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


PHP content::serialize方法代码示例

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


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


//.........这里部分代码省略.........
             $props = $apiObj->syncProperties($this->cloudid);
             require_once 'systemStatus.class.php';
             $ssObj = new systemStatus($this->db);
             $ssObj->setProperties($props['items'][0]);
             break;
         case 'syncAnnouncements':
             require_once 'apiCloud.class.php';
             $apiObj = new apiCloud($this->db, $this->apiKey);
             $resp = $apiObj->syncAnnouncements($this->cloudid);
             if ($resp[result] !== false) {
                 $itemlist = $resp[items];
                 require_once 'systemStatus.class.php';
                 $ssObj = new systemStatus($this->db);
                 $ssObj->resetAnnouncements();
                 if (count($itemlist) > 0) {
                     foreach ($itemlist as $data) {
                         $ssObj->insertState('announcement', html_entity_decode($data['announce']));
                     }
                 }
             }
             break;
         case 'syncNewswire':
             /* deprecated
             			require_once ('apiCloud.class.php');
             			$apiObj=new apiCloud($this->db,$this->apiKey);
             			$resp=$apiObj->syncNewswire($this->cloudid,$this->timeStrToUnixModB($job->lastItemTime));
             			$itemlist=$resp[items];
             			echo 'count: '.count($itemlist).'<br />';
             			if (count($itemlist)>0) {
             				require_once('newswire.class.php');
             				$nwObj=new newswire($this->db);
             				$lastItemTime=date('Y-m-d H:i:s',(time()-(6*30*24*3600))); // set to six months earlier 
             				foreach ($itemlist as $data) {					
             					$wire=$nwObj->serialize($data[title],$data[caption],$data[blogtitle],$data[webpage],$data[date],$data[blogid]);						
             					$id=$nwObj->add($wire);
             					if ($data[date]>$lastItemTime)						
             						$lastItemTime=$data[date];
             					if ($id===false)
             						echo 'skip '.$data[title].'<br />';
             					else						
             						echo 'adding '.$data[title].' id->'.$id.'<br />';
             				}
             				$this->db->update("cronJobs","lastItemTime='$lastItemTime'","id=$job->id");
             			}
             			*/
             break;
         case 'syncLog':
             require_once 'apiCloud.class.php';
             $apiObj = new apiCloud($this->db, $this->apiKey);
             // request server ask for log
             $resp = $apiObj->requestSyncLog($this->cloudid, URL_HOME, $this->timeStrToUnixModB($job->lastStart));
             // get result of log sync
             $logResult = $resp[items][0][log];
             require_once PATH_CORE . "/classes/log.class.php";
             $logObj = new log($this->db);
             // process results from sync operation
             $result = $logObj->receive($logResult);
             echo $result;
             break;
         case 'syncContent':
             // bring content from NewsCloud for this cloud to the remote site
             require_once 'apiCloud.class.php';
             $apiObj = new apiCloud($this->db, $this->apiKey);
             $resp = $apiObj->syncContent($this->cloudid, $this->timeStrToUnixModB($job->lastItemTime));
             $itemlist = $resp[items];
             if (count($itemlist) > 0) {
开发者ID:smbale,项目名称:open-social-media-toolkit,代码行数:67,代码来源:cron.class.php

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