Skip to content

Instantly share code, notes, and snippets.

<?php
/*
* 2007-2015 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
/*
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-3.0.php
@hh-com
hh-com / Create Image from PDF with Imagick.php
Last active November 17, 2017 11:14
Create Images from each page in a PDF-File with Imagick
<?php
function pdf2Png($pdfPath, $imgPath = ".")
{
$path_parts = pathinfo($pdfPath);
$PdfFilename = "pdf".$path_parts['filename'];
$pdf = new \Imagick($pdfPath);
$anzahlDerSeiten = $pdf->getNumberImages();
@hh-com
hh-com / generateAlias.php
Last active November 21, 2017 18:02
PHP Function to generate an Alias for URL
<?php
public function generateAlias($strString, $uniquer)
{
$strString = preg_replace('/(&#*\w+)[\x00-\x20]+;/i', '$1;', $strString);
$strString = preg_replace('/(&#x*)([0-9a-f]+);/i', '$1$2;', $strString);
$strString = html_entity_decode($strString, ENT_COMPAT, null);
$strString = str_replace(array('[&]', '[&amp;]', '[lt]', '[gt]', '[nbsp]', '[-]'), array('&amp;', '&amp;', '&lt;', '&gt;', '&nbsp;', '&shy;'), $strString);
$arrSearch = array('/[^a-zA-Z0-9 \.\&\/_-]+/', '/[ \.\&\/-]+/');
$arrReplace = array('', '-');
@hh-com
hh-com / analytics_google.html
Created February 23, 2018 09:22
Activate / Deactivate BUTTON for Contao Google Analytics Template
<?php
/**
* To use this script, please fill in your Google Analytics ID below
*/
$GoogleAnalyticsId = 'UA-XXXXX-X';
/**
* DO NOT EDIT ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING!
@hh-com
hh-com / Prestashop: AdminProductDataProvider.php
Last active June 30, 2018 09:08
Prestashop Product-List in Backend is very slow. Comment out the image query to solves the problem for me. /src/Adapter/Product/AdminProductDataProvider.php Line:212 and 252 to 261
<?php
/**
* 2007-2017 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:
* https://opensource.org/licenses/OSL-3.0
@hh-com
hh-com / getAllProductLinks.php
Last active November 18, 2018 20:19
Prestashop: Get all Product- Links
@hh-com
hh-com / Cron_Prestashop_Run_File_Without_Module.php
Last active November 28, 2019 14:08
Boilerplate: Prestashop - Run Singlefile without Module
<?php
/**
* NOTICE OF LICENSE
*
* Copyright Harald Huber
* You are allowerd to use this module in one project (also commercial).
* You are not allowed to share or sell this software.
*
* DISCLAIMER
*
@hh-com
hh-com / Cron_Contao3_Run_File_Without_Module.php
Last active December 13, 2018 19:34
Boilerplate: Contao3- Run Singlefile without Module (by Cron)
<?php
/**
######### Dont forget to create a .htaccess in the same direcotry from this file ###########
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
<IfModule mod_authz_core.c>
Require all granted
@hh-com
hh-com / contao-hello-world-bundle-tutorial.md
Created October 24, 2018 22:13
Contao Hello World Bundle Tutorial

Contao Hello World Bundle Tutorial

Möchte man eine Contao Erweiterung in mehreren Projekten einsetzen und/oder der Allgemeinheit zur Verfügung stellen, legt man dazu am besten ein Bundle an und veröffentlicht es auf Packagist. Dann lässt sich die Erweiterung einfach über Composer oder den Contao Manager installieren. Dieses Tutorial beschreibt wie das unter Verwendung des Skeleton Bundles funktioniert. Dabei wird ein Bundle erstellt, das ein Inhaltselement erzeugt, das "Hello World" ausgibt. Folgendes werden wir machen.

  1. Einen Vendor- und Bundle-Namen wählen
  2. Das Skeleton Bundle verstehen und anpassen
  3. Ein Repository für das Bundle anlegen
  4. Das Bundle in der Entwicklungsinstallation installieren
  5. Die grundlegende Funktionalität implementieren
  6. Unit Tests schreiben