Skip to content
This repository was archived by the owner on Apr 19, 2022. It is now read-only.

Commit 7419b5c

Browse files
committed
Minor changes on plugins
1 parent 48a95ea commit 7419b5c

File tree

18 files changed

+172
-46
lines changed

18 files changed

+172
-46
lines changed

admin/kernel/helpers/theme.class.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,14 @@ public static function meta_tags()
9696
if(!empty($layout['author']))
9797
{
9898
if(filter_var($layout['author'], FILTER_VALIDATE_URL))
99-
$meta .= '<link rel="author" href="'.$layout['author'].'" />'.PHP_EOL;
99+
$meta .= '<link rel="author" href="'.$layout['author'].'">'.PHP_EOL;
100100
else
101101
$meta .= '<meta name="author" content="'.$layout['author'].'">'.PHP_EOL;
102102
}
103103

104+
if(!empty($layout['canonical']))
105+
$meta .= '<link rel="canonical" href="'.$layout['canonical'].'">'.PHP_EOL;
106+
104107
if(!empty($layout['robots']))
105108
$meta .= '<meta name="robots" content="'.$layout['robots'].'">'.PHP_EOL;
106109

@@ -110,7 +113,7 @@ public static function meta_tags()
110113
if(!empty($seo['bing_code']))
111114
$meta .= '<meta name="msvalidate.01" content="'.$seo['bing_code'].'">'.PHP_EOL;
112115

113-
$meta .= '<link rel="alternate" type="application/atom+xml" title="ATOM Feed" href="'.$layout['feed'].'" />'.PHP_EOL;
116+
$meta .= '<link rel="alternate" type="application/atom+xml" title="ATOM Feed" href="'.$layout['feed'].'">'.PHP_EOL;
114117

115118
echo $meta;
116119
}

admin/kernel/helpers/url.class.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ public static function category($slug, $absolute=false)
1919

2020
if($settings['friendly_urls'])
2121
{
22-
return HTML_PATH_ROOT.'category/'.$slug.'/';
22+
return $url.'category/'.$slug.'/';
2323
}
2424
else
2525
{
26-
return HTML_PATH_ROOT.'index.php?controller=blog&action=view&category='.$slug;
26+
return $url.'index.php?controller=blog&amp;action=view&amp;category='.$slug;
2727
}
2828
}
2929

@@ -35,11 +35,11 @@ public static function tag($slug, $absolute=false)
3535

3636
if($settings['friendly_urls'])
3737
{
38-
return HTML_PATH_ROOT.'tag/'.$slug.'/';
38+
return $url.'tag/'.$slug.'/';
3939
}
4040
else
4141
{
42-
return HTML_PATH_ROOT.'index.php?controller=blog&action=view&tag='.$slug;
42+
return $url.'index.php?controller=blog&amp;action=view&amp;tag='.$slug;
4343
}
4444
}
4545

@@ -55,7 +55,7 @@ public static function post($post, $absolute=false)
5555
}
5656
else
5757
{
58-
return $url.'index.php?controller=post&action=view&id_post='.$post['id'];
58+
return $url.'index.php?controller=post&amp;action=view&amp;id_post='.$post['id'];
5959
}
6060
}
6161

@@ -71,7 +71,7 @@ public static function page($page, $absolute=false)
7171
}
7272
else
7373
{
74-
return HTML_PATH_ROOT.'index.php?controller=page&action=view&id_page='.$page['id'];
74+
return HTML_PATH_ROOT.'index.php?controller=page&amp;action=view&amp;id_page='.$page['id'];
7575
}
7676
}
7777

admin/kernel/plugin.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function init_db()
102102

103103
public function database($field)
104104
{
105-
return (string) $this->db->getChild($field);
105+
return $this->db->getChild($field);
106106
}
107107

108108
// DEPRECATED

index.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
'robots'=>$seo['robots'],
3939
'keywords'=>$seo['keywords'],
4040
'generator'=>$seo['generator'],
41-
'feed'=>HTML_PATH_ROOT.'feed.php'
41+
'feed'=>HTML_PATH_ROOT.'feed.php',
42+
'canonical'=>BLOG_URL
4243
);
4344

4445
if( ($url['controller']!=null) && ($url['action']!=null) )
@@ -52,6 +53,7 @@
5253
$layout['title'] .= ' - '.$post['title'];
5354
$layout['description'] = $post['description'];
5455
$layout['keywords'] = implode(',',$post['tags']);
56+
$layout['canonical'] = Url::post($post, true);
5557

