コード例 #1
0
    def activate(self,iname,active):
        if active:
            logging.debug("$$$$$$$$$$$$$$$$$$$$$")
            logging.debug(iname)
            plugin=self.getPluginByName(iname)
            logging.debug("$$$$$$$$$$$$$$$$$$$$$")
            logging.debug(str(plugin)+"###"+iname)
            if plugin:
                if (iname not in self.active_list):
                    self.active_list.append(iname)
                    OptionSet.setValue("PluginActive",self.active_list)
                plugin.active=active
                #add filter
                for k,v in plugin._filter.items():
                    if self._filter_plugins.has_key(k):
                        if not v in self._filter_plugins[k]:
                            self._filter_plugins[k].append(v)
                #add action
                for k,v in plugin._action.items():
                    if self._action_plugins.has_key(k):
                        if not v in self._action_plugins[k]:
                            self._action_plugins[k].append(v)
                #if self.blog.application:
                #    self.add_urlhandler(plugin,self.blog.application)
                if hasattr(self.plugin_util, 'addUrlHandler'):
                    self.add_urlhandlers(plugin)

        else:
            plugin=self.getPluginByName(iname)
            if plugin:
                if (iname in self.active_list):
                    self.active_list.remove(iname)
                    OptionSet.setValue("PluginActive",self.active_list)
                plugin.active=active
                #remove filter
                for k,v in plugin._filter.items():
                    if self._filter_plugins.has_key(k):
                        if v in self._filter_plugins[k]:
                            self._filter_plugins[k].remove(v)
                #remove action
                for k,v in plugin._action.items():
                    if self._action_plugins.has_key(k):
                        if v in self._action_plugins[k]:
                            self._action_plugins[k].remove(v)
                #if self.blog.application:
                #    self.remove_urlhandler(plugin,self.blog.application)
                if hasattr(self.plugin_util, 'addUrlHandler'):
                    self.remove_urlhandlers(plugin)
        self._urlmap={}
        self._setupmenu=[]
コード例 #2
0
 def __init__(self,blog=None):
     self.blog = configs.get_g_blog()
     self.plugin_util = plugin_util
     self.list={}
     self._filter_plugins={}
     self._action_plugins={}
     self._urlmap={}
     self._handlerlist={}
     self._setupmenu=[]
     pi=PluginIterator()
     self.active_list=OptionSet.getValue("PluginActive",[])
     for v,m in pi:
         logging.debug('###########################')
         logging.debug(str((v, m)))
         #try:
         if 1:
             #import plugins modules
             mod=__import__(m,globals(),locals(),[v])
             plugin=getattr(mod,v)()
             #internal name
             plugin.iname=v
             plugin.active=v in self.active_list
             plugin.blog=self.blog
             self.list[v]=plugin
             if plugin.active:
                 self.add_urlhandlers(plugin)
         #except:
         if 0:
             logging.debug('###########################')
             import sys
             #import traceback
             logging.debug(str(sys.exc_info()))
             #logging.debug(traceback.print_stack(sys.exc_info()[2]))
             pass
     logging.debug(self.list.keys())
コード例 #3
0
	def GET(self,page):
		code=OptionSet.getValue("googleAnalytics_code",default="")
		return '''<h3>Google Anslytics</h3>
					<form action="" method="post">
					<p>Analytics Code:</p>
					<textarea name="code" style="width:500px;height:100px">%s</textarea>
					<br>
					<input type="submit" value="submit">
					</form>'''%code
コード例 #4
0
	def __init__(self):
		Plugin.__init__(self,__file__)
		self.author="xuming"
		self.authoruri="http://xuming.net"
		self.uri="http://xuming.net"
		self.description="HighSyntax Plugin."
		self.name="HighSyntax plugin"
		self.version="0.1"
		self.register_filter('footer',self.footer)
		self.register_urlzip('/syntaxhighlighter/(.*)','syntaxhighlighter.zip')
		self.theme=OptionSet.getValue("highsyntax_theme",default="Default")
コード例 #5
0
	def POST(self,page):
		self.theme=page.param("theme")
		OptionSet.setValue("highsyntax_theme",self.theme)
		return self.GET(page)
コード例 #6
0
	def POST(self,page):
		code=page.param("code")
		OptionSet.setValue("googleAnalytics_code",code)
		return self.get(page)
コード例 #7
0
	def filter(self,content,*arg1,**arg2):
		code=OptionSet.getValue("googleAnalytics_code",default="")
		return content+str(code)