本文整理汇总了PHP中EasyBlogHelper::getPermalink方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogHelper::getPermalink方法的具体用法?PHP EasyBlogHelper::getPermalink怎么用?PHP EasyBlogHelper::getPermalink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyBlogHelper
的用法示例。
在下文中一共展示了EasyBlogHelper::getPermalink方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPermalink
/**
* Generate proper permalink for a blog entry
**/
function getPermalink($value)
{
$ejax = new Ejax();
$value = urldecode($value);
$permalink = EasyBlogHelper::getPermalink($value);
$ejax->value('permalink', $permalink);
$ejax->send();
}
示例2: editPost
//.........这里部分代码省略.........
// echo '##';
// echo $today->toUnix();
// echo '##';
// echo $today->toUnix() + 5;
// exit;
} else {
if (!$isNew) {
$date = EasyBlogDateHelper::dateWithOffSet($blog->created);
$blog->created = $date->toFormat();
$date = EasyBlogDateHelper::dateWithOffSet($blog->publish_up);
$blog->publish_up = $date->toFormat();
}
}
}
// we bind this attribute incase if easyblog was a old version.
$post['issitewide'] = '1';
//bind the inputs
$blog->bind($post, true);
$blog->intro = $post['intro'];
$blog->content = $post['content'];
$blog->created_by = $my->id;
$blog->ispending = 0;
//(empty($acl->rules->publish_entry)) ? 1 : 0;
$blog->published = $post['published'];
if ($overwriteDate !== false) {
$blog->created = $overwriteDate['created'];
if (isset($overwriteDate['publish_up'])) {
$blog->publish_up = $overwriteDate['publish_up'];
}
}
$blog->subscription = $allowSubscribe;
$blog->frontpage = $showFrontpage;
$blog->send_notification_emails = $sendEmails;
$blog->permalink = empty($post['permalink']) ? EasyBlogHelper::getPermalink($blog->title) : $post['permalink'];
// add in fancy box style.
$postcontent = $blog->intro . $blog->content;
// cater for wlw
$pattern = '#<a.*?\\><img[^>]*><\\/a>#i';
preg_match_all($pattern, $postcontent, $matches);
if ($matches && count($matches[0]) > 0) {
foreach ($matches[0] as $match) {
$input = $match;
$largeImgPath = '';
//getting large image path
$pattern = '#<a[^>]*>#i';
preg_match($pattern, $input, $anchors);
if ($anchors) {
preg_match('/href\\s*=\\s*[\\""\']?([^\\""\'\\s>]*)/i', $anchors[0], $adata);
if ($adata) {
$largeImgPath = $adata[1];
}
}
$input = $match;
$pattern = '#<img[^>]*>#i';
preg_match($pattern, $input, $images);
if ($images) {
preg_match('/src\\s*=\\s*[\\""\']?([^\\""\'\\s>]*)/i', $images[0], $data);
if ($data) {
$largeImgPath = empty($largeImgPath) ? $data[1] : $largeImgPath;
$largeImgPath = urldecode($largeImgPath);
$largeImgPath = str_replace(' ', '-', $largeImgPath);
$encodedurl = urldecode($data[1]);
$encodedurl = str_replace(' ', '-', $encodedurl);
$images[0] = str_replace($data[1], $encodedurl, $images[0]);
$blog->intro = str_replace($input, '<a class="easyblog-thumb-preview" href="' . $largeImgPath . '">' . $images[0] . '</a>', $blog->intro);
$blog->content = str_replace($input, '<a class="easyblog-thumb-preview" href="' . $largeImgPath . '">' . $images[0] . '</a>', $blog->content);
示例3: processMailbox
//.........这里部分代码省略.........
$tmp_dir = JPATH_ROOT . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR;
$uri = JURI::base() . $main_image_path . '/' . $userid . '/';
if (!JFolder::exists($dir)) {
JFolder::create($dir);
}
foreach ($attachments as $attachment) {
// clean up file name
if (strpos($attachment['name'], '/') !== FALSE) {
$attachment['name'] = substr($attachment['name'], strrpos($attachment['name'], '/') + 1);
} elseif (strpos($attachment['name'], '\\' !== FALSE)) {
$attachment['name'] = substr($attachment['name'], strrpos($attachment['name'], '\\') + 1);
}
// @task: check if the attachment has file extension. ( assuming is images )
$imgExts = array('jpg', 'png', 'gif', 'JPG', 'PNG', 'GIF', 'jpeg', 'JPEG');
$imageSegment = explode('.', $attachment['name']);
if (!in_array($imageSegment[count($imageSegment) - 1], $imgExts)) {
$attachment['name'] = $attachment['name'] . '.jpg';
}
// @task: Store the file into a temporary location first.
$attachment['tmp_name'] = $tmp_dir . $attachment['name'];
JFile::write($attachment['tmp_name'], $attachment['data']);
require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'mediamanager.php';
// @task: Ensure that images goes through the same resizing format when uploading via media manager.
$media = new EasyBlogMediaManager();
$result = $media->upload($dir, $uri, $attachment, '/', 'user');
// get the image file name and path
if (is_object($result) && property_exists($result, 'title')) {
$atmTitle = $result->title;
$atmURL = $result->url;
} else {
$atmTitle = $attachment['name'];
$atmURL = $uri . $attachment['name'];
}
// @task: Once the attachment is processed, delete the temporary file.
JFile::delete($attachment['tmp_name']);
// now we need to replace the img tag in the email which the source is an attachment id :(
$attachId = $attachment['id'];
if (!empty($attachId)) {
$attachId = str_replace('<', '', $attachId);
$attachId = str_replace('>', '', $attachId);
$imgPattern = array('/<div><img[^>]*src="[A-Za-z0-9:^>]*' . $attachId . '"[^>]*\\/><\\/div>/si', '/<img[^>]*src="[A-Za-z0-9:^>]*' . $attachId . '"[^>]*\\/>/si');
$imgReplace = array('', '');
$body = preg_replace($imgPattern, $imgReplace, $body);
}
// insert image into blog post
$body .= '<p><a class="easyblog-thumb-preview" href="' . $atmURL . '" title="' . $atmTitle . '"><img width="' . $config->get('main_thumbnail_width') . '" title="' . $atmTitle . '." alt="" src="' . $atmURL . '" /></a></p>';
}
}
}
if ($format == 'plain') {
$body = nl2br($body);
}
// tidy up the content so that the content do not contain incomplete html tag.
$body = EasyBlogHelper::getHelper('string')->tidyHTMLContent($body);
$type = $config->get('main_remotepublishing_mailbox_type');
// insert $body, $subject, $from, $date
$blog = EasyBlogHelper::getTable('Blog', 'Table');
// @task: Store the blog post
$blog->set('title', $subject);
$blog->set('permalink', EasyBlogHelper::getPermalink($blog->title));
$blog->set('source', 'email');
$blog->set('created_by', $userid);
$blog->set('created', $date);
$blog->set('modified', $date);
$blog->set('publish_up', $date);
$blog->set($type, $body);
$blog->set('category_id', $config->get('main_remotepublishing_mailbox_categoryid'));
$blog->set('published', $config->get('main_remotepublishing_mailbox_publish'));
$blog->set('frontpage', $config->get('main_remotepublishing_mailbox_frontpage'));
$blog->set('send_notification_emails', $config->get('main_remotepublishing_mailbox_publish'));
$blog->set('issitewide', true);
// @task: Set the blog's privacy here.
$blog->set('private', $config->get('main_remotepublishing_mailbox_privacy'));
// Store the blog post
if (!$blog->store()) {
echo 'Mailbox: Message store failed. > ' . $subject . ' :: ' . $blog->getError();
continue;
}
if ($mailbox->service == 'pop3') {
$mailbox->deleteMessage($sequence);
}
if ($mailbox->service == 'imap') {
$mailbox->setMessageFlag($sequence, '\\Seen');
}
// @rule: Autoposting to social network sites.
if ($blog->published == POST_ID_PUBLISHED) {
$blog->autopost(array(EBLOG_OAUTH_LINKEDIN, EBLOG_OAUTH_FACEBOOK, EBLOG_OAUTH_TWITTER), array(EBLOG_OAUTH_LINKEDIN, EBLOG_OAUTH_FACEBOOK, EBLOG_OAUTH_TWITTER));
$blog->notify(false);
}
$total++;
}
/*
* Disconnect from mailbox
*/
$mailbox->disconnect();
/*
* Generate report
*/
echo JText::sprintf('%1s blog posts fetched from mailbox: ' . $config->get('main_remotepublishing_mailbox_remotesystemname') . '.', $total);
}
示例4: _processLyftenBloggie
function _processLyftenBloggie($migrateComment)
{
$db = EasyBlogHelper::db();
$jSession = JFactory::getSession();
$ejax = new EJax();
$migrator = EB::migrator()->getAdapter('k2');
$migrateStat = $jSession->get('EBLOG_MIGRATOR_JOOMLA_STAT', '', 'EASYBLOG');
if (empty($migrateStat)) {
$migrateStat = new stdClass();
$migrateStat->blog = 0;
$migrateStat->category = 0;
$migrateStat->comments = 0;
$migrateStat->images = 0;
$migrateStat->user = array();
}
$query = 'SELECT * FROM `#__bloggies_entries` AS a';
$query .= ' WHERE NOT EXISTS (';
$query .= ' SELECT content_id FROM `#__easyblog_migrate_content` AS b WHERE b.`content_id` = a.`id` and `component` = ' . $db->Quote('com_lyftenbloggie');
$query .= ' )';
$query .= ' ORDER BY a.`id` LIMIT 1';
$db->setQuery($query);
$row = $db->loadObject();
if (is_null($row)) {
// now we migrate the remaining categories
$this->_migrateLyftenCategories();
//at here, we check whether there are any records processed. if yes,
//show the statistic.
$ejax->append('progress-status3', JText::_('COM_EASYBLOG_MIGRATOR_FINISHED'));
$ejax->script("divSrolltoBottomLyften();");
//update statistic
$stat = '========================================== <br />';
$stat .= JText::_('COM_EASYBLOG_MIGRATOR_TOTAL_BLOGS') . ': ' . $migrateStat->blog . '<br />';
$stat .= JText::_('COM_EASYBLOG_MIGRATOR_TOTAL_COMMENTS') . ': ' . $migrateStat->comments . '<br />';
//$stat .= 'Total images migrated : ' . $migrateStat->images . '<br />';
$statUser = $migrateStat->user;
if (!empty($statUser)) {
$stat .= '<br />';
$stat .= JText::_('COM_EASYBLOG_MIGRATOR_TOTAL_USERS_CONTRIBUTIONS') . ': ' . count($statUser) . '<br />';
foreach ($statUser as $eachUser) {
$stat .= JText::_('COM_EASYBLOG_MIGRATOR_TOTAL_BLOG_USER') . ' \'' . $eachUser->name . '\': ' . $eachUser->blogcount . '<br />';
}
}
$stat .= '<br />==========================================';
$ejax->assign('stat-status3', $stat);
$ejax->script("\$( '#migrator-submit3' ).html('" . JText::_('COM_EASYBLOG_MIGRATOR_MIGRATION_COMPLETED') . "');");
$ejax->script("\$( '#migrator-submit3' ).attr('disabled' , '');");
$ejax->script("\$( '#icon-wait3' ).css( 'display' , 'none' );");
} else {
// here we should process the migration
// step 1 : create user if not exists in eblog_users - create user through profile jtable load method.
// step 2: create categories / tags if needed.
// step 3: migrate comments if needed.
$date = EB::date();
$blogObj = new stdClass();
//default
$blogObj->category_id = 1;
//assume 1 is the uncategorized id.
if (!empty($row->catid)) {
$joomlaCat = $this->_getLyftenCategory($row->catid);
$eCat = $this->_isEblogCategoryExists($joomlaCat);
if ($eCat === false) {
$eCat = $this->_createEblogCategory($joomlaCat);
}
$blogObj->category_id = $eCat;
}
//load user profile
$profile = EB::user($row->created_by);
$blog = EB::table('Blog');
//assigning blog data
$blogObj->created_by = $profile->id;
$blogObj->created = !empty($row->created) ? $row->created : $date->toMySQL();
$blogObj->modified = !empty($row->modified) ? $row->modified : $date->toMySQL();
$blogObj->title = $row->title;
$blogObj->permalink = EasyBlogHelper::getPermalink($row->title);
if (empty($row->fulltext)) {
$blogObj->intro = '';
$blogObj->content = $row->introtext;
} else {
$blogObj->intro = $row->introtext;
$blogObj->content = $row->fulltext;
}
$blogObj->published = $row->state == '1' ? '1' : '0';
// set to unpublish for now.
$blogObj->publish_up = !empty($row->created) ? $row->created : $date->toMySQL();
$blogObj->publish_down = '0000-00-00 00:00:00';
$blogObj->hits = $row->hits;
$blogObj->frontpage = 1;
$blogObj->allowcomment = 1;
$blogObj->subscription = 1;
$blog->bind($blogObj);
$blog->store();
//add meta description
$migrator->migrateContentMeta($row->metakey, $row->metadesc, $blog->id);
//step 2: tags
$query = 'insert into `#__easyblog_post_tag` (`tag_id`, `post_id`, `created`)';
$query .= ' select a.`id`, ' . $db->Quote($blog->id) . ', ' . $db->Quote($date->toMySQL());
$query .= ' from `#__easyblog_tag` as a inner join `#__bloggies_tags` as b';
$query .= ' on a.`title` = b.`name`';
$query .= ' inner join `#__bloggies_relations` as c on b.`id` = c.`tag`';
$query .= ' where c.`entry` = ' . $db->Quote($row->id);
//.........这里部分代码省略.........
示例5: _processSmartBlog
function _processSmartBlog($migrateComment, $migrateImage, $imagePath)
{
$db = EasyBlogHelper::db();
$jSession = JFactory::getSession();
$ejax = new EJax();
//check if com_blog installed.
if (!JFile::exists(JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_blog' . DIRECTORY_SEPARATOR . 'blog.php')) {
$ejax->append('progress-status2', JText::_('COM_EASYBLOG_MIGRATOR_SMARTBLOG_ERROR'));
$ejax->script("\$( '#migrator-submit2' ).html('" . JText::_('COM_EASYBLOG_MIGRATOR_ABORTED') . "');");
$ejax->script("\$( '#migrator-submit2' ).attr('disabled' , '');");
$ejax->script("\$( '#icon-wait2' ).css( 'display' , 'none' );");
$ejax->send();
exit;
}
$migrateStat = $jSession->get('EBLOG_MIGRATOR_JOOMLA_STAT', '', 'EASYBLOG');
if (empty($migrateStat)) {
$migrateStat = new stdClass();
$migrateStat->blog = 0;
$migrateStat->category = 0;
$migrateStat->comments = 0;
$migrateStat->images = 0;
$migrateStat->user = array();
}
$query = 'SELECT * FROM `#__blog_postings` AS a';
$query .= ' WHERE NOT EXISTS (';
$query .= ' SELECT content_id FROM `#__easyblog_migrate_content` AS b WHERE b.`content_id` = a.`id` and `component` = ' . $db->Quote('com_blog');
$query .= ' )';
$query .= ' ORDER BY a.`id` LIMIT 1';
$db->setQuery($query);
$row = $db->loadObject();
if (is_null($row)) {
//at here, we check whether there are any records processed. if yes,
//show the statistic.
$ejax->append('progress-status2', JText::_('COM_EASYBLOG_MIGRATOR_FINISHED'));
$ejax->script("divSrolltoBottomSmartBlog();");
//update statistic
$stat = '========================================== <br />';
$stat .= JText::_('COM_EASYBLOG_MIGRATOR_TOTAL_BLOGS') . ': ' . $migrateStat->blog . '<br />';
$stat .= 'Total comments migrated : ' . $migrateStat->comments . '<br />';
$stat .= 'Total images migrated : ' . $migrateStat->images . '<br />';
$statUser = $migrateStat->user;
if (!empty($statUser)) {
$stat .= '<br />';
$stat .= 'Total user\'s contribution: ' . count($statUser) . '<br />';
foreach ($statUser as $eachUser) {
$stat .= JText::_('COM_EASYBLOG_MIGRATOR_TOTAL_BLOG_USER') . ' \'' . $eachUser->name . '\': ' . $eachUser->blogcount . '<br />';
}
}
$stat .= '<br />==========================================';
$ejax->assign('stat-status2', $stat);
$ejax->script("\$( '#migrator-submit2' ).html('" . JText::_('COM_EASYBLOG_MIGRATOR_MIGRATION_COMPLETED') . "');");
$ejax->script("\$( '#migrator-submit2' ).attr('disabled' , '');");
$ejax->script("\$( '#icon-wait2' ).css( 'display' , 'none' );");
} else {
// here we should process the migration
// step 1 : create user if not exists in eblog_users - create user through profile jtable load method.
// step 2 : migrate image files.
// step 2.1: create folder if not exist.
// step 3: migrate comments if needed.
$date = EB::date();
$blogObj = new stdClass();
//default
$blogObj->category_id = 1;
//assume 1 is the uncategorized id.
//load user profile
$profile = EB::user($row->user_id);
$blog = EB::table('Blog');
//assigning blog data
$blogObj->created_by = $profile->id;
$blogObj->created = !empty($row->post_date) ? $row->post_date : $date->toMySQL();
$blogObj->modified = !empty($row->post_update) ? $row->post_update : $date->toMySQL();
$blogObj->title = $row->post_title;
$blogObj->permalink = EasyBlogHelper::getPermalink($row->post_title);
$blogObj->intro = '';
$blogObj->content = $row->post_desc;
$blogObj->published = $row->published;
$blogObj->publish_up = !empty($row->post_date) ? $row->post_date : $date->toMySQL();
$blogObj->publish_down = '0000-00-00 00:00:00';
$blogObj->hits = $row->post_hits;
$blogObj->frontpage = 1;
$blog->bind($blogObj);
//step 2
$imageMigrated = false;
if ($migrateImage) {
$newImagePath = JPATH_ROOT . DIRECTORY_SEPARATOR . 'images';
if (!empty($imagePath)) {
$tmpimagePath = str_ireplace('/', DIRECTORY_SEPARATOR, $imagePath);
$newImagePath .= DIRECTORY_SEPARATOR . $tmpimagePath;
$newImagePath = JFolder::makeSafe($newImagePath);
}
if (!JFolder::exists($newImagePath)) {
JFolder::create($newImagePath);
}
$src = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_blog' . DIRECTORY_SEPARATOR . 'Images' . DIRECTORY_SEPARATOR . 'blogimages' . DIRECTORY_SEPARATOR . 'th' . $row->post_image;
$dest = $newImagePath . DIRECTORY_SEPARATOR . $row->post_image;
if (JFile::exists($src)) {
$imageMigrated = JFile::copy($src, $dest);
}
}
if ($imageMigrated) {
//.........这里部分代码省略.........
示例6: import
//.........这里部分代码省略.........
$fiConnector = new EasyBlogConnectorsHelper();
$fiConnector->addUrl($feedItemUrl);
$fiConnector->execute();
$fiContent = $fiConnector->getResult($feedItemUrl);
// to ensure the leading no text before the <?xml> tag
$pattern = '/(.*?)<html/is';
$replacement = '<html';
$fiContent = preg_replace($pattern, $replacement, $fiContent, 1);
if (!empty($fiContent)) {
$fiContent = EasyBlogHelper::getHelper('string')->forceUTF8($fiContent);
$readability = new Readability($fiContent);
$readability->debug = false;
$readability->convertLinksToFootnotes = false;
$result = $readability->init();
if ($result) {
$content = $readability->getContent()->innerHTML;
//$content = EasyBlogHelper::getHelper( 'string' )->fixUTF8( $content );
$content = EasyBlogFeedsHelper::tidyContent($content);
if (stristr(html_entity_decode($content), '<!DOCTYPE html') === false) {
$text = $content;
$text = $this->_processRelLinktoAbs($text, $feedPath);
}
}
}
}
// strip un-allowed html tag.
$text = strip_tags($text, $params->get('allowed', $defaultAllowedHTML));
// Append original source link into article if necessary
if ($params->get('sourceLinks')) {
JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
$text .= '<div><a href="' . $item->get_link() . '" target="_blank">' . JText::_('COM_EASYBLOG_FEEDS_ORIGINAL_LINK') . '</a></div>';
}
if ($feedObj->author) {
$feedAuthor = $item->get_author();
if (!empty($feedAuthor)) {
$authorName = $feedAuthor->get_name();
$authorEmail = $feedAuthor->get_email();
if (!empty($authorName)) {
// Store it as copyright column instead
$text .= '<div>' . JText::sprintf('COM_EASYBLOG_FEEDS_ORIGINAL_AUTHOR', $authorName) . '</div>';
} else {
if (!empty($authorEmail)) {
$authorArr = explode(' ', $authorEmail);
if (isset($authorArr[1])) {
$authorName = $authorArr[1];
$authorName = str_replace(array('(', ')'), '', $authorName);
$text .= '<div>' . JText::sprintf('COM_EASYBLOG_FEEDS_ORIGINAL_AUTHOR', $authorName) . '</div>';
}
}
}
}
}
if ($feedObj->item_content == 'intro') {
$blogObj->intro = $text;
} else {
$blogObj->content = $text;
}
$creationDate = $mydate;
$blogObj->created = $mydate;
$blogObj->modified = $mydate;
$blogObj->title = $item->get_title();
if (empty($blogObj->title)) {
$blogObj->title = $this->_getTitleFromLink($item->get_link());
}
$blogObj->title = EasyBlogStringHelper::unhtmlentities($blogObj->title);
$blogObj->permalink = EasyBlogHelper::getPermalink($blogObj->title);
$blogObj->publish_up = $mydate;
$blogObj->isnew = !$feedObj->item_published ? true : false;
$blog = EasyBlogHelper::getTable('blog');
$blog->bind($blogObj);
if ($feedObj->item_published) {
$blog->notify();
}
if ($blog->store()) {
$myCnt++;
//update the history with blog id
if (!empty($newHistoryId)) {
$tmpHistory = EasyBlogHelper::getTable('FeedHistory');
$tmpHistory->load($newHistoryId);
$tmpHistory->post_id = $blog->id;
$tmpHistory->store();
}
$itemMigrated++;
if ($feedObj->item_published) {
//insert activity here.
EasyBlogHelper::addJomSocialActivityBlog($blog, true, true);
// Determines if admin wants to auto post this item to the social sites.
if ($params->get('autopost')) {
$allowed = array(EBLOG_OAUTH_LINKEDIN, EBLOG_OAUTH_FACEBOOK, EBLOG_OAUTH_TWITTER);
// @rule: Process centralized options first
// See if there are any global postings enabled.
$blog->autopost($allowed, $allowed);
}
}
}
//end if
}
}
return $itemMigrated;
}
示例7: getBlogSefPermalink
public static function getBlogSefPermalink($id, $external = false)
{
$config = EasyBlogHelper::getConfig();
static $permalinks = null;
if (!isset($permalinks[$id])) {
JTable::addIncludePath(EBLOG_TABLES);
$db = EasyBlogHelper::db();
$query = 'SELECT a.* FROM ' . EasyBlogHelper::getHelper('SQL')->nameQuote('#__easyblog_post') . ' as a ' . 'WHERE a.`id` ' . '=' . $db->Quote($id);
$db->setQuery($query);
$data = $db->loadObject();
$config = EasyBlogHelper::getConfig();
if (empty($data)) {
// blog post not exists
$permalinks[$id] = JText::_('COM_EASYBLOG_INVALID_PERMALINK_POST');
return $permalinks[$id];
}
// Empty permalinks needs to be regenerated.
if (empty($data->permalink)) {
$data->permalink = EasyBlogHelper::getPermalink($data->title);
$query = 'UPDATE #__easyblog_post SET permalink=' . $db->Quote($data->permalink) . ' ' . 'WHERE ' . EasyBlogHelper::getHelper('SQL')->nameQuote('id') . '=' . $db->Quote($id);
$db->setQuery($query);
$db->Query();
}
if ($config->get('main_sef_unicode')) {
$data->permalink = $data->id . '-' . urlencode($data->permalink);
}
switch ($config->get('main_sef')) {
// Date based SEF mode
case 'date':
$date = EasyBlogHelper::getDate($data->created);
$data->permalink = $date->toFormat('%Y') . '/' . $date->toFormat('%m') . '/' . $date->toFormat('%d') . '/' . $data->permalink;
break;
case 'datecategory':
$date = EasyBlogHelper::getDate($data->created);
$catPermalink = EasyBlogRouter::getCategoryPermalink($data->category_id);
$data->permalink = $catPermalink . '/' . $date->toFormat('%Y') . '/' . $date->toFormat('%m') . '/' . $date->toFormat('%d') . '/' . $data->permalink;
break;
case 'category':
$catPermalink = EasyBlogRouter::getCategoryPermalink($data->category_id);
$data->permalink = $catPermalink . '/' . $data->permalink;
break;
case 'custom':
$data->permalink = self::getCustomPermalink($data);
break;
// Default SEF mode leave it unchanged
// Default SEF mode leave it unchanged
default:
break;
}
if ($external) {
$uri = JURI::getInstance();
return $uri->toString(array('scheme', 'host', 'port')) . '/' . $data->permalink;
}
$permalinks[$id] = $data->permalink;
}
return $permalinks[$id];
}
示例8: getPermalink
/**
* Generate proper permalink for a blog entry
**/
function getPermalink($value)
{
$ajax = new Ejax();
$permalink = EasyBlogHelper::getPermalink($value);
$ajax->assign('permalink-url', $permalink);
$ajax->script('$( "#edit-permalink" ).show();');
$ajax->script('$( "#permalink-value" ).show();');
$ajax->value('permalink-data', $permalink);
$ajax->send();
}