Skip to content

Instantly share code, notes, and snippets.

<?php
/*
1. Source code lines are limited to 120 characters
2. 0 space expected after first parenthesis of function
3. Opening brace should be on a new line
Ça donne un truc illisible
*/
public function getCategories($id_lang = false,
$("form :input").each(function(index, elem) {
var eId = $(elem).attr("id");
var label = null;
if (eId && (label = $(elem).parents("form").find("label[for="+eId+"]")).length == 1) {
$(elem).attr("placeholder", $(label).text());
$(label).remove();
}
});
<?php
header('Content-Type: application/json');
$id_product = (int)$_GET['id_product'];
if (!$id_product)
{
$result = array(
'status' => 'fail',
'data' => array(
'id_product' => 'id_product is required'
<?php
$file_content = '<?php
/**
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to http://doc.prestashop.com/display/PS15/Overriding+default+behaviors
* #Overridingdefaultbehaviors-Overridingamodule%27sbehavior for more information.
<?php
/**
* idem than base64_encode()
*/
function mybase64_encode($to_encode)
{
$base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
$encoded = '';
$padding = '';
@Shagshag
Shagshag / ps_logtoadmin.php
Last active November 18, 2018 21:21
This script allows to login to PrestaShop without password. Put it on the root of your shop by FTP then visit the URL http://yourshop/ps_logtoadmin.php
<?php
/**
* 1. Change the password below, it's encoded with m5d https://duckduckgo.com/?q=md5+toto
* 2. Put this file at the root of your shop
* 3. Visit the URL http://yourshop/ps_logtoadmin.php
**/
$auth_pass = "f71dbe52628a3f83a77ab494817525c6"; //toto
// display login screen
if (!isset($_POST['pass'])
@Shagshag
Shagshag / AdminController.php
Created July 7, 2016 08:32
backward_compatibility with currentIndex
<?php
/**
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
<?php
/**
* Ajax entry
*
* @category Prestashop
* @category Module
* @author Samdha <contact@samdha.net>
* @copyright Samdha
* @license commercial license see license.txt
*/
<?php
/**
* Add Shipping Number module
*
* @category Prestashop
* @category Module
* @author Samdha <contact@samdha.net>
* @copyright Samdha
* @license commercial license see license.txt
*
<?php
class BackupDatabaseCronModuleFrontController extends ModuleFrontController
{
public function init()
{
$this->module->cron();
die();
}
}