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
<IfModule mod_mime.c> | |
# Text | |
AddType text/css .css | |
AddType application/x-javascript .js | |
AddType text/html .html .htm | |
AddType text/richtext .rtf .rtx | |
AddType text/plain .txt | |
AddType text/xml .xml |
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 | |
add_filter( 'timber/context/404', function ( array $context ) { | |
global $wp; | |
$url = urldecode( $wp->request ); | |
$context['referer'] = wp_get_referer(); | |
$context['url'] = site_url( $url ); |
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 | |
$fh_read = fopen('alldb.sql', 'r'); | |
$fh_write = null; | |
$dbname = null; | |
while ($line = fgets($fh_read)) { | |
if (preg_match('@-- Current Database: `([^`]+)`@', $line, $m)) { | |
if ($fh_write) { | |
echo 'Closing ', $dbname, '<br>'; |
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 cafileCheck() | |
{ | |
if(!__DEBUGGING__) | |
{ | |
return; | |
} | |
$cert_locations = openssl_get_cert_locations(); | |
if(is_file($cert_locations['default_cert_file'])) |
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 | |
namespace DMG\ServiceProvider; | |
use Silex\Application; | |
use Silex\ServiceProviderInterface; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
/** |
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_loaded_theme_files() { | |
$sdir = realpath( get_stylesheet_directory() ) . DIRECTORY_SEPARATOR; | |
$tdir = realpath( get_template_directory() ) . DIRECTORY_SEPARATOR; | |
return array_filter( get_included_files(), function ( $file ) use ( $sdir, $tdir ) { | |
$r = realpath( $file ); | |
$d = dirname( $r ) . DIRECTORY_SEPARATOR; |
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
# env based | |
SetEnvIf SLIM_MODE ^(development|testing|acceptation|production)$ SLIM_MODE_FROM_ENV=$0 | |
SetEnvIfNoCase Request_URI /projects/ SLIM_MODE_FROM_REQUEST=testing SLIM_MODE_RULE_6=1 | |
SetEnvIfNoCase Host ^accepta(nce|tie|tion)\d*\. SLIM_MODE_FROM_REQUEST=acceptation SLIM_MODE_RULE_5=1 | |
SetEnvIfNoCase Host ^(beta|test(ing)?)\d*\. SLIM_MODE_FROM_REQUEST=testing SLIM_MODE_RULE_4=1 | |
SetEnvIfNoCase Host \.(dev|test(ing)?|local(host)?)$ SLIM_MODE_FROM_REQUEST=development SLIM_MODE_RULE_3=1 | |
SetEnvIfNoCase Host ^localhost(:\d+)?$ SLIM_MODE_FROM_REQUEST=development SLIM_MODE_RULE_2=1 | |
SetEnvIf SLIM_MODE_FROM_REQUEST ^$ SLIM_MODE_FROM_DOMAIN=none SLIM_MODE_RULE_1=1 |
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 Menu extends \Timber\Menu { | |
public $MenuItemClass = 'MenuItem'; | |
} | |
class MenuItem extends \Timber\MenuItem { | |
/** @var MenuItem */ | |
public $parent; |
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 | |
// removes orphaned images | |
// as in no attachment record. | |
require __DIR__ . '/wp-load.php'; | |
ob_implicit_flush( true ); | |
set_time_limit( 0 ); | |
/** @var \wpdb */ |