本文整理汇总了PHP中EBR::getItemId方法的典型用法代码示例。如果您正苦于以下问题:PHP EBR::getItemId方法的具体用法?PHP EBR::getItemId怎么用?PHP EBR::getItemId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EBR
的用法示例。
在下文中一共展示了EBR::getItemId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUnsubscribeLink
/**
* Generates the unsubscribe link for the email
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function getUnsubscribeLink($data, $external = false)
{
$itemId = EBR::getItemId('latest');
// Generate the unsubscribe hash
$hash = base64_encode(json_encode($data->export()));
$link = EBR::getRoutedURL('index.php?option=com_easyblog&task=subscription.unsubscribe&data=' . $hash . '&Itemid=' . $itemId, false, $external);
return $link;
}
示例2: EasyBlogBuildRoute
//.........这里部分代码省略.........
}
if (isset($query['search'])) {
$segments[] = $query['search'];
}
unset($query['view']);
unset($query['id']);
unset($query['layout']);
}
// index.php?option=com_easyblog&view=dashboard&layout=xxx
if (isset($query['view']) && $query['view'] == 'dashboard') {
$segments[] = EBR::translate($query['view']);
if (isset($query['layout'])) {
$segments[] = EBR::translate($query['layout']);
}
if (isset($query['filter'])) {
$segments[] = $query['filter'];
unset($query['filter']);
}
if (isset($query['blogid'])) {
$segments[] = $query['blogid'];
unset($query['blogid']);
}
if (isset($query['postType'])) {
$segments[] = $query['postType'];
unset($query['postType']);
}
unset($query['view']);
unset($query['layout']);
}
// index.php?option=com_easyblog&view=archive
if (isset($query['view']) && $query['view'] == 'archive') {
$segments[] = EBR::translate($query['view']);
unset($query['view']);
if (isset($query['layout'])) {
$segments[] = $query['layout'];
unset($query['layout']);
}
if (isset($query['archiveyear'])) {
$segments[] = $query['archiveyear'];
unset($query['archiveyear']);
}
if (isset($query['archivemonth'])) {
$segments[] = $query['archivemonth'];
unset($query['archivemonth']);
}
if (isset($query['archiveday'])) {
$segments[] = $query['archiveday'];
unset($query['archiveday']);
}
}
// index.php?option=com_easyblog&view=calendar
if (isset($query['view']) && $query['view'] == 'calendar') {
$segments[] = EBR::translate($query['view']);
unset($query['view']);
if (isset($query['year'])) {
$segments[] = $query['year'];
unset($query['year']);
}
if (isset($query['month'])) {
$segments[] = $query['month'];
unset($query['month']);
}
if (isset($query['day'])) {
$segments[] = $query['day'];
unset($query['day']);
}
}
// index.php?option=com_easyblog&view=search
if (isset($query['view']) && $query['view'] == 'search') {
$segments[] = EBR::translate($query['view']);
unset($query['view']);
if (isset($query['layout'])) {
$segments[] = $query['layout'];
unset($query['layout']);
}
if (isset($query['query'])) {
$segments[] = $query['query'];
unset($query['query']);
}
}
// // index.php?option=com_easyblog&view=composer
// if (isset($query['view']) && $query['view'] == 'composer') {
// dump('here');
// }
// index.php?option=com_easyblog&view=login
if (isset($query['view']) && $query['view'] == 'login') {
$segments[] = EBR::translate($query['view']);
unset($query['view']);
}
if (isset($query['type'])) {
if (!isset($query['format']) && !isset($query['controller'])) {
$segments[] = $query['type'];
unset($query['type']);
}
}
if (!isset($query['Itemid'])) {
$query['Itemid'] = EBR::getItemId();
}
return $segments;
}
示例3: onAfterEasyBlogSave
public function onAfterEasyBlogSave($post, $isNew)
{
if (!$this->exists()) {
return;
}
if (!$post->isPublished()) {
return;
}
$db = EasyBlogHelper::db();
$user = JFactory::getUser();
// Get plugin info
$plugin = JPluginHelper::getPlugin('easyblog', 'autoarticle');
$pluginParams = EB::registry($plugin->params);
// easyblog blog details
$data = array();
$data['title'] = $post->title;
$data['alias'] = $post->permalink;
// if (empty($post->intro)) {
// $data['introtext'] = $post->content;
// $data['fulltext'] = '';
// } else {
// $data['introtext'] = $post->intro;
// $data['fulltext'] = $post->content;
// }
$data['introtext'] = $post->getContent('entry');
$data['fulltext'] = '';
$EasyBlogitemId = EBR::getItemId('latest');
$readmoreURL = EBR::_('index.php?option=com_easyblog&view=entry&id=' . $post->id . '&Itemid=' . $EasyBlogitemId);
$readmoreURL = str_replace('/administrator/', '/', $readmoreURL);
$readmoreLink = '<a href="' . $readmoreURL . '" class="readon"><span>' . JText::_('Read More') . '</span></a>';
$data['introtext'] = $data['introtext'] . '<br />' . $readmoreLink;
$data['created'] = $post->created;
$data['created_by'] = $post->created_by;
$data['modified'] = $post->modified;
$data['modified_by'] = $user->id;
$data['publish_up'] = $post->publish_up;
$data['publish_down'] = $post->publish_down;
//these four get from plugin params
$state = $pluginParams->get('status');
$access = 1;
if ($pluginParams->get('access', '-1') == '-1') {
$access = $post->access ? 2 : 1;
} else {
$tmpAccess = $pluginParams->get('access');
switch ($tmpAccess) {
case '1':
$access = '2';
break;
case '2':
$access = '3';
break;
case '0':
default:
$access = '1';
break;
}
}
$section = '0';
$category = $pluginParams->get('sectionCategory', '0');
$frontpage = $pluginParams->get('frontpage', '-1') == '-1' ? $post->frontpage : $pluginParams->get('frontpage', '0');
$autoMapCategory = $pluginParams->get('autocategory', '0');
if ($autoMapCategory) {
$autoMapped = self::mapCategory($post->category_id);
if (!empty($autoMapped->cid)) {
$category = $autoMapped->cid;
}
}
$data['state'] = $state;
$data['access'] = $access;
$data['sectionid'] = $section;
$data['catid'] = $category;
$data['metakey'] = JRequest::getVar('keywords', '');
$data['metadesc'] = JRequest::getVar('description', '');
$contentMap = EB::table('AutoArticleMap');
$joomlaContent = JTable::getInstance('content');
$aid = '';
// try to get the existing content id via the mapping table
$contentMap->load($post->id, true);
if (!empty($contentMap->content_id)) {
$aid = $contentMap->content_id;
}
if (empty($aid) && !empty($post->permalink)) {
//try to get if the article already inserted before based on title alias.
$query = 'SELECT `id` FROM `#__content` WHERE `alias` = ' . $db->Quote($post->permalink);
$db->setQuery($query);
$aid = $db->loadResult();
}
if (!empty($aid)) {
$joomlaContent->load($aid);
}
$joomlaContent->bind($data);
// Convert the params field to an array.
$registry = new JRegistry();
$joomlaContent->attribs = $registry->toArray();
$joomlaContent->store();
$articleId = $joomlaContent->id;
if (is_null($isNew)) {
// something wrong here. test the aid to determine.
if (empty($aid)) {
$isNew = true;
//.........这里部分代码省略.........
示例4:
</li>
<li>
<a href="<?php
echo EBR::_('index.php?option=com_easyblog&view=dashboard&layout=entries&Itemid=' . EBR::getItemId('dashboard'));
?>
">
<i class="ies-newspaper ies-small"></i>
<span><?php
echo JText::_('MOD_EASYSOCIAL_MENU_EASYBLOG_POSTS');
?>
</span>
</a>
</li>
<li>
<a href="<?php
echo EBR::_('index.php?option=com_easyblog&view=dashboard&layout=drafts&Itemid=' . EBR::getItemId('dashboard'));
?>
">
<i class="ies-upload-5 ies-small"></i>
<span><?php
echo JText::_('MOD_EASYSOCIAL_MENU_EASYBLOG_DRAFTS');
?>
</span>
</a>
</li>
<?php
}
?>
<?php
}
?>
示例5: insertActivity
/**
* Inserts activity stream for JomSocial
*
* @since 5.0
* @access public
* @param EasyBlogTableBlog
* @return
*/
public function insertActivity(EasyBlogPost $post, $command = '', $content = '')
{
// Determine which command to use for this stream
if (empty($command)) {
$command = $post->isNew() ? 'easyblog.blog.add' : 'easyblog.blog.update';
}
// Check if Jomsocial exists
if (!$this->exists()) {
return false;
}
// If this is a feed source and the settings doesn't allow this, skip this
if ($command == 'easyblog.blog.add' && $post->isNew() && $post->isFromFeed() && !$this->config->get('integrations_jomsocial_rss_import_activity')) {
return false;
}
// Ensure that the configuration allows user to publish new feed
if ($command == 'easyblog.blog.add' && $post->isNew() && !$this->config->get('integrations_jomsocial_blog_new_activity')) {
return false;
}
// Ensure that the configuration allows user to publish new feed when blog is updated
if ($command == 'easyblog.blog.update' && !$post->isNew() && !$this->config->get('integrations_jomsocial_blog_update_activity')) {
return false;
}
// Determine the post title
$title = $this->getPostTitle($post);
// Get the category the post is associated to
$category = $post->getPrimaryCategory();
$categoryLink = $category->getExternalPermalink();
// Get the permalink of the blog post
$permalink = $post->getExternalPermalink();
// If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls.
if ($this->app->isAdmin() && EB::router()->isSh404Enabled()) {
$itemId = EBR::getItemId('latest');
$itemId = '&Itemid=' . $itemId;
$permalink = rtrim(JURI::root(), '/') . '/index.php?option=com_easyblog&view=entry&id=' . $post->id . $itemId;
$categoryLink = rtrim(JURI::root(), '/') . '/index.php?option=com_easyblog&view=categories&layout=listings&id=' . $category->id . $itemId;
}
// If there is no content provided, we assume that the user wants to use the blog post
if (!$content) {
$content = $this->prepareBlogContent($post, $permalink);
}
// Prepare the title of the post
$streamTitle = JText::sprintf('COM_EASYBLOG_JS_ACTIVITY_BLOG_ADDED_NON_CATEGORY', $permalink, $title);
// If this is not a new post, we need to use a different title
if (!$post->isNew() && $command == 'easyblog.blog.update') {
$streamTitle = JText::sprintf('COM_EASYBLOG_JS_ACTIVITY_BLOG_UPDATED_NON_CATEGORY', $permalink, $title);
}
// Determines which stream title to use
if ($this->config->get('integrations_jomsocial_show_category') && $post->isNew() && $command == 'easyblog.blog.add') {
$streamTitle = JText::sprintf('COM_EASYBLOG_JS_ACTIVITY_BLOG_ADDED', $permalink, $title, $categoryLink, JText::_($category->title));
}
if (!$post->isNew() && $command == 'easyblog.blog.update') {
$streamTitle = JText::sprintf('COM_EASYBLOG_JS_ACTIVITY_BLOG_UPDATED', $permalink, $title, $categoryLink, JText::_($category->title));
}
// Featuring of a blog post
if ($command == 'easyblog.blog.featured') {
$streamTitle = JText::sprintf('COM_EASYBLOG_JS_ACTIVITY_BLOG_FEATURED', $permalink, $title);
}
// Insert the object into the stream now
$obj = new stdClass();
$obj->access = $post->access;
$obj->title = $streamTitle;
$obj->content = $content;
$obj->cmd = $command;
// Should we enable likes
if ($this->config->get('integrations_jomsocial_activity_likes')) {
$obj->like_id = $post->id;
$obj->like_type = 'com_easyblog';
}
// Should we link the comments
if ($this->config->get('integrations_jomsocial_activity_comments')) {
$obj->comment_id = $post->id;
$obj->comment_type = 'com_easyblog';
}
$obj->actor = $post->created_by;
$obj->target = 0;
$obj->app = 'easyblog';
$obj->cid = $post->id;
// If this post is contributed in an event or a group, update it accordingly.
if ($post->getBlogContribution()) {
// Get the event object
// $contribution = $post->getBlogContribution();
// Event type
if ($post->source_type == EASYBLOG_POST_SOURCE_JOMSOCIAL_EVENT) {
JTable::addIncludePath(JPATH_ROOT . '/components/com_community/tables');
// Load the event
$event = JTable::getInstance('Event', 'CTable');
$event->load($post->source_id);
// Set the stream title
$eventLink = CRoute::_('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id);
$obj->title = JText::sprintf('COM_EASYBLOG_JS_ACTIVITY_EVENT_BLOG_ADDED', $permalink, $title, $eventLink, $event->title);
// Set a new command
$obj->cmd = 'event.blog.added';
//.........这里部分代码省略.........