function thb_customizer_shortcut() { if (thb_system_is_development()) { $page_title = __('Customize', 'thb_text_domain'); add_theme_page($page_title, $page_title, 'edit_theme_options', 'customize.php'); } }
/** * Add a dashboard page to show notifications and display the theme * changelog. * * @return void */ public function addPage() { $installationDetails = $this->instance->getAdmin()->getInstallationDetails(); $latest_version = $installationDetails['updates']['latest_version']; $updateSpan = ''; $checkVersion = is_child_theme() ? THB_PARENT_THEME_VERSION : THB_THEME_VERSION; $themeName = is_child_theme() ? THB_PARENT_THEME_NAME : 'thb_text_domain'; if (thb_system_is_development()) { if (version_compare($checkVersion, $latest_version) < 0) { // We've got updates! $newUpdates = __('Update!', 'thb_text_domain'); $updateSpan = '<span class="update-plugins count-1"><span>' . $newUpdates . '</span></span>'; } } add_dashboard_page($themeName . ' ' . __('theme updates', 'thb_text_domain'), $themeName . ' ' . $updateSpan, 'administrator', 'thb_theme_updates', array($this, '_themeVersionPage')); }
} /** * Set the shortcode to be private. * * @return void */ public function setPrivate() { $this->_public = false; } } } /** * TinyMCE shortcodes interface. */ if (thb_system_is_development()) { if (!function_exists('thb_tinymce_add_shortcodes_button')) { function thb_tinymce_add_shortcodes_button() { if (current_user_can('edit_posts') && current_user_can('edit_pages')) { add_filter('mce_external_plugins', 'thb_add_shortcodes_plugin'); add_filter('mce_buttons', 'thb_register_shortcodes_button'); } } } add_action('admin_init', 'thb_tinymce_add_shortcodes_button'); if (!function_exists('thb_add_shortcodes_plugin')) { function thb_add_shortcodes_plugin($plugin_array) { $resource = thb_custom_resource('admin/shortcodes'); $resource = str_replace('&', '&', $resource);
function thb_system_is_production() { return !thb_system_is_development(); }
/** * Run the admin interface. * * @return void **/ public function run() { add_action('admin_init', array($this, 'savePages')); add_action('admin_init', array($this, 'appendStyles')); add_action('admin_init', array($this, 'appendScripts')); add_action('admin_init', array($this, 'appendActions')); add_action('admin_head', array($this, 'appendCustomAdminCSS')); if (is_admin() && thb_is_super_user()) { include THB_CORE_DIR . '/pages/class.backuppage.php'; thb_backup_page(); } add_action('admin_menu', array($this, 'registerPages')); // Theme installation procedure if ($this->hasJustBeenActivated()) { $this->discardAllMessages(); if ($this->firstTimeInstall()) { $this->_installationDetails['installed'] = '1'; update_option(THB_INSTALLATION_KEY, $this->_installationDetails); if (thb_system_is_development()) { $this->prepopulateInstallation(); $this->addMessage('welcome'); } do_action('thb_theme_installation', $this); } else { if (thb_system_is_development()) { $this->addMessage('activation'); } do_action('thb_theme_activation', $this); } if (thb_system_is_development()) { $this->redirectToThemePage(); } } }