本文整理汇总了PHP中GetValue函数的典型用法代码示例。如果您正苦于以下问题:PHP GetValue函数的具体用法?PHP GetValue怎么用?PHP GetValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UserModel_BeforeDeleteUser_Handler
public function UserModel_BeforeDeleteUser_Handler($Sender) {
$UserID = GetValue('UserID', $Sender->EventArguments);
$Options = GetValue('Options', $Sender->EventArguments, array());
$Options = is_array($Options) ? $Options : array();
$DeleteMethod = GetValue('DeleteMethod', $Options, 'delete');
if ($DeleteMethod == 'delete') {
$Sender->SQL->Delete('Conversation', array('InsertUserID' => $UserID));
$Sender->SQL->Delete('Conversation', array('UpdateUserID' => $UserID));
$Sender->SQL->Delete('UserConversation', array('UserID' => $UserID));
$Sender->SQL->Delete('ConversationMessage', array('InsertUserID' => $UserID));
} else if ($DeleteMethod == 'wipe') {
$Sender->SQL->Update('ConversationMessage')
->Set('Body', T('The user and all related content has been deleted.'))
->Set('Format', 'Deleted')
->Where('InsertUserID', $UserID)
->Put();
} else {
// Leave conversation messages
}
// Remove the user's profile information related to this application
$Sender->SQL->Update('User')
->Set('CountUnreadConversations', 0)
->Where('UserID', $UserID)
->Put();
}
示例2: Render
public function Render()
{
$RenderedCount = 0;
foreach ($this->Items as $Item) {
$this->EventArguments['AssetName'] = $this->AssetName;
if (is_string($Item)) {
if (!empty($Item)) {
if ($RenderedCount > 0) {
$this->FireEvent('BetweenRenderAsset');
}
echo $Item;
$RenderedCount++;
}
} elseif ($Item instanceof Gdn_IModule) {
if (!GetValue('Visible', $Item, TRUE)) {
continue;
}
$LengthBefore = ob_get_length();
$Item->Render();
$LengthAfter = ob_get_length();
if ($LengthBefore !== FALSE && $LengthAfter > $LengthBefore) {
if ($RenderedCount > 0) {
$this->FireEvent('BetweenRenderAsset');
}
$RenderedCount++;
}
} else {
throw new Exception();
}
}
unset($this->EventArguments['AssetName']);
}
示例3: Index
/**
* Display the embedded forum.
*
* @since 2.0.18
* @access public
*/
public function Index()
{
$this->AddSideMenu('dashboard/embed');
$this->Title('Embed Vanilla');
$this->Form = new Gdn_Form();
$Validation = new Gdn_Validation();
$ConfigurationModel = new Gdn_ConfigurationModel($Validation);
$ConfigurationModel->SetField(array('Garden.TrustedDomains'));
$this->Form->SetModel($ConfigurationModel);
if ($this->Form->AuthenticatedPostBack() === FALSE) {
// Format trusted domains as a string
$TrustedDomains = GetValue('Garden.TrustedDomains', $ConfigurationModel->Data);
if (is_array($TrustedDomains)) {
$TrustedDomains = implode("\n", $TrustedDomains);
}
$ConfigurationModel->Data['Garden.TrustedDomains'] = $TrustedDomains;
// Apply the config settings to the form.
$this->Form->SetData($ConfigurationModel->Data);
} else {
// Format the trusted domains as an array based on newlines & spaces
$TrustedDomains = $this->Form->GetValue('Garden.TrustedDomains');
$TrustedDomains = explode(' ', str_replace("\n", ' ', $TrustedDomains));
$TrustedDomains = array_unique(array_map('trim', $TrustedDomains));
$this->Form->SetFormValue('Garden.TrustedDomains', $TrustedDomains);
if ($this->Form->Save() !== FALSE) {
$this->InformMessage(T("Your settings have been saved."));
}
// Reformat array as string so it displays properly in the form
$this->Form->SetFormValue('Garden.TrustedDomains', implode("\n", $TrustedDomains));
}
$this->Render();
}
示例4: smarty_function_signin_link
/**
*/
function smarty_function_signin_link($Params, &$Smarty)
{
if (!Gdn::Session()->IsValid()) {
$Wrap = GetValue('wrap', $Params, 'li');
return Gdn_Theme::Link('signinout', GetValue('text', $Params, ''), GetValue('format', $Params, Wrap('<a href="%url" rel="nofollow" class="%class">%text</a>', $Wrap)), $Params);
}
}
示例5: ToString
public function ToString()
{
if ($this->_UserData->NumRows() == 0) {
return '';
}
$String = '';
ob_start();
?>
<div class="Box">
<?php
echo panelHeading(T('In this Discussion'));
?>
<ul class="PanelInfo">
<?php
foreach ($this->_UserData->Result() as $User) {
?>
<li>
<?php
echo Anchor(Wrap(Wrap(Gdn_Format::Date($User->DateLastActive, 'html')), 'span', array('class' => 'Aside')) . ' ' . Wrap(Wrap(GetValue('Name', $User), 'span', array('class' => 'Username')), 'span'), UserUrl($User));
?>
</li>
<?php
}
?>
</ul>
</div>
<?php
$String = ob_get_contents();
@ob_end_clean();
return $String;
}
示例6: 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 '';
}
示例7: processAvatars
/**
* Create different sizes of user photos.
*/
public function processAvatars()
{
$UploadImage = new Gdn_UploadImage();
$UserData = $this->SQL->select('u.Photo')->from('User u')->where('u.Photo is not null')->get();
// Make sure the avatars folder exists.
if (!file_exists(PATH_UPLOADS . '/userpics')) {
mkdir(PATH_UPLOADS . '/userpics');
}
// Get sizes
$ProfileHeight = c('Garden.Profile.MaxHeight', 1000);
$ProfileWidth = c('Garden.Profile.MaxWidth', 250);
$ThumbSize = c('Garden.Thumbnail.Size', 40);
// Temporarily set maximum quality
saveToConfig('Garden.UploadImage.Quality', 100, false);
// Create profile and thumbnail sizes
foreach ($UserData->result() as $User) {
try {
$Image = PATH_ROOT . DS . 'uploads' . DS . GetValue('Photo', $User);
$ImageBaseName = pathinfo($Image, PATHINFO_BASENAME);
// Save profile size
$UploadImage->SaveImageAs($Image, PATH_UPLOADS . '/userpics/p' . $ImageBaseName, $ProfileHeight, $ProfileWidth);
// Save thumbnail size
$UploadImage->SaveImageAs($Image, PATH_UPLOADS . '/userpics/n' . $ImageBaseName, $ThumbSize, $ThumbSize, true);
} catch (Exception $ex) {
}
}
}
示例8: TranslationCollectorLocale_BeforeTranslate_Handler
public function TranslationCollectorLocale_BeforeTranslate_Handler($Sender)
{
$Application = $this->_EnabledApplication();
if (in_array($Application, $this->_SkipApplications)) {
return;
}
$Code = GetValue('Code', $Sender->EventArguments, '');
if (substr($Code, 0, 1) == '@') {
return;
}
if (array_key_exists($Code, $this->_Definition)) {
return;
}
$Application = strtolower($Application);
$File = dirname(__FILE__) . '/undefined/' . $Application . '.php';
if (!file_exists($File)) {
$HelpText = "Translate, cut and paste this to /locales/your-locale/{$Application}.php";
file_put_contents($File, "<?php // {$HelpText} \n");
}
$Definition = array();
include $File;
if (!array_key_exists($Code, $Definition)) {
// Should be escaped.
$Code = var_export($Code, True);
$PhpArrayCode = "\n\$Definition[" . $Code . "] = {$Code};";
file_put_contents($File, $PhpArrayCode, FILE_APPEND | LOCK_EX);
}
}
示例9: Get
public function Get($Where = False, $Offset = False, $Limit = False, $OrderBy = 'p.PageID', $OrderDirection = 'desc')
{
$bCountQuery = GetValue('bCountQuery', $Where, False, True);
if ($bCountQuery) {
$this->SQL->Select('*', 'count', 'RowCount');
$Offset = $Limit = False;
}
if (GetValue('Browse', $Where, True, True) && !$bCountQuery) {
$this->SQL->Select('p.PageID, p.Title, p.Visible, p.SectionID, p.URI')->Select('p.DateInserted, p.DateInserted, p.UpdateUserID, p.DateUpdated');
}
if ($Join = GetValue('WithSection', $Where, False, True)) {
if (!in_array($Join, array('left', 'inner'), True)) {
$Join = 'left';
}
$SectionTable = C('Candy.Sections.Table', 'Section');
$this->SQL->Join("{$SectionTable} s", 's.SectionID = p.SectionID', $Join);
if (!$bCountQuery) {
$this->SQL->Select('s.SectionID as SectionID')->Select('s.TreeLeft as SectionTreeLeft')->Select('s.TreeRight as SectionTreeRight')->Select('s.Depth as SectionDepth')->Select('s.ParentID as SectionParentID')->Select('s.Name as SectionName')->Select('s.RequestUri as SectionRequestUri');
}
}
$this->EventArguments['bCountQuery'] = $bCountQuery;
$this->EventArguments['Where'] =& $Where;
$this->FireEvent('BeforeGet');
if ($OrderBy !== False && !$bCountQuery) {
$this->SQL->OrderBy($OrderBy, $OrderDirection);
}
if (is_array($Where)) {
$this->SQL->Where($Where);
}
$Result = $this->SQL->From('Page p')->Limit($Limit, $Offset)->Get();
if ($bCountQuery) {
$Result = $Result->FirstRow()->RowCount;
}
return $Result;
}
示例10: UserInfoModule_OnBasicInfo_Handler
public function UserInfoModule_OnBasicInfo_Handler(&$Sender)
{
$UserID = $Sender->User->UserID;
$PostCount = GetValue("PostCount", Gdn::Database()->Query(sprintf("SELECT COALESCE(u.CountComments,0) + COALESCE(u.CountDiscussions,0) AS PostCount FROM GDN_User u WHERE UserID = %d", $UserID))->FirstRow(DATASET_TYPE_ARRAY), 0);
echo "<dt>" . T(Plural($PostCount, 'Posts', 'Posts')) . "</dt>\n";
echo "<dd>" . number_format($PostCount) . "</dd>";
}
示例11: DPRenderResults
function DPRenderResults($Poll)
{
$TitleExists = GetValue('Title', $Poll, FALSE);
$HideTitle = C('Plugins.DiscussionPolls.DisablePollTitle', FALSE);
echo '<div class="DP_ResultsForm">';
if ($TitleExists || $HideTitle) {
$TitleS = $Poll->Title;
if (trim($Poll->Title) != FALSE) {
$TitleS .= '<hr />';
}
} else {
$TitleS = Wrap(T('Plugins.DiscussionPolls.NotFound', 'Poll not found'));
}
echo $TitleS;
echo '<ol class="DP_ResultQuestions">';
if (!$TitleExists && !$HideTitle) {
//do nothing
} else {
if (!count($Poll->Questions)) {
echo Wrap(T('Plugins.DiscussionPolls.NoReults', 'No results for this poll'));
} else {
foreach ($Poll->Questions as $Question) {
RenderQuestion($Question);
}
}
}
echo '</ol>';
echo '</div>';
}
示例12: userAnchor
/**
* Take a user object, and writes out an anchor of the user's name to the user's profile.
*/
function userAnchor($User, $CssClass = null, $Options = null)
{
static $NameUnique = null;
if ($NameUnique === null) {
$NameUnique = c('Garden.Registration.NameUnique');
}
if (is_array($CssClass)) {
$Options = $CssClass;
$CssClass = null;
} elseif (is_string($Options)) {
$Options = array('Px' => $Options);
}
$Px = GetValue('Px', $Options, '');
$Name = GetValue($Px . 'Name', $User, t('Unknown'));
// $Text = GetValue('Text', $Options, htmlspecialchars($Name)); // Allow anchor text to be overridden.
$Text = GetValue('Text', $Options, '');
if ($Text == '') {
// get all fields since that is better for caching!
$profileFields = Gdn::userMetaModel()->getUserMeta($User->UserID, 'Profile.%', 'Profile.');
$Text = $profileFields['Profile.' . c('Nickname.Fieldname')];
if ($Text == '') {
$Text = htmlspecialchars($Name);
}
// return
} else {
$Text = htmlspecialchars($Name);
}
$Attributes = array('class' => $CssClass, 'rel' => GetValue('Rel', $Options));
if (isset($Options['title'])) {
$Attributes['title'] = $Options['title'];
}
$UserUrl = UserUrl($User, $Px);
return '<a href="' . htmlspecialchars(Url($UserUrl)) . '"' . Attribute($Attributes) . '>' . $Text . '</a>';
}
示例13: GetPluginFolder
public function GetPluginFolder($Absolute = TRUE)
{
$Folder = GetValue('Folder', Gdn::PluginManager()->GetPluginInfo(get_class($this), Gdn_PluginManager::ACCESS_CLASSNAME));
$PathParts = array($Folder);
array_unshift($PathParts, $Absolute ? PATH_PLUGINS : 'plugins');
return implode(DS, $PathParts);
}
示例14: DiscussionModel_BeforeGet_Handler
public function DiscussionModel_BeforeGet_Handler($Sender)
{
$ArticleID = GetValue('ArticleID', $Sender);
if (is_numeric($ArticleID) && $ArticleID > 0) {
$Sender->SQL->Where('ArticleID', $ArticleID);
}
}
示例15: Get
public function Get($Where = False, $Offset = False, $Limit = False, $OrderBy = False, $OrderDirection = 'desc')
{
$bCountQuery = GetValue('bCountQuery', $Where, False, True);
if ($bCountQuery) {
$this->SQL->Select('*', 'count', 'RowCount');
$Offset = False;
$Limit = False;
$OrderBy = False;
}
if (GetValue('Browse', $Where, True, True) && !$bCountQuery) {
$this->SQL->Select('c.ChunkID, c.Name, c.Url, c.InsertUserID, c.DateInserted, c.UpdateUserID, c.DateUpdated');
}
/* if (GetValue('InsertAuthor', $Where, False, True) && !$bCountQuery) {
}
if (GetValue('UpdateAuthor', $Where, False, True) && !$bCountQuery) {
}
*/
$this->EventArguments['bCountQuery'] = $bCountQuery;
$this->EventArguments['Where'] =& $Where;
$this->FireEvent('BeforeGet');
if ($OrderBy !== False) {
$this->SQL->OrderBy($OrderBy, $OrderDirection);
}
if (is_array($Where)) {
$this->SQL->Where($Where);
}
$Result = $this->SQL->From($this->Name . ' c')->Limit($Limit, $Offset)->Get();
if ($bCountQuery) {
$Result = $Result->FirstRow()->RowCount;
}
return $Result;
}