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
<? | |
//logging file | |
function debug_log($message = '<==========DEBUG LOG========>'){ | |
//directory log file | |
$dir = $_SERVER['DOCUMENT_ROOT'].'/logs'; | |
//save Output Buffer | |
ob_start(); | |
print_r($message); | |
$message = ob_get_clean(); | |
if(!file_exists($dir)){ |
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
var today = new Date(); | |
var delimeter = '/'; | |
var formatDate = today.getFullYear() + delimeter + | |
('0' + (today.getMonth() + 1)).slice(-2) + delimeter + | |
('0' + today.getDate()).slice(-2); | |
//ex . Wed Aug 28 2013 17:50:28 GMT+0900 (KST) -> "2013/08/28" |
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
//to safely serialize | |
$safe_string_to_store = base64_encode(serialize($multidimensional_array)); | |
//to unserialize... | |
$array_restored_from_db = unserialize(base64_decode($encoded_serialized_string)); |
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
function detect_ie() | |
{ | |
if (isset($_SERVER['HTTP_USER_AGENT']) && | |
(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) | |
return true; | |
else | |
return false; | |
} |
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
(function(console){ | |
console.save = function(data, filename){ | |
if(!data) { | |
console.error('Console.save: No data') | |
return; | |
} | |
if(!filename) filename = 'console.json' |
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
function new_subcategory_hierarchy() { | |
$category = get_queried_object(); | |
$parent_id = $category->category_parent; | |
$templates = array(); | |
if ( $parent_id == 0 ) { | |
// Use default values from get_category_template() | |
$templates[] = "category-{$category->slug}.php"; |
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
/** | |
* Load different template for sub category | |
*/ | |
function sub_category_template() { | |
// Get the category id from global query variables | |
$cat = get_query_var('cat'); | |
if(!empty($cat)) { | |
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
chown -R www-data:www-data * # Let apache be owner | |
find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x | |
find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r-- |
OlderNewer