本文整理汇总了PHP中GetValueR函数的典型用法代码示例。如果您正苦于以下问题:PHP GetValueR函数的具体用法?PHP GetValueR怎么用?PHP GetValueR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetValueR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cachePageWhere
/**
*
*
* @param $Result
* @param $PageWhere
* @param $DiscussionID
* @param $Page
* @param null $Limit
*/
public function cachePageWhere($Result, $PageWhere, $DiscussionID, $Page, $Limit = null)
{
if (!$this->pageCache || !empty($this->_Where) || $this->_OrderBy[0][0] != 'c.DateInserted' || $this->_OrderBy[0][1] == 'desc') {
return;
}
if (count($Result) == 0) {
return;
}
$ConfigLimit = c('Vanilla.Comments.PerPage', 30);
if (!$Limit) {
$Limit = $ConfigLimit;
}
if ($Limit != $ConfigLimit) {
return;
}
if (is_array($PageWhere)) {
$Curr = array_values($PageWhere);
} else {
$Curr = false;
}
$New = array(GetValueR('0.DateInserted', $Result));
if (count($Result) >= $Limit) {
$New[] = valr($Limit - 1 . '.DateInserted', $Result);
}
if ($Curr != $New) {
trace('CommentModel->CachePageWhere()');
$CacheKey = "Comment.Page.{$Limit}.{$DiscussionID}.{$Page}";
Gdn::cache()->store($CacheKey, $New, array(Gdn_Cache::FEATURE_EXPIRY => 86400));
trace($New, $CacheKey);
// Gdn::controller()->setData('_PageCacheStore', array($CacheKey, $New));
}
}
示例2: SetModuleSort
/**
* Function for quick modify sorting for modules in configuration file.
* See library/core/class.controller.php ~ L: 118
* If $PositionItem is False (default) $ModuleName will be added to the edn of the list.
* If $PositionItem is integer (positive or negative) ...
* If $PositionItem is string ...
*
* @param string $ModuleSortContainer, container name.
* @param string $AssetName, asset name.
* @param string $ModuleName, module name which need to add to config.
* @param mixed $PositionItem.
* @return bool. Return FALSE on failure.
*/
function SetModuleSort($ModuleSortContainer, $AssetName, $ModuleName, $PositionItem = False)
{
$ModuleSort = Gdn::Config('Modules');
$AssetSort = GetValueR("{$ModuleSortContainer}.{$AssetName}", $ModuleSort, array());
if (!is_array($AssetSort)) {
$AssetSort = array();
}
if ($PositionItem !== False) {
if (!is_numeric($PositionItem)) {
$Position = substr($PositionItem, 0, 1);
if (in_array($Position, array('-', '+'))) {
$PositionItem = substr($PositionItem, 1);
}
$PositionItem = array_search($PositionItem, $AssetSort);
if ($Position == '+') {
$PositionItem = (int) $PositionItem + 1;
}
}
$PositionItem = (int) $PositionItem;
array_splice($AssetSort, $PositionItem, 0, array($ModuleName));
} else {
array_push($AssetSort, $ModuleName);
}
$AssetSort = array_unique($AssetSort);
// Make sure that we put in config strings only.
$VarExport = create_function('$Value', 'return var_export(strval($Value), True);');
$ModuleList = implode(', ', array_map($VarExport, $AssetSort));
$PhpArrayCode = "\n\$Configuration['Modules']['{$ModuleSortContainer}']['{$AssetName}'] = array({$ModuleList});";
$ConfigFile = PATH_CONF . '/config.php';
$Result = file_put_contents($ConfigFile, $PhpArrayCode, FILE_APPEND | LOCK_EX);
return $Result !== False;
}
示例3: GoogleTranslate
function GoogleTranslate($Text, $Options = False)
{
static $LanguageCode;
if (is_null($LanguageCode)) {
$LanguageCode = LocaleLanguageCode();
}
$ResetCache = ArrayValue('ResetCache', $Options, False);
$From = ArrayValue('From', $Options, $LanguageCode);
$To = ArrayValue('To', $Options, $LanguageCode);
$String = rawurlencode($Text);
if (!LoadExtension('curl')) {
throw new Exception('You need to load/activate the cURL extension (http://www.php.net/cURL).');
}
$Resource = curl_init();
$HTTPS = GetValue('HTTPS', $_SERVER, '');
$Protocol = strlen($HTTPS) || GetValue('SERVER_PORT', $_SERVER) == 443 ? 'https://' : 'http://';
$Host = GetValue('HTTP_HOST', $_SERVER, 'google.com');
$Referer = $Protocol . $Host;
curl_setopt($Resource, CURLOPT_URL, "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q={$String}&langpair={$From}%7C{$To}");
curl_setopt($Resource, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($Resource, CURLOPT_REFERER, $Referer);
$Body = curl_exec($Resource);
curl_close($Resource);
$TranslatedText = GetValueR('responseData.translatedText', json_decode($Body));
$TranslatedText = html_entity_decode($TranslatedText, ENT_QUOTES, 'utf-8');
return $TranslatedText;
}
示例4: smarty_function_custom_menu
/**
* A placeholder for future menu items.
*
* @param array The parameters passed into the function. This currently takes no parameters.
* @param Smarty The smarty object rendering the template.
* @return
*/
function smarty_function_custom_menu($Params, &$Smarty)
{
$Controller = $Smarty->Controller;
if (is_object($Menu = GetValue('Menu', $Controller))) {
$Format = GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', GetValue('wrap', $Params, 'li')));
$Result = '';
foreach ($Menu->Items as $Group) {
foreach ($Group as $Item) {
// Make sure the item is a custom item.
if (GetValueR('Attributes.Standard', $Item)) {
continue;
}
// Make sure the user has permission for the item.
if ($Permission = GetValue('Permission', $Item)) {
if (!Gdn::Session()->CheckPermission($Permission)) {
continue;
}
}
if (($Url = GetValue('Url', $Item)) && ($Text = GetValue('Text', $Item))) {
$Result .= Gdn_Theme::Link($Url, $Text, $Format);
}
}
}
return $Result;
}
return '';
}
示例5: data
/**
*
*
* @param null $Name
* @param string $Default
* @return array|mixed
*/
public function data($Name = null, $Default = '')
{
if ($Name == null) {
$Result = $this->Data;
} else {
$Result = GetValueR($Name, $this->Data, $Default);
}
return $Result;
}
示例6: AddWarnLevel
public function AddWarnLevel($Sender, &$Args)
{
if (Gdn::Session()->CheckPermission('Garden.Moderation.Manage') || Gdn::Session()->Isvalid() && GetValueR('Author.UserID', $Args) == Gdn::Session()->User->UserID) {
$WarnLevel = GetValueR('Author.Attributes.WarnLevel', $Args);
if ($WarnLevel && $WarnLevel != 'None') {
echo "<span class=\"WarnLevel WarnLevel{$WarnLevel}\">" . T('Warning.Level.' . $WarnLevel, $WarnLevel) . '</span>';
}
}
}
示例7: _AddCreatePageModule
protected function _AddCreatePageModule($Sender)
{
if (Gdn::Session()->CheckPermission('Candy.Pages.Add')) {
$Router = Gdn::Router();
$Default404 = GetValueR('Routes.Default404.Destination', $Router);
if ($Default404 == $Sender->SelfUrl) {
$Sender->AddModule(new CreatePageModule($Sender, 'candy'));
}
}
}
示例8: SetAjarData
public function SetAjarData($SectionPath = False)
{
$SectionModel = Gdn::Factory('SectionModel');
if ($SectionPath === False) {
$SectionPath = GetValueR('SectionID', $this->_Sender);
} elseif (is_object($SectionPath) && $SectionPath instanceof StdClass) {
$SectionPath = $SectionPath->SectionID;
}
if ($SectionPath) {
$this->SetData('Items', $SectionModel->Ajar($SectionPath, '', False));
}
}
示例9: YmapGeoCoordinates
/**
* Returns longtintude and latitude of $Address.
* @param string $Address Adress which need to get coordinates.
*/
function YmapGeoCoordinates($Address, $Options = FALSE)
{
$Raw = $Options === TRUE;
$Data = array();
$Data['geocode'] = $Address;
$Url = 'http://geocode-maps.yandex.ru/1.x/?' . http_build_query($Data);
$Content = simplexml_load_string(file_get_contents($Url));
$Result = json_decode(json_encode($Content), TRUE);
if ($Raw) {
return $Result;
}
$Result = GetValueR('GeoObjectCollection.featureMember', $Result);
$Result = GetValueR('GeoObject.Point.pos', $Result);
return $Result;
}
示例10: GetGeoCoords
/**
* Gets GeoCoords by calling the Google Maps geoencoding API.
*
* @param mixed $Address.
* @param mixed $Name.
* @return mixed $Result.
*/
function GetGeoCoords($Address, $Name = False)
{
//$Address = utf8_encode($Address);
// call geoencoding api with param json for output
$GeoCodeURL = "http://maps.google.com/maps/api/geocode/json?address=" . urlencode($Address) . "&sensor=false";
$Result = json_decode(file_get_contents($GeoCodeURL));
$Status = $Result->status;
if ($Status == 'OK') {
$Result = $Result->results[0];
}
if ($Name !== False) {
$Result = GetValueR($Name, $Result);
}
return $Result;
}
示例11: GoogleTranslate
function GoogleTranslate($Text, $Options = False)
{
static $LanguageCode;
if (is_null($LanguageCode)) {
$LanguageCode = LocaleLanguageCode();
}
$ResetCache = ArrayValue('ResetCache', $Options, False);
$From = ArrayValue('From', $Options, $LanguageCode);
$To = ArrayValue('To', $Options, $LanguageCode);
$String = rawurlencode($Text);
$Result = False;
if (!LoadExtension('curl')) {
throw new Exception('You need to load/activate the cURL extension (http://www.php.net/cURL).');
}
$Resource = curl_init();
$HTTPS = GetValue('HTTPS', $_SERVER, '');
$Protocol = strlen($HTTPS) || GetValue('SERVER_PORT', $_SERVER) == 443 ? 'https://' : 'http://';
$Host = GetValue('HTTP_HOST', $_SERVER, 'google.com');
$Referer = $Protocol . $Host;
curl_setopt($Resource, CURLOPT_URL, "http://translate.google.com/translate_a/t?client=t&text={$String}&sl={$From}&tl={$To}&ie=UTF-8");
curl_setopt($Resource, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($Resource, CURLOPT_REFERER, $Referer);
$Body = curl_exec($Resource);
// Detect response encoding.
$ContentType = curl_getinfo($Resource, CURLINFO_CONTENT_TYPE);
if ($ContentType) {
preg_match('/charset\\=(.+)/', $ContentType, $Match);
$Charset = $Match[1];
if ($Charset) {
$Body = mb_convert_encoding($Body, 'utf-8', $Charset);
}
}
curl_close($Resource);
$Pos = strpos($Body, ']]');
if ($Pos !== False) {
$Body = substr($Body, 1, $Pos + 1);
$Json = json_decode($Body);
if ($ErrorMessage = LastJsonErrorMessage()) {
trigger_error($ErrorMessage);
}
$Result = GetValueR('0.0', $Json);
$Result = html_entity_decode($Result, ENT_QUOTES, 'utf-8');
}
return $Result;
}
示例12: Base_BeforeRenderAsset_Handler
public function Base_BeforeRenderAsset_Handler($Sender)
{
$AssetName = GetValueR('EventArguments.AssetName', $Sender);
if (InSection("DiscussionList")) {
if (C('Plugin.PrestigeSlider.RenderCondition') == 'all' or C('Plugin.PrestigeSlider.RenderCondition') == 'DiscussionList') {
if ($AssetName == "Content") {
echo $Sender->FetchView($this->GetView('slider.php'));
}
}
}
if (InSection("CategoryList")) {
if (C('Plugin.PrestigeSlider.RenderCondition') == 'all' or C('Plugin.PrestigeSlider.RenderCondition') == 'CategoryList') {
if ($AssetName == "Content") {
echo $Sender->FetchView($this->GetView('slider.php'));
}
}
}
}
示例13: writeConnection
function writeConnection($Row)
{
$c = Gdn::controller();
$Connected = val('Connected', $Row);
?>
<li id="<?php
echo "Provider_{$Row['ProviderKey']}";
?>
" class="Item">
<div class="Connection-Header">
<span class="IconWrap">
<?php
echo img(val('Icon', $Row, Asset('/applications/dashboard/design/images/connection-64.png')));
?>
</span>
<span class="Connection-Name">
<?php
echo val('Name', $Row, t('Unknown'));
if ($Connected) {
echo ' <span class="Gloss Connected">';
if ($Photo = valr('Profile.Photo', $Row)) {
echo ' ' . Img($Photo, array('class' => 'ProfilePhoto ProfilePhotoSmall'));
}
echo ' ' . htmlspecialchars(GetValueR('Profile.Name', $Row)) . '</span>';
}
?>
</span>
<span class="Connection-Connect">
<?php
echo ConnectButton($Row);
?>
</span>
</div>
<!-- <div class="Connection-Body">
<?php
// if (Debug()) {
// decho(val($Row['ProviderKey'], $c->User->Attributes), 'Attributes');
// }
?>
</div>-->
</li>
<?php
}
示例14: DiscussionsController_AfterRenderAsset_Handler
public function DiscussionsController_AfterRenderAsset_Handler($Sender)
{
$AssetName = GetValueR('EventArguments.AssetName', $Sender);
if ($AssetName != "Content") {
return;
}
$CurTime = time();
$LastTime = Gdn::Get('TimeCheck', $LastTime);
$SFVcount = Gdn::Get('ViewCount', $SFVcount);
$SFUcount = Gdn::Get('UserCount', $SFUcount);
$SFDcount = Gdn::Get('DiscussionCount', $SFDcount);
$SFCcount = Gdn::Get('CommentCount', $SFCcount);
// refresh counts every 60 seconds unless config is set
// e.g. $Configuration['Plugins']['StatisticsFooter']['Refresh'] = '90';
$IncSec = C('Plugins.StatisticsFooter.Refresh', 60);
if ($CurTime > $LastTime) {
$LastTime = time() + $IncSec;
Gdn::Set('TimeCheck', $LastTime);
$SFVcount = $this->GetViewCount();
Gdn::Set('ViewCount', $SFVcount);
$SFUcount = $this->GetUserCount();
Gdn::Set('UserCount', $SFUcount);
$SFDcount = $this->GetDiscussionCount();
Gdn::Set('DiscussionCount', $SFDcount);
$SFCcount = $this->GetCommentCount();
Gdn::Set('CommentCount', $SFCcount);
}
$SFPcount = $SFDcount + $SFCcount;
$ShowMe = C('Plugins.StatisticsFooter.Show');
if (strpos($ShowMe, "v") !== FALSE) {
echo Wrap(Wrap(T('View Count')) . Gdn_Format::BigNumber($SFVcount), 'div', array('class' => 'SFBox SFVCBox'));
}
if (strpos($ShowMe, "u") !== FALSE) {
echo Wrap(Wrap(T('User Count')) . Gdn_Format::BigNumber($SFUcount), 'div', array('class' => 'SFBox SFUBox'));
}
if (strpos($ShowMe, "t") !== FALSE) {
echo Wrap(Wrap(T('Topic Count')) . Gdn_Format::BigNumber($SFDcount), 'div', array('class' => 'SFBox SFTBox'));
}
if (strpos($ShowMe, "c") !== FALSE) {
echo Wrap(Wrap(T('Post Count')) . Gdn_Format::BigNumber($SFPcount), 'div', array('class' => 'SFBox SFPBox'));
}
}
示例15: GetUserEmails
protected function GetUserEmails($FormValues)
{
$SQL = Gdn::SQL();
$UserModel = Gdn::UserModel();
if (ArrayValue('SendMeOnly', $FormValues)) {
$Session = Gdn::Session();
$UserID = GetValueR('User.UserID', $Session);
$User = $UserModel->Get($UserID);
$Result[$User->Email] = $User->Name;
return $Result;
}
$Roles = ArrayValue('Roles', $FormValues);
if (is_array($Roles) && count($Roles) > 0) {
$DataSet = $SQL->Select('u.Name, u.Email')->From('UserRole r')->Join('User u', 'u.UserID = r.UserID')->WhereIn('r.RoleID', $Roles)->Get();
} else {
$DataSet = $SQL->Select('u.Name, u.Email')->From('User u')->Get();
}
$Result = ConsolidateArrayValuesByKey($DataSet->ResultArray(), 'Email', 'Name');
return $Result;
}