本文整理汇总了PHP中get_private_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP get_private_setting函数的具体用法?PHP get_private_setting怎么用?PHP get_private_setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_private_setting函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: theme_haarlem_intranet_get_quick_nav
/**
* Get the quick nav menu for an entity
*
* @param int $entity_guid the guid of the entity to get the quick nav for
*
* @return array
*/
function theme_haarlem_intranet_get_quick_nav($entity_guid)
{
$settings = get_private_setting($entity_guid, 'quick_nav');
if (empty($settings)) {
return array();
}
return @json_decode($settings, true);
}
开发者ID:coldtrick,项目名称:theme_haarlem_intranet,代码行数:15,代码来源:functions.php
示例2: sitepages_get_sitepage_object
/**
* Returns a single object that holds information about
* customizations for the $section site page. The object guid
* is stored as private data on the site entity. This allows the pages
* to still be searchable as standard entities.
*
* @param $type
* @return mixed ElggSitePage on success, FALSE on fail
*/
function sitepages_get_sitepage_object($page_type)
{
global $CONFIG;
$page_guid = get_private_setting($CONFIG->site->getGUID(), "sitepages:{$page_type}");
$sitepage = get_entity($page_guid);
if ($sitepage instanceof ElggSitePage || $sitepage->page_type == $page_type) {
return $sitepage;
}
return FALSE;
}
开发者ID:adamboardman,项目名称:Elgg,代码行数:19,代码来源:sitepages_functions.php
示例3: testElggApiGettersEntitiesFromPrivateSettings
public function testElggApiGettersEntitiesFromPrivateSettings()
{
// create some test private settings
$setting_name = 'test_setting_name_' . rand();
$setting_value = rand(1000, 9999);
$setting_name2 = 'test_setting_name_' . rand();
$setting_value2 = rand(1000, 9999);
$subtypes = $this->getRandomValidSubtypes(array('object'), 1);
$subtype = $subtypes[0];
$guids = array();
// our targets
$valid = new ElggObject();
$valid->subtype = $subtype;
$valid->save();
$guids[] = $valid->getGUID();
set_private_setting($valid->getGUID(), $setting_name, $setting_value);
set_private_setting($valid->getGUID(), $setting_name2, $setting_value2);
$valid2 = new ElggObject();
$valid2->subtype = $subtype;
$valid2->save();
$guids[] = $valid2->getGUID();
set_private_setting($valid2->getGUID(), $setting_name, $setting_value);
set_private_setting($valid2->getGUID(), $setting_name2, $setting_value2);
// simple test with name
$options = array('private_setting_name' => $setting_name);
$entities = elgg_get_entities_from_private_settings($options);
foreach ($entities as $entity) {
$this->assertTrue(in_array($entity->getGUID(), $guids));
$value = get_private_setting($entity->getGUID(), $setting_name);
$this->assertEqual($value, $setting_value);
}
// simple test with value
$options = array('private_setting_value' => $setting_value);
$entities = elgg_get_entities_from_private_settings($options);
foreach ($entities as $entity) {
$this->assertTrue(in_array($entity->getGUID(), $guids));
$value = get_private_setting($entity->getGUID(), $setting_name);
$this->assertEqual($value, $setting_value);
}
// test pairs
$options = array('type' => 'object', 'subtype' => $subtype, 'private_setting_name_value_pairs' => array(array('name' => $setting_name, 'value' => $setting_value), array('name' => $setting_name2, 'value' => $setting_value2)));
$entities = elgg_get_entities_from_private_settings($options);
$this->assertEqual(2, count($entities));
foreach ($entities as $entity) {
$this->assertTrue(in_array($entity->getGUID(), $guids));
}
foreach ($guids as $guid) {
if ($e = get_entity($guid)) {
$e->delete();
}
}
}
开发者ID:nooshin-mirzadeh,项目名称:web_2.0_benchmark,代码行数:52,代码来源:ElggCoreGetEntitiesFromPrivateSettingsTest.php
示例4: get
/**
* Override entity get and sets in order to save data to private data store.
*/
public function get($name)
{
// See if its in our base attribute
if (isset($this->attributes[$name])) {
return $this->attributes[$name];
}
// No, so see if its in the private data store.
$meta = get_private_setting($this->guid, $name);
if ($meta) {
return $meta;
}
// Can't find it, so return null
return null;
}
开发者ID:eokyere,项目名称:elgg,代码行数:17,代码来源:plugins.php
示例5: runUpgrades
/**
* Runs pending upgrades
* @return void
*/
public function runUpgrades()
{
$site = elgg_get_site_entity();
$upgrades = $this->getUpgrades();
foreach ($upgrades as $upgrade) {
$upgradename = "hypeScraper_{$upgrade}";
if (get_private_setting($site->guid, $upgradename)) {
continue;
}
if (is_callable(array($this, $upgrade))) {
call_user_func(array($this, $upgrade));
set_private_setting($site->guid, $upgradename, time());
}
}
}
开发者ID:n8b,项目名称:VMN,代码行数:19,代码来源:Upgrades.php
示例6: get
/**
* Override entity get and sets in order to save data to private data store.
*/
public function get($name)
{
// See if its in our base attribute
if (isset($this->attributes[$name])) {
return $this->attributes[$name];
}
// No, so see if its in the private data store.
// get_private_setting() returns false if it doesn't exist
$meta = get_private_setting($this->guid, $name);
if ($meta === false) {
// Can't find it, so return null
return NULL;
}
return $meta;
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:18,代码来源:plugins.php
示例7: getUserSetting
/**
* Returns a user's setting for this plugin
*
* @param string $name The setting name
* @param int $user_guid The user GUID
* @param mixed $default The default value to return if none is set
*
* @return mixed The setting string value, the default value or false if there is no user
*/
public function getUserSetting($name, $user_guid = 0, $default = null)
{
$user_guid = (int) $user_guid;
if ($user_guid) {
$user = get_entity($user_guid);
} else {
$user = _elgg_services()->session->getLoggedInUser();
}
if (!$user instanceof \ElggUser) {
return false;
}
$name = _elgg_namespace_plugin_private_setting('user_setting', $name, $this->getID());
$val = get_private_setting($user->guid, $name);
return $val !== null ? $val : $default;
}
开发者ID:bhargavgarlapati,项目名称:Elgg,代码行数:24,代码来源:ElggPlugin.php
示例8: getPrivateSetting
/**
* Returns a private setting value
*
* @param string $name Name of the private setting
*
* @return mixed Null if the setting does not exist
*/
public function getPrivateSetting($name)
{
if ((int) $this->guid > 0) {
return get_private_setting($this->getGUID(), $name);
} else {
if (isset($this->temp_private_settings[$name])) {
return $this->temp_private_settings[$name];
}
}
return null;
}
开发者ID:elgg,项目名称:elgg,代码行数:18,代码来源:ElggEntity.php
示例9: translation_editor_load_translations
function translation_editor_load_translations($current_language = "")
{
global $CONFIG;
if (empty($current_language)) {
$current_language = get_current_language();
}
// check if update is needed
$main_ts = datalist_get("te_last_update_" . $current_language);
$site_ts = get_private_setting($CONFIG->site_guid, "te_last_update_" . $current_language);
if (!empty($main_ts)) {
if (empty($site_ts) || $main_ts > $site_ts) {
if (translation_editor_merge_translations($current_language)) {
set_private_setting($CONFIG->site_guid, "te_last_update_" . $current_language, time());
}
}
} else {
translation_editor_merge_translations($current_language, true);
}
// load translations
if ($translations = translation_editor_read_translation($current_language, "translation_editor_merged_" . $CONFIG->site_guid)) {
add_translation($current_language, $translations);
}
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:23,代码来源:functions.php
示例10: execute_new_password_request
/**
* Validate and execute a password reset for a user.
*
* @param int $user_guid The user id
* @param string $conf_code Confirmation code as sent in the request email.
*/
function execute_new_password_request($user_guid, $conf_code)
{
global $CONFIG;
$user_guid = (int) $user_guid;
$user = get_entity($user_guid);
if ($user && get_private_setting($user_guid, 'passwd_conf_code') == $conf_code) {
$password = generate_random_cleartext_password();
if (force_user_password_reset($user_guid, $password)) {
//remove_metadata($user_guid, 'conf_code');
remove_private_setting($user_guid, 'passwd_conf_code');
$email = sprintf(elgg_echo('email:resetpassword:body'), $user->name, $password);
return notify_user($user->guid, $CONFIG->site->guid, elgg_echo('email:resetpassword:subject'), $email, NULL, 'email');
}
}
return false;
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:22,代码来源:users.php
示例11: pleio_api_queue_push_message
function pleio_api_queue_push_message($to_guid, $from_guid, $message, $object_type, $object_guid = 0, $site_guid = 0, $container_guid = 0)
{
$to = get_user($to_guid);
if ($to) {
$device_token = get_private_setting($to->guid, "device_token");
if ($device_token) {
if ($from_guid) {
$from = get_user($from_guid);
if ($from) {
$push = elgg_echo($message, array($from->name), 'nl');
}
}
$message = new ElggObject();
$message->subtype = 'push_message_queue';
// $message -> access_id = ACCESS_PUBLIC;
$message->description = $push;
$message->to_guid = $to->guid;
$message->object_guid = $object_guid;
$message->message_type = $object_type;
$message->site_guid = $site_guid;
$message->container_guid = $container_guid;
$message->save();
}
}
}
开发者ID:appstaat,项目名称:pleio_api,代码行数:25,代码来源:helpers.php
示例12: getUserSetting
/**
* Returns a user's setting for this plugin
*
* @param string $name The setting name
* @param int $user_guid The user GUID
*
* @return mixed The setting string value or false
*/
public function getUserSetting($name, $user_guid = null)
{
$user_guid = (int) $user_guid;
if ($user_guid) {
$user = get_entity($user_guid);
} else {
$user = elgg_get_logged_in_user_entity();
}
if (!$user instanceof ElggUser) {
return false;
}
$name = elgg_namespace_plugin_private_setting('user_setting', $name, $this->getID());
return get_private_setting($user->guid, $name);
}
开发者ID:rasul,项目名称:Elgg,代码行数:22,代码来源:ElggPlugin.php
示例13: getPrivateSetting
function getPrivateSetting($name)
{
return get_private_setting($this->getGUID(), $name);
}
开发者ID:jricher,项目名称:Elgg,代码行数:4,代码来源:entities.php
示例14:
<style>
#c_accepted_general_terms_status_bar {
background-color: green;
text-align: center;
color: white;
}
#c_notaccepted_general_terms_status_bar {
background-color: red;
text-align: center;
color: white;
}
</style>
<?php
// only admins can see this status
if (get_loggedin_user()->isAdmin()) {
if (get_private_setting(elgg_get_page_owner_entity()->guid, 'general_terms_accepted')) {
echo '<div id="c_accepted_general_terms_status_bar">';
echo elgg_echo('acgt:accepted');
} else {
echo '<div id="c_notaccepted_general_terms_status_bar">';
echo elgg_echo('acgt:not_accepted');
}
echo '</div>';
}
开发者ID:Twizanex,项目名称:c_accept_general_terms,代码行数:28,代码来源:profile_details.php
示例15: pleio_api_get_all_subsites
function pleio_api_get_all_subsites($search = null, $subsite_id = 0, $locked_filter = 0, $order_by = 0, $offset = 0, $wheres = array(), $joins = array())
{
$list = array();
$total = 0;
$joins[] = sprintf(" INNER JOIN %ssites_entity s USING (guid) ", get_config("dbprefix"));
$offset = intval($offset);
if ($search) {
$search = sanitise_string($search);
$wheres[] = " (s.name LIKE '%{$search}%' OR s.url LIKE '%{$search}%' OR s.description LIKE '%{$search}%') ";
}
if ($locked_filter == 1) {
$joins[] = sprintf(" INNER JOIN %sprivate_settings ps ON ps.entity_guid = guid ", get_config("dbprefix"));
$wheres[] = " ps.name = 'membership' AND ps.value = 'open' ";
} elseif ($locked_filter == 2) {
$joins[] = sprintf(" INNER JOIN %sprivate_settings ps ON ps.entity_guid = guid ", get_config("dbprefix"));
$wheres[] = " ps.name = 'membership' AND ps.value != 'open' ";
}
$options = array('type' => 'site', 'limit' => 20, 'offset' => $offset, 'count' => true, "wheres" => $wheres, "joins" => $joins, 'site_guid' => ELGG_ENTITIES_ANY_VALUE);
if ($subsite_id) {
$options["guids"] = $subsite_id;
}
$total = elgg_get_entities($options);
if ($total > 0) {
$options['count'] = false;
if ($order_by == 1) {
$options['order_by'] = ' s.name ';
} elseif ($order_by == 2) {
$options['order_by'] = ' s.name DESC ';
}
$sites = elgg_get_entities($options);
/* @var $site Subsite */
foreach ($sites as $site) {
$e = pleio_api_export($site, explode(",", "guid,name,url"));
$membership = get_private_setting($site->guid, "membership");
$e["o"] = !$membership || $membership == "open" ? 1 : 0;
$is_member = $site instanceof Subsite && $site->isUser() || !$site instanceof Subsite && $site instanceof ElggSite ? 1 : 0;
$e["m"] = $is_member;
$e["i"] = !$is_member && $site instanceof Subsite && $site->hasInvitation() ? 1 : 0;
$e["p"] = !$is_member && $site instanceof Subsite && $site->pendingMembershipRequest() ? 1 : 0;
$e["l"] = pleio_api_get_mobile_logo($e['guid'], $e["url"]);
$colors = pleio_api_get_site_colors($e['guid']);
$e["c"] = $colors[0];
$e["fc"] = $colors[1];
$count_result = get_data_row(sprintf("select count(*) as c from %sentity_relationships where guid_two = %d and relationship = 'member_of_site' ", get_config("dbprefix"), $e['guid']));
$e["mt"] = $count_result->c;
$e["e"] = $site->email;
$list[] = $e;
}
}
return array("total" => $total, "list" => $list, "offset" => $offset);
}
开发者ID:appstaat,项目名称:pleio_api,代码行数:51,代码来源:methods.php
示例16: get_loggedin_user
<?php
echo get_loggedin_user()->username;
echo get_private_setting(get_loggedin_user()->guid, 'general_terms_accepted');
echo '<br/>';
echo get_private_setting(881, 'general_terms_accepted');
开发者ID:Twizanex,项目名称:c_accept_general_terms,代码行数:5,代码来源:accept_general_terms.php
示例17: translation_editor_load_translations
/**
* Load all the custom translations into the running translations
*
* @param string $current_language the language to load (defaults to the language of the current user)
*
* @return void
*/
function translation_editor_load_translations($current_language = "")
{
$site = elgg_get_site_entity();
if (empty($current_language)) {
$current_language = get_current_language();
}
// check if update is needed
$main_ts = (int) datalist_get("te_last_update_{$current_language}");
$site_ts = (int) get_private_setting($site->getGUID(), "te_last_update_{$current_language}");
if (!empty($main_ts)) {
if (empty($site_ts) || $main_ts > $site_ts) {
if (translation_editor_merge_translations($current_language)) {
set_private_setting($site->getGUID(), "te_last_update_{$current_language}", time());
}
}
} else {
translation_editor_merge_translations($current_language, true);
}
// load translations
$translations = translation_editor_read_translation($current_language, "translation_editor_merged_{$site->getGUID()}");
if (!empty($translations)) {
add_translation($current_language, $translations);
}
}
开发者ID:coldtrick,项目名称:translation_editor,代码行数:31,代码来源:functions.php
示例18: register_error
register_error('subsite_manager:users:bulk_remove:no_file');
forward(REFERER);
}
$removed = 0;
// number of removed users
$not_found = 0;
// number of users not found
$already_activated = 0;
// number of users not removed because they where already activated
while ($data = fgetcsv($fh, 0, ";")) {
if (!$data[0]) {
continue;
}
if (strpos($data[0], '@') !== false) {
$users = get_user_by_email($data[0]);
$user = $users[0];
} else {
$user = get_user_by_username($data[0]);
}
if (!$user) {
$not_found += 1;
continue;
}
if (get_private_setting($user->guid, 'general_terms_accepted')) {
$already_activated += 1;
} else {
$user->delete();
$removed += 1;
}
}
system_message(elgg_echo("subsite_manager:users:bulk_remove:success", array($removed, $not_found, $already_activated)));
开发者ID:pleio,项目名称:subsite_manager,代码行数:31,代码来源:bulk_remove.php
示例19: getUserSetting
/**
* Returns a user's setting for this plugin
*
* @param string $name The setting name
* @param int $user_guid The user GUID
*
* @return mixed The setting string value or false
*/
public function getUserSetting($name, $user_guid = null)
{
$result = false;
$user_guid = (int) $user_guid;
if ($user_guid) {
$user = get_entity($user_guid);
} else {
$user = elgg_get_logged_in_user_entity();
}
if (!$user instanceof ElggUser) {
return false;
}
$name = elgg_namespace_plugin_private_setting('user_setting', $name, $this->getID());
// Subsite adjustment
$site = elgg_get_site_entity();
$org_name = $name;
if (!subsite_manager_check_global_plugin_setting($this->getID(), "use_global_usersettings")) {
$name = str_replace(ELGG_PLUGIN_USER_SETTING_PREFIX . $this->getID() . ":", ELGG_PLUGIN_USER_SETTING_PREFIX . $this->getID() . ":" . $site->getGUID() . ":", $name);
}
$tmp_result = get_private_setting($user->getGUID(), $name);
if ($tmp_result === false) {
// fallback
if ($name == $org_name) {
$name = str_replace(ELGG_PLUGIN_USER_SETTING_PREFIX . $this->getID() . ":", ELGG_PLUGIN_USER_SETTING_PREFIX . $this->getID() . ":" . $site->getGUID() . ":", $name);
} else {
$name = $org_name;
}
$result = get_private_setting($user->getGUID(), $name);
} else {
$result = $tmp_result;
}
return $result;
}
开发者ID:pleio,项目名称:subsite_manager,代码行数:41,代码来源:SubsitePlugin.php
注:本文中的get_private_setting函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论