本文整理汇总了PHP中cmsms函数的典型用法代码示例。如果您正苦于以下问题:PHP cmsms函数的具体用法?PHP cmsms怎么用?PHP cmsms使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cmsms函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetHeaderHTML
public function GetHeaderHTML()
{
if ($this->_header_html_called) {
return;
}
$this->_header_html_called = true;
$config = cmsms()->GetConfig();
$ret = '
<link rel=stylesheet href="' . $config['root_url'] . '/modules/AdvancedContent/css/jpicker.css" type="text/css" />
<script language="javascript" type="text/javascript" src="' . $config['root_url'] . '/modules/AdvancedContent/js/jquery.jpicker.min.js" defer="true"></script>
<script language="javascript" type="text/javascript">
/* <![CDATA[ */
ac_onload.push(function(){
(function($){
$.fn.jPicker.defaults.images.clientPath="' . $config['root_url'] . '/modules/AdvancedContent/images/jpicker/";';
foreach (acContentBlockManager::GetBlocksByType('colorpicker') as $block_id) {
$ret .= '$("#' . $block_id . '").jPicker();';
}
return $ret . '
})(jQuery);
});
/* ]]> */
</script>';
}
示例2: notify_users
public static function notify_users(cgfb_comment &$comment)
{
self::prepare_smarty_vars($comment);
$mod = cms_utils::get_module('CGFeedback');
$db = cmsms()->GetDb();
$query = 'SELECT DISTINCT author_email,author_name FROM ' . CGFEEDBACK_TABLE_COMMENTS . '
WHERE key1 = ? AND key2 = ? AND key3 = ? AND status = ?
and author_notify = 1';
$users = $db->GetArray($query, array($comment->key1, $comment->key2, $comment->key3, CGFEEDBACK_STATUS_PUBLISHED));
if (!is_array($users)) {
return TRUE;
}
$mailer = cms_utils::get_module('CMSMailer');
if (!$mailer) {
return FALSE;
}
$mailer->reset();
$mailer->IsHTML($mod->GetPreference('usernotification_ishtml', 1));
$subj = $mod->GetPreference(CGFEEDBACK_PREF_USERNOTIFICATION_SUBJECT);
$mailer->SetSubject($subj);
$body = $mod->ProcessTemplateFromDatabase(CGFEEDBACK_PREF_USERNOTIFICATION_TEMPLATE);
$mailer->SetBody($body);
for ($i = 0; $i < count($users); $i++) {
if (!is_email($users[$i]['author_email'])) {
continue;
}
$mailer->ClearAddresses();
$mailer->AddAddress($users[$i]['author_email'], $users[$i]['author_name']);
$mailer->Send();
}
$comment->notified = 1;
}
示例3: GetHeaderHTML
public function GetHeaderHTML()
{
$config = cmsms()->GetConfig();
$ret = '
<script language="javascript" type="text/javascript" src="' . $config['root_url'] . '/modules/AdvancedContent/js/jquery.jslider.min.js"></script>
<script language="javascript" type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function() {';
foreach ($this->content_obj->GetBlocksByType('slider') as $block_id) {
$ret .= 'jQuery("#' . $block_id . '").j_slider(';
if (count($this->GetBlockProperty('slider_params'))) {
$ret .= '{';
$slider_params = array();
foreach ($this->GetBlockProperty('slider_params') as $paramName => $paramValue) {
$slider_params[] = $paramName . ': ' . $paramValue;
}
$ret .= implode(',', $slider_params) . '}';
}
$ret .= ');';
}
return $ret . '
});
/* ]]> */
</script>';
}
示例4: expand_userlist
/**
* A function to return an expanded list of user id's given an input list
* if one of the id's specified is negative, it is assumed to be a group id
* and is expanded to its members.
*
* @param mixed A comma separated string, or an array of userid's or negative group id's.
* @return array
*/
public static function expand_userlist($useridlist)
{
$users = array();
if (!is_array($useridlist)) {
$useridlist = explode(',', $useridlist);
}
if (!count($useridlist)) {
return $users;
}
$userops = cmsms()->GetUserOperations();
foreach ($useridlist as $oneuid) {
if ($oneuid < 0) {
// assume its a group id
// and get all the uids for that group
$groupusers = $userops->LoadUsersInGroup($oneuid * -1);
foreach ($groupusers as $oneuser) {
$users[] = $oneuser->id;
}
} else {
$users[] = $oneuid;
}
}
$users = array_unique($users);
return $users;
}
示例5: GetHelp
public function GetHelp()
{
$smarty = cmsms()->GetSmarty();
$smarty->assign('help_title', $this->Lang('help_title'));
$smarty->assign('help_p1', $this->Lang('help_p1'));
$smarty->assign('help_h1', $this->Lang('help_h1'));
$smarty->assign('help_p2', $this->Lang('help_p2'));
$smarty->assign('help_h2', $this->Lang('help_h2'));
$smarty->assign('help_p3', $this->Lang('help_p3'));
$smarty->assign('help_feat_listitem1', $this->Lang('help_feat_listitem1'));
$smarty->assign('help_feat_listitem2', $this->Lang('help_feat_listitem2'));
$smarty->assign('help_feat_listitem3', $this->Lang('help_feat_listitem3'));
$smarty->assign('help_feat_listitem4', $this->Lang('help_feat_listitem4'));
$smarty->assign('help_feat_listitem5', $this->Lang('help_feat_listitem5'));
$smarty->assign('help_feat_listitem6', $this->Lang('help_feat_listitem6'));
$smarty->assign('help_h3', $this->Lang('help_h3'));
$smarty->assign('help_p4', $this->Lang('help_p4'));
$smarty->assign('help_prefs_listitem1', $this->Lang('help_prefs_listitem1'));
$smarty->assign('help_prefs_listitem2', $this->Lang('help_prefs_listitem2'));
$smarty->assign('help_prefs_listitem3', $this->Lang('help_prefs_listitem3'));
$smarty->assign('help_prefs_listitem4', $this->Lang('help_prefs_listitem4'));
$smarty->assign('help_prefs_listitem5', $this->Lang('help_prefs_listitem5'));
$smarty->assign('help_h4', $this->Lang('help_h4'));
$smarty->assign('help_p5', $this->Lang('help_p5'));
$smarty->assign('help_h5', $this->Lang('help_h5'));
$smarty->assign('help_p6', $this->Lang('help_p6'));
return $this->ProcessTemplate('help.tpl');
}
示例6: __construct
public function __construct()
{
global $CMS_INSTALL_PAGE, $CMS_PHAR_INSTALL;
if (isset($CMS_INSTALL_PAGE) || isset($CMS_PHAR_INSTALL)) {
return;
}
parent::__construct();
$fn = __DIR__ . '/class.cgsimple.php';
require_once $fn;
$smarty = cmsms()->GetSmarty();
if (!$smarty) {
return;
}
$cgsimple = new cgsimple();
$smarty->assign('cgsimple', $cgsimple);
$smarty->registerClass('cgsimple', 'cgsimple');
$smarty->register_function('module_action_link', 'module_action_link');
$smarty->register_function('module_action_url', 'module_action_url');
$smarty->register_function('cgrepeat', 'smarty_function_cgrepeat');
$smarty->register_function('session_put', 'smarty_function_session_put');
$smarty->register_function('session_erase', 'smarty_function_session_erase');
$smarty->register_function('cgsi_array_set', array($this, 'plugin_array_set'));
$smarty->register_function('cgsi_array_unset', array($this, 'plugin_array_unset'));
$smarty->register_function('anchor_link', array($this, 'plugin_anchorlink'));
}
示例7: cmsms
/**
* A method to re-initialize connections to the CMSMS configured database.
* This method should be used by any UDT's or other plugins that use any other method
* than the standard CMSMS supplied database object to connect to a database.
*
*/
function &adodb_connect()
{
$gCms = cmsms();
$config = $gCms->GetConfig();
$str = 'pear:date:extend';
if (isset($config['db_transactions'])) {
$str .= ':transaction';
}
$dbinstance = ADONewConnection($config['dbms'], $str);
$dbinstance->raiseErrorFn = "adodb_error";
$conn_func = isset($config['persistent_db_conn']) && $config['persistent_db_conn'] == true ? 'PConnect' : 'Connect';
if (!empty($config['db_port'])) {
$dbinstance->port = $config['db_port'];
}
$connect_result = $dbinstance->{$conn_func}($config['db_hostname'], $config['db_username'], $config['db_password'], $config['db_name']);
if (FALSE == $connect_result) {
$str = "Attempt to connect to database {$config['db_name']} on {$config['db_username']}@{$config['db_hostname']} failed";
trigger_error($str, E_USER_ERROR);
die($str);
}
$dbinstance->raiseErrorFn = null;
$dbinstance->SetFetchMode(ADODB_FETCH_ASSOC);
if ($config['debug'] == true) {
$dbinstance->debug = true;
}
if (!empty($config['default_encoding']) && $config['default_encoding'] == 'utf-8' && $config['set_names'] == true) {
$dbinstance->Execute("SET NAMES 'utf8'");
}
return $dbinstance;
}
示例8: unix_time
public static function unix_time($string)
{
// snarfed from smarty.
$string = trim($string);
$time = '';
if (empty($string)) {
// use "now":
$time = time();
} elseif (preg_match('/^\\d{14}$/', $string)) {
// it is mysql timestamp format of YYYYMMDDHHMMSS?
$time = mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), substr($string, 4, 2), substr($string, 6, 2), substr($string, 0, 4));
} elseif (preg_match("/(\\d{4})-(\\d{2})-(\\d{2})\\s(\\d{2}):(\\d{2}):(\\d{2})/", $string, $dt)) {
$time = mktime($dt[4], $dt[5], $dt[6], $dt[2], $dt[3], $dt[1]);
} elseif (is_numeric($string)) {
// it is a numeric string, we handle it as timestamp
$time = (int) $string;
} else {
// strtotime should handle it
$time = strtotime($string);
if ($time == -1 || $time === false) {
// strtotime() was not able to parse $string, use "now":
// but try one more thing
list($p1, $p2) = explode(' ', $string, 2);
$db = cmsms()->GetDb();
$time = $db->UnixTimeStamp($string);
if (!$time) {
$time = time();
}
}
}
return $time;
}
示例9: __construct
/**
* Takes an exception message of the form [module]%%key[%%suffix]
* and format a language string
*
* @param string $str The exception message
* @param int $code The exception code
* @param \Exception $parent a parent exception
*/
public function __construct($str = '', $code = 0, \Exception $parent = null)
{
if (strpos($str, '%%')) {
$parts = explode('%%', $str, 3);
if (count($parts) > 1) {
$module = trim($parts[0]);
$key = trim($parts[1]);
if (!$module) {
$module = cge_tmpdata::get('module');
if (!$module) {
$smarty = cmsms()->GetSmarty();
$obj = $smarty->get_template_vars('mod');
if (is_object($obj)) {
$module = $obj->GetName();
}
}
}
if ($module && $key) {
$mod = \cms_utils::get_module($module);
if ($mod) {
$str = $mod->Lang($key);
}
if (isset($parts[2]) && $parts[2]) {
$str .= ' ' . $parts[2];
}
}
}
}
parent::__construct($str, $code, $parent);
}
示例10: __construct
public function __construct($smarty)
{
parent::__construct($smarty);
$config = cmsms()->GetConfig();
$this->allow_php_tag = $config['use_smarty_php_tags'];
$this->php_functions = array('isset', 'empty', 'count', 'sizeof', 'in_array', 'is_array', 'time', 'lang', 'nl2br', 'file_exists', 'is_string', 'is_object', 'is_file', 'print_r', 'var_dump', 'htmlspecialchars', 'htmlspecialchars_decode');
}
示例11: cge_CGCreateInputSubmit
function cge_CGCreateInputSubmit(&$mod, $id, $name, $value = '', $addtext = '', $image = '', $confirmtext = '', $class = '')
{
$real_image = '';
if (!empty($image)) {
$config = cmsms()->GetConfig();
// check image_directories first
if (isset($mod->_image_directories) && !empty($mod->_image_directories)) {
foreach ($mod->_image_directories as $dir) {
$url = cms_join_path($dir, $image);
$path = cms_join_path($config['root_path'], $url);
if (is_readable($path)) {
$real_image = $url;
}
}
}
if (empty($real_image)) {
$theme = cmsms()->variables['admintheme'];
if (is_object($theme)) {
// we're in the admin
$txt = $theme->DisplayImage($image, $alt, $width, $height, $class);
$real_image = $theme->imageLink[$image];
}
}
$addtext .= ' title="' . $value . '"';
}
if (!empty($class)) {
$addtext .= ' class="' . $class . '"';
}
return $mod->CreateInputSubmit($id, $name, $value, $addtext, $real_image, $confirmtext);
}
示例12: PrePopulateAdminForm
function PrePopulateAdminForm($formDescriptor)
{
$gCms = cmsms();
$mod = $this->form_ptr->module_ptr;
$fpt = $this->form_ptr;
$main = array();
$adv = array();
$methods = array('POST' => 'POST', 'GET' => 'GET');
if (!function_exists('curl_init')) {
array_push($main, array('', $mod->Lang('title_install_curl')));
} else {
array_push($main, array($mod->Lang('title_method'), $mod->CreateInputDropdown($formDescriptor, 'fbrp_opt_method', $methods, -1, $this->GetOption('method'))));
array_push($main, array($mod->Lang('title_url'), $mod->CreateInputText($formDescriptor, 'fbrp_opt_url', $this->GetOption('url', ''), 40, 255) . '<br />' . $mod->Lang('title_url_help')));
$fields = $fpt->GetFields();
foreach ($fields as $tf) {
$al = $tf->GetAlias();
if (empty($al)) {
$al = $tf->GetVariableName();
}
array_push($adv, array($mod->Lang('title_maps_to', $tf->GetName()), $mod->CreateInputText($formDescriptor, 'fbrp_opt_fld_' . $tf->GetId(), $this->GetOption('fld_' . $tf->GetId(), $al), 40, 255) . $mod->CreateInputHidden($formDescriptor, 'fbrp_opt_sub_' . $tf->GetId(), '0') . $mod->CreateInputCheckbox($formDescriptor, 'fbrp_opt_sub_' . $tf->GetId(), '1', $this->GetOption('sub_' . $tf->GetId(), $tf->DisplayInSubmission() ? '1' : '0')) . $mod->Lang('title_include_in_submission')));
}
array_push($adv, array($mod->Lang('title_additional'), $mod->CreateInputText($formDescriptor, 'fbrp_opt_additional', $this->GetOption('additional'), 40, 255) . '<br />' . $mod->Lang('title_additional_help')));
}
return array('main' => $main, 'adv' => $adv);
}
示例13: cg_watermark
public static function &get_watermarker()
{
$mod = cge_utils::get_cge();
$txt = $mod->GetPreference('watermark_text');
$img = $mod->GetPreference('watermark_file');
$obj = new cg_watermark();
if (!empty($img)) {
$config = cmsms()->GetConfig();
$obj->set_watermark_image($config['uploads_path'] . '/' . $img);
} else {
if (!empty($txt)) {
$obj->set_watermark_text($txt);
$font = $mod->GetPreference('watermark_font');
$obj->set_font($font);
$obj->set_text_size($mod->GetPreference('watermark_textsize'));
$obj->set_text_angle($mod->GetPreference('watermark_textangle'));
$tmp = $mod->GetPreference('watermark_textcolor');
$r = hexdec(substr($tmp, 1, 2));
$g = hexdec(substr($tmp, 3, 2));
$b = hexdec(substr($tmp, 5, 2));
$obj->set_text_color($r, $g, $b);
$tmp = $mod->GetPreference('watermark_bgcolor');
$r = hexdec(substr($tmp, 1, 2));
$g = hexdec(substr($tmp, 3, 2));
$b = hexdec(substr($tmp, 5, 2));
$obj->set_background_color($r, $g, $b, $mod->GetPreference('watermark_transparent', 1));
}
}
$obj->set_alignment($mod->GetPreference('watermark_alignment'));
$obj->set_translucency($mod->GetPreference('watermark_translucency', 100));
return $obj;
}
示例14: cms_autoloader
function cms_autoloader($classname)
{
//if( $classname != 'Smarty_CMS' && $classname != 'Smarty_Parser' && startswith($classname,'Smarty') ) return;
$config = cmsms()->GetConfig();
// standard classes
$fn = cms_join_path($config['root_path'], 'lib', 'classes', "class.{$classname}.php");
if (file_exists($fn)) {
__cms_load($fn);
return;
}
$lowercase = strtolower($classname);
$fn = cms_join_path($config['root_path'], 'lib', 'classes', "class.{$lowercase}.inc.php");
if (file_exists($fn) && $classname != 'Content') {
__cms_load($fn);
return;
}
// standard interfaces
$fn = cms_join_path($config['root_path'], 'lib', 'classes', "interface.{$classname}.php");
if (file_exists($fn)) {
__cms_load($fn);
return;
}
global $CMS_LAZYLOAD_MODULES;
global $CMS_INSTALL_PAGE;
if (!isset($CMS_LAZYLOAD_MODULES) || isset($CMS_INSTALL_PAGE)) {
return;
}
// standard content types
$fn = cms_join_path($config['root_path'], 'lib', 'classes', 'contenttypes', "{$classname}.inc.php");
if (file_exists($fn)) {
__cms_load($fn);
return;
}
// module loaded content types
$contentops = ContentOperations::get_instance();
if ($contentops) {
// why would this ever NOT be true.. dunno, but hey.
$types = $contentops->ListContentTypes();
if (in_array(strtolower($classname), array_keys($types))) {
$contentops->LoadContentType(strtolower($classname));
return;
}
}
$fn = $config['root_path'] . "/modules/{$classname}/{$classname}.module.php";
if (file_exists($fn)) {
__cms_load($fn);
return;
}
$list = ModuleOperations::get_instance()->GetLoadedModules();
if (is_array($list) && count($list)) {
foreach (array_keys($list) as $modname) {
$fn = $config['root_path'] . "/modules/{$modname}/lib/class.{$classname}.php";
if (file_exists($fn)) {
__cms_load($fn);
return;
}
}
}
// module classes
}
示例15: _parse_template
private static function _parse_template(&$content_obj)
{
$templateops =& cmsms()->GetTemplateOperations();
if ($content_obj->TemplateId() > 0) {
$template = $templateops->LoadTemplateByID($content_obj->TemplateId());
} else {
# should not be needed since CMSms 1.11
$template = $templateops->LoadDefaultTemplate();
$content_obj->SetTemplateId($template->id);
}
$matches = array();
$result = preg_match_all(AC_BLOCK_PATTERN, $template->content, $matches);
if (!$result || !count($matches[1])) {
return;
}
$AC =& ac_utils::get_module('AdvancedContent');
foreach ($matches[1] as $wholetag) {
if (!($contentBlock = self::CreateContentBlock($content_obj, self::GetTagParams($wholetag)))) {
continue;
}
# do not process blocks with same id twice
if (isset(self::$_content_blocks[$content_obj->Id()][$contentBlock->GetProperty('id')])) {
self::$_content_blocks[$content_obj->Id()][$contentBlock->GetProperty('id')]->SetProperty('multiple', true);
continue;
}
self::_register_content_block($content_obj, $contentBlock);
}
}