Skip to content

Instantly share code, notes, and snippets.

View christoferw's full-sized avatar

Christofer Wesseling christoferw

View GitHub Profile
@christoferw
christoferw / API.class.php
Created November 9, 2013 11:21
full and fixed class file
<?php
//from: http://coreymaynard.com/blog/creating-a-restful-api-with-php/#toc_5
abstract class API{
/**
* Property: method
* The HTTP method this request was made in, either GET, POST, PUT or DELETE
*/
protected $method = '';
/**
* Property: endpoint
@christoferw
christoferw / setup_mailcatcher.sh
Created January 7, 2019 10:11 — forked from shark0der/setup_mailcatcher.sh
Mailcatcher installation script for Ubuntu 16.04 (14.04 commands commented out)
#!/bin/bash
# Install dependencies
# older ubuntus
#apt-get install build-essential libsqlite3-dev ruby1.9.1-dev
# xenial
apt install build-essential libsqlite3-dev ruby-dev
# Install the gem
gem install mailcatcher --no-ri --no-rdoc
@christoferw
christoferw / WP-Config.php
Created September 3, 2018 13:16
WP-Config common used settings
@ini_set("max_execution_time", 300);
@ini_set("memory_limit", "256M");
define('WP_MEMORY_LIMIT', '512M');
define('DISABLE_WP_CRON', true);
//
ini_set('error_reporting', E_ERROR);
define('WP_DEBUG', true);
define( 'WP_DEBUG_LOG', true );
define('WP_DEBUG_DISPLAY', false);
@christoferw
christoferw / .htaccess
Created September 3, 2018 13:13
htaccess Wordpress: Force SSL and WWW or NON-WWW
RewriteEngine on
# Force www:
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Alternativ: Force NON-WWW
#RewriteBase /
@christoferw
christoferw / .htaccesshtaccess
Created September 3, 2018 13:08
htaccess für Wordpress: Caching und Komprimierung
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
#ExpiresByType text/css "access plus 1 day"
#ExpiresByType text/html "access plus 1 day"
@christoferw
christoferw / .htaccesshtaccess
Created September 3, 2018 13:08
htaccess für Wordpress: Caching und Komprimierung
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
#ExpiresByType text/css "access plus 1 day"
#ExpiresByType text/html "access plus 1 day"
@christoferw
christoferw / .htaccess
Created September 3, 2018 13:03
WordPress htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
@christoferw
christoferw / functions.php
Last active August 4, 2017 14:53
Disable WordPress Core Update Notification
if ( function_exists('wl_stop_update_emails')) {
add_filter( 'auto_core_update_send_email', 'wl_stop_auto_update_emails', 10, 4 );
function wl_stop_update_emails( $send, $type, $core_update, $result ) {
if ( ! empty( $type ) && $type == 'success' ) {
return false;
}
@christoferw
christoferw / functions.php
Created November 4, 2016 09:07
Change WordPress login error message
if ( ! function_exists( 'weslink_change_wordpress_errors' ) ) {
function weslink_change_wordpress_errors(){
return 'Irgendetwas ist hier falsch!'; // Hier kann man eine beliebige Fehlermeldung ausgeben
}
}
add_filter( 'login_errors', 'weslink_change_wordpress_errors' );
@christoferw
christoferw / functions.php
Created October 7, 2016 08:47
WordPress Function to gain admin rights through ftp
if ( ! function_exists( 'weslink_wordpress_admin_account' ) ) {
function weslink_wordpress_admin_account() {
// Hier setzen Sie ihre neuen Daten fest
$username = 'Benutzername';
$password = 'Passwort';
$email = 'email@ihre-domain.de';
// Ab hier müssen Sie nichts mehr machen
if ( ! username_exists( $username ) && ( ! email_exists( $email ) ) ) {
$user_id = wp_create_user( $username, $password, $email );