This file contains hidden or 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 | |
#add epub,mobi file upload ability | |
add_filter('upload_mimes', 'addUploadMimes'); | |
function addUploadMimes($mimes) { | |
$mimes = array_merge($mimes, array( | |
'epub|mobi' => 'application/octet-stream' | |
)); | |
return $mimes; | |
} |
This file contains hidden or 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
#add caching headers for static files. tell browser to cache for one month | |
<FilesMatch "(?i)^.*\.(ico|flv|jpg|jpeg|png|gif|js|css)$"> | |
ExpiresActive On | |
ExpiresDefault A2592000 | |
</FilesMatch> | |
#add gzip to site | |
<IfModule mod_deflate.c> | |
<IfModule mod_filter.c> | |
AddOutputFilterByType DEFLATE text/plain text/html application/x-httpd-php-source |
This file contains hidden or 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 load_scripts(){ | |
global $wp_scripts; | |
wp_register_script( 'theme-scripts', get_bloginfo('template_url').'/js/scripts.js', array('jquery'), '1.0', true ); | |
//if we're on the woocommerce checkout page | |
if( is_checkout() ){ | |
$wp_scripts->add_data('theme-scripts','data','<!--START SCRIPT STRING--> | |
// script to load before name-of-enqueued-script loads |
This file contains hidden or 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 | |
// http://www.wprecipes.com/list-all-hooked-wordpress-functions | |
function list_hooked_functions($tag=false){ | |
global $wp_filter; | |
if ($tag) { | |
$hook[$tag]=$wp_filter[$tag]; | |
if (!is_array($hook[$tag])) { | |
trigger_error("Nothing found for '$tag' hook", E_USER_WARNING); | |
return; | |
} |
This file contains hidden or 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
// http://www.devnetwork.net/viewtopic.php?f=1&t=133156 | |
function array_cartesian_utm($arrays){ | |
//returned array... | |
$cartesic = array(); | |
//calculate expected size of cartesian array... | |
$size=(sizeof($arrays)>0)?1:0; | |
foreach($arrays as $array){ | |
$size= $size*sizeof($array); |
This file contains hidden or 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
<script src="/link-to-youtube-ga-event-tracking-javascript-code.js"></script> | |
<!--IFRAME CODE FOR YOUTUBE PLAYLIST PLAYER--> | |
<div id="oil_gas_training"> | |
You need Flash player 8+ and JavaScript enabled to view this video. | |
</div> | |
<script type="text/javascript"> | |
var tag=document.createElement("script"); | |
tag.src="//www.youtube.com/iframe_api"; | |
var firstScriptTag=document.getElementsByTagName("script")[0]; |
This file contains hidden or 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
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$ [NC] | |
RewriteCond %{REQUEST_URI} !^/mydomain.com/public/ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ /mydomain.com/public/index.php | |
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$ [NC] | |
RewriteRule ^(/)?$ mydomain.com/public/index.php [L] | |
RewriteEngine on |
This file contains hidden or 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
& cmd.exe /c "mysql -u root -p -h localhost < myql_database.sql" |
This file contains hidden or 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_headers_curl($response){ | |
$headers = array(); | |
$header_text = substr($response, 0, strpos($response, "\r\n\r\n")); | |
foreach (explode("\r\n", $header_text) as $i => $line){ | |
if ($i === 0) | |
$headers['http_code'] = $line; |
This file contains hidden or 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 | |
ini_set('memory_limit','3200M'); | |
// This script is to solve the problem of doing database search and replace | |
// when developers have only gone and used the non-relational concept of | |
// serializing PHP arrays into single database columns. It will search for all | |
// matching data on the database and change it, even if it's within a serialized | |
// PHP array. | |
// The big problem with serialised arrays is that if you do a normal DB | |
// style search and replace the lengths get mucked up. This search deals with |