当前位置: 首页>>代码示例>>PHP>>正文


PHP content::buildPermalink方法代码示例

本文整理汇总了PHP中content::buildPermalink方法的典型用法代码示例。如果您正苦于以下问题:PHP content::buildPermalink方法的具体用法?PHP content::buildPermalink怎么用?PHP content::buildPermalink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在content的用法示例。


在下文中一共展示了content::buildPermalink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createTempContent

 function createTempContent($userinfo = NULL, $wireid = 0)
 {
     require_once PATH_CORE . '/classes/content.class.php';
     $cObj = new content($this->db);
     $info = $this->getWireStory($wireid);
     require_once PATH_CORE . '/classes/parseStory.class.php';
     $psObj = new parseStory();
     require_once PATH_CORE . '/classes/utilities.class.php';
     $this->utilObj = new utilities($this->db);
     $info->title = stripslashes($info->title);
     $info->caption = stripslashes($this->utilObj->shorten($info->caption));
     // to do - replace proxy feed urls with final redirect
     $info->title = $psObj->cleanTitle($info->title);
     // create permalink
     $info->permalink = $cObj->buildPermalink($info->title);
     // serialize the content
     $info->title = mysql_real_escape_string($info->title);
     $info->caption = mysql_real_escape_string($info->caption);
     $story = $cObj->serialize(0, $info->title, $info->caption, $info->source, $info->url, $info->permalink, $userinfo->ncUid, $userinfo->name, $userinfo->userid, '', $userinfo->votePower, 0, 0);
     // post wire story to content
     $siteContentId = $cObj->add($story);
     return $siteContentId;
 }
开发者ID:smbale,项目名称:open-social-media-toolkit,代码行数:23,代码来源:newswire.class.php

示例2: loadStory

 function loadStory($wire = null, $feed = null)
 {
     $this->db->log('entering loadStory ');
     $this->db->log($wire);
     // post a story from a feed to Content table for the user who owns the bookmark feed
     $this->psObj->refreshUrl($wire->url);
     // $id is feed id, $wire is serialized newswire object, $feed->userid is posted by userid
     // clean headlines
     $wire->title = $this->psObj->cleanTitle($wire->title);
     $this->db->log('clean title:' . $wire->title);
     // check for duplicates from final url or initial url or title
     $error = false;
     $cleanUrl = $this->psObj->cleanUrl($wire->url);
     $isDup = $this->db->queryC("SELECT siteContentId FROM Content WHERE url = '" . $wire->url . "' OR url = '" . $cleanUrl . "' OR title = '" . $wire->title . "'");
     if ($isDup === false) {
         $wire->url = $cleanUrl;
         $this->psObj->log('Cleaned url: ' . $cleanUrl . ' <= ' . $wire->url);
         // load user wire record
         $this->db->log('not a dup');
         require_once PATH_CORE . '/classes/user.class.php';
         $userTable = new UserTable($this->db);
         $user = $userTable->getRowObject();
         // to do if $feed->userid==0 use admin
         if ($feed->userid == 0) {
             $user->loadWhere("isAdmin=1");
         } else {
             $user->load($feed->userid);
         }
         // create temporary content item, temp permalink
         require_once PATH_CORE . '/classes/utilities.class.php';
         $utilObj = new utilities();
         require_once PATH_CORE . '/classes/content.class.php';
         $cObj = new content($this->db);
         // clean caption, strip tags, trim for length
         $wire->caption = $utilObj->shorten($wire->caption, LENGTH_LONG_CAPTION);
         $wire->source = $this->stripit(parse_url($wire->url, PHP_URL_HOST));
         // create permalink
         $wire->permalink = $cObj->buildPermalink($wire->title);
         // get images, check size of each and pick most likely candidate with minimum
         require_once PATH_CORE . '/classes/remotefile.class.php';
         $rfObj = new remotePageProperty($wire->url);
         $imgArr = $this->psObj->parseImages($rfObj, 7500);
         // 7500 is min jpg size for automatically selecting images
         // $this->db->log($imgArr);
         if (count($imgArr) > 0) {
             $wire->imageUrl = $imgArr[0];
         } else {
             $wire->imageUrl = '';
         }
         // serialize the content
         $isBlogEntry = 0;
         $story = $cObj->serialize(0, $wire->title, $wire->caption, $wire->source, $wire->url, $wire->permalink, $user->ncUid, $user->name, $user->userid, '', 1, 0, 0, $wire->imageUrl, 0, $isBlogEntry, 1);
         //$this->db->log($story);
         // add to content by this userid
         $siteContentId = $cObj->add($story);
         if ($siteContentId !== false) {
             require_once PATH_CORE . '/classes/log.class.php';
             $this->logObj = new log($this->db);
             // add to user journal
             $logItem = $this->logObj->serialize(0, $user->userid, 'postStory', $siteContentId);
             $inLog = $this->logObj->update($logItem);
             if ($inLog) {
                 $logItem = $this->logObj->serialize(0, $user->userid, 'vote', $siteContentId);
                 $inLog = $this->logObj->update($logItem);
             }
         }
         // set new story loaded flag - so that features can be updated
         $this->newStoryLoaded = true;
     } else {
         $error = true;
     }
 }
开发者ID:smbale,项目名称:open-social-media-toolkit,代码行数:72,代码来源:feed.class.php


注:本文中的content::buildPermalink方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。