mirror of
https://github.com/typecho/plugins.git
synced 2024-12-21 20:40:08 +08:00
Merge pull request #10 from mutoo/master
Add MathJax plugin and fix a bug of GoogleAnalytics
This commit is contained in:
commit
87a64748c7
@ -63,6 +63,6 @@ class GoogleAnalytics_Plugin implements Typecho_Plugin_Interface
|
||||
public static function render()
|
||||
{
|
||||
$account = Typecho_Widget::widget('Widget_Options')->plugin('GoogleAnalytics')->account;
|
||||
echo "<script type=\"text/javascript\">var _gaq = _gaq || [];_gaq.push(['_setAccount', '{$account}}']);_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();</script>";
|
||||
echo "<script type=\"text/javascript\">var _gaq = _gaq || [];_gaq.push(['_setAccount', '{$account}']);_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();</script>";
|
||||
}
|
||||
}
|
63
MathJax.php
Normal file
63
MathJax.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* MathJax
|
||||
*
|
||||
* @package MathJax
|
||||
* @author mutoo
|
||||
* @version 1.0.0
|
||||
* @link http://blog.mutoo.im/mathjax-plugin.html
|
||||
*/
|
||||
class MathJax implements Typecho_Plugin_Interface
|
||||
{
|
||||
/**
|
||||
* 激活插件方法,如果激活失败,直接抛出异常
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @throws Typecho_Plugin_Exception
|
||||
*/
|
||||
public static function activate()
|
||||
{
|
||||
Typecho_Plugin::factory('Widget_Archive')->footer = array('MathJax', 'footer');
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁用插件方法,如果禁用失败,直接抛出异常
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @return void
|
||||
* @throws Typecho_Plugin_Exception
|
||||
*/
|
||||
public static function deactivate()
|
||||
{}
|
||||
|
||||
/**
|
||||
* 获取插件配置面板
|
||||
*
|
||||
* @access public
|
||||
* @param Typecho_Widget_Helper_Form $form 配置面板
|
||||
* @return void
|
||||
*/
|
||||
public static function config(Typecho_Widget_Helper_Form $form){}
|
||||
|
||||
/**
|
||||
* 个人用户的配置面板
|
||||
*
|
||||
* @access public
|
||||
* @param Typecho_Widget_Helper_Form $form
|
||||
* @return void
|
||||
*/
|
||||
public static function personalConfig(Typecho_Widget_Helper_Form $form){}
|
||||
|
||||
/**
|
||||
* 输出尾部js
|
||||
*
|
||||
* @access public
|
||||
* @param unknown $footer
|
||||
* @return unknown
|
||||
*/
|
||||
public static function footer() {
|
||||
echo '<script type="text/x-mathjax-config">MathJax.Hub.Config({tex2jax: {inlineMath: [[\'$\',\'$\'], [\'\\\\(\',\'\\\\)\']]}});</script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>';
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user