<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sentido Web &#187; plugin</title>
	<atom:link href="http://sentidoweb.com/tag/plugin/feed" rel="self" type="application/rss+xml" />
	<link>http://sentidoweb.com</link>
	<description>Desarrollo web, HTML, CSS, Javascript, PHP, MySQL</description>
	<lastBuildDate>Tue, 10 Apr 2012 01:02:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Actualiza tu theme de WordPress desde SVN</title>
		<link>http://sentidoweb.com/2011/10/17/actualiza-tu-theme-de-wordpress-desde-svn.php</link>
		<comments>http://sentidoweb.com/2011/10/17/actualiza-tu-theme-de-wordpress-desde-svn.php#comments</comments>
		<pubDate>Mon, 17 Oct 2011 21:58:14 +0000</pubDate>
		<dc:creator>displaynone</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://sentidoweb.com/?p=2752</guid>
		<description><![CDATA[Si trabajas realizando proyectos en WordPress en el que el código se aloja en un servidor usando SVN, una forma sencilla de actualizar tu theme con los últimos cambios es mediante este sencillo y no-seguro plugin. El plugin añade una opción de menú al Settings del Dashboard de WP, el cual te servirá para indicar [...]]]></description>
			<content:encoded><![CDATA[<p>Si trabajas realizando proyectos en WordPress en el que el código se aloja en un servidor usando SVN, una forma sencilla de actualizar tu theme con los últimos cambios es mediante este sencillo y no-seguro plugin.</p>
<p>El plugin añade una opción de menú al Settings del Dashboard de WP, el cual te servirá para indicar el servidor SVN, usuario, contraseña y el path que corresponde a la carpeta <em>themes</em> de WP. El plugin se conectará al repositorio SVN y recuperará las carpetas que se encuentran en el path anterior y comprobará si las carpetas corresponden a themes instalados, mostrarás una lista con los themes encontrados junto a un botón que permite actualizar todo el theme.</p>
<p>Digo que no es seguro porque no controlo los permisos de los usuarios ni otras cuestiones, pero si estás interesado en ello supongo que no te costará mucho meterle mano al código:</p>
<pre><code><pre class="php"><span style="color: #808080; font-style: italic;">// Adding Admin menu</span>
<span style="color: #723b00;">if</span> <span style="color: #66cc66;">&#40;</span> is_admin<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
  add_action<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'admin_menu'</span>, <span style="color: #ff0000;">'svn_update_menu'</span><span style="color: #66cc66;">&#41;</span>;
  add_action<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'admin_init'</span>, <span style="color: #ff0000;">'svn_update_register_settings'</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> svn_update_register_settings<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  register_setting<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'svn_up_option-group'</span>, <span style="color: #ff0000;">'svn_username'</span> <span style="color: #66cc66;">&#41;</span>;
  register_setting<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'svn_up_option-group'</span>, <span style="color: #ff0000;">'svn_password'</span> <span style="color: #66cc66;">&#41;</span>;
  register_setting<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'svn_up_option-group'</span>, <span style="color: #ff0000;">'svn_repository'</span> <span style="color: #66cc66;">&#41;</span>;
  register_setting<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'svn_up_option-group'</span>, <span style="color: #ff0000;">'svn_theme_path'</span> <span style="color: #66cc66;">&#41;</span>;
  <span style="color: #723b00;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'page'</span><span style="color: #66cc66;">&#93;</span> == <span style="color: #ff0000;">'svn-update/svn-update.php'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #723b00;">require</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'phpsvnclient/phpsvnclient.php'</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #3E6D8F;">$phpsvnclient</span> = <span style="color: #000000; font-weight: bold;">new</span> phpsvnclient<span style="color: #66cc66;">&#40;</span>get_option<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'svn_repository'</span><span style="color: #66cc66;">&#41;</span>, get_option<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'svn_username'</span><span style="color: #66cc66;">&#41;</span>, get_option<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'svn_password'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #3E6D8F;">$files</span> = <span style="color: #3E6D8F;">$phpsvnclient</span>-&gt;<span style="color: #006600;">getDirectoryFiles</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'/'</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #3E6D8F;">$svn_themes</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #3E6D8F;">$themes</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #723b00;">foreach</span><span style="color: #66cc66;">&#40;</span>get_themes<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #723b00;">as</span> <span style="color: #3E6D8F;">$k</span>=&gt;<span style="color: #3E6D8F;">$t</span><span style="color: #66cc66;">&#41;</span> <span style="color: #3E6D8F;">$themes</span><span style="color: #66cc66;">&#91;</span><span style="color: #3E6D8F;">$t</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'Template'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$k</span>, <span style="color: #3E6D8F;">$t</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">"Template Dir"</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #723b00;">if</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/is_array"><span style="color: #000066;">is_array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$files</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      <span style="color: #723b00;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$files</span> <span style="color: #723b00;">as</span> <span style="color: #3E6D8F;">$f</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #723b00;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$f</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'type'</span><span style="color: #66cc66;">&#93;</span> == <span style="color: #ff0000;">'directory'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
          <span style="color: #723b00;">if</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #000066;">isset</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$themes</span><span style="color: #66cc66;">&#91;</span><span style="color: #3E6D8F;">$f</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'path'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #3E6D8F;">$svn_themes</span><span style="color: #66cc66;">&#91;</span><span style="color: #3E6D8F;">$f</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'path'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #3E6D8F;">$themes</span><span style="color: #66cc66;">&#91;</span><span style="color: #3E6D8F;">$f</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'path'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>;
        <span style="color: #66cc66;">&#125;</span>
      <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
    update_option<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'svn_themes'</span>, <span style="color: #3E6D8F;">$svn_themes</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #723b00;">if</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #000066;">isset</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'svn_update'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      <span style="color: #3E6D8F;">$path</span> = <span style="color: #3E6D8F;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'svn_update'</span><span style="color: #66cc66;">&#93;</span>;
      <span style="color: #3E6D8F;">$theme_path</span> = WP_CONTENT_DIR . <span style="color: #ff0000;">'/themes/'</span>;
      <span style="color: #3E6D8F;">$files</span> = <span style="color: #3E6D8F;">$phpsvnclient</span>-&gt;<span style="color: #006600;">getDirectoryFiles</span><span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$path</span><span style="color: #66cc66;">&#41;</span>;
      <span style="color: #723b00;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$files</span> <span style="color: #723b00;">as</span> <span style="color: #3E6D8F;">$f</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #723b00;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$f</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'type'</span><span style="color: #66cc66;">&#93;</span> == <span style="color: #ff0000;">'file'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
          file_put_contents<span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$theme_path</span>.<span style="color: #3E6D8F;">$f</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'path'</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #3E6D8F;">$phpsvnclient</span>-&gt;<span style="color: #006600;">getFile</span><span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$f</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'path'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
      <span style="color: #66cc66;">&#125;</span>
      add_action<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'admin_notices'</span>, <span style="color: #ff0000;">'showSVNUpdated'</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> showSVNUpdated<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;&lt;strong&gt;Theme updated&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;'</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> svn_update_menu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  add_options_page<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'SVN Update Options'</span>, <span style="color: #ff0000;">'SVN Update'</span>, <span style="color: #cc66cc;">8</span>, <span style="color: #000000; font-weight: bold;">__FILE__</span>, <span style="color: #ff0000;">'svn_update_options'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> svn_update_options<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;div <span style="color: #000000; font-weight: bold;">class</span>=<span style="color: #ff0000;">"wrap"</span>&gt;
&lt;h2&gt;SVN Update Options&lt;/h2&gt;
&lt;form method=<span style="color: #ff0000;">"post"</span> action=<span style="color: #ff0000;">"options.php"</span>&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> settings_fields<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'svn_up_option-group'</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;table <span style="color: #000000; font-weight: bold;">class</span>=<span style="color: #ff0000;">"form-table"</span>&gt;
 &lt;tr&gt;
     &lt;th scope=<span style="color: #ff0000;">"row"</span> valign=<span style="color: #ff0000;">"top"</span>&gt;Username&lt;/th&gt;
     &lt;td&gt;
         &lt;input id=<span style="color: #ff0000;">"svn_username"</span> name=<span style="color: #ff0000;">"svn_username"</span> value=<span style="color: #ff0000;">"&lt;?php echo get_option('svn_username'); ?&gt;"</span> type=<span style="color: #ff0000;">"text"</span>/&gt;
           &lt;label <span style="color: #723b00;">for</span>=<span style="color: #ff0000;">"svn_username"</span>&gt;Write your SVN username&lt;/label&gt;
     &lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
     &lt;th scope=<span style="color: #ff0000;">"row"</span> valign=<span style="color: #ff0000;">"top"</span>&gt;Password&lt;/th&gt;
     &lt;td&gt;
         &lt;input id=<span style="color: #ff0000;">"svn_username"</span> name=<span style="color: #ff0000;">"svn_password"</span> value=<span style="color: #ff0000;">"&lt;?php echo get_option('svn_password'); ?&gt;"</span> type=<span style="color: #ff0000;">"password"</span> /&gt;
           &lt;label <span style="color: #723b00;">for</span>=<span style="color: #ff0000;">"svn_password"</span>&gt;Write your SVN password&lt;/label&gt;
     &lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
     &lt;th scope=<span style="color: #ff0000;">"row"</span> valign=<span style="color: #ff0000;">"top"</span>&gt;Repository&lt;/th&gt;
     &lt;td&gt;
         &lt;input id=<span style="color: #ff0000;">"svn_username"</span> name=<span style="color: #ff0000;">"svn_repository"</span> value=<span style="color: #ff0000;">"&lt;?php echo get_option('svn_repository'); ?&gt;"</span> type=<span style="color: #ff0000;">"text"</span> /&gt;
           &lt;label <span style="color: #723b00;">for</span>=<span style="color: #ff0000;">"svn_reposotoy"</span>&gt;for example: &lt;em&gt;http:<span style="color: #808080; font-style: italic;">//domain.com/svn_path/project&lt;/em&gt;&lt;/label&gt;</span>
     &lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
     &lt;th scope=<span style="color: #ff0000;">"row"</span> valign=<span style="color: #ff0000;">"top"</span>&gt;Theme path&lt;/th&gt;
     &lt;td&gt;
         &lt;input id=<span style="color: #ff0000;">"svn_username"</span> name=<span style="color: #ff0000;">"svn_theme_path"</span> value=<span style="color: #ff0000;">"&lt;?php echo get_option('svn_theme_path'); ?&gt;"</span> type=<span style="color: #ff0000;">"text"</span> /&gt;
           &lt;label <span style="color: #723b00;">for</span>=<span style="color: #ff0000;">"svn_theme_path"</span>&gt;for example: &lt;em&gt;/trunk/my_project/themes&lt;/em&gt;&lt;/label&gt;
     &lt;/td&gt;
 &lt;/tr&gt;
&lt;/table&gt;
&lt;p <span style="color: #000000; font-weight: bold;">class</span>=<span style="color: #ff0000;">"submit"</span>&gt;
&lt;input type=<span style="color: #ff0000;">"submit"</span> <span style="color: #000000; font-weight: bold;">class</span>=<span style="color: #ff0000;">"button-primary"</span> value=<span style="color: #ff0000;">"&lt;?php _e('Save Changes') ?&gt;"</span> /&gt;
&lt;/p&gt;
&lt;/form&gt;
&lt;/div&gt;
&lt;h3&gt;Available Themes&lt;/h3&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> 
  <span style="color: #3E6D8F;">$themes</span> = get_option<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'svn_themes'</span><span style="color: #66cc66;">&#41;</span>; 
  <span style="color: #723b00;">if</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/empty"><span style="color: #000066;">empty</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$themes</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;p&gt;No themes found in SVN repository instaled in WordPress&lt;/p&gt;'</span>;
  <span style="color: #66cc66;">&#125;</span> <span style="color: #723b00;">else</span> <span style="color: #66cc66;">&#123;</span>
    <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;ul&gt;'</span>;
    <span style="color: #723b00;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$themes</span> <span style="color: #723b00;">as</span> <span style="color: #3E6D8F;">$k</span>=&gt;<span style="color: #3E6D8F;">$t</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;li&gt;/'</span>.<span style="color: #3E6D8F;">$k</span>.<span style="color: #ff0000;">' =&gt; '</span>.<span style="color: #3E6D8F;">$t</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">' &lt;a href=&quot;'</span>.admin_url<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'options-general.php?page=svn-update%2Fsvn-update.php&amp;svn_update=/'</span>.<span style="color: #3E6D8F;">$k</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">'&quot; class=&quot;button-primary&quot;&gt;Update&lt;/a&gt;&lt;/li&gt;'</span>;
    <span style="color: #66cc66;">&#125;</span>
    <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;/ul&gt;'</span>;
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #66cc66;">&#125;</span></pre></code></pre>
<p>Este plugin necesita la librería <a href="http://code.google.com/p/phpsvnclient/">PHP SVN Client</a> para acceder al SVN, tan solo hay que meterlo en el mismo directorio que el plugin. Le faltan muchas cosas al plugin, pero ni tengo ganas ni tengo tiempo.</p>]]></content:encoded>
			<wfw:commentRss>http://sentidoweb.com/2011/10/17/actualiza-tu-theme-de-wordpress-desde-svn.php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Añadir validaciones a Contact Form 7 en WordPress</title>
		<link>http://sentidoweb.com/2010/10/14/anadir-validaciones-a-contact-form-7-en-wordpress.php</link>
		<comments>http://sentidoweb.com/2010/10/14/anadir-validaciones-a-contact-form-7-en-wordpress.php#comments</comments>
		<pubDate>Thu, 14 Oct 2010 18:36:38 +0000</pubDate>
		<dc:creator>displaynone</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[contact form 7]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://sentidoweb.com/?p=2623</guid>
		<description><![CDATA[Contact Form 7 es uno de los plugins de WordPress más utilizados, ya que nos permite incluir formularios de contacto de forma sencilla en nuestros blogs. El problema viene cuando queremos añadir validaciones a los campos del formulario. Una forma sencilla, quizás haya un plugin que lo haga, es editar el functions.php y añadir un [...]]]></description>
			<content:encoded><![CDATA[<p>Contact Form 7 es uno de los plugins de WordPress más utilizados, ya que nos permite incluir formularios de contacto de forma sencilla en nuestros blogs. El problema viene cuando queremos añadir validaciones a los campos del formulario. Una forma sencilla, quizás haya un plugin que lo haga, es editar el functions.php y añadir un action al init que compruebe los valores de $_POST y devolver el JSON oportuno:</p>
<pre><code><pre class="php">&nbsp;
add_action<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'init'</span>, <span style="color: #ff0000;">'comprueba_form'</span>, <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// prioridad 1 para que actue antes que el plugin</span>
<span style="color: #000000; font-weight: bold;">function</span> comprueba_form<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <span style="color: #723b00;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'POST'</span> == <span style="color: #3E6D8F;">$_SERVER</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'REQUEST_METHOD'</span><span style="color: #66cc66;">&#93;</span> &amp;&amp; 
       <a href="http://www.php.net/isset"><span style="color: #000066;">isset</span></a><span style="color: #66cc66;">&#40;</span> <span style="color: #3E6D8F;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'_wpcf7_is_ajax_call'</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span> &amp;&amp; 
       <span style="color: #3E6D8F;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'_wpcf7'</span><span style="color: #66cc66;">&#93;</span> == <span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// _wpcf7 es el id del formulario para diferenciarlos</span>
    <span style="color: #808080; font-style: italic;">// comprobaciones</span>
    <span style="color: #723b00;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #3E6D8F;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'campo'</span><span style="color: #66cc66;">&#93;</span> != <span style="color: #ff0000;">'valor'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
      <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'{&quot;mailSent&quot;:false,&quot;into&quot;:&quot;#wpcf7-f2-p813-o1&quot;,&quot;captcha&quot;:null,&quot;message&quot;:&quot;El campo '</span>campo<span style="color: #ff0000;">' falla.&quot;,&quot;onSentOk&quot;:null}'</span>;
      <a href="http://www.php.net/exit"><span style="color: #000066;">exit</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></code></pre>]]></content:encoded>
			<wfw:commentRss>http://sentidoweb.com/2010/10/14/anadir-validaciones-a-contact-form-7-en-wordpress.php/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jStorage: plugin jQuery para usar el almacenamiento de HTML5</title>
		<link>http://sentidoweb.com/2010/04/13/jstorage-plugin-jquery-para-usar-el-almacenamiento-de-html5.php</link>
		<comments>http://sentidoweb.com/2010/04/13/jstorage-plugin-jquery-para-usar-el-almacenamiento-de-html5.php#comments</comments>
		<pubDate>Tue, 13 Apr 2010 15:23:52 +0000</pubDate>
		<dc:creator>displaynone</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[base datos]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[storage]]></category>

		<guid isPermaLink="false">http://sentidoweb.com/?p=2271</guid>
		<description><![CDATA[Si hace poco comentaba el tema de Web SQL Database de HTML5, ahora encuentro un plugin para jQuery que nos facilita esta labor. $.jStorage.set&#40;key, value&#41; value = $.jStorage.get&#40;key&#41; jStorage Vía / Script &#38; Style]]></description>
			<content:encoded><![CDATA[<p>Si hace poco comentaba el tema de <a href="http://sentidoweb.com/2010/02/15/html-5-web-sql-database.php">Web SQL Database de HTML5</a>, ahora encuentro un plugin para jQuery que nos facilita esta labor.</p>
<pre><code><pre class="javascript">$.<span style="color: #006600;">jStorage</span>.<span style="color: #006600;">set</span><span style="color: #66cc66;">&#40;</span>key, value<span style="color: #66cc66;">&#41;</span>
value = $.<span style="color: #006600;">jStorage</span>.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span>key<span style="color: #66cc66;">&#41;</span></pre></code></pre>
<p><a href="http://www.jstorage.info/">jStorage</a></p>
<p>Vía / <a href="http://scriptandstyle.com/submissions/jstorage-javascript-plugin-to-store-data-locally">Script &amp; Style</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sentidoweb.com/2010/04/13/jstorage-plugin-jquery-para-usar-el-almacenamiento-de-html5.php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AnythingSlider: plugin jQuery para crear slides</title>
		<link>http://sentidoweb.com/2009/08/21/anythingslider-plugin-jquery-para-crear-slides.php</link>
		<comments>http://sentidoweb.com/2009/08/21/anythingslider-plugin-jquery-para-crear-slides.php#comments</comments>
		<pubDate>Fri, 21 Aug 2009 20:00:00 +0000</pubDate>
		<dc:creator>displaynone</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[slider]]></category>

		<guid isPermaLink="false">http://sentidoweb.com/2009/08/21/anythingslider-plugin-jquery-para-crear-slides.php</guid>
		<description><![CDATA[AnythingSlider es un plugin jQuery que permite crear slides con cualquier elemento HTML. Permite ir hacia adelante y hacia atrás, enlaces a posiciones en concreto, autoplay, vueltas infinatas, &#8230; AnythingSlider jQuery Plugin]]></description>
			<content:encoded><![CDATA[<strong>AnythingSlider</strong> es un plugin jQuery que permite crear slides con cualquier elemento HTML. Permite ir hacia adelante y hacia atrás, enlaces a posiciones en concreto, autoplay, vueltas infinatas, &#8230;
<a href="http://css-tricks.com/anythingslider-jquery-plugin/">AnythingSlider jQuery Plugin</a>
]]></content:encoded>
			<wfw:commentRss>http://sentidoweb.com/2009/08/21/anythingslider-plugin-jquery-para-crear-slides.php/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>linkNotify: plugin jQuery que indica que se carga un enlace</title>
		<link>http://sentidoweb.com/2009/06/16/linknotify-plugin-jquery-que-indica-que-se-carga-un-enlace.php</link>
		<comments>http://sentidoweb.com/2009/06/16/linknotify-plugin-jquery-que-indica-que-se-carga-un-enlace.php#comments</comments>
		<pubDate>Wed, 17 Jun 2009 01:00:00 +0000</pubDate>
		<dc:creator>displaynone</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://sentidoweb.com/2009/06/16/linknotify-plugin-jquery-que-indica-que-se-carga-un-enlace.php</guid>
		<description><![CDATA[linkNotify es un plugin jQuery que permite modificar enlaces y mostrar un texto personalizado que indica que el enlace se está cargando. Algo que puede ser muy útil para aplicaciones en la que el usuario es algo básico y pincha y pincha en el enlace eternamente hasta que ve algún resultado sin esperar a que [...]]]></description>
			<content:encoded><![CDATA[<p><strong>linkNotify</strong> es un plugin jQuery que permite modificar enlaces y mostrar un texto personalizado que indica que el enlace se está cargando. Algo que puede ser muy útil para aplicaciones en la que el usuario es algo básico y pincha y pincha en el enlace eternamente hasta que ve algún resultado sin esperar a que cargue la primera vez.</p>
<pre><code><pre class="javascript">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'a'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">linkNotify</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'Espera mientras carga la pagina...'</span><span style="color: #66cc66;">&#41;</span>;</pre></code></pre>
<p><a href="http://briancray.com/2009/06/09/jquery-plugin-linknotify-inline-link-click-notification/">linkNotify</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sentidoweb.com/2009/06/16/linknotify-plugin-jquery-que-indica-que-se-carga-un-enlace.php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutoriales para crear plugins en jQuery</title>
		<link>http://sentidoweb.com/2009/03/13/tutoriales-para-crear-plugins-en-jquery.php</link>
		<comments>http://sentidoweb.com/2009/03/13/tutoriales-para-crear-plugins-en-jquery.php#comments</comments>
		<pubDate>Fri, 13 Mar 2009 20:30:00 +0000</pubDate>
		<dc:creator>displaynone</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[manual]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://sentidoweb.com/2009/03/13/tutoriales-para-crear-plugins-en-jquery.php</guid>
		<description><![CDATA[Lista de manuales/tutoriales que nos ayudan a realizar plugins para jQuery: Why Create A jQuery Plugin? Plugins/Authoring From jQuery.com Developing A jQuery Plugin jQuery Plugin Tutorial, In-Depth For Absolute Beginners Building jQuery Plugins The Definitive Guide to Creating a Practical jQuery Plugin How To Create A Plugin For jQuery Building Your First jQuery Plugin Learn [...]]]></description>
			<content:encoded><![CDATA[<p>Lista de manuales/tutoriales que nos ayudan a realizar plugins para jQuery:<p>
<ul><li><a href="http://james.padolsey.com/javascript/why-create-a-jquery-plugin/">Why Create A jQuery Plugin?</a></li>
<li><a href="http://docs.jquery.com/Plugins/Authoring">Plugins/Authoring From jQuery.com</a></li>
<li><a href="http://snook.ca/archives/javascript/jquery_plugin/">Developing A jQuery Plugin</a></li>
<li><a href="http://www.authenticsociety.com/blog/jQueryPluginTutorial_Beginner">jQuery Plugin Tutorial, In-Depth For Absolute Beginners</a></li>
<li><a href="http://webcloud.se/article/Building_jQuery_plugins">Building jQuery Plugins</a></li>
<li><a href="http://nettuts.com/tutorials/javascript-ajax/the-definitive-guide-to-creating-a-practical-jquery-plugin/" >The Definitive Guide to Creating a Practical jQuery Plugin</a></li>
<li><a href="http://yensdesign.com/2008/12/how-to-create-a-plugin-for-jquery/" >How To Create A Plugin For jQuery</a></li>
<li><a href="http://blog.jeremymartin.name/2008/02/building-your-first-jquery-plugin-that.html">Building Your First jQuery Plugin</a></li>
<li><a href="http://nettuts.com/javascript-ajax/learn-how-to-create-a-jquery-plugin/" >Learn How to Create a jQuery Plugin</a></li>
<li><a href="http://www.learningjquery.com/2007/10/a-plugin-development-pattern" >A Plugin Development Pattern</a></li></ul>
<p><a href="http://www.webresourcesdepot.com/jquery-plugin-development-10-tutorials-to-get-started/">jQuery Plugin Development &#8211; 10 Tutorials To Get Started</a></p>
<p>Vía / <a href="http://cssglobe.com/post/4444/-jquery-plugin-development-10-tutorials-to-get-started">CSS Globe</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sentidoweb.com/2009/03/13/tutoriales-para-crear-plugins-en-jquery.php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Definitive URL Sanitizer: plugin para WP que sanea las URLs</title>
		<link>http://sentidoweb.com/2009/02/27/the-definitive-url-sanitizer-plugin-para-wp-que-sanea-las-urls.php</link>
		<comments>http://sentidoweb.com/2009/02/27/the-definitive-url-sanitizer-plugin-para-wp-que-sanea-las-urls.php#comments</comments>
		<pubDate>Fri, 27 Feb 2009 16:20:00 +0000</pubDate>
		<dc:creator>displaynone</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[sanitizer]]></category>
		<category><![CDATA[url]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://sentidoweb.com/2009/02/27/the-definitive-url-sanitizer-plugin-para-wp-que-sanea-las-urls.php</guid>
		<description><![CDATA[Mi compañero David cansado de las URLs que genera WordPress (y quién no) ha creado un plugin que limpia las URLs de los posts de WP quitándole los caracteres &#8220;extraños&#8221;. WP deja las interrogaciones (¿), comillas (“ ”) y otros caracteres más que se sustituyen por su correspondiente código (%nn). Probado para UTF-8 y compatible [...]]]></description>
			<content:encoded><![CDATA[Mi compañero <a href="http://dmnet.bitacoras.com">David</a> cansado de las URLs que genera WordPress (y quién no) ha creado un plugin que limpia las URLs de los posts de WP quitándole los caracteres &#8220;extraños&#8221;.
WP deja las interrogaciones (¿), comillas (“ ”) y otros caracteres más que se sustituyen por su correspondiente código (%nn).
Probado para UTF-8 y compatible con WP2.7+
<a href="http://dmnet.bitacoras.com/archivos/wordpress/the-definitive-url-sanitizer.php">The Definitive URL Sanitizer </a>
]]></content:encoded>
			<wfw:commentRss>http://sentidoweb.com/2009/02/27/the-definitive-url-sanitizer-plugin-para-wp-que-sanea-las-urls.php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Preview de imágenes en enlaces con jQuery</title>
		<link>http://sentidoweb.com/2009/02/11/preview-de-imagenes-en-enlaces-con-jquery.php</link>
		<comments>http://sentidoweb.com/2009/02/11/preview-de-imagenes-en-enlaces-con-jquery.php#comments</comments>
		<pubDate>Thu, 12 Feb 2009 01:30:00 +0000</pubDate>
		<dc:creator>displaynone</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[imagen]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[preview]]></category>

		<guid isPermaLink="false">http://sentidoweb.com/2009/02/11/preview-de-imagenes-en-enlaces-con-jquery.php</guid>
		<description><![CDATA[Curioso y sencillo plugin de jQuery que permite crear previews de imágenes enlazadas en etiquetas &#60;a&#62; tanto directamente en el atributo href como en el rel. Permite añadir estilos, un contenedor e incluso eventos (onload, onhide, onshow). $&#40;'ul#fourth a'&#41;.imgPreview&#40;&#123; containerID: 'imgPreviewWithStyles', imgCSS: &#123; // Limit preview size: height: 200 &#125;, // When container is shown: [...]]]></description>
			<content:encoded><![CDATA[<p>Curioso y sencillo plugin de jQuery que permite crear previews de imágenes enlazadas en etiquetas &lt;a&gt; tanto directamente en el atributo <em>href</em> como en el <em>rel</em>. Permite añadir estilos, un contenedor e incluso eventos (onload, onhide, onshow).</p>
<p><img alt="imagepreview.png" src="http://sentidoweb.com/img/2009/02/imagepreview.png" width="400" height="284" class="center" /></p>
<pre><code><pre class="javascript">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'ul#fourth a'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">imgPreview</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>
containerID: <span style="color: #3366CC;">'imgPreviewWithStyles'</span>,
imgCSS: <span style="color: #66cc66;">&#123;</span>
<span style="color: #009900; font-style: italic;">// Limit preview size:</span>
height: <span style="color: #CC0000;">200</span>
<span style="color: #66cc66;">&#125;</span>,
<span style="color: #009900; font-style: italic;">// When container is shown:</span>
onShow: <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>link<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'&lt;span&gt;'</span> + $<span style="color: #66cc66;">&#40;</span>link<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">text</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #3366CC;">'&lt;/span&gt;'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">appendTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>,
<span style="color: #009900; font-style: italic;">// When container hides:</span>
onHide: <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>link<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'span'</span>, <span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">remove</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre></code></pre>
<p><a href="http://james.padolsey.com/javascript/new-jquery-plugin-imgpreview/">New jQuery plugin: ‘imgPreview’</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sentidoweb.com/2009/02/11/preview-de-imagenes-en-enlaces-con-jquery.php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial para crear un plugin jQuery</title>
		<link>http://sentidoweb.com/2009/01/07/tutorial-para-crear-un-plugin-jquery.php</link>
		<comments>http://sentidoweb.com/2009/01/07/tutorial-para-crear-un-plugin-jquery.php#comments</comments>
		<pubDate>Wed, 07 Jan 2009 20:55:10 +0000</pubDate>
		<dc:creator>displaynone</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://sentidoweb.com/2009/01/07/tutorial-para-crear-un-plugin-jquery.php</guid>
		<description><![CDATA[En varias ocasiones he mencionado plugins para jQuery, pero en esta ocasión se trata de cómo hacer un plugin para jQuery. Independientemente de la complejidad propia del plugin, crear un plugin para jQuery es bastante sencillo, y en el tutorial nos indican paso a paso cómo desarrollarlo: Primeros pasos Propiedades de configuración Constructor Métodos adicionales [...]]]></description>
			<content:encoded><![CDATA[<p>En varias ocasiones he mencionado plugins para jQuery, pero en esta ocasión se trata de cómo hacer un plugin para jQuery.</p>
<p>Independientemente de la complejidad propia del plugin, crear un plugin para jQuery es bastante sencillo, y en el tutorial nos indican paso a paso cómo desarrollarlo:</p>
<ul><li>Primeros pasos</li>
<li>Propiedades de configuración</li>
<li>Constructor</li>
<li>Métodos adicionales</li></ul>
<p><a href="http://nettuts.com/tutorials/javascript-ajax/the-definitive-guide-to-creating-a-practical-jquery-plugin/">The Definitive Guide to Creating a Practical jQuery Plugin</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sentidoweb.com/2009/01/07/tutorial-para-crear-un-plugin-jquery.php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Laboratorio: Feel the Comments plugin para WordPress</title>
		<link>http://sentidoweb.com/2008/11/06/laboratorio-feel-the-comments-plugin-para-wordpress.php</link>
		<comments>http://sentidoweb.com/2008/11/06/laboratorio-feel-the-comments-plugin-para-wordpress.php#comments</comments>
		<pubDate>Fri, 07 Nov 2008 02:00:00 +0000</pubDate>
		<dc:creator>displaynone</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[comentarios]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[feel]]></category>
		<category><![CDATA[feel the comments]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wp]]></category>

		<guid isPermaLink="false">http://sentidoweb.com/2008/11/06/laboratorio-feel-the-comments-plugin-para-wordpress.php</guid>
		<description><![CDATA[Ayer se lió una buena por lo de Mobuzz. Estuve leyendo todo lo que puso Javier Martín en su blog y los comentarios de la gente, que suelen ser muy interesantes. Había opiniones en contra, a favor y de todo tipo, y me hubiera gustado poder distinguir de que tipo era cada comentario de forma [...]]]></description>
			<content:encoded><![CDATA[<p>Ayer se lió una buena por lo de <a href="http://loogic.com/save-mobuzz-save-the-world/">Mobuzz</a>. Estuve leyendo todo lo que puso <a href="http://loogic.com">Javier Martín</a> en su blog y los comentarios de la gente, que suelen ser muy interesantes. Había opiniones en contra, a favor y de todo tipo, y me hubiera gustado poder distinguir de que tipo era cada comentario de forma rápida.</p>
<p>Por eso se me ocurrió hacer <strong>un plugin para WordPress en el que el comentarista pudiera indicar su estado de ánimo</strong>: en general o sobre el post en particular, según permita el administrador del blog.</p>
<p><img alt="feel_the_comments1.png" src="http://sentidoweb.com/img/2008/11/feel_the_comments1.png" width="450" height="307" class="center"/></p>
<p>Desde la administración de WP, se podrá indicar que estados de ánimo puede indicar el usuario. Para ello escribirá pares tipo:texto en una caja de texto, por ejemplo:</p>
<pre>:¿Cómo te sientes?
acuerdo:Estoy totalmente de acuerdo
desacuerdo:Va a ser que no
encanta:¡Me encanta!
pordios:¡¡Por Dios!!</pre>
<p>Como se puede ver el primer par no tiene el tipo de &#8220;sentimiento&#8221;, esto es así para poder dar la oportunidad a ser neutral en tu comentario. Hay que tener en cuenta que la opción por defecto es la primera.</p>
<p>Una vez que ya hemos instalado el plugin y lo hemos activado, tan solo tendremos que modificar la plantilla de comentarios para añadir el combo y para añadir un CSS que nos permita identificar cada estado de ánimo (el nombre del estilo corresponde al tipo de la lista anterior).</p>
<p>Para añadir el combo solo tendremos que añadir el siguiente código allá donde queramos, lo más lógico es antes del submit:</p>
<pre><code><pre class="php">&amp;lt;?php <span style="color: #723b00;">if</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/function_exists"><span style="color: #000066;">function_exists</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'feel_the_comments_draw_select'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> feel_the_comments_draw_select<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; ?&amp;gt;</pre></code></pre>
<p>Para añadir la clase tan solo será necesario incluir una llamada PHP, pero con la salvedad de que hay que hacerla después de recuperar el ID del comentario. Esto es debido a dos cosas: WP es un asco y yo no tenía ganas de buscar una solución mejor. WP permite añadir hooks que se ejecuten en los filtros y las acciones, a parte de que el código de WP es <del>una chapuza</del> un lío, las funcionalidades que ofrece no son todas las que yo necesitaba, o simplemente no encontraba cómo hacerlo. Un ejemplo del código sería el siguiente:</p>
<pre><code><pre class="php">&amp;lt;li  id=<span style="color: #ff0000;">"comment-&amp;lt;?php comment_ID() ?&amp;gt;"</span> <span style="color: #000000; font-weight: bold;">class</span>=<span style="color: #ff0000;">"&amp;lt;?php echo feel_the_comments_get_class(); ?&amp;gt;"</span>&amp;gt;</pre></code></pre>
<p>Como resultado tendremos un combo en el formulario de comentarios que nos permite elegir el tipo de sentimiento que queremos expresar:<p>
<p><img alt="feel_the_comments2.png" src="http://sentidoweb.com/img/2008/11/feel_the_comments2.png" width="450" height="356" class="center" /></p>
<p>Y también unos comentarios con diferentes estilos según el sentimiento general que quieran expresar. Yo no le he dado muchas vueltas y he añadido el color negro para indicar el &#8220;¡Por Dios!&#8221;, el azul para &#8220;Estoy de acuerdo&#8221;, el verde para &#8220;Me encanta&#8221; y el gris para &#8220;No estoy de acuerdo&#8221;, el resto irían sin estilo propio.</p>
<p><img alt="feel_the_comments3.png" src="http://sentidoweb.com/img/2008/11/feel_the_comments3.png" width="388" height="746" class="center" /></p>
<p>Como he dicho antes, no es un plugin perfecto ya que WP me desespera y no tenía demasiadas ganas de ser perfeccionista, así que si alguien quiere mejorarlo, por mi perfecto.</p>
<p>Descarga: <a href="http://sentidoweb.com/lab/plugins/wp/feel_the_comments.zip">Feel the Comments</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sentidoweb.com/2008/11/06/laboratorio-feel-the-comments-plugin-para-wordpress.php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

