Skip to content

Instantly share code, notes, and snippets.

View putzflorian's full-sized avatar

Florian Putz putzflorian

  • @elements-at
  • Salzburg
  • 00:24 (UTC +01:00)
View GitHub Profile
@putzflorian
putzflorian / siteredirect.php
Last active August 29, 2015 13:56
redirect Pimcore Site Request
<?php
// redirect site
if(!Pimcore_Tool::isFrontentRequestByAdmin()){
$d = preg_match('/region\/(.*)/', $this->_request->getPathInfo(), $matches);
if($d){
$this->redirect('http://www.newdomain.at/' . $matches[1], array('code' => 301));
}
}
@putzflorian
putzflorian / httpsredirect.php
Last active August 29, 2015 13:57
HTTPS umleitung Action Controller
<?php
$document_path = $this->_request->getPathInfo();
if(!Pimcore_Tool::isFrontentRequestByAdmin()){
$pos = strpos($document_path, '/' . $this->language . '/tosc4');
if($pos === false && $_SERVER['SERVER_PORT'] == 443){
Pimcore_Model_Cache::disable();
$this->_redirect('http://www.domain.at' . $document_path, array('code' => 301));
}
@putzflorian
putzflorian / qrcode.php
Created March 7, 2014 09:19
Render qr codes
<?php
public function QrcodeAction () {
$url = $this->getParam("url");
$codeSettings = array(
'text' => $url,
'backgroundColor' => '#FFFFFF',
'foreColor' => '#000000',
'padding' => 0, //array(10,5,10,5),
'moduleSize' => 10
@putzflorian
putzflorian / importRedirects.php
Created April 3, 2014 13:43
Import Redirects in Pimcore
<?php
$today = new Zend_Date();
$today->add(6, Zend_Date::MONTH);
$time = $today->getTimestamp();
$rd = new InsertRedirect();
$row = 1;
if (($handle = fopen("redirects.csv", "r")) !== FALSE) {
while (($data = fgetcsv($handle, 10000, ";")) !== FALSE) {
@putzflorian
putzflorian / MediaQueries.css
Created June 8, 2014 11:02
Media Queries for Standard Devices
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
@putzflorian
putzflorian / ajaxpolling.js
Created June 12, 2014 12:31
Ajax polling
if(typeof(Storage) !== "undefined") {
var d = new Date();
var n = Math.round(d.getTime() /1000);
if (sessionStorage.toralarmvisit) {
} else {
sessionStorage.toralarmvisit = n;
}
@putzflorian
putzflorian / startup.js
Last active August 29, 2015 14:03
Pimcore Backend IFRAME
pimcore.registerNS("pimcore.plugin.productimport");
pimcore.plugin.productimport = Class.create(pimcore.plugin.admin, {
getClassName: function() {
return "pimcore.plugin.productimport";
},
initialize: function() {
pimcore.plugin.broker.registerPlugin(this);
@putzflorian
putzflorian / image.php
Created July 23, 2014 08:57
Pimcore_Image Create temp Images
<?php
$tmpFiles = [];
foreach ($_FILES as $file) {
$imPath = PIMCORE_TEMPORARY_DIRECTORY . "/" . uniqid() . ".jpg";
$im = Pimcore_Image::getInstance();
@putzflorian
putzflorian / SSLredirect.php
Created January 30, 2015 08:27
SSL redirect for Pimcore
<?php
// SSL redirect
if(!$this->editmode){
if($this->document instanceof Document_Page){
$domain = 'www.domain.tld';
if($this->document->getProperty('https') && !$this->getRequest()->isSecure()){
@putzflorian
putzflorian / redis-stats.php
Last active August 29, 2015 14:16 — forked from blongden/redis-stats.php
redis-stats
<?php
$fp = fsockopen('127.0.0.1', 6379, $errno, $errstr, 30);
$data = array();
if (!$fp) {
die($errstr);
} else {
fwrite($fp, "INFO\r\nQUIT\r\n");
while (!feof($fp)) {