<?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>eventuAlo.net » blog &#187; Wordpress</title>
	<atom:link href="http://www.eventualo.net/blog/category/script/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.eventualo.net/blog</link>
	<description>un blog vario ed eventualo</description>
	<lastBuildDate>Thu, 09 Feb 2012 14:45:59 +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>Aggiungere rapidamente un effetto thickbox alle immagini del blog</title>
		<link>http://www.eventualo.net/blog/2010/10/aggiungere-rapidamente-un-effetto-thickbox-alle-immagini-del-blog/</link>
		<comments>http://www.eventualo.net/blog/2010/10/aggiungere-rapidamente-un-effetto-thickbox-alle-immagini-del-blog/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 16:42:20 +0000</pubDate>
		<dc:creator>alo</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[thickbox]]></category>

		<guid isPermaLink="false">http://www.eventualo.net/blog/?p=1005</guid>
		<description><![CDATA[L&#8217;installazione base di WordPress include già diverse librerie javascript per la realizzazione di effetti vari. Se vuoi attivare rapidamente l&#8217;effetto thickbox sulle immagini del tuo blog puoi precedere come spiego di seguito. Questo è un sistema molto semplice e spartano e serve solo per la presentazione delle immagini nel sito pubblico. Se invece desideri qualcosa [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="Esempio di effetto thickbox" src="http://www.eventualo.net/gallery/2010_11_18_thickbox.png" title="Esempio di effetto thickbox" class="alignnone" width="445" height="216" /></p>
<p>L&#8217;installazione base di WordPress include già diverse librerie javascript per la realizzazione di effetti vari.<br />
Se vuoi attivare rapidamente l&#8217;effetto <a href="http://jquery.com/demo/thickbox/">thickbox</a> sulle immagini del tuo blog puoi precedere come spiego di seguito.<br />
<span id="more-1005"></span><br />
Questo è un sistema molto semplice e spartano e serve solo per la presentazione delle immagini nel sito pubblico. Se invece desideri qualcosa di più curato e versatile per la gestione delle gallerie ti consiglio di cercare un <a href="http://wordpress.org/extend/plugins/search.php?q=gallery">plugin</a> tra i tantissimi disponibili.<br />
Per questi appunti mi sono basato su questo <a href="http://www.openparenthesis.org/2010/09/10/jquery-thickbox-wordpress">tutorial su www.openparenthesis.org</a>.</p>
<p>Apri il file <strong>header.php</strong> del tuo tema: inserisci le seguenti righe <em>prima</em> della funzione <em>wp_head()</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
wp_enqueue_style<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thickbox'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// inserting style sheet for Thickbox.</span>
wp_enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'jquery'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// including jquery.</span>
wp_enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thickbox'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// including Thickbox javascript.</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Poi, sempre nella cartella del tuo tema, apri il file <strong>footer.php</strong> e inserisci il seguente javascript dopo la funzione <em>wp_head()</em> (dovrebbe funzionare se inserita anche nel <strong>footer.php</strong>, prima del tag <em>&lt;/body&gt;</em>):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">'text/javascript'</span><span style="color: #339933;">&gt;</span>
	<span style="color: #003366; font-weight: bold;">var</span> $tk <span style="color: #339933;">=</span> jQuery.<span style="color: #660066;">noConflict</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   	$tk<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #009966; font-style: italic;">/* Per le immagini delle gallery */</span>
		$tk<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;img.attachment-thumbnail&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;thickbox&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		$tk<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;img.attachment-thumbnail&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'rel'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'gallery'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009966; font-style: italic;">/* Per le immagini inserite nel post */</span>
		$tk<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.entry-content a img&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a[href*=&lt;?php echo $_SERVER['SERVER_NAME']?&gt;]&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;thickbox&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		$tk<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.entry-content a img&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a[href*=&lt;?php echo $_SERVER['SERVER_NAME']?&gt;]&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'rel'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'gallery'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Il codice è abbastanza auto-esplicativo, ma vediamo velocemente il significato delle diverse righe. La riga <strong>2</strong> richiama la modalità <em>noConflict</em> di jQuery per evitare eventuali problemi con altri plugin. Le righe <strong>5</strong> e <strong>6</strong> e le righe <strong>8</strong> e <strong>9</strong> creano dinamicamente gli attributi nei tag <em>&lt;a&gt;</em> necessari per il funzionamento del thickbox, rispettivamente nelle immagini delle gallerie e nelle immagini inserite direttamente del post. Nelle righe 8 e 9 poi è bene aggiungere una clausola sull&#8217;attributo <em>href</em> del collegamento: il thickbox si apre solo per le immagini che risiedono sul nostro sito, per gli altri indirizzi apre semplicemente l&#8217;url.</p>
<p>Oppure, se usi le immagini in evidenza dei post o altri plugin che includono nelle pagine d&#8217;archivio le thumbnail con link all&#8217;articolo, allora potresti aver la necessità di aprire una immagine in un thickbox solo se il link è diretto a una immagine (jpg o png) e non a un&#8217;altra pagina. Sostituisci le righe <strong>8</strong> e <strong>9</strong> con le seguenti:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>8
9
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">		$tk<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.entry-content a img&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a[href*=jpg]&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;a[href*=png]&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;thickbox&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		$tk<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.entry-content a img&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a[href*=jpg]&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;a[href*=png]&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'rel'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'gallery'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Ricordati di modificare le due classi <strong>.attachment-thumbnail</strong> (righe 5-6) e <strong>.entry-content</strong> (righ 8-9) sulla base del codice sorgente del tuo tema. Ogni versione di WordPress e ogni tema potrebbero dare origine a classi diverse nella pubblicazione: guarda il codice sorgente della pagina del tuo blog per trovarle.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eventualo.net/blog/2010/10/aggiungere-rapidamente-un-effetto-thickbox-alle-immagini-del-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Un plugin di WordPress contro la legge Bavaglio</title>
		<link>http://www.eventualo.net/blog/2010/08/un-plugin-di-wordpress-contro-la-legge-bavaglio/</link>
		<comments>http://www.eventualo.net/blog/2010/08/un-plugin-di-wordpress-contro-la-legge-bavaglio/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 14:34:15 +0000</pubDate>
		<dc:creator>alo</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[legge bavaglio]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.eventualo.net/blog/?p=912</guid>
		<description><![CDATA[Ho appena pubblicato un mio plugin di WordPress contro la orribile legge Bavaglio. Le principali funzioni sono: mostrare un modulo laterale (widget) con la dichiarazione “questo blog è contro la legge bavaglio” e una serie di link a informazioni e petizioni; fornire al blogger uno strumento per una generazione “automatica” e una programmazione nel tempo [...]]]></description>
			<content:encoded><![CDATA[<p>Ho appena pubblicato un <a href="http://www.eventualo.net/blog/wordpress-plugin-against-gag-law/" title="Plugin per WordPress contro la Legge Bavaglio" >mio plugin di WordPress</a> contro la orribile <strong>legge Bavaglio</strong>.</p>
<p>Le principali funzioni sono:</p>
<ul>
<li>mostrare un modulo laterale (widget) con la dichiarazione “questo blog è contro la legge bavaglio” e una serie di link a informazioni e petizioni;</li>
<li>fornire al blogger uno strumento per una generazione “automatica” e una programmazione nel tempo delle rettifiche;</li>
<li>la possibilità per il visitatore del blog di nascondere tutte le rettifiche e avere una navigazione più agevole tra i soli articoli originali.</li>
</ul>
<p>Per saperne di più e soprattutto per scaricarlo e installarlo sul tuo blog vai alla <a href="http://www.eventualo.net/blog/wordpress-plugin-against-gag-law/" title="Plugin per WordPress contro la Legge Bavaglio" >pagina del plugin</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eventualo.net/blog/2010/08/un-plugin-di-wordpress-contro-la-legge-bavaglio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alo ExportXls: plugin per WordPress per generare file XLS dal db</title>
		<link>http://www.eventualo.net/blog/2009/10/alo-exportxls-plugin-per-wordpress-per-generare-file-xls-dal-db/</link>
		<comments>http://www.eventualo.net/blog/2009/10/alo-exportxls-plugin-per-wordpress-per-generare-file-xls-dal-db/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 19:56:44 +0000</pubDate>
		<dc:creator>alo</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[exportxls]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.eventualo.net/blog/?p=400</guid>
		<description><![CDATA[[english version] Pubblico un plugin per WordPress che serve per generare file XLS (MS Excel / OpenOffice Calc) a partire dal database del blog. Per maggiori informazioni vi rimando alla pagina sul sito Worpress.org. Attenzione! A causa di  altri impegni non ci sarà ulteriore sviluppo del plugin. Caratteristiche può scegliere quale tabella esportare (articoli, utenti, [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Alo EasyMail: plugin per WordPress per inviare e-mail" href="http://www.eventualo.net/blog/?p=400#english">[english version]</a></p>
<p>Pubblico un plugin per WordPress che serve per generare file XLS (MS Excel / OpenOffice Calc) a partire dal database del blog.<br />
<span id="more-400"></span>Per maggiori informazioni vi rimando alla pagina sul sito Worpress.org.</p>
<p><em><strong><span style="color: #ff0000;">Attenzione! A causa di  altri impegni non ci sarà ulteriore sviluppo del plugin.</span><br />
</strong></em></p>
<p><strong>Caratteristiche</strong></p>
<ul>
<li>può scegliere quale tabella esportare (articoli, utenti, link, commenti)</li>
<li>nel caso di articoli e utenti può esportare anche i relativi meta</li>
</ul>
<p><strong>Screenshot</strong></p>
<p>» <a title="vedi" href="http://wordpress.org/extend/plugins/alo-exportxls/screenshots/" target="_blank">Schermata dell’amministrazione di ExportXls</a></p>
<p><strong>Download</strong></p>
<p>» <a title="scarica" href="http://wordpress.org/extend/plugins/alo-exportxls/" target="_blank">Scarica Alo ExportXls</a> (dal sito WordPress.org)</p>
<p><a name="english">-</a></p>
<p><span style="color: #333399;"><strong> </strong></span></p>
<p>This plugin for WordPress lets you to generate XLS files (MS Excel / OpenOffice Calc) from WP database&#8217;s tables. For more info please visit its page on WordPress.org.</p>
<p><span style="color: #ff0000;"><em><strong>Warning! Due to more relevant commitments this plugin will not be further developed.</strong></em></span></p>
<p><strong>Features</strong></p>
<ul>
<li>you can select the table to export (users, posts, comments, links)</li>
<li>&#8216;posts&#8217; and &#8216;users&#8217; choises can include meta data too</li>
</ul>
<p><strong>Screenshot</strong></p>
<p>» <a title="vedi" href="http://wordpress.org/extend/plugins/alo-exportxls/screenshots/" target="_blank">View of ExportXls&#8217;s administration</a></p>
<p><strong>Download</strong></p>
<p>» <a title="scarica" href="http://wordpress.org/extend/plugins/alo-exportxls/" target="_blank">Download Alo ExportXls</a> (from WordPress.org)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eventualo.net/blog/2009/10/alo-exportxls-plugin-per-wordpress-per-generare-file-xls-dal-db/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Modifica al plugin Surveys</title>
		<link>http://www.eventualo.net/blog/2009/09/modifica-al-plugin-surveys/</link>
		<comments>http://www.eventualo.net/blog/2009/09/modifica-al-plugin-surveys/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 09:26:41 +0000</pubDate>
		<dc:creator>alo</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[surveys]]></category>

		<guid isPermaLink="false">http://www.eventualo.net/blog/?p=337</guid>
		<description><![CDATA[Ho utilizzato il plugin Surveys per WordPress (indirizzo: www.bin-co.com/tools/wordpress/plugins/surveys/): per gestire questionari e relativi risultati. Davvero utile e ben fatto. Però avevo la necessità di un pulsante &#8220;clona questionario&#8221; in modo da duplicare rapidamente un questionario (e le relative domande) senza dover reinserirle nuovamente. La mia esigenza nasceva da una serie di sondaggi per la [...]]]></description>
			<content:encoded><![CDATA[<p>Ho utilizzato il plugin <strong>Surveys</strong> per WordPress (indirizzo: <a title="vai al sito" href="http://www.bin-co.com/blog/2008/11/surveys-wordpress-plugin/" target="_blank">www.bin-co.com/tools/wordpress/plugins/surveys/</a>): per gestire questionari e relativi risultati. Davvero utile e ben fatto.</p>
<p>Però avevo la necessità di un pulsante &#8220;clona questionario&#8221; in modo da duplicare rapidamente un questionario (e le relative domande) senza dover reinserirle nuovamente. La mia esigenza nasceva da una serie di sondaggi per la <em>customer satisfaction</em> tutti uguali.</p>
<p><span id="more-337"></span></p>
<p>Ecco il codice da aggiungere in due files. Sto utilizzando la versione 1.01.2, ma forse può andare anche per l&#8217;ultima versione (attualmente la 1.01.3).</p>
<p>In <strong>survey.php</strong>:</p>
<p>- prima della linea 9 (prima di: &#8220;if($_REQUEST['action'] == &#8216;delete&#8217;)&#8221;) aggiunto un messaggio di feedback:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>8
9
10
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'cloned'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">'&lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;&lt;p&gt;'</span> <span style="color: #339933;">.</span> t<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Survey cloned (ID &lt;strong&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span>survey<span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> t<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;/strong&gt;). Maybe you have to rename it (action &lt;strong&gt;Edit&lt;/strong&gt;).'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/p&gt;&lt;/div&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>- alla linea 37 modificato il <em>colspan</em> della cella (da 3 a 4):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>37
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">th</span> <span style="color: #000066;">scope</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;col&quot;</span> <span style="color: #000066;">colspan</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;4&quot;</span>&gt;&lt;?php e<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Action'</span><span style="color: #66cc66;">&#41;</span> ?&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">th</span>&gt;</span></pre></td></tr></table></div>

<p>- dopo la linea 63 (dopo il pulsante elimina) aggiunta una cella con il nuovo pulsante Clona:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>64
65
66
67
68
69
70
71
72
73
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;">	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
         <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php echo $wpframe_plugin_folder?&gt;</span></span>/survey_action.php&quot; method=&quot;post&quot; style=&quot;display: inline;&quot;&gt;
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span>&gt;</span>
            <span style="color: #009900;">&lt;?php wp_nonce_field<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'surveys_create_edit_survey'</span><span style="color: #66cc66;">&#41;</span>; ?&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;survey&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;survey&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php echo $survey-&gt;</span></span>ID?&gt;&quot; type=&quot;hidden&quot;&gt;
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;survey&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;action&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;clone&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span>&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Clone&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span>&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
            <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span></pre></td></tr></table></div>

<p>In <strong>survey_action.php</strong>:</p>
<p>- prima della linea 14 (prima di <em>else</em>) aggiunto un <em>else if</em> con il caso <em>clona</em>:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'clone'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #666666; font-style: italic;">// original survey</span>
        <span style="color: #000088;">$template_id_survey</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'survey'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Cloning survey</span>
        <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO <span style="color: #006699; font-weight: bold;">{$wpdb-&gt;prefix}</span>surveys_survey (name, description, final_screen, status, added_on, type, max_attempts, min_rate)
        SELECT CONCAT('COPIA DI ', name, ' &quot;</span><span style="color: #339933;">.</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span>His<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'), description, final_screen, status, NOW(), type, max_attempts, min_rate FROM <span style="color: #006699; font-weight: bold;">{$wpdb-&gt;prefix}</span>surveys_survey WHERE ID = <span style="color: #009933; font-weight: bold;">%d</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$template_id_survey</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$clone_id_survey</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">insert_id</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Cloning questions</span>
        <span style="color: #000088;">$template_questions</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_results</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT ID FROM <span style="color: #006699; font-weight: bold;">{$wpdb-&gt;prefix}</span>surveys_question WHERE survey_id=<span style="color: #009933; font-weight: bold;">%d</span> ORDER BY ID ASC&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$template_id_survey</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$template_questions</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$template_quest</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO <span style="color: #006699; font-weight: bold;">{$wpdb-&gt;prefix}</span>surveys_question (survey_ID, question, allow_user_answer, allow_multiple_answers)
        SELECT <span style="color: #006699; font-weight: bold;">$clone_id_survey</span>, question, allow_user_answer, allow_multiple_answers FROM <span style="color: #006699; font-weight: bold;">{$wpdb-&gt;prefix}</span>surveys_question WHERE ID = <span style="color: #009933; font-weight: bold;">%d</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$template_quest</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$justclone_id_quest</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">insert_id</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">// Cloning answers</span>
            <span style="color: #000088;">$template_answers</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_results</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT ID FROM <span style="color: #006699; font-weight: bold;">{$wpdb-&gt;prefix}</span>surveys_answer WHERE question_ID =<span style="color: #009933; font-weight: bold;">%d</span> ORDER BY ID ASC&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$template_quest</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$template_answers</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$template_answer</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO <span style="color: #006699; font-weight: bold;">{$wpdb-&gt;prefix}</span>surveys_answer (question_ID, answer, correct, sort_order)
        SELECT <span style="color: #009933; font-weight: bold;">%d</span>, answer, correct, sort_order FROM <span style="color: #006699; font-weight: bold;">{$wpdb-&gt;prefix}</span>surveys_answer WHERE ID = <span style="color: #009933; font-weight: bold;">%d</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$justclone_id_quest</span><span style="color: #339933;">,</span> <span style="color: #000088;">$template_answer</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        wp_redirect<span style="color: #009900;">&#40;</span><span style="color: #000088;">$wpframe_wordpress</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/wp-admin/edit.php?page=surveys/survey.php&amp;message=cloned&amp;survey='</span><span style="color: #339933;">.</span><span style="color: #000088;">$clone_id_survey</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>quindi l&#8217;enunciato verrebbe:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'submit'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'edit'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #666666; font-style: italic;">// ... original code ...</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'clone'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #666666; font-style: italic;">// ... ADDED CODE</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #666666; font-style: italic;">// ... original code ...</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Ora nella pagina con l&#8217;elenco dei questionari è comparso un pulsante <strong>Clone</strong> che duplica il questionario selezionato e le relative domande e opzioni di risposta.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eventualo.net/blog/2009/09/modifica-al-plugin-surveys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

