/** * 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(); }
/** * 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 */ $contextual_help = new Code_Snippets_Contextual_Help('edit'); $contextual_help->load(); /* 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(); }
/** * 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(); }