<?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>kucrut</title> <atom:link href="http://kucrut.org/feed/" rel="self" type="application/rss+xml" /><link>http://kucrut.org</link> <description>Life, WordPress, GNU/Linux, Freedom!</description> <lastBuildDate>Sat, 18 Feb 2012 20:38:35 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /> <item><title>wp_list_pages() for Custom Post Types</title><link>http://kucrut.org/wp_list_pages-for-custom-post-types/</link> <comments>http://kucrut.org/wp_list_pages-for-custom-post-types/#comments</comments> <pubDate>Sat, 18 Feb 2012 20:34:26 +0000</pubDate> <dc:creator>Dzikri Aziz</dc:creator> <category><![CDATA[Tips & Tutorials]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[Filter]]></category> <category><![CDATA[WordPress]]></category><guid
isPermaLink="false">http://kucrut.org/?p=181</guid> <description><![CDATA[wp_list_pages() is a handy little function for displaying a list of hierarchical post type, and it works with custom post types too. Unfortunately, when used for a custom post type, the list items don&#8217;t have the necessary CSS classes for current page item/ancestors. Here&#8217;s a quick fix for this particular problem. function kct_page_css_class( $css_class, $page, [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://codex.wordpress.org/Function_Reference/wp_list_pages">wp_list_pages()</a> is a handy little function for displaying a list of hierarchical post type, and it <a
href="http://codex.wordpress.org/Function_Reference/wp_list_pages#List_members_of_a_custom_post_type">works</a> with custom post types too. Unfortunately, when used for a custom post type, the list items don&#8217;t have the necessary CSS classes for current page item/ancestors. Here&#8217;s a quick fix for this particular problem.</p><pre>
function kct_page_css_class( $css_class, $page, $depth, $args, $current_page ) {
  if ( !is_singular($args['post_type']) )
    return $css_class;

  global $post;
  $current_page  = $post->ID;
  $_current_page = $post;
  _get_post_ancestors($_current_page);

  if ( isset($_current_page->ancestors) &#038;&#038; in_array($page->ID, (array) $_current_page->ancestors) )
    $css_class[] = 'current_page_ancestor';
  if ( $page->ID == $current_page )
    $css_class[] = 'current_page_item';
  elseif ( $_current_page &#038;&#038; $page->ID == $_current_page->post_parent )
    $css_class[] = 'current_page_parent';

  return $css_class;
}
add_filter( 'page_css_class', 'kct_page_css_class', 10, 5 );
</pre>]]></content:encoded> <wfw:commentRss>http://kucrut.org/wp_list_pages-for-custom-post-types/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Override max-width</title><link>http://kucrut.org/override-max-width/</link> <comments>http://kucrut.org/override-max-width/#comments</comments> <pubDate>Tue, 14 Feb 2012 11:20:30 +0000</pubDate> <dc:creator>Dzikri Aziz</dc:creator> <category><![CDATA[Tips & Tutorials]]></category> <category><![CDATA[CSS]]></category><guid
isPermaLink="false">http://kucrut.org/?p=180</guid> <description><![CDATA[Just use none :) .hentry img {height:auto; max-width:100%} .hentry .someclass img {max-width:none}]]></description> <content:encoded><![CDATA[<p>Just use <code>none</code> :)</p><pre>
.hentry img {height:auto; max-width:<span class="impo">100%</span>}
.hentry .someclass img {max-width:<span class="impo">none</span>}
</pre>]]></content:encoded> <wfw:commentRss>http://kucrut.org/override-max-width/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>KC DropBox</title><link>http://kucrut.org/kc-dropbox/</link> <comments>http://kucrut.org/kc-dropbox/#comments</comments> <pubDate>Mon, 06 Feb 2012 13:57:47 +0000</pubDate> <dc:creator>Dzikri Aziz</dc:creator> <category><![CDATA[News]]></category> <category><![CDATA[WordPress]]></category><guid
isPermaLink="false">http://kucrut.org/?p=175</guid> <description><![CDATA[Here&#8217;s a simple plugin for uploading files from your WordPress site front-end. It uses Jaka Jancar&#8217;s DropBox Uploader and inspired by a tutorial on WP Tuts+ (although I took a slightly different approach). It&#8217;s pretty easy to use and you can integrate it in your contact forms. Clone/download it from GitHub and feel free to [...]]]></description> <content:encoded><![CDATA[<p>Here&#8217;s a simple plugin for uploading files from your WordPress site front-end. It uses <a
href="http://jaka.kubje.org/projects/dropbox-uploader/">Jaka Jancar&#8217;s DropBox Uploader</a> and inspired by a <a
href="http://wp.tutsplus.com/tutorials/simple-plugin-which-lets-users-upload-files-into-your-dropbox-folder/">tutorial</a> on WP Tuts+ (although I took a slightly different approach). It&#8217;s pretty easy to use and you can integrate it in your contact forms.</p><p>Clone/download it from <a
href="https://github.com/kucrut/kc-dropbox">GitHub</a> and feel free to <a
href="http://kucrut.org/kc-dropbox/#comments">let me know</a> if you have any problem.</p> ]]></content:encoded> <wfw:commentRss>http://kucrut.org/kc-dropbox/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>PulseAudio Equalizer</title><link>http://kucrut.org/pulseaudio-equalizer/</link> <comments>http://kucrut.org/pulseaudio-equalizer/#comments</comments> <pubDate>Tue, 31 Jan 2012 08:26:47 +0000</pubDate> <dc:creator>Dzikri Aziz</dc:creator> <category><![CDATA[Random]]></category> <category><![CDATA[F|OSS]]></category> <category><![CDATA[Gentoo]]></category><guid
isPermaLink="false">http://kucrut.org/?p=170</guid> <description><![CDATA[Finally got PulseAudio&#8217;s equalizer working. It consumes 1-4% of my 2.30GHz i5 CPU (Clementine&#8217;s built-in equalizer consumes 4-7%, btw), and sounds really good :) In Gentoo, all you need to do to get this working is to install pulseaudio with equalizer USE-flag enabled (may need to unmask the unstable ebuild) and append this line to [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://kucrut.org/wp-content/uploads/2012/01/pulseaudio-eq.jpeg"><img
src="http://kucrut.org/wp-content/uploads/2012/01/pulseaudio-eq-600x337.jpg" alt="" title="pulseaudio-eq" width="600" height="337" class="aligncenter size-large wp-image-171" /></a></p><p>Finally got PulseAudio&#8217;s <a
href="http://pulseaudio.org/wiki/SystemEqualizer">equalizer</a> working. It consumes 1-4% of my 2.30GHz i5 CPU (<a
href="http://www.clementine-player.org/">Clementine&#8217;s</a> built-in equalizer consumes 4-7%, btw), and sounds really good :) <span
id="more-170"></span></p><p>In Gentoo, all you need to do to get this working is to install pulseaudio with <code>equalizer</code> USE-flag enabled (may need to unmask the unstable ebuild) and append this line to <code>/etc/pulse/default.pa</code> or <code>~/.pulse/default.pa</code> (you can change the sink name to your liking) :</p><pre>
load-module module-equalizer-sink sink_name=<span class="impo">equalized</impo>
</pre><p>After that, quit all applications that use pulseadio and restart pulseaudio:</p><pre>
pulseaudio --kill &#038;&#038; pulseaudio --start
</pre><p>Now you should be able to use the equalized sink name for your multimedia application. For example, in Clementine, go to <em>Tools</em> &raquo; <em>Preferences</em> &raquo; <em>Playback</em> and change the <em>Output plugin</em> to PulseAudio Sink and fill the <em>Output device</em> field with your equalized sink name (<code>equalized</code> in the above example).</p><p>While Clementine&#8217;s playing, adjust the equalizer levels by running <code>qpaeq</code>. All done! ;-)</p> ]]></content:encoded> <wfw:commentRss>http://kucrut.org/pulseaudio-equalizer/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>KDE 4.8 Taskbar</title><link>http://kucrut.org/kde-4-8-taskbar/</link> <comments>http://kucrut.org/kde-4-8-taskbar/#comments</comments> <pubDate>Mon, 30 Jan 2012 12:46:43 +0000</pubDate> <dc:creator>Dzikri Aziz</dc:creator> <category><![CDATA[Random]]></category> <category><![CDATA[F|OSS]]></category> <category><![CDATA[KDE]]></category><guid
isPermaLink="false">http://kucrut.org/?p=166</guid> <description><![CDATA[I&#8217;m not really sure if this feature is part of KDE SC 4.8, but it&#8217;s so cool and I feel like I have to write about it here :) See the screenshot above? KDE&#8217;s default taskbar is now more powerful than ever! Right clicking on a taskbar item now gives you the ability to start [...]]]></description> <content:encoded><![CDATA[<p>I&#8217;m not really sure if this feature is part of KDE SC 4.8, but it&#8217;s so cool and I feel like I have to write about it here :)</p><p><img
src="http://kucrut.org/wp-content/uploads/2012/01/kde-taskbar-4.8-600x176.jpg" alt="" title="kde-taskbar-4.8" width="600" height="176" class="aligncenter size-large wp-image-167" /></p><p>See the screenshot above? KDE&#8217;s default taskbar is now more powerful than ever! Right clicking on a taskbar item now gives you the ability to start a new instance of that application, <em>and</em> add a launcher of that application to the taskbar when it&#8217;s not running.</p><p>I know, it&#8217;s pretty similar to what Windows 7 offers, except (IMO) it&#8217;s waay cooler. In Windows 7, if you pinned an application to the taskbar, it will only show an icon, without the application name/window title, no matter the state of the application is (running or not). In KDE, well, you guessed it, if the application is not currently running, an icon will be added to the taskbar, and it will disappear when it&#8217;s launched.</p><p>If you really want Windows 7&#8242;s taskbar in KDE, you can install this <a
href="http://kde-look.org/content/show.php/Icon+Tasks?content=144808">plugin</a> :)</p> ]]></content:encoded> <wfw:commentRss>http://kucrut.org/kde-4-8-taskbar/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Using Built-in Post Finder in Plugins</title><link>http://kucrut.org/using-built-in-post-finder-in-plugins/</link> <comments>http://kucrut.org/using-built-in-post-finder-in-plugins/#comments</comments> <pubDate>Fri, 20 Jan 2012 00:54:23 +0000</pubDate> <dc:creator>Dzikri Aziz</dc:creator> <category><![CDATA[Tips & Tutorials]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[WordPress]]></category><guid
isPermaLink="false">http://kucrut.org/?p=162</guid> <description><![CDATA[I was making some improvements to the KC Posts widget module in my KC Essentials plugin, and I wanted to make it easy for the users to find post IDs they want to include/exclude from the query. As you may already know, in the Media admin page, we can &#8216;attach&#8217; an attachment to a post. [...]]]></description> <content:encoded><![CDATA[<p>I was making some improvements to the KC Posts widget module in my <a
href="https://github.com/kucrut/kc-essentials/">KC Essentials</a> plugin, and I wanted to make it easy for the users to find post IDs they want to include/exclude from the query. As you may already know, in the <em>Media</em> admin page, we can &#8216;attach&#8217; an attachment to a post. It uses a neat jQuery UI dialog box to find posts. Here&#8217;s how I use it in KC Essentials.<br
/> <span
id="more-162"></span><br
/> First add we need to add the dialog box and the required JS to the admin page, in my case, it&#8217;s <code>widgets.php</code>.</p><pre>
add_action( 'load-<span class="impo">widgets.php</span>', 'my_widgets_admin_actions' );
function my_widgets_admin_actions() {
  # Enqueue scripts
  wp_enqueue_script( 'my-widgets-admin-scripts', plugins_url('myscript.js', __FILE__), array('media', 'wp-ajax-response'), '0.1', true );

  # Add the finder dialog box
  add_action( 'admin_footer', 'find_posts_div', 99 );
}
</pre><p>Next, create <code>myscript.js</code> file inside the plugin directory and add these lines:</p><pre>
jQuery(document).ready(function($) {
  // Find posts
  var $findBox = $('#find-posts'),
      $found   = $('#find-posts-response'),
      $findBoxSubmit = $('#find-posts-submit');

  // Open
  $(<span class="impo">'input.kc-find-post'</span>).live('dblclick', function() {
    $findBox.data('kcTarget', $(this));
    findPosts.open();
  });

  // Insert
  $findBoxSubmit.click(function(e) {
    e.preventDefault();

    // Be nice!
    if ( !$findBox.data('kcTarget') )
      return;

    var $selected = $found.find('input:checked');
    if ( !$selected.length )
      return false;

    var $target = $findBox.data('kcTarget'),
        current = $target.val(),
        current = current === '' ? [] : current.split(','),
        newID   = $selected.val();

    if ( $.inArray(newID, current) < 0 ) {
      current.push(newID);
      $target.val( current.join(',') );
    }
  });

  // Double click on the radios
  $('input[name="found_post_id"]', $findBox).live('dblclick', function() {
    $findBoxSubmit.trigger('click');
  });

  // Close
  $( '#find-posts-close' ).click(function() {
    $findBox.removeData('kcTarget');
  });
});
</pre><p>A quick explanation:<br
/> When the user double-clicks the <code>input.kc-find-post</code> field, the finder dialog box will popup. Clicking the <em>Select</em> button will send the selected post's ID to the input field. This can also be done by double-clicking one of the radio inputs at the left side of each found posts.</p><p>Need a demo? Just install <a
href="https://github.com/kucrut/kc-essentials/">KC Essentials</a> :)</p> ]]></content:encoded> <wfw:commentRss>http://kucrut.org/using-built-in-post-finder-in-plugins/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Move Cursor to the Next/Previous Paragraph in Kate</title><link>http://kucrut.org/move-cursor-to-next-prev-paragraph-in-kate/</link> <comments>http://kucrut.org/move-cursor-to-next-prev-paragraph-in-kate/#comments</comments> <pubDate>Fri, 20 Jan 2012 00:05:53 +0000</pubDate> <dc:creator>Dzikri Aziz</dc:creator> <category><![CDATA[Tips & Tutorials]]></category> <category><![CDATA[F|OSS]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[Kate]]></category><guid
isPermaLink="false">http://kucrut.org/?p=160</guid> <description><![CDATA[It kind of irritates me that Kate doesn&#8217;t have a builtin functionality to move cursor to the next/previous paragraph. Fortunately, as with most KDE SC applications, Kate is extendable with custom scripts. So here&#8217;s my solution for the mentioned problem. /* kate-script * author: Dzikri Aziz * license: GPLv2 * revision: 3 * kate-version: 3.4 [...]]]></description> <content:encoded><![CDATA[<p>It kind of irritates me that <a
href="http://kate-editor.org/" title="KDE Advanced Text Editor">Kate</a> doesn&#8217;t have a builtin functionality to move cursor to the next/previous paragraph. Fortunately, as with most <a
href="http://kde.org/">KDE SC</a> applications, Kate is extendable with <a
href="http://kate-editor.org/2010/07/09/kate-scripted-actions/">custom scripts</a>. So here&#8217;s my solution for the mentioned problem.<span
id="more-160"></span></p><pre>
/* kate-script
 * author: Dzikri Aziz <kucrut@kucrut.org>
 * license: GPLv2
 * revision: 3
 * kate-version: 3.4
 * type: commands
 * functions: jumpUp, jumpDown
 *
 * Move cursor to next/previous paragraph
 */

