• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP FW_Cache类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中FW_Cache的典型用法代码示例。如果您正苦于以下问题:PHP FW_Cache类的具体用法?PHP FW_Cache怎么用?PHP FW_Cache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了FW_Cache类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: get

 /**
  * @param string $meta_type
  * @param int $object_id
  * @param string $multi_key 'abc' or 'ab/c/def'
  * @param null|mixed $default_value If no option found in the database, this value will be returned
  * @param bool|null $get_original_value Original value from db, no changes and translations
  *
  * @return mixed|null
  */
 public static function get($meta_type, $object_id, $multi_key, $default_value = null, $get_original_value = null)
 {
     if ($get_original_value === null) {
         $get_original_value = is_admin();
     }
     if (empty($multi_key)) {
         trigger_error('Key not specified', E_USER_WARNING);
         return null;
     }
     $multi_key = explode('/', $multi_key);
     $key = array_shift($multi_key);
     $multi_key = implode('/', $multi_key);
     $cache_key = self::$cache_key . '/' . $meta_type . '/' . $object_id . '/' . $key;
     try {
         $values = FW_Cache::get($cache_key);
     } catch (FW_Cache_Not_Found_Exception $e) {
         $values = array();
         $values['original'] = get_metadata($meta_type, $object_id, $key, true);
         $values['prepared'] = fw_prepare_option_value($values['original']);
         FW_Cache::set($cache_key, $values);
     }
     if (empty($multi_key)) {
         return $values[$get_original_value ? 'original' : 'prepared'];
     } else {
         return fw_akg($multi_key, $values[$get_original_value ? 'original' : 'prepared'], $default_value);
     }
 }
开发者ID:floq-design,项目名称:Unyson,代码行数:36,代码来源:class-fw-wp-meta.php


示例2: set

 /**
  * @param int $post_id
  * @param string $multi_key 'abc' or 'ab/c/def'
  * @param array|string|int|bool $set_value
  */
 public static function set($post_id, $multi_key, $set_value)
 {
     if (empty($multi_key)) {
         trigger_error('Key not specified', E_USER_WARNING);
         return;
     }
     $multi_key = explode('/', $multi_key);
     $key = array_shift($multi_key);
     $multi_key = implode('/', $multi_key);
     $cache_key = self::$cache_key . '/' . $post_id . '/' . $key;
     if (empty($multi_key) && $multi_key !== '0') {
         /** Replace entire meta */
         fw_update_post_meta($post_id, $key, $set_value);
         FW_Cache::del($cache_key);
     } else {
         /** Change only specified key */
         $values = array();
         $values['original'] = self::get($post_id, $key, true);
         $values['prepared'] = self::get($post_id, $key, false);
         fw_aks($multi_key, $set_value, $values['original']);
         fw_aks($multi_key, fw_prepare_option_value($set_value), $values['prepared']);
         FW_Cache::set($cache_key, $values);
         fw_update_post_meta($post_id, $key, $values['original']);
     }
 }
开发者ID:AdsonCicilioti,项目名称:Unyson,代码行数:30,代码来源:class-fw-wp-post-meta.php


示例3: execute

 /**
  * {@inheritdoc}
  * @param array $args
  * * zip - file path
  * * dir - where the zip file will be extract
  */
 public function execute(array $args, array $state = array())
 {
     if (!isset($args['zip'])) {
         return new WP_Error('no_zip', __('Zip file not specified', 'fw'));
     } else {
         $args['zip'] = fw_fix_path($args['zip']);
     }
     if (!isset($args['dir'])) {
         return new WP_Error('no_dir', __('Destination dir not specified', 'fw'));
     } else {
         $args['dir'] = fw_fix_path($args['dir']);
     }
     if (empty($state)) {
         if (!fw_ext_backups_is_dir_empty($args['dir'])) {
             return new WP_Error('destination_not_empty', __('Destination dir is not empty', 'fw'));
         }
         $state = array('entry' => '', 'extracted_files' => 0);
     }
     wp_cache_flush();
     FW_Cache::clear();
     if (is_wp_error($extract_result = fw_ext_backups_unzip_partial($args['zip'], $args['dir'], $state['entry']))) {
         return $extract_result;
     } else {
         if ($extract_result['finished']) {
             return true;
         } else {
             $state['entry'] = $extract_result['last_entry'];
             $state['extracted_files'] += $extract_result['extracted_files'];
             return $state;
         }
     }
 }
