<?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>wpGrafie.de</title>
	<atom:link href="http://wpgrafie.de/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpgrafie.de</link>
	<description>Kunst und Technik von WordPress</description>
	<lastBuildDate>Fri, 12 Apr 2013 08:00:35 +0000</lastBuildDate>
	<language>de-DE</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.2-alpha</generator>
		<item>
		<title>WordPress Logo im SVG-Format</title>
		<link>http://wpgrafie.de/2345/wordpress-logo-svg/</link>
		<comments>http://wpgrafie.de/2345/wordpress-logo-svg/#comments</comments>
		<pubDate>Thu, 28 Mar 2013 13:58:05 +0000</pubDate>
		<dc:creator>Dominik Schilling</dc:creator>
				<category><![CDATA[WordPress Tipps & Tricks]]></category>

		<guid isPermaLink="false">http://wpgrafie.de/?p=2345</guid>
		<description><![CDATA[Das Plugin „MP6“ für das kommende Admin Design beinhaltet viele Vektorgrafiken. Unter anderem auch das WordPress Logo.]]></description>
				<content:encoded><![CDATA[<blockquote><p>
SVG is a language for describing two-dimensional graphics in XML. SVG allows for three types of graphic objects: vector graphic shapes (e.g., paths consisting of straight lines and curves), images and text. Graphical objects can be grouped, styled, transformed and composited into previously rendered objects. The feature set includes nested transformations, clipping paths, alpha masks, filter effects and template objects.</p>
<p>– <a href="http://www.w3.org/TR/SVG/intro.html">W3C: About SVG</a>
</p></blockquote>
<p>SVGs sind eine feine Sache, wenn es um Grafiken geht, die „automatisch“ skalieren sollen, <b>ohne</b> dabei die Qualität des Bildes zu beeinflussen. In Zeiten von HighDPI Bildschirmen ein immer mehr populäres Hilfsmittel.</p>
<p>Wie sich schon rumgesprochen hat (<a href="https://plus.google.com/101675293278434581718/posts/8f9QVYp72dU" title="Google+ Beitrag">ich berichtete</a>), hat sich eine Gruppe von WordPress Contributor unter der Leitung von Matt als Ziel eine neues, moderneres Admin Design zu entwickeln gesetzt. Ein Schwerpunkt der Umgestaltung sind die Icons. Die neuen Icons sollen nicht im gewöhnlichen PNG Format gestaltet sein, sondern ebenfalls auf das SVG Format gesetzt werden.<br />
Bis „<a href="http://wordpress.org/extend/plugins/mp6/">MP6</a>“ in den Core gelangt und wir in den Genuss der Grafiken kommen, dauert es noch ein Weilchen.</p>
<h3>WordPress Logo</h3>
<p>Das Plugin MP6 bringt eben aufgrund des neuen Formats auch das WordPress Logo als Vektorgrafik mit. Allerdings als <i>Inline Image</i> in <a href="http://de.wikipedia.org/wiki/Base64" title="Wikipedia Eintrag zu Base64">Base64</a> kodiert.</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nc">.wp-badge</span> <span class="p">{</span>
	<span class="k">background-color</span><span class="o">:</span> <span class="m">#0074a2</span><span class="p">;</span>
	<span class="k">background-image</span><span class="o">:</span> <span class="sx">url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGlu……OTQsMjMuMjE1LDI4LjQzNHoiLz4NCgk8L2c+DQo8L2c+DQo8L3N2Zz4NCg==)</span><span class="p">;</span>
	<span class="k">background-position</span><span class="o">:</span> <span class="k">center</span> <span class="m">30px</span><span class="p">;</span>
	<span class="k">background-repeat</span><span class="o">:</span> <span class="k">no-repeat</span><span class="p">;</span>
	<span class="k">background</span><span class="o">-</span><span class="k">size</span><span class="o">:</span> <span class="m">110px</span> <span class="m">110px</span><span class="p">;</span>
<span class="p">}</span>
</pre>
</div>
</figure>
<p>Ich habe den Base64 Code mal <a href="http://www.motobit.com/util/base64-decoder-encoder.asp" title="Base64 Decoder/Encoder">dekodiert</a> und anschließend die SVG Datei angepasst, damit es unter dem Opera Browser zu keinen Darstellungsproblemem kommt. (Fixe Höhe und Breite waren definiert, was Opera anscheinend nicht mag.)<br />
Um noch ein wenig an Bytes zu sparen, wurde die Datei einmal durch <a href="https://github.com/svg/svgo-gui" title="GitHub Repository">SVGO</a> gejagt, wodurch nochmal 30% gespart werden konnten.</p>
<p>Das Ergebnis habe ich hier mal eingebunden. Zum Speichern entweder <i>Rechtsklick -> Bild speichern</i> oder den anschließenden Download nutzen. (Lizenz: Wie das Plugin und WordPress selbst: GPLv2 or later)</p>
<p><img src="http://wpgrafie.de/wp-content/uploads/2013/03/wordpress-logo.svg" alt="WordPress Logo als Vektor im SVG Format" class="aligncenter size-large wp-image-2346" style="background-color:#0074a2"/></p>
<div class="plugin-download"><a href="http://wpgrafie.de/wp-content/uploads/2013/03/wordpress-logo.svg.zip">Download<br /><small>ZIP</small></a></div>
<p><br/><br />
<strong>Zum Thema</strong></p>
<ul>
<li><a href="http://wordpress.org/extend/plugins/mp6/">Plugin: MP6 (Das kommende Admin Design)</a> — wordpress.org</li>
<li><a href="http://playground.ebiene.de/svg-bilder-komprimieren/">SVG-Bilder verlustfrei in der Größe reduzieren mit SVGO</a> — playground.ebiene.de</li>
<li><a href="https://gist.github.com/ocean90/5263152">Plugin: SVG (Erlaubt das Uploaden von SVG Dateien)</a> — gist.github.com</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://wpgrafie.de/2345/wordpress-logo-svg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vorschau auf das Twenty Thirteen Theme</title>
		<link>http://wpgrafie.de/1285/vorschau-twenty-thirteen-theme/</link>
		<comments>http://wpgrafie.de/1285/vorschau-twenty-thirteen-theme/#comments</comments>
		<pubDate>Mon, 18 Feb 2013 23:34:26 +0000</pubDate>
		<dc:creator>Dominik Schilling</dc:creator>
				<category><![CDATA[WordPress Themes]]></category>

		<guid isPermaLink="false">http://wpgrafie.de/?p=1285</guid>
		<description><![CDATA[Das kommende Standard-Theme  von WordPress heißt Twenty Thirteen und ist nun öffentlich zugänglich. Die Highlights wurden in Screenshots festgehalten.]]></description>
				<content:encoded><![CDATA[<p>Soeben wurde die erste Version des neuen Themes aus der Twenty* Reihe <a href="http://make.wordpress.org/core/2013/02/18/introducing-twenty-thirteen/">in den Trunk von WordPress committed</a>. Es hört auf den Namen <strong>Twenty Thirteen</strong> und ist das erste Theme, welches <b>Farbe</b> bekommen hat.</p>
<p>Ich konnte schon letzte Woche einen Blick auf das Theme werfen und habe im folgenden die Highlights festgehalten.</p>
<h3>Header</h3>
<figure id="attachment_1326" class="wp-caption aligncenter" style="width: 714px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/header-menu-no-widgets.jpg"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/header-menu-no-widgets-1024x558.jpg" alt="Navigation mit Unterseiten" width="714" height="389" class="size-large wp-image-1326" /></a><figcaption class="wp-caption-text">Navigation mit Unterseiten</figcaption></figure>
<figure id="attachment_1320" class="wp-caption aligncenter" style="width: 714px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/custom-header.jpg"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/custom-header-1024x640.jpg" alt="Header anpassen" width="714" height="446" class="size-large wp-image-1320" /></a><figcaption class="wp-caption-text">Header anpassen</figcaption></figure>
<figure id="attachment_1340" class="wp-caption aligncenter" style="width: 714px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/single-post-fixed-header.jpg"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/single-post-fixed-header-1024x837.jpg" alt="Fixierter Header" width="714" height="583" class="size-large wp-image-1340" /></a><figcaption class="wp-caption-text">Fixierter Header</figcaption></figure>
<figure id="attachment_1322" class="wp-caption aligncenter" style="width: 455px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/responsive-search.jpg"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/responsive-search.jpg" alt="Ausgeklappte Suche" width="455" height="704" class="size-full wp-image-1322" /></a><figcaption class="wp-caption-text">Ausgeklappte Suche</figcaption></figure>
<figure id="attachment_1323" class="wp-caption aligncenter" style="width: 455px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/responsive-menu.jpg"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/responsive-menu.jpg" alt="Responsive Menu" width="455" height="704" class="size-full wp-image-1323" /></a><figcaption class="wp-caption-text">Responsive Menu</figcaption></figure>
<h3>Post Formate</h3>
<figure id="attachment_1311" class="wp-caption aligncenter" style="width: 714px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/post-formats-index.jpg"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/post-formats-index-1024x837.jpg" alt="Post-Formate Index" width="714" height="583" class="size-large wp-image-1311" /></a><figcaption class="wp-caption-text">Post-Formate Index</figcaption></figure>
<figure id="attachment_1305" class="wp-caption aligncenter" style="width: 900px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/post-format-gallery.png"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/post-format-gallery.png" alt="Post Format: Gallery" width="900" height="500" class="size-full wp-image-1305" /></a><figcaption class="wp-caption-text">Post Format: Gallerie</figcaption></figure>
<figure id="attachment_1306" class="wp-caption aligncenter" style="width: 900px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/post-format-quote.png"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/post-format-quote.png" alt="Post Format: Quote" width="900" height="500" class="size-full wp-image-1306" /></a><figcaption class="wp-caption-text">Post Format: Zitat</figcaption></figure>
<figure id="attachment_1307" class="wp-caption aligncenter" style="width: 900px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/post-format-chat.png"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/post-format-chat.png" alt="Post Format: Chat" width="900" height="500" class="size-full wp-image-1307" /></a><figcaption class="wp-caption-text">Post Format: Chat</figcaption></figure>
<h3>Sidebar and Widgets</h3>
<figure id="attachment_1335" class="wp-caption aligncenter" style="width: 714px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/index-with-widgets.jpg"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/index-with-widgets-1024x837.jpg" alt="Sidebar mit Widgets" width="714" height="583" class="size-large wp-image-1335" /></a><figcaption class="wp-caption-text">Sidebar mit Widgets</figcaption></figure>
<figure id="attachment_1333" class="wp-caption aligncenter" style="width: 714px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/footer-with-widgets.jpg"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/footer-with-widgets-1024x837.jpg" alt="Footer mit Widgets" width="714" height="583" class="size-large wp-image-1333" /></a><figcaption class="wp-caption-text">Footer mit Widgets</figcaption></figure>
<h3>Comments</h3>
<figure id="attachment_1317" class="wp-caption aligncenter" style="width: 714px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/comment-thread.jpg"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/comment-thread-1024x590.jpg" alt="Kommentar-Thread" width="714" height="411" class="size-large wp-image-1317" /></a><figcaption class="wp-caption-text">Kommentar-Thread</figcaption></figure>
<figure id="attachment_1318" class="wp-caption aligncenter" style="width: 714px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/comment-reply.jpg"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/comment-reply-1024x837.jpg" alt="Kommentarformular" width="714" height="583" class="size-large wp-image-1318" /></a><figcaption class="wp-caption-text">Kommentarformular</figcaption></figure>
<h3>Image Attachments</h3>
<figure id="attachment_1348" class="wp-caption aligncenter" style="width: 714px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/attachment-view.jpg"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/attachment-view-1024x837.jpg" alt="Bildanhang" width="714" height="583" class="size-large wp-image-1348" /></a><figcaption class="wp-caption-text">Bildanhang</figcaption></figure>
<h3>Schrift</h3>
<p>Als Schriftfamilie wird <b>&#8216;Source Sans Pro&#8217;, Helvetica, sans-serif</b> und <b>&#8216;Bitter&#8217;, serif</b> eingesetzt.</p>
<figure id="attachment_1343" class="wp-caption aligncenter" style="width: 714px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/single-post-image-captions.jpg"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/single-post-image-captions-1024x837.jpg" alt="Einzelansicht eines Beitrags mit Bildern" width="714" height="583" class="size-large wp-image-1343" /></a><figcaption class="wp-caption-text">Einzelansicht eines Beitrags mit Bildern</figcaption></figure>
<h3>Icon Font</h3>
<figure id="attachment_1338" class="wp-caption aligncenter" style="width: 714px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/icon-font.jpg"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/icon-font-1024x640.jpg" alt="Icon Fonts Are Awesome" width="714" height="446" class="size-large wp-image-1338" /></a><figcaption class="wp-caption-text">Icon Fonts Are Awesome</figcaption></figure>
<h3>Mobiles Layout</h3>
<figure id="attachment_1287" class="wp-caption aligncenter" style="width: 368px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/iphone-index.png"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/iphone-index.png" alt="Index Screen" width="368" height="716" class="size-full wp-image-1287" /></a><figcaption class="wp-caption-text">Index Ansicht</figcaption></figure>
<figure id="attachment_1287" class="wp-caption aligncenter" style="width: 368px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/iphone-sticky-header.png"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/iphone-sticky-header.png" alt="Fixierter Header" width="368" height="716" class="size-full wp-image-1287" /></a><figcaption class="wp-caption-text">Fixierter Header</figcaption></figure>
<figure id="attachment_1287" class="wp-caption aligncenter" style="width: 368px"><a href="http://wpgrafie.de/wp-content/uploads/2013/02/iphone-menu.png"><img src="http://wpgrafie.de/wp-content/uploads/2013/02/iphone-menu.png" alt="Responsive Navigation Menu" width="368" height="716" class="size-full wp-image-1287" /></a><figcaption class="wp-caption-text">Responsive Navigation Menu</figcaption></figure>
<p><br/><br />
Was sagt ihr dazu? Begrüßt ihr den Einsatz von Farbe oder sollte es doch wieder schlicht im nächsten Theme werden?</p>
<p><br/><br />
<strong>Zum Thema</strong></p>
<ul>
<li><a href="http://make.wordpress.org/core/2013/02/18/introducing-twenty-thirteen/">A first draft of the Twenty Thirteen theme</a> — make.wordpress.org</li>
<li><a href="http://twentythirteendemo.wordpress.com/">Demo von Twenty Thriteen</a> — wordpress.com</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://wpgrafie.de/1285/vorschau-twenty-thirteen-theme/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Benutzerdefinierte Feeds in WordPress anlegen</title>
		<link>http://wpgrafie.de/schnipsel/benutzerdefiniert-feed-wordpress/</link>
		<comments>http://wpgrafie.de/schnipsel/benutzerdefiniert-feed-wordpress/#comments</comments>
		<pubDate>Mon, 18 Feb 2013 08:00:56 +0000</pubDate>
		<dc:creator>Dominik Schilling</dc:creator>
		
		<guid isPermaLink="false">http://wpgrafie.de/?post_type=schnipsel&#038;p=897</guid>
		<description><![CDATA[WordPress bietet viele Feeds schon von Haus aus an. Doch mit der Funktion add_feed() und dem RSS2 Feed Template feed-rss2.php kann die eigene Seite um einen oder mehrere Feeds erweitertet werden.]]></description>
				<content:encoded><![CDATA[<p>WordPress bietet standardmäßig RSS Feeds für Beiträge, Kommentare, Taxonomien, Archive und Custom Post Types an. In „<a href="http://www.perun.net/2012/11/03/alle-feeds-einer-wordpress-installation/" title="Welche Feed-Ausgaben generiert eine WordPress-Installation?">Alle Feeds einer WordPress-Installation</a>“ hat Vladimir diese mal aufgelistet.</p>
<p>Die Inhalte der vorhandenen Feeds können mit den richtigen Filtern angepasst werden. Doch wie kann ein eigener Feed angelegt werden?</p>
<h3>Mit <em>add_feed()</em> einen eigenen Feed anlegen</h3>
<p>Die seit WordPress 2.1.0 mitgelieferte Funktion <code>add_feed()</code> befindet sich in <code>wp-includes/rewrite.php</code> und ist, wie der Name schon verspricht, für das Anlegen neuer Feeds zuständig. Die Funktion ist folgendermaßen aufgebaut:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="sd">/**</span>
<span class="sd"> * Add a new feed type like /atom1/.</span>
<span class="sd"> *</span>
<span class="sd"> * @since 2.1.0</span>
<span class="sd"> *</span>
<span class="sd"> * @param string $feedname</span>
<span class="sd"> * @param callback $function Callback to run on feed display.</span>
<span class="sd"> * @return string Feed action name.</span>
<span class="sd"> */</span>
<span class="k">function</span> <span class="nf">add_feed</span><span class="p">(</span><span class="nv">$feedname</span><span class="p">,</span> <span class="nv">$function</span><span class="p">)</span> <span class="p">{</span>
	<span class="k">global</span> <span class="nv">$wp_rewrite</span><span class="p">;</span>
	<span class="k">if</span> <span class="p">(</span> <span class="o">!</span> <span class="nb">in_array</span><span class="p">(</span><span class="nv">$feedname</span><span class="p">,</span> <span class="nv">$wp_rewrite</span><span class="o">-&gt;</span><span class="na">feeds</span><span class="p">)</span> <span class="p">)</span> <span class="c1">//override the file if it is</span>
		<span class="nv">$wp_rewrite</span><span class="o">-&gt;</span><span class="na">feeds</span><span class="p">[]</span> <span class="o">=</span> <span class="nv">$feedname</span><span class="p">;</span>
	<span class="nv">$hook</span> <span class="o">=</span> <span class="s1">&#39;do_feed_&#39;</span> <span class="o">.</span> <span class="nv">$feedname</span><span class="p">;</span>
	<span class="c1">// Remove default function hook</span>
	<span class="nx">remove_action</span><span class="p">(</span><span class="nv">$hook</span><span class="p">,</span> <span class="nv">$hook</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
	<span class="nx">add_action</span><span class="p">(</span><span class="nv">$hook</span><span class="p">,</span> <span class="nv">$function</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
	<span class="k">return</span> <span class="nv">$hook</span><span class="p">;</span>
<span class="p">}</span>
</pre>
</div>
</figure>
<p>Zunächst erwartet die Funktion einen <b>Slug für den Feed</b>. Es ist der Name, unter welchem der Feed später aufrufbar sein wird. Er sollte deswegen nur aus den Zeichensatz [a-z0-9_-] bestehen. Die Feed URL wird bei aktivierten Permalinks im Format <code>example.com/feed/{feed_slug}</code> sein.<br />
Der zweite Teil ist die <b>Callback-Funktion</b>. Diese Funktion sollte den Feed rendern und wird beim Aufruf des Feeds aufgegriffen.</p>
<h3>Das <em>feed-rss2.php</em> Template</h3>
<p><em>feed-rss2.php</em> ist ein <a href="https://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/feed-rss2.php" title="Source der Datei wp-includes/feed-rss2.php">Template in WordPress</a> und übernimmt die Darstellung für jegliche Art von Post Type im RSS2 Format.</p>
<p>Das Template ist somit die optimale Ausgangslage für die Darstellung des eigenen Feeds und kann deswegen in der Callback-Funktion geladen werden.</p>
<p>Anregung für PHP 5.3:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="k">function</span> <span class="nf">ds_custom_feed</span><span class="p">()</span> <span class="p">{</span>
	<span class="nx">add_feed</span><span class="p">(</span> <span class="s1">&#39;custom&#39;</span><span class="p">,</span> <span class="k">function</span><span class="p">()</span> <span class="p">{</span>
		<span class="nx">load_template</span><span class="p">(</span> <span class="nx">ABSPATH</span> <span class="o">.</span> <span class="nx">WPINC</span> <span class="o">.</span> <span class="s1">&#39;/feed-rss2.php&#39;</span> <span class="p">);</span>
	<span class="p">}</span> <span class="p">);</span>
<span class="p">}</span>
<span class="nx">add_action</span><span class="p">(</span> <span class="s1">&#39;init&#39;</span><span class="p">,</span> <span class="s1">&#39;ds_custom_feed&#39;</span> <span class="p">);</span>
</pre>
</div>
</figure>
<h3>Feed mit eigenen Inhalt füllen</h3>
<p>Was nun noch fehlt, ist der Inhalt des Feeds. Dazu als Beispiel folgende Klasse anschauen:</p>
<figure class="code-block">
<figcaption class="gist-meta">PHP / <a target="_blank" href="https://gist.github.com/raw/4973288/b1ba7baabbc8eab3255c4e4ee88c06b9700e3cac/class-custom-feed.php" title="Ohne Syntax-Highlight">Text</a> / <a target="_blank" href="https://gist.github.com/4973288#file_class_custom_feed.php">github<span class="dot">:</span><span class="gist">gist</span></a></figcaption>
<div class="highlight">
<pre><span class="cp">&lt;?php</span>
<span class="sd">/**</span>
<span class="sd"> * Add a custom feed to WordPress.</span>
<span class="sd"> *</span>
<span class="sd"> * The feed will be rendered through the wp-includes/feed-rss2.php template</span>
<span class="sd"> * and avaiable under example.com/feed/{$feed_slug}.</span>
<span class="sd"> *</span>
<span class="sd"> * Note: Don&#39;t forget to flush the rewrite rules once.</span>
<span class="sd"> *</span>
<span class="sd"> * @author Dominik Schilling</span>
<span class="sd"> * @link   http://wpgrafie.de/897</span>
<span class="sd"> */</span>
<span class="k">class</span> <span class="nc">DS_Custom_Feed</span> <span class="p">{</span>
	<span class="sd">/**</span>
<span class="sd">	 * Sets the feed slug.</span>
<span class="sd">	 *</span>
<span class="sd">	 * @var string</span>
<span class="sd">	 */</span>
	<span class="k">public</span> <span class="k">static</span> <span class="nv">$feed_slug</span> <span class="o">=</span> <span class="s1">&#39;custom&#39;</span><span class="p">;</span>

	<span class="sd">/**</span>
<span class="sd">	 * Registers the feed and the pre_get_posts action</span>
<span class="sd">	 */</span>
	<span class="k">public</span> <span class="k">static</span> <span class="k">function</span> <span class="nf">init</span><span class="p">()</span> <span class="p">{</span>
		<span class="nx">add_feed</span><span class="p">(</span> <span class="nx">self</span><span class="o">::</span><span class="nv">$feed_slug</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span> <span class="nx">__CLASS__</span><span class="p">,</span> <span class="s1">&#39;feed_template&#39;</span> <span class="p">)</span> <span class="p">);</span>

		<span class="nx">add_action</span><span class="p">(</span> <span class="s1">&#39;pre_get_posts&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span> <span class="nx">__CLASS__</span><span class="p">,</span> <span class="s1">&#39;feed_content&#39;</span> <span class="p">)</span> <span class="p">);</span>
	<span class="p">}</span>

	<span class="sd">/**</span>
<span class="sd">	 * Customizes the query.</span>
<span class="sd">	 * It will bail if $query is not an object, filters are suppressed and it&#39;s not</span>
<span class="sd">	 * our feed query.</span>
<span class="sd">	 *</span>
<span class="sd">	 * @param  WP_Query $query The current query</span>
<span class="sd">	 */</span>
	<span class="k">public</span> <span class="k">static</span> <span class="k">function</span> <span class="nf">feed_content</span><span class="p">(</span> <span class="nv">$query</span> <span class="p">)</span> <span class="p">{</span>
		<span class="c1">// Bail if $query is not an object or of incorrect class</span>
		<span class="k">if</span> <span class="p">(</span> <span class="o">!</span> <span class="nv">$query</span> <span class="nx">instanceof</span> <span class="nx">WP_Query</span> <span class="p">)</span>
			<span class="k">return</span><span class="p">;</span>

		<span class="c1">// Bail if filters are suppressed on this query</span>
		<span class="k">if</span> <span class="p">(</span> <span class="nv">$query</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span> <span class="s1">&#39;suppress_filters&#39;</span> <span class="p">)</span> <span class="p">)</span>
			<span class="k">return</span><span class="p">;</span>

		<span class="c1">// Bail if it&#39;s not our feed</span>
		<span class="k">if</span> <span class="p">(</span> <span class="o">!</span> <span class="nv">$query</span><span class="o">-&gt;</span><span class="na">is_feed</span><span class="p">(</span> <span class="nx">self</span><span class="o">::</span><span class="nv">$feed_slug</span> <span class="p">)</span> <span class="p">)</span>
			<span class="k">return</span><span class="p">;</span>

		<span class="c1">// Change the feed content</span>
		<span class="c1">// Example: A feed for pages</span>
		<span class="nv">$query</span><span class="o">-&gt;</span><span class="na">set</span><span class="p">(</span> <span class="s1">&#39;post_type&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span> <span class="s1">&#39;page&#39;</span> <span class="p">)</span> <span class="p">);</span>
	<span class="p">}</span>

	<span class="sd">/**</span>
<span class="sd">	 * Loads the feed template which is placed in wp-includes/feed-rss2.php.</span>
<span class="sd">	 */</span>
	<span class="k">public</span> <span class="k">static</span> <span class="k">function</span> <span class="nf">feed_template</span><span class="p">()</span> <span class="p">{</span>
		<span class="nx">load_template</span><span class="p">(</span> <span class="nx">ABSPATH</span> <span class="o">.</span> <span class="nx">WPINC</span> <span class="o">.</span> <span class="s1">&#39;/feed-rss2.php&#39;</span> <span class="p">);</span>
	<span class="p">}</span>
<span class="p">}</span>

<span class="sd">/**</span>
<span class="sd"> * Hooks into `init`.</span>
<span class="sd"> *</span>
<span class="sd"> * Note: add_feed() needs access to the global $wp_rewrite</span>
<span class="sd"> */</span>
<span class="nx">add_action</span><span class="p">(</span> <span class="s1">&#39;init&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span> <span class="s1">&#39;DS_Custom_Feed&#39;</span><span class="p">,</span> <span class="s1">&#39;init&#39;</span> <span class="p">)</span> <span class="p">);</span>
</pre>
</div>
<figcaption class="gist-meta">PHP / <a target="_blank" href="https://gist.github.com/raw/4973288/b1ba7baabbc8eab3255c4e4ee88c06b9700e3cac/class-custom-feed.php" title="Ohne Syntax-Highlight">Text</a> / <a target="_blank" href="https://gist.github.com/4973288#file_class_custom_feed.php">github<span class="dot">:</span><span class="gist">gist</span></a></figcaption>
</figure>
<p>Es wird Gebrauch vom <code>pre_get_posts</code> Hook gemacht. Dieser erlaubt es die Query nach Bedarf anzupassen – hier wird z.B. der Post Type auf <em>page</em> gesetzt. Was alles angepasst werden kann, kann dem <a href="http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts" title="Plugin API - Action Reference - pre_get_posts">Eintrag im Codex</a> entnommen werden.</p>
<p><br/></p>
<p>Als Beispiel kann ich auf meinen Feed für den WPD Planet hinweisen, welcher nur Beiträge mit einem bestimmten Custom Field anzeigt &#8211; Nachzulesen im <a href="https://github.com/ocean90/wpgrafie-theme/blob/master/classes/class-ds-wpgrafie-wp-planet-feed.php">GitHub Repo zum Theme</a>.</p>
<p><br/><br />
<strong>Zum Thema</strong></p>
<ul>
<li><a href="http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts">Plugin API &#8211; Action Reference &#8211; pre_get_posts</a> — codex.wordpress.org</li>
<li><a href="http://www.perun.net/2012/11/03/alle-feeds-einer-wordpress-installation/">Feeds einer WordPress-Installation</a> — perun.net</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://wpgrafie.de/schnipsel/benutzerdefiniert-feed-wordpress/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Cache-Busting durch Versionierung im Dateinamen</title>
		<link>http://wpgrafie.de/schnipsel/wordpress-cache-busting-versionierung-dateinamen/</link>
		<comments>http://wpgrafie.de/schnipsel/wordpress-cache-busting-versionierung-dateinamen/#comments</comments>
		<pubDate>Mon, 14 Jan 2013 05:00:12 +0000</pubDate>
		<dc:creator>Dominik Schilling</dc:creator>
		
		<guid isPermaLink="false">http://wpgrafie.de/?post_type=schnipsel&#038;p=880</guid>
		<description><![CDATA[Von Haus aus versioniert WordPress eingebundene Skripte und Styles. Dazu wird ein Query String an die Resource angehangen. Dies ist allerdings nicht mit jedem Proxy kompatibel.
Deswegen sollte die Versionierung in den Dateinamen ausgelagert werden. Ein kleines Plugin erledigt dies für WordPress.]]></description>
				<content:encoded><![CDATA[<p>Von Haus aus versioniert WordPress eingebundene Skripte und Styles. So sieht der Output für die jQuery Bibliothek beispielhaft folgendermaßen aus:<br />
<code>http://example.com/wp-includes/js/jquery/jquery.js?ver=1.8.3</code></p>
<p>Wofür die Versionierung? Statische Dateien, die eine hohe Auslaufzeit (<a href="http://tools.ietf.org/html/rfc2616#section-14.21" title="RFC 2616, HTTP 1.1">Expires-Header</a>) haben, werden vom Browser nicht mehr vom Server geladen, sondern direkt aus dem Browsercache eingebunden. Wird die Resource aber auf dem Server geändert, bekommt der Browser dies nicht mit und lädt weiterhin die alte Version aus dem Browsercache. Abhilfe schafft die Versionierung.</p>
<p>WordPress hängt an die Resource eine Query String mit dem Parameter <code>ver</code>. Diese Art von Versionierung wird allerdings nicht empfohlen.<br />
<a href="https://developers.google.com/speed/docs/best-practices/caching#LeverageProxyCaching" title="Leverage proxy caching - Recommendations">Google schreibt</a> dazu:</p>
<blockquote><p>
Most proxies, most notably Squid up through version 3.0, do not cache resources with a &#8220;?&#8221; in their URL even if a Cache-control: public header is present in the response. To enable proxy caching for these resources, remove query strings from references to static resources, and instead encode the parameters into the file names themselves.
</p></blockquote>
<p>Die Version soll also mit in den Dateinamen gepackt werden.</p>
<h3>Plugin: Dateinamen um die Version erweitern</h3>
<p>Um die Dateien nicht physisch zu ändern hilft das mod_rewrite Modul und folgendes Plugin, welches sich in die WordPress Filter <em>script_loader_src</em> und <em>style_loader_src</em> einklinkt.</p>
<figure class="code-block">
<figcaption class="gist-meta">PHP / <a target="_blank" href="https://gist.github.com/raw/1966227/cf89f29472af6e1b45506c37a6c411bd5cb373e8/fbcbfwss.php" title="Ohne Syntax-Highlight">Text</a> / <a target="_blank" href="https://gist.github.com/1966227#file_fbcbfwss.php">github<span class="dot">:</span><span class="gist">gist</span></a></figcaption>
<div class="highlight">
<pre><span class="cp">&lt;?php</span>
<span class="sd">/**</span>
<span class="sd"> * Plugin Name: Filename-based cache busting </span>
<span class="sd"> * Version: 0.2</span>
<span class="sd"> * Description: Filename-based cache busting for WordPress scripts/styles.</span>
<span class="sd"> * Author: Dominik Schilling</span>
<span class="sd"> * Author URI: http://wphelper.de/</span>
<span class="sd"> * Plugin URI: http://wpgrafie.de/880/</span>
<span class="sd"> *</span>
<span class="sd"> * License: GPLv2 or later</span>
<span class="sd"> * License URI: http://www.gnu.org/licenses/gpl-2.0.html</span>
<span class="sd"> *</span>
<span class="sd"> * </span>
<span class="sd"> * Extend your .htaccess file with these lines:</span>
<span class="sd"> *</span>
<span class="sd"> *   &lt;IfModule mod_rewrite.c&gt;</span>
<span class="sd"> *     RewriteEngine On</span>
<span class="sd"> *     RewriteBase /</span>
<span class="sd"> *</span>
<span class="sd"> *     RewriteCond %{REQUEST_FILENAME} !-f</span>
<span class="sd"> *     RewriteCond %{REQUEST_FILENAME} !-d</span>
<span class="sd"> *     RewriteRule ^(.+)\.(.+)\.(js|css)$ $1.$3 [L]</span>
<span class="sd"> *   &lt;/IfModule&gt;</span>
<span class="sd"> */</span>
 
<span class="sd">/**</span>
<span class="sd"> * Removes the `ver` query string of the source and places it into</span>
<span class="sd"> * the filename. Doesn&#39;t change admin scripts/styles and sources</span>
<span class="sd"> * with more than the `ver` arg.</span>
<span class="sd"> *</span>
<span class="sd"> * @param  string $src The original source </span>
<span class="sd"> * @return string</span>
<span class="sd"> */</span>
<span class="k">function</span> <span class="nf">ds_filename_based_cache_busting</span><span class="p">(</span> <span class="nv">$src</span> <span class="p">)</span> <span class="p">{</span>
	<span class="c1">// Don&#39;t touch admin scripts</span>
	<span class="k">if</span> <span class="p">(</span> <span class="nx">is_admin</span><span class="p">()</span> <span class="p">)</span>
		<span class="k">return</span> <span class="nv">$src</span><span class="p">;</span>

	<span class="k">return</span> <span class="nb">preg_replace</span><span class="p">(</span>
		<span class="s1">&#39;/\.(js|css)\?ver=(.+)$/&#39;</span><span class="p">,</span>
		<span class="s1">&#39;.$2.$1&#39;</span><span class="p">,</span>
		<span class="nv">$src</span>
	<span class="p">);</span>
<span class="p">}</span>
<span class="nx">add_filter</span><span class="p">(</span> <span class="s1">&#39;script_loader_src&#39;</span><span class="p">,</span> <span class="s1">&#39;ds_filename_based_cache_busting&#39;</span> <span class="p">);</span>
<span class="nx">add_filter</span><span class="p">(</span> <span class="s1">&#39;style_loader_src&#39;</span><span class="p">,</span> <span class="s1">&#39;ds_filename_based_cache_busting&#39;</span> <span class="p">);</span>
</pre>
</div>
<figcaption class="gist-meta">PHP / <a target="_blank" href="https://gist.github.com/raw/1966227/cf89f29472af6e1b45506c37a6c411bd5cb373e8/fbcbfwss.php" title="Ohne Syntax-Highlight">Text</a> / <a target="_blank" href="https://gist.github.com/1966227#file_fbcbfwss.php">github<span class="dot">:</span><span class="gist">gist</span></a></figcaption>
</figure>
<p>Wie im Plugin Header dokumentiert, muss die .htaccess ergänzt werden.<br />
Wer auf nginx setzt kann folgende Zeilen nutzen, danke <a href="https://plus.google.com/110569673423509816572/" title="Sergej Müller">Sergej</a>:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="k">location</span> <span class="p">~</span> <span class="sr">^(.+)\.(.+)\.(js|css)$</span> <span class="p">{</span>
    <span class="kn">alias</span> <span class="nv">$1.$3</span><span class="p">;</span>
<span class="p">}</span><span class="k">﻿</span>
</pre>
</div>
</figure>
<p><br/><br />
<strong>Zum Thema</strong></p>
<ul>
<li><a href="https://gist.github.com/1966227/">Plugin auf GitHub</a> — gist.github.com</li>
<li><a href="https://developers.google.com/speed/docs/best-practices/rules_intro">Web Performance Best Practices</a> — developers.google.com</li>
<li><a href="http://tools.ietf.org/html/rfc2616">RFC 2616 HTTP-1.1-Spezifikation</a> — tools.ietf.org</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://wpgrafie.de/schnipsel/wordpress-cache-busting-versionierung-dateinamen/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Anleitung: GitLab 3.0 bei Uberspace.de installieren</title>
		<link>http://wpgrafie.de/1155/anleitung-gitlab-uberspace-installation/</link>
		<comments>http://wpgrafie.de/1155/anleitung-gitlab-uberspace-installation/#comments</comments>
		<pubDate>Wed, 31 Oct 2012 10:00:34 +0000</pubDate>
		<dc:creator>Dominik Schilling</dc:creator>
				<category><![CDATA[Abseits von WordPress]]></category>
		<category><![CDATA[Anleitung]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[GitLab]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://wpgrafie.de/?p=1155</guid>
		<description><![CDATA[GitLab ist ein Webinterface, ähnlich dem vom GitHub, welches die Projektverwaltung mit Git um einiges erleichtert.

Ich zeige, wie man in 15 Schritten GitLab auf den Webhoster Uberspace installiert bekommt.]]></description>
				<content:encoded><![CDATA[<p><a href="http://gitlabhq.com/">GitLab</a> ist ein Webinterface, ähnlich dem vom GitHub, welches die Projektverwaltung mit Git um einiges erleichtert. Dabei vereint es mehrere Elemente, wie Issues, Wiki oder Mehrbenutzer-Verwaltung. (<a href="http://demo.gitlabhq.com/">GitLab Demo</a>.)</p>
<p>Vor kurzem habe ich von GitLab gehört und wollte die Anwendung auf meinem <a href="https://uberspace.de/">Uberspace</a> ausprobieren. Schaut man sich allerdings die <a href="https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md">Installationsanleitung</a> an, so überschlägt sich diese nur so von <code>sudo</code> Aufrufen. Ein Hindernis für die Installation auf Uberspace.<br />
<b>Doch es geht auch ohne!</b></p>
<p>Die Anleitung bezieht sich auf eine GitLab Installation von Grund auf und umfasst 15 Schritte.<br />
Als Grundlage habe ich die <a href="http://blog.julo.ch/post/40340697227/gitlab-auf-deinem-uberspace-installieren">Anleitung vom Alexander</a> (Danke!) aufgegriffen und entsprechend der jeweiligen neuen Versionen angepasst.</p>
<h3 id="gitlab-vorbereitungen">0. Vorbereitungen</h3>
<p>Dinge, die du nun brauchst:</p>
<ul>
<li>Etwas Geduld und Zeit</li>
<li>Grundwissen über die Shell</li>
<li>Einen Uberspace Account :-)</li>
</ul>
<p><em>(Sofern nicht anders angeben, werden die folgenden Befehle im Home-Verzeichnis ausgeführt. <em>&lt;uberspacename></em> bitte mit Deinem Benutzernamen ersetzen, analog <em>&lt;uberspacehost></em> mit dem Servernamen.)</em></p>
<h3 id="gitlab-git">1. Git aktualisieren und konfigurieren</h3>
<p>Wer möchte kann zunächst Git auf <a href="http://code.google.com/p/git-core/downloads/list">Version 1.8.0</a> aktualisieren. Dies kann mithilfe von <a href="https://uberspace.de/dokuwiki/system:toast?s[]=toast">toast</a> erledigt werden. (Sollte kein <a href="http://www.gnu.org/software/gettext/">gettext</a> installiert sein, muss dies zuerst installiert werden.)</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>toast arm http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.1.1.tar.gz
<span class="nv">$ </span>toast arm http://git-core.googlecode.com/files/git-1.8.0.tar.gz
</pre>
</div>
</figure>
<p>Wenn noch nicht geschehen, dann müssen Name und E-Mail-Adresse für Git festgelegt werden:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>git config --global user.email <span class="s2">&quot;&lt;mail@example.com&gt;&quot;</span>
<span class="nv">$ </span>git config --global user.name <span class="s2">&quot;&lt;Dein Name&gt;&quot;</span>
</pre>
</div>
</figure>
<h3 id="gitlab-temp-ordner">2. Temporären Ordner anlegen</h3>
<p>Da GitLab temporäre Dateien anlegt, sollte ein temporären Ordner im Home-Verzeichnis anlegt werden. Damit hast auch wirklich nur Du Zugriff auf dein GitLab.</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>mkdir ~/tmp
</pre>
</div>
</figure>
<p>Damit der Ordner genutzt wird, muss die Shell-Konfiguration (<code>.rc</code>, <code>.bashrc</code> oder <code>.zshrc</code>) um Folgendes erweitert werden:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nb">export </span><span class="nv">TMPDIR</span><span class="o">=</span><span class="nv">$HOME</span>/tmp
</pre>
</div>
</figure>
<h3 id="gitlab-sshkey">3. SSH-Key generieren</h3>
<p>Für <a href="http://sitaramc.github.com/gitolite/">gitolite</a> wird ein eigener SSH-Key generiert:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>ssh-keygen -t rsa -f admin -C <span class="s2">&quot;GitLab Key&quot;</span>
</pre>
</div>
</figure>
<p>(Passwort-Eingabe überspringen.)</p>
<h3 id="gitlab-gitolite">4. gitolite installieren und konfigurieren</h3>
<p>gitolite dient für die Benutzerverwaltung der Git-Repositories. Die Jungs von Uberspace bieten dazu ein <a href="https://uberspace.de/dokuwiki/cool:gitolite?s[]=gitolite">Setup-Skript</a> an. Dies kann genutzt werden:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>gl-setup admin.pub
</pre>
</div>
</figure>
<p><br/></p>
<p>Danach die eben angelegten Keys ins SSH Verzeichnis verschieben…</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>mv admin .ssh/id_rsa.gitlab
<span class="nv">$ </span>mv admin.pub .ssh/id_rsa.gitlab.pub
</pre>
</div>
</figure>
<p>…, damit der Key genutzt wird, eine SSH-Config anlegen (wenn noch nicht vorhanden)…</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>touch .ssh/config
<span class="nv">$ </span>chmod 600 .ssh/config
</pre>
</div>
</figure>
<p>…und schließlich die Key Datei verlinken:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span><span class="nb">echo</span> -e <span class="s2">&quot;Host &lt;uberspacehost&gt;.uberspace.de localhost\n\tIdentityFile ~/.ssh/id_rsa.gitlab&quot;</span> &gt;&gt; .ssh/config
</pre>
</div>
</figure>
<p><br/></p>
<p>Zur <b>Überprüfung</b> einmal den Host per SSH aufrufen:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>ssh &lt;uberspacename&gt;@&lt;uberspacehost&gt;.uberspace.de
</pre>
</div>
</figure>
<p>Die Antwort sollte in etwa so aussehen:</p>
<figure class="code-block">
<div class="highlight">
<pre>The authenticity of host &#39;XXXXXXXX&#39; can&#39;t be established.
RSA key fingerprint is XX:XX:XX:XX:XX.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added &#39;XXXXXXXX,XXXXXXXX&#39; (RSA) to the list of known hosts.
hello admin, this is gitolite 2.3.1-1.el6 running on git 1.8
the gitolite config gives you the following access:
 R   W  gitolite-admin
 @R_ @W_    testing
Connection to XXXXXXXX closed.
</pre>
</div>
</figure>
<p>Um später keine Problem mit der Authentifizierung in Git zu haben, sollte das Repo einmal geklont werden. Danach kann es wieder gelöscht werden:<br />
(Die aufkommende Frage auch wieder mit <em>yes</em> beantworten.)</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>git clone &lt;uberspacename&gt;@localhost:gitolite-admin
<span class="nv">$ </span>rm -rf gitolite-admin
</pre>
</div>
</figure>
<p><br/></p>
<p>Zur Konfiguration die Datei <code>.gitolite.rc</code> aus dem Home-Verzeichnis öffnen und die folgenden Variablen abändern:</p>
<p><code>$GL_GITCONFIG_KEYS</code> auf <code>$GL_GITCONFIG_KEYS = ".*";</code> setzen und <code>$REPO_UMASK</code> auf <code> $REPO_UMASK = 0007;</code> setzen.</p>
<h3 id="gitlab-ruby">5. Ruby installieren</h3>
<p>GitLab basiert auf Ruby on Rails. Um Ruby zu installieren gibt es zwei Möglichkeiten.</p>
<h4>Möglichkeit 1:</h4>
<p>Uberspace bietet die <a href="https://uberspace.de/dokuwiki/development:ruby#section193">Version 1.9.3 global</a> an. Den Wiki-Eintrag bitte lesen; zusammengefasst:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>cat <span class="s">&lt;&lt;&#39;__EOF__&#39; &gt;&gt; ~/.bash_profile</span>
<span class="s">export PATH=/package/host/localhost/ruby-1.9.3/bin:$PATH</span>
<span class="s">export PATH=$HOME/.gem/ruby/1.9.1/bin:$PATH</span>
<span class="s">__EOF__</span>
<span class="nv">$ </span><span class="nb">echo</span> <span class="s2">&quot;gem: --user-install --no-rdoc --no-ri&quot;</span> &gt; ~/.gemrc
</pre>
</div>
</figure>
<p>Danach kann Bundler und CharlockHolmes installiert werden</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>gem install bundler charlock_holmes
<span class="nv">$ </span>bundle install --path ~/.gem
</pre>
</div>
</figure>
<p>Nachteil: Man hat nicht die aktuelle Ruby Version zur Verfügung.</p>
<h4>Möglichkeit 2:</h4>
<p>Den Ruby Version Manager nach <a href="https://uberspace.de/dokuwiki/development:ruby#rvm">dieser Anleitung</a> installieren.</p>
<p>Danach Ruby 1.9.3, Bundler, CharlockHolmes und sqlite3 (<a href="https://uberspace.de/dokuwiki/development:ruby?s[]=sqlite3#sqlite3">siehe Doku-Hinweis</a>) installieren:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>rvm install 1.9.3
<span class="nv">$ </span>rvm use 1.9.3
<span class="nv">$ </span>gem install --no-rdoc --no-ri bundler charlock_holmes
<span class="nv">$ </span>gem install sqlite3 -- <span class="se">\</span>
  --with-sqlite3-include<span class="o">=</span>/package/host/localhost/sqlite-3/include <span class="se">\</span>
  --with-sqlite3-lib<span class="o">=</span>/package/host/localhost/sqlite-3/lib
</pre>
</div>
</figure>
<h3 id="gitlab-redis">6. Redis installieren und konfigurieren</h3>
<p>GitLab benötigt außerdem <a href="http://redis.io/">Redis</a>. Dank <em>toast</em> wieder kein Problem:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>toast arm http://redis.googlecode.com/files/redis-2.6.2.tar.gz
</pre>
</div>
</figure>
<p>Zur Konfiguration den Ordner <code>~/.redis</code> erstellen und in Diesem eine Datei names <code>conf</code> mit folgendem Inhalt anlegen:</p>
<figure class="code-block">
<div class="highlight">
<pre>unixsocket /home/&lt;uberspacename&gt;/.redis/sock
daemonize yes
logfile /home/&lt;uberspacename&gt;/.redis/log
port 0
</pre>
</div>
</figure>
<h3 id="gitlab-install">7. GitLab installieren  und konfigurieren</h3>
<p>Nun ist GitLab selbst an der Reihe. Wir klonen uns das Repo und wechseln dann in den 3.0.3 Zweig:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>git clone git@github.com:gitlabhq/gitlabhq.git gitlab
<span class="nv">$ </span><span class="nb">cd </span>gitlab
<span class="nv">$ </span>git checkout v3.0.3 -q
</pre>
</div>
</figure>
<p>Die Beispiel-Konfigurationsdateien kopieren…</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>cp config/database.yml.example config/database.yml
<span class="nv">$ </span>cp config/gitlab.yml.example config/gitlab.yml
</pre>
</div>
</figure>
<p>…und die <code>database.yml</code> mit den richtigen Daten füllen. Achtung: Die Datenbanknamen müssen Deinen <a href="https://uberspace.de/dokuwiki/database:mysql?s[]=mysql#weitere_datenbanken">Benutzernamen mit Unterstrich als Präfix</a> haben!</p>
<p>Danach <code>gitlab.yml</code> öffnen und folgendermaßen abändern:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="l-Scalar-Plain">web</span><span class="p-Indicator">:</span>
  <span class="l-Scalar-Plain">host</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">&lt;uberspacename&gt;.&lt;uberspacehost&gt;.uberspace.de</span>
  <span class="l-Scalar-Plain">port</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">80</span>
  <span class="l-Scalar-Plain">https</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">false</span>

<span class="c1"># Email used for notification</span>
<span class="c1"># about new issues, comments</span>
<span class="l-Scalar-Plain">email</span><span class="p-Indicator">:</span>
  <span class="l-Scalar-Plain">from</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">noreply@&lt;uberspacename&gt;.&lt;uberspacehost&gt;.uberspace.de</span>

<span class="c1"># Git Hosting configuration</span>
<span class="l-Scalar-Plain">git_host</span><span class="p-Indicator">:</span>
  <span class="l-Scalar-Plain">system</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">gitolite</span>
  <span class="l-Scalar-Plain">admin_uri</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">&lt;uberspacename&gt;@localhost:gitolite-admin</span>
  <span class="l-Scalar-Plain">base_path</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">/home/&lt;uberspacename&gt;/repositories/</span>
  <span class="l-Scalar-Plain">hooks_path</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">/home/&lt;uberspacename&gt;/.gitolite/hooks/</span>
  <span class="l-Scalar-Plain">gitolite_admin_key</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">gitlab</span> 
  <span class="l-Scalar-Plain">git_user</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">&lt;uberspacename&gt;</span>
  <span class="l-Scalar-Plain">upload_pack</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">true</span>
  <span class="l-Scalar-Plain">receive_pack</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">true</span>
  <span class="l-Scalar-Plain">host</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">&lt;uberspacename&gt;.&lt;uberspacehost&gt;.uberspace.de</span>
  <span class="c1"># port: 22</span>
</pre>
</div>
</figure>
<p>(Die Hosts können später, oder auch jetzt schon, mit einer beliebigen URL ersetzt werden.)</p>
<p>Wenn git über toast installiert wurde muss noch folgende Änderung gemacht werden:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="c1"># Git settings</span>
<span class="c1"># Use default values unless you understand it</span>
<span class="l-Scalar-Plain">git</span><span class="p-Indicator">:</span>
  <span class="l-Scalar-Plain">path</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">/home/&lt;uberspacename&gt;/.toast/armed/bin/git</span>
</pre>
</div>
</figure>
<p><br/></p>
<p>Danach die restlichen GitLab Abhängigkeiten installieren:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>bundle install --without development <span class="nb">test </span>sqlite postgres  --deployment
</pre>
</div>
</figure>
<p><br/></p>
<p>Damit Redis und Resque miteinander harmonieren, müssen noch ein paar Änderungen vollzogen werden.<br />
Öffne die Datei <code>config/initializers/4_resque.rb</code> und füge folgende Zeile am Anfang ein:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="no">Resque</span><span class="o">.</span><span class="n">redis</span> <span class="o">=</span> <span class="no">Redis</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="ss">:path</span> <span class="o">=&gt;</span> <span class="s2">&quot;/home/&lt;uberspacename&gt;/.redis/sock&quot;</span><span class="p">)</span>
</pre>
</div>
</figure>
<p>Öffne die Datei <code>lib/hooks/post-receive</code> und ersetze <code>redis-cli</code> mit <code>/home/&lt;uberspacename>/.toast/armed/bin/redis-cli -s /home/&lt;uberspacename>/.redis/sock</code>.</p>
<p><br/></p>
<p>Jetzt die Hooks einrichten:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>cp lib/hooks/post-receive ~/.gitolite/hooks/common/post-receive
</pre>
</div>
</figure>
<p><br/></p>
<p>Für das Deployment wird <a href="http://code.macournoyer.com/thin/">thin</a> genutzt. Damit die Assets mit thin funktionieren muss in der Datei <code>config/environments/production.rb</code> die folgende Einstellung geändert werden:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="n">config</span><span class="o">.</span><span class="n">serve_static_assets</span> <span class="o">=</span> <span class="kp">true</span>
</pre>
</div>
</figure>
<h3 id="gitlab-redis-start">8. Redis starten</h3>
<p>Der Redis Server muss gestartet werden:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span>redis-server ~/.redis/conf
</pre>
</div>
</figure>
<h3 id="gitlab-init">9. GitLab initialisieren</h3>
<p>Jetzt kann die Datenbank und der Admin Account für GitLab angelegt werden. Das geht mit:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span><span class="nb">cd</span> ~/gitlab
<span class="nv">$ </span>bundle <span class="nb">exec </span>rake db:setup <span class="nv">RAILS_ENV</span><span class="o">=</span>production
<span class="nv">$ </span>bundle <span class="nb">exec </span>rake db:seed_fu <span class="nv">RAILS_ENV</span><span class="o">=</span>production
</pre>
</div>
</figure>
<h3 id="gitlab-check">10. GitLab Status Check</h3>
<p>Um sicher zu gehen, dass bisher alles richtig gemacht wurde, sollte der Status der GitLab Installation geprüft werden:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span><span class="nb">cd</span> ~/gitlab
<span class="nv">$ </span>bundle <span class="nb">exec </span>rake gitlab:app:status <span class="nv">RAILS_ENV</span><span class="o">=</span>production
</pre>
</div>
</figure>
<p>Das Ergebnis sollte dem Screenshot ähnlich sein.</p>
<figure id="attachment_1222" class="wp-caption aligncenter" style="width: 570px"><img src="http://wpgrafie.de/wp-content/uploads/2012/10/gitlab-app-status.png" alt="" title="gitlab-app-status" width="570" height="282" class="size-full wp-image-1222" /><figcaption class="wp-caption-text">Erfolgreiche Überprüfung der GitLab Installation</figcaption></figure>
<h3 id="gitlab-resque-start">11. Resque starten</h3>
<p>Wenn die Überprüfung erfolgreich war, kann Resque gestartet werden (könnte etwas dauern):</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span><span class="nb">cd</span> ~/gitlab
<span class="nv">$ </span>./resque.sh
</pre>
</div>
</figure>
<h3 id="gitlab-start">12. GitLab starten</h3>
<p>Fast geschafft. Jetzt kann GitLab gestartet werden. Das geht über folgenden Aufruf (Wenn Ruby nicht über den RVM installiert wurde, <code>&#038;&#038; rvm use 1.9.3</code> weglassen):</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span><span class="nb">cd</span> ~/gitlab <span class="o">&amp;&amp;</span> rvm use 1.9.3 <span class="o">&amp;&amp;</span> bundle <span class="nb">exec </span>thin start --environment production --port &lt;Port&gt;
</pre>
</div>
</figure>
<p><em>&lt;Port></em> mit einem beliebigen, fünfstelligen, freien Port ersetzen.<br />
Das Konsolenfenster noch nicht schließen! Es dient noch der späteren Überprüfung!</p>
<h3 id="gitlab-web">13. Apache-Rewrites anlegen</h3>
<p>Damit GitLab im Web erreichbar ist, sollte im <code>~/html</code> Verzeichnis eine <code>.htaccess</code> mit folgendem Inhalt angelegt werden:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nt">&lt;IfModule</span> <span class="s">mod_rewrite.c</span><span class="nt">&gt;</span>
  <span class="nb">RewriteEngine</span> <span class="k">On</span>
  <span class="nb">RewriteRule</span> (.*) http://localhost:&lt;Port&gt;/$1 [P]
<span class="nt">&lt;/IfModule&gt;</span>
</pre>
</div>
</figure>
<p><em>&lt;Port></em> mit dem selben Port wie beim thin Server ersetzen.</p>
<h3 id="gitlab-web">14. GitLab Installation finalisieren</h3>
<p>Öffne GitLab im Browser, melde dich an (Name: admin@local.host, Passwort: 5iveL!fe, <b>Passwort später unbedingt ändern!</b>) und erstelle ein Beispiel-Projekt. Achte dabei auf das noch offene Konsolenfenster. Sollte dort keine Fehlermeldung erscheinen kann der thin-Server mit <code>CTRL+C</code> gestoppt werden.<br />
Danach dann als Daemon wieder starten (Wenn Ruby nicht über den RVM installiert wurde, <code>&#038;&#038; rvm use 1.9.3</code> weglassen):</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="nv">$ </span><span class="nb">cd</span> ~/gitlab <span class="o">&amp;&amp;</span> rvm use 1.9.3 <span class="o">&amp;&amp;</span> bundle <span class="nb">exec </span>thin start --environment production --port &lt;Port&gt; --daemonize
</pre>
</div>
</figure>
<h3>FERTIG!</h3>
<p>
<strong>Zum Thema</strong></p>
<ul>
<li><a href="http://gitlabhq.com/">GITLAB: Self Hosted Git Management Application</a> — gitlabhq.com</li>
<li><a href="http://demo.gitlabhq.com/">GitLab Demo</a> — gitlabhq.com</li>
<li><a href="https://uberspace.de/dokuwiki/development:ruby">Uberspace Doku: Ruby</a> — uberspace.de</li>
<li><a href="https://github.com/sitaramc/gitolite">gitolite</a> — github.com</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://wpgrafie.de/1155/anleitung-gitlab-uberspace-installation/feed/</wfw:commentRss>
		<slash:comments>59</slash:comments>
		</item>
		<item>
		<title>WordPress 3.5: oEmbed, Editorhöhe — Weitere Einstellungen von der Oberfläche entfernt</title>
		<link>http://wpgrafie.de/1078/wordpress-einstellungen-entfernt/</link>
		<comments>http://wpgrafie.de/1078/wordpress-einstellungen-entfernt/#comments</comments>
		<pubDate>Mon, 01 Oct 2012 04:00:37 +0000</pubDate>
		<dc:creator>Dominik Schilling</dc:creator>
				<category><![CDATA[WordPress Core]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[oEmbed]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[WordPress 3.5]]></category>

		<guid isPermaLink="false">http://wpgrafie.de/?p=1078</guid>
		<description><![CDATA[„Decisions not Options“: Einstellungen für oEmbed, Uploadverzeichnis und Editorhöhe werden in WordPress 3.5 von der Oberfläche entfernt.

Privatsphäre wird als eigenständige Seite entfernt und den Lese-Einstellungen untergeordnet.]]></description>
				<content:encoded><![CDATA[<p>Eine der Philospophien von WordPress lautet <b>„Decisions not Options“</b> — Treffe Entscheidungen, keine Möglichkeiten.</p>
<blockquote><p>
When making decisions these are the users we consider first. A great example of this consideration is software options. Every time you give a user an option, you are asking them to make a decision. When a user doesn&#8217;t care or understand the option this ultimately leads to frustration. As developers we sometimes feel that providing options for everything is a good thing, you can never have too many choices, right? Ultimately these choices end up being technical ones, choices that the average end user has no interest in. It&#8217;s our duty as developers to make smart design decisions and avoid putting the weight of technical choices on our end users.</p>
<p><cite><a href="http://wordpress.org/about/philosophy/#decisions">WordPress Philosophy</a></cite>
</p></blockquote>
<p>Nachdem schon die <a href="http://wpgrafie.de/994/wordpress-xml-rpc-schnittstelle/" title="WordPress 3.5: XML-RPC Schnittstelle wird standardmäßig für alle Seiten aktiviert">Einstellung für die XML-RPC Schnittstelle</a> entfernt wurde, hier nun ein paar Weitere.</p>
<h3>oEmbed läuft nun komplett automatisch</h3>
<p><a href="http://www.oembed.com/" title="oEmbed">oEmbed</a> ist die Schnittstelle für das automatische Einbinden von zum Beispiel YouTube Videos oder, in WordPress 3.5 neu, <a href="http://soundcloud.com/">Soundcloud</a> und <a href="http://www.slideshare.net/">SlideShare</a> Medien.</p>
<figure id="attachment_1096" class="wp-caption aligncenter" style="width: 706px"><img src="http://wpgrafie.de/wp-content/uploads/2012/09/wordpress-oembed-einstellungen.png" alt="" title="oEmbed Einstellungen" width="706" height="189" class="size-full wp-image-1096" /><figcaption class="wp-caption-text">oEmbed Einstellungen in WordPress 3.4</figcaption></figure>
<p>In den Einstellungen konnten dazu gewisse Anpassungen vorgenommen werden. Zum Beispiel die Höhe oder Breite festlegen, aber auch die automatische Einbindung komplett deaktivieren. In WordPress 3.5 wird dieser Abschnitt nicht mehr vorhanden sein.</p>
<p>Die Breite wird weiterhin durch die global Variable <code>content_width</code> ermittelt. Wenn die Variable nicht definiert wurde, wird die Breite auf 500px festgelegt. Die Höhe des Mediums ist dann das 1,5-fache der Breite. Siehe dazu die Funktion <code>wp_embed_defaults()</code>.<br />
Mit Hilfe des bekannten Shortcodes <code>[embed]</code> ist weiterhin möglich, die Breite bzw. Höhe individuell anzupassen.</p>
<h4 id="oembed-deaktivieren">oEmbed deaktivieren</h4>
<p>Das automatische Einbinden lässt sich ab WordPress 3.5 nur noch über einen Filter deaktivieren. Dazu folgende Zeile:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="sd">/**</span>
<span class="sd"> * Deaktiviert oEmbed ab WordPress 3.5.</span>
<span class="sd"> */</span>
<span class="nx">remove_filter</span><span class="p">(</span> <span class="s1">&#39;the_content&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span> <span class="nv">$GLOBALS</span><span class="p">[</span><span class="s1">&#39;wp_embed&#39;</span><span class="p">],</span> <span class="s1">&#39;autoembed&#39;</span> <span class="p">),</span> <span class="mi">8</span> <span class="p">);</span>
</pre>
</div>
</figure>
<h3>Editorhöhe setzt auf Cookies</h3>
<figure id="attachment_1106" class="wp-caption alignright" style="width: 381px"><img src="http://wpgrafie.de/wp-content/uploads/2012/09/wordpress-einstellung-textbox.png" alt="" title="Textbox Einstellung" width="381" height="93" class="size-full wp-image-1106" /><figcaption class="wp-caption-text">Textbox Einstellung in WordPress 3.4</figcaption></figure>
<p>Die Höhe des Editors (der Textbox) ließ sich in den <em>Einstellungen › Schreiben</em> festlegen. Standardmäßig waren hier 20 Zeilen definiert.</p>
<p>In WordPress 3.5 wird die Höhe in ein Cookie gespeichert. Dadurch kann die Höhe inviduell für den jeweiligen Artikel optimal angepasst werden.</p>
<p>Zusammen mit meinem Plugin <a href="http://wpgrafie.de/wp-plugins/preserve-editor-scroll-position/">Preserve Editor Scroll Position</a> wird das Schreiben direkt viel angenehmer.</p>
<h3>Privatsphäre als eigenständige Seite entfernt</h3>
<p>Zur Privatsphäre gehörte die Einstellung zur Sichtbarkeit der Seite. Diese Einstellung ist aber nicht komplett von der Oberfläche verschwunden.</p>
<p>Die Index-Einstellung ist in WordPress 3.5 nun unter <em>Einstellungen › Lesen</em> einsortiert.<br />
Anstelle einer <i>Ja</i>-<i>Nein</i> Auswahl gibt es auch nur noch eine Checkbox.</p>
<figure id="attachment_1110" class="wp-caption aligncenter" style="width: 693px"><img src="http://wpgrafie.de/wp-content/uploads/2012/09/wordpress-search-engine-visibility.png" alt="" title="Search Engine Visibility" width="693" height="166" class="size-full wp-image-1110" /><figcaption class="wp-caption-text">Index-Einstellung in WordPress 3.5 (en)</figcaption></figure>
<h3>Upload Verzeichnis ändern</h3>
<p>Neben dem Verschieben des <i>wp-content</i>-Verzeichnis, Plugin- oder Theme-Verzeichnis ist es auch möglich, ein benutzerdefiniertes Verzeichnis für die Dateiuploads zu definieren. Der Pfad konnte unter <em>Einstellungen › Mediathek</em> eingestellt werden.<br />
Allerdings war weiterhin ein Zugriff auf das Dateisystem nötig, sodass gerade Anfänger hier viel kaputt machen konnten.<br />
Dies ist auch der Hauptgrund dafür, dass die Einstellung in WordPress 3.5 nicht mehr vorhanden ist. Sie wird nur noch angezeigt, wenn die Einstellung schon vor 3.5 geändert wurde.<br />
Ansonsten lässt sich ein benutzerdefiniertes Verzeichnis weiterhin über <a href="http://wpgrafie.de/195/wordpress-konstanten/" title="WordPress PHP Konstanten im Überblick">Konstanten</a> oder Filter (<code>wp_upload_dir()</code>) definieren.</p>
<p>
<strong>Zum Thema</strong></p>
<ul>
<li><a href="https://core.trac.wordpress.org/ticket/21719">Remove autoembed_urls, embed_size_w, embed_size_h</a> — core.trac.wordpress.org</li>
<li><a href="https://gist.github.com/3796628">WordPress Plugin: Auto-embeds Disabler</a> — gist.github.com</li>
<li><a href="https://core.trac.wordpress.org/ticket/21718">Remove default_post_edit_rows</a> — core.trac.wordpress.org</li>
<li><a href="https://core.trac.wordpress.org/ticket/16416">Settings -&gt; Privacy &#8220;block search engines&#8221; option is not accurate</a> — core.trac.wordpress.org</li>
<li><a href="https://core.trac.wordpress.org/ticket/21720">Hide upload_path and upload_url_path from the UI for new installs</a> — core.trac.wordpress.org</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://wpgrafie.de/1078/wordpress-einstellungen-entfernt/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>WordPress 3.5: XML-RPC Schnittstelle wird standardmäßig für alle Seiten aktiviert</title>
		<link>http://wpgrafie.de/994/wordpress-xml-rpc-schnittstelle/</link>
		<comments>http://wpgrafie.de/994/wordpress-xml-rpc-schnittstelle/#comments</comments>
		<pubDate>Thu, 27 Sep 2012 15:16:13 +0000</pubDate>
		<dc:creator>Dominik Schilling</dc:creator>
				<category><![CDATA[WordPress Core]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[WordPress 3.5]]></category>
		<category><![CDATA[XML-RPC]]></category>

		<guid isPermaLink="false">http://wpgrafie.de/?p=994</guid>
		<description><![CDATA[Die XML-RPC Schnittstelle in WordPress dient dazu, um WordPress mit externen Programmen verwalten zu können. In WordPress 3.5 wird diese für alle Seiten aktiviert.]]></description>
				<content:encoded><![CDATA[<p>Die XML-RPC Schnittstelle in WordPress dient dazu, um WordPress mit externen Programmen verwalten zu können. Zum Beispiel um Artikel zu veröffentlichen oder Kommentare zu bearbeiten. Zu den Programmen gehören unter anderem <a href="http://wordpress.org/extend/mobile/">die mobilen Anwendungen</a> für iOS, Android und Co, aber auch der Windows Live Writer.</p>
<p>Schnittstellen sind immer mit Vorsicht zu genießen, denn bei schlechter Umsetzung können sie eine optimale Angriffsfläche für Angriffe mit bösen Absichten bieten.<br />
Vor WordPress 3.5 gab es deshalb die Möglichkeit die Schnittstelle einfach nach Belieben zu aktivieren bzw. deaktivieren. <b>Deaktiviert war sie aber standardmäßig.</b></p>
<figure id="attachment_1046" class="wp-caption aligncenter" style="width: 703px"><img src="http://wpgrafie.de/wp-content/uploads/2012/09/xmlrpc-ui-setting.png" alt="" title="XML-RPC UI Einstellung" width="703" height="193" class="size-full wp-image-1046" /><figcaption class="wp-caption-text">Diese Einstellungen wird es in WordPress 3.5 nicht mehr geben.</figcaption></figure>
<p>In Laufe der Zeit wurde die XML-RPC Schnittstelle immer weiter ausgebaut und verbessert. Dies geschah hauptsächlich in WordPress 3.4.<br />
Aus diesem Grund wird die XML-RPC Schnittstelle ab WordPress 3.5 <b>standardmäßig aktiviert</b> sein. Für neue Installationen sowie auch bestehende Seiten.<br />
Gleichzeitig wurde die entsprechende Einstellung im User Interface entfernt.</p>
<h4>XML-RPC Schnittstelle in WordPress 3.5 deaktivieren</h4>
<p>Wie nun die Schnittstelle ohne UI deaktivieren? Per Filter.<br />
Zum Deaktivieren wurde ein neuer Filter names <code>xmlrpc_enabled</code> angelegt. Daraus ergibt sich folgender Code:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="sd">/**</span>
<span class="sd"> * Deaktiviert die XML-RPC Schnittstelle ab WordPress 3.5.</span>
<span class="sd"> */</span>
<span class="nx">add_filter</span><span class="p">(</span> <span class="s1">&#39;xmlrpc_enabled&#39;</span><span class="p">,</span> <span class="s1">&#39;__return_false&#39;</span> <span class="p">);</span>
</pre>
</div>
</figure>
<h4>Am Rande: Atom Publishing Protocol</h4>
<p>Neben dem XML-RPC Protokoll gab es in WordPress noch das Atom Publishing Protocol. Diese Schnittstelle wurde in WordPress 3.5 entfernt und <a href="http://wordpress.org/extend/plugins/atom-publishing-protocol/">in ein Plugin ausgelagert</a>.</p>
<p><br/><br />
<strong>Zum Thema</strong></p>
<ul>
<li><a href="https://core.trac.wordpress.org/ticket/21509">Enable XML-RPC by default and remove the option</a> — core.trac.wordpress.org</li>
<li><a href="http://wordpress.org/extend/mobile/">Mobile Apps</a> — wordpress.org</li>
<li><a href="http://codex.wordpress.org/XML-RPC">XML-RPC WordPress API</a> — codex.wordpress.org</li>
<li><a href="https://gist.github.com/3794494">WordPress Plugin: XML-RPC Disabler</a> — gist.github.com</li>
</ul>
<p><small>Titelbild von <a href="https://plus.google.com/116394575739281318169/posts/Lxa8dG7HQ5h">Matt</a>.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpgrafie.de/994/wordpress-xml-rpc-schnittstelle/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>WordPress 3.5: Speicherlimit auf 40 MB erhöht</title>
		<link>http://wpgrafie.de/996/wordpress-speicherlimit-40mb/</link>
		<comments>http://wpgrafie.de/996/wordpress-speicherlimit-40mb/#comments</comments>
		<pubDate>Thu, 20 Sep 2012 09:30:49 +0000</pubDate>
		<dc:creator>Dominik Schilling</dc:creator>
				<category><![CDATA[WordPress Core]]></category>

		<guid isPermaLink="false">http://wpgrafie.de/?p=996</guid>
		<description><![CDATA[Im Zusammenspiel mit vielen Plugins und älteren PHP Versionen kann WordPress recht schnell das festgelegte Speicherlimit überschreiten.

Um dem vorzubeugen wird das Speicherlimit auf 40 MB hochgeschraubt.]]></description>
				<content:encoded><![CDATA[<p>Im Zusammenspiel mit vielen Plugins, älteren PHP Versionen und anderen Faktoren kann WordPress recht schnell das festgelegte Speicherlimit überschreiten. Dies endet dann in der PHP typischen Fehlermeldung à la <i>Fatal error: Allowed memory size of 999999 bytes exhausted</i>.</p>
<p>In der aktuellen Version versucht WordPress das Speicherlimit auf 32 MB festzulegen. „Versucht“ deswegen, weil nicht jeder Webhoster den Zugriff über <code>ini_set()</code> zulässt.</p>
<p>In WordPress 3.5 wird das Speicherlimit nun <b>auf 40 MB erhöht</b>. Das liegt allerdings <b>nicht</b> daran, dass die zukünftige Version 8 MB mehr Speicher benötigt, sondern viel mehr daran, um die schon oben genannte Fehlermeldung zu unterdrücken bzw. mehr Spielraum zu bieten.</p>
<p>Persönliche Meinung: Ich hab die Erhöhung erstmal nicht befürwortet, da es meiner Meinung nach der falsche Weg ist. In der PHP Doku findet man folgende Aussage:</p>
<blockquote><p>
[memory_limit] Setzt den Maximalwert des Speichers in Byte, den ein Skript verbrauchen darf. Damit können schlecht geschriebene Skripte daran gehindert werden, den gesamten verfügbaren Speicher eines Servers „aufzufressen“.
</p></blockquote>
<p>Heißt im Umkehrschluss: Schlechte Skripte aka Plugins bekommen mehr „zu fressen“.</p>
<p>Allerdings muss es nicht immer ein schlechtes Plugin sein. Benutzer erwarten heutzutage leider immer mehr die eierlegende Wollmilchsau. Und natürlich spielt die Anzahl von Plugins auch eine wesentliche Rolle. — Nein, 50 aktive Plugins zu haben ist nicht normal.</p>
<h4>Wie sieht dein Speicherverbrauch aus?</h4>
<p>Der Speicherverbrauch meines Dashboards beläuft sich aktuell auf 19,6 MB bei 9 Datenbankabfragen, 7 aktivierten Plugins und deutscher Sprachdatei. Ein guter Wert, wie ich finde.<br />
Diese Informationen lass ich mir übrigens bei jeder Seite durch ein kleines Plugin ausgeben. Das Plugin habe ich mal auf <a href="https://gist.github.com/3751658">Github veröffentlicht</a>.</p>
<p>Mich würde nun mal brennend interessieren, wie den dein aktueller Speicherverbrauch ausfällt und wie viele Plugins aktiviert sind? Würdet ihr von einer Speichererhöhung profitieren?</p>
<p><br/><br />
<strong>Zum Thema</strong></p>
<ul>
<li><a href="http://core.trac.wordpress.org/ticket/21646">Bump memory limit from 32MB</a> — core.trac.wordpress.org</li>
<li><a href="http://www.php.net/manual/de/ini.core.php#ini.memory-limit">php.ini Direktiven: memory_limit </a> — php.net</li>
<li><a href="http://faq.wpde.org/exhausted-php-memory/">»Fatal error: Allowed memory size of *** bytes exhausted…« ?</a> — faq.wpde.org</li>
<li><a href="https://gist.github.com/3751658">WordPress: Print some debug infos into backend footer</a> — gist.github.com</li>
</ul>
<p><small>Titelbild von <a href="http://www.flickr.com/photos/jjackowski/6331139486/in/photostream/">jjackowski</a>, CC BY-NC-SA 2.0.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpgrafie.de/996/wordpress-speicherlimit-40mb/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>WebKit XSS Filter blockt Inlineframes und Flash Objekte in der WordPress Artikelvorschau</title>
		<link>http://wpgrafie.de/schnipsel/webkit-xss-wordpress-vorschau/</link>
		<comments>http://wpgrafie.de/schnipsel/webkit-xss-wordpress-vorschau/#comments</comments>
		<pubDate>Wed, 05 Sep 2012 22:58:42 +0000</pubDate>
		<dc:creator>Dominik Schilling</dc:creator>
		
		<guid isPermaLink="false">http://wpgrafie.de/?post_type=schnipsel&#038;p=896</guid>
		<description><![CDATA[Webkit Browser sind mit einem besonderen Schutz vor Cross-Site-Scripting (XSS) ausgestattet. Dieser Schutz kann Probleme bei der WordPress Artikelvorschau verursachen.

Mittels einem HTTP-Headerfeld ist dieses Problem allerdings umgehbar.]]></description>
				<content:encoded><![CDATA[<p>Cross-Site-Scripting (XSS), also das Einfügen von schädlichen Skripter einer Seite A in Seite B, ist ein Sicherheitsfaktor, den es gilt zu unterbinden. Primär sind dafür die Entwickler der jeweiligen Webseite zuständig.<br />
Doch auch heutige Browser klinken sich in die Thematik ein.</p>
<p><a href="http://blog.chromium.org/2010/01/security-in-depth-new-security-features.html">Seit geraumer Zeit</a> besitzen WebKit Browser, siehe Chrome und Safari, einen XSS Filter, der überprüft, ob ein Skript, welches auf einer Webseite ausgeführt werden soll, sich auch schon in der POST Anfrage befand. Ist dem so, kann dies ein Indiz für eine XSS-Attacke sein und wird geblockt.</p>
<p>Mit folgenden Beispiel kann der XSS Filter selbst getestet werden:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="cp">&lt;?php</span>
<span class="k">if</span><span class="p">(</span> <span class="o">!</span> <span class="nv">$_POST</span> <span class="p">)</span> <span class="o">:</span>
<span class="cp">?&gt;</span>
<span class="nt">&lt;form</span> <span class="na">method=</span><span class="s">&quot;post&quot;</span><span class="nt">&gt;</span>
<span class="hll">	<span class="nt">&lt;input</span> <span class="na">name=</span><span class="s">&quot;xss&quot;</span> <span class="na">value=</span><span class="s">&quot;&lt;iframe src=&#39;http://example.com&#39;&gt;&lt;/iframe&gt;&quot;</span> <span class="nt">/&gt;</span>
</span>	<span class="nt">&lt;input</span> <span class="na">type=</span><span class="s">&quot;submit&quot;</span> <span class="nt">/&gt;</span>
<span class="nt">&lt;/form&gt;</span>
<span class="cp">&lt;?php</span>
<span class="hll"><span class="k">else</span> <span class="o">:</span>
</span>	<span class="k">echo</span> <span class="nv">$_POST</span><span class="p">[</span><span class="s1">&#39;xss&#39;</span><span class="p">];</span>
<span class="k">endif</span><span class="p">;</span>
</pre>
</div>
</figure>
<h4>Was hat das nun mit der Artikelvorschau in WordPress zu tun?</h4>
<p>Ganz einfach: Starte Chrome oder Safari, erstelle einen Artikel mit einem YouTube Video und klicke auf den Button <em>Vorschau</em>.</p>
<p>Das Ergebnis:</p>
<figure id="attachment_980" class="wp-caption aligncenter" style="width: 700px"><img src="http://wpgrafie.de/wp-content/uploads/2012/09/wordpress-preview-webkit.png" alt="WordPress Vorschau im Webkit Browser" title="Artikel Vorschau eines YouTube Videos im Webkit Browser" width="700" height="472" class="size-full wp-image-980" /><figcaption class="wp-caption-text">Artikel Vorschau eines YouTube Videos im Webkit Browser</figcaption></figure>
<p>Man sucht vergeblich das YouTube Video, die Konsole wirft ein „<span style="color:red">Refused to execute a JavaScript script. Source code of script found within request.</span>“ aus und nach einem Reload des Fensters ist das YouTube Video wieder da.</p>
<figure id="attachment_982" class="wp-caption alignright" style="width: 256px"><img src="http://wpgrafie.de/wp-content/uploads/2012/09/wordpress-aktikelvorschau-weg.png" alt="WordPress Artikelvorschau" title="WordPress Artikelvorschau" width="256" height="388" class="size-full wp-image-982" /><figcaption class="wp-caption-text">Visualisierung der Artikelvorschau</figcaption></figure>
<p>Warum? Der XSS-Filter hat zugeschlagen.</p>
<p>Beim Klick auf den <em>Vorschau</em> Button wird eine POST Abfrage an <code>/wp-admin/post.php</code> gestartet und intern als <code>post.php?action=preview</code> aufgenommen.</p>
<p>Dadurch wird erreicht, dass eventuelle Änderungen in einem Entwurf oder einer Revision (Autosave) gespeichert werden. Genaueres kann man der Funktion <code>post_preview()</code> entnehmen.</p>
<p>Das Wichtige an der Funktion ist die Rückgabe. Er enthält die Weiterleitung zur eigentlichen Vorschau.</p>
<p>Wie bekannt ist, zeigt die Vorschau eine 1:1 Kopie des Artikels samt Änderungen. Dazu zählt auch in unserem Fall der vorher per POST gesendete Artikelinhalt mit dem YouTube Video.<br />
Wir erinnern uns zurück: Der XSS-Filter schlägt zu, wenn ein Skript in einer POST Abfrage gefunden wird und gleichzeitig vom Browser gerendert werden soll.<br />
Trotz dem Umweges ist dies nun bei WordPress genau der Fall.</p>
<p>Und jetzt?</p>
<h4>Den WebKit XSS Filter umgehen</h4>
<p>Mit Hilfe eines nicht-standardisierten HTTP-Headerfeldes <code>X-XSS-Protection</code> kann dem Browser mitteilt werden, dass schon auf der Client-Seite für die nötige Sicherheit gesorgt wurde. Der Wert des Feldes sollte dann mit <code>0</code> belegt werden.</p>
<p>Folgende Zeilen setzen das Vorhaben für unsere Artikelvorschau um und sollte in einem Plugin Platz finden.</p>
<figure class="code-block">
<figcaption class="gist-meta">PHP / <a target="_blank" href="https://gist.github.com/raw/3622298/68a474a23ba498f48ed9f50b4c902e0cae61c4ae/plugin.php" title="Ohne Syntax-Highlight">Text</a> / <a target="_blank" href="https://gist.github.com/3622298#file_plugin.php">github<span class="dot">:</span><span class="gist">gist</span></a></figcaption>
<div class="highlight">
<pre><span class="sd">/**</span>
<span class="sd"> * Add a X-XSS-Protection = 0 header for post previews to allow</span>
<span class="sd"> * Webkit browsers to render iframe and flash objects.</span>
<span class="sd"> * @see: http://core.trac.wordpress.org/ticket/20148</span>
<span class="sd"> *</span>
<span class="sd"> * @param $headers array  Already added header items.</span>
<span class="sd"> * @param $object  WP     The query variables.</span>
<span class="sd"> *</span>
<span class="sd"> * @return array</span>
<span class="sd"> */</span>
<span class="k">function</span> <span class="nf">send_no_xss_protection_header</span><span class="p">(</span> <span class="nv">$headers</span><span class="p">,</span> <span class="nv">$object</span> <span class="p">)</span> <span class="p">{</span>
	<span class="k">if</span> <span class="p">(</span>
		<span class="o">!</span> <span class="k">empty</span><span class="p">(</span> <span class="nv">$object</span><span class="o">-&gt;</span><span class="na">query_vars</span><span class="p">[</span><span class="s1">&#39;preview&#39;</span><span class="p">]</span> <span class="p">)</span> <span class="o">&amp;&amp;</span>
		<span class="o">!</span> <span class="k">empty</span><span class="p">(</span> <span class="nv">$object</span><span class="o">-&gt;</span><span class="na">query_vars</span><span class="p">[</span><span class="s1">&#39;p&#39;</span><span class="p">]</span> <span class="p">)</span> <span class="o">&amp;&amp;</span>
		<span class="nx">wp_get_referer</span><span class="p">()</span> <span class="o">&amp;&amp;</span>
		<span class="nx">wp_get_referer</span><span class="p">()</span> <span class="o">==</span> <span class="nb">sprintf</span><span class="p">(</span> <span class="nx">admin_url</span><span class="p">(</span> <span class="s1">&#39;post.php?post=%d&amp;action=edit&#39;</span> <span class="p">),</span> <span class="nv">$object</span><span class="o">-&gt;</span><span class="na">query_vars</span><span class="p">[</span><span class="s1">&#39;p&#39;</span><span class="p">]</span> <span class="p">)</span>
	<span class="p">)</span>
		<span class="nv">$headers</span><span class="p">[</span><span class="s1">&#39;X-XSS-Protection&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>


	<span class="k">return</span> <span class="nv">$headers</span><span class="p">;</span>
<span class="p">}</span>
<span class="nx">add_filter</span><span class="p">(</span> <span class="s1">&#39;wp_headers&#39;</span><span class="p">,</span> <span class="s1">&#39;send_no_xss_protection_header&#39;</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">2</span> <span class="p">);</span>
</pre>
</div>
<figcaption class="gist-meta">PHP / <a target="_blank" href="https://gist.github.com/raw/3622298/68a474a23ba498f48ed9f50b4c902e0cae61c4ae/plugin.php" title="Ohne Syntax-Highlight">Text</a> / <a target="_blank" href="https://gist.github.com/3622298#file_plugin.php">github<span class="dot">:</span><span class="gist">gist</span></a></figcaption>
</figure>
<p>Führt man das obige Szenarion nun erneut aus, so sollte das YouTube Video direkt angezeigt werden.</p>
<p><br/><br />
<strong>Zum Thema</strong></p>
<ul>
<li><a href="http://core.trac.wordpress.org/ticket/20148">Preview post in Webkit browser doesn&#8217;t render Flash objects</a> — core.trac.wordpress.org</li>
<li><a href="http://blog.chromium.org/2010/01/security-in-depth-new-security-features.html">Security in Depth: New Security Features</a> — blog.chromium.org</li>
<li><a href="http://blogs.msdn.com/b/ieinternals/archive/2011/01/31/controlling-the-internet-explorer-xss-filter-with-the-x-xss-protection-http-header.aspx">Controlling the XSS Filter</a> — blogs.msdn.com</li>
<li><a href="https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS">HTTP access control (CORS)</a> — developer.mozilla.org</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://wpgrafie.de/schnipsel/webkit-xss-wordpress-vorschau/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress 3.5: Willkommen Backbone.js und Underscore.js; Adios Prototype und script.aculo.us</title>
		<link>http://wpgrafie.de/928/wordpress-backbonejs-underscorejs/</link>
		<comments>http://wpgrafie.de/928/wordpress-backbonejs-underscorejs/#comments</comments>
		<pubDate>Thu, 23 Aug 2012 17:01:26 +0000</pubDate>
		<dc:creator>Dominik Schilling</dc:creator>
				<category><![CDATA[WordPress Core]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[WordPress 3.5]]></category>

		<guid isPermaLink="false">http://wpgrafie.de/?p=928</guid>
		<description><![CDATA[Während des gestrigen Entwickler Chats waren die JavaScript Bibliotheken in WordPress großes Thema.

Das Ergebnis: jQuery und jQuery UI wurden aktualisiert, Backbone.js und Underscore.js werden in den WordPress Core eingebunden, Prototype und script.aculo.us hingegen ausgelagert.]]></description>
				<content:encoded><![CDATA[<p>Während des gestrigen <a href="http://make.wordpress.org/core/weekly-developer-chats/">Entwickler Chats</a> waren die JavaScript Bibliotheken in WordPress großes Thema.</p>
<p>Zum einem wurde <a href="http://blog.jquery.com/2012/08/09/jquery-1-8-released/">jQuery 1.8</a>, welches mittlerweile 3 Wochen auf dem Markt ist, für den Core abgesegnet. Zudem wurde auch jQuery UI auf die <a href="http://blog.jqueryui.com/2012/08/jquery-ui-1-8-23/">stabile Version 1.8.23</a> aktualisiert.</p>
<h3>Backbone.js und Underscore.js</h3>
<p><a href="http://backbonejs.org/">Backbone.js</a> ist ein Model-View-Controller (<a href="http://de.wikipedia.org/wiki/Model_View_Controller">MVC</a>) Framework für JavaScript. Die Bibliotheken bieten eine solide Basis für objektorientierte Programmierung und simulieren etliche Hilfsfunktionen und eine erweiterbare Klassenhierarchie.<br />
Dieser Vorteil ermöglicht das organisieren der Daten und die saubere Trennung zwischen Daten und Logik.<br />
Mit der integrierten Template-Engine kann das HTML-Markup und die Logik sauber voneinander getrennt werden.</p>
<blockquote><p>With Backbone, you represent your data as Models, which can be created, validated, destroyed, and saved to the server. Whenever a UI action causes an attribute of a model to change, the model triggers a &#8220;change&#8221; event; all the Views that display the model&#8217;s state can be notified of the change, so that they are able to respond accordingly, re-rendering themselves with the new information. In a finished Backbone app, you don&#8217;t have to write the glue code that looks into the DOM to find an element with a specific id, and update the HTML manually — when the model changes, the views simply update themselves.</p>
<p><cite><a href="http://backbonejs.org/#introduction">Backbone.js: Introduction</a></cite>
</p></blockquote>
<p><a href="http://underscorejs.org/">Underscore.js</a> verspricht hingegen die Unterstützung von funktionalen Programmierkonstrukten für den Umgang mit Arrays, Collections und Objekten, wie zum Beispiel <code>each</code>, <code>map</code>, <code>find</code>, <code>filter</code> oder <code>toArray</code>.</p>
<blockquote><p>Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects. It&#8217;s the tie to go along with jQuery&#8217;s tux, and Backbone.js&#8217;s suspenders.</p>
<p>Underscore provides 60-odd functions that support both the usual functional suspects as well as more specialized helpers. It delegates to built-in functions, if present, so modern browsers will use the native implementations.</p>
<p><cite><a href="http://underscorejs.org/#introduction">Underscore.js: Introduction</a></cite>
</p></blockquote>
<h4>Was will WordPress mit Backbone.js und Underscore.js?</h4>
<p>Beide Projekte sind eine optimale Grundlage für sogenannte Single-Page Webanwendungen.<br />
Eine solche Anwendungen findet man auch jetzt schon im WordPress Core.</p>
<p><img src="http://wpgrafie.de/wp-content/uploads/2012/08/wordpress-theme-customizer.png" alt="WordPress Theme Customizer" title="WordPress Theme Customizer" width="710" height="300" class="aligncenter size-full wp-image-939" /></p>
<p>Es ist der <b>Theme Customizer</b> (Live-Vorschau des Themes), der mit WordPress 3.4 eingeführt wurde.</p>
<p>In WordPress 3.5 wird es weitere Projekte geben, die auf diese Art umgesetzt werden sollen.<br />
Dazu zählt der neue <a href="http://wpgrafie.de/881/wordpress-wireframes-medien-dialogfenster/">Media-Workflow samt den Dialogfenster</a>, sowie die Umsetzung von Aktionen und Filtern für JavaScript, quasi <code>add_action()</code> bzw. <code>add_filter()</code> für JavaScript.</p>
<h4>Den Grafiken folgen Prototype und script.aculo.us</h4>
<p>Wie schon berichtet, hat WordPress sich von <a href="http://wpgrafie.de/906/wordpress-grafiken-css3-gradients/">ungenutzten Grafiken befreit</a>. Jetzt hat es auch die beiden JavaScript Bibliotheken/Frameworks <a href="http://www.prototypejs.org/">Prototype</a> und <a href="http://script.aculo.us">script.aculo.us</a> getroffen. Kein großer Verlust, denn sie wurden schon länger nicht mehr genutzt.</p>
<p><b>Fallback für Plugins/Themes:</b> Falls doch noch ein Plugin/Theme existiert, welches von den beiden Bibliotheken abhängig ist, werden die benötigten Skripte automatisch von der <a href="https://developers.google.com/speed/libraries/devguide">Google API</a> eingebunden. Guter Schachzug meiner Meinung nach.</p>
<p>Ausschnitt aus der Funktion <code>wp_default_scripts()</code>:</p>
<figure class="code-block">
<div class="highlight">
<pre><span class="o">&lt;?</span><span class="nx">php</span>
	<span class="c1">// WordPress no longer uses or bundles Prototype or script.aculo.us. These are now pulled from an external source.</span>
	<span class="nv">$scripts</span><span class="o">-&gt;</span><span class="na">add</span><span class="p">(</span> <span class="s1">&#39;prototype&#39;</span><span class="p">,</span> <span class="s1">&#39;//ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(),</span> <span class="s1">&#39;1.7.1&#39;</span><span class="p">);</span>
	<span class="nv">$scripts</span><span class="o">-&gt;</span><span class="na">add</span><span class="p">(</span> <span class="s1">&#39;scriptaculous-root&#39;</span><span class="p">,</span> <span class="s1">&#39;//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;prototype&#39;</span><span class="p">),</span> <span class="s1">&#39;1.9.0&#39;</span><span class="p">);</span>
	<span class="nv">$scripts</span><span class="o">-&gt;</span><span class="na">add</span><span class="p">(</span> <span class="s1">&#39;scriptaculous-builder&#39;</span><span class="p">,</span> <span class="s1">&#39;//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/builder.js&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;scriptaculous-root&#39;</span><span class="p">),</span> <span class="s1">&#39;1.9.0&#39;</span><span class="p">);</span>
	<span class="nv">$scripts</span><span class="o">-&gt;</span><span class="na">add</span><span class="p">(</span> <span class="s1">&#39;scriptaculous-dragdrop&#39;</span><span class="p">,</span> <span class="s1">&#39;//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/dragdrop.js&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;scriptaculous-builder&#39;</span><span class="p">,</span> <span class="s1">&#39;scriptaculous-effects&#39;</span><span class="p">),</span> <span class="s1">&#39;1.9.0&#39;</span><span class="p">);</span>
	<span class="nv">$scripts</span><span class="o">-&gt;</span><span class="na">add</span><span class="p">(</span> <span class="s1">&#39;scriptaculous-effects&#39;</span><span class="p">,</span> <span class="s1">&#39;//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/effects.js&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;scriptaculous-root&#39;</span><span class="p">),</span> <span class="s1">&#39;1.9.0&#39;</span><span class="p">);</span>
	<span class="nv">$scripts</span><span class="o">-&gt;</span><span class="na">add</span><span class="p">(</span> <span class="s1">&#39;scriptaculous-slider&#39;</span><span class="p">,</span> <span class="s1">&#39;//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/slider.js&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;scriptaculous-effects&#39;</span><span class="p">),</span> <span class="s1">&#39;1.9.0&#39;</span><span class="p">);</span>
	<span class="nv">$scripts</span><span class="o">-&gt;</span><span class="na">add</span><span class="p">(</span> <span class="s1">&#39;scriptaculous-sound&#39;</span><span class="p">,</span> <span class="s1">&#39;//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/sound.js&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span> <span class="s1">&#39;scriptaculous-root&#39;</span> <span class="p">),</span> <span class="s1">&#39;1.9.0&#39;</span> <span class="p">);</span>
	<span class="nv">$scripts</span><span class="o">-&gt;</span><span class="na">add</span><span class="p">(</span> <span class="s1">&#39;scriptaculous-controls&#39;</span><span class="p">,</span> <span class="s1">&#39;//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/controls.js&#39;</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;scriptaculous-root&#39;</span><span class="p">),</span> <span class="s1">&#39;1.9.0&#39;</span><span class="p">);</span>
	<span class="nv">$scripts</span><span class="o">-&gt;</span><span class="na">add</span><span class="p">(</span> <span class="s1">&#39;scriptaculous&#39;</span><span class="p">,</span> <span class="k">false</span><span class="p">,</span> <span class="k">array</span><span class="p">(</span><span class="s1">&#39;scriptaculous-dragdrop&#39;</span><span class="p">,</span> <span class="s1">&#39;scriptaculous-slider&#39;</span><span class="p">,</span> <span class="s1">&#39;scriptaculous-controls&#39;</span><span class="p">)</span> <span class="p">);</span>
</pre>
</div>
</figure>
<h4>Nebenbei: min.css/min.js für komprimierte Stylesheets/Skripte</h4>
<p>Bisher wurden die unkomprimierte Stylesheets mit der Endung <code>.dev.css</code> kenntlich gemacht, analog bei den Skripten <code>.dev.js</code>.<br />
WordPress 3.5 geht nun die typische .min Konvention ein, das heißt: Komprimierte Dateien bekommen die Endung .min.css/.min.js und die Unkomprimierten haben keinen Suffix mehr.</p>
<p><b>Vor WordPress 3.4:</b><br />
Entwicklerversion: <code>dateiname.dev.css</code><br />
Komprimierte Version: <code>dateiname.css</code></p>
<p><b>Mit WordPress 3.5:</b><br />
Entwicklerversion: <code>dateiname.css</code><br />
Komprimierte Version: <code>dateiname.min.css</code></p>
<p><br/><br />
<strong>Zum Thema</strong></p>
<ul>
<li><a href="http://core.trac.wordpress.org/ticket/21661">Move unused JavaScript libraries to external sources</a> — core.trac.wordpress.org</li>
<li><a href="http://core.trac.wordpress.org/ticket/21170">JavaScript actions and filters</a> — core.trac.wordpress.org</li>
<li><a href="http://core.trac.wordpress.org/ticket/21633">Switch to min.js convention</a> — core.trac.wordpress.org</li>
<li><a href="http://core.trac.wordpress.org/ticket/21664">Add Underscore.js and Backbone.js to core</a> — core.trac.wordpress.org</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://wpgrafie.de/928/wordpress-backbonejs-underscorejs/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
