本文整理汇总了PHP中Gdn_Theme类的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Theme类的具体用法?PHP Gdn_Theme怎么用?PHP Gdn_Theme使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Gdn_Theme类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_link
/**
* Takes a route and prepends the web root (expects "/controller/action/params" as $Path).
*
* @param array The parameters passed into the function.
* The parameters that can be passed to this function are as follows.
* - <b>path</b>: The relative path for the url. There are some special paths that can be used to return "intelligent" links:
* - <b>signinout</b>: This will return a signin/signout url that will toggle depending on whether or not the user is already signed in. When this path is given the text is automaticall set.
* - <b>withdomain</b>: Whether or not to add the domain to the url.
* - <b>text</b>: Html text to be put inside an anchor. If this value is set then an html <a></a> is returned rather than just a url.
* - <b>id, class, etc.</b>: When an anchor is generated then any other attributes are passed through and will be written in the resulting tag.
* @param Smarty The smarty object rendering the template.
* @return The url.
*/
function smarty_function_link($Params, &$Smarty)
{
$Path = GetValue('path', $Params, '', TRUE);
$Text = GetValue('text', $Params, '', TRUE);
$NoTag = GetValue('notag', $Params, FALSE, TRUE);
$CustomFormat = GetValue('format', $Params, FALSE, TRUE);
if (!$Text && $Path != 'signinout' && $Path != 'signin') {
$NoTag = TRUE;
}
if ($CustomFormat) {
$Format = $CustomFormat;
} else {
if ($NoTag) {
$Format = '%url';
} else {
$Format = '<a href="%url" class="%class">%text</a>';
}
}
$Options = array();
if (isset($Params['withdomain'])) {
$Options['WithDomain'] = $Params['withdomain'];
}
if (isset($Params['class'])) {
$Options['class'] = $Params['class'];
}
if (isset($Params['tk'])) {
$Options['TK'] = $Params['tk'];
}
if (isset($Params['target'])) {
$Options['Target'] = $Params['target'];
}
$Result = Gdn_Theme::Link($Path, $Text, $Format, $Options);
return $Result;
}
示例2: initialize
/**
* Runs before every call to this controller.
*/
public function initialize()
{
parent::initialize();
Gdn_Theme::section('Dashboard');
set_time_limit(0);
// Is this even doing anything?
}
示例3: 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);
}
}
示例4: smarty_function_nomobile_link
/**
*
*
* @param array $Params
* @param object $Smarty
* @return string
*/
function smarty_function_nomobile_link($Params, &$Smarty)
{
$Path = val('path', $Params, '', true);
$Text = val('text', $Params, '', true);
$Wrap = val('wrap', $Params, 'li');
return Gdn_Theme::link('profile/nomobile', val('text', $Params, t("Full Site")), val('format', $Params, wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
示例5: smarty_function_category_link
/**
*/
function smarty_function_category_link($Params, &$Smarty)
{
$Path = GetValue('path', $Params, '', TRUE);
$Text = GetValue('text', $Params, '', TRUE);
$Wrap = GetValue('wrap', $Params, 'li');
return Gdn_Theme::Link('category', GetValue('text', $Params, ''), GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
示例6: smarty_function_module
/**
* @copyright Copyright 2008, 2009 Vanilla Forums Inc.
* @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
*/
function smarty_function_module($Params, &$Smarty)
{
$Name = GetValue('name', $Params);
unset($Params['name']);
$Result = Gdn_Theme::Module($Name, $Params);
return $Result;
}
示例7: smarty_function_nomobile_link
/**
*/
function smarty_function_nomobile_link($Params, &$Smarty)
{
$Path = GetValue('path', $Params, '', TRUE);
$Text = GetValue('text', $Params, '', TRUE);
$Wrap = GetValue('wrap', $Params, 'li');
return Gdn_Theme::Link('profile/nomobile', GetValue('text', $Params, T("Full Site")), GetValue('format', $Params, Wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
示例8: smarty_function_dashboard_link
/**
*
*
* @param array $Params
* @param object $Smarty
* @return string
*/
function smarty_function_dashboard_link($Params, &$Smarty)
{
$Path = val('path', $Params, '', true);
$Text = val('text', $Params, '', true);
$Wrap = val('wrap', $Params, 'li');
return Gdn_Theme::link('dashboard', val('text', $Params, ''), val('format', $Params, wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
示例9: smarty_function_breadcrumbs
/**
* Render a breadcrumb trail for the user based on the page they are on.
*/
function smarty_function_breadcrumbs($Params, &$Smarty)
{
$Breadcrumbs = $Smarty->Controller->Data('Breadcrumbs');
if (is_array($Breadcrumbs)) {
return Gdn_Theme::Breadcrumbs($Breadcrumbs);
}
}
示例10: smarty_function_custom_menu
/**
* A placeholder for future menu items.
*
* @param array $Params The parameters passed into the function.
* @param Smarty $Smarty The smarty object rendering the template.
* @return string
*/
function smarty_function_custom_menu($Params, &$Smarty)
{
$Controller = $Smarty->Controller;
if (is_object($Menu = val('Menu', $Controller))) {
$Format = val('format', $Params, wrap('<a href="%url" class="%class">%text</a>', val('wrap', $Params, 'li')));
$Result = '';
foreach ($Menu->Items as $Group) {
foreach ($Group as $Item) {
// Make sure the item is a custom item.
if (valr('Attributes.Standard', $Item)) {
continue;
}
// Make sure the user has permission for the item.
if ($Permission = val('Permission', $Item)) {
if (!Gdn::session()->checkPermission($Permission)) {
continue;
}
}
if (($Url = val('Url', $Item)) && ($Text = val('Text', $Item))) {
$Attributes = val('Attributes', $Item);
$Result .= Gdn_Theme::link($Url, $Text, $Format, $Attributes) . "\r\n";
}
}
}
return $Result;
}
return '';
}
示例11: initialize
/**
* Runs before every call to this controller.
*/
public function initialize()
{
parent::initialize();
Gdn_Theme::section('Dashboard');
$this->Model = new DBAModel();
$this->Form = new Gdn_Form();
$this->addJsFile('dba.js');
}
示例12: initialize
/**
* Set menu path. Automatically run on every use.
*
* @since 2.0.0
* @access public
*/
public function initialize()
{
parent::initialize();
Gdn_Theme::section('Dashboard');
if ($this->Menu) {
$this->Menu->highlightRoute('/dashboard/settings');
}
}
示例13: smarty_function_breadcrumbs
/**
* Render a breadcrumb trail for the user based on the page they are on.
*/
function smarty_function_breadcrumbs($Params, &$Smarty)
{
$Breadcrumbs = $Smarty->Controller->Data('Breadcrumbs');
if (!is_array($Breadcrumbs)) {
$Breadcrumbs = array();
}
return Gdn_Theme::Breadcrumbs($Breadcrumbs, GetValue('homelink', $Params, TRUE));
}
示例14: PluginController_FileUpload_Create
public function PluginController_FileUpload_Create($Sender)
{
$Sender->Title('FileUpload');
$Sender->AddSideMenu('plugin/fileupload');
Gdn_Theme::Section('Dashboard');
$Sender->Form = new Gdn_Form();
$this->EnableSlicing($Sender);
$this->Dispatch($Sender, $Sender->RequestArgs);
}
示例15: Initialize
public function Initialize()
{
parent::Initialize();
Gdn_Theme::Section('Dashboard');
$this->Model = new DBAModel();
$this->Form = new Gdn_Form();
$this->Form->InputPrefix = '';
$this->AddJsFile('dba.js');
}