final class thesis_skin_manager { public function __construct() { } public $class = null; public $name = null; public $table = null; public $table_suffix = 'thesis_backups'; // Suffix to identify the Thesis Backups table public $options = array( public function __construct($skin = array()) { // allow in all environments except the front end extract($skin); // $class, $name $this->class = !empty($class) ? trim($this->verify_class_name($class)) : false; $this->name = isset($name) ? $name : false; $this->table = $wpdb->prefix. $this->table_suffix; $this->defaults($thesis->skin->_skin, 'new'); // TODO: The Exporter could probably be run through ajax like everything else... add_action('admin_post_export_skin', array($this, 'export')); add_action('wp_ajax_backup_skin', array($this, 'backup')); add_action('wp_ajax_update_backup_skin_table', array($this, 'update_backup')); add_action('wp_ajax_restore_skin_backup', array($this, 'restore_backup')); add_action('wp_ajax_delete_skin_backup', array($this, 'delete_backup')); add_action('wp_ajax_restore_skin_default', array($this, 'restore_default')); } } /*---:[ Skin Manager interface ]:---*/ public function editor() { return "$tab

". sprintf(__('Manage %s Skin Data', 'thesis'), $this->name). "

\n". "$tab
\n". "$tab\t

". __('Backup Skin Data', 'thesis'). "

\n". "$tab\t

". __('Create a Skin backup that you can restore at any time.', 'thesis'). "

\n". "$tab\t\n". "$tab
\n". (current_user_can('manage_options') ? "$tab
\n". "$tab\t

". __('Import Skin Data', 'thesis'). "

\n". "$tab\t

". __('Import Skin data from a Thesis Skin export file.', 'thesis'). "

\n". "$tab\t\n". "$tab
\n" : ''). "$tab
\n". "$tab\t

". __('Restore Default Data', 'thesis'). "

\n". "$tab\t

". sprintf(__('Restore default data for the %s Skin.', 'thesis'), $this->name). "

\n". "$tab\t\n". "$tab
\n". "$tab
\n". "$tab\t

". $thesis->api->efn(sprintf(__('%s Skin Backups', 'thesis'), $this->name)). "

\n". "$tab\t
\n". $this->backup_table(). "$tab\t
\n". "$tab
\n". $thesis->api->popup(array( "$tab\t\t\t
\n". $export['output']. "$tab\t\t\t\t\n". "$tab\t\t\t\t\n". "$tab\t\t\t\t". wp_nonce_field('thesis-skin-export', '_wpnonce-thesis-skin-export', true, false). "\n". "$tab\t\t\t
\n")). (current_user_can('manage_options') ? $thesis->api->popup(array( $thesis->api->popup(array( "$tab\t\t\t
\n". (file_exists(THESIS_USER_SKIN. '/default.php') ? $default['output']. "$tab\t\t\t\t\n" : "$tab\t\t\t\t

". __('Your Skin does not have the ability to restore individual data components. Hit the button below to restore all default settings.', 'thesis'). "

\n". "$tab\t\t\t\t\n"). "$tab\t\t\t\t". wp_nonce_field('thesis-restore-defaults', '_wpnonce-thesis-restore-defaults', true, false). "\n". "$tab\t\t\t
\n")). "$tab". wp_nonce_field('thesis-skin-manager', '_wpnonce-thesis-skin-manager', true, false). "\n"; } public function backup_table() { foreach ((is_array($points = $this->get()) ? $points : array()) as $id => $backup) { foreach ($backup as $prop => $val) { $td .= "\t\t\t\t\t\t$value\n"; } $backups .= "\t\t\t\t\t\n". $td. "\t\t\t\t\t\t\n". "\t\t\t\t\t\t\n". "\t\t\t\t\t\t\n". "\t\t\t\t\t\n"; } return "\t\t\t\n". "\t\t\t\t\n". "\t\t\t\t\t\n". "\t\t\t\t\t\t\n". "\t\t\t\t\t\t\n". "\t\t\t\t\t\t\n". "\t\t\t\t\t\t\n". "\t\t\t\t\t\t\n". "\t\t\t\t\t\n". "\t\t\t\t\n". "\t\t\t\t\n". $backups. "\t\t\t\t\n". "\t\t\t
". __('Backup Date', 'thesis'). "". __('Notes', 'thesis'). "". __('Restore', 'thesis'). "". __('Export', 'thesis'). "". __('Delete', 'thesis'). "
\n"; } /*---:[ Skin Manager core database actions ]:---*/ public function add($notes = false, $skin = false) { wp_cache_flush(); // make sure we have the latest by flushing the cache first foreach ($this->options as $option) $data[$option] = get_option("{$skin}_{$option}"); // fetch options return true; // there are no options, so we don't need to save anything. $data['notes'] = $notes; $data['time'] = current_time('timestamp'); // add timestamp $data['class'] = $skin; // add Skin class return (bool) $wpdb->insert($this->table, $data); // return true on success, false on failure } public function delete($id = false) { return false; return (bool) $wpdb->delete($this->table, $where); } public function get() { return false; foreach ($results as $result) $valid[absint(maybe_unserialize($result['ID']))] = array( krsort($valid); return empty($valid) ? array() : $valid; } public function get_entry($id = false) { return false; return !empty($result['class']) && $result['class'] === $this->class ? $result : false; } /*---:[ ajax data handling methods ]:---*/ public function backup() { $thesis->wp->check(); $thesis->wp->nonce($_POST['nonce'], 'thesis-skin-manager'); echo $thesis->api->alert($this->add(stripslashes($_POST['note'])) === false ? __('Backup failed.', 'thesis') : __('Backup complete!', 'thesis'), 'manager_saved', true); } /* — Called when the backup table is updated with a new entry — Echoes a new backup_table() based on the most recent (updated) data */ public function update_backup() { $thesis->wp->check(); $thesis->wp->nonce($_POST['nonce'], 'thesis-skin-manager'); echo $this->backup_table(); } /* — Wholesale replaces all Skin options — Any options present in the requested backup state will be restored — Any options not present will be deleted (and will revert to defaults, if applicable) */ public function restore_backup() { $thesis->wp->check(); $thesis->wp->nonce($_POST['nonce'], 'thesis-skin-manager'); // Remove data that is not needed for the restoration unset($result['ID'], $result['time'], $result['class'], $result['notes']); $this->automatic_backup(__('Restore Skin data', 'thesis')); foreach (array_filter($result) as $key => $check) $verified[$key] = $value; foreach ($this->options as $option) { update_option("{$this->class}_$option", $verified[$option]); else delete_option("{$this->class}_$option"); } wp_cache_flush(); $thesis->skin->_write_css(); } } public function delete_backup() { $thesis->wp->check(); $thesis->wp->nonce($_POST['nonce'], 'thesis-skin-manager'); echo $thesis->api->alert($this->delete((int) $_POST['id']) === false ? __('Deletion failed.', 'thesis') : __('Backup deleted!', 'thesis'), 'manager_saved', true); } /* Export selected Skin data items — Generates a serialized Thesis Skin import file (.txt) with selected options (even if they are empty) */ public function export() { $thesis->wp->check(); $thesis->wp->nonce($_POST['_wpnonce-thesis-skin-export'], 'thesis-skin-export'); $this->error(__('The export data was incomplete. Please revisit the Skin Data Manager and try again.', 'thesis')); elseif (($options = array_filter($_POST['export'])) && (empty($options) || empty($options['id']))) $this->error(__('No backup state was specified for export. Revisit the Skin Data Manager and try again.', 'thesis')); unset($options['id']); $this->error(__('The requested export data does not match the current Skin. Please revisit the Skin Data Manager and try again.', 'thesis')); unset($data['ID']); unset($data['notes']); unset($data['time']); foreach (array_intersect(array_keys($options), $this->options) as $option) $new[$option] = maybe_unserialize($data[$option]); $new['class'] = $data['class']; $this->error(__('Export data serialization failed. Please revisit the Skin Data Manager and try again', 'thesis')); $this->error(__('Export data serialization (with hashing) failed. Please revisit the Skin Data Manager and try again.', 'thesis')); header('Content-Type: text/plain; charset='. get_option('blog_charset')); header('Content-Disposition: attachment; filename="'. str_replace('_', '-', $this->class). '-'. @date('Y\-m\-d\-H\-i'). '.txt"'); printf('%s', $out); exit; } /* Import a Thesis Skin data file — Any included (and valid) options will be overwritten, even if empty. */ public function import($file, $action) { $thesis->wp->check(); check_admin_referer($action, 'thesis_form_nonce'); return __('The import file is not present!', 'thesis'); elseif ($_FILES[$file]['error'] > 0) return __('The server encountered an error with the import file. No data will be imported.', 'thesis'); elseif (!is_array($data = $this->verify_skin_data_file($_FILES[$file], $this->class))) return empty($data) || !is_string($data) ? __('The import file does not contain valid Thesis Skin data.', 'thesis') : $data; unset($data['class']); return __('The import file does not contain any Skin data.', 'thesis'); $this->automatic_backup(__('Import Skin data', 'thesis')); foreach ($data as $option => $value) update_option("{$this->class}_$option", $value); else delete_option("{$this->class}_$option"); wp_cache_flush(); $thesis->skin->_write_css(); return true; } public function restore_default() { $thesis->wp->check(); $thesis->wp->nonce($_POST['nonce'], 'thesis-skin-manager'); parse_str(stripslashes($_POST['form']), $form); echo $response = $this->defaults( $thesis->skin->_skin, // Skin !empty($form['restore']) ? $form['restore'] : array(), // options !empty($_POST['backup']) && $_POST['backup'] == 'true' ? __('Restore defaults', 'thesis') : false) === true ? $thesis->api->alert($thesis->api->efn($response), 'default_not_saved', true); } /*---:[ Manager action helper methods ]:---*/ public function defaults($skin = array(), $restore = array(), $backup = false) { return __('No Skin was selected for restoration', 'thesis'); array_filter(array_map('intval', $restore)) : ($restore == 'new' ? array_combine($this->options, array_fill(0, count($this->options), 1)) : array()); return __('No data was selected for restoration!', 'thesis'); THESIS_USER_SKINS. "/{$skin['folder']}" : false; include_once($dir. '/default.php'); return __('The default Skin data is not in valid array format!', 'thesis'); $this->automatic_backup($backup, $skin['class']); unset($restore['css_custom']); delete_option("{$skin['class']}_css_custom"); } foreach (array_keys($restore) as $option) update_option("{$skin['class']}_$option", $default_data[$option]); else delete_option("{$skin['class']}_$option"); wp_cache_flush(); } else return __('This Skin does not have a valid default.php file.', 'thesis'); } else return __('This Skin does not have a default.php file!', 'thesis'); $thesis->skin->_write_css(); return true; } public function automatic_backup($state = false, $skin = false) { $this->add('['. __('Automatic backup', 'thesis'). (!empty($state) ? ': '. $state : ''). ']', !empty($skin) ? $skin : false); } public function error($error) { echo __('Return to the Thesis Skin Editor', 'thesis'), exit; } /*---:[ Skin Manager database table ]:---*/ private function table() { return $return && true; else { // make the table ID bigint(20) unsigned NOT NULL auto_increment, time bigint(20) NOT NULL, class varchar(200) NOT NULL, boxes longtext NOT NULL, templates longtext NOT NULL, packages longtext NOT NULL, vars longtext NOT NULL, css longtext NOT NULL, css_editor longtext NOT NULL, css_custom longtext NOT NULL, notes longtext NOT NULL, _design longtext NOT NULL, _display longtext NOT NULL, PRIMARY KEY (ID) ) COLLATE utf8_general_ci;"; // force utf8 collation to avoid latin1: destroyer of worlds return (bool) $query && $return; } } /*---:[ data verification ]:---*/ public function verify_class_name($class) { return preg_match('/\A[a-zA-Z_]\w*\Z/', $class) ? $class : false; } public function verify_skin_data_file($file, $class) { return __('The import file does not exist. Please try again.', 'thesis'); elseif (empty($class)) return __('A valid Skin class name was not specified. No data was imported.', 'thesis'); elseif (empty($name)) return __('The file name is inadequate. No data will be imported.', 'thesis'); elseif (!preg_match('/^[a-z0-9-]+\.txt$/', strtolower($name))) return __('The import file name did not pass a basic legitimacy test. No data was imported.', 'thesis'); elseif (!($serialized = file_get_contents($location))) return __('Thesis could not read the specified import file.', 'thesis'); elseif (!is_serialized($serialized)) return __('The import file is not properly serialized. No data will be imported.', 'thesis'); elseif (!($contents = unserialize($serialized))) return __('The import file could not be unserialized. No data will be imported.', 'thesis'); elseif (empty($contents['checksum'])) return __('The import file does not have a proper checksum value and cannot be trusted.', 'thesis'); elseif (empty($contents['data'])) return __('The import file does not contain any data.', 'thesis'); elseif (!is_array($contents['data'])) return __('The import file data is not formatted properly (it should be an array).', 'thesis'); elseif ($contents['checksum'] !== md5(serialize($contents['data']))) return __('The import file checksum does not match the file data. No data will be imported.', 'thesis'); elseif (empty($contents['data']['class'])) return __('The import file does not specify the Skin class to which it applies. No data will be imported.', 'thesis'); elseif ($contents['data']['class'] !== $class) return __('The import file does not apply to this Skin.', 'thesis'); return !empty($contents['data']) ? $contents['data'] : __('The import file only included empty data, so nothing was imported.', 'thesis'); } } define('THESIS_SKIN', THESIS_CORE. '/skin'); require_once(THESIS_SKIN. '/user_boxes.php'); class thesis_skin { public function __construct() { } public function __construct() { } public $_boxes = null; public $_class = null; public $_css = null; public $_design = null; public $_display = null; public $_docs = null; public $_images = null; public $_instances = null; public $_license_key = null; public $_manager = null; public $_name = null; public $_skin = null; public $_template = null; public $_templates = null; public $_user_packages = null; public $color = null; public $css_tools = null; public $design = null; public $display = null; public $fonts = null; public $functionality = null; public $grt = null; public $header_image = null; public $logo = null; public $page_404 = null; public $typography = null; public $license_key = false; // (string) product ID to use for license key-protected automatic updates // Skin-defined properties protected $filters = array(); // (array) Skin-defined functionality overrides (replaced by $functionality) } protected function construct() {} public function _api() { // Base design tools require_once(THESIS_SKIN_API. '/color.php'); require_once(THESIS_SKIN_API. '/css_tools.php'); require_once(THESIS_SKIN_API. '/fonts.php'); require_once(THESIS_SKIN_API. '/grt.php'); require_once(THESIS_SKIN_API. '/mce.php'); require_once(THESIS_SKIN_API. '/typography.php'); // deprecated $this->color = new thesis_skin_color; $this->css_tools = new thesis_skin_css_tools; $this->fonts = new thesis_skin_fonts; $this->grt = new thesis_grt; $this->typography = new thesis_skin_typography; // deprecated new thesis_mce; // Add-on functionality if (!empty($this->functionality['fonts_google']) && $this->functionality['fonts_google'] === true) { require_once(THESIS_SKIN_API. '/fonts_google.php'); new thesis_skin_fonts_google(get_option("{$this->_class}__design")); } if (!empty($this->functionality['header_image']) && $this->functionality['header_image'] === true) { require_once(THESIS_SKIN_API. '/header_image.php'); $this->header_image = new thesis_skin_header_image; } if (!empty($this->functionality['logo']) && $this->functionality['logo'] === true) { require_once(THESIS_SKIN_API. '/logo.php'); $this->logo = new thesis_skin_logo; } } public function _manager() { $this->_manager = new thesis_skin_manager($this->_skin); } public function _css() { require_once(THESIS_SKIN. '/css.php'); $css = array(); $css['css'] = ($css_skin = get_option("{$this->_class}_css")) ? $css_skin : ''; $css['css_editor'] = ($css_editor = get_option("{$this->_class}_css_editor")) ? $css_editor : ''; $css['css_custom'] = ($css_custom = get_option("{$this->_class}_css_custom")) ? $css_custom : ''; $css['vars'] = is_array($vars = get_option("{$this->_class}_vars")) ? $vars : array(); $css['preprocessor'] = !empty($this->functionality['css_preprocessor']) ? $this->functionality['css_preprocessor'] : false; $css['packages'] = is_array($packages = get_option("{$this->_class}_packages")) ? $packages : array(); $css['user_packages'] = is_array($this->_user_packages->active) ? $this->_user_packages->active : array(); if (method_exists($this, 'packages')) { add_action('thesis_include_packages', array($this, '_include_packages')); add_filter('thesis_packages', array($this, '_add_packages')); } $this->_design_options(); $this->_css = new thesis_css($css); } public function _design_options() { global $thesis; $this->design = $thesis->api->get_options($this->_design(), is_array($this->_design = get_option("{$this->_class}__design")) ? $this->_design : array()); } public function _init_wp() { global $thesis; if (!empty($_GET['t_quicklaunch_editor'])) { wp_redirect(set_url_scheme(home_url('?thesis_editor=1'))); exit; } if (!empty($_GET['t_skin_docs']) && !empty($this->_docs)) wp_redirect(esc_url($this->_docs)); require_once(THESIS_SKIN. '/images.php'); $this->_images = new thesis_images; new thesis_upload(array( 'title' => sprintf(__('Import %s Data', 'thesis'), $thesis->skins->skin['name']), 'prefix' => 'import_skin', 'file_type' => 'txt')); if (is_array($instances = apply_filters('thesis_skin_instances', array())) && !empty($instances)) $this->_instances = $instances; add_filter('thesis_quicklaunch_menu', array($this, '_quicklaunch')); add_action('admin_post_thesis_head', array($this, '_save_head')); if (method_exists($this, 'display')) add_action("admin_post_{$this->_class}__display", array($this, '_save_display')); if (method_exists($this, 'design')) add_action("admin_post_{$this->_class}__design", array($this, '_save_design')); if (!empty($this->license_key)) add_action('admin_post_skin_license', array($this, '_save_license_key')); if (!empty($this->functionality['formatting_class']) || !empty($this->functionality['editor_grt'])) add_filter('tiny_mce_before_init', array($this, '_mce')); add_action('thesis_after_update_skin', array($this, '_update')); // Deprecated header image functionality if (method_exists($this, 'header_image') && empty($this->functionality['header_image'])) add_action("admin_post_{$this->_class}__header_image", array($this, '_save_header_image')); } public function _init_admin() { add_filter('thesis_skin_menu', array($this, '_add_menu')); add_action('thesis_skin_menu', array($this, '_append_menu_links'), 99); add_action('thesis_admin_home', array($this, '_admin_home')); if (!empty($this->_instances) || method_exists($this, 'display')) $this->_menu["{$this->_class}__content"] = array( 'text' => __('Content & Display', 'thesis'), 'url' => admin_url("admin.php?page=thesis&canvas={$this->_class}__content"), 'description' => __('Manage what displays in your Skin and edit selected Skin content', 'thesis')); if (!empty($_GET['canvas'])) { if ($_GET['canvas'] == "{$this->_class}__content") { add_action('admin_init', array($this, '_init_content_admin')); add_action('thesis_admin_canvas', array($this, '_content_admin')); } elseif ($_GET['canvas'] == 'head') { add_action('admin_init', array($this, '_admin_init_head_editor')); add_action('thesis_admin_canvas', array($this, '_head_editor')); } } if (method_exists($this, 'design') || method_exists($this, 'design_admin') || !empty($this->functionality['design_admin'])) { $this->_menu["{$this->_class}__design"] = array( 'text' => __('Design', 'thesis'), 'url' => !empty($this->functionality['design_url']) ? esc_url($this->functionality['design_url']) : admin_url("admin.php?page=thesis&canvas={$this->_class}__design"), 'description' => __('Change certain aspects of your Skin’s design, like fonts and colors', 'thesis')); if (empty($this->functionality['design_url'])) { if (!empty($_GET['canvas']) && $_GET['canvas'] == "{$this->_class}__design") { add_action('thesis_admin_canvas', array($this, !empty($this->functionality['design_admin']) && method_exists($this, $this->functionality['design_admin']) ? $this->functionality['design_admin'] : (method_exists($this, 'design_admin') ? 'design_admin' : '_design_admin'))); add_action('admin_init', array($this, '_init_design_admin')); } } } if (!empty($this->license_key) && !empty($_GET['canvas']) && $_GET['canvas'] == 'skin_license') { add_action('thesis_admin_canvas', array($this, '_license_key_admin')); add_action('admin_init', array($this, '_init_license_key_admin')); } // Deprecated header image functionality if (method_exists($this, 'header_image') && empty($this->functionality['header_image'])) { $this->_menu["{$this->_class}__header_image"] = array( 'text' => __('Header Image', 'thesis'), 'url' => admin_url("admin.php?page=thesis&canvas={$this->_class}__header_image")); if (!empty($_GET['canvas']) && $_GET['canvas'] == "{$this->_class}__header_image") { add_action('admin_init', array($this, '_init_header_image')); add_action('thesis_admin_canvas', array($this, '_header_image')); } } } public function _admin_home() { global $thesis; $items = ''; foreach (apply_filters('thesis_skin_menu', array()) as $item) if ($item['url'] !== '#') $items .= "\t\t\t\t
  • {$item['text']}". (!empty($item['description']) ? ": {$item['description']}" : ''). "
  • \n"; if (empty($items)) return; echo "\t\t\t

