本文整理汇总了PHP中CParameter::get方法的典型用法代码示例。如果您正苦于以下问题:PHP CParameter::get方法的具体用法?PHP CParameter::get怎么用?PHP CParameter::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CParameter
的用法示例。
在下文中一共展示了CParameter::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getActivityContentHTML
static function getActivityContentHTML($act)
{
// Ok, the activity could be an upload OR a wall comment. In the future, the content should
// indicate which is which
$html = '';
$param = new CParameter($act->params);
$action = $param->get('action', false);
$count = $param->get('count', false);
$config = CFactory::getConfig();
switch ($action) {
case CAdminstreamsAction::TOP_USERS:
$model = CFactory::getModel('user');
$members = $model->getPopularMember($count);
$html = '';
//Get Template Page
$tmpl = new CTemplate();
$html = $tmpl->set('members', $members)->fetch('activity.members.popular');
return $html;
break;
case CAdminstreamsAction::TOP_PHOTOS:
$model = CFactory::getModel('photos');
$photos = $model->getPopularPhotos($count, 0);
$tmpl = new CTemplate();
$html = $tmpl->set('photos', $photos)->fetch('activity.photos.popular');
return $html;
break;
case CAdminstreamsAction::TOP_VIDEOS:
$model = CFactory::getModel('videos');
$videos = $model->getPopularVideos($count);
$tmpl = new CTemplate();
$html = $tmpl->set('videos', $videos)->fetch('activity.videos.popular');
return $html;
break;
}
}
示例2: injectTags
/**
* Inject data from paramter to content tags ({}) .
*
* @param $content Original content with content tags.
* @param $params Text contain all values need to be replaced.
* @param $html Auto detect url tag and insert inline.
* @return $text The content after replacing.
**/
public static function injectTags($content, $paramsTxt, $html = false)
{
$params = new CParameter($paramsTxt);
preg_match_all("/{(.*?)}/", $content, $matches, PREG_SET_ORDER);
if (!empty($matches)) {
foreach ($matches as $val) {
$replaceWith = JString::trim($params->get($val[1], null));
if (!is_null($replaceWith)) {
//if the replacement start with 'index.php', we can CRoute it
if (JString::strpos($replaceWith, 'index.php') === 0) {
$replaceWith = CRoute::getExternalURL($replaceWith);
}
if ($html) {
$replaceUrl = $params->get($val[1] . '_url', null);
if (!is_null($replaceUrl)) {
if ($val[1] == 'stream') {
$replaceUrl .= '#activity-stream-container';
}
//if the replacement start with 'index.php', we can CRoute it
if (JString::strpos($replaceUrl, 'index.php') === 0) {
$replaceUrl = CRoute::getExternalURL($replaceUrl);
}
$replaceWith = '<a href="' . $replaceUrl . '">' . $replaceWith . '</a>';
}
}
$content = CString::str_ireplace($val[0], $replaceWith, $content);
}
}
}
return $content;
}
示例3: onActivityContentDisplay
function onActivityContentDisplay($args)
{
$model =& CFactory::getModel('Wall');
$wall =& JTable::getInstance('Wall', 'CTable');
$my = CFactory::getUser();
if (empty($args->content)) {
return '';
}
$wall->load($args->cid);
CFactory::load('libraries', 'privacy');
CFactory::load('libraries', 'comment');
$comment = CComment::stripCommentData($wall->comment);
$config = CFactory::getConfig();
$commentcut = false;
if (strlen($comment) > $config->getInt('streamcontentlength')) {
$origcomment = $comment;
$comment = JString::substr($comment, 0, $config->getInt('streamcontentlength')) . ' ...';
$commentcut = true;
}
if (CPrivacy::isAccessAllowed($my->id, $args->target, 'user', 'privacyProfileView')) {
CFactory::load('helpers', 'videos');
CFactory::load('libraries', 'videos');
CFactory::load('libraries', 'wall');
$videoContent = '';
$params = new CParameter($args->params);
$videoLink = $params->get('videolink');
$image = $params->get('url');
// For older activities that does not have videoLink , we need to process it the old way.
if (!$videoLink) {
$html = CWallLibrary::_processWallContent($comment);
$tmpl = new CTemplate();
$html = CStringHelper::escape($html);
if ($commentcut) {
//add read more/less link for content
$html .= '<br /><br /><a href="javascript:void(0)" onclick="jQuery(\'#shortcomment_' . $args->cid . '\').hide(); jQuery(\'#origcomment_' . $args->cid . '\').show();" >' . JText::_('COM_COMMUNITY_READ_MORE') . '</a>';
$html = '<div id="shortcomment_' . $args->cid . '">' . $html . '</div>';
$html .= '<div id="origcomment_' . $args->cid . '" style="display:none;">' . $origcomment . '<br /><br /><a href="javascript:void(0);" onclick="jQuery(\'#shortcomment_' . $args->cid . '\').show(); jQuery(\'#origcomment_' . $args->cid . '\').hide();" >' . JText::_('COM_COMMUNITY_READ_LESS') . '</a></div>';
}
$tmpl->set('comment', $html);
$html = $tmpl->fetch('activity.wall.post');
} else {
$html = '<ul class ="cDetailList clrfix">';
$html .= '<li>';
$image = !$image ? rtrim(JURI::root(), '/') . '/components/com_community/assets/playvideo.gif' : $image;
$videoLib = new CVideoLibrary();
$provider = $videoLib->getProvider($videoLink);
$html .= '<!-- avatar --><div class="avatarWrap"><a href="javascript:void(0);" onclick="joms.activities.showVideo(\'' . $args->id . '\');"><img width="64" src="' . $image . '" class="cAvatar"/></a></div><!-- avatar -->';
$videoPlayer = $provider->getViewHTML($provider->getId(), '300', '300');
$comment = CString::str_ireplace($videoLink, '', $comment);
$html .= '<!-- details --><div class="detailWrap alpha">' . $comment . '</div><!-- details -->';
if (!empty($videoPlayer)) {
$html .= '<div style="display: none;clear: both;padding-top: 5px;" class="video-object">' . $videoPlayer . '</div>';
}
$html .= '</li>';
$html .= '</ul>';
}
return $html;
}
}
示例4: getMessage
public function getMessage($field)
{
$params = new CParameter($field['params']);
if ($params->get('min_char') && $params->get('max_char') && !$this->validLength($field['value'])) {
return JText::sprintf('COM_COMMUNITY_FIELD_CONTAIN_OUT_OF_RANGE', $field['name'], $params->get('max_char'), $params->get('min_char'));
}
return JText::sprintf('COM_COMMUNITY_FIELD_CONTAIN_IMPROPER_VALUES', JText::_($field['name']));
}
示例5: getConfiguration
public static function getConfiguration()
{
static $configuration = null;
if (is_null($configuration)) {
$plugin = JPluginHelper::getPlugin('community', 'twitter');
$params = new CParameter($plugin->params);
$my = CFactory::getUser();
$oauth = JTable::getInstance('Oauth', 'CTable');
$loaded = $oauth->load($my->id, 'twitter');
$accesstoken = unserialize($oauth->accesstoken);
$configuration = array('consumer_key' => $params->get('consumerKey', '0rSLnHLm1cpX1sTsqkQaQ'), 'consumer_secret' => $params->get('consumerSecret', 'nsCObKFeJFP9YYGOZoHAHAWfvjZIZ4Hv7M8Y1w1flQ'), 'user_token' => $accesstoken['user_token'], 'user_secret' => $accesstoken['user_secret'], 'curl_ssl_verifypeer' => false);
}
return $configuration;
}
示例6: getActivityContentHTML
public static function getActivityContentHTML($act)
{
// Ok, the activity could be an upload OR a wall comment. In the future, the content should
// indicate which is which
CFactory::load('models', 'photos');
$html = '';
$param = new CParameter($act->params);
$action = $param->get('action', false);
$photoid = $param->get('photoid', 0);
$url = $param->get('url', false);
CFactory::load('helpers', 'albums');
if ($action == 'wall') {
// unfortunately, wall post can also have 'photo' as its $act->apps. If the photo id is availble
// for (newer activity stream, inside the param), we will show the photo snippet as well. Otherwise
// just print out the wall content
// Version 1.6 onwards, $params will contain photoid information
// older version would have #photoid in the $title, since we link it to the photo
$photoid = $param->get('photoid', false);
if ($photoid) {
$photo = JTable::getInstance('Photo', 'CTable');
$photo->load($act->cid);
$helper = new CAlbumsHelper($photo->albumid);
if ($helper->showActivity()) {
$tmpl = new CTemplate();
return $tmpl->set('url', $url)->set('photo', $photo)->set('param', $param)->set('act', $act)->fetch('activity.photos.wall');
}
}
return '';
} elseif ($action == 'upload' && $photoid > 0) {
$photoModel = CFactory::getModel('photos');
$album = JTable::getInstance('Album', 'CTable');
$album->load($act->cid);
$albumsHelper = new CAlbumsHelper($album);
if ($albumsHelper->isPublic()) {
// If content has link to image, we could assume it is "upload photo" action
// since old content add this automatically.
// The $act->cid will be the album id, Retrive the recent photos uploaded
// If $act->activities has data, that means this is an aggregated content
// display some of them
if (empty($act->activities)) {
$acts[] = $act;
} else {
$acts = $act->activities;
}
$tmpl = new CTemplate();
return $tmpl->set('album', $album)->set('acts', $acts)->set('stream', $param->get('stream', false))->fetch('activity.photos.upload');
}
}
return $html;
}
示例7: getFieldHTML
public function getFieldHTML($field, $required)
{
$html = '';
$selectedElement = 0;
$elementSelected = 0;
$elementCnt = 0;
$params = new CParameter($field->params);
$readonly = $params->get('readonly') && !COwnerHelper::isCommunityAdmin() ? ' disabled="disabled"' : '';
for ($i = 0; $i < count($field->options); $i++) {
$option = $field->options[$i];
$selected = $option == $field->value ? ' checked="checked"' : '';
if (empty($selected)) {
$elementSelected++;
}
$elementCnt++;
}
$cnt = 0;
$html .= '<div style="display:inline-block" title="' . CStringHelper::escape(JText::_($field->tips)) . '">';
for ($i = 0; $i < count($field->options); $i++) {
$option = $field->options[$i];
$selected = html_entity_decode($option) == html_entity_decode($field->value) ? ' checked="checked"' : '';
$html .= '<label class="lblradio-block">';
$html .= '<input type="radio" name="field' . $field->id . '" value="' . $option . '"' . $selected . $readonly . ' style="margin: 2px 5px 0 0" />';
$html .= JText::_($option) . '</label>';
}
$html .= '</div>';
return $html;
}
示例8: removeUserTag
public static function removeUserTag($id, $type = 'comment')
{
$my = CFactory::getUser();
$pattern = '/@\\[\\[(' . $my->id . '):([a-z]+):([^\\]]+)\\]\\]/';
if ($type == 'post') {
$activity = CApiActivities::get($id);
$result = $activity->title = preg_replace($pattern, '$3', $activity->title);
$activity->save();
} else {
if ($type == 'inbox') {
$message = JTable::getInstance('Message', 'CTable');
$message->load($id);
$params = new CParameter($message->body);
$result = $params->get('content');
$result = preg_replace($pattern, '$3', $result);
$params->set('content', $result);
$message->body = $params->toString();
$message->store();
} else {
$wall = JTable::getInstance('Wall', 'CTable');
$wall->load($id);
$result = $wall->comment = preg_replace($pattern, '$3', $wall->comment);
$wall->store();
}
}
return $result;
}
示例9: getFieldHTML
public function getFieldHTML($field, $required)
{
$html = '';
$selectedElement = 0;
$required = $field->required == 1 ? ' data-required="true"' : '';
$style = ' style="margin: 0 5px 0 0;' . $this->getStyle() . '" ';
$params = new CParameter($field->params);
$disabled = '';
if ($params->get('readonly') == 1) {
$disabled = 'disabled="disabled"';
}
// Gender contain only male and female
$options = array("" => "COM_COMMUNITY_SELECT_GENDER", "COM_COMMUNITY_MALE" => "COM_COMMUNITY_MALE", "COM_COMMUNITY_FEMALE" => "COM_COMMUNITY_FEMALE");
$cnt = 0;
//CFactory::load( 'helpers' , 'string' );
// REMOVE 3.3
// $class = !empty($field->tips) ? 'jomNameTips tipRight' : '';
// REMOVE 3.3
// $html .= '<div class="' . $class . '" style="display: inline-block;" title="' . CStringHelper::escape(JText::_($field->tips)) . '">';
$html .= '<select class="joms-select" name="field' . $field->id . '" ' . $required . ' ' . $disabled . ' >';
foreach ($options as $key => $val) {
$selected = $key == $field->value ? ' selected="selected" ' : '';
$html .= '<option value="' . $key . '" ' . $selected . '>' . JText::_($val) . '</option>';
}
$html .= '</select>';
// REMOVE 3.3
// $html .= '<span id="errfield' . $field->id . 'msg" style="display: none;"> </span>';
// $html .= '</div>';
return $html;
}
示例10: getFieldHTML
public function getFieldHTML($field, $required)
{
// If maximum is not set, we define it to a default
$field->max = empty($field->max) ? 200 : $field->max;
//get the value in param
$params = new CParameter($field->params);
$style = $this->getStyle() ? '' : ' style="' . $this->getStyle() . '" ';
$class = $field->required == 1 ? ' required' : '';
$class .= $params->get('min_char') != '' && $params->get('max_char') != '' ? ' minmax_' . $params->get('min_char') . '_' . $params->get('max_char') : '';
$class .= !empty($field->tips) ? ' jomNameTips tipRight' : '';
CFactory::load('helpers', 'string');
ob_start();
?>
<input class="inputbox validate-profile-email<?php
echo $class;
?>
" title="<?php
echo CStringHelper::escape(JText::_($field->tips));
?>
" type="text" value="<?php
echo $field->value;
?>
" id="field<?php
echo $field->id;
?>
" name="field<?php
echo $field->id;
?>
" maxlength="<?php
echo $field->max;
?>
" size="40" <?php
echo $style;
?>
/>
<span id="errfield<?php
echo $field->id;
?>
msg" style="display:none;"> </span>
<?php
$html = ob_get_contents();
ob_end_clean();
return $html;
}
示例11: getFieldHTML
public function getFieldHTML($field, $required)
{
$params = new CParameter($field->params);
$readonly = $params->get('readonly') && !COwnerHelper::isCommunityAdmin() ? ' readonly=""' : '';
$style = $this->getStyle() ? ' style="' . $this->getStyle() . '"' : '';
$required = $field->required == 1 ? ' data-required="true"' : '';
// If maximum is not set, we define it to a default
$field->max = empty($field->max) ? 200 : $field->max;
$html = '<input type="text" value="' . $field->value . '" id="field' . $field->id . '" name="field' . $field->id . '" maxlength="' . $field->max . '" class="joms-input" ' . $readonly . $required . $style . ' />';
return $html;
}
示例12: getFieldData
public function getFieldData($field)
{
$value = $field['value'];
if (empty($value)) {
return $value;
}
$params = new CParameter($field['params']);
$format = $params->get('display');
if (!class_exists('CFactory')) {
require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
}
$ret = '';
if ($format == 'age') {
// PHP version > 5.2
$datetime = new DateTime($value);
$now = new DateTime('now');
// PHP version > 5.3
if (method_exists($datetime, 'diff')) {
$interval = $datetime->diff($now);
$ret = $interval->format('%Y');
} else {
$mth = $now->format('m') - $datetime->format('m');
$day = $now->format('d') - $datetime->format('d');
$ret = $now->format('Y') - $datetime->format('Y');
if ($mth >= 0) {
if ($day < 0 && $mth == 0) {
$ret--;
}
} else {
$ret--;
}
}
} else {
require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'models' . DS . 'profile.php';
$model = CFactory::getModel('profile');
//overwrite Profile date format in Configuration
$format = $params->get('date_format');
$ret = $model->formatDate($value, $format);
}
return $ret;
}
示例13: getFieldHTML
public function getFieldHTML($field, $required)
{
$params = new CParameter($field->params);
$readonly = $params->get('readonly') && !COwnerHelper::isCommunityAdmin() ? ' readonly=""' : '';
// REMOVE 3.3
// $style = $this->getStyle() ? ' style="' . $this->getStyle() . '" ' : '';
//extract the max char since the settings is in params
$max_char = $params->get('max_char');
$config = CFactory::getConfig();
// $js = 'assets/validate-1.5.min.js';
// CFactory::attach($js, 'js');
// If maximum is not set, we define it to a default
$required = $field->required == 1 ? ' data-required="true"' : '';
// REMOVE 3.3
// $class .=!empty($field->tips) ? ' jomNameTips tipRight' : '';
$html = '<textarea id="field' . $field->id . '" name="field' . $field->id . '" class="joms-textarea" ' . $readonly . $required . ' >' . $field->value . '</textarea>';
// REMOVE 3.3
// $html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>';
if (!empty($max_char)) {
$html .= '<script type="text/javascript">cvalidate.setMaxLength("#field' . $field->id . '", "' . $max_char . '");</script>';
}
return $html;
}
示例14: getFieldHTML
public function getFieldHTML($field, $required)
{
$lists = array();
//a fix for wrong data input
$field->value = JString::trim($field->value);
if (is_array($field->value)) {
$tmplist = $field->value;
} else {
if (JString::strrpos($field->value, ',') == JString::strlen($field->value) - 1) {
$field->value = JString::substr($field->value, 0, -1);
}
$tmplist = explode(',', $field->value);
}
if ($tmplist) {
foreach ($tmplist as $value) {
$lists[] = JString::trim($value);
}
}
$html = '';
$elementSelected = 0;
$elementCnt = 0;
$cnt = 0;
$params = new CParameter($field->params);
$readonly = '';
if ($params->get('readonly') == 1) {
$readonly = ' disabled="disabled"';
}
$html .= '<div style="display:inline-block">';
if (is_array($field->options)) {
foreach ($field->options as $option) {
if (JString::trim($option) == '') {
//do not display blank options
continue;
}
$selected = in_array(JString::trim($option), $lists) ? ' checked="checked"' : '';
if (empty($selected)) {
$elementSelected++;
}
$html .= '<label class="lblradio-block">';
$html .= '<input type="checkbox" name="field' . $field->id . '[]" value="' . $option . '" class="joms-checkbox" ' . $selected . $readonly . ' style="margin: 2px 5px 0 0" />';
$html .= JText::_($option) . '</label>';
$elementCnt++;
}
}
$html .= '</div>';
return $html;
}
示例15: getFieldHTML
public function getFieldHTML($field, $required)
{
$params = new CParameter($field->params);
$readonly = $params->get('readonly') ? ' readonly=""' : '';
$style = $this->getStyle() ? '' : ' style="' . $this->getStyle() . '" ';
// If maximum is not set, we define it to a default
$field->max = empty($field->max) ? 200 : $field->max;
CFactory::load('helpers', 'string');
$class = $field->required == 1 ? ' required' : '';
$class .= !empty($field->tips) ? ' jomNameTips tipRight' : '';
$tooltipcss = "";
if (!empty($field->tips)) {
$tooltipcss = "jomNameTips";
}
$html = '<input title="' . CStringHelper::escape(JText::_($field->tips)) . '" type="text" value="' . $field->value . '" id="field' . $field->id . '" name="field' . $field->id . '" maxlength="' . $field->max . '" size="40" class="' . $tooltipcss . ' tipRight inputbox' . $class . '" ' . $style . $readonly . ' />';
$html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>';
return $html;
}