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( 'testimonials_widget_widget_options', array( &$this, 'widget_options' ) ); | |
public function widget_options( $options ) { | |
foreach ( $options as $id => $parts ) { | |
if ( 'form' == $parts['section'] ) | |
unset( $options[ $id ] ); | |
} | |
return $options; | |
} |
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( 'testimonials_widget_version', array( &$this, 'version' ) ); | |
public function version( $version ) { | |
$version .= '-' . self::PLUGIN_SLUG . '-' . self::VERSION; | |
return $version; | |
} |
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( 'testimonials_widget_validate_settings', array( &$this, 'validate_settings' ), 10, 2 ); | |
public static function validate_settings( $input, $errors = array(), $do_errors = false ) { | |
if ( ! empty( $input['clearcache'] ) ) { | |
Testimonials_Widget_Premium_Cache::clear_cache_all(); | |
unset( $input['clearcache'] ); | |
} | |
if ( empty( $do_errors ) ) { | |
$validated = $input; |
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( 'testimonials_widget_sections', 'sections' ); | |
add_filter( 'testimonials_widget_settings', 'settings' ); | |
public function sections( $sections ) { | |
$sections[ 'premium' ] = __( 'Premium', 'testimonials-widget-premium' ); | |
return $sections; | |
} | |
public function settings( $settings ) { | |
$settings['premium_expand_begin'] = array( | |
'section' => 'premium', |
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( 'testimonials_widget_query_args', array( &$this, 'query_args' ), 10, 2 ); | |
public function query_args( $args, $atts ) { | |
global $wpdb; | |
$args['post_type'] = $atts['post_type']; | |
$no_cache = $atts['no_cache']; | |
if ( $no_cache ) { | |
$args['no_cache'] = 1; |
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( 'testimonials_widget_posts_custom_column', array( &$this, 'posts_custom_column' ), 10, 3 ); | |
public function posts_custom_column( $result, $column, $post_id ) { | |
switch ( $column ) { | |
case 'testimonials-widget-read-more-link': | |
$url = get_post_meta( $post_id, $column, true ); | |
if ( ! empty( $url ) && 0 === preg_match( '#https?://#', $url ) ) { | |
$url = 'http://' . $url; | |
} | |
$result = make_clickable( $url ); |
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( 'testimonials_widget_meta_box', 'my_meta_box' ); | |
function my_meta_box( $fields ) { | |
$read_more_link = array( | |
'name' => __( 'Read More Link', 'testimonials-widget-premium' ), | |
'id' => 'testimonials-widget-read-more-link', | |
'type' => 'text', | |
'desc' => __( 'Alternate destination for "Read more" link. Leave blank for normal linking to full testimonial.', 'testimonials-widget-premium' ), | |
); | |
$fields[] = $read_more_link; |
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( 'testimonials_widget_content', array( &$this, 'truncate_content' ), 10, 4 ); | |
public function truncate_content( $content, $widget_number, $source, $atts ) { | |
$char_limit = $atts['char_limit']; | |
$excerpt_read_more = $atts['excerpt_read_more']; | |
$force_read_more = $atts['force_read_more']; | |
$hide_read_more = $atts['hide_read_more']; | |
$nofollow_read_more = $atts['nofollow_read_more']; | |
$content_bare = strip_tags( $content ); | |
if ( ! $force_read_more ) { |
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( 'testimonials_widget_columns', array( &$this, 'columns' ) ); | |
public function columns( $columns ) { | |
$columns['testimonials-widget-read-more-link'] = __( 'Read More Link', 'testimonials-widget-premium' ); | |
return $columns; | |
} |
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( 'testimonials_widget_cache_get', array( $this, 'cache_get' ) ); | |
add_filter( 'testimonials_widget_cache_set', array( $this, 'cache_set' ), 10, 2 ); | |
public static function cache_get( $args ) { | |
$hash = self::create_hash( $args ); | |
$do_cache = apply_filters( 'testimonials_widget_disable_cache', true ); | |
$no_cache = isset( $args['no_cache'] ) && Testimonials_Widget_Settings::is_true( $args['no_cache'] ); | |
if ( ! $do_cache || $no_cache ) { | |
delete_transient( $hash ); | |
return false; | |
} |