コード例 #1
0
 function __construct()
 {
     $this->plugin_meta = get_plugin_meta_wpcomment();
     $this->title = __('Select-box Input', 'nm-wpcomments');
     $this->desc = __('regular select-box input', 'nm-wpcomments');
     $this->settings = self::get_settings();
 }
コード例 #2
0
 function __construct()
 {
     $this->plugin_meta = get_plugin_meta_wpcomment();
     $this->title = __('File Input', 'nm-wpcomments');
     $this->desc = __('regular file input', 'nm-wpcomments');
     $this->settings = self::get_settings();
     $this->input_scripts = array('shipped' => array(''), 'custom' => array(array('script_name' => 'plupload_script', 'script_source' => '/js/uploader/plupload.full.min.js', 'localized' => false, 'type' => 'js', 'depends' => array('jquery'), 'in_footer' => '')));
     add_action('wp_enqueue_scripts', array($this, 'load_input_scripts'));
 }
コード例 #3
0
 function __construct()
 {
     //setting plugin meta saved in config.php
     $this->plugin_meta = get_plugin_meta_wpcomment();
     //getting saved settings
     $this->plugin_settings = get_option($this->plugin_meta['shortname'] . '_settings');
     /*
      * [1]
      * TODO: change this for plugin admin pages
      */
     $this->menu_pages = array(array('page_title' => $this->plugin_meta['name'], 'menu_title' => $this->plugin_meta['name'], 'cap' => 'manage_options', 'slug' => $this->plugin_meta['shortname'], 'callback' => 'main_settings', 'parent_slug' => ''));
     /*
      * [2]
      * TODO: Change this for admin related scripts
      * JS scripts and styles to loaded
      * ADMIN
      */
     $this->plugin_scripts_admin = array(array('script_name' => 'scripts-global', 'script_source' => '/js/nm-global.js', 'localized' => false, 'type' => 'js', 'page_slug' => $this->plugin_meta['shortname']), array('script_name' => 'scripts-admin', 'script_source' => '/js/admin.js', 'localized' => true, 'type' => 'js', 'page_slug' => $this->plugin_meta['shortname'], 'depends' => array('jquery', 'jquery-ui-accordion', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-slider', 'jquery-ui-dialog', 'jquery-ui-tabs', 'media-upload', 'thickbox')), array('script_name' => 'ui-style', 'script_source' => '/js/ui/css/smoothness/jquery-ui-1.10.3.custom.min.css', 'localized' => false, 'type' => 'style', 'page_slug' => $this->plugin_meta['shortname'], 'depends' => ''));
     add_action('admin_menu', array($this, 'add_menu_pages'));
 }
コード例 #4
0
 /**
  * __construct function.
  *
  * @access public
  * @param 
  */
 public function __construct()
 {
     $this->plugin_meta = get_plugin_meta_wpcomment();
 }
コード例 #5
0
 function _setup()
 {
     //setting plugin meta saved in config.php
     $this->plugin_meta = get_plugin_meta_wpcomment();
     //getting saved settings
     $this->plugin_settings = get_option($this->plugin_meta['shortname'] . '_settings');
     // populating $inputs with NM_Inputs object
     $this->inputs = $this->get_all_inputs();
     /*
      * [2]
      * TODO: update scripts array for SHIPPED scripts
      * only use handlers
      */
     //setting shipped scripts
     $this->wp_shipped_scripts = array('jquery');
     /*
      * [3]
      * TODO: update scripts array for custom scripts/styles
      */
     //setting plugin settings
     $this->plugin_scripts = array(array('script_name' => 'scripts', 'script_source' => '/js/script.js', 'localized' => true, 'type' => 'js'), array('script_name' => 'styles', 'script_source' => '/plugin.styles.css', 'localized' => false, 'type' => 'style'));
     /*
      * [4]
      * TODO: localized array that will be used in JS files
      * Localized object will always be your pluginshortname_vars
      * e.g: pluginshortname_vars.ajaxurl
      */
     $this->localized_vars = array('ajaxurl' => admin_url('admin-ajax.php'), 'plugin_url' => $this->plugin_meta['url'], 'settings' => $this->plugin_settings);
     /*
      * [5]
      * TODO: this array will grow as plugin grow
      * all functions which need to be called back MUST be in this array
      * setting callbacks
      */
     //following array are functions name and ajax callback handlers
     $this->ajax_callbacks = array('save_settings', 'save_file_meta');
     /*
      * plugin localization being initiated here
      */
     add_action('init', array($this, 'wpp_textdomain'));
     /*
      * hooking up scripts for front-end
      */
     add_action('wp_enqueue_scripts', array($this, 'load_scripts'));
     /*
      * registering callbacks
      */
     $this->do_callbacks();
     /*
      * Action hooks for comment fields
      */
     add_action('comment_form_after_fields', array($this, 'render_comments_meta_fields'));
     add_action('comment_form_logged_in_after', array($this, 'render_comments_meta_fields'));
     /*
      * Saving comment meta
      */
     add_action('comment_post', array($this, 'save_comment_meta_fields'));
     /*
      * adding meta box in comments edit page
      */
     add_action('add_meta_boxes_comment', array($this, 'render_comment_meta_admin_box'), 1);
     /**
      * adding comment meta in front view
      */
     add_filter('comment_text', array($this, 'render_comment_meta_front'), 100);
     /**
      * validating comments
      */
     add_filter('preprocess_comment', array($this, 'verify_comment_meta_data'));
 }