    ", trim($thesis->api->efh(sprintf(__('%s Skin', 'thesis'), $this->_name))), "

    \n", (!empty($thesis->skins->preview) ? "\t\t\t

    ". sprintf(__('Note: You are previewing this Skin in Development Mode. To change this, visit the Manage Skins page.', 'thesis'), admin_url('admin.php?page=thesis&canvas=select_skin')). "

    \n" : ''), "\t\t\t\n"; } public function _add_menu($menu) { return is_array($this->_menu) ? (is_array($menu) ? array_merge($menu, $this->_menu) : $this->_menu) : $menu; } public function _add_boxes($boxes) { if (file_exists(THESIS_USER_SKIN. '/box.php')) include_once(THESIS_USER_SKIN. '/box.php'); return is_array($add_boxes = $this->boxes()) ? (is_array($boxes) ? array_merge($boxes, $add_boxes) : $add_boxes) : $boxes; } public function _include_packages() { if (file_exists(THESIS_USER_SKIN. '/package.php')) include_once(THESIS_USER_SKIN. '/package.php'); } public function _add_packages($packages) { return is_array($add_packages = $this->packages()) ? (is_array($packages) ? array_merge($packages, $add_packages) : $add_packages) : $packages; } public function _add_fonts($fonts) { return is_array($add_fonts = $this->fonts()) ? (is_array($fonts) ? array_merge($fonts, $add_fonts) : $add_fonts) : $fonts; } public function _init_license_key_admin() { wp_enqueue_style('thesis-options'); wp_enqueue_script('thesis-options'); } public function _license_key_admin() { global $thesis; $this->_license_key = trim(get_option("{$this->_class}_license_key", false)); $status = get_option("{$this->_class}_license_key_status", false); $message = get_transient("{$this->_class}_license_message", false); if (empty($message) && !empty($this->_license_key)) { set_transient("{$this->_class}_license_message", $thesis->api->check_license( $this->_license_key, $this->license_key, !empty($this->license_key_name) ? $this->license_key_name : $this->_name, $this->_class, 'admin.php?page=thesis&canvas=skin_license'), 60*60*24); $message = get_transient("{$this->_class}_license_message"); } $license = $thesis->api->form->fields(array( 'license_key' => array( 'type' => 'text', 'width' => 'long', 'code' => true, 'label' => sprintf(__('Enter Your %s License Key', 'thesis'), $this->_name), 'tooltip' => sprintf(__('Check out the Skin License Key documentation for everything you need to know about license keys.', 'thesis'), esc_url('https://diythemes.com/thesis/rtfm/how-to/skin-license-key/')))), !empty($this->_license_key) ? array('license_key' => $this->_license_key) : array(), 'skin_license_', false, 3, 3); echo "\t\t