5658
$where_am_i[1] = 'post';
5759
}
@@ -60,18 +62,21 @@
6062
$layout['title'] .= ' - '.$page['title'];
6163
$layout['description'] = $page['description'];
6264
$layout['keywords'] = $page['keywords'];
65+
$layout['canonical'] = Url::page($page, true);
6366

6467
$where_am_i[1] = 'page';
6568
}
6669
elseif( ($url['category']!==null) && !empty($category) )
6770
{
68-
$layout['title'] .= ' - '.$category['name'];
71+
$layout['title'] .= ' - '.$category['name'];
72+
$layout['canonical'] = Url::category($category['slug'], true);
6973

7074
$where_am_i[1] = 'category';
7175
}
7276
elseif( ($url['tag']!==null) && !empty($tag) )
7377
{
74-
$layout['title'] .= ' - '.$url['tag'];
78+
$layout['title'] .= ' - '.$url['tag'];
79+
$layout['canonical'] = Url::tag($tag, true);
7580

7681
$where_am_i[1] = 'tag';
7782
}

plugins/about/plugin.bit

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ class PLUGIN_ABOUT extends Plugin
2525
global $Language;
2626

2727
$html = Html::label( array('content'=>$Language->get('FULL_NAME')) );
28-
$html .= Html::input( array('name'=>'name', 'type'=>'text', 'value'=>$this->get_field_db('name')) );
28+
$html .= Html::input( array('name'=>'name', 'type'=>'text', 'value'=>$this->database('name')) );
2929

3030
$html .= Html::label( array('content'=>$Language->get('ABOUT')) );
31-
$html .= Html::textarea( array('name'=>'about', 'content'=>$this->get_field_db('about')) );
31+
$html .= Html::textarea( array('name'=>'about', 'content'=>$this->database('about')) );
3232

3333
$html .= Html::label( array('content'=>$Language->get('PICTURE')) );
3434
$html .= Html::input( array('name'=>'profile_picture', 'type'=>'file') );
@@ -48,9 +48,9 @@ class PLUGIN_ABOUT extends Plugin
4848
$src = HTML_PATH_PLUGINS_DB.'about/profile_picture.jpg';
4949

5050
$html = '<ul>';
51-
if(isset($src)) $html .= '<li class="image"><img class="plugin_about" alt="'.$this->get_field_db('name').'" src="'.$src.'" /></li>';
52-
$html .= '<li class="name">'.$this->get_field_db('name').'</li>';
53-
$html .= '<li class="about">'.$this->get_field_db('about').'</li>';
51+
if(isset($src)) $html .= '<li class="image"><img class="plugin_about" alt="'.$this->database('name').'" src="'.$src.'" /></li>';
52+
$html .= '<li class="name">'.$this->database('name').'</li>';
53+
$html .= '<li class="about">'.$this->database('about').'</li>';
5454
$html .= '</ul>';
5555

5656
return $html;

plugins/analytics/plugin.bit

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class PLUGIN_ANALYTICS extends Plugin
2525
global $Language;
2626

2727
$html = Html::label( array('content'=>$Language->get('GOOGLE_ANALYTICS_ID') ));
28-
$html .= Html::input( array('name'=>'id', 'type'=>'text', 'value'=>$this->get_field_db('id')) );
28+
$html .= Html::input( array('name'=>'id', 'type'=>'text', 'value'=>$this->database('id')) );
2929

3030
return $html;
3131
}
@@ -36,7 +36,7 @@ class PLUGIN_ANALYTICS extends Plugin
3636
<script type="text/javascript">
3737

