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


PHP nocache_headers函数代码示例

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


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

示例1: nocache

 /**
  * Set nocache constants and headers.
  *
  * @access private
  * @return void
  */
 private function nocache()
 {
     if (!defined('DONOTCACHEPAGE')) {
         define("DONOTCACHEPAGE", "true");
     }
     nocache_headers();
 }
开发者ID:rongandat,项目名称:sallumeh,代码行数:13,代码来源:class-wc-cache-helper.php

示例2: create_post

 public function create_post()
 {
     global $json_api;
     if (!$json_api->query->nonce) {
         $json_api->error("You must include a 'nonce' value to create posts. Use the `get_nonce` Core API method.");
     }
     if (!$json_api->query->cookie) {
         $json_api->error("You must include a 'cookie' authentication cookie. Use the `create_auth_cookie` Auth API method.");
     }
     $nonce_id = $json_api->get_nonce_id('posts', 'create_post');
     if (!wp_verify_nonce($json_api->query->nonce, $nonce_id)) {
         $json_api->error("Your 'nonce' value was incorrect. Use the 'get_nonce' API method.");
     }
     $user_id = wp_validate_auth_cookie($json_api->query->cookie, 'logged_in');
     if (!$user_id) {
         $json_api->error("Invalid authentication cookie. Use the `generate_auth_cookie` Auth API method.");
     }
     if (!user_can($user_id, 'edit_posts')) {
         $json_api->error("You need to login with a user capable of creating posts.");
     }
     nocache_headers();
     $post = new JSON_API_Post();
     $id = $post->create($_REQUEST);
     if (empty($id)) {
         $json_api->error("Could not create post.");
     }
     return array('post' => $post);
 }
开发者ID:anju-mds,项目名称:wp-json-api-auth,代码行数:28,代码来源:posts.php

示例3: init

 /**
  * Check if data update is needed after version update
  */
 function init()
 {
     global $userMeta;
     $history = $userMeta->getData('history');
     $lastVersion = null;
     if (!empty($history)) {
         if (isset($history['version']['last_version'])) {
             $lastVersion = $history['version']['last_version'];
         }
     }
     if (version_compare($userMeta->version, $lastVersion, '<=')) {
         return;
     }
     // Determine last version and run data update
     if ($lastVersion) {
         self::runUpgrade($lastVersion);
     } else {
         if (get_option('user_meta_fields')) {
             self::runUpgrade('1.1.0');
         } elseif (get_option('user_meta_field')) {
             self::runUpgrade('1.0.3');
         }
     }
     // Saveing last version data
     $history['version']['last_version'] = $userMeta->version;
     $history['version'][$userMeta->version] = array('timestamp' => time());
     $userMeta->updateData('history', $history);
     nocache_headers();
 }
开发者ID:hoonio,项目名称:PhoneAfrika,代码行数:32,代码来源:umVersionUpdateController.php

示例4: action_authorize

 /**
  * Sets the nonce cookie then redirects to Sopresto.
  *
  * @return void
  */
 public function action_authorize()
 {
     $proxy = apply_filters('social_authorize_url', Social::$api_url . $this->request->query('key') . '/authorize/', $this->request->query('key'));
     if (strpos($proxy, Social::$api_url) !== false) {
         $salt = $this->auth_nonce_salt();
         $id = Social::wp39_create_nonce($this->auth_nonce_key($salt));
         $url = home_url('index.php');
         $args = array('social_controller' => 'auth', 'social_action' => 'authorized', 'salt' => $salt);
         if (is_admin()) {
             $args['is_admin'] = 'true';
             $args['user_id'] = get_current_user_id();
             if (defined('IS_PROFILE_PAGE')) {
                 $args['personal'] = 'true';
                 $url = add_query_arg('personal', 'true', $url);
             }
         } else {
             $post_id = $this->request->query('post_id');
             if ($post_id !== null) {
                 $args['p'] = $post_id;
             }
             // Set the nonce cookie
             setcookie('social_auth_nonce', $id, 0, '/');
         }
         $proxy = add_query_arg(array('v' => '2', 'id' => $id, 'response_url' => urlencode(add_query_arg($args, $url))), $proxy);
         $proxy = apply_filters('social_proxy_url', $proxy);
     }
     nocache_headers();
     Social::log('Authorizing with URL: ' . $proxy);
     wp_redirect($proxy);
     exit;
 }
