Example #1
0
 /**
  * Executed when the menu is loaded
  */
 public function load()
 {
     parent::load();
     /* Don't allow visiting the edit snippet page without a valid ID */
     if (code_snippets_get_menu_slug('edit') === $_REQUEST['page']) {
         if (!isset($_REQUEST['id']) || 0 == $_REQUEST['id']) {
             wp_redirect(code_snippets_get_menu_url('add'));
             exit;
         }
     }
     /* Load the contextual help tabs */
     code_snippets_load_edit_help();
     /* Enqueue the code editor and other scripts and styles */
     add_action('admin_enqueue_scripts', 'code_snippets_enqueue_codemirror');
     add_action('admin_enqueue_scripts', array($this, 'enqueue_tagit'), 9);
     /* Register action hooks */
     if (code_snippets_get_setting('general', 'enable_description')) {
         add_action('code_snippets/admin/single', array($this, 'render_description_editor'), 9);
     }
     if (code_snippets_get_setting('general', 'enable_tags')) {
         add_action('code_snippets/admin/single', array($this, 'render_tags_editor'));
     }
     if (code_snippets_get_setting('general', 'snippet_scope_enabled')) {
         add_action('code_snippets/admin/single/settings', array($this, 'render_scope_setting'));
     }
     if (get_current_screen()->in_admin('network')) {
         add_action('code_snippets/admin/single/settings', array($this, 'render_multisite_sharing_setting'));
     }
     $this->process_actions();
 }
Example #2
0
 /**
  * Executed when the menu is loaded
  */
 public function load()
 {
     parent::load();
     $contextual_help = new Code_Snippets_Contextual_Help('import');
     $contextual_help->load();
     $this->process_import_file();
 }
 function load()
 {
     parent::load();
     if (is_network_admin()) {
         wp_redirect(code_snippets_get_menu_url('settings', 'admin'));
         exit;
     }
 }
Example #4
0
 /**
  * Executed when the admin page is loaded
  */
 function load()
 {
     parent::load();
     /* Load the contextual help tabs */
     $contextual_help = new Code_Snippets_Contextual_Help('manage');
     $contextual_help->load();
     /* Initialize the list table class */
     $this->list_table = new Code_Snippets_List_Table();
     $this->list_table->prepare_items();
 }
Example #5
0
 /**
  * Executed when the admin page is loaded
  */
 function load()
 {
     parent::load();
     /* Load the contextual help tabs */
     code_snippets_load_manage_help();
     /* Initialize the list table class */
     require_once plugin_dir_path(CODE_SNIPPETS_FILE) . 'php/class-list-table.php';
     $this->list_table = new Code_Snippets_List_Table();
     $this->list_table->prepare_items();
 }
Example #6
0
 /**
  * Executed when the menu is loaded
  */
 public function load()
 {
     parent::load();
     code_snippets_load_import_help();
     $this->process_import_file();
 }