3838
var _gaq = _gaq || [];
39-
_gaq.push([\'_setAccount\', \''.$this->get_field_db('id').'\']);
39+
_gaq.push([\'_setAccount\', \''.$this->database('id').'\']);
4040
_gaq.push([\'_trackPageview\']);
4141

4242
(function() {

plugins/html_code/plugin.bit

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ class PLUGIN_HTML_CODE extends Plugin
2525
global $Language;
2626

2727
$html = Html::label( array('content'=>$Language->get('HTML_CODE')) );
28-
$html .= Html::textarea( array('name'=>'code', 'type'=>'text', 'content'=>$this->get_field_db('code')) );
28+
$html .= Html::textarea( array('name'=>'code', 'type'=>'text', 'content'=>$this->database('code')) );
2929

3030
return $html;
3131
}
3232

3333
public function blog_body()
3434
{
35-
$html = $this->get_field_db('code');
35+
$html = $this->database('code');
3636

3737
return $html;
3838
}

plugins/last_posts/plugin.bit

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class PLUGIN_LAST_POSTS extends Plugin
2525
global $Language;
2626

2727
$html = '<label>'.$Language->get('AMOUNT').'</label>';
28-
$html .= '<input name="amount" type="text" value="'.$this->get_field_db('amount').'">';
28+
$html .= '<input name="amount" type="text" value="'.$this->database('amount').'">';
2929

3030
return $html;
3131
}
@@ -34,7 +34,7 @@ class PLUGIN_LAST_POSTS extends Plugin
3434
{
3535
global $Post;
3636

37-
$list = $Post->get_by_page(0, $this->get_field_db('amount') );
37+
$list = $Post->get_by_page(0, $this->database('amount') );
3838

3939
$html = '<ul>';
4040

plugins/maintenance_mode/plugin.bit

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ class PLUGIN_MAINTENANCE_MODE extends Plugin
2525
global $where_am_i;
2626

2727
if($where_am_i[0]=='blog')
28-
exit($this->get_field_db('message'));
28+
exit($this->database('message'));
2929
}
3030

3131
public function dashboard_config()
3232
{
3333
global $Language;
3434

3535
$html = Html::label( array('content'=>$Language->get('MESSAGE')) );
36-
$html .= Html::input( array('name'=>'message', 'type'=>'text', 'value'=>$this->get_field_db('message')) );
36+
$html .= Html::input( array('name'=>'message', 'type'=>'text', 'value'=>$this->database('message')) );
3737

3838
return $html;
3939
}

plugins/my_image/plugin.bit

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class PLUGIN_MY_IMAGE extends Plugin
2626

2727
// Caption
2828
$html = '<label>'.$Language->get('CAPTION').'</label>';
29-
$html .= '<input name="caption" type="text" value="'.$this->get_field_db('caption').'">';
29+
$html .= '<input name="caption" type="text" value="'.$this->database('caption').'">';
3030

3131
// Image
3232
$html .= '<input name="image" type="file">';
@@ -41,7 +41,7 @@ class PLUGIN_MY_IMAGE extends Plugin
4141
public function blog_body()
4242
{
4343
$html = '<ul>';
44-
$html .= '<li><img alt="'.$this->get_field_db('caption').'" src="'.HTML_PATH_PLUGINS_DB.'my_image/image.jpg" /></li>';
44+
$html .= '<li><img alt="'.$this->database('caption').'" src="'.HTML_PATH_PLUGINS_DB.'my_image/image.jpg" /></li>';
4545
$html .= '</ul>';
4646

4747
return $html;

plugins/open_graph/languages/en_US.bit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
$_PLUGIN_CONFIG['LANG'] = array(
4-
'NAME'=>'Open graph meta tags',
4+
'NAME'=>'Open Graph',
55
'DESCRIPTION'=>'Open graph meta tags.'
66
);
77

plugins/open_graph/languages/es_ES.bit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
$_PLUGIN_CONFIG['LANG'] = array(
4-
'NAME'=>'Open graph meta tags',
4+
'NAME'=>'Open Graph',
55
'DESCRIPTION'=>'Open graph meta tags.'
66
);
77

plugins/open_graph/plugin.bit

+13-10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class PLUGIN_OPEN_GRAPH extends Plugin
2121
global $settings;
2222
global $category;
2323
global $seo;
24+
global $tag;
2425

2526
$og = array(
2627
'locale'=>$settings['locale'],
@@ -29,7 +30,8 @@ class PLUGIN_OPEN_GRAPH extends Plugin
2930
'description'=>$seo['site_description'],
3031
'image'=>$settings['url'].HTML_PATH_ADMIN_TEMPLATES.'default/css/img/mrnibbler128.png',
3132
'url'=>BLOG_URL,
32-
'site_name'=>$seo['site_title']
33+
'site_name'=>$seo['site_title'],
34+
'tags'=>''
3335
);
3436

3537
// The theme has og:image ?
@@ -41,30 +43,31 @@ class PLUGIN_OPEN_GRAPH extends Plugin
4143
$og['type'] = 'article';
4244
$og['title'] .= ' - '.$post['title'];
4345
$og['description'] = $post['description'];
44-
$og['url'] = $settings['url'].$post['permalink'];
46+
$og['url'] = Url::post($post, true);
47+
48+
// tags
49+
$og['tags'] .= '<meta property="article:tag" content="'.$post['category'].'">'.PHP_EOL;
50+
foreach($post['tags'] as $tag)
51+
$og['tags'] .= '<meta property="article:tag" content="'.$tag.'">'.PHP_EOL;
4552
}
4653
elseif( ($where_am_i[1]=='page') && !empty($page) )
4754
{
4855
$og['type'] = 'article';
4956
$og['title'] .= ' - '.$page['title'];
5057
$og['description'] = $page['description'];
51-
$og['url'] = $settings['url'].$page['permalink'];
58+
$og['url'] = Url::page($page, true);
5259
}
5360
elseif( ($where_am_i[1]=='category') && !empty($category) )
5461
{
55-
$permalink = Url::category($category['slug']);
56-
5762
$og['type'] = 'article';
5863
$og['title'] .= ' - '.$category['name'];
59-
$og['url'] = $settings['url'].$permalink;
64+
$og['url'] = Url::category($category['slug'], true);
6065
}
6166
elseif( ($where_am_i[1]=='tag') && !empty($tag) )
6267
{
63-
$permalink = Url::tag($tag['slug']);
64-
6568
$og['type'] = 'article';
6669
$og['title'] .= ' - '.$tag;
67-
$og['url'] = $settings['url'].$permalink;
70+
$og['url'] = Url::tag($tag, true);
6871
}
6972

7073
$html = PHP_EOL.'<!-- Open Graph -->'.PHP_EOL;
@@ -75,7 +78,7 @@ class PLUGIN_OPEN_GRAPH extends Plugin
7578
$html .= '<meta property="og:image" content="'.$og['image'].'">'.PHP_EOL;
7679
$html .= '<meta property="og:url" content="'.$og['url'].'">'.PHP_EOL;
7780
$html .= '<meta property="og:site_name" content="'.$og['site_name'].'">'.PHP_EOL;
78-
$html .= '<link rel="canonical" href="'.$og['url'].'">'.PHP_EOL;
81+
$html .= $og['tags'];
7982

8083
return $html;
8184
}

plugins/sponsors/plugin.bit

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ class PLUGIN_SPONSORS extends Plugin
2525
global $Language;
2626

2727
$html = Html::label( array('content'=>$Language->get('SPONSOR_CODE')) );
28-
$html .= Html::textarea( array('name'=>'code', 'type'=>'text', 'content'=>$this->get_field_db('code')) );
28+
$html .= Html::textarea( array('name'=>'code', 'type'=>'text', 'content'=>$this->database('code')) );
2929

3030
return $html;
3131
}
3232

3333
public function blog_body()
3434
{
35-
$html = $this->get_field_db('code');
35+
$html = $this->database('code');
3636

3737
return $html;
3838
}

plugins/tag_cloud/plugin.bit

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ class PLUGIN_TAG_CLOUD extends Plugin
2525
global $Language;
2626

2727
$html = Html::label( array('content'=>$Language->get('MIN_SIZE_IN_PX')) );
28-
$html .= Html::input( array('name'=>'min_size', 'type'=>'text', 'value'=>$this->get_field_db('min_size')) );
28+
$html .= Html::input( array('name'=>'min_size', 'type'=>'text', 'value'=>$this->database('min_size')) );
2929

3030
$html .= Html::label( array('content'=>$Language->get('MAX_SIZE_IN_PX')) );
31-
$html .= Html::input( array('name'=>'max_size', 'type'=>'text', 'value'=>$this->get_field_db('max_size')) );
31+
$html .= Html::input( array('name'=>'max_size', 'type'=>'text', 'value'=>$this->database('max_size')) );
3232

3333
return $html;
3434
}
@@ -47,13 +47,13 @@ class PLUGIN_TAG_CLOUD extends Plugin
4747

4848
foreach($cloud as $tag=>$amount)
4949
{
50-
$amount = $amount + $this->get_field_db('min_size');
50+
$amount = $amount + $this->database('min_size');
5151

5252
// Max size 40px
53-
$size = min($amount, $this->get_field_db('max_size'));
53+
$size = min($amount, $this->database('max_size'));
5454

5555
// Min size 12px
56-
$size = max($size, $this->get_field_db('min_size'));
56+
$size = max($size, $this->database('min_size'));
5757

5858
$style = 'font-size:'.$size.'px; margin-right: 5px; display: inline-block;';
5959

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
$_PLUGIN_CONFIG['LANG'] = array(
4+
'NAME'=>'Twitter cards',
5+
'DESCRIPTION'=>'Twitter cards make it possible for you to attach media experiences to Tweets that link to your content.'
6+
);
7+
8+
?>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
$_PLUGIN_CONFIG['LANG'] = array(
4+
'NAME'=>'Twitter Cards',
5+
'DESCRIPTION'=>'Mejora el SEO de tu blog con Twitter Cards.'
6+
);
7+
8+
?>

0 commit comments

Comments
 (0)