Fixed theme sniffer to Wordpress Core

This commit is contained in:
Fabiano 2018-10-05 11:16:00 -03:00
parent 2b2bb08390
commit 4550ec8701
11 changed files with 52 additions and 55 deletions

View File

@ -9,33 +9,32 @@
};
if (settings) {
$.extend(config, settings);
$.extend( config, settings );
}
var minimized_elements = $(this);
minimized_elements.each(function(){
var t = $(this).text();
if(t.length < config.minChars) return;
$(this).html(
t.slice(0,config.showChars)+'<span>'+ config.ellipsesText +' </span><a href="#" class="tainacan-interface-more">[ '+ config.moreText +' ]</a>'+
'<span style="display:none;">'+ t.slice(config.showChars,t.length)+' <a href="#" class="tainacan-interface-less">[ '+ config.lessText +' ]</a></span>'
var minimized_elements = $( this );
minimized_elements.each(function(){
var t = $( this ).text();
if (t.length < config.minChars) { return };
$( this ).html(
t.slice( 0,config.showChars ) + '<span>' + config.ellipsesText + ' </span><a href="#" class="tainacan-interface-more">[ ' + config.moreText + ' ]</a>' + '<span style="display:none;">' + t.slice( config.showChars,t.length ) + ' <a href="#" class="tainacan-interface-less">[ ' + config.lessText + ' ]</a></span>'
);
});
$('a.tainacan-interface-more', minimized_elements).click(function(event){
event.preventDefault();
minimized_elements.addClass('full-story');
$(this).hide().prev().hide();
$(this).next().show();
});
$('a.tainacan-interface-less', minimized_elements).click(function(event){
$( 'a.tainacan-interface-more', minimized_elements ).click(function(event){
event.preventDefault();
minimized_elements.removeClass('full-story');
$(this).parent().hide().prev().show().prev().show();
minimized_elements.addClass( 'full-story' );
$( this ).hide().prev().hide();
$( this ).next().show();
});
$( 'a.tainacan-interface-less', minimized_elements ).click(function(event){
event.preventDefault();
minimized_elements.removeClass( 'full-story' );
$( this ).parent().hide().prev().show().prev().show();
});
return minimized_elements;
};

View File

@ -20,12 +20,12 @@
echo '</p><p>';
}
if ( get_option( 'tainacan_blogaddress' ) ) {
echo wp_filter_nohtml_kses(get_option( 'tainacan_blogaddress', '' ));
echo wp_filter_nohtml_kses( get_option( 'tainacan_blogaddress', '' ) );
} ?>
</p>
<p class="tainacan-footer-info--blog">
<?php if ( get_option( 'tainacan_blogemail' ) ) {
printf( __( 'E-mail: %s', 'tainacan-interface' ), sanitize_email(get_option( 'tainacan_blogemail', '' )) );
printf( __( 'E-mail: %s', 'tainacan-interface' ), sanitize_email( get_option( 'tainacan_blogemail', '' ) ) );
}
if ( get_option( 'tainacan_blogemail' ) && get_option( 'tainacan_blogphone' ) ) {
if ( wp_is_mobile() ) :
@ -35,12 +35,12 @@ if ( get_option( 'tainacan_blogemail' ) && get_option( 'tainacan_blogphone' ) )
endif;
}
if ( get_option( 'tainacan_blogphone' ) ) {
printf( __( 'Telephone: %s', 'tainacan-interface' ), wp_filter_nohtml_kses(get_option( 'tainacan_blogphone', '' )) );
printf( __( 'Telephone: %s', 'tainacan-interface' ), wp_filter_nohtml_kses( get_option( 'tainacan_blogphone', '' ) ) );
} ?>
</p>
</div>
<div class="col-auto pr-0 pr-md-3 d-none d-md-block align-self-md-top">
<img src="<?php if ( get_theme_mod( 'tainacan_footer_logo' ) ) { echo esc_attr(get_theme_mod( 'tainacan_footer_logo' )); } ?>" class="tainacan-footer-info--logo" alt="">
<img src="<?php if ( get_theme_mod( 'tainacan_footer_logo' ) ) { echo esc_attr( get_theme_mod( 'tainacan_footer_logo' ) ); } ?>" class="tainacan-footer-info--logo" alt="">
</div>
<div class="col-12 tainacan-powered">
<span>

View File

@ -125,11 +125,11 @@ add_action( 'widgets_init', 'tainacan_widgets_footer_init' );
function tainacan_get_logo() {
if ( has_custom_logo() ) {
return get_custom_logo();
} else {
$html = '<a class="navbar-brand tainacan-logo" href="' . esc_url( home_url() ) . '">';
$html .= '<h1>'. get_bloginfo( 'name' ) .'</h1>';
$html .= '</a>';
return $html;
} else {
$html = '<a class="navbar-brand tainacan-logo" href="' . esc_url( home_url() ) . '">';
$html .= '<h1>' . get_bloginfo( 'name' ) . '</h1>';
$html .= '</a>';
return $html;
}
}

View File

@ -21,13 +21,13 @@ class TainacanThemeCollectionColor {
wp_enqueue_script( 'tainacan_colorWell', get_template_directory_uri() . '/functions/collection-color.js', false, false, true );
wp_enqueue_style( 'tainacan_colorWellStyle', get_template_directory_uri() . '/functions/collection-color.css' );
wp_localize_script( 'tainacan_colorWell', 'tainacan_colorPickerVars', array(
'cancelText' => __("cancel", 'tainacan-interface'),
'chooseText' => __("choose", 'tainacan-interface'),
'togglePaletteMoreText' => __("more", 'tainacan-interface'),
'togglePaletteLessText' => __("less", 'tainacan-interface'),
'clearText' => __("Clear Color Selection", 'tainacan-interface'),
'noColorSelectedText' => __("No Color Selected", 'tainacan-interface'),
) );
'cancelText' => __( 'cancel', 'tainacan-interface' ),
'chooseText' => __( 'choose', 'tainacan-interface' ),
'togglePaletteMoreText' => __( 'more', 'tainacan-interface' ),
'togglePaletteLessText' => __( 'less', 'tainacan-interface' ),
'clearText' => __( 'Clear Color Selection', 'tainacan-interface' ),
'noColorSelectedText' => __( 'No Color Selected', 'tainacan-interface' ),
));
wp_enqueue_script( 'tainacan_Spectrum', get_template_directory_uri() . '/assets/js/spectrum.js', false, false, true );
wp_enqueue_style( 'tainacan_Spectrum', get_template_directory_uri() . '/assets/js/spectrum.css' );

View File

@ -36,8 +36,8 @@ if ( ! function_exists( 'tainacan_enqueues' ) ) {
/**
* Google
*/
// Google fonts Roboto
wp_enqueue_style( 'tainacan_RobotoFonts', 'https://fonts.googleapis.com/css?family=Roboto:100,100i,300,300i,400,400i,500,500i,700,700i,900,900i' );
// Google fonts Roboto
wp_enqueue_style( 'tainacan_RobotoFonts', 'https://fonts.googleapis.com/css?family=Roboto:100,100i,300,300i,400,400i,500,500i,700,700i,900,900i' );
// Material Icons
wp_register_style( 'tainacan_MaterialIconsFonts', get_template_directory_uri() . '/assets/fonts/material-design-icons/css/materialdesignicons.min.css', '', '2.4.85', '' );
wp_enqueue_style( 'tainacan_MaterialIconsFonts' );
@ -47,8 +47,8 @@ if ( ! function_exists( 'tainacan_enqueues' ) ) {
*/
wp_enqueue_script( 'tainacan_tainacanTruncate', get_template_directory_uri() . '/assets/js/tainacan-interface-truncate.js', array( 'jquery' ), '1.0', false );
wp_localize_script( 'tainacan_tainacanTruncate', 'tainacan_trucanteVars', array(
"moreText" => __('More', 'tainacan-interface'),
"lessText" => __('Less', 'tainacan-interface')
'moreText' => __( 'More', 'tainacan-interface' ),
'lessText' => __( 'Less', 'tainacan-interface' ),
));
wp_register_style( 'tainacan_tainacanStyle', get_stylesheet_uri(), array( 'tainacan_bootstrap4CSS' ) );

View File

@ -24,11 +24,11 @@ function tainacan_comments_callback( $comment, $args, $depth ) {
</a>
<p class="comment-time text-oslo-gray my-sm-1">
<?php
printf(
printf(
/* translators: 1: Comment date, 2: comment time. Example: April 21st at 15:25*/
__('%1$s at %2$s.', 'tainacan-interface'),
get_comment_date(),
get_comment_time()
__( '%1$s at %2$s.', 'tainacan-interface' ),
get_comment_date(),
get_comment_time()
);
?>
</p>
@ -137,9 +137,7 @@ function tainacan_social_meta() {
<meta property="og:image:height" content="<?php echo $image['height']; ?>"/>
<?php } else {
return;
} // End if().
<?php } else { return; } // End if().
}
add_action( 'wp_head', 'tainacan_social_meta', 5 );

View File

@ -7,4 +7,4 @@
</button>
</span>
</div>
</form>
</form>

View File

@ -119,7 +119,7 @@
<?php if ( true == get_theme_mod( 'tainacan_twitter_share', true ) ) : ?>
<?php
$twitter_option = get_option( 'tainacan_twitter_user' );
$via = ! empty( $twitter_option ) ? '&amp;via=' . esc_attr(get_option( 'tainacan_twitter_user' )) : '';
$via = ! empty( $twitter_option ) ? '&amp;via=' . esc_attr( get_option( 'tainacan_twitter_user' ) ) : '';
?>
<a href="http://twitter.com/share?url=<?php the_permalink(); ?>&amp;text=<?php the_title_attribute(); ?><?php echo $via; ?>" target="_blank" class="item-card-link--sharing">
<img src="<?php echo get_template_directory_uri() . '/assets/images/twitter-circle.png'; ?>" alt="">

View File

@ -24,7 +24,7 @@
<?php endif; ?>
<?php if ( true == get_theme_mod( 'tainacan_twitter_share', true ) && get_option( 'tainacan_twitter_user' ) ) : ?>
<div class="rotater">
<a href="http://twitter.com/share?url=<?php echo home_url( $wp->request ); ?>&amp;text=<?php the_title_attribute(); ?>&amp;via=<?php echo esc_attr(get_option( 'tainacan_twitter_user', '' )); ?>" target="_blank">
<a href="http://twitter.com/share?url=<?php echo home_url( $wp->request ); ?>&amp;text=<?php the_title_attribute(); ?>&amp;via=<?php echo esc_attr( get_option( 'tainacan_twitter_user', '' ) ); ?>" target="_blank">
<div class="btn btn-icon">
<i class="mdi mdi-twitter"></i>
</div>

View File

@ -70,7 +70,7 @@ echo '</style>';
<?php endif; ?>
<?php if ( true == get_theme_mod( 'tainacan_twitter_share', true ) && get_option( 'tainacan_twitter_user' ) ) : ?>
<div class="rotater">
<a href="http://twitter.com/share?url=<?php echo home_url( $wp->request ); ?>&amp;text=<?php the_title_attribute(); ?>&amp;via=<?php echo esc_attr(get_option( 'tainacan_twitter_user', '' )); ?>" target="_blank">
<a href="http://twitter.com/share?url=<?php echo home_url( $wp->request ); ?>&amp;text=<?php the_title_attribute(); ?>&amp;via=<?php echo esc_attr( get_option( 'tainacan_twitter_user', '' ) ); ?>" target="_blank">
<div class="btn btn-icon">
<i class="mdi mdi-twitter"></i>
</div>
@ -102,4 +102,4 @@ echo '</style>';
<?php do_action( 'tainacan-interface-collection-header-bottom' ); ?>
</div>
</div>
</div>
</div>

View File

@ -12,7 +12,7 @@
<?php endif; ?>
<?php if ( true == get_theme_mod( 'tainacan_twitter_share', true ) ) : ?>
<?php $twitter_option = get_option( 'tainacan_twitter_user' ); ?>
<?php $via = ! empty( $twitter_option ) ? '&amp;via=' . esc_attr(get_option( 'tainacan_twitter_user' )) : ''; ?>
<?php $via = ! empty( $twitter_option ) ? '&amp;via=' . esc_attr( get_option( 'tainacan_twitter_user' ) ) : ''; ?>
<a href="http://twitter.com/share?url=<?php the_permalink(); ?>&amp;text=<?php the_title_attribute(); ?><?php echo $via; ?>" target="_blank" class="">
<img src="<?php echo get_template_directory_uri() . '/assets/images/twitter-circle.png'; ?>" alt="">
</a>