'Diego Najar', 'version'=>'3.7', 'url'=>'http://www.nibbleblog.com' ); // ===================================================================== // PLUGIN CLASS // ===================================================================== class PLUGIN_TWITTER_CARDS extends Plugin { function __construct() { parent::__construct(); $this->fields = array('creator'=>'', 'site'=>''); } public function dashboard_config() { global $Language; $html = Html::label( array('content'=>'twitter:creator') ); $html .= Html::input( array('name'=>'creator', 'type'=>'text', 'value'=>$this->database('creator')) ); $html .= Html::label( array('content'=>'twitter:site') ); $html .= Html::input( array('name'=>'site', 'type'=>'text', 'value'=>$this->database('site')) ); return $html; } public function blog_head() { global $post; global $page; global $where_am_i; global $settings; global $category; global $seo; global $tag; $og = array( 'card'=>'summary', 'title'=>$seo['site_title'], 'description'=>$seo['site_description'], 'image'=>$settings['url'].HTML_PATH_ADMIN_TEMPLATES.'default/css/img/mrnibbler128.png', 'url'=>BLOG_URL ); // The theme has og:image ? if(file_exists(THEME_IMG.'image.png')) $og['image'] = $settings['url'].HTML_THEME_IMG.'image.png'; if( ($where_am_i[1]=='post') && !empty($post) ) { $og['title'] .= ' - '.$post['title']; $og['description'] = $post['description']; $og['url'] = Url::post($post, true); } elseif( ($where_am_i[1]=='page') && !empty($page) ) { $og['title'] .= ' - '.$page['title']; $og['description'] = $page['description']; $og['url'] = Url::page($page, true); } elseif( ($where_am_i[1]=='category') && !empty($category) ) { $og['title'] .= ' - '.$category['name']; $og['url'] = Url::category($category['slug'], true); } elseif( ($where_am_i[1]=='tag') && !empty($tag) ) { $og['title'] .= ' - '.$tag; $og['url'] = Url::tag($tag, true); } $html = PHP_EOL.''.PHP_EOL; $html .= ''.PHP_EOL; $html .= ''.PHP_EOL; $html .= ''.PHP_EOL; $html .= ''.PHP_EOL; $html .= ''.PHP_EOL; $site = $this->database('site'); $creator = $this->database('creator'); if(!empty($site)) $html .= ''.PHP_EOL; if(!empty($creator)) $html .= ''.PHP_EOL; return $html; } } ?>