开发者ID:ThemeFuse,项目名称:Unyson-Backups-Extension,代码行数:38,代码来源:class-fw-ext-backups-task-type-unzip.php


示例4: get_fonts

 /**
  * Returns fonts
  * @return array
  */
 public function get_fonts()
 {
     $cache_key = 'fw_option_type/' . $this->get_type();
     try {
         return FW_Cache::get($cache_key);
     } catch (FW_Cache_Not_Found_Exception $e) {
         $fonts = array('standard' => apply_filters('fw_option_type_typography_v2_standard_fonts', array("Arial", "Verdana", "Trebuchet", "Georgia", "Times New Roman", "Tahoma", "Palatino", "Helvetica", "Calibri", "Myriad Pro", "Lucida", "Arial Black", "Gill Sans", "Geneva", "Impact", "Serif")), 'google' => json_decode(fw_get_google_fonts_v2(), true));
         FW_Cache::set($cache_key, $fonts);
         return $fonts;
     }
 }
开发者ID:puriwp,项目名称:Theme-Framework,代码行数:15,代码来源:class-fw-option-type-typography-v2.php


示例5: get_updates

 private function get_updates($force_check = false)
 {
     $cache_key = 'fw_ext_update/updates';
     // use cache because this method may be called multiple times (to prevent useless requests to update servers)
     try {
         return FW_Cache::get($cache_key);
     } catch (FW_Cache_Not_Found_Exception $e) {
         $updates = array('framework' => $this->get_framework_update($force_check), 'theme' => $this->get_theme_update($force_check), 'extensions' => $this->get_extensions_with_updates($force_check));
         FW_Cache::set($cache_key, $updates);
         return $updates;
     }
 }
开发者ID:AdsonCicilioti,项目名称:Unyson,代码行数:12,代码来源:class-fw-extension-update.php


示例6: fw_ext_builder_get_item_width

/**
 * Get builder item width data
 *
 * Default widths are specified in the config, but some builder types can have custom widths
 *
 * Usage example:
 * <div class="<?php echo esc_attr(fw_ext_builder_get_item_width('builder-type', $item['width'] .'/frontend_class')) ?>" >
 *
 * @param string $builder_type Builder option type (some builders can have different item widths)
 * @param null|string $width_id Specify width id (accepts multikey) or leave empty to get all widths
 * @param null|mixed $default_value Return this value if specified key does not exist
 * @return array
 */
function fw_ext_builder_get_item_width($builder_type, $width_id = null, $default_value = null)
{
    try {
        $cache_key = fw()->extensions->get('builder')->get_cache_key('item_widths/' . $builder_type);
        $widths = FW_Cache::get($cache_key);
    } catch (FW_Cache_Not_Found_Exception $e) {
        $widths = apply_filters('fw_builder_item_widths:' . $builder_type, fw()->extensions->get('builder')->get_config('default_item_widths'));
        FW_Cache::set($cache_key, $widths);
    }
    if (is_null($width_id)) {
        return $widths;
    } else {
        return fw_akg($width_id, $widths, $default_value);
    }
}
开发者ID:setcomunicacao,项目名称:setdigital,代码行数:28,代码来源:helpers.php


示例7: get_predefined_templates

 /**
  * @param string $builder_type
  * @return array|mixed
  * @since 1.1.14
  */
 protected function get_predefined_templates($builder_type)
 {
     $cache_id = 'fw_ext_builder/predefined_templates/' . $builder_type . '/' . $this->get_type();
     try {
         return FW_Cache::get($cache_id);
     } catch (FW_Cache_Not_Found_Exception $e) {
         $templates = array();
         foreach (apply_filters('fw_ext_builder:predefined_templates:' . $builder_type . ':' . $this->get_type(), array()) as $id => $template) {
             if (isset($template['title']) && is_string($template['title']) && isset($template['json']) && is_string($template['json']) && null !== json_decode($template['json'])) {
                 $templates[$id] = array('title' => $template['title'], 'json' => $template['json'], 'type' => 'predefined');
             } else {
                 trigger_error('Invalid predefined template: ' . $id, E_USER_WARNING);
             }
         }
         FW_Cache::set($cache_id, $templates);
         return $templates;
     }
 }
