<?xml version="1.0"?>
     <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
     <channel>
      <link>http://www.bitacora.gesbit.com/</link>
      <title>Bitácora de Gesbit - Entrada "Típico plugin "filtro" en Gesbit III" de la bitácora</title>
      <generator>Gesbit</generator>
      <description>Bitácora del gestor de bitácoras Gesbit</description>
      <atom:link href="http://www.bitacora.gesbit.com/rss/" rel="self"
       type="application/rss+xml" />
    
      <item>
       <link>http://www.bitacora.gesbit.com/tipico-plugin-filtro-en-gesbit-iii/</link>
       <guid>http://www.bitacora.gesbit.com/tipico-plugin-filtro-en-gesbit-iii/</guid>
       <pubDate>Fri, 01 Aug 2008 21:22:07 +0200</pubDate>
       <title><![CDATA[ Típico plugin "filtro" en Gesbit III ]]></title>
       <description><![CDATA[<p>Tercera parte de las entradas dedicadas a un típico plugin "filtro" para Gesbit. Y es que, <a title="Entrada en esta bitácora" href="http://www.bitacora.gesbit.com/al-hilo-del-plugin-gbdefensio/">al hilo</a> del <a title="Entrada en esta bitácora" href="http://www.bitacora.gesbit.com/plugin-gbdefensio-para-gesbit/">plugin GbDefensio</a>, se pueden apreciar ciertas mejoras, por decirlo así. Recuerda la <a title="Entrada en esta bitácora" href="http://www.bitacora.gesbit.com/tipico-plugin-filtro-en-gesbit/">primera parte de estas entradas</a>, donde mostré el plugin, y la entrada en que <a title="Entrada en esta bitácora" href="http://www.bitacora.gesbit.com/tipico-plugin-filtro-en-gesbit-ii/">lo describí línea por línea</a>. Recuérdalas, digo, y, compara el código que se muestra en ellas con este que te presento ahora, ya sabes, perteneciente al <a title="Plugins para el gestor de bitácoras Gesbit" href="http://www.gesbit.com/plugins.php">plugin GbMarkdown</a> de Gesbit.</p><div class="gbhighlighcode"><div class="sourcecode"><pre class="php"><span style="color: #000000; font-weight: bold;">class</span> GbMarkdown <span style="color: #000000; font-weight: bold;">extends</span> GbPlugin 
<span style="color: #66cc66;">&#123;</span>  
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> OnActivatePlugin<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> OnDeactivatePlugin<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> FilterCallback<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$filterID</span>, <span style="color: #0000ff;">$content</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$filterID</span> == GBPLUGINS_FILTER_POST_CONTENT<span style="color: #66cc66;">&#41;</span> 
     &amp;&amp; <a href="http://www.php.net/is_readable"><span style="color: #000066;">is_readable</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">GetDirPScriptsPath</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.GBMARKDOWN_MAIN_SCRIPT<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
       <span style="color: #b1b100;">require_once</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">GetDirPScriptsPath</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.GBMARKDOWN_MAIN_SCRIPT<span style="color: #66cc66;">&#41;</span>;
       <span style="color: #b1b100;">return</span> Markdown<span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/html_entity_decode"><span style="color: #000066;">html_entity_decode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$content</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$content</span>;
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>
<p>Así como ves es como luce el código fuente del plugin GbDefensio, la clase principal que lo conforma. Este es uno de los más o menos típicos plugins que hacen uso de un determinado filtro de Gesbit, de modo que actúan sobre cierto contenido, antes de que este se presente al usuario. ¿Es necesario que describa línea por línea el código fuente? Yo diría que no, ¿y tú?</p>]]></description>
      </item>
      
     </channel>
    </rss>