Skip to content

Instantly share code, notes, and snippets.

@thefuxia
thefuxia / functionreal_lastmod.php
Created October 8, 2009 13:50
function real_lastmod()
<?php
/**
* Gibt den Zeitpunkt der letzten Änderung aller verwendeten
* Dateien als UNIX-Timestamp zurück.
* @return integer
*/
function real_lastmod()
{
$arr_all_files = get_included_files();
if ( !array_key_exists(1, $arr_all_files) )
@thefuxia
thefuxia / function.is_local.php
Created October 8, 2009 13:55
function is_local()
<?php
function is_local()
{
return ( '127.0.0.1' == $_SERVER["REMOTE_ADDR"]) ? TRUE : FALSE;
}
@thefuxia
thefuxia / function.is_ascii.php
Created October 8, 2009 13:58
function is_ascii ()
<?php
function is_ascii ($str)
{
return preg_match("/[\\000-\\126]/", $str);
}
@thefuxia
thefuxia / class.singleton.php
Created October 8, 2009 14:08
Template for a singleton.
<?php
/**
* Description
*
* Aufruf nur durch
<code>{NAME}::getInstance()</code>
* @author Thomas Scholz <info@toscho.de>
*/
class {NAME} {
@thefuxia
thefuxia / class.View_All_Posts.php
Created June 24, 2010 20:42
Adds a view all posts page to any archive.
<?php
/**
* Adds a view all posts page to any archive.
*
* @author Thomas Scholz http://toscho.de
* @version 1.1
* @license: GPL2
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@thefuxia
thefuxia / Wordpress-feed-desc-fulltext.php
Created July 22, 2010 10:18
Print full text in feed description
<?php
add_filter('the_excerpt_rss', 'my_fulltext_desc');
function my_fulltext_desc($excerpt)
{
if ( ! is_feed() )
{
return $excerpt;
}
return apply_filters('the_content', get_the_content() );
@thefuxia
thefuxia / post-cats-to-css-classes.php
Created July 24, 2010 23:26
Converts post categories into CSS classes
<?php
function categories_to_classes()
{
$out = '';
$cats = get_the_category();
foreach ( $cats as $cat_object )
{
$out .= $cat_object->slug . ' ';
}
@thefuxia
thefuxia / class.Toscho_Language_Filter.php
Created August 2, 2010 16:06
Change language declarations in WordPress.
<?php
/**
* Adjust the public visible language declarations.
*
* @author "Thomas Scholz" http://toscho.de
* @version 1.0
*/
class Toscho_Language_Filter
{
/**
@thefuxia
thefuxia / class.TTT_Comment_Form.php
Created September 5, 2010 12:43
Handler for filters and actions for the comment form.
<?php
/**
* Handler for filters and actions for the comment form.
*
* comment_form(); in the theme’s comments.php and WP 3+ is required.
*
* @author "Thomas Scholz" http://toscho.de
* @version 1.2
*
*/
@thefuxia
thefuxia / consolas.css
Created September 8, 2010 19:52
Opera User Stylesheet for monospace elements
@charset "utf-8";
/* Name: monospace: Consolas */
pre, code, samp, var,
.code, .pre,
textarea
{
font-family: Consolas,
/* make unicode characters work: */
'Lucida Sans Unicode',
'Arial Unicode MS'