Examples used at http://msls.co/hooks-filters-and-actions/
This file contains 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
window.onload = function () { | |
console.log("Merry Christmas"); | |
}; |
This file contains 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 | |
function my_msls_blog_collection_get( $objects ) { | |
$objects = array(); | |
$blogs = array( 1 => 'Override English', 2 => 'Override Deutsch', ); | |
foreach ( $blogs as $id => $description ) { | |
$details = get_blog_details( $id ); | |
if ( is_object( $details ) ) { | |
$objects[$id] = new MslsBlog( $details, $description ); | |
} |
This file contains 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
# Install PHP_CodeSniffer | |
sudo apt-get install php-codesniffer | |
# Install the WordPress Coding Standards | |
sudo git clone git://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git \ | |
$(pear config-get php_dir)/PHP/CodeSniffer/Standards/WordPress | |
# Now your can check your files like this | |
phpcs --standard=WordPress your-file.php |
This file contains 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 BoundingBox | |
*/ | |
class BoundingBox { | |
/** | |
* @var float $lat | |
* @var float $lon |
This file contains 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
#!/usr/bin/env python | |
""" | |
The config.ini contains something like: | |
[Proxy] | |
proxy = http://YOURPROXY/proxy.pac | |
user = YOURUSER | |
pass = YOURPASS | |
local = proxy.pac |
This file contains 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 | |
/* | |
Plugin Name: WordPress serves JSON | |
Description: Serve your content as JSON or JSONP in a simple manner (based on an example by Jon Cave - http://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/). | |
Plugin URI: https://gist.github.com/lloc/8933914 | |
Author: realloc | |
Author URI: http://lloc.de/ | |
*/ | |
namespace LLOC\realloc; |
This file contains 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 | |
namespace wctrn\realloc; | |
abstract class Option { | |
abstract function get( int $id ); | |
} |
This file contains 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 | |
namespace wctrn\realloc; | |
interface Thing { | |
public function the_content( string $content ) : void; | |
} | |
class Tag implements Thing { |
This file contains 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 | |
function variadic_sum( int ... $args ) { | |
return array_sum( $args ); | |
} | |
// echoes 6 | |
echo variadic_sum( 1, 2, 3 ), PHP_EOL; | |
$a = [ 1, 2, 3 ]; |
NewerOlder