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


PHP EB::quickpost方法代码示例

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


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

示例1: formatMicroblog

 /**
  * Formats microblog posts. Use EB::quickpost()->getAdapter('source')->format($blog);
  *
  * @deprecated	4.0
  */
 public static function formatMicroblog(&$row)
 {
     $adapter = EB::quickpost()->getAdapter($row->posttype);
     if ($adapter === false) {
         return;
     }
     $adapter->format($row);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:13,代码来源:easyblog.php

示例2: formatMicroblog

 /**
  * Formats the microblog posts
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public static function formatMicroblog(EasyBlogPost &$blog)
 {
     $adapter = EB::quickpost()->getAdapter($blog->posttype);
     if ($adapter === false) {
         return;
     }
     $adapter->format($blog);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:16,代码来源:standard.php

示例3: getQuickpostObject

 /**
  * Retrieves the quickpost object
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 private function getQuickpostObject($type)
 {
     $adapter = EB::quickpost()->getAdapter($type);
     return $adapter;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:13,代码来源:view.ajax.php

示例4: import

 /**
  * Allows caller to import posts from twitter
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function import()
 {
     $key = $this->config->get('integrations_twitter_api_key');
     $secret = $this->config->get('integrations_twitter_secret_key');
     // Ensure that the settings is enabled
     if (!$this->config->get('integrations_twitter_microblog')) {
         // TODO: Turn this into language string.
         return EB::exception('Twitter import has been disabled.', EASYBLOG_MSG_ERROR);
     }
     // Get a list of hashtags
     $hashtags = $this->config->get('integrations_twitter_microblog_hashes');
     // If there are no hashtags, skip this
     if (!$hashtags) {
         // TODO: Turn this into language string.
         return EB::exception('No hashtags provided to search. Skipping this.', EASYBLOG_MSG_INFO);
     }
     $hashtags = explode(',', $hashtags);
     $total = count($hashtags);
     // Get the list of accounts
     $model = EB::model('OAuth');
     $accounts = $model->getTwitterAccounts();
     if (!$accounts) {
         return EB::exception('No Twitter accounts associated on the site. Skipping this', EASYBLOG_MSG_INFO);
     }
     // Get the default category to save the tweets into
     $categoryId = $this->config->get('integrations_twitter_microblog_category');
     // Default state of the post
     $published = $this->config->get('integrations_twitter_microblog_publish');
     // Determines if the post should be available on the frontpage
     $frontpage = $this->config->get('integrations_twitter_microblog_frontpage');
     // Determines the total number of items imported
     $total = 0;
     // Go through each twitter accounts and search for the tags
     foreach ($accounts as $account) {
         $params = EB::registry($account->params);
         $screen = $params->get('screen_name');
         // If we can't get the screen name, do not try to process it.
         if (!$screen) {
             continue;
         }
         // Get the twitter consumer
         $consumer = EB::oauth()->getClient('Twitter');
         $consumer->setAccess($account->access_token);
         // Get the last tweet that has been imported so we don't try to search for anything prior to that
         $lastImport = $model->getLastTweetImport($account->id);
         // Prepare the search params
         $tweets = $consumer->search($hashtags, $lastImport);
         if (!$tweets) {
             return EB::exception('No tweets found. Skipping this.', EASYBLOG_MSG_INFO);
         }
         foreach ($tweets as $tweet) {
             $data = array();
             $data['title'] = JString::substr($tweet->text, 0, 20) . JText::_('COM_EASYBLOG_ELLIPSES');
             $data['posttype'] = EBLOG_MICROBLOG_TWITTER;
             $data['created_by'] = $account->user_id;
             $data['created'] = EB::date()->toSql();
             $data['modified'] = EB::date()->toSql();
             $data['publish_up'] = EB::date()->toSql();
             $data['intro'] = $tweet->text;
             $data['published'] = $published;
             $data['frontpage'] = $frontpage;
             $data['source_id'] = '0';
             $data['source_type'] = EASYBLOG_POST_SOURCE_SITEWIDE;
             $data['category_id'] = $categoryId;
             $data['categories'] = array($categoryId);
             // we need to set this as legacy post as the post did not go through composer.
             $data['doctype'] = EASYBLOG_POST_DOCTYPE_LEGACY;
             $post = EB::post();
             $createOption = array('overrideDoctType' => 'legacy', 'checkAcl' => false, 'overrideAuthorId' => $account->user_id);
             $post->create($createOption);
             // binding
             $post->bind($data);
             $saveOptions = array('applyDateOffset' => false, 'validateData' => false, 'useAuthorAsRevisionOwner' => true, 'checkAcl' => false, 'overrideAuthorId' => $account->user_id);
             // Save the post now
             try {
                 $post->save($saveOptions);
             } catch (EasyBlogException $exception) {
                 return $exception;
             }
             // We need to save some of these tweets
             $adapter = EB::quickpost()->getAdapter('twitter');
             if ($adapter) {
                 $adapter->saveAsset($post->id, 'screen_name', $tweet->user->screen_name);
                 $adapter->saveAsset($post->id, 'created_at', $tweet->created_at);
             }
             // Create a new history record
             $history = EB::table('TwitterMicroBlog');
             $history->id_str = $tweet->id_str;
             $history->post_id = $post->id;
             $history->oauth_id = $account->id;
             $history->created = $post->created;
             $history->tweet_author = $screen;
//.........这里部分代码省略.........
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:101,代码来源:twitter.php


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