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


PHP pods_transient_clear函数代码示例

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


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

示例1: cache_flush_pods

 /**
  * Clear Pod-related cache
  *
  * @param array $pod
  *
  * @return void
  *
  * @since 2.0
  */
 public function cache_flush_pods($pod = null)
 {
     /**
      * @var $wpdb wpdb
      */
     global $wpdb;
     pods_transient_clear('pods');
     pods_transient_clear('pods_components');
     if (null !== $pod && is_array($pod)) {
         pods_transient_clear('pods_pod_' . $pod['name']);
         pods_cache_clear($pod['name'], 'pods-class');
         foreach ($pod['fields'] as $field) {
             pods_transient_clear('pods_field_' . $pod['name'] . '_' . $field['name']);
         }
         if (in_array($pod['type'], array('post_type', 'taxonomy'))) {
             pods_transient_clear('pods_wp_cpt_ct');
         }
     } else {
         pods_transient_clear('pods_wp_cpt_ct');
     }
     $wpdb->query("DELETE FROM `{$wpdb->options}` WHERE `option_name` LIKE '_transient_pods%'");
     $wpdb->query("DELETE FROM `{$wpdb->options}` WHERE `option_name` LIKE '_transient_timeout_pods%'");
     pods_cache_clear(true);
     pods_transient_set('pods_flush_rewrites', 1);
 }
开发者ID:satokora,项目名称:IT354Project,代码行数:34,代码来源:PodsAPI.php

示例2: load

 /**
  * Load activated components and init component
  *
  * @since 2.0
  */
 public function load()
 {
     do_action('pods_components_load');
     foreach ((array) $this->components as $component => $component_data) {
         $component_data['MustUse'] = apply_filters('pods_component_require_' . $component_data['ID'], $component_data['MustUse'], $component_data);
         if (false === $component_data['MustUse'] && (!isset($this->settings['components'][$component]) || 0 == $this->settings['components'][$component])) {
             continue;
         }
         if (!empty($component_data['PluginDependency'])) {
             $dependency = explode('|', $component_data['PluginDependency']);
             if (!pods_is_plugin_active($dependency[1])) {
                 continue;
             }
         }
         if (!empty($component_data['ThemeDependency'])) {
             $dependency = explode('|', $component_data['ThemeDependency']);
             if (strtolower($dependency[1]) != strtolower(get_template()) && strtolower($dependency[1]) != strtolower(get_stylesheet())) {
                 continue;
             }
         }
         if (false === $component_data['External']) {
             $component_data['File'] = realpath($this->components_dir . $component_data['File']);
         }
         if (empty($component_data['File'])) {
             pods_transient_clear('pods_components');
             continue;
         }
         if (!file_exists($component_data['File'])) {
             pods_message('Pods Component not found: ' . $component_data['File']);
             pods_transient_clear('pods_components');
             continue;
         }
         include_once $component_data['File'];
         if (!empty($component_data['Class']) && class_exists($component_data['Class']) || isset($component_data['object'])) {
             if (!isset($this->components[$component]['object'])) {
                 $this->components[$component]['object'] = new $component_data['Class']();
             }
             if (method_exists($this->components[$component]['object'], 'options')) {
                 if (isset($this->settings['components'][$component])) {
                     $this->components[$component]['options'] = $this->components[$component]['object']->options($this->settings['components'][$component]);
                 } else {
                     $this->components[$component]['options'] = $this->components[$component]['object']->options(array());
                 }
                 $this->options($component, $this->components[$component]['options']);
             } else {
                 $this->options($component, array());
             }
             if (method_exists($this->components[$component]['object'], 'handler')) {
                 $this->components[$component]['object']->handler($this->settings['components'][$component]);
             }
         }
     }
 }
开发者ID:Ingenex,项目名称:redesign,代码行数:58,代码来源:PodsComponents.php