开发者ID:reardestani,项目名称:Unyson-Builder-Extension,代码行数:23,代码来源:class-fw-ext-builder-templates-component.php


示例8: set

 /**
  * Alternative for update_option()
  * @param string $option_name
  * @param string|null $specific_multi_key
  * @param array|string|int|bool $set_value
  */
 public static function set($option_name, $specific_multi_key = null, $set_value)
 {
     $cache_key = self::$cache_key . '/' . $option_name;
     if ($specific_multi_key === null) {
         /** Replace entire option */
         update_option($option_name, $set_value, false);
         FW_Cache::del($cache_key);
     } else {
         /** Change only specified key */
         $values = array();
         $values['original'] = self::get($option_name, null, true);
         $values['prepared'] = self::get($option_name, null, false);
         fw_aks($specific_multi_key, $set_value, $values['original']);
         fw_aks($specific_multi_key, fw_prepare_option_value($set_value), $values['prepared']);
         FW_Cache::set($cache_key, $values);
         update_option($option_name, $values['original'], false);
     }
 }
开发者ID:cristeamdev,项目名称:Unyson,代码行数:24,代码来源:class-fw-wp-option.php


示例9: fw_ext_mega_menu_is_mm_item

/**
 * Check if menu item is a MegaMenu item or is inside a MegaMenu item
 * @param WP_Post $item
 * @return bool
 */
function fw_ext_mega_menu_is_mm_item($item)
{
    $cache_key = fw_ext('megamenu')->get_cache_key('/mm_item');
    try {
        $mm_items = FW_Cache::get($cache_key);
    } catch (FW_Cache_Not_Found_Exception $e) {
        $mm_items = array();
    }
    if (isset($mm_items[$item->ID])) {
        return $mm_items[$item->ID];
    }
    $cursor_item = array('id' => $item->ID, 'parent' => $item->menu_item_parent);
    do {
        $is_mm_item = fw_ext_mega_menu_get_meta($cursor_item['id'], 'enabled');
    } while (!$is_mm_item && intval($cursor_item['parent']) !== 0 && ($cursor_item = get_post($cursor_item['parent'])) && ($cursor_item = array('id' => $cursor_item->ID, 'parent' => get_post_meta($cursor_item->ID, '_menu_item_menu_item_parent', true))));
    $mm_items[$item->ID] = (bool) $is_mm_item;
    FW_Cache::set($cache_key, $mm_items);
    return $mm_items[$item->ID];
}
开发者ID:krishna19,项目名称:Unyson-MegaMenu-Extension,代码行数:24,代码来源:helpers.php


示例10: get_base_dirs_map

 /**
  * @return array {base_dir_real_path => base_dir_wp_filesystem_path}
  */
 public static function get_base_dirs_map()
 {
     /** @var WP_Filesystem_Base $wp_filesystem */
     global $wp_filesystem;
     if (!$wp_filesystem) {
         trigger_error('Filesystem is not available', E_USER_ERROR);
     }
     try {
         $cache_key = 'fw_wp_filesystem/base_dirs_map';
         return FW_Cache::get($cache_key);
     } catch (FW_Cache_Not_Found_Exception $e) {
         $themes_dir = get_theme_root();
         // Account for relative theme roots
         if ('/themes' == $themes_dir || !is_dir($themes_dir)) {
             $themes_dir = WP_CONTENT_DIR . $themes_dir;
         }
         $dirs = array(fw_fix_path(ABSPATH) => fw_fix_path($wp_filesystem->abspath()), fw_fix_path(WP_CONTENT_DIR) => fw_fix_path($wp_filesystem->wp_content_dir()), fw_fix_path(WP_PLUGIN_DIR) => fw_fix_path($wp_filesystem->wp_plugins_dir()), fw_fix_path($themes_dir) => fw_fix_path($wp_filesystem->wp_themes_dir()));
         FW_Cache::set($cache_key, $dirs);
         return $dirs;
     }
 }
开发者ID:chrisuehlein,项目名称:couponsite,代码行数:24,代码来源:class-fw-wp-filesystem.php


