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 | |
$file_content = file_get_contents( MAGENTO_ROOT. '/app/code/core/Mage/Core/Controller/Varien/Front.php' ); | |
$look_for = '->setRedirect($baseUrl, $redirectCode)'; | |
$use = '->setRedirect( $baseUrl . substr( $requestUri, 1 ), $redirectCode )'; | |
$file_content = str_replace( '<?php', '', $file_content ); | |
$file_content = str_replace( $look_for, $use, $file_content ); | |
eval( $file_content ); |
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
#!/usr/bin/php | |
<?php | |
date_default_timezone_set('CET'); | |
/** | |
* This script is a sendmail wrapper for php to log calls of the php mail() function. | |
*/ | |
//* Get the email content | |
$logline = ''; | |
$pointer = fopen('php://stdin', 'r'); |
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
Replace name_of_action with the name of the ajax action; | |
Replace name-of-plugin and name_of_plugin with the name of the plugin | |
File: name-of-plugin.php | |
<?php | |
class name_of_plugin { | |
/** | |
* Setup | |
*/ |
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 | |
$base_path = '/Users/eivin.landa/Workspace'; | |
$who = 'Eivin'; | |
$repos = [ | |
'AVREmea/emea.dev', | |
'Exist/exist.dev', | |
'Soma/soma.dev', |
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
echo "Installing web software" && \ | |
apt-get update \ | |
apt-get install \ | |
zip \ | |
git \ | |
zsh \ | |
mariadb-server apache2 php php-mbstring php-dom php-mcrypt libapache2-mod-php php-mysql \ | |
letsencrypt python-letsencrypt-apache \ | |
-y && \ |
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 | |
$wp_did_header = true; | |
require_once 'public/wp-load.php'; | |
$args = [ | |
'post_type' => 'product', | |
'posts_per_page' => -1, | |
'fields' => 'ids', |
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 | |
class Post_Type_Waybill { | |
static function setup() { | |
// add_filter( 'user_has_cap', __CLASS__ .'::disallow_new_post_button', 10, 2 ); | |
// add_filter( 'user_has_cap', __CLASS__ .'::disallow_new_post_page', 10, 2 ); | |
add_action( 'init', __CLASS__ .'::waybill_capabilities', 0 ); | |
add_action( 'init', __CLASS__ .'::waybill_post_type', 1 ); |
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
/** | |
* Recursive mapping | |
* @param array collection Any 2d array | |
* @param integer index The starting index (used for recursion) | |
* @return array Array with all possible combination of items | |
*/ | |
var generate_combinations = function( collection, index ) { | |
// Sanity check | |
if ( ! collection[ index ] ) { |
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 convert(&$arr, $path, $value) { | |
$keys = explode('.', $path); | |
foreach ($keys as $key) { | |
if ( ! isset( $arr[$key] ) ) { | |
$arr[$key] = []; | |
} | |
$arr = &$arr[$key]; |
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 | |
$mageFilename = 'public/app/Mage.php'; | |
if (!file_exists($mageFilename)) { | |
echo $mageFilename." was not found"; | |
exit; | |
} | |
require_once $mageFilename; | |
Mage::app(); |