Jul 11, 2010
WordPress
Here are two sample scripts along with an API to provide automatic updates for plugins and themes you host on your own server.
Inside /api you’ll find index.php which processes all the update requests. You should place this in something like http://updates.example.com and update $api_url in /plugin/test-plugin-update/test-plugin-update.php and /theme/portfolio-racer/inc/updates.php accordingly. If you activate these sample plugins without changing API URL, updates will be checked against my test server. If you decide to update, both plugin and theme will be replaced with exactly the same version of each.
#
Jun 1, 2010
Web Design
After upgrading WordPress to a new version, you might need to clear the APC opcode cache. Here is a simple script that you can store in the root of your website, for example, clearapc.php:
if (function_exists('apc_clear_cache') && $_GET['pass'] == 'secret') {
if (apc_clear_cache() && apc_clear_cache('user'))
print 'All Clear!';
else
print 'Clearing Failed!';
print '<pre>';
print_r(apc_cache_info());
print '</pre>';
} else {
print 'Authenticate, please!';
}
Then call the script via http://example.com/clearapc.php?pass=secret
Instead of using ?pass=secret, you might well call the filename something that is hard to guess: clearapc93920.php
#
May 2, 2010
WordPress
Here is a quick way to clear APC opcode cache with a single click within your WordPress dashboard Read more »
#
Dec 26, 2009
WordPress
Update: Ryan has made this into a plugin — Code Comments.
Add this to your theme’s functions.php to allow readers post fragments of code in their comments (wrapped in <code>...</code>) which are automatically encoded (think of < and <)
add_filter('pre_comment_content', 'encode_code_in_comment');
function encode_code_in_comment($source) {
$encoded = preg_replace_callback('/<code>(.*?)<\/code>/ims',
create_function(
'$matches',
'$matches[1] = preg_replace(
array("/^[\r|\n]+/i", "/[\r|\n]+$/i"), "",
$matches[1]);
return "<code>" . htmlentities($matches[1]) . "</code>";'
),
$source);
if ($encoded)
return $encoded;
else
return $source;
}
Worth noting:
- Everything wrapped in
<code>...</code> is encoded.
- Line breaks after opening
<code> and before closing </code> are removed in order to avoid unnecessary <br /> tags.
#
Feb 24, 2008
Web Design
HTML list have become one of the most used HTML elements for marking-up various semantic content structures — navigation, comments and even image galleries.
This article will explain and show you how to style lists inside blog posts, articles or other basic HTML documents.
Before we start, it is necessary to understand the importance of using specific HTML tags <ul> and <ol>, instead of simple numbering (like 1., 2. or •, ») for building lists. By applying content a semantic structure, we emphasize the relationships between different content elements. In case of lists we are able to imply that there is a certain relationship between all of the list members, which is possibly described by the paragraph introducing the list. It also helps screen reader users for whom the total number of items is announced before the rest of the list. Read more »
#
Nov 13, 2007
Web Design
It is a common trend among many web designers and developers to use h1 tag for a logo of a website. Although such decision has no impact on the visual presentation of the content, it drastically diminishes the semantic power of h1 tag.
Every page on the web can be viewed as a single document. Hypertext enables linking and organizing them into groups and sets, which requires that each document has a clear purpose and structure.
Domain names are unique identifiers of those different groups of documents and are the broadest description of their content. Therefore usually they already include the name of a business, person or product (I will refer to them as ‘logos’). Read more »
#