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


PHP elgg_get_system_cache函数代码示例

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


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

示例1: _elgg_load_autoload_cache

/**
 * Load cached data into the autoload system
 *
 * Note this has to wait until Elgg's data path is known.
 *
 * @access private
 */
function _elgg_load_autoload_cache()
{
    $manager = _elgg_services()->autoloadManager;
    $manager->setStorage(elgg_get_system_cache());
    if (!$manager->loadCache()) {
        $manager->addClasses(dirname(dirname(__FILE__)) . '/classes');
    }
}
开发者ID:sephiroth88,项目名称:Elgg,代码行数:15,代码来源:autoloader.php

示例2: load

 /**
  * Retrieve the contents of a system cache.
  *
  * @param string $type The type of cache to load
  * @return string
  */
 function load($type)
 {
     if ($this->CONFIG->system_cache_enabled) {
         $cache = elgg_get_system_cache();
         $cached_data = $cache->load($type);
         if ($cached_data) {
             return $cached_data;
         }
     }
     return null;
 }
开发者ID:gzachos,项目名称:elgg_ellak,代码行数:17,代码来源:SystemCache.php

示例3: elgg_load_system_cache

/**
 * Retrieve the contents of a system cache.
 *
 * @param string $type The type of cache to load
 * @return string
 */
function elgg_load_system_cache($type)
{
    global $CONFIG;
    if ($CONFIG->system_cache_enabled) {
        $cache = elgg_get_system_cache();
        $cached_data = $cache->load($type);
        if ($cached_data) {
            return $cached_data;
        }
    }
    return null;
}
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:18,代码来源:cache.php

示例4: ElggObject

        if ($count == 0) {
            $field = new ElggObject();
            // not using classes so we can handle both profile and trip in one function
            $field->owner_guid = $site_guid;
            $field->container_guid = $site_guid;
            $field->access_id = ACCESS_PUBLIC;
            $field->subtype = "custom_" . $type . "_field";
            $field->save();
            $field->metadata_name = $metadata_name;
            $field->metadata_type = $metadata_type;
            if ($type == "profile") {
                $field->show_on_register = "no";
                $field->mandatory = "no";
                $field->user_editable = "yes";
            }
            $field->order = $max_fields;
            $field->save();
            $max_fields++;
            $added++;
        }
    }
    if ($added == 0) {
        register_error(elgg_echo("profiles_go:actions:import:from_default:no_fields"));
    } else {
        elgg_get_system_cache()->delete("profiles_go_" . $type . "_fields_" . $site_guid);
        system_message(elgg_echo("profiles_go:actions:import:from_default:new_fields", array($added)));
    }
} else {
    register_error(elgg_echo("profiles_go:actions:import:from_default:error:wrong_type"));
}
forward(REFERER);
开发者ID:rosanamontes,项目名称:teranga.go,代码行数:31,代码来源:importFromDefault.php

示例5: elgg_get_filepath_cache

/**
 * @access private
 * @deprecated 1.9 Use elgg_get_system_cache()
 */
function elgg_get_filepath_cache()
{
    elgg_deprecated_notice(__FUNCTION__ . ' is deprecated by elgg_get_system_cache()', 1.9);
    return elgg_get_system_cache();
}
开发者ID:gzachos,项目名称:elgg_ellak,代码行数:9,代码来源:deprecated-1.9.php

