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

PHP variable_set函数代码示例

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

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



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

示例1: asu_webspark_bootstrap_settings_submit

function asu_webspark_bootstrap_settings_submit($form, &$form_state)
{
    // Set the variables, need to use this instead of theme_get_settings
    // because the scop of the vars is more global.
    if ($form_state['values']['asu_brand_header_selector'] != 'custom') {
        variable_set('asu_brand_header_template', $form_state['values']['asu_brand_header_selector']);
    } else {
        variable_set('asu_brand_header_template', $form_state['values']['asu_brand_header_template']);
    }
    variable_set('asu_brand_is_student', $form_state['values']['asu_brand_is_student']);
    variable_set('asu_brand_student_color', $form_state['values']['asu_brand_student_color']);
    variable_set('asu_brand_header_selector', $form_state['values']['asu_brand_header_selector']);
    if ($file = $form_state['values']['picture_upload']) {
        unset($form_state['values']['picture_upload']);
        $filename = file_unmanaged_copy($file->uri);
        $form_state['values']['default_picture'] = 1;
        $form_state['values']['picture_path'] = $filename;
    }
    // If the user entered a path relative to the system files directory for
    // a logo or favicon, store a public:// URI so the theme system can handle it.
    if (!empty($form_state['values']['picture_path'])) {
        $form_state['values']['picture_path'] = _system_theme_settings_validate_path($form_state['values']['picture_path']);
    }
    // ASU header needs a cache_clear
    if (module_exists('asu_brand')) {
        asu_brand_cache_clear();
    }
}
开发者ID:niner9,项目名称:webspark-drops-drupal7,代码行数:28,代码来源:theme-settings.php


示例2: fusion_core_initialize_theme_settings

/**
 * Initialize theme settings if needed
 */
function fusion_core_initialize_theme_settings($theme_name)
{
    $theme_settings = theme_get_settings($theme_name);
    if (is_null($theme_settings['theme_font_size']) || $theme_settings['rebuild_registry'] == 1) {
        // Rebuild theme registry & notify user
        if ($theme_settings['rebuild_registry'] == 1) {
            drupal_rebuild_theme_registry();
            drupal_set_message(t('Theme registry rebuild completed. <a href="!link">Turn off</a> this feature for production websites.', array('!link' => url('admin/build/themes/settings/' . $GLOBALS['theme']))), 'warning');
        }
        // Retrieve saved or site-wide theme settings
        $theme_setting_name = str_replace('/', '_', 'theme_' . $theme_name . '_settings');
        $settings = variable_get($theme_setting_name, FALSE) ? theme_get_settings($theme_name) : theme_get_settings();
        // Skip toggle_node_info_ settings
        if (module_exists('node')) {
            foreach (node_get_types() as $type => $name) {
                unset($settings['toggle_node_info_' . $type]);
            }
        }
        // Retrieve default theme settings
        $defaults = fusion_core_default_theme_settings();
        // Set combined default & saved theme settings
        variable_set($theme_setting_name, array_merge($defaults, $settings));
        // Force theme settings refresh
        theme_get_setting('', TRUE);
    }
}
开发者ID:edchacon,项目名称:scratchpads,代码行数:29,代码来源:theme-settings.php


示例3: submit

 public function submit($form, &$form_state)
 {
     variable_set('publisher_enabled', $form_state['values']['enabled']);
     variable_set('publisher_api_key', $form_state['values']['api_key']);
     variable_set('publisher_debug_mode', $form_state['values']['debug']);
     drupal_set_message('Publisher settings saved successfully!');
 }
开发者ID:sammarks,项目名称:publisher,代码行数:7,代码来源:SettingsForm.php


示例4: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     static::$cacheDir = DRUPONY_TEST_DIR . DIRECTORY_SEPARATOR . 'cacheDir';
     variable_set('drupony_cachedir', static::$cacheDir);
     require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'drupony.module';
     require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'drupony.hooks.inc';
 }
