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
// http://www.devnetwork.net/viewtopic.php?f=1&t=133156 | |
function array_cartesian_utm($arrays){ | |
//returned array... | |
$cartesic = array(); | |
//calculate expected size of cartesian array... | |
$size=(sizeof($arrays)>0)?1:0; | |
foreach($arrays as $array){ | |
$size= $size*sizeof($array); |
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 | |
// Detect if the content contains any Facebook links that can be embedded based on this doc | |
// https://developers.facebook.com/docs/plugins/oembed-endpoints/ | |
$content = 'https://www.facebook.com/facebook/videos/10153231379946729/'; | |
preg_match_all( '/http(s):\/\/(www.)facebook.com\/((?<=\/).+(?<=\/)posts|(?<=\/).+(?<=\/)activity|photo(s|\.php)|permalink\.php|media|questions|notes|(?<=\/).+(?<=\/)videos|video\.php)/', $content, $matches ); |
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 | |
/** | |
* Enable Jetpack development mode if WP_DEBUG is true and jetpack is not active/connected to WordPress.com | |
* See: https://jetpack.com/support/development-mode/ | |
*/ | |
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { | |
if ( method_exists( '\\Jetpack', 'is_active' ) && is_callable( array( '\\Jetpack', 'is_active' ) ) ) { | |
$jetpack_reflection = new \ReflectionMethod( '\\Jetpack', 'is_active' ); |
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 | |
/** | |
* Get the excerpt of a paragraph or string of long text. | |
* | |
* Get the shortened version of text for the wyisiwig. Use with custom wysiwyg (e.g. Advanced Custom Fields). This will print the paragraph and breaks tag but will strip all other tags | |
* | |
* @since 2014-11-06 | |
* @version 2016-03-09 | |
* @author De'Yonte W.<rxnlabs@github.com> |
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 | |
/** | |
* Add the widget ID and widget name as HTML comments. | |
* | |
* Makes it easiser to identify exactly which widget area a widget is appearing in. | |
* This helps a lot with themes that have a lot of sidebars and uses a lot of widgets. | |
*/ | |
function which_dynamic_sidebar( $sidebar_params ) { | |
$sidebar_params['0']['class'] = empty( $sidebar_params['0']['class'] )?$sidebar_params['0']['id']:$sidebar_params['0']['class'].' '.$sidebar_params['0']['id']; | |
$sidebar_params['0']['before_widget'] = '<!--Widget-Area:id:'.esc_attr($sidebar_params['0']['id']).';name:'.esc_attr($sidebar_params['0']['name']).'-->'.$sidebar_params['0']['before_widget']; |
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
/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/ |
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 | |
ini_set('memory_limit','1500M'); | |
/** | |
* Update/Covert all WooCommerce Products data to a new post type | |
* | |
* Moving all WooCommerce custom data to a new custom post type. Should only be executed from CLI since it uses so many processes. | |
* | |
* @author De'Yonte W. <admin@rxnlabs.com> | |
* @return void | |
*/ |
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 | |
/* | |
Output a list of numbers multiple times depending on their value (e.g. output 9 nine times, or 18 eighteen times). Works well if it doesn't matter if you listall the numbers preceding the last number | |
*/ | |
$array = array(1,2,3,4,5,6,7,8,9,12,18); | |
foreach ($array as $num) { | |
$string = ''; | |
$count = 1 * $num; | |
for ($i=0;$i < $count; $i++) { |
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
# Change the upload path of the sites to make sure media files still work | |
SELECT * FROM wpdb_6_options WHERE option_name IN ('upload_path', 'upload_url_path'); |
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
<script type="text/javascript"> | |
var storefront_items_stock = {}; | |
<? | |
var storefront = DB.getObjects('store_item'); | |
for each (item in storefront) { | |
print('storefront_items_stock['); | |
print( item.store_item_KEY ); | |
print( '] = ' ); | |
print( item.Number_in_Stock ); | |
print( ';\n'); |