示例3: admin_components_toggle

 /**
  * Toggle a component on or off
  *
  * @param PodsUI $ui
  *
  * @return bool
  */
 public function admin_components_toggle(PodsUI $ui)
 {
     $component = $_GET['id'];
     if (!empty(PodsInit::$components->components[$component]['PluginDependency'])) {
         $dependency = explode('|', PodsInit::$components->components[$component]['PluginDependency']);
         if (!pods_is_plugin_active($dependency[1])) {
             $website = 'http://wordpress.org/extend/plugins/' . dirname($dependency[1]) . '/';
             if (isset($dependency[2])) {
                 $website = $dependency[2];
             }
             if (!empty($website)) {
                 $website = ' ' . sprintf(__('You can find it at %s', 'pods'), '<a href="' . $website . '" target="_blank">' . $website . '</a>');
             }
             $message = sprintf(__('The %s component requires that you have the <strong>%s</strong> plugin installed and activated.', 'pods'), PodsInit::$components->components[$component]['Name'], $dependency[0]) . $website;
             $ui->error($message);
             $ui->manage();
             return;
         }
     }
     if (!empty(PodsInit::$components->components[$component]['ThemeDependency'])) {
         $dependency = explode('|', PodsInit::$components->components[$component]['ThemeDependency']);
         if (strtolower($dependency[1]) != strtolower(get_template()) && strtolower($dependency[1]) != strtolower(get_stylesheet())) {
             $website = '';
             if (isset($dependency[2])) {
                 $website = ' ' . sprintf(__('You can find it at %s', 'pods'), '<a href="' . $dependency[2] . '" target="_blank">' . $dependency[2] . '</a>');
             }
             $message = sprintf(__('The %s component requires that you have the <strong>%s</strong> theme installed and activated.', 'pods'), PodsInit::$components->components[$component]['Name'], $dependency[0]) . $website;
             $ui->error($message);
             $ui->manage();
             return;
         }
     }
     if (!empty(PodsInit::$components->components[$component]['MustUse'])) {
         $message = sprintf(__('The %s component can not be disabled from here. You must deactivate the plugin or theme that added it.', 'pods'), PodsInit::$components->components[$component]['Name']);
         $ui->error($message);
         $ui->manage();
         return;
     }
     if (1 == pods_var('toggled')) {
         $toggle = PodsInit::$components->toggle($component);
         if (true === $toggle) {
             $ui->message(PodsInit::$components->components[$component]['Name'] . ' ' . __('Component enabled', 'pods'));
         } elseif (false === $toggle) {
             $ui->message(PodsInit::$components->components[$component]['Name'] . ' ' . __('Component disabled', 'pods'));
         }
         $components = PodsInit::$components->components;
         foreach ($components as $component => &$component_data) {
             $toggle = 0;
             if (isset(PodsInit::$components->settings['components'][$component_data['ID']])) {
                 if (0 != PodsInit::$components->settings['components'][$component_data['ID']]) {
                     $toggle = 1;
                 }
             }
             if (true === $component_data['DeveloperMode']) {
                 if (!pods_developer()) {
                     unset($components[$component]);
                     continue;
                 }
             }
             $component_data = array('id' => $component_data['ID'], 'name' => $component_data['Name'], 'description' => make_clickable($component_data['Description']), 'version' => $component_data['Version'], 'author' => $component_data['Author'], 'toggle' => $toggle);
         }
         $ui->data = $components;
         pods_transient_clear('pods_components');
         $url = pods_var_update(array('toggled' => null));
         pods_redirect($url);
     } elseif (1 == pods_var('toggle')) {
         $ui->message(PodsInit::$components->components[$component]['Name'] . ' ' . __('Component enabled', 'pods'));
     } else {
         $ui->message(PodsInit::$components->components[$component]['Name'] . ' ' . __('Component disabled', 'pods'));
     }
     $ui->manage();
 }
开发者ID:erkmen,项目名称:wpstartersetup,代码行数:79,代码来源:PodsAdmin.php

示例4: clear_cache

 /**
  * Clear cache on save
  *
  * @since 2.0
  */
 public function clear_cache($data, $pod = null, $id = null, $groups = null, $post = null)
 {
     $old_post = $id;
     if (!is_object($id)) {
         $old_post = null;
     }
     if (is_object($post) && $this->object_type != $post->post_type) {
         return;
     }
     if (!is_array($data) && 0 < $data) {
         $post = $data;
         $post = get_post($post);
     }
     if ($this->object_type == $post->post_type) {
         pods_transient_clear('pods_object_pages');
         if (is_object($old_post) && $this->object_type == $old_post->post_type) {
             pods_cache_clear($old_post->post_title, 'pods_object_page_wildcard');
         }
         pods_cache_clear($post->post_title, 'pods_object_page_wildcard');
         self::flush_rewrites();
     }
 }
