当前位置: 首页>>代码示例>>PHP>>正文


PHP FW_Cache::del方法代码示例

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


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

示例1: set

 /**
  * @param string $meta_type
  * @param int $object_id
  * @param string $multi_key 'abc' or 'ab/c/def'
  * @param array|string|int|bool $set_value
  */
 public static function set($meta_type, $object_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);
     // Make sure meta is added to the post, not a revision.
     if ($meta_type === 'post' && ($the_post = wp_is_post_revision($object_id))) {
         $object_id = $the_post;
     }
     $cache_key = self::$cache_key . '/' . $meta_type . '/' . $object_id . '/' . $key;
     if (empty($multi_key) && $multi_key !== '0') {
         /** Replace entire meta */
         fw_update_metadata($meta_type, $object_id, $key, $set_value);
         FW_Cache::del($cache_key);
     } else {
         /** Change only specified key */
         $values = array();
         $values['original'] = self::get($meta_type, $object_id, $key, true);
         $values['prepared'] = self::get($meta_type, $object_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_metadata($meta_type, $object_id, $key, $values['original']);
     }
 }
开发者ID:floq-design,项目名称:Unyson,代码行数:35,代码来源: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: 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

示例4: 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

示例5: fw_set_db_post_option

/**
 * Set post option value in database
 *
 * @param null|int $post_id
 * @param string|null $option_id Specific option id (accepts multikey). null - all options
 * @param $value
 */
function fw_set_db_post_option($post_id = null, $option_id = null, $value)
{
    FW_Cache::del('fw_post_options/values');
    $meta_key = 'fw_options';
    $post_id = intval($post_id);
    if (!$post_id) {
        /** @var WP_Post $post */
        global $post;
        if (!$post) {
            return;
        } else {
            $post_id = $post->ID;
        }
    }
    $post_type = get_post_type(($post_revision_id = wp_is_post_revision($post_id)) ? $post_revision_id : $post_id);
    try {
        $options = FW_Cache::get($cache_key = 'fw_post_options/only/' . $post_type);
    } catch (FW_Cache_Not_Found_Exception $e) {
        FW_Cache::set($cache_key, $options = array());
        // prevent recursion
        if (apply_filters('fw_get_db_post_option:fw-storage-enabled', $post_type !== 'fw-slider', $post_type)) {
            FW_Cache::set($cache_key, $options = fw_extract_only_options(fw()->theme->get_post_options($post_type)));
        }
    }
    $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_value = fw_get_db_post_option($post_id, $option_id);
        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, array('post-id' => $post_id));
        }
        FW_WP_Meta::set('post', $post_id, $meta_key . '/' . $option_id, $value);
    } else {
        $old_value = fw_get_db_post_option($post_id);
        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, array('post-id' => $post_id));
            }
        }
        FW_WP_Meta::set('post', $post_id, $meta_key, $value);
    }
    FW_Cache::del('fw_post_options/values');
    // fixes https://github.com/ThemeFuse/Unyson/issues/1538
    /**
     * @deprecated
     */
    fw()->backend->_sync_post_separate_meta($post_id);
    /**
     * @since 2.2.8
     */
    do_action('fw_post_options_update', $post_id, $option_id, explode('/', $sub_keys), $old_value);
}
开发者ID:cristeamdev,项目名称:Unyson,代码行数:77,代码来源:database.php

示例6: 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

示例7: 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) {
         $search_paths = array('framework' => fw_get_framework_directory('/extensions'), 'parent' => fw_get_template_customizations_directory('/extensions'));
         if (is_child_theme()) {
             $search_paths['child'] = fw_get_stylesheet_customizations_directory('/extensions');
         }
         $extensions = array();
         foreach ($search_paths as $source => $path) {
             $this->read_extensions($source, $path, $extensions);
         }
         FW_Cache::set($cache_key, $extensions);
         return $extensions;
     }
 }
开发者ID:floq-design,项目名称:Unyson,代码行数:28,代码来源:class--fw-extensions-manager.php

示例8: _reset_cache

 /**
  * @internal
  */
 public function _reset_cache()
 {
     FW_Cache::del($this->get_main_cache_key());
 }
开发者ID:puriwp,项目名称:Theme-Framework,代码行数:7,代码来源:database.php


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