开发者ID:sekane81,项目名称:ratoninquietoweb,代码行数:36,代码来源:auth.php

示例5: wp

 public function wp()
 {
     global $post;
     if (is_singular() && post_password_required($post->ID)) {
         nocache_headers();
     }
 }
开发者ID:ashenkar,项目名称:sanga,代码行数:7,代码来源:caching.class.php

示例6: set_cookie

 private function set_cookie()
 {
     nocache_headers();
     if (isset($_GET['mid']) || isset($_GET['cond'])) {
         return false;
     }
     global $upload;
     $upload = false;
     if (isset($_POST['upload'])) {
         if ($_POST['upload'] === 'Font Upload') {
             if (move_uploaded_file($_FILES['font']['tmp_name'], dirname(__FILE__) . '/fonts/' . $_FILES['font']['name'])) {
                 update_option('meme_message', '<div class="updated" style="margin-left:0;"><p>Font uploaded Successfully</p></div>');
             }
             return false;
         }
         global $guploaderr;
         $guploaderr = true;
         include 'meme-image-upload.php';
         if ($guploaderr) {
             return false;
         }
         if (get_option('meme_message')) {
             $upload = $_FILES['image']['name'];
             $upload = str_replace(array('.jpeg', '.png', '.JPG', '.PNG', '.JPEG', '.gif', '.GIF'), '.jpg', $upload);
             if ($upload) {
                 unset($_COOKIE['meme_uploaded_image']);
             }
         }
     }
     if (isset($_COOKIE['meme_uploaded_image'])) {
         $upload = $_COOKIE['meme_uploaded_image'];
     } else {
         setcookie("meme_uploaded_image", $upload, 0);
     }
 }
开发者ID:maesson,项目名称:lyft,代码行数:35,代码来源:meme-generator.php

示例7: wpui_export_settings

function wpui_export_settings()
{
    if (empty($_POST['wpui_action']) || 'export_settings' != $_POST['wpui_action']) {
        return;
    }
    if (!wp_verify_nonce($_POST['wpui_export_nonce'], 'wpui_export_nonce')) {
        return;
    }
    if (!current_user_can('manage_options')) {
        return;
    }
    $settings["wpui_option_name"] = get_option('wpui_option_name');
    $settings["wpui_login_option_name"] = get_option('wpui_login_option_name');
    $settings["wpui_global_option_name"] = get_option('wpui_global_option_name');
    $settings["wpui_dashboard_option_name"] = get_option('wpui_dashboard_option_name');
    $settings["wpui_admin_menu_option_name"] = get_option('wpui_admin_menu_option_name');
    $settings["wpui_admin_bar_option_name"] = get_option('wpui_admin_bar_option_name');
    $settings["wpui_editor_option_name"] = get_option('wpui_editor_option_name');
    $settings["wpui_metaboxes_option_name"] = get_option('wpui_metaboxes_option_name');
    $settings["wpui_columns_option_name"] = get_option('wpui_columns_option_name');
    $settings["wpui_library_option_name"] = get_option('wpui_library_option_name');
    $settings["wpui_profil_option_name"] = get_option('wpui_profil_option_name');
    $settings["wpui_plugins_option_name"] = get_option('wpui_plugins_option_name');
    $settings["wpui_roles_option_name"] = get_option('wpui_roles_option_name');
    ignore_user_abort(true);
    nocache_headers();
    header('Content-Type: application/json; charset=utf-8');
    header('Content-Disposition: attachment; filename=wpui-settings-export-' . date('m-d-Y') . '.json');
    header("Expires: 0");
    echo json_encode($settings);
    exit;
}
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:32,代码来源:wpadminui-core.php

示例8: app_login_init

function app_login_init()
{
    nocache_headers();
    if (isset($_REQUEST['action'])) {
        $action = $_REQUEST['action'];
    } else {
        $action = 'login';
    }
    //Set a cookie now to see if they are supported by the browser.
    setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
    if (SITECOOKIEPATH != COOKIEPATH) {
        setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
    }
    // allow plugins to override the default actions, and to add extra actions if they want
    do_action('login_init');
    do_action('login_form_' . $action);
    switch ($action) {
        case 'lostpassword':
        case 'retrievepassword':
            app_show_password();
            break;
        case 'register':
            app_show_registration();
            break;
        case 'login':
        default:
            app_show_login();
            break;
    }
    exit;
}
开发者ID:ugurbastan,项目名称:swe-574-group4,代码行数:31,代码来源:theme-login.php

