Index: /extensions/GooglePlusOne/button.tpl
===================================================================
--- /extensions/GooglePlusOne/button.tpl (revision 16310)
+++ /extensions/GooglePlusOne/button.tpl (revision 16310)
@@ -0,0 +1,3 @@
+{combine_script id='google_plusone' path='https://apis.google.com/js/plusone.js'}
+
+
Index: /extensions/GooglePlusOne/main.inc.php
===================================================================
--- /extensions/GooglePlusOne/main.inc.php (revision 16309)
+++ /extensions/GooglePlusOne/main.inc.php (revision 16310)
@@ -28,19 +28,9 @@
'ro','ru','sr','sk','sl','es','sv','th','tr','uk','vi',
);
-
- $template->assign(array(
- 'GPLUS1_SIZE' => $conf['GooglePlusOne']['size'],
- 'GPLUS1_ANNO' => $conf['GooglePlusOne']['annotation'],
- ));
- if (script_basename() == 'picture')
+ // position for index
+ if (script_basename() == 'index')
{
- $template->assign('GPLUS1_POSITON', $conf['GooglePlusOne']['position']);
- $template->set_prefilter('picture', 'gplus1_add_button_prefilter');
- }
- else if (script_basename() == 'index')
- {
- $template->assign('GPLUS1_POSITON', 'index');
- $template->set_prefilter('index', 'gplus1_add_button_prefilter');
+ $conf['GooglePlusOne']['position'] = 'index';
}
@@ -50,7 +40,14 @@
if ($conf['GooglePlusOne']['size'] == 'tall' AND $conf['GooglePlusOne']['annotation'] == 'bubble')
{
- $template->assign('GPLUS1_SIZE', 'standard');
+ $conf['GooglePlusOne']['size'] = 'standard';
}
}
+
+ // config
+ $template->assign(array(
+ 'GPLUS1_SIZE' => $conf['GooglePlusOne']['size'],
+ 'GPLUS1_ANNO' => $conf['GooglePlusOne']['annotation'],
+ 'GPLUS1_POSITON' => $conf['GooglePlusOne']['position'],
+ ));
// button language
@@ -67,4 +64,21 @@
$template->assign('GPLUS1_LANG', 'en-GB');
}
+
+
+ $template->set_filename('gplus1_button', dirname(__FILE__).'/button.tpl');
+ $button = $template->parse('gplus1_button', true);
+
+ switch ($conf['GooglePlusOne']['position'])
+ {
+ case 'index':
+ $template->concat('PLUGIN_INDEX_ACTIONS', '
'.$button.'');
+ break;
+ case 'toolbar':
+ $template->concat('PLUGIN_PICTURE_ACTIONS', $button);
+ break;
+ default;
+ $template->assign('GPLUS1_BUTTON', $button);
+ $template->set_prefilter('picture', 'gplus1_add_button_prefilter');
+ }
}
@@ -73,26 +87,14 @@
global $template;
- $replace = '{combine_script id=\'google_plusone\' path=\'https://apis.google.com/js/plusone.js\'}
-
-';
-
switch ($template->get_template_vars('GPLUS1_POSITON'))
{
case 'top':
$search = '';
- $replace = '
'.$replace.'
';
+ $replace = '
{$GPLUS1_BUTTON}
';
break;
case 'bottom':
$search = '{$ELEMENT_CONTENT}';
- break;
-
- case 'toolbar':
- $search = '