yksehtniycul
|
don't play with me 'cause you're playing with fire |
Site Admin (not site owner)
I facilitate the site technically while doing my best to do little else It's so easy to laugh It's so easy to hate It takes strength to be gentle and kind
It takes guts to be gentle and kind
Simple reminders for me... --Setup unfairly spammed comments complaint thread ooo(why the hell was I flagged as spam??)
« Last Edit: March 09, 2009, 03:29:11 AM by yksehtniycul »
|
Logged yksehtniycul has 2094 Posts (+0/-0 Karma) |
|
|
yksehtniycul
|
don't play with me 'cause you're playing with fire |
administration notes:
Hacked wp-includes/classes.php
<?php if(get_post_meta($page->ID,'blank',true)=='yes') //don't display as link
$output .= $indent . '<li class="' . $css_class . '" title="' . $page->post_name . '">' . apply_filters('the_title', $page->post_title); else $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . $page->post_name . '">' . apply_filters('the_title', $page->post_title) . '</a>'; ?>
This allows pages to be marked as blank, so they will not generate links in the sidebar (so users time isn't wasted clicking on them)
Also changed the title attribute to be the page name, rather than repeating the page title.
edited: Btw, in order to mark a page as blank, a meta key called 'blank' must be added to the page with a value of 'yes'.
« Last Edit: October 16, 2008, 03:01:59 AM by yksehtniycul »
|
Logged yksehtniycul has 2094 Posts (+0/-0 Karma) |
|
|
yksehtniycul
|
don't play with me 'cause you're playing with fire |
administration notes:
Hacked wp-includes/widgets.php
<?php if(get_post_meta(get_the_ID(),'sticky',true)=='yes') continue; ?>
This excludes announcement/sticky posts from the "Recent News" widget in the sidebar.
In order to exclude the post a meta key called 'sticky' must be added to the post with a value of 'yes'. Just using the sticky plugin won't suffice.
|
Logged yksehtniycul has 2094 Posts (+0/-0 Karma) |
|
|
yksehtniycul
|
don't play with me 'cause you're playing with fire |
administration notes:
Hacked wp-includes/widgets.php
'depth' => 1
This manually sets a hidden argument for the page and category listing widgets (in two separate lines)
I tried to make this an option in the interface (it definitely should be) but the hack became overly elaborate for an include file, and I couldn't get controller code to reliably add/update the depth option to the database.
This btw limits the hierarchical listings to one level. For my next trick I plan on trying to add subpage counters to the page listing.
|
Logged yksehtniycul has 2094 Posts (+0/-0 Karma) |
|
|
yksehtniycul
|
don't play with me 'cause you're playing with fire |
administration notes:
Hacked wp-includes/classes.php
<?php if($this->tree_type=='page'&&$depth+1==$max_depth) { global $wpdb; $page =& $element;
if(get_post_meta($page->ID,'unlisted',true)=='yes') return;
call_user_func_array(array(&$this, 'start_el'), $cb_args);
$subpages = $wpdb->get_var(" SELECT COUNT(*) FROM $wpdb->posts WHERE post_parent = '{$page->ID}' AND post_status = 'publish' AND post_type = 'page'      ");
//$subpages = $wpdb->get_var(" // SELECT COUNT(*) FROM $wpdb->posts p LEFT JOIN $wpdb->postmeta m ON p.ID = m.post_id // WHERE m.post_id IS NULL AND p.post_parent = '{$page->ID}' AND p.post_status = 'publish' AND p.post_type = 'page'      // ");
$subpages+=get_post_meta($page->ID,'subadjust',true); //hack
if($subpages) $output .= ' (' . ($subpages) . ')'; } else call_user_func_array(array(&$this, 'start_el'), $cb_args); ?>
This counts the number of subpages in the page listing widget and appends the number in parenthesis to each listing (if subpages exist)
« Last Edit: November 26, 2008, 08:10:57 PM by yksehtniycul »
|
Logged yksehtniycul has 2094 Posts (+0/-0 Karma) |
|
|
yksehtniycul
|
don't play with me 'cause you're playing with fire |
administration notes:
Hacked wp-includes/post.php
<?php /** * get_page_children() - Retrieve child pages * * {@internal Missing Long Description}} * * @package WordPress * @subpackage Post * @since 1.5.1 * * @param int $page_id page ID * @param array $pages list of pages * @return array {@internal Missing Description}} */ function &get_page_children($page_id, $pages, $depth = 0) { $page_list = array(); foreach ( $pages as $page ) { if ( $page->post_parent == $page_id ) { $page_list[] = $page; if($depth<=0||$depth>1) if ( $children = get_page_children($page->ID, $pages, $depth-1 ) ) $page_list = array_merge($page_list, $children); } } return $page_list; }
/** * get_pages() - Retrieve a list of pages * * {@internal Missing Long Description}} * * @package WordPress * @subpackage Post * @since 1.5 * @uses $wpdb * * @param mixed $args Optional. Array or string of options * @return array List of pages matching defaults or $args */ function &get_pages($args = '') { global $wpdb;
$defaults = array( 'child_of' => 0, 'sort_order' => 'ASC', 'sort_column' => 'post_title', 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '', 'depth' => 0 );
$r = wp_parse_args( $args, $defaults ); extract( $r, EXTR_SKIP );
$key = md5( serialize( $r ) ); if ( $cache = wp_cache_get( 'get_pages', 'posts' ) ) if ( isset( $cache[ $key ] ) ) return apply_filters('get_pages', $cache[ $key ], $r );
$inclusions = ''; if ( !empty($include) ) { $child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include $exclude = ''; $meta_key = ''; $meta_value = ''; $hierarchical = false; $incpages = preg_split('/[\s,]+/',$include); if ( count($incpages) ) { foreach ( $incpages as $incpage ) { if (empty($inclusions)) $inclusions = $wpdb->prepare(' AND ( ID = %d ', $incpage); else $inclusions .= $wpdb->prepare(' OR ID = %d ', $incpage); } } } if (!empty($inclusions)) $inclusions .= ')';
$exclusions = ''; if ( !empty($exclude) ) { $expages = preg_split('/[\s,]+/',$exclude); if ( count($expages) ) { foreach ( $expages as $expage ) { if (empty($exclusions)) $exclusions = $wpdb->prepare(' AND ( ID <> %d ', $expage); else $exclusions .= $wpdb->prepare(' AND ID <> %d ', $expage); } } } if (!empty($exclusions)) $exclusions .= ')';
$author_query = ''; if (!empty($authors)) { $post_authors = preg_split('/[\s,]+/',$authors);
if ( count($post_authors) ) { foreach ( $post_authors as $post_author ) { //Do we have an author id or an author login? if ( 0 == intval($post_author) ) { $post_author = get_userdatabylogin($post_author); if ( empty($post_author) ) continue; if ( empty($post_author->ID) ) continue; $post_author = $post_author->ID; }
if ( '' == $author_query ) $author_query = $wpdb->prepare(' post_author = %d ', $post_author); else $author_query .= $wpdb->prepare(' OR post_author = %d ', $post_author); } if ( '' != $author_query ) $author_query = " AND ($author_query)"; } }
$join = ''; $where = "$exclusions $inclusions "; if ( ! empty( $meta_key ) || ! empty( $meta_value ) ) { $join = " LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )"; // meta_key and met_value might be slashed $meta_key = stripslashes($meta_key); $meta_value = stripslashes($meta_value); if ( ! empty( $meta_key ) ) $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s", $meta_key); if ( ! empty( $meta_value ) ) $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_value = %s", $meta_value);
} $query = "SELECT * FROM $wpdb->posts $join WHERE (post_type = 'page' AND post_status = 'publish') $where "; $query .= $author_query; $query .= " ORDER BY " . $sort_column . " " . $sort_order ;
$pages = $wpdb->get_results($query);
if ( empty($pages) ) return apply_filters('get_pages', array(), $r);
// Update cache. update_page_cache($pages);
if ( $child_of || $hierarchical ) $pages = & get_page_children($child_of, $pages, $depth);
$cache[ $key ] = $pages; wp_cache_set( 'get_pages', $cache, 'posts' );
$pages = apply_filters('get_pages', $pages, $r);
return $pages; } ?>
This adds depth limiting to get_pages().
Note, Wordpress does not assign an ID to the top-level page, therefore it is not possible to request only the top-level pages. It just happens passing the argument hierarchical=1 (a boolean flag) has the side effect of procuring the top-level pages while the child_of argument is 0 (which normally disables parent based pruning -- and conveniently the parent ID you'll end up with for top-level pages)
It's worth noting there is no reason to presume this behavior will not change in future version of Wordpress. For now however hierarchical is equivalent to passing a non-zero child_of, so it is safe to combine the two this way.
This hack is used to generate an array of sibling pages from which the "prev" and "next" page flippers atop each page can be practically retrieved.
« Last Edit: November 30, 2008, 08:26:30 PM by yksehtniycul »
|
Logged yksehtniycul has 2094 Posts (+0/-0 Karma) |
|
|
yksehtniycul
|
don't play with me 'cause you're playing with fire |
administration notes:
Hacked wp-includes/post-template.php
Changed...
<?php if ( $link && current_user_can( 'edit_post', $revision->ID ) && $link = get_edit_post_link( $revision->ID ) ) ?>
to...
<?php $rev_parent_id = $revision->post_parent;
if ( $link && current_user_can( 'edit_post', $rev_parent_id ) && $link = 'revision.php?revision='.$revision->ID) ?>
I read somewhere revisions were stored as children of the revised post. So for some reason only administrators and editors can "edit" revisions. So I changed the edit privilege test to be against the child (actual post) and sure enough now writers can see revisions (and restore them if they like)
WordPress currently has no privileges related to revisions. So if that ever changes (after an update) this should be reviewed, because we don't want lowly contributors being able to delete or rollback revisions. A restore just replaces the current contents of a post with an old revision's contents, so this is a harmless operation at best. Frankly as implemented it seems silly not to make revisions available to all.
« Last Edit: January 16, 2009, 06:32:55 AM by yksehtniycul »
|
Logged yksehtniycul has 2094 Posts (+0/-0 Karma) |
|
|
yksehtniycul
|
don't play with me 'cause you're playing with fire |
^Woops, I did a stupid thing somehow with the revisions hack... not sure how. But anyway it is fixed now. I'm pretty sure Contributors can see/compare revisions. Authors can at least. I haven't tried restoring a revision. I mainly implemented the hack so Contributors could see revisions, but it is harmless if they can restore as well. Regardless if they are unable to, I'm not sure I'll ever be motivated to add that functionality.
|
Logged yksehtniycul has 2094 Posts (+0/-0 Karma) |
|
|
yksehtniycul
|
don't play with me 'cause you're playing with fire |
administration notes:
Hacked wp-includes/formatting.php
Disabling auto formatting for pages (this has been bugging me for too long)
<?php
function wpautop($pee, $br = 1) {
global $no_autop; if($no_autop') return $pee; //hack: yksehtniycul
« Last Edit: March 15, 2009, 04:34:48 AM by yksehtniycul »
|
Logged yksehtniycul has 2094 Posts (+0/-0 Karma) |
|
|
yksehtniycul
|
don't play with me 'cause you're playing with fire |
administration notes:
.htaccess
Bold lines added to avoid "super-caching" for these user agents.
# BEGIN WPSuperCache <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / AddDefaultCharset UTF-8 RewriteCond %{REQUEST_URI} !^.*[^/]$ RewriteCond %{REQUEST_URI} !^.*//.*$ RewriteCond %{REQUEST_METHOD} !=POST RewriteCond %{QUERY_STRING} !.*=.* RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$ # ADDED THIS LINE TO PASS-THROUGH MOBILE USER AGENTS RewriteCond %{HTTP_USER_AGENT} !(2\0560\040MMP|240x320|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3\0560|EudoraWeb|hiptop|MMEF20|MOT-V|NetFront|Newt|Nokia|Opera\040Mini|Palm|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|Small|SonyEricsson|Symbian\040OS|SymbianOS|TS21i-10|UP\056Browser|UP\056Link|Windows\040CE|WinWAP) RewriteCond %{HTTP:Accept-Encoding} gzip RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz -f RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html.gz [L]
RewriteCond %{REQUEST_URI} !^.*[^/]$ RewriteCond %{REQUEST_URI} !^.*//.*$ RewriteCond %{REQUEST_METHOD} !=POST RewriteCond %{QUERY_STRING} !.*=.* RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$ # ADDED THIS LINE TO PASS-THROUGH MOBILE USER AGENTS RewriteCond %{HTTP_USER_AGENT} !(2\0560\040MMP|240x320|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3\0560|EudoraWeb|hiptop|MMEF20|MOT-V|NetFront|Newt|Nokia|Opera\040Mini|Palm|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|Small|SonyEricsson|Symbian\040OS|SymbianOS|TS21i-10|UP\056Browser|UP\056Link|Windows\040CE|WinWAP) RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html -f RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html [L] </IfModule>
# END WPSuperCache
The following rejected user agent strings were added to the wp-super-cache plugin settings...
2.0.*MMP 240x320 AvantGo BlackBerry Blazer Cellphone Danger DoCoMo Elaine/3.0 EudoraWeb hiptop MMEF20 MOT-V NetFront Newt Nokia Opera.*Mini Palm portalmmm Proxinet ProxiNet SHARP-TQ-GX10 Small SonyEricsson Symbian.*OS SymbianOS TS21i-10 UP.Browser UP.Link Windows.*CE WinWAP
Note: .* is substituted for spaces. I don't know if this is a functional strategy, but the settings dialogue rewrites most any other syntax. Officially it does not seem to support non-alphanumeric strings.
|
Logged yksehtniycul has 2094 Posts (+0/-0 Karma) |
|
|
yksehtniycul
|
don't play with me 'cause you're playing with fire |
Just to let everyone know I'm still committed to seeing this website (or what is left of it) thru, here is my personal todo list for 2010. If you're reading this don't think unkindly about what I'm not doing for the website, ask yourself what you could do to improve the site.
*repair everything that is not working (of course.) *repair mobile phone etc support. *try to get all the screenshot pages back up in the archives *try to put the archives videos back now that we have a way to cope with the bandwidth *try to use this (http://web.archive.org/web/20071027111507/http://www.digitaldevildb.com/) to reconstruct the archive news pages as much as possible. *try to use Jessicat's Kyuuyaku Kerberos scan to make a better quality forum logo. *do my best to find a new font/look for the forum banner. *get all the Google crap out of the pages (not the anti-Google stuff, I'd welcome more of that) *try to find a replacement for Google Spreadsheets (eg. maybe Sheetster) for the Demonary projects (or what's left of them) *of course finish up/continue perfecting the new YaCy site wide search (replacing Google Custom Search) *eventually upgrade WordPress (and continue to do so) *convert all my WordPress source code hacks into a custom WordPress plugin (so WordPress can be upgraded on demand) *program a WordPress to Simple Machine Forums bridge plugin so user accounts and login will be site wide. *make all registered parties automatically able to write (not publish) posts and pages and upload media to the WordPress Media Library (should work better on the new host) *try to improve YaCy if necessary so to better index the site (primarily not indexing keywords, sidebar stuff, and rss feed summaries, so if you search for Persona you don't get back every page on the website!!) *find a a way to build a really solid sitemap (should not be too hard on the new host) so YaCy can keep the website index up to date. *try to figure out a donation system (surely someone out there appreciates the website / can spare a dime)
PS: When I say try I mean I'll follow thru, but sometimes things just don't work out for technical reasons
PPS: Full disclosure, most if not all of the technical stuff I'm doing for other (higher priority) websites as well.
« Last Edit: December 19, 2009, 03:34:31 PM by yksehtniycul »
|
Logged yksehtniycul has 2094 Posts (+0/-0 Karma) |
|
|
yksehtniycul
|
don't play with me 'cause you're playing with fire |
Just realized I'd not finished publishing all of the Spanish translation work Emilio did all the way back to the beginning of time / I asked Emilio to give the site a second chance. Let's hope he will. No one else has ever worked so selflessly like Tony for this place as has Emilio
« Last Edit: December 25, 2009, 08:11:49 PM by yksehtniycul »
|
Logged yksehtniycul has 2094 Posts (+0/-0 Karma) |
|
|
yksehtniycul
|
don't play with me 'cause you're playing with fire |
Fixed the localization bug that would make urls with terms like "franchisers" get converted to French (because the term began with "fr" etc.)
*changed: "/^(.*)\/($languages)\/?(.*)$/i" to: "/^(.*)\/($languages)\/(.*)$/i" *changed: $search[] = "/\/(".implode("|",$polyglot_settings['knownlangs']).")\/?/i"; $replace[] = ''; to $search[] = "/\/(".implode("|",$polyglot_settings['knownlangs']).")\//i"; $replace[] = '/';
« Last Edit: March 17, 2010, 07:32:00 PM by yksehtniycul »
|
Logged yksehtniycul has 2094 Posts (+0/-0 Karma) |
|
|
|