/** * Main page options tab. */ function thb_portfolio_options() { if (thb_portfolio_framework_check() && thb_portfolio_config('options')) { $thb_page = thb_theme()->getAdmin()->getMainPage(); $thb_tab = new THB_Tab(__('Portfolio', 'thb-portfolio'), 'portfolio'); $thb_container = $thb_tab->createContainer('', 'single_work_options'); $thb_field = new THB_TextField('works_url_slug'); $thb_field->setLabel(__('URL slug', 'thb-portfolio')); $thb_field->setHelp(sprintf(__('URL slug for Portfolio items. Defaults to "works". Remember to <a href="%s">re-save the site\'s permalinks</a>.', 'thb-portfolio'), admin_url('options-permalink.php'))); $thb_container->addField($thb_field); if (thb_portfolio_config('works_navigation')) { $thb_field = new THB_YesNoField('works_navigation'); $thb_field->setLabel(__('Enable navigation between Portfolio items', 'thb-portfolio')); $thb_container->addField($thb_field); } if (thb_portfolio_config('portfolio_index')) { $thb_field = new THB_SelectField('portfolio_index'); $thb_field->setLabel(__('Select the Portfolio index', 'thb-portfolio')); $thb_field->setHelp(__('Choose the index page for your portfolio items "back to portfolio" link.', 'thb-portfolio')); $thb_field->setOptions(thb_get_pages_for_select('template-portfolio.php')); $thb_container->addField($thb_field); } $thb_page->addTab($thb_tab); } }
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_backup_page() { $thb_theme = thb_theme(); $thb_page = new THB_BackupPage(__('Framework settings', 'thb_text_domain'), 'thb-framework_settings'); // General --------------------------------------------------------- $thb_tab = new THB_StaticTab(__('General', 'thb_text_domain'), 'general'); $thb_tab->setAction('thb_save_super_users'); $thb_tab->setSubmitLabel(__('Save changes', 'thb_text_domain')); $thb_container = $thb_tab->createContainer('', 'framework_settings_container'); $thb_field = new THB_TextField('thb_super_users'); $thb_field->setStaticOption('thb_super_users'); $thb_field->setLabel(__('Super users', 'thb_text_domain')); $thb_field->setHelp(sprintf(__('Enter a list of comma separated usernames to hide this page from other users. Can be reset from the <a href="%s">WP options page</a> under <code>thb_super_users</code>.', 'thb_text_domain'), admin_url('options.php'))); $thb_container->addField($thb_field); $thb_page->addTab($thb_tab); // Admin customizations -------------------------------------------- $thb_tab = new THB_Tab(__('Admin customizations', 'thb_text_domain'), 'thb_admin_customizations'); $thb_container = $thb_tab->createContainer('', 'admin_customizations'); $thb_field = new THB_UploadField('login_logo'); $thb_field->setLabel(__('Login logo', 'thb_text_domain')); $thb_field->setValue(thb_get_option('login_logo')); $thb_field->setHelp(__('Upload an image to be used as a logo in the login screen of your site. Please remember to load a properly dimensioned logo.', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextareaField('admin_css'); $thb_field->setAllowCode(); $thb_field->setValue(thb_get_option('admin_css')); $thb_field->setLabel(__('Custom admin CSS', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_page->addTab($thb_tab); // Export options -------------------------------------------------- $thb_tab = new THB_StaticTab(__('Export', 'thb_text_domain'), 'export'); $thb_tab->setAction('thb_export'); $thb_tab->setSubmitLabel(__('Export', 'thb_text_domain')); $thb_container = $thb_tab->createContainer('', 'export_container'); $thb_container->setIntroText(__('Backup your duplicable content (slides, meta fields, etc.), options and customizations to the theme\'s appearance. Upon clicking on the Export button, the browser will prompt you to save a file with a <code>.thb-backup</code> extension which will contain your settings, encrypted.', 'thb_text_domain')); $thb_export_duplicable = new THB_CheckboxField('export_duplicable'); $thb_export_duplicable->setLabel(__('Export duplicable content', 'thb_text_domain')); $thb_export_duplicable->setValue('1'); $thb_container->addField($thb_export_duplicable); $thb_export_options = new THB_CheckboxField('export_options'); $thb_export_options->setLabel(__('Export options', 'thb_text_domain')); $thb_export_options->setValue('1'); $thb_container->addField($thb_export_options); $thb_export_skin = new THB_CheckboxField('export_mods'); $thb_export_skin->setLabel(__('Export skin', 'thb_text_domain')); $thb_export_skin->setValue('1'); $thb_container->addField($thb_export_skin); $thb_page->addTab($thb_tab); // Import options -------------------------------------------------- $thb_tab = new THB_StaticTab(__('Import', 'thb_text_domain'), 'import'); $thb_tab->setAction('thb_import'); $thb_tab->setSubmitLabel(__('Import', 'thb_text_domain')); $thb_container = $thb_tab->createContainer('', 'import_container'); $thb_container->setIntroText(__('Import a previously saved <code>.thb-backup</code> file. Please note that this will completely overwrite your options or skin settings.', 'thb_text_domain')); $thb_upload = new THB_ClassicUploadField('import_data'); $thb_upload->setLabel(__('Upload backup file', 'thb_text_domain')); $thb_container->addField($thb_upload); $thb_page->addTab($thb_tab); $thb_theme->getAdmin()->addPage($thb_page); }
/** * Order tabs by their registered index. * * @param THB_Tab $a First tab to compare. * @param THB_Tab $b Second tab to compare. * @return int */ public function orderTabs($a, $b) { if ($a->getIndex() == $b->getIndex()) { return 0; } return $a->getIndex() < $b->getIndex() ? -1 : 1; }
if ($lightbox_enable) { $thb_lightbox = thb_get_module_url('core/lightbox/submodules/magnific-popup'); if (thb_config('core/lightbox/submodules/magnific-popup', 'skin') == false) { $thb_theme->getFrontend()->addStyle($thb_lightbox . '/css/magnific-popup.css'); } $thb_theme->getFrontend()->addScript($thb_lightbox . '/js/jquery.magnific-popup.min.js'); if (thb_get_option('enable_lightbox_images') == 1) { $thb_theme->getFrontend()->addScript($thb_lightbox . '/js/thb.lightbox.config_images.js'); } if (thb_get_option('enable_lightbox_videos') == 1) { $thb_theme->getFrontend()->addScript($thb_lightbox . '/js/thb.lightbox.config_videos.js'); } $thb_theme->getFrontend()->addScript($thb_lightbox . '/js/thb.lightbox.js'); } /** * Theme options tab * ----------------------------------------------------------------------------- */ if (thb_config('core/lightbox/submodules/magnific-popup', 'options')) { $thb_page = $thb_theme->getAdmin()->getMainPage(); $thb_tab = new THB_Tab(__('Lightbox', 'thb_text_domain'), 'lightbox'); $thb_container = $thb_tab->createContainer('', 'lightbox_options'); $thb_container->setIntroText(__('Powered by Magnific Popup. If you mind to use another plugin, you might want to disable this feature.', 'thb_text_domain')); $thb_field = new THB_CheckboxField('enable_lightbox_images'); $thb_field->setLabel(__('Enable lightbox for images', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_CheckboxField('enable_lightbox_videos'); $thb_field->setLabel(__('Enable lightbox for links to video pages and files', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_page->addTab($thb_tab); }
} add_theme_support('woocommerce'); // Disable WooCommerce styles if (thb_config('core/woocommerce', 'disable_core_skin')) { add_filter('woocommerce_enqueue_styles', '__return_empty_array'); } /** * Woocommerce product page sidebar * ----------------------------------------------------------------------------- */ /** * Theme options tab * ----------------------------------------------------------------------------- */ $thb_page = $thb_theme->getAdmin()->getMainPage(); $thb_tab = new THB_Tab(__('WooCommerce', 'thb_text_domain'), 'woocommerce'); $thb_container = $thb_tab->createContainer(__('Shop page options', 'thb_text_domain'), 'woocommerce_shop_options'); $thb_field = new THB_SelectField('shop_columns'); $thb_field->setLabel(__('Columns layout', 'thb_text_domain')); $thb_field->setOptions(array('3' => '3', '4' => '4')); $thb_container->addField($thb_field); $thb_field = new THB_SelectField('shop_sidebar'); $thb_field->setLabel(__('Shop page sidebar', 'thb_text_domain')); $thb_field->setOptions(array(0 => __('No sidebar', 'thb_text_domain'))); $thb_field->setDynamicOptions('thb_get_sidebars_for_select'); $thb_container->addField($thb_field); $thb_field = new THB_SelectField('shop_sidebar_position'); $thb_field->setLabel(__('Shop page sidebar position', 'thb_text_domain')); $thb_field->setOptions(array('sidebar-left' => __('Left', 'thb_text_domain'), 'sidebar-right' => __('Right', 'thb_text_domain'))); $thb_container->addField($thb_field); $thb_field = new THB_NumberField('shop_products_per_page');
* Redistribuitions of files must retain the above copyright notice. * * @package Modules\Core\Social * @author The Happy Bit <*****@*****.**> * @copyright Copyright 2012, Andrea Gandino & Simone Maranzana * @link http:// * @since The Happy Framework v 1.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ $thb_theme = thb_theme(); /** * Social options tab * ----------------------------------------------------------------------------- */ $thb_page = $thb_theme->getAdmin()->getMainPage(); $thb_tab = new THB_Tab(__('Social', 'thb_text_domain'), 'social'); $thb_container = $thb_tab->createContainer('', 'social_options'); $thb_field = new THB_TextField('social_twitter'); $thb_field->setLabel(__('Twitter', 'thb_text_domain')); $thb_field->setHelp(__('Enter your Twitter URL.', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextField('social_facebook'); $thb_field->setLabel(__('Facebook', 'thb_text_domain')); $thb_field->setHelp(__('Enter your Facebook URL.', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextField('social_googleplus'); $thb_field->setLabel(__('Google+', 'thb_text_domain')); $thb_field->setHelp(__('Enter your Google+ URL', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextField('social_flickr'); $thb_field->setLabel(__('Flickr', 'thb_text_domain'));
$thb_container->addField($thb_field); } } } if (thb_check_template_config('core/portfolio', 'templates')) { add_action('wp_loaded', 'thb_add_portfolio_metabox'); } } } /** * Portfolio general options * ----------------------------------------------------------------------------- */ if (thb_config('core/portfolio', 'options')) { $thb_page = $thb_theme->getAdmin()->getMainPage(); $thb_tab = new THB_Tab(__('Portfolio', 'thb_text_domain'), 'portfolio'); $thb_container = $thb_tab->createContainer('', 'single_work_options'); $thb_field = new THB_TextField('works_url_slug'); $thb_field->setLabel(__('URL slug', 'thb_text_domain')); $thb_field->setHelp(sprintf(__('URL slug for Portfolio items. Defaults to "works". Remember to <a href="%s">re-save the site\'s permalinks</a>.', 'thb_text_domain'), admin_url('options-permalink.php'))); $thb_container->addField($thb_field); if (thb_config('core/portfolio', 'works_navigation')) { $thb_field = new THB_YesNoField('works_navigation'); $thb_field->setLabel(__('Enable navigation between Portfolio items', 'thb_text_domain')); $thb_container->addField($thb_field); } $thb_page->addTab($thb_tab); } /** * Single Portfolio item * -----------------------------------------------------------------------------
* @since The Happy Framework v 1.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ $thb_theme = thb_theme(); /** * Module configuration * ----------------------------------------------------------------------------- */ $thb_config = array('options' => true, 'options_logo_position' => array('logo-left' => __('Left', 'thb_text_domain'), 'logo-center' => __('Center', 'thb_text_domain'), 'logo-right' => __('Right', 'thb_text_domain')), 'meta_options' => true, 'meta_options_subtitle' => true, 'meta_options_pageheader_disable' => true, 'meta_options_page_boxed' => true, 'meta_options_gutter' => true, 'meta_options_gutter_default' => true); $thb_theme->setConfig('core/layout', thb_array_asum($thb_config, $config)); /** * Options tab * ----------------------------------------------------------------------------- */ $thb_page = $thb_theme->getAdmin()->getMainPage(); $thb_tab = new THB_Tab(__('Layout', 'thb_text_domain'), 'layout'); /** * Header */ $thb_container = $thb_tab->createContainer(__('Header', 'thb_text_domain'), 'layout_options_header'); if (thb_config('core/layout', 'options_logo_position') !== false) { $thb_field = new THB_SelectField('logo_position'); $thb_field->setLabel(__('Logo position', 'thb_text_domain')); $thb_field->setOptions(thb_config('core/layout', 'options_logo_position')); $thb_container->addField($thb_field); } /** * Footer */ $thb_container = $thb_tab->createContainer(__('Footer', 'thb_text_domain'), 'layout_options_footer'); /**