开发者ID:erkmen,项目名称:wpstartersetup,代码行数:27,代码来源:Pages.php

示例5: reset

 /**
  * @param null $_blog_id
  */
 public function reset($_blog_id = null)
 {
     global $wpdb;
     // Switch DB table prefixes
     if (null !== $_blog_id && $_blog_id != $wpdb->blogid) {
         switch_to_blog(pods_absint($_blog_id));
     } else {
         $_blog_id = null;
     }
     $api = pods_api();
     $pods = $api->load_pods(array('names_ids' => true));
     foreach ($pods as $pod_id => $pod_label) {
         $api->delete_pod(array('id' => $pod_id));
     }
     $templates = $api->load_templates();
     foreach ($templates as $template) {
         $api->delete_template(array('id' => $template['id']));
     }
     $pages = $api->load_pages();
     foreach ($pages as $page) {
         $api->delete_page(array('id' => $page['id']));
     }
     $helpers = $api->load_helpers();
     foreach ($helpers as $helper) {
         $api->delete_helper(array('id' => $helper['id']));
     }
     $tables = $wpdb->get_results("SHOW TABLES LIKE '{$wpdb->prefix}pods%'", ARRAY_N);
     if (!empty($tables)) {
         foreach ($tables as $table) {
             $table = $table[0];
             pods_query("DROP TABLE `{$table}`", false);
         }
     }
     // Remove any orphans
     $wpdb->query("\n                DELETE `p`, `pm`\n                FROM `{$wpdb->posts}` AS `p`\n                LEFT JOIN `{$wpdb->postmeta}` AS `pm`\n                    ON `pm`.`post_id` = `p`.`ID`\n                WHERE\n                    `p`.`post_type` LIKE '_pods_%'\n            ");
     delete_option('pods_framework_version');
     delete_option('pods_framework_db_version');
     delete_option('pods_framework_upgrade_2_0');
     delete_option('pods_framework_upgraded_1_x');
     // @todo Make sure all entries are being cleaned and do something about the pods_framework_upgrade_{version} dynamic entries created by PodsUpgrade
     delete_option('pods_framework_upgrade_2_0_0');
     delete_option('pods_framework_upgrade_2_0_sister_ids');
     delete_option('pods_framework_version_last');
     delete_option('pods_component_settings');
     $api->cache_flush_pods();
     pods_transient_clear('pods_flush_rewrites');
     self::$version = '';
     // Restore DB table prefix (if switched)
     if (null !== $_blog_id) {
         restore_current_blog();
     }
 }
开发者ID:centaurustech,项目名称:chipin,代码行数:55,代码来源:PodsInit.php

示例6: reseter

 /**
  * Delete transients that stores the settings.
  *
  * @since 2.5.5
  */
 function reseter()
 {
     $keys = array('pods_pfat_the_pods', 'pods_pfat_auto_pods', 'pods_pfat_archive_test');
     foreach ($keys as $key) {
         pods_transient_clear($key);
     }
 }
开发者ID:benbrandt,项目名称:pods,代码行数:12,代码来源:Pods_Templates_Auto_Template_Settings.php

示例7: clear_cache

 /**
  * Clear cache on save
  *
  * @since 2.0
  */
 public function clear_cache($data, $pod = null, $id = null, $groups = null, $post = null)
 {
     $old_post = $id;
     if (!is_object($id)) {
         $old_post = null;
     }
     if (is_object($post) && $this->object_type != $post->post_type) {
         return;
     }
     if (!is_array($data) && 0 < $data) {
         $post = $data;
         $post = get_post($post);
     }
     if ($this->object_type == $post->object_type) {
         pods_transient_clear('pods_object_helpers');
     }
 }
开发者ID:Ingenex,项目名称:redesign,代码行数:22,代码来源:Helpers.php


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