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 | |
// Make sure required $_FILES values are set before trying to load WordPress | |
if ( isset( $_FILES['file'] ) ) { | |
// Load WordPress | |
require( strstr( dirname( __FILE__ ), 'wp-content', true ) . 'wp-load.php' ); | |
// Load additional required files since we did a short init |
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 | |
// Make sure required $_FILES values are set before trying to load WordPress | |
if ( isset( $_FILES['file'] ) ) { | |
// We don't need all of WordPress, just the basics | |
define( 'SHORTINIT', true ); | |
// Load WordPress | |
require( strstr( dirname( __FILE__ ), 'wp-content', true ) . 'wp-load.php' ); |
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 | |
/** | |
* Get a value from an object or an array. Allows the ability to fetch a nested value from a | |
* heterogeneous multidimensional collection using dot notation. | |
* | |
* @param array|object $data | |
* @param string $key | |
* @param mixed $default | |
* @return mixed |
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 | |
/** | |
* Get an excerpt | |
* | |
* @param string $content The content to be transformed | |
* @param int $length The number of words | |
* @param string $more The text to be displayed at the end, if shortened | |
* @return string | |
*/ |
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 | |
/** | |
* Order an array based an ordered set of keys. | |
* NOTE: Values that don't have a corresponding key in the array of keys will be dropped. | |
* | |
* @param array $array | |
* @param array $keys | |
* @return array | |
*/ | |
public static function array_order_by_keys( array $array, array $keys ) { |
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 | |
/** | |
* Case insensitive array_search() with partial matches. | |
* | |
* @param string $needle | |
* @param array $haystack | |
* @return bool|int|string | |
*/ | |
public static function array_find( $needle, array $haystack ) { |
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 | |
/** | |
* Index a collection of arrays/objects by a specific key/property. | |
* | |
* @param string $index | |
* @param array $data | |
* @return array | |
*/ | |
function index_by( $index, array $data ) { |
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 | |
/** | |
* Validate a value by running it through one or more callbacks. | |
* | |
* @param mixed $value | |
* @param callable $validation | |
* @return bool | |
*/ | |
function validate( $value, $validation ) { |
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 | |
/** | |
* Sanitize a value by passing it through one or more sanitization callbacks. | |
* | |
* @param mixed $value | |
* @param callable|array $sanitize | |
* @return mixed | |
*/ | |
function sanitize( $value, $sanitize ) { |
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 | |
/** | |
* Merge multiple WP_Error objects together | |
* | |
* @return WP_Error | |
*/ | |
function wp_error_merge() { | |
$wp_error_merged = new WP_Error(); | |
$wp_errors = func_get_args(); |