示例11: execute

 /**
  * {@inheritdoc}
  * @param array $args
  * * source_dir - everything from this directory will be added in zip
  * * destination_dir - where the zip file will be created
  *
  * Warning!
  *  Zip can't be executed in steps, it will execute way too long,
  *  because it is impossible to update a zip file, every time you add a file to zip,
  *  a new temp copy of original zip is created with new modifications, it is compressed,
  *  and the original zip is replaced. So when the zip will grow in size,
  *  just adding a single file, will take a very long time.
  */
 public function execute(array $args, array $state = array())
 {
     if (!isset($args['source_dir'])) {
         return new WP_Error('no_source_dir', __('Source dir not specified', 'fw'));
     } else {
         $args['source_dir'] = fw_fix_path($args['source_dir']);
     }
     if (!isset($args['destination_dir'])) {
         return new WP_Error('no_destination_dir', __('Destination dir not specified', 'fw'));
     } else {
         $args['destination_dir'] = fw_fix_path($args['destination_dir']);
     }
     if (!class_exists('ZipArchive')) {
         return new WP_Error('zip_ext_missing', __('Zip extension missing', 'fw'));
     }
     $zip_path = $args['source_dir'] . '/' . implode('-', array('fw-backup', date('Y_m_d-H_i_s'), fw_ext('backups')->manifest->get_version())) . '.zip';
     $zip = new ZipArchive();
     if (false === ($zip_error_code = $zip->open($zip_path, ZipArchive::CREATE))) {
         return new WP_Error('cannot_open_zip', sprintf(__('Cannot open zip (Error code: %s)', 'fw'), $zip_error_code));
     }
     $files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($args['source_dir']), RecursiveIteratorIterator::LEAVES_ONLY);
     foreach ($files as $name => $file) {
         if (!$file->isDir()) {
             // Skip directories (they would be added automatically)
             if (($file_path = $file->getRealPath()) !== $zip_path) {
                 $zip->addFile($file_path, substr(fw_fix_path($file_path), strlen($args['source_dir']) + 1));
             }
         }
     }
     wp_cache_flush();
     FW_Cache::clear();
     // Zip archive will be created only after closing object
     if (!$zip->close()) {
         return new WP_Error('cannot_close_zip', __('Cannot close the zip file', 'fw'));
     }
     if (!rename($zip_path, $args['destination_dir'] . '/' . basename($zip_path))) {
         return new WP_Error('cannot_move_zip', __('Cannot move zip in destination dir', 'fw'));
     }
     return true;
 }
开发者ID:azharijelek,项目名称:Unyson-Backups-Extension,代码行数:53,代码来源:class-fw-ext-backups-task-type-zip.php


示例12: get_settings_options

 public final function get_settings_options()
 {
     $cache_key = $this->get_cache_key() . '/settings_options';
     try {
         return FW_Cache::get($cache_key);
     } catch (FW_Cache_Not_Found_Exception $e) {
         $path = $this->get_declared_path('/settings-options.php');
         if (!file_exists($path)) {
             FW_Cache::set($cache_key, array());
             return array();
         }
         $variables = fw_get_variables_from_file($path, array('options' => array()));
         FW_Cache::set($cache_key, $variables['options']);
         return $variables['options'];
     }
 }
开发者ID:floq-design,项目名称:Unyson,代码行数:16,代码来源:class-fw-extension.php