示例9: delete_post

 public function delete_post()
 {
     global $json_api;
     $post = $json_api->introspector->get_current_post();
     if (empty($post)) {
         $json_api->error("Post not found.");
     }
     if (!current_user_can('edit_post', $post->ID)) {
         $json_api->error("You need to login with a user that has the 'edit_post' capacity for that post.");
     }
     if (!current_user_can('delete_posts')) {
         $json_api->error("You need to login with a user that has the 'delete_posts' capacity.");
     }
     if ($post->post_author != get_current_user_id() && !current_user_can('delete_other_posts')) {
         $json_api->error("You need to login with a user that has the 'delete_other_posts' capacity.");
     }
     if (!$json_api->query->nonce) {
         $json_api->error("You must include a 'nonce' value to update posts. Use the `get_nonce` Core API method.");
     }
     $nonce_id = $json_api->get_nonce_id('posts', 'delete_post');
     if (!wp_verify_nonce($json_api->query->nonce, $nonce_id)) {
         $json_api->error("Your 'nonce' value was incorrect. Use the 'get_nonce' API method.");
     }
     nocache_headers();
     wp_delete_post($post->ID);
     return array();
 }
开发者ID:Ryan4021,项目名称:angularwp,代码行数:27,代码来源:posts.php

示例10: export_slider

 /**
  * Exports a Soliloquy slider.
  *
  * @since 1.0.0
  *
  * @return null Return early if failing proper checks to export the slider.
  */
 public function export_slider()
 {
     if (!$this->has_exported_slider()) {
         return;
     }
     if (!$this->verify_exported_slider()) {
         return;
     }
     if (!$this->can_export_slider()) {
         return;
     }
     // Ignore the user aborting the action.
     ignore_user_abort(true);
     // Grab the proper data.
     $post_id = absint($_POST['soliloquy_post_id']);
     $data = get_post_meta($post_id, '_sol_slider_data', true);
     // Append the in_slider data checker to the data array.
     $data['in_slider'] = get_post_meta($post_id, '_sol_in_slider', true);
     // Set the proper headers.
     nocache_headers();
     header('Content-Type: application/json; charset=utf-8');
     header('Content-Disposition: attachment; filename=soliloquy-' . $post_id . '-' . date('m-d-Y') . '.json');
     header('Expires: 0');
     // Make the settings downloadable to a JSON file and die.
     die(json_encode($data));
 }
开发者ID:shellygraham,项目名称:lair-hill-crossing,代码行数:33,代码来源:export.php

示例11: export_settings

 /**
  * Export your settings
  * @author Julien Maury
  * @return bool|void
  */
 public function export_settings()
 {
     if (empty($_POST['export_facetwp']) || empty($_POST['action']) || 'export_facetwp_settings' !== $_POST['action']) {
         return;
     }
     if (!current_user_can('manage_options')) {
         return;
     }
     if (!wp_verify_nonce($_POST['export_facetwp_nonce'], 'export_facetwp_nonce')) {
         return;
     }
     $items = $_POST['export_facetwp'];
     if (!empty($items)) {
         foreach ($items as $item) {
             if ('facet' == substr($item, 0, 5)) {
                 $item_name = substr($item, 6);
                 $output['facets'][] = FacetWP::instance()->helper->get_facet_by_name($item_name);
             } elseif ('template' == substr($item, 0, 8)) {
                 $item_name = substr($item, 9);
                 $output['templates'][] = FacetWP::instance()->helper->get_template_by_name($item_name);
             }
         }
     }
     ignore_user_abort(true);
     nocache_headers();
     header('Content-Type: application/json; charset=utf-8');
     header('Content-Disposition: attachment; filename=facetwp-settings-export-' . strtotime('now') . '.json');
     header('Expires: 0');
     echo json_encode($output);
     exit;
 }
开发者ID:BeAPI,项目名称:bea-facetwp-import-export,代码行数:36,代码来源:import-export.php

示例12: satispress_send_file

/**
 * Send a download.
 *
 * @since 0.1.0
 *
 * @param string $file An absolute file path.
 */
function satispress_send_file($file)
{
    @session_write_close();
    if (function_exists('apache_setenv')) {
        @apache_setenv('no-gzip', 1);
    }
    if (get_magic_quotes_runtime()) {
        @set_magic_quotes_runtime(0);
    }
    @ini_set('zlib.output_compression', 'Off');
    @set_time_limit(0);
    @ob_end_clean();
    if (ob_get_level()) {
        @ob_end_clean();
        // Zip corruption fix.
    }
    nocache_headers();
    header('Robots: none');
    header('Content-Type: application/force-download');
    header('Content-Description: File Transfer');
    header('Content-Disposition: attachment; filename="' . basename($file) . '";');
    header('Content-Transfer-Encoding: binary');
    if ($size = @filesize($file)) {
        header('Content-Length: ' . $size);
    }
    @readfile_chunked($file) or wp_die(__('File not found', 'satispress'));
    exit;
}
开发者ID:blazersix,项目名称:satispress,代码行数:35,代码来源:functions.php

示例13: listen

 private static function listen()
 {
     if ($key = filter_input(INPUT_GET, self::PURGE_QUERY_VAR)) {
         $response = new stdClass();
         if ($key === self::get_purge_key()) {
             delete_transient(EXTEND_UPDATE);
             delete_transient('pagelines_extend_themes');
             delete_transient('pagelines_extend_sections');
             delete_transient('pagelines_extend_plugins');
             delete_transient('pagelines_extend_integrations');
             delete_transient('pagelines_sections_cache');
             remove_theme_mod('available_updates');
             remove_theme_mod('pending_updates');
             do_action('extend_flush');
             $response->status = 'success';
             $response->message = 'Cache purged.';
             $status_code = 200;
         } else {
             $response->status = 'fail';
             $response->message = 'Invalid key.';
             $status_code = 422;
         }
         if (!headers_sent()) {
             nocache_headers();
             @header("Content-type: application/json");
             status_header($status_code);
             echo json_encode($response);
             exit;
         } else {
             wp_die($response->message, $response->status, array('response' => $status_code));
         }
         // silence
     }
 }
开发者ID:aaemnnosttv,项目名称:pl2x-remote-purge,代码行数:34,代码来源:pl2x-remote-purge.php

示例14: settings_export

 /**
  * Process a settings export from config
  * @since    1.0.0
  */
 public function settings_export()
 {
     if (empty($_POST['pn_action']) || 'export_settings' != $_POST['pn_action']) {
         return;
     }
     if (!wp_verify_nonce($_POST['pn_export_nonce'], 'pn_export_nonce')) {
         return;
     }
     if (!current_user_can('manage_options')) {
         return;
     }
     $settings[0] = get_option($this->plugin_slug . '-settings');
     $settings[1] = get_option($this->plugin_slug . '-settings-second');
     ignore_user_abort(true);
     nocache_headers();
     header('Content-Type: application/json; charset=utf-8');
     header('Content-Disposition: attachment; filename=pn-settings-export-' . date('m-d-Y') . '.json');
     header("Expires: 0");
     if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
         echo json_encode($settings, JSON_PRETTY_PRINT);
     } else {
         echo json_encode($settings);
     }
     exit;
 }
开发者ID:ncross42,项目名称:dobalance,代码行数:29,代码来源:impexp.php

示例15: handle_api_requests

 /**
  * API request - Trigger any API requests.
  *
  * @since   2.0
  * @version 2.4
  */
 public function handle_api_requests()
 {
     global $wp;
     if (!empty($_GET['wc-api'])) {
         $wp->query_vars['wc-api'] = $_GET['wc-api'];
     }
     // wc-api endpoint requests.
     if (!empty($wp->query_vars['wc-api'])) {
         // Buffer, we won't want any output here.
         ob_start();
         // No cache headers.
         nocache_headers();
         // Clean the API request.
         $api_request = strtolower(wc_clean($wp->query_vars['wc-api']));
         // Trigger generic action before request hook.
         do_action('woocommerce_api_request', $api_request);
         // Is there actually something hooked into this API request? If not trigger 400 - Bad request.
         status_header(has_action('woocommerce_api_' . $api_request) ? 200 : 400);
         // Trigger an action which plugins can hook into to fulfill the request.
         do_action('woocommerce_api_' . $api_request);
         // Done, clear buffer and exit.
         ob_end_clean();
         die('-1');
     }
 }
开发者ID:tlovett1,项目名称:woocommerce,代码行数:31,代码来源:class-wc-api.php


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