Example #1
0
 function thb_seo_options_tab()
 {
     if (thb_is_super_user()) {
         $thb_page = thb_theme()->getAdmin()->getMainPage();
         $thb_tab = new THB_Tab(__('SEO', 'thb_text_domain'), 'seo');
         $thb_container = $thb_tab->createContainer('', 'seo_options');
         $thb_field = new THB_CheckboxField('seo_enable');
         $thb_field->setLabel(__('Enable SEO', 'thb_text_domain'));
         $thb_field->setHelp(__('This option will enable the search engines optimization component. If you mind to use an external plugin, you might want to disable it.', 'thb_text_domain'));
         $thb_container->addField($thb_field);
         $thb_field = new THB_TextField('seo_author');
         $thb_field->setLabel(__('Site author', 'thb_text_domain'));
         $thb_container->addField($thb_field);
         $thb_field = new THB_TextareaField('seo_description');
         $thb_field->setLabel(__('Site description', 'thb_text_domain'));
         $thb_container->addField($thb_field);
         $thb_field = new THB_TextareaField('seo_keywords');
         $thb_field->setLabel(__('Keywords', 'thb_text_domain'));
         $thb_container->addField($thb_field);
         $thb_field = new THB_TextField('seo_robots');
         $thb_field->setLabel(__('Robots', 'thb_text_domain'));
         $thb_container->addField($thb_field);
         $thb_field = new THB_TextField('google_site_verification');
         $thb_field->setLabel(__('Google site verification', 'thb_text_domain'));
         $thb_container->addField($thb_field);
         $thb_page->addTab($thb_tab);
     }
 }
 function thb_lang($key)
 {
     global $thb_lang;
     $translation = $key;
     if (isset($thb_lang[$key]) && $thb_lang[$key] != '') {
         $translation = $thb_lang[$key];
     } else {
         if (defined('THB_DEBUG') && THB_DEBUG === true || thb_is_super_user()) {
             $translation = '<span style="background: red; color: white;">' . $translation . '</span>';
         }
     }
     return $translation;
 }
 /**
  * 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();
         }
     }
 }
 /**
  * Save the framework settings access option.
  */
 function thb_save_super_users()
 {
     $superUsers = isset($_POST['thb_super_users']) ? $_POST['thb_super_users'] : '';
     $usernames = explode(',', $superUsers);
     array_walk($usernames, 'trim');
     if (!empty($usernames)) {
         update_option('thb_super_users', implode(',', $usernames));
     }
     $result = thb_system_raise_success(__('All saved!', 'thb_text_domain'));
     thb_system_set_flashdata($result);
     if (!thb_is_super_user()) {
         $thb_theme = thb_theme();
         $thb_theme->getAdmin()->redirectToThemePage();
     }
 }