示例13: set

 public final function set($item_id = null, $option_id = null, $value, array $extra_data = array())
 {
     FW_Cache::del($cache_key_values = $this->get_cache_key('values', $item_id, $extra_data));
     FW_Cache::del($cache_key_values_processed = $this->get_cache_key('values:processed', $item_id, $extra_data));
     try {
         $options = FW_Cache::get($cache_key = $this->get_cache_key('options', $item_id, $extra_data));
     } catch (FW_Cache_Not_Found_Exception $e) {
         FW_Cache::set($cache_key, array());
         // prevent recursion
         FW_Cache::set($cache_key, $options = fw_extract_only_options($this->get_options($item_id, $extra_data)));
     }
     $sub_keys = null;
     if ($option_id) {
         $option_id = explode('/', $option_id);
         // 'option_id/sub/keys'
         $_option_id = array_shift($option_id);
         // 'option_id'
         $sub_keys = empty($option_id) ? null : implode('/', $option_id);
         // 'sub/keys'
         $option_id = $_option_id;
         unset($_option_id);
         $old_values = is_array($old_values = $this->get_values($item_id, $extra_data)) ? $old_values : array();
         $old_value = isset($old_values[$option_id]) ? $old_values[$option_id] : null;
         if ($sub_keys) {
             // update sub_key in old_value and use the entire value
             $new_value = $old_value;
             fw_aks($sub_keys, $value, $new_value);
             $value = $new_value;
             unset($new_value);
             $old_value = fw_akg($sub_keys, $old_value);
         }
         if (isset($options[$option_id])) {
             $value = fw()->backend->option_type($options[$option_id]['type'])->storage_save($option_id, $options[$option_id], $value, $this->get_fw_storage_params($item_id, $extra_data));
         }
         $old_values[$option_id] = $value;
         $this->set_values($item_id, $old_values, $extra_data);
         unset($old_values);
     } else {
         $old_value = is_array($old_values = $this->get_values($item_id, $extra_data)) ? $old_values : array();
         if (!is_array($value)) {
             $value = array();
         }
         foreach ($value as $_option_id => $_option_value) {
             if (isset($options[$_option_id])) {
                 $value[$_option_id] = fw()->backend->option_type($options[$_option_id]['type'])->storage_save($_option_id, $options[$_option_id], $_option_value, $this->get_fw_storage_params($item_id, $extra_data));
             }
         }
         $this->set_values($item_id, $value, $extra_data);
     }
     FW_Cache::del($cache_key_values);
     // fixes https://github.com/ThemeFuse/Unyson/issues/1538
     FW_Cache::del($cache_key_values_processed);
     $this->_after_set($item_id, $option_id, $sub_keys, $old_value, $extra_data);
 }
开发者ID:puriwp,项目名称:Theme-Framework,代码行数:54,代码来源:class-fw-db-options-model.php


示例14: get_sets

 private function get_sets()
 {
     $cache_key = 'fw_option_type_icon/sets';
     try {
         return FW_Cache::get($cache_key);
     } catch (FW_Cache_Not_Found_Exception $e) {
         $sets = apply_filters('fw_option_type_icon_sets', $this->get_default_sets());
         // do not allow overwrite default sets
         $sets = array_merge($sets, $this->get_default_sets());
         FW_Cache::set($cache_key, $sets);
         return $sets;
     }
 }
开发者ID:cristeamdev,项目名称:Unyson,代码行数:13,代码来源:class-fw-option-type-icon.php


