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
main() { | |
Map <String, String> args = {'filter_visibility' : 'false' }; | |
print( getMediaAssetCollectionArgs( args ) ); | |
print( getRequestURi( getMediaAssetCollectionArgs( args ) ) ); | |
} | |
Map getMediaAssetCollectionArgs( Map args ) { |
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
//Ensure that we don't allow creation of tickers via insertion of a post with non-existent tickers assigned | |
//Tickers should only be created via the admin ticker interface or via automatic pull-in from xignite | |
add_filter( 'wp_insert_post_data', function( $data, $post_arr ) { | |
if ( empty( $post_arr['tax_input']['ticker'] ) ) { | |
return $data; | |
} | |
$created_tickers = 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
add_filter( 'the_content', function( $content ) { | |
$content_path = ( defined( 'IMAGE_REPLACER_WP_CONTENT_PATH' ) ) ? IMAGE_REPLACER_WP_CONTENT_PATH : WP_CONTENT_DIR; | |
$content_url = ( defined( 'IMAGE_REPLACER_WP_CONTENT_URL' ) ) ? IMAGE_REPLACER_WP_CONTENT_URL : WP_CONTENT_URL; | |
preg_match_all( '/<img(?:\s|.)+?src="((?:\s|.)+?)"(?:\s|.)+?\/?>/', $content, $matches ); | |
if ( empty( $matches[1] ) ) | |
return $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
//If no post thumbnail exists, get the first image in the post and return that instead | |
add_filter( 'post_thumbnail_html', function( $html, $post_id, $post_thumbnail_id, $size, $attr ) { | |
if ( $html ) | |
return $html; | |
$found = preg_match( '/<img.+?class=\".+?([0-9]+).*\/>/', get_post( $post_id )->post_content, $matches ); | |
if ( $found ) | |
$html = wp_get_attachment_image( end( $matches ), $size, false, $attr ); |
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
add_filter( 'wp_get_attachment_image_attributes', function( $attr, $attachment ) { | |
$content_path = ( defined( 'IMAGE_REPLACER_WP_CONTENT_PATH' ) ) ? IMAGE_REPLACER_WP_CONTENT_PATH : WP_CONTENT_DIR; | |
$content_url = ( defined( 'IMAGE_REPLACER_WP_CONTENT_URL' ) ) ? IMAGE_REPLACER_WP_CONTENT_URL : WP_CONTENT_URL; | |
$file_path = str_replace( $content_url, $content_path, $attr['src'] ); | |
if ( file_exists( $file_path ) ) | |
return $attr; |
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
function parse() { | |
if ( ! file_exists( $this->file_path ) || ! is_readable( $this->file_path ) ) | |
return array(); | |
$header = NULL; | |
$data = array(); | |
if ( ( $handle = fopen( $this->file_path, 'r' ) ) !== FALSE ) { |