<?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>elektro:elch &#187; Programmierung</title>
	<atom:link href="http://elektroelch.de/blog/tag/programmierung/feed/" rel="self" type="application/rss+xml" />
	<link>http://elektroelch.de</link>
	<description>Es ist nicht ungefährlich, wenn ein Volk lesen und schreiben kann.</description>
	<lastBuildDate>Fri, 11 May 2012 10:20:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<atom:link rel='hub' href='http://elektroelch.de/?pushpress=hub'/>
		<item>
		<title>WordPress: Absprung im Plugin-Bereich v2.7</title>
		<link>http://elektroelch.de/blog/2008/11/06/wordpress-absprung-im-plugin-bereich-v27/</link>
		<comments>http://elektroelch.de/blog/2008/11/06/wordpress-absprung-im-plugin-bereich-v27/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 11:40:45 +0000</pubDate>
		<dc:creator>latz</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Programmierung]]></category>

		<guid isPermaLink="false">http://elektroelch.de/blog/?p=381</guid>
		<description><![CDATA[[English version] Frank Bültge beschreibt in seinem Posting &#8222;WordPress Plugins bereichern&#8220;, wie man die Bedienungsfreundlichkeit seines Plugins steigern kann, indem man einen Link zu den Options-Seiten neben die Deaktivieren- und Bearbeiten-Links platziert. Mit Version 2.6 funktioniert das so: function addConfigureLink&#40;$links, $file&#41; &#123; static $this_plugin; if &#40;!$this_plugin&#41; &#123; $this_plugin = plugin_basename&#40;__FILE__&#41;; &#125; if &#40;$file == $this_plugin&#41; [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align:right">[<em><a href="http://elektroelch.de/blog/direct-settings-27/">English version</a></em>]</p>
<p> <a href="http://bueltge.de/">Frank Bültge</a> beschreibt in seinem Posting &#8222;<a href="http://bueltge.de/wordpress-plugins-bereichern/">WordPress Plugins bereichern</a>&#8220;, wie man die Bedienungsfreundlichkeit seines Plugins steigern kann, indem man einen Link zu den Options-Seiten neben die <em>Deaktivieren-</em> und <em>Bearbeiten-</em>Links platziert. Mit Version 2.6 funktioniert das so:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> addConfigureLink<span style="color: #009900;">&#40;</span><span style="color: #000088;">$links</span><span style="color: #339933;">,</span> <span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  static <span style="color: #000088;">$this_plugin</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$this_plugin</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$this_plugin</span> <span style="color: #339933;">=</span> plugin_basename<span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$this_plugin</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$settings_link</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;a href=&quot;index.php?page=myplugin.php&quot;&gt;'</span> <span style="color: #339933;">.</span> 
      __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Settings'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$links</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$settings_link</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$links</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$links</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;plugin_action_links&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;addConfigureLink&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Bei dieser Methode wird allerdings für jedes Plugin die Funktion <code>addConfigureLink</code> aufgerufen&#8230; und sehr übersichtlich sieht es auch nicht aus.</p>
<p>Das haben sich offensichtlich auch die WP-Entwickler gedacht und haben den Filter verbessert:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> addConfigureLink<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$links</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
  <span style="color: #000088;">$settings_link</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;a href=&quot;myplugin.php&quot;&gt;Settings&lt;/a&gt;'</span><span style="color: #339933;">;</span> 
  <span style="color: #990000;">array_unshift</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$links</span><span style="color: #339933;">,</span> <span style="color: #000088;">$settings_link</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$links</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$plugin</span> <span style="color: #339933;">=</span> plugin_basename<span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;plugin_action_links_<span style="color: #006699; font-weight: bold;">$plugin</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'addConfigureLink'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Jetzt muss die Funktion <code>addConfigureLink</code> nicht bei jedem installierten Plugins überprüfen, welche Plugindaten gerade aufgerufen werden und der Code wird übersichtlicher. </p>
<p>Abschließend bleibt wie immer die Überlegung, ob man solche &#8222;frischen&#8220; Filter sofort nutzen soll und damit die Kompatibilität zu vorherigen WordPress-Versionen zerstört oder ob man wartet, bis sich die neue Version ausreichend verbreitet hat. Meine Meinung dazu gibt&#8217;s bei <a href="http://identi.ca/notice/878876">identi.ca</a> (schamlose Werbung!).</p>
<p><strong>Update: There an <a href="http://elektroelch.de/blog/direct-settings-27/">English version</a> of this posting available.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://elektroelch.de/blog/2008/11/06/wordpress-absprung-im-plugin-bereich-v27/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