    ", sprintf(__('%s License Key', 'thesis'), $this->_name), "

    \n", "\t\t
    \n", "\t\t\t{$license['output']}\n", (!empty($message) ? "\t\t\t
    $message
    \n" : ''), "\t\t\t\n", "\t\t\t\n", wp_nonce_field('thesis_skin_license_key', '_wpnonce', true, false), "\t\t
    \n"; } public function _save_license_key() { global $thesis; $thesis->wp->check(); check_admin_referer('thesis_skin_license_key'); if (!empty($_POST['save_options']) && !empty($_POST['license_key']) && ($this->_license_key = trim($_POST['license_key']))) { $thesis->api->delete_transients(); $thesis->api->activate( $this->_license_key, $this->license_key, !empty($this->license_key_name) ? $this->license_key_name : $this->_name, $this->_class, 'admin.php?page=thesis&canvas=skin_license'); } elseif (empty($_POST['license_key']) || !empty($_POST['delete_options'])) { $old_key = $this->_license_key; $this->_license_key = false; $thesis->api->delete_transients(); $thesis->api->deactivate( $old_key, $this->license_key, !empty($this->license_key_name) ? $this->license_key_name : $this->_name, $this->_class, 'admin.php?page=thesis&canvas=skin_license'); } wp_redirect(admin_url('admin.php?page=thesis&canvas=skin_license')); exit; } public function _license_key_nag($nag) { if (!empty($this->_license_key)) return $nag; $tab = str_repeat("\t", 3); return $nag. "$tab
    \n". "$tab\t