示例15: import_fp

 public function import_fp($fp, $keep_users_tables = false, $fix_foreign_database = false, $keep_options = false)
 {
     /**
      * @var wpdb $wpdb
      */
     global $wpdb;
     $helper = new FW_Backup_Helper_Database();
     $exporter = new FW_Backup_Export_Database();
     /**
      * fixme: all options should have bool for wp_option autoload | array( 'option_name' => (bool)autoload )
      */
     $option_list = array($wpdb->prefix . 'user_roles', 'siteurl', 'blogname', 'blog_charset', 'blogdescription', 'admin_email', 'mailserver_url', 'mailserver_login', 'mailserver_pass', 'mailserver_port', 'ftp_credentials', 'use_ssl', 'template', 'stylesheet', 'current_theme', 'WPLANG');
     $option_list = apply_filters('fw_ext_backup_import_skip_options', $option_list);
     // Preserve some options
     $before = array_map('get_option', $option_list);
     $before = array_combine($option_list, $before);
     // Preserve Backup History and Backup Settings
     $history = $exporter->export_history();
     $settings = $exporter->export_settings();
     // Import database (preserve user related tables)
     // ==============================================
     if ($keep_users_tables) {
         $foreign_prefix = $exporter->import_fp($fp, array($wpdb->users, $wpdb->usermeta));
     } else {
         $foreign_prefix = $exporter->import_fp($fp);
     }
     wp_cache_flush();
     FW_Cache::clear();
     $fw_extensions_data = get_option('fw_extensions', array());
     if (!empty($fw_extensions_data[$this->backup()->get_name()]['wp_upload_dir']['baseurl']) && $fix_foreign_database) {
         $wp_upload_dir = wp_upload_dir();
         // Fix database
         if ($fix_foreign_database) {
             $helper->fix_foreign_database(array(fw_get_url_without_scheme($fw_extensions_data[$this->backup()->get_name()]['wp_upload_dir']['baseurl']) => fw_get_url_without_scheme($wp_upload_dir['baseurl']), str_replace('/', '\\/', fw_get_url_without_scheme($fw_extensions_data[$this->backup()->get_name()]['wp_upload_dir']['baseurl'] . '/')) => str_replace('/', '\\/', fw_get_url_without_scheme($wp_upload_dir['baseurl'] . '/')), str_replace('/', '\\\\/', fw_get_url_without_scheme($fw_extensions_data[$this->backup()->get_name()]['wp_upload_dir']['baseurl'] . '/')) => str_replace('/', '\\\\/', fw_get_url_without_scheme($wp_upload_dir['baseurl'] . '/')), str_replace('/', '\\\\/', fw_get_url_without_scheme($fw_extensions_data[$this->backup()->get_name()]['wp_upload_dir']['baseurl'] . '/')) => str_replace('/', '\\\\/', fw_get_url_without_scheme($wp_upload_dir['baseurl'] . '/'))));
         }
     }
     // Restore Backup History and Settings
     $exporter->import_history($history);
     $exporter->import_settings($settings);
     // Fix database
     if ($fix_foreign_database) {
         $uploadDir = wp_upload_dir();
         $uploadOld = fw_get_url_without_scheme(site_url() . '/wp-content/uploads/');
         $uploadNew = fw_get_url_without_scheme($uploadDir['baseurl'] . '/');
         $helper->fix_foreign_database(array($uploadOld => $uploadNew, str_replace('/', '\\/', $uploadOld) => str_replace('/', '\\/', $uploadNew), str_replace('/', '\\\\/', $uploadOld) => str_replace('/', '\\\\/', $uploadNew), str_replace('/', '\\\\/', $uploadOld) => str_replace('/', '\\\\/', $uploadNew), site_url() => $before['siteurl'], site_url() . '/' => $before['siteurl'] . '/', fw_get_url_without_scheme(site_url() . '/') => fw_get_url_without_scheme($before['siteurl'] . '/'), str_replace('/', '\\/', fw_get_url_without_scheme(site_url() . '/')) => str_replace('/', '\\/', fw_get_url_without_scheme($before['siteurl'] . '/')), str_replace('/', '\\\\/', fw_get_url_without_scheme(site_url() . '/')) => str_replace('/', '\\\\/', fw_get_url_without_scheme($before['siteurl'] . '/')), str_replace('/', '\\\\/', fw_get_url_without_scheme(site_url() . '/')) => str_replace('/', '\\\\/', fw_get_url_without_scheme($before['siteurl'] . '/'))));
         $helper->fix_wp_options($foreign_prefix);
     }
     wp_cache_flush();
     FW_Cache::clear();
     // Restore options
     if ($keep_options) {
         // WP keeps stylesheet settings in theme_mods_{stylesheet} option,
         // that means that if stylesheet option has different value in dump file and in database
         // new theme_mods_{stylesheet} should be rename to old theme_mods_{stylesheet}
         $stylesheet = get_option('stylesheet');
         if ($before['stylesheet'] != $stylesheet) {
             $theme_mods_before = 'theme_mods_' . $before['stylesheet'];
             $theme_mods_after = 'theme_mods_' . $stylesheet;
             $query = $wpdb->prepare("\n\t\t\t\t\tDELETE FROM\n\t\t\t\t\t\t{$wpdb->options}\n\t\t\t\t\tWHERE\n\t\t\t\t\t    option_name = %s\n\t\t\t\t", $theme_mods_before);
             $wpdb->query($query);
             $query = $wpdb->prepare("\n\t\t\t\t\tUPDATE\n\t\t\t\t\t\t{$wpdb->options}\n\t\t\t\t\tSET\n\t\t\t\t\t\toption_name = %s\n\t\t\t\t\tWHERE\n\t\t\t\t\t\toption_name = %s\n\t\t\t\t", $theme_mods_before, $theme_mods_after);
             $wpdb->query($query);
         }
         // Restore all saved options
         array_map('update_option', array_keys($before), $before);
     }
     // Actualize settings
     $this->backup()->cron()->reschedule();
     wp_cache_flush();
     FW_Cache::clear();
 }
开发者ID:ExtPoint,项目名称:Unyson-Backup-Extension,代码行数:71,代码来源:class-fw-backup-helper-database.php


示例16: fw_get_google_fonts

