Skip to content

Instantly share code, notes, and snippets.

Alain Schlesser schlessera

Block or report user

Report or block schlessera

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@schlessera
schlessera / script.md
Last active Aug 19, 2019
Siteground webinar - Learn How WP-CLI Can Make Your Life Easier
View script.md

Siteground webinar - Learn How WP-CLI Can Make Your Life Easier

Webinar description

WP-CLI, the command-line interface for WordPress, is one of the most popular tools among WordPress developers. However, it can be extremely helpful for anyone managing a WordPress site. In this webinar, the main person behind WP-CLI project: Alain Schlesser will show us the ins and outs of the tool. He will give us great examples on how it can be used to improve your workflow, for beginners to experienced developers and for projects big and small. We will give you invaluable examples on how to perform different tasks with WP-CLI automatically, saving you time and preventing you from making manual errors, like:

  • Keep forgetting to backup? Automate the process with WP-CLI.
  • Site not working? Get tips for easy troubleshoot with WP-CLI.
  • Too many spam comments? Learn how to clean them in no time.
  • Can’t log into your site? Reset your password with WP-CLI.
@schlessera
schlessera / shortcode-copyright.php
Created Apr 4, 2015
Shortcode to display copyright notice with current year
View shortcode-copyright.php
View keybase.md

Keybase proof

I hereby claim:

  • I am schlessera on github.
  • I am schlessera (https://keybase.io/schlessera) on keybase.
  • I have a public key ASAwZ3hewGFJXOlKo5p5dYD5Q-gmmvQDfsbyTKID3Uo09wo

To claim this, I am signing this object:

@schlessera
schlessera / README.md
Created Jul 29, 2016
Real-time Log Viewer Example
View README.md

Partial real-time log viewer example

This is a (partial) example to demonstrate the interaction between different reusable components to build an admin page in the WordPress back-end that shows a near-real-time display of the last 30 lines of my log files.

This code will not work as is, as some of it depends on a larger architecture system. Some of the files have been shortened, and the usual file headers and copyright notices have been removed for brevity's sake.

The related components that are discussed are brightnucleus/dependencies and brightnucleus/settings. The configuration is loaded through brightnucleus/config.

Notable "features" of the below code:

@schlessera
schlessera / Plugin.php
Last active Sep 29, 2017
Using Value Objects for Dependency Injection
View Plugin.php
<?php
class Plugin
{
protected $plugin_root;
private $loaded;
public function __construct(PluginRoot $plugin_root)
{
@schlessera
schlessera / Autoloader.php
Last active Apr 11, 2017
Generic Autoloader
View Autoloader.php
<?php namespace Generic;
use RuntimeException;
/**
* Class Autoloader.
*
* This is a custom autoloader to replace the functionality that we would
* normally get through the autoloader generated by Composer.
*
@schlessera
schlessera / translatable_string.php
Last active Jan 18, 2017
Translatable string with multiple links that can be reordered and renamed
View translatable_string.php
<?php
/**
* Translatable string with multiple links that can be reordered and renamed
* @author Alain Schlesser (alain.schlesser@gmail.com)
*
* @see http://php.net/manual/function.preg-replace.php
* @see http://codex.wordpress.org/Function_Reference/_2
*/
@schlessera
schlessera / .htaccess
Created May 8, 2015
Redirect HTTP to HTTPS, for the main domain as well as all subdomains.
View .htaccess
# Redirect HTTP to HTTPS, for the main domain as well as all subdomains.
#
# Example:
# http://domain.com/ => https://domain.com/
# http://subdomain.domain.com/ => https://subdomain.domain.com/
#
# Make sure you replace "replacewithyourdomain" with your actual root domain!
#
# @author: Alain Schlesser <alain.schlesser@gmail.com>
@schlessera
schlessera / Controller.php
Last active May 29, 2016
Example of bootstrapping a WordPress plugin.
View Controller.php
<?php
// file: src/Controller.php
/**
* Example Plugin Controller.
*/
namespace Example\Plugin;
use BrightNucleus\Config\ConfigInterface;
@schlessera
schlessera / README.md
Created Mar 10, 2016
Accessing WP plugin code from a theme
View README.md
You can’t perform that action at this time.