Colors removing Kirki

This commit is contained in:
LebCit
2019-07-23 14:10:12 +03:00
parent 2813c71f6d
commit 456dd07322
275 changed files with 779 additions and 61435 deletions
+142 -158
View File
@@ -58,19 +58,30 @@ class Full_Screen_Morphing_Search {
// Require WordPress jQuery.
wp_enqueue_script( 'jquery' );
// Require jquery-ui-core and jquery-ui-autocomplete for autoco;pletition search !
// Require jquery-ui-core and jquery-ui-autocomplete for autocompletition search !
wp_enqueue_script( 'jquery-ui-core' );
wp_enqueue_script( 'jquery-ui-autocomplete' );
// Load Javascript.
wp_enqueue_script( $this->plugin->name, $this->plugin->url . 'assets/js/full-screen-morphing-search.js', array( 'jquery' ), '1.0', true );
// Associative Array 'fsmsp_options'.
$fsmsp_options = get_option( 'fsmsp_options' );
// Declare PHP Variables to be passed to JS.
$fsmsp_options_does_not_exists = ( null === get_option( 'fsmsp_options', null ) ) ? true : false;
$fsmsp_main_backgroung_color = $fsmsp_options['fsmsp_main_backgroung_color'];
// Localize full-screen-morphing-search.js !
wp_localize_script(
$this->plugin->name,
'fsmsp_vars',
array(
'fsmsp_is_customize_preview' => is_customize_preview(),
'fsmsp_is_customize_preview' => is_customize_preview(),
'fsmsp_options_does_not_exists' => $fsmsp_options_does_not_exists,
'fsmsp_main_backgroung_color' => $fsmsp_main_backgroung_color,
)
);
}
/**
@@ -83,177 +94,148 @@ class Full_Screen_Morphing_Search {
public function full_screen_morphing_search_output_morphing_search() {
$fsmsp_options = get_option( 'fsmsp_options' ); // Associative Array 'fsmsp_options'.
/**
* Setting the placeholder as a variable to output the option depending on the case.
*
* For "Notice: Undefined index" : @see https://stackoverflow.com/a/4261200
*/
$fsmsp_placeholder = isset( $fsmsp_options['fsmsp_search_form_text'] ) ? $fsmsp_options['fsmsp_search_form_text'] : ''; // Selecting the key to get the value.
if ( ! empty( $fsmsp_placeholder ) ) {
$fsmsp_placeholder = esc_attr( $fsmsp_placeholder );
} else {
$fsmsp_placeholder = esc_attr_x( 'Search …', 'placeholder', 'full-screen-morphing-search' );
}
?>
<div id="morphsearch" class="morphsearch">
<span class="morphsearch-close"></span>
<form role="search" class="morphsearch-form" method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<input required type="search" class="morphsearch-input" name="s"
placeholder="<?php echo esc_attr( $fsmsp_placeholder ); ?>"
value="" />
<button class="morphsearch-submit" type="submit">
<?php
$response = wp_remote_get( 'https://plugins.svn.wordpress.org/full-screen-morphing-search/trunk/assets/img/magnifier.svg' );
if ( is_array( $response ) ) {
echo wp_kses( $response['body'], 'full_screen_morphing_search_add_svg_tags' ); // use the content.
}
?>
</button>
</form>
<div class="morphsearch-content">
<div class="dummy-column">
<h2 class="fsmsp-rp">Recent Posts</h2>
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => '5',
'ignore_sticky_posts' => 1,
);
$fsmsprp = new WP_Query( $args );
while ( $fsmsprp->have_posts() ) :
$fsmsprp->the_post();
?>
<div class="dummy-media-object">
<div id="morphsearch" class="morphsearch">
<span class="morphsearch-close" style="--morphsearch-close-background: <?php fsmsp_close_icon_color(); ?>">
</span><!-- Modifiying the CSS Variable --morphsearch-close-background on the style attribute -->
<form role="search" class="morphsearch-form" method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<input required type="search" class="morphsearch-input" name="s"
placeholder="<?php echo esc_attr_x( 'Search...', 'placeholder' ); ?>"
style=
"
--morphsearch-input-placeholder: <?php fsmsp_search_text_color(); ?>
;
color: <?php fsmsp_input_text_color(); ?>
"
value=""/>
<button id="morphsearch-submit" class="morphsearch-submit" type="submit">
<?php fsmsp_svg_color(); // CN: Using "inline" SVG. ?>
</button>
</form>
<div class="morphsearch-content">
<div class="dummy-column">
<h2 style="color: <?php fsmsp_headings_color(); ?>">Recent Posts</h2>
<?php
if ( has_post_thumbnail() ) {
$args = array(
'post_type' => 'post',
'posts_per_page' => '5',
'ignore_sticky_posts' => 1,
);
$msprp = new WP_Query( $args );
while ( $msprp->have_posts() ) :
$msprp->the_post();
?>
<a href="<?php echo the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php
} else {
?>
<a href="<?php echo the_permalink(); ?>" class="fsmsp-article-link" title="<?php the_title_attribute(); ?>">
<div class="dummy-media-object" style="background: <?php fsmsp_columns_background_color(); ?>"
onmouseover="this.style.background = '<?php fsmsp_columns_hover_background_color(); ?>';"
onmouseout="this.style.background = '<?php fsmsp_columns_background_color(); ?>';">
<a href="<?php echo the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php echo the_post_thumbnail( 'msp-thumb', array( 'class' => 'round' ) ); ?>
</a>
<h3>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" style="color: <?php fsmsp_links_color(); ?>"
onmouseover="this.style.color = '<?php fsmsp_links_hover_color(); ?>';"
onmouseout="this.style.color = '<?php fsmsp_links_color(); ?>';">
<?php the_title(); ?>
</a>
</h3>
</div>
<?php
endwhile;
wp_reset_postdata();
?>
</div>
<div class="dummy-column">
<h2 style="color: <?php fsmsp_headings_color(); ?>">Top Categories</h2>
<?php
$cats = get_categories();
if ( empty( $cats ) ) {
return;
}
if ( has_post_thumbnail() ) {
echo the_post_thumbnail( 'full-screen-morphing-search-plugin-thumb', array( 'class' => 'round' ) );
} else {
if ( empty( $fsmsp_options['fsmsp_article_icon'] ) ) {
echo '<img src="' . esc_url( plugins_url( 'assets/img/article.png', __FILE__ ) ) . '" >';
} else {
full_screen_morphing_search_article_icon();
$tc_counts = array();
$cat_links = array();
foreach ( (array) $cats as $cat ) {
$tc_counts[ $cat->name ] = $cat->count;
$cat_links[ $cat->name ] = get_category_link( $cat->term_id );
}
asort( $tc_counts );
$tc_counts = array_reverse( $tc_counts, true );
$i = 0;
foreach ( $tc_counts as $cat => $tc_count ) {
$i++;
$cat_link = esc_url( $cat_links[ $cat ] );
$cat = str_replace( ' ', '&nbsp;', esc_html( $cat ) );
if ( $i < 6 ) {
?>
<div class="dummy-media-object" style="background: <?php fsmsp_columns_background_color(); ?>"
onmouseover="this.style.background = '<?php fsmsp_columns_hover_background_color(); ?>';"
onmouseout="this.style.background = '<?php fsmsp_columns_background_color(); ?>';">
<?php
echo '<img src="' . esc_url( plugins_url( 'assets/img/category.png', __FILE__ ) ) . '" > ';
print '<h3><a href=' . esc_url( $cat_link ) . ' style="color:';
echo esc_attr( fsmsp_links_color() ) . '"
>' . esc_html( $cat . ' (' . $tc_count . ')' ) . '</a></h3>';
?>
</div>
<?php
}
}
?>
</a>
<h3><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
</div>
<div class="dummy-column">
<h2 style="color: <?php fsmsp_headings_color(); ?>">Top Tags</h2>
<?php
endwhile;
wp_reset_postdata();
?>
</div>
<div class="dummy-column">
<h2 class="fsmsp-tc">Top Categories</h2>
<?php
$fsmspcats = get_categories();
if ( empty( $fsmspcats ) ) {
return;
}
$fsmsptc_counts = array();
$fsmspcat_links = array();
foreach ( (array) $fsmspcats as $fsmspcat ) {
$fsmsptc_counts[ $fsmspcat->name ] = $fsmspcat->count;
$fsmspcat_links[ $fsmspcat->name ] = get_category_link( $fsmspcat->term_id );
}
asort( $fsmsptc_counts );
$fsmsptc_counts = array_reverse( $fsmsptc_counts, true );
$i = 0;
foreach ( $fsmsptc_counts as $fsmspcat => $fsmsptc_count ) {
$i++;
$fsmspcat_link = esc_url( $fsmspcat_links[ $fsmspcat ] );
$fsmspcat = str_replace( ' ', '&nbsp;', esc_html( $fsmspcat ) );
if ( $i < 6 ) {
?>
<div class="dummy-media-object fsmsp-tc-child">
<span class="fsmsp-category-image">
<?php
if ( empty( $fsmsp_options['fsmsp_category_icon'] ) ) {
echo '<img src="' . esc_url( plugins_url( 'assets/img/category.png', __FILE__ ) ) . '" >';
} else {
full_screen_morphing_search_category_icon();
}
?>
</span>
<?php
print "<h3><a href='" . esc_url( $fsmspcat_link ) . "'>" . esc_html( $fsmspcat . ' (' . $fsmsptc_count . ')' ) . '</a></h3>';
?>
</div>
<?php
$tags = get_tags();
if ( empty( $tags ) ) {
return;
}
}
?>
</div>
<div class="dummy-column">
<h2 class="fsmsp-tt">Top Tags</h2>
<?php
$fsmsptags = get_tags();
if ( empty( $fsmsptags ) ) {
return;
}
$fsmsptt_counts = array();
$fsmsptag_links = array();
foreach ( (array) $fsmsptags as $fsmsptag ) {
$fsmsptt_counts[ $fsmsptag->name ] = $fsmsptag->count;
$fsmsptag_links[ $fsmsptag->name ] = get_tag_link( $fsmsptag->term_id );
}
asort( $fsmsptt_counts );
$fsmsptt_counts = array_reverse( $fsmsptt_counts, true );
$i = 0;
foreach ( $fsmsptt_counts as $fsmsptag => $fsmsptt_count ) {
$i++;
$tag_link = esc_url( $fsmsptag_links[ $fsmsptag ] );
$fsmsptag = str_replace( ' ', '&nbsp;', esc_html( $fsmsptag ) );
if ( $i < 6 ) {
?>
<div class="dummy-media-object fsmsp-tt-child">
<span class="fsmsp-tag-image">
<?php
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- strict comparison not working !
if ( empty( $fsmsp_options['fsmsp_tag_icon'] ) ) {
$tt_counts = array();
$tag_links = array();
foreach ( (array) $tags as $tag ) {
$tt_counts[ $tag->name ] = $tag->count;
$tag_links[ $tag->name ] = get_tag_link( $tag->term_id );
}
asort( $tt_counts );
$tt_counts = array_reverse( $tt_counts, true );
$i = 0;
foreach ( $tt_counts as $tag => $tt_count ) {
$i++;
$tag_link = esc_url( $tag_links[ $tag ] );
$tag = str_replace( ' ', '&nbsp;', esc_html( $tag ) );
if ( $i < 6 ) {
?>
<div class="dummy-media-object" style="background: <?php fsmsp_columns_background_color(); ?>"
onmouseover="this.style.background = '<?php fsmsp_columns_hover_background_color(); ?>';"
onmouseout="this.style.background = '<?php fsmsp_columns_background_color(); ?>';">
<?php
echo '<img src="' . esc_url( plugins_url( 'assets/img/tag.png', __FILE__ ) ) . '" >';
} else {
full_screen_morphing_search_tag_icon();
}
?>
</span>
print "<h3><a href='" . esc_url( $tag_link ) . "'>" . esc_html( $tag . ' (' . $tt_count . ')' ) . '</a></h3>';
?>
</div>
<?php
print "<h3><a href='" . esc_url( $tag_link ) . "'>" . esc_html( $fsmsptag . ' (' . $fsmsptt_count . ')' ) . '</a></h3>';
?>
</div>
<?php
}
}
}
?>
?>
</div>
</div><!-- .morphsearch-content -->
</div><!-- #morphsearch.morphsearch -->
</div>
</div><!-- .morphsearch-content -->
</div><!-- #morphsearch.morphsearch -->
<?php
$fsmsp_ac = array( // Autocomplete.
'post_type' => array( 'post', 'page' ),
'post_status' => 'publish',
'posts_per_page' => -1, // all posts and pages.
);
$posts = get_posts( $fsmsp_ac );
$fsmsac = array( // Autocomplete.
'post_type' => array( 'post', 'page' ),
'post_status' => 'publish',
'posts_per_page' => -1, // all posts and pages.
);
$posts = get_posts( $fsmsac );
if ( $posts ) :
foreach ( $posts as $k => $post ) {
$source[ $k ]['ID'] = $post->ID;
$source[ $k ]['label'] = $post->post_title; // The name of the post.
$source[ $k ]['permalink'] = get_permalink( $post->ID );
$source[ $k ]['ID'] = $post->ID;
$source[ $k ]['label'] = $post->post_title; // The name of the post.
$source[ $k ]['permalink'] = get_permalink( $post->ID );
}
?>
@@ -261,17 +243,19 @@ class Full_Screen_Morphing_Search {
jQuery(document).ready(function($){
var posts = <?php echo wp_json_encode( array_values( $source ) ); ?>;
jQuery( 'input[name="s"]' ).autocomplete({
source: posts,
minLength: 2,
select: function(event, ui) {
var permalink = ui.item.permalink; // Get permalink from the datasource
window.location.replace(permalink);
source: posts,
minLength: 2,
select: function(event, ui) {
var permalink = ui.item.permalink; // Get permalink from the datasource.
window.location.replace(permalink);
}
});
});
</script>
<?php
endif;
endif;
}
}
$full_screen_morphing_search = new Full_Screen_Morphing_Search();