开发者ID:frizinak,项目名称:drupony,代码行数:7,代码来源:DruponyModuleTest.php


示例5: save

 public function save()
 {
     foreach ($this->saveable as $property) {
         $save[$property] = $this->{$property};
     }
     variable_set('ldap_profile_conf', $save);
 }
开发者ID:mrschleig,项目名称:sensdata,代码行数:7,代码来源:LdapProfileConfAdmin.class.php


示例6: testDateImport

 /**
  * Verify that date fields are imported correctly. When no timezone is
  * explicitly provided with the source data, we want the displayed time on the
  * Drupal site to match that in the source data. To validate that, we make
  * sure we have set a consistent timezone at the PHP and Drupal levels, and
  * that the format used on the page is not locale-dependent (no day or month
  * names). Then, we can just look for the desired date/time strings in the
  * node page.
  */
 function testDateImport()
 {
     date_default_timezone_set('America/Los_Angeles');
     variable_set('date_default_timezone', 'America/Los_Angeles');
     variable_set('date_format_medium', 'Y-m-d H:i');
     $migration = Migration::getInstance('DateExample');
     $result = $migration->processImport();
     $this->assertEqual($result, Migration::RESULT_COMPLETED, t('Variety term import returned RESULT_COMPLETED'));
     $rawnodes = node_load_multiple(FALSE, array('type' => 'date_migrate_example'), TRUE);
     $this->assertEqual(count($rawnodes), 2, t('Two sample nodes created'));
     $node = reset($rawnodes);
     $this->drupalGet('/node/' . $node->nid);
     $this->assertText('2011-05-12 19:43', t('Simple date field found'));
     $this->assertText('2011-06-13 18:32 to 2011-07-23 10:32', t('Date range field found'));
     $this->assertText('2011-07-22 12:13', t('Datestamp field found'));
     $this->assertText('2011-08-01 00:00 to 2011-09-01 00:00', t('Datestamp range field found'));
     $this->assertText('2011-11-18 15:00', t('Datetime field with +9 timezone found'));
     $this->assertText('2011-10-30 14:43 to 2011-12-31 17:59', t('Datetime range field with -5 timezone found'));
     $this->assertText('2011-11-25 09:01', t('First date repeat instance found'));
     $this->assertText('2011-12-09 09:01', t('Second date repeat instance found'));
     $this->assertNoText('2011-12-23 09:01', t('Skipped date repeat instance not found'));
     $this->assertText('2012-05-11 09:01', t('Last date repeat instance found'));
     $node = next($rawnodes);
     $this->drupalGet('/node/' . $node->nid);
     $this->assertText('2012-06-21 15:32', t('First date value found'));
     $this->assertText('2012-12-02 11:08', t('Second date value found'));
     $this->assertText('2004-02-03 01:15', t('Start for first date range found'));
     $this->assertText('2005-03-04 22:11', t('End for first date range found'));
     $this->assertText('2014-09-01 17:21', t('Start for second date range found'));
     $this->assertText('2015-12-23 00:01', t('End for first second range found'));
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:40,代码来源:DateMigrateExampleUnitTest.php


示例7: _scratchpadify_install_configure_form_submit

function _scratchpadify_install_configure_form_submit($form, &$form_state)
{
    global $user;
    variable_set('site_name', $form_state['values']['site_name']);
    variable_set('site_mail', $form_state['values']['site_mail']);
    variable_set('date_default_timezone', $form_state['values']['date_default_timezone']);
    // Enable update.module if this option was selected.
    if ($form_state['values']['update_status_module'][1]) {
        // Stop enabling the update module, it's a right royal pain in the arse.
        //drupal_install_modules(array('update'));
    }
    // Turn this off temporarily so that we can pass a password through.
    variable_set('user_email_verification', FALSE);
    $form_state['old_values'] = $form_state['values'];
    $form_state['values'] = $form_state['values']['account'];
    // We precreated user 1 with placeholder values. Let's save the real values.
    $account = user_load(1);
    $merge_data = array('init' => $form_state['values']['mail'], 'roles' => array(), 'status' => 0);
    user_save($account, array_merge($form_state['values'], $merge_data));
    // Log in the first user.
    user_authenticate($form_state['values']);
    $form_state['values'] = $form_state['old_values'];
    unset($form_state['old_values']);
    variable_set('user_email_verification', TRUE);
    if (isset($form_state['values']['clean_url'])) {
        variable_set('clean_url', $form_state['values']['clean_url']);
    }
    // The user is now logged in, but has no session ID yet, which
    // would be required later in the request, so remember it.
    $user->sid = session_id();
    // Record when this install ran.
    variable_set('install_time', time());
}
开发者ID:edchacon,项目名称:scratchpads,代码行数:33,代码来源:scratchpadify.profile-help.php


示例8: testKeyEnumKeys

 /**
  * Test enumeration of anonymous and authenticated keys.
  */
 public function testKeyEnumKeys()
 {
     global $base_root;
     variable_set('authcache_roles', array());
     $expect = array($base_root);
     $result = authcache_enum_keys();
     $this->assertEqual($expect, $result);
     drupal_static_reset();
     // Test anonymous and authenticated roles.
     variable_set('authcache_roles', array(DRUPAL_ANONYMOUS_RID => DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID => DRUPAL_AUTHENTICATED_RID));
     $result = authcache_enum_keys();
     $anonymous_key = array_pop($result);
     $this->assertEqual($base_root, $anonymous_key);
     // Expect 1 additional key for authenticated users.
     $this->assertEqual(1, count($result));
     drupal_static_reset();
     // Test additional roles.
     $rid1 = $this->drupalCreateRole(array());
     $rid2 = $this->drupalCreateRole(array());
     variable_set('authcache_roles', array(DRUPAL_ANONYMOUS_RID => DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID => DRUPAL_AUTHENTICATED_RID, $rid1 => $rid1, $rid2 => $rid2));
     $result = authcache_enum_keys();
     $anonymous_key = array_pop($result);
     $this->assertEqual($base_root, $anonymous_key);
     // Expect 4 keys for authenticated users:
     // * Only authenticated rid
     // * Only rid1
     // * Only rid2
     // * rid1 and rid2
     $this->assertEqual(4, count($result));
 }
开发者ID:LandPotential,项目名称:LandPKS_Authentication_Admin,代码行数:33,代码来源:AuthcacheEnumKeysTestCase.php


示例9: drupalexp_form_system_theme_settings_submit

function drupalexp_form_system_theme_settings_submit(&$form, &$form_state)
{
    unset($_SESSION['drupalexp_default_preset']);
    unset($_SESSION['drupalexp_default_direction']);
    unset($_SESSION['drupalexp_layout']);
    variable_set('drupalexp_settings_updated', REQUEST_TIME);
}
开发者ID:benelori,项目名称:lori,代码行数:7,代码来源:theme-settings.php


示例10: csa_base_get_default_settings

function csa_base_get_default_settings($theme)
{
    // Get node types
    $node_types = node_get_types('names');
    // The default values for the theme variables. Make sure $defaults exactly
    // matches the $defaults in the theme-settings.php file.
    $defaults = array('csa_base_move_sidebar' => 1, 'breadcrumb_display' => 0, 'breadcrumb_display_admin' => 1, 'breadcrumb_with_title' => 1, 'primary_links_display_style' => 'tabbed-menu', 'primary_links_allow_tree' => 0, 'secondary_links_display_style' => 'menu', 'secondary_links_allow_tree' => 0, 'search_snippet' => 1, 'search_info_type' => 1, 'search_info_user' => 1, 'search_info_date' => 1, 'search_info_comment' => 1, 'search_info_upload' => 1, 'mission_statement_pages' => 'home', 'hide_front_page_title' => 1, 'front_page_title_display' => 'title_slogan', 'page_title_display_custom' => '', 'other_page_title_display' => 'ptitle_slogan', 'other_page_title_display_custom' => '', 'configurable_separator' => ' | ', 'meta_keywords' => '', 'meta_description' => '', 'taxonomy_display_default' => 'only', 'taxonomy_display_vocab_name' => 1, 'taxonomy_format_default' => 'vocab', 'taxonomy_format_links' => 0, 'taxonomy_format_delimiter' => ', ', 'taxonomy_enable_content_type' => 0, 'submitted_by_author_default' => 0, 'submitted_by_date_default' => 0, 'submitted_by_enable_content_type' => 0);
    // Make the default content-type settings the same as the default theme settings,
    // so we can tell if content-type-specific settings have been altered.
    $defaults = array_merge($defaults, theme_get_settings());
    // Set the default values for content-type-specific settings
    foreach ($node_types as $type => $name) {
        $defaults["taxonomy_display_{$type}"] = $defaults['taxonomy_display_default'];
        $defaults["taxonomy_format_{$type}"] = $defaults['taxonomy_format_default'];
        $defaults["submitted_by_author_{$type}"] = $defaults['submitted_by_author_default'];
        $defaults["submitted_by_date_{$type}"] = $defaults['submitted_by_date_default'];
    }
    // Get default theme settings.
    $settings = theme_get_settings($theme);
    // Don't save the toggle_node_info_ variables
    if (module_exists('node')) {
        foreach (node_get_types() as $type => $name) {
            unset($settings['toggle_node_info_' . $type]);
        }
    }
    // Save default theme settings
    variable_set(str_replace('/', '_', 'theme_' . $theme . '_settings'), array_merge($defaults, $settings));
    // Force refresh of Drupal internals
    theme_get_setting('', TRUE);
    return $defaults;
}
开发者ID:rasjones,项目名称:csa,代码行数:31,代码来源:theme-settings-defaults.php


示例11: testNewDefaultThemeBlocks

 /**
  * Check the enabled Garland blocks are correctly copied over.
  */
 function testNewDefaultThemeBlocks()
 {
     // Create administrative user.
     $adminuser = $this->drupalCreateUser(array('administer themes'));
     $this->drupalLogin($adminuser);
     // Ensure no other theme's blocks are in the block table yet.
     $count = db_query_range("SELECT 1 FROM {block} WHERE theme NOT IN ('garland', 'seven')", 0, 1)->fetchField();
     $this->assertFalse($count, t('Only Garland and Seven have blocks.'));
     // Populate list of all blocks for matching against new theme.
     $blocks = array();
     $result = db_query("SELECT * FROM {block} WHERE theme = 'garland'");
     foreach ($result as $block) {
         // $block->theme and $block->bid will not match, so remove them.
         unset($block->theme, $block->bid);
         $blocks[$block->module][$block->delta] = $block;
     }
     // Turn on the Stark theme and ensure that it contains all of the blocks
     // that Garland did.
     theme_enable(array('stark'));
     variable_set('theme_default', 'stark');
     $result = db_query("SELECT * FROM {block} WHERE theme='stark'");
     foreach ($result as $block) {
         unset($block->theme, $block->bid);
         $this->assertEqual($blocks[$block->module][$block->delta], $block, t('Block %name matched', array('%name' => $block->module . '-' . $block->delta)));
     }
 }
开发者ID:pjcdawkins,项目名称:drupal7mongodb,代码行数:29,代码来源:NewDefaultThemeBlocksTest.php


示例12: applyDefaultConfigurationToContentType

 /**
  * Apply default NextEuropa configuration to a specific content type.
  *
  * This method is usually called into hook_install().
  *
  * @param string $type
  *    Content type machine name.
  *
  * @see nexteuropa_pages_install()
  */
 public function applyDefaultConfigurationToContentType($type)
 {
     // Replace title field.
     multisite_config_service('title')->replaceTitleField('node', $type, 'title');
     multisite_config_service('entity_translation')->enableEntityTranslation($type);
     // Add Organic Group fields.
     multisite_config_service('og')->createOgGroupAudienceField('node', $type);
     multisite_config_service('og')->createOgContentAccessField('node', $type);
     // Enable Workbench Moderation.
     multisite_config_service('workbench_moderation')->enableWorkbenchModeration($type);
     // Grant OG permissions if NextEuropa Editorial feature is enabled.
     if (module_exists('nexteuropa_editorial')) {
         $og_permissions = array();
         $og_permissions['contributor'] = array('create ' . $type . ' content', 'update own ' . $type . ' content', 'delete own ' . $type . ' content');
         $og_permissions['validator'] = $og_permissions['publisher'] = $og_permissions['administrator member'] = array('create ' . $type . ' content', 'update own ' . $type . ' content', 'delete own ' . $type . ' content', 'update any ' . $type . ' content', 'delete any ' . $type . ' content');
         foreach ($og_permissions as $role => $permissions) {
             multisite_config_service('og')->grantOgPermissions($role, $permissions, 'node', 'editorial_team', 'og');
         }
     }
     // Enable Linkchecker control for "Page" content type.
     multisite_config_service('linkchecker')->enableLinkcheckerForContentType($type);
     // Enable default scheduling options for a specific content type.
     multisite_config_service('scheduler')->enableSchedulerForContentType($type);
     // Set unpublish moderation state to "expired".
     // This call cannot be included in the API method above since it is
     // a configuration specific to NextEuropa .
     variable_set('scheduler_unpublish_moderation_state_' . $type, 'expired');
 }
开发者ID:janoka,项目名称:platform-dev,代码行数:38,代码来源:Config.php


示例13: hook_taxonomy_vocabulary_update

/**
 * Act on taxonomy vocabularies when updated.
 *
 * Modules implementing this hook can act on the vocabulary object when updated.
 *
 * @param $vocabulary
 *   A taxonomy vocabulary object.
 */
function hook_taxonomy_vocabulary_update($vocabulary)
{
    $status = $vocabulary->synonyms ? TRUE : FALSE;
    if ($vocabulary->synonyms) {
        variable_set('taxonomy_' . $vocabulary->vid . '_synonyms', $status);
    }
}
开发者ID:edos4,项目名称:drupal_test,代码行数:15,代码来源:taxonomy.api.php


示例14: hook_menu_delete

/**
 * Respond to a custom menu deletion.
 *
 * This hook is used to notify modules that a custom menu along with all links
 * contained in it (if any) has been deleted. Contributed modules may use the
 * information to perform actions based on the information entered into the menu
 * system.
 *
 * @param $menu
 *   An array representing a custom menu:
 *   - menu_name: The unique name of the custom menu.
 *   - title: The human readable menu title.
 *   - description: The custom menu description.
 *
 * @see hook_menu_insert()
 * @see hook_menu_update()
 */
function hook_menu_delete($menu)
{
    // Delete the record from our variable.
    $my_menus = variable_get('my_module_menus', array());
    unset($my_menus[$menu['menu_name']]);
    variable_set('my_module_menus', $my_menus);
}
开发者ID:HamzaBendidane,项目名称:prel,代码行数:24,代码来源:menu.api.php


示例15: _validate_page_width

function _validate_page_width($width)
{
    global $theme_key;
    /*
     * The default values for the theme variables. Make sure $defaults exactly
     * matches the $defaults in the theme-settings.php file.
     */
    $defaults = array('pixture_width' => '85%');
    // check if it is liquid (%) or fixed width (px)
    if (preg_match("/(\\d+)\\s*%/", $width, $match)) {
        $liquid = 1;
        $num = intval($match[0]);
        if (50 <= $num && $num <= 100) {
            return $num . "%";
            // OK!
        }
    } else {
        if (preg_match("/(\\d+)\\s*px/", $width, $match)) {
            $fixed = 1;
            $num = intval($match[0]);
            if (800 <= $num && $num < 1600) {
                return $num . "px";
                // OK
            }
        }
    }
    // reset to default value
    variable_set(str_replace('/', '_', 'theme_' . $theme_key . '_settings'), array_merge($defaults, theme_get_settings($theme_key)));
    // Force refresh of Drupal internals
    theme_get_setting('', TRUE);
    return $defaults['pixture_width'];
}
开发者ID:javaperl,项目名称:fcase,代码行数:32,代码来源:theme-settings.php


示例16: fusion_core_initialize_theme_settings

/**
 * Initialize theme settings if needed
 */
function fusion_core_initialize_theme_settings($theme_name)
{
    $theme_settings = theme_get_settings($theme_name);
    if (!isset($theme_settings['primary_menu_dropdown']) || $theme_settings['rebuild_registry'] == 1) {
        static $registry_rebuilt = false;
        // avoid multiple rebuilds per page
        // Rebuild theme registry & notify user
        if (isset($theme_settings['rebuild_registry']) && $theme_settings['rebuild_registry'] == 1 && !$registry_rebuilt) {
            drupal_rebuild_theme_registry();
            drupal_set_message(t('Theme registry rebuild completed. <a href="!link">Turn off</a> this feature for production websites.', array('!link' => url('admin/build/themes/settings/' . $GLOBALS['theme']))), 'warning');
            $registry_rebuilt = true;
        }
        // Retrieve saved or site-wide theme settings
        $theme_setting_name = str_replace('/', '_', 'theme_' . $theme_name . '_settings');
        $settings = variable_get($theme_setting_name, FALSE) ? theme_get_settings($theme_name) : theme_get_settings();
        // Skip toggle_node_info_ settings
        if (module_exists('node')) {
            foreach (node_get_types() as $type => $name) {
                unset($settings['toggle_node_info_' . $type]);
            }
        }
        // Combine default theme settings from .info file & theme-settings.php
        $theme_data = list_themes();
        // get theme data for all themes
        $info_theme_settings = $theme_name ? $theme_data[$theme_name]->info['settings'] : array();
        $defaults = array_merge(fusion_core_default_theme_settings(), $info_theme_settings);
        // Set combined default & saved theme settings
        variable_set($theme_setting_name, array_merge($defaults, $settings));
        // Force theme settings refresh
        theme_get_setting('', TRUE);
    }
}
开发者ID:victorkane,项目名称:adminescolar,代码行数:35,代码来源:theme-settings.php


示例17: superhero_preprocess_page

/**
 * Preprocess Page
 */
function superhero_preprocess_page(&$vars)
{
    $theme = superhero_get_theme();
    $theme->page =& $vars;
    $vars['attributes_array']['class'] = array('body');
    // Primary nav
    $vars['primary_nav'] = FALSE;
    if ($vars['main_menu']) {
        // Build links
        $vars['primary_nav'] = menu_tree(variable_get('menu_main_links_source', 'main-menu'));
        // Provide default theme wrapper function
        $vars['primary_nav']['#theme_wrappers'] = array('menu_tree__primary');
    }
    $default_preset = $theme->settings['default_preset'];
    $force = false;
    $superhero_base_url = variable_get('superhero_base_url', '');
    global $base_url;
    if ($superhero_base_url != $base_url) {
        $force = true;
    }
    variable_set('superhero_base_url', $base_url);
    require_once dirname(__FILE__) . '/includes/superhero_scss.php';
    $scss = new Superhero_scss($theme);
    if (!file_exists('public://css')) {
        drupal_mkdir('public://css');
    }
    $file = $scss->outputFile('public://css/' . $theme->theme . '-theme-preset' . ($default_preset + 1) . '.css', $force);
    drupal_add_css($file, array('type' => 'file', 'group' => CSS_THEME));
}
开发者ID:Kalamet,项目名称:poly_demo,代码行数:32,代码来源:template.php


示例18: setUpBranchAPICall

 /**
  * Sets up a project and a files branch using API function calls.
  *
  * @param $prefix
  *   Directory prefix to prepend on the data directories.
  * @param $default
  *   TRUE to set this as the default branch; FALSE to not set it as default.
  * @param $info
  *   Array of information to override the defaults (see function code to see
  *   what they are). Note that $prefix is applied after this information is
  *   read, and that only one directory and one excluded are supported in this
  *   function.
  *
  * @return
  *   Array of information (defaults with overrides) used to create the
  *   branch and project.
  */
 function setUpBranchAPICall($prefix = '', $default = TRUE, $info = array())
 {
     // Set up defaults.
     $info += array('project' => 'test', 'project_title' => 'Project 6', 'project_type' => 'module', 'branch_name' => '6', 'title' => 'Testing 6', 'core_compatibility' => '7.x', 'update_frequency' => 1, 'directory' => drupal_get_path('module', 'api') . '/tests/sample', 'excluded' => drupal_get_path('module', 'api') . '/tests/sample/to_exclude', 'regexps' => '');
     $info['preferred'] = $default ? 1 : 0;
     // Create the project.
     $project = new stdClass();
     $project->project_type = $info['project_type'];
     $project->project_name = $info['project'];
     $project->project_title = $info['project_title'];
     api_save_project($project);
     if ($default) {
         // Make this the default project/compatibility.
         variable_set('api_default_project', $info['project']);
         variable_set('api_default_core_compatibility', $info['core_compatibility']);
     }
     // Create the branch.
     $branch = new stdClass();
     $branch->project = $info['project'];
     $branch->branch_name = $info['branch_name'];
     $branch->title = $info['title'];
     $branch->preferred = $info['preferred'];
     $branch->core_compatibility = $info['core_compatibility'];
     $branch->update_frequency = $info['update_frequency'];
     $branch->data = array('directories' => $prefix . $info['directory'], 'excluded_directories' => $prefix . $info['excluded'], 'exclude_files_regexp' => $info['regexps']);
     api_save_branch($branch);
     if ($default) {
         $this->assertEqual(variable_get('api_default_branch', 99), $branch->branch_id, 'Variable for default branch is set correctly');
     }
     return $info;
 }
开发者ID:neelkhatri,项目名称:drupal,代码行数:48,代码来源:api_test_case.php


示例19: vset

 /**
  * Method for defining a key's value in the caching mechanism.
  *
  * @param string $key
  *   The unique name of the value to be stored. If not unique, the existing
  *   value will be replaced.
  * @param mixed $value
  *   The serializable value to be stored under the $key provided.
  *
  * @return NULL
  *   Returns after corresponding set functionality finishes.
  */
 public function vset($key, $value)
 {
     if ($this->memcacheExists) {
         $this->mem->set($key, $value);
         return;
     }
     variable_set($key, $value);
 }
开发者ID:etype-services,项目名称:moser,代码行数:20,代码来源:NodeRevisionCleanupVariableCRUD.php


示例20: hook_image_style_delete

/**
 * Respond to image style deletion.
 *
 * This hook enables modules to update settings when a image style is being
 * deleted. If a style is deleted, a replacement name may be specified in
 * $style['name'] and the style being deleted will be specified in
 * $style['old_name'].
 *
 * @param $style
 *   The image style array that being deleted.
 */
function hook_image_style_delete($style)
{
    // Administrators can choose an optional replacement style when deleting.
    // Update the modules style variable accordingly.
    if (isset($style['old_name']) && $style['old_name'] == variable_get('mymodule_image_style', '')) {
        variable_set('mymodule_image_style', $style['name']);
    }
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:19,代码来源:image.api.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP variant_date_to_timestamp函数代码示例发布时间:2022-05-23
下一篇:
PHP variable_initialize函数代码示例发布时间: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