updated plugin GP Premium
version 2.0.3
This commit is contained in:
parent
d7964b08bd
commit
3ef36355e9
@ -15,16 +15,12 @@
|
|||||||
/* columns */
|
/* columns */
|
||||||
.generate-columns-container:not(.masonry-container) {
|
.generate-columns-container:not(.masonry-container) {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: row wrap;
|
flex-wrap: wrap;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
.generate-columns-container:not(.masonry-container) .generate-columns {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.generate-columns .inside-article {
|
.generate-columns .inside-article {
|
||||||
width: 100%;
|
height: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,10 +42,6 @@
|
|||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.no-sidebar .generate-columns-container .inside-article > * {
|
|
||||||
max-width: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.load-more:not(.has-svg-icon) .button.loading:before {
|
.load-more:not(.has-svg-icon) .button.loading:before {
|
||||||
content: "\e900";
|
content: "\e900";
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
@ -1 +1 @@
|
|||||||
.masonry-enabled .page-header{position:relative!important}.separate-containers .site-main>.generate-columns-container{margin-bottom:0}.load-more.are-images-unloaded,.masonry-container.are-images-unloaded,.masonry-enabled #nav-below{opacity:0}.generate-columns-container:not(.masonry-container){display:flex;flex-flow:row wrap;align-items:stretch}.generate-columns-container:not(.masonry-container) .generate-columns{display:flex}.generate-columns .inside-article{width:100%;box-sizing:border-box}.generate-columns-activated.post-image-aligned-left .generate-columns-container article:not(.featured-column) .post-image,.generate-columns-activated.post-image-aligned-right .generate-columns-container article:not(.featured-column) .post-image{float:none;text-align:center;margin-left:0;margin-right:0}.generate-columns-container .page-header,.generate-columns-container .paging-navigation{flex:1 1 100%;clear:both}.generate-columns-container .paging-navigation{margin-bottom:0}.no-sidebar .generate-columns-container .inside-article>*{max-width:none}.load-more:not(.has-svg-icon) .button.loading:before{content:"\e900";display:inline-block;font-family:"GP Premium";font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;animation:spin 2s infinite linear;margin-right:7px}.load-more .button:not(.loading) .gp-icon{display:none}.load-more .gp-icon svg{animation:spin 2s infinite linear;margin-right:7px}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.generate-columns{box-sizing:border-box}.generate-columns.grid-20,.grid-sizer.grid-20{width:20%}.generate-columns.grid-25,.grid-sizer.grid-25{width:25%}.generate-columns.grid-33,.grid-sizer.grid-33{width:33.3333%}.generate-columns.grid-50,.grid-sizer.grid-50{width:50%}.generate-columns.grid-60,.grid-sizer.grid-60{width:60%}.generate-columns.grid-66,.grid-sizer.grid-66{width:66.66667%}@media (min-width:768px) and (max-width:1024px){.generate-columns.tablet-grid-50,.grid-sizer.tablet-grid-50{width:50%}}@media (max-width:767px){.generate-columns-activated .generate-columns-container{margin-left:0;margin-right:0}.generate-columns-container .generate-columns,.generate-columns-container>*{padding-left:0}.generate-columns-container .page-header{margin-left:0}.generate-columns.mobile-grid-100,.grid-sizer.mobile-grid-100{width:100%}.generate-columns-container>.paging-navigation{margin-left:0}}@media (max-width:768px){.load-more{display:block;text-align:center;margin-bottom:0}}
|
.masonry-enabled .page-header{position:relative!important}.separate-containers .site-main>.generate-columns-container{margin-bottom:0}.load-more.are-images-unloaded,.masonry-container.are-images-unloaded,.masonry-enabled #nav-below{opacity:0}.generate-columns-container:not(.masonry-container){display:flex;flex-wrap:wrap;align-items:stretch}.generate-columns .inside-article{height:100%;box-sizing:border-box}.generate-columns-activated.post-image-aligned-left .generate-columns-container article:not(.featured-column) .post-image,.generate-columns-activated.post-image-aligned-right .generate-columns-container article:not(.featured-column) .post-image{float:none;text-align:center;margin-left:0;margin-right:0}.generate-columns-container .page-header,.generate-columns-container .paging-navigation{flex:1 1 100%;clear:both}.generate-columns-container .paging-navigation{margin-bottom:0}.load-more:not(.has-svg-icon) .button.loading:before{content:"\e900";display:inline-block;font-family:"GP Premium";font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;animation:spin 2s infinite linear;margin-right:7px}.load-more .button:not(.loading) .gp-icon{display:none}.load-more .gp-icon svg{animation:spin 2s infinite linear;margin-right:7px}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.generate-columns{box-sizing:border-box}.generate-columns.grid-20,.grid-sizer.grid-20{width:20%}.generate-columns.grid-25,.grid-sizer.grid-25{width:25%}.generate-columns.grid-33,.grid-sizer.grid-33{width:33.3333%}.generate-columns.grid-50,.grid-sizer.grid-50{width:50%}.generate-columns.grid-60,.grid-sizer.grid-60{width:60%}.generate-columns.grid-66,.grid-sizer.grid-66{width:66.66667%}@media (min-width:768px) and (max-width:1024px){.generate-columns.tablet-grid-50,.grid-sizer.tablet-grid-50{width:50%}}@media (max-width:767px){.generate-columns-activated .generate-columns-container{margin-left:0;margin-right:0}.generate-columns-container .generate-columns,.generate-columns-container>*{padding-left:0}.generate-columns-container .page-header{margin-left:0}.generate-columns.mobile-grid-100,.grid-sizer.mobile-grid-100{width:100%}.generate-columns-container>.paging-navigation{margin-left:0}}@media (max-width:768px){.load-more{display:block;text-align:center;margin-bottom:0}}
|
@ -126,16 +126,12 @@
|
|||||||
/* columns */
|
/* columns */
|
||||||
.generate-columns-container:not(.masonry-container) {
|
.generate-columns-container:not(.masonry-container) {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: row wrap;
|
flex-wrap: wrap;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
.generate-columns-container:not(.masonry-container) .generate-columns {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.generate-columns .inside-article {
|
.generate-columns .inside-article {
|
||||||
width: 100%;
|
height: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,10 +153,6 @@
|
|||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.no-sidebar .generate-columns-container .inside-article > * {
|
|
||||||
max-width: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.load-more:not(.has-svg-icon) .button.loading:before {
|
.load-more:not(.has-svg-icon) .button.loading:before {
|
||||||
content: "\e900";
|
content: "\e900";
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -5,30 +5,30 @@ if ( ! function_exists( 'generate_blog_customize_register' ) ) {
|
|||||||
add_action( 'customize_register', 'generate_blog_customize_register', 99 );
|
add_action( 'customize_register', 'generate_blog_customize_register', 99 );
|
||||||
|
|
||||||
function generate_blog_customize_register( $wp_customize ) {
|
function generate_blog_customize_register( $wp_customize ) {
|
||||||
// Get our defaults
|
// Get our defaults.
|
||||||
$defaults = generate_blog_get_defaults();
|
$defaults = generate_blog_get_defaults();
|
||||||
|
|
||||||
// Get our controls
|
// Get our controls.
|
||||||
require_once GP_LIBRARY_DIRECTORY . 'customizer-helpers.php';
|
require_once GP_LIBRARY_DIRECTORY . 'customizer-helpers.php';
|
||||||
|
|
||||||
// Add control types so controls can be built using JS
|
// Add control types so controls can be built using JS.
|
||||||
if ( method_exists( $wp_customize, 'register_control_type' ) ) {
|
if ( method_exists( $wp_customize, 'register_control_type' ) ) {
|
||||||
$wp_customize->register_control_type( 'GeneratePress_Title_Customize_Control' );
|
$wp_customize->register_control_type( 'GeneratePress_Title_Customize_Control' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove our blog control from the free theme
|
// Remove our blog control from the free theme.
|
||||||
if ( $wp_customize->get_control( 'blog_content_control' ) ) {
|
if ( $wp_customize->get_control( 'blog_content_control' ) ) {
|
||||||
$wp_customize->remove_control( 'blog_content_control' );
|
$wp_customize->remove_control( 'blog_content_control' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register our custom controls
|
// Register our custom controls.
|
||||||
if ( method_exists( $wp_customize,'register_control_type' ) ) {
|
if ( method_exists( $wp_customize, 'register_control_type' ) ) {
|
||||||
$wp_customize->register_control_type( 'GeneratePress_Refresh_Button_Customize_Control' );
|
$wp_customize->register_control_type( 'GeneratePress_Refresh_Button_Customize_Control' );
|
||||||
$wp_customize->register_control_type( 'GeneratePress_Information_Customize_Control' );
|
$wp_customize->register_control_type( 'GeneratePress_Information_Customize_Control' );
|
||||||
$wp_customize->register_control_type( 'Generate_Control_Toggle_Customize_Control' );
|
$wp_customize->register_control_type( 'Generate_Control_Toggle_Customize_Control' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Blog content section
|
// Blog content section.
|
||||||
$wp_customize->add_section(
|
$wp_customize->add_section(
|
||||||
'generate_blog_section',
|
'generate_blog_section',
|
||||||
array(
|
array(
|
||||||
@ -48,7 +48,7 @@ if ( ! function_exists( 'generate_blog_customize_register' ) ) {
|
|||||||
'type' => 'generatepress-customizer-title',
|
'type' => 'generatepress-customizer-title',
|
||||||
'title' => __( 'Content', 'gp-premium' ),
|
'title' => __( 'Content', 'gp-premium' ),
|
||||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||||
'priority' => 0,
|
'priority' => 1,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -64,7 +64,7 @@ if ( ! function_exists( 'generate_blog_customize_register' ) ) {
|
|||||||
'post-meta-single' => __( 'Single', 'gp-premium' ),
|
'post-meta-single' => __( 'Single', 'gp-premium' ),
|
||||||
),
|
),
|
||||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||||
'priority' => 0,
|
'priority' => 1,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -729,7 +729,7 @@ if ( ! function_exists( 'generate_blog_customize_register' ) ) {
|
|||||||
'section' => 'generate_blog_section',
|
'section' => 'generate_blog_section',
|
||||||
'choices' => generate_blog_get_image_sizes(),
|
'choices' => generate_blog_get_image_sizes(),
|
||||||
'settings' => 'generate_blog_settings[single_post_image_size]',
|
'settings' => 'generate_blog_settings[single_post_image_size]',
|
||||||
'active_callback' => 'generate_premium_featured_image_active',
|
'active_callback' => 'generate_premium_single_featured_image_active',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -750,7 +750,7 @@ if ( ! function_exists( 'generate_blog_customize_register' ) ) {
|
|||||||
'label' => __( 'Width', 'gp-premium' ),
|
'label' => __( 'Width', 'gp-premium' ),
|
||||||
'section' => 'generate_blog_section',
|
'section' => 'generate_blog_section',
|
||||||
'settings' => 'generate_blog_settings[single_post_image_width]',
|
'settings' => 'generate_blog_settings[single_post_image_width]',
|
||||||
'active_callback' => 'generate_premium_featured_image_active',
|
'active_callback' => 'generate_premium_single_featured_image_active',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -771,7 +771,7 @@ if ( ! function_exists( 'generate_blog_customize_register' ) ) {
|
|||||||
'label' => __( 'Height', 'gp-premium' ),
|
'label' => __( 'Height', 'gp-premium' ),
|
||||||
'section' => 'generate_blog_section',
|
'section' => 'generate_blog_section',
|
||||||
'settings' => 'generate_blog_settings[single_post_image_height]',
|
'settings' => 'generate_blog_settings[single_post_image_height]',
|
||||||
'active_callback' => 'generate_premium_featured_image_active',
|
'active_callback' => 'generate_premium_single_featured_image_active',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -786,7 +786,7 @@ if ( ! function_exists( 'generate_blog_customize_register' ) ) {
|
|||||||
'<a href="https://docs.generatepress.com/article/adjusting-the-featured-images/" target="_blank" rel="noopener noreferrer">' . __( 'here', 'gp-premium' ) . '</a>'
|
'<a href="https://docs.generatepress.com/article/adjusting-the-featured-images/" target="_blank" rel="noopener noreferrer">' . __( 'here', 'gp-premium' ) . '</a>'
|
||||||
),
|
),
|
||||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||||
'active_callback' => 'generate_premium_featured_image_active',
|
'active_callback' => 'generate_premium_single_featured_image_active',
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -904,7 +904,7 @@ if ( ! function_exists( 'generate_blog_customize_register' ) ) {
|
|||||||
'section' => 'generate_blog_section',
|
'section' => 'generate_blog_section',
|
||||||
'choices' => generate_blog_get_image_sizes(),
|
'choices' => generate_blog_get_image_sizes(),
|
||||||
'settings' => 'generate_blog_settings[page_post_image_size]',
|
'settings' => 'generate_blog_settings[page_post_image_size]',
|
||||||
'active_callback' => 'generate_premium_featured_image_active',
|
'active_callback' => 'generate_premium_single_page_featured_image_active',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -925,7 +925,7 @@ if ( ! function_exists( 'generate_blog_customize_register' ) ) {
|
|||||||
'label' => __( 'Width', 'gp-premium' ),
|
'label' => __( 'Width', 'gp-premium' ),
|
||||||
'section' => 'generate_blog_section',
|
'section' => 'generate_blog_section',
|
||||||
'settings' => 'generate_blog_settings[page_post_image_width]',
|
'settings' => 'generate_blog_settings[page_post_image_width]',
|
||||||
'active_callback' => 'generate_premium_featured_image_active',
|
'active_callback' => 'generate_premium_single_page_featured_image_active',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -946,7 +946,7 @@ if ( ! function_exists( 'generate_blog_customize_register' ) ) {
|
|||||||
'label' => __( 'Height', 'gp-premium' ),
|
'label' => __( 'Height', 'gp-premium' ),
|
||||||
'section' => 'generate_blog_section',
|
'section' => 'generate_blog_section',
|
||||||
'settings' => 'generate_blog_settings[page_post_image_height]',
|
'settings' => 'generate_blog_settings[page_post_image_height]',
|
||||||
'active_callback' => 'generate_premium_featured_image_active',
|
'active_callback' => 'generate_premium_single_page_featured_image_active',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -961,7 +961,7 @@ if ( ! function_exists( 'generate_blog_customize_register' ) ) {
|
|||||||
'<a href="https://docs.generatepress.com/article/adjusting-the-featured-images/" target="_blank" rel="noopener noreferrer">' . __( 'here', 'gp-premium' ) . '</a>'
|
'<a href="https://docs.generatepress.com/article/adjusting-the-featured-images/" target="_blank" rel="noopener noreferrer">' . __( 'here', 'gp-premium' ) . '</a>'
|
||||||
),
|
),
|
||||||
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||||
'active_callback' => 'generate_premium_featured_image_active',
|
'active_callback' => 'generate_premium_single_page_featured_image_active',
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -1118,7 +1118,7 @@ if ( ! function_exists( 'generate_blog_customizer_live_preview' ) ) {
|
|||||||
wp_enqueue_script(
|
wp_enqueue_script(
|
||||||
'generate-blog-themecustomizer',
|
'generate-blog-themecustomizer',
|
||||||
trailingslashit( plugin_dir_url( __FILE__ ) ) . 'js/customizer.js',
|
trailingslashit( plugin_dir_url( __FILE__ ) ) . 'js/customizer.js',
|
||||||
array( 'jquery', 'customize-preview', 'gp-premium' ),
|
array( 'jquery', 'customize-preview', 'generate-blog' ),
|
||||||
GENERATE_BLOG_VERSION,
|
GENERATE_BLOG_VERSION,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
@ -27,13 +27,13 @@ if ( ! function_exists( 'generate_blog_scripts' ) ) {
|
|||||||
$deps = array();
|
$deps = array();
|
||||||
|
|
||||||
if ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) {
|
if ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) {
|
||||||
$deps[] = 'jquery-masonry';
|
$deps[] = 'masonry';
|
||||||
$deps[] = 'imagesloaded';
|
$deps[] = 'imagesloaded';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $settings[ 'infinite_scroll' ] && ! is_singular() && ! is_404() ) {
|
if ( $settings[ 'infinite_scroll' ] && ! is_singular() && ! is_404() && ! is_post_type_archive( 'product' ) ) {
|
||||||
$deps[] = 'infinitescroll';
|
$deps[] = 'infinite-scroll';
|
||||||
wp_enqueue_script( 'infinitescroll', plugin_dir_url( __FILE__ ) . 'js/infinite-scroll.pkgd.min.js', array( 'jquery' ), '3.0.1', true );
|
wp_enqueue_script( 'infinite-scroll', plugin_dir_url( __FILE__ ) . 'js/infinite-scroll.pkgd.min.js', array(), '3.0.6', true );
|
||||||
|
|
||||||
$font_icons = true;
|
$font_icons = true;
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ if ( ! function_exists( 'generate_blog_scripts' ) ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) || ( $settings[ 'infinite_scroll' ] && ! is_singular() && ! is_404() ) ) {
|
if ( ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) || ( $settings[ 'infinite_scroll' ] && ! is_singular() && ! is_404() && ! is_post_type_archive( 'product' ) ) ) {
|
||||||
wp_enqueue_script( 'generate-blog', plugin_dir_url( __FILE__ ) . "js/scripts{$suffix}.js", $deps, GENERATE_BLOG_VERSION, true );
|
wp_enqueue_script( 'generate-blog', plugin_dir_url( __FILE__ ) . "js/scripts{$suffix}.js", $deps, GENERATE_BLOG_VERSION, true );
|
||||||
|
|
||||||
wp_localize_script(
|
wp_localize_script(
|
||||||
@ -62,7 +62,7 @@ if ( ! function_exists( 'generate_blog_scripts' ) ) {
|
|||||||
'generate_blog_masonry_init',
|
'generate_blog_masonry_init',
|
||||||
array(
|
array(
|
||||||
'columnWidth' => '.grid-sizer',
|
'columnWidth' => '.grid-sizer',
|
||||||
'itemSelector' => 'none',
|
'itemSelector' => '.masonry-post',
|
||||||
'stamp' => '.page-header',
|
'stamp' => '.page-header',
|
||||||
'percentPosition' => true,
|
'percentPosition' => true,
|
||||||
'stagger' => 30,
|
'stagger' => 30,
|
||||||
@ -79,8 +79,8 @@ if ( ! function_exists( 'generate_blog_scripts' ) ) {
|
|||||||
'infiniteScrollInit' => apply_filters(
|
'infiniteScrollInit' => apply_filters(
|
||||||
'generate_blog_infinite_scroll_init',
|
'generate_blog_infinite_scroll_init',
|
||||||
array(
|
array(
|
||||||
'path' => '.nav-links .next',
|
'path' => '.infinite-scroll-path a',
|
||||||
'append' => '#main article',
|
'append' => '#main .infinite-scroll-item',
|
||||||
'history' => false,
|
'history' => false,
|
||||||
'loadOnScroll' => $settings['infinite_scroll_button'] ? false : true,
|
'loadOnScroll' => $settings['infinite_scroll_button'] ? false : true,
|
||||||
'button' => $settings['infinite_scroll_button'] ? '.load-more a' : null,
|
'button' => $settings['infinite_scroll_button'] ? '.load-more a' : null,
|
||||||
@ -144,6 +144,10 @@ if ( ! function_exists( 'generate_blog_post_classes' ) ) {
|
|||||||
generate_blog_get_defaults()
|
generate_blog_get_defaults()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ( $settings['infinite_scroll'] ) {
|
||||||
|
$classes[] = 'infinite-scroll-item';
|
||||||
|
}
|
||||||
|
|
||||||
// Set our masonry class
|
// Set our masonry class
|
||||||
if ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) {
|
if ( 'true' == generate_blog_get_masonry() && generate_blog_get_columns() ) {
|
||||||
$classes[] = 'masonry-post';
|
$classes[] = 'masonry-post';
|
||||||
@ -594,7 +598,7 @@ add_filter( 'generate_content_more_link_output', 'generate_blog_read_more_button
|
|||||||
*
|
*
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*
|
*
|
||||||
* @param string Our existing read more link.
|
* @param string $output Our existing read more link.
|
||||||
*/
|
*/
|
||||||
function generate_blog_read_more_button( $output ) {
|
function generate_blog_read_more_button( $output ) {
|
||||||
$settings = wp_parse_args(
|
$settings = wp_parse_args(
|
||||||
@ -602,16 +606,21 @@ function generate_blog_read_more_button( $output ) {
|
|||||||
generate_blog_get_defaults()
|
generate_blog_get_defaults()
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( ! $settings[ 'read_more_button' ] ) {
|
if ( ! $settings['read_more_button'] ) {
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf( '%5$s<p class="read-more-container"><a title="%1$s" class="read-more button" href="%2$s">%3$s%4$s</a></p>',
|
return sprintf(
|
||||||
|
'%5$s<p class="read-more-container"><a title="%1$s" class="read-more button" href="%2$s" aria-label="%4$s">%3$s</a></p>',
|
||||||
the_title_attribute( 'echo=0' ),
|
the_title_attribute( 'echo=0' ),
|
||||||
esc_url( get_permalink( get_the_ID() ) . apply_filters( 'generate_more_jump','#more-' . get_the_ID() ) ),
|
esc_url( get_permalink( get_the_ID() ) . apply_filters( 'generate_more_jump', '#more-' . get_the_ID() ) ),
|
||||||
wp_kses_post( $settings['read_more'] ),
|
wp_kses_post( $settings['read_more'] ),
|
||||||
'<span class="screen-reader-text">' . get_the_title() . '</span>',
|
sprintf(
|
||||||
'generate_excerpt_more_output' == current_filter() ? ' ... ' : ''
|
/* translators: Aria-label describing the read more button */
|
||||||
|
_x( 'More on %s', 'more on post title', 'gp-premium' ),
|
||||||
|
the_title_attribute( 'echo=0' )
|
||||||
|
),
|
||||||
|
'generate_excerpt_more_output' === current_filter() ? ' ... ' : ''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -675,3 +684,27 @@ function generate_blog_get_singular_template() {
|
|||||||
|
|
||||||
return $template;
|
return $template;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_action( 'generate_after_footer', 'generate_blog_do_infinite_scroll_path', 500 );
|
||||||
|
/**
|
||||||
|
* Add a next page of posts link for infinite scroll.
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
function generate_blog_do_infinite_scroll_path() {
|
||||||
|
if ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$settings = wp_parse_args(
|
||||||
|
get_option( 'generate_blog_settings', array() ),
|
||||||
|
generate_blog_get_defaults()
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( $settings['infinite_scroll'] && ! is_singular() && ! is_404() ) {
|
||||||
|
printf(
|
||||||
|
'<div class="infinite-scroll-path" aria-hidden="true" style="display: none;">%s</div>',
|
||||||
|
get_next_posts_link()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
jQuery( document ).ready( function($) {
|
jQuery( function( $ ) {
|
||||||
// Featured image controls
|
// Featured image controls
|
||||||
var featured_image_archive_controls = [
|
var featuredImageArchiveControls = [
|
||||||
'generate_blog_settings-post_image',
|
'generate_blog_settings-post_image',
|
||||||
'generate_blog_settings-post_image_padding',
|
'generate_blog_settings-post_image_padding',
|
||||||
'generate_blog_settings-post_image_position',
|
'generate_blog_settings-post_image_position',
|
||||||
@ -11,11 +11,11 @@ jQuery( document ).ready( function($) {
|
|||||||
'generate_regenerate_images_notice',
|
'generate_regenerate_images_notice',
|
||||||
];
|
];
|
||||||
|
|
||||||
$.each( featured_image_archive_controls, function( index, value ) {
|
$.each( featuredImageArchiveControls, function( index, value ) {
|
||||||
$( '#customize-control-' + value ).attr( 'data-control-section', 'featured-image-archives' );
|
$( '#customize-control-' + value ).attr( 'data-control-section', 'featured-image-archives' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
var featured_image_single_controls = [
|
var featuredImageSingleControls = [
|
||||||
'generate_blog_settings-single_post_image',
|
'generate_blog_settings-single_post_image',
|
||||||
'generate_blog_settings-single_post_image_padding',
|
'generate_blog_settings-single_post_image_padding',
|
||||||
'generate_blog_settings-single_post_image_position',
|
'generate_blog_settings-single_post_image_position',
|
||||||
@ -26,17 +26,17 @@ jQuery( document ).ready( function($) {
|
|||||||
'generate_regenerate_single_post_images_notice',
|
'generate_regenerate_single_post_images_notice',
|
||||||
];
|
];
|
||||||
|
|
||||||
$.each( featured_image_single_controls, function( index, value ) {
|
$.each( featuredImageSingleControls, function( index, value ) {
|
||||||
$( '#customize-control-' + value ).attr( 'data-control-section', 'featured-image-single' ).css( {
|
$( '#customize-control-' + value ).attr( 'data-control-section', 'featured-image-single' ).css( {
|
||||||
visibility: 'hidden',
|
visibility: 'hidden',
|
||||||
height: '0',
|
height: '0',
|
||||||
width: '0',
|
width: '0',
|
||||||
margin: '0',
|
margin: '0',
|
||||||
overflow: 'hidden'
|
overflow: 'hidden',
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
var featured_image_page_controls = [
|
var featuredImagePageControls = [
|
||||||
'generate_blog_settings-page_post_image',
|
'generate_blog_settings-page_post_image',
|
||||||
'generate_blog_settings-page_post_image_padding',
|
'generate_blog_settings-page_post_image_padding',
|
||||||
'generate_blog_settings-page_post_image_position',
|
'generate_blog_settings-page_post_image_position',
|
||||||
@ -47,18 +47,18 @@ jQuery( document ).ready( function($) {
|
|||||||
'generate_regenerate_page_images_notice',
|
'generate_regenerate_page_images_notice',
|
||||||
];
|
];
|
||||||
|
|
||||||
$.each( featured_image_page_controls, function( index, value ) {
|
$.each( featuredImagePageControls, function( index, value ) {
|
||||||
$( '#customize-control-' + value ).attr( 'data-control-section', 'featured-image-page' ).css( {
|
$( '#customize-control-' + value ).attr( 'data-control-section', 'featured-image-page' ).css( {
|
||||||
visibility: 'hidden',
|
visibility: 'hidden',
|
||||||
height: '0',
|
height: '0',
|
||||||
width: '0',
|
width: '0',
|
||||||
margin: '0',
|
margin: '0',
|
||||||
overflow: 'hidden'
|
overflow: 'hidden',
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Post meta controls
|
// Post meta controls
|
||||||
var post_meta_archive_controls = [
|
var postMetaArchiveControls = [
|
||||||
'generate_settings-post_content',
|
'generate_settings-post_content',
|
||||||
'generate_blog_settings-excerpt_length',
|
'generate_blog_settings-excerpt_length',
|
||||||
'generate_blog_settings-read_more',
|
'generate_blog_settings-read_more',
|
||||||
@ -74,11 +74,11 @@ jQuery( document ).ready( function($) {
|
|||||||
'blog_masonry_loading_control',
|
'blog_masonry_loading_control',
|
||||||
];
|
];
|
||||||
|
|
||||||
$.each( post_meta_archive_controls, function( index, value ) {
|
$.each( postMetaArchiveControls, function( index, value ) {
|
||||||
$( '#customize-control-' + value ).attr( 'data-control-section', 'post-meta-archives' );
|
$( '#customize-control-' + value ).attr( 'data-control-section', 'post-meta-archives' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
var post_meta_single_controls = [
|
var postMetaSingleControls = [
|
||||||
'generate_blog_settings-single_date',
|
'generate_blog_settings-single_date',
|
||||||
'generate_blog_settings-single_author',
|
'generate_blog_settings-single_author',
|
||||||
'generate_blog_settings-single_categories',
|
'generate_blog_settings-single_categories',
|
||||||
@ -86,13 +86,13 @@ jQuery( document ).ready( function($) {
|
|||||||
'generate_blog_settings-single_post_navigation',
|
'generate_blog_settings-single_post_navigation',
|
||||||
];
|
];
|
||||||
|
|
||||||
$.each( post_meta_single_controls, function( index, value ) {
|
$.each( postMetaSingleControls, function( index, value ) {
|
||||||
$( '#customize-control-' + value ).attr( 'data-control-section', 'post-meta-single' ).css( {
|
$( '#customize-control-' + value ).attr( 'data-control-section', 'post-meta-single' ).css( {
|
||||||
visibility: 'hidden',
|
visibility: 'hidden',
|
||||||
height: '0',
|
height: '0',
|
||||||
width: '0',
|
width: '0',
|
||||||
margin: '0',
|
margin: '0',
|
||||||
overflow: 'hidden'
|
overflow: 'hidden',
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
});
|
} );
|
||||||
|
@ -5,39 +5,38 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
( function( $ ) {
|
( function( $ ) {
|
||||||
|
|
||||||
// Container width
|
// Container width
|
||||||
wp.customize( 'generate_settings[container_width]', function( value ) {
|
wp.customize( 'generate_settings[container_width]', function( value ) {
|
||||||
value.bind( function( newval ) {
|
value.bind( function() {
|
||||||
if ( $( '.masonry-container' )[0] ) {
|
if ( $( '.masonry-container' )[ 0 ] ) {
|
||||||
var $initiate = jQuery('.masonry-container').imagesLoaded( function() {
|
jQuery( '.masonry-container' ).imagesLoaded( function() {
|
||||||
$container = jQuery('.masonry-container');
|
$container = jQuery( '.masonry-container' );
|
||||||
if (jQuery($container).length) {
|
if ( jQuery( $container ).length ) {
|
||||||
$container.masonry({
|
$container.masonry( {
|
||||||
columnWidth: '.grid-sizer',
|
columnWidth: '.grid-sizer',
|
||||||
itemSelector: '.masonry-post',
|
itemSelector: '.masonry-post',
|
||||||
stamp: '.page-header'
|
stamp: '.page-header',
|
||||||
});
|
} );
|
||||||
}
|
}
|
||||||
});
|
} );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
$( 'body' ).on( 'generate_spacing_updated', function() {
|
$( 'body' ).on( 'generate_spacing_updated', function() {
|
||||||
if ( $( '.masonry-container' )[0] ) {
|
if ( $( '.masonry-container' )[ 0 ] ) {
|
||||||
var $initiate = jQuery('.masonry-container').imagesLoaded( function() {
|
jQuery( '.masonry-container' ).imagesLoaded( function() {
|
||||||
$container = jQuery('.masonry-container');
|
$container = jQuery( '.masonry-container' );
|
||||||
if (jQuery($container).length) {
|
if ( jQuery( $container ).length ) {
|
||||||
$container.masonry({
|
$container.masonry( {
|
||||||
columnWidth: '.grid-sizer',
|
columnWidth: '.grid-sizer',
|
||||||
itemSelector: '.masonry-post',
|
itemSelector: '.masonry-post',
|
||||||
stamp: '.page-header'
|
stamp: '.page-header',
|
||||||
});
|
} );
|
||||||
}
|
}
|
||||||
});
|
} );
|
||||||
}
|
}
|
||||||
});
|
} );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The first infinite scroll load in the Customizer misses article classes if they've been
|
* The first infinite scroll load in the Customizer misses article classes if they've been
|
||||||
@ -45,34 +44,33 @@
|
|||||||
*
|
*
|
||||||
* This is totally hacky, but I'm just happy I finally got it working!
|
* This is totally hacky, but I'm just happy I finally got it working!
|
||||||
*/
|
*/
|
||||||
var $container = $( 'article' ).first().parent();
|
var $container = $( '.infinite-scroll-item' ).first().parent();
|
||||||
$container.on( 'load.infiniteScroll', function( event, response, path ) {
|
$container.on( 'load.infiniteScroll', function( event, response ) {
|
||||||
$posts = $( response ).find( 'article' );
|
var $posts = $( response ).find( 'article' );
|
||||||
if ( wp.customize.value('generate_blog_settings[column_layout]')() ) {
|
if ( wp.customize.value( 'generate_blog_settings[column_layout]' )() ) {
|
||||||
$posts.addClass( 'generate-columns' );
|
$posts.addClass( 'generate-columns' );
|
||||||
$posts.addClass( 'grid-parent' );
|
$posts.addClass( 'grid-parent' );
|
||||||
$posts.addClass( 'grid-' + wp.customize.value('generate_blog_settings[columns]')() );
|
$posts.addClass( 'grid-' + wp.customize.value( 'generate_blog_settings[columns]' )() );
|
||||||
$posts.addClass( 'tablet-grid-50' );
|
$posts.addClass( 'tablet-grid-50' );
|
||||||
$posts.addClass( 'mobile-grid-100' );
|
$posts.addClass( 'mobile-grid-100' );
|
||||||
} else {
|
} else {
|
||||||
$posts.removeClass( 'generate-columns' );
|
$posts.removeClass( 'generate-columns' );
|
||||||
$posts.removeClass( 'grid-parent' );
|
$posts.removeClass( 'grid-parent' );
|
||||||
$posts.removeClass( 'grid-' + wp.customize.value('generate_blog_settings[columns]')() );
|
$posts.removeClass( 'grid-' + wp.customize.value( 'generate_blog_settings[columns]' )() );
|
||||||
$posts.removeClass( 'tablet-grid-50' );
|
$posts.removeClass( 'tablet-grid-50' );
|
||||||
$posts.removeClass( 'mobile-grid-100' );
|
$posts.removeClass( 'mobile-grid-100' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( wp.customize.value('generate_blog_settings[masonry]')() ) {
|
if ( wp.customize.value( 'generate_blog_settings[masonry]' )() ) {
|
||||||
$posts.addClass( 'masonry-post' );
|
$posts.addClass( 'masonry-post' );
|
||||||
} else {
|
} else {
|
||||||
$posts.removeClass( 'masonry-post' );
|
$posts.removeClass( 'masonry-post' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! wp.customize.value('generate_blog_settings[post_image_padding]')() ) {
|
if ( ! wp.customize.value( 'generate_blog_settings[post_image_padding]' )() ) {
|
||||||
$posts.addClass( 'no-featured-image-padding' );
|
$posts.addClass( 'no-featured-image-padding' );
|
||||||
} else {
|
} else {
|
||||||
$posts.removeClass( 'no-featured-image-padding' );
|
$posts.removeClass( 'no-featured-image-padding' );
|
||||||
}
|
}
|
||||||
});
|
} );
|
||||||
|
}( jQuery ) );
|
||||||
} )( jQuery );
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,33 +1,41 @@
|
|||||||
jQuery( document ).ready( function( $ ) {
|
document.addEventListener( 'DOMContentLoaded', function() {
|
||||||
var $masonry_container = $( '.masonry-container' );
|
var msnryContainer = document.querySelector( '.masonry-container' );
|
||||||
var msnry = false;
|
|
||||||
|
|
||||||
if ( $masonry_container.length ) {
|
if ( msnryContainer ) {
|
||||||
var $grid = $masonry_container.masonry( generateBlog.masonryInit );
|
// eslint-disable-next-line no-undef -- Masonry is a dependency.
|
||||||
|
var msnry = new Masonry( msnryContainer, generateBlog.masonryInit ),
|
||||||
|
navBelow = document.querySelector( '#nav-below' ),
|
||||||
|
loadMore = document.querySelector( '.load-more' );
|
||||||
|
|
||||||
msnry = $grid.data( 'masonry' );
|
// eslint-disable-next-line no-undef -- imagesLoaded is a dependency.
|
||||||
|
imagesLoaded( msnryContainer, function() {
|
||||||
|
msnry.layout();
|
||||||
|
msnryContainer.classList.remove( 'are-images-unloaded' );
|
||||||
|
|
||||||
$grid.imagesLoaded( function() {
|
if ( loadMore ) {
|
||||||
$grid.masonry( 'layout' );
|
loadMore.classList.remove( 'are-images-unloaded' );
|
||||||
$grid.removeClass( 'are-images-unloaded' );
|
}
|
||||||
$( '.load-more' ).removeClass( 'are-images-unloaded' );
|
|
||||||
$( '#nav-below' ).css( 'opacity', '1' );
|
if ( navBelow ) {
|
||||||
$grid.masonry( 'option', { itemSelector: '.masonry-post' });
|
navBelow.style.opacity = 1;
|
||||||
var $items = $grid.find( '.masonry-post' );
|
}
|
||||||
$grid.masonry( 'appended', $items );
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
$( '#nav-below' ).insertAfter( '.masonry-container' );
|
msnryContainer.parentNode.insertBefore( navBelow, msnryContainer.nextSibling );
|
||||||
|
|
||||||
$( window ).on( "orientationchange", function( event ) {
|
window.addEventListener( 'orientationchange', function() {
|
||||||
$grid.masonry( 'layout' );
|
msnry.layout();
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $( '.infinite-scroll' ).length && $( '.nav-links .next' ).length ) {
|
var hasInfiniteScroll = document.querySelector( '.infinite-scroll' ),
|
||||||
var $container = $( '#main article' ).first().parent();
|
nextLink = document.querySelector( '.infinite-scroll-path a' );
|
||||||
var $button = $( '.load-more a' );
|
|
||||||
var svgIcon = '';
|
if ( hasInfiniteScroll && nextLink ) {
|
||||||
|
var infiniteItems = document.querySelectorAll( '.infinite-scroll-item' ),
|
||||||
|
container = infiniteItems[ 0 ].parentNode,
|
||||||
|
button = document.querySelector( '.load-more a' ),
|
||||||
|
svgIcon = '';
|
||||||
|
|
||||||
if ( generateBlog.icon ) {
|
if ( generateBlog.icon ) {
|
||||||
svgIcon = generateBlog.icon;
|
svgIcon = generateBlog.icon;
|
||||||
@ -37,37 +45,54 @@ jQuery( document ).ready( function( $ ) {
|
|||||||
|
|
||||||
infiniteScrollInit.outlayer = msnry;
|
infiniteScrollInit.outlayer = msnry;
|
||||||
|
|
||||||
$container.infiniteScroll( infiniteScrollInit );
|
// eslint-disable-next-line no-undef -- InfiniteScroll is a dependency.
|
||||||
|
var infiniteScroll = new InfiniteScroll( container, infiniteScrollInit );
|
||||||
|
|
||||||
$button.on( 'click', function( e ) {
|
if ( button ) {
|
||||||
document.activeElement.blur();
|
button.addEventListener( 'click', function( e ) {
|
||||||
$( this ).html( svgIcon + generateBlog.loading ).addClass( 'loading' );
|
document.activeElement.blur();
|
||||||
} );
|
e.target.innerHTML = svgIcon + generateBlog.loading;
|
||||||
|
e.target.classList.add( 'loading' );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
$container.on( 'append.infiniteScroll', function( event, response, path, items ) {
|
infiniteScroll.on( 'append', function( response, path, items ) {
|
||||||
if ( ! $( '.generate-columns-container' ).length ) {
|
if ( button && ! document.querySelector( '.generate-columns-container' ) ) {
|
||||||
$container.append( $button.parent() );
|
container.appendChild( button.parentNode );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix srcset images not loading in Safari.
|
items.forEach( function( element ) {
|
||||||
// img.outerHTML = img.outerHTML isn't minified properly, so we need the extra var.
|
var images = element.querySelectorAll( 'img' );
|
||||||
$( items ).find( 'img' ).each( function( index, img ) {
|
|
||||||
var imgOuterHTML = img.outerHTML;
|
if ( images ) {
|
||||||
img.outerHTML = imgOuterHTML;
|
images.forEach( function( image ) {
|
||||||
|
var imgOuterHTML = image.outerHTML;
|
||||||
|
image.outerHTML = imgOuterHTML;
|
||||||
|
} );
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
if ( $grid ) {
|
if ( msnryContainer && msnry ) {
|
||||||
$grid.imagesLoaded( function() {
|
// eslint-disable-next-line no-undef -- ImagesLoaded is a dependency.
|
||||||
$grid.masonry( 'layout' );
|
imagesLoaded( msnryContainer, function() {
|
||||||
|
msnry.layout();
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
$button.html( svgIcon + generateBlog.more ).removeClass( 'loading' );
|
if ( button ) {
|
||||||
$( document.body ).trigger( 'post-load' );
|
button.innerHTML = svgIcon + generateBlog.more;
|
||||||
|
button.classList.remove( 'loading' );
|
||||||
|
}
|
||||||
|
|
||||||
|
document.body.dispatchEvent( new Event( 'post-load' ) );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
$container.on( 'last.infiniteScroll', function() {
|
infiniteScroll.on( 'last', function() {
|
||||||
$( '.load-more' ).hide();
|
var loadMoreElement = document.querySelector( '.load-more' );
|
||||||
|
|
||||||
|
if ( loadMoreElement ) {
|
||||||
|
loadMoreElement.style.display = 'none';
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -1 +1 @@
|
|||||||
jQuery(document).ready(function(t){var i,r,l,s,n,e=t(".masonry-container"),o=!1;e.length&&(o=(i=e.masonry(generateBlog.masonryInit)).data("masonry"),i.imagesLoaded(function(){i.masonry("layout"),i.removeClass("are-images-unloaded"),t(".load-more").removeClass("are-images-unloaded"),t("#nav-below").css("opacity","1"),i.masonry("option",{itemSelector:".masonry-post"});var n=i.find(".masonry-post");i.masonry("appended",n)}),t("#nav-below").insertAfter(".masonry-container"),t(window).on("orientationchange",function(n){i.masonry("layout")})),t(".infinite-scroll").length&&t(".nav-links .next").length&&(r=t("#main article").first().parent(),l=t(".load-more a"),s="",generateBlog.icon&&(s=generateBlog.icon),(n=generateBlog.infiniteScrollInit).outlayer=o,r.infiniteScroll(n),l.on("click",function(n){document.activeElement.blur(),t(this).html(s+generateBlog.loading).addClass("loading")}),r.on("append.infiniteScroll",function(n,e,o,a){t(".generate-columns-container").length||r.append(l.parent()),t(a).find("img").each(function(n,e){var o=e.outerHTML;e.outerHTML=o}),i&&i.imagesLoaded(function(){i.masonry("layout")}),l.html(s+generateBlog.more).removeClass("loading"),t(document.body).trigger("post-load")}),r.on("last.infiniteScroll",function(){t(".load-more").hide()}))});
|
document.addEventListener("DOMContentLoaded",function(){var t,e,n,r=document.querySelector(".masonry-container");r&&(t=new Masonry(r,generateBlog.masonryInit),e=document.querySelector("#nav-below"),n=document.querySelector(".load-more"),imagesLoaded(r,function(){t.layout(),r.classList.remove("are-images-unloaded"),n&&n.classList.remove("are-images-unloaded"),e&&(e.style.opacity=1)}),r.parentNode.insertBefore(e,r.nextSibling),window.addEventListener("orientationchange",function(){t.layout()}));var a,i,l,o,c,d=document.querySelector(".infinite-scroll"),u=document.querySelector(".infinite-scroll-path a");d&&u&&(a=document.querySelectorAll(".infinite-scroll-item")[0].parentNode,i=document.querySelector(".load-more a"),l="",generateBlog.icon&&(l=generateBlog.icon),(o=generateBlog.infiniteScrollInit).outlayer=t,c=new InfiniteScroll(a,o),i&&i.addEventListener("click",function(e){document.activeElement.blur(),e.target.innerHTML=l+generateBlog.loading,e.target.classList.add("loading")}),c.on("append",function(e,n,o){i&&!document.querySelector(".generate-columns-container")&&a.appendChild(i.parentNode),o.forEach(function(e){var n=e.querySelectorAll("img");n&&n.forEach(function(e){var n=e.outerHTML;e.outerHTML=n})}),r&&t&&imagesLoaded(r,function(){t.layout()}),i&&(i.innerHTML=l+generateBlog.more,i.classList.remove("loading")),document.body.dispatchEvent(new Event("post-load"))}),c.on("last",function(){var e=document.querySelector(".load-more");e&&(e.style.display="none")}))});
|
@ -599,22 +599,22 @@ generate_colors_live_update( 'form_button_text_color_hover', button_hover, 'colo
|
|||||||
* Back to top background color
|
* Back to top background color
|
||||||
* Empty: transparent
|
* Empty: transparent
|
||||||
*/
|
*/
|
||||||
generate_colors_live_update( 'back_to_top_background_color', '.generate-back-to-top,.generate-back-to-top:visited', 'background-color', 'transparent' );
|
generate_colors_live_update( 'back_to_top_background_color', 'a.generate-back-to-top', 'background-color', 'transparent' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Back to top text color
|
* Back to top text color
|
||||||
* Empty: text_color
|
* Empty: text_color
|
||||||
*/
|
*/
|
||||||
generate_colors_live_update( 'back_to_top_text_color', '.generate-back-to-top,.generate-back-to-top:visited', 'color', '', 'text_color' );
|
generate_colors_live_update( 'back_to_top_text_color', 'a.generate-back-to-top', 'color', '', 'text_color' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Back to top background color hover
|
* Back to top background color hover
|
||||||
* Empty: transparent
|
* Empty: transparent
|
||||||
*/
|
*/
|
||||||
generate_colors_live_update( 'back_to_top_background_color_hover', '.generate-back-to-top:hover,.generate-back-to-top:focus', 'background-color', 'transparent' );
|
generate_colors_live_update( 'back_to_top_background_color_hover', 'a.generate-back-to-top:hover,a.generate-back-to-top:focus', 'background-color', 'transparent' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Back to top text color hover
|
* Back to top text color hover
|
||||||
* Empty: text_color
|
* Empty: text_color
|
||||||
*/
|
*/
|
||||||
generate_colors_live_update( 'back_to_top_text_color_hover', '.generate-back-to-top:hover,.generate-back-to-top:focus', 'color', '', 'text_color' );
|
generate_colors_live_update( 'back_to_top_text_color_hover', 'a.generate-back-to-top:hover,a.generate-back-to-top:focus', 'color', '', 'text_color' );
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
( function( $ ) {
|
( function( $ ) {
|
||||||
|
|
||||||
// Update the site title in real time...
|
// Update the site title in real time...
|
||||||
wp.customize( 'generate_copyright', function( value ) {
|
wp.customize( 'generate_copyright', function( value ) {
|
||||||
value.bind( function( newval ) {
|
value.bind( function( newval ) {
|
||||||
@ -16,5 +15,4 @@
|
|||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
}( jQuery ) );
|
||||||
} )( jQuery );
|
|
||||||
|
@ -162,9 +162,9 @@ if ( ! function_exists( 'generate_show_de_meta_box' ) ) {
|
|||||||
</label>
|
</label>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<label for="meta-generate-disable-post-image" style="display:block;margin-bottom:3px;" title="<?php _e( 'Featured Image / Page Header', 'gp-premium' ); ?>">
|
<label for="meta-generate-disable-post-image" style="display:block;margin-bottom:3px;" title="<?php _e( 'Featured Image', 'gp-premium' ); ?>">
|
||||||
<input type="checkbox" name="_generate-disable-post-image" id="meta-generate-disable-post-image" value="true" <?php checked( $stored_meta['_generate-disable-post-image'][0], 'true' ); ?>>
|
<input type="checkbox" name="_generate-disable-post-image" id="meta-generate-disable-post-image" value="true" <?php checked( $stored_meta['_generate-disable-post-image'][0], 'true' ); ?>>
|
||||||
<?php _e( 'Featured Image / Page Header', 'gp-premium' ); ?>
|
<?php _e( 'Featured Image', 'gp-premium' ); ?>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label for="meta-generate-disable-headline" style="display:block;margin-bottom:3px;" title="<?php _e( 'Content Title', 'gp-premium' ); ?>">
|
<label for="meta-generate-disable-headline" style="display:block;margin-bottom:3px;" title="<?php _e( 'Content Title', 'gp-premium' ); ?>">
|
||||||
@ -276,6 +276,7 @@ if ( ! function_exists( 'generate_disable_elements_setup' ) ) {
|
|||||||
// Remove the navigation.
|
// Remove the navigation.
|
||||||
if ( ! empty( $disable_nav ) && false !== $disable_nav && function_exists( 'generate_get_navigation_location' ) ) {
|
if ( ! empty( $disable_nav ) && false !== $disable_nav && function_exists( 'generate_get_navigation_location' ) ) {
|
||||||
add_filter( 'generate_navigation_location', '__return_false', 20 );
|
add_filter( 'generate_navigation_location', '__return_false', 20 );
|
||||||
|
add_filter( 'generate_disable_mobile_header_menu', '__return_true' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the title.
|
// Remove the title.
|
||||||
@ -356,9 +357,9 @@ function generate_premium_disable_elements_options( $stored_meta ) {
|
|||||||
</label>
|
</label>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<label for="meta-generate-disable-post-image" style="display:block;margin-bottom:3px;" title="<?php _e( 'Featured Image / Page Header', 'gp-premium' ); ?>">
|
<label for="meta-generate-disable-post-image" style="display:block;margin-bottom:3px;" title="<?php _e( 'Featured Image', 'gp-premium' ); ?>">
|
||||||
<input type="checkbox" name="_generate-disable-post-image" id="meta-generate-disable-post-image" value="true" <?php checked( $stored_meta['_generate-disable-post-image'][0], 'true' ); ?>>
|
<input type="checkbox" name="_generate-disable-post-image" id="meta-generate-disable-post-image" value="true" <?php checked( $stored_meta['_generate-disable-post-image'][0], 'true' ); ?>>
|
||||||
<?php _e( 'Featured Image / Page Header', 'gp-premium' ); ?>
|
<?php _e( 'Featured Image', 'gp-premium' ); ?>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label for="meta-generate-disable-headline" style="display:block;margin-bottom:3px;" title="<?php _e( 'Content Title', 'gp-premium' ); ?>">
|
<label for="meta-generate-disable-headline" style="display:block;margin-bottom:3px;" title="<?php _e( 'Content Title', 'gp-premium' ); ?>">
|
||||||
|
1
wp-content/plugins/gp-premium/dist/block-elements.asset.php
vendored
Normal file
1
wp-content/plugins/gp-premium/dist/block-elements.asset.php
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php return array('dependencies' => array('lodash', 'react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-server-side-render'), 'version' => '3d87f60ace27bf43e0745865f776d835');
|
12
wp-content/plugins/gp-premium/dist/block-elements.css
vendored
Normal file
12
wp-content/plugins/gp-premium/dist/block-elements.css
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
.inline-post-meta-area>.gb-inside-container>.block-editor-inner-blocks>.block-editor-block-list__layout{display:flex;align-items:center}.inline-post-meta-area>.gb-inside-container>.block-editor-inner-blocks>.block-editor-block-list__layout>.wp-block{margin-left:0;margin-right:0}.inline-post-meta-area>.gb-inside-container>.block-editor-inner-blocks>.block-editor-block-list__layout>.wp-block.block-list-appender{margin-left:20px}.inline-post-meta-area>.gb-inside-container>.block-editor-inner-blocks>.block-editor-block-list__layout>.wp-block-image{line-height:0}.inline-post-meta-area>.gb-inside-container>.block-editor-inner-blocks>.block-editor-block-list__layout>.wp-block-image figcaption{display:none}.gpp-dynamic-container-bg-dropdown .components-popover__content{width:275px}.gpp-dynamic-container-bg-dropdown .components-popover__content .components-base-control:not(:last-child){margin-bottom:20px}.gpp-dynamic-container-bg-dropdown .components-popover__content .components-base-control:last-child .components-base-control__field{margin-bottom:0}.gpp-dynamic-container-bg-dropdown .components-popover__content .components-base-control:last-child .components-base-control__help{margin-top:3px}
|
||||||
|
|
||||||
|
.gpp-dynamic-headline-text-dropdown .components-popover__content{width:275px}.gpp-dynamic-headline-text-dropdown .components-popover__content .components-base-control:not(:last-child){margin-bottom:20px}.gpp-dynamic-headline-text-dropdown .components-popover__content .components-base-control:last-child .components-base-control__field{margin-bottom:0}.gpp-dynamic-headline-text-dropdown .components-popover__content .components-base-control:last-child .components-base-control__help{margin-top:3px}.gpp-blocks-dynamic-text-replace-field{display:none}.gpp-block-dynamic-year .components-base-control__help{margin-top:2px}
|
||||||
|
|
||||||
|
.wp-block[data-type="generatepress/dynamic-content"]{margin-top:0;margin-bottom:0}
|
||||||
|
|
||||||
|
.wp-block[data-type="generatepress/dynamic-image"]{margin-top:0;margin-bottom:0;color:#fff}.wp-block[data-type="generatepress/dynamic-image"] .components-gpp-dynamic-image-placeholder__label{color:white;position:absolute;font-size:1em;top:0;left:0;right:0;bottom:0;display:flex;justify-content:center;align-items:center}.wp-block[data-type="generatepress/dynamic-image"] .components-gpp-dynamic-image-placeholder__label>.gpp-dynamic-featured-image__label{margin-left:10px}.wp-block[data-type="generatepress/dynamic-image"] .gpp-dynamic-image-placeholder{background:#000;vertical-align:middle}.wp-block[data-type="generatepress/dynamic-image"] .components-placeholder{width:100%}.wp-block[data-type="generatepress/dynamic-image"] .gpp-dynamic-image-preview{position:relative;display:inline-block}.wp-block[data-type="generatepress/dynamic-image"] .dynamic-author-image-rounded{border-radius:100%}
|
||||||
|
|
||||||
|
.components-generatepress-units-control-header__units{display:flex;justify-content:space-between;margin-bottom:5px;align-items:center}.components-generatepress-control__units .components-generatepress-control-buttons__units button.components-button{background:#fff;box-shadow:none !important;color:#929da7;font-size:10px;padding:0 5px;position:relative;text-align:center;text-shadow:none;border:0;border-radius:0 !important;line-height:20px;padding:0 5px;height:auto}.components-generatepress-control__units .components-generatepress-control-buttons__units button.components-button.is-primary{background:#fff !important;color:#000 !important;cursor:default;z-index:1;font-weight:bold}
|
||||||
|
|
||||||
|
.is-root-container>.wp-block{max-width:var(--gp-block-element-width);margin-left:auto;margin-right:auto}.left-sidebar-block-type div:not(.block-editor-inner-blocks)>.block-editor-block-list__layout,.right-sidebar-block-type div:not(.block-editor-inner-blocks)>.block-editor-block-list__layout{padding:10px}body.left-sidebar-block-type div:not(.block-editor-inner-blocks)>.block-editor-block-list__layout .block-editor-block-list__block,body.right-sidebar-block-type div:not(.block-editor-inner-blocks)>.block-editor-block-list__layout .block-editor-block-list__block{margin-top:0;margin-bottom:0}.gpp-block-element-panel>.components-base-control{margin-bottom:20px}.gpp-block-element-panel .components-notice{margin:0}.gpp-block-element-panel .components-notice .components-notice__content{margin:0}.gpp-element-panel-label .components-panel__body-toggle.components-button{display:flex;flex-direction:row-reverse;justify-content:flex-end}.gpp-element-panel-label .components-panel__body-toggle.components-button svg.components-panel__icon{margin:0 10px 0 0}button.gpp-block-elements-template-button{cursor:pointer;background:#fff;border:1px solid #ddd;border-radius:5px;margin:0 0 10px;padding:5px}button.gpp-block-elements-template-button:hover{border-color:var(--wp-admin-theme-color)}button.gpp-block-elements-template-button .gpp-block-template-label{font-size:13px;color:#888;padding:5px}.element-has-parent #generate_premium_elements{display:none}.gpp-block-element-template-panel{background:#fafafa}.gpp-hook-select .gpp-block-element-search-select{width:100%;position:relative}.gpp-hook-select .components-text-control__input{position:relative;z-index:1;background:#fff url(data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E) no-repeat right 5px top 55%;background-size:13px 13px}.gpp-hook-select .select-search__select{background:#fff;border:1px solid #ddd}.gpp-hook-select .select-search__options{list-style:none}.gpp-hook-select .select-search__row:not(:first-child){border-top:1px solid #eee}.gpp-hook-select .select-search__row{margin:0}.gpp-hook-select .select-search__option,.gpp-hook-select .select-search__not-found{display:block;height:36px;width:100%;padding:0 16px;background:#fff;border:none;outline:none;text-align:left;cursor:pointer;margin:0}.gpp-hook-select .select-search__option.select-search__is-selected{background:#007cba;color:#fff}.gpp-hook-select .select-search__option.select-search__is-highlighted,.gpp-hook-select .select-search__option:not(.select-search__is-selected):hover{background:#fafafa}.gpp-hook-select .select-search__option.select-search__is-highlighted.select-search__is-selected,.gpp-hook-select .select-search__option.select-search__is-selected:hover{background:#007cba;color:#fff}.gpp-hook-select .select-search__group-header{font-size:10px;text-transform:uppercase;background:#eee;padding:8px 16px}.gpp-hook-select .gpp-block-element-search-select.is-disabled{opacity:0.5}.gpp-hook-select .gpp-block-element-search-select.is-loading .select-search__value::after{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='50' height='50' viewBox='0 0 50 50'%3E%3Cpath fill='%232F2D37' d='M25,5A20.14,20.14,0,0,1,45,22.88a2.51,2.51,0,0,0,2.49,2.26h0A2.52,2.52,0,0,0,50,22.33a25.14,25.14,0,0,0-50,0,2.52,2.52,0,0,0,2.5,2.81h0A2.51,2.51,0,0,0,5,22.88,20.14,20.14,0,0,1,25,5Z'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 25 25' to='360 25 25' dur='0.6s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E");background-size:11px}.gpp-hook-select .gpp-block-element-search-select:not(.is-disabled) .select-search__input{cursor:pointer}.gpp-hook-select .gpp-block-element-search-select:not(.select-search--multiple) .select-search__select{position:absolute;z-index:2;top:35px;right:0;left:0;border-radius:3px;overflow:auto;max-height:360px}.gpp-hook-select .select-search__not-found{height:auto;padding:16px;text-align:center;color:#888}
|
||||||
|
|
3
wp-content/plugins/gp-premium/dist/block-elements.js
vendored
Normal file
3
wp-content/plugins/gp-premium/dist/block-elements.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
wp-content/plugins/gp-premium/dist/editor.asset.php
vendored
Normal file
1
wp-content/plugins/gp-premium/dist/editor.asset.php
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php return array('dependencies' => array('wp-edit-post', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-plugins', 'wp-polyfill'), 'version' => 'bd343256121c2eef56d86e2530482c0e');
|
2
wp-content/plugins/gp-premium/dist/editor.css
vendored
Normal file
2
wp-content/plugins/gp-premium/dist/editor.css
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.gpp-active-element-type{color:#555;font-size:11px;text-transform:uppercase}
|
||||||
|
|
1
wp-content/plugins/gp-premium/dist/editor.js
vendored
Normal file
1
wp-content/plugins/gp-premium/dist/editor.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=54)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},11:function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},16:function(e,t){e.exports=window.wp.htmlEntities},18:function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},19:function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},20:function(e,t){e.exports=window.wp.plugins},21:function(e,t){e.exports=window.wp.editPost},4:function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},51:function(e,t,n){},54:function(e,t,n){"use strict";n.r(t);var r=n(6),o=n.n(r),c=n(7),i=n.n(c),u=n(8),l=n.n(u),f=n(9),p=n.n(f),a=n(4),s=n.n(a),m=n(0),b=(n(51),n(1)),y=n(20),d=n(21),g=n(16);var O=function(e){l()(c,e);var t,n,r=(t=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=s()(t);if(n){var o=s()(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return p()(this,e)});function c(){return o()(this,c),r.apply(this,arguments)}return i()(c,[{key:"render",value:function(){var e=gpPremiumEditor.activeElements;return!e||e.length<1?null:gpPremiumEditor.postTypeIsPublic?Object(m.createElement)(d.PluginDocumentSettingPanel,{name:"generatepress-elements-info",title:Object(b.__)("Active Elements","gp-premium"),className:"gpp-element-info-panel gpp-element-panel-label"},Object(m.createElement)(m.Fragment,null,Object(m.createElement)("ul",{className:"gpp-active-elements"},Object.keys(e).map((function(t,n){return Object(m.createElement)("li",{key:"gpp-active-block-element-".concat(n)},Object(m.createElement)("a",{href:e[t].url+"&action=edit"},Object(g.decodeEntities)(e[t].name))," ",Object(m.createElement)("span",{className:"gpp-active-element-type"},"- ",e[t].type))}))),Object(m.createElement)("a",{href:gpPremiumEditor.elementsUrl,className:"components-button is-secondary"},Object(b.__)("All Elements","gp-premium")))):null}}]),c}(m.Component);Object(y.registerPlugin)("generatepress-elements-info-panel",{icon:null,render:O})},6:function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},7:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},8:function(e,t,n){var r=n(18);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},9:function(e,t,n){var r=n(19),o=n(11);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?o(e):t}}});
|
1
wp-content/plugins/gp-premium/dist/site-library.asset.php
vendored
Normal file
1
wp-content/plugins/gp-premium/dist/site-library.asset.php
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-polyfill'), 'version' => 'fce74c8619052abc4fcc40dbeb6704bb');
|
2
wp-content/plugins/gp-premium/dist/site-library.css
vendored
Normal file
2
wp-content/plugins/gp-premium/dist/site-library.css
vendored
Normal file
File diff suppressed because one or more lines are too long
5
wp-content/plugins/gp-premium/dist/site-library.js
vendored
Normal file
5
wp-content/plugins/gp-premium/dist/site-library.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 138 B |
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
@ -1,4 +1,4 @@
|
|||||||
jQuery( document ).ready( function( $ ) {
|
jQuery( function( $ ) {
|
||||||
$( '.post-type-gp_elements .page-title-action:not(.legacy-button)' ).on( 'click', function( e ) {
|
$( '.post-type-gp_elements .page-title-action:not(.legacy-button)' ).on( 'click', function( e ) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
@ -10,4 +10,9 @@ jQuery( document ).ready( function( $ ) {
|
|||||||
|
|
||||||
$( '.choose-element-type-parent' ).hide();
|
$( '.choose-element-type-parent' ).hide();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
// Don't allow Elements to quick edit parents.
|
||||||
|
$( '.inline-edit-gp_elements select#post_parent, .inline-edit-gp_elements .inline-edit-menu-order-input, .bulk-edit-gp_elements select#post_parent' ).each( function() {
|
||||||
|
$( this ).closest( 'label' ).remove();
|
||||||
|
} );
|
||||||
} );
|
} );
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 200 B |
@ -188,18 +188,25 @@ ul.element-metabox-tabs li.is-selected a {
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.element-settings.header table[data-tab="hero"],
|
.element-settings.header:not(.has-page-hero) table[data-tab="site-header"],
|
||||||
|
.element-settings.header.has-page-hero table[data-tab="hero"],
|
||||||
.element-settings.hook table[data-tab="hook-settings"],
|
.element-settings.hook table[data-tab="hook-settings"],
|
||||||
.element-settings.block table[data-tab="hook-settings"],
|
.element-settings.block table[data-tab="hook-settings"],
|
||||||
.element-settings.layout table[data-tab="sidebars"] {
|
.element-settings.layout table[data-tab="sidebars"] {
|
||||||
display: table;
|
display: table;
|
||||||
}
|
}
|
||||||
|
|
||||||
.element-settings.layout #generate-element-content,
|
.element-settings.header:not(.has-page-hero) #generate-element-content {
|
||||||
.element-settings.block #generate-element-content {
|
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.element-settings.header:not(.has-page-hero) #generate-element-content + .CodeMirror:not(.gpp-elements-show-codemirror) {
|
||||||
|
height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
opacity: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.padding-container {
|
.padding-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
@ -337,7 +344,8 @@ span.tip {
|
|||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
body:not(.header-element-type) #generate_page_hero_template_tags {
|
body:not(.header-element-type) #generate_page_hero_template_tags,
|
||||||
|
.header-element-type:not(.element-has-page-hero) #generate_page_hero_template_tags {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
jQuery(document).ready(function( $ ) {
|
jQuery( function( $ ) {
|
||||||
if ( $( '.element-settings' ).hasClass( 'header' ) || $( '.element-settings' ).hasClass( 'hook' ) ) {
|
if ( $( '.element-settings' ).hasClass( 'header' ) || $( '.element-settings' ).hasClass( 'hook' ) ) {
|
||||||
$( function() {
|
$( function() {
|
||||||
if ( elements.settings) {
|
if ( elements.settings ) {
|
||||||
wp.codeEditor.initialize( "generate-element-content", elements.settings );
|
wp.codeEditor.initialize( 'generate-element-content', elements.settings );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ jQuery(document).ready(function( $ ) {
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
$( '#_generate_hook' ).select2( {
|
$( '#_generate_hook' ).select2( {
|
||||||
width: '100%'
|
width: '100%',
|
||||||
} );
|
} );
|
||||||
|
|
||||||
$( '.element-metabox-tabs li' ).on( 'click', function() {
|
$( '.element-metabox-tabs li' ).on( 'click', function() {
|
||||||
@ -63,15 +63,17 @@ jQuery(document).ready(function( $ ) {
|
|||||||
$( '.generate-elements-settings' ).hide();
|
$( '.generate-elements-settings' ).hide();
|
||||||
$( '.generate-elements-settings[data-tab="' + tab + '"]' ).show();
|
$( '.generate-elements-settings[data-tab="' + tab + '"]' ).show();
|
||||||
|
|
||||||
if ( $( '.element-settings' ).hasClass( 'block' ) & 'hook-settings' === tab ) {
|
if ( $( '.element-settings' ).hasClass( 'block' ) && 'hook-settings' === tab ) {
|
||||||
$( '.generate-elements-settings[data-tab="display-rules"]' ).show();
|
$( '.generate-elements-settings[data-tab="display-rules"]' ).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $( '.element-settings' ).hasClass( 'header' ) ) {
|
if ( $( '.element-settings' ).hasClass( 'header' ) ) {
|
||||||
if ( 'hero' !== tab ) {
|
if ( 'hero' !== tab ) {
|
||||||
$( '#generate-element-content' ).next( '.CodeMirror' ).hide();
|
$( '#generate-element-content' ).next( '.CodeMirror' ).removeClass( 'gpp-elements-show-codemirror' );
|
||||||
|
$( '#generate_page_hero_template_tags' ).css( 'display', '' );
|
||||||
} else {
|
} else {
|
||||||
$( '#generate-element-content' ).next( '.CodeMirror' ).show();
|
$( '#generate-element-content' ).next( '.CodeMirror' ).addClass( 'gpp-elements-show-codemirror' );
|
||||||
|
$( '#generate_page_hero_template_tags' ).css( 'display', 'block' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
@ -82,7 +84,7 @@ jQuery(document).ready(function( $ ) {
|
|||||||
selects.each( function() {
|
selects.each( function() {
|
||||||
var select = $( this ),
|
var select = $( this ),
|
||||||
config = {
|
config = {
|
||||||
width: 'style'
|
width: 'style',
|
||||||
};
|
};
|
||||||
|
|
||||||
select.select2( config );
|
select.select2( config );
|
||||||
@ -95,82 +97,70 @@ jQuery(document).ready(function( $ ) {
|
|||||||
$( '.add-condition' ).on( 'click', function() {
|
$( '.add-condition' ).on( 'click', function() {
|
||||||
var _this = $( this );
|
var _this = $( this );
|
||||||
|
|
||||||
var row = _this.closest( '.generate-element-row-content' ).find( '.condition.hidden.screen-reader-text' ).clone(true);
|
var row = _this.closest( '.generate-element-row-content' ).find( '.condition.hidden.screen-reader-text' ).clone( true );
|
||||||
row.removeClass( 'hidden screen-reader-text' );
|
row.removeClass( 'hidden screen-reader-text' );
|
||||||
row.insertBefore( _this.closest( '.generate-element-row-content' ).find( '.condition:last' ) );
|
row.insertBefore( _this.closest( '.generate-element-row-content' ).find( '.condition:last' ) );
|
||||||
|
|
||||||
select2Init();
|
select2Init();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
} );
|
||||||
|
|
||||||
$( '.remove-condition' ).on('click', function() {
|
$( '.remove-condition' ).on( 'click', function() {
|
||||||
$(this).parents('.condition').remove();
|
$( this ).parents( '.condition' ).remove();
|
||||||
|
|
||||||
select2Init();
|
select2Init();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
} );
|
||||||
|
|
||||||
var get_location_objects = function( _this, onload = false ) {
|
var getLocationObjects = function( _this, onload = false, data = '' ) {
|
||||||
var select = _this,
|
var select = _this,
|
||||||
parent = select.parent(),
|
parent = select.parent(),
|
||||||
location = select.val(),
|
location = select.val(),
|
||||||
object_select = parent.find( '.condition-object-select' ),
|
objectSelect = parent.find( '.condition-object-select' ),
|
||||||
locationString = '',
|
locationType = '',
|
||||||
actionType = 'terms';
|
actionType = 'terms';
|
||||||
|
|
||||||
if ( '' == location ) {
|
|
||||||
|
|
||||||
|
if ( '' === location ) {
|
||||||
parent.removeClass( 'generate-elements-rule-objects-visible' );
|
parent.removeClass( 'generate-elements-rule-objects-visible' );
|
||||||
select.closest( '.generate-element-row-content' ).find( '.generate-element-row-loading' ).remove();
|
select.closest( '.generate-element-row-content' ).find( '.generate-element-row-loading' ).remove();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if ( location.indexOf( ':taxonomy:' ) > 0 ) {
|
if ( location.indexOf( ':taxonomy:' ) > 0 ) {
|
||||||
var locationType = 'taxonomy';
|
locationType = 'taxonomy';
|
||||||
} else {
|
} else {
|
||||||
var locationType = location.substr( 0, location.indexOf( ':' ) );
|
locationType = location.substr( 0, location.indexOf( ':' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
var locationID = location.substr( location.lastIndexOf( ':' ) + 1 );
|
var locationID = location.substr( location.lastIndexOf( ':' ) + 1 );
|
||||||
|
|
||||||
locationString = location;
|
if ( 'taxonomy' === locationType || 'post' === locationType ) {
|
||||||
|
|
||||||
if ( 'taxonomy' == locationType || 'post' == locationType ) {
|
|
||||||
|
|
||||||
if ( ! ( '.generate-element-row-loading' ).length ) {
|
if ( ! ( '.generate-element-row-loading' ).length ) {
|
||||||
select.closest( '.generate-element-row-content' ).prepend( '<div class="generate-element-row-loading"></div>' );
|
select.closest( '.generate-element-row-content' ).prepend( '<div class="generate-element-row-loading"></div>' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'post' == locationType ) {
|
var fillObjects = function( response ) {
|
||||||
if ( 'taxonomy' == locationType ) {
|
var objects = response[ locationID ].objects;
|
||||||
actionType = 'terms';
|
|
||||||
} else {
|
|
||||||
actionType = 'posts';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$.post( ajaxurl, {
|
|
||||||
action : 'generate_elements_get_location_' + actionType,
|
|
||||||
id : locationID,
|
|
||||||
nonce : elements.nonce
|
|
||||||
}, function( response ) {
|
|
||||||
response = $.parseJSON( response );
|
|
||||||
var objects = response.objects;
|
|
||||||
|
|
||||||
var blank = {
|
var blank = {
|
||||||
'id': '',
|
id: '',
|
||||||
'name': 'All ' + response.label,
|
name: 'All ' + response[ locationID ].label,
|
||||||
};
|
};
|
||||||
|
|
||||||
if ( location.indexOf( ':taxonomy:' ) > 0 ) {
|
if ( location.indexOf( ':taxonomy:' ) > 0 ) {
|
||||||
blank.name = elements.choose;
|
blank.name = elements.choose;
|
||||||
}
|
}
|
||||||
|
|
||||||
objects.unshift( blank );
|
objectSelect.empty();
|
||||||
object_select.empty();
|
|
||||||
|
objectSelect.append( $( '<option>', {
|
||||||
|
value: blank.id,
|
||||||
|
label: blank.name,
|
||||||
|
text: blank.name,
|
||||||
|
} ) );
|
||||||
|
|
||||||
$.each( objects, function( key, value ) {
|
$.each( objects, function( key, value ) {
|
||||||
object_select.append( $( '<option>', {
|
objectSelect.append( $( '<option>', {
|
||||||
value: value.id,
|
value: value.id,
|
||||||
label: elements.showID && value.id ? value.name + ': ' + value.id : value.name,
|
label: elements.showID && value.id ? value.name + ': ' + value.id : value.name,
|
||||||
text: elements.showID && value.id ? value.name + ': ' + value.id : value.name,
|
text: elements.showID && value.id ? value.name + ': ' + value.id : value.name,
|
||||||
@ -180,38 +170,93 @@ jQuery(document).ready(function( $ ) {
|
|||||||
parent.addClass( 'generate-elements-rule-objects-visible' );
|
parent.addClass( 'generate-elements-rule-objects-visible' );
|
||||||
|
|
||||||
if ( onload ) {
|
if ( onload ) {
|
||||||
object_select.val( object_select.attr( 'data-saved-value' ) );
|
objectSelect.val( objectSelect.attr( 'data-saved-value' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
select.closest( '.generate-element-row-content' ).find( '.generate-element-row-loading' ).remove();
|
select.closest( '.generate-element-row-content' ).find( '.generate-element-row-loading' ).remove();
|
||||||
} );
|
};
|
||||||
|
|
||||||
|
if ( data && onload ) {
|
||||||
|
// Use pre-fetched data if we just loaded the page.
|
||||||
|
fillObjects( data );
|
||||||
|
} else {
|
||||||
|
if ( 'post' === locationType ) {
|
||||||
|
if ( 'taxonomy' === locationType ) {
|
||||||
|
actionType = 'terms';
|
||||||
|
} else {
|
||||||
|
actionType = 'posts';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$.post( ajaxurl, {
|
||||||
|
action: 'generate_elements_get_location_' + actionType,
|
||||||
|
id: locationID,
|
||||||
|
nonce: elements.nonce,
|
||||||
|
}, function( response ) {
|
||||||
|
response = JSON.parse( response );
|
||||||
|
fillObjects( response );
|
||||||
|
} );
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
parent.removeClass( 'generate-elements-rule-objects-visible' );
|
parent.removeClass( 'generate-elements-rule-objects-visible' );
|
||||||
select.closest( '.generate-element-row-content' ).find( '.generate-element-row-loading' ).remove();
|
select.closest( '.generate-element-row-content' ).find( '.generate-element-row-loading' ).remove();
|
||||||
object_select.empty().append( '<option value="0"></option>' );
|
objectSelect.empty().append( '<option value="0"></option>' );
|
||||||
object_select.val( '0' );
|
objectSelect.val( '0' );
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove.show();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$( '.condition select.condition-select' ).on( 'change', function() {
|
$( '.condition select.condition-select' ).on( 'change', function() {
|
||||||
get_location_objects( $( this ) );
|
getLocationObjects( $( this ) );
|
||||||
|
|
||||||
$( '.elements-no-location-error' ).hide();
|
$( '.elements-no-location-error' ).hide();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
var postObjects = [];
|
||||||
|
var termObjects = [];
|
||||||
|
|
||||||
$( '.generate-elements-rule-objects-visible' ).each( function() {
|
$( '.generate-elements-rule-objects-visible' ).each( function() {
|
||||||
var _this = $( this ),
|
var _this = $( this ),
|
||||||
select = _this.find( 'select.condition-select' );
|
select = _this.find( 'select.condition-select' ),
|
||||||
|
location = select.val(),
|
||||||
|
locationID = location.substr( location.lastIndexOf( ':' ) + 1 ),
|
||||||
|
locationType = '';
|
||||||
|
|
||||||
$( '<div class="generate-element-row-loading"></div>' ).insertBefore( _this );
|
if ( location.indexOf( ':taxonomy:' ) > 0 ) {
|
||||||
|
locationType = 'taxonomy';
|
||||||
|
} else {
|
||||||
|
locationType = location.substr( 0, location.indexOf( ':' ) );
|
||||||
|
}
|
||||||
|
|
||||||
get_location_objects( select, true );
|
if ( 'post' === locationType ) {
|
||||||
|
if ( ! postObjects.includes( locationID ) ) {
|
||||||
|
postObjects.push( locationID );
|
||||||
|
}
|
||||||
|
} else if ( 'taxonomy' === locationType && ! termObjects.includes( locationID ) ) {
|
||||||
|
termObjects.push( locationID );
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
if ( postObjects.length > 0 || termObjects.length > 0 ) {
|
||||||
|
$.post( ajaxurl, {
|
||||||
|
action: 'generate_elements_get_location_objects',
|
||||||
|
posts: postObjects,
|
||||||
|
terms: termObjects,
|
||||||
|
nonce: elements.nonce,
|
||||||
|
}, function( response ) {
|
||||||
|
response = JSON.parse( response );
|
||||||
|
|
||||||
|
$( '.generate-elements-rule-objects-visible' ).each( function() {
|
||||||
|
var _this = $( this ),
|
||||||
|
select = _this.find( 'select.condition-select' );
|
||||||
|
|
||||||
|
$( '<div class="generate-element-row-loading"></div>' ).insertBefore( _this );
|
||||||
|
|
||||||
|
getLocationObjects( select, true, response );
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
$( '.set-featured-image a, .change-featured-image a:not(.remove-image)' ).on( 'click', function( event ) {
|
$( '.set-featured-image a, .change-featured-image a:not(.remove-image)' ).on( 'click', function( event ) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
@ -237,7 +282,7 @@ jQuery(document).ready(function( $ ) {
|
|||||||
$( '.change-featured-image' ).hide();
|
$( '.change-featured-image' ).hide();
|
||||||
$( '.image-preview' ).empty();
|
$( '.image-preview' ).empty();
|
||||||
return false;
|
return false;
|
||||||
});
|
} );
|
||||||
|
|
||||||
$( '.remove-image' ).on( 'click', function( e ) {
|
$( '.remove-image' ).on( 'click', function( e ) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -257,12 +302,12 @@ jQuery(document).ready(function( $ ) {
|
|||||||
var frame = wp.media( {
|
var frame = wp.media( {
|
||||||
title: _this.data( 'title' ),
|
title: _this.data( 'title' ),
|
||||||
multiple: false,
|
multiple: false,
|
||||||
library: { type : _this.data( 'type' ) },
|
library: { type: _this.data( 'type' ) },
|
||||||
button: { text : _this.data( 'insert' ) }
|
button: { text: _this.data( 'insert' ) },
|
||||||
} );
|
} );
|
||||||
|
|
||||||
frame.on( 'select', function() {
|
frame.on( 'select', function() {
|
||||||
var attachment = frame.state().get('selection').first().toJSON();
|
var attachment = frame.state().get( 'selection' ).first().toJSON();
|
||||||
|
|
||||||
container.find( '.media-field' ).val( attachment.id );
|
container.find( '.media-field' ).val( attachment.id );
|
||||||
container.find( '.remove-field' ).show();
|
container.find( '.remove-field' ).show();
|
||||||
@ -293,11 +338,11 @@ jQuery(document).ready(function( $ ) {
|
|||||||
$( '.requires-background-image' ).hide();
|
$( '.requires-background-image' ).hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'featured-image' == _this.val() ) {
|
if ( 'featured-image' === _this.val() ) {
|
||||||
$( '.image-text' ).text( elements.fallback_image );
|
$( '.image-text' ).text( elements.fallback_image );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'custom-image' == _this.val() ) {
|
if ( 'custom-image' === _this.val() ) {
|
||||||
$( '.image-text' ).text( elements.custom_image );
|
$( '.image-text' ).text( elements.custom_image );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
@ -308,10 +353,10 @@ jQuery(document).ready(function( $ ) {
|
|||||||
|
|
||||||
var _this = $( this ),
|
var _this = $( this ),
|
||||||
control = _this.attr( 'data-control' ),
|
control = _this.attr( 'data-control' ),
|
||||||
control_area = _this.closest( '.generate-element-row-content' );
|
controlArea = _this.closest( '.generate-element-row-content' );
|
||||||
|
|
||||||
control_area.find( '.padding-container' ).hide();
|
controlArea.find( '.padding-container' ).hide();
|
||||||
control_area.find( '.padding-container.' + control ).show();
|
controlArea.find( '.padding-container.' + control ).show();
|
||||||
_this.siblings().removeClass( 'is-selected' );
|
_this.siblings().removeClass( 'is-selected' );
|
||||||
_this.addClass( 'is-selected' );
|
_this.addClass( 'is-selected' );
|
||||||
} );
|
} );
|
||||||
|
1758
wp-content/plugins/gp-premium/elements/class-block-elements.php
Normal file
1758
wp-content/plugins/gp-premium/elements/class-block-elements.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -30,6 +30,14 @@ class GeneratePress_Block_Element {
|
|||||||
*/
|
*/
|
||||||
protected $type = '';
|
protected $type = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has post ancestors.
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
* @var boolean If this post has a parent.
|
||||||
|
*/
|
||||||
|
protected $has_parent = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kicks it all off.
|
* Kicks it all off.
|
||||||
*
|
*
|
||||||
@ -40,6 +48,18 @@ class GeneratePress_Block_Element {
|
|||||||
public function __construct( $post_id ) {
|
public function __construct( $post_id ) {
|
||||||
$this->post_id = $post_id;
|
$this->post_id = $post_id;
|
||||||
$this->type = get_post_meta( $post_id, '_generate_block_type', true );
|
$this->type = get_post_meta( $post_id, '_generate_block_type', true );
|
||||||
|
$has_content_template_condition = get_post_meta( $post_id, '_generate_post_loop_item_display', true );
|
||||||
|
|
||||||
|
// Take over the $post_id temporarily if this is a child block.
|
||||||
|
// This allows us to inherit the parent block Display Rules.
|
||||||
|
if ( 'content-template' === $this->type && $has_content_template_condition ) {
|
||||||
|
$parent_block = wp_get_post_parent_id( $post_id );
|
||||||
|
|
||||||
|
if ( ! empty( $parent_block ) ) {
|
||||||
|
$this->has_parent = true;
|
||||||
|
$post_id = $parent_block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$display_conditions = get_post_meta( $post_id, '_generate_element_display_conditions', true ) ? get_post_meta( $post_id, '_generate_element_display_conditions', true ) : array();
|
$display_conditions = get_post_meta( $post_id, '_generate_element_display_conditions', true ) ? get_post_meta( $post_id, '_generate_element_display_conditions', true ) : array();
|
||||||
$exclude_conditions = get_post_meta( $post_id, '_generate_element_exclude_conditions', true ) ? get_post_meta( $post_id, '_generate_element_exclude_conditions', true ) : array();
|
$exclude_conditions = get_post_meta( $post_id, '_generate_element_exclude_conditions', true ) ? get_post_meta( $post_id, '_generate_element_exclude_conditions', true ) : array();
|
||||||
@ -55,7 +75,31 @@ class GeneratePress_Block_Element {
|
|||||||
$post_id
|
$post_id
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simplify filter name.
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
$display = apply_filters(
|
||||||
|
'generate_element_display',
|
||||||
|
$display,
|
||||||
|
$post_id
|
||||||
|
);
|
||||||
|
|
||||||
|
// Restore our actual post ID if it's been changed.
|
||||||
|
if ( 'content-template' === $this->type && $has_content_template_condition ) {
|
||||||
|
$post_id = $this->post_id;
|
||||||
|
}
|
||||||
|
|
||||||
if ( $display ) {
|
if ( $display ) {
|
||||||
|
global $generate_elements;
|
||||||
|
|
||||||
|
$generate_elements[ $post_id ] = array(
|
||||||
|
'is_block_element' => true,
|
||||||
|
'type' => $this->type,
|
||||||
|
'id' => $post_id,
|
||||||
|
);
|
||||||
|
|
||||||
$hook = get_post_meta( $post_id, '_generate_hook', true );
|
$hook = get_post_meta( $post_id, '_generate_hook', true );
|
||||||
$custom_hook = get_post_meta( $post_id, '_generate_custom_hook', true );
|
$custom_hook = get_post_meta( $post_id, '_generate_custom_hook', true );
|
||||||
$priority = get_post_meta( $post_id, '_generate_hook_priority', true );
|
$priority = get_post_meta( $post_id, '_generate_hook_priority', true );
|
||||||
@ -80,12 +124,36 @@ class GeneratePress_Block_Element {
|
|||||||
case 'left-sidebar':
|
case 'left-sidebar':
|
||||||
$hook = 'generate_before_left_sidebar_content';
|
$hook = 'generate_before_left_sidebar_content';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'content-template':
|
||||||
|
$hook = 'generate_before_do_template_part';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'custom' === $hook && $custom_hook ) {
|
if ( 'custom' === $hook && $custom_hook ) {
|
||||||
$hook = $custom_hook;
|
$hook = $custom_hook;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( 'post-meta-template' === $this->type ) {
|
||||||
|
$post_meta_location = get_post_meta( $post_id, '_generate_post_meta_location', true );
|
||||||
|
|
||||||
|
if ( '' === $post_meta_location || 'after-post-title' === $post_meta_location ) {
|
||||||
|
$hook = 'generate_after_entry_title';
|
||||||
|
|
||||||
|
if ( is_page() ) {
|
||||||
|
$hook = 'generate_after_page_title';
|
||||||
|
}
|
||||||
|
} elseif ( 'before-post-title' === $post_meta_location ) {
|
||||||
|
$hook = 'generate_before_entry_title';
|
||||||
|
|
||||||
|
if ( is_page() ) {
|
||||||
|
$hook = 'generate_before_page_title';
|
||||||
|
}
|
||||||
|
} elseif ( 'after-content' === $post_meta_location ) {
|
||||||
|
$hook = 'generate_after_content';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! $hook ) {
|
if ( ! $hook ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -98,16 +166,27 @@ class GeneratePress_Block_Element {
|
|||||||
remove_action( 'generate_footer', 'generate_construct_footer' );
|
remove_action( 'generate_footer', 'generate_construct_footer' );
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action( esc_attr( $hook ), array( $this, 'build_hook' ), absint( $priority ) );
|
if ( 'content-template' === $this->type && ! $this->has_parent ) {
|
||||||
|
add_filter( 'generate_do_template_part', array( $this, 'do_template_part' ) );
|
||||||
if ( 'right-sidebar' === $this->type || 'left-sidebar' === $this->type ) {
|
|
||||||
add_filter( 'sidebars_widgets', array( $this, 'remove_sidebar_widgets' ) );
|
|
||||||
add_filter( 'generate_show_default_sidebar_widgets', '__return_false' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_action( 'wp', array( $this, 'remove_elements' ), 100 );
|
||||||
|
add_action( esc_attr( $hook ), array( $this, 'build_hook' ), absint( $priority ) );
|
||||||
add_filter( 'generateblocks_do_content', array( $this, 'do_block_content' ) );
|
add_filter( 'generateblocks_do_content', array( $this, 'do_block_content' ) );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable our post loop items if needed.
|
||||||
|
*
|
||||||
|
* @param boolean $do Whether to display the default post loop item or not.
|
||||||
|
*/
|
||||||
|
public function do_template_part( $do ) {
|
||||||
|
if ( GeneratePress_Elements_Helper::should_render_content_template( $this->post_id ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $do;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,12 +231,185 @@ class GeneratePress_Block_Element {
|
|||||||
return $widgets;
|
return $widgets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove existing elements.
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
public function remove_elements() {
|
||||||
|
if ( 'right-sidebar' === $this->type || 'left-sidebar' === $this->type ) {
|
||||||
|
add_filter( 'sidebars_widgets', array( $this, 'remove_sidebar_widgets' ) );
|
||||||
|
add_filter( 'generate_show_default_sidebar_widgets', '__return_false' );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'page-hero' === $this->type ) {
|
||||||
|
$disable_title = get_post_meta( $this->post_id, '_generate_disable_title', true );
|
||||||
|
$disable_featured_image = get_post_meta( $this->post_id, '_generate_disable_featured_image', true );
|
||||||
|
$disable_primary_post_meta = get_post_meta( $this->post_id, '_generate_disable_primary_post_meta', true );
|
||||||
|
|
||||||
|
if ( $disable_title ) {
|
||||||
|
if ( is_singular() ) {
|
||||||
|
add_filter( 'generate_show_title', '__return_false' );
|
||||||
|
}
|
||||||
|
|
||||||
|
remove_action( 'generate_archive_title', 'generate_archive_title' );
|
||||||
|
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $disable_primary_post_meta ) {
|
||||||
|
remove_action( 'generate_after_entry_title', 'generate_post_meta' );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $disable_featured_image && is_singular() ) {
|
||||||
|
remove_action( 'generate_after_entry_header', 'generate_blog_single_featured_image' );
|
||||||
|
remove_action( 'generate_before_content', 'generate_blog_single_featured_image' );
|
||||||
|
remove_action( 'generate_after_header', 'generate_blog_single_featured_image' );
|
||||||
|
remove_action( 'generate_before_content', 'generate_featured_page_header_inside_single' );
|
||||||
|
remove_action( 'generate_after_header', 'generate_featured_page_header' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'post-meta-template' === $this->type ) {
|
||||||
|
$post_meta_location = get_post_meta( $this->post_id, '_generate_post_meta_location', true );
|
||||||
|
$disable_primary_post_meta = get_post_meta( $this->post_id, '_generate_disable_primary_post_meta', true );
|
||||||
|
$disable_secondary_post_meta = get_post_meta( $this->post_id, '_generate_disable_secondary_post_meta', true );
|
||||||
|
|
||||||
|
if ( '' === $post_meta_location || 'after-post-title' === $post_meta_location || 'custom' === $post_meta_location ) {
|
||||||
|
if ( $disable_primary_post_meta ) {
|
||||||
|
remove_action( 'generate_after_entry_title', 'generate_post_meta' );
|
||||||
|
}
|
||||||
|
} elseif ( 'before-post-title' === $post_meta_location || 'custom' === $post_meta_location ) {
|
||||||
|
if ( $disable_primary_post_meta ) {
|
||||||
|
remove_action( 'generate_after_entry_title', 'generate_post_meta' );
|
||||||
|
}
|
||||||
|
} elseif ( 'after-content' === $post_meta_location || 'custom' === $post_meta_location ) {
|
||||||
|
if ( $disable_secondary_post_meta ) {
|
||||||
|
remove_action( 'generate_after_entry_content', 'generate_footer_meta' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'post-navigation-template' === $this->type ) {
|
||||||
|
$disable_post_navigation = get_post_meta( $this->post_id, '_generate_disable_post_navigation', true );
|
||||||
|
|
||||||
|
if ( $disable_post_navigation ) {
|
||||||
|
add_filter( 'generate_footer_entry_meta_items', array( $this, 'disable_post_navigation' ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'archive-navigation-template' === $this->type ) {
|
||||||
|
$disable_archive_navigation = get_post_meta( $this->post_id, '_generate_disable_archive_navigation', true );
|
||||||
|
|
||||||
|
if ( $disable_archive_navigation ) {
|
||||||
|
remove_action( 'generate_after_loop', 'generate_do_post_navigation' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable post navigation.
|
||||||
|
*
|
||||||
|
* @param array $items The post meta items.
|
||||||
|
*/
|
||||||
|
public function disable_post_navigation( $items ) {
|
||||||
|
return array_diff( $items, array( 'post-navigation' ) );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the HTML structure for Page Headers.
|
* Builds the HTML structure for Page Headers.
|
||||||
*
|
*
|
||||||
* @since 1.11.0
|
* @since 1.11.0
|
||||||
*/
|
*/
|
||||||
public function build_hook() {
|
public function build_hook() {
|
||||||
echo GeneratePress_Elements_Helper::build_content( $this->post_id); // phpcs:ignore -- No escaping needed.
|
$post_id = $this->post_id;
|
||||||
|
|
||||||
|
if ( 'content-template' === $this->type ) {
|
||||||
|
// Check for child templates if this isn't already one.
|
||||||
|
if ( ! $this->has_parent ) {
|
||||||
|
$children = get_posts(
|
||||||
|
array(
|
||||||
|
'post_type' => 'gp_elements',
|
||||||
|
'post_parent' => $post_id,
|
||||||
|
'order' => 'ASC',
|
||||||
|
'orderby' => 'menu_order',
|
||||||
|
'no_found_rows' => true,
|
||||||
|
'post_status' => 'publish',
|
||||||
|
'numberposts' => 20,
|
||||||
|
'fields' => 'ids',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( ! empty( $children ) ) {
|
||||||
|
// Loop through any child templates and overwrite $post_id if applicable.
|
||||||
|
foreach ( (array) $children as $child_id ) {
|
||||||
|
if ( GeneratePress_Elements_Helper::should_render_content_template( $child_id ) ) {
|
||||||
|
$post_id = $child_id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// No children, check if parent should render.
|
||||||
|
if ( ! GeneratePress_Elements_Helper::should_render_content_template( $post_id ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// No children, check if template should render.
|
||||||
|
if ( ! GeneratePress_Elements_Helper::should_render_content_template( $post_id ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't display child elements - they will replace the parent element if applicable.
|
||||||
|
if ( $this->has_parent ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tag_name_value = get_post_meta( $post_id, '_generate_post_loop_item_tagname', true );
|
||||||
|
$use_theme_container = get_post_meta( $post_id, '_generate_use_theme_post_container', true );
|
||||||
|
|
||||||
|
if ( $tag_name_value ) {
|
||||||
|
$tag_name = $tag_name_value;
|
||||||
|
} else {
|
||||||
|
$tag_name = 'article';
|
||||||
|
}
|
||||||
|
|
||||||
|
printf(
|
||||||
|
'<%s id="%s" class="%s">',
|
||||||
|
esc_attr( $tag_name ),
|
||||||
|
'post-' . get_the_ID(),
|
||||||
|
implode( ' ', get_post_class( 'dynamic-content-template' ) ) // phpcs:ignore -- No escaping needed.
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( $use_theme_container ) {
|
||||||
|
echo '<div class="inside-article">';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'archive-navigation-template' === $this->type || 'post-navigation-template' === $this->type ) {
|
||||||
|
$use_theme_pagination_container = get_post_meta( $post_id, '_generate_use_archive_navigation_container', true );
|
||||||
|
|
||||||
|
if ( $use_theme_pagination_container ) {
|
||||||
|
echo '<div class="paging-navigation">';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo GeneratePress_Elements_Helper::build_content( $post_id ); // phpcs:ignore -- No escaping needed.
|
||||||
|
|
||||||
|
if ( 'content-template' === $this->type ) {
|
||||||
|
if ( $use_theme_container ) {
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</' . esc_attr( $tag_name ) . '>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'archive-navigation-template' === $this->type || 'post-navigation-template' === $this->type ) {
|
||||||
|
$use_theme_pagination_container = get_post_meta( $post_id, '_generate_use_archive_navigation_container', true );
|
||||||
|
|
||||||
|
if ( $use_theme_pagination_container ) {
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@ class GeneratePress_Conditions {
|
|||||||
'general:author' => esc_attr__( 'Author Archives', 'gp-premium' ),
|
'general:author' => esc_attr__( 'Author Archives', 'gp-premium' ),
|
||||||
'general:date' => esc_attr__( 'Date Archives', 'gp-premium' ),
|
'general:date' => esc_attr__( 'Date Archives', 'gp-premium' ),
|
||||||
'general:search' => esc_attr__( 'Search Results', 'gp-premium' ),
|
'general:search' => esc_attr__( 'Search Results', 'gp-premium' ),
|
||||||
|
'general:no_results' => esc_attr__( 'No Search Results', 'gp-premium' ),
|
||||||
'general:404' => esc_attr__( '404 Template', 'gp-premium' ),
|
'general:404' => esc_attr__( '404 Template', 'gp-premium' ),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -188,6 +189,12 @@ class GeneratePress_Conditions {
|
|||||||
$location = 'general:date';
|
$location = 'general:date';
|
||||||
} elseif ( is_search() ) {
|
} elseif ( is_search() ) {
|
||||||
$location = 'general:search';
|
$location = 'general:search';
|
||||||
|
|
||||||
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( 0 === $wp_query->found_posts ) {
|
||||||
|
$location = 'general:no_results';
|
||||||
|
}
|
||||||
} elseif ( is_404() ) {
|
} elseif ( is_404() ) {
|
||||||
$location = 'general:404';
|
$location = 'general:404';
|
||||||
} elseif ( is_category() ) {
|
} elseif ( is_category() ) {
|
||||||
|
@ -142,6 +142,351 @@ class GeneratePress_Elements_Helper {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$block_type = get_post_meta( $id, '_generate_block_type', true );
|
||||||
|
|
||||||
|
if ( 'site-footer' === $block_type ) {
|
||||||
|
$block_element->post_content = str_replace( '{{current_year}}', date( 'Y' ), $block_element->post_content ); // phpcs:ignore -- Prefer date().
|
||||||
|
}
|
||||||
|
|
||||||
return apply_filters( 'generate_do_block_element_content', do_blocks( $block_element->post_content ) );
|
return apply_filters( 'generate_do_block_element_content', do_blocks( $block_element->post_content ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get our Element type label.
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
* @param string $type The type value.
|
||||||
|
*/
|
||||||
|
public static function get_element_type_label( $type ) {
|
||||||
|
switch ( $type ) {
|
||||||
|
case 'block':
|
||||||
|
$label = __( 'Block', 'gp-premium' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'header':
|
||||||
|
$label = __( 'Header', 'gp-premium' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'hook':
|
||||||
|
$label = __( 'Hook', 'gp-premium' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'layout':
|
||||||
|
$label = __( 'Layout', 'gp-premium' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'site-header':
|
||||||
|
$label = __( 'Site Header', 'gp-premium' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'page-hero':
|
||||||
|
$label = __( 'Page Hero', 'gp-premium' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'content-template':
|
||||||
|
$label = __( 'Content Template', 'gp-premium' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'post-meta-template':
|
||||||
|
$label = __( 'Post Meta Template', 'gp-premium' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'post-navigation-template':
|
||||||
|
$label = __( 'Post Navigation', 'gp-premium' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'archive-navigation-template':
|
||||||
|
$label = __( 'Archive Navigation', 'gp-premium' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'right-sidebar':
|
||||||
|
$label = __( 'Right Sidebar', 'gp-premium' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'left-sidebar':
|
||||||
|
$label = __( 'Left Sidebar', 'gp-premium' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'site-footer':
|
||||||
|
$label = __( 'Site Footer', 'gp-premium' );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$label = esc_html( str_replace( '-', ' ', ucfirst( $type ) ) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $label;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check for content template conditions.
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
* @param int $post_id The post to check.
|
||||||
|
*/
|
||||||
|
public static function should_render_content_template( $post_id ) {
|
||||||
|
$loop_item_display = get_post_meta( $post_id, '_generate_post_loop_item_display', true );
|
||||||
|
$display = true;
|
||||||
|
|
||||||
|
if ( 'has-term' === $loop_item_display ) {
|
||||||
|
$tax = get_post_meta( $post_id, '_generate_post_loop_item_display_tax', true );
|
||||||
|
|
||||||
|
if ( $tax ) {
|
||||||
|
$term = get_post_meta( $post_id, '_generate_post_loop_item_display_term', true );
|
||||||
|
|
||||||
|
// Add support for multiple comma separated terms.
|
||||||
|
if ( ! empty( $term ) ) {
|
||||||
|
$term = str_replace( ' ', '', $term );
|
||||||
|
$term = explode( ',', $term );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( has_term( $term, $tax ) ) {
|
||||||
|
$display = true;
|
||||||
|
} else {
|
||||||
|
$display = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'has-post-meta' === $loop_item_display ) {
|
||||||
|
$post_meta_name = get_post_meta( $post_id, '_generate_post_loop_item_display_post_meta', true );
|
||||||
|
|
||||||
|
if ( $post_meta_name ) {
|
||||||
|
$post_meta = get_post_meta( get_the_ID(), $post_meta_name, true );
|
||||||
|
|
||||||
|
if ( $post_meta ) {
|
||||||
|
$display = true;
|
||||||
|
} else {
|
||||||
|
$display = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'is-first-post' === $loop_item_display ) {
|
||||||
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( 0 === $wp_query->current_post && ! is_paged() ) {
|
||||||
|
$display = true;
|
||||||
|
} else {
|
||||||
|
$display = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return apply_filters( 'generate_should_render_content_template', $display, $post_id );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build our entire list of hooks to display.
|
||||||
|
*
|
||||||
|
* @since 1.7
|
||||||
|
*
|
||||||
|
* @return array Our list of hooks.
|
||||||
|
*/
|
||||||
|
public static function get_available_hooks() {
|
||||||
|
$hooks = array(
|
||||||
|
'scripts' => array(
|
||||||
|
'group' => esc_attr__( 'Scripts/Styles', 'gp-premium' ),
|
||||||
|
'hooks' => array(
|
||||||
|
'wp_head',
|
||||||
|
'wp_body_open',
|
||||||
|
'wp_footer',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'header' => array(
|
||||||
|
'group' => esc_attr__( 'Header', 'gp-premium' ),
|
||||||
|
'hooks' => array(
|
||||||
|
'generate_before_header',
|
||||||
|
'generate_after_header',
|
||||||
|
'generate_before_header_content',
|
||||||
|
'generate_after_header_content',
|
||||||
|
'generate_before_logo',
|
||||||
|
'generate_after_logo',
|
||||||
|
'generate_header',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'navigation' => array(
|
||||||
|
'group' => esc_attr__( 'Navigation', 'gp-premium' ),
|
||||||
|
'hooks' => array(
|
||||||
|
'generate_inside_navigation',
|
||||||
|
'generate_after_primary_menu',
|
||||||
|
'generate_inside_secondary_navigation',
|
||||||
|
'generate_inside_mobile_menu',
|
||||||
|
'generate_inside_mobile_menu_bar',
|
||||||
|
'generate_inside_mobile_header',
|
||||||
|
'generate_inside_slideout_navigation',
|
||||||
|
'generate_after_slideout_navigation',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'content' => array(
|
||||||
|
'group' => esc_attr__( 'Content', 'gp-premium' ),
|
||||||
|
'hooks' => array(
|
||||||
|
'generate_inside_site_container',
|
||||||
|
'generate_inside_container',
|
||||||
|
'generate_before_main_content',
|
||||||
|
'generate_after_main_content',
|
||||||
|
'generate_before_content',
|
||||||
|
'generate_after_content',
|
||||||
|
'generate_after_entry_content',
|
||||||
|
'generate_after_primary_content_area',
|
||||||
|
'generate_before_entry_title',
|
||||||
|
'generate_after_entry_title',
|
||||||
|
'generate_after_entry_header',
|
||||||
|
'generate_before_archive_title',
|
||||||
|
'generate_after_archive_title',
|
||||||
|
'generate_after_archive_description',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'comments' => array(
|
||||||
|
'group' => esc_attr__( 'Comments', 'gp-premium' ),
|
||||||
|
'hooks' => array(
|
||||||
|
'generate_before_comments_container',
|
||||||
|
'generate_before_comments',
|
||||||
|
'generate_inside_comments',
|
||||||
|
'generate_below_comments_title',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'sidebars' => array(
|
||||||
|
'group' => esc_attr__( 'Sidebars', 'gp-premium' ),
|
||||||
|
'hooks' => array(
|
||||||
|
'generate_before_right_sidebar_content',
|
||||||
|
'generate_after_right_sidebar_content',
|
||||||
|
'generate_before_left_sidebar_content',
|
||||||
|
'generate_after_left_sidebar_content',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'footer' => array(
|
||||||
|
'group' => esc_attr__( 'Footer', 'gp-premium' ),
|
||||||
|
'hooks' => array(
|
||||||
|
'generate_before_footer',
|
||||||
|
'generate_after_footer',
|
||||||
|
'generate_after_footer_widgets',
|
||||||
|
'generate_before_footer_content',
|
||||||
|
'generate_after_footer_content',
|
||||||
|
'generate_footer',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( class_exists( 'WooCommerce' ) ) {
|
||||||
|
$hooks['navigation']['hooks'][] = 'generate_mobile_cart_items';
|
||||||
|
|
||||||
|
$hooks['woocommerce-global'] = array(
|
||||||
|
'group' => esc_attr__( 'WooCommerce - Global', 'gp-premium' ),
|
||||||
|
'hooks' => array(
|
||||||
|
'woocommerce_before_main_content',
|
||||||
|
'woocommerce_after_main_content',
|
||||||
|
'woocommerce_sidebar',
|
||||||
|
'woocommerce_breadcrumb',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
$hooks['woocommerce-shop'] = array(
|
||||||
|
'group' => esc_attr__( 'WooCommerce - Shop', 'gp-premium' ),
|
||||||
|
'hooks' => array(
|
||||||
|
'woocommerce_archive_description',
|
||||||
|
'woocommerce_before_shop_loop',
|
||||||
|
'woocommerce_after_shop_loop',
|
||||||
|
'woocommerce_before_shop_loop_item_title',
|
||||||
|
'woocommerce_after_shop_loop_item_title',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
$hooks['woocommerce-product'] = array(
|
||||||
|
'group' => esc_attr__( 'WooCommerce - Product', 'gp-premium' ),
|
||||||
|
'hooks' => array(
|
||||||
|
'woocommerce_before_single_product',
|
||||||
|
'woocommerce_before_single_product_summary',
|
||||||
|
'woocommerce_after_single_product_summary',
|
||||||
|
'woocommerce_single_product_summary',
|
||||||
|
'woocommerce_share',
|
||||||
|
'woocommerce_simple_add_to_cart',
|
||||||
|
'woocommerce_before_add_to_cart_form',
|
||||||
|
'woocommerce_after_add_to_cart_form',
|
||||||
|
'woocommerce_before_add_to_cart_button',
|
||||||
|
'woocommerce_after_add_to_cart_button',
|
||||||
|
'woocommerce_before_add_to_cart_quantity',
|
||||||
|
'woocommerce_after_add_to_cart_quantity',
|
||||||
|
'woocommerce_product_meta_start',
|
||||||
|
'woocommerce_product_meta_end',
|
||||||
|
'woocommerce_after_single_product',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
$hooks['woocommerce-cart'] = array(
|
||||||
|
'group' => esc_attr__( 'WooCommerce - Cart', 'gp-premium' ),
|
||||||
|
'hooks' => array(
|
||||||
|
'woocommerce_before_calculate_totals',
|
||||||
|
'woocommerce_after_calculate_totals',
|
||||||
|
'woocommerce_before_cart',
|
||||||
|
'woocommerce_after_cart_table',
|
||||||
|
'woocommerce_before_cart_table',
|
||||||
|
'woocommerce_before_cart_contents',
|
||||||
|
'woocommerce_cart_contents',
|
||||||
|
'woocommerce_after_cart_contents',
|
||||||
|
'woocommerce_cart_coupon',
|
||||||
|
'woocommerce_cart_actions',
|
||||||
|
'woocommerce_before_cart_totals',
|
||||||
|
'woocommerce_cart_totals_before_order_total',
|
||||||
|
'woocommerce_cart_totals_after_order_total',
|
||||||
|
'woocommerce_proceed_to_checkout',
|
||||||
|
'woocommerce_after_cart_totals',
|
||||||
|
'woocommerce_after_cart',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
$hooks['woocommerce-checkout'] = array(
|
||||||
|
'group' => esc_attr__( 'WooCommerce - Checkout', 'gp-premium' ),
|
||||||
|
'hooks' => array(
|
||||||
|
'woocommerce_before_checkout_form',
|
||||||
|
'woocommerce_checkout_before_customer_details',
|
||||||
|
'woocommerce_checkout_after_customer_details',
|
||||||
|
'woocommerce_checkout_billing',
|
||||||
|
'woocommerce_before_checkout_billing_form',
|
||||||
|
'woocommerce_after_checkout_billing_form',
|
||||||
|
'woocommerce_before_order_notes',
|
||||||
|
'woocommerce_after_order_notes',
|
||||||
|
'woocommerce_checkout_shipping',
|
||||||
|
'woocommerce_checkout_before_order_review',
|
||||||
|
'woocommerce_checkout_order_review',
|
||||||
|
'woocommerce_review_order_before_cart_contents',
|
||||||
|
'woocommerce_review_order_after_cart_contents',
|
||||||
|
'woocommerce_review_order_before_order_total',
|
||||||
|
'woocommerce_review_order_after_order_total',
|
||||||
|
'woocommerce_review_order_before_payment',
|
||||||
|
'woocommerce_review_order_before_submit',
|
||||||
|
'woocommerce_review_order_after_submit',
|
||||||
|
'woocommerce_review_order_after_payment',
|
||||||
|
'woocommerce_checkout_after_order_review',
|
||||||
|
'woocommerce_after_checkout_form',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
$hooks['woocommerce-account'] = array(
|
||||||
|
'group' => esc_attr__( 'WooCommerce - Account', 'gp-premium' ),
|
||||||
|
'hooks' => array(
|
||||||
|
'woocommerce_before_account_navigation',
|
||||||
|
'woocommerce_account_navigation',
|
||||||
|
'woocommerce_after_account_navigation',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) {
|
||||||
|
$hooks['navigation']['hooks'][] = 'generate_menu_bar_items';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( defined( 'GENERATE_VERSION' ) && version_compare( GENERATE_VERSION, '3.0.0-alpha.1', '>' ) ) {
|
||||||
|
$hooks['navigation']['hooks'][] = 'generate_before_navigation';
|
||||||
|
$hooks['navigation']['hooks'][] = 'generate_after_navigation';
|
||||||
|
$hooks['navigation']['hooks'][] = 'generate_after_mobile_menu_button';
|
||||||
|
$hooks['navigation']['hooks'][] = 'generate_inside_mobile_menu_control_wrapper';
|
||||||
|
|
||||||
|
$hooks['content']['hooks'][] = 'generate_after_loop';
|
||||||
|
$hooks['content']['hooks'][] = 'generate_before_do_template_part';
|
||||||
|
$hooks['content']['hooks'][] = 'generate_after_do_template_part';
|
||||||
|
}
|
||||||
|
|
||||||
|
return apply_filters( 'generate_hooks_list', $hooks );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,26 @@ class GeneratePress_Hero {
|
|||||||
|
|
||||||
$display = apply_filters( 'generate_header_element_display', GeneratePress_Conditions::show_data( $this->conditional, $this->exclude, $this->users ), $post_id );
|
$display = apply_filters( 'generate_header_element_display', GeneratePress_Conditions::show_data( $this->conditional, $this->exclude, $this->users ), $post_id );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simplify filter name.
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
$display = apply_filters(
|
||||||
|
'generate_element_display',
|
||||||
|
$display,
|
||||||
|
$post_id
|
||||||
|
);
|
||||||
|
|
||||||
if ( $display ) {
|
if ( $display ) {
|
||||||
|
global $generate_elements;
|
||||||
|
|
||||||
|
$generate_elements[ $post_id ] = array(
|
||||||
|
'is_block_element' => false,
|
||||||
|
'type' => 'header',
|
||||||
|
'id' => $post_id,
|
||||||
|
);
|
||||||
|
|
||||||
$location = apply_filters( 'generate_page_hero_location', 'generate_after_header', $post_id );
|
$location = apply_filters( 'generate_page_hero_location', 'generate_after_header', $post_id );
|
||||||
|
|
||||||
add_action( $location, array( $this, 'build_hero' ), 9 );
|
add_action( $location, array( $this, 'build_hero' ), 9 );
|
||||||
|
@ -163,7 +163,26 @@ class GeneratePress_Hook {
|
|||||||
|
|
||||||
$display = apply_filters( 'generate_hook_element_display', GeneratePress_Conditions::show_data( $this->conditional, $this->exclude, $this->users ), $post_id );
|
$display = apply_filters( 'generate_hook_element_display', GeneratePress_Conditions::show_data( $this->conditional, $this->exclude, $this->users ), $post_id );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simplify filter name.
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
$display = apply_filters(
|
||||||
|
'generate_element_display',
|
||||||
|
$display,
|
||||||
|
$post_id
|
||||||
|
);
|
||||||
|
|
||||||
if ( $display ) {
|
if ( $display ) {
|
||||||
|
global $generate_elements;
|
||||||
|
|
||||||
|
$generate_elements[ $post_id ] = array(
|
||||||
|
'is_block_element' => false,
|
||||||
|
'type' => 'hook',
|
||||||
|
'id' => $post_id,
|
||||||
|
);
|
||||||
|
|
||||||
if ( 'generate_header' === $this->hook && $this->disable_site_header ) {
|
if ( 'generate_header' === $this->hook && $this->disable_site_header ) {
|
||||||
remove_action( 'generate_header', 'generate_construct_header' );
|
remove_action( 'generate_header', 'generate_construct_header' );
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,26 @@ class GeneratePress_Site_Layout {
|
|||||||
|
|
||||||
$display = apply_filters( 'generate_layout_element_display', GeneratePress_Conditions::show_data( $this->conditional, $this->exclude, $this->users ), $post_id );
|
$display = apply_filters( 'generate_layout_element_display', GeneratePress_Conditions::show_data( $this->conditional, $this->exclude, $this->users ), $post_id );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simplify filter name.
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
$display = apply_filters(
|
||||||
|
'generate_element_display',
|
||||||
|
$display,
|
||||||
|
$post_id
|
||||||
|
);
|
||||||
|
|
||||||
if ( $display ) {
|
if ( $display ) {
|
||||||
|
global $generate_elements;
|
||||||
|
|
||||||
|
$generate_elements[ $post_id ] = array(
|
||||||
|
'is_block_element' => false,
|
||||||
|
'type' => 'layout',
|
||||||
|
'id' => $post_id,
|
||||||
|
);
|
||||||
|
|
||||||
add_action( 'wp', array( $this, 'after_setup' ), 100 );
|
add_action( 'wp', array( $this, 'after_setup' ), 100 );
|
||||||
add_action( 'wp_enqueue_scripts', array( $this, 'build_css' ), 50 );
|
add_action( 'wp_enqueue_scripts', array( $this, 'build_css' ), 50 );
|
||||||
|
|
||||||
@ -285,6 +304,7 @@ class GeneratePress_Site_Layout {
|
|||||||
|
|
||||||
if ( $this->disable_primary_navigation ) {
|
if ( $this->disable_primary_navigation ) {
|
||||||
add_filter( 'generate_navigation_location', '__return_false', 20 );
|
add_filter( 'generate_navigation_location', '__return_false', 20 );
|
||||||
|
add_filter( 'generate_disable_mobile_header_menu', '__return_true' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $this->disable_secondary_navigation ) {
|
if ( $this->disable_secondary_navigation ) {
|
||||||
|
@ -47,6 +47,7 @@ class GeneratePress_Elements_Metabox {
|
|||||||
add_action( 'save_post', array( $this, 'save' ) );
|
add_action( 'save_post', array( $this, 'save' ) );
|
||||||
add_action( 'wp_ajax_generate_elements_get_location_terms', array( $this, 'get_terms' ) );
|
add_action( 'wp_ajax_generate_elements_get_location_terms', array( $this, 'get_terms' ) );
|
||||||
add_action( 'wp_ajax_generate_elements_get_location_posts', array( $this, 'get_posts' ) );
|
add_action( 'wp_ajax_generate_elements_get_location_posts', array( $this, 'get_posts' ) );
|
||||||
|
add_action( 'wp_ajax_generate_elements_get_location_objects', array( $this, 'get_all_objects' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,6 +64,14 @@ class GeneratePress_Elements_Metabox {
|
|||||||
|
|
||||||
if ( ! $element_type ) {
|
if ( ! $element_type ) {
|
||||||
$element_type = 'no-element-type';
|
$element_type = 'no-element-type';
|
||||||
|
|
||||||
|
if ( function_exists( 'get_current_screen' ) ) {
|
||||||
|
$current_screen = get_current_screen();
|
||||||
|
|
||||||
|
if ( ! empty( $current_screen->is_block_editor ) ) {
|
||||||
|
$element_type = 'block';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $element_type;
|
return $element_type;
|
||||||
@ -87,9 +96,21 @@ class GeneratePress_Elements_Metabox {
|
|||||||
$classes .= ' no-element-type';
|
$classes .= ' no-element-type';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( 'header' === $element_type && get_post_meta( get_the_ID(), '_generate_element_content', true ) ) {
|
||||||
|
$classes .= ' element-has-page-hero';
|
||||||
|
}
|
||||||
|
|
||||||
$block_type = get_post_meta( get_the_ID(), '_generate_block_type', true );
|
$block_type = get_post_meta( get_the_ID(), '_generate_block_type', true );
|
||||||
|
|
||||||
if ( $block_type ) {
|
if ( $block_type ) {
|
||||||
|
if ( 'content-template' === $block_type && get_post_meta( get_the_ID(), '_generate_use_theme_post_container', true ) ) {
|
||||||
|
$classes .= ' using-theme-post-container';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ( 'archive-navigation-template' === $block_type || 'post-navigation-template' === $block_type ) && get_post_meta( get_the_ID(), '_generate_use_archive_navigation_container', true ) ) {
|
||||||
|
$classes .= ' using-theme-pagination-container';
|
||||||
|
}
|
||||||
|
|
||||||
$classes .= ' ' . $block_type . '-block-type';
|
$classes .= ' ' . $block_type . '-block-type';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,7 +173,12 @@ class GeneratePress_Elements_Metabox {
|
|||||||
wp_enqueue_media();
|
wp_enqueue_media();
|
||||||
wp_enqueue_script( 'wp-color-picker' );
|
wp_enqueue_script( 'wp-color-picker' );
|
||||||
wp_enqueue_style( 'wp-color-picker' );
|
wp_enqueue_style( 'wp-color-picker' );
|
||||||
wp_enqueue_script( 'wp-color-picker-alpha', GP_LIBRARY_DIRECTORY_URL . 'alpha-color-picker/wp-color-picker-alpha.min.js', array( 'wp-color-picker' ), '2.1.4', true );
|
wp_enqueue_script( 'wp-color-picker-alpha', GP_LIBRARY_DIRECTORY_URL . 'alpha-color-picker/wp-color-picker-alpha.min.js', array( 'wp-color-picker' ), '3.0.0', true );
|
||||||
|
|
||||||
|
wp_add_inline_script(
|
||||||
|
'wp-color-picker-alpha',
|
||||||
|
'jQuery( function() { jQuery( ".color-picker" ).wpColorPicker(); } );'
|
||||||
|
);
|
||||||
|
|
||||||
if ( function_exists( 'wp_add_inline_script' ) && function_exists( 'generate_get_default_color_palettes' ) ) {
|
if ( function_exists( 'wp_add_inline_script' ) && function_exists( 'generate_get_default_color_palettes' ) ) {
|
||||||
// Grab our palette array and turn it into JS.
|
// Grab our palette array and turn it into JS.
|
||||||
@ -167,31 +193,12 @@ class GeneratePress_Elements_Metabox {
|
|||||||
wp_enqueue_script( 'select2', GP_LIBRARY_DIRECTORY_URL . 'select2/select2.full.min.js', array( 'jquery', 'generate-elements-metabox' ), '4.0.13', true );
|
wp_enqueue_script( 'select2', GP_LIBRARY_DIRECTORY_URL . 'select2/select2.full.min.js', array( 'jquery', 'generate-elements-metabox' ), '4.0.13', true );
|
||||||
|
|
||||||
$css = '';
|
$css = '';
|
||||||
$containerWidth = function_exists( 'generate_get_option' ) ? generate_get_option( 'container_width' ) : 1100;
|
|
||||||
$rightSidebarWidth = apply_filters( 'generate_right_sidebar_width', '25' );
|
|
||||||
$leftSidebarWidth = apply_filters( 'generate_left_sidebar_width', '25' );
|
|
||||||
|
|
||||||
$containerWidth = floatval( $containerWidth );
|
|
||||||
$leftSidebarWidth = '0.' . $leftSidebarWidth;
|
|
||||||
$rightSidebarWidth = '0.' . $rightSidebarWidth;
|
|
||||||
|
|
||||||
$leftSidebarWidth = $containerWidth - ( $containerWidth * $leftSidebarWidth );
|
|
||||||
$rightSidebarWidth = $containerWidth - ( $containerWidth * $rightSidebarWidth );
|
|
||||||
|
|
||||||
$leftSidebarWidth = $containerWidth - $leftSidebarWidth;
|
|
||||||
$rightSidebarWidth = $containerWidth - $rightSidebarWidth;
|
|
||||||
|
|
||||||
$css .= '.left-sidebar-block-type div:not(.block-editor-inner-blocks) > .block-editor-block-list__layout {max-width:' . $leftSidebarWidth . 'px;margin-left: auto;margin-right: auto;box-sizing: content-box;}';
|
|
||||||
$css .= '.right-sidebar-block-type div:not(.block-editor-inner-blocks) > .block-editor-block-list__layout {max-width:' . $rightSidebarWidth . 'px;margin-left: auto;margin-right: auto;box-sizing: content-box;}';
|
|
||||||
$css .= '.left-sidebar-block-type div:not(.block-editor-inner-blocks) > .block-editor-block-list__layout, .right-sidebar-block-type div:not(.block-editor-inner-blocks) > .block-editor-block-list__layout {padding: 10px;}';
|
|
||||||
$css .= 'body.left-sidebar-block-type div:not(.block-editor-inner-blocks) > .block-editor-block-list__layout .block-editor-block-list__block, body.right-sidebar-block-type div:not(.block-editor-inner-blocks) > .block-editor-block-list__layout .block-editor-block-list__block {margin-top:0;margin-bottom:0;}';
|
|
||||||
|
|
||||||
if ( function_exists( 'generate_get_option' ) && 'separate-containers' === generate_get_option( 'content_layout_setting' ) ) {
|
if ( function_exists( 'generate_get_option' ) && 'separate-containers' === generate_get_option( 'content_layout_setting' ) ) {
|
||||||
$css .= 'body.left-sidebar-block-type div:not(.block-editor-inner-blocks) > .block-editor-block-list__layout, body.right-sidebar-block-type div:not(.block-editor-inner-blocks) > .block-editor-block-list__layout {background: ' . generate_get_option( 'background_color' ) . ';}';
|
$css .= 'body.left-sidebar-block-type .block-editor-block-list__layout.is-root-container, body.right-sidebar-block-type .block-editor-block-list__layout.is-root-container {background: ' . generate_get_option( 'background_color' ) . ';}';
|
||||||
|
$css .= 'body.content-template-block-type:not(.using-theme-post-container) .block-editor-block-list__layout.is-root-container, body.archive-navigation-template-block-type:not(.using-theme-pagination-container) .block-editor-block-list__layout.is-root-container {background: ' . generate_get_option( 'background_color' ) . ';}';
|
||||||
}
|
}
|
||||||
|
|
||||||
$css .= '.editor-styles-wrapper .wp-block:not(.editor-post-title__block), .site-header-block-type .editor-styles-wrapper .wp-block:not(.editor-post-title__block), .site-footer-block-type .editor-styles-wrapper .wp-block:not(.editor-post-title__block) {max-width: 100%;}';
|
|
||||||
|
|
||||||
wp_add_inline_style( 'generate-elements-metabox', $css );
|
wp_add_inline_style( 'generate-elements-metabox', $css );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -204,7 +211,7 @@ class GeneratePress_Elements_Metabox {
|
|||||||
*/
|
*/
|
||||||
public function register_metabox() {
|
public function register_metabox() {
|
||||||
// Title not translated on purpose.
|
// Title not translated on purpose.
|
||||||
add_meta_box( 'generate_premium_elements', 'Element', array( $this, 'element_fields' ), 'gp_elements', 'normal' );
|
add_meta_box( 'generate_premium_elements', 'Element', array( $this, 'element_fields' ), 'gp_elements', 'normal', 'high' );
|
||||||
add_meta_box( 'generate_page_hero_template_tags', __( 'Template Tags', 'gp-premium' ), array( $this, 'template_tags' ), 'gp_elements', 'side', 'low' );
|
add_meta_box( 'generate_page_hero_template_tags', __( 'Template Tags', 'gp-premium' ), array( $this, 'template_tags' ), 'gp_elements', 'side', 'low' );
|
||||||
remove_meta_box( 'slugdiv', 'gp_elements', 'normal' );
|
remove_meta_box( 'slugdiv', 'gp_elements', 'normal' );
|
||||||
}
|
}
|
||||||
@ -220,9 +227,14 @@ class GeneratePress_Elements_Metabox {
|
|||||||
wp_nonce_field( basename( __FILE__ ), 'generate_elements_nonce' );
|
wp_nonce_field( basename( __FILE__ ), 'generate_elements_nonce' );
|
||||||
|
|
||||||
$type = self::get_element_type();
|
$type = self::get_element_type();
|
||||||
|
$page_hero_class = '';
|
||||||
$merge = get_post_meta( get_the_ID(), '_generate_site_header_merge', true );
|
$merge = get_post_meta( get_the_ID(), '_generate_site_header_merge', true );
|
||||||
$conditions_set = get_post_meta( get_the_ID(), '_generate_element_display_conditions', true );
|
$conditions_set = get_post_meta( get_the_ID(), '_generate_element_display_conditions', true );
|
||||||
$post_status = get_post_status( get_the_ID() );
|
$post_status = get_post_status( get_the_ID() );
|
||||||
|
|
||||||
|
if ( 'header' === $type && get_post_meta( get_the_ID(), '_generate_element_content', true ) ) {
|
||||||
|
$page_hero_class = ' has-page-hero';
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<div class="gp-element-type" style="display: none;">
|
<div class="gp-element-type" style="display: none;">
|
||||||
<select class="select-type" name="_generate_element_type">
|
<select class="select-type" name="_generate_element_type">
|
||||||
@ -240,29 +252,29 @@ class GeneratePress_Elements_Metabox {
|
|||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<div class="element-settings <?php echo esc_html( $type ); ?>">
|
<div class="element-settings <?php echo esc_html( $type . $page_hero_class ); ?>">
|
||||||
<?php if ( 'hook' === $type || 'header' === $type ) : ?>
|
<?php if ( 'hook' === $type || 'header' === $type ) : ?>
|
||||||
<textarea id="generate-element-content" name="_generate_element_content"><?php echo esc_textarea( get_post_meta( get_the_ID(), '_generate_element_content', true ) ); ?></textarea>
|
<textarea id="generate-element-content" name="_generate_element_content"><?php echo esc_textarea( get_post_meta( get_the_ID(), '_generate_element_content', true ) ); ?></textarea>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<ul class="element-metabox-tabs">
|
<ul class="element-metabox-tabs">
|
||||||
<?php if ( 'header' === $type ) : ?>
|
<?php if ( 'header' === $type ) : ?>
|
||||||
<li data-type="header" <?php echo 'header' === $type ? 'class="is-selected" ' : ''; ?>data-tab="hero">
|
<li data-type="header" <?php echo 'header' === $type && '' === $page_hero_class ? 'class="is-selected" ' : ''; ?>data-tab="site-header">
|
||||||
<a href="#">
|
<a href="#">
|
||||||
<?php _e( 'Page Hero', 'gp-premium' ); ?>
|
<?php _e( 'Site Header', 'gp-premium' ); ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li data-type="header" data-tab="site-header">
|
<li data-type="header" <?php echo 'header' === $type && '' !== $page_hero_class ? 'class="is-selected" ' : ''; ?>data-tab="hero">
|
||||||
<a href="#">
|
<a href="#">
|
||||||
<?php _e( 'Site Header', 'gp-premium' ); ?>
|
<?php _e( 'Page Hero', 'gp-premium' ); ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<li data-type="hook" <?php echo ( 'hook' === $type || 'block' === $type ) ? 'class="is-selected" ' : ''; ?>data-tab="hook-settings">
|
<li data-type="hook" <?php echo ( 'hook' === $type || 'block' === $type ) ? 'class="is-selected" ' : ''; ?>data-tab="hook-settings">
|
||||||
<a href="#">
|
<a href="#">
|
||||||
<?php _e( 'Settings', 'gp-premium' ); ?>
|
<?php echo 'block' === $type ? esc_attr__( 'Display Rules', 'gp-premium' ) : esc_attr__( 'Settings', 'gp-premium' ); ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@ -312,30 +324,7 @@ class GeneratePress_Elements_Metabox {
|
|||||||
<table class="generate-elements-settings" data-type="hook" data-tab="hook-settings">
|
<table class="generate-elements-settings" data-type="hook" data-tab="hook-settings">
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
if ( 'block' === $type ) :
|
if ( 'hook' === $type ) :
|
||||||
?>
|
|
||||||
<tr id="block-row" class="generate-element-row">
|
|
||||||
<td class="generate-element-row-heading">
|
|
||||||
<label for="_generate_block_type"><?php _e( 'Block Type', 'gp-premium' ); ?></label>
|
|
||||||
</td>
|
|
||||||
<td class="generate-element-row-content">
|
|
||||||
<select id="_generate_block_type" name="_generate_block_type">
|
|
||||||
<option <?php selected( get_post_meta( get_the_ID(), '_generate_block_type', true ), 'hook' ); ?> value="hook"><?php esc_attr_e( 'Hook', 'gp-premium' ); ?></option>
|
|
||||||
<option <?php selected( get_post_meta( get_the_ID(), '_generate_block_type', true ), 'site-header' ); ?> value="site-header"><?php esc_attr_e( 'Site Header', 'gp-premium' ); ?></option>
|
|
||||||
<option <?php selected( get_post_meta( get_the_ID(), '_generate_block_type', true ), 'site-footer' ); ?> value="site-footer"><?php esc_attr_e( 'Site Footer', 'gp-premium' ); ?></option>
|
|
||||||
<option <?php selected( get_post_meta( get_the_ID(), '_generate_block_type', true ), 'right-sidebar' ); ?> value="right-sidebar"><?php esc_attr_e( 'Right Sidebar', 'gp-premium' ); ?></option>
|
|
||||||
<option <?php selected( get_post_meta( get_the_ID(), '_generate_block_type', true ), 'left-sidebar' ); ?> value="left-sidebar"><?php esc_attr_e( 'Left Sidebar', 'gp-premium' ); ?></option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<div class="sidebar-notice" <?php echo 'left-sidebar' === get_post_meta( get_the_ID(), '_generate_block_type', true ) || 'right-sidebar' === get_post_meta( get_the_ID(), '_generate_block_type', true ) ? 'style="display: block;"' : ''; ?>>
|
|
||||||
<?php _e( 'This will remove the current sidebar widgets for the selected sidebar. Your layout must have a sidebar set for this Element to show.', 'gp-premium' ); ?>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
endif;
|
|
||||||
|
|
||||||
if ( 'hook' === $type || 'block' === $type ) :
|
|
||||||
?>
|
?>
|
||||||
<tr id="hook-row" class="generate-element-row hook-row <?php echo '' !== get_post_meta( get_the_ID(), '_generate_block_type', true ) && 'hook' !== get_post_meta( get_the_ID(), '_generate_block_type', true ) ? 'hide-hook-row' : ''; ?>">
|
<tr id="hook-row" class="generate-element-row hook-row <?php echo '' !== get_post_meta( get_the_ID(), '_generate_block_type', true ) && 'hook' !== get_post_meta( get_the_ID(), '_generate_block_type', true ) ? 'hide-hook-row' : ''; ?>">
|
||||||
<td class="generate-element-row-heading">
|
<td class="generate-element-row-heading">
|
||||||
@ -430,7 +419,7 @@ class GeneratePress_Elements_Metabox {
|
|||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ( 'hook' === $type || 'block' === $type ) :
|
if ( 'hook' === $type ) :
|
||||||
?>
|
?>
|
||||||
<tr class="generate-element-row hook-row <?php echo '' !== get_post_meta( get_the_ID(), '_generate_block_type', true ) && 'hook' !== get_post_meta( get_the_ID(), '_generate_block_type', true ) ? 'hide-hook-row' : ''; ?>">
|
<tr class="generate-element-row hook-row <?php echo '' !== get_post_meta( get_the_ID(), '_generate_block_type', true ) && 'hook' !== get_post_meta( get_the_ID(), '_generate_block_type', true ) ? 'hide-hook-row' : ''; ?>">
|
||||||
<td class="generate-element-row-heading">
|
<td class="generate-element-row-heading">
|
||||||
@ -753,7 +742,7 @@ class GeneratePress_Elements_Metabox {
|
|||||||
<label for="_generate_hero_background_color"><?php _e( 'Background Color', 'gp-premium' ); ?></label>
|
<label for="_generate_hero_background_color"><?php _e( 'Background Color', 'gp-premium' ); ?></label>
|
||||||
</td>
|
</td>
|
||||||
<td class="generate-element-row-content">
|
<td class="generate-element-row-content">
|
||||||
<input class="color-picker" data-alpha="true" type="text" name="_generate_hero_background_color" id="_generate_hero_background_color" value="<?php echo esc_attr( get_post_meta( get_the_ID(), '_generate_hero_background_color', true ) ); ?>" />
|
<input class="color-picker" data-alpha-enabled="true" data-alpha-color-type="hex" type="text" name="_generate_hero_background_color" id="_generate_hero_background_color" value="<?php echo esc_attr( get_post_meta( get_the_ID(), '_generate_hero_background_color', true ) ); ?>" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -836,7 +825,7 @@ class GeneratePress_Elements_Metabox {
|
|||||||
<label for="_generate_site_header_background_color"><?php _e( 'Header Background', 'gp-premium' ); ?></label>
|
<label for="_generate_site_header_background_color"><?php _e( 'Header Background', 'gp-premium' ); ?></label>
|
||||||
</td>
|
</td>
|
||||||
<td class="generate-element-row-content">
|
<td class="generate-element-row-content">
|
||||||
<input class="color-picker" data-alpha="true" type="text" name="_generate_site_header_background_color" id="_generate_site_header_background_color" value="<?php echo esc_attr( get_post_meta( get_the_ID(), '_generate_site_header_background_color', true ) ); ?>" />
|
<input class="color-picker" data-alpha-enabled="true" data-alpha-color-type="hex" type="text" name="_generate_site_header_background_color" id="_generate_site_header_background_color" value="<?php echo esc_attr( get_post_meta( get_the_ID(), '_generate_site_header_background_color', true ) ); ?>" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -998,7 +987,7 @@ class GeneratePress_Elements_Metabox {
|
|||||||
<label for="_generate_navigation_background_color"><?php _e( 'Navigation Background', 'gp-premium' ); ?></label>
|
<label for="_generate_navigation_background_color"><?php _e( 'Navigation Background', 'gp-premium' ); ?></label>
|
||||||
</td>
|
</td>
|
||||||
<td class="generate-element-row-content">
|
<td class="generate-element-row-content">
|
||||||
<input class="color-picker" data-alpha="true" type="text" name="_generate_navigation_background_color" id="_generate_navigation_background_color" value="<?php echo esc_attr( get_post_meta( get_the_ID(), '_generate_navigation_background_color', true ) ); ?>" />
|
<input class="color-picker" data-alpha-enabled="true" data-alpha-color-type="hex" type="text" name="_generate_navigation_background_color" id="_generate_navigation_background_color" value="<?php echo esc_attr( get_post_meta( get_the_ID(), '_generate_navigation_background_color', true ) ); ?>" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -1016,7 +1005,7 @@ class GeneratePress_Elements_Metabox {
|
|||||||
<label for="_generate_navigation_background_color_hover"><?php _e( 'Navigation Background Hover', 'gp-premium' ); ?></label>
|
<label for="_generate_navigation_background_color_hover"><?php _e( 'Navigation Background Hover', 'gp-premium' ); ?></label>
|
||||||
</td>
|
</td>
|
||||||
<td class="generate-element-row-content">
|
<td class="generate-element-row-content">
|
||||||
<input class="color-picker" data-alpha="true" type="text" name="_generate_navigation_background_color_hover" id="_generate_navigation_background_color_hover" value="<?php echo esc_attr( get_post_meta( get_the_ID(), '_generate_navigation_background_color_hover', true ) ); ?>" />
|
<input class="color-picker" data-alpha-enabled="true" data-alpha-color-type="hex" type="text" name="_generate_navigation_background_color_hover" id="_generate_navigation_background_color_hover" value="<?php echo esc_attr( get_post_meta( get_the_ID(), '_generate_navigation_background_color_hover', true ) ); ?>" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -1034,7 +1023,7 @@ class GeneratePress_Elements_Metabox {
|
|||||||
<label for="_generate_navigation_background_color_current"><?php _e( 'Navigation Background Current', 'gp-premium' ); ?></label>
|
<label for="_generate_navigation_background_color_current"><?php _e( 'Navigation Background Current', 'gp-premium' ); ?></label>
|
||||||
</td>
|
</td>
|
||||||
<td class="generate-element-row-content">
|
<td class="generate-element-row-content">
|
||||||
<input class="color-picker" data-alpha="true" type="text" name="_generate_navigation_background_color_current" id="_generate_navigation_background_color_current" value="<?php echo esc_attr( get_post_meta( get_the_ID(), '_generate_navigation_background_color_current', true ) ); ?>" />
|
<input class="color-picker" data-alpha-enabled="true" data-alpha-color-type="hex" type="text" name="_generate_navigation_background_color_current" id="_generate_navigation_background_color_current" value="<?php echo esc_attr( get_post_meta( get_the_ID(), '_generate_navigation_background_color_current', true ) ); ?>" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -1659,17 +1648,6 @@ class GeneratePress_Elements_Metabox {
|
|||||||
delete_post_meta( $post_id, $type_key );
|
delete_post_meta( $post_id, $type_key );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the block type.
|
|
||||||
if ( 'block' === $type_value && isset( $_POST['_generate_block_type'] ) ) {
|
|
||||||
$block_type_value = sanitize_key( $_POST['_generate_block_type'] );
|
|
||||||
|
|
||||||
if ( $block_type_value ) {
|
|
||||||
update_post_meta( $post_id, '_generate_block_type', $block_type_value );
|
|
||||||
} else {
|
|
||||||
delete_post_meta( $post_id, '_generate_block_type' );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Content.
|
// Content.
|
||||||
if ( isset( $_POST['_generate_element_content'] ) ) {
|
if ( isset( $_POST['_generate_element_content'] ) ) {
|
||||||
$key = '_generate_element_content';
|
$key = '_generate_element_content';
|
||||||
@ -1688,7 +1666,7 @@ class GeneratePress_Elements_Metabox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save Hooks type.
|
// Save Hooks type.
|
||||||
if ( 'hook' === $type_value || 'block' === $type_value ) {
|
if ( 'hook' === $type_value ) {
|
||||||
$hook_values = array(
|
$hook_values = array(
|
||||||
'_generate_hook' => 'text',
|
'_generate_hook' => 'text',
|
||||||
'_generate_custom_hook' => 'text',
|
'_generate_custom_hook' => 'text',
|
||||||
@ -2078,45 +2056,93 @@ class GeneratePress_Elements_Metabox {
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all of our posts and terms in one go on load.
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
public function get_all_objects() {
|
||||||
|
check_ajax_referer( 'generate-elements-location', 'nonce' );
|
||||||
|
|
||||||
|
$current_user_can = 'manage_options';
|
||||||
|
|
||||||
|
if ( apply_filters( 'generate_elements_metabox_ajax_allow_editors', false ) ) {
|
||||||
|
$current_user_can = 'edit_posts';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! current_user_can( $current_user_can ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! isset( $_POST['posts'] ) && ! isset( $_POST['terms'] ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$posts = array();
|
||||||
|
$terms = array();
|
||||||
|
|
||||||
|
if ( ! empty( $_POST['posts'] ) ) {
|
||||||
|
$posts = array_map( 'sanitize_text_field', $_POST['posts'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! empty( $_POST['terms'] ) ) {
|
||||||
|
$terms = array_map( 'sanitize_text_field', $_POST['terms'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
$all_posts = self::get_post_type_posts( $posts );
|
||||||
|
$all_terms = self::get_taxonomy_terms( $terms );
|
||||||
|
|
||||||
|
echo wp_json_encode( array_merge( $all_posts, $all_terms ) );
|
||||||
|
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Look up posts inside a post type.
|
* Look up posts inside a post type.
|
||||||
*
|
*
|
||||||
* @since 1.7
|
* @since 1.7
|
||||||
*
|
*
|
||||||
* @param string $post_type The post type to look up.
|
* @param string|array $post_type The post type to look up.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function get_post_type_posts( $post_type ) {
|
public static function get_post_type_posts( $post_type ) {
|
||||||
|
if ( ! is_array( $post_type ) ) {
|
||||||
global $wpdb;
|
$post_type = array( $post_type );
|
||||||
|
|
||||||
$post_status = array( 'publish', 'future', 'draft', 'pending', 'private' );
|
|
||||||
|
|
||||||
$object = get_post_type_object( $post_type );
|
|
||||||
|
|
||||||
$data = array(
|
|
||||||
'type' => 'posts',
|
|
||||||
'postType' => $post_type,
|
|
||||||
'label' => $object->label,
|
|
||||||
'objects' => array(),
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( 'attachment' === $post_type ) {
|
|
||||||
$posts = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_title from $wpdb->posts where post_type = %s ORDER BY post_title", $post_type ) );
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$format = implode( ', ', array_fill( 0, count( $post_status ), '%s' ) );
|
|
||||||
$query = sprintf( "SELECT ID, post_title from $wpdb->posts where post_type = '%s' AND post_status IN(%s) ORDER BY post_title", $post_type, $format );
|
|
||||||
// @codingStandardsIgnoreLine
|
|
||||||
$posts = $wpdb->get_results( $wpdb->prepare( $query, $post_status ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( $posts as $post ) {
|
$data = array();
|
||||||
$title = ( '' !== $post->post_title ) ? esc_attr( $post->post_title ) : $post_type . '-' . $post->ID;
|
|
||||||
$data['objects'][] = array(
|
foreach ( $post_type as $type ) {
|
||||||
'id' => $post->ID,
|
global $wpdb;
|
||||||
'name' => $title,
|
|
||||||
|
$post_status = array( 'publish', 'future', 'draft', 'pending', 'private' );
|
||||||
|
|
||||||
|
$object = get_post_type_object( $type );
|
||||||
|
|
||||||
|
$data[ $type ] = array(
|
||||||
|
'type' => 'posts',
|
||||||
|
'postType' => $type,
|
||||||
|
'label' => $object->label,
|
||||||
|
'objects' => array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ( 'attachment' === $type ) {
|
||||||
|
$posts = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_title from $wpdb->posts where post_type = %s ORDER BY post_title", $type ) );
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$format = implode( ', ', array_fill( 0, count( $post_status ), '%s' ) );
|
||||||
|
$query = sprintf( "SELECT ID, post_title from $wpdb->posts where post_type = '%s' AND post_status IN(%s) ORDER BY post_title", $type, $format );
|
||||||
|
// @codingStandardsIgnoreLine
|
||||||
|
$posts = $wpdb->get_results( $wpdb->prepare( $query, $post_status ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( $posts as $post ) {
|
||||||
|
$title = ( '' !== $post->post_title ) ? esc_attr( $post->post_title ) : $type . '-' . $post->ID;
|
||||||
|
$data[ $type ]['objects'][] = array(
|
||||||
|
'id' => $post->ID,
|
||||||
|
'name' => $title,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
@ -2127,31 +2153,39 @@ class GeneratePress_Elements_Metabox {
|
|||||||
*
|
*
|
||||||
* @since 1.7
|
* @since 1.7
|
||||||
*
|
*
|
||||||
* @param int $tax_id The taxonomy ID.
|
* @param int|array $tax_id The taxonomy ID.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function get_taxonomy_terms( $tax_id ) {
|
public static function get_taxonomy_terms( $tax_id ) {
|
||||||
$tax = get_taxonomy( $tax_id );
|
if ( ! is_array( $tax_id ) ) {
|
||||||
|
$tax_id = array( $tax_id );
|
||||||
|
}
|
||||||
|
|
||||||
$terms = get_terms(
|
$data = array();
|
||||||
array(
|
|
||||||
'taxonomy' => $tax_id,
|
|
||||||
'hide_empty' => false,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$data = array(
|
foreach ( $tax_id as $id ) {
|
||||||
'type' => 'terms',
|
$tax = get_taxonomy( $id );
|
||||||
'taxonomy' => $tax_id,
|
|
||||||
'label' => $tax->label,
|
|
||||||
'objects' => array(),
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ( $terms as $term ) {
|
$terms = get_terms(
|
||||||
$data['objects'][] = array(
|
array(
|
||||||
'id' => $term->term_id,
|
'taxonomy' => $id,
|
||||||
'name' => esc_attr( $term->name ),
|
'hide_empty' => false,
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$data[ $id ] = array(
|
||||||
|
'type' => 'terms',
|
||||||
|
'taxonomy' => $id,
|
||||||
|
'label' => $tax->label,
|
||||||
|
'objects' => array(),
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ( $terms as $term ) {
|
||||||
|
$data[ $id ]['objects'][] = array(
|
||||||
|
'id' => $term->term_id,
|
||||||
|
'name' => esc_attr( $term->name ),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
@ -2165,209 +2199,7 @@ class GeneratePress_Elements_Metabox {
|
|||||||
* @return array Our list of hooks.
|
* @return array Our list of hooks.
|
||||||
*/
|
*/
|
||||||
public static function get_available_hooks() {
|
public static function get_available_hooks() {
|
||||||
$hooks = array(
|
return GeneratePress_Elements_Helper::get_available_hooks();
|
||||||
'scripts' => array(
|
|
||||||
'group' => esc_attr__( 'Scripts & Styles', 'gp-premium' ),
|
|
||||||
'hooks' => array(
|
|
||||||
'wp_head',
|
|
||||||
'wp_body_open',
|
|
||||||
'wp_footer',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'header' => array(
|
|
||||||
'group' => esc_attr__( 'Header', 'gp-premium' ),
|
|
||||||
'hooks' => array(
|
|
||||||
'generate_before_header',
|
|
||||||
'generate_after_header',
|
|
||||||
'generate_before_header_content',
|
|
||||||
'generate_after_header_content',
|
|
||||||
'generate_before_logo',
|
|
||||||
'generate_after_logo',
|
|
||||||
'generate_header',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'navigation' => array(
|
|
||||||
'group' => esc_attr__( 'Navigation', 'gp-premium' ),
|
|
||||||
'hooks' => array(
|
|
||||||
'generate_inside_navigation',
|
|
||||||
'generate_inside_secondary_navigation',
|
|
||||||
'generate_inside_mobile_menu',
|
|
||||||
'generate_inside_mobile_menu_bar',
|
|
||||||
'generate_inside_mobile_header',
|
|
||||||
'generate_inside_slideout_navigation',
|
|
||||||
'generate_after_slideout_navigation',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'content' => array(
|
|
||||||
'group' => esc_attr__( 'Content', 'gp-premium' ),
|
|
||||||
'hooks' => array(
|
|
||||||
'generate_inside_site_container',
|
|
||||||
'generate_inside_container',
|
|
||||||
'generate_before_main_content',
|
|
||||||
'generate_after_main_content',
|
|
||||||
'generate_before_content',
|
|
||||||
'generate_after_content',
|
|
||||||
'generate_after_entry_content',
|
|
||||||
'generate_after_primary_content_area',
|
|
||||||
'generate_before_entry_title',
|
|
||||||
'generate_after_entry_title',
|
|
||||||
'generate_after_entry_header',
|
|
||||||
'generate_before_archive_title',
|
|
||||||
'generate_after_archive_title',
|
|
||||||
'generate_after_archive_description',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'comments' => array(
|
|
||||||
'group' => esc_attr__( 'Comments', 'gp-premium' ),
|
|
||||||
'hooks' => array(
|
|
||||||
'generate_before_comments_container',
|
|
||||||
'generate_before_comments',
|
|
||||||
'generate_inside_comments',
|
|
||||||
'generate_below_comments_title',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'sidebars' => array(
|
|
||||||
'group' => esc_attr__( 'Sidebars', 'gp-premium' ),
|
|
||||||
'hooks' => array(
|
|
||||||
'generate_before_right_sidebar_content',
|
|
||||||
'generate_after_right_sidebar_content',
|
|
||||||
'generate_before_left_sidebar_content',
|
|
||||||
'generate_after_left_sidebar_content',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
'footer' => array(
|
|
||||||
'group' => esc_attr__( 'Footer', 'gp-premium' ),
|
|
||||||
'hooks' => array(
|
|
||||||
'generate_before_footer',
|
|
||||||
'generate_after_footer',
|
|
||||||
'generate_after_footer_widgets',
|
|
||||||
'generate_before_footer_content',
|
|
||||||
'generate_after_footer_content',
|
|
||||||
'generate_footer',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( class_exists( 'WooCommerce' ) ) {
|
|
||||||
$hooks['navigation']['hooks'][] = 'generate_mobile_cart_items';
|
|
||||||
|
|
||||||
$hooks['woocommerce-global'] = array(
|
|
||||||
'group' => esc_attr__( 'WooCommerce - Global', 'gp-premium' ),
|
|
||||||
'hooks' => array(
|
|
||||||
'woocommerce_before_main_content',
|
|
||||||
'woocommerce_after_main_content',
|
|
||||||
'woocommerce_sidebar',
|
|
||||||
'woocommerce_breadcrumb',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
$hooks['woocommerce-shop'] = array(
|
|
||||||
'group' => esc_attr__( 'WooCommerce - Shop', 'gp-premium' ),
|
|
||||||
'hooks' => array(
|
|
||||||
'woocommerce_archive_description',
|
|
||||||
'woocommerce_before_shop_loop',
|
|
||||||
'woocommerce_after_shop_loop',
|
|
||||||
'woocommerce_before_shop_loop_item_title',
|
|
||||||
'woocommerce_after_shop_loop_item_title',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
$hooks['woocommerce-product'] = array(
|
|
||||||
'group' => esc_attr__( 'WooCommerce - Product', 'gp-premium' ),
|
|
||||||
'hooks' => array(
|
|
||||||
'woocommerce_before_single_product',
|
|
||||||
'woocommerce_before_single_product_summary',
|
|
||||||
'woocommerce_after_single_product_summary',
|
|
||||||
'woocommerce_single_product_summary',
|
|
||||||
'woocommerce_share',
|
|
||||||
'woocommerce_simple_add_to_cart',
|
|
||||||
'woocommerce_before_add_to_cart_form',
|
|
||||||
'woocommerce_after_add_to_cart_form',
|
|
||||||
'woocommerce_before_add_to_cart_button',
|
|
||||||
'woocommerce_after_add_to_cart_button',
|
|
||||||
'woocommerce_before_add_to_cart_quantity',
|
|
||||||
'woocommerce_after_add_to_cart_quantity',
|
|
||||||
'woocommerce_product_meta_start',
|
|
||||||
'woocommerce_product_meta_end',
|
|
||||||
'woocommerce_after_single_product',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
$hooks['woocommerce-cart'] = array(
|
|
||||||
'group' => esc_attr__( 'WooCommerce - Cart', 'gp-premium' ),
|
|
||||||
'hooks' => array(
|
|
||||||
'woocommerce_before_calculate_totals',
|
|
||||||
'woocommerce_after_calculate_totals',
|
|
||||||
'woocommerce_before_cart',
|
|
||||||
'woocommerce_after_cart_table',
|
|
||||||
'woocommerce_before_cart_table',
|
|
||||||
'woocommerce_before_cart_contents',
|
|
||||||
'woocommerce_cart_contents',
|
|
||||||
'woocommerce_after_cart_contents',
|
|
||||||
'woocommerce_cart_coupon',
|
|
||||||
'woocommerce_cart_actions',
|
|
||||||
'woocommerce_before_cart_totals',
|
|
||||||
'woocommerce_cart_totals_before_order_total',
|
|
||||||
'woocommerce_cart_totals_after_order_total',
|
|
||||||
'woocommerce_proceed_to_checkout',
|
|
||||||
'woocommerce_after_cart_totals',
|
|
||||||
'woocommerce_after_cart',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
$hooks['woocommerce-checkout'] = array(
|
|
||||||
'group' => esc_attr__( 'WooCommerce - Checkout', 'gp-premium' ),
|
|
||||||
'hooks' => array(
|
|
||||||
'woocommerce_before_checkout_form',
|
|
||||||
'woocommerce_checkout_before_customer_details',
|
|
||||||
'woocommerce_checkout_after_customer_details',
|
|
||||||
'woocommerce_checkout_billing',
|
|
||||||
'woocommerce_before_checkout_billing_form',
|
|
||||||
'woocommerce_after_checkout_billing_form',
|
|
||||||
'woocommerce_before_order_notes',
|
|
||||||
'woocommerce_after_order_notes',
|
|
||||||
'woocommerce_checkout_shipping',
|
|
||||||
'woocommerce_checkout_before_order_review',
|
|
||||||
'woocommerce_checkout_order_review',
|
|
||||||
'woocommerce_review_order_before_cart_contents',
|
|
||||||
'woocommerce_review_order_after_cart_contents',
|
|
||||||
'woocommerce_review_order_before_order_total',
|
|
||||||
'woocommerce_review_order_after_order_total',
|
|
||||||
'woocommerce_review_order_before_payment',
|
|
||||||
'woocommerce_review_order_before_submit',
|
|
||||||
'woocommerce_review_order_after_submit',
|
|
||||||
'woocommerce_review_order_after_payment',
|
|
||||||
'woocommerce_checkout_after_order_review',
|
|
||||||
'woocommerce_after_checkout_form',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
$hooks['woocommerce-account'] = array(
|
|
||||||
'group' => esc_attr__( 'WooCommerce - Account', 'gp-premium' ),
|
|
||||||
'hooks' => array(
|
|
||||||
'woocommerce_before_account_navigation',
|
|
||||||
'woocommerce_account_navigation',
|
|
||||||
'woocommerce_after_account_navigation',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( function_exists( 'generate_is_using_flexbox' ) && generate_is_using_flexbox() ) {
|
|
||||||
$hooks['navigation']['hooks'][] = 'generate_menu_bar_items';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( defined( 'GENERATE_VERSION' ) && version_compare( GENERATE_VERSION, '3.0.0-alpha.1', '>' ) ) {
|
|
||||||
$hooks['navigation']['hooks'][] = 'generate_before_navigation';
|
|
||||||
$hooks['navigation']['hooks'][] = 'generate_after_navigation';
|
|
||||||
$hooks['navigation']['hooks'][] = 'generate_after_mobile_menu_button';
|
|
||||||
$hooks['navigation']['hooks'][] = 'generate_inside_mobile_menu_control_wrapper';
|
|
||||||
|
|
||||||
$hooks['content']['hooks'][] = 'generate_after_loop';
|
|
||||||
$hooks['content']['hooks'][] = 'generate_before_do_template_part';
|
|
||||||
$hooks['content']['hooks'][] = 'generate_after_do_template_part';
|
|
||||||
}
|
|
||||||
|
|
||||||
return apply_filters( 'generate_hooks_list', $hooks );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,25 +74,29 @@ class GeneratePress_Elements_Post_Type {
|
|||||||
*/
|
*/
|
||||||
public function post_type() {
|
public function post_type() {
|
||||||
$labels = array(
|
$labels = array(
|
||||||
'name' => _x( 'Elements', 'Post Type General Name', 'gp-premium' ),
|
'name' => _x( 'Elements', 'Post Type General Name', 'gp-premium' ),
|
||||||
'singular_name' => _x( 'Element', 'Post Type Singular Name', 'gp-premium' ),
|
'singular_name' => _x( 'Element', 'Post Type Singular Name', 'gp-premium' ),
|
||||||
'menu_name' => __( 'Elements', 'gp-premium' ),
|
'menu_name' => __( 'Elements', 'gp-premium' ),
|
||||||
'all_items' => __( 'All Elements', 'gp-premium' ),
|
'all_items' => __( 'All Elements', 'gp-premium' ),
|
||||||
'add_new' => __( 'Add New Element', 'gp-premium' ),
|
'add_new' => __( 'Add New Element', 'gp-premium' ),
|
||||||
'add_new_item' => __( 'Add New Element', 'gp-premium' ),
|
'add_new_item' => __( 'Add New Element', 'gp-premium' ),
|
||||||
'new_item' => __( 'New Element', 'gp-premium' ),
|
'new_item' => __( 'New Element', 'gp-premium' ),
|
||||||
'edit_item' => __( 'Edit Element', 'gp-premium' ),
|
'edit_item' => __( 'Edit Element', 'gp-premium' ),
|
||||||
'update_item' => __( 'Update Element', 'gp-premium' ),
|
'update_item' => __( 'Update Element', 'gp-premium' ),
|
||||||
'search_items' => __( 'Search Element', 'gp-premium' ),
|
'search_items' => __( 'Search Element', 'gp-premium' ),
|
||||||
'featured_image' => __( 'Background Image', 'gp-premium' ),
|
'featured_image' => __( 'Background Image', 'gp-premium' ),
|
||||||
'set_featured_image' => __( 'Set background image', 'gp-premium' ),
|
'set_featured_image' => __( 'Set background image', 'gp-premium' ),
|
||||||
'remove_featured_image' => __( 'Remove background image', 'gp-premium' ),
|
'remove_featured_image' => __( 'Remove background image', 'gp-premium' ),
|
||||||
|
'item_published' => __( 'Element published.', 'gp-premium' ),
|
||||||
|
'item_updated' => __( 'Element updated.', 'gp-premium' ),
|
||||||
|
'item_scheduled' => __( 'Element scheduled.', 'gp-premium' ),
|
||||||
|
'item_reverted_to_draft' => __( 'Element reverted to draft.', 'gp-premium' ),
|
||||||
);
|
);
|
||||||
|
|
||||||
$args = array(
|
$args = array(
|
||||||
'labels' => $labels,
|
'labels' => $labels,
|
||||||
'supports' => array( 'title', 'editor', 'thumbnail' ),
|
'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields', 'page-attributes' ),
|
||||||
'hierarchical' => false,
|
'hierarchical' => true,
|
||||||
'public' => false,
|
'public' => false,
|
||||||
'show_ui' => true,
|
'show_ui' => true,
|
||||||
'show_in_menu' => false,
|
'show_in_menu' => false,
|
||||||
@ -134,10 +138,11 @@ class GeneratePress_Elements_Post_Type {
|
|||||||
if ( 'block' !== $type ) {
|
if ( 'block' !== $type ) {
|
||||||
$args['supports'] = array( 'title', 'thumbnail' );
|
$args['supports'] = array( 'title', 'thumbnail' );
|
||||||
$args['show_in_rest'] = false;
|
$args['show_in_rest'] = false;
|
||||||
|
$args['hierarchical'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'block' === $type ) {
|
if ( 'block' === $type ) {
|
||||||
$args['supports'] = array( 'title', 'editor' );
|
$args['supports'] = array( 'title', 'editor', 'custom-fields', 'page-attributes' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'layout' === $type ) {
|
if ( 'layout' === $type ) {
|
||||||
@ -196,7 +201,13 @@ class GeneratePress_Elements_Post_Type {
|
|||||||
* @since 1.7
|
* @since 1.7
|
||||||
*/
|
*/
|
||||||
public function build_element_type_filter() {
|
public function build_element_type_filter() {
|
||||||
if ( 'gp_elements' !== get_post_type() ) {
|
$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
|
||||||
|
|
||||||
|
if ( ! $screen ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! isset( $screen->post_type ) || 'gp_elements' !== $screen->post_type ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,23 +218,52 @@ class GeneratePress_Elements_Post_Type {
|
|||||||
'layout' => esc_html__( 'Layouts', 'gp-premium' ),
|
'layout' => esc_html__( 'Layouts', 'gp-premium' ),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$current_element_type = isset( $_GET['gp_element_type_filter'] ) ? esc_html( $_GET['gp_element_type_filter'] ) : ''; // phpcs:ignore -- No processing happening.
|
||||||
|
$current_block_type = isset( $_GET['gp_elements_block_type_filter'] ) ? esc_html( $_GET['gp_elements_block_type_filter'] ) : ''; // phpcs:ignore -- No processing happening.
|
||||||
?>
|
?>
|
||||||
<select name="gp_element_type_filter">
|
<select name="gp_element_type_filter">
|
||||||
<option value=""><?php esc_html_e( 'All types', 'gp-premium' ); ?></option>
|
<option value=""><?php esc_html_e( 'All types', 'gp-premium' ); ?></option>
|
||||||
<?php
|
<?php
|
||||||
$current = isset( $_GET['gp_element_type_filter'] )? esc_html( $_GET['gp_element_type_filter'] ) : ''; // phpcs:ignore -- No processing happening.
|
|
||||||
|
|
||||||
foreach ( $values as $value => $label ) {
|
foreach ( $values as $value => $label ) {
|
||||||
printf(
|
printf(
|
||||||
'<option value="%1$s" %2$s>%3$s</option>',
|
'<option value="%1$s" %2$s>%3$s</option>',
|
||||||
esc_html( $value ),
|
esc_html( $value ),
|
||||||
$value === $current ? 'selected="selected"' : '',
|
$value === $current_element_type ? 'selected="selected"' : '',
|
||||||
esc_html( $label )
|
esc_html( $label )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
<?php
|
<?php
|
||||||
|
if ( 'block' === $current_element_type ) {
|
||||||
|
$block_types = array(
|
||||||
|
'hook',
|
||||||
|
'site-header',
|
||||||
|
'page-hero',
|
||||||
|
'content-template',
|
||||||
|
'post-meta-template',
|
||||||
|
'post-navigation-template',
|
||||||
|
'archive-navigation-template',
|
||||||
|
'right-sidebar',
|
||||||
|
'left-sidebar',
|
||||||
|
'site-footer',
|
||||||
|
);
|
||||||
|
?>
|
||||||
|
<select name="gp_elements_block_type_filter">
|
||||||
|
<option value=""><?php esc_html_e( 'All block types', 'gp-premium' ); ?></option>
|
||||||
|
<?php
|
||||||
|
foreach ( $block_types as $value ) {
|
||||||
|
printf(
|
||||||
|
'<option value="%1$s" %2$s>%3$s</option>',
|
||||||
|
esc_html( $value ),
|
||||||
|
$value === $current_block_type ? 'selected="selected"' : '',
|
||||||
|
esc_html( GeneratePress_Elements_Helper::get_element_type_label( $value ) )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -242,10 +282,28 @@ class GeneratePress_Elements_Post_Type {
|
|||||||
global $pagenow;
|
global $pagenow;
|
||||||
|
|
||||||
$type = isset( $_GET['gp_element_type_filter'] ) ? $_GET['gp_element_type_filter'] : ''; // phpcs:ignore -- No processing happening.
|
$type = isset( $_GET['gp_element_type_filter'] ) ? $_GET['gp_element_type_filter'] : ''; // phpcs:ignore -- No processing happening.
|
||||||
|
$meta_query = array();
|
||||||
|
|
||||||
if ( 'edit.php' === $pagenow && $query->is_main_query() && '' !== $type ) {
|
if ( 'edit.php' === $pagenow && $query->is_main_query() && '' !== $type ) {
|
||||||
$query->set( 'meta_key', '_generate_element_type' );
|
$meta_query[] = array(
|
||||||
$query->set( 'meta_value', esc_attr( $type ) );
|
'key' => '_generate_element_type',
|
||||||
|
'value' => esc_attr( $type ),
|
||||||
|
'compare' => '=',
|
||||||
|
);
|
||||||
|
|
||||||
|
$block_type = isset( $_GET['gp_elements_block_type_filter'] ) ? $_GET['gp_elements_block_type_filter'] : ''; // phpcs:ignore -- No processing happening.
|
||||||
|
|
||||||
|
if ( 'block' === $type && '' !== $block_type ) {
|
||||||
|
$meta_query['relation'] = 'AND';
|
||||||
|
|
||||||
|
$meta_query[] = array(
|
||||||
|
'key' => '_generate_block_type',
|
||||||
|
'value' => esc_attr( $block_type ),
|
||||||
|
'compare' => '=',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->set( 'meta_query', $meta_query );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +327,7 @@ class GeneratePress_Elements_Post_Type {
|
|||||||
$block_type = get_post_meta( $post_id, '_generate_block_type', true );
|
$block_type = get_post_meta( $post_id, '_generate_block_type', true );
|
||||||
|
|
||||||
if ( $block_type ) {
|
if ( $block_type ) {
|
||||||
echo ' - ' . esc_html( str_replace( '-', ' ', ucfirst( $block_type ) ) );
|
echo ' - ' . esc_html( GeneratePress_Elements_Helper::get_element_type_label( $block_type ) );
|
||||||
|
|
||||||
if ( 'hook' === $block_type && $hook_location ) {
|
if ( 'hook' === $block_type && $hook_location ) {
|
||||||
echo '<br />';
|
echo '<br />';
|
||||||
@ -310,12 +368,15 @@ class GeneratePress_Elements_Post_Type {
|
|||||||
|
|
||||||
case 'location':
|
case 'location':
|
||||||
$location = get_post_meta( $post_id, '_generate_element_display_conditions', true );
|
$location = get_post_meta( $post_id, '_generate_element_display_conditions', true );
|
||||||
|
$parent_block = wp_get_post_parent_id( $post_id );
|
||||||
|
|
||||||
if ( $location ) {
|
if ( $location ) {
|
||||||
foreach ( (array) $location as $data ) {
|
foreach ( (array) $location as $data ) {
|
||||||
echo esc_html( GeneratePress_Conditions::get_saved_label( $data ) );
|
echo esc_html( GeneratePress_Conditions::get_saved_label( $data ) );
|
||||||
echo '<br />';
|
echo '<br />';
|
||||||
}
|
}
|
||||||
|
} elseif ( ! empty( $parent_block ) ) {
|
||||||
|
echo esc_html__( 'Inherit from parent', 'gp-premium' );
|
||||||
} else {
|
} else {
|
||||||
echo esc_html__( 'Not set', 'gp-premium' );
|
echo esc_html__( 'Not set', 'gp-premium' );
|
||||||
}
|
}
|
||||||
@ -423,9 +484,9 @@ class GeneratePress_Elements_Post_Type {
|
|||||||
<select class="select-type" name="element_type">
|
<select class="select-type" name="element_type">
|
||||||
<option value=""><?php esc_attr_e( 'Choose...', 'gp-premium' ); ?></option>
|
<option value=""><?php esc_attr_e( 'Choose...', 'gp-premium' ); ?></option>
|
||||||
<option value="block"><?php esc_attr_e( 'Block', 'gp-premium' ); ?></option>
|
<option value="block"><?php esc_attr_e( 'Block', 'gp-premium' ); ?></option>
|
||||||
<option value="header"><?php esc_attr_e( 'Header', 'gp-premium' ); ?></option>
|
|
||||||
<option value="hook"><?php esc_attr_e( 'Hook', 'gp-premium' ); ?></option>
|
<option value="hook"><?php esc_attr_e( 'Hook', 'gp-premium' ); ?></option>
|
||||||
<option value="layout"><?php esc_attr_e( 'Layout', 'gp-premium' ); ?></option>
|
<option value="layout"><?php esc_attr_e( 'Layout', 'gp-premium' ); ?></option>
|
||||||
|
<option value="header"><?php esc_attr_e( 'Header', 'gp-premium' ); ?></option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<button class="button button-primary"><?php _e( 'Create', 'gp-premium' ); ?></button>
|
<button class="button button-primary"><?php _e( 'Create', 'gp-premium' ); ?></button>
|
||||||
|
@ -19,6 +19,7 @@ require $elements_dir . 'class-hooks.php';
|
|||||||
require $elements_dir . 'class-hero.php';
|
require $elements_dir . 'class-hero.php';
|
||||||
require $elements_dir . 'class-layout.php';
|
require $elements_dir . 'class-layout.php';
|
||||||
require $elements_dir . 'class-block.php';
|
require $elements_dir . 'class-block.php';
|
||||||
|
require $elements_dir . 'class-block-elements.php';
|
||||||
require $elements_dir . 'class-post-type.php';
|
require $elements_dir . 'class-post-type.php';
|
||||||
|
|
||||||
add_action( 'wp', 'generate_premium_do_elements' );
|
add_action( 'wp', 'generate_premium_do_elements' );
|
||||||
@ -188,3 +189,84 @@ function generate_add_block_element_content_filters( $content ) {
|
|||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_action( 'admin_bar_menu', 'generate_add_elements_admin_bar', 100 );
|
||||||
|
/**
|
||||||
|
* Add the Elementd admin bar item.
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
function generate_add_elements_admin_bar() {
|
||||||
|
$current_user_can = 'manage_options';
|
||||||
|
|
||||||
|
if ( apply_filters( 'generate_elements_metabox_ajax_allow_editors', false ) ) {
|
||||||
|
$current_user_can = 'edit_posts';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! current_user_can( $current_user_can ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
global $wp_admin_bar;
|
||||||
|
global $generate_elements;
|
||||||
|
|
||||||
|
$title = __( 'Elements', 'gp-premium' );
|
||||||
|
$count = ! empty( $generate_elements ) ? count( $generate_elements ) : 0;
|
||||||
|
|
||||||
|
// Prevent "Entire Site" Elements from being counted on non-edit pages in the admin.
|
||||||
|
if ( is_admin() && function_exists( 'get_current_screen' ) ) {
|
||||||
|
$screen = get_current_screen();
|
||||||
|
|
||||||
|
if ( ! isset( $screen->is_block_editor ) || ! $screen->is_block_editor ) {
|
||||||
|
$count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'edit' !== $screen->parent_base ) {
|
||||||
|
$count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $count > 0 ) {
|
||||||
|
$title = sprintf(
|
||||||
|
/* translators: Active Element count. */
|
||||||
|
__( 'Elements (%s)', 'gp-premium' ),
|
||||||
|
$count
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$wp_admin_bar->add_menu(
|
||||||
|
array(
|
||||||
|
'id' => 'gp_elements-menu',
|
||||||
|
'title' => $title,
|
||||||
|
'href' => esc_url( admin_url( 'edit.php?post_type=gp_elements' ) ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( ! empty( $generate_elements ) ) {
|
||||||
|
// Prevent "Entire Site" Elements from being counted on non-edit pages in the admin.
|
||||||
|
if ( is_admin() && function_exists( 'get_current_screen' ) ) {
|
||||||
|
$screen = get_current_screen();
|
||||||
|
|
||||||
|
if ( ! isset( $screen->is_block_editor ) || ! $screen->is_block_editor ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'edit' !== $screen->parent_base ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( (array) $generate_elements as $key => $data ) {
|
||||||
|
$label = GeneratePress_Elements_Helper::get_element_type_label( $data['type'] );
|
||||||
|
|
||||||
|
$wp_admin_bar->add_menu(
|
||||||
|
array(
|
||||||
|
'id' => 'element-' . absint( $data['id'] ),
|
||||||
|
'parent' => 'gp_elements-menu',
|
||||||
|
'title' => get_the_title( $data['id'] ) . ' (' . $label . ')',
|
||||||
|
'href' => get_edit_post_link( $data['id'] ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -239,24 +239,20 @@ class GeneratePress_External_CSS_File {
|
|||||||
if ( defined( 'DOMAIN_MAPPING' ) && DOMAIN_MAPPING ) {
|
if ( defined( 'DOMAIN_MAPPING' ) && DOMAIN_MAPPING ) {
|
||||||
if ( function_exists( 'domain_mapping_siteurl' ) && function_exists( 'get_original_url' ) ) {
|
if ( function_exists( 'domain_mapping_siteurl' ) && function_exists( 'get_original_url' ) ) {
|
||||||
$mapped_domain = domain_mapping_siteurl( false );
|
$mapped_domain = domain_mapping_siteurl( false );
|
||||||
$mapped_domain = str_replace( 'https://', '//', $domain_mapping );
|
|
||||||
$mapped_domain = str_replace( 'http://', '//', $mapped_domain );
|
|
||||||
|
|
||||||
$original_domain = get_original_url( 'siteurl' );
|
$original_domain = get_original_url( 'siteurl' );
|
||||||
$original_domain = str_replace( 'https://', '//', $original_domain );
|
|
||||||
$original_domain = str_replace( 'http://', '//', $original_domain );
|
|
||||||
|
|
||||||
$content = str_replace( $original_domain, $mapped_domain, $content );
|
$content = str_replace( $original_domain, $mapped_domain, $content );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strip protocols.
|
|
||||||
$content = str_replace( 'https://', '//', $content );
|
|
||||||
$content = str_replace( 'http://', '//', $content );
|
|
||||||
|
|
||||||
if ( is_writable( $this->file( 'path' ) ) || ( ! file_exists( $this->file( 'path' ) ) && is_writable( dirname( $this->file( 'path' ) ) ) ) ) {
|
if ( is_writable( $this->file( 'path' ) ) || ( ! file_exists( $this->file( 'path' ) ) && is_writable( dirname( $this->file( 'path' ) ) ) ) ) {
|
||||||
|
$chmod_file = 0644;
|
||||||
|
|
||||||
if ( ! $wp_filesystem->put_contents( $this->file( 'path' ), wp_strip_all_tags( $content ), FS_CHMOD_FILE ) ) {
|
if ( defined( 'FS_CHMOD_FILE' ) ) {
|
||||||
|
$chmod_file = FS_CHMOD_FILE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $wp_filesystem->put_contents( $this->file( 'path' ), wp_strip_all_tags( $content ), $chmod_file ) ) {
|
||||||
|
|
||||||
// Fail!
|
// Fail!
|
||||||
return false;
|
return false;
|
||||||
@ -279,7 +275,7 @@ class GeneratePress_External_CSS_File {
|
|||||||
global $blog_id;
|
global $blog_id;
|
||||||
|
|
||||||
// Get the upload directory for this site.
|
// Get the upload directory for this site.
|
||||||
$upload_dir = wp_upload_dir();
|
$upload_dir = wp_get_upload_dir();
|
||||||
|
|
||||||
// If this is a multisite installation, append the blogid to the filename.
|
// If this is a multisite installation, append the blogid to the filename.
|
||||||
$css_blog_id = ( is_multisite() && $blog_id > 1 ) ? '_blog-' . $blog_id : null;
|
$css_blog_id = ( is_multisite() && $blog_id > 1 ) ? '_blog-' . $blog_id : null;
|
||||||
@ -335,7 +331,7 @@ class GeneratePress_External_CSS_File {
|
|||||||
global $blog_id;
|
global $blog_id;
|
||||||
|
|
||||||
// Get the upload directory for this site.
|
// Get the upload directory for this site.
|
||||||
$upload_dir = wp_upload_dir();
|
$upload_dir = wp_get_upload_dir();
|
||||||
|
|
||||||
// If this is a multisite installation, append the blogid to the filename.
|
// If this is a multisite installation, append the blogid to the filename.
|
||||||
$css_blog_id = ( is_multisite() && $blog_id > 1 ) ? '_blog-' . $blog_id : null;
|
$css_blog_id = ( is_multisite() && $blog_id > 1 ) ? '_blog-' . $blog_id : null;
|
||||||
@ -360,9 +356,7 @@ class GeneratePress_External_CSS_File {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strip protocols.
|
$css_uri = set_url_scheme( $css_uri );
|
||||||
$css_uri = str_replace( 'https://', '//', $css_uri );
|
|
||||||
$css_uri = str_replace( 'http://', '//', $css_uri );
|
|
||||||
|
|
||||||
if ( 'path' === $target ) {
|
if ( 'path' === $target ) {
|
||||||
return $file_path;
|
return $file_path;
|
||||||
|
81
wp-content/plugins/gp-premium/general/enqueue-scripts.php
Normal file
81
wp-content/plugins/gp-premium/general/enqueue-scripts.php
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file adds global scripts.
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
*
|
||||||
|
* @package GP Premium
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit; // No direct access, please.
|
||||||
|
}
|
||||||
|
|
||||||
|
add_action( 'enqueue_block_editor_assets', 'generate_premium_enqueue_editor_scripts' );
|
||||||
|
/**
|
||||||
|
* Add scripts to the non-Elements block editor.
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
*/
|
||||||
|
function generate_premium_enqueue_editor_scripts() {
|
||||||
|
global $pagenow;
|
||||||
|
|
||||||
|
$deps = array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' );
|
||||||
|
|
||||||
|
if ( 'widgets.php' === $pagenow ) {
|
||||||
|
unset( $deps[3] );
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_enqueue_script(
|
||||||
|
'gp-premium-editor',
|
||||||
|
GP_PREMIUM_DIR_URL . 'dist/editor.js',
|
||||||
|
$deps,
|
||||||
|
filemtime( GP_PREMIUM_DIR_PATH . 'dist/editor.js' ),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
wp_set_script_translations( 'gp-premium-editor', 'gp-premium', GP_PREMIUM_DIR_PATH . 'langs' );
|
||||||
|
|
||||||
|
global $generate_elements;
|
||||||
|
$active_elements = array();
|
||||||
|
|
||||||
|
if ( class_exists( 'GeneratePress_Elements_Helper' ) && ! empty( $generate_elements ) ) {
|
||||||
|
foreach ( (array) $generate_elements as $key => $data ) {
|
||||||
|
$type = esc_html( GeneratePress_Elements_Helper::get_element_type_label( $data['type'] ) );
|
||||||
|
|
||||||
|
$active_elements[] = array(
|
||||||
|
'type' => $type,
|
||||||
|
'name' => get_the_title( $data['id'] ),
|
||||||
|
'url' => get_edit_post_link( $data['id'] ),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$post_type_is_public = false;
|
||||||
|
|
||||||
|
if ( get_post_type() ) {
|
||||||
|
$post_type = get_post_type_object( get_post_type() );
|
||||||
|
|
||||||
|
if ( is_object( $post_type ) && ! empty( $post_type->public ) ) {
|
||||||
|
$post_type_is_public = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_localize_script(
|
||||||
|
'gp-premium-editor',
|
||||||
|
'gpPremiumEditor',
|
||||||
|
array(
|
||||||
|
'isBlockElement' => 'gp_elements' === get_post_type(),
|
||||||
|
'activeElements' => $active_elements,
|
||||||
|
'elementsUrl' => esc_url( admin_url( 'edit.php?post_type=gp_elements' ) ),
|
||||||
|
'postTypeIsPublic' => $post_type_is_public,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
wp_enqueue_style(
|
||||||
|
'gp-premium-editor',
|
||||||
|
GP_PREMIUM_DIR_URL . 'dist/editor.css',
|
||||||
|
array( 'wp-edit-blocks' ),
|
||||||
|
filemtime( GP_PREMIUM_DIR_PATH . 'dist/editor.css' )
|
||||||
|
);
|
||||||
|
}
|
@ -3,7 +3,8 @@
|
|||||||
* Plugin Name: GP Premium
|
* Plugin Name: GP Premium
|
||||||
* Plugin URI: https://generatepress.com
|
* Plugin URI: https://generatepress.com
|
||||||
* Description: The entire collection of GeneratePress premium modules.
|
* Description: The entire collection of GeneratePress premium modules.
|
||||||
* Version: 1.12.3
|
* Version: 2.0.3
|
||||||
|
* Requires PHP: 5.6
|
||||||
* Author: Tom Usborne
|
* Author: Tom Usborne
|
||||||
* Author URI: https://generatepress.com
|
* Author URI: https://generatepress.com
|
||||||
* License: GNU General Public License v2 or later
|
* License: GNU General Public License v2 or later
|
||||||
@ -17,8 +18,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
exit; // Exit if accessed directly.
|
exit; // Exit if accessed directly.
|
||||||
}
|
}
|
||||||
|
|
||||||
define( 'GP_PREMIUM_VERSION', '1.12.3' );
|
define( 'GP_PREMIUM_VERSION', '2.0.3' );
|
||||||
define( 'GP_PREMIUM_DIR_PATH', plugin_dir_path( __FILE__ ) );
|
define( 'GP_PREMIUM_DIR_PATH', plugin_dir_path( __FILE__ ) );
|
||||||
|
define( 'GP_PREMIUM_DIR_URL', plugin_dir_url( __FILE__ ) );
|
||||||
define( 'GP_LIBRARY_DIRECTORY', plugin_dir_path( __FILE__ ) . 'library/' );
|
define( 'GP_LIBRARY_DIRECTORY', plugin_dir_path( __FILE__ ) . 'library/' );
|
||||||
define( 'GP_LIBRARY_DIRECTORY_URL', plugin_dir_url( __FILE__ ) . 'library/' );
|
define( 'GP_LIBRARY_DIRECTORY_URL', plugin_dir_url( __FILE__ ) . 'library/' );
|
||||||
|
|
||||||
@ -79,14 +81,6 @@ if ( generatepress_is_module_active( 'generate_package_elements', 'GENERATE_ELEM
|
|||||||
require_once GP_PREMIUM_DIR_PATH . 'elements/elements.php';
|
require_once GP_PREMIUM_DIR_PATH . 'elements/elements.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( generatepress_is_module_active( 'generate_package_hooks', 'GENERATE_HOOKS' ) ) {
|
|
||||||
require_once GP_PREMIUM_DIR_PATH . 'hooks/generate-hooks.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( generatepress_is_module_active( 'generate_package_page_header', 'GENERATE_PAGE_HEADER' ) ) {
|
|
||||||
require_once GP_PREMIUM_DIR_PATH . 'page-header/generate-page-header.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( generatepress_is_module_active( 'generate_package_secondary_nav', 'GENERATE_SECONDARY_NAV' ) ) {
|
if ( generatepress_is_module_active( 'generate_package_secondary_nav', 'GENERATE_SECONDARY_NAV' ) ) {
|
||||||
require_once GP_PREMIUM_DIR_PATH . 'secondary-nav/generate-secondary-nav.php';
|
require_once GP_PREMIUM_DIR_PATH . 'secondary-nav/generate-secondary-nav.php';
|
||||||
}
|
}
|
||||||
@ -99,10 +93,6 @@ if ( generatepress_is_module_active( 'generate_package_typography', 'GENERATE_TY
|
|||||||
require_once GP_PREMIUM_DIR_PATH . 'typography/generate-fonts.php';
|
require_once GP_PREMIUM_DIR_PATH . 'typography/generate-fonts.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( generatepress_is_module_active( 'generate_package_sections', 'GENERATE_SECTIONS' ) ) {
|
|
||||||
require_once GP_PREMIUM_DIR_PATH . 'sections/generate-sections.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( generatepress_is_module_active( 'generate_package_menu_plus', 'GENERATE_MENU_PLUS' ) ) {
|
if ( generatepress_is_module_active( 'generate_package_menu_plus', 'GENERATE_MENU_PLUS' ) ) {
|
||||||
require_once GP_PREMIUM_DIR_PATH . 'menu-plus/generate-menu-plus.php';
|
require_once GP_PREMIUM_DIR_PATH . 'menu-plus/generate-menu-plus.php';
|
||||||
}
|
}
|
||||||
@ -115,19 +105,39 @@ if ( generatepress_is_module_active( 'generate_package_woocommerce', 'GENERATE_W
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deprecated modules.
|
||||||
|
if ( generatepress_is_module_active( 'generate_package_hooks', 'GENERATE_HOOKS' ) ) {
|
||||||
|
require_once GP_PREMIUM_DIR_PATH . 'hooks/generate-hooks.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( generatepress_is_module_active( 'generate_package_page_header', 'GENERATE_PAGE_HEADER' ) ) {
|
||||||
|
require_once GP_PREMIUM_DIR_PATH . 'page-header/generate-page-header.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( generatepress_is_module_active( 'generate_package_sections', 'GENERATE_SECTIONS' ) ) {
|
||||||
|
require_once GP_PREMIUM_DIR_PATH . 'sections/generate-sections.php';
|
||||||
|
}
|
||||||
|
|
||||||
// General functionality.
|
// General functionality.
|
||||||
require_once GP_PREMIUM_DIR_PATH . 'inc/functions.php';
|
require_once GP_PREMIUM_DIR_PATH . 'inc/functions.php';
|
||||||
require_once GP_PREMIUM_DIR_PATH . 'general/class-external-file-css.php';
|
require_once GP_PREMIUM_DIR_PATH . 'general/class-external-file-css.php';
|
||||||
require_once GP_PREMIUM_DIR_PATH . 'general/smooth-scroll.php';
|
require_once GP_PREMIUM_DIR_PATH . 'general/smooth-scroll.php';
|
||||||
require_once GP_PREMIUM_DIR_PATH . 'general/icons.php';
|
require_once GP_PREMIUM_DIR_PATH . 'general/icons.php';
|
||||||
|
require_once GP_PREMIUM_DIR_PATH . 'general/enqueue-scripts.php';
|
||||||
require_once GP_PREMIUM_DIR_PATH . 'inc/deprecated.php';
|
require_once GP_PREMIUM_DIR_PATH . 'inc/deprecated.php';
|
||||||
|
|
||||||
|
if ( generatepress_is_module_active( 'generate_package_site_library', 'GENERATE_SITE_LIBRARY' ) && version_compare( PHP_VERSION, '5.4', '>=' ) && ! defined( 'GENERATE_DISABLE_SITE_LIBRARY' ) ) {
|
||||||
|
require_once GP_PREMIUM_DIR_PATH . 'site-library/class-site-library-rest.php';
|
||||||
|
require_once GP_PREMIUM_DIR_PATH . 'site-library/class-site-library-helper.php';
|
||||||
|
}
|
||||||
|
|
||||||
if ( is_admin() ) {
|
if ( is_admin() ) {
|
||||||
require_once GP_PREMIUM_DIR_PATH . 'inc/reset.php';
|
require_once GP_PREMIUM_DIR_PATH . 'inc/reset.php';
|
||||||
require_once GP_PREMIUM_DIR_PATH . 'import-export/generate-ie.php';
|
require_once GP_PREMIUM_DIR_PATH . 'import-export/generate-ie.php';
|
||||||
|
require_once GP_PREMIUM_DIR_PATH . 'inc/deprecated-admin.php';
|
||||||
|
|
||||||
if ( generatepress_is_module_active( 'generate_package_site_library', 'GENERATE_SITE_LIBRARY' ) && version_compare( PHP_VERSION, '5.4', '>=' ) && ! defined( 'GENERATE_DISABLE_SITE_LIBRARY' ) ) {
|
if ( generatepress_is_module_active( 'generate_package_site_library', 'GENERATE_SITE_LIBRARY' ) && version_compare( PHP_VERSION, '5.4', '>=' ) && ! defined( 'GENERATE_DISABLE_SITE_LIBRARY' ) ) {
|
||||||
require_once GP_PREMIUM_DIR_PATH . 'sites/sites.php';
|
require_once GP_PREMIUM_DIR_PATH . 'site-library/class-site-library.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once GP_PREMIUM_DIR_PATH . 'inc/activation.php';
|
require_once GP_PREMIUM_DIR_PATH . 'inc/activation.php';
|
||||||
@ -214,10 +224,11 @@ if ( ! function_exists( 'generate_premium_theme_information' ) ) {
|
|||||||
// GeneratePress isn't the active theme, let them know GP Premium won't work.
|
// GeneratePress isn't the active theme, let them know GP Premium won't work.
|
||||||
printf(
|
printf(
|
||||||
'<div class="notice is-dismissible notice-warning">
|
'<div class="notice is-dismissible notice-warning">
|
||||||
<p>%1$s <a href="https://generatepress.com/install-generatepress" target="_blank">%2$s</a></p>
|
<p>%1$s <a href="%3$s">%2$s</a></p>
|
||||||
</div>',
|
</div>',
|
||||||
esc_html__( 'GP Premium requires GeneratePress to be your active theme.', 'gp-premium' ),
|
esc_html__( 'GP Premium requires GeneratePress to be your active theme.', 'gp-premium' ),
|
||||||
esc_html__( 'Install now.', 'gp-premium' )
|
esc_html__( 'Install now.', 'gp-premium' ),
|
||||||
|
esc_url( admin_url( 'theme-install.php?theme=generatepress' ) )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,7 +533,7 @@ function generate_hooks_add_legacy_button() {
|
|||||||
if ( 'gp_elements' === $screen->post_type && 'edit' === $screen->base ) :
|
if ( 'gp_elements' === $screen->post_type && 'edit' === $screen->base ) :
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
jQuery( document ).ready( function( $ ) {
|
jQuery( function( $ ) {
|
||||||
$( '<a href="<?php echo admin_url(); ?>themes.php?page=gp_hooks_settings" class="page-title-action legacy-button"><?php esc_html_e( "Legacy Hooks", "gp-premium" ); ?></a>' ).insertAfter( '.page-title-action:not(.legacy-button)' );
|
$( '<a href="<?php echo admin_url(); ?>themes.php?page=gp_hooks_settings" class="page-title-action legacy-button"><?php esc_html_e( "Legacy Hooks", "gp-premium" ); ?></a>' ).insertAfter( '.page-title-action:not(.legacy-button)' );
|
||||||
} );
|
} );
|
||||||
</script>
|
</script>
|
||||||
|
@ -141,6 +141,15 @@ if ( ! function_exists( 'generate_super_package_addons' ) ) {
|
|||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
$deprecated_modules = apply_filters(
|
||||||
|
'generate_premium_deprecated_modules',
|
||||||
|
array(
|
||||||
|
'Page Header',
|
||||||
|
'Hooks',
|
||||||
|
'Sections',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
foreach ( $addons as $k => $v ) :
|
foreach ( $addons as $k => $v ) :
|
||||||
|
|
||||||
$key = get_option( $v );
|
$key = get_option( $v );
|
||||||
@ -157,7 +166,8 @@ if ( ! function_exists( 'generate_super_package_addons' ) ) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php } else {
|
<?php } else {
|
||||||
if ( 'Page Header' === $k || 'Hooks' === $k ) {
|
// Don't output deprecated modules.
|
||||||
|
if ( in_array( $k, $deprecated_modules ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -8,7 +8,8 @@
|
|||||||
padding: 10px 15px;
|
padding: 10px 15px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: #222;
|
color: #222;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.generatepress-dashboard-tabs a:not(:last-child) {
|
.generatepress-dashboard-tabs a:not(:last-child) {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
jQuery( document ).ready(function( $ ) {
|
jQuery( function( $ ) {
|
||||||
$( '#generate-select-all' ).on( 'click', function( event ) {
|
$( '#generate-select-all' ).on( 'click', function() {
|
||||||
if ( this.checked ) {
|
if ( this.checked ) {
|
||||||
$( '.addon-checkbox:not(:disabled)' ).each( function() {
|
$( '.addon-checkbox:not(:disabled)' ).each( function() {
|
||||||
this.checked = true;
|
this.checked = true;
|
||||||
});
|
} );
|
||||||
} else {
|
} else {
|
||||||
$( '.addon-checkbox' ).each( function() {
|
$( '.addon-checkbox' ).each( function() {
|
||||||
this.checked = false;
|
this.checked = false;
|
||||||
});
|
} );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
@ -20,6 +20,7 @@ jQuery( document ).ready(function( $ ) {
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
$( 'input[name="generate_package_hooks_deactivate_package"]' ).on( 'click', function() {
|
$( 'input[name="generate_package_hooks_deactivate_package"]' ).on( 'click', function() {
|
||||||
|
// eslint-disable-next-line no-alert
|
||||||
var check = confirm( dashboard.deprecated_module );
|
var check = confirm( dashboard.deprecated_module );
|
||||||
|
|
||||||
if ( ! check ) {
|
if ( ! check ) {
|
||||||
@ -28,10 +29,20 @@ jQuery( document ).ready(function( $ ) {
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
$( 'input[name="generate_package_page_header_deactivate_package"]' ).on( 'click', function() {
|
$( 'input[name="generate_package_page_header_deactivate_package"]' ).on( 'click', function() {
|
||||||
|
// eslint-disable-next-line no-alert
|
||||||
var check = confirm( dashboard.deprecated_module );
|
var check = confirm( dashboard.deprecated_module );
|
||||||
|
|
||||||
if ( ! check ) {
|
if ( ! check ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
});
|
|
||||||
|
$( 'input[name="generate_package_sections_deactivate_package"]' ).on( 'click', function() {
|
||||||
|
// eslint-disable-next-line no-alert
|
||||||
|
var check = confirm( dashboard.deprecated_module );
|
||||||
|
|
||||||
|
if ( ! check ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
@ -6,6 +6,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
|
|
||||||
add_action( 'generate_dashboard_inside_container', 'generate_do_dashboard_tabs', 5 );
|
add_action( 'generate_dashboard_inside_container', 'generate_do_dashboard_tabs', 5 );
|
||||||
add_action( 'generate_inside_site_library_container', 'generate_do_dashboard_tabs', 5 );
|
add_action( 'generate_inside_site_library_container', 'generate_do_dashboard_tabs', 5 );
|
||||||
|
add_action( 'generate_before_site_library', 'generate_do_dashboard_tabs', 5 );
|
||||||
/**
|
/**
|
||||||
* Adds our tabs to the GeneratePress dashboard.
|
* Adds our tabs to the GeneratePress dashboard.
|
||||||
*
|
*
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* This file handles the Site Library.
|
* Deprecated admin functions.
|
||||||
*
|
|
||||||
* @since 1.6.0
|
|
||||||
*
|
*
|
||||||
* @package GP Premium
|
* @package GP Premium
|
||||||
*/
|
*/
|
||||||
@ -11,18 +9,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
exit; // No direct access, please.
|
exit; // No direct access, please.
|
||||||
}
|
}
|
||||||
|
|
||||||
define( 'GENERATE_SITES_PATH', plugin_dir_path( __FILE__ ) );
|
|
||||||
define( 'GENERATE_SITES_URL', plugin_dir_url( __FILE__ ) );
|
|
||||||
|
|
||||||
require_once GENERATE_SITES_PATH . 'classes/class-site.php';
|
|
||||||
require_once GENERATE_SITES_PATH . 'classes/class-site-helper.php';
|
|
||||||
require_once GENERATE_SITES_PATH . 'classes/class-site-widget-importer.php';
|
|
||||||
require_once GENERATE_SITES_PATH . 'classes/class-site-restore.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks to see if we're in the Site dashboard.
|
* Checks to see if we're in the Site dashboard.
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
|
* @deprecated 2.0.0
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@ -40,11 +31,11 @@ function generate_is_sites_dashboard() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter( 'generate_dashboard_tabs', 'generate_sites_dashboard_tab' );
|
|
||||||
/**
|
/**
|
||||||
* Add the Sites tab to our Dashboard tabs.
|
* Add the Sites tab to our Dashboard tabs.
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
|
* @deprecated 2.0.0
|
||||||
*
|
*
|
||||||
* @param array $tabs Existing tabs.
|
* @param array $tabs Existing tabs.
|
||||||
* @return array New tabs.
|
* @return array New tabs.
|
||||||
@ -59,11 +50,11 @@ function generate_sites_dashboard_tab( $tabs ) {
|
|||||||
return $tabs;
|
return $tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action( 'admin_menu', 'generate_site_library_register' );
|
|
||||||
/**
|
/**
|
||||||
* Register our Site Library page.
|
* Register our Site Library page.
|
||||||
*
|
*
|
||||||
* @since 1.7
|
* @since 1.7
|
||||||
|
* @deprecated 2.0.0
|
||||||
*/
|
*/
|
||||||
function generate_site_library_register() {
|
function generate_site_library_register() {
|
||||||
add_submenu_page(
|
add_submenu_page(
|
||||||
@ -76,11 +67,11 @@ function generate_site_library_register() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action( 'admin_head', 'generate_site_library_fix_menu' );
|
|
||||||
/**
|
/**
|
||||||
* Set our current menu item as the GeneratePress Dashboard.
|
* Set our current menu item as the GeneratePress Dashboard.
|
||||||
*
|
*
|
||||||
* @since 1.7
|
* @since 1.7
|
||||||
|
* @deprecated 2.0.0
|
||||||
*/
|
*/
|
||||||
function generate_site_library_fix_menu() {
|
function generate_site_library_fix_menu() {
|
||||||
global $parent_file, $submenu_file, $post_type;
|
global $parent_file, $submenu_file, $post_type;
|
||||||
@ -93,11 +84,11 @@ function generate_site_library_fix_menu() {
|
|||||||
remove_submenu_page( 'themes.php', 'generatepress-site-library' );
|
remove_submenu_page( 'themes.php', 'generatepress-site-library' );
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action( 'admin_enqueue_scripts', 'generate_sites_do_enqueue_scripts' );
|
|
||||||
/**
|
/**
|
||||||
* Add our scripts for the site library.
|
* Add our scripts for the site library.
|
||||||
*
|
*
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
|
* @deprecated 2.0.0
|
||||||
*/
|
*/
|
||||||
function generate_sites_do_enqueue_scripts() {
|
function generate_sites_do_enqueue_scripts() {
|
||||||
if ( ! generate_is_sites_dashboard() ) {
|
if ( ! generate_is_sites_dashboard() ) {
|
||||||
@ -175,11 +166,11 @@ function generate_sites_do_enqueue_scripts() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter( 'admin_body_class', 'generate_sites_do_admin_body_classes' );
|
|
||||||
/**
|
/**
|
||||||
* Add a body class while in the Site Library.
|
* Add a body class while in the Site Library.
|
||||||
*
|
*
|
||||||
* @since 1.8
|
* @since 1.8
|
||||||
|
* @deprecated 2.0.0
|
||||||
*
|
*
|
||||||
* @param array $classes Current body classes.
|
* @param array $classes Current body classes.
|
||||||
* @return array Existing and our new body classes
|
* @return array Existing and our new body classes
|
||||||
@ -192,7 +183,6 @@ function generate_sites_do_admin_body_classes( $classes ) {
|
|||||||
return $classes;
|
return $classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action( 'generate_inside_site_library_container', 'generate_sites_add_tabs_wrapper_open', 4 );
|
|
||||||
/**
|
/**
|
||||||
* Add an opening wrapper element for our Dashboard tabs and page builder links.
|
* Add an opening wrapper element for our Dashboard tabs and page builder links.
|
||||||
*
|
*
|
||||||
@ -206,6 +196,7 @@ function generate_sites_add_tabs_wrapper_open() {
|
|||||||
* Adds our Site dashboard container.
|
* Adds our Site dashboard container.
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
|
* @deprecated 2.0.0
|
||||||
*/
|
*/
|
||||||
function generate_sites_container() {
|
function generate_sites_container() {
|
||||||
?>
|
?>
|
||||||
@ -319,9 +310,10 @@ function generate_sites_container() {
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action( 'wp_ajax_generate_sites_refresh_sites', 'generate_sites_do_refresh_list' );
|
|
||||||
/**
|
/**
|
||||||
* Refresh our list of sites.
|
* Refresh our list of sites.
|
||||||
|
*
|
||||||
|
* @deprecated 2.0.0
|
||||||
*/
|
*/
|
||||||
function generate_sites_do_refresh_list() {
|
function generate_sites_do_refresh_list() {
|
||||||
check_ajax_referer( 'refresh_sites_nonce', '_nonce' );
|
check_ajax_referer( 'refresh_sites_nonce', '_nonce' );
|
||||||
@ -340,6 +332,7 @@ function generate_sites_do_refresh_list() {
|
|||||||
* Get our page header meta slugs.
|
* Get our page header meta slugs.
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
|
* @deprecated 2.0.0
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@ -373,6 +366,7 @@ function generate_sites_export_page_headers() {
|
|||||||
* Get our Element display locations.
|
* Get our Element display locations.
|
||||||
*
|
*
|
||||||
* @since 1.7
|
* @since 1.7
|
||||||
|
* @deprecated 2.0.0
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@ -400,6 +394,7 @@ function generate_sites_export_elements_location() {
|
|||||||
* Get our Element display locations.
|
* Get our Element display locations.
|
||||||
*
|
*
|
||||||
* @since 1.7
|
* @since 1.7
|
||||||
|
* @deprecated 2.0.0
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@ -427,6 +422,7 @@ function generate_sites_export_elements_exclusion() {
|
|||||||
* List out compatible theme modules Sites can activate.
|
* List out compatible theme modules Sites can activate.
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
|
* @deprecated 2.0.0
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@ -453,6 +449,7 @@ function generatepress_get_site_premium_modules() {
|
|||||||
* Don't allow Sites to modify these options.
|
* Don't allow Sites to modify these options.
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
|
* @deprecated 2.0.0
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@ -477,11 +474,11 @@ function generatepress_sites_disallowed_options() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action( 'generate_export_items', 'generatepress_sites_add_export_checkbox' );
|
|
||||||
/**
|
/**
|
||||||
* Add our GeneratePress Site export checkbox to the Export module.
|
* Add our GeneratePress Site export checkbox to the Export module.
|
||||||
*
|
*
|
||||||
* @since 1.7
|
* @since 1.7
|
||||||
|
* @deprecated 2.0.0
|
||||||
*/
|
*/
|
||||||
function generatepress_sites_add_export_checkbox() {
|
function generatepress_sites_add_export_checkbox() {
|
||||||
if ( ! apply_filters( 'generate_show_generatepress_site_export_option', false ) ) {
|
if ( ! apply_filters( 'generate_show_generatepress_site_export_option', false ) ) {
|
||||||
@ -497,11 +494,11 @@ function generatepress_sites_add_export_checkbox() {
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
add_filter( 'generate_export_data', 'generatepress_sites_do_site_options_export', 10, 2 );
|
|
||||||
/**
|
/**
|
||||||
* Add to our export .json file.
|
* Add to our export .json file.
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
|
* @deprecated 2.0.0
|
||||||
*
|
*
|
||||||
* @param array $data The current data being exported.
|
* @param array $data The current data being exported.
|
||||||
* @return array Existing and extended data.
|
* @return array Existing and extended data.
|
||||||
@ -652,7 +649,8 @@ function generatepress_sites_do_site_options_export( $data ) {
|
|||||||
/**
|
/**
|
||||||
* Get our sites from the site server.
|
* Get our sites from the site server.
|
||||||
*
|
*
|
||||||
* @since 1.12.0
|
* @since 1.12.0'
|
||||||
|
* @deprecated 2.0.0
|
||||||
*/
|
*/
|
||||||
function generate_get_sites_from_library() {
|
function generate_get_sites_from_library() {
|
||||||
$remote_sites = get_transient( 'generatepress_sites' );
|
$remote_sites = get_transient( 'generatepress_sites' );
|
||||||
@ -715,12 +713,12 @@ function generate_get_sites_from_library() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action( 'current_screen', 'generatepress_sites_init', 5 );
|
|
||||||
/**
|
/**
|
||||||
* Fetch our sites and trusted authors. Stores them in their own transients.
|
* Fetch our sites and trusted authors. Stores them in their own transients.
|
||||||
* We use current_screen instead of admin_init so we can check what admin page we're on.
|
* We use current_screen instead of admin_init so we can check what admin page we're on.
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
|
* @deprecated 2.0.0
|
||||||
*/
|
*/
|
||||||
function generatepress_sites_init() {
|
function generatepress_sites_init() {
|
||||||
$screen = get_current_screen();
|
$screen = get_current_screen();
|
||||||
@ -730,12 +728,12 @@ function generatepress_sites_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action( 'plugins_loaded', 'generatepress_sites_output' );
|
|
||||||
/**
|
/**
|
||||||
* Initiate our Sites once everything has loaded.
|
* Initiate our Sites once everything has loaded.
|
||||||
* We use current_screen instead of admin_init so we can check what admin page we're on.
|
* We use current_screen instead of admin_init so we can check what admin page we're on.
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
|
* @deprecated 2.0.0
|
||||||
*/
|
*/
|
||||||
function generatepress_sites_output() {
|
function generatepress_sites_output() {
|
||||||
if ( ! class_exists( 'GeneratePress_Site' ) ) {
|
if ( ! class_exists( 'GeneratePress_Site' ) ) {
|
||||||
@ -762,6 +760,7 @@ function generatepress_sites_output() {
|
|||||||
* Show an error message when no sites exist.
|
* Show an error message when no sites exist.
|
||||||
*
|
*
|
||||||
* @since 1.8.2
|
* @since 1.8.2
|
||||||
|
* @deprecated 2.0.0
|
||||||
*/
|
*/
|
||||||
function generatepress_sites_no_results_error() {
|
function generatepress_sites_no_results_error() {
|
||||||
printf(
|
printf(
|
||||||
@ -773,3 +772,19 @@ function generatepress_sites_no_results_error() {
|
|||||||
'https://docs.generatepress.com/article/site-library-unavailable/'
|
'https://docs.generatepress.com/article/site-library-unavailable/'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build each site UI.
|
||||||
|
*
|
||||||
|
* @deprecated 2.0.0
|
||||||
|
*/
|
||||||
|
class GeneratePress_Site {
|
||||||
|
/**
|
||||||
|
* Get it rockin'
|
||||||
|
*
|
||||||
|
* @param array $config The site configuration.
|
||||||
|
*/
|
||||||
|
public function __construct( $config = array() ) {
|
||||||
|
// Do nothing.
|
||||||
|
}
|
||||||
|
}
|
@ -47,7 +47,14 @@ function generate_premium_get_media_query( $name ) {
|
|||||||
function generate_get_css_print_method() {
|
function generate_get_css_print_method() {
|
||||||
$mode = apply_filters( 'generatepress_dynamic_css_print_method', 'inline' );
|
$mode = apply_filters( 'generatepress_dynamic_css_print_method', 'inline' );
|
||||||
|
|
||||||
if ( ( function_exists( 'is_customize_preview' ) && is_customize_preview() ) || is_preview() ) {
|
if (
|
||||||
|
( function_exists( 'is_customize_preview' ) && is_customize_preview() )
|
||||||
|
||
|
||||||
|
is_preview()
|
||||||
|
||
|
||||||
|
// AMP inlines all CSS, so inlining from the start improves CSS processing performance.
|
||||||
|
( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() )
|
||||||
|
) {
|
||||||
return 'inline';
|
return 'inline';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,3 +64,24 @@ function generate_get_css_print_method() {
|
|||||||
|
|
||||||
return $mode;
|
return $mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check to see if we have a Block Element.
|
||||||
|
*
|
||||||
|
* @since 2.0.0
|
||||||
|
* @param string $element The type of element to check.
|
||||||
|
* @param boolean $block_element Whether it's a block element or not.
|
||||||
|
*/
|
||||||
|
function generate_has_active_element( $element, $block_element ) {
|
||||||
|
global $generate_elements;
|
||||||
|
|
||||||
|
if ( ! empty( $generate_elements ) ) {
|
||||||
|
foreach ( (array) $generate_elements as $key => $data ) {
|
||||||
|
if ( $element === $data['type'] && $block_element === $data['is_block_element'] ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -262,7 +262,7 @@ function generate_reset_options_scripts() {
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
jQuery( document ).ready( function($) {
|
jQuery( function( $ ) {
|
||||||
$( '.show-advanced' ).on( 'click', function() {
|
$( '.show-advanced' ).on( 'click', function() {
|
||||||
$( this ).toggleClass( 'active' );
|
$( this ).toggleClass( 'active' );
|
||||||
$( this ).next( '.advanced-choices' ).toggleClass( 'show' );
|
$( this ).next( '.advanced-choices' ).toggleClass( 'show' );
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2020-10-01 13:52:43+0000","generator":"WP-CLI\/2.4.0","source":"dist\/block-elements.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"de","plural-forms":"nplurals=2; plural=n != 1;"},"This will remove the current sidebar widgets for the selected sidebar. Your layout must have a sidebar set for this Element to show.":["Die bestehenden Widgets des ausgew\u00e4hlten Seitenbereichs werden gel\u00f6scht. F\u00fcr das Layout muss ein Seitenbereich definiert sein, damit dieses Element angezeigt werden kann."],"Site Footer":["Seiten-Footer"],"None":["Ohne"],"Type":["Typ"],"Right Sidebar":["Rechte Seitenleiste"],"Left Sidebar":["Linke Seitenleiste"],"Priority":["Priorit\u00e4t"],"Custom Hook":["Benutzerdefinierter Hook"],"Custom":["Benutzerdefiniert"],"Site Header":["Seitenkopf"],"Page Hero":["Page Hero"],"Hook":["Hook"],"Right":["Rechts"],"Left":["Links"],"Center":["Zentriert"],"Location":["Standort"]}}}
|
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2020-10-01 13:52:43+0000","generator":"WP-CLI\/2.4.0","source":"dist\/editor.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"de","plural-forms":"nplurals=2; plural=n != 1;"},"All Elements":["Alle Elemente"]}}}
|
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2020-10-01 13:52:43+0000","generator":"WP-CLI\/2.4.0","source":"dist\/site-library.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"de","plural-forms":"nplurals=2; plural=n != 1;"},"Why?":["Warum?"],"This process restores your previous options, widgets and active plugins. It will also remove your imported content and CSS.":["Dieser Vorgang stellt Ihre vorherigen Optionen, Widgets und aktiven Plugins wieder her. Au\u00dferdem werden Ihre importierten Inhalte und CSS entfernt."],"It is highly recommended that you remove the last site you imported before importing a new one.":["Es wird dringend empfohlen, die zuletzt importierte Site zu entfernen, bevor Sie eine neue importieren."],"Existing Site Import Detected":["Bestehender Site-Import erkannt"],"Restoring theme options":["Vorherige Theme-Einstellungen werden wieder hergestellt."],"New URL":["Neue URL"],"Old URL":["Alte URL"],"This site is using Elementor which means you will want to replace the imported image URLs.":["Diese Site verwendet Elementor, was bedeutet, dass Sie eventuell die importierten Bild-URLs ersetzen sollten."],"Additional Cleanup":["Zus\u00e4tzliche Bereinigung"],"This site uses the following plugins.":["Diese Site verwendet die folgenden Plugins."],"All":["Alle"],"View Site":["Seite ansehen"],"Get Started":["Installation starten"],"Plugins":["Plugins"],"Installing plugins":["Plugins installieren"],"Activating plugins":["Plugins aktivieren"],"Importing widgets":["Widgets importieren"],"Importing site options":["Import von Seiten Optionen"],"Importing content":["Importieren von Inhalten"],"None":["Ohne"],"Import":["Import"]}}}
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2021-01-18 18:01:36+0000","generator":"WP-CLI\/2.4.0","source":"dist\/block-elements.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"es","plural-forms":"nplurals=2; plural=n != 1;"},"This will remove the current sidebar widgets for the selected sidebar. Your layout must have a sidebar set for this Element to show.":["Esto eliminar\u00e1 los widgets de barra lateral actuales para la barra lateral seleccionada. La plantilla debe tener una barra lateral establecida para que este elemento se muestre."],"Site Footer":["Pie de p\u00e1gina del sitio"],"None":["Ninguno"],"Type":["Tipo"],"Right Sidebar":["Barra Lateral Derecha"],"Left Sidebar":["Barra Lateral Izquierda"],"Priority":["Prioridad"],"Custom Hook":["Hook personalizado"],"Custom":["Personalizado"],"Site Header":["Encabezamiento del sitio"],"Page Hero":["P\u00e1gina Hero"],"Hook":["Hook"],"Right":["Derecha"],"Left":["Izquierda"],"Center":["Centro"],"Location":["Posici\u00f3n"]}}}
|
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2021-01-18 18:01:36+0000","generator":"WP-CLI\/2.4.0","source":"dist\/editor.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"es","plural-forms":"nplurals=2; plural=n != 1;"},"All Elements":["Todos los Elementos"]}}}
|
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2021-01-18 18:01:36+0000","generator":"WP-CLI\/2.4.0","source":"dist\/site-library.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"es","plural-forms":"nplurals=2; plural=n != 1;"},"Why?":["\u00bfPor qu\u00e9?"],"This process restores your previous options, widgets and active plugins. It will also remove your imported content and CSS.":["Este proceso restaura la anterior versi\u00f3n de las opciones, widgets y plugins activos. Tambi\u00e9n eliminar\u00e1 el contenido importado y el CSS."],"It is highly recommended that you remove the last site you imported before importing a new one.":["Es muy recomendable que elimines el anterior sitio que importaste antes de importar uno nuevo."],"Existing Site Import Detected":["Detectado sitio existente importado"],"Restoring theme options":["Restauraci\u00f3n de opciones del tema"],"New URL":["Nueva URL"],"Old URL":["URL antigua"],"This site is using Elementor which means you will want to replace the imported image URLs.":["Este sitio est\u00e1 utilizando Elementor, lo que significa que querr\u00e1 reemplazar las URLs de im\u00e1genes importadas."],"Additional Cleanup":["Limpieza adicional"],"This site uses the following plugins.":["Este sitio utiliza los siguientes plugins."],"All":["Todo"],"View Site":["Ver Sitio"],"Get Started":["Empezar"],"Plugins":["Plugins"],"Installing plugins":["Instalaci\u00f3n de plugins"],"Activating plugins":["Activar plugins"],"Importing widgets":["Importar widgets"],"Importing site options":["Importar opciones del sitio"],"Importing content":["Importando contenido"],"None":["Ninguno"],"Import":["Importar"]}}}
|
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2021-04-24 08:46:07+0000","generator":"WP-CLI\/2.4.0","source":"dist\/editor.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"fi","plural-forms":"nplurals=2; plural=n != 1;"},"Active Elements":["Aktiivit elementit"],"All Elements":["Kaikki elementit"]}}}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2021-03-10 11:23:17+0000","generator":"WP-CLI\/2.4.0","source":"dist\/block-elements.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"fr","plural-forms":"nplurals=2; plural=n > 1;"},"Post author name":["Nom de l'auteur de la publication"],"Post date":["Date de la publication"],"Title":["Titre"],"Dynamic text type":["Type de texte dynamique"],"Published date before text":["Texte avant la date de publication"],"Term archives":["Archives des termes"],"Author meta":["M\u00e9tadonn\u00e9es des auteurs"],"Previous page of posts":["Pr\u00e9c\u00e9dente page des publications"],"Next page of posts":["Prochaine page des publications"],"Comments area":["Zone des commentaires"],"Author archives":["Archives des auteurs"],"Single post":["Publication unique"],"Taxonomy":["Taxonomie"],"In same term":["Dans le m\u00eame terme"],"No previous post":["Pas de publication pr\u00e9c\u00e9dente"],"This will remove the current sidebar widgets for the selected sidebar. Your layout must have a sidebar set for this Element to show.":["Cela supprimera les widgets en cours pour la colonne lat\u00e9rale s\u00e9lectionn\u00e9e. Votre mise en page doit avoir des colonnes lat\u00e9rales d\u00e9finies pour que cet \u00e9l\u00e9ment soit visible."],"Site Footer":["Pied de page du site"],"None":["Aucun"],"Type":["Type"],"Right Sidebar":["Colonne lat\u00e9rale de droite"],"Left Sidebar":["Colonne lat\u00e9rale gauche"],"Priority":["Priorit\u00e9"],"Custom Hook":["Hook personnalis\u00e9"],"Custom":["Personnaliser"],"Site Header":["Ent\u00eate du site"],"Page Hero":["Banni\u00e8re"],"Hook":["Hook"],"Right":["Droite"],"Left":["Gauche"],"Center":["Centre"],"Location":["Emplacement"]}}}
|
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2021-03-10 11:23:17+0000","generator":"WP-CLI\/2.4.0","source":"dist\/editor.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"fr","plural-forms":"nplurals=2; plural=n > 1;"},"All Elements":["Tous les \u00e9l\u00e9ments"]}}}
|
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2021-03-10 11:23:17+0000","generator":"WP-CLI\/2.4.0","source":"dist\/site-library.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"fr","plural-forms":"nplurals=2; plural=n > 1;"},"Why?":["Pourquoi?"],"This process restores your previous options, widgets and active plugins. It will also remove your imported content and CSS.":["Cette op\u00e9ration restaure vos r\u00e9glages pr\u00e9c\u00e9dents: options, widgets et extensions actives. Cela va aussi supprimer le contenu import\u00e9 est les CSS. "],"It is highly recommended that you remove the last site you imported before importing a new one.":["Il est vraiment recommand\u00e9 de supprimer le dernier site que vous avez import\u00e9 avant d'en importer un nouveau. "],"Existing Site Import Detected":["L'importation de ce site existe d\u00e9j\u00e0"],"Restoring theme options":["Restaurer les options du th\u00e8me"],"New URL":["Nouvelle URL"],"Old URL":["Ancienne URL"],"This site is using Elementor which means you will want to replace the imported image URLs.":["Ce site utilise Elementor ce qui veut dire que vous devrez remplacer les URLs des images import\u00e9es"],"Additional Cleanup":["Nettoyage suppl\u00e9mentaire"],"This site uses the following plugins.":["Ce site utilise les plugins suivants"],"Installing plugins":["Installation de plugins..."],"Activating plugins":["Activer les plugins"],"Importing widgets":["Importation des widgets"],"Importing site options":["Importation des options du site"],"Importing content":["Importation du contenu"],"None":["Aucun"],"Import":["Importer"]}}}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
wp-content/plugins/gp-premium/langs/gp-premium-nb_NO.mo
Normal file
BIN
wp-content/plugins/gp-premium/langs/gp-premium-nb_NO.mo
Normal file
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2020-05-12 15:01:48+0000","generator":"WP-CLI\/2.4.0","source":"dist\/block-elements.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"nl","plural-forms":"nplurals=2; plural=n != 1;"},"None":["Geen"],"Type":["Type"],"Right Sidebar":["Rechter zijbalk"],"Left Sidebar":["Linker zijbalk"],"Priority":["Prioriteit"],"Custom Hook":["Aangepaste hook"],"Custom":["Aangepast"],"Site Header":["Site header"],"Page Hero":["Page Hero"],"Hook":["Hook"],"Right":["Rechts"],"Left":["Links"],"Center":["Midden"],"Location":["Locatie"]}}}
|
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2020-05-12 15:01:48+0000","generator":"WP-CLI\/2.4.0","source":"dist\/editor.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"nl","plural-forms":"nplurals=2; plural=n != 1;"},"All Elements":["Alle elementen"]}}}
|
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2020-05-12 15:01:48+0000","generator":"WP-CLI\/2.4.0","source":"dist\/site-library.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"nl","plural-forms":"nplurals=2; plural=n != 1;"},"Why?":["Waarom?"],"This process restores your previous options, widgets and active plugins. It will also remove your imported content and CSS.":["Deze procedure zet je vorige opties, widgets, en actieve plugins terug. Het verwijdert ook de ge\u00efmporteerde inhoud en CSS."],"It is highly recommended that you remove the last site you imported before importing a new one.":["Het is aanbevolen dat je de laatste site verwijdert die je hebt ge\u00efmporteerd voordat je een nieuwe importeert."],"Existing Site Import Detected":["Bestaande site import gevonden"],"Restoring theme options":["Terugzetten themaopties"],"New URL":["Nieuwe URL"],"Old URL":["Oude URL"],"This site is using Elementor which means you will want to replace the imported image URLs.":["Deze site maakt gebruik van Elementor, wat betekent dat je de ge\u00efmporteerde afbeeldings-URLs moet aanpassen."],"Additional Cleanup":["Extra opruimen"],"This site uses the following plugins.":["Deze site maakt gebruik van de volgende plugins:"],"All":["Alles"],"View Site":["Bekijk site"],"Get Started":["Nu beginnen"],"Plugins":["Plugins"],"Installing plugins":["Plugins aan het installeren"],"Activating plugins":["Plugins aan het activeren"],"Importing widgets":["Widgets aan het importeren"],"Importing site options":["Site-instellingen aan het importeren"],"Importing content":["Inhoud aan het importeren"],"None":["Geen"],"Import":["Importeren"]}}}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2020-08-08 21:16:06+0000","generator":"WP-CLI\/2.4.0","source":"dist\/block-elements.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"pt","plural-forms":"nplurals=2; plural=n != 1;"},"Site Footer":["Rodap\u00e9 do site"],"None":["Nenhuma"],"Type":["Tipo"],"Right Sidebar":["Barra lateral direita"],"Left Sidebar":["Barra lateral esquerda"],"Priority":["Prioridade"],"Custom Hook":["Hook personalizado"],"Custom":["Personalizado"],"Site Header":["Cabe\u00e7alho do site"],"Page Hero":["Hero de p\u00e1gina"],"Hook":["Hook"],"Right":["Direita"],"Left":["Esquerda"],"Center":["Centro"],"Location":["Localiza\u00e7\u00e3o"]}}}
|
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2020-08-08 21:16:06+0000","generator":"WP-CLI\/2.4.0","source":"dist\/editor.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"pt","plural-forms":"nplurals=2; plural=n != 1;"},"All Elements":["Todos os elementos"]}}}
|
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2020-08-08 21:16:06+0000","generator":"WP-CLI\/2.4.0","source":"dist\/site-library.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"pt","plural-forms":"nplurals=2; plural=n != 1;"},"Why?":["Porqu\u00ea?"],"This process restores your previous options, widgets and active plugins. It will also remove your imported content and CSS.":["Este processo recupera as suas op\u00e7\u00f5es, widgets e plugins activos anteriores. Tamb\u00e9m ir\u00e1 remover o seu conte\u00fado importado e CSS."],"It is highly recommended that you remove the last site you imported before importing a new one.":["\u00c9 altamente recomendado que remova o site importado anteriormente antes de importar um novo."],"Existing Site Import Detected":["Detectado um site importado existente"],"Restoring theme options":["A recuperar op\u00e7\u00f5es do tema"],"New URL":["URL novo"],"Old URL":["URL antigo"],"This site is using Elementor which means you will want to replace the imported image URLs.":["Este site utiliza o Elementor, isto significa que dever\u00e1 substituir os URL das imagens importadas."],"Additional Cleanup":["Limpeza adicional"],"This site uses the following plugins.":["Este site utiliza os seguintes plugins."],"All":["Todos"],"View Site":["Ver site"],"Get Started":["Come\u00e7ar"],"Plugins":["Plugins"],"Installing plugins":["A instalar plugins"],"Activating plugins":["A activar plugins"],"Importing widgets":["A importar widgets"],"Importing site options":["A importar op\u00e7\u00f5es do site"],"Importing content":["A importar conte\u00fados"],"None":["Nenhuma"],"Import":["Importar"]}}}
|
Binary file not shown.
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2020-04-26 23:48:38+0000","generator":"WP-CLI\/2.4.0","source":"dist\/block-elements.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"ru","plural-forms":"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"},"None":["\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442"],"Type":["\u0422\u0438\u043f"],"Right Sidebar":["\u0412 \u043f\u0440\u0430\u0432\u043e\u043c \u0431\u043e\u043a\u043e\u0432\u0438\u043a\u0435"],"Left Sidebar":["\u0412 \u043b\u0435\u0432\u043e\u043c \u0431\u043e\u043a\u043e\u0432\u0438\u043a\u0435"],"Priority":["\u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442"],"Custom Hook":["\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0445\u0443\u043a"],"Custom":["\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439"],"Site Header":["\u0428\u0430\u043f\u043a\u0430 \u0441\u0430\u0439\u0442\u0430"],"Page Hero":["Hero \u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430"],"Hook":["\u0425\u0443\u043a"],"Right":["\u0421\u043f\u0440\u0430\u0432\u0430"],"Left":["\u0421\u043b\u0435\u0432\u0430"],"Center":["\u041f\u043e \u0446\u0435\u043d\u0442\u0440\u0443"],"Location":["\u0420\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435"]}}}
|
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2020-04-26 23:48:38+0000","generator":"WP-CLI\/2.4.0","source":"dist\/editor.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"ru","plural-forms":"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"},"All Elements":["\u0412\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b"]}}}
|
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2020-04-26 23:48:38+0000","generator":"WP-CLI\/2.4.0","source":"dist\/site-library.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"ru","plural-forms":"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"},"Why?":["\u041f\u043e\u0447\u0435\u043c\u0443?"],"This process restores your previous options, widgets and active plugins. It will also remove your imported content and CSS.":["\u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0432\u0430\u0448\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u0432\u0438\u0434\u0436\u0435\u0442\u044b \u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u044b. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u0443\u0434\u0430\u043b\u0438\u0442 \u0432\u0430\u0448 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u0438 CSS."],"It is highly recommended that you remove the last site you imported before importing a new one.":["\u041d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u0430\u0439\u0442 \u043f\u0435\u0440\u0435\u0434 \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u043c \u043d\u043e\u0432\u043e\u0433\u043e."],"Existing Site Import Detected":["\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d \u0438\u043c\u043f\u043e\u0440\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430"],"Restoring theme options":["\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0442\u0435\u043c\u044b"],"New URL":["\u041d\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 URL"],"Old URL":["\u0421\u0442\u0430\u0440\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 URL"],"This site is using Elementor which means you will want to replace the imported image URLs.":["\u042d\u0442\u043e\u0442 \u0441\u0430\u0439\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 Elementor, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0412\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c URL-\u0430\u0434\u0440\u0435\u0441\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439."],"Additional Cleanup":["\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0430"],"This site uses the following plugins.":["\u042d\u0442\u043e\u0442 \u0441\u0430\u0439\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u044b."],"Installing plugins":["\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432"],"Activating plugins":["\u0410\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432"],"Importing widgets":["\u0418\u043c\u043f\u043e\u0440\u0442 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432"],"Importing site options":["\u0418\u043c\u043f\u043e\u0440\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0441\u0430\u0439\u0442\u0430"],"Importing content":["\u0418\u043c\u043f\u043e\u0440\u0442 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430"],"None":["\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442"],"Import":["\u0418\u043c\u043f\u043e\u0440\u0442"]}}}
|
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2021-04-23 12:51:19+0000","generator":"WP-CLI\/2.4.0","source":"dist\/editor.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"sv_SE","plural-forms":"nplurals=2; plural=n != 1;"},"Active Elements":["Aktiva element"],"All Elements":["Alla element"]}}}
|
@ -0,0 +1 @@
|
|||||||
|
{"translation-revision-date":"2021-04-23 12:51:19+0000","generator":"WP-CLI\/2.4.0","source":"dist\/site-library.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"sv_SE","plural-forms":"nplurals=2; plural=n != 1;"},"Note: We do our best to ensure all imported images are licensed for open use. However, image licenses can change, so we strongly advise that you replace all imported images with your own.":[""],"Check out your new site and start making it yours!":["Kolla in din nya webbplats och b\u00f6rja g\u00f6ra den till din egen!"],"Learn more here":["L\u00e4r dig mer h\u00e4r"],"To disable it, find WP_DEBUG in your wp-config.php file and set it to false like the below.":["F\u00f6r att inaktivera den, hitta WP_DEBUG i din wp-config.php-fil och st\u00e4ll in den p\u00e5 falsk som nedan."],"WordPress debug mode is currently enabled. With this, any errors from third-party plugins might affect the import process.":[""],"Debug Mode Enabled":["Fels\u00f6kningsl\u00e4ge aktiverat"],"Preview mobile":["F\u00f6rhandsgranska mobil"],"Preview tablet":["F\u00f6rhandsgranska surfplatta"],"Preview desktop":["F\u00f6rhandsgranska station\u00e4r dator"],"Elementor Tools":["Elementor-verktyg"],"Take note of the old and new URLs below, then head over to the Elementor Tools area to replace them.":[""],"Begin Import":[""],"I understand":["Jag f\u00f6rst\u00e5r"],"Confirm Import":["Bekr\u00e4fta import"],"Import Demo Content":["Importera demoinneh\u00e5ll"],"This will install and activate needed plugins, import demo content, and import site options.":["Detta kommer att installera och aktivera n\u00f6dv\u00e4ndiga till\u00e4gg, importera demo-inneh\u00e5ll och importera webbplatsalternativ."],"Import Theme Options":["Importera temaalternativ"],"This will import the options from the Customizer.":["Detta importerar alternativen fr\u00e5n anpassaren."],"These plugins need to be installed manually.":["Dessa till\u00e4gg m\u00e5ste installeras manuellt."],"These plugins are already installed.":["Dessa till\u00e4gg \u00e4r redan installerade."],"These plugins can be installed automatically.":["Dessa till\u00e4gg kan installeras automatiskt."],"Gathering information":[""],"Refresh sites":["Uppdatera webbplatser"],"Requires GP Premium %s.":["Kr\u00e4ver GP Premium %s."],"Page Builder":[""],"Category":["Kategori"],"No thanks":["Nej tack"],"Remove imported site":["Ta bort importerad webbplats"],"This process makes changes to your website. If it contains important data, we suggest backing it up before proceeding.":[""],"Try again":["F\u00f6rs\u00f6k igen"],"No sites were found.":["Inga webbplatser hittades."],"Restoring content":["\u00c5terst\u00e4ller inneh\u00e5ll"],"Installing %s":["Installerar %s"],"Import Complete":["Import slutf\u00f6rd"],"Importing theme options":["Importerar temaalternativ"],"Why?":["Varf\u00f6r?"],"This process restores your previous options, widgets and active plugins. It will also remove your imported content and CSS.":["Denna process \u00e5terst\u00e4ller dina f\u00f6reg\u00e5ende alternativ, widgetar och aktiva till\u00e4gg. Det tar ocks\u00e5 bort ditt importerade inneh\u00e5ll och CSS."],"It is highly recommended that you remove the last site you imported before importing a new one.":["Det rekommenderas starkt att du tar bort den senaste webbplatsen du importerade innan du importerar en ny."],"Existing Site Import Detected":["Befintlig webbplatsimport uppt\u00e4ckt"],"Restoring theme options":["\u00c5terst\u00e4ller temalternativ"],"New URL":["Ny URL"],"Old URL":["Gammal URL"],"This site is using Elementor which means you will want to replace the imported image URLs.":["Denna webbplats anv\u00e4nder Elementor vilket inneb\u00e4r att du beh\u00f6ver ers\u00e4tta de importerade bild-URL:erna."],"Additional Cleanup":["Ytterligare upprensning"],"This site uses the following plugins.":["Denna webbplats anv\u00e4nder f\u00f6ljande till\u00e4gg."],"All":["Alla"],"View Site":["Visa webbplats"],"Get Started":["Komma ig\u00e5ng"],"Plugins":["Till\u00e4gg"],"Installing plugins":["Installerar till\u00e4gg"],"Activating plugins":["Aktiverar till\u00e4gg"],"Importing widgets":["Importerar widgetar"],"Importing site options":["Importerar webbplatsalternativ"],"Importing content":["Importerar inneh\u00e5ll"],"None":["Ingen"],"Import":["Importera"]}}}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|||||||
* Allows plugins to use their own update API.
|
* Allows plugins to use their own update API.
|
||||||
*
|
*
|
||||||
* @author Easy Digital Downloads
|
* @author Easy Digital Downloads
|
||||||
* @version 1.7.1
|
* @version 1.8.0
|
||||||
*/
|
*/
|
||||||
class EDD_SL_Plugin_Updater {
|
class EDD_SL_Plugin_Updater {
|
||||||
|
|
||||||
@ -106,47 +106,50 @@ class EDD_SL_Plugin_Updater {
|
|||||||
return $_transient_data;
|
return $_transient_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$current = $this->get_repo_api_data();
|
||||||
|
if ( false !== $current && is_object( $current ) && isset( $current->new_version ) ) {
|
||||||
|
if ( version_compare( $this->version, $current->new_version, '<' ) ) {
|
||||||
|
$_transient_data->response[ $this->name ] = $current;
|
||||||
|
} else {
|
||||||
|
// Populating the no_update information is required to support auto-updates in WordPress 5.5.
|
||||||
|
$_transient_data->no_update[ $this->name ] = $current;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$_transient_data->last_checked = time();
|
||||||
|
$_transient_data->checked[ $this->name ] = $this->version;
|
||||||
|
|
||||||
|
return $_transient_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get repo API data from store.
|
||||||
|
* Save to cache.
|
||||||
|
*
|
||||||
|
* @return \stdClass
|
||||||
|
*/
|
||||||
|
public function get_repo_api_data() {
|
||||||
$version_info = $this->get_cached_version_info();
|
$version_info = $this->get_cached_version_info();
|
||||||
|
|
||||||
if ( false === $version_info ) {
|
if ( false === $version_info ) {
|
||||||
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
|
$version_info = $this->api_request(
|
||||||
|
'plugin_latest_version',
|
||||||
|
array(
|
||||||
|
'slug' => $this->slug,
|
||||||
|
'beta' => $this->beta,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if ( ! $version_info ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is required for your plugin to support auto-updates in WordPress 5.5.
|
||||||
|
$version_info->plugin = $this->name;
|
||||||
|
$version_info->id = $this->name;
|
||||||
|
|
||||||
$this->set_version_info_cache( $version_info );
|
$this->set_version_info_cache( $version_info );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
|
return $version_info;
|
||||||
|
|
||||||
$no_update = false;
|
|
||||||
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
|
||||||
|
|
||||||
$_transient_data->response[ $this->name ] = $version_info;
|
|
||||||
|
|
||||||
// Make sure the plugin property is set to the plugin's name/location. See issue 1463 on Software Licensing's GitHub repo.
|
|
||||||
$_transient_data->response[ $this->name ]->plugin = $this->name;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$no_update = new stdClass();
|
|
||||||
$no_update->id = '';
|
|
||||||
$no_update->slug = $this->slug;
|
|
||||||
$no_update->plugin = $this->name;
|
|
||||||
$no_update->new_version = $version_info->new_version;
|
|
||||||
$no_update->url = $version_info->homepage;
|
|
||||||
$no_update->package = $version_info->package;
|
|
||||||
$no_update->icons = $version_info->icons;
|
|
||||||
$no_update->banners = $version_info->banners;
|
|
||||||
$no_update->banners_rtl = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
$_transient_data->last_checked = time();
|
|
||||||
$_transient_data->checked[ $this->name ] = $this->version;
|
|
||||||
|
|
||||||
if ( $no_update ) {
|
|
||||||
$_transient_data->no_update[ $this->name ] = $no_update;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $_transient_data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -182,7 +185,7 @@ class EDD_SL_Plugin_Updater {
|
|||||||
|
|
||||||
if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
|
if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
|
||||||
|
|
||||||
$version_info = $this->get_cached_version_info();
|
$version_info = $this->get_repo_api_data();
|
||||||
|
|
||||||
if ( false === $version_info ) {
|
if ( false === $version_info ) {
|
||||||
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
|
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
|
||||||
@ -211,29 +214,14 @@ class EDD_SL_Plugin_Updater {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$no_update = false;
|
|
||||||
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
||||||
|
|
||||||
$update_cache->response[ $this->name ] = $version_info;
|
$update_cache->response[ $this->name ] = $version_info;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$no_update = new stdClass();
|
$update_cache->no_update[ $this->name ] = $version_info;
|
||||||
$no_update->id = '';
|
|
||||||
$no_update->slug = $this->slug;
|
|
||||||
$no_update->plugin = $this->name;
|
|
||||||
$no_update->new_version = $version_info->new_version;
|
|
||||||
$no_update->url = $version_info->homepage;
|
|
||||||
$no_update->package = $version_info->package;
|
|
||||||
$no_update->icons = $version_info->icons;
|
|
||||||
$no_update->banners = $version_info->banners;
|
|
||||||
$no_update->banners_rtl = array();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$update_cache->last_checked = time();
|
$update_cache->last_checked = time();
|
||||||
$update_cache->checked[ $this->name ] = $this->version;
|
$update_cache->checked[ $this->name ] = $this->version;
|
||||||
if ( $no_update ) {
|
|
||||||
$update_cache->no_update[ $this->name ] = $no_update;
|
|
||||||
}
|
|
||||||
|
|
||||||
set_site_transient( 'update_plugins', $update_cache );
|
set_site_transient( 'update_plugins', $update_cache );
|
||||||
|
|
||||||
@ -437,16 +425,16 @@ class EDD_SL_Plugin_Updater {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( false === $edd_plugin_url_available[ $store_hash ] ) {
|
if ( false === $edd_plugin_url_available[ $store_hash ] ) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array_merge( $this->api_data, $_data );
|
$data = array_merge( $this->api_data, $_data );
|
||||||
|
|
||||||
if ( $data['slug'] != $this->slug ) {
|
if ( $data['slug'] != $this->slug ) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $this->api_url == trailingslashit ( home_url() ) ) {
|
if ( $this->api_url == trailingslashit ( home_url() ) ) {
|
||||||
return false; // Don't allow a plugin to ping itself
|
return false; // Don't allow a plugin to ping itself
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,7 +470,7 @@ class EDD_SL_Plugin_Updater {
|
|||||||
$request->icons = maybe_unserialize( $request->icons );
|
$request->icons = maybe_unserialize( $request->icons );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! empty( $request->sections ) ) {
|
if ( ! empty( $request->sections ) ) {
|
||||||
foreach( $request->sections as $key => $section ) {
|
foreach( $request->sections as $key => $section ) {
|
||||||
$request->$key = (array) $section;
|
$request->$key = (array) $section;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,163 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* WP Async Request
|
|
||||||
*
|
|
||||||
* @package WP-Background-Processing
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ( ! class_exists( 'WP_Async_Request' ) ) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Abstract WP_Async_Request class.
|
|
||||||
*
|
|
||||||
* @abstract
|
|
||||||
*/
|
|
||||||
abstract class WP_Async_Request {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prefix
|
|
||||||
*
|
|
||||||
* (default value: 'wp')
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @access protected
|
|
||||||
*/
|
|
||||||
protected $prefix = 'wp';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Action
|
|
||||||
*
|
|
||||||
* (default value: 'async_request')
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @access protected
|
|
||||||
*/
|
|
||||||
protected $action = 'async_request';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Identifier
|
|
||||||
*
|
|
||||||
* @var mixed
|
|
||||||
* @access protected
|
|
||||||
*/
|
|
||||||
protected $identifier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Data
|
|
||||||
*
|
|
||||||
* (default value: array())
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
* @access protected
|
|
||||||
*/
|
|
||||||
protected $data = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initiate new async request
|
|
||||||
*/
|
|
||||||
public function __construct() {
|
|
||||||
$this->identifier = $this->prefix . '_' . $this->action;
|
|
||||||
|
|
||||||
add_action( 'wp_ajax_' . $this->identifier, array( $this, 'maybe_handle' ) );
|
|
||||||
add_action( 'wp_ajax_nopriv_' . $this->identifier, array( $this, 'maybe_handle' ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set data used during the request
|
|
||||||
*
|
|
||||||
* @param array $data Data.
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function data( $data ) {
|
|
||||||
$this->data = $data;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dispatch the async request
|
|
||||||
*
|
|
||||||
* @return array|WP_Error
|
|
||||||
*/
|
|
||||||
public function dispatch() {
|
|
||||||
$url = add_query_arg( $this->get_query_args(), $this->get_query_url() );
|
|
||||||
$args = $this->get_post_args();
|
|
||||||
|
|
||||||
return wp_remote_post( esc_url_raw( $url ), $args );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get query args
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected function get_query_args() {
|
|
||||||
if ( property_exists( $this, 'query_args' ) ) {
|
|
||||||
return $this->query_args;
|
|
||||||
}
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'action' => $this->identifier,
|
|
||||||
'nonce' => wp_create_nonce( $this->identifier ),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get query URL
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
protected function get_query_url() {
|
|
||||||
if ( property_exists( $this, 'query_url' ) ) {
|
|
||||||
return $this->query_url;
|
|
||||||
}
|
|
||||||
|
|
||||||
return admin_url( 'admin-ajax.php' );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get post args
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected function get_post_args() {
|
|
||||||
if ( property_exists( $this, 'post_args' ) ) {
|
|
||||||
return $this->post_args;
|
|
||||||
}
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'timeout' => 0.01,
|
|
||||||
'blocking' => false,
|
|
||||||
'body' => $this->data,
|
|
||||||
'cookies' => $_COOKIE,
|
|
||||||
'sslverify' => apply_filters( 'https_local_ssl_verify', false ),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Maybe handle
|
|
||||||
*
|
|
||||||
* Check for correct nonce and pass to handler.
|
|
||||||
*/
|
|
||||||
public function maybe_handle() {
|
|
||||||
// Don't lock up other requests while processing
|
|
||||||
session_write_close();
|
|
||||||
|
|
||||||
check_ajax_referer( $this->identifier, 'nonce' );
|
|
||||||
|
|
||||||
$this->handle();
|
|
||||||
|
|
||||||
wp_die();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle
|
|
||||||
*
|
|
||||||
* Override this method to perform any actions required
|
|
||||||
* during the async request.
|
|
||||||
*/
|
|
||||||
abstract protected function handle();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,506 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* WP Background Process
|
|
||||||
*
|
|
||||||
* @package WP-Background-Processing
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ( ! class_exists( 'WP_Background_Process' ) ) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Abstract WP_Background_Process class.
|
|
||||||
*
|
|
||||||
* @abstract
|
|
||||||
* @extends WP_Async_Request
|
|
||||||
*/
|
|
||||||
abstract class WP_Background_Process extends WP_Async_Request {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Action
|
|
||||||
*
|
|
||||||
* (default value: 'background_process')
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @access protected
|
|
||||||
*/
|
|
||||||
protected $action = 'background_process';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start time of current process.
|
|
||||||
*
|
|
||||||
* (default value: 0)
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @access protected
|
|
||||||
*/
|
|
||||||
protected $start_time = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cron_hook_identifier
|
|
||||||
*
|
|
||||||
* @var mixed
|
|
||||||
* @access protected
|
|
||||||
*/
|
|
||||||
protected $cron_hook_identifier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cron_interval_identifier
|
|
||||||
*
|
|
||||||
* @var mixed
|
|
||||||
* @access protected
|
|
||||||
*/
|
|
||||||
protected $cron_interval_identifier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initiate new background process
|
|
||||||
*/
|
|
||||||
public function __construct() {
|
|
||||||
parent::__construct();
|
|
||||||
|
|
||||||
$this->cron_hook_identifier = $this->identifier . '_cron';
|
|
||||||
$this->cron_interval_identifier = $this->identifier . '_cron_interval';
|
|
||||||
|
|
||||||
add_action( $this->cron_hook_identifier, array( $this, 'handle_cron_healthcheck' ) );
|
|
||||||
add_filter( 'cron_schedules', array( $this, 'schedule_cron_healthcheck' ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dispatch
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function dispatch() {
|
|
||||||
// Schedule the cron healthcheck.
|
|
||||||
$this->schedule_event();
|
|
||||||
|
|
||||||
// Perform remote post.
|
|
||||||
return parent::dispatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Push to queue
|
|
||||||
*
|
|
||||||
* @param mixed $data Data.
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function push_to_queue( $data ) {
|
|
||||||
$this->data[] = $data;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Save queue
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function save() {
|
|
||||||
$key = $this->generate_key();
|
|
||||||
|
|
||||||
if ( ! empty( $this->data ) ) {
|
|
||||||
update_site_option( $key, $this->data );
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update queue
|
|
||||||
*
|
|
||||||
* @param string $key Key.
|
|
||||||
* @param array $data Data.
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function update( $key, $data ) {
|
|
||||||
if ( ! empty( $data ) ) {
|
|
||||||
update_site_option( $key, $data );
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete queue
|
|
||||||
*
|
|
||||||
* @param string $key Key.
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function delete( $key ) {
|
|
||||||
delete_site_option( $key );
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate key
|
|
||||||
*
|
|
||||||
* Generates a unique key based on microtime. Queue items are
|
|
||||||
* given a unique key so that they can be merged upon save.
|
|
||||||
*
|
|
||||||
* @param int $length Length.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
protected function generate_key( $length = 64 ) {
|
|
||||||
$unique = md5( microtime() . rand() );
|
|
||||||
$prepend = $this->identifier . '_batch_';
|
|
||||||
|
|
||||||
return substr( $prepend . $unique, 0, $length );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Maybe process queue
|
|
||||||
*
|
|
||||||
* Checks whether data exists within the queue and that
|
|
||||||
* the process is not already running.
|
|
||||||
*/
|
|
||||||
public function maybe_handle() {
|
|
||||||
// Don't lock up other requests while processing
|
|
||||||
session_write_close();
|
|
||||||
|
|
||||||
if ( $this->is_process_running() ) {
|
|
||||||
// Background process already running.
|
|
||||||
wp_die();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $this->is_queue_empty() ) {
|
|
||||||
// No data to process.
|
|
||||||
wp_die();
|
|
||||||
}
|
|
||||||
|
|
||||||
check_ajax_referer( $this->identifier, 'nonce' );
|
|
||||||
|
|
||||||
$this->handle();
|
|
||||||
|
|
||||||
wp_die();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is queue empty
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
protected function is_queue_empty() {
|
|
||||||
global $wpdb;
|
|
||||||
|
|
||||||
$table = $wpdb->options;
|
|
||||||
$column = 'option_name';
|
|
||||||
|
|
||||||
if ( is_multisite() ) {
|
|
||||||
$table = $wpdb->sitemeta;
|
|
||||||
$column = 'meta_key';
|
|
||||||
}
|
|
||||||
|
|
||||||
$key = $wpdb->esc_like( $this->identifier . '_batch_' ) . '%';
|
|
||||||
|
|
||||||
$count = $wpdb->get_var( $wpdb->prepare( "
|
|
||||||
SELECT COUNT(*)
|
|
||||||
FROM {$table}
|
|
||||||
WHERE {$column} LIKE %s
|
|
||||||
", $key ) );
|
|
||||||
|
|
||||||
return ( $count > 0 ) ? false : true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is process running
|
|
||||||
*
|
|
||||||
* Check whether the current process is already running
|
|
||||||
* in a background process.
|
|
||||||
*/
|
|
||||||
protected function is_process_running() {
|
|
||||||
if ( get_site_transient( $this->identifier . '_process_lock' ) ) {
|
|
||||||
// Process already running.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lock process
|
|
||||||
*
|
|
||||||
* Lock the process so that multiple instances can't run simultaneously.
|
|
||||||
* Override if applicable, but the duration should be greater than that
|
|
||||||
* defined in the time_exceeded() method.
|
|
||||||
*/
|
|
||||||
protected function lock_process() {
|
|
||||||
$this->start_time = time(); // Set start time of current process.
|
|
||||||
|
|
||||||
$lock_duration = ( property_exists( $this, 'queue_lock_time' ) ) ? $this->queue_lock_time : 60; // 1 minute
|
|
||||||
$lock_duration = apply_filters( $this->identifier . '_queue_lock_time', $lock_duration );
|
|
||||||
|
|
||||||
set_site_transient( $this->identifier . '_process_lock', microtime(), $lock_duration );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unlock process
|
|
||||||
*
|
|
||||||
* Unlock the process so that other instances can spawn.
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
protected function unlock_process() {
|
|
||||||
delete_site_transient( $this->identifier . '_process_lock' );
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get batch
|
|
||||||
*
|
|
||||||
* @return stdClass Return the first batch from the queue
|
|
||||||
*/
|
|
||||||
protected function get_batch() {
|
|
||||||
global $wpdb;
|
|
||||||
|
|
||||||
$table = $wpdb->options;
|
|
||||||
$column = 'option_name';
|
|
||||||
$key_column = 'option_id';
|
|
||||||
$value_column = 'option_value';
|
|
||||||
|
|
||||||
if ( is_multisite() ) {
|
|
||||||
$table = $wpdb->sitemeta;
|
|
||||||
$column = 'meta_key';
|
|
||||||
$key_column = 'meta_id';
|
|
||||||
$value_column = 'meta_value';
|
|
||||||
}
|
|
||||||
|
|
||||||
$key = $wpdb->esc_like( $this->identifier . '_batch_' ) . '%';
|
|
||||||
|
|
||||||
$query = $wpdb->get_row( $wpdb->prepare( "
|
|
||||||
SELECT *
|
|
||||||
FROM {$table}
|
|
||||||
WHERE {$column} LIKE %s
|
|
||||||
ORDER BY {$key_column} ASC
|
|
||||||
LIMIT 1
|
|
||||||
", $key ) );
|
|
||||||
|
|
||||||
$batch = new stdClass();
|
|
||||||
$batch->key = $query->$column;
|
|
||||||
$batch->data = maybe_unserialize( $query->$value_column );
|
|
||||||
|
|
||||||
return $batch;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle
|
|
||||||
*
|
|
||||||
* Pass each queue item to the task handler, while remaining
|
|
||||||
* within server memory and time limit constraints.
|
|
||||||
*/
|
|
||||||
protected function handle() {
|
|
||||||
$this->lock_process();
|
|
||||||
|
|
||||||
do {
|
|
||||||
$batch = $this->get_batch();
|
|
||||||
|
|
||||||
foreach ( $batch->data as $key => $value ) {
|
|
||||||
$task = $this->task( $value );
|
|
||||||
|
|
||||||
if ( false !== $task ) {
|
|
||||||
$batch->data[ $key ] = $task;
|
|
||||||
} else {
|
|
||||||
unset( $batch->data[ $key ] );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $this->time_exceeded() || $this->memory_exceeded() ) {
|
|
||||||
// Batch limits reached.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update or delete current batch.
|
|
||||||
if ( ! empty( $batch->data ) ) {
|
|
||||||
$this->update( $batch->key, $batch->data );
|
|
||||||
} else {
|
|
||||||
$this->delete( $batch->key );
|
|
||||||
}
|
|
||||||
} while ( ! $this->time_exceeded() && ! $this->memory_exceeded() && ! $this->is_queue_empty() );
|
|
||||||
|
|
||||||
$this->unlock_process();
|
|
||||||
|
|
||||||
// Start next batch or complete process.
|
|
||||||
if ( ! $this->is_queue_empty() ) {
|
|
||||||
$this->dispatch();
|
|
||||||
} else {
|
|
||||||
$this->complete();
|
|
||||||
}
|
|
||||||
|
|
||||||
wp_die();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Memory exceeded
|
|
||||||
*
|
|
||||||
* Ensures the batch process never exceeds 90%
|
|
||||||
* of the maximum WordPress memory.
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
protected function memory_exceeded() {
|
|
||||||
$memory_limit = $this->get_memory_limit() * 0.9; // 90% of max memory
|
|
||||||
$current_memory = memory_get_usage( true );
|
|
||||||
$return = false;
|
|
||||||
|
|
||||||
if ( $current_memory >= $memory_limit ) {
|
|
||||||
$return = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return apply_filters( $this->identifier . '_memory_exceeded', $return );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get memory limit
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
protected function get_memory_limit() {
|
|
||||||
if ( function_exists( 'ini_get' ) ) {
|
|
||||||
$memory_limit = ini_get( 'memory_limit' );
|
|
||||||
} else {
|
|
||||||
// Sensible default.
|
|
||||||
$memory_limit = '128M';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! $memory_limit || -1 === intval( $memory_limit ) ) {
|
|
||||||
// Unlimited, set to 32GB.
|
|
||||||
$memory_limit = '32000M';
|
|
||||||
}
|
|
||||||
|
|
||||||
return intval( $memory_limit ) * 1024 * 1024;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Time exceeded.
|
|
||||||
*
|
|
||||||
* Ensures the batch never exceeds a sensible time limit.
|
|
||||||
* A timeout limit of 30s is common on shared hosting.
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
protected function time_exceeded() {
|
|
||||||
$finish = $this->start_time + apply_filters( $this->identifier . '_default_time_limit', 20 ); // 20 seconds
|
|
||||||
$return = false;
|
|
||||||
|
|
||||||
if ( time() >= $finish ) {
|
|
||||||
$return = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return apply_filters( $this->identifier . '_time_exceeded', $return );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Complete.
|
|
||||||
*
|
|
||||||
* Override if applicable, but ensure that the below actions are
|
|
||||||
* performed, or, call parent::complete().
|
|
||||||
*/
|
|
||||||
protected function complete() {
|
|
||||||
// Unschedule the cron healthcheck.
|
|
||||||
$this->clear_scheduled_event();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Schedule cron healthcheck
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
* @param mixed $schedules Schedules.
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function schedule_cron_healthcheck( $schedules ) {
|
|
||||||
$interval = apply_filters( $this->identifier . '_cron_interval', 5 );
|
|
||||||
|
|
||||||
if ( property_exists( $this, 'cron_interval' ) ) {
|
|
||||||
$interval = apply_filters( $this->identifier . '_cron_interval', $this->cron_interval );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adds every 5 minutes to the existing schedules.
|
|
||||||
$schedules[ $this->identifier . '_cron_interval' ] = array(
|
|
||||||
'interval' => MINUTE_IN_SECONDS * $interval,
|
|
||||||
'display' => sprintf( __( 'Every %d Minutes' ), $interval ),
|
|
||||||
);
|
|
||||||
|
|
||||||
return $schedules;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle cron healthcheck
|
|
||||||
*
|
|
||||||
* Restart the background process if not already running
|
|
||||||
* and data exists in the queue.
|
|
||||||
*/
|
|
||||||
public function handle_cron_healthcheck() {
|
|
||||||
if ( $this->is_process_running() ) {
|
|
||||||
// Background process already running.
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $this->is_queue_empty() ) {
|
|
||||||
// No data to process.
|
|
||||||
$this->clear_scheduled_event();
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->handle();
|
|
||||||
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Schedule event
|
|
||||||
*/
|
|
||||||
protected function schedule_event() {
|
|
||||||
if ( ! wp_next_scheduled( $this->cron_hook_identifier ) ) {
|
|
||||||
wp_schedule_event( time(), $this->cron_interval_identifier, $this->cron_hook_identifier );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear scheduled event
|
|
||||||
*/
|
|
||||||
protected function clear_scheduled_event() {
|
|
||||||
$timestamp = wp_next_scheduled( $this->cron_hook_identifier );
|
|
||||||
|
|
||||||
if ( $timestamp ) {
|
|
||||||
wp_unschedule_event( $timestamp, $this->cron_hook_identifier );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cancel Process
|
|
||||||
*
|
|
||||||
* Stop processing queue items, clear cronjob and delete batch.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function cancel_process() {
|
|
||||||
if ( ! $this->is_queue_empty() ) {
|
|
||||||
$batch = $this->get_batch();
|
|
||||||
|
|
||||||
$this->delete( $batch->key );
|
|
||||||
|
|
||||||
wp_clear_scheduled_hook( $this->cron_hook_identifier );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Task
|
|
||||||
*
|
|
||||||
* Override this method to perform any actions required on each
|
|
||||||
* queue item. Return the modified item for further processing
|
|
||||||
* in the next pass through. Or, return false to remove the
|
|
||||||
* item from the queue.
|
|
||||||
*
|
|
||||||
* @param mixed $item Queue item to iterate over.
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
abstract protected function task( $item );
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -215,6 +215,227 @@ function generate_premium_customizer_shortcut_controls( $wp_customize ) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_action( 'customize_register', 'generate_premium_layout_block_element_messages', 1000 );
|
||||||
|
/**
|
||||||
|
* Add shortcuts to sections we don't control in this plugin.
|
||||||
|
*
|
||||||
|
* @since 1.8
|
||||||
|
*/
|
||||||
|
function generate_premium_layout_block_element_messages( $wp_customize ) {
|
||||||
|
if ( ! class_exists( 'WP_Customize_Panel' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( method_exists( $wp_customize, 'register_control_type' ) ) {
|
||||||
|
$wp_customize->register_control_type( 'GeneratePress_Information_Customize_Control' );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( version_compare( PHP_VERSION, '5.6', '>=' ) ) {
|
||||||
|
$footer_sections = array(
|
||||||
|
'generate_layout_footer',
|
||||||
|
'footer_color_section',
|
||||||
|
'font_footer_section',
|
||||||
|
'generate_backgrounds_footer',
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ( $footer_sections as $section ) {
|
||||||
|
if ( $wp_customize->get_section( $section ) ) {
|
||||||
|
$wp_customize->add_control(
|
||||||
|
new GeneratePress_Information_Customize_Control(
|
||||||
|
$wp_customize,
|
||||||
|
'generate_using_site_footer_element_' . $section,
|
||||||
|
array(
|
||||||
|
'section' => $section,
|
||||||
|
'description' => sprintf(
|
||||||
|
/* translators: URL to the Elements dashboard. */
|
||||||
|
__( 'This page is using a <a href="%s">Site Footer Element</a>. Some of the options below may not apply.', 'gp-premium' ),
|
||||||
|
admin_url( 'edit.php?post_type=gp_elements' )
|
||||||
|
),
|
||||||
|
'notice' => true,
|
||||||
|
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||||
|
'active_callback' => function() {
|
||||||
|
$has_block_element = generate_has_active_element( 'site-footer', true );
|
||||||
|
|
||||||
|
if ( $has_block_element ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
'priority' => 0,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$header_sections = array(
|
||||||
|
'generate_layout_header',
|
||||||
|
'header_color_section',
|
||||||
|
'font_header_section',
|
||||||
|
'generate_backgrounds_header',
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ( $header_sections as $section ) {
|
||||||
|
if ( $wp_customize->get_section( $section ) ) {
|
||||||
|
$wp_customize->add_control(
|
||||||
|
new GeneratePress_Information_Customize_Control(
|
||||||
|
$wp_customize,
|
||||||
|
'generate_using_site_header_element_' . $section,
|
||||||
|
array(
|
||||||
|
'section' => $section,
|
||||||
|
'description' => sprintf(
|
||||||
|
/* translators: URL to the Elements dashboard. */
|
||||||
|
__( 'This page is using a <a href="%s">Site Header Element</a>. Some of the options below may not apply.', 'gp-premium' ),
|
||||||
|
admin_url( 'edit.php?post_type=gp_elements' )
|
||||||
|
),
|
||||||
|
'notice' => true,
|
||||||
|
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||||
|
'active_callback' => function() {
|
||||||
|
$has_block_element = generate_has_active_element( 'site-header', true );
|
||||||
|
|
||||||
|
if ( $has_block_element ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
'priority' => 0,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sidebar_sections = array(
|
||||||
|
'generate_layout_sidebars',
|
||||||
|
'sidebar_widget_color_section',
|
||||||
|
'font_widget_section',
|
||||||
|
'generate_backgrounds_sidebars',
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ( $sidebar_sections as $section ) {
|
||||||
|
if ( $wp_customize->get_section( $section ) ) {
|
||||||
|
$wp_customize->add_control(
|
||||||
|
new GeneratePress_Information_Customize_Control(
|
||||||
|
$wp_customize,
|
||||||
|
'generate_using_sidebar_element_' . $section,
|
||||||
|
array(
|
||||||
|
'section' => $section,
|
||||||
|
'description' => sprintf(
|
||||||
|
/* translators: URL to the Elements dashboard. */
|
||||||
|
__( 'This page is using a <a href="%s">Sidebar Element</a>. Some of the options below may not apply.', 'gp-premium' ),
|
||||||
|
admin_url( 'edit.php?post_type=gp_elements' )
|
||||||
|
),
|
||||||
|
'notice' => true,
|
||||||
|
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||||
|
'active_callback' => function() {
|
||||||
|
$has_right_sidebar_block_element = generate_has_active_element( 'right-sidebar', true );
|
||||||
|
|
||||||
|
if ( $has_right_sidebar_block_element ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$has_left_sidebar_block_element = generate_has_active_element( 'left-sidebar', true );
|
||||||
|
|
||||||
|
if ( $has_left_sidebar_block_element ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
'priority' => 0,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $wp_customize->get_section( 'generate_blog_section' ) ) {
|
||||||
|
$wp_customize->add_control(
|
||||||
|
new GeneratePress_Information_Customize_Control(
|
||||||
|
$wp_customize,
|
||||||
|
'generate_using_post_loop_item_element',
|
||||||
|
array(
|
||||||
|
'section' => 'generate_blog_section',
|
||||||
|
'description' => sprintf(
|
||||||
|
/* translators: URL to the Elements dashboard. */
|
||||||
|
__( 'This page is using a <a href="%s">Content Template Element</a>. Some of the options below may not apply.', 'gp-premium' ),
|
||||||
|
admin_url( 'edit.php?post_type=gp_elements' )
|
||||||
|
),
|
||||||
|
'notice' => true,
|
||||||
|
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||||
|
'active_callback' => function() {
|
||||||
|
$has_block_element = generate_has_active_element( 'content-template', true );
|
||||||
|
|
||||||
|
if ( $has_block_element ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
'priority' => 0,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$wp_customize->add_control(
|
||||||
|
new GeneratePress_Information_Customize_Control(
|
||||||
|
$wp_customize,
|
||||||
|
'generate_using_page_hero_element',
|
||||||
|
array(
|
||||||
|
'section' => 'generate_blog_section',
|
||||||
|
'description' => sprintf(
|
||||||
|
/* translators: URL to the Elements dashboard. */
|
||||||
|
__( 'This page is using a <a href="%s">Page Hero Element</a>. Some of the options below may not apply.', 'gp-premium' ),
|
||||||
|
admin_url( 'edit.php?post_type=gp_elements' )
|
||||||
|
),
|
||||||
|
'notice' => true,
|
||||||
|
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||||
|
'active_callback' => function() {
|
||||||
|
$has_block_element = generate_has_active_element( 'page-hero', true );
|
||||||
|
|
||||||
|
if ( $has_block_element ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
'priority' => 0,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$wp_customize->add_control(
|
||||||
|
new GeneratePress_Information_Customize_Control(
|
||||||
|
$wp_customize,
|
||||||
|
'generate_using_post_meta_area_element',
|
||||||
|
array(
|
||||||
|
'section' => 'generate_blog_section',
|
||||||
|
'description' => sprintf(
|
||||||
|
/* translators: URL to the Elements dashboard. */
|
||||||
|
__( 'This page is using a <a href="%s">Post Meta Template Element</a>. Some of the options below may not apply.', 'gp-premium' ),
|
||||||
|
admin_url( 'edit.php?post_type=gp_elements' )
|
||||||
|
),
|
||||||
|
'notice' => true,
|
||||||
|
'settings' => ( isset( $wp_customize->selective_refresh ) ) ? array() : 'blogname',
|
||||||
|
'active_callback' => function() {
|
||||||
|
$has_block_element = generate_has_active_element( 'post-meta-template', true );
|
||||||
|
|
||||||
|
if ( $has_block_element ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
'priority' => 0,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
add_action( 'customize_controls_print_styles', 'generate_premium_customize_print_styles' );
|
add_action( 'customize_controls_print_styles', 'generate_premium_customize_print_styles' );
|
||||||
/**
|
/**
|
||||||
* Print control styles for the Customizer.
|
* Print control styles for the Customizer.
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user