示例#1
0
 /**
  * Constructor, init the functions inside WP
  *
  * @since   2.0.0
  * @return  \Add_Quicktag
  */
 private function __construct()
 {
     if (!is_admin()) {
         return;
     }
     // get string of plugin
     self::$plugin = plugin_basename(__FILE__);
     // on uninstall remove capability from roles
     register_uninstall_hook(__FILE__, array('Add_Quicktag', 'uninstall'));
     // on deactivate delete all settings in database
     // register_deactivation_hook( __FILE__, array('Add_Quicktag', 'uninstall' ) );
     // load translation files
     add_action('admin_init', array($this, 'localize_plugin'));
     // on init register post type for addquicktag and print js
     add_action('init', array($this, 'on_admin_init'));
     add_filter('quicktags_settings', array($this, 'remove_quicktags'), 10, 1);
 }
示例#2
0
 /**
  * Enqueue scripts and stylesheets
  * @since    0.0.2
  *
  * @internal param $where
  */
 public function print_scripts()
 {
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
     wp_register_script(self::$option_string . '_admin_script', plugins_url('/js/settings' . $suffix . '.js', parent::get_plugin_string()), array('jquery', 'quicktags'), '', TRUE);
     wp_enqueue_script(self::$option_string . '_admin_script');
     wp_register_style(self::$option_string . '_admin_style', plugins_url('/css/settings' . $suffix . '.css', parent::get_plugin_string()), array(), FALSE, 'screen');
     wp_enqueue_style(self::$option_string . '_admin_style');
 }
示例#3
0
 /**
  * Handler for the action 'init'. Instantiates this class.
  *
  * @since   2.0.0
  * @access  public
  * @return  $classobj
  */
 public static function get_object()
 {
     if (NULL === self::$classobj) {
         self::$classobj = new self();
     }
     return self::$classobj;
 }