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 | |
/** | |
* @param string $str | |
* @return bool | |
*/ | |
function is_base64($str) | |
{ | |
return (bool)preg_match('`^[a-zA-Z0-9+/]+={0,2}$`', $str); | |
} |
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
<Directory "/var/web/www/"> | |
# use mod_authz_host since Apache 2.4 | |
<IfDefine APACHE24> | |
Require local | |
</IfDefine> | |
# use mod_access before 2.4 | |
<IfDefine !APACHE24> | |
Order Deny,Allow |
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
RewriteEngine On | |
RewriteCond %{QUERY_STRING} ^=PHPE9568F3[4-6]-D428-11d2-A769-00AA001ACF42$ [OR] | |
RewriteCond %{QUERY_STRING} ^=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000$ | |
RewriteRule (.*) - [F] |
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 | |
/** | |
* Implements hook_menu(). | |
*/ | |
function foobar_menu() { | |
$items['admin/add-image-style'] = array( | |
'title' => 'Shortcut to add image style', | |
'page callback' => 'drupal_goto', | |
'page arguments' => array('/admin/config/media/image-styles/add'), |
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
{ | |
"require-dev": { | |
"squizlabs/php_codesniffer": "2.*" | |
}, | |
"scripts": { | |
"phpcs-setup": [ | |
"\"vendor/bin/phpcs\" --config-set default_standard ruleset.xml", | |
"\"vendor/bin/phpcs\" --config-set colors 1", | |
"\"vendor/bin/phpcs\" --config-set show_progress 1", | |
"\"vendor/bin/phpcs\" --config-set report_width 120", |
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
# more info : http://httpd.apache.org/docs/current/en/expr.html#vars | |
# deny access from monday to friday and between 9am to 6pm | |
RewriteCond %{TIME_WDAY} ^1|2|3|4|5$ | |
RewriteCond %{TIME_HOUR} ^0?9|10|11|12|13|14|15|16|17|18$ | |
RewriteRule ^nsfw\.html$ - [L] |
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 | |
$xml = <<<ENDXML | |
<catalog xmlns:ns1="http://localhost/ns1" xmlns:ns2="http://localhost/ns2"> | |
<product id="1" ns2:order="2"> | |
<name>Test</name> | |
<ns1:price>100</ns1:price> | |
</product> | |
</catalog> | |
ENDXML; |
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 | |
/** | |
* Flatten a multidimensional array to a single dimensional array by joining nested keys together | |
* | |
* @param array $array The array to flatten | |
* @param string $glue Glue string to join keys together | |
* @return array | |
*/ | |
function array_linearize(array $array, $glue = '/') | |
{ |
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 | |
/** | |
* Implements hook_preprocess_html(). | |
*/ | |
function <theme>_preprocess_html(&$variables) | |
{ | |
$header = drupal_get_http_header('status'); | |
if ($header && preg_match('`^[0-9]+`', $header, $matches)) { | |
switch ($matches[0]) { |
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 | |
/** | |
* Implements hook_preprocess_html(). | |
*/ | |
function <theme>_preprocess_html(&$vars) | |
{ | |
$meta = array( | |
'#tag' => 'meta', | |
'#attributes' => array( |
OlderNewer