示例6: reloadAllTranslations

 /**
  * Reload all translations from all registered paths.
  *
  * This is only called by functions which need to know all possible translations.
  *
  * @todo Better on demand loading based on language_paths array
  *
  * @return void
  */
 function reloadAllTranslations()
 {
     static $LANG_RELOAD_ALL_RUN;
     if ($LANG_RELOAD_ALL_RUN) {
         return;
     }
     if ($GLOBALS['_ELGG']->i18n_loaded_from_cache) {
         $cache = elgg_get_system_cache();
         $cache_dir = $cache->getVariable("cache_path");
         $filenames = elgg_get_file_list($cache_dir, array(), array(), array(".lang"));
         foreach ($filenames as $filename) {
             // Look for files matching for example 'en.lang', 'cmn.lang' or 'pt_br.lang'.
             // Note that this regex is just for the system cache. The original language
             // files are allowed to have uppercase letters (e.g. pt_BR.php).
             if (preg_match('/(([a-z]{2,3})(_[a-z]{2})?)\\.lang$/', $filename, $matches)) {
                 $language = $matches[1];
                 $data = elgg_load_system_cache("{$language}.lang");
                 if ($data) {
                     $this->addTranslation($language, unserialize($data));
                 }
             }
         }
     } else {
         foreach ($GLOBALS['_ELGG']->language_paths as $path => $dummy) {
             $this->registerTranslations($path, true);
         }
     }
     $LANG_RELOAD_ALL_RUN = true;
 }
开发者ID:007arunwilson,项目名称:Elgg,代码行数:38,代码来源:Translator.php

示例7: get_input

<?php

$widget_context = get_input("widget_context");
if (!empty($widget_context)) {
    $error_count = 0;
    if ($widgets = elgg_get_widget_types($widget_context)) {
        $toggle_settings = array("can_add", "hide");
        foreach ($widgets as $handler => $widget) {
            foreach ($toggle_settings as $setting) {
                $input_name = $widget_context . "_" . $handler . "_" . $setting;
                $value = get_input($input_name, "no");
                if (!widget_manager_set_widget_setting($handler, $setting, $widget_context, $value)) {
                    $error_count++;
                    register_error(elgg_echo("widget_manager:action:manage:error:save_setting", array($setting, $widget->name)));
                }
            }
        }
        elgg_get_system_cache()->delete("widget_manager_widget_settings");
    }
    if ($error_count == 0) {
        system_message(elgg_echo("widget_manager:action:manage:success"));
    }
} else {
    register_error(elgg_echo("widget_manager:action:manage:error:context"));
}
forward(REFERER);
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:26,代码来源:manage.php

示例8: reload_all_translations

/**
 * Reload all translations from all registered paths.
 *
 * This is only called by functions which need to know all possible translations.
 *
 * @todo Better on demand loading based on language_paths array
 *
 * @return void
 */
function reload_all_translations()
{
    global $CONFIG;
    static $LANG_RELOAD_ALL_RUN;
    if ($LANG_RELOAD_ALL_RUN) {
        return;
    }
    if ($CONFIG->i18n_loaded_from_cache) {
        $cache = elgg_get_system_cache();
        $cache_dir = $cache->getVariable("cache_path");
        $filenames = elgg_get_file_list($cache_dir, array(), array(), array(".lang"));
        foreach ($filenames as $filename) {
            if (preg_match('/([a-z]+)\\.[^.]+$/', $filename, $matches)) {
                $language = $matches[1];
                $data = elgg_load_system_cache("{$language}.lang");
                if ($data) {
                    add_translation($language, unserialize($data));
                }
            }
        }
    } else {
        foreach ($CONFIG->language_paths as $path => $dummy) {
            register_translations($path, true);
        }
    }
    $LANG_RELOAD_ALL_RUN = true;
}
开发者ID:duanhv,项目名称:mdg-social,代码行数:36,代码来源:languages.php

示例9: array

            $metadata_type = $type;
            $options["metadata_name_value_pairs"] = array("name" => "metadata_name", "value" => $metadata_name);
            $count = elgg_get_entities_from_metadata($options);
            if ($count == 0) {
                $field = new ProfileManagerCustomProfileField();
                $field->save();
                $field->metadata_name = $metadata_name;
                $field->metadata_label = $metadata_label;
                $field->metadata_type = $metadata_type;
                $field->show_on_register = "no";
                $field->mandatory = "no";
                $field->user_editable = "yes";
                $field->order = $new_order;
                $field->save();
                $new_order++;
            } else {
                $skipped++;
            }
            $n++;
        }
    }
    // clear cache
    $site_guid = elgg_get_site_entity()->getGUID();
    elgg_get_system_cache()->delete("profile_manager_profile_fields_" . $site_guid);
}
if ($n - $skipped == 0) {
    register_error(elgg_echo("profile_manager:actions:import:from_custom:no_fields"));
} else {
    system_message(elgg_echo("profile_manager:actions:import:from_custom:new_fields", array($n - $skipped)));
}
forward(REFERER);
开发者ID:n8b,项目名称:VMN,代码行数:31,代码来源:importFromCustom.php

