This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function template_hierarchy_detector(){ | |
$out = array(); | |
if ( is_404() ) { | |
$out[] = 'Error 404 Page'; | |
} | |
if( is_search() ){ | |
$out[] = 'Search Result Page'; | |
} | |
if( is_archive() ){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_pages_tree($parent_id=0){ | |
$args = array( | |
'parent'=>$parent_id | |
); | |
$pages = get_pages( $args ); | |
if($pages){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_pages_flattened_tree(&$flattened_list, $parent_id=0, $level=0){ | |
$args = array( | |
'parent'=>$parent_id | |
); | |
$pages = get_pages( $args ); | |
if($pages){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wp-config.php: | |
define('AUTOSAVE_INTERVAL', 300 ); // seconds | |
define('WP_POST_REVISIONS', false ); | |
SQL: | |
DELETE FROM wp_posts WHERE post_type = "revision"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (ZipFile zip = ZipFile.Read(@"D:\path\to\ZipFile.zip")) | |
{ | |
zip.RemoveSelectedEntries("foldername/*"); // Remove folder and all its contents | |
zip.Save(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function generateRandomString($length = 12) { | |
$characters = '23456789abcdefghijkmnpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ !@#$%^&*()_-'; | |
$randomString = ''; | |
for ($i = 0; $i < $length; $i++) { | |
$randomString .= $characters[rand(0, strlen($characters) - 1)]; | |
} | |
return $randomString; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Foo { | |
protected $var1; | |
protected $var2; | |
/* Get Properties | |
* | |
* Get all class properties at once and put it in an array | |
* | |
* @return array $class_vars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shutdown -s -f -t 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$request->getScheme().'://'.$request->getHttpHost().$request->getBasePath().$request->getPathInfo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
D:\webserver>mklink /d d:\webserver\apache\ d:\webserver\apache22 |
OlderNewer