function jumpDown() {
  return _jump();
}

function jumpUp() {
  return _jump( true );
}

function action( cmd ) {
  var a = new Object();
  if ( cmd == 'jumpUp' ) {
    a.text = i18n('Move cursor to previous paragraph');
    a.shortcut = 'Alt+Up';
    a.icon = "";
    a.category = "";
    a.interactive = false;
  }
  else if ( cmd == 'jumpDown' ) {
    a.text = i18n('Move cursor to next paragraph');
    a.shortcut = 'Alt+Down';
    a.icon = "";
    a.category = "";
    a.interactive = false;
  }

  return a;
}

function help( cmd ) {
  if (cmd == 'jumpUp') {
    return i18n('Move cursor to previous paragraph');
  }
  else if (cmd == 'jumpDown') {
    return i18n('Move cursor to next paragraph');
  }
}

function _jump( up ) {
  var init   = curPos = view.cursorPosition().line,
      lines  = document.lines(),
      target;

  if ( document.firstColumn(curPos) == -1 )
    curPos = document.prevNonEmptyLine(curPos);

  if ( up === true ) {
    target = 0;
    while ( curPos-- > 0 ) {
      if ( document.firstColumn(curPos) == -1 &#038;&#038; document.nextNonEmptyLine(curPos) != init ) {
        target = document.nextNonEmptyLine(curPos);
        break;
      }
    }
  }

  else {
    lines--;
    target = lines;
    while ( curPos++ < lines ) {
      if ( document.firstColumn(curPos) == -1 &#038;&#038; document.nextNonEmptyLine(curPos) != init ) {
        target = document.nextNonEmptyLine(curPos);
        break;
      }
    }
  }

  view.setCursorPosition(target, 0);
}
</pre><p>Save this script as <code>jump.js</code> inside katepart directory in your KDE user directory, eg: <code>$KDEHOME/share/apps/katepart/script</code> (just create the sub-directories if they don't exist yet) and relaunch Kate. Now you can move the cursor to the next paragraph by pressing <code>Alt+Up</code> or the previous one by pressing <code>Alt+Down</code>. You can freely customize the shortcut from <em>Settings &raquo; Configure Shortcuts</em>.</p><p>Any improvements are welcome!</p><p>As a bonus, here's the <a
href="http://www.box.com/s/yn53ytty7gm8d9afodp5">scripting guide</a> I printed from Google cache.</p> ]]></content:encoded> <wfw:commentRss>http://kucrut.org/move-cursor-to-next-prev-paragraph-in-kate/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>jQuery in Widgets Admin Page</title><link>http://kucrut.org/jquery-in-widgets-admin-page/</link> <comments>http://kucrut.org/jquery-in-widgets-admin-page/#comments</comments> <pubDate>Tue, 17 Jan 2012 20:31:15 +0000</pubDate> <dc:creator>Dzikri Aziz</dc:creator> <category><![CDATA[Tips & Tutorials]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[WordPress]]></category><guid
isPermaLink="false">http://kucrut.org/?p=159</guid> <description><![CDATA[Here&#8217;s a quick tip. If you built a custom widget for your themes/plugins and you need jQuery for the configuration form, you&#8217;ll need to call it when the ajax process is done, that is when a widget was just dropped to a sidebar/widget area, or the user just saved the configuration. jQuery(document).ready(function($) { $('.widgets-sortables').ajaxSuccess(function() { [...]]]></description> <content:encoded><![CDATA[<p>Here&#8217;s a quick tip. If you built a custom widget for your themes/plugins and you need jQuery for the configuration form, you&#8217;ll need to call it when the ajax process is done, that is when a widget was just dropped to a sidebar/widget area, or the user just saved the configuration.</p><pre>
jQuery(document).ready(function($) {
  $('.widgets-sortables').ajaxSuccess(function() {
    <span class="ccomment">// do your thing</span>
  });
});
</pre>]]></content:encoded> <wfw:commentRss>http://kucrut.org/jquery-in-widgets-admin-page/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Hacking Term List Table</title><link>http://kucrut.org/hacking-term-list-table/</link> <comments>http://kucrut.org/hacking-term-list-table/#comments</comments> <pubDate>Wed, 11 Jan 2012 13:33:57 +0000</pubDate> <dc:creator>Dzikri Aziz</dc:creator> <category><![CDATA[Tips & Tutorials]]></category> <category><![CDATA[Hook]]></category> <category><![CDATA[WordPress]]></category><guid
isPermaLink="false">http://kucrut.org/?p=154</guid> <description><![CDATA[Term list table, unlike post list table, is not very customizable. What I needed was to display the thumbnail/icon of each term, to make it easier for the content editors to distinguish one term from another. I consider this as a hack, not because we&#8217;re going to edit a core file (never ever do that, [...]]]></description> <content:encoded><![CDATA[<p>Term list table, unlike <a
href="http://scribu.net/wordpress/custom-sortable-columns.html">post</a> <a
href="http://scribu.net/wordpress/sortable-taxonomy-columns.html">list</a> <a
href="http://theme.fm/2011/07/hacking-the-wordpress-admin-mastering-custom-columns-758/">table</a>, is not very customizable. What I needed was to display the thumbnail/icon of each term, to make it easier for the content editors to distinguish one term from another.</p><p><img
src="http://kucrut.org/wp-content/uploads/2012/01/term-table.jpg" alt="" title="Term Table" width="740" height="408" class="aligncenter size-full wp-image-155" /></p><p><span
id="more-154"></span></p><p>I consider this as a hack, not because we&#8217;re going to edit a core file (never ever do that, please!), but because we&#8217;re (ab)using a <em>filter</em> hook to display the thumbnail, which should normally be done through an <em>action</em> hook. Unfortunately, if we take a look at <code>wp-admin/includes/class-wp-terms-list-table.php</code> file, there&#8217;s only one action hook in there, which can&#8217;t help us. However, there&#8217;s a filter hook that can be useful for our situation: <code>"{$taxonomy}_row_actions"</code>, normally used to customize the action links that show up when we hover over a term row.</p><p>Before we begin, We need to decide how we attach an image to a term. There are many plugins out there that can help us with this, but in this guide we&#8217;ll be using my own plugin, <a
href="http://wordpress.org/extend/plugins/kc-settings/">KC Settings</a>. By the way, if the plugin of your choice doesn&#8217;t use <code>termmeta</code> table to store terms metadata, I strongly suggest you to look for another plugin :)</p><p>Let&#8217;s get started with creating a mu-plugin file, or editing a our theme&#8217;s <code>function.php</code> file (not recommended). We&#8217;ll be using the <em>category</em> taxonomy throughout this guide, but you can off course use other taxonomies.</p><p>First we&#8217;ll add an entry for KC Settings, (please refer to the sample files included in the plugin to learn about the setting array), or you can also use the Builder if you like.</p><pre>
function my_category_metadata( $groups ) {
  $groups[] = array(
    '<span class="impo">category</span>' =&gt; array(
      array(
        'id'        =&gt; 'category-meta',
        'title'     =&gt; 'Metadata',
        'fields'    =&gt; array(
          array(
            'id'    =&gt; 'icon',
            'title' =&gt; 'Icon',
            'type'  =&gt; 'file'
          )
        )
      )
    )
  );

  return $groups;
}
add_filter( 'kc_term_settings', 'my_category_metadata' );
</pre><p>Now we can attach an image when creating/editing a term:<br
/><div
id="attachment_156" class="wp-caption aligncenter" style="width: 510px"><img
src="http://kucrut.org/wp-content/uploads/2012/01/set-term-icon.jpg" alt="" title="Set term icon" width="500" height="636" class="size-full wp-image-156" /><p
class="wp-caption-text">Attach/set term icon</p></div></p><p>To get the data, we can use <code>get_term_meta()</code>. For example, assuming the category ID is <code>20</code>:</p><pre>
print_r( get_metadata('term', <span class="impo">20</span>, 'icon', true) );
</pre><p>&hellip;which outputs:</p><pre>
Array
(
  [selected] =&gt; Array
    (
      [0] =&gt; 38
    )
  [files] =&gt; Array
    (
      [0] =&gt; 38
    )
)
</pre><p>Next, we&#8217;ll display each term&#8217;s icon on the term list table:</p><pre>
function my_category_column_hack( $actions, $term ) {
  if ( $icon = get_metadata('term', $term-&gt;term_id, 'icon', true) ) {
    if ( isset($icon['selected'][0]) &#038;&#038; $img = wp_get_attachment_image( $icon['selected'][0]) )
      echo '&lt;a href="'.get_edit_post_link($icon['selected'][0]).'" class="term-icon"&gt;'.$img.'&lt;/a&gt;';
  }

  return $actions;
}
add_filter( '<span class="impo">category</span>_row_actions', 'my_category_column_hack', 10, 2 );
</pre><p>We&#8217;re basically done, and the term table should now display the icons of each term. However, we need to add some CSS to make it look a little bit sexier and to match the <em>Media</em> screen.</p><pre>
function my_admin_inline_styles() {
  $screen = get_current_screen();
  if ( $screen-&gt;base == 'edit-tags' ) { ?&gt;
&lt;style&gt;.term-icon {float:left;width:40px;height:40px;overflow:hidden;margin-right:10px} .term-icon img {max-width:100%;height:auto}&lt;/style&gt;
  &lt;?php }
}
add_action( 'admin_print_styles', 'my_admin_inline_styles', 99 );
</pre>]]></content:encoded> <wfw:commentRss>http://kucrut.org/hacking-term-list-table/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Setting Default File Permission in Linux&#8482;</title><link>http://kucrut.org/setting-default-file-permission-in-linux/</link> <comments>http://kucrut.org/setting-default-file-permission-in-linux/#comments</comments> <pubDate>Sun, 08 Jan 2012 13:18:52 +0000</pubDate> <dc:creator>Dzikri Aziz</dc:creator> <category><![CDATA[Tips & Tutorials]]></category> <category><![CDATA[Linux]]></category><guid
isPermaLink="false">http://kucrut.org/?p=150</guid> <description><![CDATA[Here&#8217;s the situation; I want every newly created file/directory in /var/www to be owned by user kucrut and group apache, and they should have read/write persmission, while all other users/groups should only have read permission. We will use ACL for this, and it&#8217;s usually installed by default. First, we need to make sure that the [...]]]></description> <content:encoded><![CDATA[<p>Here&#8217;s the situation; I want every newly created file/directory in <code>/var/www</code> to be owned by user <code>kucrut</code> and group <code>apache</code>, and they should have read/write persmission, while all other users/groups should only have read permission. We will use <a
href="http://savannah.nongnu.org/projects/acl">ACL</a> for this, and it&#8217;s usually installed by default.<span
id="more-150"></span></p><p>First, we need to make sure that the partition which the <code>/var/www</code> directory resides (usually <code>/</code>has ACL enabled. The <code>/etc/fstab</code> line should look like this:</p><pre>
<span class="ccomment"># Partition  # Mount point   # Filesystem     # Options         # Dump/pass</span>
/dev/sda5    /               ext4             noatime,acl       0 1
</pre><p>If acl isn&#8217;t there yet, add it, save the file, and remount the partition by running this command as root (or use <code>sudo</code>):</p><pre>mount -o remount /</pre><p>If you can&#8217;t remount the partition for whatever reason, just reboot :)</p><p>Now run this set of commands as root, and don&#8217;t forget to change <code>kucrut</code> to your own username:</p><pre>
<span class="ccomment"># Set ownership</span>
chown -R kucrut:apache /var/www

<span class="ccomment"># Set permission</span>
chmod -R g+ws /var/www

<span class="ccomment"># Set default permission for newly created files/directories</span>
setfacl -d -m g::rwx /var/www
setfacl -d -m o::rx /var/www
</pre><p>&#8230; and we&#8217;re done.</p><p>Try creating a new file and check its permission:</p><pre>
touch /var/www/xyz &amp;&amp; ls -l /var/www/xyz
-rw-rw-r-- 1 kucrut apache 0 2012-01-08 /var/www/xyz
</pre><p>Source: <a
href="http://www.linuxquestions.org/questions/linux-desktop-74/applying-default-permissions-for-newly-created-files-within-a-specific-folder-605129/">LinuxQuestions.org</a></p> ]]></content:encoded> <wfw:commentRss>http://kucrut.org/setting-default-file-permission-in-linux/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching using disk: basic
Object Caching 947/1049 objects using disk: basic

Served from: kucrut.org @ 2012-02-23 04:49:47 -->
