#!/bin/bash
if [ "$1" == "" ]; then
exit 0
fi
REPLACE_FILENAME=`echo $1|sed 's/ /\-/g'`
FILES_PATH='./';
if [ "$2" != "" ]; then
FILES_PATH=$2
fi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Settings { | |
/** | |
* @var string OPTION_NAME | |
*/ | |
const OPTION_NAME = 'myplugin_settings'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const toggleButtons = document.getElementsByClassName('as-toggle'); | |
for(let toggle of toggleButtons){ | |
const span = document.createElement('span'); | |
if(toggle.checked){ | |
span.classList.add('is-checked'); | |
} | |
span.classList.add('toggle-button'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wpdb; | |
$prefix = "foo"; | |
// We get all the transients prefixed by our `$prefix` | |
$sql = 'select option_name from ' . $wpdb->prefix . 'options where option_name like "_transient_' . $prefix . '%"'; | |
$results = $wpdb->get_results( $sql, ARRAY_A ); | |
$transients = []; | |
array_walk_recursive( $results, function ( $value ) use ( &$transients ) { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const form = document.forms["foo"]; | |
// Save initial state | |
const initialFormData = new FormData(form); | |
const initialFormState = JSON.stringify(Array.from(initialFormData.entries())); | |
// Change form controls' values | |
form.elements["text"].value = "foo"; | |
// Get new form state |
// Remove Mailchimp for Wordpress plugin's comments
add_action('get_footer',function (){ ob_start(function ($o){
return preg_replace('/\n?<!--.*?mailchimp.*?>/mi','',$o); }); });
add_action('wp_footer',function (){ ob_end_flush(); }, 999);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
emmet.require('filters').add('php', function process(tree) { | |
_.each(tree.children, function(node) { | |
// define variable name | |
if (node.name() == 'data' && node.parent == ''){ | |
node.start = '\\$this->request->data'; | |
}else{ | |
node.start = (node.parent == '' ? '\\$' : '') + node.name(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Create a web friendly URL slug from a string. | |
* | |
* Although supported, transliteration is discouraged because | |
* 1) most web browsers support UTF-8 characters in URLs | |
* 2) transliteration causes a loss of information | |
* | |
* @author Sean Murphy <sean@iamseanmurphy.com> | |
* @copyright Copyright 2012 Sean Murphy. All rights reserved. |