add_doc_hooks( $instance ); } // Define some prefixes to use througout the plugin. $this->assets_prefix = strtolower( preg_replace( '/\B([A-Z])/', '-$1', __NAMESPACE__ ) ); $this->meta_prefix = strtolower( preg_replace( '/\B([A-Z])/', '_$1', __NAMESPACE__ ) ); } /** * Register MU Script * * @action wp_enqueue_scripts */ public function register_assets() { $propertyid = get_option( 'sharethis_property_id' ); $propertyid = false !== $propertyid && null !== $propertyid ? explode( '-', $propertyid, 2 ) : array(); $first_prod = get_option( 'sharethis_first_product' ); $first_prod = false !== $first_prod && null !== $first_prod ? $first_prod : ''; if ( is_array( $propertyid ) && array() !== $propertyid ) { wp_register_script( "{$this->assets_prefix}-mu", "//platform-api.sharethis.com/js/sharethis.js#property={$propertyid[0]}&product={$first_prod}-buttons", array(), SHARETHIS_SHARE_BUTTONS_VERSION, false ); } // Register style sheet for sticky hiding. wp_register_style( "{$this->assets_prefix}-sticky", "{$this->dir_url}css/mu-style.css", array(), filemtime( "{$this->dir_path}css/mu-style.css" ) ); } /** * Register admin scripts/styles. * * @action admin_enqueue_scripts */ public function register_admin_assets() { wp_register_script( "{$this->assets_prefix}-mua", '//platform-api.sharethis.com/js/sharethis.js?product=inline-share-buttons', array(), SHARETHIS_SHARE_BUTTONS_VERSION, false ); wp_register_script( "{$this->assets_prefix}-admin", "{$this->dir_url}js/admin.js", array( 'jquery', 'jquery-ui-sortable', 'wp-util' ), filemtime( "{$this->dir_path}js/admin.js" ), false ); wp_register_script( "{$this->assets_prefix}-meta-box", "{$this->dir_url}js/meta-box.js", array( 'jquery', 'wp-util' ), filemtime( "{$this->dir_path}js/meta-box.js" ), false ); wp_register_script( "{$this->assets_prefix}-credentials", "{$this->dir_url}js/set-credentials.js", array( 'jquery', 'jquery-ui-sortable', 'wp-util' ), time(), false ); wp_register_style( "{$this->assets_prefix}-admin", "{$this->dir_url}css/admin.css", array(), filemtime( "{$this->dir_path}css/admin.css" ) ); wp_register_style( "{$this->assets_prefix}-meta-box", "{$this->dir_url}css/meta-box.css", array(), filemtime( "{$this->dir_path}css/meta-box.css" ) ); } }