本文整理汇总了PHP中CString::str_ireplace方法的典型用法代码示例。如果您正苦于以下问题:PHP CString::str_ireplace方法的具体用法?PHP CString::str_ireplace怎么用?PHP CString::str_ireplace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CString
的用法示例。
在下文中一共展示了CString::str_ireplace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: setImage
public function setImage($path, $type = 'thumb')
{
CError::assert($path, '', '!empty', __FILE__, __LINE__);
$db = $this->getDBO();
// Fix the back quotes
$path = CString::str_ireplace('\\', '/', $path);
$type = JString::strtolower($type);
// Test if the record exists.
$oldFile = $this->{$type};
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
if ($oldFile) {
// File exists, try to remove old files first.
$oldFile = CString::str_ireplace('/', '/', $oldFile);
// If old file is default_thumb or default, we should not remove it.
//
// Need proper way to test it
if (!JString::stristr($oldFile, 'group.jpg') && !JString::stristr($oldFile, 'group_thumb.jpg') && !JString::stristr($oldFile, 'default.jpg') && !JString::stristr($oldFile, 'default_thumb.jpg')) {
jimport('joomla.filesystem.file');
JFile::delete($oldFile);
}
}
$this->{$type} = $path;
$this->store();
}
示例3: getItems
/**
* Retrieve menu items in JomSocial's toolbar
*
* @access public
* @param
*
* @return Array An array of #__menu objects.
**/
public function getItems()
{
$config = CFactory::getConfig();
$db = JFactory::getDBO();
$menus = array();
// For menu access
$my = CFactory::getUser();
//joomla 1.6
$menutitlecol = !C_JOOMLA_15 ? 'title' : 'name';
$query = 'SELECT a.' . $db->nameQuote('id') . ', a.' . $db->nameQuote('link') . ', a.' . $menutitlecol . ' as name, a.' . $db->nameQuote(TABLE_MENU_PARENTID) . ', false as script ' . ' FROM ' . $db->nameQuote('#__menu') . ' AS a ' . ' LEFT JOIN ' . $db->nameQuote('#__menu') . ' AS b ' . ' ON b.' . $db->nameQuote('id') . '=a.' . $db->nameQuote(TABLE_MENU_PARENTID) . ' AND b.' . $db->nameQuote('published') . '=' . $db->Quote(1) . ' ' . ' WHERE a.' . $db->nameQuote('published') . '=' . $db->Quote(1) . ' ' . ' AND a.' . $db->nameQuote('menutype') . '=' . $db->Quote($config->get('toolbar_menutype'));
if ($my->id == 0) {
$query .= ' AND a.' . $db->nameQuote('access') . '=' . $db->Quote(0);
}
CFactory::load('helpers', 'owner');
if ($my->id > 0 && !COwnerHelper::isCommunityAdmin()) {
// $query .= ' AND a.' . $db->nameQuote( 'access' ) . '>=' . $db->Quote( 0 ) . ' AND a.' . $db->nameQuote( 'access' ) . '<' . $db->Quote( 2 );
//we haven't supported access level setting for toolbar menu yet.
$query .= ' AND a.' . $db->nameQuote('access') . '>=' . $db->Quote(0);
}
if (COwnerHelper::isCommunityAdmin()) {
$query .= ' AND a.' . $db->nameQuote('access') . '>=' . $db->Quote(0);
}
$ordering_field = TABLE_MENU_ORDERING_FIELD;
$query .= ' ORDER BY a.' . $db->nameQuote($ordering_field);
$db->setQuery($query);
$result = $db->loadObjectList();
// remove disabled apps base on &view=value in result's link
$this->cleanMenus($result);
//avoid multiple count execution
$parentColumn = TABLE_MENU_PARENTID;
$menus = array();
foreach ($result as $i => $row) {
//get top main links on toolbar
//add Itemid if not our components and dont add item id for external link
$row->link = CString::str_ireplace('https://', 'http://', $row->link);
if (strpos($row->link, 'com_community') == false && strpos($row->link, 'http://') === false) {
$row->link .= "&Itemid=" . $row->id;
}
if ($row->{$parentColumn} == MENU_PARENT_ID) {
$obj = new stdClass();
$obj->item = $row;
$obj->item->script = false;
$obj->childs = null;
$menus[$row->id] = $obj;
}
}
// Retrieve child menus from the original result.
// Since we reduce the number of sql queries, we need to use php to split the menu's out
// accordingly.
foreach ($result as $i => $row) {
if ($row->{$parentColumn} != MENU_PARENT_ID && isset($menus[$row->{$parentColumn}])) {
if (!is_array($menus[$row->{$parentColumn}]->childs)) {
$menus[$row->{$parentColumn}]->childs = array();
}
$menus[$row->{$parentColumn}]->childs[] = $row;
}
}
return $menus;
}
示例4: 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;
}
}
示例5: profile
/**
* Displays the viewing profile page.
*
* @access public
* @param array An associative array to display the fields
*/
public function profile(&$data)
{
$mainframe = JFactory::getApplication();
$friendsModel = CFactory::getModel('friends');
$showfriends = JRequest::getVar('showfriends', false);
$userid = JRequest::getVar('userid', '');
$user = CFactory::getUser($userid);
$linkUrl = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
$document = JFactory::getDocument();
$document->setTitle(JText::sprintf('COM_COMMUNITY_USERS_FEED_TITLE', $user->getDisplayName()));
$document->setDescription(JText::sprintf('COM_COMMUNITY_USERS_FEED_DESCRIPTION', $user->getDisplayName(), $user->lastvisitDate));
$document->setLink($linkUrl);
include_once JPATH_COMPONENT . '/libraries/activities.php';
$act = new CActivityStream();
$friendIds = $friendsModel->getFriendIds($user->id);
$friendIds = $showfriends ? $friendIds : null;
$rows = $act->getFEED($user->id, $friendIds, null, $mainframe->getCfg('feed_limit'));
// add the avatar image
$rssImage = new JFeedImage();
$rssImage->url = $user->getThumbAvatar();
$rssImage->link = $linkUrl;
$rssImage->width = 64;
$rssImage->height = 64;
$document->image = $rssImage;
//CFactory::load( 'helpers' , 'string' );
//CFactory::load( 'helpers' , 'time' );
foreach ($rows->data as $row) {
if ($row->type != 'title') {
// Get activities link
$pattern = '/<a href=\\"(.*?)\\"/';
preg_match_all($pattern, $row->title, $matches);
// Use activity owner link when activity link is not available
if (!empty($matches[1][1])) {
$linkUrl = $matches[1][1];
} else {
if (!empty($matches[1][0])) {
$linkUrl = $matches[1][0];
}
}
// load individual item creator class
$item = new JFeedItem();
$item->title = $row->title;
$item->link = $linkUrl;
$item->description = "<img src=\"{$row->favicon}\" alt=\"\" /> " . $row->title;
$item->date = CTimeHelper::getDate($row->createdDateRaw)->toRFC822();
$item->category = '';
//$row->category;
$item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
// Make sure url is absolute
$pattern = '/href="(.*?)index.php/';
$replace = 'href="' . JURI::base() . 'index.php';
$string = $item->description;
$item->description = preg_replace($pattern, $replace, $string);
// loads item info into rss array
$document->addItem($item);
}
}
}
示例6: add
/**
* Add sharing sites into bookmarks
* @params string $providerName Pass the provider name to be displayed
* @params string $imageURL Image that needs to be displayed beside the provider
* @params string $apiURL Api URL that JomSocial should link to
**/
public function add($providerName, $className, $apiURL)
{
$apiURL = CString::str_ireplace('{uri}', $this->currentURI, $apiURL);
$obj = new stdClass();
$obj->name = $providerName;
$obj->className = $className;
$obj->link = $apiURL;
$this->_bookmarks[JString::strtolower($providerName)] = $obj;
}
示例7: display
/**
* The default method that will display the output of this view which is called by
* Joomla
*
* @param string template Template file name
**/
public function display($tpl = null)
{
$document = JFactory::getDocument();
$params = $this->get('Params');
//user's email privacy setting
//CFactory::load( 'libraries' , 'notificationtypes' );
$notificationTypes = new CNotificationTypes();
$lists = array();
for ($i = 1; $i <= 31; $i++) {
$qscale[] = JHTML::_('select.option', $i, $i);
}
$lists['qscale'] = JHTML::_('select.genericlist', $qscale, 'qscale', 'class="inputbox" size="1"', 'value', 'text', $params->get('qscale', '11'));
$videosSize = array(JHTML::_('select.option', '320x240', '320x240 (QVGA 4:3)'), JHTML::_('select.option', '400x240', '400x240 (WQVGA 5:3)'), JHTML::_('select.option', '400x300', '400x300 (Quarter SVGA 4:3)'), JHTML::_('select.option', '480x272', '480x272 (Sony PSP 30:17)'), JHTML::_('select.option', '480x320', '480x320 (iPhone 3:2)'), JHTML::_('select.option', '480x360', '480x360 (4:3)'), JHTML::_('select.option', '512x384', '512x384 (4:3)'), JHTML::_('select.option', '600x480', '600x480 (4:3)'), JHTML::_('select.option', '640x360', '640x360 (16:9)'), JHTML::_('select.option', '640x480', '640x480 (VCA 4:3)'), JHTML::_('select.option', '800x600', '800x600 (SVGA 4:3)'));
$lists['videosSize'] = JHTML::_('select.genericlist', $videosSize, 'videosSize', 'class="inputbox" size="1"', 'value', 'text', $params->get('videosSize'));
$imgQuality = array(JHTML::_('select.option', '60', 'Low'), JHTML::_('select.option', '80', 'Medium'), JHTML::_('select.option', '90', 'High'), JHTML::_('select.option', '95', 'Very High'));
$lists['imgQuality'] = JHTML::_('select.genericlist', $imgQuality, 'output_image_quality', 'class="inputbox" size="1"', 'value', 'text', $params->get('output_image_quality'));
//album mode
$albumMode = array(JHTML::_('select.option', '0', JText::_('COM_COMMUNITY_SAME_WINDOW')), JHTML::_('select.option', '1', JText::_('COM_COMMUNITY_MODAL_WINDOW')));
$lists['albumMode'] = JHTML::_('select.genericlist', $albumMode, 'album_mode', 'class="inputbox" size="1"', 'value', 'text', $params->get('album_mode'));
//video mode
$videoMode = array(JHTML::_('select.option', '0', JText::_('COM_COMMUNITY_SAME_WINDOW')), JHTML::_('select.option', '1', JText::_('COM_COMMUNITY_MODAL_WINDOW')));
$lists['videoMode'] = JHTML::_('select.genericlist', $videoMode, 'video_mode', 'class="inputbox" size="1"', 'value', 'text', $params->get('video_mode'));
//video native
$videoNative = array(JHTML::_('select.option', '0', JText::_('COM_COMMUNITY_STREAM_VIDEO_PLAYER_MEDIAELEMENT')), JHTML::_('select.option', '1', JText::_('COM_COMMUNITY_STREAM_VIDEO_PLAYER_NATIVE')));
$lists['videoNative'] = JHTML::_('select.genericlist', $videoNative, 'video_native', 'class="inputbox" size="1"', 'value', 'text', $params->get('video_native'));
// Group discussion order option
$groupDiscussionOrder = array(JHTML::_('select.option', 'ASC', 'Older first'), JHTML::_('select.option', 'DESC', 'Newer first'));
$lists['groupDicussOrder'] = JHTML::_('select.genericlist', $groupDiscussionOrder, 'group_discuss_order', 'class="inputbox" size="1"', 'value', 'text', $params->get('group_discuss_order'));
$videoThumbSize = array(JHTML::_('select.option', '320x180', '320x180'), JHTML::_('select.option', '640x360', '640x360'), JHTML::_('select.option', '1280x720', '1280x720'));
$lists['videoThumbSize'] = JHTML::_('select.genericlist', $videoThumbSize, 'videosThumbSize', 'class="inputbox" size="1"', 'value', 'text', $params->get('videosThumbSize'));
$dstOffset = array();
$counter = -4;
for ($i = 0; $i <= 8; $i++) {
$dstOffset[] = JHTML::_('select.option', $counter, $counter);
$counter++;
}
$watermarkPosition = array(JHTML::_('select.option', 'left_top', JText::_('COM_COMMUNITY_CONFIGURATION_PHOTOS_WATERMARK_POSITION_LFFT_TOP')), JHTML::_('select.option', 'left_bottom', JText::_('COM_COMMUNITY_CONFIGURATION_PHOTOS_WATERMARK_POSITION_LFFT_BOTTOM')), JHTML::_('select.option', 'right_top', JText::_('COM_COMMUNITY_CONFIGURATION_PHOTOS_WATERMARK_POSITION_RIGHT_TOP')), JHTML::_('select.option', 'right_bottom', JText::_('COM_COMMUNITY_CONFIGURATION_PHOTOS_WATERMARK_POSITION_RIGHT_BOTTOM')));
$lists['watermarkPosition'] = JHTML::_('select.genericlist', $watermarkPosition, 'watermark_position', 'class="inputbox" size="1"', 'value', 'text', $params->get('watermark_position'));
$lists['dstOffset'] = JHTML::_('select.genericlist', $dstOffset, 'daylightsavingoffset', 'class="inputbox" size="1"', 'value', 'text', $params->get('daylightsavingoffset'));
$networkModel = $this->getModel('network', false);
$JSNInfo = $networkModel->getJSNInfo();
$JSON_output = $networkModel->getJSON();
$lists['enable'] = JHTML::_('select.booleanlist', 'network_enable', 'class="inputbox"', $JSNInfo['network_enable']);
$uploadLimit = ini_get('upload_max_filesize');
$uploadLimit = CString::str_ireplace('M', ' MB', $uploadLimit);
require_once JPATH_ROOT . '/administrator/components/com_community/libraries/autoupdate.php';
$isuptodate = CAutoUpdate::checkUpdate();
$this->assign('JSNInfo', $JSNInfo);
$this->assign('JSON_output', $JSON_output);
$this->assign('lists', $lists);
$this->assign('uploadLimit', $uploadLimit);
$this->assign('config', $params);
$this->assign('isuptodate', $isuptodate);
$this->assign('notificationTypes', $notificationTypes);
parent::display($tpl);
}
示例8: friends
public function friends($data = null)
{
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$document = JFactory::getDocument();
$id = JRequest::getCmd('userid', 0);
$sorted = $jinput->get->get('sort', 'latest', 'STRING');
//JRequest::getVar( 'sort' , 'latest' , 'GET' );
$filter = JRequest::getWord('filter', 'all', 'GET');
$isMine = $id == $my->id && $my->id != 0;
$my = CFactory::getUser();
$id = $id == 0 ? $my->id : $id;
$user = CFactory::getUser($id);
$friends = CFactory::getModel('friends');
$blockModel = CFactory::getModel('block');
$document->setLink(CRoute::_('index.php?option=com_community'));
$rows = $friends->getFriends($id, $sorted, true, $filter);
// Hide submenu if we are viewing other's friends
if ($isMine) {
$document->setTitle(JText::_('COM_COMMUNITY_FRIENDS_MY_FRIENDS'));
} else {
$document->setTitle(JText::sprintf('COM_COMMUNITY_FRIENDS_ALL_FRIENDS', $user->getDisplayName()));
}
$sortItems = array('latest' => JText::_('COM_COMMUNITY_SORT_RECENT_FRIENDS'), 'online' => JText::_('COM_COMMUNITY_ONLINE'));
$resultRows = array();
// @todo: preload all friends
foreach ($rows as $row) {
$user = CFactory::getUser($row->id);
$obj = clone $row;
$obj->friendsCount = $user->getFriendCount();
$obj->profileLink = CUrlHelper::userLink($row->id);
$obj->isFriend = true;
$obj->isBlocked = $blockModel->getBlockStatus($user->id, $my->id);
$resultRows[] = $obj;
}
unset($rows);
foreach ($resultRows as $row) {
if (!$row->isBlocked) {
// load individual item creator class
$item = new JFeedItem();
$item->title = strip_tags($row->name);
$item->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->id);
$item->description = '<img src="' . JURI::base() . $row->_thumb . '" alt="" /> ' . $row->_status;
$item->date = $row->lastvisitDate;
$item->category = '';
//$row->category;
$item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
// Make sure url is absolute
$item->description = CString::str_ireplace('href="/', 'href="' . JURI::base(), $item->description);
// loads item info into rss array
$document->addItem($item);
}
}
}
示例9: display
/**
* The default method that will display the output of this view which is called by
* Joomla
*
* @param string template Template file name
**/
public function display($tpl = null)
{
//Load pane behavior
jimport('joomla.html.pane');
$pane =& JPane::getInstance('sliders');
$document =& JFactory::getDocument();
// Load tooltips
JHTML::_('behavior.tooltip', '.hasTip');
$params = $this->get('Params');
//user's email privacy setting
CFactory::load('libraries', 'emailtypes');
$emailtypes = new CEmailTypes();
// Add submenu
$contents = '';
ob_start();
require_once JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_community' . DS . 'views' . DS . 'configuration' . DS . 'tmpl' . DS . 'navigation.php';
$contents = ob_get_contents();
ob_end_clean();
$document =& JFactory::getDocument();
$document->setBuffer($contents, 'modules', 'submenu');
$lists = array();
for ($i = 1; $i <= 31; $i++) {
$qscale[] = JHTML::_('select.option', $i, $i);
}
$lists['qscale'] = JHTML::_('select.genericlist', $qscale, 'qscale', 'class="inputbox" size="1"', 'value', 'text', $params->get('qscale', '11'));
$videosSize = array(JHTML::_('select.option', '320x240', '320x240 (QVGA 4:3)'), JHTML::_('select.option', '400x240', '400x240 (WQVGA 5:3)'), JHTML::_('select.option', '400x300', '400x300 (Quarter SVGA 4:3)'), JHTML::_('select.option', '480x272', '480x272 (Sony PSP 30:17)'), JHTML::_('select.option', '480x320', '480x320 (iPhone 3:2)'), JHTML::_('select.option', '480x360', '480x360 (4:3)'), JHTML::_('select.option', '512x384', '512x384 (4:3)'), JHTML::_('select.option', '600x480', '600x480 (4:3)'), JHTML::_('select.option', '640x360', '640x360 (16:9)'), JHTML::_('select.option', '640x480', '640x480 (VCA 4:3)'), JHTML::_('select.option', '800x600', '800x600 (SVGA 4:3)'));
$lists['videosSize'] = JHTML::_('select.genericlist', $videosSize, 'videosSize', 'class="inputbox" size="1"', 'value', 'text', $params->get('videosSize'));
$imgQuality = array(JHTML::_('select.option', '60', 'Low'), JHTML::_('select.option', '80', 'Medium'), JHTML::_('select.option', '90', 'High'), JHTML::_('select.option', '95', 'Very High'));
$lists['imgQuality'] = JHTML::_('select.genericlist', $imgQuality, 'output_image_quality', 'class="inputbox" size="1"', 'value', 'text', $params->get('output_image_quality'));
// Group discussion order option
$groupDiscussionOrder = array(JHTML::_('select.option', 'ASC', 'Older first'), JHTML::_('select.option', 'DESC', 'Newer first'));
$lists['groupDicussOrder'] = JHTML::_('select.genericlist', $groupDiscussionOrder, 'group_discuss_order', 'class="inputbox" size="1"', 'value', 'text', $params->get('group_discuss_order'));
$dstOffset = array();
$counter = -4;
for ($i = 0; $i <= 8; $i++) {
$dstOffset[] = JHTML::_('select.option', $counter, $counter);
$counter++;
}
$lists['dstOffset'] = JHTML::_('select.genericlist', $dstOffset, 'daylightsavingoffset', 'class="inputbox" size="1"', 'value', 'text', $params->get('daylightsavingoffset'));
$networkModel = $this->getModel('network', false);
$JSNInfo =& $networkModel->getJSNInfo();
$JSON_output =& $networkModel->getJSON();
$lists['enable'] = JHTML::_('select.booleanlist', 'network_enable', 'class="inputbox"', $JSNInfo['network_enable']);
$uploadLimit = ini_get('upload_max_filesize');
$uploadLimit = CString::str_ireplace('M', ' MB', $uploadLimit);
$this->assignRef('JSNInfo', $JSNInfo);
$this->assignRef('JSON_output', $JSON_output);
$this->assignRef('lists', $lists);
$this->assign('uploadLimit', $uploadLimit);
$this->assign('config', $params);
$this->assign('emailtypes', $emailtypes->getEmailTypes());
parent::display($tpl);
}
示例10: getDuration
public function getDuration()
{
$duration = '';
//Get duration
$pattern = "'<span class=gray id=video-duration>(.*?)</span>'s";
preg_match_all($pattern, $this->xmlContent, $matches);
if ($matches) {
$duration = explode(":", CString::str_ireplace(" ", "", trim(strip_tags($matches[1][0]))));
$duration = $duration[0] * 60 + $duration[1];
}
return $duration;
}
示例11: getDescription
public function getDescription()
{
$description = '';
// Store description
$pattern = "'<blip\\:puredescription>(.*?)<\\/blip\\:puredescription>'s";
preg_match_all($pattern, $this->xmlContent, $matches);
if ($matches) {
$description = CString::str_ireplace(''', "'", $matches[1][0]);
$description = CString::str_ireplace('<![CDATA[', '', $description);
$description = CString::str_ireplace(']]>', '', $description);
}
return $description;
}
示例12: submitToJomsocial
public function submitToJomsocial()
{
require_once JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_community' . DS . 'models' . DS . 'network.php';
$model = new CommunityModelNetwork();
$network =& $model->getJSNInfo();
// to run or not to run?
if (empty($network['network_enable'])) {
return;
}
if ($network['network_cron_freq']) {
$time_diff = time() - $network['network_cron_last_run'];
$cron_freq = $network['network_cron_freq'] * 60 * 60;
// 1 hour
if ($time_diff < $cron_freq) {
return;
}
}
// prepare data
foreach ($network as $key => $value) {
$token = JUtility::getToken();
$keys = array('network_site_name', 'network_description', 'network_keywords', 'network_language', 'network_member_count', 'network_group_count', 'network_site_url', 'network_join_url', 'network_logo_url');
if (in_array($key, $keys)) {
$key = CString::str_ireplace('network_', '', $key);
$input_filtered[$key] = $value;
}
}
if (!defined('SERVICES_JSON_SLICE')) {
include_once AZRUL_SYSTEM_PATH . '/pc_includes/JSON.php';
}
$json = new Services_JSON();
$json_output = $json->encode($input_filtered);
// post data
$post_data = array();
$post_data['jsonText'] = $json_output;
$config = CFactory::getConfig();
$post_url = $config->get('jsnetwork_path');
CFactory::load('helpers', 'remote');
$test = CRemoteHelper::post($post_url, $post_data);
// save
$network['network_cron_last_run'] = time();
$token = JUtility::getToken();
$network[$token] = 1;
// set post data
foreach ($network as $key => $value) {
JRequest::setVar($key, $value, 'POST');
}
$model->save();
}
示例13: _getGoogleAdsHTML
public static function _getGoogleAdsHTML($googleCode, $userId)
{
ob_start();
?>
<div id="community-mygoodleads-wrap">
<?php
$gCode = html_entity_decode($googleCode);
$gCode = CString::str_ireplace("<br />", "\n", $gCode);
$gCode = preg_replace('/eval\\((.*)\\)/', '', $gCode);
?>
<?php
echo "{$gCode}\n";
?>
</div>
<?php
$contents = ob_get_contents();
ob_end_clean();
return $contents;
}
示例14: add
/**
* Add new notification
*/
public function add($from, $to, $title, $content, $privacy = COMMUNITY_PRIVACY_PUBLIC)
{
jimport('joomla.utilities.date');
$db =& $this->getDBO();
$date =& JFactory::getDate();
$obj = new stdClass();
$obj->actor = $from;
$obj->target = $to;
$obj->title = $title;
$obj->content = $content;
$obj->created = $date->toMySQL();
$userFrom =& JFactory::getUser($from);
$userTo =& JFactory::getUser($to);
// Porcess the message and title
$search = array('{actor}', '{target}');
$replace = array($userFrom->name, $userTo->name);
$title = CString::str_ireplace($search, $replace, $title);
$content = CString::str_ireplace($search, $replace, $content);
return $this;
}
示例15: display
public function display($data = null)
{
$mainframe = JFactory::getApplication();
$document = JFactory::getDocument();
$model = CFactory::getModel('search');
$members = $model->getPeople();
// Prepare feeds
// $document->setTitle($title);
foreach ($members as $member) {
$user = CFactory::getUser($member->id);
$friendCount = JText::sprintf(CStringHelper::isPlural($user->getFriendCount()) ? 'COM_COMMUNITY_FRIENDS_COUNT_MANY' : 'COM_COMMUNITY_FRIENDS_COUNT', $user->getFriendCount());
$item = new JFeedItem();
$item->title = $user->getDisplayName();
$item->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
$item->description = '<img src="' . $user->getThumbAvatar() . '" alt="" /> ' . $friendCount;
$item->date = '';
$item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
// Make sure url is absolute
$item->description = CString::str_ireplace('href="/', 'href="' . JURI::base(), $item->description);
$document->addItem($item);
}
}