To support Laravel Package in Lumen:
Go to bootstrap/app.php
and uncomment this line:
$app->withFacades();
composer require package-name
<?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. |
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(); |
// 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);
#!/bin/bash
if [ "$1" == "" ]; then
exit 0
fi
REPLACE_FILENAME=`echo $1|sed 's/ /\-/g'`
FILES_PATH='./';
if [ "$2" != "" ]; then
FILES_PATH=$2
fi
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 |
<?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 ) { | |
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'); | |
<?php | |
class Settings { | |
/** | |
* @var string OPTION_NAME | |
*/ | |
const OPTION_NAME = 'myplugin_settings'; |