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
diff --git a/WordPress-Dropins/wp-stack-cdn.php b/WordPress-Dropins/wp-stack-cdn.php | |
index 4099276..070ace8 100644 | |
--- a/WordPress-Dropins/wp-stack-cdn.php | |
+++ b/WordPress-Dropins/wp-stack-cdn.php | |
@@ -54,11 +54,11 @@ class WP_Stack_CDN_Plugin extends WP_Stack_Plugin { | |
$preg_path = preg_quote( $path, '#' ); | |
// Targeted replace just on uploads URLs | |
- return preg_replace( "#=([\"'])(https?://{$domain})?$preg_path/((?:(?!\\1]).)+)\.(" . implode( '|', $this->extensions ) . ")(\?((?:(?!\\1).)+))?\\1#", '=$1http://' . $this->cdn_domain . $path . '/$3.$4$5$1', $content ); | |
+ return preg_replace( "#=([\"'])(https?://{$domain})?$preg_path/((?:(?!\\1]).)+)\.(" . implode( '|', $this->extensions ) . ")(\?((?:(?!\\1).)+))?\\1#", '=$1//' . $this->cdn_domain . $path . '/$3.$4$5$1', $content ); |
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 ttf_get_make_stats() { | |
// Make remote request to WP.org | |
$response = wp_remote_post( | |
'http://api.wordpress.org/themes/info/1.0/', | |
array( | |
'body' => array( | |
'action' => 'theme_information', | |
'request' => serialize( (object) 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
// Run function only when the export is initiated | |
add_action( 'export_wp', 'zdt_unlimited_script_time' ); | |
/** | |
* Sets script execution time to unlimited. | |
* | |
* @return void | |
*/ | |
function zdt_unlimited_script_time() { | |
set_time_limit( 0 ); |
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
/** | |
* Used in front end requests to get the latest Tweet. | |
* | |
* @return bool|string | |
*/ | |
function get_latest_tweet() { | |
// Attempt to get the transient | |
if ( $tweet = get_transient( 'my_latest_tweet' ) ) { | |
return $tweet; |
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 if ( $image = zdt_get_social_image( $post ) ) : ?> | |
<div class="pin_share"> | |
<a href="http://pinterest.com/pin/create/button/?url=<?php echo urlencode( esc_url( get_the_permalink( get_the_ID() ) ); ?>&media=<?php echo urlencode( esc_url( $image ) ); ?>&description=<?php echo urlencode( esc_html( get_the_excerpt( get_the_ID() ) ); ?>" class="pin-it-button" count-layout="none">Pin It</a> | |
</div> | |
<?php endif; ?> |
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
/** | |
* Generates a domain-mapping safe URL on WordPress.com | |
* Core's ajaxurl uses admin_url() which returns *.wordpress.com which doesn't work for the front-end on domain-mapped sites. | |
* This works around that and generates the correct URL based on context. | |
*/ | |
function admin_ajax_url( $path = '' ) { | |
if ( is_admin() ) | |
$url = admin_url( 'admin-ajax.php' ); | |
else | |
$url = home_url( 'wp-admin/admin-ajax.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 | |
add_action( 'init', 'test' ); | |
function test() { | |
// Returns bool( false ) | |
set_transient( 'test-trans-false', false, 5 ); | |
get_transient( 'test-trans-false' ); | |
// Return bool( false ) | |
set_transient( 'test-trans-true', true, 5 ); | |
get_transient( 'test-trans-true' ); |
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 zt_add_enctype { | |
echo ' enctype="multipart/form-data"'; | |
} | |
add_action( 'post_edit_form_tag', 'zt_add_enctype' ); |
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 test_race() { | |
if ( wp_cache_get( 'lock' ) ) | |
return false; | |
wp_cache_add( 'lock', 1 ); | |
$key = time(); | |
wp_cache_add( $key, 0 ); |
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 test_race() { | |
$key = date( 'YdmH', time() ); | |
wp_cache_add( $key, 0 ); | |
if ( 1 !== wp_cache_incr( $key ) ) | |
return false; | |
// Do the things | |
} |
OlderNewer