/** * Prepares the list data */ public function prepareVars() { $settings = ProblogSettingsModel::instance(); $this->vars['alchemy'] = $settings->get('alchemy'); $this->vars['checkUrl'] = URL::to('/radiantweb_api/problog/check_url/valid/'); $this->vars['checkUrlXmlrpc'] = URL::to('/radiantweb_api/problog/check_url/valid_link/'); }
public function onRun() { $this->addCss('/plugins/radiantweb/problog/assets/css/problog_post.css'); $this->addJs('/plugins/radiantweb/problog/assets/google-code-prettify/prettify.js'); $this->addJs('/plugins/radiantweb/problog/assets/google-code-prettify/run_prettify.js?skin=sunburst'); $this->getPost(); if (!is_null($this->post) && ($this->post->published < 1 && !$this->user())) { return \Response::make($this->controller->run('404'), 404); } if (!is_null($this->post) && !$this->render_category) { /* set up metas for this post */ $this->page['post_item'] = $this->post; $this->page->title = $this->post->meta_title ? $this->post->meta_title : $this->post->title; $this->page->meta_description = $this->post->meta_description ? $this->post->meta_description : $this->post->excerpt; $this->page->meta_keywords = $this->post->meta_keywords; $this->page['categories'] = $this->categories = CategoryModel::get(); if ($this->post) { $this->page['author'] = $this->getAuthor($this->post->user_id); } $this->page['parentPage'] = $this->post->parent; $this->page['searchpage'] = $this->property('searchpage'); $this->page['back'] = Request::header('referer'); $this->page['url'] = Request::url(); $settings = ProblogSettingsModel::instance(); $this->page['sharethis'] = $settings->get('sharethis'); $this->page['facebook'] = $settings->get('facebook'); $this->page['twitter'] = $settings->get('twitter'); $this->page['google'] = $settings->get('google'); $this->page['embedly'] = $settings->get('embedly'); if ($this->page['embedly']) { $this->addJs('/plugins/radiantweb/problog/assets/js/jquery.embedly.js'); $this->addJs('/plugins/radiantweb/problog/assets/js/embedly.js'); } } }
public function beforeSave() { if (ProblogSettingsModel::get('markdownMode', false)) { $this->content_markdown = $this->content; $this->content = $this->formatHtml($this->content); } }
public function postRender($parent) { if ($this->property('render') == 'specific') { return $this->property('specific'); } elseif ($this->property('render') == 'settings') { $settings = ProblogSettingsModel::instance(); return $settings->get('blogPost'); } else { return $parent; } }
function onDoTweet() { $settings = ProblogSettingsModel::instance(); $blogPost = $settings->get('blogPost'); $pb_auth = DB::table('radiantweb_twitter_auth')->first(); $PB_AUTH_TOKEN = $pb_auth->twitter_auth_token; $PB_AUTH_SECRET = $pb_auth->twitter_auth_secret; $PB_APP_KEY = $pb_auth->twitter_key; $PB_APP_SECRET = $pb_auth->twitter_secret; if ($PB_AUTH_TOKEN) { $connection = new TwitterOAuth($PB_APP_KEY, $PB_APP_SECRET, $PB_AUTH_TOKEN, $PB_AUTH_SECRET); $url = Url::to('/') . '/' . $blogPost . '/' . $this->model->slug . '/'; $msg = str_replace('{{url}}', $url, $_REQUEST['message']); $update_status = $connection->post('statuses/update', ['status' => $msg]); } }
public function formExtendFieldsBefore($widget) { if (ProblogSettingsModel::get('markdownMode', false)) { $widget->tabs['fields']['content']['type'] = 'markdown'; } }
/** * Get the post's excerpt if available * otherwise fall back to a limited content string. * * @param $post * * @return string */ private function getSummary($post) { $excerpt = $post->excerpt; if (mb_strlen(trim($excerpt))) { return $excerpt; } $content = $post->content; if (Settings::get('markdownMode')) { $content = Post::formatHtml($content); } return $content; }