function publicInit() { require_once ABSPATH . 'wp-admin/includes/plugin.php'; $this->prepareLibrary(); $GoogleFont = new ThemeGoogleFont(); $GoogleFont->setToStyle($this->library['style']); $this->includeLibrary(ThemeOption::getOption('responsive_mode_enable'), null, array('responsive')); $this->includeLibrary(!ThemeOption::getOption('responsive_mode_enable'), null, array('responsive-disable')); $this->includeLibrary(!class_exists('TSThemeStyle'), null, array('ts-frontend')); $this->includeLibrary(!class_exists('PBPageBuilder'), null, array('pb-frontend', 'pb-frontend-main')); $this->addLibrary('style', 2); $this->addLibrary('script', 2); $aPattern = array('rightClick' => '/^right_click_/', 'selection' => '/^copy_selection_/', 'fancyboxImage' => '/^fancybox_image_/', 'fancyboxVideo' => '/^fancybox_video_/', 'goToPageTop' => '/^go_to_page_top_/'); $option = ThemeOption::getOptionObject(); foreach ($aPattern as $indexPattern => $valuePattern) { foreach ($option as $index => $value) { if (preg_match($valuePattern, $index, $result)) { $nIndex = preg_replace($valuePattern, '', $index); $data[$indexPattern][$nIndex] = $value; } } } $data['config']['theme_url'] = THEME_URL; $param = array('l10n_print_after' => 'themeOption=' . json_encode($data) . ';'); wp_localize_script('public', 'themeOption', $param); }
<?php /******************************************************************************/ /******************************************************************************/ $Theme = new Theme(); $GoogleFont = new ThemeGoogleFont(); $GoogleFont->scheduleDownload(); add_action('admin_init', array($Theme, 'adminInit')); add_action('admin_menu', array($Theme, 'adminMenuInit')); add_action('wp_ajax_autocomplete_google_font', array($GoogleFont, 'getFontByName')); add_action('wp_ajax_theme_admin_option_page_save', array($Theme, 'adminOptionPanelSave')); add_action('wp_ajax_theme_admin_option_page_import_google_font', array($GoogleFont, 'import')); /******************************************************************************/ /******************************************************************************/