/**
 * @return Array with Google fonts
 */
function fw_get_google_fonts()
{
    $cache_key = 'fw_google_fonts';
    try {
        return FW_Cache::get($cache_key);
    } catch (FW_Cache_Not_Found_Exception $e) {
        $fonts = apply_filters('fw_google_fonts', include dirname(__FILE__) . '/fw-google-fonts.json.php');
        FW_Cache::set($cache_key, $fonts);
        return $fonts;
    }
}
开发者ID:joelgarciajr84,项目名称:Unyson,代码行数:14,代码来源:general.php


示例17: get_installed_extensions

 /**
  * Scan all directories for extensions
  *
  * @param bool $reset_cache
  * @return array
  */
 private function get_installed_extensions($reset_cache = false)
 {
     $cache_key = $this->get_cache_key('installed_extensions');
     if ($reset_cache) {
         FW_Cache::del($cache_key);
     }
     try {
         return FW_Cache::get($cache_key);
     } catch (FW_Cache_Not_Found_Exception $e) {
         $extensions = array();
         foreach (fw()->extensions->get_locations() as $location) {
             // leave only used keys
             $location = array('path' => $location['path'], 'is' => $location['is']);
             $this->read_extensions($location, $extensions);
         }
         FW_Cache::set($cache_key, $extensions);
         return $extensions;
     }
 }
开发者ID:northpen,项目名称:northpen,代码行数:25,代码来源:class--fw-extensions-manager.php


示例18: get_config

 /**
  * Return config key value, or entire config array
  * Config array is merged from child configs
  * @param string|null $key Multi key format accepted: 'a/b/c'
  * @return mixed|null
  */
 public final function get_config($key = null)
 {
     $cache_key = self::$cache_key . '/config';
     try {
         $config = FW_Cache::get($cache_key);
     } catch (FW_Cache_Not_Found_Exception $e) {
         $config = array();
         if (file_exists(FW_PT_CUSTOM_DIR . '/theme/config.php')) {
             $variables = fw_get_variables_from_file(FW_PT_CUSTOM_DIR . '/theme/config.php', array('cfg' => null));
             if (!empty($variables['cfg'])) {
                 $config = array_merge($config, $variables['cfg']);
                 unset($variables);
             }
         }
         if (FW_CT && file_exists(FW_CT_CUSTOM_DIR . '/theme/config.php')) {
             $variables = fw_get_variables_from_file(FW_CT_CUSTOM_DIR . '/theme/config.php', array('cfg' => null));
             if (!empty($variables['cfg'])) {
                 $config = array_merge($config, $variables['cfg']);
                 unset($variables);
             }
         }
         unset($path);
         FW_Cache::set($cache_key, $config);
     }
     return $key === null ? $config : fw_akg($key, $config);
 }
开发者ID:AdsonCicilioti,项目名称:Unyson,代码行数:32,代码来源:theme.php


示例19: get_backups_dir

 /**
  * All backups (zip) will go in this directory
  * @return string
  */
 public function get_backups_dir()
 {
     $cache_key = $this->get_cache_key('/dir');
     try {
         return FW_Cache::get($cache_key);
     } catch (FW_Cache_Not_Found_Exception $e) {
         $uploads = wp_upload_dir();
         $dir = fw_fix_path($uploads['basedir']) . '/fw-backup';
         FW_Cache::set($cache_key, $dir);
         return $dir;
     }
 }
开发者ID:azharijelek,项目名称:Unyson-Backups-Extension,代码行数:16,代码来源:class-fw-extension-backups.php


示例20: fw_get_google_fonts

/**
 * @return Array with Google fonts
 */
function fw_get_google_fonts()
{
    $cache_key = 'fw_google_fonts';
    try {
        return FW_Cache::get($cache_key);
    } catch (FW_Cache_Not_Found_Exception $e) {
        $fonts = apply_filters('fw_google_fonts', json_decode(file_get_contents(dirname(__FILE__) . '/fw-google-fonts.json'), true));
        FW_Cache::set($cache_key, $fonts);
        return $fonts;
    }
}
开发者ID:halkibsi,项目名称:Unyson,代码行数:14,代码来源:general.php



注:本文中的FW_Cache类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP FW_Option_Type类代码示例发布时间:2022-05-23
下一篇:
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap