Skip to content

Instantly share code, notes, and snippets.

View saiik's full-sized avatar
🦄

Tobias Fuchs saiik

🦄
View GitHub Profile
@saiik
saiik / Add.php
Last active November 30, 2016 10:52
Add & delete Shopware Attributes using the new CRUD feature
<?php
$attr = Shopware()->Container()->get("shopware_attribute.crud_service");
$attr->update(
"attributes_table",
'your_field_name',
'field_type',
[
'label' => 'Display Label',
@saiik
saiik / config.php
Created August 29, 2016 14:34
Shopware Config (debug)
<?php
return [
'db' => [
'host' => '',
'port' => '',
'username' => '',
'password' => '',
'dbname' => ''
],
'front' => [
@saiik
saiik / IE.php
Last active September 7, 2016 07:26
Check if user is using internet explorer
<?php
preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
if(count($matches) < 2) {
preg_match('/Trident\/\d{1,2}.\d{1,2}; rv:([0-9]*)/', $_SERVER['HTTP_USER_AGENT'], $matches);
}
if(count($matches) > 1) {
$usingIE = true;
@saiik
saiik / filter.php
Last active November 30, 2016 10:50
Filter @mentions and #hashtags from a string
<?php
/**
* Filter @mentions and #hashtags from a string
*
* @author saiik<saikon@hotmail.de>
* @license GPLv3
*/
$str = 'Hello @saiik! #php #github';
@saiik
saiik / .htaccess
Created November 21, 2017 12:28
.htaccess HTTP > HTTPS
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]