| 1 |
<?php |
| 2 |
/** |
| 3 |
* The class for wp_media extends |
| 4 |
* |
| 5 |
* @link http://webdeclic.com |
| 6 |
* @since 1.0.0 |
| 7 |
* |
| 8 |
* @package Quickwebp |
| 9 |
* @subpackage Quickwebp/admin |
| 10 |
*/ |
| 11 |
class Quickwebp_Wp_Media_Extends { |
| 12 |
|
| 13 |
/** |
| 14 |
* The ID of this plugin. |
| 15 |
* |
| 16 |
* @since 1.0.0 |
| 17 |
* @access private |
| 18 |
* @var string $plugin_name The ID of this plugin. |
| 19 |
*/ |
| 20 |
private $plugin_name; |
| 21 |
|
| 22 |
/** |
| 23 |
* The version of this plugin. |
| 24 |
* |
| 25 |
* @since 1.0.0 |
| 26 |
* @access private |
| 27 |
* @var string $version The current version of this plugin. |
| 28 |
*/ |
| 29 |
private $version; |
| 30 |
|
| 31 |
/** |
| 32 |
* Initialize the class and set its properties. |
| 33 |
* |
| 34 |
* @since 1.0.0 |
| 35 |
* @param string $plugin_name The name of this plugin. |
| 36 |
* @param string $version The version of this plugin. |
| 37 |
*/ |
| 38 |
public function __construct( $plugin_name, $version ) { |
| 39 |
|
| 40 |
$this->plugin_name = $plugin_name; |
| 41 |
$this->version = $version; |
| 42 |
|
| 43 |
} |
| 44 |
|
| 45 |
public function enqueue_scripts(){ |
| 46 |
global $pagenow; |
| 47 |
if(get_option('quickwebp_settings_paste_image', quickwebp_settings_default('quickwebp_settings_paste_image')) != '1'){ |
| 48 |
return; |
| 49 |
} |
| 50 |
|
| 51 |
$wp_media_extends_assets = include( QUICKWEBP_PLUGIN_PATH . 'public/assets/build/wp-media-extends.asset.php' ); |
| 52 |
wp_enqueue_script( 'quickwebp-wp-media-extends', QUICKWEBP_PLUGIN_URL . 'public/assets/build/wp-media-extends.js', $wp_media_extends_assets['dependencies'], $wp_media_extends_assets['version'], true ); |
| 53 |
wp_localize_script( 'quickwebp-wp-media-extends', 'quickwebp_wp_media_extends', array( |
| 54 |
'is_upload_page' => $pagenow ? $pagenow === 'upload.php' : false, |
| 55 |
'nonce' => wp_create_nonce( 'media-form' ), |
| 56 |
'prompt_text' => __( 'Please enter the name of your image', QUICKWEBP_TEXT_DOMAIN ), |
| 57 |
) ); |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
} |