本文整理汇总了PHP中cms_utils::get_current_content方法的典型用法代码示例。如果您正苦于以下问题:PHP cms_utils::get_current_content方法的具体用法?PHP cms_utils::get_current_content怎么用?PHP cms_utils::get_current_content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cms_utils
的用法示例。
在下文中一共展示了cms_utils::get_current_content方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_anchor
function smarty_function_anchor($params, &$template)
{
$smarty = $template->smarty;
$gCms = cmsms();
$content = cms_utils::get_current_content();
if (!is_object($content)) {
return;
}
// Added by Russ for class, tabindex and title for anchor 2006/07/19
$class = "";
$title = "";
$tabindex = "";
$accesskey = "";
if (isset($params['class'])) {
$class = ' class="' . $params['class'] . '"';
}
if (isset($params['title'])) {
$title = ' title="' . $params['title'] . '"';
}
if (isset($params['tabindex'])) {
$tabindex = ' tabindex="' . $params['tabindex'] . '"';
}
if (isset($params['accesskey'])) {
$accesskey = ' accesskey="' . $params['accesskey'] . '"';
}
// End of first part added by Russ 2006/07/19
$url = $content->GetURL() . '#' . trim($params['anchor']);
$url = str_replace('&', '***', $url);
$url = str_replace('&', '&', $url);
$url = str_replace('***', '&', $url);
if (isset($params['onlyhref']) && ($params['onlyhref'] == '1' || $params['onlyhref'] == 'true')) {
// Note if you set 'onlyheref' that is what you get - no class or title or tabindex or text
$tmp = $url;
} else {
// Line replaced by Russ
// echo '<a href="'.$url.'">'.$params['text'].'</a>';
// Line replaced with - by Russ to reflect class and title for anchor 2006/07/19
$tmp = '<a href="' . $url . '"' . $class . $title . $tabindex . $accesskey . '>' . $params['text'] . '</a>';
// End of second part added by Russ 2006/07/19
}
if (isset($params['assign'])) {
$smarty->assign(trim($params['assign']), $tmp);
return;
}
echo $tmp;
}
示例2: smarty_cms_function_page_image
function smarty_cms_function_page_image($params, &$smarty)
{
$result = '';
$propname = 'image';
if (isset($params['thumbnail'])) {
$propname = 'thumbnail';
}
$gCms = cmsms();
$contentobj =& cms_utils::get_current_content();
if (is_object($contentobj)) {
$result = $contentobj->GetPropertyValue($propname);
if ($result == -1) {
$result = '';
}
}
if (isset($params['assign'])) {
$smarty =& $gCms->GetSmarty();
$smarty->assign($params['assign'], $result);
return;
}
return $result;
}
示例3: generate_ga
/**
* @ignore
*/
public function generate_ga()
{
// generate analytics stuff
$property_id = \cge_param::get_string($this->_config, 'cghm_ga_propertyid');
if (!$property_id) {
return;
}
$linkdomains = \cge_param::get_string($this->_config, 'cghm_ga_linkdomains');
if ($linkdomains) {
$linkdomains = $this->str_to_array($linkdomains);
}
$subdomains = \cge_param::get_bool($this->_config, 'cghm_ga_subdomains');
$domain = \cge_param::get_string($this->_config, 'cghm_ga_domain');
if ($subdomains && !$domain) {
$sysconfig = \cms_config::get_instance();
$url = new \cms_url($sysconfig['root_url']);
$domain = $url->get_host();
}
$tpl = $this->CreateSmartyTemplate('google_analytics.tpl');
$tpl->assign('content_obj', \cms_utils::get_current_content());
$tpl->assign('config', $this->_config);
$tpl->assign('domain', $domain);
if (count($linkdomains)) {
$tpl->assign('linkdomains', $linkdomains);
}
return $tpl->fetch();
}
示例4: page_url
/**
* Get the URL of the currently requested page.
* Only works for frontend requests
*
* @deprecated
* @return string
*/
public static function page_url()
{
$content_obj = \cms_utils::get_current_content();
if (is_object($content_obj)) {
return $content_obj->GetURL();
}
}
示例5: cmsms
# The projects homepage is: cmsmadesimple.org
# Version: 0.9.4
# File : action.default.php
# This file is a modification of the default plugin {content}
# Purpose: performs the default frontend action if {AdvancedContent} is used.
# License: GPL
# deprecated
#-------------------------------------------------------------------------------
if (!is_object(cmsms())) {
exit;
}
if (isset($params['active']) && ac_utils::IsFalse($params['active'])) {
return;
}
# don't process inactive blocks
if (!($content_obj = cms_utils::get_current_content())) {
return;
}
$config = cmsms()->GetConfig();
$type = isset($params['block_type']) ? $params['block_type'] : '';
if ($content_obj->Type() != 'advanced_content' && $content_obj->Type() != 'content2') {
if ($type == 'image') {
if (!function_exists('smarty_cms_function_content_image') && !function_exists('smarty_function_content_image')) {
require_once $config['root_path'] . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'function.content_image.php';
}
$method = function_exists('smarty_cms_function_content_image') ? 'smarty_cms_function_content_image' : 'smarty_function_content_image';
$output = trim($method($params, cmsms()->GetSmarty()));
} else {
if ($type == 'module') {
if (!function_exists('smarty_cms_function_content_module') && !function_exists('smarty_function_content_module')) {
require_once $config['root_path'] . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'function.content_module.php';
示例6: smarty_cms_function_cms_stylesheet
function smarty_cms_function_cms_stylesheet($params, &$template)
{
#---------------------------------------------
# Initials
#---------------------------------------------
$smarty = $template->smarty;
$config = cmsms()->GetConfig();
$db = cmsms()->GetDb();
global $CMS_ADMIN_PAGE;
global $CMS_LOGIN_PAGE;
global $CMS_STYLESHEET;
$CMS_STYLESHEET = 1;
$template_id = -1;
$use_https = 0;
$cache_dir = $config['css_path'];
$stylesheet = '';
$combine_stylesheets = true;
$fnsuffix = '';
$trimbackground = FALSE;
$forceblackandwhite = FALSE;
$root_url = $config['css_url'];
$auto_https = 1;
#---------------------------------------------
# Trivial Exclusion
#---------------------------------------------
if (isset($CMS_LOGIN_PAGE)) {
return;
}
#---------------------------------------------
# Read parameters
#---------------------------------------------
if (isset($params["templateid"]) && $params["templateid"] != "") {
$template_id = $params["templateid"];
} else {
$content_obj = cms_utils::get_current_content();
if (!is_object($content_obj)) {
return;
}
$template_id = $content_obj->TemplateId();
$use_https = (int) $content_obj->Secure();
}
if (isset($params['auto_https']) && $params['auto_https'] == 0) {
$auto_https = 0;
}
if (isset($params['https'])) {
$use_https = (int) $params['https'];
}
if ($auto_https && cmsms()->is_https_request()) {
$use_https = 1;
}
if ($use_https && isset($config['ssl_url'])) {
$root_url = $config['ssl_css_url'];
}
if (isset($params['nocombine']) && $params['nocombine'] == 1) {
$combine_stylesheets = FALSE;
}
if (isset($params['stripbackground'])) {
$trimbackground = (int) $params['stripbackground'];
}
if (isset($params['forceblackonwhite'])) {
$forceblackandwhite = (int) $params['forceblackonwhite'];
}
if ($trimbackground || $forceblackandwhite) {
$fnsuffix = '_e_';
}
#---------------------------------------------
# Build query
#---------------------------------------------
$qparms = array();
$where = array();
$query = '';
$order = '';
if (isset($params['name']) && $params['name'] != '') {
$query = 'SELECT DISTINCT A.css_id,A.css_name,A.css_text,A.modified_date,A.media_type,A.media_query
FROM ' . cms_db_prefix() . 'css A';
$where[] = 'A.css_name = ?';
$qparms[] = trim($params['name']);
} else {
$query = 'SELECT DISTINCT A.css_id,A.css_name,A.css_text,A.modified_date,A.media_type,A.media_query,B.assoc_order
FROM ' . cms_db_prefix() . 'css A
LEFT JOIN ' . cms_db_prefix() . 'css_assoc B ON A.css_id = B.assoc_css_id';
$where[] = 'B.assoc_type = ? AND B.assoc_to_id = ?';
$qparms = array('template', $template_id);
if (isset($params['media']) && strtolower($params['media']) != 'all') {
$types = explode(',', $params['media']);
$expr = array();
foreach ($types as $type) {
$expr[] = 'media_type LIKE ?';
$qparms[] = '%' . trim($type) . '%';
}
$expr[] = 'media_type LIKE ?';
$qparms[] = '%all%';
$where[] = '(' . implode(' OR ', $expr) . ')';
}
$order = 'ORDER BY B.assoc_order';
}
$query .= " WHERE " . implode(' AND ', $where) . ' ' . $order;
#---------------------------------------------
# Execute
#---------------------------------------------
//.........这里部分代码省略.........
示例7: anchor_url
/**
* Generate a URL to an anchor on the same page
*
* @param string $name The name of the anchor
* @return string
*/
public static function anchor_url($name)
{
if (!$name) {
return;
}
$name = trim($name);
if (!$name) {
return;
}
$content_obj = \cms_utils::get_current_content();
if (!is_object($content_obj)) {
return;
}
return $content_obj->GetURL() . '#' . $name;
}