Ejemplo n.º 1
0
 /**
  * Initialize the plugin by loading admin scripts & styles and adding a
  * settings page and menu.
  *
  */
 private function __construct()
 {
     /*
      * Call $plugin_slug from public plugin class.
      *
      */
     $plugin = anspress::get_instance();
     $this->plugin_slug = $plugin->get_plugin_slug();
     add_action('current_screen', array($this, 'redirect_to_install_page'));
     // Load admin style sheet and JavaScript.
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
     // Add the options page and menu item.
     add_action('admin_menu', array($this, 'add_plugin_admin_menu'));
     // Add an action link pointing to the options page.
     $plugin_basename = plugin_basename(plugin_dir_path(__DIR__) . $this->plugin_slug . '.php');
     add_filter('plugin_action_links_' . $plugin_basename, array($this, 'add_action_links'));
     add_action('admin_init', array($this, 'register_setting'));
     // flush rewrite rule if option updated
     add_action('admin_init', array($this, 'init_actions'));
     add_action('admin_head-nav-menus.php', array($this, 'ap_menu_metaboxes'));
     add_action('parent_file', array($this, 'tax_menu_correction'));
     add_action('load-post.php', array($this, 'question_meta_box_class'));
     add_action('load-post-new.php', array($this, 'question_meta_box_class'));
     //add_action( 'show_user_profile', array($this, 'user_roles_fields') );
     //add_action( 'edit_user_profile', array($this, 'user_roles_fields') );
     //add_action( 'personal_options_update', array($this, 'save_user_roles_fields') );
     //add_action( 'edit_user_profile_update', array($this, 'save_user_roles_fields') );
     add_action('wp_ajax_ap_save_options', array($this, 'ap_save_options'));
     add_action('wp_ajax_ap_edit_points', array($this, 'ap_edit_points'));
     add_action('wp_ajax_ap_save_points', array($this, 'ap_save_points'));
     add_action('wp_ajax_ap_new_point_form', array($this, 'ap_new_point_form'));
     add_action('wp_ajax_ap_delete_point', array($this, 'ap_delete_point'));
     add_action('admin_menu', array($this, 'change_post_menu_label'));
     add_action('wp_ajax_ap_edit_badges', array($this, 'ap_edit_badges'));
     add_action('wp_ajax_ap_save_badges', array($this, 'ap_save_badges'));
     add_action('wp_ajax_ap_new_badge_form', array($this, 'ap_new_badge_form'));
     add_action('wp_ajax_ap_delete_badge', array($this, 'ap_delete_badge'));
     add_action('wp_ajax_ap_toggle_addon', array($this, 'ap_toggle_addon'));
     add_action('wp_ajax_ap_install_base_page', array($this, 'ap_install_base_page'));
     add_action('wp_ajax_ap_install_default_opt', array($this, 'ap_install_default_opt'));
     add_action('wp_ajax_ap_install_data_table', array($this, 'ap_install_data_table'));
     add_action('wp_ajax_ap_install_rewrite_rules', array($this, 'ap_install_rewrite_rules'));
     add_action('wp_ajax_ap_install_finish', array($this, 'ap_install_finish'));
     add_action('save_post', array($this, 'update_rewrite'));
 }
Ejemplo n.º 2
0
 /**
  * Return an instance of this class.
  *
  * @since     1.0.0
  *
  * @return    object    A single instance of this class.
  */
 public static function get_instance()
 {
     // If the single instance hasn't been set, set it now.
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }