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


PHP variable_initialize函数代码示例

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


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

示例1: refreshVariables

 /**
  * Refresh the in-memory set of variables.
  *
  * Refresh the in-memory set of variables. Useful after a page request is made
  * that changes a variable in a different thread.
  *
  * This is an overridden version of the function provided by the Drupal test
  * module. It maintains any settings created in settings.php (and it's
  * corresponding global.inc) file.
  *
  * In other words calling a settings page with $this->drupalPost() with a
  * changed value would update a variable to reflect that change, but in
  * the thread that made the call (thread running the test) the changed
  * variable would not be picked up.
  *
  * This method clears the variables cache and loads a fresh copy from
  * the database to ensure that the most up-to-date set of variables is loaded.
  */
 protected function refreshVariables()
 {
     global $conf;
     cache_clear_all('variables', 'cache_bootstrap');
     $variables = variable_initialize();
     // Merge updated database variables back into $conf.
     foreach ($variables as $name => $value) {
         $conf[$name] = $value;
     }
     return $conf;
 }
开发者ID:alexdesignworks,项目名称:site_test_helpers,代码行数:29,代码来源:site_test_helpers_case.php

示例2: refreshVariables

 /**
  * Refresh the in-memory set of variables and state values. Useful after a
  * page request is made that changes a variable in a different thread.
  *
  * In other words calling a settings page with $this->backdropPost() with a changed
  * value would update a variable to reflect that change, but in the thread that
  * made the call (thread running the test) the changed variable would not be
  * picked up.
  *
  * This method clears the variables cache and loads a fresh copy from the database
  * to ensure that the most up-to-date set of variables is loaded.
  */
 protected function refreshVariables()
 {
     global $conf;
     cache('bootstrap')->delete('variables');
     $conf = variable_initialize();
     backdrop_static_reset('states');
     backdrop_static_reset('config');
 }
开发者ID:thejimbirch,项目名称:backdropcms.org,代码行数:20,代码来源:backdrop_web_test_case.php

示例3: refreshVariables

 /**
  * Refresh the in-memory set of variables. Useful after a page request is made
  * that changes a variable in a different thread.
  *
  * In other words calling a settings page with $this->drupalPost() with a changed
  * value would update a variable to reflect that change, but in the thread that
  * made the call (thread running the test) the changed variable would not be
  * picked up.
  *
  * This method clears the variables cache and loads a fresh copy from the database
  * to ensure that the most up-to-date set of variables is loaded.
  */
 protected function refreshVariables()
 {
     global $conf;
     cache_clear_all('variables', 'cache_bootstrap');
     $conf = variable_initialize();
 }
开发者ID:rlugojr,项目名称:livereload-examples,代码行数:18,代码来源:drupal_web_test_case.php

示例4: refreshVariables

 /**
  * Refresh the in-memory set of variables. Useful after a page request is made
  * that changes a variable in a different thread.
  *
  * In other words calling a settings page with $this->drupalPost() with a changed
  * value would update a variable to reflect that change, but in the thread that
  * made the call (thread running the test) the changed variable would not be
  * picked up.
  *
  * This method clears the variables cache and loads a fresh copy from the database
  * to ensure that the most up-to-date set of variables is loaded.
  */
 protected function refreshVariables()
 {
     global $conf;
     if (!defined('DRUPAL_CORE_VERSION')) {
         define('DRUPAL_CORE_VERSION', "8");
     }
     if (DRUPAL_CORE_VERSION == "7") {
         cache_clear_all('variables', 'cache_bootstrap');
     } else {
         cache('bootstrap')->delete('variables');
     }
     $conf = variable_initialize();
 }
开发者ID:enriquesanchezhernandez,项目名称:campaigns,代码行数:25,代码来源:drupal_test_case.php

示例5: readVariable

 /**
  * Read a drupal variable.
  *
  * @param string $name
  *   The variable name.
  * @param null $default
  *   Pass in a default to use of the variable doesn't exist.
  *
  * @return bool|mixed
  *   false on failure, the variable on success.
  */
 public function readVariable($name, $default = null)
 {
     global $conf;
     $conf = variable_initialize($conf);
     return variable_get($name, $default);
 }
开发者ID:ixis,项目名称:codeception-drupal-variable,代码行数:17,代码来源:Bootstrapped.php

示例6: isset

// Drupal will probably miscalculate the base_url if we're bootstrapping from handler.php
if (!isset($base_url)) {
    $base_root = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
    // As $_SERVER['HTTP_HOST'] allows user input, ensure it only contains valid characters.
    $base_url = $base_root . '://www.' . preg_replace('/[^a-z0-9-:._]/i', '', $_SERVER['HTTP_HOST']);
    // Unlike $_SERVER['PHP_SELF'], $_SERVER['SCRIPT_NAME'] cannot be modified by a visitor.
    $script_path_array = explode('/', $_SERVER['SCRIPT_NAME']);
    $base_path_array = explode('/', $base_path);
    $base_dir = implode('/', array_intersect($base_path_array, $script_path_array));
    $base_url .= $base_dir;
}
// Bootstrap Drupal.
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION);
// Initialize configuration variables, using values from settings.php if available.
$conf = variable_initialize(isset($conf) ? $conf : array());
// Add file.inc for various file functions used in phpfreechat
require_once './includes/file.inc';
// Add common.inc to be able to use drupal_get_path later
require_once './includes/common.inc';
// Add user module to handle user permissions in phpfreechat
require_once drupal_get_path('module', 'user') . '/user.module';
// We will need to load the current node
if (!function_exists('arg')) {
    // Use HTTP_REFERER to extract the node ID
    $path = str_replace(array($base_url . '/', '/?q='), '', $_SERVER['HTTP_REFERER']);
    // Get the real path from the current request
    require_once './includes/path.inc';
    $args = explode('/', drupal_get_normal_path($path));
    $result = db_query('SELECT * FROM {node} n INNER JOIN {phpfreechat} pfc ON pfc.nid = n.nid WHERE n.nid = :nid', array(':nid' => $args[1]));
    $node = $result->fetchObject();
开发者ID:Lanou94,项目名称:intranet,代码行数:31,代码来源:handler.php

示例7: resetBranchesAndCache

 /**
  * Makes sure all variables and branches have been reset.
  */
 function resetBranchesAndCache()
 {
     cache_clear_all('variables', 'cache_bootstrap', 'cache');
     drupal_static_reset();
     variable_initialize();
     api_reset_branches();
 }
开发者ID:neelkhatri,项目名称:drupal,代码行数:10,代码来源:api_test_case.php


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