Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 32 |
|
0.00% |
0 / 3 |
CRAP | n/a |
0 / 0 |
|
| _wpcom_fiverr_enqueue_scripts | |
0.00% |
0 / 17 |
|
0.00% |
0 / 1 |
2 | |||
| _wpcom_fiverr | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| _wpcom_fiverr_cta | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Adds a fiverr logo maker cta to the general settings page |
| 4 | * |
| 5 | * @package automattic/jetpack-mu-wpcom |
| 6 | */ |
| 7 | |
| 8 | use Automattic\Jetpack\Jetpack_Mu_Wpcom; |
| 9 | |
| 10 | /** |
| 11 | * Enqueue assets needed by the fiverr cta. |
| 12 | */ |
| 13 | function _wpcom_fiverr_enqueue_scripts() { |
| 14 | $asset_file = include Jetpack_Mu_Wpcom::BASE_DIR . 'build/wpcom-fiverr/wpcom-fiverr.asset.php'; |
| 15 | |
| 16 | wp_enqueue_style( |
| 17 | 'wpcom-fiverr', |
| 18 | plugins_url( 'build/wpcom-fiverr/wpcom-fiverr.css', Jetpack_Mu_Wpcom::BASE_FILE ), |
| 19 | array(), |
| 20 | $asset_file['version'] ?? filemtime( Jetpack_Mu_Wpcom::BASE_DIR . 'build/wpcom-fiverr/wpcom-fiverr.css' ) |
| 21 | ); |
| 22 | |
| 23 | wp_enqueue_script( |
| 24 | 'wpcom-fiverr', |
| 25 | plugins_url( 'build/wpcom-fiverr/wpcom-fiverr.js', Jetpack_Mu_Wpcom::BASE_FILE ), |
| 26 | $asset_file['dependencies'] ?? array(), |
| 27 | $asset_file['version'] ?? filemtime( Jetpack_Mu_Wpcom::BASE_DIR . 'build/wpcom-fiverr/wpcom-fiverr.js' ), |
| 28 | array( |
| 29 | 'strategy' => 'defer', |
| 30 | 'in_footer' => false, |
| 31 | ) |
| 32 | ); |
| 33 | } |
| 34 | add_action( 'admin_enqueue_scripts', '_wpcom_fiverr_enqueue_scripts' ); |
| 35 | |
| 36 | /** |
| 37 | * Add the fiverr cta to the general settings page. |
| 38 | */ |
| 39 | function _wpcom_fiverr() { |
| 40 | add_settings_field( 'wpcom_fiverr_cta', '', '_wpcom_fiverr_cta', 'general', 'default' ); |
| 41 | } |
| 42 | add_action( 'admin_init', '_wpcom_fiverr' ); |
| 43 | |
| 44 | /** |
| 45 | * Display the fiverr cta on the general settings page. |
| 46 | */ |
| 47 | function _wpcom_fiverr_cta() { |
| 48 | ?> |
| 49 | <tr class="wpcom-fiverr-cta"> |
| 50 | <th> |
| 51 | <?php esc_html_e( 'Site Logo', 'jetpack-mu-wpcom' ); ?> |
| 52 | </th> |
| 53 | <td> |
| 54 | <p><b><?php esc_html_e( 'Make an incredible logo in minutes', 'jetpack-mu-wpcom' ); ?></b></p> |
| 55 | <p><?php esc_html_e( 'Pre-designed by top talent. Just add your touch.', 'jetpack-mu-wpcom' ); ?></p> |
| 56 | <button class="wpcom-fiverr-cta-button button"> |
| 57 | <svg width="20" height="20" viewBox="0 0 500 500" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 58 | <circle cx="250" cy="250" r="177" fill="white"/> |
| 59 | <path d="M500 250C500 111.93 388.07 0 250 0C111.93 0 0 111.93 0 250C0 388.07 111.93 500 250 500C388.07 500 500 388.07 500 250ZM360.42 382.5H294.77V237.2H231.94V382.5H165.9V237.2H128.45V183.45H165.9V167.13C165.9 124.54 198.12 95.48 246.05 95.48H294.78V149.22H256.93C241.62 149.22 231.95 157.58 231.95 171.12V183.45H360.43V382.5H360.42Z" fill="#1DBF73"/> |
| 60 | </svg> |
| 61 | <?php esc_html_e( 'Try Fiverr Logo Maker', 'jetpack-mu-wpcom' ); ?> |
| 62 | </button> |
| 63 | </td> |
| 64 | </tr> |
| 65 | <?php |
| 66 | } |