<?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>naden.de/blog</title> <atom:link href="http://www.naden.de/blog/feed" rel="self" type="application/rss+xml" /><link>http://www.naden.de/blog</link> <description>/* no comment */</description> <lastBuildDate>Tue, 23 Feb 2010 21:04:58 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.1</generator> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Kombinierte Terms-Listings in Drupal</title><link>http://www.naden.de/blog/kombinierte-terms-listings-in-drupal</link> <comments>http://www.naden.de/blog/kombinierte-terms-listings-in-drupal#comments</comments> <pubDate>Tue, 23 Feb 2010 21:01:27 +0000</pubDate> <dc:creator>naden</dc:creator> <category><![CDATA[Drupal]]></category> <category><![CDATA[combine]]></category> <category><![CDATA[taxonomy]]></category> <category><![CDATA[term]]></category> <category><![CDATA[terms]]></category><guid
isPermaLink="false">http://www.naden.de/blog/?p=229</guid> <description><![CDATA[In Drupal lassen sich Terme mit AND oder OR verkn&#252;pfen, um ein Listing zu erstellen was mit N Termen assoziert ist oder mit einem von N-Termen. Leider bietet Drupal aber keine M&#246;glichkeit an, ein solches Listing zu erstellen. Das erledigt meine kleine Hilfsfunktion combine_terms();./**
* Generates combined terms list
*
* @param $terms
*  [...]]]></description> <content:encoded><![CDATA[<p>In Drupal lassen sich Terme mit AND oder OR verkn&#252;pfen, um ein Listing zu erstellen was mit N Termen assoziert ist oder mit einem von N-Termen. Leider bietet Drupal aber keine M&#246;glichkeit an, ein solches Listing zu erstellen. Das erledigt meine kleine Hilfsfunktion <em>combine_terms();</em>.<span
id="more-229"></span></p><div
class="wp_codebox"><table><tr
id="p2292"><td
class="code" id="p229code2"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Generates combined terms list
 *
 * @param $terms
 *   array of terms
 * @param $conjunction
 *   , or +, default ,
 * @param $delimiter
 *   term delimiter, default ' + '
 * @return
 *   themed html to display
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> combine_terms<span style="color: #009900;">&#40;</span><span style="color: #000088;">$terms</span><span style="color: #339933;">,</span> <span style="color: #000088;">$conjunction</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">','</span><span style="color: #339933;">,</span> <span style="color: #000088;">$delimiter</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">' + '</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <a href="http://www.php.net/list"><span style="color: #990000;">list</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> taxonomy_term_path<span style="color: #009900;">&#40;</span><span style="color: #000088;">$terms</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// build &quot;regular&quot; term listing</span>
  <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$terms</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$term</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$term</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$term</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span> <span style="color: #339933;">:</span> <a href="http://www.php.net/strip_tags"><span style="color: #990000;">strip_tags</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$term</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">description</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$term_link</span> <span style="color: #339933;">=</span> l<span style="color: #009900;">&#40;</span><span style="color: #000088;">$term</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$path</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'/'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$term</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tid</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'attributes'</span> <span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rel'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'tag'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$description</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;li class=&quot;vocab-term&quot;&gt;'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$term_link</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$delimiter</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/li&gt;'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// build the combined term listing</span>
  <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$k</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$k</span><span style="color: #339933;">&lt;</span>count <span style="color: #009900;">&#40;</span><span style="color: #000088;">$terms</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$k</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$k</span> <span style="color: #339933;">==</span> <a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$terms</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$k</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000088;">$index</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$k</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">&gt;</span> <a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$terms</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span> ? <span style="color: #cc66cc;">0</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$k</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <a href="http://www.php.net/sprintf"><span style="color: #990000;">sprintf</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;li class=&quot;vocab-term&quot;&gt;&lt;a href=&quot;/%s/%d%s%d&quot; rel=&quot;tag&quot; title=&quot;%s %s&quot;&gt;%s %s&lt;/a&gt;%s&lt;/li&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$path</span><span style="color: #339933;">,</span> <span style="color: #000088;">$terms</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tid</span><span style="color: #339933;">,</span> <span style="color: #000088;">$conjunction</span><span style="color: #339933;">,</span> <span style="color: #000088;">$terms</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$index</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tid</span><span style="color: #339933;">,</span> <span style="color: #000088;">$terms</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$terms</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$index</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$terms</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$terms</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$index</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$delimiter</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$output</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>count<span style="color: #339933;">&gt;</span></pre></td></tr></table></div><p>Ist eine Node also mit den Termen A, B und C assoziert, so liefert der Aufruf von <em>combine_terms()</em> das folgende Listing:</p><p><code>A, B, C, A+B, A+C, B+C bzw. A, B, C, A,B, A,C, B,C</code></p> ]]></content:encoded> <wfw:commentRss>http://www.naden.de/blog/kombinierte-terms-listings-in-drupal/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Wordpress Feed auf Kategorien beschr&#228;nken</title><link>http://www.naden.de/blog/wordpress-feed-auf-kategorien-beschraenken</link> <comments>http://www.naden.de/blog/wordpress-feed-auf-kategorien-beschraenken#comments</comments> <pubDate>Tue, 23 Feb 2010 18:05:45 +0000</pubDate> <dc:creator>naden</dc:creator> <category><![CDATA[Wordpress]]></category> <category><![CDATA[category]]></category> <category><![CDATA[customize]]></category> <category><![CDATA[exclude]]></category> <category><![CDATA[feed]]></category> <category><![CDATA[restrict]]></category><guid
isPermaLink="false">http://www.naden.de/blog/?p=223</guid> <description><![CDATA[Um seinen Newsfeed auf bestimmte Kategorien zu beschr&#228;nken reicht ein kleiner Hack, den man z.B. in der functions.php ablegen kann oder in einem Mini-Plugin.add_filter&#40;'pre_get_posts', 'feed_by_categories'&#41;;
&#160;
function feed_by_categories&#40;$query&#41; &#123;
&#160;
if&#40;$query-&#62;is_feed&#41; &#123;
$query-&#62;set&#40;'cat', '12,13,9'&#41;;
&#125;
&#160;
return $query;
&#125;Durch diese &#196;nderung werden im Feed nur Blogbeitr&#228;ge der Kategorien 12, 13 und 9 gelistet.
]]></description> <content:encoded><![CDATA[<p>Um seinen Newsfeed auf bestimmte Kategorien zu beschr&#228;nken reicht ein kleiner Hack, den man z.B. in der functions.php ablegen kann oder in einem Mini-Plugin.<span
id="more-223"></span></p><div
class="wp_codebox"><table><tr
id="p2234"><td
class="code" id="p223code4"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'pre_get_posts'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'feed_by_categories'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> feed_by_categories<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">is_feed</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cat'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'12,13,9'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$query</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div><p>Durch diese &#196;nderung werden im Feed nur Blogbeitr&#228;ge der Kategorien 12, 13 und 9 gelistet.</p> ]]></content:encoded> <wfw:commentRss>http://www.naden.de/blog/wordpress-feed-auf-kategorien-beschraenken/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Jetmarks &#8211; Jetpack Plugin released</title><link>http://www.naden.de/blog/jetmarks-jetpack-plugin-released</link> <comments>http://www.naden.de/blog/jetmarks-jetpack-plugin-released#comments</comments> <pubDate>Mon, 15 Feb 2010 22:24:24 +0000</pubDate> <dc:creator>naden</dc:creator> <category><![CDATA[allgemeines]]></category> <category><![CDATA[bing]]></category> <category><![CDATA[Firefox]]></category> <category><![CDATA[google]]></category> <category><![CDATA[jetmarks]]></category> <category><![CDATA[jetpack]]></category> <category><![CDATA[yahoo]]></category><guid
isPermaLink="false">http://www.naden.de/blog/?p=198</guid> <description><![CDATA[Click here for an english translation.
Wer wie ich weit mehr als 1000 Bookmarks zu allen m&#246;glichen Artikeln und Blogbeitr&#228;gen besitzt, der verliert irgendwann den &#220;berblick &#252;ber seine Sammlung und diese wird dadurch wertlos.
So sucht man erneut nach L&#246;sungen im Internet, obwohl dazu m&#246;glicherweise bereits ein brauchbares Bookmark angelegt wurde.
Nachdem ich diverse Bookmark-Addons ausprobiert hatte [...]]]></description> <content:encoded><![CDATA[<p><a
href="#english">Click here for an english translation.</a></p><p>Wer wie ich weit mehr als 1000 Bookmarks zu allen m&#246;glichen Artikeln und Blogbeitr&#228;gen besitzt, der verliert irgendwann den &#220;berblick &#252;ber seine Sammlung und diese wird dadurch wertlos.</p><p>So sucht man erneut nach L&#246;sungen im Internet, obwohl dazu m&#246;glicherweise bereits ein brauchbares Bookmark angelegt wurde.</p><p>Nachdem ich diverse Bookmark-Addons ausprobiert hatte und mit keinem so richtig zufrieden war, habe ich Jetmarks unter den folgenden Gesichtspunkten programmiert:</p><p><strong>Merkmale</strong></p><ul><li>Jetmarks sollte mit so wenig Aufwand wie m&#246;glich geschrieben werden. Deshalb ist es ein Jetpack-Plugin und kein &#8220;normales&#8221; Firefox-Plugin.</li><li>Jetmarks sollte keinerlei Remote-Aufrufe ben&#246;tigen, keinen Daemon, kein Ajax etc.</li><li>Jetmarks sollte keine eigene GUI haben, keine Toolbar ben&#246;tigen oder auch nur einen extra Suchschlitz brauchen.</li><li>Jetmarks sollte das normale Suchverhalten &#252;ber Google, Yahoo! oder Bing bereichern.</li></ul><p><strong>F&#252;r die Installation besuche bitte die <a
href="/blog/jetmarks">Plugin Webseite</a>.</strong></p><p><strong>Konfiguration</strong><br
/> Folgende Einstellungen sind m&#246;glich:</p><ul><li>Limit: Anzahl der Ergebnisse, bevor ausgeblendet wird.</li><li>Sprache, Deutsch oder Englisch</li><li>Wie sollen Suchbegriffe verbunden werden: AND oder OR</li><li>Hintergrundfarbe</li><li>Highlightfarbe</li></ul><p><strong>Screenshots</strong><br
/><a
href='http://www.naden.de/blog/jetmarks-jetpack-plugin-released/jetmarks-bing-serps' title='jetmarks-bing-serps'><img
width="150" height="115" src="http://www.naden.de/blog/wp-content/uploads/jetmarks-bing-serps.jpg" class="attachment-thumbnail" alt="" title="jetmarks-bing-serps" /></a> <a
href='http://www.naden.de/blog/jetmarks-jetpack-plugin-released/jetmarks-configuration' title='jetmarks-configuration'><img
width="150" height="107" src="http://www.naden.de/blog/wp-content/uploads/jetmarks-configuration.jpg" class="attachment-thumbnail" alt="" title="jetmarks-configuration" /></a> <a
href='http://www.naden.de/blog/jetmarks-jetpack-plugin-released/jetmarks-google-serps' title='jetmarks-google-serps'><img
width="150" height="112" src="http://www.naden.de/blog/wp-content/uploads/jetmarks-google-serps.jpg" class="attachment-thumbnail" alt="" title="jetmarks-google-serps" /></a> <a
href='http://www.naden.de/blog/jetmarks-jetpack-plugin-released/jetmarks-google-serps-expanded' title='jetmarks-google-serps-expanded'><img
width="150" height="126" src="http://www.naden.de/blog/wp-content/uploads/jetmarks-google-serps-expanded.jpg" class="attachment-thumbnail" alt="" title="jetmarks-google-serps-expanded" /></a> <a
href='http://www.naden.de/blog/jetmarks-jetpack-plugin-released/jetmarks-yahoo-serps' title='jetmarks-yahoo-serps'><img
width="149" height="141" src="http://www.naden.de/blog/wp-content/uploads/jetmarks-yahoo-serps.jpg" class="attachment-thumbnail" alt="" title="jetmarks-yahoo-serps" /></a></p><p><strong>Was Jetmarks nicht ist</strong><br
/> Jetmarks ist keine Volltextsuchmaschine, sondern nutzt die Firefox-Places API, die keinen Volltextindex f&#252;r Bookmarks bereitstellt. Ein Bookmark wird dann gelistet, wenn eines der eingegebenen Keywords im Titel oder der URL gefunden wird. Es findet kein Ranking statt.<br
/> Mitunter sind die Ergebnisse etwas unsch&#246;n, da bei der Suche nach &#8220;html&#8221; oder &#8220;php&#8221; auch URL&#8217;s gelistet werden, die eine dieser Zeichenketten als Endung beinhalten.</p><p>Mir pers&#246;nlich hat Jetmarks sehr geholfen meine Bookmarksammlung wieder besser nutzen zu k&#246;nnen. Gerade Programmierern, die &#252;ber die Jahre ebenfalls enorme Mengen an Bookmarks angelegt haben, sollten Jetmarks einfach mal ausprobieren.</p><p><a
name="english"></a></p><hr
/><p>If you have more than 1000 bookmarks in your browser like me, you will soon lose track of your valuable collection.</p><p>Because of this you will very likely search the internet more than once for the same problem.</p><p>I tried a lot of bookmark-addons but I was not satisfied. Therefore I developed Jetmarks under the following conditions:</p><ul><li>Jetmarks should not do any remote calls like sockets, ajax etc.</li><li>Jetmarks should work without any gui, with no toolbar or even searchslot.</li><li>Jetmarks should enrich Google, Bing or Yahoo! serps</li></ul><p><strong>For the installation please visit the <a
href="/blog/jetmarks">plugin website</a>.</strong></p><p><strong>Configuration</strong><br
/> Possible options:</p><ul><li>Limit results to X hits.</li><li>Conjunction of serch terms: AND or OR</li><li>Backgroundcolor</li><li>Highlightcolor</li></ul><p><strong>What Jetmarks is not</strong><br
/> Jetmarks is not a fulltext searchengine. Jetmarks uses the Firefox-Places API, which serves no fulltext index for bookmark queries. A bookmark gets listet without any ranking if the title or url matches one of the supplied search terms.</p><p>For me Jetmarks was very useful. If you own tons of bookmarks you will very likely love the plugin!</p> ]]></content:encoded> <wfw:commentRss>http://www.naden.de/blog/jetmarks-jetpack-plugin-released/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Wordpress random Post</title><link>http://www.naden.de/blog/wordpress-random-post</link> <comments>http://www.naden.de/blog/wordpress-random-post#comments</comments> <pubDate>Fri, 29 Jan 2010 11:00:10 +0000</pubDate> <dc:creator>naden</dc:creator> <category><![CDATA[Code Snippets]]></category> <category><![CDATA[Wordpress]]></category> <category><![CDATA[get-permalink]]></category> <category><![CDATA[get-the-title]]></category> <category><![CDATA[post]]></category> <category><![CDATA[random post]]></category> <category><![CDATA[zufälliger post]]></category><guid
isPermaLink="false">http://www.naden.de/blog/wordpress-random-post</guid> <description><![CDATA[Das folgene Code-Snippet holt einen zuf&#228;lligen Wordpress Post aus der Datenbank und zeigt einen Link darauf an.$post_id = $wpdb-&#62;get_var&#40;&#34;SELECT ID FROM {$wpdb-&#62;posts} WHERE post_status = 'publish' AND post_type = 'post' AND post_date &#60; = NOW() ORDER BY RAND() LIMIT 1&#34;&#41;;
&#160;
printf&#40;'&#60;a href=&#34;%s&#34;&#62;%s', get_permalink&#40;$post_id&#41;, get_the_title&#40;$post_id&#41;&#41;;Zuf&#228;llige Ausgabe:&#60;a href=&#34;http://www.naden.de/blog/wordpress-random-post&#34;&#62;Wordpress random Post&#60;/a&#62;Man k&#246;nnte auch gleich post_name und post_title aus der [...]]]></description> <content:encoded><![CDATA[<p>Das folgene Code-Snippet holt einen zuf&#228;lligen Wordpress Post aus der Datenbank und zeigt einen Link darauf an.<span
id="more-154"></span></p><div
class="wp_codebox"><table><tr
id="p1547"><td
class="code" id="p154code7"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$post_id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_var</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT ID FROM <span style="color: #006699; font-weight: bold;">{$wpdb-&gt;posts}</span> WHERE post_status = 'publish' AND post_type = 'post' AND post_date &lt; = NOW() ORDER BY RAND() LIMIT 1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<a href="http://www.php.net/printf"><span style="color: #990000;">printf</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;a href=&quot;%s&quot;&gt;%s'</span><span style="color: #339933;">,</span> get_permalink<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post_id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> get_the_title<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post_id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p><strong>Zuf&#228;llige Ausgabe:</strong></p><div
class="wp_codebox"><table><tr
id="p1548"><td
class="code" id="p154code8"><pre class="html" style="font-family:monospace;">&lt;a href=&quot;http://www.naden.de/blog/wordpress-random-post&quot;&gt;Wordpress random Post&lt;/a&gt;</pre></td></tr></table></div><p>Man k&#246;nnte auch gleich <em>post_name</em> und <em>post_title</em> aus der Datenbanktabelle auslesen, anstelle <em>get_permalink()</em> und <em>get_the_title()</em> aufzurufen, dann w&#252;rde man aber alle Filter umgehen, die m&#246;glicherweise auf diese Werte angewendet werden.</p> ]]></content:encoded> <wfw:commentRss>http://www.naden.de/blog/wordpress-random-post/feed</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Screencast online erstellen</title><link>http://www.naden.de/blog/screencast-online-erstellen</link> <comments>http://www.naden.de/blog/screencast-online-erstellen#comments</comments> <pubDate>Tue, 26 Jan 2010 15:25:12 +0000</pubDate> <dc:creator>naden</dc:creator> <category><![CDATA[Linkperlen]]></category> <category><![CDATA[aufnehmen]]></category> <category><![CDATA[erstellen]]></category> <category><![CDATA[online]]></category> <category><![CDATA[screencast]]></category> <category><![CDATA[tutorial]]></category> <category><![CDATA[video]]></category><guid
isPermaLink="false">http://www.naden.de/blog/screencast-online-erstellen</guid> <description><![CDATA[Wer mal schnell einen Screencast erstellen will, ohne sich extra ein Programm zu installieren, dem kann ich &#8220;Screencast-O-Matic&#8221; w&#228;rmstens empfehlen.
Das Java-Applet funktioniert browser&#252;bergreifend und nimmt neben dem Bild auch Ton auf. Zus&#228;tzlich kann man Untertitel einf&#252;gen und das fertige Video als mp4 herunterladen oder auf Youtube ver&#246;ffentlichen. Einfach vierlagig.
Screencast-O-Matic &#8211; Screencast ;)Webseite: www.screencast-o-matic.com
]]></description> <content:encoded><![CDATA[<p>Wer mal schnell einen Screencast erstellen will, ohne sich extra ein Programm zu installieren, dem kann ich &#8220;Screencast-O-Matic&#8221; w&#228;rmstens empfehlen.<span
id="more-152"></span></p><p>Das Java-Applet funktioniert browser&#252;bergreifend und nimmt neben dem Bild auch Ton auf. Zus&#228;tzlich kann man Untertitel einf&#252;gen und das fertige Video als mp4 herunterladen oder auf Youtube ver&#246;ffentlichen. Einfach vierlagig.</p><p><strong>Screencast-O-Matic &#8211; Screencast ;)</strong><br
/> <object
width="425" height="344"><param
name="movie" value="http://www.youtube.com/v/ZRUw6JTeu-I&#038;rel=0&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1"></param><param
name="allowFullScreen" value="true"></param><param
name="allowScriptAccess" value="always"></param><embed
src="http://www.youtube.com/v/ZRUw6JTeu-I&#038;rel=0&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="344"></embed></object></p><p><strong>Webseite:</strong> <a
rel="nofollow" target="_blank" href="/blog/shorturl/45">www.screencast-o-matic.com</a></p> ]]></content:encoded> <wfw:commentRss>http://www.naden.de/blog/screencast-online-erstellen/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>PSPad Plugin &#8211; Text Tools</title><link>http://www.naden.de/blog/pspad-plugin-text-tools</link> <comments>http://www.naden.de/blog/pspad-plugin-text-tools#comments</comments> <pubDate>Mon, 25 Jan 2010 20:38:44 +0000</pubDate> <dc:creator>naden</dc:creator> <category><![CDATA[Tools]]></category> <category><![CDATA[pspad]]></category> <category><![CDATA[pspad plugin]]></category> <category><![CDATA[pspad script]]></category><guid
isPermaLink="false">http://www.naden.de/blog/pspad-plugin-text-tools</guid> <description><![CDATA[Ich habe f&#252;r den hervorragenden Editor PSPad habe ich ein Plugin namens TextTools geschrieben, was viele Funktion nachr&#252;stet, die ich doch stark vermisst habe.
Ist Text ausgew&#228;hlt, so wird das PSPad Script nur auf diesen angewendet. Ansonsten auf das gesamte, aktuelle Editorfenster.Men&#252;punkt
FunktionsbeschreibungUnique
entferne doppelter ZeilenUnique (ignore case)
entferne doppelter Zeilen ohne R&#252;cksicht auf Gro&#223;- und KleinschreibungLinesToList (numbers: ,)
Liste [...]]]></description> <content:encoded><![CDATA[<p>Ich habe f&#252;r den hervorragenden Editor <a
href="/blog/shorturl/46" target="_blank" rel="nofollow">PSPad</a> habe ich ein Plugin namens TextTools geschrieben, was viele Funktion nachr&#252;stet, die ich doch stark vermisst habe.<span
id="more-151"></span></p><p>Ist Text ausgew&#228;hlt, so wird das PSPad Script nur auf diesen angewendet. Ansonsten auf das gesamte, aktuelle Editorfenster.</p><table><thead><th>Men&#252;punkt</th><th>Funktionsbeschreibung</th></thead><tbody><tr><th>Unique</th><td>entferne doppelter Zeilen</td></tr><tr><th>Unique (ignore case)</th><td>entferne doppelter Zeilen ohne R&#252;cksicht auf Gro&#223;- und Kleinschreibung</td></tr><tr><th>LinesToList (numbers: ,)</th><td>Liste aus Zeilen erstellen (1,2,3,&#8230;)</td></tr><tr><th>LinesToList (strings: &#8216;,&#8217;)</th><td>Liste aus Zeilen erstellen (&#8216;a&#8217;,'b&#8217;,'c&#8217;,&#8230;)</td></tr><tr><th>Sort (lexicographic)</th><td>Zeilen lexikographisch sortieren</td></tr><tr><th>Sort (reverse lexicographic)</th><td>Zeilen umgekehrt lexikographisch sortieren</td></tr><tr><th>Sort (numeric)</th><td>Zeilen numerisch sortieren</td></tr><tr><th>Sort (reverse numeric)</th><td>Zeilen umgekehrt numerisch sortieren</td></tr><tr><th>UrlEncode</th><td>String url codieren</td></tr><tr><th>UrlDecode</th><td>String url decodieren</td></tr><tr><th>Base64Encode</th><td>String base64 codieren</td></tr><tr><th>Base64Decode</th><td>String base64 decodieren</td></tr><tr><th>LowerCase</th><td>Zeilen in Kleinschreibung umwandeln</td></tr><tr><th>UpperCase</th><td>Zeilen in Gro&#223;schreibung umwandeln</td></tr><tr><th>StringToHex</th><td>String in hexadezimale Schreibweise umwandeln</td></tr><tr><th>HexToString</th><td>hexadezimale Daten in String umwandeln</td></tr></tbody></table><p>Zur Installation das Script <em>TextTools.js</em> im Unterverzeichnis <em>JScript</em> ablegen.</p><p>Vorschl&#228;ge f&#252;r weitere Funktionen sind willkommen. Bug reports auch.</p><p><a
class="download" rel="nofollow" target="_blank" href="/blog/shorturl/44">Download</a> v1.0</p> ]]></content:encoded> <wfw:commentRss>http://www.naden.de/blog/pspad-plugin-text-tools/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Curl PHP Get Request</title><link>http://www.naden.de/blog/curl-php-get-request</link> <comments>http://www.naden.de/blog/curl-php-get-request#comments</comments> <pubDate>Wed, 20 Jan 2010 15:55:12 +0000</pubDate> <dc:creator>naden</dc:creator> <category><![CDATA[Php]]></category> <category><![CDATA[conten type]]></category> <category><![CDATA[curl]]></category> <category><![CDATA[download]]></category> <category><![CDATA[get]]></category> <category><![CDATA[get request]]></category> <category><![CDATA[http]]></category> <category><![CDATA[http get]]></category><guid
isPermaLink="false">http://www.naden.de/blog/curl-php-get-request</guid> <description><![CDATA[M&#246;chte man mit curl z.B. Dateien mit dem Content-Type: text/html runter laden, kann sich aber wegen einer fehlenden Endung (html, css, &#8230;) nicht an dieser orientieren, so springt die folgende Funktion in die Bresche./**
* @param string url - Url
* @param array content_types - Liste der erlaubten Content-Typen
* @param string file - (optional) [...]]]></description> <content:encoded><![CDATA[<p>M&#246;chte man mit <em>curl</em> z.B. Dateien mit dem <em>Content-Type: text/html</em> runter laden, kann sich aber wegen einer fehlenden Endung (html, css, &#8230;) nicht an dieser orientieren, so springt die folgende Funktion in die Bresche.<span
id="more-150"></span></p><div
class="wp_codebox"><table><tr
id="p15011"><td
class="code" id="p150code11"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * @param string url - Url
 * @param array content_types - Liste der erlaubten Content-Typen
 * @param string file - (optional) Datei um die empfangenen Daten zu speichern    
 * 
 * @return mixed true | false | Daten 
 */</span> 
<span style="color: #000000; font-weight: bold;">function</span> curlGetByContentType<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content_types</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'text/html'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// curl mit Url initialisieren</span>
  <span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/curl_init"><span style="color: #990000;">curl_init</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// optionen setzen: nur header zurückliefern</span>
  <a href="http://www.php.net/curl_setopt_array"><span style="color: #990000;">curl_setopt_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span>
    CURLOPT_HEADER <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span>
    CURLOPT_NOBODY <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span>
    CURLOPT_RETURNTRANSFER <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span>
  <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <a href="http://www.php.net/curl_exec"><span style="color: #990000;">curl_exec</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// prüfe ob der Content-Type einer der geforderten ist</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/eregi"><span style="color: #990000;">eregi</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'^('</span><span style="color: #339933;">.</span> <a href="http://www.php.net/implode"><span style="color: #990000;">implode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'|'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content_types</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">')'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/curl_getinfo"><span style="color: #990000;">curl_getinfo</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLINFO_CONTENT_TYPE<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// curl Handle schliessen</span>
    <a href="http://www.php.net/curl_close"><span style="color: #990000;">curl_close</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// curl mit Url initialisieren </span>
    <span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/curl_init"><span style="color: #990000;">curl_init</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// optionen: Body-Cotnent zurückliefern</span>
    <a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// wenn eine Datei angeg. wurde, Daten in Datei speichern</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/is_null"><span style="color: #990000;">is_null</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$fh</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/fopen"><span style="color: #990000;">fopen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'w'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_FILE<span style="color: #339933;">,</span> <span style="color: #000088;">$fh</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/curl_exec"><span style="color: #990000;">curl_exec</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// curl Hadle schliessen</span>
  <a href="http://www.php.net/curl_close"><span style="color: #990000;">curl_close</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #666666; font-style: italic;">// Datei Handle schliessen</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fh</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$fh</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <a href="http://www.php.net/fclose"><span style="color: #990000;">fclose</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fh</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">return</span> <a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$data</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div><p><strong>Beispiele</strong></p><div
class="wp_codebox"><table><tr
id="p15012"><td
class="code" id="p150code12"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Content-Type: text/html
</span><span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://www.golem.de'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> curlGetByContentType<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'image/png'</span><span style="color: #339933;">,</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'text/html'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Content-Type: text/html; charset=&quot;UTF-8&quot;
</span><span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://www.heise.de'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> curlGetByContentType<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'image/png'</span><span style="color: #339933;">,</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'text/html'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Content-Type: image/png
</span><span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://upload.wikimedia.org/wikipedia/de/b/bc/Wiki.png'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> curlGetByContentType<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'image/png'</span><span style="color: #339933;">,</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">'text/html'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'file.png'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p>Leider habe ich keinen Weg gefunden, ohne das <em>curl</em> zwei mal initialisiert werden muss. Vorschl&#228;ge sind willkommen.</p> ]]></content:encoded> <wfw:commentRss>http://www.naden.de/blog/curl-php-get-request/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Javascript Bookmark</title><link>http://www.naden.de/blog/javascript-bookmark</link> <comments>http://www.naden.de/blog/javascript-bookmark#comments</comments> <pubDate>Tue, 19 Jan 2010 20:16:37 +0000</pubDate> <dc:creator>naden</dc:creator> <category><![CDATA[Javascript]]></category> <category><![CDATA[Bookmark]]></category> <category><![CDATA[favorit]]></category> <category><![CDATA[favoriten]]></category><guid
isPermaLink="false">http://www.naden.de/blog/javascript-bookmark</guid> <description><![CDATA[Um per Javascript die aktuelle Webseite als Favorit im Browser zu speichern, gibt es die abenteuerlichsten L&#246;sungen. Noch heute liest man auf vielen Seiten, bei Firefox bitte Strg+D dr&#252;cken!
Meine L&#246;sung, die schon seit Jahren so wunderbar funktioniert sieht wie folgt aus:function bookmark&#40;url, title&#41; &#123;
// ist keine Url angegeben, wird der aktuelle Hostname genutzt
[...]]]></description> <content:encoded><![CDATA[<p>Um per Javascript die aktuelle Webseite als Favorit im Browser zu speichern, gibt es die abenteuerlichsten L&#246;sungen. Noch heute liest man auf vielen Seiten, bei Firefox bitte Strg+D dr&#252;cken!<span
id="more-149"></span></p><p>Meine L&#246;sung, die schon seit Jahren so wunderbar funktioniert sieht wie folgt aus:</p><div
class="wp_codebox"><table><tr
id="p14916"><td
class="code" id="p149code16"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> bookmark<span style="color: #009900;">&#40;</span>url<span style="color: #339933;">,</span> title<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #006600; font-style: italic;">// ist keine Url angegeben, wird der aktuelle Hostname genutzt</span>
  <span style="color: #003366; font-weight: bold;">var</span> url <span style="color: #339933;">=</span> url <span style="color: #339933;">||</span> location.<span style="color: #660066;">protocol</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'//'</span> <span style="color: #339933;">+</span> location.<span style="color: #660066;">host</span><span style="color: #339933;">;</span>
  <span style="color: #006600; font-style: italic;">// um die aktuelle Url zu bookmarken, die vorherige Zeile</span>
  <span style="color: #006600; font-style: italic;">// auskommentieren und die nächste einkommentieren.</span>
  <span style="color: #006600; font-style: italic;">// var url = url || location.href;</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">// kein Titel angeg. wird der aktuelle Hostname benutzt</span>
  <span style="color: #003366; font-weight: bold;">var</span> title <span style="color: #339933;">=</span> title <span style="color: #339933;">||</span> location.<span style="color: #660066;">host</span><span style="color: #339933;">;</span>
  <span style="color: #006600; font-style: italic;">// um den Titel aktuelle Url zu bookmarken, die vorherige Zeile</span>
  <span style="color: #006600; font-style: italic;">// auskommentieren und die nächste einkommentieren.</span>
  <span style="color: #006600; font-style: italic;">// var title = document.title;</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">// Internet Explorer</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">all</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		window.<span style="color: #660066;">external</span>.<span style="color: #660066;">AddFavorite</span><span style="color: #009900;">&#40;</span>url<span style="color: #339933;">,</span> title<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #006600; font-style: italic;">// Firefox</span>
	<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">sidebar</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		window.<span style="color: #660066;">sidebar</span>.<span style="color: #660066;">addPanel</span><span style="color: #009900;">&#40;</span>title<span style="color: #339933;">,</span> url<span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
  <span style="color: #006600; font-style: italic;">// false zurückliefern, fall die Funktion</span>
  <span style="color: #006600; font-style: italic;">// über das &quot;onlick&quot;-Event des &lt;a&gt;-Tags</span>
  <span style="color: #006600; font-style: italic;">// aufgerufen wurde</span>
  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div><p>Der Aufruf sieht z.B. so aus:</p><div
class="wp_codebox"><table><tr
id="p14917"><td
class="code" id="p149code17"><pre class="html" style="font-family:monospace;">&lt;/a&gt;&lt;a href=&quot;&quot; onclick=&quot;javascript:return bookmark();&quot;&gt;Bookmark&lt;/a&gt;</pre></td></tr></table></div><p>oder</p><div
class="wp_codebox"><table><tr
id="p14918"><td
class="code" id="p149code18"><pre class="html" style="font-family:monospace;">&lt;a href=&quot;&quot; onclick=&quot;javascript:return bookmark('Naden's Webseite', 'http://www.naden.de');&quot;&gt;Bookmark&lt;/a&gt;</pre></td></tr></table></div>]]></content:encoded> <wfw:commentRss>http://www.naden.de/blog/javascript-bookmark/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>PHP Redirect</title><link>http://www.naden.de/blog/php-redirect</link> <comments>http://www.naden.de/blog/php-redirect#comments</comments> <pubDate>Fri, 15 Jan 2010 17:58:51 +0000</pubDate> <dc:creator>naden</dc:creator> <category><![CDATA[Php]]></category> <category><![CDATA[idn]]></category> <category><![CDATA[punnycode]]></category> <category><![CDATA[redirect]]></category> <category><![CDATA[umlautdomains]]></category> <category><![CDATA[umlaute]]></category><guid
isPermaLink="false">http://www.naden.de/blog/php-redirect</guid> <description><![CDATA[PHP Redirects von Domains sind ein alter Hut. W&#228;hrend man Domains ohne Sonderzeichen problemlos mittels header(&#8216;Location: &#8230;&#8217;); oder Meta-Refresh umleiten kann, hat man bei Sonderzeichen in Domainnamen ein Problem.
Der Meta-Refresh funktioniert zwar noch immer, der Redirect mittels header(&#8216;Location: &#8230;&#8217;); aus PHP heraus leider nicht.
Die folgende Funktion zerlegt die Url&#8217;s in ihre Bestandteile, dann wird der [...]]]></description> <content:encoded><![CDATA[<p>PHP Redirects von Domains sind ein alter Hut. W&#228;hrend man Domains ohne Sonderzeichen problemlos mittels <em>header(&#8216;Location: &#8230;&#8217;);</em> oder <em>Meta-Refresh</em> umleiten kann, hat man bei Sonderzeichen in Domainnamen ein Problem.<span
id="more-148"></span></p><p>Der <em>Meta-Refresh</em> funktioniert zwar noch immer, der Redirect mittels <em>header(&#8216;Location: &#8230;&#8217;);</em> aus PHP heraus leider nicht.</p><p>Die folgende Funktion zerlegt die Url&#8217;s in ihre Bestandteile, dann wird der Hostname in Punnycode codiert und die Url wieder zusammengbaut.</p><p>Der Aufruf von <em>idn_redirect(&#8216;http://www.&#246;ko.de/&#8217;); leitet auf </em><em>http://www.xn--ko-eka.de/</em></p><div
class="wp_codebox"><table><tr
id="p14820"><td
class="code" id="p148code20"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> idn_redirect<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #000088;">$permanent</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #b1b100;">include_once</span> <span style="color: #0000ff;">'Net/IDNA.php'</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$idn</span> <span style="color: #339933;">=</span> Net_IDNA<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$tokens</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/parse_url"><span style="color: #990000;">parse_url</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$target</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tokens</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'scheme'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'://'</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/array_key_exists"><span style="color: #990000;">array_key_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tokens</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <a href="http://www.php.net/array_key_exists"><span style="color: #990000;">array_key_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'pass'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tokens</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$target</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$tokens</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">':'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$tokens</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pass'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">'@'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  try <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$host</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$idn</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">encode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tokens</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'host'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  catch<span style="color: #009900;">&#40;</span>Exception <span style="color: #000088;">$ex</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$host</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$target</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$host</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$target</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$tokens</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'host'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/array_key_exists"><span style="color: #990000;">array_key_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'port'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tokens</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tokens</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'port'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$target</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">':'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$tokens</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'port'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/array_key_exists"><span style="color: #990000;">array_key_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'path'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tokens</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tokens</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'path'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$target</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$tokens</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'path'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/array_key_exists"><span style="color: #990000;">array_key_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'query'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tokens</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tokens</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'query'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$target</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'?'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$tokens</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'query'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/array_key_exists"><span style="color: #990000;">array_key_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'fragment'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tokens</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tokens</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'fragment'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$target</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'#'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$tokens</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'fragment'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/headers_sent"><span style="color: #990000;">headers_sent</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$permanent</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'HTTP/1.1 301 Moved permanently.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
		<a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location: '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$target</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <a href="http://www.php.net/printf"><span style="color: #990000;">printf</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;html&gt;&lt;head&gt;&lt;meta http-equiv=&quot;refresh&quot; content=&quot;0;URL=%s&quot;&gt;&lt;/meta&gt;&lt;/head&gt;&lt;body&gt;&lt;a href=&quot;%s&quot;&gt;%s&lt;/a&gt;&lt;/body&gt;&lt;/html&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$target</span><span style="color: #339933;">,</span> <span style="color: #000088;">$target</span><span style="color: #339933;">,</span> <span style="color: #000088;">$target</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div><p>Die Funktion nutzt die IDN-Funktionen von <a
href="http://pecl.php.net/package/idn" rel="nofollow" target="_blank">http://pecl.php.net/package/idn</a>.</p> ]]></content:encoded> <wfw:commentRss>http://www.naden.de/blog/php-redirect/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>OmniAds Update</title><link>http://www.naden.de/blog/omniads-update</link> <comments>http://www.naden.de/blog/omniads-update#comments</comments> <pubDate>Tue, 05 Jan 2010 11:36:13 +0000</pubDate> <dc:creator>naden</dc:creator> <category><![CDATA[Wordpress Plugins]]></category> <category><![CDATA[ad]]></category> <category><![CDATA[ads]]></category> <category><![CDATA[werbung]]></category> <category><![CDATA[Wordpress]]></category><guid
isPermaLink="false">http://www.naden.de/blog/omniads-update</guid> <description><![CDATA[F&#252;r mein Wordpress Ads Plugin OmniAds gibt es ein Update auf Version 0.54! Das Update bringt neben einigen Bugfixes eine kleine aber feine Erweiterung mit.
Neben den Unit-Typen PHP und HTML gibt es nun zus&#228;tzlich den Unit-Type FILE. Damit ist es nun m&#246;glich, komplexe Units in extra Dateien auszulagern.
Diese Dateien m&#252;ssen im Unterverzeichnis &#60;&#8230;OmniAds&#8230;&#62;/units/ liegen. Eine [...]]]></description> <content:encoded><![CDATA[<p>F&#252;r mein <a
href="/blog/omniads">Wordpress Ads Plugin</a> OmniAds gibt es ein Update auf Version 0.54! Das Update bringt neben einigen Bugfixes eine kleine aber feine Erweiterung mit.<span
id="more-147"></span></p><p>Neben den Unit-Typen PHP und HTML gibt es nun zus&#228;tzlich den Unit-Type FILE. Damit ist es nun m&#246;glich, komplexe Units in extra Dateien auszulagern.<br
/> Diese Dateien m&#252;ssen im Unterverzeichnis <em>&lt;&#8230;OmniAds&#8230;&gt;/units/</em> liegen. Eine Datei mit der Endung <em>.php</em> wird auch als solche behandelt und kann demnach bel. PHP-Code enthalten. Jede andere Dateiendung wie <em>.html</em> oder <em>.txt</em> &#8230; wird als Text interpretiert und kann Text, Html, Javascrip, Flash etc. enthalten.</p><p><a
href="/blog/omniads">zum Plugin</a></p> ]]></content:encoded> <wfw:commentRss>http://www.naden.de/blog/omniads-update/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- This site's performance optimized by W3 Total Cache. Dramatically improve the speed and reliability of your blog!

Learn more about our WordPress Plugins: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (user agent is rejected)
Database Caching using disk

Served from: arwen @ 2010-03-12 06:03:31 -->