示例10: elgg_get_entities_from_metadata

    $options['metadata_name_value_pairs'] = ['name' => 'metadata_name', 'value' => $metadata_name];
    $count = elgg_get_entities_from_metadata($options);
    if ($count) {
        continue;
    }
    $field = new ElggObject();
    // not using classes so we can handle both profile and group in one function
    $field->owner_guid = $site_guid;
    $field->container_guid = $site_guid;
    $field->access_id = ACCESS_PUBLIC;
    $field->subtype = $subtype;
    $field->save();
    $field->metadata_name = $metadata_name;
    $field->metadata_type = $metadata_type;
    if ($type == 'profile') {
        $field->show_on_register = 'no';
        $field->mandatory = 'no';
        $field->user_editable = 'yes';
    }
    $field->order = $max_fields;
    $field->save();
    $max_fields++;
    $added++;
}
if ($added == 0) {
    register_error(elgg_echo('profile_manager:actions:import:from_default:no_fields'));
} else {
    elgg_get_system_cache()->delete("profile_manager_{$type}_fields_{$site_guid}");
    system_message(elgg_echo('profile_manager:actions:import:from_default:new_fields', [$added]));
}
forward(REFERER);
开发者ID:coldtrick,项目名称:profile_manager,代码行数:31,代码来源:importFromDefault.php

示例11: translation_editor_merge_translations

/**
 * Merge all custom translations into a single file for performance
 *
 * @param string $language the language to merge
 * @param bool   $update   force and update to other sites
 *
 * @return bool
 */
function translation_editor_merge_translations($language = "", $update = false)
{
    $result = false;
    $site = elgg_get_site_entity();
    if (empty($language)) {
        $language = get_current_language();
    }
    if (!empty($language)) {
        $translations = array();
        // get core translations
        $core = translation_editor_read_translation($language, 'core');
        if (!empty($core)) {
            $translations = $core;
        }
        // get the customo keys
        $custom_keys = translation_editor_read_translation($language, 'custom_keys');
        if (!empty($custom_keys)) {
            $translations += $custom_keys;
        }
        // proccess all plugins
        $plugins = elgg_get_plugins();
        if (!empty($plugins)) {
            foreach ($plugins as $plugin) {
                // add plugin translations
                $plugin_translation = translation_editor_read_translation($language, $plugin->title);
                if (!empty($plugin_translation)) {
                    $translations += $plugin_translation;
                }
            }
        }
        if (!empty($translations)) {
            // write all to disk
            if (translation_editor_write_translation($language, "translation_editor_merged_{$site->getGUID()}", $translations)) {
                $result = true;
            }
        } else {
            // no custom translations, so remove the cache file
            if (translation_editor_delete_translation($language, "translation_editor_merged_{$site->getGUID()}")) {
                $result = true;
            }
        }
    }
    if ($result) {
        // clear system cache
        $cache = elgg_get_system_cache();
        $cache->delete("{$language}.lang");
        // let others know this happend
        elgg_trigger_event("language:merge", "translation_editor", $language);
    }
    // reset language cache on all sites
    if ($update) {
        $ts = time();
        datalist_set("te_last_update_{$language}", $ts);
        set_private_setting($site->getGUID(), "te_last_update_{$language}", $ts);
    }
    return $result;
}
开发者ID:coldtrick,项目名称:translation_editor,代码行数:65,代码来源:functions.php

示例12: elgg_get_filepath_cache

/**
 * @access private
 */
function elgg_get_filepath_cache()
{
    return elgg_get_system_cache();
}
开发者ID:nogsus,项目名称:Elgg,代码行数:7,代码来源:cache.php


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