    ". sprintf(__('Please enter a %s license key!', 'thesis'), $this->_name). "

    \n". "$tab\t

    ". sprintf(__('You’ll need to enter a valid %2$s license key to receive automatic updates.', 'thesis'), admin_url('admin.php?page=thesis&canvas=skin_license'), $this->_name). "

    \n". "$tab
    \n"; } public function _admin_init_head_editor() { global $thesis; wp_enqueue_style('thesis-options'); #wp wp_enqueue_style('thesis-box-form'); #wp wp_enqueue_script('jquery-ui-droppable'); #wp wp_enqueue_script('jquery-ui-sortable'); #wp wp_enqueue_script('thesis-options'); wp_enqueue_script('thesis-ui', THESIS_JS_URL. '/ui.js', array('thesis-menu', 'thesis-options'), $thesis->version, true); #wp add_action('admin_head', array($this, '_admin_head_js')); } public function _admin_head_js() { echo "\n"; } public function _head_editor() { echo $this->_templates->head($this->_boxes->get_box_form_data($this->_templates->head, true)); } /*---:[ ajax interface actions ]:---*/ public function _init_ajax() { add_action('wp_ajax_add_box', array($this, '_add_box')); add_action('wp_ajax_save_box', array($this, '_save_box')); add_action('wp_ajax_save_template', array($this, '_save_template')); add_action('wp_ajax_change_template', array($this, '_change_template')); add_action('wp_ajax_create_template', array($this, '_create_template')); add_action('wp_ajax_delete_template', array($this, '_delete_template')); add_action('wp_ajax_copy_template', array($this, '_copy_template')); add_action('wp_ajax_save_css', array($this, '_save_css')); add_action('wp_ajax_save_css_package', array($this, '_save_css_package')); add_action('wp_ajax_delete_css_package', array($this, '_delete_css_package')); add_action('wp_ajax_save_css_variable', array($this, '_save_css_variable')); add_action('wp_ajax_delete_css_variable', array($this, '_delete_css_variable')); add_action('wp_ajax_color_complement', array($this, '_color_complement')); if (method_exists($this, 'admin_ajax')) $this->admin_ajax(); } public function _change_template() { global $thesis; $thesis->wp->nonce($_POST['nonce'], 'thesis-save-template'); echo $this->_templates->editor($this->_template_form()); if ($thesis->environment == 'ajax') die(); } public function _create_template() { global $thesis; $thesis->wp->check(); $thesis->wp->nonce($_POST['nonce'], 'thesis-save-template'); if (!is_array($save = $this->_templates->create($_POST['title'])) || empty($save['id']) || empty($save['templates'])) return; update_option("{$this->_class}_templates", $save['templates']); wp_cache_flush(); echo $save['id']; if ($thesis->environment == 'ajax') die(); } public function _delete_template() { global $thesis; $thesis->wp->check(); $thesis->wp->nonce($_POST['nonce'], 'thesis-save-template'); if (!is_array($templates = $this->_templates->delete($_POST['template']))) echo $thesis->api->alert(__('Template not deleted.', 'thesis'), 'template_deleted', true); else { if (empty($templates)) delete_option("{$this->_class}_templates"); else update_option("{$this->_class}_templates", $templates); wp_cache_flush(); echo $thesis->api->alert(__('Template deleted!', 'thesis'), 'template_deleted', true); } if ($thesis->environment == 'ajax') die(); } public function _copy_template() { global $thesis; $thesis->wp->check(); $thesis->wp->nonce($_POST['nonce'], 'thesis-save-template'); if (!is_array($templates = $this->_templates->copy($_POST['to'], $_POST['from']))) echo $thesis->api->alert(__('Template not copied.', 'thesis'), 'template_copied', true); else { update_option("{$this->_class}_templates", $templates); #wp wp_cache_flush(); echo $thesis->api->alert(__('Template copied!', 'thesis'), 'template_copied', true); } if ($thesis->environment == 'ajax') die(); } public function _save_template() { global $thesis; $thesis->wp->check(); parse_str(stripslashes($_POST['form']), $form); $thesis->wp->nonce($form['_wpnonce-thesis-ajax'], 'thesis-save-template'); if (!is_array($save = $this->_templates->save($form))) echo $thesis->api->alert(__('Template not saved.', 'thesis'), 'template_saved', true); else { if (is_array($save['templates']) && empty($save['templates'])) delete_option("{$this->_class}_templates"); elseif (is_array($save['templates'])) update_option("{$this->_class}_templates", $save['templates']); #wp $this->_boxes->delete($save['delete_boxes']); $boxes = $this->_boxes->save($form); if (is_array($boxes) && empty($boxes)) delete_option("{$this->_class}_boxes"); elseif (is_array($boxes)) update_option("{$this->_class}_boxes", $boxes); wp_cache_flush(); echo $thesis->api->alert(__('Template saved!', 'thesis'), 'template_saved', true); } if ($thesis->environment == 'ajax') die(); } public function _save_box() { global $thesis; $thesis->wp->check(); parse_str(stripslashes($_POST['form']), $form); if ($thesis->wp->nonce($form['_wpnonce-thesis-save-box'], 'thesis-save-box', true)) { $boxes = $this->_boxes->save($form); if (is_array($boxes) && empty($boxes)) delete_option("{$this->_class}_boxes"); elseif (is_array($boxes)) update_option("{$this->_class}_boxes", $boxes); wp_cache_flush(); echo $thesis->api->alert(__('Options saved!', 'thesis'), 'options_saved', true); } else echo $thesis->api->alert(__('Options not saved.', 'thesis'), 'options_saved', true); if ($thesis->environment == 'ajax') die(); } public function _save_head() { global $thesis; $thesis->wp->check(); $thesis->wp->nonce($_POST['_wpnonce-thesis-save-head'], 'thesis-save-head'); $saved = 'no'; if ($head = $this->_templates->save_head($_POST)) { if (is_array($head)) $this->_boxes->delete($head); $this->_boxes->save(stripslashes_deep($_POST), true); $saved = 'yes'; } wp_redirect("admin.php?page=thesis&canvas=head&saved=$saved"); exit; } public function _add_box() { global $thesis; $thesis->wp->nonce($_POST['nonce'], 'thesis-add-box'); if (is_array($boxes = $this->_boxes->add($_POST['id']))) { update_option("{$this->_class}_boxes", $boxes); wp_cache_flush(); } if ($thesis->environment == 'ajax') die(); } public function _write_css() { if (!isset($this->_css)) return; $this->_css->reset_vars(get_option("{$this->_class}_vars")); $this->_design_options(); if (method_exists($this, 'css_variables') && is_array($map = $this->css_variables()) && is_array($vars = $this->_css->update_vars($map))) update_option("{$this->_class}_vars", $vars); $this->_css->write(); } public function _save_css() { global $thesis; $thesis->wp->check(); $thesis->wp->nonce($_POST['nonce'], 'thesis-save-css'); if (isset($_POST['editors']) && is_array($_POST['editors'])) foreach ($_POST['editors'] as $editor => $css) update_option("{$this->_class}_$editor", trim(stripslashes($css))); elseif (isset($_POST['custom'])) update_option("{$this->_class}_css_custom", trim(stripslashes($_POST['custom']))); wp_cache_flush(); $this->_write_css(); echo $thesis->api->alert(__('CSS saved!', 'thesis'), 'css_saved', true); if ($thesis->environment == 'ajax') die(); } public function _save_css_variable() { global $thesis; $thesis->wp->check(); $thesis->wp->nonce($_POST['nonce'], 'thesis-save-css-variable'); if (is_array($save = $this->_css->save_variable(stripslashes_deep($_POST['item'])))) { update_option("{$this->_class}_vars", $save); wp_cache_flush(); echo $thesis->api->alert(__('Variable saved!', 'thesis'), 'var_saved', true); } else echo $thesis->api->alert(__('Variable not saved.', 'thesis'), 'var_saved', true); if ($thesis->environment == 'ajax') die(); } public function _delete_css_variable() { global $thesis; $thesis->wp->check(); $thesis->wp->nonce($_POST['nonce'], 'thesis-save-css-variable'); if (is_array($save = $this->_css->delete_variable($_POST['item']))) { if (empty($save)) delete_option("{$this->_class}_vars"); else update_option("{$this->_class}_vars", $save); wp_cache_flush(); echo $thesis->api->alert(__('Variable deleted!', 'thesis'), 'var_deleted', true); } else echo $thesis->api->alert(__('Variable not deleted.', 'thesis'), 'var_deleted', true); if ($thesis->environment == 'ajax') die(); } public function _save_css_package() { global $thesis; $thesis->wp->check(); parse_str(stripslashes($_POST['pkg']), $pkg); $thesis->wp->nonce($pkg['_wpnonce-thesis-save-package'], 'thesis-save-package'); if (is_array($packages = $this->_css->save_package($pkg))) { update_option("{$this->_class}_packages", $packages); echo $thesis->api->alert(__('Package saved!', 'thesis'), 'package_saved', true); wp_cache_flush(); } else echo $thesis->api->alert(__('Package not saved.', 'thesis'), 'package_saved', true); if ($thesis->environment == 'ajax') die(); } public function _delete_css_package() { global $thesis; $thesis->wp->check(); parse_str(stripslashes($_POST['pkg']), $pkg); $thesis->wp->nonce($pkg['_wpnonce-thesis-save-package'], 'thesis-save-package'); if (is_array($packages = $this->_css->delete_package($pkg))) { if (empty($packages)) delete_option("{$this->_class}_packages"); else update_option("{$this->_class}_packages", $packages); wp_cache_flush(); echo $thesis->api->alert(__('Package deleted!', 'thesis'), 'package_deleted', true); } else echo $thesis->api->alert(__('Package not deleted.', 'thesis'), 'package_deleted', true); if ($thesis->environment == 'ajax') die(); } public function _color_complement() { global $thesis; $thesis->wp->check(); echo ($complement = $thesis->api->colors->complement($_POST['color'])) ? $complement : "N/A"; if ($thesis->environment == 'ajax') die(); } /*---:[ Front-end Skin output ]:---*/ public function _skin() { global $thesis; if ($thesis->environment == 'editor') { $this->_editor(); exit(); } else return $this->_template(); } public function _query($query) { global $thesis, $wp_version; if (!$query->is_main_query()) return $query; $page = $custom = false; if ($query->is_page && ($page = !empty($query->queried_object_id) ? $query->queried_object_id : (!empty($query->query_vars['page_id']) ? $query->query_vars['page_id'] : false)) && !empty($page)) { $redirect = ($redirect = get_post_meta($page, '_thesis_redirect', true)) ? $redirect : false; #wp if (is_array($redirect) && !empty($redirect['url'])) { wp_redirect($redirect['url'], 301); #wp exit; } $custom = is_array($post_meta = get_post_meta($page, "_{$this->_class}", true)) ? (!empty($post_meta['template']) ? $post_meta['template'] : false) : false; } elseif ($query->is_category || $query->is_tax || $query->is_tag) { $query->get_queried_object(); if (is_object($query->queried_object)) { if ($query->is_tag && version_compare($wp_version, '3.8.2', '<') && version_compare($wp_version, '3.8', '>=')) { $query->queried_object = get_term_by('slug', $query->query_vars['tag'], 'post_tag'); $query->queried_object_id = $query->queried_object->term_id; } if (!empty($thesis->wp->terms[$query->queried_object->term_id][$this->_class]['template']) && ($template = $thesis->wp->terms[$query->queried_object->term_id][$this->_class]['template'])) $custom = !empty($template) ? $template : false; do_action('thesis_init_term', $query->queried_object->term_id); } } do_action('thesis_init_template', $this->_template = $this->_templates->get_template($custom)); return apply_filters('thesis_query', $query); } private function _template() { global $thesis, $wp_query; if (empty($this->_boxes->active) || !is_array($this->_boxes->active)) { echo __('Uh oh, no template data is present!', 'thesis'); return; } $custom = false; if ($wp_query->is_single) { $redirect = ($redirect = get_post_meta($wp_query->post->ID, '_thesis_redirect', true)) ? $redirect : false; #wp if (is_array($redirect) && !empty($redirect['url'])) wp_redirect($redirect['url'], 301); #wp $custom = is_array($post_meta = get_post_meta($wp_query->post->ID, "_{$this->_class}", true)) ? (!empty($post_meta['template']) ? $post_meta['template'] : false) : false; } if ($wp_query->is_404 || $custom) { $this->_template = $this->_templates->get_template($custom); do_action('thesis_init_custom_template', $this->_template); $this->page_404 = $wp_query->is_404 ? apply_filters('thesis_404_page', false) : false; } if ($wp_query->is_singular) do_action('thesis_init_post_meta', $wp_query->post->ID); if (is_array($preload = apply_filters('thesis_template_preload', array())) && !empty($preload)) { $boxes = $this->_preload(array('thesis_html_head', 'thesis_html_body')); if (is_array($boxes)) foreach ($preload as $id) if (in_array($id, $boxes) && is_object($this->_boxes->active[$id]) && method_exists($this->_boxes->active[$id], 'preload')) $this->_boxes->active[$id]->preload(); } return apply_filters('thesis_template', THESIS_SKIN. '/template.php'); } private function _preload($roots) { $boxes = array(); foreach ($roots as $root) { if (!in_array($root, $boxes)) $boxes[] = $root; if (!empty($this->_template['boxes'][$root]) && is_array($this->_template['boxes'][$root])) $boxes = array_merge_recursive($boxes, $this->_preload($this->_template['boxes'][$root])); } return $boxes; } public function _body_class($classes) { global $wp_query; $add = $this->_template['id']; if (in_array($this->_template['id'], array_keys($this->_templates->custom_select()))) $add = 'custom'; $classes[] = "template-$add"; if (isset($wp_query->queried_object) && is_object($wp_query->queried_object) && !empty($wp_query->queried_object->taxonomy)) $classes[] = "template-". esc_attr($wp_query->queried_object->slug); return $classes; } public function _editor_launcher() { global $thesis; if (!current_user_can('manage_options') || $thesis->wp_customize === true) return; $scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN === true ? 'https' : 'http'; echo "
    \n", "\t
    \n", "\t\t

