Initial commit
11
404.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php get_header(); ?>
|
||||
|
||||
<div class="page-col-center">
|
||||
|
||||
<?php get_template_part('inc/page-title'); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php get_sidebar(); ?>
|
||||
|
||||
<?php get_footer(); ?>
|
23
archive.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php get_header(); ?>
|
||||
|
||||
<div class="page-col-center">
|
||||
|
||||
<?php get_template_part('inc/page-title'); ?>
|
||||
|
||||
<?php if ( have_posts() ) : ?>
|
||||
|
||||
<div class="page-grid-center">
|
||||
<?php while ( have_posts() ): the_post(); ?>
|
||||
<?php get_template_part('content'); ?>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php get_template_part('inc/pagination'); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php get_sidebar(); ?>
|
||||
|
||||
<?php get_footer(); ?>
|
111
comments.php
Normal file
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
if ( post_password_required() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $comments ) {
|
||||
?>
|
||||
|
||||
<div class="comments" id="comments">
|
||||
|
||||
<?php
|
||||
$comments_number = get_comments_number();
|
||||
?>
|
||||
|
||||
<div class="comments-header">
|
||||
|
||||
<h2 class="comment-reply-title">
|
||||
<?php
|
||||
if ( ! have_comments() ) {
|
||||
_e( 'Leave a comment', 'dashwall' );
|
||||
} elseif ( '1' === $comments_number ) {
|
||||
/* translators: %s: Post title. */
|
||||
printf( _x( 'One reply on “%s”', 'comments title', 'dashwall' ), get_the_title() );
|
||||
} else {
|
||||
printf(
|
||||
/* translators: 1: Number of comments, 2: Post title. */
|
||||
_nx(
|
||||
'%1$s reply on “%2$s”',
|
||||
'%1$s replies on “%2$s”',
|
||||
$comments_number,
|
||||
'comments title',
|
||||
'dashwall'
|
||||
),
|
||||
number_format_i18n( $comments_number ),
|
||||
get_the_title()
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
</h2><!--/.comment-reply-title-->
|
||||
|
||||
</div><!--/.comments-header-->
|
||||
|
||||
<div class="commentlist">
|
||||
|
||||
<?php
|
||||
wp_list_comments(
|
||||
array(
|
||||
'avatar_size' => 64,
|
||||
)
|
||||
);
|
||||
|
||||
$comment_pagination = paginate_comments_links(
|
||||
array(
|
||||
'echo' => false,
|
||||
'end_size' => 0,
|
||||
'mid_size' => 0,
|
||||
'next_text' => __( 'Newer Comments', 'dashwall' ) . ' <span aria-hidden="true">→</span>',
|
||||
'prev_text' => '<span aria-hidden="true">←</span> ' . __( 'Older Comments', 'dashwall' ),
|
||||
)
|
||||
);
|
||||
|
||||
if ( $comment_pagination ) {
|
||||
$pagination_classes = '';
|
||||
|
||||
// If we're only showing the "Next" link, add a class indicating so.
|
||||
if ( false === strpos( $comment_pagination, 'prev page-numbers' ) ) {
|
||||
$pagination_classes = ' only-next';
|
||||
}
|
||||
// If we're only showing the "Prev" link, add a class indicating so.
|
||||
if ( false === strpos( $comment_pagination, 'next page-numbers' ) ) {
|
||||
$pagination_classes = ' only-prev';
|
||||
}
|
||||
?>
|
||||
|
||||
<nav class="comments-nav group<?php echo $pagination_classes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static output ?>" aria-label="<?php esc_attr_e( 'Comments', 'dashwall' ); ?>">
|
||||
<?php echo wp_kses_post( $comment_pagination ); ?>
|
||||
</nav>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</div><!--/.commentlist-->
|
||||
|
||||
</div><!--/.comments-->
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
if ( comments_open() || pings_open() ) {
|
||||
|
||||
comment_form(
|
||||
array(
|
||||
'title_reply_before' => '<h2 id="reply-title" class="comment-reply-title">',
|
||||
'title_reply_after' => '</h2>',
|
||||
)
|
||||
);
|
||||
|
||||
} elseif ( is_single() ) {
|
||||
|
||||
?>
|
||||
|
||||
<div class="comment-respond" id="respond">
|
||||
|
||||
<p class="comments-closed"><?php _e( 'Comments are closed.', 'dashwall' ); ?></p>
|
||||
|
||||
</div><!--/#respond-->
|
||||
|
||||
<?php
|
||||
}
|
30
content-featured.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<div class="featured-card">
|
||||
|
||||
<?php if ( comments_open() && ( get_theme_mod( 'comment-count', 'on' ) =='on' ) ): ?>
|
||||
<?php $number = get_comments_number( $post->ID ); if ( $number > 0 ) { ?>
|
||||
<a class="comments-bubble" href="<?php comments_link(); ?>"><i class="fas fa-comment"></i><span><?php comments_number( '0', '1', '%' ); ?></span></a>
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="featured-card-thumb" style="background-image:url('<?php the_post_thumbnail_url('dashwall-large'); ?>');"></div>
|
||||
|
||||
<div class="featured-card-container">
|
||||
|
||||
<div class="featured-card-content">
|
||||
|
||||
<div class="featured-card-category"><?php esc_html_e('in','dashwall'); ?> <?php the_category(' / '); ?></div>
|
||||
|
||||
<h2 class="featured-large-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
|
||||
|
||||
<div class="featured-card-meta">
|
||||
<a href="<?php echo get_author_posts_url(get_the_author_meta( 'ID' )); ?>" class="featured-card-avatar"><?php echo get_avatar(get_the_author_meta('user_email'),'36'); ?></a>
|
||||
<a href="<?php echo get_author_posts_url(get_the_author_meta( 'ID' )); ?>" class="featured-card-author"><span><?php esc_html_e('by','dashwall'); ?></span> <?php the_author(); ?></a>
|
||||
<span class="featured-card-divider">·</span>
|
||||
<span class="feautred-card-date"><?php the_time( get_option('date_format') ); ?></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
27
content-highlights.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<a class="highlights-card" href="<?php the_permalink(); ?>">
|
||||
<div class="highlights-card-inner group">
|
||||
|
||||
<div class="highlights-card-left">
|
||||
|
||||
<div class="highlights-card-thumb">
|
||||
<?php if ( has_post_thumbnail() ): ?>
|
||||
<?php the_post_thumbnail('dashwall-small'); ?>
|
||||
<?php else: ?>
|
||||
<i class="fas fa-image"></i>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="highlights-card-right">
|
||||
|
||||
<h3 class="highlights-card-title">
|
||||
<?php the_title(); ?>
|
||||
</h3>
|
||||
|
||||
<div class="highlights-card-date"><?php the_time( get_option('date_format') ); ?></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</a>
|
48
content.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<article id="post-<?php the_ID(); ?>" <?php post_class('page-card blog-card'); ?>>
|
||||
|
||||
<div class="blog-card-inner">
|
||||
|
||||
<div class="blog-card-top">
|
||||
|
||||
<a href="<?php the_permalink(); ?>" class="blog-card-thumb" style="background-image:url('<?php the_post_thumbnail_url('dashwall-medium'); ?>');">
|
||||
|
||||
<?php if ( has_post_thumbnail() ): ?>
|
||||
|
||||
<?php else: ?>
|
||||
<i class="fas fa-image"></i>
|
||||
<?php endif; ?>
|
||||
|
||||
</a>
|
||||
|
||||
<?php if ( comments_open() && ( get_theme_mod( 'comment-count', 'on' ) =='on' ) ): ?>
|
||||
<?php $number = get_comments_number( $post->ID ); if ( $number > 0 ) { ?>
|
||||
<a class="comments-bubble" href="<?php comments_link(); ?>"><i class="fas fa-comment"></i><span><?php comments_number( '0', '1', '%' ); ?></span></a>
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( get_theme_mod( 'more-link', 'on' ) =='on' ): ?>
|
||||
<a class="more-link-custom" href="<?php the_permalink(); ?>"><i class="fas fa-arrow-right"></i></a>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
<div class="blog-card-bottom">
|
||||
|
||||
<div class="blog-card-category"><?php the_category(' / '); ?></div>
|
||||
|
||||
<h2 class="blog-card-title">
|
||||
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
|
||||
</h2>
|
||||
|
||||
<?php if (get_theme_mod('excerpt-length','20') != '0'): ?>
|
||||
<div class="blog-card-excerpt">
|
||||
<?php the_excerpt(); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="blog-card-date"><?php the_time( get_option('date_format') ); ?></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</article>
|
201
dark.css
Normal file
|
@ -0,0 +1,201 @@
|
|||
body:where(.dark),
|
||||
body:where(.dark) .page-header,
|
||||
body:where(.dark) .canvas-bottom { background: #313642; }
|
||||
|
||||
body:where(.dark) .site-title a { color: #fff; }
|
||||
body:where(.dark) .site-description { color: #9ba4b3; }
|
||||
|
||||
body:where(.dark) a { color: #fff; }
|
||||
body:where(.dark) .canvas-inner { background: #212632; }
|
||||
body:where(.dark) .page-card,
|
||||
body:where(.dark) .widget,
|
||||
body:where(.dark) .pagination ul li a { background: #313642; box-shadow: none; }
|
||||
body:where(.dark) .page-card:after,
|
||||
body:where(.dark) .widget:after { background: #3b404d; }
|
||||
|
||||
body:where(.dark) .page-card-highlights,
|
||||
body:where(.dark) .page-card-post-nav { background: #fff; }
|
||||
|
||||
body:where(.dark) .page-sidebar { box-shadow: inset -1px 0 0 rgba(255,255,255,0.1); }
|
||||
body:where(.dark) .page-sidebar .social-links .social-tooltip,
|
||||
body:where(.dark) .sharrre-header .sharrre .box { background: #313642; color: #fff; }
|
||||
body:where(.dark) .page-sidebar .social-links .social-tooltip:hover { color: #fff; }
|
||||
body:where(.dark) .page-sidebar .social-links .social-tooltip:hover:after { background: #fff; color: #212632; }
|
||||
body:where(.dark) .page-sidebar .social-links .social-tooltip:hover:before { border-color: transparent #fff; }
|
||||
|
||||
body:where(.dark) .stickywrap .stickywrap-heading,
|
||||
body:where(.dark) .widget > h3,
|
||||
body:where(.dark) .widget .wp-block-heading { color: #fff; }
|
||||
|
||||
body:where(.dark) .blog-card-thumb { background-color: #212632; }
|
||||
body:where(.dark) .featured-card-thumb,
|
||||
body:where(.dark) .header-single-thumb { background-color: #313642; }
|
||||
|
||||
body:where(.dark) .header-single:before { background: #fff; }
|
||||
|
||||
@media only screen and (max-width: 1340px) {
|
||||
body:where(.dark) .header-single-title { color: #212632; text-shadow: none; }
|
||||
body:where(.dark) .header-single-category a,
|
||||
body:where(.dark) .header-single-content,
|
||||
body:where(.dark) .header-single-meta a { color: #9ba4b3; }
|
||||
}
|
||||
|
||||
body:where(.dark) .blog-card-thumb i { color: #3b404d; }
|
||||
|
||||
body:where(.dark) .comments-bubble i { color: #3b404d; }
|
||||
body:where(.dark) .comments-bubble span { color: #fff; }
|
||||
|
||||
body:where(.dark) .page-card-highlights .stickywrap-heading { color: #212632; }
|
||||
body:where(.dark) .highlights-card { color: #9ba4b3; border-top: 1px solid #fff; }
|
||||
body:where(.dark) .highlights-card:hover { background: #fff; color: #313642; }
|
||||
body:where(.dark) .highlights-card-title { color: #212632; }
|
||||
body:where(.dark) .highlights-card-thumb { background: #fff; }
|
||||
|
||||
body:where(.dark) .themeform.searchform div input:not([type="submit"]):not([type="checkbox"]) { background: #313642; color: #9ba4b3; outline: 1px solid rgba(255,255,255,0.1); }
|
||||
body:where(.dark) .themeform.searchform div:after { color: #9ba4b3; }
|
||||
body:where(.dark) .themeform.searchform div textarea:focus,
|
||||
body:where(.dark) .themeform.searchform div input:not([type="submit"]):focus { outline: 1px solid rgba(255,255,255,0.2); color: #9ba4b3; }
|
||||
|
||||
body:where(.dark) .page-card-post-nav .stickywrap-heading { color: #212632; }
|
||||
body:where(.dark) .post-nav li a { background: #fff; color: #212632; }
|
||||
body:where(.dark) .post-nav li a:hover { background: #fff; }
|
||||
body:where(.dark) .post-nav li a strong { color: #9ba4b3; }
|
||||
|
||||
body:where(.dark) .entry { color: #d0d6df; }
|
||||
|
||||
body:where(.dark) .author-bio { background: #3b404d; box-shadow: none; }
|
||||
body:where(.dark) .author-bio .bio-avatar:after { background: #fff; color: #212632; }
|
||||
body:where(.dark) .author-bio .bio-name { color: #fff; }
|
||||
|
||||
body:where(.dark) .post-tags a { background: #3b404d; box-shadow: inset 0 1px 0 rgba(255,255,255,0.06); }
|
||||
body:where(.dark) .post-tags a:hover { background: #fff; color: #212632; }
|
||||
|
||||
body:where(.dark) .wp-pagenavi a,
|
||||
body:where(.dark) .wp-pagenavi span { color: #9ba4b3; }
|
||||
body:where(.dark) .wp-pagenavi a { background: #313642; box-shadow: inset 0 1px 0 rgba(255,255,255,0.08); color: #fff; }
|
||||
body:where(.dark) .wp-pagenavi a:hover,
|
||||
body:where(.dark) .wp-pagenavi a:active,
|
||||
body:where(.dark) .wp-pagenavi span.current { background: #fff; color: #212632; }
|
||||
|
||||
body:where(.dark) .entry .wp-caption { background: rgba(255,255,255,0.06); }
|
||||
body:where(.dark) .entry hr { background: rgba(255,255,255,0.12); }
|
||||
body:where(.dark) .entry dt { color: #fff; }
|
||||
body:where(.dark) .entry pre { border: 1px solid rgba(255,255,255,0.12); }
|
||||
body:where(.dark) .entry code { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.9); }
|
||||
body:where(.dark) .entry ins { background: rgba(255,255,255,0.12); }
|
||||
body:where(.dark) .entry table td { border-color: rgba(255,255,255,0.08); }
|
||||
body:where(.dark) .entry .wp-block-button a { background: rgba(255,255,255,0.12); color: #fff; }
|
||||
body:where(.dark) .entry .wp-block-calendar caption { background: rgba(255,255,255,0.06); color: #fff; }
|
||||
body:where(.dark) .entry .wp-block-calendar th { background: rgba(255,255,255,0.12); color: #fff; }
|
||||
body:where(.dark) .entry .wp-block-calendar td { color: rgba(255,255,255,0.5); }
|
||||
|
||||
body:where(.dark.invert-dark-logo) .site-title a img,
|
||||
body:where(.dark.invert-dark-logo) .site-title a svg,
|
||||
body:where(.dark.invert-dark-logo) #footer-logo { filter: invert(1); }
|
||||
|
||||
body:where(.dark) .commentlist .fn { color: #fff; }
|
||||
body:where(.dark) .commentlist .comment-metadata:before { color: #9ba4b3; }
|
||||
body:where(.dark) .commentlist .comment-metadata a { color: #9ba4b3; }
|
||||
body:where(.dark) .comment-awaiting-moderation { color: #fff; }
|
||||
body:where(.dark) .commentlist li.bypostauthor > .comment-body:after,
|
||||
body:where(.dark) .commentlist li.comment-author-admin > .comment-body:after { background: #fff; color: #212632; }
|
||||
|
||||
body:where(.dark) .themeform input[type="submit"] { background: #fff; color: #212632; }
|
||||
body:where(.dark) .themeform input:not([type="submit"]):not([type="checkbox"]),
|
||||
body:where(.dark) .themeform textarea { background: #212632; color: #9ba4b3; box-shadow: none; outline: 1px solid rgba(255,255,255,0.06); }
|
||||
body:where(.dark) .themeform textarea:focus,
|
||||
body:where(.dark) .themeform input:not([type="submit"]):focus { outline: 1px solid rgba(255,255,255,0.15); color: #9ba4b3; }
|
||||
|
||||
body:where(.dark) h1,
|
||||
body:where(.dark) h2,
|
||||
body:where(.dark) h3,
|
||||
body:where(.dark) h4,
|
||||
body:where(.dark) h5,
|
||||
body:where(.dark) h6 { color: #fff; }
|
||||
|
||||
body:where(.dark) .social-links li a:hover { color: #fff; }
|
||||
body:where(.dark) .social-links .social-tooltip:hover:after { background: #fff; color: #212632; }
|
||||
body:where(.dark) .social-links .social-tooltip:hover:before { border-color: #fff transparent; }
|
||||
|
||||
body:where(.dark) .widget > h3,
|
||||
body:where(.dark) .widget > h3 a,
|
||||
body:where(.dark) .widget > h3 a:hover,
|
||||
body:where(.dark) .widget .wp-block-heading,
|
||||
body:where(.dark) .widget .wp-block-heading a,
|
||||
body:where(.dark) .widget .wp-block-heading a:hover { color: #fff; }
|
||||
body:where(.dark) .widget > ul li:before,
|
||||
body:where(.dark) .widget > ul li a:before,
|
||||
body:where(.dark) .widget > div > ul li a:before,
|
||||
body:where(.dark) .widget_calendar caption:before { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.4); }
|
||||
body:where(.dark) .widget > ul li a:hover:before { color: rgba(255,255,255,0.7); }
|
||||
body:where(.dark) .widget_archive ul li,
|
||||
body:where(.dark) .widget_categories ul li,
|
||||
body:where(.dark) .widget_links ul li { color: rgba(255,255,255,0.3); }
|
||||
body:where(.dark) .widget_recent_comments ul li,
|
||||
body:where(.dark) .widget_recent_entries ul li { color: rgba(255,255,255,0.5); }
|
||||
body:where(.dark) .widget_rss ul li a { color: rgba(255,255,255,0.9); }
|
||||
body:where(.dark) .widget_rss ul li span.rss-date { color: rgba(255,255,255,0.5); }
|
||||
body:where(.dark) .widget_rss ul li cite { color: rgba(255,255,255,0.3); }
|
||||
body:where(.dark) .widget_calendar a { color: #fff; }
|
||||
body:where(.dark) .widget_calendar a:hover { color: #fff!important; }
|
||||
body:where(.dark) .widget_calendar caption { background: rgba(255,255,255,0.1); color: #fff; }
|
||||
body:where(.dark) .widget_calendar caption:before { color: rgba(255,255,255,0.7); }
|
||||
body:where(.dark) .widget_calendar thead { background: rgba(255,255,255,0.06); box-shadow: inset 0 -1px 0 rgba(255,255,255,0.04); }
|
||||
body:where(.dark) .widget_calendar th,
|
||||
body:where(.dark) .widget_calendar td { border: 1px solid rgba(255,255,255,0.12); }
|
||||
|
||||
body:where(.dark) .alx-tabs-nav { background: #3b404d; box-shadow: none; }
|
||||
body:where(.dark) .alx-tabs-nav li a { color: rgba(255,255,255,0.6); }
|
||||
body:where(.dark) .alx-tabs-nav li a:hover { color: #fff; }
|
||||
body:where(.dark) .alx-tabs-nav li.active a { }
|
||||
body:where(.dark) .alx-tab .tab-item-category a,
|
||||
body:where(.dark) .alx-posts .post-item-category a { color: rgba(255,255,255,0.6); }
|
||||
|
||||
/* menu styling */
|
||||
body:where(.dark) .menu-toggle-icon span { background: #fff; }
|
||||
body:where(.dark) .nav-menu.mobile button:focus,
|
||||
body:where(.dark) .menu-toggle:focus { background: rgba(255,255,255,0.04); }
|
||||
body:where(.dark) .nav-menu a { color: #fff; }
|
||||
body:where(.dark) .nav-menu .svg-icon { fill: #fff; }
|
||||
body:where(.dark) .nav-menu:not(.mobile) .menu ul { background: #fff; color: #fff; }
|
||||
body:where(.dark) .nav-menu:not(.mobile) .menu ul:after { border-bottom-color: #fff; }
|
||||
body:where(.dark) .nav-menu:not(.mobile) .menu ul ul:after { border-right-color: #fff; }
|
||||
body:where(.dark) .nav-menu-dropdown-left .nav-menu:not(.mobile) .menu ul ul:after { border-left-color: #fff; border-bottom-color: transparent; }
|
||||
|
||||
body:where(.dark) .nav-menu:not(.mobile) a { color: #9ba4b3; }
|
||||
body:where(.dark) .nav-menu:not(.mobile) a:hover { color: #fff; }
|
||||
body:where(.dark) .nav-menu:not(.mobile) ul ul a:hover { color: #000; }
|
||||
body:where(.dark) .nav-menu:not(.mobile) ul ul > li:hover > span { background: rgba(255,255,255,0.1); }
|
||||
body:where(.dark) .nav-menu:not(.mobile) ul ul a { color: #212632; }
|
||||
body:where(.dark) .nav-menu:not(.mobile) ul ul span { border-bottom: 1px solid #eee; }
|
||||
body:where(.dark) .nav-menu:not(.mobile) button { color: #666; }
|
||||
body:where(.dark) .nav-menu:not(.mobile) button.active { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.5); }
|
||||
body:where(.dark) .nav-menu:not(.mobile) button .svg-icon { fill: rgba(255,255,255,0.3); }
|
||||
body:where(.dark) .nav-menu:not(.mobile) ul ul button { color: #eee; }
|
||||
body:where(.dark) .nav-menu:not(.mobile) ul ul button.active { background: #eee; color: rgba(0,0,0,0.5); }
|
||||
body:where(.dark) .nav-menu:not(.mobile) ul ul button .svg-icon { fill: rgba(0,0,0,0.5); }
|
||||
|
||||
body:where(.dark) .nav-menu:not(.mobile) li.current_page_item > span > a,
|
||||
body:where(.dark) .nav-menu:not(.mobile) li.current-menu-item > span > a,
|
||||
body:where(.dark) .nav-menu:not(.mobile) li.current-menu-ancestor > span > a,
|
||||
body:where(.dark) .nav-menu:not(.mobile) li.current-post-parent > span > a { color: #fff; }
|
||||
body:where(.dark) .nav-menu:not(.mobile) ul ul li.current_page_item > span > a,
|
||||
body:where(.dark) .nav-menu:not(.mobile) ul ul li.current-menu-item > span > a,
|
||||
body:where(.dark) .nav-menu:not(.mobile) ul ul li.current-menu-ancestor > span > a,
|
||||
body:where(.dark) .nav-menu:not(.mobile) ul ul li.current-post-parent > span > a { color: #999; }
|
||||
|
||||
body:where(.dark) .nav-menu.mobile { border-bottom-color: rgba(255,255,255,0.06); }
|
||||
body:where(.dark) .nav-menu.mobile button.active .svg-icon { fill: #fff; }
|
||||
body:where(.dark) .nav-menu.mobile ul ul { background: rgba(255,255,255,0.04); }
|
||||
body:where(.dark) .nav-menu.mobile ul li .menu-item-wrapper,
|
||||
body:where(.dark) .nav-menu.mobile ul ul li .menu-item-wrapper { border-bottom: 1px solid rgba(255,255,255,0.07); }
|
||||
body:where(.dark) .nav-menu.mobile ul li a { color: #fff; }
|
||||
body:where(.dark) .nav-menu.mobile ul button,
|
||||
body:where(.dark) .nav-menu.mobile ul ul button { border-left: 1px solid rgba(255,255,255,0.07); }
|
||||
body:where(.dark) .nav-menu.mobile > div > ul { border-top: 1px solid rgba(255,255,255,0.07); }
|
||||
|
||||
body:where(.dark) .nav-menu.mobile > .menu-toggle { box-shadow: 0 0 0 1px rgba(255,255,255,0.08); }
|
||||
|
||||
@media only screen and (max-width: 719px) {
|
||||
body:where(.dark) .page-sidebar { border-bottom: 1px solid rgba(255,255,255,0.06); }
|
||||
}
|
7913
fonts/all.css
Normal file
9
fonts/all.min.css
vendored
Normal file
BIN
fonts/fa-brands-400.ttf
Normal file
BIN
fonts/fa-brands-400.woff2
Normal file
BIN
fonts/fa-regular-400.ttf
Normal file
BIN
fonts/fa-regular-400.woff2
Normal file
BIN
fonts/fa-solid-900.ttf
Normal file
BIN
fonts/fa-solid-900.woff2
Normal file
BIN
fonts/fa-v4compatibility.ttf
Normal file
BIN
fonts/fa-v4compatibility.woff2
Normal file
100
footer.php
Normal file
|
@ -0,0 +1,100 @@
|
|||
</div><!--/.page-row-->
|
||||
</div><!--/.page-inner-container-->
|
||||
|
||||
<div class="page-inner-container-footer">
|
||||
<footer class="page-card" id="footer">
|
||||
|
||||
<div class="wrapper-inner">
|
||||
|
||||
<?php if ( get_theme_mod( 'footer-ads', 'off' ) == 'on' ): ?>
|
||||
<div id="footer-ads">
|
||||
<?php dynamic_sidebar( 'footer-ads' ); ?>
|
||||
</div><!--/#footer-ads-->
|
||||
<?php endif; ?>
|
||||
|
||||
<?php // footer widgets
|
||||
$total = 4;
|
||||
if ( get_theme_mod( 'footer-widgets','0' ) != '' ) {
|
||||
|
||||
$total = get_theme_mod( 'footer-widgets' );
|
||||
if( $total == 1) $class = 'one-full';
|
||||
if( $total == 2) $class = 'one-half';
|
||||
if( $total == 3) $class = 'one-third';
|
||||
if( $total == 4) $class = 'one-fourth';
|
||||
}
|
||||
|
||||
if ( ( is_active_sidebar( 'footer-1' ) ||
|
||||
is_active_sidebar( 'footer-2' ) ||
|
||||
is_active_sidebar( 'footer-3' ) ||
|
||||
is_active_sidebar( 'footer-4' ) ) && $total > 0 )
|
||||
{ ?>
|
||||
<div id="footer-widgets">
|
||||
|
||||
<div class="pad group">
|
||||
<?php $i = 0; while ( $i < $total ) { $i++; ?>
|
||||
<?php if ( is_active_sidebar( 'footer-' . $i ) ) { ?>
|
||||
|
||||
<div class="footer-widget-<?php echo esc_attr( $i ); ?> grid <?php echo esc_attr( $class ); ?> <?php if ( $i == $total ) { echo 'last'; } ?>">
|
||||
<?php dynamic_sidebar( 'footer-' . $i ); ?>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</div><!--/.pad-->
|
||||
|
||||
</div><!--/#footer-widgets-->
|
||||
<?php } ?>
|
||||
|
||||
<div id="footer-bottom">
|
||||
|
||||
<div class="pad group">
|
||||
|
||||
<div class="grid one-full">
|
||||
|
||||
<?php if ( get_theme_mod('footer-logo') ): ?>
|
||||
<img id="footer-logo" src="<?php echo esc_url( get_theme_mod('footer-logo') ); ?>" alt="<?php echo esc_attr( get_bloginfo('name')); ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="copyright">
|
||||
<?php if ( get_theme_mod( 'copyright' ) ): ?>
|
||||
<p><?php echo esc_html( get_theme_mod( 'copyright' ) ); ?></p>
|
||||
<?php else: ?>
|
||||
<p><?php bloginfo(); ?> © <?php echo esc_html( date_i18n( esc_html__( 'Y', 'dashwall' ) ) ); ?>. <?php esc_html_e( 'All Rights Reserved.', 'dashwall' ); ?></p>
|
||||
<?php endif; ?>
|
||||
</div><!--/#copyright-->
|
||||
|
||||
<?php if ( get_theme_mod( 'credit', 'on' ) == 'on' ): ?>
|
||||
<div id="credit">
|
||||
<p><?php esc_html_e('Powered by','dashwall'); ?> <a href="<?php esc_url( _e( 'https://wordpress.org', 'dashwall' ) ); ?>" rel="nofollow">WordPress</a>. <?php esc_html_e('Theme by','dashwall'); ?> <a href="http://alx.media" rel="nofollow">Alx</a>.</p>
|
||||
</div><!--/#credit-->
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( get_theme_mod( 'footer-social', 'on' ) == 'on' ): ?>
|
||||
<?php dashwall_social_links() ; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div><!--/.pad-->
|
||||
|
||||
</div><!--/#footer-bottom-->
|
||||
|
||||
</div>
|
||||
|
||||
</footer><!--/#footer-->
|
||||
|
||||
</div><!--/.page-inner-container-footer-->
|
||||
|
||||
</div><!--/.page-inner-->
|
||||
</div><!--/.page-wrapper-->
|
||||
|
||||
<a id="back-to-top" href="#"><i class="fas fa-angle-up"></i></a>
|
||||
|
||||
<div class="canvas-bottom"></div>
|
||||
<div class="canvas-wrapper">
|
||||
<div class="canvas-inner"></div>
|
||||
</div>
|
||||
|
||||
<?php wp_footer(); ?>
|
||||
</body>
|
||||
</html>
|
635
functions.php
Normal file
|
@ -0,0 +1,635 @@
|
|||
<?php
|
||||
/* ------------------------------------------------------------------------- *
|
||||
* Custom functions
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
// Use a child theme instead of placing custom functions here
|
||||
// http://codex.wordpress.org/Child_Themes
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- *
|
||||
* Load theme files
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
// Load Kirki
|
||||
include( get_template_directory() . '/functions/kirki/kirki.php' );
|
||||
|
||||
if ( ! function_exists( 'dashwall_load' ) ) {
|
||||
|
||||
function dashwall_load() {
|
||||
// Load theme languages
|
||||
load_theme_textdomain( 'dashwall', get_template_directory().'/languages' );
|
||||
|
||||
// Load theme options and meta boxes
|
||||
include( get_template_directory() . '/functions/theme-options.php' );
|
||||
include( get_template_directory() . '/functions/meta-boxes.php' );
|
||||
|
||||
// Load dynamic styles
|
||||
include( get_template_directory() . '/functions/dynamic-styles.php' );
|
||||
|
||||
// Load TGM plugin activation
|
||||
include( get_template_directory() . '/functions/class-tgm-plugin-activation.php' );
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'after_setup_theme', 'dashwall_load' );
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- *
|
||||
* Base functionality
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
// Content width
|
||||
if ( !isset( $content_width ) ) { $content_width = 650; }
|
||||
|
||||
|
||||
/* Theme setup
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_setup' ) ) {
|
||||
|
||||
function dashwall_setup() {
|
||||
// Enable title tag
|
||||
add_theme_support( 'title-tag' );
|
||||
|
||||
// Enable automatic feed links
|
||||
add_theme_support( 'automatic-feed-links' );
|
||||
|
||||
// Enable featured image
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
|
||||
// Enable responsive embeds
|
||||
add_theme_support( 'responsive-embeds' );
|
||||
|
||||
// Enable HTML5 semantic markup
|
||||
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
|
||||
|
||||
// Declare WooCommerce support
|
||||
add_theme_support( 'woocommerce' );
|
||||
|
||||
// Enable support for selective refresh of widgets in customizer
|
||||
add_theme_support( 'customize-selective-refresh-widgets' );
|
||||
|
||||
// Disable support for widgets block editor
|
||||
remove_theme_support( 'widgets-block-editor' );
|
||||
|
||||
// Thumbnail sizes
|
||||
add_image_size( 'dashwall-small', 320, 180, true );
|
||||
add_image_size( 'dashwall-medium', 520, 293, true );
|
||||
add_image_size( 'dashwall-large', 800, 450, true );
|
||||
add_image_size( 'dashwall-huge', 1000, 563, true );
|
||||
|
||||
// Thumbnail sizes custom widgets
|
||||
add_image_size( 'alx-small', 150, 150, true );
|
||||
add_image_size( 'alx-medium', 520, 293, true );
|
||||
|
||||
// Custom menu areas
|
||||
register_nav_menus( array(
|
||||
'mobile' => esc_html__( 'Mobile', 'dashwall' ),
|
||||
'header' => esc_html__( 'Header', 'dashwall' ),
|
||||
) );
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'after_setup_theme', 'dashwall_setup' );
|
||||
|
||||
|
||||
/* Custom navigation
|
||||
/* ------------------------------------ */
|
||||
if ( ! class_exists( '\Dashwall\Nav' ) ) {
|
||||
require_once 'functions/nav.php';
|
||||
}
|
||||
add_action( 'wp', function() {
|
||||
$nav = new \Dashwall\Nav();
|
||||
$nav->enqueue(
|
||||
[
|
||||
'script' => 'js/nav.js',
|
||||
'inline' => false,
|
||||
]
|
||||
);
|
||||
$nav->init();
|
||||
} );
|
||||
|
||||
|
||||
/* Custom logo
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_custom_logo' ) ) {
|
||||
|
||||
function dashwall_custom_logo() {
|
||||
$defaults = array(
|
||||
'height' => 120,
|
||||
'width' => 400,
|
||||
'flex-height' => true,
|
||||
'flex-width' => true,
|
||||
'header-text' => array( 'site-title', 'site-description' ),
|
||||
);
|
||||
add_theme_support( 'custom-logo', $defaults );
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'after_setup_theme', 'dashwall_custom_logo' );
|
||||
|
||||
|
||||
/* Custom header
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_custom_header' ) ) {
|
||||
|
||||
function dashwall_custom_header() {
|
||||
$args = array(
|
||||
'default-image' => false,
|
||||
'default-text' => false,
|
||||
'width' => 1120,
|
||||
'height' => 300,
|
||||
'flex-width' => true,
|
||||
'flex-height' => true,
|
||||
);
|
||||
add_theme_support( 'custom-header', $args );
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'after_setup_theme', 'dashwall_custom_header' );
|
||||
|
||||
|
||||
/* Custom background
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_custom_background' ) ) {
|
||||
|
||||
function dashwall_custom_background() {
|
||||
$args = array();
|
||||
add_theme_support( 'custom-background', $args );
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'after_setup_theme', 'dashwall_custom_background' );
|
||||
|
||||
|
||||
/* Deregister
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_deregister' ) ) {
|
||||
|
||||
function dashwall_deregister() {
|
||||
wp_deregister_style( 'wp-pagenavi' );
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'dashwall_deregister', 100 );
|
||||
|
||||
|
||||
/* Register sidebars
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_sidebars' ) ) {
|
||||
|
||||
function dashwall_sidebars() {
|
||||
register_sidebar(array( 'name' => esc_html__('Primary','dashwall'),'id' => 'primary','description' => esc_html__("Normal full width sidebar","dashwall"), 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
|
||||
|
||||
if ( get_theme_mod('footer-widgets') >= '1' ) { register_sidebar(array( 'name' => esc_html__('Footer 1','dashwall'),'id' => 'footer-1', 'description' => esc_html__("Widgetized footer","dashwall"), 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>')); }
|
||||
if ( get_theme_mod('footer-widgets') >= '2' ) { register_sidebar(array( 'name' => esc_html__('Footer 2','dashwall'),'id' => 'footer-2', 'description' => esc_html__("Widgetized footer","dashwall"), 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>')); }
|
||||
if ( get_theme_mod('footer-widgets') >= '3' ) { register_sidebar(array( 'name' => esc_html__('Footer 3','dashwall'),'id' => 'footer-3', 'description' => esc_html__("Widgetized footer","dashwall"), 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>')); }
|
||||
if ( get_theme_mod('footer-widgets') >= '4' ) { register_sidebar(array( 'name' => esc_html__('Footer 4','dashwall'),'id' => 'footer-4', 'description' => esc_html__("Widgetized footer","dashwall"), 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>')); }
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'widgets_init', 'dashwall_sidebars' );
|
||||
|
||||
|
||||
/* Enqueue javascript
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_scripts' ) ) {
|
||||
|
||||
function dashwall_scripts() {
|
||||
wp_enqueue_script( 'dashwall-slick', get_template_directory_uri() . '/js/slick.min.js', array( 'jquery' ),'', false );
|
||||
if ( get_theme_mod( 'theme-toggle','on' ) == 'on' ) { wp_enqueue_script( 'dashwall-theme-toggle', get_template_directory_uri() . '/js/theme-toggle.js', array( 'jquery' ),'', true ); }
|
||||
wp_enqueue_script( 'dashwall-scripts', get_template_directory_uri() . '/js/scripts.js', array( 'jquery' ),'', true );
|
||||
if ( is_singular() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); }
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'dashwall_scripts' );
|
||||
|
||||
|
||||
/* Enqueue css
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_styles' ) ) {
|
||||
|
||||
function dashwall_styles() {
|
||||
wp_enqueue_style( 'dashwall-style', get_stylesheet_uri() );
|
||||
wp_enqueue_style( 'dashwall-responsive', get_template_directory_uri().'/responsive.css' );
|
||||
if ( ( get_theme_mod( 'dark-theme','off' ) == 'on' ) || ( get_theme_mod( 'theme-toggle','on' ) == 'on' ) ) { wp_enqueue_style( 'dashwall-dark', get_template_directory_uri().'/dark.css' ); }
|
||||
wp_enqueue_style( 'dashwall-font-awesome', get_template_directory_uri().'/fonts/all.min.css' );
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'dashwall_styles' );
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- *
|
||||
* Template functions
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* Layout class
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_layout_class' ) ) {
|
||||
|
||||
function dashwall_layout_class() {
|
||||
// Default layout
|
||||
$layout = 'col-2cl';
|
||||
$default = 'col-2cl';
|
||||
|
||||
// Check for page/post specific layout
|
||||
if ( is_page() || is_single() ) {
|
||||
// Reset post data
|
||||
wp_reset_postdata();
|
||||
global $post;
|
||||
// Get meta
|
||||
$meta = get_post_meta($post->ID,'_layout',true);
|
||||
// Get if set and not set to inherit
|
||||
if ( isset($meta) && !empty($meta) && $meta != 'inherit' ) { $layout = $meta; }
|
||||
// Else check for page-global / single-global
|
||||
elseif ( is_single() && ( get_theme_mod('layout-single','inherit') !='inherit' ) ) $layout = get_theme_mod('layout-single',''.$default.'');
|
||||
elseif ( is_page() && ( get_theme_mod('layout-page','inherit') !='inherit' ) ) $layout = get_theme_mod('layout-page',''.$default.'');
|
||||
// Else get global option
|
||||
else $layout = get_theme_mod('layout-global',''.$default.'');
|
||||
}
|
||||
|
||||
// Set layout based on page
|
||||
elseif ( is_home() && ( get_theme_mod('layout-home','inherit') !='inherit' ) ) $layout = get_theme_mod('layout-home',''.$default.'');
|
||||
elseif ( is_category() && ( get_theme_mod('layout-archive-category','inherit') !='inherit' ) ) $layout = get_theme_mod('layout-archive-category',''.$default.'');
|
||||
elseif ( is_archive() && ( get_theme_mod('layout-archive','inherit') !='inherit' ) ) $layout = get_theme_mod('layout-archive',''.$default.'');
|
||||
elseif ( is_search() && ( get_theme_mod('layout-search','inherit') !='inherit' ) ) $layout = get_theme_mod('layout-search',''.$default.'');
|
||||
elseif ( is_404() && ( get_theme_mod('layout-404','inherit') !='inherit' ) ) $layout = get_theme_mod('layout-404',''.$default.'');
|
||||
|
||||
// Global option
|
||||
else $layout = get_theme_mod('layout-global',''.$default.'');
|
||||
|
||||
// Return layout class
|
||||
return esc_attr( $layout );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Dynamic sidebar primary
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_sidebar_primary' ) ) {
|
||||
|
||||
function dashwall_sidebar_primary() {
|
||||
// Default sidebar
|
||||
$sidebar = 'primary';
|
||||
|
||||
// Set sidebar based on page
|
||||
if ( is_home() && get_theme_mod('s1-home') ) $sidebar = get_theme_mod('s1-home');
|
||||
if ( is_single() && get_theme_mod('s1-single') ) $sidebar = get_theme_mod('s1-single');
|
||||
if ( is_archive() && get_theme_mod('s1-archive') ) $sidebar = get_theme_mod('s1-archive');
|
||||
if ( is_category() && get_theme_mod('s1-archive-category') ) $sidebar = get_theme_mod('s1-archive-category');
|
||||
if ( is_search() && get_theme_mod('s1-search') ) $sidebar = get_theme_mod('s1-search');
|
||||
if ( is_404() && get_theme_mod('s1-404') ) $sidebar = get_theme_mod('s1-404');
|
||||
if ( is_page() && get_theme_mod('s1-page') ) $sidebar = get_theme_mod('s1-page');
|
||||
|
||||
// Check for page/post specific sidebar
|
||||
if ( is_page() || is_single() ) {
|
||||
// Reset post data
|
||||
wp_reset_postdata();
|
||||
global $post;
|
||||
// Get meta
|
||||
$meta = get_post_meta($post->ID,'_sidebar_primary',true);
|
||||
if ( $meta ) { $sidebar = $meta; }
|
||||
}
|
||||
|
||||
// Return sidebar
|
||||
return esc_attr( $sidebar );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Social links
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_social_links' ) ) {
|
||||
|
||||
function dashwall_social_links() {
|
||||
if ( !get_theme_mod('social-links') =='' ) {
|
||||
$links = get_theme_mod('social-links', array());
|
||||
if ( !empty( $links ) ) {
|
||||
echo '<ul class="social-links">';
|
||||
foreach( $links as $item ) {
|
||||
|
||||
// Build each separate html-section only if set
|
||||
if ( isset($item['social-title']) && !empty($item['social-title']) )
|
||||
{ $title = 'title="' .esc_attr( $item['social-title'] ). '"'; } else $title = '';
|
||||
if ( isset($item['social-link']) && !empty($item['social-link']) )
|
||||
{ $link = 'href="' .esc_url( $item['social-link'] ). '"'; } else $link = '';
|
||||
if ( isset($item['social-target']) && !empty($item['social-target']) )
|
||||
{ $target = 'target="_blank"'; } else $target = '';
|
||||
if ( isset($item['social-icon']) && !empty($item['social-icon']) )
|
||||
{ $icon = 'class="fab ' .esc_attr( $item['social-icon'] ). '"'; } else $icon = '';
|
||||
if ( isset($item['social-color']) && !empty($item['social-color']) )
|
||||
{ $color = 'style="color: ' .esc_attr( $item['social-color'] ). ';"'; } else $color = '';
|
||||
|
||||
// Put them together
|
||||
if ( isset($item['social-title']) && !empty($item['social-title']) && isset($item['social-icon']) && !empty($item['social-icon']) && ($item['social-icon'] !='fa-') ) {
|
||||
echo '<li><a rel="nofollow" class="social-tooltip" '.$title.' '.$link.' '.$target.'><i '.$icon.' '.$color.'></i></a></li>';
|
||||
}
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Site name/logo
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_site_title' ) ) {
|
||||
|
||||
function dashwall_site_title() {
|
||||
|
||||
$custom_logo_id = get_theme_mod( 'custom_logo' );
|
||||
$logo = wp_get_attachment_image_src( $custom_logo_id , 'full' );
|
||||
|
||||
// Text or image?
|
||||
if ( has_custom_logo() && $logo !== false ) {
|
||||
$logo = '<img src="'. esc_url( $logo[0] ) .'" alt="'.esc_attr( get_bloginfo('name')).'">';
|
||||
} else {
|
||||
$logo = esc_html( get_bloginfo('name') );
|
||||
}
|
||||
|
||||
$link = '<a href="'.esc_url( home_url('/') ).'" rel="home">'.$logo.'</a>';
|
||||
|
||||
if ( is_front_page() || is_home() ) {
|
||||
$sitename = '<h1 class="site-title">'.$link.'</h1>'."\n";
|
||||
} else {
|
||||
$sitename = '<p class="site-title">'.$link.'</p>'."\n";
|
||||
}
|
||||
|
||||
return $sitename;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Blog title
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_blog_title' ) ) {
|
||||
|
||||
function dashwall_blog_title() {
|
||||
global $post;
|
||||
$heading = esc_html( get_theme_mod('blog-heading') );
|
||||
$subheading = esc_html( get_theme_mod('blog-subheading') );
|
||||
if($heading) {
|
||||
$title = $heading;
|
||||
} else {
|
||||
$title = esc_html( get_bloginfo('name') );
|
||||
}
|
||||
if($subheading) {
|
||||
$title = $title.' <span>'.$subheading.'</span>';
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Related posts
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_related_posts' ) ) {
|
||||
|
||||
function dashwall_related_posts() {
|
||||
wp_reset_postdata();
|
||||
global $post;
|
||||
|
||||
// Define shared post arguments
|
||||
$args = array(
|
||||
'no_found_rows' => true,
|
||||
'update_post_meta_cache' => false,
|
||||
'update_post_term_cache' => false,
|
||||
'ignore_sticky_posts' => 1,
|
||||
'orderby' => 'rand',
|
||||
'post__not_in' => array($post->ID),
|
||||
'posts_per_page' => 2
|
||||
);
|
||||
// Related by categories
|
||||
if ( get_theme_mod( 'related-posts','categories' ) == 'categories' ) {
|
||||
|
||||
$cats = get_post_meta($post->ID, 'related-cat', true);
|
||||
|
||||
if ( !$cats ) {
|
||||
$cats = wp_get_post_categories($post->ID, array('fields'=>'ids'));
|
||||
$args['category__in'] = $cats;
|
||||
} else {
|
||||
$args['cat'] = $cats;
|
||||
}
|
||||
}
|
||||
// Related by tags
|
||||
if ( get_theme_mod( 'related-posts','categories' ) == 'tags' ) {
|
||||
|
||||
$tags = get_post_meta($post->ID, 'related-tag', true);
|
||||
|
||||
if ( !$tags ) {
|
||||
$tags = wp_get_post_tags($post->ID, array('fields'=>'ids'));
|
||||
$args['tag__in'] = $tags;
|
||||
} else {
|
||||
$args['tag_slug__in'] = explode(',', $tags);
|
||||
}
|
||||
if ( !$tags ) { $break = true; }
|
||||
}
|
||||
|
||||
$query = !isset($break)?new WP_Query($args):new WP_Query;
|
||||
return $query;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Get featured post ids
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_get_featured_post_ids' ) ) {
|
||||
|
||||
function dashwall_get_featured_post_ids() {
|
||||
$args = array(
|
||||
'category' => absint( get_theme_mod('featured-category','') ),
|
||||
'numberposts' => absint( get_theme_mod('featured-posts-count','4')),
|
||||
);
|
||||
$posts = get_posts($args);
|
||||
if ( !$posts ) return false;
|
||||
foreach ( $posts as $post )
|
||||
$ids[] = $post->ID;
|
||||
return $ids;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- *
|
||||
* Filters
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* Body class
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_body_class' ) ) {
|
||||
|
||||
function dashwall_body_class( $classes ) {
|
||||
$classes[] = dashwall_layout_class();
|
||||
if ( get_theme_mod( 'boxed','off' ) != 'on' ) { $classes[] = 'full-width'; }
|
||||
if ( get_theme_mod( 'boxed','off' ) == 'on' ) { $classes[] = 'boxed'; }
|
||||
if ( has_nav_menu( 'mobile' ) ) { $classes[] = 'mobile-menu'; }
|
||||
if ( get_theme_mod( 'dark-theme' ,'off' ) == 'on' ) { $classes[] = 'dark'; }
|
||||
if ( get_theme_mod( 'invert-logo' ,'on' ) == 'on' ) { $classes[] = 'invert-dark-logo'; }
|
||||
if (! ( is_user_logged_in() ) ) { $classes[] = 'logged-out'; }
|
||||
return $classes;
|
||||
}
|
||||
|
||||
}
|
||||
add_filter( 'body_class', 'dashwall_body_class' );
|
||||
|
||||
|
||||
/* Excerpt ending
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_excerpt_more' ) ) {
|
||||
|
||||
function dashwall_excerpt_more( $more ) {
|
||||
if ( is_admin() ) {
|
||||
return $more;
|
||||
}
|
||||
return '...';
|
||||
}
|
||||
|
||||
}
|
||||
add_filter( 'excerpt_more', 'dashwall_excerpt_more' );
|
||||
|
||||
|
||||
/* Excerpt length
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_excerpt_length' ) ) {
|
||||
|
||||
function dashwall_excerpt_length( $length ) {
|
||||
if ( is_admin() ) {
|
||||
return $length;
|
||||
}
|
||||
|
||||
$new_length = $length;
|
||||
$custom_length = get_theme_mod( 'excerpt-length', '20' );
|
||||
if ( absint( $custom_length ) > 0 ) {
|
||||
$new_length = absint( $custom_length );
|
||||
}
|
||||
return $new_length;
|
||||
}
|
||||
|
||||
}
|
||||
add_filter( 'excerpt_length', 'dashwall_excerpt_length', 999 );
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- *
|
||||
* Actions
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* Include or exclude featured articles in loop
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_pre_get_posts' ) ) {
|
||||
|
||||
function dashwall_pre_get_posts( $query ) {
|
||||
// Are we on main query ?
|
||||
if ( !$query->is_main_query() ) return;
|
||||
if ( $query->is_home() ) {
|
||||
|
||||
// Featured posts enabled
|
||||
if ( get_theme_mod('featured-posts-count','4') != '0' ) {
|
||||
// Get featured post ids
|
||||
$featured_post_ids = dashwall_get_featured_post_ids();
|
||||
// Exclude posts
|
||||
if ( $featured_post_ids && get_theme_mod('featured-posts-include','off') =='on' )
|
||||
$query->set('post__not_in', $featured_post_ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'pre_get_posts', 'dashwall_pre_get_posts' );
|
||||
|
||||
|
||||
/* Script for no-js / js class
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_html_js_class' ) ) {
|
||||
|
||||
function dashwall_html_js_class () {
|
||||
echo '<script>document.documentElement.className = document.documentElement.className.replace("no-js","js");</script>'. "\n";
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'wp_head', 'dashwall_html_js_class', 1 );
|
||||
|
||||
|
||||
/* Admin panel css
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_admin_panel_css' ) ) {
|
||||
|
||||
function dashwall_admin_panel_css() {
|
||||
global $pagenow;
|
||||
if ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) {
|
||||
echo '<style>
|
||||
.rwmb-image-select { width: auto!important; height: auto!important; }
|
||||
.rwmb-text { width: 100%; }
|
||||
</style>';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'admin_head', 'dashwall_admin_panel_css' );
|
||||
|
||||
|
||||
/* TGM plugin activation
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_plugins' ) ) {
|
||||
|
||||
function dashwall_plugins() {
|
||||
if ( get_theme_mod('recommended-plugins','on') =='on' ) {
|
||||
// Add the following plugins
|
||||
$plugins = array(
|
||||
array(
|
||||
'name' => esc_html__( 'Alx Extensions', 'dashwall' ),
|
||||
'slug' => 'alx-extensions',
|
||||
),
|
||||
array(
|
||||
'name' => esc_html__( 'Meta Box', 'dashwall' ),
|
||||
'slug' => 'meta-box',
|
||||
),
|
||||
array(
|
||||
'name' => esc_html__( 'Regenerate Thumbnails', 'dashwall' ),
|
||||
'slug' => 'regenerate-thumbnails',
|
||||
),
|
||||
array(
|
||||
'name' => esc_html__( 'WP-PageNavi', 'dashwall' ),
|
||||
'slug' => 'wp-pagenavi',
|
||||
)
|
||||
);
|
||||
tgmpa( $plugins );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'tgmpa_register', 'dashwall_plugins' );
|
||||
|
||||
|
||||
/* WooCommerce basic support
|
||||
/* ------------------------------------ */
|
||||
function dashwall_wc_wrapper_start() {
|
||||
echo '<div class="page-col-center">';
|
||||
}
|
||||
function dashwall_wc_wrapper_end() {
|
||||
echo '</div>';
|
||||
}
|
||||
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
|
||||
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
|
||||
add_action('woocommerce_before_main_content', 'dashwall_wc_wrapper_start', 10);
|
||||
add_action('woocommerce_after_main_content', 'dashwall_wc_wrapper_end', 10);
|
||||
|
||||
|
||||
/* Accessibility IE11 fix - https://git.io/vWdr2
|
||||
/* ------------------------------------ */
|
||||
function dashwall_skip_link_focus_fix() {
|
||||
?>
|
||||
<script>
|
||||
/(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())},!1);
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
add_action( 'wp_print_footer_scripts', 'dashwall_skip_link_focus_fix' );
|
3760
functions/class-tgm-plugin-activation.php
Normal file
178
functions/dynamic-styles.php
Normal file
|
@ -0,0 +1,178 @@
|
|||
<?php
|
||||
/* ------------------------------------------------------------------------- *
|
||||
* Dynamic styles
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* Convert hexadecimal to rgb
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_hex2rgb' ) ) {
|
||||
|
||||
function dashwall_hex2rgb( $hex, $array=false ) {
|
||||
$hex = str_replace("#", "", $hex);
|
||||
|
||||
if ( strlen($hex) == 3 ) {
|
||||
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
|
||||
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
|
||||
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
|
||||
} else {
|
||||
$r = hexdec(substr($hex,0,2));
|
||||
$g = hexdec(substr($hex,2,2));
|
||||
$b = hexdec(substr($hex,4,2));
|
||||
}
|
||||
|
||||
$rgb = array( $r, $g, $b );
|
||||
if ( !$array ) { $rgb = implode(",", $rgb); }
|
||||
return $rgb;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Google fonts
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_enqueue_google_fonts' ) ) {
|
||||
|
||||
function dashwall_enqueue_google_fonts () {
|
||||
if ( get_theme_mod('dynamic-styles', 'on') == 'on' ) {
|
||||
if ( get_theme_mod( 'font' ) == 'titillium-web-ext' ) { wp_enqueue_style( 'titillium-web-ext', '//fonts.googleapis.com/css?family=Titillium+Web:400,400italic,300italic,300,600&subset=latin,latin-ext' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'droid-serif' ) { wp_enqueue_style( 'droid-serif', '//fonts.googleapis.com/css?family=Droid+Serif:400,400italic,700' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'source-sans-pro' ) { wp_enqueue_style( 'source-sans-pro', '//fonts.googleapis.com/css?family=Source+Sans+Pro:400,300italic,300,400italic,600&subset=latin,latin-ext' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'lato' ) { wp_enqueue_style( 'lato', '//fonts.googleapis.com/css?family=Lato:400,300,300italic,400italic,700' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'raleway' ) { wp_enqueue_style( 'raleway', '//fonts.googleapis.com/css?family=Raleway:400,300,600' ); }
|
||||
/*default*/ if ( ( get_theme_mod( 'font' ) == '' ) || ( get_theme_mod( 'font' ) == 'inter' ) ) { wp_enqueue_style( 'inter', '//fonts.googleapis.com/css?family=Inter:400,300,600,800' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'ubuntu' ) { wp_enqueue_style( 'ubuntu', '//fonts.googleapis.com/css?family=Ubuntu:400,400italic,300italic,300,700&subset=latin,latin-ext' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'ubuntu-cyr' ) { wp_enqueue_style( 'ubuntu-cyr', '//fonts.googleapis.com/css?family=Ubuntu:400,400italic,300italic,300,700&subset=latin,cyrillic-ext' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'roboto' ) { wp_enqueue_style( 'roboto', '//fonts.googleapis.com/css?family=Roboto:400,300italic,300,400italic,700&subset=latin,latin-ext' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'roboto-cyr' ) { wp_enqueue_style( 'roboto-cyr', '//fonts.googleapis.com/css?family=Roboto:400,300italic,300,400italic,700&subset=latin,cyrillic-ext' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'roboto-condensed' ) { wp_enqueue_style( 'roboto-condensed', '//fonts.googleapis.com/css?family=Roboto+Condensed:400,300italic,300,400italic,700&subset=latin,latin-ext' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'roboto-condensed-cyr' ) { wp_enqueue_style( 'roboto-condensed-cyr', '//fonts.googleapis.com/css?family=Roboto+Condensed:400,300italic,300,400italic,700&subset=latin,cyrillic-ext' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'roboto-slab' ) { wp_enqueue_style( 'roboto-slab', '//fonts.googleapis.com/css?family=Roboto+Slab:400,300italic,300,400italic,700&subset=latin,latin-ext' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'roboto-slab-cyr' ) { wp_enqueue_style( 'roboto-slab-cyr', '//fonts.googleapis.com/css?family=Roboto+Slab:400,300italic,300,400italic,700&subset=latin,cyrillic-ext' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'playfair-display' ) { wp_enqueue_style( 'playfair-display', '//fonts.googleapis.com/css?family=Playfair+Display:400,400italic,700&subset=latin,latin-ext' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'playfair-display-cyr' ) { wp_enqueue_style( 'playfair-display-cyr', '//fonts.googleapis.com/css?family=Playfair+Display:400,400italic,700&subset=latin,cyrillic' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'open-sans' ) { wp_enqueue_style( 'open-sans', '//fonts.googleapis.com/css?family=Open+Sans:400,400italic,300italic,300,600&subset=latin,latin-ext' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'open-sans-cyr' ) { wp_enqueue_style( 'open-sans-cyr', '//fonts.googleapis.com/css?family=Open+Sans:400,400italic,300italic,300,600&subset=latin,cyrillic-ext' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'pt-serif' ) { wp_enqueue_style( 'pt-serif', '//fonts.googleapis.com/css?family=PT+Serif:400,700,400italic&subset=latin,latin-ext' ); }
|
||||
if ( get_theme_mod( 'font' ) == 'pt-serif-cyr' ) { wp_enqueue_style( 'pt-serif-cyr', '//fonts.googleapis.com/css?family=PT+Serif:400,700,400italic&subset=latin,cyrillic-ext' ); }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'dashwall_enqueue_google_fonts' );
|
||||
|
||||
|
||||
/* Dynamic css output
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'dashwall_dynamic_css' ) ) {
|
||||
|
||||
function dashwall_dynamic_css() {
|
||||
if ( get_theme_mod('dynamic-styles', 'on') == 'on' ) {
|
||||
|
||||
// rgb values
|
||||
$color_1 = get_theme_mod('color-1');
|
||||
$color_1_rgb = dashwall_hex2rgb($color_1);
|
||||
|
||||
// start output
|
||||
$styles = '';
|
||||
|
||||
// google fonts
|
||||
if ( get_theme_mod( 'font' ) == 'titillium-web-ext' ) { $styles .= 'body { font-family: "Titillium Web", Arial, sans-serif; }'."\n"; }
|
||||
if ( get_theme_mod( 'font' ) == 'droid-serif' ) { $styles .= 'body { font-family: "Droid Serif", serif; }'."\n"; }
|
||||
if ( get_theme_mod( 'font' ) == 'source-sans-pro' ) { $styles .= 'body { font-family: "Source Sans Pro", Arial, sans-serif; }'."\n"; }
|
||||
if ( get_theme_mod( 'font' ) == 'lato' ) { $styles .= 'body { font-family: "Lato", Arial, sans-serif; }'."\n"; }
|
||||
if ( get_theme_mod( 'font' ) == 'raleway' ) { $styles .= 'body { font-family: "Raleway", Arial, sans-serif; }'."\n"; }
|
||||
/*default*/ if ( ( get_theme_mod( 'font' ) == '' ) || ( get_theme_mod( 'font' ) == 'inter' ) ) { $styles .= 'body { font-family: "Inter", Arial, sans-serif; }'."\n"; }
|
||||
if ( ( get_theme_mod( 'font' ) == 'ubuntu' ) || ( get_theme_mod( 'font' ) == 'ubuntu-cyr' ) ) { $styles .= 'body { font-family: "Ubuntu", Arial, sans-serif; }'."\n"; }
|
||||
if ( ( get_theme_mod( 'font' ) == 'roboto' ) || ( get_theme_mod( 'font' ) == 'roboto-cyr' ) ) { $styles .= 'body { font-family: "Roboto", Arial, sans-serif; }'."\n"; }
|
||||
if ( ( get_theme_mod( 'font' ) == 'roboto-condensed' ) || ( get_theme_mod( 'font' ) == 'roboto-condensed-cyr' ) ) { $styles .= 'body { font-family: "Roboto Condensed", Arial, sans-serif; }'."\n"; }
|
||||
if ( ( get_theme_mod( 'font' ) == 'roboto-slab' ) || ( get_theme_mod( 'font' ) == 'roboto-slab-cyr' ) ) { $styles .= 'body { font-family: "Roboto Slab", Arial, sans-serif; }'."\n"; }
|
||||
if ( ( get_theme_mod( 'font' ) == 'playfair-display' ) || ( get_theme_mod( 'font' ) == 'playfair-display-cyr' ) ) { $styles .= 'body { font-family: "Playfair Display", Arial, sans-serif; }'."\n"; }
|
||||
if ( ( get_theme_mod( 'font' ) == 'open-sans' ) || ( get_theme_mod( 'font' ) == 'open-sans-cyr' ) ) { $styles .= 'body { font-family: "Open Sans", Arial, sans-serif; }'."\n"; }
|
||||
if ( ( get_theme_mod( 'font' ) == 'pt-serif' ) || ( get_theme_mod( 'font' ) == 'pt-serif-cyr' ) ) { $styles .= 'body { font-family: "PT Serif", serif; }'."\n"; }
|
||||
if ( get_theme_mod( 'font' ) == 'arial' ) { $styles .= 'body { font-family: Arial, sans-serif; }'."\n"; }
|
||||
if ( get_theme_mod( 'font' ) == 'georgia' ) { $styles .= 'body { font-family: Georgia, serif; }'."\n"; }
|
||||
if ( get_theme_mod( 'font' ) == 'verdana' ) { $styles .= 'body { font-family: Verdana, sans-serif; }'."\n"; }
|
||||
if ( get_theme_mod( 'font' ) == 'tahoma' ) { $styles .= 'body { font-family: Tahoma, sans-serif; }'."\n"; }
|
||||
|
||||
// container width
|
||||
if ( get_theme_mod('container-width','1730') != '1730' ) {
|
||||
if ( get_theme_mod( 'boxed' ) ) {
|
||||
$styles .= '
|
||||
.none { max-width: '.esc_attr( get_theme_mod('container-width') ).'px; }
|
||||
'."\n";
|
||||
}
|
||||
else {
|
||||
$styles .= '
|
||||
.page-inner-container,
|
||||
.page-inner-container-footer { max-width: '.esc_attr( get_theme_mod('container-width') ).'px; }
|
||||
'."\n";
|
||||
}
|
||||
}
|
||||
// content max-width
|
||||
if ( get_theme_mod('content-width','1070') != '1070' ) {
|
||||
$styles .= '
|
||||
body.archive .page-inner-container,
|
||||
body.search .page-inner-container,
|
||||
body.single .page-inner-container,
|
||||
body.page .page-inner-container,
|
||||
body.error404 .page-inner-container { max-width: '.esc_attr( get_theme_mod('content-width') ).'px; }
|
||||
|
||||
.header-single-container { max-width: calc('.esc_attr( get_theme_mod('content-width') ).'px + 40px); }
|
||||
'."\n";
|
||||
}
|
||||
// gradient left
|
||||
if ( get_theme_mod('gradient-left','#00c196') != '#00c196' ) {
|
||||
$styles .= '
|
||||
.more-link-custom,
|
||||
.page-card-comments,
|
||||
.page-card-profile,
|
||||
.page-card-search,
|
||||
#back-to-top,
|
||||
.post-nav li i,
|
||||
.alx-tabs-nav li.active a { background: linear-gradient(90deg, '.esc_attr( get_theme_mod('gradient-left') ).' 0%, '.esc_attr( get_theme_mod('gradient-right') ).' 100%)!important; }
|
||||
'."\n";
|
||||
}
|
||||
// gradient right
|
||||
if ( get_theme_mod('gradient-right','#1b6da0') != '#1b6da0' ) {
|
||||
$styles .= '
|
||||
.more-link-custom,
|
||||
.page-card-comments,
|
||||
.page-card-profile,
|
||||
.page-card-search,
|
||||
#back-to-top,
|
||||
.post-nav li i,
|
||||
.alx-tabs-nav li.active a { background: linear-gradient(90deg, '.esc_attr( get_theme_mod('gradient-left') ).' 0%, '.esc_attr( get_theme_mod('gradient-right') ).' 100%)!important; }
|
||||
'."\n";
|
||||
}
|
||||
// color hover text
|
||||
if ( get_theme_mod('color-hover-text','#0e979b') != '#0e979b' ) {
|
||||
$styles .= '
|
||||
a:hover { color: '.esc_attr( get_theme_mod('color-hover-text') ).'; }
|
||||
.widget > ul li a:hover:before,
|
||||
.widget_nav_menu > div > ul li a:hover:before { background: '.esc_attr( get_theme_mod('color-hover-text') ).'; }
|
||||
'."\n";
|
||||
}
|
||||
// background color
|
||||
if ( get_theme_mod('color-background','#f6f7fa') != '#f6f7fa' ) {
|
||||
$styles .= '
|
||||
.canvas-inner { background: '.esc_attr( get_theme_mod('color-background') ).'; }
|
||||
'."\n";
|
||||
}
|
||||
// header logo max-height
|
||||
if ( get_theme_mod('logo-max-height','60') != '60' ) {
|
||||
$styles .= '.site-title a img { max-height: '.esc_attr( get_theme_mod('logo-max-height') ).'px; }'."\n";
|
||||
}
|
||||
// header text color
|
||||
if ( get_theme_mod( 'header_textcolor' ) != '' ) {
|
||||
$styles .= '.site-title a, .site-description { color: #'.esc_attr( get_theme_mod( 'header_textcolor' ) ).'; }'."\n";
|
||||
}
|
||||
if ( get_theme_mod('dark','off') == 'on' ) {
|
||||
wp_add_inline_style( 'dashwall-dark', $styles );
|
||||
} else {
|
||||
wp_add_inline_style( 'dashwall-style', $styles );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'dashwall_dynamic_css' );
|
BIN
functions/images/col-1c.png
Normal file
After Width: | Height: | Size: 138 B |
BIN
functions/images/col-2cl.png
Normal file
After Width: | Height: | Size: 187 B |
BIN
functions/images/col-2cr.png
Normal file
After Width: | Height: | Size: 190 B |
BIN
functions/images/col-3cl.png
Normal file
After Width: | Height: | Size: 198 B |
BIN
functions/images/col-3cm.png
Normal file
After Width: | Height: | Size: 179 B |
BIN
functions/images/col-3cr.png
Normal file
After Width: | Height: | Size: 137 B |
BIN
functions/images/footer-widgets-0.png
Normal file
After Width: | Height: | Size: 138 B |
BIN
functions/images/footer-widgets-1.png
Normal file
After Width: | Height: | Size: 139 B |
BIN
functions/images/footer-widgets-2.png
Normal file
After Width: | Height: | Size: 148 B |
BIN
functions/images/footer-widgets-3.png
Normal file
After Width: | Height: | Size: 146 B |
BIN
functions/images/footer-widgets-4.png
Normal file
After Width: | Height: | Size: 144 B |
BIN
functions/images/layout-off.png
Normal file
After Width: | Height: | Size: 630 B |
21
functions/kirki/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2023 Themeum
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
BIN
functions/kirki/assets/images/1c.png
Normal file
After Width: | Height: | Size: 786 B |
BIN
functions/kirki/assets/images/2cl.png
Normal file
After Width: | Height: | Size: 866 B |
BIN
functions/kirki/assets/images/2cr.png
Normal file
After Width: | Height: | Size: 869 B |
BIN
functions/kirki/assets/images/3cl.png
Normal file
After Width: | Height: | Size: 929 B |
BIN
functions/kirki/assets/images/3cm.png
Normal file
After Width: | Height: | Size: 932 B |
BIN
functions/kirki/assets/images/3cr.png
Normal file
After Width: | Height: | Size: 935 B |
BIN
functions/kirki/assets/images/featured-plugin-banner.jpg
Normal file
After Width: | Height: | Size: 342 KiB |
BIN
functions/kirki/assets/images/jquery.fs.stepper-arrows.png
Normal file
After Width: | Height: | Size: 306 B |
BIN
functions/kirki/assets/images/kirki-bottom.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
91
functions/kirki/assets/images/kirki-bottom.svg
Normal file
|
@ -0,0 +1,91 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="71.497665"
|
||||
height="23.886881"
|
||||
version="1.1"
|
||||
xml:space="preserve"
|
||||
style="clip-rule:evenodd;fill-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1"
|
||||
id="svg2"
|
||||
inkscape:version="0.91 r13725"
|
||||
sodipodi:docname="kirki-bottom.svg"><metadata
|
||||
id="metadata56"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs54" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1871"
|
||||
inkscape:window-height="1056"
|
||||
id="namedview52"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:zoom="4.6669048"
|
||||
inkscape:cx="-1.0852472"
|
||||
inkscape:cy="-7.0625365"
|
||||
inkscape:window-x="49"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg2" /><g
|
||||
id="g4242"
|
||||
transform="translate(-3.71284,-0.18012)"
|
||||
inkscape:export-xdpi="94"
|
||||
inkscape:export-ydpi="94"><path
|
||||
inkscape:export-ydpi="94.19397"
|
||||
inkscape:export-xdpi="94.19397"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path46"
|
||||
style="fill:none;stroke:#000000;stroke-width:0.2;stroke-miterlimit:1;stroke-dasharray:none"
|
||||
d="m 10.4064,22.5387 -0.3276,0 0,1.4283 -1.65866,0 -0.31673,-2.9188 C 5.488,18.886 3.81284,15.6275 3.81284,12.0084 c 0,-2.71119 0.9401,-5.22001 2.5246,-7.23473 L 6.0704,2.31269 l 2.90602,0 C 10.8759,1.02464 13.1284,0.28012 15.5411,0.28012 c 2.4127,0 4.6652,0.74452 6.5647,2.03257 l 2.8545,0 -0.2609,2.40411 c 1.6102,2.01928 2.57,4.55213 2.57,7.2916 0,3.6568 -1.7103,6.9454 -4.3471,9.0859 l -0.3117,2.8727 -1.6586,0 0,-1.4283 -0.2761,0 c -1.5432,0.7637 -3.2923,1.1979 -5.1348,1.1979 -1.8425,0 -3.5916,-0.4342 -5.1347,-1.1979 z" /><g
|
||||
inkscape:export-ydpi="94.19397"
|
||||
inkscape:export-xdpi="94.19397"
|
||||
style="stroke-width:0.2;stroke-miterlimit:1;stroke-dasharray:none"
|
||||
id="g48"><path
|
||||
d="m 15.4462,11.8498 c 3.4224,0 6.1968,2.104 6.1968,4.6994 0,2.5955 -2.7744,4.6995 -6.1968,4.6995 -3.4224,0 -6.19678,-2.104 -6.19678,-4.6995 0,-2.5954 2.77438,-4.6994 6.19678,-4.6994 z m -1.9811,2.9947 c 0.5725,0 1.0366,0.8148 1.0366,1.8199 0,1.0051 -0.4641,1.8199 -1.0366,1.8199 -0.5725,0 -1.0366,-0.8148 -1.0366,-1.8199 0,-1.0051 0.4641,-1.8199 1.0366,-1.8199 z m 4.0544,0 c 0.5726,0 1.0367,0.8148 1.0367,1.8199 0,1.0051 -0.4641,1.8199 -1.0367,1.8199 -0.5725,0 -1.0366,-0.8148 -1.0366,-1.8199 0,-1.0051 0.4641,-1.8199 1.0366,-1.8199 z"
|
||||
style="fill:none;stroke:#000000;stroke-width:0.2;stroke-miterlimit:1;stroke-dasharray:none"
|
||||
id="path50"
|
||||
inkscape:connector-curvature="0" /></g></g><g
|
||||
id="g20"
|
||||
style="fill:#000000;fill-opacity:0.20408164"
|
||||
inkscape:export-xdpi="94.19397"
|
||||
inkscape:export-ydpi="94.19397"
|
||||
transform="matrix(0.34650485,0,0,0.34650485,30.267064,8.7780735)"><text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:40px;line-height:125%;font-family:Roboto;-inkscape-font-specification:'Roboto Light';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:0.20408164;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
x="-7.2853427"
|
||||
y="42.141983"
|
||||
id="text4234"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4236"
|
||||
x="-7.2853427"
|
||||
y="42.141983">toolkit</tspan></text>
|
||||
</g><text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:15.76700211px;line-height:125%;font-family:'Roboto Slab';-inkscape-font-specification:'Roboto Slab Bold';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:0.10204079;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
x="27.568701"
|
||||
y="11.573637"
|
||||
id="text4238"
|
||||
sodipodi:linespacing="125%"
|
||||
inkscape:export-xdpi="94"
|
||||
inkscape:export-ydpi="94"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4240"
|
||||
x="27.568701"
|
||||
y="11.573637">KIRKI</tspan></text>
|
||||
</svg>
|
After Width: | Height: | Size: 4.8 KiB |
BIN
functions/kirki/assets/images/kirki-logo-rounded.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
functions/kirki/assets/images/kirki-logo-square-white.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
functions/kirki/assets/images/kirki-logo-square.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
107
functions/kirki/composer.json
Normal file
|
@ -0,0 +1,107 @@
|
|||
{
|
||||
"name": "kirki-framework/kirki",
|
||||
"type": "library",
|
||||
"version": "4.2.0",
|
||||
"keywords": [
|
||||
"WordPress",
|
||||
"Customizer"
|
||||
],
|
||||
"description": "Extending the WordPress customizer",
|
||||
"homepage": "https://kirki.org",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kirki Framework",
|
||||
"email": "connect@mapsteps.com"
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
"vendor-dir": "kirki-composer",
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true,
|
||||
"composer/installers": true
|
||||
}
|
||||
},
|
||||
"include-path": [
|
||||
".",
|
||||
"core"
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Kirki\\Compatibility\\": [
|
||||
"kirki-packages/compatibility/src"
|
||||
],
|
||||
"Kirki\\Data\\": [
|
||||
"kirki-packages/data-option/src"
|
||||
],
|
||||
"Kirki\\Field\\": [
|
||||
"kirki-packages/field/src/Field",
|
||||
"kirki-packages/field-background/src",
|
||||
"kirki-packages/field-dimensions/src",
|
||||
"kirki-packages/field-fontawesome/src",
|
||||
"kirki-packages/field-multicolor/src/Field",
|
||||
"kirki-packages/field-multicolor/src",
|
||||
"kirki-packages/field-typography/src/Field",
|
||||
"kirki-packages/field-typography/src"
|
||||
],
|
||||
"Kirki\\Module\\": [
|
||||
"kirki-packages/module-css/src",
|
||||
"kirki-packages/module-editor-styles/src",
|
||||
"kirki-packages/module-field-dependencies/src",
|
||||
"kirki-packages/module-postmessage/src",
|
||||
"kirki-packages/module-preset/src",
|
||||
"kirki-packages/module-section-icons/src",
|
||||
"kirki-packages/module-selective-refresh/src",
|
||||
"kirki-packages/module-tooltips/src",
|
||||
"kirki-packages/module-webfonts/src"
|
||||
],
|
||||
"Kirki\\Util\\": [
|
||||
"kirki-packages/util/src"
|
||||
],
|
||||
"Kirki\\Settings\\": [
|
||||
"kirki-packages/settings/src"
|
||||
],
|
||||
"Kirki\\": [
|
||||
"kirki-packages/control-base/src",
|
||||
"kirki-packages/control-checkbox/src",
|
||||
"kirki-packages/control-code/src",
|
||||
"kirki-packages/control-color/src",
|
||||
"kirki-packages/control-color-palette/src",
|
||||
"kirki-packages/control-cropped-image/src",
|
||||
"kirki-packages/control-custom/src",
|
||||
"kirki-packages/control-dashicons/src",
|
||||
"kirki-packages/control-date/src",
|
||||
"kirki-packages/control-dimension/src",
|
||||
"kirki-packages/control-editor/src",
|
||||
"kirki-packages/control-generic/src",
|
||||
"kirki-packages/control-image/src",
|
||||
"kirki-packages/control-multicheck/src",
|
||||
"kirki-packages/control-palette/src",
|
||||
"kirki-packages/control-radio/src",
|
||||
"kirki-packages/control-react-colorful/src",
|
||||
"kirki-packages/control-react-select/src",
|
||||
"kirki-packages/control-repeater/src",
|
||||
"kirki-packages/control-select/src",
|
||||
"kirki-packages/control-slider/src",
|
||||
"kirki-packages/control-sortable/src",
|
||||
"kirki-packages/control-upload/src",
|
||||
"kirki-packages/field/src",
|
||||
"kirki-packages/googlefonts/src",
|
||||
"kirki-packages/l10n/src",
|
||||
"kirki-packages/module-panels/src",
|
||||
"kirki-packages/module-sections/src",
|
||||
"kirki-packages/url-getter/src"
|
||||
]
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/installers": "*",
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "*",
|
||||
"wp-coding-standards/wpcs": "*",
|
||||
"phpcompatibility/phpcompatibility-wp": "*",
|
||||
"wptrt/wpthemereview": "dev-develop"
|
||||
}
|
||||
}
|
605
functions/kirki/composer.lock
generated
Normal file
|
@ -0,0 +1,605 @@
|
|||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "1cdc638108e6a3cc36d943f05ad417c4",
|
||||
"packages": [],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "composer/installers",
|
||||
"version": "v2.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/composer/installers.git",
|
||||
"reference": "c29dc4b93137acb82734f672c37e029dfbd95b35"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/composer/installers/zipball/c29dc4b93137acb82734f672c37e029dfbd95b35",
|
||||
"reference": "c29dc4b93137acb82734f672c37e029dfbd95b35",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-plugin-api": "^1.0 || ^2.0",
|
||||
"php": "^7.2 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/composer": "1.6.* || ^2.0",
|
||||
"composer/semver": "^1 || ^3",
|
||||
"phpstan/phpstan": "^0.12.55",
|
||||
"phpstan/phpstan-phpunit": "^0.12.16",
|
||||
"symfony/phpunit-bridge": "^5.3",
|
||||
"symfony/process": "^5"
|
||||
},
|
||||
"type": "composer-plugin",
|
||||
"extra": {
|
||||
"class": "Composer\\Installers\\Plugin",
|
||||
"branch-alias": {
|
||||
"dev-main": "2.x-dev"
|
||||
},
|
||||
"plugin-modifies-install-path": true
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Composer\\Installers\\": "src/Composer/Installers"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kyle Robinson Young",
|
||||
"email": "kyle@dontkry.com",
|
||||
"homepage": "https://github.com/shama"
|
||||
}
|
||||
],
|
||||
"description": "A multi-framework Composer library installer",
|
||||
"homepage": "https://composer.github.io/installers/",
|
||||
"keywords": [
|
||||
"Dolibarr",
|
||||
"Eliasis",
|
||||
"Hurad",
|
||||
"ImageCMS",
|
||||
"Kanboard",
|
||||
"Lan Management System",
|
||||
"MODX Evo",
|
||||
"MantisBT",
|
||||
"Mautic",
|
||||
"Maya",
|
||||
"OXID",
|
||||
"Plentymarkets",
|
||||
"Porto",
|
||||
"RadPHP",
|
||||
"SMF",
|
||||
"Starbug",
|
||||
"Thelia",
|
||||
"Whmcs",
|
||||
"WolfCMS",
|
||||
"agl",
|
||||
"annotatecms",
|
||||
"attogram",
|
||||
"bitrix",
|
||||
"cakephp",
|
||||
"chef",
|
||||
"cockpit",
|
||||
"codeigniter",
|
||||
"concrete5",
|
||||
"croogo",
|
||||
"dokuwiki",
|
||||
"drupal",
|
||||
"eZ Platform",
|
||||
"elgg",
|
||||
"expressionengine",
|
||||
"fuelphp",
|
||||
"grav",
|
||||
"installer",
|
||||
"itop",
|
||||
"known",
|
||||
"kohana",
|
||||
"laravel",
|
||||
"lavalite",
|
||||
"lithium",
|
||||
"magento",
|
||||
"majima",
|
||||
"mako",
|
||||
"matomo",
|
||||
"mediawiki",
|
||||
"miaoxing",
|
||||
"modulework",
|
||||
"modx",
|
||||
"moodle",
|
||||
"osclass",
|
||||
"pantheon",
|
||||
"phpbb",
|
||||
"piwik",
|
||||
"ppi",
|
||||
"processwire",
|
||||
"puppet",
|
||||
"pxcms",
|
||||
"reindex",
|
||||
"roundcube",
|
||||
"shopware",
|
||||
"silverstripe",
|
||||
"sydes",
|
||||
"sylius",
|
||||
"tastyigniter",
|
||||
"wordpress",
|
||||
"yawik",
|
||||
"zend",
|
||||
"zikula"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/composer/installers/issues",
|
||||
"source": "https://github.com/composer/installers/tree/v2.2.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://packagist.com",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/composer",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-08-20T06:45:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "dealerdirect/phpcodesniffer-composer-installer",
|
||||
"version": "v1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHPCSStandards/composer-installer.git",
|
||||
"reference": "4be43904336affa5c2f70744a348312336afd0da"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da",
|
||||
"reference": "4be43904336affa5c2f70744a348312336afd0da",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-plugin-api": "^1.0 || ^2.0",
|
||||
"php": ">=5.4",
|
||||
"squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/composer": "*",
|
||||
"ext-json": "*",
|
||||
"ext-zip": "*",
|
||||
"php-parallel-lint/php-parallel-lint": "^1.3.1",
|
||||
"phpcompatibility/php-compatibility": "^9.0",
|
||||
"yoast/phpunit-polyfills": "^1.0"
|
||||
},
|
||||
"type": "composer-plugin",
|
||||
"extra": {
|
||||
"class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Franck Nijhof",
|
||||
"email": "franck.nijhof@dealerdirect.com",
|
||||
"homepage": "http://www.frenck.nl",
|
||||
"role": "Developer / IT Manager"
|
||||
},
|
||||
{
|
||||
"name": "Contributors",
|
||||
"homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors"
|
||||
}
|
||||
],
|
||||
"description": "PHP_CodeSniffer Standards Composer Installer Plugin",
|
||||
"homepage": "http://www.dealerdirect.com",
|
||||
"keywords": [
|
||||
"PHPCodeSniffer",
|
||||
"PHP_CodeSniffer",
|
||||
"code quality",
|
||||
"codesniffer",
|
||||
"composer",
|
||||
"installer",
|
||||
"phpcbf",
|
||||
"phpcs",
|
||||
"plugin",
|
||||
"qa",
|
||||
"quality",
|
||||
"standard",
|
||||
"standards",
|
||||
"style guide",
|
||||
"stylecheck",
|
||||
"tests"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/PHPCSStandards/composer-installer/issues",
|
||||
"source": "https://github.com/PHPCSStandards/composer-installer"
|
||||
},
|
||||
"time": "2023-01-05T11:28:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpcompatibility/php-compatibility",
|
||||
"version": "9.3.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
|
||||
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
|
||||
"reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3",
|
||||
"squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
|
||||
},
|
||||
"conflict": {
|
||||
"squizlabs/php_codesniffer": "2.6.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
|
||||
},
|
||||
"suggest": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
|
||||
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
||||
},
|
||||
"type": "phpcodesniffer-standard",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL-3.0-or-later"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Wim Godden",
|
||||
"homepage": "https://github.com/wimg",
|
||||
"role": "lead"
|
||||
},
|
||||
{
|
||||
"name": "Juliette Reinders Folmer",
|
||||
"homepage": "https://github.com/jrfnl",
|
||||
"role": "lead"
|
||||
},
|
||||
{
|
||||
"name": "Contributors",
|
||||
"homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
|
||||
}
|
||||
],
|
||||
"description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
|
||||
"homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"phpcs",
|
||||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues",
|
||||
"source": "https://github.com/PHPCompatibility/PHPCompatibility"
|
||||
},
|
||||
"time": "2019-12-27T09:44:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpcompatibility/phpcompatibility-paragonie",
|
||||
"version": "1.3.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
|
||||
"reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/bba5a9dfec7fcfbd679cfaf611d86b4d3759da26",
|
||||
"reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"phpcompatibility/php-compatibility": "^9.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
|
||||
"paragonie/random_compat": "dev-master",
|
||||
"paragonie/sodium_compat": "dev-master"
|
||||
},
|
||||
"suggest": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
|
||||
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
||||
},
|
||||
"type": "phpcodesniffer-standard",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL-3.0-or-later"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Wim Godden",
|
||||
"role": "lead"
|
||||
},
|
||||
{
|
||||
"name": "Juliette Reinders Folmer",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.",
|
||||
"homepage": "http://phpcompatibility.com/",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"paragonie",
|
||||
"phpcs",
|
||||
"polyfill",
|
||||
"standards",
|
||||
"static analysis"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues",
|
||||
"source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie"
|
||||
},
|
||||
"time": "2022-10-25T01:46:02+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpcompatibility/phpcompatibility-wp",
|
||||
"version": "2.1.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
|
||||
"reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5",
|
||||
"reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"phpcompatibility/php-compatibility": "^9.0",
|
||||
"phpcompatibility/phpcompatibility-paragonie": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.7"
|
||||
},
|
||||
"suggest": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
|
||||
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
||||
},
|
||||
"type": "phpcodesniffer-standard",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL-3.0-or-later"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Wim Godden",
|
||||
"role": "lead"
|
||||
},
|
||||
{
|
||||
"name": "Juliette Reinders Folmer",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
|
||||
"homepage": "http://phpcompatibility.com/",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"phpcs",
|
||||
"standards",
|
||||
"static analysis",
|
||||
"wordpress"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues",
|
||||
"source": "https://github.com/PHPCompatibility/PHPCompatibilityWP"
|
||||
},
|
||||
"time": "2022-10-24T09:00:36+00:00"
|
||||
},
|
||||
{
|
||||
"name": "squizlabs/php_codesniffer",
|
||||
"version": "3.7.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
||||
"reference": "1359e176e9307e906dc3d890bcc9603ff6d90619"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619",
|
||||
"reference": "1359e176e9307e906dc3d890bcc9603ff6d90619",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-simplexml": "*",
|
||||
"ext-tokenizer": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
||||
},
|
||||
"bin": [
|
||||
"bin/phpcs",
|
||||
"bin/phpcbf"
|
||||
],
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.x-dev"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Greg Sherwood",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
|
||||
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
|
||||
"keywords": [
|
||||
"phpcs",
|
||||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
|
||||
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
|
||||
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
|
||||
},
|
||||
"time": "2022-06-18T07:21:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "wp-coding-standards/wpcs",
|
||||
"version": "2.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/WordPress/WordPress-Coding-Standards.git",
|
||||
"reference": "7da1894633f168fe244afc6de00d141f27517b62"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7da1894633f168fe244afc6de00d141f27517b62",
|
||||
"reference": "7da1894633f168fe244afc6de00d141f27517b62",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4",
|
||||
"squizlabs/php_codesniffer": "^3.3.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6",
|
||||
"phpcompatibility/php-compatibility": "^9.0",
|
||||
"phpcsstandards/phpcsdevtools": "^1.0",
|
||||
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
||||
},
|
||||
"suggest": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
|
||||
},
|
||||
"type": "phpcodesniffer-standard",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Contributors",
|
||||
"homepage": "https://github.com/WordPress/WordPress-Coding-Standards/graphs/contributors"
|
||||
}
|
||||
],
|
||||
"description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
|
||||
"keywords": [
|
||||
"phpcs",
|
||||
"standards",
|
||||
"wordpress"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/WordPress/WordPress-Coding-Standards/issues",
|
||||
"source": "https://github.com/WordPress/WordPress-Coding-Standards",
|
||||
"wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki"
|
||||
},
|
||||
"time": "2020-05-13T23:57:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "wptrt/wpthemereview",
|
||||
"version": "dev-develop",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/WPTT/WPThemeReview.git",
|
||||
"reference": "15684d0852fe90d807c2ae7746dea1302b74b4bd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/WPTT/WPThemeReview/zipball/15684d0852fe90d807c2ae7746dea1302b74b4bd",
|
||||
"reference": "15684d0852fe90d807c2ae7746dea1302b74b4bd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4",
|
||||
"phpcompatibility/phpcompatibility-wp": "^2.0",
|
||||
"squizlabs/php_codesniffer": "^3.3.1",
|
||||
"wp-coding-standards/wpcs": "^2.2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
|
||||
"php-parallel-lint/php-console-highlighter": "^0.5",
|
||||
"php-parallel-lint/php-parallel-lint": "^1.0",
|
||||
"phpcompatibility/php-compatibility": "^9.0",
|
||||
"phpcsstandards/phpcsdevtools": "^1.0",
|
||||
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0",
|
||||
"roave/security-advisories": "dev-master"
|
||||
},
|
||||
"suggest": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
|
||||
},
|
||||
"default-branch": true,
|
||||
"type": "phpcodesniffer-standard",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Theme Review Team",
|
||||
"homepage": "https://make.wordpress.org/themes/handbook/",
|
||||
"role": "Strategy and rule setting"
|
||||
},
|
||||
{
|
||||
"name": "Ulrich Pogson",
|
||||
"homepage": "https://github.com/grappler",
|
||||
"role": "Lead developer"
|
||||
},
|
||||
{
|
||||
"name": "Juliette Reinders Folmer",
|
||||
"homepage": "https://github.com/jrfnl",
|
||||
"role": "Lead developer"
|
||||
},
|
||||
{
|
||||
"name": "Denis Žoljom",
|
||||
"homepage": "https://github.com/dingo-d",
|
||||
"role": "Plugin integration lead"
|
||||
},
|
||||
{
|
||||
"name": "Contributors",
|
||||
"homepage": "https://github.com/WPTRT/WPThemeReview/graphs/contributors"
|
||||
}
|
||||
],
|
||||
"description": "PHP_CodeSniffer rules (sniffs) to verify theme compliance with the rules for theme hosting on wordpress.org",
|
||||
"homepage": "https://make.wordpress.org/themes/handbook/review/",
|
||||
"keywords": [
|
||||
"phpcs",
|
||||
"standards",
|
||||
"themes",
|
||||
"wordpress"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/WPTRT/WPThemeReview/issues",
|
||||
"source": "https://github.com/WPTRT/WPThemeReview"
|
||||
},
|
||||
"time": "2021-06-22T06:10:49+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": {
|
||||
"wptrt/wpthemereview": 20
|
||||
},
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=7.0"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.3.0"
|
||||
}
|
17
functions/kirki/inc/bootstrap.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* Bootstrap the plugin.
|
||||
*
|
||||
* @since 4.0
|
||||
* @package kirki
|
||||
*/
|
||||
|
||||
/**
|
||||
* Instantiate oblects.
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
new \Kirki\Compatibility\Aliases();
|
||||
new \Kirki\Compatibility\Scripts();
|
||||
new \Kirki\Compatibility\Deprecated();
|
||||
new \Kirki\Data\Option();
|
12
functions/kirki/kirki-composer/autoload.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
if (PHP_VERSION_ID < 50600) {
|
||||
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit734b74506bf23405b8270b65bdba2dd6::getLoader();
|
572
functions/kirki/kirki-composer/composer/ClassLoader.php
Normal file
|
@ -0,0 +1,572 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
/**
|
||||
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
||||
*
|
||||
* $loader = new \Composer\Autoload\ClassLoader();
|
||||
*
|
||||
* // register classes with namespaces
|
||||
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||
* $loader->add('Symfony', __DIR__.'/framework');
|
||||
*
|
||||
* // activate the autoloader
|
||||
* $loader->register();
|
||||
*
|
||||
* // to enable searching the include path (eg. for PEAR packages)
|
||||
* $loader->setUseIncludePath(true);
|
||||
*
|
||||
* In this example, if you try to use a class in the Symfony\Component
|
||||
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||
* the autoloader will first look for the class under the component/
|
||||
* directory, and it will then fallback to the framework/ directory if not
|
||||
* found before giving up.
|
||||
*
|
||||
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @see https://www.php-fig.org/psr/psr-0/
|
||||
* @see https://www.php-fig.org/psr/psr-4/
|
||||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
/** @var ?string */
|
||||
private $vendorDir;
|
||||
|
||||
// PSR-4
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, array<string, int>>
|
||||
*/
|
||||
private $prefixLengthsPsr4 = array();
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, array<int, string>>
|
||||
*/
|
||||
private $prefixDirsPsr4 = array();
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, string>
|
||||
*/
|
||||
private $fallbackDirsPsr4 = array();
|
||||
|
||||
// PSR-0
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, array<string, string[]>>
|
||||
*/
|
||||
private $prefixesPsr0 = array();
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, string>
|
||||
*/
|
||||
private $fallbackDirsPsr0 = array();
|
||||
|
||||
/** @var bool */
|
||||
private $useIncludePath = false;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
* @psalm-var array<string, string>
|
||||
*/
|
||||
private $classMap = array();
|
||||
|
||||
/** @var bool */
|
||||
private $classMapAuthoritative = false;
|
||||
|
||||
/**
|
||||
* @var bool[]
|
||||
* @psalm-var array<string, bool>
|
||||
*/
|
||||
private $missingClasses = array();
|
||||
|
||||
/** @var ?string */
|
||||
private $apcuPrefix;
|
||||
|
||||
/**
|
||||
* @var self[]
|
||||
*/
|
||||
private static $registeredLoaders = array();
|
||||
|
||||
/**
|
||||
* @param ?string $vendorDir
|
||||
*/
|
||||
public function __construct($vendorDir = null)
|
||||
{
|
||||
$this->vendorDir = $vendorDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getPrefixes()
|
||||
{
|
||||
if (!empty($this->prefixesPsr0)) {
|
||||
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
* @psalm-return array<string, array<int, string>>
|
||||
*/
|
||||
public function getPrefixesPsr4()
|
||||
{
|
||||
return $this->prefixDirsPsr4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
* @psalm-return array<string, string>
|
||||
*/
|
||||
public function getFallbackDirs()
|
||||
{
|
||||
return $this->fallbackDirsPsr0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
* @psalm-return array<string, string>
|
||||
*/
|
||||
public function getFallbackDirsPsr4()
|
||||
{
|
||||
return $this->fallbackDirsPsr4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[] Array of classname => path
|
||||
* @psalm-return array<string, string>
|
||||
*/
|
||||
public function getClassMap()
|
||||
{
|
||||
return $this->classMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $classMap Class to filename map
|
||||
* @psalm-param array<string, string> $classMap
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addClassMap(array $classMap)
|
||||
{
|
||||
if ($this->classMap) {
|
||||
$this->classMap = array_merge($this->classMap, $classMap);
|
||||
} else {
|
||||
$this->classMap = $classMap;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix, either
|
||||
* appending or prepending to the ones previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param string[]|string $paths The PSR-0 root directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr0
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$this->fallbackDirsPsr0,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$first = $prefix[0];
|
||||
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
||||
|
||||
return;
|
||||
}
|
||||
if ($prepend) {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixesPsr0[$first][$prefix]
|
||||
);
|
||||
} else {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$this->prefixesPsr0[$first][$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace, either
|
||||
* appending or prepending to the ones previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param string[]|string $paths The PSR-4 base directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addPsr4($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
// Register directories for the root namespace.
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr4
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$this->fallbackDirsPsr4,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||
// Register directories for a new namespace.
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
} elseif ($prepend) {
|
||||
// Prepend directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixDirsPsr4[$prefix]
|
||||
);
|
||||
} else {
|
||||
// Append directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$this->prefixDirsPsr4[$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix,
|
||||
* replacing any others previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param string[]|string $paths The PSR-0 base directories
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr0 = (array) $paths;
|
||||
} else {
|
||||
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace,
|
||||
* replacing any others previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param string[]|string $paths The PSR-4 base directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPsr4($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr4 = (array) $paths;
|
||||
} else {
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns on searching the include path for class files.
|
||||
*
|
||||
* @param bool $useIncludePath
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUseIncludePath($useIncludePath)
|
||||
{
|
||||
$this->useIncludePath = $useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to check if the autoloader uses the include path to check
|
||||
* for classes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getUseIncludePath()
|
||||
{
|
||||
return $this->useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns off searching the prefix and fallback directories for classes
|
||||
* that have not been registered with the class map.
|
||||
*
|
||||
* @param bool $classMapAuthoritative
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||
{
|
||||
$this->classMapAuthoritative = $classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should class lookup fail if not found in the current class map?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isClassMapAuthoritative()
|
||||
{
|
||||
return $this->classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
||||
*
|
||||
* @param string|null $apcuPrefix
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setApcuPrefix($apcuPrefix)
|
||||
{
|
||||
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The APCu prefix in use, or null if APCu caching is not enabled.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getApcuPrefix()
|
||||
{
|
||||
return $this->apcuPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this instance as an autoloader.
|
||||
*
|
||||
* @param bool $prepend Whether to prepend the autoloader or not
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register($prepend = false)
|
||||
{
|
||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||
|
||||
if (null === $this->vendorDir) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($prepend) {
|
||||
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
||||
} else {
|
||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||
self::$registeredLoaders[$this->vendorDir] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters this instance as an autoloader.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
spl_autoload_unregister(array($this, 'loadClass'));
|
||||
|
||||
if (null !== $this->vendorDir) {
|
||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
* @return true|null True if loaded, null otherwise
|
||||
*/
|
||||
public function loadClass($class)
|
||||
{
|
||||
if ($file = $this->findFile($class)) {
|
||||
includeFile($file);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the path to the file where the class is defined.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
*
|
||||
* @return string|false The path if found, false otherwise
|
||||
*/
|
||||
public function findFile($class)
|
||||
{
|
||||
// class map lookup
|
||||
if (isset($this->classMap[$class])) {
|
||||
return $this->classMap[$class];
|
||||
}
|
||||
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
||||
return false;
|
||||
}
|
||||
if (null !== $this->apcuPrefix) {
|
||||
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
||||
if ($hit) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
$file = $this->findFileWithExtension($class, '.php');
|
||||
|
||||
// Search for Hack files if we are running on HHVM
|
||||
if (false === $file && defined('HHVM_VERSION')) {
|
||||
$file = $this->findFileWithExtension($class, '.hh');
|
||||
}
|
||||
|
||||
if (null !== $this->apcuPrefix) {
|
||||
apcu_add($this->apcuPrefix.$class, $file);
|
||||
}
|
||||
|
||||
if (false === $file) {
|
||||
// Remember that this class does not exist.
|
||||
$this->missingClasses[$class] = true;
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the currently registered loaders indexed by their corresponding vendor directories.
|
||||
*
|
||||
* @return self[]
|
||||
*/
|
||||
public static function getRegisteredLoaders()
|
||||
{
|
||||
return self::$registeredLoaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $class
|
||||
* @param string $ext
|
||||
* @return string|false
|
||||
*/
|
||||
private function findFileWithExtension($class, $ext)
|
||||
{
|
||||
// PSR-4 lookup
|
||||
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||
|
||||
$first = $class[0];
|
||||
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||
$subPath = $class;
|
||||
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
||||
$subPath = substr($subPath, 0, $lastPos);
|
||||
$search = $subPath . '\\';
|
||||
if (isset($this->prefixDirsPsr4[$search])) {
|
||||
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
||||
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
||||
if (file_exists($file = $dir . $pathEnd)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-4 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 lookup
|
||||
if (false !== $pos = strrpos($class, '\\')) {
|
||||
// namespaced class name
|
||||
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||
} else {
|
||||
// PEAR-like class name
|
||||
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||
}
|
||||
|
||||
if (isset($this->prefixesPsr0[$first])) {
|
||||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 include paths.
|
||||
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope isolated include.
|
||||
*
|
||||
* Prevents access to $this/self from included files.
|
||||
*
|
||||
* @param string $file
|
||||
* @return void
|
||||
* @private
|
||||
*/
|
||||
function includeFile($file)
|
||||
{
|
||||
include $file;
|
||||
}
|
352
functions/kirki/kirki-composer/composer/InstalledVersions.php
Normal file
|
@ -0,0 +1,352 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
use Composer\Semver\VersionParser;
|
||||
|
||||
/**
|
||||
* This class is copied in every Composer installed project and available to all
|
||||
*
|
||||
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
||||
*
|
||||
* To require its presence, you can require `composer-runtime-api ^2.0`
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class InstalledVersions
|
||||
{
|
||||
/**
|
||||
* @var mixed[]|null
|
||||
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
|
||||
*/
|
||||
private static $installed;
|
||||
|
||||
/**
|
||||
* @var bool|null
|
||||
*/
|
||||
private static $canGetVendors;
|
||||
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
private static $installedByVendor = array();
|
||||
|
||||
/**
|
||||
* Returns a list of all package names which are present, either by being installed, replaced or provided
|
||||
*
|
||||
* @return string[]
|
||||
* @psalm-return list<string>
|
||||
*/
|
||||
public static function getInstalledPackages()
|
||||
{
|
||||
$packages = array();
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
$packages[] = array_keys($installed['versions']);
|
||||
}
|
||||
|
||||
if (1 === \count($packages)) {
|
||||
return $packages[0];
|
||||
}
|
||||
|
||||
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all package names with a specific type e.g. 'library'
|
||||
*
|
||||
* @param string $type
|
||||
* @return string[]
|
||||
* @psalm-return list<string>
|
||||
*/
|
||||
public static function getInstalledPackagesByType($type)
|
||||
{
|
||||
$packagesByType = array();
|
||||
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
foreach ($installed['versions'] as $name => $package) {
|
||||
if (isset($package['type']) && $package['type'] === $type) {
|
||||
$packagesByType[] = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $packagesByType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given package is installed
|
||||
*
|
||||
* This also returns true if the package name is provided or replaced by another package
|
||||
*
|
||||
* @param string $packageName
|
||||
* @param bool $includeDevRequirements
|
||||
* @return bool
|
||||
*/
|
||||
public static function isInstalled($packageName, $includeDevRequirements = true)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (isset($installed['versions'][$packageName])) {
|
||||
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given package satisfies a version constraint
|
||||
*
|
||||
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
|
||||
*
|
||||
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
|
||||
*
|
||||
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
|
||||
* @param string $packageName
|
||||
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
|
||||
* @return bool
|
||||
*/
|
||||
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
||||
{
|
||||
$constraint = $parser->parseConstraints($constraint);
|
||||
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
||||
|
||||
return $provided->matches($constraint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a version constraint representing all the range(s) which are installed for a given package
|
||||
*
|
||||
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
|
||||
* whether a given version of a package is installed, and not just whether it exists
|
||||
*
|
||||
* @param string $packageName
|
||||
* @return string Version constraint usable with composer/semver
|
||||
*/
|
||||
public static function getVersionRanges($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ranges = array();
|
||||
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
||||
}
|
||||
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
||||
}
|
||||
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
||||
}
|
||||
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
||||
}
|
||||
|
||||
return implode(' || ', $ranges);
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||
*/
|
||||
public static function getVersion($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['version'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['version'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||
*/
|
||||
public static function getPrettyVersion($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['pretty_version'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
|
||||
*/
|
||||
public static function getReference($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['reference'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['reference'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
|
||||
*/
|
||||
public static function getInstallPath($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
|
||||
*/
|
||||
public static function getRootPackage()
|
||||
{
|
||||
$installed = self::getInstalled();
|
||||
|
||||
return $installed[0]['root'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the raw installed.php data for custom implementations
|
||||
*
|
||||
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
||||
* @return array[]
|
||||
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
|
||||
*/
|
||||
public static function getRawData()
|
||||
{
|
||||
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
|
||||
|
||||
if (null === self::$installed) {
|
||||
// only require the installed.php file if this file is loaded from its dumped location,
|
||||
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||
self::$installed = include __DIR__ . '/installed.php';
|
||||
} else {
|
||||
self::$installed = array();
|
||||
}
|
||||
}
|
||||
|
||||
return self::$installed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
||||
*
|
||||
* @return array[]
|
||||
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
public static function getAllRawData()
|
||||
{
|
||||
return self::getInstalled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Lets you reload the static array from another file
|
||||
*
|
||||
* This is only useful for complex integrations in which a project needs to use
|
||||
* this class but then also needs to execute another project's autoloader in process,
|
||||
* and wants to ensure both projects have access to their version of installed.php.
|
||||
*
|
||||
* A typical case would be PHPUnit, where it would need to make sure it reads all
|
||||
* the data it needs from this class, then call reload() with
|
||||
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
|
||||
* the project in which it runs can then also use this class safely, without
|
||||
* interference between PHPUnit's dependencies and the project's dependencies.
|
||||
*
|
||||
* @param array[] $data A vendor/composer/installed.php data set
|
||||
* @return void
|
||||
*
|
||||
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
|
||||
*/
|
||||
public static function reload($data)
|
||||
{
|
||||
self::$installed = $data;
|
||||
self::$installedByVendor = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
private static function getInstalled()
|
||||
{
|
||||
if (null === self::$canGetVendors) {
|
||||
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
||||
}
|
||||
|
||||
$installed = array();
|
||||
|
||||
if (self::$canGetVendors) {
|
||||
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
||||
if (isset(self::$installedByVendor[$vendorDir])) {
|
||||
$installed[] = self::$installedByVendor[$vendorDir];
|
||||
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
||||
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
|
||||
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
|
||||
self::$installed = $installed[count($installed) - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (null === self::$installed) {
|
||||
// only require the installed.php file if this file is loaded from its dumped location,
|
||||
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||
self::$installed = require __DIR__ . '/installed.php';
|
||||
} else {
|
||||
self::$installed = array();
|
||||
}
|
||||
}
|
||||
$installed[] = self::$installed;
|
||||
|
||||
return $installed;
|
||||
}
|
||||
}
|
21
functions/kirki/kirki-composer/composer/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
// autoload_classmap.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||
);
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
// autoload_namespaces.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
16
functions/kirki/kirki-composer/composer/autoload_psr4.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
// autoload_psr4.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Kirki\\Util\\' => array($baseDir . '/kirki-packages/util/src'),
|
||||
'Kirki\\Settings\\' => array($baseDir . '/kirki-packages/settings/src'),
|
||||
'Kirki\\Module\\' => array($baseDir . '/kirki-packages/module-css/src', $baseDir . '/kirki-packages/module-editor-styles/src', $baseDir . '/kirki-packages/module-field-dependencies/src', $baseDir . '/kirki-packages/module-postmessage/src', $baseDir . '/kirki-packages/module-preset/src', $baseDir . '/kirki-packages/module-section-icons/src', $baseDir . '/kirki-packages/module-selective-refresh/src', $baseDir . '/kirki-packages/module-tooltips/src', $baseDir . '/kirki-packages/module-webfonts/src'),
|
||||
'Kirki\\Field\\' => array($baseDir . '/kirki-packages/field/src/Field', $baseDir . '/kirki-packages/field-background/src', $baseDir . '/kirki-packages/field-dimensions/src', $baseDir . '/kirki-packages/field-fontawesome/src', $baseDir . '/kirki-packages/field-multicolor/src/Field', $baseDir . '/kirki-packages/field-multicolor/src', $baseDir . '/kirki-packages/field-typography/src/Field', $baseDir . '/kirki-packages/field-typography/src'),
|
||||
'Kirki\\Data\\' => array($baseDir . '/kirki-packages/data-option/src'),
|
||||
'Kirki\\Compatibility\\' => array($baseDir . '/kirki-packages/compatibility/src'),
|
||||
'Kirki\\' => array($baseDir . '/kirki-packages/control-base/src', $baseDir . '/kirki-packages/control-checkbox/src', $baseDir . '/kirki-packages/control-code/src', $baseDir . '/kirki-packages/control-color/src', $baseDir . '/kirki-packages/control-color-palette/src', $baseDir . '/kirki-packages/control-cropped-image/src', $baseDir . '/kirki-packages/control-custom/src', $baseDir . '/kirki-packages/control-dashicons/src', $baseDir . '/kirki-packages/control-date/src', $baseDir . '/kirki-packages/control-dimension/src', $baseDir . '/kirki-packages/control-editor/src', $baseDir . '/kirki-packages/control-generic/src', $baseDir . '/kirki-packages/control-image/src', $baseDir . '/kirki-packages/control-multicheck/src', $baseDir . '/kirki-packages/control-palette/src', $baseDir . '/kirki-packages/control-radio/src', $baseDir . '/kirki-packages/control-react-colorful/src', $baseDir . '/kirki-packages/control-react-select/src', $baseDir . '/kirki-packages/control-repeater/src', $baseDir . '/kirki-packages/control-select/src', $baseDir . '/kirki-packages/control-slider/src', $baseDir . '/kirki-packages/control-sortable/src', $baseDir . '/kirki-packages/control-upload/src', $baseDir . '/kirki-packages/field/src', $baseDir . '/kirki-packages/googlefonts/src', $baseDir . '/kirki-packages/l10n/src', $baseDir . '/kirki-packages/module-panels/src', $baseDir . '/kirki-packages/module-sections/src', $baseDir . '/kirki-packages/url-getter/src'),
|
||||
);
|
42
functions/kirki/kirki-composer/composer/autoload_real.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit734b74506bf23405b8270b65bdba2dd6
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function loadClassLoader($class)
|
||||
{
|
||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||
require __DIR__ . '/ClassLoader.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Composer\Autoload\ClassLoader
|
||||
*/
|
||||
public static function getLoader()
|
||||
{
|
||||
if (null !== self::$loader) {
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit734b74506bf23405b8270b65bdba2dd6', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit734b74506bf23405b8270b65bdba2dd6', 'loadClassLoader'));
|
||||
|
||||
$includePaths = require __DIR__ . '/include_paths.php';
|
||||
$includePaths[] = get_include_path();
|
||||
set_include_path(implode(PATH_SEPARATOR, $includePaths));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit734b74506bf23405b8270b65bdba2dd6::getInitializer($loader));
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
109
functions/kirki/kirki-composer/composer/autoload_static.php
Normal file
|
@ -0,0 +1,109 @@
|
|||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit734b74506bf23405b8270b65bdba2dd6
|
||||
{
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'K' =>
|
||||
array (
|
||||
'Kirki\\Util\\' => 11,
|
||||
'Kirki\\Settings\\' => 15,
|
||||
'Kirki\\Module\\' => 13,
|
||||
'Kirki\\Field\\' => 12,
|
||||
'Kirki\\Data\\' => 11,
|
||||
'Kirki\\Compatibility\\' => 20,
|
||||
'Kirki\\' => 6,
|
||||
),
|
||||
);
|
||||
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'Kirki\\Util\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/kirki-packages/util/src',
|
||||
),
|
||||
'Kirki\\Settings\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/kirki-packages/settings/src',
|
||||
),
|
||||
'Kirki\\Module\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/kirki-packages/module-css/src',
|
||||
1 => __DIR__ . '/../..' . '/kirki-packages/module-editor-styles/src',
|
||||
2 => __DIR__ . '/../..' . '/kirki-packages/module-field-dependencies/src',
|
||||
3 => __DIR__ . '/../..' . '/kirki-packages/module-postmessage/src',
|
||||
4 => __DIR__ . '/../..' . '/kirki-packages/module-preset/src',
|
||||
5 => __DIR__ . '/../..' . '/kirki-packages/module-section-icons/src',
|
||||
6 => __DIR__ . '/../..' . '/kirki-packages/module-selective-refresh/src',
|
||||
7 => __DIR__ . '/../..' . '/kirki-packages/module-tooltips/src',
|
||||
8 => __DIR__ . '/../..' . '/kirki-packages/module-webfonts/src',
|
||||
),
|
||||
'Kirki\\Field\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/kirki-packages/field/src/Field',
|
||||
1 => __DIR__ . '/../..' . '/kirki-packages/field-background/src',
|
||||
2 => __DIR__ . '/../..' . '/kirki-packages/field-dimensions/src',
|
||||
3 => __DIR__ . '/../..' . '/kirki-packages/field-fontawesome/src',
|
||||
4 => __DIR__ . '/../..' . '/kirki-packages/field-multicolor/src/Field',
|
||||
5 => __DIR__ . '/../..' . '/kirki-packages/field-multicolor/src',
|
||||
6 => __DIR__ . '/../..' . '/kirki-packages/field-typography/src/Field',
|
||||
7 => __DIR__ . '/../..' . '/kirki-packages/field-typography/src',
|
||||
),
|
||||
'Kirki\\Data\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/kirki-packages/data-option/src',
|
||||
),
|
||||
'Kirki\\Compatibility\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/kirki-packages/compatibility/src',
|
||||
),
|
||||
'Kirki\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/kirki-packages/control-base/src',
|
||||
1 => __DIR__ . '/../..' . '/kirki-packages/control-checkbox/src',
|
||||
2 => __DIR__ . '/../..' . '/kirki-packages/control-code/src',
|
||||
3 => __DIR__ . '/../..' . '/kirki-packages/control-color/src',
|
||||
4 => __DIR__ . '/../..' . '/kirki-packages/control-color-palette/src',
|
||||
5 => __DIR__ . '/../..' . '/kirki-packages/control-cropped-image/src',
|
||||
6 => __DIR__ . '/../..' . '/kirki-packages/control-custom/src',
|
||||
7 => __DIR__ . '/../..' . '/kirki-packages/control-dashicons/src',
|
||||
8 => __DIR__ . '/../..' . '/kirki-packages/control-date/src',
|
||||
9 => __DIR__ . '/../..' . '/kirki-packages/control-dimension/src',
|
||||
10 => __DIR__ . '/../..' . '/kirki-packages/control-editor/src',
|
||||
11 => __DIR__ . '/../..' . '/kirki-packages/control-generic/src',
|
||||
12 => __DIR__ . '/../..' . '/kirki-packages/control-image/src',
|
||||
13 => __DIR__ . '/../..' . '/kirki-packages/control-multicheck/src',
|
||||
14 => __DIR__ . '/../..' . '/kirki-packages/control-palette/src',
|
||||
15 => __DIR__ . '/../..' . '/kirki-packages/control-radio/src',
|
||||
16 => __DIR__ . '/../..' . '/kirki-packages/control-react-colorful/src',
|
||||
17 => __DIR__ . '/../..' . '/kirki-packages/control-react-select/src',
|
||||
18 => __DIR__ . '/../..' . '/kirki-packages/control-repeater/src',
|
||||
19 => __DIR__ . '/../..' . '/kirki-packages/control-select/src',
|
||||
20 => __DIR__ . '/../..' . '/kirki-packages/control-slider/src',
|
||||
21 => __DIR__ . '/../..' . '/kirki-packages/control-sortable/src',
|
||||
22 => __DIR__ . '/../..' . '/kirki-packages/control-upload/src',
|
||||
23 => __DIR__ . '/../..' . '/kirki-packages/field/src',
|
||||
24 => __DIR__ . '/../..' . '/kirki-packages/googlefonts/src',
|
||||
25 => __DIR__ . '/../..' . '/kirki-packages/l10n/src',
|
||||
26 => __DIR__ . '/../..' . '/kirki-packages/module-panels/src',
|
||||
27 => __DIR__ . '/../..' . '/kirki-packages/module-sections/src',
|
||||
28 => __DIR__ . '/../..' . '/kirki-packages/url-getter/src',
|
||||
),
|
||||
);
|
||||
|
||||
public static $classMap = array (
|
||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit734b74506bf23405b8270b65bdba2dd6::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit734b74506bf23405b8270b65bdba2dd6::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit734b74506bf23405b8270b65bdba2dd6::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
11
functions/kirki/kirki-composer/composer/include_paths.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
// include_paths.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
$baseDir . '/',
|
||||
$baseDir . '/core',
|
||||
);
|
5
functions/kirki/kirki-composer/composer/installed.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"packages": [],
|
||||
"dev": false,
|
||||
"dev-package-names": []
|
||||
}
|
23
functions/kirki/kirki-composer/composer/installed.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php return array(
|
||||
'root' => array(
|
||||
'name' => 'kirki-framework/kirki',
|
||||
'pretty_version' => '4.2.0',
|
||||
'version' => '4.2.0.0',
|
||||
'reference' => NULL,
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'dev' => false,
|
||||
),
|
||||
'versions' => array(
|
||||
'kirki-framework/kirki' => array(
|
||||
'pretty_version' => '4.2.0',
|
||||
'version' => '4.2.0.0',
|
||||
'reference' => NULL,
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
),
|
||||
);
|
26
functions/kirki/kirki-composer/composer/platform_check.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
// platform_check.php @generated by Composer
|
||||
|
||||
$issues = array();
|
||||
|
||||
if (!(PHP_VERSION_ID >= 70000)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.0.0". You are running ' . PHP_VERSION . '.';
|
||||
}
|
||||
|
||||
if ($issues) {
|
||||
if (!headers_sent()) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
}
|
||||
if (!ini_get('display_errors')) {
|
||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
||||
} elseif (!headers_sent()) {
|
||||
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
||||
}
|
||||
}
|
||||
trigger_error(
|
||||
'Composer detected issues in your platform: ' . implode(' ', $issues),
|
||||
E_USER_ERROR
|
||||
);
|
||||
}
|
21
functions/kirki/kirki-packages/compatibility/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2019 kirki-framework
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
184
functions/kirki/kirki-packages/compatibility/src/Aliases.php
Normal file
|
@ -0,0 +1,184 @@
|
|||
<?php
|
||||
/**
|
||||
* Adds class aliases for backwards compatibility.
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Core
|
||||
* @author Themeum
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 0.1
|
||||
*/
|
||||
|
||||
namespace Kirki\Compatibility;
|
||||
|
||||
/**
|
||||
* Adds class aliases for backwards compatibility.
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
class Aliases {
|
||||
|
||||
/**
|
||||
* An array of class aliases.
|
||||
*
|
||||
* @access private
|
||||
* @since 0.1
|
||||
* @var array
|
||||
*/
|
||||
private $aliases = [
|
||||
'generic' => [
|
||||
[ 'Kirki\Compatibility\Kirki', 'Kirki' ],
|
||||
[ 'Kirki\Compatibility\Config', 'Kirki_Config' ],
|
||||
[ 'Kirki\Compatibility\Control', 'Kirki_Control' ],
|
||||
[ 'Kirki\Compatibility\Field', 'Kirki_Field' ],
|
||||
[ 'Kirki\Util\Helper', 'Kirki_Helper' ],
|
||||
[ 'Kirki\Compatibility\Init', 'Kirki_Init' ],
|
||||
[ 'Kirki\L10n', 'Kirki_L10n' ],
|
||||
[ 'Kirki\Compatibility\Modules', 'Kirki_Modules' ],
|
||||
[ 'Kirki\Compatibility\Sanitize_Values', 'Kirki_Sanitize_Values' ],
|
||||
[ 'Kirki\Compatibility\Section', 'Kirki_Section' ],
|
||||
[ 'Kirki\Compatibility\Values', 'Kirki_Values' ],
|
||||
[ 'Kirki\Util\Util', 'Kirki_Util' ],
|
||||
[ 'Kirki\Compatibility\Framework', 'Kirki_Toolkit' ],
|
||||
[ 'Kirki\Module\CSS', 'Kirki_Modules_CSS' ],
|
||||
[ 'Kirki\Module\CSS\Output', 'Kirki_Output' ],
|
||||
[ 'Kirki\Module\CSS\Generator', 'Kirki_Modules_CSS_Generator' ],
|
||||
[ 'Kirki\Module\CSS\Property', 'Kirki_Output_Property' ],
|
||||
[ 'Kirki\Module\CSS\Property\Font_Family', 'Kirki_Output_Property_Font_Family' ],
|
||||
[ 'Kirki\Module\Preset', 'Kirki_Modules_Preset' ],
|
||||
[ 'Kirki\Module\Tooltips', 'Kirki_Modules_Tooltips' ],
|
||||
[ 'Kirki\Module\Webfonts', 'Kirki_Modules_Webfonts' ],
|
||||
[ 'Kirki\Module\Webfonts\Google', 'Kirki_Fonts_Google' ],
|
||||
[ 'Kirki\Module\Webfonts\Fonts', 'Kirki_Fonts' ],
|
||||
[ 'Kirki\Module\Webfonts\Embed', 'Kirki_Modules_Webfonts_Embed' ],
|
||||
[ 'Kirki\Module\Webfonts\Async', 'Kirki_Modules_Webfonts_Async' ],
|
||||
[ 'Kirki\Module\Field_Dependencies', 'Kirki_Modules_Field_Dependencies' ],
|
||||
[ 'Kirki\Module\Editor_Styles', 'Kirki_Modules_Gutenberg' ],
|
||||
[ 'Kirki\Module\Selective_Refresh', 'Kirki_Modules_Selective_Refresh' ],
|
||||
[ 'Kirki\Module\Postmessage', 'Kirki_Modules_Postmessage' ],
|
||||
[ 'Kirki\Field\Background', 'Kirki_Field_Background' ],
|
||||
[ 'Kirki\Field\CSS\Background', 'Kirki_Output_Field_Background' ],
|
||||
[ 'Kirki\Field\Checkbox', 'Kirki_Field_Checkbox' ],
|
||||
[ 'Kirki\Field\Checkbox_Switch', 'Kirki_Field_Switch' ],
|
||||
[ 'Kirki\Field\Checkbox_Switch', 'Kirki\Field\Switch' ], // Preventing typo.
|
||||
[ 'Kirki\Field\Checkbox_Toggle', 'Kirki_Field_Toggle' ],
|
||||
[ 'Kirki\Field\Checkbox_Toggle', 'Kirki\Field\Toggle' ], // Preventing typo.
|
||||
[ 'Kirki\Field\Code', 'Kirki_Field_Code' ],
|
||||
[ 'Kirki\Field\Color', 'Kirki_Field_Color' ],
|
||||
[ 'Kirki\Field\Color', 'Kirki_Field_Color_Alpha' ],
|
||||
[ 'Kirki\Field\Color_Palette', 'Kirki_Field_Color_Palette' ],
|
||||
[ 'Kirki\Field\Custom', 'Kirki_Field_Custom' ],
|
||||
[ 'Kirki\Field\Dashicons', 'Kirki_Field_Dashicons' ],
|
||||
[ 'Kirki\Field\Date', 'Kirki_Field_Date' ],
|
||||
[ 'Kirki\Field\Dimension', 'Kirki_Field_Dimension' ],
|
||||
[ 'Kirki\Field\Dimensions', 'Kirki_Field_Dimensions' ],
|
||||
[ 'Kirki\Field\CSS\Dimensions', 'Kirki_Output_Field_Dimensions' ],
|
||||
[ 'Kirki\Field\Dimensions', 'Kirki_Field_Spacing' ],
|
||||
[ 'Kirki\Field\Dimensions', 'Kirki\Field\Spacing' ],
|
||||
[ 'Kirki\Field\Editor', 'Kirki_Field_Editor' ],
|
||||
[ 'Kirki\Field\FontAwesome', 'Kirki_Field_FontAwesome' ],
|
||||
[ 'Kirki\Field\Generic', 'Kirki_Field_Kirki_Generic' ],
|
||||
[ 'Kirki\Field\Generic', 'Kirki_Field_Generic' ],
|
||||
[ 'Kirki\Field\Text', 'Kirki_Field_Text' ],
|
||||
[ 'Kirki\Field\Textarea', 'Kirki_Field_Textarea' ],
|
||||
[ 'Kirki\Field\URL', 'Kirki_Field_URL' ],
|
||||
[ 'Kirki\Field\URL', 'Kirki_Field_Link' ],
|
||||
[ 'Kirki\Field\URL', 'Kirki\Field\Link' ],
|
||||
[ 'Kirki\Field\Image', 'Kirki_Field_Image' ],
|
||||
[ 'Kirki\Field\CSS\Image', 'Kirki_Output_Field_Image' ],
|
||||
[ 'Kirki\Field\Multicheck', 'Kirki_Field_Multicheck' ],
|
||||
[ 'Kirki\Field\Multicolor', 'Kirki_Field_Multicolor' ],
|
||||
[ 'Kirki\Field\CSS\Multicolor', 'Kirki_Output_Field_Multicolor' ],
|
||||
[ 'Kirki\Field\Number', 'Kirki_Field_Number' ],
|
||||
[ 'Kirki\Field\Palette', 'Kirki_Field_Palette' ],
|
||||
[ 'Kirki\Field\Repeater', 'Kirki_Field_Repeater' ],
|
||||
[ 'Kirki\Field\Dropdown_Pages', 'Kirki_Field_Dropdown_Pages' ],
|
||||
[ 'Kirki\Field\Preset', 'Kirki_Field_Preset' ],
|
||||
[ 'Kirki\Field\Select', 'Kirki_Field_Select' ],
|
||||
[ 'Kirki\Field\Slider', 'Kirki_Field_Slider' ],
|
||||
[ 'Kirki\Field\Sortable', 'Kirki_Field_Sortable' ],
|
||||
[ 'Kirki\Field\Typography', 'Kirki_Field_Typography' ],
|
||||
[ 'Kirki\Field\CSS\Typography', 'Kirki_Output_Field_Typography' ],
|
||||
[ 'Kirki\Field\Upload', 'Kirki_Field_Upload' ],
|
||||
],
|
||||
'customizer' => [
|
||||
[ 'Kirki\Control\Base', 'Kirki_Control_Base' ],
|
||||
[ 'Kirki\Control\Base', 'Kirki_Customize_Control' ],
|
||||
[ 'Kirki\Control\Checkbox', 'Kirki_Control_Checkbox' ],
|
||||
[ 'Kirki\Control\Checkbox_Switch', 'Kirki_Control_Switch' ],
|
||||
[ 'Kirki\Control\Checkbox_Toggle', 'Kirki_Control_Toggle' ],
|
||||
[ 'WP_Customize_Code_Editor_Control', 'Kirki_Control_Code' ],
|
||||
[ 'Kirki\Control\Color', 'Kirki_Control_Color' ],
|
||||
[ 'Kirki\Control\Color_Palette', 'Kirki_Control_Color_Palette' ],
|
||||
[ 'WP_Customize_Cropped_Image_Control', 'Kirki_Control_Cropped_Image' ],
|
||||
[ 'Kirki\Control\Custom', 'Kirki_Control_Custom' ],
|
||||
[ 'Kirki\Control\Dashicons', 'Kirki_Control_Dashicons' ],
|
||||
[ 'Kirki\Control\Date', 'Kirki_Control_Date' ],
|
||||
[ 'Kirki\Control\Dimension', 'Kirki_Control_Dimension' ],
|
||||
[ 'Kirki\Control\Editor', 'Kirki_Control_Editor' ],
|
||||
[ 'Kirki\Control\Generic', 'Kirki_Control_Generic' ],
|
||||
[ 'Kirki\Control\Image', 'Kirki_Control_Image' ],
|
||||
[ 'Kirki\Control\Multicheck', 'Kirki_Control_Multicheck' ],
|
||||
[ 'Kirki\Control\Generic', 'Kirki_Control_Number' ],
|
||||
[ 'Kirki\Control\Palette', 'Kirki_Control_Palette' ],
|
||||
[ 'Kirki\Control\Radio', 'Kirki_Control_Radio' ],
|
||||
[ 'Kirki\Control\Radio_Buttonset', 'Kirki_Control_Radio_Buttonset' ],
|
||||
[ 'Kirki\Control\Radio_Image', 'Kirki_Control_Radio_Image' ],
|
||||
[ 'Kirki\Control\Radio_Image', 'Kirki_Controls_Radio_Image_Control' ],
|
||||
[ 'Kirki\Control\Repeater', 'Kirki_Control_Repeater' ],
|
||||
[ 'Kirki\Control\Select', 'Kirki_Control_Select' ],
|
||||
[ 'Kirki\Control\Slider', 'Kirki_Control_Slider' ],
|
||||
[ 'Kirki\Control\Sortable', 'Kirki_Control_Sortable' ],
|
||||
[ 'Kirki\Control\Upload', 'Kirki_Control_Upload' ],
|
||||
[ 'Kirki\Settings\Repeater', 'Kirki\Settings\Repeater_Setting' ],
|
||||
[ 'Kirki\Settings\Repeater', 'Kirki_Settings_Repeater_Setting' ],
|
||||
[ 'WP_Customize_Section', 'Kirki_Sections_Default_Section' ],
|
||||
[ 'Kirki\Section_Types\Expanded', 'Kirki_Sections_Expanded_Section' ],
|
||||
[ 'Kirki\Section_Types\Nested', 'Kirki_Sections_Nested_Section' ],
|
||||
[ 'Kirki\Section_Types\Link', 'Kirki_Sections_Link_Section' ],
|
||||
[ 'Kirki\Panel_Types\Nested', 'Kirki_Panels_Nested_Panel' ],
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @access public
|
||||
* @since 0.1
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->add_aliases();
|
||||
add_action( 'customize_register', [ $this, 'add_customizer_aliases' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds object aliases.
|
||||
*
|
||||
* @access public
|
||||
* @since 0.1
|
||||
* @return void
|
||||
*/
|
||||
public function add_aliases() {
|
||||
foreach ( $this->aliases['generic'] as $item ) {
|
||||
if ( class_exists( $item[0] ) ) {
|
||||
class_alias( $item[0], $item[1] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds object aliases for classes that get instantiated on customize_register.
|
||||
*
|
||||
* @access public
|
||||
* @since 0.1
|
||||
* @return void
|
||||
*/
|
||||
public function add_customizer_aliases() {
|
||||
foreach ( $this->aliases['customizer'] as $item ) {
|
||||
if ( class_exists( $item[0] ) ) {
|
||||
class_alias( $item[0], $item[1] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
179
functions/kirki/kirki-packages/compatibility/src/Config.php
Normal file
|
@ -0,0 +1,179 @@
|
|||
<?php
|
||||
/**
|
||||
* Processes configurations.
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Compatibility
|
||||
* @author Themeum
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Kirki\Compatibility;
|
||||
|
||||
/**
|
||||
* The Config object
|
||||
*/
|
||||
final class Config {
|
||||
|
||||
/**
|
||||
* Each instance is stored separately in this array.
|
||||
*
|
||||
* @static
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private static $instances = [];
|
||||
|
||||
/**
|
||||
* The finalized configuration array.
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $config_final = [];
|
||||
|
||||
/**
|
||||
* The configuration ID.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $id = 'global';
|
||||
|
||||
/**
|
||||
* Capability (fields will inherit this).
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $capability = 'edit_theme_options';
|
||||
|
||||
/**
|
||||
* The data-type we'll be using.
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $option_type = 'theme_mod';
|
||||
|
||||
/**
|
||||
* If we're using serialized options, then this is the global option name.
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $option_name = '';
|
||||
|
||||
/**
|
||||
* The compiler.
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $compiler = [];
|
||||
|
||||
/**
|
||||
* Set to true if you want to completely disable any Kirki-generated CSS.
|
||||
*
|
||||
* @access protected
|
||||
* @var bool
|
||||
*/
|
||||
protected $disable_output = false;
|
||||
|
||||
/**
|
||||
* The class constructor.
|
||||
* Use the get_instance() static method to get the instance you need.
|
||||
*
|
||||
* @access private
|
||||
* @param string $config_id @see Kirki\Compatibility\Config::get_instance().
|
||||
* @param array $args @see Kirki\Compatibility\Config::get_instance().
|
||||
*/
|
||||
private function __construct( $config_id = 'global', $args = [] ) {
|
||||
|
||||
// Get defaults from the class.
|
||||
$defaults = get_class_vars( __CLASS__ );
|
||||
// Skip what we don't need in this context.
|
||||
unset( $defaults['config_final'] );
|
||||
unset( $defaults['instances'] );
|
||||
// Apply any kirki_config global filters.
|
||||
$defaults = apply_filters( 'kirki_config', $defaults );
|
||||
// Merge our args with the defaults.
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
|
||||
// Modify default values with the defined ones.
|
||||
foreach ( $args as $key => $value ) {
|
||||
// Is this property whitelisted?
|
||||
if ( property_exists( $this, $key ) ) {
|
||||
$args[ $key ] = $value;
|
||||
}
|
||||
}
|
||||
$this->id = $config_id;
|
||||
|
||||
$this->config_final = wp_parse_args(
|
||||
[
|
||||
'id' => $config_id,
|
||||
],
|
||||
$args
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this method to get an instance of your config.
|
||||
* Each config has its own instance of this object.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $id Config ID.
|
||||
* @param array $args {
|
||||
* Optional. Arguments to override config defaults.
|
||||
*
|
||||
* @type string $capability @see https://codex.wordpress.org/Roles_and_Capabilities
|
||||
* @type string $option_type theme_mod or option.
|
||||
* @type string $option_name If we want to used serialized options,
|
||||
* this is where we'll be adding the option name.
|
||||
* All fields using this config will be items in that array.
|
||||
* @type array $compiler Not yet fully implemented
|
||||
* @type bool $disable_output If set to true, no CSS will be generated
|
||||
* from fields using this configuration.
|
||||
* }
|
||||
*
|
||||
* @return Kirki\Compatibility\Config
|
||||
*/
|
||||
public static function get_instance( $id = 'global', $args = [] ) {
|
||||
if ( empty( $id ) ) {
|
||||
$id = 'global';
|
||||
}
|
||||
$id_md5 = md5( $id );
|
||||
if ( ! isset( self::$instances[ $id_md5 ] ) ) {
|
||||
self::$instances[ $id_md5 ] = new self( $id, $args );
|
||||
}
|
||||
return self::$instances[ $id_md5 ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the IDs of all current configs.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 3.0.22
|
||||
* @return array
|
||||
*/
|
||||
public static function get_config_ids() {
|
||||
$configs = [];
|
||||
foreach ( self::$instances as $instance ) {
|
||||
$configs[] = $instance->id;
|
||||
}
|
||||
return array_unique( $configs );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the $config_final property
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function get_config() {
|
||||
return $this->config_final;
|
||||
}
|
||||
}
|
129
functions/kirki/kirki-packages/compatibility/src/Control.php
Normal file
|
@ -0,0 +1,129 @@
|
|||
<?php
|
||||
/**
|
||||
* Controls handler
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Core
|
||||
* @author Themeum
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Kirki\Compatibility;
|
||||
|
||||
/**
|
||||
* Our main Kirki\Control object
|
||||
*/
|
||||
class Control {
|
||||
|
||||
/**
|
||||
* The $wp_customize WordPress global.
|
||||
*
|
||||
* @access protected
|
||||
* @var WP_Customize_Manager
|
||||
*/
|
||||
protected $wp_customize;
|
||||
|
||||
/**
|
||||
* An array of all available control types.
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected static $control_types = [];
|
||||
|
||||
/**
|
||||
* The class constructor.
|
||||
* Creates the actual controls in the customizer.
|
||||
*
|
||||
* @access public
|
||||
* @param array $args The field definition as sanitized in Kirki\Field.
|
||||
*/
|
||||
public function __construct( $args ) {
|
||||
|
||||
// Set the $wp_customize property.
|
||||
global $wp_customize;
|
||||
if ( ! $wp_customize ) {
|
||||
return;
|
||||
}
|
||||
$this->wp_customize = $wp_customize;
|
||||
|
||||
// Set the control types.
|
||||
$this->set_control_types();
|
||||
|
||||
// Add the control.
|
||||
$this->add_control( $args );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class name of the class needed to create tis control.
|
||||
*
|
||||
* @access private
|
||||
* @param array $args The field definition as sanitized in Kirki\Field.
|
||||
*
|
||||
* @return string the name of the class that will be used to create this control.
|
||||
*/
|
||||
final function get_control_class_name( $args ) {
|
||||
|
||||
// Set a default class name.
|
||||
$class_name = 'WP_Customize_Control';
|
||||
|
||||
// Get the classname from the array of control classnames.
|
||||
if ( array_key_exists( $args['type'], self::$control_types ) ) {
|
||||
$class_name = self::$control_types[ $args['type'] ];
|
||||
}
|
||||
return $class_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the control.
|
||||
*
|
||||
* @access protected
|
||||
* @param array $args The field definition as sanitized in Kirki\Field.
|
||||
*/
|
||||
final protected function add_control( $args ) {
|
||||
|
||||
// Get the name of the class we're going to use.
|
||||
$class_name = $this->get_control_class_name( $args );
|
||||
|
||||
/**
|
||||
* Allow filtering the arguments.
|
||||
*
|
||||
* @since 0.1
|
||||
* @param array $args The arguments.
|
||||
* @param WP_Customize_Manager $wp_customize The customizer instance.
|
||||
* @return array Return the arguments.
|
||||
*/
|
||||
$args = apply_filters( 'kirki_field_add_control_args', $args, $this->wp_customize );
|
||||
|
||||
// Add the control.
|
||||
$this->wp_customize->add_control( new $class_name( $this->wp_customize, $args['settings'], $args ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the $control_types property.
|
||||
* Makes sure the kirki_control_types filter is applied
|
||||
* and that the defined classes actually exist.
|
||||
* If a defined class does not exist, it is removed.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
final function set_control_types() {
|
||||
|
||||
// Early exit if this has already run.
|
||||
if ( ! empty( self::$control_types ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
self::$control_types = apply_filters( 'kirki_control_types', [] );
|
||||
|
||||
// Make sure the defined classes actually exist.
|
||||
foreach ( self::$control_types as $key => $classname ) {
|
||||
if ( ! class_exists( $classname ) ) {
|
||||
unset( self::$control_types[ $key ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Backwards-compatibility for Kirki filters.
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Core
|
||||
* @author Themeum
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Compatibility;
|
||||
|
||||
/**
|
||||
* Please do not use this class directly.
|
||||
* You should instead extend it per-field-type.
|
||||
*/
|
||||
class Deprecated {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
*/
|
||||
public function __construct() {
|
||||
require_once __DIR__ . '/deprecated/classes.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
|
||||
require_once __DIR__ . '/deprecated/functions.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
|
||||
require_once __DIR__ . '/deprecated/filters.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude
|
||||
}
|
||||
}
|
683
functions/kirki/kirki-packages/compatibility/src/Field.php
Normal file
|
@ -0,0 +1,683 @@
|
|||
<?php
|
||||
/**
|
||||
* Creates and validates field parameters.
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Core
|
||||
* @author Themeum
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Compatibility;
|
||||
|
||||
use Kirki\Compatibility\Kirki;
|
||||
|
||||
/**
|
||||
* Please do not use this class directly.
|
||||
* You should instead extend it per-field-type.
|
||||
*/
|
||||
class Field {
|
||||
|
||||
/**
|
||||
* An array of the field arguments.
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
public $label;
|
||||
public $row_label;
|
||||
public $button_label;
|
||||
public $description;
|
||||
public $help;
|
||||
|
||||
protected $args = array();
|
||||
|
||||
/**
|
||||
* The ID of the kirki_config we're using.
|
||||
*
|
||||
* @see Kirki\Compatibility\Config
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $kirki_config = 'global';
|
||||
|
||||
/**
|
||||
* The capability required so that users can edit this field.
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $capability = 'edit_theme_options';
|
||||
|
||||
/**
|
||||
* If we're using options instead of theme_mods
|
||||
* and we want them serialized, this is the option that
|
||||
* will saved in the db.
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $option_name = '';
|
||||
|
||||
/**
|
||||
* Custom input attributes (defined as an array).
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $input_attrs = array();
|
||||
|
||||
/**
|
||||
* Preset choices.
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $preset = array();
|
||||
|
||||
/**
|
||||
* CSS Variables.
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $css_vars = array();
|
||||
|
||||
/**
|
||||
* Use "theme_mod" or "option".
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $option_type = 'theme_mod';
|
||||
|
||||
/**
|
||||
* The name of this setting (id for the db).
|
||||
*
|
||||
* @access protected
|
||||
* @var string|array
|
||||
*/
|
||||
protected $settings = '';
|
||||
|
||||
/**
|
||||
* Set to true if you want to disable all CSS output for this field.
|
||||
*
|
||||
* @access protected
|
||||
* @var bool
|
||||
*/
|
||||
protected $disable_output = false;
|
||||
|
||||
/**
|
||||
* The field type.
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $type = 'kirki-generic';
|
||||
|
||||
/**
|
||||
* Some fields require options to be set.
|
||||
* We're whitelisting the property here
|
||||
* and suggest you validate this in a child class.
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $choices = array();
|
||||
|
||||
/**
|
||||
* Assign this field to a section.
|
||||
* Fields not assigned to a section will not be displayed in the customizer.
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $section = '';
|
||||
|
||||
/**
|
||||
* The default value for this field.
|
||||
*
|
||||
* @access protected
|
||||
* @var string|array|bool
|
||||
*/
|
||||
protected $default = '';
|
||||
|
||||
/**
|
||||
* Priority determines the position of a control inside a section.
|
||||
* Lower priority numbers move the control to the top.
|
||||
*
|
||||
* @access protected
|
||||
* @var int
|
||||
*/
|
||||
protected $priority = 10;
|
||||
|
||||
/**
|
||||
* Unique ID for this field.
|
||||
* This is auto-calculated from the $settings argument.
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $id = '';
|
||||
|
||||
/**
|
||||
* Use if you want to automatically generate CSS from this field's value.
|
||||
*
|
||||
* @see https://kirki.org/docs/arguments/output
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $output = array();
|
||||
|
||||
/**
|
||||
* Use to automatically generate postMessage scripts.
|
||||
* Not necessary to use if you use 'transport' => 'auto'
|
||||
* and have already set an array for the 'output' argument.
|
||||
*
|
||||
* @see https://kirki.org/docs/arguments/js_vars
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $js_vars = array();
|
||||
|
||||
/**
|
||||
* If you want to use a CSS compiler, then use this to set the variable names.
|
||||
*
|
||||
* @see https://kirki.org/docs/arguments/variables
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $variables = array();
|
||||
|
||||
/**
|
||||
* Text that will be used in a tooltip to provide extra info for this field.
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $tooltip = '';
|
||||
|
||||
/**
|
||||
* A custom callback to determine if the field should be visible or not.
|
||||
*
|
||||
* @access protected
|
||||
* @var string|array
|
||||
*/
|
||||
protected $active_callback = '__return_true';
|
||||
|
||||
/**
|
||||
* A custom sanitize callback that will be used to properly save the values.
|
||||
*
|
||||
* @access protected
|
||||
* @var string|array
|
||||
*/
|
||||
protected $sanitize_callback = '';
|
||||
|
||||
/**
|
||||
* Use 'refresh', 'postMessage' or 'auto'.
|
||||
* 'auto' will automatically geberate any 'js_vars' from the 'output' argument.
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $transport = 'refresh';
|
||||
|
||||
/**
|
||||
* Define dependencies to show/hide this field based on the values of other fields.
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $required = array();
|
||||
|
||||
/**
|
||||
* Partial Refreshes array.
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $partial_refresh = array();
|
||||
|
||||
/**
|
||||
* The class constructor.
|
||||
* Parses and sanitizes all field arguments.
|
||||
* Then it adds the field to Kirki::$fields.
|
||||
*
|
||||
* @access public
|
||||
* @param string $config_id The ID of the config we want to use.
|
||||
* Defaults to "global".
|
||||
* Configs are handled by the Kirki\Compatibility\Config class.
|
||||
* @param array $args The arguments of the field.
|
||||
*/
|
||||
public function __construct( $config_id = 'global', $args = array() ) {
|
||||
|
||||
/**
|
||||
* In case the user only provides 1 argument,
|
||||
* assume that the provided argument is $args and set $config_id = 'global'.
|
||||
*/
|
||||
if ( is_array( $config_id ) && empty( $args ) ) {
|
||||
$args = $config_id;
|
||||
$config_id = isset( $args['kirki_config'] ) ? $args['kirki_config'] : 'global';
|
||||
}
|
||||
|
||||
if ( isset( $args['setting'] ) && ! empty( $args['setting'] ) && ( ! isset( $args['settings'] ) || empty( $args['settings'] ) ) ) {
|
||||
/* translators: %s represents the field ID where the error occurs. */
|
||||
_doing_it_wrong( __METHOD__, sprintf( esc_html__( 'Typo found in field %s - setting instead of settings.', 'kirki' ), esc_html( $args['settings'] ) ), '3.0.10' );
|
||||
$args['settings'] = $args['setting'];
|
||||
unset( $args['setting'] );
|
||||
}
|
||||
|
||||
$args['kirki_config'] = $config_id;
|
||||
|
||||
$this->kirki_config = $config_id;
|
||||
|
||||
if ( '' === $config_id ) {
|
||||
/* translators: %1$s represents the field ID where the error occurs. %2$s is the URL in the documentation site. */
|
||||
_doing_it_wrong( __METHOD__, sprintf( esc_html__( 'Config not defined for field %1$s - See %2$s for details on how to properly add fields.', 'kirki' ), esc_html( $args['settings'] ), 'https://aristath.github.io/kirki/docs/getting-started/fields.html' ), '3.0.10' );
|
||||
$this->kirki_config = 'global';
|
||||
}
|
||||
|
||||
// Get defaults from the class.
|
||||
$defaults = get_class_vars( __CLASS__ );
|
||||
|
||||
// Get the config arguments, and merge them with the defaults.
|
||||
$config_defaults = ( isset( Kirki::$config['global'] ) ) ? Kirki::$config['global'] : array();
|
||||
|
||||
if ( 'global' !== $this->kirki_config && isset( Kirki::$config[ $this->kirki_config ] ) ) {
|
||||
$config_defaults = Kirki::$config[ $this->kirki_config ];
|
||||
}
|
||||
|
||||
$config_defaults = ( is_array( $config_defaults ) ) ? $config_defaults : array();
|
||||
|
||||
foreach ( $config_defaults as $key => $value ) {
|
||||
if ( isset( $defaults[ $key ] ) && ! empty( $value ) && $value !== $defaults[ $key ] ) {
|
||||
$defaults[ $key ] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// Merge our args with the defaults.
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
|
||||
// Set the class properties using the parsed args.
|
||||
foreach ( $args as $key => $value ) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
|
||||
$this->args = $args;
|
||||
|
||||
$this->set_field();
|
||||
|
||||
// Instantiate the \Kirki\Field to apply hooks.
|
||||
new \Kirki\Field\None( $this->args );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the field arguments
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function set_field() {
|
||||
|
||||
$properties = get_class_vars( __CLASS__ );
|
||||
|
||||
// Some things must run before the others.
|
||||
$this->set_option_type();
|
||||
$this->set_settings();
|
||||
|
||||
// Sanitize the properties, skipping the ones that have already run above.
|
||||
foreach ( array_keys( $properties ) as $property ) {
|
||||
if ( in_array( $property, array( 'option_name', 'option_type', 'settings' ), true ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( method_exists( $this, 'set_' . $property ) ) {
|
||||
$method_name = 'set_' . $property;
|
||||
$this->$method_name();
|
||||
}
|
||||
}
|
||||
|
||||
// Get all arguments with their values.
|
||||
$args = get_object_vars( $this );
|
||||
|
||||
foreach ( array_keys( $args ) as $key ) {
|
||||
$args[ $key ] = $this->$key;
|
||||
}
|
||||
|
||||
// Add the field to the static $fields variable properly indexed.
|
||||
Kirki::$fields[ $this->settings ] = $args;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape the $section.
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function set_input_attrs() {
|
||||
$this->input_attrs = (array) $this->input_attrs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure we're using the correct option_type
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function set_option_type() {
|
||||
|
||||
// Take care of common typos.
|
||||
if ( 'options' === $this->option_type ) {
|
||||
$this->option_type = 'option';
|
||||
}
|
||||
|
||||
// Take care of common typos.
|
||||
if ( 'theme_mods' === $this->option_type ) {
|
||||
/* translators: %1$s represents the field ID where the error occurs. */
|
||||
_doing_it_wrong( __METHOD__, sprintf( esc_html( 'Typo found in field %s - "theme_mods" vs "theme_mod"', 'kirki' ), esc_html( $this->settings ) ), '3.0.10' );
|
||||
$this->option_type = 'theme_mod';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifications for partial refreshes.
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function set_partial_refresh() {
|
||||
if ( ! is_array( $this->partial_refresh ) ) {
|
||||
$this->partial_refresh = array();
|
||||
}
|
||||
foreach ( $this->partial_refresh as $id => $args ) {
|
||||
if ( ! is_array( $args ) || ! isset( $args['selector'] ) || ! isset( $args['render_callback'] ) || ! is_callable( $args['render_callback'] ) ) {
|
||||
/* translators: %1$s represents the field ID where the error occurs. */
|
||||
_doing_it_wrong( __METHOD__, sprintf( esc_html__( '"partial_refresh" invalid entry in field %s', 'kirki' ), esc_html( $this->settings ) ), '3.0.10' );
|
||||
unset( $this->partial_refresh[ $id ] );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ( ! empty( $this->partial_refresh ) ) {
|
||||
$this->transport = 'postMessage';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the settings.
|
||||
* If we're using serialized options it makes sure that settings are properly formatted.
|
||||
* We'll also be escaping all setting names here for consistency.
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function set_settings() {
|
||||
|
||||
// If settings is not an array, temporarily convert it to an array.
|
||||
// This is just to allow us to process everything the same way and avoid code duplication.
|
||||
// if settings is not an array then it will not be set as an array in the end.
|
||||
if ( ! is_array( $this->settings ) ) {
|
||||
$this->settings = array(
|
||||
'kirki_placeholder_setting' => $this->settings,
|
||||
);
|
||||
}
|
||||
$settings = array();
|
||||
foreach ( $this->settings as $setting_key => $setting_value ) {
|
||||
$settings[ $setting_key ] = $setting_value;
|
||||
|
||||
// If we're using serialized options then we need to spice this up.
|
||||
if ( 'option' === $this->option_type && '' !== $this->option_name && ( false === strpos( $setting_key, '[' ) ) ) {
|
||||
$settings[ $setting_key ] = "{$this->option_name}[{$setting_value}]";
|
||||
}
|
||||
}
|
||||
$this->settings = $settings;
|
||||
if ( isset( $this->settings['kirki_placeholder_setting'] ) ) {
|
||||
$this->settings = $this->settings['kirki_placeholder_setting'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the active_callback
|
||||
* If we're using the $required argument,
|
||||
* Then this is where the switch is made to our evaluation method.
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function set_active_callback() {
|
||||
|
||||
if ( is_array( $this->active_callback ) ) {
|
||||
|
||||
if ( ! is_callable( $this->active_callback ) ) {
|
||||
|
||||
// Bugfix for https://github.com/aristath/kirki/issues/1961.
|
||||
foreach ( $this->active_callback as $key => $val ) {
|
||||
if ( is_callable( $val ) ) {
|
||||
unset( $this->active_callback[ $key ] );
|
||||
}
|
||||
}
|
||||
if ( isset( $this->active_callback[0] ) ) {
|
||||
$this->required = $this->active_callback;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $this->required ) ) {
|
||||
$this->active_callback = '__return_true';
|
||||
return;
|
||||
}
|
||||
// No need to proceed any further if we're using the default value.
|
||||
if ( '__return_true' === $this->active_callback ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the function is callable, otherwise fallback to __return_true.
|
||||
if ( ! is_callable( $this->active_callback ) ) {
|
||||
$this->active_callback = '__return_true';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the $id.
|
||||
* Setting the ID should happen after the 'settings' sanitization.
|
||||
* This way we can also properly handle cases where the option_type is set to 'option'
|
||||
* and we're using an array instead of individual options.
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function set_id() {
|
||||
$this->id = sanitize_key( str_replace( '[', '-', str_replace( ']', '', $this->settings ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the $choices.
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function set_choices() {
|
||||
if ( ! is_array( $this->choices ) ) {
|
||||
$this->choices = array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes the $disable_output.
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function set_disable_output() {
|
||||
$this->disable_output = (bool) $this->disable_output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the $sanitize_callback
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function set_output() {
|
||||
if ( empty( $this->output ) ) {
|
||||
return;
|
||||
}
|
||||
if ( ! is_array( $this->output ) ) {
|
||||
/* translators: The field ID where the error occurs. */
|
||||
_doing_it_wrong( __METHOD__, sprintf( esc_html__( '"output" invalid format in field %s. The "output" argument should be defined as an array of arrays.', 'kirki' ), esc_html( $this->settings ) ), '3.0.10' );
|
||||
$this->output = array(
|
||||
array(
|
||||
'element' => $this->output,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Convert to array of arrays if needed.
|
||||
if ( isset( $this->output['element'] ) ) {
|
||||
/* translators: The field ID where the error occurs. */
|
||||
_doing_it_wrong( __METHOD__, sprintf( esc_html__( '"output" invalid format in field %s. The "output" argument should be defined as an array of arrays.', 'kirki' ), esc_html( $this->settings ) ), '3.0.10' );
|
||||
$this->output = array( $this->output );
|
||||
}
|
||||
|
||||
foreach ( $this->output as $key => $output ) {
|
||||
if ( empty( $output ) || ! isset( $output['element'] ) ) {
|
||||
unset( $this->output[ $key ] );
|
||||
continue;
|
||||
}
|
||||
if ( ! isset( $output['sanitize_callback'] ) && isset( $output['callback'] ) ) {
|
||||
$this->output[ $key ]['sanitize_callback'] = $output['callback'];
|
||||
}
|
||||
|
||||
// Convert element arrays to strings.
|
||||
if ( isset( $output['element'] ) && is_array( $output['element'] ) ) {
|
||||
$this->output[ $key ]['element'] = array_unique( $this->output[ $key ]['element'] );
|
||||
sort( $this->output[ $key ]['element'] );
|
||||
|
||||
// Trim each element in the array.
|
||||
foreach ( $this->output[ $key ]['element'] as $index => $element ) {
|
||||
$this->output[ $key ]['element'][ $index ] = trim( $element );
|
||||
}
|
||||
$this->output[ $key ]['element'] = implode( ',', $this->output[ $key ]['element'] );
|
||||
}
|
||||
|
||||
// Fix for https://github.com/aristath/kirki/issues/1659#issuecomment-346229751.
|
||||
$this->output[ $key ]['element'] = str_replace( array( "\t", "\n", "\r", "\0", "\x0B" ), ' ', $this->output[ $key ]['element'] );
|
||||
$this->output[ $key ]['element'] = trim( preg_replace( '/\s+/', ' ', $this->output[ $key ]['element'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the $js_vars
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function set_js_vars() {
|
||||
if ( ! is_array( $this->js_vars ) ) {
|
||||
$this->js_vars = array();
|
||||
}
|
||||
|
||||
// Check if transport is set to auto.
|
||||
// If not, then skip the auto-calculations and exit early.
|
||||
if ( 'auto' !== $this->transport ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set transport to refresh initially.
|
||||
// Serves as a fallback in case we failt to auto-calculate js_vars.
|
||||
$this->transport = 'refresh';
|
||||
|
||||
$js_vars = array();
|
||||
|
||||
// Try to auto-generate js_vars.
|
||||
// First we need to check if js_vars are empty, and that output is not empty.
|
||||
if ( empty( $this->js_vars ) && ! empty( $this->output ) ) {
|
||||
|
||||
// Start going through each item in the $output array.
|
||||
foreach ( $this->output as $output ) {
|
||||
$output['function'] = ( isset( $output['function'] ) ) ? $output['function'] : 'style';
|
||||
|
||||
// If 'element' is not defined, skip this.
|
||||
if ( ! isset( $output['element'] ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( is_array( $output['element'] ) ) {
|
||||
$output['element'] = implode( ',', $output['element'] );
|
||||
}
|
||||
|
||||
// If there's a sanitize_callback defined skip this, unless we also have a js_callback defined.
|
||||
if ( isset( $output['sanitize_callback'] ) && ! empty( $output['sanitize_callback'] ) && ! isset( $output['js_callback'] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// If we got this far, it's safe to add this.
|
||||
$js_vars[] = $output;
|
||||
}
|
||||
|
||||
// Did we manage to get all the items from 'output'?
|
||||
// If not, then we're missing something so don't add this.
|
||||
if ( count( $js_vars ) !== count( $this->output ) ) {
|
||||
return;
|
||||
}
|
||||
$this->js_vars = $js_vars;
|
||||
$this->transport = 'postMessage';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the $variables
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function set_variables() {
|
||||
if ( ! is_array( $this->variables ) ) {
|
||||
$variable = ( is_string( $this->variables ) && ! empty( $this->variables ) ) ? $this->variables : false;
|
||||
$this->variables = array();
|
||||
if ( $variable && empty( $this->variables ) ) {
|
||||
$this->variables[0]['name'] = $variable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the $transport
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function set_transport() {
|
||||
if ( 'postmessage' === trim( strtolower( $this->transport ) ) ) {
|
||||
$this->transport = 'postMessage';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the $required
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function set_required() {
|
||||
if ( ! is_array( $this->required ) ) {
|
||||
$this->required = array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the $priority
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function set_priority() {
|
||||
$this->priority = absint( $this->priority );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the $css_vars
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected function set_css_vars() {
|
||||
if ( is_string( $this->css_vars ) ) {
|
||||
$this->css_vars = array( $this->css_vars );
|
||||
}
|
||||
if ( isset( $this->css_vars[0] ) && is_string( $this->css_vars[0] ) ) {
|
||||
$this->css_vars = array( $this->css_vars );
|
||||
}
|
||||
foreach ( $this->css_vars as $key => $val ) {
|
||||
if ( ! isset( $val[1] ) ) {
|
||||
$this->css_vars[ $key ][1] = '$';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
* The main Kirki object
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Core
|
||||
* @author Themeum
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Compatibility;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Singleton class
|
||||
*/
|
||||
final class Framework {
|
||||
public $modules;
|
||||
/**
|
||||
* Holds the one, true instance of this object.
|
||||
*
|
||||
* @static
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected static $instance = null;
|
||||
|
||||
/**
|
||||
* Access the single instance of this class.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @return Kirki\Compatibility\Framework
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
}
|
310
functions/kirki/kirki-packages/compatibility/src/Init.php
Normal file
|
@ -0,0 +1,310 @@
|
|||
<?php
|
||||
/**
|
||||
* Initializes Kirki
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Core
|
||||
* @author Themeum
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Compatibility;
|
||||
|
||||
/**
|
||||
* Initialize Kirki
|
||||
*/
|
||||
class Init {
|
||||
|
||||
/**
|
||||
* Control types.
|
||||
*
|
||||
* @access private
|
||||
* @since 3.0.0
|
||||
* @var array
|
||||
*/
|
||||
private $control_types = [];
|
||||
|
||||
/**
|
||||
* Should we show a nag for the deprecated fontawesome field?
|
||||
*
|
||||
* @static
|
||||
* @access private
|
||||
* @since 3.0.42
|
||||
* @var bool
|
||||
*/
|
||||
private static $show_fa_nag = false;
|
||||
|
||||
/**
|
||||
* The class constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'wp_loaded', [ $this, 'add_to_customizer' ], 1 );
|
||||
add_filter( 'kirki_control_types', [ $this, 'default_control_types' ] );
|
||||
|
||||
add_action( 'customize_register', [ $this, 'remove_controls' ], 99999 );
|
||||
|
||||
add_action( 'admin_notices', [ $this, 'admin_notices' ] );
|
||||
add_action( 'admin_init', [ $this, 'dismiss_nag' ] );
|
||||
|
||||
// ? Bagus: is this necessary? The Values class doesn't have constructor, so this does nothing.
|
||||
new Values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the default Kirki control types.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
* @param array $control_types The control types array.
|
||||
* @return array
|
||||
*/
|
||||
public function default_control_types( $control_types = [] ) {
|
||||
$this->control_types = [
|
||||
'kirki-composite' => '\Kirki\Control\Composite',
|
||||
'checkbox' => '\Kirki\Control\Checkbox',
|
||||
'kirki-color' => '\Kirki\Control\ReactColorful',
|
||||
'kirki-color-palette' => '\Kirki\Control\Color_Palette',
|
||||
'kirki-custom' => '\Kirki\Control\Custom',
|
||||
'kirki-date' => '\Kirki\Control\Date',
|
||||
'kirki-dashicons' => '\Kirki\Control\Dashicons',
|
||||
'kirki-dimension' => '\Kirki\Control\Dimension',
|
||||
'kirki-dimensions' => '\Kirki\Control\Dimensions',
|
||||
'kirki-editor' => '\Kirki\Control\Editor',
|
||||
'kirki-image' => '\Kirki\Control\Image',
|
||||
'kirki-multicolor' => '\Kirki\Control\Multicolor',
|
||||
'kirki-multicheck' => '\Kirki\Control\Multicheck',
|
||||
'kirki-number' => '\Kirki\Control\Number',
|
||||
'kirki-radio' => '\Kirki\Control\Radio',
|
||||
'kirki-radio-buttonset' => '\Kirki\Control\Radio_Buttonset',
|
||||
'kirki-radio-image' => '\Kirki\Control\Radio_Image',
|
||||
'repeater' => '\Kirki\Control\Repeater',
|
||||
'kirki-select' => '\Kirki\Control\Select',
|
||||
'kirki-slider' => '\Kirki\Control\Slider',
|
||||
'kirki-sortable' => '\Kirki\Control\Sortable',
|
||||
'kirki-spacing' => '\Kirki\Control\Dimensions',
|
||||
'kirki-switch' => '\Kirki\Control\Checkbox_Switch',
|
||||
'kirki-generic' => '\Kirki\Control\Generic',
|
||||
'kirki-toggle' => '\Kirki\Control\Checkbox_Toggle',
|
||||
'image' => '\Kirki\Control\Image',
|
||||
'cropped_image' => '\Kirki\Control\Cropped_Image',
|
||||
'upload' => '\Kirki\Control\Upload',
|
||||
];
|
||||
return array_merge( $this->control_types, $control_types );
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function that adds the fields to the customizer.
|
||||
*/
|
||||
public function add_to_customizer() {
|
||||
$this->fields_from_filters();
|
||||
add_action( 'customize_register', [ $this, 'register_control_types' ] );
|
||||
add_action( 'customize_register', [ $this, 'add_fields' ], 99 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register control types
|
||||
*/
|
||||
public function register_control_types() {
|
||||
global $wp_customize;
|
||||
|
||||
$this->control_types = $this->default_control_types();
|
||||
if ( ! class_exists( 'WP_Customize_Code_Editor_Control' ) ) {
|
||||
unset( $this->control_types['code_editor'] );
|
||||
}
|
||||
foreach ( $this->control_types as $key => $classname ) {
|
||||
if ( ! class_exists( $classname ) ) {
|
||||
unset( $this->control_types[ $key ] );
|
||||
}
|
||||
}
|
||||
|
||||
$skip_control_types = apply_filters(
|
||||
'kirki_control_types_exclude',
|
||||
[
|
||||
'\Kirki\Control\Repeater',
|
||||
'\WP_Customize_Control',
|
||||
]
|
||||
);
|
||||
|
||||
foreach ( $this->control_types as $control_type ) {
|
||||
if ( ! in_array( $control_type, $skip_control_types, true ) && class_exists( $control_type ) ) {
|
||||
$wp_customize->register_control_type( $control_type );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the settings and controls from the $fields array and register them.
|
||||
*
|
||||
* @var object The WordPress Customizer object.
|
||||
*/
|
||||
public function add_fields() {
|
||||
global $wp_customize;
|
||||
|
||||
foreach ( Kirki::$fields as $args ) {
|
||||
|
||||
// Create the settings.
|
||||
new \Kirki\Compatibility\Settings( $args );
|
||||
|
||||
// Check if we're on the customizer.
|
||||
// If we are, then we will create the controls, add the scripts needed for the customizer
|
||||
// and any other tweaks that this field may require.
|
||||
if ( $wp_customize ) {
|
||||
|
||||
// Create the control.
|
||||
new Control( $args );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process fields added using the 'kirki_fields' and 'kirki_controls' filter.
|
||||
* These filters are no longer used, this is simply for backwards-compatibility.
|
||||
*
|
||||
* @access private
|
||||
* @since 2.0.0
|
||||
*/
|
||||
private function fields_from_filters() {
|
||||
$fields = apply_filters( 'kirki_controls', [] );
|
||||
$fields = apply_filters( 'kirki_fields', $fields );
|
||||
|
||||
if ( ! empty( $fields ) ) {
|
||||
foreach ( $fields as $field ) {
|
||||
$field['kirki_config'] = 'global';
|
||||
Kirki::add_field( 'global', $field );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for the is_plugin static method in the Kirki\Util\Util class.
|
||||
* This is here for backwards-compatibility purposes.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
* @return bool
|
||||
*/
|
||||
public static function is_plugin() {
|
||||
return Util::is_plugin();
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for the get_variables static method in the Kirki\Util\Util class.
|
||||
* This is here for backwards-compatibility purposes.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 2.0.0
|
||||
* @return array Formatted as array( 'variable-name' => value ).
|
||||
*/
|
||||
public static function get_variables() {
|
||||
|
||||
// Log error for developers.
|
||||
_doing_it_wrong( __METHOD__, esc_html__( 'We detected you\'re using Kirki\Compatibility\Init::get_variables(). Please use \Kirki\Util\Util::get_variables() instead.', 'kirki' ), '3.0.10' );
|
||||
|
||||
// ! This will be failed, because Util class is under Kirki\Util namespace.
|
||||
return Util::get_variables();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove controls.
|
||||
*
|
||||
* @since 3.0.17
|
||||
* @param object $wp_customize The customizer object.
|
||||
* @return void
|
||||
*/
|
||||
public function remove_controls( $wp_customize ) {
|
||||
foreach ( Kirki::$controls_to_remove as $control ) {
|
||||
$wp_customize->remove_control( $control );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows an admin notice.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.42
|
||||
* @return void
|
||||
*/
|
||||
public function admin_notices() {
|
||||
|
||||
// No need for a nag if we don't need to recommend installing the FA plugin.
|
||||
if ( ! self::$show_fa_nag ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// No need for a nag if FA plugin is already installed.
|
||||
if ( defined( 'FONTAWESOME_DIR_PATH' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// No need for a nag if current user can't install plugins.
|
||||
if ( ! current_user_can( 'install_plugins' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// No need for a nag if user has dismissed it.
|
||||
$dismissed = get_user_meta( get_current_user_id(), 'kirki_fa_nag_dismissed', true );
|
||||
if ( true === $dismissed || 1 === $dismissed || '1' === $dismissed ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div class="notice notice-info is-dismissible">
|
||||
<p>
|
||||
<?php esc_html_e( 'Your theme uses a Font Awesome field for icons. To avoid issues with missing icons on your frontend we recommend you install the official Font Awesome plugin.', 'kirki' ); ?>
|
||||
</p>
|
||||
<p>
|
||||
<a class="button button-primary" href="<?php echo esc_url( admin_url( 'plugin-install.php?tab=plugin-information&plugin=font-awesome&TB_iframe=true&width=600&height=550' ) ); ?>"><?php esc_html_e( 'Install Plugin', 'kirki' ); ?></a>
|
||||
<a class="button button-secondary" href="<?php echo esc_url( wp_nonce_url( admin_url( '?dismiss-nag=font-awesome-kirki' ), 'kirki-dismiss-nag', 'nonce' ) ); ?>"><?php esc_html_e( 'Don\'t show this again', 'kirki' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismisses the nag.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.42
|
||||
* @return void
|
||||
*/
|
||||
public function dismiss_nag() {
|
||||
if ( isset( $_GET['nonce'] ) && wp_verify_nonce( $_GET['nonce'], 'kirki-dismiss-nag' ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput
|
||||
if ( get_current_user_id() && isset( $_GET['dismiss-nag'] ) && 'font-awesome-kirki' === $_GET['dismiss-nag'] ) {
|
||||
update_user_meta( get_current_user_id(), 'kirki_fa_nag_dismissed', true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles showing a nag if the theme is using the deprecated fontawesome field
|
||||
*
|
||||
* @static
|
||||
* @access protected
|
||||
* @since 3.0.42
|
||||
* @param array $args The field arguments.
|
||||
* @return void
|
||||
*/
|
||||
protected static function maybe_show_fontawesome_nag( $args ) {
|
||||
|
||||
// If we already know we want it, skip check.
|
||||
if ( self::$show_fa_nag ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the field is fontawesome.
|
||||
if ( isset( $args['type'] ) && in_array( $args['type'], [ 'fontawesome', 'kirki-fontawesome' ], true ) ) {
|
||||
|
||||
// Skip check if theme has disabled FA enqueueing via a filter.
|
||||
if ( ! apply_filters( 'kirki_load_fontawesome', true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we got this far, we need to show the nag.
|
||||
self::$show_fa_nag = true;
|
||||
}
|
||||
}
|
||||
}
|
304
functions/kirki/kirki-packages/compatibility/src/Kirki.php
Normal file
|
@ -0,0 +1,304 @@
|
|||
<?php
|
||||
/**
|
||||
* The Kirki API class.
|
||||
* Takes care of adding panels, sections & fields to the customizer.
|
||||
* For documentation please see https://github.com/aristath/kirki/wiki
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Core
|
||||
* @author Themeum
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Compatibility;
|
||||
|
||||
// ? Bagus: do we really need these? They are already under the same namespace as Kirki class (this file).
|
||||
use Kirki\Compatibility\Config;
|
||||
use Kirki\Compatibility\Field;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class acts as an interface.
|
||||
* Developers may use this object to add configurations, fields, panels and sections.
|
||||
* You can also access all available configurations, fields, panels and sections
|
||||
* by accessing the object's static properties.
|
||||
*/
|
||||
class Kirki extends Init {
|
||||
|
||||
/**
|
||||
* URL to the Kirki folder.
|
||||
*
|
||||
* @deprecated This is no longer used. Only kept here for backwards compatibility to avoid fatal errors.
|
||||
* @static
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public static $url;
|
||||
|
||||
/**
|
||||
* An array containing all configurations.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public static $config = [];
|
||||
|
||||
/**
|
||||
* An array containing all fields for compatibility purpose.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public static $fields = [];
|
||||
|
||||
/**
|
||||
* An array containing all fields.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public static $all_fields = [];
|
||||
|
||||
/**
|
||||
* An array containing all controls to be removed.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 3.0.17
|
||||
* @var array
|
||||
*/
|
||||
public static $controls_to_remove = [];
|
||||
|
||||
/**
|
||||
* Modules object.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
* @var object
|
||||
*/
|
||||
public $modules;
|
||||
|
||||
/**
|
||||
* Get the value of an option from the db.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $config_id The ID of the configuration corresponding to this field.
|
||||
* @param string $field_id The field_id (defined as 'settings' in the field arguments).
|
||||
* @return mixed The saved value of the field.
|
||||
*/
|
||||
public static function get_option( $config_id = '', $field_id = '' ) {
|
||||
|
||||
return Values::get_value( $config_id, $field_id );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the configuration options.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $config_id The configuration ID.
|
||||
* @param array $args The configuration options.
|
||||
*/
|
||||
public static function add_config( $config_id, $args = [] ) {
|
||||
|
||||
$config = Config::get_instance( $config_id, $args );
|
||||
$config_args = $config->get_config();
|
||||
|
||||
self::$config[ $config_args['id'] ] = $config_args;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new panel.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $id The ID for this panel.
|
||||
* @param array $args The panel arguments.
|
||||
*/
|
||||
public static function add_panel( $id = '', $args = [] ) {
|
||||
|
||||
new \Kirki\Panel( $id, $args );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a panel.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 3.0.17
|
||||
* @param string $id The ID for this panel.
|
||||
*/
|
||||
public static function remove_panel( $id = '' ) {
|
||||
|
||||
$panel = new \Kirki\Panel( $id );
|
||||
$panel->remove();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new section.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $id The ID for this section.
|
||||
* @param array $args The section arguments.
|
||||
*/
|
||||
public static function add_section( $id, $args ) {
|
||||
|
||||
new \Kirki\Section( $id, $args );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a section.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 3.0.17
|
||||
* @param string $id The ID for this section.
|
||||
*/
|
||||
public static function remove_section( $id = '' ) {
|
||||
|
||||
$section = new \Kirki\Section( $id );
|
||||
$section->remove();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new field.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $config_id The configuration ID for this field.
|
||||
* @param array $args The field arguments.
|
||||
*/
|
||||
public static function add_field( $config_id, $args = [] ) {
|
||||
|
||||
if ( doing_action( 'customize_register' ) ) {
|
||||
_doing_it_wrong( __METHOD__, esc_html__( 'Kirki fields should not be added on customize_register. Please add them directly, or on init.', 'kirki' ), '3.0.10' );
|
||||
}
|
||||
|
||||
parent::maybe_show_fontawesome_nag( $args );
|
||||
|
||||
// Early exit if 'type' is not defined.
|
||||
if ( ! isset( $args['type'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$args = self::migrate_css_vars( $args );
|
||||
|
||||
$str = str_replace( [ '-', '_' ], ' ', $args['type'] );
|
||||
$classname = '\Kirki\Field\\' . str_replace( ' ', '_', ucwords( $str ) );
|
||||
|
||||
$config = Config::get_instance( $config_id )->get_config();
|
||||
$args['kirki_config'] = isset( $args['kirki_config'] ) ? $args['kirki_config'] : $config_id;
|
||||
|
||||
unset( $config['id'] );
|
||||
|
||||
$args = wp_parse_args( $args, $config );
|
||||
|
||||
if ( class_exists( $classname ) ) {
|
||||
unset( $args['type'] );
|
||||
new $classname( $args );
|
||||
return;
|
||||
}
|
||||
|
||||
new Field( $config_id, $args );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a control.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 3.0.17
|
||||
* @param string $id The field ID.
|
||||
*/
|
||||
public static function remove_control( $id ) {
|
||||
|
||||
if ( ! in_array( $id, self::$controls_to_remove, true ) ) {
|
||||
self::$controls_to_remove[] = $id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a parameter for a config-id.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 3.0.10
|
||||
* @param string $id The config-ID.
|
||||
* @param string $param The parameter we want.
|
||||
* @return string
|
||||
*/
|
||||
public static function get_config_param( $id, $param ) {
|
||||
|
||||
if ( ! isset( self::$config[ $id ] ) || ! isset( self::$config[ $id ][ $param ] ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return self::$config[ $id ][ $param ];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrate css-variables to output argument.
|
||||
*
|
||||
* This only exists for backwards-compatibility with the deprecated css-vars argument.
|
||||
*
|
||||
* @static
|
||||
* @since 4.0
|
||||
* @param array $args The field arguments.
|
||||
* @return array
|
||||
*/
|
||||
private static function migrate_css_vars( $args ) {
|
||||
|
||||
// Convert css_vars to output args.
|
||||
if ( isset( $args['css_vars'] ) ) {
|
||||
|
||||
if ( isset( $args['transport'] ) && 'postMessage' === $args['transport'] ) {
|
||||
$args['transport'] = 'auto';
|
||||
}
|
||||
|
||||
// Convert to properly-formatted arrays.
|
||||
$args['css_vars'] = (array) $args['css_vars'];
|
||||
|
||||
if ( isset( $args['css_vars'][0] ) && is_string( $args['css_vars'][0] ) ) {
|
||||
$args['css_vars'] = [ $args['css_vars'] ];
|
||||
}
|
||||
|
||||
foreach ( $args['css_vars'] as $css_var ) {
|
||||
$output = [
|
||||
'element' => ':root',
|
||||
'property' => $css_var[0],
|
||||
];
|
||||
if ( isset( $css_var[1] ) ) {
|
||||
$output['value_pattern'] = $css_var[1];
|
||||
}
|
||||
if ( isset( $css_var[2] ) ) {
|
||||
$output['choice'] = $css_var[2];
|
||||
}
|
||||
$args['output'][] = $output;
|
||||
}
|
||||
}
|
||||
|
||||
return $args;
|
||||
|
||||
}
|
||||
|
||||
}
|
161
functions/kirki/kirki-packages/compatibility/src/Modules.php
Normal file
|
@ -0,0 +1,161 @@
|
|||
<?php
|
||||
/**
|
||||
* Handles modules loading.
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Modules
|
||||
* @author Themeum
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 3.0.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Compatibility;
|
||||
|
||||
/**
|
||||
* The Modules class.
|
||||
*/
|
||||
class Modules {
|
||||
|
||||
|
||||
/**
|
||||
* An array of available modules.
|
||||
*
|
||||
* @static
|
||||
* @access private
|
||||
* @since 3.0.0
|
||||
* @var array
|
||||
*/
|
||||
private static $modules = [];
|
||||
|
||||
/**
|
||||
* An array of active modules (objects).
|
||||
*
|
||||
* @static
|
||||
* @access private
|
||||
* @since 3.0.0
|
||||
* @var array
|
||||
*/
|
||||
private static $active_modules = [];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
add_action( 'after_setup_theme', [ $this, 'setup_default_modules' ], 10 );
|
||||
add_action( 'after_setup_theme', [ $this, 'init' ], 11 );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default modules and apply the 'kirki_modules' filter.
|
||||
* In v3.0.35 this method was renamed from default_modules to setup_default_modules,
|
||||
* and its visibility changed from private to public to fix https://github.com/aristath/kirki/issues/2023
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public function setup_default_modules() {
|
||||
|
||||
self::$modules = apply_filters(
|
||||
'kirki_modules',
|
||||
[
|
||||
'css' => '\Kirki\Module\CSS',
|
||||
'tooltips' => '\Kirki\Module\Tooltips',
|
||||
'postMessage' => '\Kirki\Module\Postmessage',
|
||||
'selective-refresh' => '\Kirki\Module\Selective_Refresh',
|
||||
'field-dependencies' => '\Kirki\Module\Field_Dependencies',
|
||||
'webfonts' => '\Kirki\Module\Webfonts',
|
||||
'preset' => '\Kirki\Module\Preset',
|
||||
'gutenberg' => '\Kirki\Module\Editor_Styles',
|
||||
'section-icons' => '\Kirki\Module\Section_Icons',
|
||||
]
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates the modules.
|
||||
* In v3.0.35 the visibility for this method was changed
|
||||
* from private to public to fix https://github.com/aristath/kirki/issues/2023
|
||||
*
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public function init() {
|
||||
|
||||
foreach ( self::$modules as $module_class ) {
|
||||
if ( class_exists( $module_class ) ) {
|
||||
new $module_class();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a module.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $module The classname of the module to add.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function add_module( $module ) {
|
||||
|
||||
if ( ! in_array( $module, self::$modules, true ) ) {
|
||||
self::$modules[] = $module;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a module.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $module The classname of the module to add.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function remove_module( $module ) {
|
||||
|
||||
$key = array_search( $module, self::$modules, true );
|
||||
|
||||
if ( false !== $key ) {
|
||||
unset( self::$modules[ $key ] );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the modules array.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
* @return array
|
||||
*/
|
||||
public static function get_modules() {
|
||||
|
||||
return self::$modules;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array of active modules (objects).
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 3.0.0
|
||||
* @return array
|
||||
*/
|
||||
public static function get_active_modules() {
|
||||
|
||||
return self::$active_modules;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,209 @@
|
|||
<?php
|
||||
/**
|
||||
* Additional sanitization methods for controls.
|
||||
* These are used in the field's 'sanitize_callback' argument.
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Core
|
||||
* @author Themeum
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Compatibility;
|
||||
|
||||
use Kirki\Field\Checkbox;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple wrapper class for static methods.
|
||||
*/
|
||||
class Sanitize_Values {
|
||||
|
||||
/**
|
||||
* Checkbox sanitization callback.
|
||||
*
|
||||
* Sanitization callback for 'checkbox' type controls.
|
||||
* This callback sanitizes `$value` as a boolean value, either TRUE or FALSE.
|
||||
*
|
||||
* Deprecated. Use \Kirki\Field\Checkbox::sanitize() instead.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @see \Kirki\Field\Checkbox::sanitize()
|
||||
* @param bool|string $value Whether the checkbox is checked.
|
||||
* @return bool Whether the checkbox is checked.
|
||||
*/
|
||||
public static function checkbox( $value ) {
|
||||
$obj = new Checkbox();
|
||||
|
||||
// ! This sanitize function doesn't exist. A method exists check should be used before actually calling it.
|
||||
return (bool) $obj->sanitize( $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize number options.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 0.5
|
||||
* @param int|float|double|string $value The value to be sanitized.
|
||||
* @return integer|double|string
|
||||
*/
|
||||
public static function number( $value ) {
|
||||
return ( is_numeric( $value ) ) ? $value : intval( $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop-down Pages sanitization callback.
|
||||
*
|
||||
* - Sanitization: dropdown-pages
|
||||
* - Control: dropdown-pages
|
||||
*
|
||||
* Sanitization callback for 'dropdown-pages' type controls. This callback sanitizes `$page_id`
|
||||
* as an absolute integer, and then validates that $input is the ID of a published page.
|
||||
*
|
||||
* @see absint() https://developer.wordpress.org/reference/functions/absint/
|
||||
* @see get_post_status() https://developer.wordpress.org/reference/functions/get_post_status/
|
||||
*
|
||||
* @param int $page_id Page ID.
|
||||
* @param WP_Customize_Setting $setting Setting instance.
|
||||
* @return int|string Page ID if the page is published; otherwise, the setting default.
|
||||
*/
|
||||
public static function dropdown_pages( $page_id, $setting ) {
|
||||
|
||||
// Ensure $input is an absolute integer.
|
||||
$page_id = absint( $page_id );
|
||||
|
||||
// If $page_id is an ID of a published page, return it; otherwise, return the default.
|
||||
return ( 'publish' === get_post_status( $page_id ) ? $page_id : $setting->default );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitizes css dimensions.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 2.2.0
|
||||
* @param string $value The value to be sanitized.
|
||||
* @return string
|
||||
*/
|
||||
public static function css_dimension( $value ) {
|
||||
|
||||
// Trim it.
|
||||
$value = trim( $value );
|
||||
|
||||
// If the value is round, then return 50%.
|
||||
if ( 'round' === $value ) {
|
||||
$value = '50%';
|
||||
}
|
||||
|
||||
// If the value is empty, return empty.
|
||||
if ( '' === $value ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// If auto, inherit or initial, return the value.
|
||||
if ( 'auto' === $value || 'initial' === $value || 'inherit' === $value || 'normal' === $value ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
// Return empty if there are no numbers in the value.
|
||||
if ( ! preg_match( '#[0-9]#', $value ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// If we're using calc() then return the value.
|
||||
if ( false !== strpos( $value, 'calc(' ) ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
// The raw value without the units.
|
||||
$raw_value = self::filter_number( $value );
|
||||
$unit_used = '';
|
||||
|
||||
// An array of all valid CSS units. Their order was carefully chosen for this evaluation, don't mix it up!!!
|
||||
$units = [ 'fr', 'rem', 'em', 'ex', '%', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ch', 'vh', 'vw', 'vmin', 'vmax' ];
|
||||
foreach ( $units as $unit ) {
|
||||
if ( false !== strpos( $value, $unit ) ) {
|
||||
$unit_used = $unit;
|
||||
}
|
||||
}
|
||||
|
||||
// Hack for rem values.
|
||||
if ( 'em' === $unit_used && false !== strpos( $value, 'rem' ) ) {
|
||||
$unit_used = 'rem';
|
||||
}
|
||||
|
||||
return $raw_value . $unit_used;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters numeric values.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $value The value to be sanitized.
|
||||
* @return int|float
|
||||
*/
|
||||
public static function filter_number( $value ) {
|
||||
return filter_var( $value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize RGBA colors
|
||||
*
|
||||
* @static
|
||||
* @since 0.8.5
|
||||
* @param string $value The value to be sanitized.
|
||||
* @return string
|
||||
*/
|
||||
public static function rgba( $value ) {
|
||||
$color = \ariColor::newColor( $value );
|
||||
return $color->toCSS( 'rgba' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize colors.
|
||||
*
|
||||
* @static
|
||||
* @since 0.8.5
|
||||
* @param string $value The value to be sanitized.
|
||||
* @return string
|
||||
*/
|
||||
public static function color( $value ) {
|
||||
|
||||
// If the value is empty, then return empty.
|
||||
if ( '' === $value ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// If transparent, then return 'transparent'.
|
||||
if ( is_string( $value ) && 'transparent' === trim( $value ) ) {
|
||||
return 'transparent';
|
||||
}
|
||||
|
||||
// Instantiate the object.
|
||||
$color = \ariColor::newColor( $value );
|
||||
|
||||
// Return a CSS value, using the auto-detected mode.
|
||||
return $color->toCSS( $color->mode );
|
||||
}
|
||||
|
||||
/**
|
||||
* DOES NOT SANITIZE ANYTHING.
|
||||
*
|
||||
* @static
|
||||
* @since 0.5
|
||||
* @param int|string|array $value The value to be sanitized.
|
||||
* @return int|string|array
|
||||
*/
|
||||
public static function unfiltered( $value ) {
|
||||
return $value;
|
||||
}
|
||||
}
|
58
functions/kirki/kirki-packages/compatibility/src/Scripts.php
Normal file
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
/**
|
||||
* Registers scripts for WordPress Compatibility with versions prior to WP5.0
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Core
|
||||
* @author Themeum
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 0.1
|
||||
*/
|
||||
|
||||
namespace Kirki\Compatibility;
|
||||
|
||||
use Kirki\URL;
|
||||
|
||||
/**
|
||||
* Adds scripts for backwards-compatibility
|
||||
*
|
||||
* @since 0.1
|
||||
*/
|
||||
class Scripts {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @access public
|
||||
* @since 0.1
|
||||
*/
|
||||
public function __construct() {
|
||||
global $wp_version;
|
||||
|
||||
/**
|
||||
* Check if the WordPress version is lower than 5.0
|
||||
* If lower then we need to enqueue the backported scripts.
|
||||
*/
|
||||
if ( version_compare( $GLOBALS['wp_version'], '5.0', '<' ) ) {
|
||||
add_action( 'wp_enqueue_scripts', [ $this, 'register_scripts' ] );
|
||||
add_action( 'admin_register_scripts', [ $this, 'register_scripts' ] );
|
||||
add_action( 'customize_controls_enqueue_scripts', [ $this, 'register_scripts' ] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue missing WP scripts.
|
||||
*
|
||||
* @access public
|
||||
* @since 0.1
|
||||
* @return void
|
||||
*/
|
||||
public function register_scripts() {
|
||||
$folder_url = trailingslashit( URL::get_from_path( __DIR__ ) );
|
||||
wp_register_script( 'wp-polyfill', $folder_url . 'scripts/wp-polyfill.js', [], '7.0.0', false );
|
||||
wp_register_script( 'wp-hooks', $folder_url . 'scripts/hooks.js', [ 'wp-polyfill' ], '2.2.0', false );
|
||||
wp_register_script( 'wp-i18n', $folder_url . 'scripts/i18n.js', [ 'wp-polyfill' ], '3.3.0', false );
|
||||
}
|
||||
|
||||
}
|
157
functions/kirki/kirki-packages/compatibility/src/Settings.php
Normal file
|
@ -0,0 +1,157 @@
|
|||
<?php
|
||||
/**
|
||||
* Handles sections created via the Kirki API.
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Core
|
||||
* @author Themeum
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Compatibility;
|
||||
|
||||
/**
|
||||
* Each setting is a separate instance
|
||||
*/
|
||||
class Settings {
|
||||
|
||||
/**
|
||||
* The global $wp_customize object.
|
||||
*
|
||||
* @access protected
|
||||
* @var WP_Customize_Manager
|
||||
*/
|
||||
protected $wp_customize;
|
||||
|
||||
/**
|
||||
* The setting-stypes we're using.
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $setting_types = [];
|
||||
|
||||
/**
|
||||
* Creates a new Settings object.
|
||||
* Class constructor.
|
||||
*
|
||||
* @access public
|
||||
* @param array $args The field definition as sanitized in Kirki\Compatibility\Field.
|
||||
*/
|
||||
public function __construct( $args = [] ) {
|
||||
|
||||
// Set the $wp_customize property.
|
||||
global $wp_customize;
|
||||
if ( ! $wp_customize ) {
|
||||
return;
|
||||
}
|
||||
$this->wp_customize = $wp_customize;
|
||||
|
||||
// Set the setting_types.
|
||||
$this->set_setting_types();
|
||||
|
||||
// Add the settings.
|
||||
$this->add_settings( $args );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the settings for this field.
|
||||
* If settings are defined as an array, then it goes through them
|
||||
* and calls the add_setting method.
|
||||
* If not an array, then it just calls add_setting
|
||||
*
|
||||
* @access private
|
||||
* @param array $args The field definition as sanitized in Kirki\Compatibility\Field.
|
||||
*/
|
||||
final function add_settings( $args = [] ) {
|
||||
|
||||
// Get the classname we'll be using to create our setting(s).
|
||||
$classname = false;
|
||||
if ( isset( $args['option_type'] ) && array_key_exists( $args['option_type'], $this->setting_types ) ) {
|
||||
$classname = $this->setting_types[ $args['option_type'] ];
|
||||
}
|
||||
if ( ! isset( $args['type'] ) || ! array_key_exists( $args['type'], $this->setting_types ) ) {
|
||||
$args['type'] = 'default';
|
||||
}
|
||||
$classname = ! $classname ? $this->setting_types[ $args['type'] ] : $classname;
|
||||
|
||||
// If settings are defined as an array, then we need to go through them
|
||||
// and call add_setting for each one of them separately.
|
||||
if ( isset( $args['settings'] ) && is_array( $args['settings'] ) ) {
|
||||
|
||||
// Make sure defaults have been defined.
|
||||
if ( ! isset( $args['default'] ) || ! is_array( $args['default'] ) ) {
|
||||
$args['default'] = [];
|
||||
}
|
||||
foreach ( $args['settings'] as $key => $value ) {
|
||||
// ? Bagus: this $defaults var is not defined anywhere inside this function, so is this a mistake?
|
||||
$default = ( isset( $defaults[ $key ] ) ) ? $defaults[ $key ] : '';
|
||||
$this->add_setting( $classname, $value, $default, $args['option_type'], $args['capability'], $args['transport'], $args['sanitize_callback'] );
|
||||
}
|
||||
}
|
||||
$this->add_setting( $classname, $args['settings'], $args['default'], $args['option_type'], $args['capability'], $args['transport'], $args['sanitize_callback'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* This is where we're finally adding the setting to the Customizer.
|
||||
*
|
||||
* @access private
|
||||
* @param string $classname The name of the class that will be used to create this setting.
|
||||
* We're getting this from $this->setting_types.
|
||||
* @param string $setting The setting-name.
|
||||
* If settings is an array, then this method is called per-setting.
|
||||
* @param string|array $default Default value for this setting.
|
||||
* @param string $type The data type we're using. Valid options: theme_mod|option.
|
||||
* @param string $capability @see https://codex.wordpress.org/Roles_and_Capabilities.
|
||||
* @param string $transport Use refresh|postMessage.
|
||||
* @param string|array $sanitize_callback A callable sanitization function or method.
|
||||
*/
|
||||
final function add_setting( $classname, $setting, $default, $type, $capability, $transport, $sanitize_callback ) {
|
||||
|
||||
$this->wp_customize->add_setting(
|
||||
new $classname(
|
||||
$this->wp_customize,
|
||||
$setting,
|
||||
[
|
||||
'default' => $default,
|
||||
'type' => $type,
|
||||
'capability' => $capability,
|
||||
'transport' => $transport,
|
||||
'sanitize_callback' => $sanitize_callback,
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the $this->setting_types property.
|
||||
* Makes sure the kirki_setting_types filter is applied
|
||||
* and that the defined classes actually exist.
|
||||
* If a defined class does not exist, it is removed.
|
||||
*/
|
||||
final function set_setting_types() {
|
||||
|
||||
// Apply the kirki_setting_types filter.
|
||||
$this->setting_types = apply_filters(
|
||||
'kirki_setting_types',
|
||||
[
|
||||
'default' => 'WP_Customize_Setting',
|
||||
'repeater' => '\Kirki_Settings_Repeater_Setting',
|
||||
'user_meta' => '\Kirki\Util\Setting\User_Meta',
|
||||
'site_option' => '\Kirki\Util\Setting\Site_Option',
|
||||
]
|
||||
);
|
||||
|
||||
// Make sure the defined classes actually exist.
|
||||
foreach ( $this->setting_types as $key => $classname ) {
|
||||
|
||||
if ( ! class_exists( $classname ) ) {
|
||||
unset( $this->setting_types[ $key ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
124
functions/kirki/kirki-packages/compatibility/src/Values.php
Normal file
|
@ -0,0 +1,124 @@
|
|||
<?php
|
||||
/**
|
||||
* Helpers to get the values of a field.
|
||||
*
|
||||
* ! WARNING: PLEASE DO NOT USE THESE.
|
||||
* we only have these for backwards-compatibility purposes.
|
||||
* please use get_option() & get_theme_mod() instead.
|
||||
*
|
||||
* @package Kirki
|
||||
* @category Core
|
||||
* @author Themeum
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Compatibility;
|
||||
|
||||
/**
|
||||
* Wrapper class for static methods.
|
||||
*/
|
||||
class Values {
|
||||
|
||||
/**
|
||||
* Get the value of a field.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param string $config_id The configuration ID. @see Kirki\Compatibility\Config.
|
||||
* @param string $field_id The field ID.
|
||||
* @return string|array
|
||||
*/
|
||||
public static function get_value( $config_id = '', $field_id = '' ) {
|
||||
|
||||
// Make sure value is defined.
|
||||
$value = '';
|
||||
|
||||
// This allows us to skip the $config_id argument.
|
||||
// If we skip adding a $config_id, use the 'global' configuration.
|
||||
if ( ( '' === $field_id ) && '' !== $config_id ) {
|
||||
$field_id = $config_id;
|
||||
$config_id = 'global';
|
||||
}
|
||||
|
||||
// If $config_id is empty, set it to 'global'.
|
||||
$config_id = ( '' === $config_id ) ? 'global' : $config_id;
|
||||
|
||||
// Fallback to 'global' if $config_id is not found.
|
||||
if ( ! isset( Kirki::$config[ $config_id ] ) ) {
|
||||
$config_id = 'global';
|
||||
}
|
||||
|
||||
if ( 'theme_mod' === Kirki::$config[ $config_id ]['option_type'] ) {
|
||||
|
||||
// We're using theme_mods so just get the value using get_theme_mod.
|
||||
$default_value = null;
|
||||
|
||||
if ( isset( Kirki::$all_fields[ $field_id ] ) && isset( Kirki::$all_fields[ $field_id ]['default'] ) ) {
|
||||
$default_value = Kirki::$all_fields[ $field_id ]['default'];
|
||||
}
|
||||
|
||||
$value = get_theme_mod( $field_id, $default_value );
|
||||
|
||||
return apply_filters( 'kirki_values_get_value', $value, $field_id );
|
||||
}
|
||||
|
||||
if ( 'option' === Kirki::$config[ $config_id ]['option_type'] ) {
|
||||
|
||||
// We're using options.
|
||||
if ( '' !== Kirki::$config[ $config_id ]['option_name'] ) {
|
||||
// Options are serialized as a single option in the db.
|
||||
// We'll have to get the option and then get the item from the array.
|
||||
$options = get_option( Kirki::$config[ $config_id ]['option_name'] );
|
||||
|
||||
if ( ! isset( Kirki::$all_fields[ $field_id ] ) && isset( Kirki::$all_fields[ Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']' ] ) ) {
|
||||
$field_id = Kirki::$config[ $config_id ]['option_name'] . '[' . $field_id . ']';
|
||||
}
|
||||
|
||||
$setting_modified = str_replace( ']', '', str_replace( Kirki::$config[ $config_id ]['option_name'] . '[', '', $field_id ) );
|
||||
|
||||
$default_value = ( isset( Kirki::$all_fields[ $field_id ] ) && isset( Kirki::$all_fields[ $field_id ]['default'] ) ) ? Kirki::$all_fields[ $field_id ]['default'] : '';
|
||||
$value = ( isset( $options[ $setting_modified ] ) ) ? $options[ $setting_modified ] : $default_value;
|
||||
$value = maybe_unserialize( $value );
|
||||
|
||||
return apply_filters( 'kirki_values_get_value', $value, $field_id );
|
||||
}
|
||||
|
||||
// Each option separately saved in the db.
|
||||
$value = get_option( $field_id, Kirki::$all_fields[ $field_id ]['default'] );
|
||||
|
||||
return apply_filters( 'kirki_values_get_value', $value, $field_id );
|
||||
|
||||
}
|
||||
|
||||
return apply_filters( 'kirki_values_get_value', $value, $field_id );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value or fallsback to default.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @param array $field The field aruments.
|
||||
* @return string|array
|
||||
*/
|
||||
public static function get_sanitized_field_value( $field ) {
|
||||
$value = $field['default'];
|
||||
if ( ! isset( $field['option_type'] ) || 'theme_mod' === $field['option_type'] ) {
|
||||
$value = get_theme_mod( $field['settings'], $field['default'] );
|
||||
} elseif ( isset( $field['option_type'] ) && 'option' === $field['option_type'] ) {
|
||||
if ( isset( $field['option_name'] ) && '' !== $field['option_name'] ) {
|
||||
$all_values = get_option( $field['option_name'], [] );
|
||||
$sub_setting_id = str_replace( [ ']', $field['option_name'] . '[' ], '', $field['settings'] );
|
||||
if ( isset( $all_values[ $sub_setting_id ] ) ) {
|
||||
$value = $all_values[ $sub_setting_id ];
|
||||
}
|
||||
} else {
|
||||
$value = get_option( $field['settings'], $field['default'] );
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
// phpcs:ignoreFile
|
||||
|
||||
if ( ! class_exists( 'Kirki_Active_Callback' ) ) {
|
||||
// Removed in https://github.com/aristath/kirki/pull/1682/files
|
||||
class Kirki_Active_Callback {
|
||||
public static function evaluate() {
|
||||
_deprecated_function( __METHOD__, '3.0.17', null );
|
||||
return true;
|
||||
}
|
||||
private static function evaluate_requirement() {
|
||||
_deprecated_function( __METHOD__, '3.0.17', null );
|
||||
return true;
|
||||
}
|
||||
public static function compare( $value1, $value2, $operator ) {
|
||||
_deprecated_function( __METHOD__, '3.0.17', 'Kirki_Helper::compare_values' );
|
||||
return Kirki_Helper::compare_values( $value1, $value2, $operator );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated in v3.0.36
|
||||
*
|
||||
* Keeping it here in case a theme or plugin was using one of its public methods.
|
||||
* This is just to avoid fatal errors, it does not do anything.
|
||||
*/
|
||||
if ( ! class_exists( 'Kirki_CSS_To_File' ) ) {
|
||||
class Kirki_CSS_To_File {
|
||||
public function __construct() {}
|
||||
public function get_url() {}
|
||||
public function get_timestamp() {}
|
||||
public function write_file() {}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
<?php
|
||||
// phpcs:ignoreFile
|
||||
|
||||
add_filter( 'kirki_config', function( $args ) {
|
||||
return apply_filters( 'kirki/config', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_control_types', function( $args ) {
|
||||
return apply_filters( 'kirki/control_types', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_section_types', function( $args ) {
|
||||
return apply_filters( 'kirki/section_types', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_section_types_exclude', function( $args ) {
|
||||
return apply_filters( 'kirki/section_types/exclude', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_control_types_exclude', function( $args ) {
|
||||
return apply_filters( 'kirki/control_types/exclude', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_controls', function( $args ) {
|
||||
return apply_filters( 'kirki/controls', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_fields', function( $args ) {
|
||||
return apply_filters( 'kirki/fields', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_modules', function( $args ) {
|
||||
return apply_filters( 'kirki/modules', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_panel_types', function( $args ) {
|
||||
return apply_filters( 'kirki/panel_types', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_setting_types', function( $args ) {
|
||||
return apply_filters( 'kirki/setting_types', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_variable', function( $args ) {
|
||||
return apply_filters( 'kirki/variable', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_values_get_value', function( $arg1, $arg2 ) {
|
||||
return apply_filters( 'kirki/values/get_value', $arg1, $arg2 );
|
||||
}, 99, 2 );
|
||||
|
||||
add_action( 'init', function() {
|
||||
$config_ids = \Kirki\Compatibility\Config::get_config_ids();
|
||||
global $kirki_deprecated_filters_iteration;
|
||||
foreach ( $config_ids as $config_id ) {
|
||||
foreach( array(
|
||||
'/dynamic_css',
|
||||
'/output/control-classnames',
|
||||
'/css/skip_hidden',
|
||||
'/styles',
|
||||
'/output/property-classnames',
|
||||
'/webfonts/skip_hidden',
|
||||
) as $filter_suffix ) {
|
||||
$kirki_deprecated_filters_iteration = array( $config_id, $filter_suffix );
|
||||
add_filter( "kirki_{$config_id}_{$filter_suffix}", function( $args ) {
|
||||
global $kirki_deprecated_filters_iteration;
|
||||
$kirki_deprecated_filters_iteration[1] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[1] );
|
||||
return apply_filters( "kirki/{$kirki_deprecated_filters_iteration[0]}/{$kirki_deprecated_filters_iteration[1]}", $args );
|
||||
}, 99 );
|
||||
if ( false !== strpos( $kirki_deprecated_filters_iteration[1], '-' ) ) {
|
||||
$kirki_deprecated_filters_iteration[1] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[1] );
|
||||
add_filter( "kirki_{$config_id}_{$filter_suffix}", function( $args ) {
|
||||
global $kirki_deprecated_filters_iteration;
|
||||
$kirki_deprecated_filters_iteration[1] = str_replace( '-', '_', $kirki_deprecated_filters_iteration[1] );
|
||||
return apply_filters( "kirki/{$kirki_deprecated_filters_iteration[0]}/{$kirki_deprecated_filters_iteration[1]}", $args );
|
||||
}, 99 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_enqueue_google_fonts', function( $args ) {
|
||||
return apply_filters( 'kirki/enqueue_google_fonts', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_styles_array', function( $args ) {
|
||||
return apply_filters( 'kirki/styles_array', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_dynamic_css_method', function( $args ) {
|
||||
return apply_filters( 'kirki/dynamic_css/method', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_postmessage_script', function( $args ) {
|
||||
return apply_filters( 'kirki/postmessage/script', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_fonts_all', function( $args ) {
|
||||
return apply_filters( 'kirki/fonts/all', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_fonts_standard_fonts', function( $args ) {
|
||||
return apply_filters( 'kirki/fonts/standard_fonts', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_fonts_google_fonts', function( $args ) {
|
||||
return apply_filters( 'kirki/fonts/google_fonts', $args );
|
||||
}, 99 );
|
||||
|
||||
add_filter( 'kirki_googlefonts_load_method', function( $args ) {
|
||||
return apply_filters( 'kirki/googlefonts_load_method', $args );
|
||||
}, 99 );
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
// phpcs:ignoreFile
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'kirki_get_option' ) ) {
|
||||
/**
|
||||
* Get the value of a field.
|
||||
* This is a deprecated function that we used when there was no API.
|
||||
* Please use get_theme_mod() or get_option() instead.
|
||||
* @see https://developer.wordpress.org/reference/functions/get_theme_mod/
|
||||
* @see https://developer.wordpress.org/reference/functions/get_option/
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function kirki_get_option( $option = '' ) {
|
||||
_deprecated_function( __FUNCTION__, '1.0.0', sprintf( esc_html__( '%1$s or %2$s', 'kirki' ), 'get_theme_mod', 'get_option' ) );
|
||||
return Kirki::get_option( '', $option );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'kirki_sanitize_hex' ) ) {
|
||||
function kirki_sanitize_hex( $color ) {
|
||||
_deprecated_function( __FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->toCSS( \'hex\' )' );
|
||||
return Kirki_Color::sanitize_hex( $color );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'kirki_get_rgb' ) ) {
|
||||
function kirki_get_rgb( $hex, $implode = false ) {
|
||||
_deprecated_function( __FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->toCSS( \'rgb\' )' );
|
||||
return Kirki_Color::get_rgb( $hex, $implode );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'kirki_get_rgba' ) ) {
|
||||
function kirki_get_rgba( $hex = '#fff', $opacity = 100 ) {
|
||||
_deprecated_function( __FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->toCSS( \'rgba\' )' );
|
||||
return Kirki_Color::get_rgba( $hex, $opacity );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'kirki_get_brightness' ) ) {
|
||||
function kirki_get_brightness( $hex ) {
|
||||
_deprecated_function( __FUNCTION__, '1.0.0', 'ariColor::newColor( $color )->lightness' );
|
||||
return Kirki_Color::get_brightness( $hex );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'Kirki' ) ) {
|
||||
function Kirki() {
|
||||
return \Kirki\Compatibility\Framework::get_instance();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,623 @@
|
|||
this["wp"] = this["wp"] || {}; this["wp"]["hooks"] =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(installedModules[moduleId]) {
|
||||
/******/ return installedModules[moduleId].exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = installedModules[moduleId] = {
|
||||
/******/ i: moduleId,
|
||||
/******/ l: false,
|
||||
/******/ exports: {}
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Execute the module function
|
||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/
|
||||
/******/ // Flag the module as loaded
|
||||
/******/ module.l = true;
|
||||
/******/
|
||||
/******/ // Return the exports of the module
|
||||
/******/ return module.exports;
|
||||
/******/ }
|
||||
/******/
|
||||
/******/
|
||||
/******/ // expose the modules object (__webpack_modules__)
|
||||
/******/ __webpack_require__.m = modules;
|
||||
/******/
|
||||
/******/ // expose the module cache
|
||||
/******/ __webpack_require__.c = installedModules;
|
||||
/******/
|
||||
/******/ // define getter function for harmony exports
|
||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||
/******/ }
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // define __esModule on exports
|
||||
/******/ __webpack_require__.r = function(exports) {
|
||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
/******/ }
|
||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // create a fake namespace object
|
||||
/******/ // mode & 1: value is a module id, require it
|
||||
/******/ // mode & 2: merge all properties of value into the ns
|
||||
/******/ // mode & 4: return value when already ns object
|
||||
/******/ // mode & 8|1: behave like require
|
||||
/******/ __webpack_require__.t = function(value, mode) {
|
||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||
/******/ if(mode & 8) return value;
|
||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||
/******/ var ns = Object.create(null);
|
||||
/******/ __webpack_require__.r(ns);
|
||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
||||
/******/ return ns;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||
/******/ __webpack_require__.n = function(module) {
|
||||
/******/ var getter = module && module.__esModule ?
|
||||
/******/ function getDefault() { return module['default']; } :
|
||||
/******/ function getModuleExports() { return module; };
|
||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||
/******/ return getter;
|
||||
/******/ };
|
||||
/******/
|
||||
/******/ // Object.prototype.hasOwnProperty.call
|
||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||
/******/
|
||||
/******/ // __webpack_public_path__
|
||||
/******/ __webpack_require__.p = "";
|
||||
/******/
|
||||
/******/
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(__webpack_require__.s = 366);
|
||||
/******/ })
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ 366:
|
||||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/validateNamespace.js
|
||||
/**
|
||||
* Validate a namespace string.
|
||||
*
|
||||
* @param {string} namespace The namespace to validate - should take the form
|
||||
* `vendor/plugin/function`.
|
||||
*
|
||||
* @return {boolean} Whether the namespace is valid.
|
||||
*/
|
||||
function validateNamespace(namespace) {
|
||||
if ('string' !== typeof namespace || '' === namespace) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('The namespace must be a non-empty string.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(namespace)) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('The namespace can only contain numbers, letters, dashes, periods, underscores and slashes.');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* harmony default export */ var build_module_validateNamespace = (validateNamespace);
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/validateHookName.js
|
||||
/**
|
||||
* Validate a hookName string.
|
||||
*
|
||||
* @param {string} hookName The hook name to validate. Should be a non empty string containing
|
||||
* only numbers, letters, dashes, periods and underscores. Also,
|
||||
* the hook name cannot begin with `__`.
|
||||
*
|
||||
* @return {boolean} Whether the hook name is valid.
|
||||
*/
|
||||
function validateHookName(hookName) {
|
||||
if ('string' !== typeof hookName || '' === hookName) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('The hook name must be a non-empty string.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (/^__/.test(hookName)) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('The hook name cannot begin with `__`.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(hookName)) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('The hook name can only contain numbers, letters, dashes, periods and underscores.');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* harmony default export */ var build_module_validateHookName = (validateHookName);
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createAddHook.js
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns a function which, when invoked, will add a hook.
|
||||
*
|
||||
* @param {Object} hooks Stored hooks, keyed by hook name.
|
||||
*
|
||||
* @return {Function} Function that adds a new hook.
|
||||
*/
|
||||
|
||||
function createAddHook(hooks) {
|
||||
/**
|
||||
* Adds the hook to the appropriate hooks container.
|
||||
*
|
||||
* @param {string} hookName Name of hook to add
|
||||
* @param {string} namespace The unique namespace identifying the callback in the form `vendor/plugin/function`.
|
||||
* @param {Function} callback Function to call when the hook is run
|
||||
* @param {?number} priority Priority of this hook (default=10)
|
||||
*/
|
||||
return function addHook(hookName, namespace, callback) {
|
||||
var priority = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10;
|
||||
|
||||
if (!build_module_validateHookName(hookName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!build_module_validateNamespace(namespace)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ('function' !== typeof callback) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('The hook callback must be a function.');
|
||||
return;
|
||||
} // Validate numeric priority
|
||||
|
||||
|
||||
if ('number' !== typeof priority) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('If specified, the hook priority must be a number.');
|
||||
return;
|
||||
}
|
||||
|
||||
var handler = {
|
||||
callback: callback,
|
||||
priority: priority,
|
||||
namespace: namespace
|
||||
};
|
||||
|
||||
if (hooks[hookName]) {
|
||||
// Find the correct insert index of the new hook.
|
||||
var handlers = hooks[hookName].handlers;
|
||||
var i;
|
||||
|
||||
for (i = handlers.length; i > 0; i--) {
|
||||
if (priority >= handlers[i - 1].priority) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i === handlers.length) {
|
||||
// If append, operate via direct assignment.
|
||||
handlers[i] = handler;
|
||||
} else {
|
||||
// Otherwise, insert before index via splice.
|
||||
handlers.splice(i, 0, handler);
|
||||
} // We may also be currently executing this hook. If the callback
|
||||
// we're adding would come after the current callback, there's no
|
||||
// problem; otherwise we need to increase the execution index of
|
||||
// any other runs by 1 to account for the added element.
|
||||
|
||||
|
||||
(hooks.__current || []).forEach(function (hookInfo) {
|
||||
if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
|
||||
hookInfo.currentIndex++;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// This is the first hook of its type.
|
||||
hooks[hookName] = {
|
||||
handlers: [handler],
|
||||
runs: 0
|
||||
};
|
||||
}
|
||||
|
||||
if (hookName !== 'hookAdded') {
|
||||
doAction('hookAdded', hookName, namespace, callback, priority);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/* harmony default export */ var build_module_createAddHook = (createAddHook);
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createRemoveHook.js
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns a function which, when invoked, will remove a specified hook or all
|
||||
* hooks by the given name.
|
||||
*
|
||||
* @param {Object} hooks Stored hooks, keyed by hook name.
|
||||
* @param {boolean} removeAll Whether to remove all callbacks for a hookName, without regard to namespace. Used to create `removeAll*` functions.
|
||||
*
|
||||
* @return {Function} Function that removes hooks.
|
||||
*/
|
||||
|
||||
function createRemoveHook(hooks, removeAll) {
|
||||
/**
|
||||
* Removes the specified callback (or all callbacks) from the hook with a
|
||||
* given hookName and namespace.
|
||||
*
|
||||
* @param {string} hookName The name of the hook to modify.
|
||||
* @param {string} namespace The unique namespace identifying the callback in the form `vendor/plugin/function`.
|
||||
*
|
||||
* @return {number} The number of callbacks removed.
|
||||
*/
|
||||
return function removeHook(hookName, namespace) {
|
||||
if (!build_module_validateHookName(hookName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!removeAll && !build_module_validateNamespace(namespace)) {
|
||||
return;
|
||||
} // Bail if no hooks exist by this name
|
||||
|
||||
|
||||
if (!hooks[hookName]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var handlersRemoved = 0;
|
||||
|
||||
if (removeAll) {
|
||||
handlersRemoved = hooks[hookName].handlers.length;
|
||||
hooks[hookName] = {
|
||||
runs: hooks[hookName].runs,
|
||||
handlers: []
|
||||
};
|
||||
} else {
|
||||
// Try to find the specified callback to remove.
|
||||
var handlers = hooks[hookName].handlers;
|
||||
|
||||
var _loop = function _loop(i) {
|
||||
if (handlers[i].namespace === namespace) {
|
||||
handlers.splice(i, 1);
|
||||
handlersRemoved++; // This callback may also be part of a hook that is
|
||||
// currently executing. If the callback we're removing
|
||||
// comes after the current callback, there's no problem;
|
||||
// otherwise we need to decrease the execution index of any
|
||||
// other runs by 1 to account for the removed element.
|
||||
|
||||
(hooks.__current || []).forEach(function (hookInfo) {
|
||||
if (hookInfo.name === hookName && hookInfo.currentIndex >= i) {
|
||||
hookInfo.currentIndex--;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
for (var i = handlers.length - 1; i >= 0; i--) {
|
||||
_loop(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (hookName !== 'hookRemoved') {
|
||||
doAction('hookRemoved', hookName, namespace);
|
||||
}
|
||||
|
||||
return handlersRemoved;
|
||||
};
|
||||
}
|
||||
|
||||
/* harmony default export */ var build_module_createRemoveHook = (createRemoveHook);
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createHasHook.js
|
||||
/**
|
||||
* Returns a function which, when invoked, will return whether any handlers are
|
||||
* attached to a particular hook.
|
||||
*
|
||||
* @param {Object} hooks Stored hooks, keyed by hook name.
|
||||
*
|
||||
* @return {Function} Function that returns whether any handlers are
|
||||
* attached to a particular hook.
|
||||
*/
|
||||
function createHasHook(hooks) {
|
||||
/**
|
||||
* Returns how many handlers are attached for the given hook.
|
||||
*
|
||||
* @param {string} hookName The name of the hook to check for.
|
||||
*
|
||||
* @return {boolean} Whether there are handlers that are attached to the given hook.
|
||||
*/
|
||||
return function hasHook(hookName) {
|
||||
return hookName in hooks;
|
||||
};
|
||||
}
|
||||
|
||||
/* harmony default export */ var build_module_createHasHook = (createHasHook);
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createRunHook.js
|
||||
/**
|
||||
* Returns a function which, when invoked, will execute all callbacks
|
||||
* registered to a hook of the specified type, optionally returning the final
|
||||
* value of the call chain.
|
||||
*
|
||||
* @param {Object} hooks Stored hooks, keyed by hook name.
|
||||
* @param {?boolean} returnFirstArg Whether each hook callback is expected to
|
||||
* return its first argument.
|
||||
*
|
||||
* @return {Function} Function that runs hook callbacks.
|
||||
*/
|
||||
function createRunHook(hooks, returnFirstArg) {
|
||||
/**
|
||||
* Runs all callbacks for the specified hook.
|
||||
*
|
||||
* @param {string} hookName The name of the hook to run.
|
||||
* @param {...*} args Arguments to pass to the hook callbacks.
|
||||
*
|
||||
* @return {*} Return value of runner, if applicable.
|
||||
*/
|
||||
return function runHooks(hookName) {
|
||||
if (!hooks[hookName]) {
|
||||
hooks[hookName] = {
|
||||
handlers: [],
|
||||
runs: 0
|
||||
};
|
||||
}
|
||||
|
||||
hooks[hookName].runs++;
|
||||
var handlers = hooks[hookName].handlers;
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
args[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
if (!handlers || !handlers.length) {
|
||||
return returnFirstArg ? args[0] : undefined;
|
||||
}
|
||||
|
||||
var hookInfo = {
|
||||
name: hookName,
|
||||
currentIndex: 0
|
||||
};
|
||||
|
||||
hooks.__current.push(hookInfo);
|
||||
|
||||
while (hookInfo.currentIndex < handlers.length) {
|
||||
var handler = handlers[hookInfo.currentIndex];
|
||||
var result = handler.callback.apply(null, args);
|
||||
|
||||
if (returnFirstArg) {
|
||||
args[0] = result;
|
||||
}
|
||||
|
||||
hookInfo.currentIndex++;
|
||||
}
|
||||
|
||||
hooks.__current.pop();
|
||||
|
||||
if (returnFirstArg) {
|
||||
return args[0];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/* harmony default export */ var build_module_createRunHook = (createRunHook);
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createCurrentHook.js
|
||||
/**
|
||||
* Returns a function which, when invoked, will return the name of the
|
||||
* currently running hook, or `null` if no hook of the given type is currently
|
||||
* running.
|
||||
*
|
||||
* @param {Object} hooks Stored hooks, keyed by hook name.
|
||||
*
|
||||
* @return {Function} Function that returns the current hook.
|
||||
*/
|
||||
function createCurrentHook(hooks) {
|
||||
/**
|
||||
* Returns the name of the currently running hook, or `null` if no hook of
|
||||
* the given type is currently running.
|
||||
*
|
||||
* @return {?string} The name of the currently running hook, or
|
||||
* `null` if no hook is currently running.
|
||||
*/
|
||||
return function currentHook() {
|
||||
if (!hooks.__current || !hooks.__current.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return hooks.__current[hooks.__current.length - 1].name;
|
||||
};
|
||||
}
|
||||
|
||||
/* harmony default export */ var build_module_createCurrentHook = (createCurrentHook);
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createDoingHook.js
|
||||
/**
|
||||
* Returns a function which, when invoked, will return whether a hook is
|
||||
* currently being executed.
|
||||
*
|
||||
* @param {Object} hooks Stored hooks, keyed by hook name.
|
||||
*
|
||||
* @return {Function} Function that returns whether a hook is currently
|
||||
* being executed.
|
||||
*/
|
||||
function createDoingHook(hooks) {
|
||||
/**
|
||||
* Returns whether a hook is currently being executed.
|
||||
*
|
||||
* @param {?string} hookName The name of the hook to check for. If
|
||||
* omitted, will check for any hook being executed.
|
||||
*
|
||||
* @return {boolean} Whether the hook is being executed.
|
||||
*/
|
||||
return function doingHook(hookName) {
|
||||
// If the hookName was not passed, check for any current hook.
|
||||
if ('undefined' === typeof hookName) {
|
||||
return 'undefined' !== typeof hooks.__current[0];
|
||||
} // Return the __current hook.
|
||||
|
||||
|
||||
return hooks.__current[0] ? hookName === hooks.__current[0].name : false;
|
||||
};
|
||||
}
|
||||
|
||||
/* harmony default export */ var build_module_createDoingHook = (createDoingHook);
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createDidHook.js
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns a function which, when invoked, will return the number of times a
|
||||
* hook has been called.
|
||||
*
|
||||
* @param {Object} hooks Stored hooks, keyed by hook name.
|
||||
*
|
||||
* @return {Function} Function that returns a hook's call count.
|
||||
*/
|
||||
|
||||
function createDidHook(hooks) {
|
||||
/**
|
||||
* Returns the number of times an action has been fired.
|
||||
*
|
||||
* @param {string} hookName The hook name to check.
|
||||
*
|
||||
* @return {number} The number of times the hook has run.
|
||||
*/
|
||||
return function didHook(hookName) {
|
||||
if (!build_module_validateHookName(hookName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return hooks[hookName] && hooks[hookName].runs ? hooks[hookName].runs : 0;
|
||||
};
|
||||
}
|
||||
|
||||
/* harmony default export */ var build_module_createDidHook = (createDidHook);
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createHooks.js
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns an instance of the hooks object.
|
||||
*
|
||||
* @return {Object} Object that contains all hooks.
|
||||
*/
|
||||
|
||||
function createHooks() {
|
||||
var actions = Object.create(null);
|
||||
var filters = Object.create(null);
|
||||
actions.__current = [];
|
||||
filters.__current = [];
|
||||
return {
|
||||
addAction: build_module_createAddHook(actions),
|
||||
addFilter: build_module_createAddHook(filters),
|
||||
removeAction: build_module_createRemoveHook(actions),
|
||||
removeFilter: build_module_createRemoveHook(filters),
|
||||
hasAction: build_module_createHasHook(actions),
|
||||
hasFilter: build_module_createHasHook(filters),
|
||||
removeAllActions: build_module_createRemoveHook(actions, true),
|
||||
removeAllFilters: build_module_createRemoveHook(filters, true),
|
||||
doAction: build_module_createRunHook(actions),
|
||||
applyFilters: build_module_createRunHook(filters, true),
|
||||
currentAction: build_module_createCurrentHook(actions),
|
||||
currentFilter: build_module_createCurrentHook(filters),
|
||||
doingAction: build_module_createDoingHook(actions),
|
||||
doingFilter: build_module_createDoingHook(filters),
|
||||
didAction: build_module_createDidHook(actions),
|
||||
didFilter: build_module_createDidHook(filters),
|
||||
actions: actions,
|
||||
filters: filters
|
||||
};
|
||||
}
|
||||
|
||||
/* harmony default export */ var build_module_createHooks = (createHooks);
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/index.js
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addAction", function() { return addAction; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addFilter", function() { return addFilter; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeAction", function() { return removeAction; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeFilter", function() { return removeFilter; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasAction", function() { return hasAction; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasFilter", function() { return hasFilter; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeAllActions", function() { return removeAllActions; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeAllFilters", function() { return removeAllFilters; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doAction", function() { return doAction; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyFilters", function() { return applyFilters; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "currentAction", function() { return currentAction; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "currentFilter", function() { return currentFilter; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doingAction", function() { return doingAction; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doingFilter", function() { return doingFilter; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "didAction", function() { return didAction; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "didFilter", function() { return didFilter; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "actions", function() { return build_module_actions; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "filters", function() { return build_module_filters; });
|
||||
/* concated harmony reexport createHooks */__webpack_require__.d(__webpack_exports__, "createHooks", function() { return build_module_createHooks; });
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
|
||||
var _createHooks = build_module_createHooks(),
|
||||
addAction = _createHooks.addAction,
|
||||
addFilter = _createHooks.addFilter,
|
||||
removeAction = _createHooks.removeAction,
|
||||
removeFilter = _createHooks.removeFilter,
|
||||
hasAction = _createHooks.hasAction,
|
||||
hasFilter = _createHooks.hasFilter,
|
||||
removeAllActions = _createHooks.removeAllActions,
|
||||
removeAllFilters = _createHooks.removeAllFilters,
|
||||
doAction = _createHooks.doAction,
|
||||
applyFilters = _createHooks.applyFilters,
|
||||
currentAction = _createHooks.currentAction,
|
||||
currentFilter = _createHooks.currentFilter,
|
||||
doingAction = _createHooks.doingAction,
|
||||
doingFilter = _createHooks.doingFilter,
|
||||
didAction = _createHooks.didAction,
|
||||
didFilter = _createHooks.didFilter,
|
||||
build_module_actions = _createHooks.actions,
|
||||
build_module_filters = _createHooks.filters;
|
||||
|
||||
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
/******/ });
|
1140
functions/kirki/kirki-packages/compatibility/src/scripts/i18n.js
Normal file
21
functions/kirki/kirki-packages/control-base/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2019 kirki-framework
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
2
functions/kirki/kirki-packages/control-base/dist/control.css
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
@media screen and (min-width:1667px){.rtl .wp-full-overlay.expanded{margin-left:0;margin-right:300px}.wp-full-overlay.expanded{margin-left:300px}}#customize-theme-controls .customize-pane-child.open{overflow:visible}.wp-full-overlay-sidebar{width:300px}.expanded .wp-full-overlay-footer{max-width:299px}.kirki-w100{width:100%}.kirki-w50{width:50%}.kirki-w45{width:45%}.kirki-w40{width:40%}.kirki-w33{width:33.3333%}.kirki-w30{width:30%}.kirki-w25{width:25%}.kirki-w20{width:20%}.kirki-w15{width:15%}.kirki-w10{width:10%}.kirki-w5{width:5%}.control-section-kirki-default,.control-section-kirki-outer{min-height:100%}.customize-control-has-small-gap{margin-bottom:9px}.customize-control-is-gapless{margin-bottom:0}.customize-control-kirki-hidden-field{height:0;margin-bottom:0}.customize-control-kirki,.customize-control-kirki *{box-sizing:border-box}.customize-control-kirki.kirki-group-item{clear:none}.kirki-group-item{clear:none;float:left;padding-left:3px;padding-right:3px}.kirki-group-item.kirki-group-start{padding-left:0;padding-right:3px}.kirki-group-item.kirki-group-break,.kirki-group-item.kirki-group-end{padding-left:3px;padding-right:0}.kirki-group-item.kirki-group-end:after{clear:both;content:"";display:block;height:0;width:100%}.customize-control-kirki{position:relative}.customize-control-kirki .kirki-control-label,.customize-control-kirki label.customize-control-title{display:block}.customize-control-kirki .kirki-control-form{position:relative}.customize-control-kirki .kirki-control-form textarea{display:block;width:100%}
|
||||
/*# sourceMappingURL=control.css.map */
|
1
functions/kirki/kirki-packages/control-base/dist/control.css.map
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"mappings":"AACE,qCACE,+BAEE,aAAA,CADA,kBCCJ,CCDA,0BACE,iBDMF,CALF,CCGA,qDACE,gBDKF,CCFA,yBACE,WDKF,CCFA,kCACE,eDKF,CCFA,YACE,UDKF,CCFA,WACE,SDKF,CCFA,WACE,SDKF,CCFA,WACE,SDKF,CCFA,WACE,cDKF,CCFA,WACE,SDKF,CCFA,WACE,SDKF,CCFA,WACE,SDKF,CCFA,WACE,SDKF,CCFA,WACE,SDKF,CCFA,UACE,QDKF,CCFA,4DAEE,eDKF,CCFA,iCACE,iBDKF,CCFA,8BACE,eDKF,CCFA,sCAEE,QAAA,CADA,eDMF,CCFA,oDAEE,qBDKF,CCFA,0CACE,UDKF,CCFA,kBAEE,UAAA,CADA,UAAA,CAEA,gBAAA,CACA,iBDKF,CCHE,oCACE,cAAA,CACA,iBDKJ,CCFE,sEAEE,gBAAA,CACA,eDGJ,CCCI,wCAKE,UAAA,CAJA,UAAA,CACA,aAAA,CAEA,QAAA,CADA,UDGN,CCIA,yBACE,iBDDF,CCGE,qGAEE,aDDJ,CCIE,6CACE,iBDFJ,CCII,sDACE,aAAA,CACA,UDFN","sources":["src/rtl.scss","%3Cinput%20css%20N7IR_2%3E","src/control.scss"],"sourcesContent":[".rtl {\n @media screen and (min-width: 1667px) {\n .wp-full-overlay.expanded {\n margin-right: 300px;\n margin-left: 0;\n }\n }\n}\n","@media screen and (min-width: 1667px) {\n .rtl .wp-full-overlay.expanded {\n margin-right: 300px;\n margin-left: 0;\n }\n}\n\n@media screen and (min-width: 1667px) {\n .wp-full-overlay.expanded {\n margin-left: 300px;\n }\n}\n#customize-theme-controls .customize-pane-child.open {\n overflow: visible;\n}\n\n.wp-full-overlay-sidebar {\n width: 300px;\n}\n\n.expanded .wp-full-overlay-footer {\n max-width: 299px;\n}\n\n.kirki-w100 {\n width: 100%;\n}\n\n.kirki-w50 {\n width: 50%;\n}\n\n.kirki-w45 {\n width: 45%;\n}\n\n.kirki-w40 {\n width: 40%;\n}\n\n.kirki-w33 {\n width: 33.3333%;\n}\n\n.kirki-w30 {\n width: 30%;\n}\n\n.kirki-w25 {\n width: 25%;\n}\n\n.kirki-w20 {\n width: 20%;\n}\n\n.kirki-w15 {\n width: 15%;\n}\n\n.kirki-w10 {\n width: 10%;\n}\n\n.kirki-w5 {\n width: 5%;\n}\n\n.control-section-kirki-default,\n.control-section-kirki-outer {\n min-height: 100%;\n}\n\n.customize-control-has-small-gap {\n margin-bottom: 9px;\n}\n\n.customize-control-is-gapless {\n margin-bottom: 0;\n}\n\n.customize-control-kirki-hidden-field {\n margin-bottom: 0;\n height: 0;\n}\n\n.customize-control-kirki,\n.customize-control-kirki * {\n box-sizing: border-box;\n}\n\n.customize-control-kirki.kirki-group-item {\n clear: none;\n}\n\n.kirki-group-item {\n float: left;\n clear: none;\n padding-left: 3px;\n padding-right: 3px;\n}\n.kirki-group-item.kirki-group-start {\n padding-left: 0;\n padding-right: 3px;\n}\n.kirki-group-item.kirki-group-break, .kirki-group-item.kirki-group-end {\n padding-left: 3px;\n padding-right: 0;\n}\n.kirki-group-item.kirki-group-end::after {\n content: \"\";\n display: block;\n width: 100%;\n height: 0;\n clear: both;\n}\n\n.customize-control-kirki {\n position: relative;\n}\n.customize-control-kirki .kirki-control-label,\n.customize-control-kirki label.customize-control-title {\n display: block;\n}\n.customize-control-kirki .kirki-control-form {\n position: relative;\n}\n.customize-control-kirki .kirki-control-form textarea {\n display: block;\n width: 100%;\n}\n/*# sourceMappingURL=control.css.map */\n","@import \"rtl.scss\";\n\n@media screen and (min-width: 1667px) {\n .wp-full-overlay.expanded {\n margin-left: 300px;\n }\n}\n\n#customize-theme-controls .customize-pane-child.open {\n overflow: visible;\n}\n\n.wp-full-overlay-sidebar {\n width: 300px;\n}\n\n.expanded .wp-full-overlay-footer {\n max-width: 299px;\n}\n\n.kirki-w100 {\n width: 100%;\n}\n\n.kirki-w50 {\n width: 50%;\n}\n\n.kirki-w45 {\n width: 45%;\n}\n\n.kirki-w40 {\n width: 40%;\n}\n\n.kirki-w33 {\n width: 33.3333%;\n}\n\n.kirki-w30 {\n width: 30%;\n}\n\n.kirki-w25 {\n width: 25%;\n}\n\n.kirki-w20 {\n width: 20%;\n}\n\n.kirki-w15 {\n width: 15%;\n}\n\n.kirki-w10 {\n width: 10%;\n}\n\n.kirki-w5 {\n width: 5%;\n}\n\n.control-section-kirki-default,\n.control-section-kirki-outer {\n min-height: 100%;\n}\n\n.customize-control-has-small-gap {\n margin-bottom: 9px;\n}\n\n.customize-control-is-gapless {\n margin-bottom: 0;\n}\n\n.customize-control-kirki-hidden-field {\n margin-bottom: 0;\n height: 0;\n}\n\n.customize-control-kirki,\n.customize-control-kirki * {\n box-sizing: border-box;\n}\n\n.customize-control-kirki.kirki-group-item {\n clear: none; // Override WordPress.\n}\n\n.kirki-group-item {\n float: left;\n clear: none;\n padding-left: 3px;\n padding-right: 3px;\n\n &.kirki-group-start {\n padding-left: 0;\n padding-right: 3px;\n }\n\n &.kirki-group-break,\n &.kirki-group-end {\n padding-left: 3px;\n padding-right: 0;\n }\n\n &.kirki-group-end {\n &::after {\n content: \"\";\n display: block;\n width: 100%;\n height: 0;\n clear: both;\n }\n }\n}\n\n.customize-control-kirki {\n position: relative;\n\n .kirki-control-label,\n label.customize-control-title {\n display: block;\n }\n\n .kirki-control-form {\n position: relative;\n\n textarea {\n display: block;\n width: 100%;\n }\n }\n}\n"],"names":[],"version":3,"file":"control.css.map"}
|
2
functions/kirki/kirki-packages/control-base/dist/control.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
!function(){var t;wp.customize.kirkiDynamicControl=wp.customize.Control.extend({initialize:function(t,e){var i,n=this,o=e||{};if(o.params=o.params||{},o.params.type||(o.params.type="kirki-generic"),o.content){var r=o.content.split('class="');r=r[1].split('"'),i=r[0]}else i="customize-control customize-control-"+o.params.type;!o.params.wrapper_attrs&&o.params.wrapper_atts&&(o.params.wrapper_attrs=o.params.wrapper_atts),o.params.content=jQuery("<li></li>"),o.params.content.attr("id","customize-control-"+t.replace(/]/g,"").replace(/\[/g,"-")),o.params.content.attr("class",i),_.each(o.params.wrapper_attrs,(function(t,e){"class"===e&&(t=t.replace("{default_class}",i)),o.params.content.attr(e,t)})),n.propertyElements=[],wp.customize.Control.prototype.initialize.call(n,t,o),wp.hooks.doAction("kirki.dynamicControl.init.after",t,n,o)},_setUpSettingRootLinks:function(){var t=this;t.container.find("[data-customize-setting-link]").each((function(){var e=jQuery(this);wp.customize(e.data("customizeSettingLink"),(function(i){var n=new wp.customize.Element(e);t.elements.push(n),n.sync(i),n.set(i())}))}))},_setUpSettingPropertyLinks:function(){var t=this;t.setting&&t.container.find("[data-customize-setting-property-link]").each((function(){var e,i=jQuery(this),n=i.data("customizeSettingPropertyLink");e=new wp.customize.Element(i),t.propertyElements.push(e),e.set(t.setting()[n]),e.bind((function(e){var i=t.setting();e!==i[n]&&((i=_.clone(i))[n]=e,t.setting.set(i))})),t.setting.bind((function(t){t[n]!==e.get()&&e.set(t[n])}))}))},ready:function(){var t=this;t._setUpSettingRootLinks(),t._setUpSettingPropertyLinks(),wp.customize.Control.prototype.ready.call(t),t.deferred.embedded.done((function(){t.initKirkiControl(),wp.hooks.doAction("kirki.dynamicControl.ready.deferred.embedded.done",t)})),wp.hooks.doAction("kirki.dynamicControl.ready.after",t)},embed:function(){var t=this,e=t.section();e&&(wp.customize.section(e,(function(e){"kirki-expanded"===e.params.type||e.expanded()||wp.customize.settings.autofocus.control===t.id?t.actuallyEmbed():e.expanded.bind((function(e){e&&t.actuallyEmbed()}))})),wp.hooks.doAction("kirki.dynamicControl.embed.after",t))},actuallyEmbed:function(){var t=this;"resolved"!==t.deferred.embedded.state()&&(t.renderContent(),t.deferred.embedded.resolve(),wp.hooks.doAction("kirki.dynamicControl.actuallyEmbed.after",t))},focus:function(t){var e=this;e.actuallyEmbed(),wp.customize.Control.prototype.focus.call(e,t),wp.hooks.doAction("kirki.dynamicControl.focus.after",e)},initKirkiControl:function(t){t=t||this,wp.hooks.doAction("kirki.dynamicControl.initKirkiControl",this),t.container.on("change keyup paste click","input",(function(){t.setting.set(jQuery(this).val())}))}}),(t=wp.customize).Value.prototype.set=function(e){var i,n,o=this._value;return e=this._setter.apply(this,arguments),null===(e=this.validate(e))||_.isEqual(o,e)||(this.id&&t.control(this.id)&&t.control(this.id).params&&t.control(this.id).params.parent_setting&&(i=t.control(this.id).params.parent_setting,(n={})[this.id.replace(i+"[","").replace("]","")]=e,t.control(i).setting.set(jQuery.extend({},t.control(i).setting._value,n))),this._value=e,this._dirty=!0,this.callbacks.fireWith(this,[e,o])),this},t.Value.prototype.get=function(){var e;return this.id&&t.control(this.id)&&t.control(this.id).params&&t.control(this.id).params.parent_setting?(e=t.control(this.id).params.parent_setting,t.control(e).setting.get()[this.id.replace(e+"[","").replace("]","")]):this._value}}();
|
||||
//# sourceMappingURL=control.js.map
|
1
functions/kirki/kirki-packages/control-base/dist/control.js.map
vendored
Normal file
347
functions/kirki/kirki-packages/control-base/src/Control/Base.php
Normal file
|
@ -0,0 +1,347 @@
|
|||
<?php
|
||||
/**
|
||||
* Customizer Controls Base.
|
||||
*
|
||||
* Extend this in other controls.
|
||||
*
|
||||
* @package kirki-framework/control-base
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Control;
|
||||
|
||||
use Kirki\URL;
|
||||
|
||||
/**
|
||||
* A base for controls.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
class Base extends \WP_Customize_Control {
|
||||
|
||||
/**
|
||||
* Used to automatically generate all CSS output.
|
||||
*
|
||||
* Whitelisting property for use in Kirki modules.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @var array
|
||||
*/
|
||||
public $output = [];
|
||||
|
||||
/**
|
||||
* Data type
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @var string
|
||||
*/
|
||||
public $option_type = 'theme_mod';
|
||||
|
||||
/**
|
||||
* Option name (if using options).
|
||||
*
|
||||
* Whitelisting property for use in Kirki modules.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @var string
|
||||
*/
|
||||
public $option_name = false;
|
||||
|
||||
/**
|
||||
* The kirki_config we're using for this control
|
||||
*
|
||||
* Whitelisting property for use in Kirki modules.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @var string
|
||||
*/
|
||||
public $kirki_config = 'global';
|
||||
|
||||
/**
|
||||
* Whitelisting the "preset" argument for use in Kirki modules.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @var array
|
||||
*/
|
||||
public $preset = [];
|
||||
|
||||
/**
|
||||
* Whitelisting the "css_vars" argument for use in Kirki modules.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @var string
|
||||
*/
|
||||
public $css_vars = '';
|
||||
|
||||
/**
|
||||
* The version. Used in scripts & styles for cache-busting.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @var string
|
||||
*/
|
||||
public static $control_ver = '1.0.4';
|
||||
|
||||
/**
|
||||
* Parent setting.
|
||||
*
|
||||
* Used for composite controls to denote the setting that should be saved.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1
|
||||
* @var string
|
||||
*/
|
||||
public $parent_setting;
|
||||
|
||||
/**
|
||||
* Wrapper attributes.
|
||||
*
|
||||
* The value of this property will be rendered to the wrapper element.
|
||||
* Can be 'class', 'id', 'data-*', and other attributes.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1
|
||||
* @var array
|
||||
*/
|
||||
public $wrapper_attrs = [];
|
||||
|
||||
/**
|
||||
* Backwards compatibility support for `$wrapper_attrs`.
|
||||
*
|
||||
* Kirki v3 already has this `$wrapper_atts` property.
|
||||
* It was not published in the documentation, and more for internal use.
|
||||
*
|
||||
* The `WP_Customize_Control` is using `input_attrs` not `input_atts` (see, attrs vs atts).
|
||||
* So Kirki uses `$wrapper_attrs` for consistency and keep the old `$wrapper_atts` backwards compatibility.
|
||||
*
|
||||
* This property could be removed in the future.
|
||||
* Please use `$wrapper_attrs` instead.
|
||||
*
|
||||
* @since 1.1
|
||||
* @deprecated 1.0.1 This variable could be removed in the future. Please use `$wrapper_attrs` instead.
|
||||
* @var array
|
||||
*/
|
||||
public $wrapper_atts = [];
|
||||
|
||||
/**
|
||||
* Wrapper options.
|
||||
*
|
||||
* This won't be rendered automatically to the wrapper element.
|
||||
* The purpose is to allow us to have custom options so we can manage it when needed.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.1
|
||||
* @var array
|
||||
*/
|
||||
public $wrapper_opts = [];
|
||||
|
||||
/**
|
||||
* Extra script dependencies.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @return array
|
||||
*/
|
||||
public function kirki_script_dependencies() {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue control related scripts/styles.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue() {
|
||||
|
||||
// Enqueue the styles.
|
||||
wp_enqueue_style( 'kirki-control-base', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], self::$control_ver );
|
||||
|
||||
// Enqueue the scripts.
|
||||
wp_enqueue_script( 'kirki-control-base', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [ 'customize-controls' ], self::$control_ver, false );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the control wrapper and calls $this->render_content() for the internals.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
protected function render() {
|
||||
|
||||
$id = 'customize-control-' . str_replace( [ '[', ']' ], [ '-', '' ], $this->id );
|
||||
$class = 'customize-control customize-control-kirki customize-control-' . $this->type;
|
||||
$gap = isset( $this->wrapper_opts['gap'] ) ? $this->wrapper_opts['gap'] : 'default';
|
||||
$tag = isset( $this->wrapper_opts['tag'] ) ? $this->wrapper_opts['tag'] : 'li';
|
||||
|
||||
switch ( $gap ) {
|
||||
case 'small':
|
||||
$class .= ' customize-control-has-small-gap';
|
||||
break;
|
||||
|
||||
case 'none':
|
||||
$class .= ' customize-control-is-gapless';
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ( empty( $this->wrapper_attrs ) && ! empty( $this->wrapper_atts ) ) {
|
||||
$this->wrapper_attrs = $this->wrapper_atts;
|
||||
}
|
||||
|
||||
if ( isset( $this->wrapper_attrs['id'] ) ) {
|
||||
$id = $this->wrapper_attrs['id'];
|
||||
}
|
||||
|
||||
if ( ! isset( $this->wrapper_attrs['data-kirki-setting'] ) ) {
|
||||
$this->wrapper_attrs['data-kirki-setting'] = $this->id;
|
||||
}
|
||||
|
||||
if ( ! isset( $this->wrapper_attrs['data-kirki-setting-link'] ) ) {
|
||||
if ( isset( $this->settings['default'] ) ) {
|
||||
$this->wrapper_attrs['data-kirki-setting-link'] = $this->settings['default']->id;
|
||||
}
|
||||
}
|
||||
|
||||
$data_attrs = '';
|
||||
|
||||
foreach ( $this->wrapper_attrs as $attr_key => $attr_value ) {
|
||||
if ( 0 === strpos( $attr_key, 'data-' ) ) {
|
||||
$data_attrs .= ' ' . esc_attr( $attr_key ) . '="' . esc_attr( $attr_value ) . '"';
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $this->wrapper_attrs['class'] ) ) {
|
||||
$class = str_ireplace( '{default_class}', $class, $this->wrapper_attrs['class'] );
|
||||
}
|
||||
|
||||
// ! Consider to esc $data_attrs.
|
||||
// ? What function we can use to escape string like data-xx="yy"?
|
||||
printf( '<' . esc_attr( $tag ) . ' id="%s" class="%s"%s>', esc_attr( $id ), esc_attr( $class ), $data_attrs );
|
||||
$this->render_content();
|
||||
echo '</' . esc_attr( $tag ) . '>';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the parameters passed to the JavaScript via JSON.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @see WP_Customize_Control::to_json()
|
||||
* @return void
|
||||
*/
|
||||
public function to_json() {
|
||||
|
||||
// Get the basics from the parent class.
|
||||
parent::to_json();
|
||||
|
||||
// Default value.
|
||||
$this->json['default'] = $this->setting->default;
|
||||
|
||||
if ( isset( $this->default ) ) {
|
||||
$this->json['default'] = $this->default;
|
||||
}
|
||||
|
||||
// Output.
|
||||
$this->json['output'] = $this->output;
|
||||
|
||||
// Value.
|
||||
$this->json['value'] = $this->value();
|
||||
|
||||
// Choices.
|
||||
$this->json['choices'] = $this->choices;
|
||||
|
||||
// The link.
|
||||
$this->json['link'] = $this->get_link();
|
||||
|
||||
// The ID.
|
||||
$this->json['id'] = $this->id;
|
||||
|
||||
// Translation strings.
|
||||
$this->json['l10n'] = $this->l10n();
|
||||
|
||||
// The ajaxurl in case we need it.
|
||||
$this->json['ajaxurl'] = admin_url( 'admin-ajax.php' );
|
||||
|
||||
// Input attributes.
|
||||
$this->json['inputAttrs'] = '';
|
||||
|
||||
if ( is_array( $this->input_attrs ) ) {
|
||||
foreach ( $this->input_attrs as $attr => $value ) {
|
||||
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
}
|
||||
|
||||
// The kirki-config.
|
||||
$this->json['kirkiConfig'] = $this->kirki_config;
|
||||
|
||||
// The option-type.
|
||||
$this->json['kirkiOptionType'] = $this->option_type;
|
||||
|
||||
// The option-name.
|
||||
$this->json['kirkiOptionName'] = $this->option_name;
|
||||
|
||||
// The preset.
|
||||
$this->json['preset'] = $this->preset;
|
||||
|
||||
// The CSS-Variables.
|
||||
$this->json['css-var'] = $this->css_vars;
|
||||
|
||||
// Parent setting.
|
||||
$this->json['parent_setting'] = $this->parent_setting;
|
||||
|
||||
// Wrapper Attributes.
|
||||
$this->json['wrapper_attrs'] = $this->wrapper_attrs;
|
||||
$this->json['wrapper_atts'] = $this->wrapper_attrs; // For backward compatibility - Could be removed in the future.
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the control's content.
|
||||
*
|
||||
* Allows the content to be overridden without having to rewrite the wrapper in `$this::render()`.
|
||||
* Control content can alternately be rendered in JS. See WP_Customize_Control::print_template().
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.0
|
||||
* @return void
|
||||
*/
|
||||
protected function render_content() {}
|
||||
|
||||
/**
|
||||
* An Underscore (JS) template for this control's content (but not its container).
|
||||
*
|
||||
* Class variables for this control class are available in the `data` JS object;
|
||||
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.0
|
||||
* @see WP_Customize_Control::print_template()
|
||||
* @return void
|
||||
*/
|
||||
protected function content_template() {}
|
||||
|
||||
/**
|
||||
* Returns an array of translation strings.
|
||||
*
|
||||
* @access protected
|
||||
* @since 3.0.0
|
||||
* @return array
|
||||
*/
|
||||
protected function l10n() {
|
||||
return [];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
import "./control.scss";
|
||||
import "./dynamic-control";
|
136
functions/kirki/kirki-packages/control-base/src/control.scss
Normal file
|
@ -0,0 +1,136 @@
|
|||
@import "rtl.scss";
|
||||
|
||||
@media screen and (min-width: 1667px) {
|
||||
.wp-full-overlay.expanded {
|
||||
margin-left: 300px;
|
||||
}
|
||||
}
|
||||
|
||||
#customize-theme-controls .customize-pane-child.open {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.wp-full-overlay-sidebar {
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.expanded .wp-full-overlay-footer {
|
||||
max-width: 299px;
|
||||
}
|
||||
|
||||
.kirki-w100 {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.kirki-w50 {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.kirki-w45 {
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
.kirki-w40 {
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
.kirki-w33 {
|
||||
width: 33.3333%;
|
||||
}
|
||||
|
||||
.kirki-w30 {
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
.kirki-w25 {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
.kirki-w20 {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.kirki-w15 {
|
||||
width: 15%;
|
||||
}
|
||||
|
||||
.kirki-w10 {
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
.kirki-w5 {
|
||||
width: 5%;
|
||||
}
|
||||
|
||||
.control-section-kirki-default,
|
||||
.control-section-kirki-outer {
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.customize-control-has-small-gap {
|
||||
margin-bottom: 9px;
|
||||
}
|
||||
|
||||
.customize-control-is-gapless {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.customize-control-kirki-hidden-field {
|
||||
margin-bottom: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.customize-control-kirki,
|
||||
.customize-control-kirki * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.customize-control-kirki.kirki-group-item {
|
||||
clear: none; // Override WordPress.
|
||||
}
|
||||
|
||||
.kirki-group-item {
|
||||
float: left;
|
||||
clear: none;
|
||||
padding-left: 3px;
|
||||
padding-right: 3px;
|
||||
|
||||
&.kirki-group-start {
|
||||
padding-left: 0;
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
||||
&.kirki-group-break,
|
||||
&.kirki-group-end {
|
||||
padding-left: 3px;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
&.kirki-group-end {
|
||||
&::after {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 0;
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.customize-control-kirki {
|
||||
position: relative;
|
||||
|
||||
.kirki-control-label,
|
||||
label.customize-control-title {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.kirki-control-form {
|
||||
position: relative;
|
||||
|
||||
textarea {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,289 @@
|
|||
/**
|
||||
* The majority of the code in this file
|
||||
* is derived from the wp-customize-posts plugin
|
||||
* and the work of @westonruter to whom I am very grateful.
|
||||
*
|
||||
* @see https://github.com/xwp/wp-customize-posts
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* A dynamic color-alpha control.
|
||||
*
|
||||
* @class
|
||||
* @augments wp.customize.Control
|
||||
* @augments wp.customize.Class
|
||||
*/
|
||||
wp.customize.kirkiDynamicControl = wp.customize.Control.extend({
|
||||
|
||||
initialize: function (id, options) {
|
||||
let control = this;
|
||||
let args = options || {};
|
||||
|
||||
args.params = args.params || {};
|
||||
|
||||
if (!args.params.type) {
|
||||
args.params.type = 'kirki-generic';
|
||||
}
|
||||
|
||||
let className;
|
||||
|
||||
if (args.content) {
|
||||
let splits = args.content.split('class="');
|
||||
splits = splits[1].split('"');
|
||||
className = splits[0];
|
||||
} else {
|
||||
className = 'customize-control customize-control-' + args.params.type;
|
||||
}
|
||||
|
||||
if (!args.params.wrapper_attrs && args.params.wrapper_atts) {
|
||||
args.params.wrapper_attrs = args.params.wrapper_atts;
|
||||
}
|
||||
|
||||
// Hijack the container to add wrapper_attrs.
|
||||
args.params.content = jQuery("<li></li>");
|
||||
args.params.content.attr('id', 'customize-control-' + id.replace(/]/g, '').replace(/\[/g, '-'));
|
||||
args.params.content.attr('class', className);
|
||||
|
||||
_.each(args.params.wrapper_attrs, function (val, key) {
|
||||
if ('class' === key) {
|
||||
val = val.replace('{default_class}', className);
|
||||
}
|
||||
|
||||
args.params.content.attr(key, val);
|
||||
});
|
||||
|
||||
control.propertyElements = [];
|
||||
wp.customize.Control.prototype.initialize.call(control, id, args);
|
||||
wp.hooks.doAction('kirki.dynamicControl.init.after', id, control, args);
|
||||
},
|
||||
|
||||
/**
|
||||
* Add bidirectional data binding links between inputs and the setting(s).
|
||||
*
|
||||
* This is copied from wp.customize.Control.prototype.initialize(). It
|
||||
* should be changed in Core to be applied once the control is embedded.
|
||||
*
|
||||
* @private
|
||||
* @returns {void}
|
||||
*/
|
||||
_setUpSettingRootLinks: function () {
|
||||
var control = this,
|
||||
nodes = control.container.find('[data-customize-setting-link]');
|
||||
|
||||
nodes.each(function () {
|
||||
var node = jQuery(this);
|
||||
|
||||
wp.customize(node.data('customizeSettingLink'), function (setting) {
|
||||
var element = new wp.customize.Element(node);
|
||||
control.elements.push(element);
|
||||
element.sync(setting);
|
||||
element.set(setting());
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Add bidirectional data binding links between inputs and the setting properties.
|
||||
*
|
||||
* @private
|
||||
* @returns {void}
|
||||
*/
|
||||
_setUpSettingPropertyLinks: function () {
|
||||
var control = this,
|
||||
nodes;
|
||||
|
||||
if (!control.setting) {
|
||||
return;
|
||||
}
|
||||
|
||||
nodes = control.container.find('[data-customize-setting-property-link]');
|
||||
|
||||
nodes.each(function () {
|
||||
var node = jQuery(this),
|
||||
element,
|
||||
propertyName = node.data('customizeSettingPropertyLink');
|
||||
|
||||
element = new wp.customize.Element(node);
|
||||
control.propertyElements.push(element);
|
||||
element.set(control.setting()[propertyName]);
|
||||
|
||||
element.bind(function (newPropertyValue) {
|
||||
var newSetting = control.setting();
|
||||
if (newPropertyValue === newSetting[propertyName]) {
|
||||
return;
|
||||
}
|
||||
newSetting = _.clone(newSetting);
|
||||
newSetting[propertyName] = newPropertyValue;
|
||||
control.setting.set(newSetting);
|
||||
});
|
||||
control.setting.bind(function (newValue) {
|
||||
if (newValue[propertyName] !== element.get()) {
|
||||
element.set(newValue[propertyName]);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
ready: function () {
|
||||
var control = this;
|
||||
|
||||
control._setUpSettingRootLinks();
|
||||
control._setUpSettingPropertyLinks();
|
||||
|
||||
wp.customize.Control.prototype.ready.call(control);
|
||||
|
||||
control.deferred.embedded.done(function () {
|
||||
control.initKirkiControl();
|
||||
wp.hooks.doAction('kirki.dynamicControl.ready.deferred.embedded.done', control);
|
||||
});
|
||||
wp.hooks.doAction('kirki.dynamicControl.ready.after', control);
|
||||
},
|
||||
|
||||
/**
|
||||
* Embed the control in the document.
|
||||
*
|
||||
* Override the embed() method to do nothing,
|
||||
* so that the control isn't embedded on load,
|
||||
* unless the containing section is already expanded.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
embed: function () {
|
||||
var control = this,
|
||||
sectionId = control.section();
|
||||
|
||||
if (!sectionId) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp.customize.section(sectionId, function (section) {
|
||||
if ('kirki-expanded' === section.params.type || section.expanded() || wp.customize.settings.autofocus.control === control.id) {
|
||||
control.actuallyEmbed();
|
||||
} else {
|
||||
section.expanded.bind(function (expanded) {
|
||||
if (expanded) {
|
||||
control.actuallyEmbed();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
wp.hooks.doAction('kirki.dynamicControl.embed.after', control);
|
||||
},
|
||||
|
||||
/**
|
||||
* Deferred embedding of control when actually
|
||||
*
|
||||
* This function is called in Section.onChangeExpanded() so the control
|
||||
* will only get embedded when the Section is first expanded.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
actuallyEmbed: function () {
|
||||
var control = this;
|
||||
if ('resolved' === control.deferred.embedded.state()) {
|
||||
return;
|
||||
}
|
||||
control.renderContent();
|
||||
control.deferred.embedded.resolve(); // This triggers control.ready().
|
||||
wp.hooks.doAction('kirki.dynamicControl.actuallyEmbed.after', control);
|
||||
},
|
||||
|
||||
/**
|
||||
* This is not working with autofocus.
|
||||
*
|
||||
* @param {object} [args] Args.
|
||||
* @returns {void}
|
||||
*/
|
||||
focus: function (args) {
|
||||
var control = this;
|
||||
control.actuallyEmbed();
|
||||
wp.customize.Control.prototype.focus.call(control, args);
|
||||
wp.hooks.doAction('kirki.dynamicControl.focus.after', control);
|
||||
},
|
||||
|
||||
/**
|
||||
* Additional actions that run on ready.
|
||||
*
|
||||
* @param {object} control - The control object. If undefined fallsback to the this.
|
||||
* @returns {void}
|
||||
*/
|
||||
initKirkiControl: function (control) {
|
||||
control = control || this;
|
||||
wp.hooks.doAction('kirki.dynamicControl.initKirkiControl', this);
|
||||
|
||||
// Save the value
|
||||
control.container.on('change keyup paste click', 'input', function () {
|
||||
control.setting.set(jQuery(this).val());
|
||||
});
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
||||
(function (api) {
|
||||
|
||||
/**
|
||||
* Set the value and trigger all bound callbacks.
|
||||
*
|
||||
* @since 1.0
|
||||
* @param {object} to - New value.
|
||||
* @returns {Object} - this
|
||||
*/
|
||||
api.Value.prototype.set = function (to) {
|
||||
var from = this._value,
|
||||
parentSetting,
|
||||
newVal;
|
||||
|
||||
to = this._setter.apply(this, arguments);
|
||||
to = this.validate(to);
|
||||
|
||||
// Bail if the sanitized value is null or unchanged.
|
||||
if (null === to || _.isEqual(from, to)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start Kirki mod.
|
||||
*/
|
||||
if (this.id && api.control(this.id) && api.control(this.id).params && api.control(this.id).params.parent_setting) {
|
||||
parentSetting = api.control(this.id).params.parent_setting;
|
||||
newVal = {};
|
||||
newVal[this.id.replace(parentSetting + '[', '').replace(']', '')] = to;
|
||||
api.control(parentSetting).setting.set(jQuery.extend({}, api.control(parentSetting).setting._value, newVal));
|
||||
}
|
||||
|
||||
/**
|
||||
* End Kirki mod.
|
||||
*/
|
||||
|
||||
this._value = to;
|
||||
this._dirty = true;
|
||||
|
||||
this.callbacks.fireWith(this, [to, from]);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the value.
|
||||
*
|
||||
* @returns {mixed} - Returns the value.
|
||||
*/
|
||||
api.Value.prototype.get = function () {
|
||||
|
||||
// Start Kirki mod.
|
||||
var parentSetting;
|
||||
if (this.id && api.control(this.id) && api.control(this.id).params && api.control(this.id).params.parent_setting) {
|
||||
parentSetting = api.control(this.id).params.parent_setting;
|
||||
return api.control(parentSetting).setting.get()[this.id.replace(parentSetting + '[', '').replace(']', '')];
|
||||
}
|
||||
// End Kirki mod.
|
||||
|
||||
return this._value;
|
||||
};
|
||||
}(wp.customize));
|
8
functions/kirki/kirki-packages/control-base/src/rtl.scss
Normal file
|
@ -0,0 +1,8 @@
|
|||
.rtl {
|
||||
@media screen and (min-width: 1667px) {
|
||||
.wp-full-overlay.expanded {
|
||||
margin-right: 300px;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
21
functions/kirki/kirki-packages/control-checkbox/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2019 kirki-framework
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
2
functions/kirki/kirki-packages/control-checkbox/dist/control.css
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
.customize-control-kirki-toggle .kirki-toggle{align-items:flex-start;display:flex;justify-content:space-between}.customize-control-kirki-toggle .kirki-toggle .kirki-control-label{width:80%}.customize-control-kirki-toggle .kirki-toggle .kirki-control-form{text-align:right;width:20%}.customize-control-kirki-toggle .kirki-toggle .kirki-toggle-switch-label{width:100%}.customize-control-kirki-toggle .kirki-toggle .kirki-toggle-switch-label:before{right:0}.customize-control-kirki-toggle .kirki-toggle .kirki-toggle-switch-label:after{right:18px}.customize-control-kirki-switch .kirki-switch .kirki-toggle-switch-label{padding:10px 0 12px 44px;text-align:left}.customize-control-kirki-switch .kirki-switch .kirki-toggle-switch-label:after,.customize-control-kirki-switch .kirki-switch .kirki-toggle-switch-label:before{left:0}.customize-control-kirki-switch .kirki-switch .toggle-off,.customize-control-kirki-switch .kirki-switch .toggle-on{bottom:-2px;padding-left:5px;position:relative}.customize-control-kirki-switch .kirki-switch .toggle-on{color:#0073aa;display:none}.customize-control-kirki-switch .kirki-switch .toggle-off{color:#82878c;display:inline-block}.kirki-toggle-switch-label{cursor:pointer;display:inline-block;position:relative}.kirki-toggle-switch-label:after,.kirki-toggle-switch-label:before{box-sizing:border-box;content:"";margin:0;outline:0;position:absolute;top:50%;transform:translate3d(0,-50%,0);transition:all .35s cubic-bezier(0,.95,.38,.98),background-color .15s ease}.kirki-toggle-switch-label:before{background-color:#b4b9be;border:1px solid #b4b9be;border-radius:8px;height:14px;width:37px}.kirki-toggle-switch-label:after{background-color:#999;border:1px solid rgba(0,0,0,.1);border-radius:50%;height:22px;width:22px}.kirki-toggle-switch-input{opacity:0}.kirki-toggle-switch-input:checked+.kirki-toggle-switch-label:after{background-color:#0073aa;transform:translate3d(100%,-50%,0)}.kirki-toggle-switch-input:checked+.kirki-toggle-switch-label .toggle-on{display:inline-block}.kirki-toggle-switch-input:checked+.kirki-toggle-switch-label .toggle-off{display:none}
|
||||
/*# sourceMappingURL=control.css.map */
|
1
functions/kirki/kirki-packages/control-checkbox/dist/control.css.map
vendored
Normal file
2
functions/kirki/kirki-packages/control-checkbox/dist/control.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
!function(){var i={initKirkiControl:function(i){(i=i||this).container.on("change","input",(function(){i.setting.set(jQuery(this).is(":checked"))}))}};wp.customize.controlConstructor["kirki-checkbox"]=wp.customize.kirkiDynamicControl.extend(i),wp.customize.controlConstructor["kirki-switch"]=wp.customize.kirkiDynamicControl.extend(i),wp.customize.controlConstructor["kirki-toggle"]=wp.customize.kirkiDynamicControl.extend(i)}();
|
||||
//# sourceMappingURL=control.js.map
|
1
functions/kirki/kirki-packages/control-checkbox/dist/control.js.map
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"mappings":"YAEA,IAAIA,EAAsB,CAEzBC,iBAAkB,SAAUC,IAC3BA,EAAUA,GAAWC,MACbC,UAAUC,GAAI,SAAU,SAAS,WACxCH,EAAQI,QAAQC,IAAKC,OAAQL,MAAOM,GAAI,kBAK3CC,GAAGC,UAAUC,mBAAmB,kBAAoBF,GAAGC,UAAUE,oBAAoBC,OAAQd,GAC7FU,GAAGC,UAAUC,mBAAmB,gBAAoBF,GAAGC,UAAUE,oBAAoBC,OAAQd,GAC7FU,GAAGC,UAAUC,mBAAmB,gBAAoBF,GAAGC,UAAUE,oBAAoBC,OAAQd","sources":["src/control.js"],"sourcesContent":["import \"./control.scss\";\n\nvar kirkiCheckboxScript = {\n\n\tinitKirkiControl: function( control ) {\n\t\tcontrol = control || this;\n\t\tcontrol.container.on( 'change', 'input', function() {\n\t\t\tcontrol.setting.set( jQuery( this ).is( ':checked' ) );\n\t\t} );\n\t}\n};\n\nwp.customize.controlConstructor['kirki-checkbox'] = wp.customize.kirkiDynamicControl.extend( kirkiCheckboxScript );\nwp.customize.controlConstructor['kirki-switch'] = wp.customize.kirkiDynamicControl.extend( kirkiCheckboxScript );\nwp.customize.controlConstructor['kirki-toggle'] = wp.customize.kirkiDynamicControl.extend( kirkiCheckboxScript );\n"],"names":["$1abc80d3e2df1201$var$kirkiCheckboxScript","initKirkiControl","control","this","container","on","setting","set","jQuery","is","wp","customize","controlConstructor","kirkiDynamicControl","extend"],"version":3,"file":"control.js.map"}
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
/**
|
||||
* Customizer Control: checkbox.
|
||||
*
|
||||
* Creates a new custom control.
|
||||
* Custom controls contains all background-related options.
|
||||
*
|
||||
* @package kirki-framework/control-checkbox
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Control;
|
||||
|
||||
use Kirki\Control\Base;
|
||||
use Kirki\URL;
|
||||
|
||||
/**
|
||||
* Adds a checkbox control.
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
class Checkbox extends Base {
|
||||
|
||||
/**
|
||||
* The control type.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'kirki-checkbox';
|
||||
|
||||
/**
|
||||
* The control version.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @var string
|
||||
*/
|
||||
public static $control_ver = '1.0.3';
|
||||
|
||||
/**
|
||||
* Enqueue control related scripts/styles.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue() {
|
||||
parent::enqueue();
|
||||
|
||||
// Enqueue the script.
|
||||
wp_enqueue_script( 'kirki-control-checkbox', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [ 'jquery', 'customize-base', 'kirki-control-base' ], self::$control_ver, false );
|
||||
|
||||
// Enqueue the style.
|
||||
wp_enqueue_style( 'kirki-control-checkbox-style', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], self::$control_ver );
|
||||
}
|
||||
|
||||
/**
|
||||
* An Underscore (JS) template for this control's content (but not its container).
|
||||
*
|
||||
* Class variables for this control class are available in the `data` JS object;
|
||||
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
|
||||
*
|
||||
* @see WP_Customize_Control::print_template()
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.0
|
||||
* @return void
|
||||
*/
|
||||
protected function content_template() {
|
||||
?>
|
||||
<input
|
||||
id="_customize-input-{{ data.id }}"
|
||||
type="checkbox"
|
||||
value="{{ data.value }}"
|
||||
{{{ data.link }}}
|
||||
<# if ( data.description ) { #>aria-describedby="_customize-description-{{ data.id }}"<# } #>
|
||||
<# if ( data.value ) { #>checked="checked"<# } #>
|
||||
/>
|
||||
<label for="_customize-input-{{ data.id }}">{{{ data.label }}}</label>
|
||||
<# if ( data.description ) { #>
|
||||
<span id="_customize-description-{{ data.id }}" class="description customize-control-description">{{{ data.description }}}</span>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
<?php
|
||||
/**
|
||||
* Customizer Control: switch.
|
||||
*
|
||||
* @package kirki-framework/checkbox
|
||||
* @copyright Copyright (c) 2023, Themeum
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
namespace Kirki\Control;
|
||||
|
||||
use Kirki\Control\Base;
|
||||
use Kirki\URL;
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch control (modified checkbox).
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
class Checkbox_Switch extends Base {
|
||||
|
||||
/**
|
||||
* The control type.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'kirki-switch';
|
||||
|
||||
/**
|
||||
* The control version.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @var string
|
||||
*/
|
||||
public static $control_ver = '1.0.3';
|
||||
|
||||
/**
|
||||
* Enqueue control related scripts/styles.
|
||||
*
|
||||
* @access public
|
||||
* @since 1.0
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue() {
|
||||
|
||||
parent::enqueue();
|
||||
|
||||
// Enqueue the script.
|
||||
wp_enqueue_script( 'kirki-control-checkbox', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.js' ), [ 'jquery', 'customize-base', 'kirki-control-base' ], self::$control_ver, false );
|
||||
|
||||
// Enqueue the style.
|
||||
wp_enqueue_style( 'kirki-control-checkbox-style', URL::get_from_path( dirname( dirname( __DIR__ ) ) . '/dist/control.css' ), [], self::$control_ver );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the parameters passed to the JavaScript via JSON.
|
||||
*
|
||||
* @since 3.4.0
|
||||
*/
|
||||
public function to_json() {
|
||||
|
||||
// Get the basics from the parent class.
|
||||
parent::to_json();
|
||||
|
||||
$this->json['checkboxType'] = str_ireplace( 'kirki-', '', $this->type );
|
||||
|
||||
$this->json['defaultChoices'] = [
|
||||
'on' => __( 'On', 'kirki' ),
|
||||
'off' => __( 'Off', 'kirki' ),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* An Underscore (JS) template for this control's content (but not its container).
|
||||
*
|
||||
* Class variables for this control class are available in the `data` JS object;
|
||||
* export custom variables by overriding {@see WP_Customize_Control::to_json()}.
|
||||
*
|
||||
* @see WP_Customize_Control::print_template()
|
||||
*
|
||||
* @access protected
|
||||
* @since 1.0
|
||||
* @return void
|
||||
*/
|
||||
protected function content_template() {
|
||||
?>
|
||||
|
||||
<div class="kirki-{{ data.checkboxType }}-control kirki-{{ data.checkboxType }}">
|
||||
<# if ( data.label || data.description ) { #>
|
||||
<div class="kirki-control-label">
|
||||
<# if ( data.label ) { #>
|
||||
<label class="customize-control-title" for="kirki_{{ data.checkboxType }}_{{ data.id }}">
|
||||
{{{ data.label }}}
|
||||
</label>
|
||||
<# } #>
|
||||
|
||||
<# if ( data.description ) { #>
|
||||
<span class="description customize-control-description">{{{ data.description }}}</span>
|
||||
<# } #>
|
||||
</div>
|
||||
<# } #>
|
||||
|
||||
<div class="kirki-control-form">
|
||||
<input class="screen-reader-text kirki-toggle-switch-input" {{{ data.inputAttrs }}} name="kirki_{{ data.checkboxType }}_{{ data.id }}" id="kirki_{{ data.checkboxType }}_{{ data.id }}" type="checkbox" value="{{ data.value }}" {{{ data.link }}}<# if ( '1' == data.value ) { #> checked<# } #> />
|
||||
<label class="kirki-toggle-switch-label" for="kirki_{{ data.checkboxType }}_{{ data.id }}">
|
||||
<# if ('switch' === data.checkboxType) { #>
|
||||
<span class="toggle-on">
|
||||
<# data.choices.on = data.choices.on || data.defaultChoices.on #>
|
||||
{{ data.choices.on }}
|
||||
</span>
|
||||
<span class="toggle-off">
|
||||
<# data.choices.off = data.choices.off || data.defaultChoices.off #>
|
||||
{{ data.choices.off }}
|
||||
</span>
|
||||
<# } #>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|