    ", $thesis->api->efh(ucfirst($this->_template['title'])), "

    \n", "\t\t

    \n", "\t\t\t_template['id']}\" />\n", "\t\t\tapi->ef0(__('edit template', 'thesis')), "\" />\n", "\t\t

    \n", "\t
    \n", "
    \n"; } public function _editor_launcher_css() { global $thesis; if (!current_user_can('manage_options') || $thesis->wp_customize === true) return; $position = !empty($this->functionality['launcher_position']) && $this->functionality['launcher_position'] == 'right' ? 'right' : 'left'; echo "\n"; } /*---:[ 301 redirect post meta and custom template options for posts, pages, and archive pages ]:---*/ public function _post_meta($post_meta) { global $thesis; $options = array( 'thesis_redirect' => array( 'title' => __('301 Redirect', 'thesis'), 'fields' => array( 'url' => array( 'type' => 'text', 'width' => 'full', 'code' => true, 'label' => sprintf(__('Redirect %s', 'thesis'), $thesis->api->base['url']), 'tooltip' => sprintf(__('Use this handy tool to set up nice-looking affiliate links for your site. If you place a %1$s in this field, users will get redirected to this %1$s whenever they visit the %1$s defined in the Permalink above (located beneath the post title field).', 'thesis'), $thesis->api->base['url']), 'description' => $thesis->api->strings['include_http']))), $this->_class => array( 'title' => $thesis->api->ef0(sprintf(__('%1$s Skin Custom Template', 'thesis'), $this->_name)), 'context' => 'side', 'priority' => 'default', 'fields' => array( 'template' => array( 'type' => 'select', 'label' => $thesis->api->strings['custom_template'], 'options' => $this->_templates->custom_select())))); return is_array($post_meta) ? array_merge($post_meta, $options) : $options; } public function _term_options($term_options) { global $thesis; $options[$this->_class] = array( 'template' => array( 'type' => 'select', 'label' => sprintf(__('%1$s Skin %2$s','thesis'), $this->_name, $thesis->api->strings['custom_template']), 'options' => $this->_templates->custom_select())); return is_array($term_options) ? array_merge($term_options, $options) : $options; } /*---:[ Skin API valet methods ]:---*/ public function color_scheme($scheme) { global $thesis; if (!is_array($scheme)) return; $label = !empty($scheme['label']) ? $scheme['label'] : __('Color Scheme', 'thesis'); $tooltip = !empty($scheme['tooltip']) ? $scheme['tooltip'] : false; $scheme['default'] = $options = is_array($scheme['default']) ? $scheme['default'] : array(); $values = array_merge($scheme['default'], $this->design); return array( 'type' => 'custom', 'label' => $label, 'tooltip' => $tooltip, 'options' => $options, 'output' => $thesis->api->colors->scheme($scheme, $values, $this->_class)); } /*---:[ Deprecated Skin API methods ]:---*/ public function _init_header_image() { wp_enqueue_style('thesis-options'); wp_enqueue_media(); wp_enqueue_script('custom-header'); } public function _header_image() { global $thesis; $width = is_numeric($w = $this->header_image()) ? strip_tags($w) : false; $save_url = esc_url(add_query_arg(array('action' => "{$this->_class}__header_image", '_wpnonce' => wp_create_nonce('thesis-header-image')), admin_url("admin-post.php"))); $delete_url = esc_url(add_query_arg(array('action' => "{$this->_class}__header_image", '_wpnonce' => wp_create_nonce('thesis-header-image'), 'delete' => 'true'), admin_url("admin-post.php"))); $data_attributes = "data-style=\"save button\" data-update-link=\"$save_url\" data-choose=\"". __('Select a Header Image', 'thesis'). "\" data-update=\"". __('Set Header Image', 'thesis'). "\""; echo $width == false ? "\t\t

    ". __('You must declare a width for your header image before this functionality can be enabled.', 'thesis'). "

    \n" : "\t\t

    ". sprintf(__('%s Skin Header Image', 'thesis'), $this->_name). "

    \n". "\t\t

    ". sprintf(__('Based on your current design settings, we recommend a header image that is %dpx wide.', 'thesis'), $width). "

    \n". "\t\t
    \n". (!empty($this->header_image) ? "\t\t\theader_image['src']). "\" height=\"". (int) $this->header_image['height']. "\" width=\"". (int) $this->header_image['width']. "\"/>\n". "\t\t\t

    ". sprintf(__('Current image is %1$dpx wide by %2$dpx tall.', 'thesis'), (int) $this->header_image['width'], (int) $this->header_image['height']). "

    \n" : ''). "\t\t
    \n". "\t\t

    \n". "\t\t\n". (!empty($this->header_image) ? "\t\t". __('Remove Header Image', 'thesis'). "\n" : ''). "\t\t

    \n"; } public function _save_header_image() { global $thesis; $thesis->wp->check(); $thesis->wp->nonce($_GET['_wpnonce'], 'thesis-header-image'); if (!empty($_GET['delete']) && $_GET['delete'] === 'true') { delete_option("{$this->_class}__header_image"); $this->header_image = array(); } else { $id = (int) $_GET['file']; $image = wp_get_attachment_metadata($id); update_option("{$this->_class}__header_image", $this->header_image = array( 'src' => esc_url_raw(wp_get_attachment_url($id)), 'height' => (int) $image['height'], 'width' => (int) $image['width'], 'id' => $id)); } wp_cache_flush(); $this->_write_css(); wp_redirect(admin_url("admin.php?page=thesis&canvas={$this->_class}__header_image")); exit; } public function header_image_html() { global $thesis; if (empty($this->header_image) || !empty($this->functionality['header_image'])) return; echo "header_image['src']), "\" alt=\"", trim($thesis->api->efh((!empty($thesis->api->options['blogname']) ? htmlspecialchars_decode($thesis->api->options['blogname'], ENT_QUOTES). ' ' : ''). __('header image', 'thesis'))), "\" width=\"{$this->header_image['width']}\" height=\"{$this->header_image['height']}\" title=\"", __('back to home page', 'thesis'), "\" />\n"; } } require_once(THESIS_WP. '/boxes.php'); require_once(THESIS_WP. '/post_types.php'); require_once(THESIS_WP. '/terms.php'); require_once(THESIS_WP. '/widgets.php'); require_once(THESIS_WP. '/post_meta.php'); class thesis_wp { public function __construct() { } public $post_meta = null; public $terms = null; public $widgets = array( // (array) core Thesis widget classes public $boxes = array( // (array) Boxes this controller is adding to Thesis public $dependents = array( public $exclude = array( /* 'bwg_gallery', // photo gallery — these should be moved to specific compatibility modules )); public function __construct() { $this->actions(); $this->filters(); $this->widgets(); } private function actions() { load_theme_textdomain('thesis', THESIS_USER. '/languages'); add_theme_support('menus'); add_action('widgets_init', array($this, 'init')); add_action('wp_loaded', array($this, 'wp_loaded'), 100); add_action('thesis_boxes', array($this, 'core_boxes')); foreach ($this->dependents as $box) add_action("{$box}_dependents", array($this, 'post_boxes')); remove_action('wp_head', 'wp_generator'); remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0); remove_action('wp_head', 'rel_canonical'); remove_action('wp_head', 'wp_shortlink_wp_head'); remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'wlwmanifest_link'); add_action('hook_head_bottom', 'wp_head'); add_action('hook_after_html', 'wp_footer', 1); } private function filters() { add_filter('thesis_exclude_template_types', array($this, 'exclude_template_types')); add_filter('thesis_exclude_query_types', array($this, 'exclude_query_types')); add_filter('post_class', array($this, 'post_class')); add_filter('the_content', array($this, 'no_p_on_img')); // Cookie consent only applies to legacy Skins that use the Thesis Comment Form add_filter('comment_form_submit_field', array($this, 'comment_consent_checkbox'), 2, 2); foreach ($capital_P as $dangit) remove_filter($dangit, 'capital_P_dangit'); # Dagnabbit. } private function widgets() { foreach ($this->widgets as $widget) register_widget($widget); } public function init() { // Initialize Post Types new thesis_post_types; // Initialize Term metadata controller $this->terms = $terms->terms; // Initiate Boxes whose $type = false foreach ($boxes as $box) new $box; // Post meta add_action('init', array($this, 'init_post_meta'), 100); wp_enqueue_style('thesis-edit', THESIS_CSS_URL. '/edit.css'); #wp wp_enqueue_script('jquery-ui-core'); #wp wp_enqueue_script('thesis-edit', THESIS_JS_URL. '/edit.js'); #wp } } public function wp_loaded() { new thesis_dashboard_rss; add_action('wp_print_styles', array($this, 'remove_css'), 11); remove_action('wp_head', 'print_emoji_detection_script', 7); remove_action('admin_print_scripts', 'print_emoji_detection_script'); remove_action('wp_print_styles', 'print_emoji_styles'); remove_action('admin_print_styles', 'print_emoji_styles'); } } public function core_boxes($boxes) { return $boxes; } public function post_boxes($boxes) { return $boxes; } public function init_post_meta() { $this->post_meta = apply_filters('thesis_post_meta', array()); foreach ($this->post_meta as $class => $meta) { new thesis_post_meta($class, $meta, $tabindex); } } public function remove_css() { add_filter('print_styles_array', array($this, 'remove_styles')); } public function remove_styles($list) { return array_diff($list, array('wp-block-library')); } /*---:[ Filters ]:---*/ public function exclude_template_types($template_types) { foreach ($this->exclude['templates'] as $type) $template_types[] = $type; return $template_types; } public function exclude_query_types($query_types) { foreach ($this->exclude['query'] as $type) $query_types[] = $type; return $query_types; } public function post_class($classes) { unset($classes[array_search('hentry', $classes)]); return $classes; } public function no_p_on_img($content) { return preg_replace('/

    \s*()?\s*()\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content); } public function comment_consent_checkbox($submit, $tab) { "$tab

    \n". "$tab\t\n". "$tab\t\n". "$tab

    \n". $submit; } return $submit; } /*---:[ Thesis WP API methods ]:---*/ /* Apply the specified $filters to $content. — $content: the content to filter — $filters: an array of filters with filter function => priority pairs */ public function filter($content, $filters = array()) { foreach ($filters as $filter => $priority) add_filter($content, $filter, $priority); else add_filter($content, $filter); } /* Use $thesis->wp->check() to see if the current user has permission to access certain functionality within WP. */ public function check($access = false) { wp_die(__('Easy there, homeh. You don’t have admin privileges to change Thesis settings.', 'thesis')); } /* Use $thesis->wp->nonce() to perform a nonce check for enhanced interface security. */ public function nonce($nonce, $action, $passthrough = false) { die(__('Your nonce check is incorrect. Check the nonce name and action and try again.', 'thesis')); return false; else die(__('It looks like you may have been logged out of WordPress. Log back in, and then try your action again.', 'thesis')); return true; } public function author($author_id, $field = false) { // fields: ID, user_login, user_nicename, display_name, user_email, user_url, user_registered, user_status return $field ? $author->data->$field : $author->data; } /* Check to see if the current page is a descendant of some other page. Note: Should be fired at template_redirect or later. */ public function is_tree($id = false) { foreach ($ancestors as $page) return true; return is_page($id) ? true : false; } public function language_attributes() { $attributes[] = "dir=\"$dir\""; $attributes[] = "lang=\"$lang\""; return apply_filters('thesis_language_attributes', $attributes); } }
    Deprecated: Creation of dynamic property thesis::$environment is deprecated in /webroot/r/e/redbar/primary/www/wp-content/themes/thesis/thesis.php on line 17

    Deprecated: Creation of dynamic property thesis::$wp_customize is deprecated in /webroot/r/e/redbar/primary/www/wp-content/themes/thesis/thesis.php on line 95

    Deprecated: Creation of dynamic property thesis::$caching is deprecated in /webroot/r/e/redbar/primary/www/wp-content/themes/thesis/thesis.php on line 96

    Deprecated: Creation of dynamic property thesis::$wpseo is deprecated in /webroot/r/e/redbar/primary/www/wp-content/themes/thesis/thesis.php on line 97

    Deprecated: Creation of dynamic property thesis::$api is deprecated in /webroot/r/e/redbar/primary/www/wp-content/themes/thesis/thesis.php on line 71

    Fatal error: Uncaught Error: Class "thesis_wp" not found in /webroot/r/e/redbar/primary/www/wp-content/themes/thesis/thesis.php:72 Stack trace: #0 /webroot/r/e/redbar/primary/www/wp-includes/class-wp-hook.php(324): thesis->init() #1 /webroot/r/e/redbar/primary/www/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #2 /webroot/r/e/redbar/primary/www/wp-includes/plugin.php(517): WP_Hook->do_action() #3 /webroot/r/e/redbar/primary/www/wp-settings.php(705): do_action() #4 /webroot/r/e/redbar/primary/www/wp-config.php(116): require_once('...') #5 /webroot/r/e/redbar/primary/www/wp-load.php(50): require_once('...') #6 /webroot/r/e/redbar/primary/www/wp-blog-header.php(13): require_once('...') #7 /webroot/r/e/redbar/primary/www/index.php(19): require('...') #8 {main} thrown in /webroot/r/e/redbar/primary/www/wp-content/themes/thesis/thesis.php on line 72