first commit

This commit is contained in:
User A0264400
2026-04-01 23:20:16 +03:00
commit a766acdc90
23071 changed files with 4933189 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<?php
/**
* Fired during plugin activation
*
* @link https://www.gutentor.com/
* @since 1.0.0
*
* @package Gutentor
*/
/**
* Fired during plugin activation.
*
* This class defines all code necessary to run during the plugin's activation.
*
* @since 1.0.0
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
class Gutentor_Activator {
/**
* Short Description. (use period)
*
* Long Description.
*
* @since 1.0.0
*/
public static function activate() {
update_option( '__gutentor_do_redirect', true );
gutentor_add_installed_time();
}
}

View File

@@ -0,0 +1,970 @@
<?php
/**
* Do things related with admin settings
*
* @since 1.0.0
*/
if ( ! class_exists( 'Gutentor_Admin' ) ) {
/**
* Class Gutentor_Admin.
*/
class Gutentor_Admin extends Gutentor_Helper {
protected static $page_slug = 'gutentor';
public $tax_in_color = array();
public $tax_in_image = array();
public $taxonomies = array();
public function __construct() {
add_action( 'admin_menu', array( __CLASS__, 'admin_pages' ) );
add_action( 'admin_init', array( __CLASS__, 'redirect' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts_js' ) );
add_action( 'enqueue_block_editor_assets', array( $this, 'admin_editor_scripts' ), 99 );
add_action( 'plugin_action_links_gutentor/gutentor.php', array( $this, 'add_plugin_links' ), 10, 4 );
/*Category/Taxonomy Term Meta*/
$this->tax_in_color = gutentor_get_options( 'tax-in-color' );
$this->tax_in_image = gutentor_get_options( 'tax-in-image' );
if ( is_array( $this->tax_in_color ) ) {
$this->taxonomies = $this->tax_in_color;
}
if ( is_array( $this->tax_in_image ) ) {
$this->taxonomies = array_unique( array_merge( $this->taxonomies, $this->tax_in_image ) );
}
if ( ! empty( $this->taxonomies ) ) {
foreach ( $this->taxonomies as $tax ) {
add_action( $tax . '_add_form_fields', array( $this, 'taxonomy_edit_meta_field' ) );
add_action( $tax . '_edit_form_fields', array( $this, 'taxonomy_edit_meta_field' ) );
add_action( 'edited_' . $tax, array( $this, 'save_taxonomy_custom_meta' ) );
add_action( 'create_' . $tax, array( $this, 'save_taxonomy_custom_meta' ) );
add_filter( 'register_taxonomy_args', array( $this, 'add_taxonomy_args' ), 10, 2 );
}
}
self::initialize_ajax();
}
/**
* Redirect to plugin page when plugin activated
*
* @since 1.0.0
*/
public static function redirect() {
if ( get_option( '__gutentor_do_redirect' ) ) {
update_option( '__gutentor_do_redirect', false );
if ( ! is_multisite() ) {
exit( wp_redirect( esc_url( admin_url( 'admin.php?page=' . self::$page_slug ) ) ) );
}
}
}
/**
* Admin Page Menu and submenu page
*
* @since 1.0.0
*/
public static function admin_pages() {
add_menu_page(
'gutentor',
esc_html__( 'Gutentor', 'gutentor' ),
'manage_options',
self::$page_slug,
array( __CLASS__, 'getting_started_template' ),
'data:image/svg+xml;base64,' . base64_encode(
'<svg version="1.1" id="gray-logo" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="44px" height="47.042px" viewBox="0 0 44 47.042" enable-background="new 0 0 44 47.042" xml:space="preserve">
<path fill="#9FA4A9" d="M42.397,13.536l-16.293-9.45c-0.732-0.424-1.935-0.427-2.667-0.006l-0.44,0.252
c0.045,0.085,0.071,0.182,0.071,0.284v5.565c0,0.341-0.275,0.616-0.617,0.616h-5.565c-0.341,0-0.619-0.275-0.619-0.616V8.2
l-1.199,0.69v6.151c0,0.382-0.31,0.69-0.689,0.69h-6.21c-0.38,0-0.688-0.309-0.688-0.69V13.25l-0.376,0.216
c-0.734,0.422-1.338,1.461-1.339,2.309L5.76,18.553h3.42c0.327,0,0.593,0.265,0.593,0.594v5.348c0,0.329-0.266,0.596-0.593,0.596
H5.748l-0.019,9.521c-0.001,0.849,0.597,1.89,1.33,2.313l16.295,9.452c0.732,0.424,1.935,0.428,2.669,0.005l16.332-9.388
c0.732-0.421,1.336-1.461,1.337-2.311l0.039-18.834C43.732,15.003,43.134,13.961,42.397,13.536z M34.535,30.71l-9.631,5.758
L15.086,31l-0.175-11.235l9.643-5.771l9.1,5.067l-1.393,2.499l-7.657-4.263l-6.807,4.074l0.122,7.935l6.933,3.86l6.82-4.08v-1.083
l-6.103-0.122l0.059-2.861l8.906,0.179V30.71z"/>
<path fill="#9FA4A9" d="M5.866,11.788c0,0.111-0.09,0.203-0.201,0.203H3.849c-0.11,0-0.202-0.092-0.202-0.203V9.974
c0-0.113,0.091-0.203,0.202-0.203h1.816c0.111,0,0.201,0.09,0.201,0.203V11.788z"/>
<path fill="#9FA4A9" d="M4.048,17.141c0,0.187-0.15,0.336-0.336,0.336H0.691c-0.187,0-0.336-0.149-0.336-0.336v-3.022
c0-0.184,0.149-0.334,0.336-0.334h3.021c0.186,0,0.336,0.15,0.336,0.334V17.141z"/>
<rect x="8.79" y="9.445" fill="#9FA4A9" width="5.202" height="5.202"/>
<rect x="17.342" y="5.137" fill="#9FA4A9" width="4.82" height="4.819"/>
<path fill="#9FA4A9" d="M9.261,7.286c0,0.179-0.145,0.324-0.324,0.324H6.025C5.847,7.61,5.7,7.465,5.7,7.286V4.375
c0-0.178,0.146-0.325,0.325-0.325h2.912c0.179,0,0.324,0.146,0.324,0.325V7.286z"/>
<path fill="#9FA4A9" d="M15.298,6.035c0,0.178-0.145,0.323-0.323,0.323h-2.913c-0.179,0-0.324-0.145-0.324-0.323V3.121
c0-0.177,0.146-0.323,0.324-0.323h2.913c0.178,0,0.323,0.146,0.323,0.323V6.035z"/>
<path fill="#9FA4A9" d="M19.745,2.948c0,0.149-0.122,0.271-0.272,0.271h-2.455c-0.152,0-0.274-0.123-0.274-0.271V0.491
c0-0.149,0.122-0.272,0.274-0.272h2.455c0.15,0,0.272,0.124,0.272,0.272V2.948z"/>
<rect x="4.154" y="19.683" fill="#9FA4A9" width="4.546" height="4.546"/>
</svg>'
),
110
);
add_submenu_page(
'gutentor',
esc_html__( 'Getting Started Page', 'gutentor' ),
esc_html__( 'Getting Started', 'gutentor' ),
'manage_options',
self::$page_slug,
array( __CLASS__, 'getting_started_template' )
);
add_submenu_page(
'gutentor',
esc_html__( 'Blocks', 'gutentor' ),
esc_html__( 'Blocks', 'gutentor' ),
'manage_options',
'gutentor-blocks',
array( __CLASS__, 'gutentor_blocks_template' )
);
}
/**
* Enqueue styles & scripts for frontend & backend
*
* @access public
* @uses wp_enqueue_style
* @return void
* @since Gutentor 1.0.0
*/
public static function admin_scripts() {
$screen = get_current_screen();
$admin_scripts_bases = array( 'toplevel_page_gutentor', 'gutentor_page_gutentor-blocks', 'gutentor_page_gutentor-settings', 'term', 'edit-tags' );
if ( ! ( isset( $screen->base ) &&
in_array( $screen->base, $admin_scripts_bases ) )
) {
return;
}
/*
---------------------------------------------*
* Register Style for Admin Page *
*---------------------------------------------*/
$scripts = array(
array(
'handler' => 'jquery-ui',
'absolute' => true,
'style' => GUTENTOR_URL . 'assets/library/jquery-ui/jquery-ui' . '.min' . '.css',
),
array(
'handler' => 'gutentor-admin-build',
'absolute' => true,
'script' => GUTENTOR_URL . 'dist/admin.build.js',
'dependency' => array( 'jquery', 'lodash', 'wp-api', 'wp-i18n', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-edit-post', 'wp-element', 'wp-keycodes', 'wp-plugins', 'wp-rich-text', 'wp-viewport' ), // Dependencies, defined above,
),
);
/*FontAwesome CSS*/
if ( 4 == gutentor_get_options( 'fa-version' ) ) {
wp_enqueue_style(
'fontawesome', // Handle.
GUTENTOR_URL . 'assets/library/font-awesome-4.7.0/css/font-awesome.min.css',
array(),
'4'
);
} else {
wp_enqueue_style(
'fontawesome', // Handle.
GUTENTOR_URL . 'assets/library/fontawesome/css/all.min.css',
array(),
'5.12.0'
);
}
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_media();
self::enqueue( $scripts );
$localize = array(
'edd' => array(
'active' => gutentor_is_edd_active(),
'review' => gutentor_is_edd_review_active(),
'wishlist' => gutentor_is_edd_wishlist_active(),
),
'fontAwesomeVersion' => gutentor_get_options( 'fa-version' ),
'postFormats' => gutentor_get_post_formats(),
'gutentorPro' => array(
'active' => gutentor_pro_active(),
),
);
wp_localize_script( 'gutentor-admin-build', 'gutentor', $localize );
}
/**
* Enqueue styles & scripts for frontend & backend
*
* @access public
* @uses wp_enqueue_style
* @return void
* @since Gutentor 1.0.0
*/
public static function admin_scripts_js() {
$screen = get_current_screen();
$admin_scripts_bases = array( 'toplevel_page_gutentor', 'gutentor_page_gutentor-blocks', 'gutentor_page_gutentor-settings', 'gutentor_page_gutentor-pro-license', 'term', 'edit-tags' );
$admin_scripts_bases = apply_filters( 'gutentor_admin_scripts_current_screen', $admin_scripts_bases );
if ( ! ( isset( $screen->base ) &&
(
( in_array( $screen->base, $admin_scripts_bases ) ) ||
( in_array( get_post_type(), array( 'gutentor-fonts', 'gutentor-icons' ) ) )
)
)
) {
return;
}
/*
---------------------------------------------*
* Register Style for Admin Page *
*---------------------------------------------*/
$scripts = array(
array(
'handler' => 'magnific-popup',
'absolute' => true,
'style' => GUTENTOR_URL . 'assets/library/magnific-popup/magnific-popup' . '.min' . '.css',
),
array(
'handler' => 'gutentor-admin',
'absolute' => true,
'style' => GUTENTOR_URL . 'dist/blocks.admin.build.css',
'dependency' => array( 'wp-edit-blocks' ),
),
array(
'handler' => 'gutentor-admin',
'absolute' => true,
'script' => GUTENTOR_URL . 'assets/js/admin-script' . GUTENTOR_SCRIPT_PREFIX . '.js',
'dependency' => array( 'wp-color-picker' ),
),
array(
'handler' => 'magnific-popup',
'absolute' => true,
'script' => GUTENTOR_URL . 'assets/library/magnific-popup/jquery.magnific-popup' . '.min' . '.js',
),
);
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_media();
self::enqueue( $scripts );
$localize = array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'ajax_nonce' => wp_create_nonce( 'gutentor-block-nonce' ),
);
wp_localize_script( 'gutentor-admin', 'GUTENTOR_SETTINGS', $localize );
}
/**
* Enqueue styles & scripts for frontend & backend
*
* @access public
* @uses wp_enqueue_style
* @return void
* @since Gutentor 1.0.0
*/
public static function admin_editor_scripts() {
/*
---------------------------------------------*
* Register Style for Admin Page *
*---------------------------------------------*/
$scripts = array(
array(
'handler' => 'gutentor-block-deactivate',
'absolute' => true,
'script' => GUTENTOR_URL . 'assets/js/blocks-deactivate' . GUTENTOR_SCRIPT_PREFIX . '.js',
'dependency' => array( 'wp-blocks' ),
),
);
self::enqueue( $scripts );
$localize = array(
'status' => self::block_action(),
);
wp_localize_script( 'gutentor-block-deactivate', 'GUTENTOR_BLOCKS', $localize );
}
/**
* Render Getting Started Template
*
* @return void
*/
public static function getting_started_template() {
require_once GUTENTOR_PATH . 'includes/admin/templates/getting-started-page.php';
}
/**
* Render Blocks Template
*
* @since 1.0.0
*/
public static function gutentor_blocks_template() {
require_once GUTENTOR_PATH . 'includes/admin/templates/admin-page.php';
}
/**
* Initialize Ajax
*/
public static function initialize_ajax() {
// Ajax requests.
add_action( 'wp_ajax_gutentor_activate_block', array( __CLASS__, 'activate_block' ) );
add_action( 'wp_ajax_gutentor_deactivate_block', array( __CLASS__, 'deactivate_block' ) );
add_action( 'wp_ajax_gutentor_bulk_activate_blocks', array( __CLASS__, 'bulk_activate_blocks' ) );
add_action( 'wp_ajax_gutentor_bulk_deactivate_blocks', array( __CLASS__, 'bulk_deactivate_blocks' ) );
}
public static function block_action( $action = 'get', $blocks = array() ) {
$key = 'off-blocks';
switch ( $action ) {
case 'get':
return self::get_option( $key, array() );
case 'update':
self::update_option( $key, $blocks );
break;
}
}
public static function is_block_active( $block_id ) {
$blocks = self::block_action();
if ( ! isset( $blocks[ $block_id ] ) || $blocks[ $block_id ] == $block_id ) {
return true;
} else {
return false;
}
}
public static function is_all_block_active() {
$blocks = self::block_action();
if ( is_array( $blocks ) && ! empty( $blocks ) ) {
foreach ( $blocks as $b ) {
if ( $b == 'disabled' ) {
return false;
}
}
}
return true;
}
/**
* Activate block
*/
public static function activate_block() {
check_ajax_referer( 'gutentor-block-nonce', 'nonce' );
$block_id = sanitize_text_field( $_POST['block_id'] );
$blocks = self::block_action();
if ( ! is_array( $blocks ) ) {
$blocks = array();
}
$blocks[ $block_id ] = $block_id;
$blocks = array_map( 'esc_attr', $blocks );
/*Update blocks.*/
self::update_option( 'off-blocks', $blocks );
die();
}
/**
* Deactivate block
*/
public static function deactivate_block() {
check_ajax_referer( 'gutentor-block-nonce', 'nonce' );
$block_id = sanitize_text_field( $_POST['block_id'] );
$blocks = self::block_action();
if ( ! is_array( $blocks ) ) {
$blocks = array();
}
$blocks[ $block_id ] = 'disabled';
$blocks = array_map( 'esc_attr', $blocks );
// Update blocks.
self::block_action( 'update', $blocks );
echo esc_html( $block_id );
die();
}
/**
* Activate all module
*/
public static function bulk_activate_blocks() {
check_ajax_referer( 'gutentor-block-nonce', 'nonce' );
// Get all blocks.
$all_blocks = self::$block_list;
$new_blocks = array();
// Set all extension to enabled.
foreach ( $all_blocks as $slug => $value ) {
$_slug = str_replace( 'gutentor/', '', $slug );
$new_blocks[ $_slug ] = $_slug;
}
// Escape attrs.
$new_blocks = array_map( 'esc_attr', $new_blocks );
// Update new_extensions.
self::block_action( 'update', $new_blocks );
echo 'success';
die();
}
/**
* Deactivate all module
*/
public static function bulk_deactivate_blocks() {
check_ajax_referer( 'gutentor-block-nonce', 'nonce' );
// Get all extensions.
$old_blocks = self::$block_list;
$new_blocks = array();
// Set all extension to enabled.
foreach ( $old_blocks as $slug => $value ) {
$_slug = str_replace( 'gutentor/', '', $slug );
$new_blocks[ $_slug ] = 'disabled';
}
// Escape attrs.
$new_blocks = array_map( 'esc_attr', $new_blocks );
// Update new_extensions.
self::update_option( 'off-blocks', $new_blocks );
echo 'success';
die();
}
public static function elements() {
$gutentor_elements = array(
'e1' => array(
'title' => esc_html__( 'Advanced Text', 'gutentor' ),
'description' => esc_html__( 'Insert text with advanced options ', 'gutentor' ),
),
'e2' => array(
'title' => esc_html__( 'Button', 'gutentor' ),
'description' => esc_html__( 'Prompt visitors to take action with attractive buttons.', 'gutentor' ),
),
'e3' => array(
'title' => esc_html__( 'Counter', 'gutentor' ),
'description' => esc_html__( ' Insert an animated number to display the counter number.', 'gutentor' ),
),
'divider' => array(
'title' => esc_html__( 'Divider', 'gutentor' ),
'description' => esc_html__( 'Divider differentiate sections and elements with shape.', 'gutentor' ),
),
'e4' => array(
'title' => esc_html__( 'Google Map', 'gutentor' ),
'description' => esc_html__( 'Display a Google Map on your website with Google Map API.', 'gutentor' ),
),
'e5' => array(
'title' => esc_html__( 'Icon', 'gutentor' ),
'description' => esc_html__( 'Insert an icon to symbolize the text', 'gutentor' ),
),
'e6' => array(
'title' => esc_html__( 'Image', 'gutentor' ),
'description' => esc_html__( 'Insert an image to create extra value on the content.', 'gutentor' ),
),
'e7' => array(
'title' => esc_html__( 'List', 'gutentor' ),
'description' => esc_html__( 'Represent the paragraphs in tabbed styles', 'gutentor' ),
),
'e8' => array(
'title' => esc_html__( 'Pricing', 'gutentor' ),
'description' => esc_html__( 'Insert the pricing to showcase the price of the product.', 'gutentor' ),
),
'e9' => array(
'title' => esc_html__( 'Progress Bar', 'gutentor' ),
'description' => esc_html__( 'Showcase the progress of the work in an animated form.', 'gutentor' ),
),
'e10' => array(
'title' => esc_html__( 'Rating', 'gutentor' ),
'description' => esc_html__( 'Insert the rating element to represent the rating from 1-5 star.', 'gutentor' ),
),
'e0' => array(
'title' => esc_html__( 'Simple Text', 'gutentor' ),
'description' => esc_html__( 'Insert text with minimal options ', 'gutentor' ),
),
'e11' => array(
'title' => esc_html__( 'Video Popup', 'gutentor' ),
'description' => esc_html__( 'Insert video in your website.', 'gutentor' ),
),
);
return apply_filters( 'gutentor_elements_in_admin_page', $gutentor_elements );
}
public static function modules() {
$gutentor_modules = array(
'm6' => array(
'title' => esc_html__( 'Accordion ', 'gutentor' ),
'description' => esc_html__( 'Design collapsable items and pin any Gutentor Elements in Accordion Body.', 'gutentor' ),
),
'm4' => array(
'title' => esc_html__( 'Advanced Columns', 'gutentor' ),
'description' => esc_html__( 'Insert advanced columns to create customizable columns within the page. ', 'gutentor' ),
),
'm1' => array(
'title' => esc_html__( 'Button Group', 'gutentor' ),
'description' => esc_html__( ' Insert button group and it allows to added unlimited buttons.', 'gutentor' ),
),
'm0' => array(
'title' => esc_html__( 'Carousel', 'gutentor' ),
'description' => esc_html__( 'Insert carousel column and add element inside the columns. ', 'gutentor' ),
),
'm3' => array(
'title' => esc_html__( 'Container/Cover Block', 'gutentor' ),
'description' => esc_html__( 'Insert container and add any block, it facilitates as like wrapper.', 'gutentor' ),
),
'm2' => array(
'title' => esc_html__( 'Dynamic Columns', 'gutentor' ),
'description' => esc_html__( 'Insert dynamic columns to insert unlimited predefined columns ', 'gutentor' ),
),
'm9' => array(
'title' => esc_html__( 'Form Wrapper', 'gutentor' ),
'description' => esc_html__( 'Use (contact form) shortcode and design form input field, text area and button according to your need.', 'gutentor' ),
),
'm11' => array(
'title' => esc_html__( 'Filter', 'gutentor' ),
'description' => esc_html__( 'Filter block has module gallery all features with added primary/secondary filters items and searches filter. Filter block uses Module Gallery block as an inner block. ', 'gutentor' ),
),
'm10' => array(
'title' => esc_html__( 'Gallery', 'gutentor' ),
'description' => esc_html__( 'Advanced gallery block which let you add any Gutentor Elements as gallery content. The Module Gallery Block also allows customizing the popup content as image and video.', 'gutentor' ),
),
'm8' => array(
'title' => esc_html__( 'Icon Group ', 'gutentor' ),
'description' => esc_html__( 'Insert multiple icons in the Icon Group and create beautiful social profile links and icon designs.', 'gutentor' ),
),
'm12' => array(
'title' => esc_html__( 'Quote', 'gutentor' ),
'description' => esc_html__( 'Quote is the collection of element blocks which create a adorable quote design.', 'gutentor' ),
),
'm5' => array(
'title' => esc_html__( 'Slider ', 'gutentor' ),
'description' => esc_html__( 'Insert slider container and add elements within the container.', 'gutentor' ),
),
'm7' => array(
'title' => esc_html__( 'Tabs ', 'gutentor' ),
'description' => esc_html__( 'Add tab items with tab title and content, allowed to add any gutentor element inside it.', 'gutentor' ),
),
'm13' => array(
'title' => esc_html__( 'Table of Contents ', 'gutentor' ),
'description' => esc_html__( 'Table of Contents facilitates to access large contents of post/page through the heading of the contents.', 'gutentor' ),
),
);
if ( gutentor_pro_active() ) {
$gutentor_modules['m14'] = array(
'title' => esc_html__( 'Advance Show More', 'gutentor' ),
'description' => esc_html__( 'Advance Show More is extended version of show more widget with innerblocks.', 'gutentor' ),
);
$gutentor_modules['m15'] = array(
'title' => esc_html__( 'PopOver', 'gutentor' ),
'description' => esc_html__( 'PopOver is extended version of show more widget with innerblocks.', 'gutentor' ),
);
$gutentor_modules['m16'] = array(
'title' => esc_html__( 'Wrapper', 'gutentor' ),
'description' => esc_html__( 'Use it as wrapper block for gutentor elements, and other blocks, control width and design beautiful block section.', 'gutentor' ),
);
}
return apply_filters( 'gutentor_modules_in_admin_page', $gutentor_modules );
}
public static function posts() {
$gutentor_posts = array(
'p4' => array(
'title' => esc_html__( 'Advanced Post (Type)', 'gutentor' ),
'description' => esc_html__( 'Combination of multiple blocks like Post Module, Post Header, Post Footer.', 'gutentor' ),
),
'p6' => array(
'title' => esc_html__( 'Duplex Post (Type)', 'gutentor' ),
'description' => esc_html__( 'Design post in two different ways Feature Post and Normal Post, post design will be more beautiful.', 'gutentor' ),
),
'p1' => array(
'title' => esc_html__( 'Post (Type)', 'gutentor' ),
'description' => esc_html__( 'Display Blog post with list and grid view from post module.', 'gutentor' ),
),
'p3' => array(
'title' => esc_html__( 'Post (Type) Carousel', 'gutentor' ),
'description' => esc_html__( 'Display post or post type in carousel mode.', 'gutentor' ),
),
'p2' => array(
'title' => esc_html__( 'Post (Type) Feature', 'gutentor' ),
'description' => esc_html__( 'Display post with news and magazine style.', 'gutentor' ),
),
'p5' => array(
'title' => esc_html__( 'Post (Type) News Ticker', 'gutentor' ),
'description' => esc_html__( 'Display Marquee, Vertical, Horizontal or Typewriter News Ticker from post or post type.', 'gutentor' ),
),
);
return apply_filters( 'gutentor_posts_in_admin_page', $gutentor_posts );
}
public static function terms() {
$gutentor_terms = array(
't1' => array(
'title' => esc_html__( 'Term (Category)', 'gutentor' ),
'description' => esc_html__( 'Similar like Post (Type) block but in Term (Category) you can customize any term with beautiful design.', 'gutentor' ),
),
't2' => array(
'title' => esc_html__( 'Term (Category) Feature', 'gutentor' ),
'description' => esc_html__( '38 unique and lovely templates to showcase your Category and Term similar to Post (Type) Feature. Very useful to Blog, Magazine and E-commerce sites.', 'gutentor' ),
),
't3' => array(
'title' => esc_html__( 'Term Category Carousel', 'gutentor' ),
'description' => esc_html__( 'Term (Category) Carousel Block use Term (Category) as an inner block. You will find almost every options to customize your Term (Category) Carousel.', 'gutentor' ),
),
);
return apply_filters( 'gutentor_terms_in_admin_page', $gutentor_terms );
}
public static function content() {
$gutentor_block_collection = array(
'about-block' => array(
'title' => esc_html__( 'About Widget', 'gutentor' ),
'description' => esc_html__( 'The About Widget gives short description related to product, person or any items with a large section of a photo, title, description, and button with customise setting and different templates.', 'gutentor' ),
),
'accordion' => array(
'title' => esc_html__( 'Accordion Widget', 'gutentor' ),
'description' => esc_html__( 'The Accordion Widget helps you to display information in collapsible rows with title ,description and button. Generally this block can be helpful for display FAQ and other informative message. ', 'gutentor' ),
),
'list' => array(
'title' => esc_html__( 'Advanced List Widget', 'gutentor' ),
'description' => esc_html__( 'Not just a regular list but create an awesome list by adding image and icon on the advanced list widget.', 'gutentor' ),
),
'author-profile' => array(
'title' => esc_html__( 'Author Widget', 'gutentor' ),
'description' => esc_html__( 'The Author Widget allows user to display information related to author with title, description and button', 'gutentor' ),
),
'blog-post' => array(
'title' => esc_html__( 'Post Widget', 'gutentor' ),
'description' => esc_html__( 'The Post Widget block display collection of posts with different setting related to post items and many more templates.', 'gutentor' ),
),
'call-to-action' => array(
'title' => esc_html__( 'Call to Action Widget', 'gutentor' ),
'description' => esc_html__( 'The Call to Action Widget helps user to trigger certain action with collection of button.It is usable to link learn more, download, buy etc.', 'gutentor' ),
),
'content-box' => array(
'title' => esc_html__( 'Content Widget', 'gutentor' ),
'description' => esc_html__( 'Content Widget block is useful to preset plain title, content and button without image and icon.', 'gutentor' ),
),
'count-down' => array(
'title' => esc_html__( 'Countdown Widget', 'gutentor' ),
'description' => esc_html__( 'This Widget is useful for setting a countdown feature on your website. It is extremely helpful for any event show related website.', 'gutentor' ),
),
'counter-box' => array(
'title' => esc_html__( 'Counter Widget', 'gutentor' ),
'description' => esc_html__( 'Counter Widget represents the facts and figure related to any product, item or any product with cool animation , features and many more fascinated templates.', 'gutentor' ),
),
'featured-block' => array(
'title' => esc_html__( 'Featured Widget', 'gutentor' ),
'description' => esc_html__( 'The Featured Widget displays large section with a photo, title, description, and button with awesome template. Generally, it is useful to header part of the site.', 'gutentor' ),
),
'gallery' => array(
'title' => esc_html__( 'Gallery Widget', 'gutentor' ),
'description' => esc_html__( 'The Gallery Widget allows user to create mesmerizing gallery of image with caption which is perfect showcase of image of portfolio, services or product.', 'gutentor' ),
),
'google-map' => array(
'title' => esc_html__( 'Google Map Widget', 'gutentor' ),
'description' => esc_html__( 'Google Map Widget facilitates user to display the location of organization, company or any place with advanced features of google map. ', 'gutentor' ),
),
'icon-box' => array(
'title' => esc_html__( 'Icon Widget', 'gutentor' ),
'description' => esc_html__( 'Icon Widget facilitates to show off a short brief about the users services with Font Awesome icons with cool templates and features.', 'gutentor' ),
),
'image-box' => array(
'title' => esc_html__( 'Image Widget', 'gutentor' ),
'description' => esc_html__( 'The Image Widget display information with image, title, description and button which modify by available features and cool templates.', 'gutentor' ),
),
'image-slider' => array(
'title' => esc_html__( 'Image Slider Widget', 'gutentor' ),
'description' => esc_html__( 'The Image Slider Widget display adorable slider with image, title, description and button which modify by available features and cool templates.', 'gutentor' ),
),
'notification' => array(
'title' => esc_html__( 'Notification Widget', 'gutentor' ),
'description' => esc_html__( 'The Notification Widget facilitates to show different type of information(Warning,Error,Success).', 'gutentor' ),
),
'opening-hours' => array(
'title' => esc_html__( 'Opening Hours Widget', 'gutentor' ),
'description' => esc_html__( 'The Opening Hours Widget depicts the information related to opening schedule of any organization.', 'gutentor' ),
),
'pricing' => array(
'title' => esc_html__( 'Pricing Widget', 'gutentor' ),
'description' => esc_html__( 'The Pricing Widget represents the pricing details of any commodity with number of customize features.', 'gutentor' ),
),
'progress-bar' => array(
'title' => esc_html__( 'Progress Bar Widget', 'gutentor' ),
'description' => esc_html__( 'The progress bar Widget facilitates user create a customizable bar and/or circle progress counter to represent percentage values.', 'gutentor' ),
),
'restaurant-menu' => array(
'title' => esc_html__( 'Restaurant Menu Widget', 'gutentor' ),
'description' => esc_html__( 'The Restaurant Menu Widget represents the information items and recipes available in restaurant with different features and cool templates.', 'gutentor' ),
),
'show-more' => array(
'title' => esc_html__( 'Show More Widget', 'gutentor' ),
'description' => esc_html__( 'Add small text to show details text with show more button.', 'gutentor' ),
),
'social' => array(
'title' => esc_html__( 'Social links Widget', 'gutentor' ),
'description' => esc_html__( 'The Social links Widget displays the social networks page on website with different templates and a number of features.', 'gutentor' ),
),
'tabs' => array(
'title' => esc_html__( 'Tabs Widget', 'gutentor' ),
'description' => esc_html__( 'The Tab Widget facilitates user to display content in a fully tabbed UX which contains title, description and buttons with number of templates.', 'gutentor' ),
),
'team' => array(
'title' => esc_html__( 'Team Widget', 'gutentor' ),
'description' => esc_html__( 'With the team Widget users can create an attractive and sophisticated team section where they can represent the team members of their company in a professional way.', 'gutentor' ),
),
'testimonial' => array(
'title' => esc_html__( 'Testimonial Widget', 'gutentor' ),
'description' => esc_html__( 'The Testimonial Widget display the feedback or quotation given by your user which helps site visitor to trust on your product, services.', 'gutentor' ),
),
'timeline' => array(
'title' => esc_html__( 'Timeline Widget', 'gutentor' ),
'description' => esc_html__( 'The Timeline Widget has ability to represents the user information or events in chronological order with different styles. ', 'gutentor' ),
),
'video-popup' => array(
'title' => esc_html__( 'Video Popup Widget', 'gutentor' ),
'description' => esc_html__( 'The Video Popup Widget display video from youtube link or custom uploaded video in popup mode with number of styles ,video control.', 'gutentor' ),
),
);
return apply_filters( 'gutentor_block_in_admin_page', $gutentor_block_collection );
}
/*Taxonomy Fields*/
public function taxonomy_edit_meta_field( $term ) {
// Retrieve the existing value(s) for this meta field.
$gutentor_meta = $term && ! empty( $term->term_id ) ? get_term_meta( $term->term_id, 'gutentor_meta', true ) : false;
$bg = isset( $gutentor_meta['bg-color'] ) ? $gutentor_meta['bg-color'] : '';
$hover_bg = isset( $gutentor_meta['bg-hover-color'] ) ? $gutentor_meta['bg-hover-color'] : '';
$text_color = isset( $gutentor_meta['text-color'] ) ? $gutentor_meta['text-color'] : '';
$hover_text_color = isset( $gutentor_meta['text-hover-color'] ) ? $gutentor_meta['text-hover-color'] : '';
$f_image = isset( $gutentor_meta['featured-image'] ) ? $gutentor_meta['featured-image'] : '';
/*backward compatibility*/
if ( isset( $term->term_id ) && get_option( 'gutentor-cat-' . $term->term_id ) ) {
$gutentor_prev_options = get_option( 'gutentor-cat-' . $term->term_id );
$gutentor_prev_options = json_decode( $gutentor_prev_options, true );
if ( isset( $gutentor_prev_options['background-color'] ) && ! empty( $gutentor_prev_options['background-color'] ) ) {
$bg = $gutentor_prev_options['background-color'];
}
if ( isset( $gutentor_prev_options['background-hover-color'] ) && ! empty( $gutentor_prev_options['background-hover-color'] ) ) {
$hover_bg = $gutentor_prev_options['background-hover-color'];
}
if ( isset( $gutentor_prev_options['text-color'] ) && ! empty( $gutentor_prev_options['text-color'] ) ) {
$text_color = $gutentor_prev_options['text-color'];
}
if ( isset( $gutentor_prev_options['text-hover-color'] ) && ! empty( $gutentor_prev_options['text-hover-color'] ) ) {
$hover_text_color = $gutentor_prev_options['text-hover-color'];
}
}
if (
(
$term &&
! empty( $term->term_id ) &&
is_array( $this->tax_in_color ) && in_array( $term->taxonomy, $this->tax_in_color )
)
||
(
isset( $_GET['taxonomy'] ) &&
is_array( $this->tax_in_color ) && in_array( $_GET['taxonomy'], $this->tax_in_color )
)
) {
?>
<tr class="gutentor-fields">
<td><h4><?php esc_html_e( 'Background Color', 'gutentor' ); ?></h4></td>
<td class="form-field gutentor-fields">
<label for="gutentor_meta[bg-color]"><?php esc_html_e( 'Normal', 'gutentor' ); ?></label>
<input type="text" value="<?php echo esc_attr( $bg ); ?>" id="gutentor_meta[bg-color]" name="gutentor_meta[bg-color]" class="gutentor-color-picker" data-rgba="1"/>
</td>
</tr>
<tr class="form-field gutentor-fields">
<td></td>
<td>
<label for="gutentor_meta[bg-hover-color]"><?php esc_html_e( 'Hover', 'gutentor' ); ?></label>
<input type="text" value="<?php echo esc_attr( $hover_bg ); ?>" id="gutentor_meta[bg-hover-color]" name="gutentor_meta[bg-hover-color]" class="gutentor-color-picker" data-rgba="1" />
</td>
</tr>
<tr>
<td><h4><?php esc_html_e( 'Text Color', 'gutentor' ); ?></h4></td>
<td class="form-field gutentor-fields">
<label for="gutentor_meta[text-color]"><?php esc_html_e( 'Normal', 'gutentor' ); ?></label>
<input type="text" value="<?php echo esc_attr( $text_color ); ?>" id="gutentor_meta[text-color]" name="gutentor_meta[text-color]" class="gutentor-color-picker" data-rgba="1"/>
</td>
</tr>
<tr class="form-field gutentor-fields">
<td></td>
<td>
<label for="gutentor_meta[text-hover-color]"><?php esc_html_e( 'Hover', 'gutentor' ); ?></label>
<input type="text" value="<?php echo esc_attr( $hover_text_color ); ?>" id="gutentor_meta[text-hover-color]" name="gutentor_meta[text-hover-color]" class="gutentor-color-picker" data-rgba="1" />
</td>
</tr>
<?php
}
if (
(
$term &&
(
! empty( $term->term_id ) &&
(
$term->taxonomy !== 'product_cat' &&
(
is_array( $this->tax_in_image ) && in_array( $term->taxonomy, $this->tax_in_image )
)
)
)
)
||
(
isset( $_GET['taxonomy'] ) &&
is_array( $this->tax_in_image ) && in_array( $_GET['taxonomy'], $this->tax_in_image )
)
) {
?>
<tr>
<td>
<label for="gutentor_meta[featured-image]"><h4><?php esc_html_e( 'Featured Image', 'gutentor' ); ?></h4></label>
</td>
<td>
<div class="form-field gutentor-fields">
<?php
$button_text = __( 'Select Image', 'gutentor' );
$upload_title = __( 'Add Image', 'gutentor' );
$preview = '';
if ( ! empty( $f_image ) ) {
$attachment = wp_get_attachment_image_src( $f_image, 'thumbnail' );
$preview = $attachment[0];
$upload_title = __( 'Change Image', 'gutentor' );
}
$hidden = ( empty( $f_image ) ) ? ' hidden' : '';
$output = "<div class='gutentor-img-preview" . esc_attr( $hidden ) . "'><div class='gutentor-img-wrap'><i class='dashicons dashicons-no gutentor-clear-img'></i><a data-button-text='" . esc_attr( $button_text ) . "' data-title='" . esc_attr( $upload_title ) . "' href='#' class='gutentor-img-uploader-open'><img src='" . esc_url( $preview ) . "' /></a></div></div>";
$output .= "<a href='#' class='button button-primary gutentor-img-uploader-open' data-button-text='" . esc_attr( $button_text ) . "' data-title='" . esc_attr( $upload_title ) . "'>" . esc_html( $upload_title ) . '</a>';
$output .= '<input type="hidden" value="' . esc_attr( $f_image ) . '" id="gutentor_meta[featured-image]" name="gutentor_meta[featured-image]" />';
echo $output;//phpcs:ignore All output is escaped before
?>
</div>
</td>
</tr>
<?php
}
?>
<?php wp_nonce_field( 'gutentor_update_term_meta', 'gutentor_term_meta_nonce' ); ?>
<?php
}
public function save_taxonomy_custom_meta( $term_id ) {
if (
isset( $_POST['gutentor_meta'] ) &&
is_array( $_POST['gutentor_meta'] ) &&
! empty( $_POST['gutentor_term_meta_nonce'] ) &&
wp_verify_nonce( $_POST['gutentor_term_meta_nonce'], 'gutentor_update_term_meta' )
) {
$m_value = array();
foreach ( $_POST['gutentor_meta'] as $key => $value ) {
$key = sanitize_key( $key );
switch ( $key ) {
case 'bg-color':
case 'bg-hover-color':
case 'text-color':
case 'text-hover-color':
$m_value[ $key ] = gutentor_sanitize_color( $value );
break;
case 'featured-image':
$m_value[ $key ] = absint( $value );
break;
default:
$m_value[ $key ] = sanitize_text_field( $value );
break;
}
}
update_term_meta( $term_id, 'gutentor_meta', $m_value );
/*backward compatibility*/
if ( get_option( 'gutentor-cat-' . $term_id ) ) {
delete_option( 'gutentor-cat-' . $term_id );
}
}
}
public function add_taxonomy_args( $args, $taxonomy_name ) {
if ( is_array( $this->taxonomies ) &&
in_array( $taxonomy_name, $this->taxonomies )
) {
$args['show_in_rest'] = true;
}
return $args;
}
/**
* Add plugin menu items.
*
* @access public
*
* @since 1.0.0
* @param string[] $actions An array of plugin action links. By default this can include
* 'activate', 'deactivate', and 'delete'. With Multisite active
* this can also include 'network_active' and 'network_only' items.
* @param string $plugin_file Path to the plugin file relative to the plugins directory.
* @param array $plugin_data An array of plugin data. See get_plugin_data()
* and the {@see 'plugin_row_meta'} filter for the list
* of possible values.
* @param string $context The plugin context. By default this can include 'all',
* 'active', 'inactive', 'recently_activated', 'upgrade',
* 'mustuse', 'dropins', and 'search'.
* @return array settings schema for this plugin.
*/
public function add_plugin_links( $actions, $plugin_file, $plugin_data, $context ) {
$actions[] = '<a href="' . esc_url( menu_page_url( 'gutentor', false ) ) . '">' . esc_html__( 'Getting Started', 'gutentor' ) . '</a>';
return $actions;
}
}
}
new Gutentor_Admin();

View File

@@ -0,0 +1,147 @@
<?php
/**
* A helper class for plugin Admin Settings
*
* @since 1.0.0
*/
if ( ! class_exists( 'Gutentor_Helper' ) ) {
/**
* Class Gutentor_Helper.
*/
class Gutentor_Helper {
public static $block_list = array(
'about-block' => 'gutentor/about-block',
'accordion' => 'gutentor/accordion',
'advanced-columns' => 'gutentor/m4',
'author-profile' => 'gutentor/author-profile',
'blog-post' => 'gutentor/blog-post',
'call-to-action' => 'gutentor/call-to-action',
'count-down' => 'gutentor/count-down',
'counter-box' => 'gutentor/counter-box',
'divider' => 'gutentor/divider',
'featured-block' => 'gutentor/featured-block',
'gallery' => 'gutentor/gallery',
'google-map' => 'gutentor/google-map',
'google-map-element' => 'gutentor/e4',
'icon-box' => 'gutentor/icon-box',
'image-box' => 'gutentor/image-box',
'image-slider' => 'gutentor/image-slider',
'list' => 'gutentor/list',
'notification' => 'gutentor/notification',
'opening-hours' => 'gutentor/opening-hours',
'pricing' => 'gutentor/pricing',
'progress-bar' => 'gutentor/progress-bar',
'restaurant-menu' => 'gutentor/restaurant-menu',
'show-more' => 'gutentor/show-more',
'social' => 'gutentor/social',
'tabs' => 'gutentor/tabs',
'team' => 'gutentor/team',
'testimonial' => 'gutentor/testimonial',
'timeline' => 'gutentor/timeline',
'video-popup' => 'gutentor/video-popup',
);
public static function enqueue( $scripts ) {
// Do not enqueue anything if no array is supplied.
if ( ! is_array( $scripts ) ) {
return;
}
$scripts = apply_filters( 'gutentor_block_scripts', $scripts );
foreach ( $scripts as $script ) {
// Do not try to enqueue anything if handler is not supplied.
if ( ! isset( $script['handler'] ) ) {
continue;
}
$version = GUTENTOR_VERSION;
if ( isset( $script['version'] ) ) {
$version = $script['version'];
}
// Enqueue each vendor's style.
if ( isset( $script['style'] ) ) {
$path = GUTENTOR_URL . $script['style'];
if ( isset( $script['absolute'] ) ) {
$path = $script['style'];
}
$dependency = array();
if ( isset( $script['dependency'] ) ) {
$dependency = $script['dependency'];
}
wp_enqueue_style( $script['handler'], $path, $dependency, $version );
}
// Enqueue each vendor's script.
if ( isset( $script['script'] ) ) {
if ( $script['script'] === true || $script['script'] === 1 ) {
wp_enqueue_script( $script['handler'] );
} else {
$prefix = '';
if ( isset( $script['prefix'] ) ) {
$prefix = $script['prefix'];
}
$path = '';
if ( isset( $script['script'] ) ) {
$path = GUTENTOR_URL . $script['script'];
}
if ( isset( $script['absolute'] ) ) {
$path = $script['script'];
}
$dependency = array( 'jquery' );
if ( isset( $script['dependency'] ) ) {
$dependency = $script['dependency'];
}
$in_footer = true;
if ( isset( $script['in_footer'] ) ) {
$in_footer = $script['in_footer'];
}
wp_enqueue_script( $prefix . $script['handler'], $path, $dependency, $version, $in_footer );
}
}
}
}
/**
* Returns an option from the database for
* the admin settings page.
*
* @param string $key The option key.
* @param mixed $default Option default value if option is not available.
* @param boolean $network_override Whether to allow the network admin setting to be overridden on subsites.
* @return string Return the option value
*/
public static function get_option( $key, $default = false, $network_override = false ) {
return gutentor_get_options( $key );
}
/**
* Updates an option from the admin settings page.
*
* @param string $key The option key.
* @param bool $network Whether to allow the network admin setting to be overridden on subsites.
* @return void
*/
public static function update_option( $key, $blocks ) {
$g_options = gutentor_get_options();
$g_options[ $key ] = $blocks;
update_option( 'gutentor_settings_options', $g_options );
}
}
}

View File

@@ -0,0 +1,548 @@
<?php
/**
* Tracking functions for reporting plugin usage to the Engine site for users that have opted in
*
* @package Gutentor
* @subpackage Admin
* @since 3.2.1
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Agent Usage tracking
*
* @since 3.2.1
* @return void
*/
class Gutentor_Tracking {
/**
* @access private
*/
private $slug = '';
private $secret_opt_key = '';
private $last_send_opt_key = '';
private $hide_notice_opt_key = '';
private $agents_opt_key = '';
private $agent_active_opt_key = '';
private $data;
private $api_url = '';
private $remote_url = '';
private $version = '';
/**
* Get things going
* allow-tracking is set from $this->get_opt_data()
* Other from opt key
*
* @since 3.2.1
* @return void
*/
public function __construct() {
/*Changed with the plugin*/
$this->remote_url = trailingslashit( 'https://tracking.acmeit.org' );
$this->slug = GUTENTOR_PLUGIN_NAME;
$this->version = '1.0.0';
/*Changed with the plugin end*/
$this->secret_opt_key = 'agent_secret_key';
$this->last_send_opt_key = 'agent_last_send';
$this->hide_notice_opt_key = 'agent_hide_notice';
$this->agent_active_opt_key = 'is_active_this_track';
$this->agents_opt_key = 'agent_' . md5( $this->remote_url );/*unique per remote url*/
$this->init();
}
/**
* Set up WordPress hooks.
*
* @since 3.2.1
* @return void
*/
public function init() {
add_action( 'init', array( $this, 'schedule_send' ) );
add_action( 'set_gutentor_settings_options', array( $this, 'is_do_post' ) );
add_action( 'admin_init', array( $this, 'do_agents' ) );
add_action( 'admin_init', array( $this, 'do_show_tracking_notice' ) );
add_action( 'admin_notices', array( $this, 'admin_notice' ) );
}
/**
* Update agents.
* Run once in the lifetime.
*
* @since 3.2.1
* @return void
*/
public function do_agents() {
$installed_agents = get_option( $this->agents_opt_key, array() );
if ( isset( $installed_agents[ $this->slug ] ) ) {
return;
}
$installed_agents[ $this->slug ] = $this->version;
$active_agent = $this->get_opt_data( $this->agent_active_opt_key, '' );
if ( ! $active_agent ) {
$active_agent = $this->slug;
} elseif ( is_array( $installed_agents ) && ! empty( $installed_agents ) ) {
$highest_ver = $this->version;
foreach ( $installed_agents as $agent => $agent_ver ) {
if ( version_compare( $agent_ver, $highest_ver ) > 0 ) {
$highest_ver = $agent_ver;
$active_agent = $agent;
}
}
}
gutentor_add_installed_time();
// register this agent locally.
$this->update_opt_data( $this->agent_active_opt_key, $active_agent );
// register agent data globally.
update_option( $this->agents_opt_key, $installed_agents );
}
/**
* Is this active agent
*
* @since 3.2.1
* @return boolean
*/
private function is_active_agent() {
if ( $this->slug == $this->get_opt_data( $this->agent_active_opt_key ) ) {
return true;
}
return false;
}
/**
* Update secret keyy
*
* @since 3.2.1
* @return void
*/
private function update_secret_key( $res ) {
// get secret key from engine.
$get_secret_key = json_decode( $res, true );
$secret_key = 'none';
if ( $get_secret_key && is_array( $get_secret_key ) && isset( $get_secret_key['secret_key'] ) ) {
$secret_key = $get_secret_key['secret_key'];
}
$this->update_opt_data( $this->secret_opt_key, sanitize_text_field( $secret_key ) );
}
/**
* Authorize this site to send data to engine.
* get secret key from engine
* run on agent activation.
*
* @since 3.2.1
* @return void
*/
public function do_handshake() {
$secret_key = $this->get_opt_data( $this->secret_opt_key );
if ( ! empty( $secret_key ) ) {
// secret_key already exists.
// do nothing.
return;
}
// authenticate with engine.
$this->api_url = $this->remote_url . 'wp-json/acme-udp-admin/v1/handshake';
$get_secret_key = $this->do_post( true, true );
$this->update_secret_key( $get_secret_key );
}
/**
* Default Options
*
* @param null
* @return array $advanced_import_default_options
*
* @since 3.2.1
*/
private function default_options() {
return array(
'allow-tracking' => false,
);
}
/**
* Get option.
*
* @since 3.2.1
* @return array
*/
private function get_opt_data( $key = '' ) {
$advanced_import_options = json_decode( get_option( '__gutentor_helper_options' ), true );
$advanced_import_default_options = $this->default_options();
if ( ! empty( $key ) ) {
if ( isset( $advanced_import_options[ $key ] ) ) {
return $advanced_import_options[ $key ];
}
return isset( $advanced_import_default_options[ $key ] ) ? $advanced_import_default_options[ $key ] : '';
} else {
if ( ! is_array( $advanced_import_options ) ) {
$advanced_import_options = array();
}
return array_merge( $advanced_import_default_options, $advanced_import_options );
}
}
/**
* Update options.
*
* @since 3.2.1
* @return array
*/
private function update_opt_data( $key, $val ) {
$helper_options = json_decode( get_option( '__gutentor_helper_options' ), true );
if ( ! is_array( $helper_options ) ) {
$helper_options = array();
}
$helper_options[ $key ] = $val;
update_option(
'__gutentor_helper_options',
wp_json_encode( $helper_options )
);
}
/**
* Gather data to send to engine.
*
* @since 3.2.1
* @return array
*/
private function get_data() {
if ( ! class_exists( 'WP_Debug_Data' ) ) {
include_once ABSPATH . 'wp-admin/includes/class-wp-debug-data.php';
}
// Ensure get_core_updates is available (needed by WP_Debug_Data::debug_data).
if ( ! function_exists( 'get_core_updates' ) ) {
include_once ABSPATH . 'wp-admin/includes/update.php';
}
$data = array();
if ( method_exists( 'WP_Debug_Data', 'debug_data' ) && function_exists( 'get_core_updates' ) ) {
$data['data'] = WP_Debug_Data::debug_data();
} else {
$data['data'] = array();
}
$data['admin_email'] = get_bloginfo( 'admin_email' );
$user = get_user_by( 'email', $data['admin_email'] );
if ( $user && isset( $user->data->user_nicename ) ) {
$data['nicename'] = $user->data->user_nicename;
} else {
$data['nicename'] = 'Unknown';
}
$data['site_url'] = get_bloginfo( 'url' );
$data['version'] = get_bloginfo( 'version' );
$data['sender'] = $this->slug;
return $data;
}
/**
* Setup the data
*
* @access private
*
* @since 3.2.1
* @return void
*/
private function setup_data() {
$data = array();
$data['agent_data'] = maybe_serialize( $this->get_data() );
$data['secret_key'] = $this->get_opt_data( $this->secret_opt_key );
$this->data = $data;
}
/**
* Send the data to the Engine server
*
* @access public
*
* @param bool $override If we should override the tracking setting.
* @param bool $is_handshake If it is just handshake to get secret key.
*
* @since 3.2.1
* @return bool
*/
public function do_post( $override = false, $is_handshake = false ) {
if ( ! $this->get_opt_data( 'allow-tracking' ) && ! $override ) {
return false;
}
/*Send a maximum of once per week*/
$last_send = $this->get_last_send();
if ( is_numeric( $last_send ) && $last_send > strtotime( '-1 week' ) && ! $is_handshake ) {
return false;
}
/*if this agent is not active agent*/
if ( ! $this->is_active_agent() ) {
return false;
}
if ( ! $is_handshake ) {
$this->api_url = $this->remote_url . 'wp-json/acme-udp-admin/v1/process-data';
$this->update_last_send();
}
$this->setup_data();
$response = wp_remote_post(
$this->api_url,
array(
'method' => 'POST',
'timeout' => 45,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'headers' => array(),
'body' => $this->data,
)
);
if ( $is_handshake ) {
return wp_remote_retrieve_body( $response );
} else {
$is_secret_key = json_decode( wp_remote_retrieve_body( $response ), true );
if ( is_array( $is_secret_key ) && isset( $is_secret_key['secret_key'] ) ) {
$this->update_secret_key( wp_remote_retrieve_body( $response ) );
}
}
}
/**
* While user allow the tracking
*
* @since 3.2.1
* @return array
*/
public function is_do_post( $g_options ) {
if ( isset( $g_options['allow_tracking'] ) && $g_options['allow_tracking'] == 1 ) {
$this->do_post( true );
}
return $g_options;
}
/**
* When saving hide tracking notice.
*
* @return void
*/
public function do_show_tracking_notice() {
$this->do_handshake();
// listen for our activate button to be clicked
if ( ! isset( $_GET[ esc_attr( $this->slug ) . '_tracking' ] ) ) {
return;
}
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
/*Security check*/
check_admin_referer( $this->slug );
if ( 1 == $_GET[ esc_attr( $this->slug ) . '_tracking' ] ) {
$this->update_opt_data( 'allow-tracking', true );
$this->do_post( true );
} else {
$this->update_opt_data( 'allow-tracking', false );
}
$this->update_hide_tracking_notice( true );
}
/**
* Schedule a weekly tracking
*
* @return array|false|string
* @since 3.2.1
*/
public function schedule_send() {
if ( isset( $_GET['acmeit_verify_user_secret_key_rand_3022'] ) ) {
die( 'equal' );
}
if ( wp_doing_cron() ) {
add_action( 'gutentor_weekly_scheduled_events', array( $this, 'do_post' ) );
}
}
/**
* Update last send
*
* @since 3.2.1
* @return void
*/
public function update_last_send() {
$this->update_opt_data( $this->last_send_opt_key, time() );
}
/**
* Get last send
*
* @since 3.2.1
* @return string
*/
public function get_last_send() {
return $this->get_opt_data( $this->last_send_opt_key );
}
/**
* Update hide notice
*
* @since 3.2.1
* @return void
*/
public function update_hide_tracking_notice( $val = false ) {
$this->update_opt_data( $this->hide_notice_opt_key, $val );
}
/**
* Get hide notice
*
* @since 3.2.1
* @return boolean
*/
public function get_hide_tracking_notice() {
return $this->get_opt_data( $this->hide_notice_opt_key );
}
/**
* Check if we can show tracking notice to user.
*
* @since 3.2.1
* @return boolean
*/
public function can_show_notice() {
if ( $this->get_opt_data( 'installed_time' ) > strtotime( '-3 day' ) ) {
return false;
}
if ( $this->get_hide_tracking_notice() ) {
return false;
}
if ( $this->get_opt_data( 'allow-tracking' ) ) {
return false;
}
if ( ! current_user_can( 'manage_options' ) ) {
return false;
}
/*if this agent is not active agent*/
if ( ! $this->is_active_agent() ) {
return false;
}
return true;
}
/**
* Get current admin page URL.
*
* Returns an empty string if it cannot generate a URL.
*
* @since 3.2.1
* @return string
*/
private function get_current_admin_url() {
$uri = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
$uri = preg_replace( '|^.*/wp-admin/|i', '', $uri );
if ( ! $uri ) {
return '';
}
return remove_query_arg( array( '_wpnonce' ), admin_url( $uri ) );
}
/**
* Display the admin notice to users.
*
* @return void
* @since 3.2.1
*/
public function admin_notice() {
if ( ! $this->can_show_notice() ) {
return;
}
global $current_user;
$allow_url = wp_nonce_url(
add_query_arg(
array(
esc_attr( $this->slug ) . '_tracking' => 1,
),
$this->get_current_admin_url()
),
$this->slug
);
$not_allow_url = wp_nonce_url(
add_query_arg(
array(
esc_attr( $this->slug ) . '_tracking' => 0,
),
$this->get_current_admin_url()
),
$this->slug
);
?>
<div class="notice updated <?php echo esc_attr( $this->slug ); ?>-track-notice">
<p style="float: left">
<?php
printf(
/* Translators: %1$s current user display name. */
esc_html__(
'Howdy, %1$s! Allow Gutentor to anonymously track how this plugin is used and help us make the plugin better. No sensitive data is tracked.',
'gutentor'
),
'<strong>' . esc_html( $current_user->display_name ) . '</strong>'
);
?>
</p>
<a href="<?php echo esc_url( $allow_url ); ?>" class="btn button-primary">
<span><?php esc_html_e( 'Allow', 'gutentor' ); ?></span>
</a>
<a href="<?php echo esc_url( $not_allow_url ); ?>" class="btn button-link">
<span><?php esc_html_e( 'Do not allow', 'gutentor' ); ?></span>
</a>
</div>
<?php
}
}
global $gutentor_tracking;
$gutentor_tracking = new Gutentor_Tracking();

View File

@@ -0,0 +1,295 @@
<?php
/**
* Do things related with Gutentor settings
*
* @since 3.0.3
*/
if ( ! class_exists( 'Gutentor_Admin_Settings' ) ) {
/**
* Class Gutentor_Admin_Settings.
*/
class Gutentor_Admin_Settings {
protected static $page_slug = 'gutentor-settings';
public function __construct() {
add_action( 'admin_menu', array( __CLASS__, 'admin_pages' ) );
add_action( 'admin_init', array( $this, 'depreciated_settings' ) );
add_filter( 'register_post_type_args', array( $this, 'enable_rest_api' ), 20, 2 );
add_filter( 'use_block_editor_for_post_type', array( $this, 'enable_gutenberg_post_type' ), 999, 2 );
add_action( 'init', array( $this, 'add_page_templates_in_post_types' ), 999 );
}
/**
* Admin Page Menu and submenu page
*
* @since 3.0.3
*/
public static function admin_pages() {
add_submenu_page(
'gutentor',
esc_html__( 'Settings', 'gutentor' ),
esc_html__( 'Settings', 'gutentor' ),
'manage_options',
'gutentor-settings',
array( __CLASS__, 'gutentor_settings_template' )
);
}
/**
* Render Settings Template
*
* @since 3.0.3
*/
public static function gutentor_settings_template() {
require_once GUTENTOR_PATH . 'includes/admin/templates/settings.php';
}
/**
* All existing Settings
* Convert in just one setting
*
* @since 3.1.2
*/
public function depreciated_settings() {
$g_options = gutentor_get_options();
if ( isset( $g_options['options_v_0'] ) ) {
return false;
}
$gutentor_get_options = array();
/*Typography*/
$global_typography = array(
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'body',
'button',
);
foreach ( $global_typography as $gt ) {
$key = 'gutentor-gt-' . esc_attr( $gt );
$gutentor_get_options[ $key ] = gutentor_get_options( $key );
}
/*Global Color*/
$global_color = array(
'btn-txt',
'btn-bg',
'heading',
'body',
'link',
'cat-txt-default',
'cat-bg-default',
);
foreach ( $global_color as $gc ) {
$key = 'gc-' . esc_attr( $gc );
$gutentor_get_options[ $key ] = gutentor_get_options( $key );
}
/*Global Width*/
$global_width = array(
'mobile',
'tablet',
'desktop',
'large',
);
foreach ( $global_width as $gw ) {
$key = 'gutentor-gw-' . esc_attr( $gw );
$gutentor_get_options[ $key ] = gutentor_get_options( $key );
}
/*post format*/
$post_formats = gutentor_get_post_formats();
if ( $post_formats && is_array( $post_formats ) ) {
foreach ( $post_formats as $post_format ) {
$key = 'gutentor-pf-' . esc_attr( $post_format );
$gutentor_get_options[ $key ] = gutentor_get_options( $key );
}
}
$other_options = array(
'gutentor_disable_wide_width_editor',
'gutentor_map_api',
'gutentor_font_awesome_version',
'gutentor_tax_term_color',
'gutentor_tax_term_image',
'gutentor_dynamic_style_location',
'gutentor_color_palatte_options',
'gutentor_color_palatte',
'gutentor_gt_apply_options',
);
foreach ( $other_options as $key ) {
$gutentor_get_options[ $key ] = gutentor_get_options( $key );
}
/*Enabled Disable Blocks*/
$gutentor_get_options['_GUTENTOR_BLOCKS'] = gutentor_get_options( '_GUTENTOR_BLOCKS' );
/*Gutentor color palatte*/
$gutentor_get_options['gutentor_color_palatte'] = gutentor_get_options( 'gutentor_color_palatte' );
foreach ( $gutentor_get_options as $key => $value ) {
delete_option( $key );
if ( 'gutentor_map_api' == $key ) {
$key = 'map-api';
} elseif ( 'gutentor_disable_wide_width_editor' == $key ) {
$key = 'wide-width-editor';
} elseif ( 'gutentor_tax_term_color' == $key && $gutentor_get_options[ $key ] ) {
$key = 'tax-in-color';
$value = array(
'category',
'post_tag',
'product_cat',
'product_tag',
'download_category',
'download_tag',
);
} elseif ( 'gutentor_tax_term_image' == $key && $gutentor_get_options[ $key ] ) {
$key = 'tax-in-image';
$value = array(
'category',
'post_tag',
'product_cat',
'product_tag',
'download_category',
'download_tag',
);
} elseif ( 'gutentor_dynamic_style_location' == $key ) {
$key = 'dynamic-res-location';
} elseif ( 'gutentor_gt_apply_options' == $key ) {
$key = 'typo-apply-options';
} elseif ( 'gutentor_font_awesome_version' == $key ) {
$key = 'fa-version';
} elseif ( 'gutentor_color_palatte_options' == $key ) {
$key = 'color-palette-options';
} elseif ( 'gutentor_color_palatte' == $key ) {
$key = 'color-palettes';
} elseif ( '_GUTENTOR_BLOCKS' == $key ) {
$key = 'off-blocks';
} elseif ( strpos( $key, 'gutentor-pf-' ) !== false ) {
$key = str_replace( 'gutentor-pf-', 'pf-', $key );
} elseif ( strpos( $key, 'gutentor-gt-' ) !== false ) {
$key = str_replace( 'gutentor-gt-', 'gt-', $key );
} elseif ( strpos( $key, 'gutentor-gw-' ) !== false ) {
$key = str_replace( 'gutentor-gw-', 'gw-', $key );
} elseif ( strpos( $key, 'gutentor-gc-' ) !== false ) {
$key = str_replace( 'gutentor-gc-', 'gc-', $key );
}
$g_options[ $key ] = $value;
}
if ( isset( $g_options['gutentor_enable_editor_in_pt'] ) ) {
$g_options['editor-in-pt'] = $g_options['gutentor_enable_editor_in_pt'];
unset( $g_options['gutentor_enable_editor_in_pt'] );
}
if ( isset( $g_options['gutentor_enable_page_templates_in_pt'] ) ) {
$g_options['page-templates-in-pt'] = $g_options['gutentor_enable_page_templates_in_pt'];
unset( $g_options['gutentor_enable_page_templates_in_pt'] );
}
if ( isset( $g_options['gutentor_enable_import_block'] ) ) {
if ( $g_options['gutentor_enable_import_block'] ) {
$g_options['enable-import-block'] = $g_options['gutentor_enable_import_block'];
} else {
$g_options['enable-import-block'] = true;
}
unset( $g_options['gutentor_enable_import_block'] );
}
if ( isset( $g_options['gutentor_enable_export_block'] ) ) {
if ( $g_options['gutentor_enable_export_block'] ) {
$g_options['enable-export-block'] = $g_options['gutentor_enable_export_block'];
} else {
$g_options['enable-export-block'] = true;
}
unset( $g_options['gutentor_enable_export_block'] );
}
if ( isset( $g_options['resource_load'] ) ) {
$g_options['resource-load'] = $g_options['resource_load'];
unset( $g_options['resource_load'] );
}
if ( isset( $g_options['gutentor_enable_edd_demo_url'] ) ) {
$g_options['edd-demo-url'] = $g_options['gutentor_enable_edd_demo_url'];
unset( $g_options['gutentor_enable_edd_demo_url'] );
}
$g_options['options_v_0'] = true;
update_option( 'gutentor_settings_options', $g_options );
}
/**
* Enable rest api post types
*
* @since 3.0.3
*/
public static function enable_rest_api( $args, $post_type ) {
$gutentor_settings = gutentor_get_options();
if ( isset( $gutentor_settings['editor-in-pt'] ) ) {
$gutenberg_enable_post_types = $gutentor_settings['editor-in-pt'];
if ( is_array( $gutenberg_enable_post_types ) &&
in_array( $post_type, $gutenberg_enable_post_types )
) {
$args['show_in_rest'] = true;
}
}
return $args;
}
/**
* Enable Gutenberg Editor in Post Types
*
* @since 3.0.3
*/
public static function enable_gutenberg_post_type( $can_edit, $post_type ) {
$gutentor_settings = gutentor_get_options();
if ( isset( $gutentor_settings['editor-in-pt'] ) ) {
$gutenberg_enable_post_types = $gutentor_settings['editor-in-pt'];
if ( is_array( $gutenberg_enable_post_types ) &&
in_array( $post_type, $gutenberg_enable_post_types ) ) {
return true;
}
}
return $can_edit;
}
/**
* How to add Page Templates to Post or Custom Post Types
* https://www.gutentor.com/documentation/article/how-to-add-page-templates-to-post-or-custom-post-types/
*
* @since 3.0.3
*/
public function add_page_templates_in_post_types() {
$pts = array();
$pts[] = 'page';
$gutentor_settings = gutentor_get_options();
if ( isset( $gutentor_settings['page-templates-in-pt'] ) ) {
$pt = maybe_unserialize( $gutentor_settings['page-templates-in-pt'] );
if ( is_array( $pt ) && ! empty( $pt ) ) {
foreach ( $pt as $p ) {
$pts[] = $p;
}
}
}
if ( ! is_array( $pts ) ) {
return;
}
foreach ( $pts as $p ) {
add_filter( 'theme_' . $p . '_templates', array( gutentor_hooks(), 'gutentor_add_page_template' ) );
}
if ( in_array( 'page', $pts ) ) {
add_filter( 'page_template', array( gutentor_hooks(), 'gutentor_redirect_page_template' ), 999 );
}
if ( count( array_diff( $pts, array( 'page' ) ) ) > 0 ) {
add_filter( 'single_template', array( gutentor_hooks(), 'gutentor_redirect_page_template' ), 999 );
}
}
}
}
new Gutentor_Admin_Settings();

View File

@@ -0,0 +1,213 @@
<div class="gutentor-plugin-landing-page">
<section class="gutentor-plugin-banner">
<div class="gutentor-plugin-header">
<h2 class="gutentor-plugin-header-title"><?php esc_html_e( 'Gutentor - WordPress Page Building Blocks', 'gutentor' ); ?></h2>
<p><?php esc_html_e( 'Advanced yet easy drag & drop WordPress block page builder. Create masterpiece, pixel perfect websites using modern WordPress way. Work with any theme, create any design.', 'gutentor' ); ?></p>
<a href="https://www.gutentor.com/documentation/" target="_blank" class="btn btn-primary"><span class="dashicons dashicons-media-document"></span><?php echo esc_html__( 'Documentation', 'gutentor' ); ?></a>
<a href="https://www.demo.gutentor.com" target="_blank" class="btn btn-primary"><span class="dashicons dashicons-visibility"></span><?php echo esc_html__( 'Gutentor Demo', 'gutentor' ); ?></a>
</div>
</section>
<div class="gutentor-plugin-list">
<div class="gutentor-tab">
<div class="gutentor-container">
<div class="gutentor-row">
<div class="gutentor-tab-list">
<span id="gutentor-admin-element-tab" class="tablist-item tablist-item-active"><?php esc_html_e( 'Elements', 'gutentor' ); ?></span>
<span id="gutentor-admin-module-tab" class="tablist-item"><?php esc_html_e( 'Modules', 'gutentor' ); ?></span>
<span id="gutentor-admin-post-tab" class="tablist-item"><?php esc_html_e( 'Posts', 'gutentor' ); ?></span>
<span id="gutentor-admin-term-tab" class="tablist-item"><?php esc_html_e( 'Terms', 'gutentor' ); ?></span>
<span id="gutentor-admin-widget-tab" class="tablist-item"><?php esc_html_e( 'Widgets', 'gutentor' ); ?></span>
</div>
</div>
</div>
</div>
<div class="gutentor-tab-wrapper">
<section class="gutentor-tab-content gutentor-admin-element-content gutentor-active ">
<div class="gutentor-container">
<div class="gutentor-row">
<?php
$contents = Gutentor_Admin::elements();
foreach ( $contents as $block_id => $content ) :
?>
<div class="col">
<div class="plugin-box">
<h3><?php echo esc_html( $content['title'] ); ?></h3>
<p>
<?php echo esc_html( $content['description'] ); ?>
</p>
<div class="onoffswitch">
<?php
$status = Gutentor_Admin::is_block_active( $block_id );
$cls = $status ? 'enabled' : 'disabled';
?>
<input
name="onoffswitch"
id="myonoffswitch3"
type="checkbox"
data-action="<?php echo esc_attr( $block_id ); ?>"
class="onoffswitch-checkbox <?php echo esc_attr( $cls ); ?>"
<?php checked( $status, true ); ?>
>
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</section>
<section class="gutentor-tab-content gutentor-admin-module-content">
<div class="gutentor-container">
<div class="gutentor-row">
<?php
$contents = Gutentor_Admin::modules();
foreach ( $contents as $block_id => $content ) :
?>
<div class="col">
<div class="plugin-box">
<h3><?php echo esc_html( $content['title'] ); ?></h3>
<p>
<?php echo esc_html( $content['description'] ); ?>
</p>
<div class="onoffswitch">
<?php
$status = Gutentor_Admin::is_block_active( $block_id );
$cls = $status ? 'enabled' : 'disabled';
?>
<input
name="onoffswitch"
id="myonoffswitch3"
type="checkbox"
data-action="<?php echo esc_attr( $block_id ); ?>"
class="onoffswitch-checkbox <?php echo esc_attr( $cls ); ?>"
<?php checked( $status, true ); ?>
>
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</section>
<section class="gutentor-tab-content gutentor-admin-post-content">
<div class="gutentor-container">
<div class="gutentor-row">
<?php
$contents = Gutentor_Admin::posts();
foreach ( $contents as $block_id => $content ) :
?>
<div class="col">
<div class="plugin-box">
<h3><?php echo esc_html( $content['title'] ); ?></h3>
<p>
<?php echo esc_html( $content['description'] ); ?>
</p>
<div class="onoffswitch">
<?php
$status = Gutentor_Admin::is_block_active( $block_id );
$cls = $status ? 'enabled' : 'disabled';
?>
<input
name="onoffswitch"
id="myonoffswitch3"
type="checkbox"
data-action="<?php echo esc_attr( $block_id ); ?>"
class="onoffswitch-checkbox <?php echo esc_attr( $cls ); ?>"
<?php checked( $status, true ); ?>
>
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</section>
<section class="gutentor-tab-content gutentor-admin-term-content">
<div class="gutentor-container">
<div class="gutentor-row">
<?php
$contents = Gutentor_Admin::terms();
foreach ( $contents as $block_id => $content ) :
?>
<div class="col">
<div class="plugin-box">
<h3><?php echo esc_html( $content['title'] ); ?></h3>
<p>
<?php echo esc_html( $content['description'] ); ?>
</p>
<div class="onoffswitch">
<?php
$status = Gutentor_Admin::is_block_active( $block_id );
$cls = $status ? 'enabled' : 'disabled';
?>
<input
name="onoffswitch"
id="myonoffswitch3"
type="checkbox"
data-action="<?php echo esc_attr( $block_id ); ?>"
class="onoffswitch-checkbox <?php echo esc_attr( $cls ); ?>"
<?php checked( $status, true ); ?>
>
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</section>
<section class="gutentor-tab-content gutentor-admin-widget-content">
<div class="gutentor-container">
<div class="gutentor-row">
<?php
$contents = Gutentor_Admin::content();
foreach ( $contents as $block_id => $content ) :
?>
<div class="col">
<div class="plugin-box">
<h3><?php echo esc_html( $content['title'] ); ?></h3>
<p>
<?php echo esc_html( $content['description'] ); ?>
</p>
<div class="onoffswitch">
<?php
$status = Gutentor_Admin::is_block_active( $block_id );
$cls = $status ? 'enabled' : 'disabled';
?>
<input
name="onoffswitch"
id="myonoffswitch3"
type="checkbox"
data-action="<?php echo esc_attr( $block_id ); ?>"
class="onoffswitch-checkbox <?php echo esc_attr( $cls ); ?>"
<?php checked( $status, true ); ?>
>
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</section>
</div>
</div>
</div>

View File

@@ -0,0 +1,161 @@
<main class="gutentor-get-started-landing-page">
<section class="gutentor-plugin-banner gutentor-get-started-header">
<div class="container">
<div class="gutentor-plugin-header">
<h2 class="gutentor-plugin-header-title">
<?php esc_html_e( 'Getting Started To Gutentor', 'gutentor' ); ?>
</h2>
<h4>
<?php esc_html_e( 'WordPress Page Building Blocks', 'gutentor' ); ?>
</h4>
<a href="https://www.youtube.com/watch?v=bGMi7L78hVk" class="btn btn-primary gutentor-getting-started-watch-video">
<?php esc_html_e( 'Intro Video', 'gutentor' ); ?>
<span class="dashicons dashicons-controls-play"></span>
</a>
<a href="https://www.youtube.com/channel/UCkPtdikwcTsBhJknaa6r10w" class="btn btn-primary" target="_blank">
<?php esc_html_e( 'Video Tutorials', 'gutentor' ); ?>
<span class="dashicons dashicons-controls-play"></span>
</a>
</div>
</div>
</section>
<article class="gutentor-get-started">
<section>
<div class="container">
<div class="col col-image">
<img src="<?php echo esc_url( GUTENTOR_URL . 'assets/img/admin/page-post.png' ); ?>">
</div>
<div class="col">
<div class="gutentor-get-started-content">
<h3><?php esc_html_e( '1. Add New Page/Post', 'gutentor' ); ?></h3>
<p><?php esc_html_e( 'Here is the steps to add page/post in WordPress', 'gutentor' ); ?></p>
<h4><?php esc_html_e( 'Adding Page', 'gutentor' ); ?></h4>
<ul>
<li><?php esc_html_e( 'Go to Pages => Add New', 'gutentor' ); ?></li>
<li><?php esc_html_e( 'OR', 'gutentor' ); ?> <a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=page' ) ); ?>" target="_blank"><?php esc_html_e( 'Click here', 'gutentor' ); ?></a></li>
</ul>
<h4><?php esc_html_e( 'Adding Post', 'gutentor' ); ?></h4>
<ul>
<li><?php esc_html_e( 'Go to Posts => Add New', 'gutentor' ); ?></li>
<li><?php esc_html_e( 'OR', 'gutentor' ); ?> <a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=post' ) ); ?>" target="_blank"><?php esc_html_e( 'Click here', 'gutentor' ); ?></a></li>
</ul>
</div>
</div>
</div>
</section>
<section>
<div class="container">
<div class="col col-image">
<img src="<?php echo esc_url( GUTENTOR_URL . 'assets/img/admin/template-library.png' ); ?>">
</div>
<div class="col">
<div class="gutentor-get-started-content">
<h3><?php esc_html_e( '2. Import Template Library or Add New Blocks', 'gutentor' ); ?></h3>
<p><?php esc_html_e( 'From Edit screen of page/post, you can easily import Beautiful Templates', 'gutentor' ); ?></p>
<h4><?php esc_html_e( 'Import template library', 'gutentor' ); ?></h4>
<ul>
<li>
<?php esc_html_e( 'At the top of page/post edit Screen, click on “Template Library”', 'gutentor' ); ?>
<ul>
<li><strong><?php esc_html_e( 'Blocks: ', 'gutentor' ); ?></strong><?php esc_html_e( 'Search and Import Elegant Blocks', 'gutentor' ); ?></li>
<li><strong><?php esc_html_e( 'Templates: ', 'gutentor' ); ?></strong><?php esc_html_e( 'Import Beautiful Stunning Templates', 'gutentor' ); ?></li>
<li><strong><?php esc_html_e( 'File: ', 'gutentor' ); ?></strong><?php esc_html_e( 'Import Demo Data from JSON file', 'gutentor' ); ?></li>
</ul>
</li>
</ul>
<h4><?php esc_html_e( 'To add fresh block follow below steps', 'gutentor' ); ?></h4>
<ul>
<li><?php esc_html_e( 'At the top left corner of the page/post edit Screen, click on Sign', 'gutentor' ); ?><span class="dashicons dashicons-plus"></span></li>
<li><?php esc_html_e( 'Type Block name in search bar, if you already know the block name.', 'gutentor' ); ?></li>
<li><?php esc_html_e( 'OR Scroll down and navigate to Gutentor section and Add New Block.', 'gutentor' ); ?></li>
</ul>
</div>
</div>
</div>
</section>
<section>
<div class="container">
<div class="col col-image">
<img src="<?php echo esc_url( GUTENTOR_URL . 'assets/img/admin/start-designing.png' ); ?>" />
</div>
<div class="col">
<div class="gutentor-get-started-content">
<h3><?php esc_html_e( '3. Start Designing', 'gutentor' ); ?></h3>
<p>
<?php
printf(
// translators: %1$s is the HTML opening tag for a strong element, %2$s is the closing tag for a strong element.
esc_html__( 'Gutentor blocks are divided into element,module,post,term and widget. Visit %1$s Dashboard: Gutentor=>Blocks %2$s indepth understanding of gutentor blocks classification.', 'gutentor' ),
'<strong>',
'</strong>'
);
?>
</p>
<p><?php esc_html_e( 'After Adding a Block (element/module/post/term) in the editor, It is ready to Design', 'gutentor' ); ?></p>
<ul>
<li><strong><?php esc_html_e( 'General: ', 'gutentor' ); ?></strong><?php esc_html_e( 'It consists set of options to design blocks. e.g color, typography, margin, padding and so on.', 'gutentor' ); ?></li>
<li><strong><?php esc_html_e( 'Advanced: ', 'gutentor' ); ?></strong><?php esc_html_e( 'It consists of set of Advanced Setting which effect whole Block Section.', 'gutentor' ); ?></li>
</ul>
</div>
</div>
</div>
</section>
<section>
<div class="container">
<div class="col col-image">
<img src="<?php echo esc_url( GUTENTOR_URL . 'assets/img/admin/widget-designing.png' ); ?>">
</div>
<div class="col">
<div class="gutentor-get-started-content">
<h3><?php esc_html_e( '4. Designing Widget', 'gutentor' ); ?></h3>
<p><?php esc_html_e( 'After Adding a Block in the editor, It is ready to Design', 'gutentor' ); ?></p>
<p>
<?php
printf(
// translators: %1$s is the HTML opening tag for a strong element, %2$s is the closing tag for a strong element.
esc_html__( 'At right sidebar of Edit screen, there are Document and Block Tabs, under %1$s Block Tab %2$s, you will find setting to respective block.', 'gutentor' ),
'<strong>',
'</strong>'
);
?>
</p>
<ul>
<li>
<strong><?php esc_html_e( 'General', 'gutentor' ); ?></strong>
<ul>
<li><strong><?php esc_html_e( 'Block Title: ', 'gutentor' ); ?></strong><?php esc_html_e( 'Setting related to block title.', 'gutentor' ); ?></li>
<li><strong><?php esc_html_e( 'Block Items: ', 'gutentor' ); ?></strong><?php esc_html_e( 'It is Main part of block setting which consist of 3 tabs like general, style and advanced.', 'gutentor' ); ?>
<ul>
<li><strong><?php esc_html_e( 'General: ', 'gutentor' ); ?></strong><?php esc_html_e( 'It consists functional setting like select, enable and disable the features of the block. ', 'gutentor' ); ?></li>
<li><strong><?php esc_html_e( 'Style: ', 'gutentor' ); ?></strong><?php esc_html_e( 'Style tabs consists of different styling setting of the block item.', 'gutentor' ); ?></li>
<li><strong><?php esc_html_e( 'Advanced: ', 'gutentor' ); ?></strong><?php esc_html_e( 'It consists of margin/padding and animation setting of block items.', 'gutentor' ); ?></li>
</ul>
</li>
</ul>
</li>
<li><strong><?php esc_html_e( 'Advanced: ', 'gutentor' ); ?></strong><?php esc_html_e( 'It consists of set of Advanced Setting which effect whole Block Section.', 'gutentor' ); ?></li>
</ul>
</div>
</div>
</div>
</section>
</article>
<footer class="gutentor-get-started-footer">
<a href="https://www.gutentor.com/documentation/" target="_blank" class="btn btn-primary">
<span class="dashicons dashicons-media-document"></span>
<?php esc_html_e( 'Documentation', 'gutentor' ); ?>
</a>
<a href="https://www.demo.gutentor.com" target="_blank" class="btn btn-primary">
<span class="dashicons dashicons-visibility"></span>
<?php esc_html_e( 'Gutentor Demo', 'gutentor' ); ?>
</a>
<a href="https://templateberg.com/gutenberg-templates/" target="_blank" class="btn btn-primary">
<span class="dashicons dashicons-screenoptions"></span>
<?php esc_html_e( 'Gutenberg Templates', 'gutentor' ); ?>
</a>
</footer>
</main>

View File

@@ -0,0 +1,2 @@
<?php
echo "<div id='gutentor-admin-settings'></div>";

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,859 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Block_Hooks' ) ) {
/**
* Block Specific Hooks Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Block_Hooks {
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @return object
* @since 2.0.0
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Add Shape Array
*
* @access public
* @return array
* @since 2.0.0
*/
public function blockShapeDividerSvgArray() {
$shape = array(
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none"><path d="M0,6V0H1000V100Z" transform="translate(0 0)"></path></svg>',
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none"><path d="M0,22.3V0H1000V100Z" transform="translate(0 0)" style="opacity:0.66"></path><path d="M0,6V0H1000V100Z" transform="translate(0 0)"></path></svg>',
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 84.94" preserveAspectRatio="none"><path d="M0,0V72.94c14.46,5.89,32.38,10.5,54.52.26,110.25-51,120.51,23.71,192.6-4.3,144.73-56.23,154.37,49.44,246.71,4.64C637,4.05,622.19,124.16,757.29,66.21c93-39.91,108.38,54.92,242.71-8.25V0Z" style="fill-rule:evenodd;opacity:0.33"></path><path d="M0,0V52.83c131.11,59.9,147-32.91,239.24,6.65,135.09,58,120.24-62.16,263.46,7.34,92.33,44.8,102-60.88,246.71-4.64,72.1,28,82.35-46.71,192.6,4.3,23.95,11.08,43,4.78,58-1.72V0Z" style="fill-rule:evenodd;opacity:0.66"></path><path d="M0,0V24.26c15.6,6.95,35.77,15.41,61.78,3.38,110.25-51,120.51,23.71,192.6-4.3C399.11-32.89,408.75,72.79,501.08,28,644.3-41.51,629.45,78.6,764.54,20.65,855.87-18.53,872.34,72.12,1000,15.7V0Z" style="fill-rule:evenodd"></path></svg>',
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 99" preserveAspectRatio="none"><path d="M526.35,17.11C607.41,28.38,687,48.17,768.06,59.5A1149.19,1149.19,0,0,0,1000,68.07V0H0V99C155.18,13.84,347.42-7.77,526.35,17.11Z" transform="translate(0 0.04)"></path></svg>',
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none"><path class="st0" d="M499.9,51"></path><path class="st1" d="M0,1v94.2c256.7-171,917.3-15.6,1000,4.8V1H0z"></path><path d="M0,100h1.3C273.1-106.1,1000,77.4,1000,77.4V0H0V100z"></path></svg>',
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 100" preserveAspectRatio="none"><polygon points="0,0 0,46.7 40.7,23.4 82.5,47.2 124.2,23.4 166,47.2 207.7,23.4 249.4,47.2 291.2,23.4 332.9,47.2 374.7,23.4 416.4,47.2 458.1,23.4 499.9,47.2 541.6,23.4 583.4,47.2 625.1,23.4 666.9,47.2 708.6,23.4 750.3,47.2 792.1,23.4 833.8,47.2 875.6,23.4 917.3,47.2 959,23.4 1000,46.8 1000,0 "></polygon><path class="st0" d="M499.9,51"></path></svg>',
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1920 435" preserveAspectRatio="none"><path class="path1" d="M1920,435.1H0V49c32.8,32,92.7,82.1,180,108.3C486.8,249.6,554.4-28.5,918,9.1C1152.9,33.4,1328.5,180,1602,176 c137.7-2,248.9-43,318-75C1920,229.7,1920,306.4,1920,435.1z" style="fill-rule:evenodd;opacity:0.33; transform: rotate(180deg); transform-origin:50% 50%;" ></path><path class="path2" d="M1920,288.1c-228,42-357.8,100.5-489,54c-254.1-90-325.1-324.6-603-315C619.8,34.3,532.8,150,280.5,228.8 c-136.7,42.7-178-42.7-280.5-48.6v255h1920V288.1z" style="fill-rule:evenodd;opacity:0.66; transform: rotate(180deg); transform-origin:50% 50%;"></path><path class="path3" d="M1920,435.1H0v-215c81,5,135,77,243,41c199.3-66.4,294.5-143.1,405-162c315-54,384.2,131.1,585,207 c165,62.4,385,129,687-120C1920,236.1,1920,385.1,1920,435.1z" style="fill-rule:evenodd; transform: rotate(180deg); transform-origin:50% 50%;"></path></svg>',
'<svg width="100%" viewBox="0 0 1280 86" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><g><path d="M1280 66.1c-3.8 0-7.6.3-11.4.8-18.3-32.6-59.6-44.2-92.2-25.9-3.5 2-6.9 4.3-10 6.9-22.7-41.7-74.9-57.2-116.6-34.5-14.2 7.7-25.9 19.3-33.8 33.3-.2.3-.3.6-.5.8-12.2-1.4-23.7 5.9-27.7 17.5-11.9-6.1-25.9-6.3-37.9-.6-21.7-30.4-64-37.5-94.4-15.7-12.1 8.6-21 21-25.4 35.2-10.8-9.3-24.3-15-38.5-16.2-8.1-24.6-34.6-38-59.2-29.9-14.3 4.7-25.5 16-30 30.3-4.3-1.9-8.9-3.2-13.6-3.8-13.6-45.5-61.5-71.4-107-57.8a86.38 86.38 0 0 0-43.2 29.4c-8.7-3.6-18.7-1.8-25.4 4.8-23.1-24.8-61.9-26.2-86.7-3.1-7.1 6.6-12.5 14.8-15.9 24-26.7-10.1-56.9-.4-72.8 23.3-2.6-2.7-5.6-5.1-8.9-6.9-.4-.2-.8-.4-1.2-.7-.6-25.9-22-46.4-47.9-45.8-11.5.3-22.5 4.7-30.9 12.5-16.5-33.5-57.1-47.3-90.6-30.8-21.9 11-36.3 32.7-37.6 57.1-7-2.3-14.5-2.8-21.8-1.6C84.8 47 55.7 40.7 34 54.8c-5.6 3.6-10.3 8.4-13.9 14-6.6-1.7-13.3-2.6-20.1-2.6-.1 0 0 19.8 0 19.8h1280V66.1z" fill-opacity=".5" style="fill-rule:evenodd; transform: rotate(180deg); transform-origin:50% 50%;"/><path d="M15.6 86H1280V48.5c-3.6 1.1-7.1 2.5-10.4 4.4-6.3 3.6-11.8 8.5-16 14.5-8.1-1.5-16.4-.9-24.2 1.7-3.2-39-37.3-68.1-76.4-64.9-24.8 2-46.8 16.9-57.9 39.3-19.9-18.5-51-17.3-69.4 2.6-8.2 8.8-12.8 20.3-13.1 32.3-.4.2-.9.4-1.3.7-3.5 1.9-6.6 4.4-9.4 7.2-16.6-24.9-48.2-35-76.2-24.4-12.2-33.4-49.1-50.6-82.5-38.4-9.5 3.5-18.1 9.1-25 16.5-7.1-6.9-17.5-8.8-26.6-5-30.4-39.3-87-46.3-126.2-15.8-14.8 11.5-25.6 27.4-31 45.4-4.9.6-9.7 1.9-14.2 3.9-8.2-25.9-35.8-40.2-61.7-32-15 4.8-26.9 16.5-31.8 31.5-14.9 1.3-29 7.2-40.3 17-11.5-37.4-51.2-58.4-88.7-46.8-14.8 4.6-27.7 13.9-36.7 26.5-12.6-6-27.3-5.7-39.7.6-4.1-12.2-16.2-19.8-29-18.4-.2-.3-.3-.6-.5-.9-24.4-43.3-79.4-58.6-122.7-34.2-13.3 7.5-24.4 18.2-32.4 31.2C99.8 18.5 50 28.5 25.4 65.4c-4.3 6.4-7.5 13.3-9.8 20.6z" style="fill-rule:evenodd; transform: rotate(180deg); transform-origin:50% 50%;"/></g></svg>',
'<svg width="100%" height="300px" viewBox="0 0 1280 140" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><g><path d="M853.893,86.998c-38.859,0-58.811-16.455-77.956-35.051c18.295-10.536,40.891-18.276,73.378-18.276 c38.685,0,64.132,12.564,85.489,28.347C916.192,72.012,900.8,86.998,853.893,86.998z M526.265,80.945 c-6.517-0.562-13.599-0.879-21.41-0.879c-70.799,0-91.337,27.229-134.433,35.662c14.901,3.72,32.118,6.07,52.898,6.07 C470.171,121.797,500.34,103.421,526.265,80.945z" fill-opacity=".3" style="fill-rule:evenodd; transform: rotate(180deg); transform-origin:50% 50%;"/><path d="M663.458,109.671c-67.137,0-80.345-23.824-137.193-28.726C567.086,45.555,597.381,0,665.691,0 c61.857,0,85.369,27.782,110.246,51.947C736.888,74.434,717.459,109.671,663.458,109.671z M217.68,94.163 c55.971,0,62.526,24.026,126.337,24.026c9.858,0,18.508-0.916,26.404-2.461c-57.186-14.278-80.177-48.808-138.659-48.808 c-77.063,0-99.96,48.569-151.751,48.569c-40.006,0-60.008-12.206-80.011-29.506v16.806c20.003,10.891,40.005,21.782,80.011,21.782 C160.014,124.57,158.608,94.163,217.68,94.163z M1200.112,46.292c-57.493,0-56.935,46.595-115.015,46.595 c-53.612,0-59.755-39.618-115.602-39.618c-15.267,0-25.381,3.751-34.69,8.749c36.096,26.675,60.503,62.552,117.342,62.552 c69.249,0,75.951-43.559,147.964-43.559c39.804,0,59.986,10.943,79.888,21.777V85.982 C1260.097,68.771,1239.916,46.292,1200.112,46.292z" fill-opacity=".5" style="fill-rule:evenodd; transform: rotate(180deg); transform-origin:50% 50%;"/><path d="M1052.147,124.57c-56.84,0-81.247-35.876-117.342-62.552c-18.613,9.994-34.005,24.98-80.912,24.98 c-38.859,0-58.811-16.455-77.956-35.051c-39.05,22.487-58.479,57.724-112.48,57.724c-67.137,0-80.345-23.824-137.193-28.726 c-25.925,22.475-56.093,40.852-102.946,40.852c-20.779,0-37.996-2.349-52.898-6.07c-7.895,1.545-16.546,2.461-26.404,2.461 c-63.811,0-70.366-24.026-126.337-24.026c-59.072,0-57.665,30.407-137.669,30.407c-40.006,0-60.008-10.891-80.011-21.782V140h1280 v-37.212c-19.903-10.835-40.084-21.777-79.888-21.777C1128.098,81.011,1121.397,124.57,1052.147,124.57z" style="fill-rule:evenodd; transform: rotate(180deg); transform-origin:50% 50%;"/></g></svg>',
'<svg viewBox="0 0 1280 140" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><g><path d="M0 140h1280C573.08 140 0 0 0 0z" style="transform: rotate(180deg); transform-origin:50% 50%;"/></g></svg>',
'<svg viewBox="0 0 1280 140" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><g><path d="M0 51.76c36.21-2.25 77.57-3.58 126.42-3.58 320 0 320 57 640 57 271.15 0 312.58-40.91 513.58-53.4V0H0z" fill-opacity=".3" style="fill-rule:evenodd;"/><path d="M0 24.31c43.46-5.69 94.56-9.25 158.42-9.25 320 0 320 89.24 640 89.24 256.13 0 307.28-57.16 481.58-80V0H0z" fill-opacity=".5" style="fill-rule:evenodd; "/><path d="M0 0v3.4C28.2 1.6 59.4.59 94.42.59c320 0 320 84.3 640 84.3 285 0 316.17-66.85 545.58-81.49V0z" style="fill-rule:evenodd; "/></g></svg>',
'<svg version="1.1" x="0px" y="0px" viewBox="0 0 240 24" xml:space="preserve" preserveAspectRatio="none"><path d="M138.75,22.41c-5.43,0.619-12.363-0.09-18.125-1.27c-5.654-1.19-17.017-5.711-24.116-8.642 C78.34,4.689,64.438,1.708,50.312,0.429c-5.664-0.5-11.685-0.84-24.814,0.62C12.358,2.499,0,7.249,0,7.249V24h240v-7.34 c0,0-17.285-7.921-38.018-7.381c-9.404,0.17-22.275,1.61-32.158,5.442c-5.098,1.959-12.539,4.409-19.121,5.879 C144.17,22.061,141.191,22.17,138.75,22.41z" style="transform: rotate(180deg); transform-origin:50% 50%;"></path></svg>',
'<svg viewBox="0 0 1280 140" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><g><path d="M0 47.44L170 0l626.48 94.89L1110 87.11l170-39.67V140H0V47.44z" fill-opacity=".5" style="fill-rule:evenodd; transform: rotate(180deg); transform-origin:50% 50%;"/><path d="M0 90.72l140-28.28 315.52 24.14L796.48 65.8 1140 104.89l140-14.17V140H0V90.72z" style="fill-rule:evenodd; transform: rotate(180deg); transform-origin:50% 50%;"/></g></svg>',
'<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100" viewBox="0 0 100 100" preserveAspectRatio="none"><path d="M0 100 C40 0 60 0 100 100 Z" style="transform: rotate(180deg); transform-origin:50% 50%;"></path></svg>',
'<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100" preserveAspectRatio="none"><path d="M0 100 C 20 0 50 0 100 100 Z" style="transform: rotate(180deg); transform-origin:50% 50%;"></path></svg>',
'<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100" viewBox="0 0 100 102" preserveAspectRatio="none"><path d="M0 0 L50 100 L100 0 Z" style="transform: rotate(180deg); transform-origin:50% 50%;"></path></svg>',
'<svg viewBox="0 0 1280 140" xmlns="http://www.w3.org/2000/svg"><path d="M0 0l64.8 30.95 91.2-2.54 95.46 27.87 120.04.2L443 83.15l90.09-3.12L640 110.12l102.39-29.73 85.55 8.51 88.11-5.75L992 52.22l73.21 4.26L1132 38.79l77-.33L1280 0v140H0V0z" fill-opacity=".5" style="fill-rule:evenodd; transform: rotate(180deg); transform-origin:50% 50%;"/><path d="M0 0l64.8 38.69 91.2-3.18 95.46 34.84 120.04.24 71.5 33.35 90.09-3.91L640 137.65l102.39-37.17 85.55 10.65 88.11-7.19L992 65.28l73.21 5.31 66.79-22.1 77-.41L1280 0v140H0V0z" style="fill-rule:evenodd; transform: rotate(180deg); transform-origin:50% 50%;"/></svg>',
'<svg width="100%" height="250px" viewBox="0 0 1280 140" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><path d="M1280 0l-266 91.52a72.59 72.59 0 0 1-30.76 3.71L0 0v140h1280z" fill-opacity=".5" style="fill-rule:evenodd; transform: rotate(180deg); transform-origin:50% 50%;"/><path d="M1280 0l-262.1 116.26a73.29 73.29 0 0 1-39.09 6L0 0v140h1280z" style="fill-rule:evenodd; transform: rotate(180deg); transform-origin:50% 50%;"/></svg>',
'<svg width="100%" height="100px" viewBox="0 0 1280 140" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 140h1280C573.08 140 0 0 0 0z" fill-opacity=".3" style="fill-rule:evenodd; transform: rotate(180deg); transform-origin:50% 50%;"/><path d="M0 140h1280C573.08 140 0 30 0 30z" fill-opacity=".5" style="fill-rule:evenodd; transform: rotate(180deg); transform-origin:50% 50%;"/><path d="M0 140h1280C573.08 140 0 60 0 60z" style="fill-rule:evenodd; transform: rotate(180deg); transform-origin:50% 50%;"/></svg>',
);
return apply_filters( 'gutentor_shape_list', $shape );
}
/**
* Add Filter
*
* @access public
* @return void
* @since 2.0.0
*/
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
add_filter( $hook, array( $component, $callback ), $priority, $accepted_args );
}
/**
* Add Action
*
* @access public
* @return void
* @since 2.0.0
*/
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
add_action( $hook, array( $component, $callback ), $priority, $accepted_args );
}
/**
* Run Block
*
* @access public
* @return void
* @since 2.0.0
*/
public function run() {
/*Block Specific PHP hooks*/
$this->add_filter( 'gutentor_save_element_class', $this, 'add_element_google_map_section_classes', 10, 2 );
$this->add_filter( 'gutentor_save_section_class', $this, 'add_section_classes', 10, 2 );
$this->add_filter( 'gutentor_save_section_class', $this, 'added_content_align_classes', 10, 2 );
$this->add_filter( 'gutentor_save_before_container', $this, 'addAdvancedVideoOutput', 10, 2 );
$this->add_filter( 'gutentor_save_section_class', $this, 'add_animation_class', 15, 2 );
$this->add_filter( 'gutentor_save_container_class', $this, 'add_container_remove_space_classes', 15, 2 );
$this->add_filter( 'gutentor_save_grid_row_class', $this, 'add_row_remove_space_classes', 15, 2 );
$this->add_filter( 'gutentor_save_grid_column_class', $this, 'add_column_remove_space_classes', 15, 2 );
$this->add_filter( 'gutentor_save_before_container', $this, 'addAdvancedBlockShapeTop', 15, 2 );
$this->add_filter( 'gutentor_save_after_container', $this, 'addAdvancedBlockShapeBottom', 15, 2 );
$this->add_filter( 'gutentor_save_grid_row_class', $this, 'add_item_wrap_animation_class', 15, 2 );
$this->add_filter( 'gutentor_save_item_image_display_data', $this, 'add_link_to_post_thumbnails', 15, 3 );
$this->add_filter( 'gutentor_save_grid_column_class', $this, 'add_column_class', 10, 2 );
$this->add_filter( 'gutentor_save_before_block_items', $this, 'add_block_save_header', 10, 2 );
$this->add_filter( 'gutentor_save_link_attr', $this, 'addButtonLinkAttr', 10, 3 );
$this->add_filter( 'gutentor_edit_post_module_readmore_button_data', $this, 'addButtonWrap', 10, 3 );
$this->add_filter( 'gutentor_save_block_header_data', $this, 'gutentor_heading_title', 10, 2 );
$this->add_filter( 'gutentor_save_grid_column_class', $this, 'addingBlogStyleOptionsClass', 15, 2 );
$this->add_filter( 'gutentor_post_module_product_button_class', $this, 'addingProductButtonWrap', 10, 3 );
$this->add_filter( 'gutentor_post_module_download_button_class', $this, 'addingProductButtonWrap', 10, 3 );
$this->add_filter( 'gutentor_edit_enable_column', $this, 'remove_column_class_blog_post', 8, 2 );
/*Get dynamic CSS location*/
$this->add_filter( 'gutentor_dynamic_style_location', $this, 'get_dynamic_style_location' );
}
/**
* Adding Google Map Section Classes
*
* @param {array} output
* @param {object} props
* @return {array}
*/
public function add_element_google_map_section_classes( $output, $attributes ) {
if ( $attributes['gName'] != 'gutentor/e4' ) {
return $output;
}
$local_data = '';
$elementAnimation = isset( $attributes['eAnimation'] ) ? $attributes['eAnimation'] : '';
$animation_class = ( $elementAnimation && array_key_exists( 'Animation', $attributes['eAnimation'] ) && $attributes['eAnimation']['Animation'] && 'none' != $attributes['eAnimation']['Animation'] ) ? gutentor_concat_space( 'wow animated ', $attributes['eAnimation']['Animation'] ) : '';
$local_data = gutentor_concat_space( $local_data, $animation_class );
/*Section Enable Position*/
$enable_position = ( $attributes['eOnPos'] ) ? $attributes['eOnPos'] : false;
if ( $enable_position ) {
/*Section Desktop Position*/
$position_desktop = ( $attributes['ePosTypeD'] ) ? $attributes['ePosTypeD'] . '-desktop' : false;
$local_data = gutentor_concat_space( $local_data, $position_desktop );
/*Section Tablet Position*/
$position_tablet = ( $attributes['ePosTypeT'] ) ? $attributes['ePosTypeT'] . '-tablet' : false;
$local_data = gutentor_concat_space( $local_data, $position_tablet );
/*Section Mobile Position*/
$position_mobile = ( $attributes['ePosTypeM'] ) ? $attributes['ePosTypeM'] . '-mobile' : false;
$local_data = gutentor_concat_space( $local_data, $position_mobile );
}
/*Section Display*/
if ( isset( $attributes['eHideMode'] ) ) {
$is_d_hide = array_key_exists( 'desktop', $attributes['eHideMode'] ) && $attributes['eHideMode']['desktop'];
/*Section Tablet Display*/
$is_t_hide = array_key_exists( 'tablet', $attributes['eHideMode'] ) && $attributes['eHideMode']['tablet'];
/*Section Mobile Display*/
$is_m_hide = array_key_exists( 'mobile', $attributes['eHideMode'] ) && $attributes['eHideMode']['mobile'];
$device_class = '';
if ( $is_d_hide ) {
$device_class = 'd-lg-none';
}
if ( $is_t_hide ) {
$device_class .= ' d-md-none';
if ( ! $is_d_hide ) {
$device_class .= ' d-lg-block';
}
}
if ( $is_m_hide ) {
$device_class .= ' d-none';
if ( ! $is_t_hide ) {
// $device_class .= ' d-sm-block';
$device_class .= ' d-md-block';
}
if ( ! $device_class && ! strpos( $device_class, 'd-lg-block' ) ) {
$device_class .= ' d-lg-block';
}
}
$local_data = gutentor_concat_space( $local_data, $device_class );
}
/*Concat Output with local data*/
$local_data = gutentor_concat_space( $output, $local_data );
/*Checked: escaped last*/
return $local_data;
}
/**
* Adding Section Classes
*
* @param {array} output
* @param {object} props
* @return {array}
*/
public function add_section_classes( $output, $attributes ) {
$local_data = '';
$blockComponentBGType = ( isset( $attributes['blockComponentBGType'] ) ) ? $attributes['blockComponentBGType'] : '';
$blockComponentEnableOverlay = ( isset( $attributes['blockComponentEnableOverlay'] ) ) ? $attributes['blockComponentEnableOverlay'] : '';
/* Bg classes */
$bg_class = GutentorBackgroundOptionsCSSClasses( $blockComponentBGType );
$local_data = gutentor_concat_space( $local_data, $bg_class );
/*Overlay classes*/
$overlay = $blockComponentEnableOverlay ? 'has-gutentor-overlay' : '';
$local_data = gutentor_concat_space( $local_data, $overlay );
/*Shape Top select classes*/
$blockShapeTopSelect = ( isset( $attributes['blockShapeTopSelect'] ) ) ? $attributes['blockShapeTopSelect'] : false;
if ( $blockShapeTopSelect ) {
$blockShapeTopSelectClass = $blockShapeTopSelect ? 'has-gutentor-block-shape-top' : '';
$local_data = gutentor_concat_space( $local_data, $blockShapeTopSelectClass );
}
/*mTShapePos select classes*/
$blockShapeTopPosition = ( isset( $attributes['blockShapeTopPosition'] ) ) ? $attributes['blockShapeTopPosition'] : false;
if ( $blockShapeTopPosition ) {
$blockShapeTopPosition = $blockShapeTopPosition ? 'gutentor-block-shape-top-bring-front' : '';
$local_data = gutentor_concat_space( $local_data, $blockShapeTopPosition );
}
/*mBShapePos select classes*/
$blockShapeBottomPosition = ( isset( $attributes['blockShapeBottomPosition'] ) ) ? $attributes['blockShapeBottomPosition'] : false;
if ( $blockShapeBottomPosition ) {
$blockShapeBottomPosition = $blockShapeBottomPosition ? 'gutentor-block-shape-bottom-bring-front' : '';
$local_data = gutentor_concat_space( $local_data, $blockShapeBottomPosition );
}
/*mTShapeVFlip select classes*/
$blockShapeTopFlipVertically = ( isset( $attributes['blockShapeTopFlipVertically'] ) ) ? $attributes['blockShapeTopFlipVertically'] : false;
if ( $blockShapeTopFlipVertically ) {
$local_data = gutentor_concat_space( $local_data, 'gutentor-tshape-fv' );
}
/*mTShapeHFlip select classes*/
$blockShapeTopFlipHorizontally = ( isset( $attributes['blockShapeTopFlipHorizontally'] ) ) ? $attributes['blockShapeTopFlipHorizontally'] : false;
if ( $blockShapeTopFlipHorizontally ) {
$local_data = gutentor_concat_space( $local_data, 'gutentor-tshape-hv' );
}
/*mTShapeHFlip select classes*/
$blockShapeBottomFlipVertically = ( isset( $attributes['blockShapeBottomFlipVertically'] ) ) ? $attributes['blockShapeBottomFlipVertically'] : false;
if ( $blockShapeBottomFlipVertically ) {
$local_data = gutentor_concat_space( $local_data, 'gutentor-bshape-fv' );
}
/*mTShapeHFlip select classes*/
$blockShapeBottomFlipHorizontally = ( isset( $attributes['blockShapeBottomFlipHorizontally'] ) ) ? $attributes['blockShapeBottomFlipHorizontally'] : false;
if ( $blockShapeBottomFlipHorizontally ) {
$local_data = gutentor_concat_space( $local_data, 'gutentor-bshape-hv' );
}
/*Shape Bottom select classes*/
$blockShapeBottomSelect = ( isset( $attributes['blockShapeBottomSelect'] ) ) ? $attributes['blockShapeBottomSelect'] : false;
if ( $blockShapeBottomSelect ) {
$blockShapeBottomSelectClass = $blockShapeBottomSelect ? 'has-gutentor-block-shape-bottom' : '';
$local_data = gutentor_concat_space( $local_data, $blockShapeBottomSelectClass );
}
/*Section Desktop Display*/
$is_d_hide = ( $attributes['blockComponentDesktopDisplayMode'] ) ? $attributes['blockComponentDesktopDisplayMode'] : false;
/*Section Tablet Display*/
$is_t_hide = ( $attributes['blockComponentTabletDisplayMode'] ) ? $attributes['blockComponentTabletDisplayMode'] : false;
/*Section Mobile Display*/
$is_m_hide = ( $attributes['blockComponentMobileDisplayMode'] ) ? $attributes['blockComponentMobileDisplayMode'] : false;
$device_class = '';
if ( $is_d_hide ) {
$device_class = 'd-lg-none';
}
if ( $is_t_hide ) {
$device_class .= ' d-md-none';
if ( ! $is_d_hide ) {
$device_class .= ' d-lg-block';
}
}
if ( $is_m_hide ) {
$device_class .= ' d-none';
if ( ! $is_t_hide ) {
// $device_class .= ' d-sm-block';
$device_class .= ' d-md-block';
}
if ( ! $device_class && ! strpos( $device_class, 'd-lg-block' ) ) {
$device_class .= ' d-lg-block';
}
}
$local_data = gutentor_concat_space( $local_data, $device_class );
/*Section Enable Position*/
$enable_position = ( $attributes['blockComponentEnablePosition'] ) ? $attributes['blockComponentEnablePosition'] : false;
/*Section Desktop Position*/
$position_desktop = ( $enable_position && $attributes['blockComponentPositionTypeDesktop'] ) ? $attributes['blockComponentPositionTypeDesktop'] . '-desktop' : false;
$local_data = gutentor_concat_space( $local_data, $position_desktop );
/*Section Tablet Position*/
$position_tablet = ( $enable_position && $attributes['blockComponentPositionTypeTablet'] ) ? $attributes['blockComponentPositionTypeTablet'] . '-tablet' : false;
$local_data = gutentor_concat_space( $local_data, $position_tablet );
/*Section Mobile Position*/
$position_mobile = ( $enable_position && $attributes['blockComponentPositionTypeMobile'] ) ? $attributes['blockComponentPositionTypeMobile'] . '-mobile' : false;
$local_data = gutentor_concat_space( $local_data, $position_mobile );
/*Concat Output with local data*/
$local_data = gutentor_concat_space( $output, $local_data );
/*Checked: escaped last*/
return $local_data;
}
/**
* Adding Content align Class
*
* @param {array} output
* @param {object} props
* @return string
*/
public function added_content_align_classes( $output, $attributes ) {
$gutentorBlockName = ( isset( $attributes['gutentorBlockName'] ) ) ? $attributes['gutentorBlockName'] : '';
$block_list = array( 'gutentor/blog-post', 'gutentor/google-map' );
$block_list = apply_filters( 'gutentor_block_access_content_align_class', $block_list );
if ( ! in_array( $gutentorBlockName, $block_list ) ) {
return $output;
}
$height_condition = false;
$enable_height = ( isset( $attributes['blockComponentEnableHeight'] ) ) ? $attributes['blockComponentEnableHeight'] : false;
$has_height = ( isset( $attributes['blockComponentHeight'] ) ) ? $attributes['blockComponentHeight'] : false;
$desktop_height = ( array_key_exists( 'desktop', $has_height ) ) ? $attributes['blockComponentHeight']['desktop'] : false;
$tablet_height = ( array_key_exists( 'tablet', $has_height ) ) ? $attributes['blockComponentHeight']['tablet'] : false;
$mobile_height = ( array_key_exists( 'mobile', $has_height ) ) ? $attributes['blockComponentHeight']['mobile'] : false;
$enable_content_v_align = ( isset( $attributes['blockComponentEnableContentVerticalAlign'] ) ) ? $attributes['blockComponentEnableContentVerticalAlign'] : false;
$desktop_v_align = ( isset( $attributes['blockComponentContentVerticalAlignDesktop'] ) ) ? $attributes['blockComponentContentVerticalAlignDesktop'] : false;
$tablet_v_align = ( isset( $attributes['blockComponentContentVerticalAlignTablet'] ) ) ? $attributes['blockComponentContentVerticalAlignTablet'] : false;
$mobile_v_align = ( isset( $attributes['blockComponentContentVerticalAlignMobile'] ) ) ? $attributes['blockComponentContentVerticalAlignMobile'] : false;
if ( $enable_height && $has_height && $enable_content_v_align && ( $desktop_height || $tablet_height || $mobile_height ) ) {
$height_condition = true;
}
if ( $height_condition && $desktop_v_align ) {
$desktop_align_data = $desktop_v_align . '-desktop';
$output = gutentor_concat_space( $output, $desktop_align_data );
}
if ( $height_condition && $tablet_v_align ) {
$tablet_align_data = $tablet_v_align . '-tablet';
$output = gutentor_concat_space( $output, $tablet_align_data );
}
if ( $height_condition && $mobile_v_align ) {
$mobile_align_data = $mobile_v_align . '-mobile';
$output = gutentor_concat_space( $output, $mobile_align_data );
}
/*Checked: escaped last*/
return $output;
}
/**
* Advanced Options Video Output
*
* @param {object} output
* @param {object} props
* @return {object} Inline CSS
*/
public function addAdvancedVideoOutput( $output, $attributes ) {
$gutentorBlockName = ( isset( $attributes['gutentorBlockName'] ) ) ? $attributes['gutentorBlockName'] : '';
$block_list = array( 'gutentor/blog-post', 'gutentor/google-map' );
$block_list = apply_filters( 'gutentor_widget_block_access_bg_video_html', $block_list );
if ( ! in_array( $gutentorBlockName, $block_list ) ) {
return $output;
}
$blockComponentBGType = ( isset( $attributes['blockComponentBGType'] ) ) ? $attributes['blockComponentBGType'] : '';
if ( 'video' !== $blockComponentBGType ) {
return $output;
}
$blockComponentBGVideo = ( isset( $attributes['blockComponentBGVideo'] ) ) ? $attributes['blockComponentBGVideo'] : '';
$blockComponentBGVideoLoop = ( isset( $attributes['blockComponentBGVideoLoop'] ) ) ? $attributes['blockComponentBGVideoLoop'] : '';
$blockComponentBGVideoMuted = ( isset( $attributes['blockComponentBGVideoMuted'] ) ) ? $attributes['blockComponentBGVideoMuted'] : '';
$backgroundVideoSrc = ( isset( $attributes['mBGVideoSrc'] ) ) ? $attributes['mBGVideoSrc'] : '';
$backgroundVideoUrl = ( isset( $attributes['mBGVideoUrl'] ) ) ? $attributes['mBGVideoUrl'] : '';
$videoOutput = GutentorUpdatedBackgroundVideoOutput( $blockComponentBGType, $backgroundVideoSrc, $blockComponentBGVideo, $backgroundVideoUrl, $blockComponentBGVideoLoop, $blockComponentBGVideoMuted );
if ( $videoOutput ) {
$output = gutentor_concat_space( $output, $videoOutput );
}
/*Checked: escaped*/
return $output;
}
/**
* Adding Container Remove Classes
*
* @param {array} output
* @param {object} props
* @return string
*/
public function add_container_remove_space_classes( $output, $attributes ) {
$gutentorBlockName = ( isset( $attributes['gutentorBlockName'] ) ) ? $attributes['gutentorBlockName'] : '';
$block_list = array( 'gutentor/blog-post', 'gutentor/google-map' );
$block_list = apply_filters( 'gutentor_block_access_container_remove_space', $block_list );
if ( ! in_array( $gutentorBlockName, $block_list ) ) {
return $output;
}
$local_data = '';
$container_object = ( isset( $attributes['blockComponentRemoveContainerSpace'] ) ) ? $attributes['blockComponentRemoveContainerSpace'] : false;
$container_desktop = ( $container_object && isset( $attributes['blockComponentRemoveContainerSpace']['desktop'] ) ) ? $attributes['blockComponentRemoveContainerSpace']['desktop'] : false;
$container_desktop = ( $container_desktop ) ? 'gutentor-rm-ct-space-d' : '';
$container_tablet = ( $container_object && isset( $attributes['blockComponentRemoveContainerSpace']['tablet'] ) ) ? $attributes['blockComponentRemoveContainerSpace']['tablet'] : false;
$container_tablet = ( $container_tablet ) ? 'gutentor-rm-ct-space-t' : '';
$container_mobile = ( $container_object && isset( $attributes['blockComponentRemoveContainerSpace']['mobile'] ) ) ? $attributes['blockComponentRemoveContainerSpace']['mobile'] : false;
$container_mobile = ( $container_mobile ) ? 'gutentor-rm-ct-space' : '';
/* Remove Desktop Container Class*/
$local_data = gutentor_concat_space( $local_data, $container_desktop );
$local_data = gutentor_concat_space( $local_data, $container_tablet );
$local_data = gutentor_concat_space( $local_data, $container_mobile );
$local_data = gutentor_concat_space( $output, $local_data );
/*Checked: escaped last*/
return $local_data;
}
/**
* Adding Row Remove Classes
*
* @param {array} output
* @param {object} props
* @return string
*/
public function add_row_remove_space_classes( $output, $attributes ) {
$gutentorBlockName = ( isset( $attributes['gutentorBlockName'] ) ) ? $attributes['gutentorBlockName'] : '';
$block_list = array( 'gutentor/blog-post' );
$block_list = apply_filters( 'gutentor_block_access_row_remove_space', $block_list );
if ( ! in_array( $gutentorBlockName, $block_list ) ) {
return $output;
}
$local_data = '';
$row_object = ( isset( $attributes['blockComponentRemoveRowSpace'] ) ) ? $attributes['blockComponentRemoveRowSpace'] : false;
$row_desktop = ( $row_object && isset( $attributes['blockComponentRemoveRowSpace']['desktop'] ) ) ? $attributes['blockComponentRemoveRowSpace']['desktop'] : false;
$row_desktop = ( $row_desktop ) ? 'gutentor-rm-row-space-d' : '';
$row_tablet = ( $row_object && isset( $attributes['blockComponentRemoveRowSpace']['tablet'] ) ) ? $attributes['blockComponentRemoveRowSpace']['tablet'] : false;
$row_tablet = ( $row_tablet ) ? 'gutentor-rm-row-space-t' : '';
$row_mobile = ( $row_object && isset( $attributes['blockComponentRemoveRowSpace']['mobile'] ) ) ? $attributes['blockComponentRemoveRowSpace']['mobile'] : false;
$row_mobile = ( $row_mobile ) ? 'gutentor-rm-row-space' : '';
/* Remove Row Class*/
$local_data = gutentor_concat_space( $local_data, $row_desktop );
$local_data = gutentor_concat_space( $local_data, $row_tablet );
$local_data = gutentor_concat_space( $local_data, $row_mobile );
$local_data = gutentor_concat_space( $output, $local_data );
/*Checked: escaped last*/
return $local_data;
}
/**
* Adding Column Remove Classes
*
* @param {array} output
* @param {object} props
* @return string
*/
public function add_column_remove_space_classes( $output, $attributes ) {
$gutentorBlockName = ( isset( $attributes['gutentorBlockName'] ) ) ? $attributes['gutentorBlockName'] : '';
$block_list = array( 'gutentor/blog-post' );
$block_list = apply_filters( 'gutentor_block_access_column_remove_space', $block_list );
if ( ! in_array( $gutentorBlockName, $block_list ) ) {
return $output;
}
$local_data = '';
$column_object = ( isset( $attributes['blockComponentRemoveColumnSpace'] ) ) ? $attributes['blockComponentRemoveColumnSpace'] : false;
$column_desktop = ( $column_object && isset( $attributes['blockComponentRemoveColumnSpace']['desktop'] ) ) ? $attributes['blockComponentRemoveColumnSpace']['desktop'] : false;
$column_desktop = ( $column_desktop ) ? 'gutentor-rm-col-space-d' : '';
$column_tablet = ( $column_object && isset( $attributes['blockComponentRemoveColumnSpace']['tablet'] ) ) ? $attributes['blockComponentRemoveColumnSpace']['tablet'] : false;
$column_tablet = ( $column_tablet ) ? 'gutentor-rm-col-space-t' : '';
$column_mobile = ( $column_object && isset( $attributes['blockComponentRemoveColumnSpace']['mobile'] ) ) ? $attributes['blockComponentRemoveColumnSpace']['mobile'] : false;
$column_mobile = ( $column_mobile ) ? 'gutentor-rm-col-space' : '';
/* Remove Column Class*/
$local_data = gutentor_concat_space( $local_data, $column_desktop );
$local_data = gutentor_concat_space( $local_data, $column_tablet );
$local_data = gutentor_concat_space( $local_data, $column_mobile );
$local_data = gutentor_concat_space( $output, $local_data );
/*Checked: escaped last*/
return $local_data;
}
/**
* Adding Section Animation Class
*
* @param {array} output
* @param {object} props
* @return string
*/
public function add_animation_class( $output, $attributes ) {
$blockComponentAnimation = isset( $attributes['blockComponentAnimation'] ) ? $attributes['blockComponentAnimation'] : '';
$animation_class = ( $blockComponentAnimation && $attributes['blockComponentAnimation']['Animation'] && 'none' != $attributes['blockComponentAnimation']['Animation'] ) ? gutentor_concat_space( 'wow animated ', $attributes['blockComponentAnimation']['Animation'] ) : '';
/*Checked: escaped last*/
return gutentor_concat_space( $output, $animation_class );
}
/**
* Advanced Block Shape Before Container
*
* @param {string} $output
* @param {array} $attributes
* @return string $attributes
*/
public function addAdvancedBlockShapeTop( $output, $attributes ) {
if ( ! array_key_exists( 'blockShapeTopSelect', $attributes ) ) {
return $output;
}
if ( ! isset( $attributes['blockShapeTopSelect'] ) || is_null( $attributes['blockShapeTopSelect'] ) ) {
return $output;
}
$shape = $this->blockShapeDividerSvgArray();
if ( ! array_key_exists( $attributes['blockShapeTopSelect'], $shape ) ) {
return $output;
}
$shape_data = '<div class="gutentor-block-shape-top"><span>' . $shape[ $attributes['blockShapeTopSelect'] ] . '</span></div>';
/*Checked: $shape[ $attributes['blockShapeTopSelect'] ] is predefined*/
return $output . $shape_data;
}
/**
* Advanced Block Shape Before Container
*
* @param {string} $output
* @param {array} $attributes
* @return string $attributes
*/
public function addAdvancedBlockShapeBottom( $output, $attributes ) {
if ( ! array_key_exists( 'blockShapeBottomSelect', $attributes ) ) {
return $output;
}
if ( ! isset( $attributes['blockShapeBottomSelect'] ) || is_null( $attributes['blockShapeBottomSelect'] ) ) {
return $output;
}
$shape = $this->blockShapeDividerSvgArray();
if ( ! array_key_exists( $attributes['blockShapeBottomSelect'], $shape ) ) {
return $output;
}
$shape_data = '<div class="gutentor-block-shape-bottom"><span>' . $shape[ $attributes['blockShapeBottomSelect'] ] . '</span></div>';
/*Checked: $shape[ $attributes['blockShapeTopSelect'] ] is predefined*/
return $output . $shape_data;
}
/**
* Adding Item Wrap Animation Class
*
* @param {array} output
* @param {object} props
* @return string
*/
public function add_item_wrap_animation_class( $output, $attributes ) {
$blockItemsWrapAnimation = isset( $attributes['blockItemsWrapAnimation'] ) ? $attributes['blockItemsWrapAnimation'] : '';
$animation_class = ( $blockItemsWrapAnimation && $attributes['blockItemsWrapAnimation']['Animation'] && 'none' != $attributes['blockItemsWrapAnimation']['Animation'] ) ? gutentor_concat_space( 'wow animated ', $attributes['blockItemsWrapAnimation']['Animation'] ) : '';
/*Checked: escaped last*/
return gutentor_concat_space( $output, $animation_class );
}
/**
* Adding Link to Post Thumbnails
*
* @param {array} output
* @param {object} props
* @return string
*/
public function add_link_to_post_thumbnails( $output, $url, $attributes ) {
$output_wrap = '';
$target = '';
$class = '';
$rel = '';
if ( empty( $output ) || $output == null ) {
return $output;
}
if ( ! array_key_exists( 'blockImageBoxLinkOptionsEnable', $attributes ) ) {
return $output;
}
if ( ! $attributes['blockImageBoxLinkOptionsEnable'] ) {
return $output;
}
if ( array_key_exists( 'blockImageBoxLinkOpenNewTab', $attributes ) ) {
$target = $attributes['blockImageBoxLinkOpenNewTab'] ? 'target="_blank"' : '';
}
if ( array_key_exists( 'blockImageBoxLinkClass', $attributes ) ) {
$class = $attributes['blockImageBoxLinkClass'] ? $attributes['blockImageBoxLinkClass'] : '';
}
if ( array_key_exists( 'blockImageBoxLinkRel', $attributes ) ) {
$rel = ( $attributes['blockImageBoxLinkRel'] ) ? 'rel="' . $attributes['blockImageBoxLinkRel'] . '"' : '';
}
$output_wrap .= '<a class="gutentor-single-item-image-link ' . esc_attr( $class ) . '" href="' . esc_url( $url ) . '" ' . esc_attr( $target ) . ' ' . esc_attr( $rel ) . '>';
$output_wrap .= $output;
$output_wrap .= '</a>';
/*Checked: escaped*/
return $output_wrap;
}
/**
* Adding Block Header
*
* @param {array} output
* @param {object} props
* @return string
*/
public function add_column_class( $output, $attributes ) {
if ( ! apply_filters( 'gutentor_edit_enable_column', true, $attributes ) ) {
return $output;
}
$local_data = '';
$blockItemsColumn_desktop = ( isset( $attributes['blockItemsColumn']['desktop'] ) ) ? $attributes['blockItemsColumn']['desktop'] : '';
$local_data = gutentor_concat_space( $local_data, $blockItemsColumn_desktop );
$blockItemsColumn_tablet = ( isset( $attributes['blockItemsColumn']['tablet'] ) ) ? $attributes['blockItemsColumn']['tablet'] : '';
$local_data = gutentor_concat_space( $local_data, $blockItemsColumn_tablet );
$blockItemsColumn_mobile = ( isset( $attributes['blockItemsColumn']['mobile'] ) ) ? $attributes['blockItemsColumn']['mobile'] : '';
$local_data = gutentor_concat_space( $local_data, $blockItemsColumn_mobile );
/*Checked: escaped last*/
return gutentor_concat_space( $output, $local_data );
}
/**
* Adding Block Header
*
* @param {array} output
* @param {object} props
* @return string
*/
public function add_block_save_header( $output, $attributes ) {
if ( ! apply_filters( 'gutentor_save_block_header_data_enable', true, $attributes ) ) {
return $output;
}
$blockHeader = '<div class="' . esc_attr( apply_filters( 'gutentor_save_block_header_class', 'gutentor-block-header', $attributes ) ) . '">';
$blockHeader .= apply_filters( 'gutentor_save_block_header_data', '', $attributes );
$blockHeader .= '</div>';
/*Checked: escaped*/
return $output . $blockHeader;
}
/**
* Add Button Attributes
*
* @param {object} output
* @param {string} buttonLink
* @param {object} buttonLinkOptions
* @return string
*/
public function addButtonLinkAttr( $output, $buttonLink, $buttonLinkOptions ) {
$target = $rel = '';
$buttonOptions = ( $buttonLinkOptions && array_key_exists( 'openInNewTab', $buttonLinkOptions ) ) ? $buttonLinkOptions['openInNewTab'] : false;
if ( $buttonOptions ) {
$target = $buttonOptions ? '_blank' : '';
}
$relOptions = ( $buttonLinkOptions && array_key_exists( 'rel', $buttonLinkOptions ) ) ? $buttonLinkOptions['rel'] : false;
if ( $relOptions ) {
$rel = ( $buttonLinkOptions['rel'] ) ? $buttonLinkOptions['rel'] : '';
}
$a_href = ( $buttonLink ) ? 'href="' . esc_url( $buttonLink ) . '"' : '';
$a_target = ( $target ) ? 'target="' . esc_attr( $target ) . '" ' : '';
$local_data = gutentor_concat_space( $a_href, $a_target );
$a_rel = ( $rel ) ? 'rel="' . esc_attr( $rel ) . '" ' : '';
$local_data = gutentor_concat_space( $local_data, $a_rel );
/*Checked: escaped*/
return gutentor_concat_space( $output, $local_data );
}
/**
* Add Button Wrap Attributes
*
* @param {object} $output
* @param {string} $post
* @param {object} buttonLinkOptions
* @return string
*/
public function addButtonWrap( $output, $post, $attributes ) {
if ( $attributes['gName'] != 'gutentor/p1' ) {
return $output;
}
$outPutData = '';
$enable_height = ( $attributes['pEqlHeight'] ) ? $attributes['pEqlHeight'] : false;
if ( ! $enable_height ) {
return $output;
}
$outPutData .= '<div class="gutentor-button-wrap">';
$outPutData .= $output;
$outPutData .= '</div>';
/*Checked: escaped*/
return $outPutData;
}
/**
* Callback functions for body_class,
* Adding Admin Body Class.
*
* @return string
* @since 1.0.0
* @access public
*/
public function gutentor_heading_title( $data, $attributes ) {
$output = '';
$block_title_tag = '';
$block_title = '';
$section_title_align = '';
$section_title_animation = '';
$section_title_animation_class = '';
$block_enable_design_title = '';
$block_design_title = '';
if ( isset( $attributes['blockComponentTitleAlign'] ) ) {
$section_title_align = ( $attributes['blockComponentTitleAlign'] ) ? $attributes['blockComponentTitleAlign'] : '';
}
if ( isset( $attributes['blockComponentTitleAnimation'] ) ) {
$section_title_animation = ( $attributes['blockComponentTitleAnimation'] ) ? $attributes['blockComponentTitleAnimation'] : '';
if ( isset( $attributes['blockComponentTitleAnimation']['Animation'] ) ) {
$section_title_animation_class = ( $attributes['blockComponentTitleAnimation']['Animation'] && 'none' != $attributes['blockComponentTitleAnimation']['Animation'] ) ? 'wow animated ' . $attributes['blockComponentTitleAnimation']['Animation'] : '';
}
}
if ( isset( $attributes['blockComponentTitleTag'] ) ) {
$block_title_tag = ( $attributes['blockComponentTitleTag'] ) ? $attributes['blockComponentTitleTag'] : '';
}
if ( isset( $attributes['blockComponentTitle'] ) ) {
$block_title = ( $attributes['blockComponentTitle'] ) ? $attributes['blockComponentTitle'] : '';
}
if ( isset( $attributes['blockComponentTitleDesignEnable'] ) ) {
$block_enable_design_title = ( $attributes['blockComponentTitleDesignEnable'] ) ? 'enable-title-design' : '';
}
if ( isset( $attributes['blockComponentTitleDesignEnable'] ) && isset( $attributes['blockComponentTitleSeperatorPosition'] ) ) {
$block_design_title = ( $attributes['blockComponentTitleDesignEnable'] && $attributes['blockComponentTitleSeperatorPosition'] ) ? $attributes['blockComponentTitleSeperatorPosition'] : 'seperator-bottom';
}
$block_title_tag = gutentor_get_title_tag( $block_title_tag );
$blockComponentTitleEnable = isset( $attributes['blockComponentTitleEnable'] ) ? $attributes['blockComponentTitleEnable'] : false;
if ( $blockComponentTitleEnable ) {
$output .= '<div class="gutentor-section-title ' . esc_attr( gutentor_concat_space( $block_enable_design_title, $block_design_title ) ) . ' ' . esc_attr( gutentor_concat_space( $section_title_align, $section_title_animation_class ) ) . ' " ' . GutentorAnimationOptionsDataAttr( $section_title_animation ) . '>' . "\n";
$output .= '<' . esc_attr( $block_title_tag ) . ' class="gutentor-title">' . "\n";
$output .= wp_kses_post( $block_title );
$output .= '</' . esc_attr( $block_title_tag ) . '>' . "\n";
$output .= '</div>' . "\n";
}
/*Checked: escaped*/
return $data . $output;
}
/**
* Adding Class
*
* @param {array} output
* @param {object} props
* @return {array}
*/
public function addingBlogStyleOptionsClass( $output, $attributes ) {
if ( 'gutentor/blog-post' !== $attributes['gutentorBlockName'] ) {
return $output;
}
$blog_style_class = $attributes['blockBlogStyle'] ? $attributes['blockBlogStyle'] : '';
/*Checked: escaped last*/
return gutentor_concat_space( $output, $blog_style_class );
}
/**
* Adding Product
*
* @param {array} output
* @param {object} props
* @return {array}
*/
public function addingProductButtonWrap( $output, $post, $attributes ) {
if ( $attributes['gName'] != 'gutentor/p1' ) {
return $output;
}
$enable_height = ( $attributes['pEqlHeight'] ) ? $attributes['pEqlHeight'] : false;
if ( ! $enable_height ) {
return $output;
}
/*Checked: escaped last*/
return gutentor_concat_space( $output, 'gutentor-button-wrap' );
}
/**
* Remove Column Class in Blog post
*
* @param {array} output
* @param {object} attributes
* @return mixed||boolean
*/
public function remove_column_class_blog_post( $output, $attributes ) {
if ( 'gutentor/blog-post' !== $attributes['gutentorBlockName'] ) {
return $output;
}
if ( $attributes['blockBlogStyle'] === 'blog-list' ) {
return false;
}
/*Checked: escaped last*/
return $output;
}
/**
* Get value of gutentor_dynamic_style_location
*
* @param {string} $gutentor_dynamic_style_location
* @return string
*/
public function get_dynamic_style_location( $gutentor_dynamic_style_location ) {
if ( gutentor_get_options( 'dynamic-res-location' ) ) {
$gutentor_dynamic_style_location = gutentor_get_options( 'dynamic-res-location' );
}
/*Checked: escaped last*/
return $gutentor_dynamic_style_location;
}
}
}
/**
* Return instance of Gutentor_Block_Hooks class
*
* @since 1.0.0
*/
if ( ! function_exists( 'gutentor_block_hooks' ) ) {
function gutentor_block_hooks() {
return Gutentor_Block_Hooks::get_instance();
}
}
gutentor_block_hooks()->run();

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,128 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Term_Modules_Hooks' ) ) {
/**
* Block Specific Hooks Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Term_Modules_Hooks {
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @return object
* @since 2.0.0
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Add Filter
*
* @access public
* @return void
* @since 2.0.0
*/
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
add_filter( $hook, array( $component, $callback ), $priority, $accepted_args );
}
/**
* Add Action
*
* @access public
* @return void
* @since 2.0.0
*/
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
add_action( $hook, array( $component, $callback ), $priority, $accepted_args );
}
/**
* Run Block
*
* @access public
* @return void
* @since 2.0.0
*/
public function run() {
/*Block Specific PHP hooks*/
$this->add_filter( 'gutentor_term_module_article_class', $this, 'add_item_post_align_class', 10, 2 );
}
/**
* Adding Align class
*
* @param {array} output
* @param {object} props
* @return {array}
*/
public function add_item_post_align_class( $output, $attributes ) {
$gName = ( isset( $attributes['gName'] ) ) ? $attributes['gName'] : '';
$block_list = array( 'gutentor/t1', 'gutentor/t2' );
$block_list = apply_filters( 'gutentor_term_item_bx_align_class_accessor_block', $block_list );
if ( ! in_array( $gName, $block_list ) ) {
return $output;
}
if ( ! isset( $attributes['tBxAlign'] ) ) {
return $output;
}
$local_data = '';
$align_mobile = ( isset( $attributes['tBxAlign']['mobile'] ) ) ? $attributes['tBxAlign']['mobile'] : false;
if ( $align_mobile ) {
$align_m_class = ( $align_mobile ) ? $align_mobile . '-mobile' : '';
$local_data = gutentor_concat_space( $local_data, $align_m_class );
}
$align_tablet = ( isset( $attributes['tBxAlign']['tablet'] ) ) ? $attributes['tBxAlign']['tablet'] : false;
if ( $align_tablet ) {
$align_t_class = ( $align_tablet ) ? $align_tablet . '-tablet' : '';
$local_data = gutentor_concat_space( $local_data, $align_t_class );
}
$align_desktop = ( isset( $attributes['tBxAlign']['desktop'] ) ) ? $attributes['tBxAlign']['desktop'] : false;
if ( $align_desktop ) {
$align_d_class = ( $align_desktop ) ? $align_desktop . '-desktop' : '';
$local_data = gutentor_concat_space( $local_data, $align_d_class );
}
/*Checked: escaped last*/
return gutentor_concat_space( $output, $local_data );
}
}
}
/**
* Return instance of Gutentor_Term_Modules_Hooks class
*
* @since 1.0.0
*/
if ( ! function_exists( 'gutentor_term_modules_hooks' ) ) {
function gutentor_term_modules_hooks() {
return Gutentor_Term_Modules_Hooks::get_instance();
}
}
gutentor_term_modules_hooks()->run();

View File

@@ -0,0 +1,404 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Duplex_P6_T1' ) ) {
/**
* Gutentor_Duplex_P6_T1 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Duplex_P6_T1 extends Gutentor_Query_Elements {
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Run Block
*
* @access public
* @since 2.0.0
* @return void
*/
public function run() {
add_filter( 'gutentor_post_module_p6_query_data', array( $this, 'template_data' ), 999, 4 );
}
/**
* Get Featured Single item data
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function p6_template1_featured_woo_single_article( $post, $attributes, $index ) {
$output = '';
if ( ! gutentor_is_woocommerce_active() ) {
return $output;
}
$product = wc_get_product( $post->ID );
$rating = $product->get_average_rating();
$count = $product->get_rating_count();
$rating_html = wc_get_rating_html( $rating, $count );
$query_sorting = array_key_exists( 'blockFPSortableItems', $attributes ) ? $attributes['blockFPSortableItems'] : false;
$enable_featured_image = ( isset( $attributes['pOnFPFImg'] ) ) ? $attributes['pOnFPFImg'] : false;
$enable_avatar = ( isset( $attributes['pFPOnAvatar'] ) ) ? $attributes['pFPOnAvatar'] : false;
$avatar_pos = ( isset( $attributes['pFPAvatarPos'] ) ) ? $attributes['pFPAvatarPos'] : false;
$enable_post_format = ( isset( $attributes['pOnFPPostFormatOpt'] ) ) ? $attributes['pOnFPPostFormatOpt'] : false;
$post_format_pos = ( isset( $attributes['pFPPostFormatPos'] ) ) ? $attributes['pFPPostFormatPos'] : false;
$cat_pos = ( isset( $attributes['pFPCatPos'] ) ) ? $attributes['pFPCatPos'] : false;
$enable_featured_cat = ( isset( $attributes['pOnFPFeaturedCat'] ) ) ? $attributes['pOnFPFeaturedCat'] : false;
$output .= "<article class='" . esc_attr( apply_filters( 'gutentor_post_module_article_class', gutentor_concat_space( 'gutentor-post', 'gutentor-post-featured', 'gutentor-post-item-' . $index ), $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_p6_featured_post_post_item', 'gutentor-post-featured-item', $attributes ) ) . "'>";
if ( $enable_featured_image ) {
$enable_overlayImage = false;
$overlayImage = ( isset( $attributes['pFPFImgOColor'] ) ) ? $attributes['pFPFImgOColor'] : false;
if ( $overlayImage ) {
$enable_overlayImage = ( isset( $attributes['pFPFImgOColor']['enable'] ) ) ? $attributes['pFPFImgOColor']['enable'] : false;
}
$url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $attributes['pFPFImgSize'] );
$default_url = WC()->plugin_url() . '/assets/images/placeholder.png';
$overlay = $enable_overlayImage ? 'gutentor-overlay' : '';
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_p6_featured_post_post_item_height', gutentor_concat_space( 'gutentor-post-featured-height', 'gutentor-bg-image', $overlay ), $attributes ) ) . "' style='background-image:url(" . esc_url( is_array( $url ) && ! empty( $url ) ? $url[0] : $default_url ) . ")'>";
if ( $enable_avatar && $this->avatar_fp_on_image_condition( $avatar_pos ) ) {
$output .= $this->get_fp_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $this->featured_post_format_on_image_condition( $post_format_pos ) ) {
$output .= $this->p6_fp_new_badge_product( $post, $product );
}
if ( $enable_featured_cat && $this->featured_post_categories_on_image_condition( $cat_pos ) ) {
$output .= $this->p6_fp_get_woo_badge( $post, $product, $attributes );
}
$output .= apply_filters( 'gutentor_p6_featured_image_popup_data', '', $post, $attributes );
$output .= '<div class="gutentor-post-content">';
if ( $query_sorting ) :
foreach ( $query_sorting as $element ) :
if ( ! ( array_key_exists( 'itemValue', $element ) ) ) {
return $output;
}
switch ( $element['itemValue'] ) {
case 'title':
if ( $cat_pos === 'gutentor-fp-cat-pos-before-title' || $post_format_pos === 'gutentor-fp-pf-pos-before-title' ) {
$output .= '<div class="gutentor-post-title-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-fp-pf-pos-before-title' ) {
$output .= $this->p6_fp_new_badge_product( $post, $product );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-fp-cat-pos-before-title' ) {
$output .= $this->p6_fp_get_woo_badge( $post, $product, $attributes );
}
$output .= $this->get_featured_post_title( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_featured_post_title( $post, $attributes );
}
break;
case 'primary-entry-meta':
$output .= $this->get_featured_post_primary_meta( $post, $attributes );
break;
case 'secondary-entry-meta':
$output .= $this->get_featured_post_secondary_meta( $post, $attributes );
break;
case 'price':
$output .= $this->p6_featured_wc_price( $post, $product, $attributes );
break;
case 'rating':
if ( isset( $attributes['fpWooOnRating'] ) && $attributes['fpWooOnRating'] ) {
if ( $rating_html ) {
$output .= '<div class="gutentor-fp-wc-rating">';
$output .= $rating_html;
$output .= '</div>';
}
}
break;
case 'avatar':
$output .= $this->get_fp_avatar_data( $post, $attributes );
break;
case 'description':
if ( $cat_pos === 'gutentor-fp-cat-pos-before-ct-box' || $post_format_pos === 'gutentor-fp-pf-pos-before-ct-box' ) {
$output .= '<div class="gutentor-post-desc-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-fp-pf-pos-before-ct-box' ) {
$output .= $this->p6_fp_new_badge_product( $post, $product );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-fp-cat-pos-before-ct-box' ) {
$output .= $this->p6_fp_get_woo_badge( $post, $product, $attributes );
}
$output .= $this->get_featured_post_description( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_featured_post_description( $post, $attributes );
}
break;
case 'button':
if ( $cat_pos === 'gutentor-fp-cat-pos-before-button' || $post_format_pos === 'gutentor-fp-pf-pos-before-button' ) {
$output .= '<div class="gutentor-post-desc-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-fp-pf-pos-before-button' ) {
$output .= $this->p6_fp_new_badge_product( $post, $product );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-fp-cat-pos-before-button' ) {
$output .= $this->p6_fp_get_woo_badge( $post, $product, $attributes );
}
if ( isset( $attributes['pOnFPBtn'] ) && $attributes['pOnFPBtn'] ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_product_button_class', 'gutentor-woo-add-to-cart wc-block-grid__product-add-to-cart', $post, $attributes ) ) . "'>";
ob_start();
woocommerce_template_loop_add_to_cart(
array(
'gutentor-attributes' => $attributes,
'gutentor-btn-type' => 'featured',
)
);
$output .= ob_get_clean();
$output .= '</div>';
}
$output .= '</div>';
} elseif ( isset( $attributes['pOnFPBtn'] ) && $attributes['pOnFPBtn'] ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_product_button_class', 'gutentor-woo-add-to-cart wc-block-grid__product-add-to-cart', $post, $attributes ) ) . "'>";
ob_start();
woocommerce_template_loop_add_to_cart(
array(
'gutentor-attributes' => $attributes,
'gutentor-btn-type' => 'featured',
)
);
$output .= ob_get_clean();
$output .= '</div>';
}
break;
default:
$output .= '';
break;
}
endforeach;
endif;
$output .= '</div>';/*.gutentor-post-content*/
$output .= '</div>';/*.gutentor-bg-image*/
}
$output .= '</div>';/*.gutentor-post-featured-item*/
$output .= '</article>';/*.article*/
return $output;
}
/**
* Get EDD Featured Single item data
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function p6_template1_featured_edd_single_article( $post, $attributes, $index ) {
if ( ! gutentor_is_edd_active() ) {
return '';
}
$download = edd_get_download( $post->ID );
$output = '';
$query_sorting = array_key_exists( 'blockFPSortableItems', $attributes ) ? $attributes['blockFPSortableItems'] : false;
$enable_featured_image = ( isset( $attributes['pOnFPFImg'] ) ) ? $attributes['pOnFPFImg'] : false;
$enable_avatar = ( isset( $attributes['pFPOnAvatar'] ) ) ? $attributes['pFPOnAvatar'] : false;
$avatar_pos = ( isset( $attributes['pFPAvatarPos'] ) ) ? $attributes['pFPAvatarPos'] : false;
$enable_post_format = ( isset( $attributes['pOnFPPostFormatOpt'] ) ) ? $attributes['pOnFPPostFormatOpt'] : false;
$post_format_pos = ( isset( $attributes['pFPPostFormatPos'] ) ) ? $attributes['pFPPostFormatPos'] : false;
$output .= "<article class='" . esc_attr( apply_filters( 'gutentor_post_module_article_class', gutentor_concat_space( 'gutentor-post', 'gutentor-post-featured', 'gutentor-post-item-' . $index ), $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_p6_featured_post_post_item', 'gutentor-post-featured-item', $attributes ) ) . "'>";
if ( $enable_featured_image ) {
$enable_overlayImage = false;
$overlayImage = ( isset( $attributes['pFPFImgOColor'] ) ) ? $attributes['pFPFImgOColor'] : false;
if ( $overlayImage ) {
$enable_overlayImage = ( isset( $attributes['pFPFImgOColor']['enable'] ) ) ? $attributes['pFPFImgOColor']['enable'] : false;
}
$url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $attributes['pFPFImgSize'] );
$default_url = GUTENTOR_URL . 'assets/img/default-image.jpg';
$overlay = $enable_overlayImage ? 'gutentor-overlay' : '';
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_p6_featured_post_post_item_height', gutentor_concat_space( 'gutentor-post-featured-height', 'gutentor-bg-image', $overlay ), $attributes ) ) . "' style='background-image:url(" . esc_url( is_array( $url ) && ! empty( $url ) ? $url[0] : $default_url ) . ")'>";
if ( $enable_avatar && $this->avatar_fp_on_image_condition( $avatar_pos ) ) {
$output .= $this->get_fp_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $this->featured_post_format_on_image_condition( $post_format_pos ) ) {
$output .= $this->p6_fp_edd_new_badge_product( $post, $download );
}
$output .= apply_filters( 'gutentor_p6_featured_image_popup_data', '', $post, $attributes );
$output .= '<div class="gutentor-post-content">';
if ( $query_sorting ) :
foreach ( $query_sorting as $element ) :
if ( ! ( array_key_exists( 'itemValue', $element ) ) ) {
return $output;
}
switch ( $element['itemValue'] ) {
case 'title':
if ( $post_format_pos === 'gutentor-fp-pf-pos-before-title' ) {
$output .= '<div class="gutentor-post-title-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-fp-pf-pos-before-title' ) {
$output .= $this->p6_fp_edd_new_badge_product( $post, $download );
}
$output .= $this->get_featured_post_title( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_featured_post_title( $post, $attributes );
}
break;
case 'primary-entry-meta':
$output .= $this->get_featured_post_primary_meta( $post, $attributes );
break;
case 'secondary-entry-meta':
$output .= $this->get_featured_post_secondary_meta( $post, $attributes );
break;
case 'price':
$output .= $this->p6_featured_edd_price( $post, $attributes );
break;
case 'rating':
if ( isset( $attributes['fpWooOnRating'] ) && $attributes['fpWooOnRating'] ) {
$review = gutentor_custom_edd_review( $post->ID );
if ( $review ) {
$output .= '<div class="gutentor-fp-edd-rating">';
$output .= $review;
$output .= '</div>';
}
}
break;
case 'avatar':
$output .= $this->get_fp_avatar_data( $post, $attributes );
break;
case 'description':
if ( $post_format_pos === 'gutentor-fp-pf-pos-before-ct-box' ) {
$output .= '<div class="gutentor-post-desc-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-fp-pf-pos-before-ct-box' ) {
$output .= $this->p6_fp_edd_new_badge_product( $post, $download );
}
$output .= $this->get_featured_post_description( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_featured_post_description( $post, $attributes );
}
break;
case 'wishlist':
$output .= $this->get_fp_edd_wish_list( $post, $attributes );
break;
case 'button':
if ( $post_format_pos === 'gutentor-fp-pf-pos-before-button' ) {
$output .= '<div class="gutentor-post-button-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-fp-pf-pos-before-button' ) {
$output .= $this->p6_fp_edd_new_badge_product( $post, $download );
}
$output .= $this->p6_get_fp_edd_button( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->p6_get_fp_edd_button( $post, $attributes );
}
break;
default:
$output .= '';
break;
}
endforeach;
endif;
$output .= '</div>';/*.gutentor-post-content*/
$output .= '</div>';/*.gutentor-bg-image*/
}
$output .= '</div>';/*.gutentor-post-featured-item*/
$output .= '</article>';/*.article*/
return $output;
}
/**
* Content On Image Template 1
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @param {array} $content
* @return {mix}
*/
public function template_data( $output, $the_query, $attributes, $content ) {
$template = $attributes['p6Temp'] ? $attributes['p6Temp'] : '';
$post_number = $attributes['postsToShow'] ? $attributes['postsToShow'] : '';
$post_type = ( isset( $attributes['pPostType'] ) ) ? $attributes['pPostType'] : 'post';
if ( $template !== 'gutentor_p6_template1' ) {
return $output;
}
$index = 0;
$post_categories = array();
while ( $the_query->have_posts() ) :
$the_query->the_post();
$post_categories = array_merge( $post_categories, wp_get_post_categories( get_the_ID() ) );
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p6_grid_column_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
if ( $post_type === 'product' ) {
$output .= $this->p6_template1_featured_woo_single_article( get_post(), $attributes, $index );
} elseif ( $post_type === 'download' ) {
$output .= $this->p6_template1_featured_edd_single_article( get_post(), $attributes, $index );
} else {
$output .= $this->p6_featured_single_article( get_post(), $attributes, $index );
}
$output .= '</div>';
}
if ( $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_grid_column_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index > 0 && $index < $post_number ) {
if ( $post_type === 'product' ) {
$output .= $this->p6_woo_single_article( get_post(), $attributes, $index );
} elseif ( $post_type === 'download' ) {
$output .= $this->p6_edd_single_article( get_post(), $attributes, $index );
} else {
$output .= $this->p6_single_article( get_post(), $attributes, $index );
}
}
if ( $index + 1 === $post_number ) {
$output .= '</div>';
}
++$index;
endwhile;
if ( $post_categories && $content === 'ajax' ) {
$cat_style = gutentor_pm_post_dynamic_categories_color( array_unique( $post_categories ) );
if ( $cat_style ) {
$output .= '<style>' . wp_strip_all_tags( $cat_style ) . '</style>';
}
}
return $output;
}
}
}
Gutentor_Duplex_P6_T1::get_instance()->run();

View File

@@ -0,0 +1,504 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Duplex_P6_T2' ) ) {
/**
* Gutentor_Duplex_P6_T2 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Duplex_P6_T2 extends Gutentor_Query_Elements {
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @return object
* @since 2.0.0
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Run Block
*
* @access public
* @return void
* @since 2.0.0
*/
public function run() {
add_filter( 'gutentor_post_module_p6_query_data', array( $this, 'template_data' ), 999, 4 );
}
/**
* Get Featured Single item data
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function p6_template2_featured_single_article( $post, $attributes, $index ) {
$output = '';
$enable_avatar = isset( $attributes['pFPOnAvatar'] ) && $attributes['pFPOnAvatar'];
$avatar_pos = isset( $attributes['pFPAvatarPos'] ) ? $attributes['pFPAvatarPos'] : false;
$query_sorting = array_key_exists( 'blockFPSortableItems', $attributes ) ? $attributes['blockFPSortableItems'] : false;
$enable_featured_image = isset( $attributes['pOnFPFImg'] ) && $attributes['pOnFPFImg'];
$enable_post_format = isset( $attributes['pOnFPPostFormatOpt'] ) && $attributes['pOnFPPostFormatOpt'];
$post_format_pos = isset( $attributes['pFPPostFormatPos'] ) ? $attributes['pFPPostFormatPos'] : false;
$cat_pos = ( isset( $attributes['pFPCatPos'] ) ) ? $attributes['pFPCatPos'] : false;
$enable_featured_cat = isset( $attributes['pOnFPFeaturedCat'] ) && $attributes['pOnFPFeaturedCat'];
$thumb_class = ( has_post_thumbnail() && $enable_featured_image ) ? '' : 'gutentor-post-no-thumb';
$output .= "<article class='" . esc_attr( apply_filters( 'gutentor_post_module_article_class', gutentor_concat_space( 'gutentor-post', 'gutentor-post-featured', $thumb_class, 'gutentor-post-item-' . $index ), $attributes ) ) . "'>";
$output .= '<div class="gutentor-post-featured-item">';
if ( $enable_featured_image && gutentor_has_post_featured( $post ) ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_p6_fp_post_module_post_image_box', 'gutentor-post-image-box', $post, $attributes ) ) . "'>";
$output .= $this->get_featured_post_featured_image( $post, $attributes );
if ( $enable_avatar && $this->avatar_fp_on_image_condition( $avatar_pos ) ) {
$output .= $this->get_fp_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $this->featured_post_format_on_image_condition( $post_format_pos ) ) {
$output .= $this->get_featured_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $this->featured_post_categories_on_image_condition( $cat_pos ) ) {
$output .= $this->get_featured_post_module_badges_collection( $post, $attributes );
}
$output .= '</div>';
}
$output .= '<div class="gutentor-post-content">';
if ( $query_sorting ) :
foreach ( $query_sorting as $element ) :
if ( ! ( array_key_exists( 'itemValue', $element ) ) ) {
return $output;
}
switch ( $element['itemValue'] ) {
case 'title':
if ( $cat_pos === 'gutentor-fp-cat-pos-before-title' || $post_format_pos === 'gutentor-fp-pf-pos-before-title' ) {
$output .= '<div class="gutentor-post-title-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-fp-pf-pos-before-title' ) {
$output .= $this->get_featured_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-fp-cat-pos-before-title' ) {
$output .= $this->get_featured_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_featured_post_title( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_featured_post_title( $post, $attributes );
}
break;
case 'primary-entry-meta':
$output .= $this->get_featured_post_primary_meta( $post, $attributes );
break;
case 'secondary-entry-meta':
$output .= $this->get_featured_post_secondary_meta( $post, $attributes );
break;
case 'avatar':
$output .= $this->get_fp_avatar_data( $post, $attributes );
break;
case 'description':
if ( $cat_pos === 'gutentor-fp-cat-pos-before-ct-box' || $post_format_pos === 'gutentor-fp-pf-pos-before-ct-box' ) {
$output .= '<div class="gutentor-post-desc-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-fp-pf-pos-before-ct-box' ) {
$output .= $this->get_featured_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-fp-cat-pos-before-ct-box' ) {
$output .= $this->get_featured_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_featured_post_description( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_featured_post_description( $post, $attributes );
}
break;
case 'button':
if ( $cat_pos === 'gutentor-fp-cat-pos-before-button' || $post_format_pos === 'gutentor-fp-pf-pos-before-button' ) {
$output .= '<div class="gutentor-post-desc-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-fp-pf-pos-before-button' ) {
$output .= $this->get_featured_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-fp-cat-pos-before-button' ) {
$output .= $this->get_featured_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_featured_post_button( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_featured_post_button( $post, $attributes );
}
break;
default:
$output .= '';
break;
}
endforeach;
endif;
$output .= '</div>';/*.gutentor-post-content*/
$output .= '</div>';/*.gutentor-post-featured-item*/
$output .= '</article>';/*.article*/
return $output;
}
/**
* Get Featured Woo Single item data
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function p6_template2_fp_woo_single_article( $post, $attributes, $index ) {
$output = '';
if ( ! gutentor_is_woocommerce_active() ) {
return $output;
}
$product = wc_get_product( $post->ID );
$rating = $product->get_average_rating();
$count = $product->get_rating_count();
$rating_html = wc_get_rating_html( $rating, $count );
$enable_avatar = isset( $attributes['pFPOnAvatar'] ) && $attributes['pFPOnAvatar'];
$avatar_pos = ( isset( $attributes['pFPAvatarPos'] ) ) ? $attributes['pFPAvatarPos'] : false;
$query_sorting = array_key_exists( 'blockFPSortableItems', $attributes ) ? $attributes['blockFPSortableItems'] : false;
$enable_featured_image = isset( $attributes['pOnFPFImg'] ) && $attributes['pOnFPFImg'];
$enable_post_format = isset( $attributes['pOnFPPostFormatOpt'] ) && $attributes['pOnFPPostFormatOpt'];
$post_format_pos = ( isset( $attributes['pFPPostFormatPos'] ) ) ? $attributes['pFPPostFormatPos'] : false;
$cat_pos = ( isset( $attributes['pFPCatPos'] ) ) ? $attributes['pFPCatPos'] : false;
$enable_featured_cat = isset( $attributes['pOnFPFeaturedCat'] ) && $attributes['pOnFPFeaturedCat'];
$output .= "<article class='" . esc_attr( apply_filters( 'gutentor_post_module_article_class', gutentor_concat_space( 'gutentor-post', 'gutentor-post-featured', 'gutentor-post-item-' . $index ), $attributes ) ) . "'>";
$output .= '<div class="gutentor-post-featured-item">';
if ( $enable_featured_image ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_p6_fp_post_module_post_image_box', 'gutentor-post-image-box', $post, $attributes ) ) . "'>";
$output .= $this->p6_fp_get_woo_product_thumbnail( $post, $product, $attributes );
if ( $enable_avatar && $this->avatar_fp_on_image_condition( $avatar_pos ) ) {
$output .= $this->get_fp_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $this->featured_post_format_on_image_condition( $post_format_pos ) ) {
$output .= $this->p6_fp_new_badge_product( $post, $product );
}
if ( $enable_featured_cat && $this->featured_post_categories_on_image_condition( $cat_pos ) ) {
$output .= $this->p6_fp_get_woo_badge( $post, $product, $attributes );
}
$output .= '</div>';
}
$output .= '<div class="gutentor-post-content">';
if ( $query_sorting ) :
foreach ( $query_sorting as $element ) :
if ( ! ( array_key_exists( 'itemValue', $element ) ) ) {
return $output;
}
switch ( $element['itemValue'] ) {
case 'title':
if ( $cat_pos === 'gutentor-fp-cat-pos-before-title' || $post_format_pos === 'gutentor-fp-pf-pos-before-title' ) {
$output .= '<div class="gutentor-post-title-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-fp-pf-pos-before-title' ) {
$output .= $this->p6_fp_new_badge_product( $post, $product );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-fp-cat-pos-before-title' ) {
$output .= $this->p6_fp_get_woo_badge( $post, $product, $attributes );
}
$output .= $this->get_featured_post_title( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_featured_post_title( $post, $attributes );
}
break;
case 'primary-entry-meta':
$output .= $this->get_featured_post_primary_meta( $post, $attributes );
break;
case 'secondary-entry-meta':
$output .= $this->get_featured_post_secondary_meta( $post, $attributes );
break;
case 'price':
$output .= $this->p6_featured_wc_price( $post, $product, $attributes );
break;
case 'rating':
if ( isset( $attributes['fpWooOnRating'] ) && $attributes['fpWooOnRating'] ) {
if ( $rating_html ) {
$output .= '<div class="gutentor-fp-wc-rating">';
$output .= $rating_html;
$output .= '</div>';
}
}
break;
case 'avatar':
$output .= $this->get_fp_avatar_data( $post, $attributes );
break;
case 'description':
if ( $cat_pos === 'gutentor-fp-cat-pos-before-ct-box' || $post_format_pos === 'gutentor-fp-pf-pos-before-ct-box' ) {
$output .= '<div class="gutentor-post-desc-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-fp-pf-pos-before-ct-box' ) {
$output .= $this->p6_fp_new_badge_product( $post, $product );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-fp-cat-pos-before-ct-box' ) {
$output .= $this->p6_fp_get_woo_badge( $post, $product, $attributes );
}
$output .= $this->get_featured_post_description( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_featured_post_description( $post, $attributes );
}
break;
case 'button':
if ( $cat_pos === 'gutentor-fp-cat-pos-before-button' || $post_format_pos === 'gutentor-fp-pf-pos-before-button' ) {
$output .= '<div class="gutentor-post-desc-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-fp-pf-pos-before-button' ) {
$output .= $this->p6_fp_new_badge_product( $post, $product );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-fp-cat-pos-before-button' ) {
$output .= $this->p6_fp_get_woo_badge( $post, $product, $attributes );
}
if ( isset( $attributes['pOnFPBtn'] ) && $attributes['pOnFPBtn'] ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_product_button_class', 'gutentor-woo-add-to-cart wc-block-grid__product-add-to-cart', $post, $attributes ) ) . "'>";
ob_start();
woocommerce_template_loop_add_to_cart(
array(
'gutentor-attributes' => $attributes,
'gutentor-btn-type' => 'featured',
)
);
$output .= ob_get_clean();
$output .= '</div>';
}
$output .= '</div>';
} elseif ( isset( $attributes['pOnFPBtn'] ) && $attributes['pOnFPBtn'] ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_product_button_class', 'gutentor-woo-add-to-cart wc-block-grid__product-add-to-cart', $post, $attributes ) ) . "'>";
ob_start();
woocommerce_template_loop_add_to_cart(
array(
'gutentor-attributes' => $attributes,
'gutentor-btn-type' => 'featured',
)
);
$output .= ob_get_clean();
$output .= '</div>';
}
break;
default:
$output .= '';
break;
}
endforeach;
endif;
$output .= '</div>';/*.gutentor-post-content*/
$output .= '</div>';/*.gutentor-post-featured-item*/
$output .= '</article>';/*.article*/
return $output;
}
/**
* Get Featured Edd Single item data
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function p6_template2_fp_edd_single_article( $post, $attributes, $index ) {
if ( ! gutentor_is_edd_active() ) {
return '';
}
$download = edd_get_download( $post->ID );
$output = '';
$enable_avatar = isset( $attributes['pFPOnAvatar'] ) && $attributes['pFPOnAvatar'];
$avatar_pos = ( isset( $attributes['pFPAvatarPos'] ) ) ? $attributes['pFPAvatarPos'] : false;
$query_sorting = array_key_exists( 'blockFPSortableItems', $attributes ) ? $attributes['blockFPSortableItems'] : false;
$enable_featured_image = isset( $attributes['pOnFPFImg'] ) && $attributes['pOnFPFImg'];
$enable_post_format = isset( $attributes['pOnFPPostFormatOpt'] ) && $attributes['pOnFPPostFormatOpt'];
$post_format_pos = ( isset( $attributes['pFPPostFormatPos'] ) ) ? $attributes['pFPPostFormatPos'] : false;
$output .= "<article class='" . esc_attr( apply_filters( 'gutentor_post_module_article_class', gutentor_concat_space( 'gutentor-post', 'gutentor-post-featured', 'gutentor-post-item-' . $index ), $attributes ) ) . "'>";
$output .= '<div class="gutentor-post-featured-item">';
if ( $enable_featured_image ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_p6_fp_post_module_post_image_box', 'gutentor-post-image-box', $post, $attributes ) ) . "'>";
$output .= $this->p6_fp_get_edd_thumbnail( $post, $attributes );
if ( $enable_avatar && $this->avatar_fp_on_image_condition( $avatar_pos ) ) {
$output .= $this->get_fp_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $this->featured_post_format_on_image_condition( $post_format_pos ) ) {
$output .= $this->p6_fp_edd_new_badge_product( $post, $download );
}
$output .= '</div>';
}
$output .= '<div class="gutentor-post-content">';
if ( $query_sorting ) :
foreach ( $query_sorting as $element ) :
if ( ! ( array_key_exists( 'itemValue', $element ) ) ) {
return $output;
}
switch ( $element['itemValue'] ) {
case 'title':
if ( $post_format_pos === 'gutentor-fp-pf-pos-before-title' ) {
$output .= '<div class="gutentor-post-title-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-fp-pf-pos-before-title' ) {
$output .= $this->p6_fp_edd_new_badge_product( $post, $download );
}
$output .= $this->get_featured_post_title( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_featured_post_title( $post, $attributes );
}
break;
case 'primary-entry-meta':
$output .= $this->get_featured_post_primary_meta( $post, $attributes );
break;
case 'secondary-entry-meta':
$output .= $this->get_featured_post_secondary_meta( $post, $attributes );
break;
case 'price':
$output .= $this->p6_featured_edd_price( $post, $attributes );
break;
case 'rating':
if ( isset( $attributes['fpWooOnRating'] ) && $attributes['fpWooOnRating'] ) {
if ( gutentor_custom_edd_review( $post->ID ) ) {
$output .= '<div class="gutentor-fp-edd-rating">';
$output .= gutentor_custom_edd_review( $post->ID );
$output .= '</div>';
}
}
break;
case 'avatar':
$output .= $this->get_fp_avatar_data( $post, $attributes );
break;
case 'description':
if ( $post_format_pos === 'gutentor-fp-pf-pos-before-ct-box' ) {
$output .= '<div class="gutentor-post-desc-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-fp-pf-pos-before-ct-box' ) {
$output .= $this->p6_fp_edd_new_badge_product( $post, $download );
}
$output .= $this->get_featured_post_description( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_featured_post_description( $post, $attributes );
}
break;
case 'wishlist':
$output .= $this->get_fp_edd_wish_list( $post, $attributes );
break;
case 'button':
if ( $post_format_pos === 'gutentor-fp-pf-pos-before-button' ) {
$output .= '<div class="gutentor-post-button-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-fp-pf-pos-before-button' ) {
$output .= $this->p6_fp_edd_new_badge_product( $post, $download );
}
$output .= $this->p6_get_fp_edd_button( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->p6_get_fp_edd_button( $post, $attributes );
}
break;
default:
$output .= '';
break;
}
endforeach;
endif;
$output .= '</div>';/*.gutentor-post-content*/
$output .= '</div>';/*.gutentor-post-featured-item*/
$output .= '</article>';/*.article*/
return $output;
}
/**
* Content On Image Template 1
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @param {array} $content
* @return {mix}
*/
public function template_data( $output, $the_query, $attributes, $content ) {
$template = $attributes['p6Temp'] ? $attributes['p6Temp'] : '';
$post_number = $attributes['postsToShow'] ? $attributes['postsToShow'] : '';
$post_type = ( isset( $attributes['pPostType'] ) ) ? $attributes['pPostType'] : 'post';
if ( $template !== 'gutentor_p6_template2' ) {
return $output;
}
$index = 0;
$post_categories = array();
while ( $the_query->have_posts() ) :
$the_query->the_post();
$post_categories = array_merge( $post_categories, wp_get_post_categories( get_the_ID() ) );
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p6_grid_column_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
if ( $post_type === 'product' ) {
$output .= $this->p6_template2_fp_woo_single_article( get_post(), $attributes, $index );
} elseif ( $post_type === 'download' ) {
$output .= $this->p6_template2_fp_edd_single_article( get_post(), $attributes, $index );
} else {
$output .= $this->p6_template2_featured_single_article( get_post(), $attributes, $index );
}
$output .= '</div>';
}
if ( $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_grid_column_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index > 0 && $index < $post_number ) {
if ( $post_type === 'product' ) {
$output .= $this->p6_woo_single_article( get_post(), $attributes, $index );
} elseif ( $post_type === 'download' ) {
$output .= $this->p6_edd_single_article( get_post(), $attributes, $index );
} else {
$output .= $this->p6_single_article( get_post(), $attributes, $index );
}
}
if ( $index + 1 === $post_number ) {
$output .= '</div>';
}
++$index;
endwhile;
if ( $post_categories && $content === 'ajax' ) {
$cat_style = gutentor_pm_post_dynamic_categories_color( array_unique( $post_categories ) );
if ( $cat_style ) {
$output .= '<style>' . wp_strip_all_tags( $cat_style ) . '</style>';
}
}
return $output;
}
}
}
Gutentor_Duplex_P6_T2::get_instance()->run();

View File

@@ -0,0 +1,560 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured' ) ) {
/**
* Gutentor_Featured Class For Gutentor
*
* @package Gutentor
* @since 2.0.5
*/
class Gutentor_Featured extends Gutentor_Query_Elements {
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Run Block
*
* @access public
* @since 2.0.0
* @return void
*/
public function run() {
add_filter( 'gutentor_post_module_p2_query_data', array( $this, 'post_template' ), 999, 3 );
add_filter( 'gutentor_term_module_t2_query_data', array( $this, 'term_template' ), 999, 3 );
}
/**
* Load Dependencies
* Used for blog template loading
*
* @since 1.0.1
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function load_dependencies() {
/*Load file once*/
static $loaded = false;
if ( ! $loaded ) {
$loaded = true;
/*Template 1*/
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-1/t-1.php';
/*Template 2*/
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-2/t-1.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-2/t-2.php';
/*Template 3*/
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-3/t-1.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-3/t-2.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-3/t-3.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-3/t-4.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-3/t-5.php';
/*Template 4*/
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-4/t-1.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-4/t-2.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-4/t-3.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-4/t-4.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-4/t-5.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-4/t-6.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-4/t-7.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-4/t-8.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-4/t-9.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-4/t-10.php';
/*Template 5*/
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-5/t-1.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-5/t-2.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-5/t-3.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-5/t-4.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-5/t-5.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-5/t-6.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-5/t-7.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-5/t-8.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-5/t-9.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-5/t-10.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-5/t-11.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-5/t-12.php';
/*Template 6*/
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-6/t-1.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-6/t-2.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-6/t-3.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-6/t-4.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-6/t-5.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-6/t-6.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-6/t-7.php';
require_once GUTENTOR_PATH . 'includes/block-templates/featured/n-6/t-8.php';
}
}
/**
* Check if P2
*
* @param {array} output
*
* @return {boolean}
*/
public function isP2( $attributes ) {
$block_name = ( isset( $attributes['gName'] ) ) ? $attributes['gName'] : '';
if ( 'gutentor/p2' !== $block_name ) {
return false;
}
$template = ( isset( $attributes['p2Temp'] ) ) ? $attributes['p2Temp'] : '';
if ( $this->template !== $template ) {
return false;
}
$number = ( isset( $attributes['postsToShow'] ) ) ? $attributes['postsToShow'] : '';
if ( $this->number !== $number ) {
return false;
}
return true;
}
/**
* Check if T2
*
* @param {array} output
*
* @return {boolean}
*/
public function isT2( $attributes ) {
$block_name = ( isset( $attributes['gName'] ) ) ? $attributes['gName'] : '';
if ( 'gutentor/t2' !== $block_name ) {
return false;
}
$template = ( isset( $attributes['t2Temp'] ) ) ? $attributes['t2Temp'] : '';
if ( $this->template !== $template ) {
return false;
}
$number = ( isset( $attributes['t2Number'] ) ) ? $attributes['t2Number'] : '';
if ( $this->number !== $number ) {
return false;
}
return true;
}
/**
* Get Single block
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function p2_single_article( $post, $attributes, $index ) {
$output = '';
$enable_post_format = isset( $attributes['pOnPostFormatOpt'] ) && $attributes['pOnPostFormatOpt'];
$post_format_pos = ( isset( $attributes['pPostFormatPos'] ) ) ? $attributes['pPostFormatPos'] : false;
$cat_pos = ( isset( $attributes['pPostCatPos'] ) ) ? $attributes['pPostCatPos'] : false;
$enable_featured_cat = isset( $attributes['pOnFeaturedCat'] ) && $attributes['pOnFeaturedCat'];
$enable_avatar = isset( $attributes['pOnAvatar'] ) && $attributes['pOnAvatar'];
$avatar_pos = ( isset( $attributes['pAvatarPos'] ) ) ? $attributes['pAvatarPos'] : false;
$thumb_class = has_post_thumbnail() ? '' : 'gutentor-post-no-thumb gtf-no-thumb';
$output .= "<article class='" . esc_attr( apply_filters( 'gutentor_post_module_article_class', gutentor_concat_space( 'gutentor-post gtf-item-wrap', $thumb_class, 'gutentor-post-item-' . $index, 'gtf-item-' . $index ), $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_post_item', gutentor_concat_space( 'gutentor-post-item', 'gtf-item' ), $attributes ) ) . "'>";
if ( has_post_thumbnail( $post->ID ) ) {
$enable_overlayImage = false;
$overlayImage = ( isset( $attributes['pFImgOColor'] ) ) ? $attributes['pFImgOColor'] : false;
if ( $overlayImage ) {
$enable_overlayImage = ( isset( $attributes['pFImgOColor']['enable'] ) ) ? $attributes['pFImgOColor']['enable'] : false;
}
$url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $attributes['pFImgSize'] );
$background = '';
if ( isset( $url[0] ) ) {
$background = 'style="background-image:url(' . esc_url( $url[0] ) . ')"';
}
$overlay = $enable_overlayImage ? 'gutentor-overlay g-overlay' : '';/*gutentor-overlay for bc*/
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_post_item_height', gutentor_concat_space( 'gutentor-bg-image gtf-bg-image', 'gutentor-post-height gtf-item-height', $overlay ), $attributes ) ) . "' " . $background . '>';
if ( $enable_avatar && $this->avatar_on_image_condition( $avatar_pos ) ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $this->post_format_on_image_condition( $post_format_pos ) ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $this->categories_on_image_condition( $cat_pos ) ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= apply_filters( 'gutentor_edit_post_module_featured_image_popup_data', '', $post, $attributes );
$output .= '<div class="gutentor-post-content gtf-content">';/*gutentor-post-content for bc*/
$output .= $this->get_primary_meta( $post, $attributes );
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-title' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-title' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-title' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_title( $post, $attributes );
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-content' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-ct-box' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-ct-box' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_description( $post, $attributes );
$output .= $this->get_secondary_meta( $post, $attributes );
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-button' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-button' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-button' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_button( $post, $attributes );
$output .= '</div>';/*.gtf-content*/
$output .= apply_filters( 'gutentor_post_type_featured_after_content', '', $post, $attributes );
$output .= '</div>';/*.gtf-bg-image*/
} else {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_post_item_height', gutentor_concat_space( 'gutentor-post-height', 'gtf-item-height' ), $attributes ) ) . "'>";
if ( $enable_avatar && $this->avatar_on_image_condition( $avatar_pos ) ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $this->post_format_on_image_condition( $post_format_pos ) ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $this->categories_on_image_condition( $cat_pos ) ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= apply_filters( 'gutentor_edit_post_module_featured_image_popup_data', '', $post, $attributes );
$output .= '<div class="gutentor-post-content gtf-content">';/*gutentor-post-content for bc*/
$output .= $this->get_primary_meta( $post, $attributes );
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-title' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-title' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-title' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_title( $post, $attributes );
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-content' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-ct-box' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-ct-box' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_description( $post, $attributes );
$output .= $this->get_secondary_meta( $post, $attributes );
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-button' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-button' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-button' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_button( $post, $attributes );
$output .= '</div>';/*.gtf-content*/
$output .= apply_filters( 'gutentor_post_type_featured_after_content', '', $post, $attributes );
$output .= '</div>';/*.gtf-item-height*/
}
$output .= '</div>';/*.gutentor-post-item*/
$output .= '</article>';/*.article*/
return $output;
}
/**
* Get Woo Single block
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function p2_woo_single_article( $post, $attributes, $index ) {
$output = '';
if ( ! gutentor_is_woocommerce_active() ) {
return $output;
}
$product = wc_get_product( $post->ID );
$rating = $product->get_average_rating();
$count = $product->get_rating_count();
$rating_html = wc_get_rating_html( $rating, $count );
$enable_post_format = isset( $attributes['pOnPostFormatOpt'] ) && $attributes['pOnPostFormatOpt'];
$post_format_pos = ( isset( $attributes['pPostFormatPos'] ) ) ? $attributes['pPostFormatPos'] : false;
$cat_pos = ( isset( $attributes['pPostCatPos'] ) ) ? $attributes['pPostCatPos'] : false;
$enable_featured_cat = isset( $attributes['pOnFeaturedCat'] ) && $attributes['pOnFeaturedCat'];
$output .= "<article class='" . esc_attr( apply_filters( 'gutentor_post_module_article_class', gutentor_concat_space( 'gutentor-post gtf-item-wrap', 'gutentor-post-item-' . $index, 'gtf-item-' . $index ), $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_post_item', gutentor_concat_space( 'gutentor-post-item', 'gtf-item' ), $attributes ) ) . "'>";
$enable_overlayImage = false;
$overlayImage = isset( $attributes['pFImgOColor'] ) && $attributes['pFImgOColor'];
if ( $overlayImage ) {
$enable_overlayImage = ( isset( $attributes['pFImgOColor']['enable'] ) ) ? $attributes['pFImgOColor']['enable'] : false;
}
$url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $attributes['pFImgSize'] );
$default_url = WC()->plugin_url() . '/assets/images/placeholder.png';
$overlay = $enable_overlayImage ? 'gutentor-overlay g-overlay' : '';/*gutentor-overlay for bc*/
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_post_item_height', gutentor_concat_space( 'gutentor-bg-image gtf-bg-image', 'gutentor-post-height gtf-item-height', $overlay ), $attributes ) ) . "' style='background-image:url(" . esc_url( is_array( $url ) && ! empty( $url ) ? $url[0] : $default_url ) . ")'>";
if ( $enable_post_format && $this->post_format_on_image_condition( $post_format_pos ) ) {
$output .= $this->new_badge_product( $post, $product );
}
if ( $enable_featured_cat && $this->categories_on_image_condition( $cat_pos ) ) {
$output .= $this->get_woo_badge( $post, $product, $attributes );
}
$output .= apply_filters( 'gutentor_edit_post_module_featured_image_popup_data', '', $post, $attributes );
$output .= '<div class="gutentor-post-content gtf-content">';/*gutentor-post-content for bc*/
$output .= $this->get_primary_meta( $post, $attributes );
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-title' ) {
$output .= $this->new_badge_product( $post, $product );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-title' ) {
$output .= $this->get_woo_badge( $post, $product, $attributes );
}
$output .= $this->get_title( $post, $attributes );
$output .= $this->updated_wc_price( $post, $product, $attributes );
if ( isset( $attributes['wooOnRating'] ) && $attributes['wooOnRating'] ) {
if ( $rating_html ) {
$output .= '<div class="gutentor-wc-rating">';
$output .= $rating_html;
$output .= '</div>';
}
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-ct-box' ) {
$output .= $this->new_badge_product( $post, $product );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-ct-box' ) {
$output .= $this->get_woo_badge( $post, $product, $attributes );
}
$output .= $this->get_description( $post, $attributes );
$output .= $this->get_secondary_meta( $post, $attributes );
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-button' ) {
$output .= $this->new_badge_product( $post, $product );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-button' ) {
$output .= $this->get_woo_badge( $post, $product, $attributes );
}
if ( isset( $attributes['pOnBtn'] ) && $attributes['pOnBtn'] ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_product_button_class', 'gutentor-woo-add-to-cart wc-block-grid__product-add-to-cart', $post, $attributes ) ) . "'>";
ob_start();
woocommerce_template_loop_add_to_cart( array( 'gutentor-attributes' => $attributes ) );
$output .= ob_get_clean();
$output .= '</div>';
}
$output .= '</div>';/*.gtf-content*/
$output .= apply_filters( 'gutentor_post_type_featured_after_content', '', $post, $attributes );
$output .= '</div>';/*.gtf-bg-image*/
$output .= '</div>';/*.gutentor-post-item*/
$output .= '</article>';/*.article*/
return $output;
}
/**
* Get Edd Single block
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function p2_edd_single_article( $post, $attributes, $index ) {
if ( ! gutentor_is_edd_active() ) {
return '';
}
$download = edd_get_download( $post->ID );
$output = '';
$enable_avatar = isset( $attributes['pOnAvatar'] ) && $attributes['pOnAvatar'];
$avatar_pos = ( isset( $attributes['pAvatarPos'] ) ) ? $attributes['pAvatarPos'] : false;
$enable_post_format = isset( $attributes['pOnPostFormatOpt'] ) && $attributes['pOnPostFormatOpt'];
$post_format_pos = ( isset( $attributes['pPostFormatPos'] ) ) ? $attributes['pPostFormatPos'] : false;
$output .= "<article class='" . esc_attr( apply_filters( 'gutentor_post_module_article_class', gutentor_concat_space( 'gutentor-post gtf-item-wrap', 'gutentor-post-item-' . $index, 'gtf-item-' . $index ), $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_post_item', gutentor_concat_space( 'gutentor-post-item', 'gtf-item' ), $attributes ) ) . "'>";
$enable_overlayImage = false;
$overlayImage = isset( $attributes['pFImgOColor'] ) && $attributes['pFImgOColor'];
if ( $overlayImage ) {
$enable_overlayImage = ( isset( $attributes['pFImgOColor']['enable'] ) ) ? $attributes['pFImgOColor']['enable'] : false;
}
$url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $attributes['pFImgSize'] );
$default_url = GUTENTOR_URL . 'assets/img/default-image.jpg';
$overlay = $enable_overlayImage ? 'gutentor-overlay g-overlay' : '';/*gutentor-overlay for bc*/
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_post_item_height', gutentor_concat_space( 'gutentor-bg-image gtf-bg-image', 'gutentor-post-height gtf-item-height', $overlay ), $attributes ) ) . "' style='background-image:url(" . esc_url( is_array( $url ) && ! empty( $url ) ? $url[0] : $default_url ) . ")'>";
if ( $enable_avatar && $this->avatar_on_image_condition( $avatar_pos ) ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $this->post_format_on_image_condition( $post_format_pos ) ) {
$output .= $this->edd_new_badge_product( $post, $download );
}
$output .= apply_filters( 'gutentor_edit_post_module_featured_image_popup_data', '', $post, $attributes );
$output .= '<div class="gutentor-post-content gtf-content">';/*gutentor-post-content for bc*/
$output .= $this->get_primary_meta( $post, $attributes );
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-title' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-title' ) {
$output .= $this->edd_new_badge_product( $post, $download );
}
$output .= $this->get_title( $post, $attributes );
$output .= $this->updated_edd_price( $post, $attributes );
if ( isset( $attributes['wooOnRating'] ) && $attributes['wooOnRating'] ) {
if ( gutentor_custom_edd_review( $post->ID ) ) {
$output .= '<div class="gutentor-edd-rating">';
$output .= gutentor_custom_edd_review( $post->ID );
$output .= '</div>';
}
}
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-content' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-ct-box' ) {
$output .= $this->edd_new_badge_product( $post, $download );
}
$output .= $this->get_description( $post, $attributes );
$output .= $this->get_secondary_meta( $post, $attributes );
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-button' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-button' ) {
$output .= $this->edd_new_badge_product( $post, $download );
}
$output .= $this->get_edd_wish_list( $post, $attributes );
$output .= $this->get_edd_button( $post, $attributes );
$output .= '</div>';/*.gtf-content*/
$output .= apply_filters( 'gutentor_post_type_featured_after_content', '', $post, $attributes );
$output .= '</div>';/*.gtf-bg-image*/
$output .= '</div>';/*.gutentor-post-item*/
$output .= '</article>';/*.article*/
return $output;
}
/**
* Featured Post type template
*
* @param {string} $data
* @param {object} $post
* @param {array} $attributes
* @return {mix}
*
* @return {boolean}
*/
public function featured_post_type_template( $post, $attributes, $index ) {
$post_type = ( isset( $attributes['pPostType'] ) ) ? $attributes['pPostType'] : 'post';
if ( 'product' === $post_type ) {
return $this->p2_woo_single_article( $post, $attributes, $index );
} elseif ( 'download' === $post_type ) {
return $this->p2_edd_single_article( $post, $attributes, $index );
} else {
return $this->p2_single_article( $post, $attributes, $index );
}
}
/**
* Get T2 Single item
*
* @param {string} $data
* @param {array} $term
* @param {array} $attributes
* @return {mix}
*/
public function t2_single_article( $term, $attributes, $index ) {
$output = '';
$no_thumb = '';
$bg_image = '';
$url = '';
$thumbnail_size = ( isset( $attributes['tFImgSize'] ) ) ? $attributes['tFImgSize'] : 'large';
if ( $this->has_term_thumbnail( $term ) ) {
$image_url = wp_get_attachment_image_src( $this->get_term_thumbnail_id( $term ), $thumbnail_size );
if ( ! $image_url ) {
$image_url[0] = GUTENTOR_URL . 'assets/img/default-image.jpg';
}
$url = $image_url[0];
$url = 'style="background-image:url(' . esc_url( $url ) . ')"';
$bg_image = 'gtf-bg-image';
} else {
$no_thumb = 'gtf-no-thumb';
}
$output .= "<article class='" . esc_attr( apply_filters( 'gutentor_term_module_article_class', gutentor_concat_space( 'gtf-item-wrap', 'gtf-item-' . $index, $no_thumb ), $attributes ) ) . "'>";
$output .= '<div class="gtf-item">';
$enable_overlayImage = false;
$overlayImage = isset( $attributes['tFImgOC'] ) && $attributes['tFImgOC'];
if ( $overlayImage ) {
$enable_overlayImage = ( isset( $attributes['tFImgOC']['enable'] ) ) ? $attributes['tFImgOC']['enable'] : false;
}
$overlay = $enable_overlayImage ? 'g-overlay' : '';
$output .= '<div class="' . esc_attr( gutentor_concat_space( $bg_image, 'gtf-item-height', $overlay ) ) . '" ' . $url . '>';
$output .= '<div class="gtf-content">';
$output .= $this->get_term_title_and_count( $term, $attributes );
$output .= $this->get_term_description( $term, $attributes );
$output .= $this->get_term_button( $term, $attributes );
$output .= '</div>';/*.g-term-content*/
$output .= '</div>';/*.gtf-bg-image*/
$output .= '</div>';/*.gutentor-term-item*/
$output .= '</article>';/*.article*/
return $output;
}
}
}
Gutentor_Featured::get_instance()->load_dependencies();

View File

@@ -0,0 +1,108 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N1_T1' ) ) {
/**
* Gutentor_Featured_N1_T1 Class For Gutentor
*
* @package Gutentor
* @since 2.0.5
*/
class Gutentor_Featured_N1_T1 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 1;
/**
* Number of public
*
* @access private
* @since 3.0.0
* @var integer
*/
public $template = 1;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N1_T1::get_instance()->run();

View File

@@ -0,0 +1,107 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N2_T1' ) ) {
/**
* Gutentor_Featured_N2_T1 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N2_T1 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 2;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 1;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N2_T1::get_instance()->run();

View File

@@ -0,0 +1,109 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N2_T2' ) ) {
/**
* Gutentor_Featured_N2_T2 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N2_T2 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 2;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 2;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N2_T2::get_instance()->run();

View File

@@ -0,0 +1,109 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N3_T1' ) ) {
/**
* Gutentor_Featured_N3_T1 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N3_T1 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 3;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 1;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N3_T1::get_instance()->run();

View File

@@ -0,0 +1,129 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N3_T2' ) ) {
/**
* Gutentor_Featured_N3_T2 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N3_T2 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 3;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 2;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 0 || $index === 1 ) {
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
}
if ( $index === 1 ) {
$output .= '</div>';/*$index === 1*/
}
if ( $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 0 || $index === 1 ) {
$output .= $this->t2_single_article( $term, $attributes, $index );
}
if ( $index === 1 ) {
$output .= '</div>';/*$index === 1*/
}
if ( $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N3_T2::get_instance()->run();

View File

@@ -0,0 +1,129 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N3_T3' ) ) {
/**
* Gutentor_Featured_N3_T3 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N3_T3 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 3;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 3;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 1 || $index === 2 ) {
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
}
if ( $index === 2 ) {
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 1 || $index === 2 ) {
$output .= $this->t2_single_article( $term, $attributes, $index );
}
if ( $index === 2 ) {
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N3_T3::get_instance()->run();

View File

@@ -0,0 +1,121 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N3_T4' ) ) {
/**
* Gutentor_Featured_N3_T4 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N3_T4 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 3;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 4;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 || $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-lg-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-12 grid-lg-12 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 || $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-lg-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-12 grid-lg-12 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N3_T4::get_instance()->run();

View File

@@ -0,0 +1,121 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N3_T5' ) ) {
/**
* Gutentor_Featured_N3_T5 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N3_T5 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 3;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 5;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-12 grid-lg-12 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 || $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-lg-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-12 grid-lg-12 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 || $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-lg-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N3_T5::get_instance()->run();

View File

@@ -0,0 +1,107 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N4_T1' ) ) {
/**
* Gutentor_Featured_N4_T1 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N4_T1 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 4;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 1;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-3 grid-md-3 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-3 grid-md-3 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N4_T1::get_instance()->run();

View File

@@ -0,0 +1,144 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N4_T10' ) ) {
/**
* Gutentor_Featured_N4_T10 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N4_T10 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 4;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 10;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_grid_row_class', 'grid-row', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-12 grid-md-12 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 || $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 2 ) {
$output .= '</div>';
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_row_class', 'grid-row', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-12 grid-md-12 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 || $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 2 ) {
$output .= '</div>';
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N4_T10::get_instance()->run();

View File

@@ -0,0 +1,107 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N4_T2' ) ) {
/**
* Gutentor_Featured_N4_T2 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N4_T2 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 4;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 2;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N4_T2::get_instance()->run();

View File

@@ -0,0 +1,129 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N4_T3' ) ) {
/**
* Gutentor_Featured_N4_T3 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N4_T3 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 4;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 3;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index > 0 && $index < 4 ) {
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
}
if ( $index === 3 ) {
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index > 0 && $index < 4 ) {
$output .= $this->t2_single_article( $term, $attributes, $index );
}
if ( $index === 3 ) {
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N4_T3::get_instance()->run();

View File

@@ -0,0 +1,129 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N4_T4' ) ) {
/**
* Gutentor_Featured_N4_T4 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N4_T4 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 4;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 4;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index < 3 ) {
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
}
if ( $index === 2 ) {
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index < 3 ) {
$output .= $this->t2_single_article( $term, $attributes, $index );
}
if ( $index === 2 ) {
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N4_T4::get_instance()->run();

View File

@@ -0,0 +1,139 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N4_T5' ) ) {
/**
* Gutentor_Featured_N4_T5 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N4_T5 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 4;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 5;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-12 grid-md-12 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-12 grid-md-12 grid-12', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_grid_row_class', 'grid-row', $attributes ) ) . "'>";
}
if ( $index > 0 && $index < 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= '</div>';
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-12 grid-md-12 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-12 grid-md-12 grid-12', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_row_class', 'grid-row', $attributes ) ) . "'>";
}
if ( $index > 0 && $index < 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= '</div>';
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N4_T5::get_instance()->run();

View File

@@ -0,0 +1,137 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N4_T6' ) ) {
/**
* Gutentor_Featured_N4_T6 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N4_T6 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 4;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 6;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-12 grid-md-12 grid-12', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_grid_row_class', 'grid-row', $attributes ) ) . "'>";
}
if ( $index < 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 2 ) {
$output .= '</div>';
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-12 grid-md-12 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-12 grid-md-12 grid-12', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_row_class', 'grid-row', $attributes ) ) . "'>";
}
if ( $index < 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 2 ) {
$output .= '</div>';
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-12 grid-md-12 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N4_T6::get_instance()->run();

View File

@@ -0,0 +1,145 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N4_T7' ) ) {
/**
* Gutentor_Featured_N4_T7 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N4_T7 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 4;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 7;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_grid_row_class', 'grid-row', $attributes ) ) . "'>";
}
if ( $index === 1 || $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-12 grid-md-12 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_row_class', 'grid-row', $attributes ) ) . "'>";
}
if ( $index === 1 || $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-12 grid-md-12 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N4_T7::get_instance()->run();

View File

@@ -0,0 +1,145 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N4_T8' ) ) {
/**
* Gutentor_Featured_N4_T8 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N4_T8 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 4;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 8;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_grid_row_class', 'grid-row', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-12 grid-md-12 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 2 || $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= '</div>';
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_row_class', 'grid-row', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-12 grid-md-12 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 2 || $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= '</div>';
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N4_T8::get_instance()->run();

View File

@@ -0,0 +1,145 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N4_T9' ) ) {
/**
* Gutentor_Featured_N4_T9 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N4_T9 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 4;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 9;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_grid_row_class', 'grid-row', $attributes ) ) . "'>";
}
if ( $index === 0 || $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-12 grid-md-12 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_row_class', 'grid-row', $attributes ) ) . "'>";
}
if ( $index === 0 || $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-12 grid-md-12 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N4_T9::get_instance()->run();

View File

@@ -0,0 +1,107 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N5_T1' ) ) {
/**
* Gutentor_Featured_N5_T1 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N5_T1 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 5;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 1;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-2m3 grid-md-2m3 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-2m3 grid-md-2m3 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N5_T1::get_instance()->run();

View File

@@ -0,0 +1,121 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N5_T10' ) ) {
/**
* Gutentor_Featured_N5_T10 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N5_T10 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 5;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 10;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 0 || $index === 2 || $index === 3 || $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 0 || $index === 2 || $index === 3 || $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N5_T10::get_instance()->run();

View File

@@ -0,0 +1,121 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N5_T11' ) ) {
/**
* Gutentor_Featured_N5_T11 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N5_T11 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 5;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 11;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 0 || $index === 1 || $index === 2 || $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 0 || $index === 1 || $index === 2 || $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N5_T11::get_instance()->run();

View File

@@ -0,0 +1,121 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N5_T12' ) ) {
/**
* Gutentor_Featured_N5_T12 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N5_T12 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 5;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 12;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 || $index === 1 || $index === 2 || $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 || $index === 1 || $index === 2 || $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N5_T12::get_instance()->run();

View File

@@ -0,0 +1,139 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N5_T2' ) ) {
/**
* Gutentor_Featured_N5_T2 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N5_T2 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 5;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 2;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_grid_row_class', 'grid-row', $attributes ) ) . "'>";
}
if ( $index > 0 && $index < 6 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 5 ) {
$output .= '</div>';
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_row_class', 'grid-row', $attributes ) ) . "'>";
}
if ( $index > 0 && $index < 6 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 5 ) {
$output .= '</div>';
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N5_T2::get_instance()->run();

View File

@@ -0,0 +1,137 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N5_T3' ) ) {
/**
* Gutentor_Featured_N5_T3 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N5_T3 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 5;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 3;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_grid_row_class', 'grid-row', $attributes ) ) . "'>";
}
if ( $index < 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= '</div>';
$output .= '</div>';
}
if ( $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_row_class', 'grid-row', $attributes ) ) . "'>";
}
if ( $index < 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= '</div>';
$output .= '</div>';
}
if ( $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N5_T3::get_instance()->run();

View File

@@ -0,0 +1,147 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N5_T4' ) ) {
/**
* Gutentor_Featured_N5_T4 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N5_T4 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 5;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 4;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
}
if ( $index === 0 || $index === 1 ) {
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
}
if ( $index === 1 ) {
$output .= '</div>';
}
if ( $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
}
if ( $index === 3 || $index === 4 ) {
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
}
if ( $index === 4 ) {
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
}
if ( $index === 0 || $index === 1 ) {
$output .= $this->t2_single_article( $term, $attributes, $index );
}
if ( $index === 1 ) {
$output .= '</div>';
}
if ( $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
}
if ( $index === 3 || $index === 4 ) {
$output .= $this->t2_single_article( $term, $attributes, $index );
}
if ( $index === 4 ) {
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N5_T4::get_instance()->run();

View File

@@ -0,0 +1,121 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N5_T5' ) ) {
/**
* Gutentor_Featured_N5_T5 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N5_T5 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 5;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 5;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 || $index === 1 || $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 3 || $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 || $index === 1 || $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 3 || $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N5_T5::get_instance()->run();

View File

@@ -0,0 +1,121 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N5_T6' ) ) {
/**
* Gutentor_Featured_N5_T6 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N5_T6 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 5;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 6;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 || $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 2 || $index === 3 || $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 || $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 2 || $index === 3 || $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N5_T6::get_instance()->run();

View File

@@ -0,0 +1,137 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N5_T7' ) ) {
/**
* Gutentor_Featured_N5_T7 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N5_T7 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 5;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 7;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 0 || $index === 1 ) {
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
}
if ( $index === 1 ) {
$output .= '</div>';
}
if ( $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 2 || $index === 3 || $index === 4 ) {
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
}
if ( $index === 4 ) {
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 0 || $index === 1 ) {
$output .= $this->t2_single_article( $term, $attributes, $index );
}
if ( $index === 1 ) {
$output .= '</div>';
}
if ( $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 2 || $index === 3 || $index === 4 ) {
$output .= $this->t2_single_article( $term, $attributes, $index );
}
if ( $index === 4 ) {
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N5_T7::get_instance()->run();

View File

@@ -0,0 +1,137 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N5_T8' ) ) {
/**
* Gutentor_Featured_N5_T8 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N5_T8 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 5;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 8;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 0 || $index === 1 || $index === 2 ) {
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
}
if ( $index === 2 ) {
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 3 || $index === 4 ) {
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
}
if ( $index === 4 ) {
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 0 || $index === 1 || $index === 2 ) {
$output .= $this->t2_single_article( $term, $attributes, $index );
}
if ( $index === 2 ) {
$output .= '</div>';
}
if ( $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 3 || $index === 4 ) {
$output .= $this->t2_single_article( $term, $attributes, $index );
}
if ( $index === 4 ) {
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N5_T8::get_instance()->run();

View File

@@ -0,0 +1,121 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N5_T9' ) ) {
/**
* Gutentor_Featured_N5_T9 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N5_T9 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 5;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 9;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 || $index === 2 || $index === 3 || $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-8 grid-md-8 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 1 || $index === 2 || $index === 3 || $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N5_T9::get_instance()->run();

View File

@@ -0,0 +1,107 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N6_T1' ) ) {
/**
* Gutentor_Featured_N6_T1 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N6_T1 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 6;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 1;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-2 grid-md-2 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-2 grid-md-2 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N6_T1::get_instance()->run();

View File

@@ -0,0 +1,107 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N6_T2' ) ) {
/**
* Gutentor_Featured_N6_T2 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N6_T2 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 6;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 2;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-4 grid-md-4 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N6_T2::get_instance()->run();

View File

@@ -0,0 +1,121 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N6_T3' ) ) {
/**
* Gutentor_Featured_N6_T3 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N6_T3 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 6;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 3;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 || $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 2 || $index === 3 || $index === 4 || $index === 5 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-3 grid-md-3 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 || $index === 1 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 2 || $index === 3 || $index === 4 || $index === 5 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-3 grid-md-3 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N6_T3::get_instance()->run();

View File

@@ -0,0 +1,121 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N6_T4' ) ) {
/**
* Gutentor_Featured_N6_T4 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N6_T4 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 6;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 4;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 || $index === 1 || $index === 2 || $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-3 grid-md-3 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 4 || $index === 5 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 || $index === 1 || $index === 2 || $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-3 grid-md-3 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 4 || $index === 5 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N6_T4::get_instance()->run();

View File

@@ -0,0 +1,137 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N6_T5' ) ) {
/**
* Gutentor_Featured_N6_T5 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N6_T5 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 6;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 5;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 0 || $index === 1 ) {
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
}
if ( $index === 1 ) {
$output .= '</div>';
}
if ( $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 2 || $index === 3 || $index === 4 || $index === 5 ) {
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
}
if ( $index === 5 ) {
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 0 || $index === 1 ) {
$output .= $this->t2_single_article( $term, $attributes, $index );
}
if ( $index === 1 ) {
$output .= '</div>';
}
if ( $index === 2 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 2 || $index === 3 || $index === 4 || $index === 5 ) {
$output .= $this->t2_single_article( $term, $attributes, $index );
}
if ( $index === 5 ) {
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N6_T5::get_instance()->run();

View File

@@ -0,0 +1,137 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N6_T6' ) ) {
/**
* Gutentor_Featured_N6_T6 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N6_T6 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 6;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 6;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 0 || $index === 1 || $index === 2 || $index === 3 ) {
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
}
if ( $index === 3 ) {
$output .= '</div>';
}
if ( $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 4 || $index === 5 ) {
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
}
if ( $index === 5 ) {
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 0 || $index === 1 || $index === 2 || $index === 3 ) {
$output .= $this->t2_single_article( $term, $attributes, $index );
}
if ( $index === 3 ) {
$output .= '</div>';
}
if ( $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
}
if ( $index === 4 || $index === 5 ) {
$output .= $this->t2_single_article( $term, $attributes, $index );
}
if ( $index === 5 ) {
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N6_T6::get_instance()->run();

View File

@@ -0,0 +1,121 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N6_T7' ) ) {
/**
* Gutentor_Featured_N6_T7 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N6_T7 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 6;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 7;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 1 || $index === 2 || $index === 3 || $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-3 grid-md-3 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 0 || $index === 5 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 1 || $index === 2 || $index === 3 || $index === 4 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-3 grid-md-3 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 0 || $index === 5 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N6_T7::get_instance()->run();

View File

@@ -0,0 +1,121 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Featured_N6_T8' ) ) {
/**
* Gutentor_Featured_N6_T8 Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Featured_N6_T8 extends Gutentor_Featured {
/**
* Number of items
*
* @access public
* @since 3.0.0
* @var integer
*/
public $number = 6;
/**
* Number of template
*
* @access public
* @since 3.0.0
* @var integer
*/
public $template = 8;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid interface and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Post template
*
* @param {string} $output
* @param {object} $the_query
* @param {array} $attributes
*
* @return {string}
*/
public function post_template( $output, $the_query, $attributes ) {
if ( ! $this->isP2( $attributes ) ) {
return $output;
}
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
if ( $index === 0 || $index == 1 || $index === 4 || $index === 5 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-3 grid-md-3 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
if ( $index === 2 || $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->featured_post_type_template( get_post(), $attributes, $index );
$output .= '</div>';
}
++$index;
endwhile;
return $output;
}
/**
* Term Template
*
* @param {string} $output
* @param {array} $terms
* @param {array} $attributes
*
* @return {string}
*/
public function term_template( $output, $terms, $attributes ) {
if ( ! $this->isT2( $attributes ) ) {
return $output;
}
$index = 0;
foreach ( $terms as $term ) {
if ( $index === 0 || $index == 1 || $index === 4 || $index === 5 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-3 grid-md-3 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
if ( $index === 2 || $index === 3 ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t2_grid_class', 'grid-lg-6 grid-md-6 grid-12', $attributes ) ) . "'>";
$output .= $this->t2_single_article( $term, $attributes, $index );
$output .= '</div>';
}
++$index;
}
return $output;
}
}
}
Gutentor_Featured_N6_T8::get_instance()->run();

View File

@@ -0,0 +1,892 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Normal_P1_Templates' ) ) {
/**
* Blog_Post_Templates Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Normal_P1_Templates extends Gutentor_Query_Elements {
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Run Block
*
* @access public
* @since 2.0.0
* @return void
*/
public function run() {
add_filter( 'gutentor_post_module_p1_query_data', array( $this, 'load_blog_post_template' ), 99999, 3 );
}
/**
* Load Grid Template 1
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function gutentor_p1_grid_template1( $data, $post, $attributes ) {
$query_sorting = array_key_exists( 'blockSortableItems', $attributes ) ? $attributes['blockSortableItems'] : false;
$enable_post_format = isset( $attributes['pOnPostFormatOpt'] ) && $attributes['pOnPostFormatOpt'];
$post_format_pos = ( isset( $attributes['pPostFormatPos'] ) ) ? $attributes['pPostFormatPos'] : false;
$cat_pos = ( isset( $attributes['pPostCatPos'] ) ) ? $attributes['pPostCatPos'] : false;
$enable_featured_cat = isset( $attributes['pOnFeaturedCat'] ) && $attributes['pOnFeaturedCat'];
$enable_featured_img = isset( $attributes['pOnFImg'] ) && $attributes['pOnFImg'];
$enable_avatar = isset( $attributes['pOnAvatar'] ) && $attributes['pOnAvatar'];
$avatar_pos = ( isset( $attributes['pAvatarPos'] ) ) ? $attributes['pAvatarPos'] : false;
$output = '';
if ( $query_sorting ) :
foreach ( $query_sorting as $element ) :
if ( ! ( array_key_exists( 'itemValue', $element ) ) ) {
return $output;
}
switch ( $element['itemValue'] ) {
case 'featured-image':
if ( $enable_featured_img && gutentor_has_post_featured( $post ) ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_post_image_box', 'gutentor-post-image-box', $post, $attributes ) ) . "'>";
if ( $enable_avatar && has_post_thumbnail( $post->ID ) && $this->avatar_on_image_condition( $avatar_pos ) ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
$output .= $this->get_featured_image( $post, $attributes );
if ( $enable_post_format && has_post_thumbnail( $post->ID ) && $this->post_format_on_image_condition( $post_format_pos ) ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && has_post_thumbnail( $post->ID ) && $this->categories_on_image_condition( $cat_pos ) ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= '</div>';
}
break;
case 'title':
if ( $cat_pos === 'gutentor-cat-pos-before-title' || $post_format_pos === 'gutentor-pf-pos-before-title' || $this->avatar_on_title_condition( $avatar_pos ) ) {
$output .= '<div class="gutentor-post-title-data-wrap">';
if ( $enable_avatar && has_post_thumbnail( $post->ID ) && $this->avatar_on_title_condition( $avatar_pos ) ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-title' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-title' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_title( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_title( $post, $attributes );
}
break;
case 'avatar':
$output .= $this->get_avatar_data( $post, $attributes );
break;
case 'primary-entry-meta':
$output .= $this->get_primary_meta( $post, $attributes );
break;
case 'secondary-entry-meta':
$output .= $this->get_secondary_meta( $post, $attributes );
break;
case 'description':
if ( $cat_pos === 'gutentor-cat-pos-before-ct-box' || $post_format_pos === 'gutentor-pf-pos-before-ct-box' ) {
$output .= '<div class="gutentor-post-desc-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-ct-box' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-ct-box' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_description( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_description( $post, $attributes );
}
break;
case 'button':
if ( $cat_pos === 'gutentor-cat-pos-before-button' || $post_format_pos === 'gutentor-pf-pos-before-button' ) {
$output .= '<div class="gutentor-post-desc-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-button' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-button' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_button( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_button( $post, $attributes );
}
break;
default:
$output .= $this->get_dynamic_element( $element, $post, $attributes );
break;
}
endforeach;
endif;
return $output;
}
/**
* Load List Template 1
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function gutentor_p1_list_template1( $data, $post, $attributes ) {
$query_sorting = array_key_exists( 'blockSortableItems', $attributes ) ? $attributes['blockSortableItems'] : false;
$enable_post_format = isset( $attributes['pOnPostFormatOpt'] ) && $attributes['pOnPostFormatOpt'];
$post_format_pos = ( isset( $attributes['pPostFormatPos'] ) ) ? $attributes['pPostFormatPos'] : false;
$cat_pos = ( isset( $attributes['pPostCatPos'] ) ) ? $attributes['pPostCatPos'] : false;
$enable_featured_cat = isset( $attributes['pOnFeaturedCat'] ) && $attributes['pOnFeaturedCat'];
$enable_featured_img = isset( $attributes['pOnFImg'] ) && $attributes['pOnFImg'];
$enable_avatar = isset( $attributes['pOnAvatar'] ) && $attributes['pOnAvatar'];
$avatar_pos = ( isset( $attributes['pAvatarPos'] ) ) ? $attributes['pAvatarPos'] : false;
$output = '';
if ( $enable_featured_img && gutentor_has_post_featured( $post ) ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_post_image_box', 'gutentor-post-image-box', $post, $attributes ) ) . "'>";
if ( $enable_avatar && has_post_thumbnail( $post->ID ) && $this->avatar_on_image_condition( $avatar_pos ) ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
$output .= $this->get_featured_image( $post, $attributes );
if ( $enable_post_format && has_post_thumbnail( $post->ID ) && $this->post_format_on_image_condition( $post_format_pos ) ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && has_post_thumbnail( $post->ID ) && $this->categories_on_image_condition( $cat_pos ) ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= '</div>';
}
$output .= '<div class="gutentor-post-content">';
if ( $query_sorting ) :
foreach ( $query_sorting as $element ) :
if ( ! ( array_key_exists( 'itemValue', $element ) ) ) {
return $output;
}
switch ( $element['itemValue'] ) {
case 'title':
if ( $cat_pos === 'gutentor-cat-pos-before-title' || $post_format_pos === 'gutentor-pf-pos-before-title' || $this->avatar_on_title_condition( $avatar_pos ) ) {
$output .= '<div class="gutentor-post-title-data-wrap">';
if ( $enable_avatar && has_post_thumbnail( $post->ID ) && $this->avatar_on_title_condition( $avatar_pos ) ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-title' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-title' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_title( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_title( $post, $attributes );
}
break;
case 'avatar':
$output .= $this->get_avatar_data( $post, $attributes );
break;
case 'primary-entry-meta':
$output .= $this->get_primary_meta( $post, $attributes );
break;
case 'secondary-entry-meta':
$output .= $this->get_secondary_meta( $post, $attributes );
break;
case 'description':
if ( $cat_pos === 'gutentor-cat-pos-before-ct-box' || $post_format_pos === 'gutentor-pf-pos-before-ct-box' ) {
$output .= '<div class="gutentor-post-desc-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-ct-box' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-ct-box' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_description( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_description( $post, $attributes );
}
break;
case 'button':
if ( $cat_pos === 'gutentor-cat-pos-before-button' || $post_format_pos === 'gutentor-pf-pos-before-button' ) {
$output .= '<div class="gutentor-post-desc-data-wrap">';
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-button' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-button' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_button( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_button( $post, $attributes );
}
break;
default:
$output .= $this->get_dynamic_element( $element, $post, $attributes );
break;
}
endforeach;
endif;
$output .= '</div>';/*.gutentor-post-content*/
return $output;
}
/**
* Load Template 1
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function gutentor_p1_template1( $data, $post, $attributes ) {
$template_style = isset( $attributes['gStyle'] ) ? $attributes['gStyle'] : false;
$output = '';
if ( $template_style === 'gutentor-blog-grid' ) {
$output = $this->gutentor_p1_grid_template1( $data, $post, $attributes );
} elseif ( $template_style === 'gutentor-blog-list' ) {
$output = $this->gutentor_p1_list_template1( $data, $post, $attributes );
}
return $output;
}
/**
* Load Template 2
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function gutentor_p1_template2( $data, $post, $attributes ) {
$enable_post_format = isset( $attributes['pOnPostFormatOpt'] ) && $attributes['pOnPostFormatOpt'];
$post_format_pos = ( isset( $attributes['pPostFormatPos'] ) ) ? $attributes['pPostFormatPos'] : false;
$cat_pos = ( isset( $attributes['pPostCatPos'] ) ) ? $attributes['pPostCatPos'] : false;
$enable_featured_cat = isset( $attributes['pOnFeaturedCat'] ) && $attributes['pOnFeaturedCat'];
$enable_avatar = isset( $attributes['pOnAvatar'] ) && $attributes['pOnAvatar'];
$avatar_pos = ( isset( $attributes['pAvatarPos'] ) ) ? $attributes['pAvatarPos'] : false;
$enable_featured_img = isset( $attributes['pOnFImg'] ) && $attributes['pOnFImg'];
$output = '';
if ( $enable_featured_img && gutentor_has_post_featured( $post ) ) {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_post_image_box', 'gutentor-post-image-box', $post, $attributes ) ) . "'>";
if ( $enable_avatar && $this->avatar_on_image_condition( $avatar_pos ) ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
$output .= $this->get_featured_image( $post, $attributes );
if ( $enable_post_format && $this->post_format_on_image_condition( $post_format_pos ) ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $this->categories_on_image_condition( $cat_pos ) ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_primary_meta( $post, $attributes );
$output .= '</div>';/*.gutentor-post-image-box*/
}
$output .= '<div class="gutentor-post-content">';
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-title' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-title' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-title' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_title( $post, $attributes );
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-content' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-ct-box' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-ct-box' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_description( $post, $attributes );
$output .= $this->get_secondary_meta( $post, $attributes );
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-button' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-button' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-button' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_button( $post, $attributes );
$output .= '</div>';/*.gutentor-post-content*/
return $output;
}
/**
* add Template 5
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function gutentor_p1_bg_image_template5( $data, $post, $attributes ) {
$output = '';
$query_sorting = array_key_exists( 'blockSortableItems', $attributes ) ? $attributes['blockSortableItems'] : false;
$enable_post_format = isset( $attributes['pOnPostFormatOpt'] ) && $attributes['pOnPostFormatOpt'];
$post_format_pos = ( isset( $attributes['pPostFormatPos'] ) ) ? $attributes['pPostFormatPos'] : false;
$cat_pos = ( isset( $attributes['pPostCatPos'] ) ) ? $attributes['pPostCatPos'] : false;
$enable_featured_cat = isset( $attributes['pOnFeaturedCat'] ) && $attributes['pOnFeaturedCat'];
$enable_featured_img = isset( $attributes['pOnFImg'] ) && $attributes['pOnFImg'];
$enable_avatar = isset( $attributes['pOnAvatar'] ) && $attributes['pOnAvatar'];
$avatar_pos = ( isset( $attributes['pAvatarPos'] ) ) ? $attributes['pAvatarPos'] : false;
if ( $enable_featured_img && has_post_thumbnail( $post->ID ) ) {
$enable_overlayImage = false;
$overlayImage = ( isset( $attributes['pFImgOColor'] ) ) ? $attributes['pFImgOColor'] : false;
if ( $overlayImage ) {
$enable_overlayImage = ( isset( $attributes['pFImgOColor']['enable'] ) ) ? $attributes['pFImgOColor']['enable'] : false;
}
$url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $attributes['pFImgSize'] );
$overlay = $enable_overlayImage ? 'g-overlay' : '';/*gutentor-overlay for bc*/
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_t5_item_height', gutentor_concat_space( 'gptm-bg-image', 'gptm-item-height', $overlay ), $attributes ) ) . "' style=\"background-image:url('" . esc_url( is_array( $url ) && ! empty( $url ) ? $url[0] : '' ) . "');\">";
if ( $enable_avatar && $this->avatar_on_image_condition( $avatar_pos ) ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $this->post_format_on_image_condition( $post_format_pos ) ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $this->categories_on_image_condition( $cat_pos ) ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= apply_filters( 'gutentor_edit_post_module_featured_image_popup_data', '', $post, $attributes );
$output .= '<div class="gutentor-post-content ">';/*gutentor-post-content for bc*/
if ( $query_sorting ) :
foreach ( $query_sorting as $element ) :
if ( ! ( array_key_exists( 'itemValue', $element ) ) ) {
return $output;
}
switch ( $element['itemValue'] ) {
case 'title':
if ( $cat_pos === 'gutentor-cat-pos-before-title' || $post_format_pos === 'gutentor-pf-pos-before-title' || $avatar_pos === 'g-avatar-b-title' ) {
$output .= '<div class="gutentor-post-title-data-wrap">';
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-title' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-title' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-title' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_title( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_title( $post, $attributes );
}
break;
case 'avatar':
$output .= $this->get_avatar_data( $post, $attributes );
break;
case 'primary-entry-meta':
$output .= $this->get_primary_meta( $post, $attributes );
break;
case 'secondary-entry-meta':
$output .= $this->get_secondary_meta( $post, $attributes );
break;
case 'description':
if ( $cat_pos === 'gutentor-cat-pos-before-ct-box' || $post_format_pos === 'gutentor-pf-pos-before-ct-box' || $avatar_pos === 'g-avatar-b-content' ) {
$output .= '<div class="gutentor-post-desc-data-wrap">';
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-content' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-ct-box' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-ct-box' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_description( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_description( $post, $attributes );
}
break;
case 'button':
if ( $cat_pos === 'gutentor-cat-pos-before-button' || $post_format_pos === 'gutentor-pf-pos-before-button' || $avatar_pos === 'g-avatar-b-button' ) {
$output .= '<div class="gutentor-post-button-data-wrap">';
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-button' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-button' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-button' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_button( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_button( $post, $attributes );
}
break;
default:
$output .= $this->get_dynamic_element( $element, $post, $attributes );
break;
}
endforeach;
endif;
$output .= '</div>';/*.gutentor-post-content*/
$output .= '</div>';/*.gptm-bg-image*/
} else {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_t5_item_height', 'gptm-item-height', $attributes ) ) . "'>";
if ( $enable_avatar && $this->avatar_on_image_condition( $avatar_pos ) ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $this->post_format_on_image_condition( $post_format_pos ) ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $this->categories_on_image_condition( $cat_pos ) ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= apply_filters( 'gutentor_edit_post_module_featured_image_popup_data', '', $post, $attributes );
$output .= '<div class="gutentor-post-content">';/*gutentor-post-content for bc*/
if ( $query_sorting ) :
foreach ( $query_sorting as $element ) :
if ( ! ( array_key_exists( 'itemValue', $element ) ) ) {
return $output;
}
switch ( $element['itemValue'] ) {
case 'title':
if ( $cat_pos === 'gutentor-cat-pos-before-title' || $post_format_pos === 'gutentor-pf-pos-before-title' || $avatar_pos === 'g-avatar-b-title' ) {
$output .= '<div class="gutentor-post-title-data-wrap">';
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-title' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-title' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-title' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_title( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_title( $post, $attributes );
}
break;
case 'avatar':
$output .= $this->get_avatar_data( $post, $attributes );
break;
case 'primary-entry-meta':
$output .= $this->get_primary_meta( $post, $attributes );
break;
case 'secondary-entry-meta':
$output .= $this->get_secondary_meta( $post, $attributes );
break;
case 'description':
if ( $cat_pos === 'gutentor-cat-pos-before-ct-box' || $post_format_pos === 'gutentor-pf-pos-before-ct-box' || $avatar_pos === 'g-avatar-b-content' ) {
$output .= '<div class="gutentor-post-desc-data-wrap">';
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-content' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-ct-box' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-ct-box' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_description( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_description( $post, $attributes );
}
break;
case 'button':
if ( $cat_pos === 'gutentor-cat-pos-before-button' || $post_format_pos === 'gutentor-pf-pos-before-button' || $avatar_pos === 'g-avatar-b-button' ) {
$output .= '<div class="gutentor-post-button-data-wrap">';
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-button' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-button' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-button' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_button( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_button( $post, $attributes );
}
break;
default:
$output .= $this->get_dynamic_element( $element, $post, $attributes );
break;
}
endforeach;
endif;
$output .= '</div>';/*.gutentor-post-content*/
$output .= '</div>';/*.gptm-item-height*/
}
return $output;
}
/**
* add Template 5
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function gutentor_p1_normal_image_template5( $data, $post, $attributes ) {
$output = '';
$query_sorting = array_key_exists( 'blockSortableItems', $attributes ) ? $attributes['blockSortableItems'] : false;
$enable_post_format = isset( $attributes['pOnPostFormatOpt'] ) && $attributes['pOnPostFormatOpt'];
$post_format_pos = ( isset( $attributes['pPostFormatPos'] ) ) ? $attributes['pPostFormatPos'] : false;
$cat_pos = ( isset( $attributes['pPostCatPos'] ) ) ? $attributes['pPostCatPos'] : false;
$enable_featured_cat = isset( $attributes['pOnFeaturedCat'] ) && $attributes['pOnFeaturedCat'];
$enable_featured_img = isset( $attributes['pOnFImg'] ) && $attributes['pOnFImg'];
$enable_avatar = isset( $attributes['pOnAvatar'] ) && $attributes['pOnAvatar'];
$avatar_pos = ( isset( $attributes['pAvatarPos'] ) ) ? $attributes['pAvatarPos'] : false;
if ( $enable_featured_img && has_post_thumbnail( $post->ID ) ) {
$enable_overlayImage = false;
$overlayImage = ( isset( $attributes['pFImgOColor'] ) ) ? $attributes['pFImgOColor'] : false;
if ( $overlayImage ) {
$enable_overlayImage = ( isset( $attributes['pFImgOColor']['enable'] ) ) ? $attributes['pFImgOColor']['enable'] : false;
}
$overlay = $enable_overlayImage ? 'g-overlay' : '';/*gutentor-overlay for bc*/
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_t5_item_height', gutentor_concat_space( 'gptm-bg-image', 'gptm-item-height', $overlay ), $attributes ) ) . "'>";
if ( $enable_avatar && $this->avatar_on_image_condition( $avatar_pos ) ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $this->post_format_on_image_condition( $post_format_pos ) ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
$output .= $this->get_featured_image( $post, $attributes );
if ( $enable_featured_cat && $this->categories_on_image_condition( $cat_pos ) ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= apply_filters( 'gutentor_edit_post_module_featured_image_popup_data', '', $post, $attributes );
$output .= '<div class="gutentor-post-content">';/*gutentor-post-content for bc*/
if ( $query_sorting ) :
foreach ( $query_sorting as $element ) :
if ( ! ( array_key_exists( 'itemValue', $element ) ) ) {
return $output;
}
switch ( $element['itemValue'] ) {
case 'title':
if ( $cat_pos === 'gutentor-cat-pos-before-title' || $post_format_pos === 'gutentor-pf-pos-before-title' || $avatar_pos === 'g-avatar-b-title' ) {
$output .= '<div class="gutentor-post-title-data-wrap">';
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-title' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-title' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-title' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_title( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_title( $post, $attributes );
}
break;
case 'avatar':
$output .= $this->get_avatar_data( $post, $attributes );
break;
case 'primary-entry-meta':
$output .= $this->get_primary_meta( $post, $attributes );
break;
case 'secondary-entry-meta':
$output .= $this->get_secondary_meta( $post, $attributes );
break;
case 'description':
if ( $cat_pos === 'gutentor-cat-pos-before-ct-box' || $post_format_pos === 'gutentor-pf-pos-before-ct-box' || $avatar_pos === 'g-avatar-b-content' ) {
$output .= '<div class="gutentor-post-desc-data-wrap">';
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-content' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-ct-box' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-ct-box' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_description( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_description( $post, $attributes );
}
break;
case 'button':
if ( $cat_pos === 'gutentor-cat-pos-before-button' || $post_format_pos === 'gutentor-pf-pos-before-button' || $avatar_pos === 'g-avatar-b-button' ) {
$output .= '<div class="gutentor-post-button-data-wrap">';
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-button' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-button' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-button' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_button( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_button( $post, $attributes );
}
break;
default:
$output .= $this->get_dynamic_element( $element, $post, $attributes );
break;
}
endforeach;
endif;
$output .= '</div>';/*.gutentor-post-content*/
$output .= '</div>';/*.gptm-bg-image*/
} else {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_t5_item_height', 'gptm-item-height', $attributes ) ) . "'>";
if ( $enable_avatar && $this->avatar_on_image_condition( $avatar_pos ) ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $this->post_format_on_image_condition( $post_format_pos ) ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
$overlay_obj = ( isset( $attributes['pFImgOColor'] ) ) ? $attributes['pFImgOColor'] : false;
$overlay_enable = ( $overlay_obj && array_key_exists( 'enable', $overlay_obj ) ) ? $attributes['pFImgOColor']['enable'] : false;
$overlay = ( $overlay_enable ) ? 'gutentor-overlay' : '';
$output .= '<div class="gutentor-image-thumb">';/*gutentor-post-content for bc*/
$output .= '<img class="' . esc_attr( gutentor_concat_space( 'normal-image', $overlay ) ) . '" src="' . esc_url( GUTENTOR_URL . 'assets/img/default-image.jpg' ) . '">';
$output .= '</div>';/*gutentor-post-content for bc*/
if ( $enable_featured_cat && $this->categories_on_image_condition( $cat_pos ) ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= apply_filters( 'gutentor_edit_post_module_featured_image_popup_data', '', $post, $attributes );
$output .= '<div class="gutentor-post-content">';/*gutentor-post-content for bc*/
if ( $query_sorting ) :
foreach ( $query_sorting as $element ) :
if ( ! ( array_key_exists( 'itemValue', $element ) ) ) {
return $output;
}
switch ( $element['itemValue'] ) {
case 'title':
if ( $cat_pos === 'gutentor-cat-pos-before-title' || $post_format_pos === 'gutentor-pf-pos-before-title' || $avatar_pos === 'g-avatar-b-title' ) {
$output .= '<div class="gutentor-post-title-data-wrap">';
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-title' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-title' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-title' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_title( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_title( $post, $attributes );
}
break;
case 'avatar':
$output .= $this->get_avatar_data( $post, $attributes );
break;
case 'primary-entry-meta':
$output .= $this->get_primary_meta( $post, $attributes );
break;
case 'secondary-entry-meta':
$output .= $this->get_secondary_meta( $post, $attributes );
break;
case 'description':
if ( $cat_pos === 'gutentor-cat-pos-before-ct-box' || $post_format_pos === 'gutentor-pf-pos-before-ct-box' || $avatar_pos === 'g-avatar-b-content' ) {
$output .= '<div class="gutentor-post-desc-data-wrap">';
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-content' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-ct-box' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-ct-box' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_description( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_description( $post, $attributes );
}
break;
case 'button':
if ( $cat_pos === 'gutentor-cat-pos-before-button' || $post_format_pos === 'gutentor-pf-pos-before-button' || $avatar_pos === 'g-avatar-b-button' ) {
$output .= '<div class="gutentor-post-button-data-wrap">';
if ( $enable_avatar && $avatar_pos === 'g-avatar-b-button' ) {
$output .= $this->get_avatar_data( $post, $attributes );
}
if ( $enable_post_format && $post_format_pos === 'gutentor-pf-pos-before-button' ) {
$output .= $this->get_post_format_data( $post, $attributes );
}
if ( $enable_featured_cat && $cat_pos === 'gutentor-cat-pos-before-button' ) {
$output .= $this->get_post_module_badges_collection( $post, $attributes );
}
$output .= $this->get_button( $post, $attributes );
$output .= '</div>';
} else {
$output .= $this->get_button( $post, $attributes );
}
break;
default:
$output .= $this->get_dynamic_element( $element, $post, $attributes );
break;
}
endforeach;
endif;
$output .= '</div>';/*.gutentor-post-content*/
$output .= '</div>';/*.gptm-item-height*/
}
return $output;
}
/**
* add Template 5
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function gutentor_p1_template5( $data, $post, $attributes ) {
$output = '';
$pImgDisplayType = ( isset( $attributes['pImgDisplayType'] ) ) ? $attributes['pImgDisplayType'] : false;
if ( $pImgDisplayType === 'normal-image' ) {
$output .= $this->gutentor_p1_normal_image_template5( $data, $post, $attributes );
}
if ( $pImgDisplayType === 'bg-image' ) {
$output .= $this->gutentor_p1_bg_image_template5( $data, $post, $attributes );
}
return $output;
}
/**
* Blog Post Templates
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function load_blog_post_template( $data, $post, $attributes ) {
$output = $data;
$template = ( isset( $attributes['p1Temp'] ) ) ? $attributes['p1Temp'] : '';
$post_type = ( isset( $attributes['pPostType'] ) ) ? $attributes['pPostType'] : 'post';
if ( $post_type === 'product' ) {
return $output;
}
if ( method_exists( $this, $template ) ) {
$output = $this->$template( $data, $post, $attributes );
} else {
$output = $this->gutentor_p1_template1( $data, $post, $attributes );
}
return $output;
}
}
}
Gutentor_Normal_P1_Templates::get_instance()->run();

View File

@@ -0,0 +1,246 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_T1_Templates' ) ) {
/**
* Blog_Post_Templates Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_T1_Templates extends Gutentor_Query_Elements {
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Run Block
*
* @access public
* @since 2.0.0
* @return void
*/
public function run() {
add_filter( 'gutentor_term_module_t1_query_data', array( $this, 'load_blog_post_template' ), 99999, 4 );
}
/**
* Load Grid Template 1
*
* @param {string} $data
* @param {array} $term
* @param {array} $attributes
* @return {mix}
*/
public function gutentor_t1_grid_template1( $data, $term, $attributes ) {
$query_sorting = array_key_exists( 'blockSortableItems', $attributes ) ? $attributes['blockSortableItems'] : false;
$enable_featured_img = isset( $attributes['tOnFImg'] ) && $attributes['tOnFImg'];
$output = '';
if ( $query_sorting ) :
foreach ( $query_sorting as $element ) :
if ( ! ( array_key_exists( 'itemValue', $element ) ) ) {
return $output;
}
switch ( $element['itemValue'] ) {
case 'featured-image':
if ( $enable_featured_img && $this->has_term_thumbnail( $term ) ) {
$output .= $this->get_term_featured_image( $term, $attributes );
}
break;
case 'title':
$output .= $this->get_term_title_and_count_updated( $term, $attributes, 'title' );
break;
case 'count':
$output .= $this->get_term_title_and_count_updated( $term, $attributes, 'count' );
break;
case 'description':
$output .= $this->get_term_description( $term, $attributes );
break;
case 'button':
$output .= $this->get_term_button( $term, $attributes );
break;
default:
$output .= $this->get_term_dynamic_element( $element, $term, $attributes );
break;
}
endforeach;
endif;
return $output;
}
/**
* Load List Template 1
*
* @param {string} $data
* @param {array} $term
* @param {array} $attributes
* @return {mix}
*/
public function gutentor_t1_list_template1( $data, $term, $attributes ) {
$query_sorting = array_key_exists( 'blockSortableItems', $attributes ) ? $attributes['blockSortableItems'] : false;
$enable_featured_img = isset( $attributes['tOnFImg'] ) && $attributes['tOnFImg'];
$output = '';
if ( $enable_featured_img && $this->has_term_thumbnail( $term ) ) {
$output .= '<div class="gutentor-term-image-box">';
$output .= $this->get_term_featured_image( $term, $attributes );
$output .= '</div>';/*.gutentor-term-image-box*/
}
$output .= '<div class="gutentor-term-content">';
if ( $query_sorting ) :
foreach ( $query_sorting as $element ) :
if ( ! ( array_key_exists( 'itemValue', $element ) ) ) {
return $output;
}
switch ( $element['itemValue'] ) {
case 'title':
$output .= $this->get_term_title_and_count_updated( $term, $attributes, 'title' );
break;
case 'count':
$output .= $this->get_term_title_and_count_updated( $term, $attributes, 'count' );
break;
case 'description':
$output .= $this->get_term_description( $term, $attributes );
break;
case 'button':
$output .= $this->get_term_button( $term, $attributes );
break;
default:
$output .= $this->get_term_dynamic_element( $element, $term, $attributes );
break;
}
endforeach;
endif;
$output .= '</div>';/*.gutentor-term-content*/
return $output;
}
/**
* Template 2
*
* @param {string} $data
* @param {array} $term
* @param {array} $attributes
* @return {mix}
*/
public function gutentor_t1_template2( $data, $term, $attributes ) {
$url = array();
$bg_image_class = $custom_style = '';
$thumbnail_size = ( isset( $attributes['tFImgSize'] ) ) ? $attributes['tFImgSize'] : 'large';
$overlay = ( isset( $attributes['tFImgOC']['enable'] ) ) ? $attributes['tFImgOC']['enable'] : '';
$overlay = $overlay ? 'g-overlay' : '';
if ( $this->has_term_thumbnail( $term ) ) {
$url = wp_get_attachment_image_src( $this->get_term_thumbnail_id( $term ), $thumbnail_size );
$bg_image_class = 'gtf-bg-image';
$custom_style = "style='background-image:url(" . esc_url( is_array( $url ) && ! empty( $url ) ? $url[0] : '' ) . ")'";
}
$query_sorting = array_key_exists( 'blockSortableItems', $attributes ) ? $attributes['blockSortableItems'] : false;
$output = "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_t1_template2_item_height', gutentor_concat_space( 'gtf-item-height', $bg_image_class, $overlay ), $attributes ) ) . "' " . $custom_style . '>';
$output .= '<div class="gtf-content">';
if ( $query_sorting ) :
foreach ( $query_sorting as $element ) :
if ( ! ( array_key_exists( 'itemValue', $element ) ) ) {
return $output;
}
switch ( $element['itemValue'] ) {
case 'title':
$output .= $this->get_term_title_and_count_updated( $term, $attributes, 'title' );
break;
case 'count':
$output .= $this->get_term_title_and_count_updated( $term, $attributes, 'count' );
break;
case 'description':
$output .= $this->get_term_description( $term, $attributes );
break;
case 'button':
$output .= $this->get_term_button( $term, $attributes );
break;
default:
$output .= $this->get_term_dynamic_element( $element, $term, $attributes );
break;
}
endforeach;
endif;
$output .= '</div>';/*.gtf-content*/
$output .= '</div>';/*.gtf-item-height*/
return $output;
}
/**
* Load Template 1
*
* @param {string} $data
* @param {array} $term
* @param {array} $attributes
* @return {mix}
*/
public function gutentor_t1_template1( $data, $term, $attributes ) {
$template_style = isset( $attributes['termStyle'] ) ? $attributes['termStyle'] : false;
$output = '';
if ( $template_style === 'gtf-grid' ) {
$output = $this->gutentor_t1_grid_template1( $data, $term, $attributes );
} elseif ( $template_style === 'gtf-list' ) {
$output = $this->gutentor_t1_list_template1( $data, $term, $attributes );
}
return $output;
}
/**
* Blog Post Templates
*
* @param {string} $data
* @param {array} $term
* @param {array} $attributes
* @return {mix}
*/
public function load_blog_post_template( $data, $term, $attributes, $index ) {
$output = $data;
$template = ( isset( $attributes['t1Temp'] ) ) ? $attributes['t1Temp'] : '';
$enable_featured_img = isset( $attributes['tOnFImg'] ) && $attributes['tOnFImg'];
if ( $enable_featured_img && $this->has_term_thumbnail( $term ) ) {
$no_thumb = '';
} else {
$no_thumb = 'gtf-no-thumb';
}
$output .= "<article class='" . esc_attr( apply_filters( 'gutentor_term_module_article_class', gutentor_concat_space( 'gutentor-term', 'gtf-item-' . $index, $no_thumb ), $attributes ) ) . "'>";
$output .= "<div class='gtf-item'>";
if ( method_exists( $this, $template ) ) {
$output .= $this->$template( $data, $term, $attributes );
} else {
$output .= $this->gutentor_t1_template1( $data, $term, $attributes );
}
$output .= '</div>';
$output .= '</article>';
return $output;
}
}
}
Gutentor_T1_Templates::get_instance()->run();

View File

@@ -0,0 +1,84 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Ticker_P5_Templates' ) ) {
/**
* Blog_Post_Templates Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Ticker_P5_Templates extends Gutentor_Query_Elements {
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Run Block
*
* @access public
* @since 2.0.0
* @return void
*/
public function run() {
add_filter( 'gutentor_post_module_p5_query_data', array( $this, 'load_blog_post_template' ), 99999, 3 );
}
/**
* Load Template 1
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function gutentor_p5_template1( $data, $post, $attributes ) {
$output = '';
$output .= '<a class="gutentor-post-title" href="' . esc_url( get_permalink() ) . '" rel="bookmark">';
$output .= get_the_title();
$output .= '</a>';
return $output;
}
/**
* Blog Post Templates
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function load_blog_post_template( $data, $post, $attributes ) {
$output = $data;
$template = ( isset( $attributes['p5Temp'] ) ) ? $attributes['p5Temp'] : '';
if ( method_exists( $this, $template ) ) {
$output = $this->$template( $data, $post, $attributes );
}
return $output;
}
}
}
Gutentor_Ticker_P5_Templates::get_instance()->run();

View File

@@ -0,0 +1,149 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Widget_Blog_Post_Templates' ) ) {
/**
* Blog_Post_Templates Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_Widget_Blog_Post_Templates {
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Run Block
*
* @access public
* @since 2.0.0
* @return void
*/
public function run() {
add_filter( 'gutentor_save_blog_post_block_template_data', array( $this, 'load_blog_post_template' ), 10, 3 );
}
/**
* Load Template 1
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function template_1( $data, $post, $attributes ) {
$output = '';
$overlay = ( $attributes['blockImageBoxImageOverlayColor']['enable'] ) ? "<div class='overlay'></div>" : '';
$enable_image_display = $attributes['blockEnableImageBoxDisplayOptions'] ? $attributes['blockEnableImageBoxDisplayOptions'] : false;
if ( $attributes['enablePostImage'] ) {
$image_output = '';
$output .= '<div class="gutentor-single-item-image-box">';
if ( 'bg-image' == $attributes['blockImageBoxDisplayOptions'] && $enable_image_display ) {
$url = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) );
if ( $url ) {
$image_output .= '<div class="gutentor-bg-image" style="background-image:url(' . esc_url( $url ) . ')">';
$image_output .= $overlay;
$image_output .= '</div>';
}
} elseif ( has_post_thumbnail() ) {
$image_output .= '<div class="gutentor-image-thumb">';
$image_output .= get_the_post_thumbnail( '', '', '' );
$image_output .= $overlay;
$image_output .= '</div>';
}
$output .= apply_filters( 'gutentor_save_item_image_display_data', $image_output, get_permalink(), $attributes );
$output .= '</div>';/*.gutentor-single-item-image-box*/
}
$output .= '<div class="gutentor-post-content">';
if ( $attributes['blockSingleItemTitleEnable'] ) {
$title_tag = gutentor_get_title_tag( $attributes['blockSingleItemTitleTag'] );
$output .= '<' . esc_attr( $title_tag ) . ' class="gutentor-single-item-title">';
$output .= '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">';
$output .= get_the_title();
$output .= '</a>';
$output .= '</' . esc_attr( $title_tag ) . '>';
}
$output .= '<div class="entry-meta">';
if ( $attributes['enablePostDate'] ) {
$dateFontAwesomeClass = (int) gutentor_get_options( 'fa-version' ) === 4 ? 'fa fa-calendar' : 'far fa-calendar-alt';
$output .= '<div class="posted-on"><i class="' . esc_attr( $dateFontAwesomeClass ) . '"></i>';
$output .= '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . esc_attr( get_the_date() ) . '</a>';
$output .= '</div>';
}
if ( $attributes['enablePostAuthor'] ) {
$authorFontAwesomeClass = (int) gutentor_get_options( 'fa-version' ) === 4 ? 'fa fa-user' : 'far fa-user';
$output .= '<div class="author vcard"><i class="' . esc_attr( $authorFontAwesomeClass ) . '"></i>';
$output .= '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . esc_html( get_the_author() ) . '</a>';
$output .= '</div>';
}
if ( $attributes['enablePostCategory'] ) {
$categories_list = get_the_category_list( esc_html__( ', ', 'gutentor' ) );
if ( $categories_list ) {
$catFontAwesomeClass = (int) gutentor_get_options( 'fa-version' ) === 4 ? 'fa fa-tags' : 'fas fa-tags';
$output .= '<div class="cat-links"><i class="' . esc_attr( $catFontAwesomeClass ) . '"></i>' . $categories_list . '</div>';
}
}
$output .= '</div>';/*.entry-meta*/
if ( $attributes['excerptLength'] > 0 && $attributes['blockSingleItemDescriptionEnable'] ) {
$desc_tag = gutentor_get_title_tag( $attributes['blockSingleItemDescriptionTag'] );
$output .= '<div class="gutentor-post-excerpt gutentor-single-item-desc">';
$output .= "<$desc_tag class='gutentor-single-item-desc'>" . wp_kses_post( gutentor_get_excerpt_by_id( $post->ID, $attributes['excerptLength'] ) ) . "</$desc_tag>";
$output .= '</div>';
}
if ( $attributes['blockSingleItemButtonEnable'] ) {
$default_class = gutentor_concat_space( 'gutentor-button', 'gutentor-single-item-button' );
$icon = ( isset( $attributes['buttonIcon'] ) && $attributes['buttonIcon']['value'] ) ? '<i class="gutentor-button-icon ' . esc_attr( $attributes['buttonIcon']['value'] ) . '" ></i>' : '';
$icon_options = ( isset( $attributes['blockSingleItemButtonIconOptions'] ) ) ? $attributes['blockSingleItemButtonIconOptions'] : '';
$link_options = ( isset( $attributes['blockSingleItemButtonLinkOptions'] ) ) ? $attributes['blockSingleItemButtonLinkOptions'] : '';
$output .= '<a class="' . esc_attr( gutentor_concat_space( $default_class, GutentorButtonOptionsClasses( $icon_options ) ) ) . '" ' . apply_filters( 'gutentor_save_link_attr', '', esc_url( get_permalink() ), $link_options ) . '>' . $icon . '<span>' . esc_html( $attributes['buttonText'] ) . '</span></a>';
}
$output .= '</div>';/*.gutentor-post-content*/
return $output;
}
/**
* Blog Post Templates
*
* @param {string} $data
* @param {array} $post
* @param {array} $attributes
* @return {mix}
*/
public function load_blog_post_template( $data, $post, $attributes ) {
$output = $data;
if ( 'blog-template1' === $attributes['blockBlogTemplate'] ) {
$output = $this->template_1( $data, $post, $attributes );
}
return $output;
}
}
}
Gutentor_Widget_Blog_Post_Templates::get_instance()->run();

View File

@@ -0,0 +1,78 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_E11' ) ) {
/**
* Functions related to Progress bar
*
* @package Gutentor
* @since 3.0.6
*/
class Gutentor_E11 extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 3.0.6
* @var string
*/
protected $block_name = 'e11';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 3.0.6
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.0.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'magnific-popup' ),
'style_handles' => array( 'magnific-popup' ),
);
}
/**
* Just return content.
* It is for view_script_handles
*
* @param array $attributes Attributes array.
* @param string $content Content is always string.
* @return string
* @since 3.0.6
* @access public
*/
public function render_callback( $attributes, $content ) {
return $content;
}
}
}
Gutentor_E11::get_instance()->run();

View File

@@ -0,0 +1,78 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_E2' ) ) {
/**
* Functions related to Progress bar
*
* @package Gutentor
* @since 3.0.6
*/
class Gutentor_E2 extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 3.0.6
* @var string
*/
protected $block_name = 'e2';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 3.0.6
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.0.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'magnific-popup' ),
'style_handles' => array( 'magnific-popup' ),
);
}
/**
* Just return content.
* It is for view_script_handles
*
* @param array $attributes Attributes array.
* @param string $content Content is always string.
* @return string
* @since 3.0.6
* @access public
*/
public function render_callback( $attributes, $content ) {
return $content;
}
}
}
Gutentor_E2::get_instance()->run();

View File

@@ -0,0 +1,78 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_E3' ) ) {
/**
* Functions related to Countup
*
* @package Gutentor
* @since 3.2.6
*/
class Gutentor_E3 extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 3.2.6
* @var string
*/
protected $block_name = 'e3';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 3.2.6
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.2.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'countUp' ),
);
}
/**
* Just return content.
* It is for view_script_handles
*
* @param array $attributes Attributes array.
* @param string $content Content is always string.
* @return string
* @since 3.2.6
* @access public
*/
public function render_callback( $attributes, $content ) {
return $content;
}
}
}
Gutentor_E3::get_instance()->run();

View File

@@ -0,0 +1,236 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_E4' ) ) {
/**
* Functions related to Google Map
*
* @package Gutentor
* @since 1.0.1
*/
class Gutentor_E4 extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 1.0.1
* @var string
*/
protected $block_name = 'e4';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 1.0.1
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.2.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'gutentor-google-maps', 'google-maps' ),
);
}
/**
* Google Map Attributes Default Value
*
* @since 1.0.0
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function get_default_values() {
$google_map_attr = array(
'id' => '',
'blockID' => '',
'gID' => '',
'e4Loc' => 'La Sagrada Familia, Barcelona, Spain',
'e4Lat' => '41.4036299',
'e4Lon' => '2.1743558000000576',
'e4Type' => 'roadmap',
'e4Zoom' => 15,
'e4Height' => array(
'type' => 'px',
'desktop' => '250',
'tablet' => '250',
'mobile' => '150',
),
'e4Draggable' => true,
'e4TypeCtrl' => true,
'e4ZoomCtrl' => true,
'e4FullScrCtrl' => true,
'e4StreetViewCtrl' => true,
'e4Markers' => array(),
);
$google_map_attr = apply_filters( 'gutentor_element_google_map_get_default_values', $google_map_attr );
return $google_map_attr;
}
/**
* Returns attributes for this Block
*
* @static
* @access public
* @since 1.0.0
* @return array
*/
protected function get_attrs() {
$google_map_attr = array(
'id' => array(
'type' => 'string',
),
'blockID' => array(
'type' => 'string',
),
'gID' => array(
'type' => 'string',
),
'gName' => array(
'type' => 'string',
'default' => 'gutentor/e4',
),
'e4Loc' => array(
'type' => 'string',
'default' => 'La Sagrada Familia, Barcelona, Spain',
),
'e4Lat' => array(
'type' => 'string',
'default' => '41.4036299',
),
'e4Lon' => array(
'type' => 'string',
'default' => '2.1743558000000576',
),
'e4Type' => array(
'type' => 'string',
'default' => 'roadmap',
),
'e4Zoom' => array(
'type' => 'number',
'default' => 15,
),
'e4Height' => array(
'type' => 'object',
'default' => array(
'type' => 'px',
'desktop' => '250',
'tablet' => '250',
'mobile' => '150',
),
),
'e4Draggable' => array(
'type' => 'boolean',
'default' => true,
),
'e4TypeCtrl' => array(
'type' => 'boolean',
'default' => true,
),
'e4ZoomCtrl' => array(
'type' => 'boolean',
'default' => true,
),
'e4FullScrCtrl' => array(
'type' => 'boolean',
'default' => true,
),
'e4StreetViewCtrl' => array(
'type' => 'boolean',
'default' => true,
),
'e4Markers' => array(
'type' => 'object',
'default' => array(),
),
);
return array_merge_recursive( $google_map_attr, $this->get_element_common_attrs() );
}
/**
* Render Google Map Data
*
* @since 1.0.1
* @access public
*
* @param array $attributes
* @param string $content
* @return string
*/
public function render_callback( $attributes, $content ) {
$id = isset( $attributes['id'] ) ? $attributes['id'] : 'gutentor-google-map-' . wp_rand( 10, 100 );
$blockID = isset( $attributes['gID'] ) ? $attributes['gID'] : '';
$class = 'gutentor-google-map';
$default_class = gutentor_block_add_default_classes( 'gutentor-e4', $attributes );
if ( isset( $attributes['className'] ) ) {
$class .= ' ' . $default_class;
}
$align = isset( $attributes['align'] ) ? 'align' . $attributes['align'] : '';
$tag = 'div';
$local_attr = array();
$local_attr['id'] = $id;
$local_attr['location'] = $attributes['e4Loc'];
$local_attr['latitude'] = $attributes['e4Lat'];
$local_attr['longitude'] = $attributes['e4Lon'];
$local_attr['zoom'] = $attributes['e4Zoom'];
$local_attr['type'] = $attributes['e4Type'];
$local_attr['draggable'] = $attributes['e4Draggable'];
$local_attr['mapTypeControl'] = $attributes['e4TypeCtrl'];
$local_attr['zoomControl'] = $attributes['e4ZoomCtrl'];
$local_attr['fullscreenControl'] = $attributes['e4FullScrCtrl'];
$local_attr['streetViewControl'] = $attributes['e4StreetViewCtrl'];
$local_attr['markers'] = $attributes['e4Markers'];
$block_animation_attrs = isset( $attributes['eAnimation'] ) ? $attributes['eAnimation'] : '';
$map_section_class = gutentor_concat_space( 'gutentor-element g-el-gmap', $align );
$map_section_id = 'section-' . $blockID;
$map_section_class = gutentor_concat_space( $map_section_class, $map_section_id );
$class = gutentor_concat_space( $class, $id );
$output = '<' . $tag . ' class="' . esc_attr( apply_filters( 'gutentor_save_element_class', $map_section_class, $attributes ) ) . '" id="section-' . esc_attr( $blockID ) . '" ' . GutentorAnimationOptionsDataAttr( $block_animation_attrs ) . '>' . "\n";
$output .= '<div class="' . esc_attr( apply_filters( 'gutentor_save_grid_row_class', gutentor_concat_space( esc_attr( $class ), 'gutentor-grid-item-wrap' ), $attributes ) ) . '" id="' . esc_attr( $id ) . '"></div>' . "\n";
$output .= '</' . $tag . '>' . "\n";
$output .= '<script type="text/javascript">' . "\n";
$output .= ' /* <![CDATA[ */' . "\n";
$output .= ' if ( ! window.gutentorGoogleMaps ) window.gutentorGoogleMaps =[];' . "\n";
$output .= ' window.gutentorGoogleMaps.push( { container: "' . esc_attr( $id ) . '", attributes: ' . wp_json_encode( $local_attr ) . ' } );' . "\n";
$output .= ' /* ]]> */' . "\n";
$output .= '</script>' . "\n";
return $output;
}
}
}
Gutentor_E4::get_instance()->run();

View File

@@ -0,0 +1,77 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_E9' ) ) {
/**
* Functions related to Progress bar
*
* @package Gutentor
* @since 3.0.6
*/
class Gutentor_E9 extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 3.0.6
* @var string
*/
protected $block_name = 'e9';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 3.0.6
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.0.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'jquery-easypiechart' ),
);
}
/**
* Just return content.
* It is for view_script_handles
*
* @param array $attributes Attributes array.
* @param string $content Content is always string.
* @return string
* @since 3.0.6
* @access public
*/
public function render_callback( $attributes, $content ) {
return $content;
}
}
}
Gutentor_E9::get_instance()->run();

View File

@@ -0,0 +1,78 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_M0' ) ) {
/**
* Functions related to Progress bar
*
* @package Gutentor
* @since 3.0.6
*/
class Gutentor_M0 extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 3.0.6
* @var string
*/
protected $block_name = 'm0';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 3.0.6
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.0.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'slick' ),
'style_handles' => array( 'slick' ),
);
}
/**
* Just return content.
* It is for view_script_handles
*
* @param array $attributes Attributes array.
* @param string $content Content is always string.
* @return string
* @since 3.0.6
* @access public
*/
public function render_callback( $attributes, $content ) {
return $content;
}
}
}
Gutentor_M0::get_instance()->run();

View File

@@ -0,0 +1,78 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_M10' ) ) {
/**
* Functions related to Progress bar
*
* @package Gutentor
* @since 3.0.6
*/
class Gutentor_M10 extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 3.0.6
* @var string
*/
protected $block_name = 'm10';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 3.0.6
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.0.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'magnific-popup', 'isotope', 'masonry' ),
'style_handles' => array( 'magnific-popup' ),
);
}
/**
* Just return content.
* It is for view_script_handles
*
* @param array $attributes Attributes array.
* @param string $content Content is always string.
* @return string
* @since 3.0.6
* @access public
*/
public function render_callback( $attributes, $content ) {
return $content;
}
}
}
Gutentor_M10::get_instance()->run();

View File

@@ -0,0 +1,77 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_M4' ) ) {
/**
* Functions related to Progress bar
*
* @package Gutentor
* @since 3.0.6
*/
class Gutentor_M4 extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 3.0.6
* @var string
*/
protected $block_name = 'm4';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 3.0.6
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.0.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'theia-sticky-sidebar' ),
);
}
/**
* Just return content.
* It is for view_script_handles
*
* @param array $attributes Attributes array.
* @param string $content Content is always string.
* @return string
* @since 3.0.6
* @access public
*/
public function render_callback( $attributes, $content ) {
return $content;
}
}
}
Gutentor_M4::get_instance()->run();

View File

@@ -0,0 +1,78 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_M5' ) ) {
/**
* Functions related to Progress bar
*
* @package Gutentor
* @since 3.0.6
*/
class Gutentor_M5 extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 3.0.6
* @var string
*/
protected $block_name = 'm5';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 3.0.6
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.0.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'slick' ),
'style_handles' => array( 'slick' ),
);
}
/**
* Just return content.
* It is for view_script_handles
*
* @param array $attributes Attributes array.
* @param string $content Content is always string.
* @return string
* @since 3.0.6
* @access public
*/
public function render_callback( $attributes, $content ) {
return $content;
}
}
}
Gutentor_M5::get_instance()->run();

View File

@@ -0,0 +1,448 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_P1' ) ) {
/**
* Functions related to Blog Post
*
* @package Gutentor
* @since 1.0.1
*/
class Gutentor_P1 extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 1.0.1
* @var string
*/
protected $block_name = 'p1';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @return object
* @since 1.0.1
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.0.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'magnific-popup', 'masonry' ),
'style_handles' => array( 'magnific-popup' ),
);
}
/**
* Load Dependencies
* Used for blog template loading
*
* @since 1.0.1
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function load_dependencies() {
require_once GUTENTOR_PATH . 'includes/block-templates/normal/class-normal-p1-templates.php';
require_once GUTENTOR_PATH . 'includes/block-templates/normal/class-normal-p1-woo-templates.php';
require_once GUTENTOR_PATH . 'includes/block-templates/normal/class-normal-p1-edd-templates.php';
}
/**
* Returns attributes for this Block
*
* @static
* @access public
* @return array
* @since 1.0.1
*/
public function get_attrs() {
$blog_post_attr = array(
'gID' => array(
'type' => 'string',
'default' => '',
),
/*column*/
'blockItemsColumn' => array(
'type' => 'object',
'default' => array(
'desktop' => 'grid-md-4',
'tablet' => 'grid-sm-4',
'mobile' => 'grid-xs-12',
),
),
'timestamp' => array(
'type' => 'number',
'default' => 0,
),
'gName' => array(
'type' => 'string',
'default' => 'gutentor/p1',
),
'p1Temp' => array(
'type' => 'string',
'default' => 'gutentor_p1_template1',
),
'gStyle' => array(
'type' => 'string',
'default' => 'gutentor-blog-grid',
),
'pTaxTerm' => array(
'type' => 'array',
'items' => array(
'type' => 'object',
'label' => array(
'type' => 'string',
),
'value' => array(
'type' => 'number',
),
),
),
'pTaxType' => array(
'type' => 'string',
'default' => 'category',
),
'pTaxOperator' => array(
'type' => 'string',
'default' => 'IN',
),
'pPostType' => array(
'type' => 'string',
'default' => 'post',
),
'pIncludePosts' => array(
'type' => 'string',
),
'pExcludePosts' => array(
'type' => 'string',
),
'pOffsetPosts' => array(
'type' => 'number',
),
'postsToShow' => array(
'type' => 'number',
'default' => 6,
),
'order' => array(
'type' => 'string',
'default' => 'desc',
),
'orderBy' => array(
'type' => 'string',
'default' => 'date',
),
'pNoFoundTxt' => array(
'type' => 'string',
'default' => 'Nothing Found',
),
'pEqlHeight' => array(
'type' => 'boolean',
'default' => false,
),
'categories' => array(
'type' => 'string',
'default' => '',
),
'gutentorBlogPostImageLink' => array(
'type' => 'boolean',
'default' => false,
),
'pReverseContent' => array(
'type' => 'boolean',
'default' => false,
),
'pOnColInList' => array(
'type' => 'boolean',
'default' => false,
),
'gutentorBlogPostImageLinkNewTab' => array(
'type' => 'boolean',
'default' => false,
),
'pContentPos' => array(
'type' => 'object',
'default' => array(
'desktop' => 'g-pos-center',
'tablet' => 'g-pos-center',
'mobile' => 'g-pos-center',
),
),
'pMsyOn' => array(
'type' => 'boolean',
'default' => false,
),
'pTimeline' => array(
'type' => 'object',
'default' => array(
'enable' => false,
/*icon*/
'icon' => array(
'label' => 'fa-arrow-down',
'value' => (int) gutentor_get_options( 'fa-version' ) === 4 ? 'fa fa-arrow-down' : 'fas fa-arrow-down',
'code' => 'f108',
),
'iSize' => array(
'type' => 'px',
'mobile' => 10,
),
'iColor' => array(
'enable' => true,
'normal' => '#fff',
),
/*node*/
'nBgColor' => array(
'enable' => true,
'normal' => '#d5dee6',
),
'nWidth' => array(
'enable' => true,
'type' => 'px',
'mobile' => 30,
),
'nHeight' => array(
'enable' => true,
'type' => 'px',
'mobile' => 30,
),
'border' => array(
'rTypeN' => '%',
'rTopN' => '50',
'rRightN' => '50',
'rBottomN' => '50',
'rLeftN' => '50',
),
/*width*/
'lColor' => array(
'enable' => true,
'normal' => '#d5dee6',
),
'lWidth' => array(
'enable' => true,
'type' => 'px',
'mobile' => 3,
),
),
),
'pTypeWpQuery' => array(
'type' => 'string',
'default' => 'default',
),
'pWpQuery' => array(
'type' => 'string',
'default' => '',
),
'pImgDisplayType' => array(
'type' => 'string',
'default' => 'bg-image',
),
);
$blog_partial_attrs = array_merge_recursive( $blog_post_attr, $this->get_module_common_attrs() );
return array_merge_recursive( $blog_partial_attrs, $this->get_module_query_elements_common_attrs() );
}
/**
* Render Blog Post Data
*
* @param array $attributes
* @param string $content
* @return string
* @since 1.0.1
* @access public
*/
public function render_callback( $attributes, $content ) {
$blockID = isset( $attributes['pID'] ) ? $attributes['pID'] : $attributes['gID'];
$gID = isset( $attributes['gID'] ) ? $attributes['gID'] : '';
$pTypeWpQuery = isset( $attributes['pTypeWpQuery'] ) ? $attributes['pTypeWpQuery'] : false;
$output = '';
$default_class = gutentor_block_add_default_classes( 'gutentor-p1', $attributes );
$tag = $attributes['mTag'] ? $attributes['mTag'] : 'div';
$pFType = $attributes['pFType'] ? $attributes['pFType'] : '';
$template = $attributes['p1Temp'] ? $attributes['p1Temp'] : '';
$enable_equal_height = isset( $attributes['pEqlHeight'] ) && $attributes['pEqlHeight'] ? 'g-equal-height' : '';
$align = isset( $attributes['align'] ) ? 'align' . $attributes['align'] : '';
$blockComponentAnimation = isset( $attributes['mAnimation'] ) ? $attributes['mAnimation'] : '';
$post_type = isset( $attributes['pPostType'] ) ? $attributes['pPostType'] : '';
$nothing_found_text = isset( $attributes['pNoFoundTxt'] ) ? $attributes['pNoFoundTxt'] : '';
$thumbnail_enable = isset( $attributes['pOnFImg'] ) ? $attributes['pOnFImg'] : false;
$timeline = isset( $attributes['pTimeline'] ) ? $attributes['pTimeline'] : false;
$timelineEnable = is_array( $timeline ) && array_key_exists( 'enable', $timeline ) ? $timeline['enable'] : false;
$timelineClass = '';
$thumb_class = '';
$access_no_thumbnail = array( 'product', 'download' );
$gptm_class = $template === 'gutentor_p1_template5' ? 'gptm-item' : '';
$pImgDisplayType = ( isset( $attributes['pImgDisplayType'] ) ) ? $attributes['pImgDisplayType'] : false;
/*query args*/
$query_args = array(
'posts_per_page' => isset( $attributes['postsToShow'] ) ? $attributes['postsToShow'] : 6,
'post_type' => isset( $attributes['pPostType'] ) ? $attributes['pPostType'] : 'post',
'orderby' => isset( $attributes['orderBy'] ) ? $attributes['orderBy'] : 'date',
'order' => isset( $attributes['order'] ) ? $attributes['order'] : 'desc',
'paged' => isset( $attributes['paged'] ) ? $attributes['paged'] : 1,
'ignore_sticky_posts' => true,
'post_status' => 'publish',
);
/*load custom template search*/
global $wp_query;
$gutentor_template = $wp_query->get(
'gutentor-templates'
);
if ( isset( $gutentor_template['type'] ) && $gutentor_template['type'] === 'search' ) {
$query_args['s'] = $gutentor_template['s'];
}
if ( $pTypeWpQuery === 'default' ) {
/*Backward compatible*/
if ( isset( $attributes['categories'] ) && ! empty( $attributes['categories'] ) ) {
if ( is_array( $attributes['categories'] ) && ! gutentor_is_array_empty( $attributes['categories'] ) ) {
$query_args['taxonomy'] = 'category';
$query_args['term'] = $attributes['categories'];
}
if ( ! is_array( $attributes['categories'] ) ) {
$query_args['taxonomy'] = 'category';
$query_args['term'] = $attributes['categories'];
}
}
if ( isset( $attributes['pTaxType'] ) && ! empty( $attributes['pTaxType'] ) &&
isset( $attributes['pTaxTerm'] ) && ! empty( $attributes['pTaxTerm'] ) ) {
$query_args['taxonomy'] = $attributes['pTaxType'];
$query_args['taxOperator'] = $attributes['pTaxOperator'] ? $attributes['pTaxOperator'] : 'IN';
if ( is_array( $attributes['pTaxTerm'] ) ) {
$p1_terms = array();
foreach ( $attributes['pTaxTerm'] as $p1_term ) {
$p1_terms [] = $p1_term['value'];
}
$query_args['term'] = $p1_terms;
} elseif ( is_string( $attributes['pTaxTerm'] ) || is_numeric( $attributes['pTaxTerm'] ) ) {
$query_args['term'] = $attributes['pTaxTerm'];
}
}
if ( isset( $attributes['pAuthor'] ) && ! empty( $attributes['pAuthor'] ) ) {
if ( is_array( $attributes['pAuthor'] ) ) {
$author_list = array();
foreach ( $attributes['pAuthor'] as $data ) {
$author_list[] = $data['value'];
}
$query_args['author__in'] = $author_list;
}
}
if ( isset( $attributes['pOffsetPosts'] ) ) {
$query_args['offset'] = $attributes['pOffsetPosts'];
}
if ( isset( $attributes['pIncludePosts'] ) && ! empty( $attributes['pIncludePosts'] ) ) {
$query_args['post__in'] = $attributes['pIncludePosts'];
}
if ( isset( $attributes['pExcludePosts'] ) && ! empty( $attributes['pExcludePosts'] ) ) {
$query_args['post__not_in'] = $attributes['pExcludePosts'];
}
/*Search query*/
if ( isset( $attributes['s'] ) && ! empty( $attributes['s'] ) ) {
$query_args['s'] = $attributes['s'];
}
}
if ( $pTypeWpQuery === 'custom' ) {
$pWpQueryJson = isset( $attributes['pWpQuery'] ) ? $attributes['pWpQuery'] : false;
$pWpQueryData = json_decode( $pWpQueryJson, true );
$query_args = array_merge( $query_args, $pWpQueryData );
}
$the_query = new WP_Query( gutentor_get_query( $query_args ) );
$tag = gutentor_get_module_tag( $tag );
$output .= '<' . esc_attr( $tag ) . ' class="' . esc_attr( apply_filters( 'gutentor_post_module_main_wrap_class', gutentor_concat_space( 'gutentor-post-module', 'section-' . $gID, 'gutentor-post-module-p1', $template, $align, $default_class, $enable_equal_height ), $attributes ) ) . '" id="' . esc_attr( $blockID ) . '" data-gbid="' . esc_attr( $gID ) . '" ' . GutentorAnimationOptionsDataAttr( $blockComponentAnimation ) . '>' . "\n";
$output .= apply_filters( 'gutentor_post_module_before_container', '', $attributes );
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_container_class', 'grid-container', $attributes ) ) . "'>";
$output .= apply_filters( 'gutentor_post_module_before_block_items', '', $attributes );
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_grid_row_class', 'grid-row', $attributes ) ) . "' " . gutentor_get_html_attr( apply_filters( 'gutentor_post_module_attr', array(), $attributes ) ) . '>';
$cat_style = '';
$post_categories = array();
if ( $the_query->have_posts() ) :
$index = 0;
while ( $the_query->have_posts() ) :
$the_query->the_post();
$post_categories = array_merge( $post_categories, wp_get_post_categories( get_the_ID() ) );
$video_url = get_post_meta( get_the_ID(), 'gutentor_meta_video_url', true );
$video_id = get_post_meta( get_the_ID(), 'gutentor_meta_video_id', true );
if ( ! in_array( $post_type, $access_no_thumbnail ) ) {
$thumb_class = has_post_thumbnail() && $thumbnail_enable ? '' : 'gutentor-post-no-thumb';
$thumb_class = ( ( $video_url || $video_id ) && gutentor_pro_active() && $pFType === 'video' ) ? '' : $thumb_class;
$thumb_class = $template === 'gutentor_p1_template5' && $pImgDisplayType === 'normal-image' ? '' : $thumb_class;
}
if ( $timelineEnable ) {
if ( $index % 2 === 0 ) {
$timelineClass = 'g-timeline-even';
} else {
$timelineClass = 'g-timeline-odd';
}
}
$output .= "<article class='" . esc_attr( apply_filters( 'gutentor_post_module_grid_column_class', gutentor_concat_space( 'gutentor-post', $thumb_class, $timelineClass ), $attributes ) ) . "'>";
if ( $timelineEnable ) {
$output .= "<div class='g-timeline-post-wrap'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_post_item', gutentor_concat_space( 'gutentor-post-item', $gptm_class ), $attributes ) ) . "'>";
$output .= apply_filters( 'gutentor_post_module_p1_query_data', '', get_post(), $attributes );
$output .= '</div>';/*.gutentor-post-item*/
$output .= '</div>';/*.g-timeline-post-wrap*/
$output .= apply_filters( 'gutentor_post_module_p1_query_data_after', '', get_post(), $attributes );
} else {
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_post_item', gutentor_concat_space( 'gutentor-post-item', $gptm_class ), $attributes ) ) . "'>";
$output .= apply_filters( 'gutentor_post_module_p1_query_data', '', get_post(), $attributes );
$output .= '</div>';/*.gutentor-post-item*/
}
$output .= '</article>';/*.article*/
++$index;
endwhile;
else :
$output .= '<header class="g-n-f-t-1"><h2 class="g-n-f-title">' . esc_html( $nothing_found_text ) . '</h2></header>';
endif;
$output .= '</div>';/*.grid-row*/
$output .= apply_filters( 'gutentor_post_module_after_block_items', '', $attributes );
$output .= '</div>';/*.grid-container*/
$output .= apply_filters( 'gutentor_post_module_after_container', '', $attributes );
if ( $post_categories && $content === 'ajax' ) {
$cat_style = gutentor_pm_post_dynamic_categories_color( array_unique( $post_categories ) );
$output .= '<style>' . wp_strip_all_tags( $cat_style ) . '</style>';
}
$output .= '</' . esc_attr( $tag ) . '>';/*
.gutentor-blog-post-wrapper*/
// Restore original Post Data
wp_reset_postdata();
return $output;
}
}
}
Gutentor_P1::get_instance()->run();

View File

@@ -0,0 +1,291 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_P2' ) ) {
/**
* Functions related to Blog Post
*
* @package Gutentor
* @since 1.0.1
*/
class Gutentor_P2 extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 1.0.1
* @var string
*/
protected $block_name = 'p2';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 1.0.1
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.0.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'magnific-popup' ),
'style_handles' => array( 'magnific-popup' ),
);
}
/**
* Returns attributes for this Block
*
* @static
* @access public
* @since 1.0.1
* @return array
*/
protected function get_attrs() {
$blog_post_attr = array(
'gID' => array(
'type' => 'string',
'default' => '',
),
'gName' => array(
'type' => 'string',
'default' => 'gutentor/p2',
),
'p2Temp' => array(
'type' => 'number',
'default' => 1,
),
'pTaxType' => array(
'type' => 'string',
'default' => 'category',
),
'pTaxOperator' => array(
'type' => 'string',
'default' => 'IN',
),
'pTaxTerm' => array(
'type' => 'array',
'items' => array(
'type' => 'object',
'label' => array(
'type' => 'string',
),
'value' => array(
'type' => 'number',
),
),
),
'pPostType' => array(
'type' => 'string',
'default' => 'post',
),
'pIncludePosts' => array(
'type' => 'string',
),
'pExcludePosts' => array(
'type' => 'string',
),
'pOffsetPosts' => array(
'type' => 'number',
),
'postsToShow' => array(
'type' => 'number',
'default' => 6,
),
'order' => array(
'type' => 'string',
'default' => 'desc',
),
'orderBy' => array(
'type' => 'string',
'default' => 'date',
),
'categories' => array(
'type' => 'string',
'default' => '',
),
'gutentorBlogPostImageLink' => array(
'type' => 'boolean',
'default' => false,
),
'pReverseContent' => array(
'type' => 'boolean',
'default' => false,
),
'gutentorBlogPostImageLinkNewTab' => array(
'type' => 'boolean',
'default' => false,
),
'p1BgProps' => array(
'type' => 'object',
'default' => array(
'size' => 'cover',
'pos' => 'center',
'repeat' => 'no-repeat',
'attachment' => 'scroll',
),
),
'p1FImageOnHeight' => array(
'type' => 'boolean',
'default' => false,
),
'p1FImageHeight' => array(
'type' => 'boolean',
'default' => false,
),
'pContentPos' => array(
'type' => 'object',
'default' => array(
'desktop' => 'g-pos-bottom',
'tablet' => 'g-pos-bottom',
'mobile' => 'g-pos-bottom',
),
),
);
$blog_partial_attrs = array_merge_recursive( $blog_post_attr, $this->get_module_common_attrs() );
return array_merge_recursive( $blog_partial_attrs, $this->get_module_query_elements_common_attrs() );
}
/**
* Render Blog Post Data
*
* @since 1.0.1
* @access public
*
* @param array $attributes
* @param string $content
* @return string
*/
public function render_callback( $attributes, $content ) {
$blockID = isset( $attributes['pID'] ) ? $attributes['pID'] : $attributes['gID'];
$gID = isset( $attributes['gID'] ) ? $attributes['gID'] : '';
$output = '';
$default_class = gutentor_block_add_default_classes( 'gutentor-p2', $attributes );
$tag = $attributes['mTag'] ? $attributes['mTag'] : 'section';
$template = $attributes['p2Temp'] ? $attributes['p2Temp'] : '';
$post_number = $attributes['postsToShow'] ? $attributes['postsToShow'] : '';
$align = isset( $attributes['align'] ) ? 'align' . $attributes['align'] : '';
$blockComponentAnimation = isset( $attributes['mAnimation'] ) ? $attributes['mAnimation'] : '';
/*query args*/
$query_args = array(
'posts_per_page' => isset( $attributes['postsToShow'] ) ? $attributes['postsToShow'] : 6,
'post_type' => isset( $attributes['pPostType'] ) ? $attributes['pPostType'] : 'post',
'orderby' => isset( $attributes['orderBy'] ) ? $attributes['orderBy'] : 'date',
'order' => isset( $attributes['order'] ) ? $attributes['order'] : 'desc',
'paged' => isset( $attributes['paged'] ) ? $attributes['paged'] : 1,
'ignore_sticky_posts' => true,
'post_status' => 'publish',
);
/*Backward compatible*/
if ( isset( $attributes['categories'] ) && ! empty( $attributes['categories'] ) ) {
if ( is_array( $attributes['categories'] ) && ! gutentor_is_array_empty( $attributes['categories'] ) ) {
$query_args['taxonomy'] = 'category';
$query_args['term'] = $attributes['categories'];
}
if ( ! is_array( $attributes['categories'] ) ) {
$query_args['taxonomy'] = 'category';
$query_args['term'] = $attributes['categories'];
}
}
if ( isset( $attributes['pTaxType'] ) && ! empty( $attributes['pTaxType'] ) &&
isset( $attributes['pTaxTerm'] ) && ! empty( $attributes['pTaxTerm'] ) ) {
$query_args['taxonomy'] = $attributes['pTaxType'];
$query_args['taxOperator'] = $attributes['pTaxOperator'] ? $attributes['pTaxOperator'] : 'IN';
if ( is_array( $attributes['pTaxTerm'] ) ) {
$p2_terms = array();
foreach ( $attributes['pTaxTerm'] as $p2_term ) {
$p2_terms [] = $p2_term['value'];
}
$query_args['term'] = $p2_terms;
} elseif ( is_string( $attributes['pTaxTerm'] ) || is_numeric( $attributes['pTaxTerm'] ) ) {
$query_args['term'] = $attributes['pTaxTerm'];
}
}
if ( isset( $attributes['pAuthor'] ) && ! empty( $attributes['pAuthor'] ) ) {
if ( is_array( $attributes['pAuthor'] ) ) {
$author_list = array();
foreach ( $attributes['pAuthor'] as $data ) {
$author_list[] = $data['value'];
}
$query_args['author__in'] = $author_list;
}
}
if ( isset( $attributes['offset'] ) ) {
$query_args['offset'] = $attributes['offset'];
}
if ( isset( $attributes['pIncludePosts'] ) && ! empty( $attributes['pIncludePosts'] ) ) {
$query_args['post__in'] = $attributes['pIncludePosts'];
}
if ( isset( $attributes['pExcludePosts'] ) && ! empty( $attributes['pExcludePosts'] ) ) {
$query_args['post__not_in'] = $attributes['pExcludePosts'];
}
if ( isset( $attributes['pOffsetPosts'] ) ) {
$query_args['offset'] = $attributes['pOffsetPosts'];
}
$gutentor_p2_news_the_query = new WP_Query( gutentor_get_query( $query_args ) );
if ( $gutentor_p2_news_the_query->have_posts() ) :
$tag = gutentor_get_module_tag( $tag );
$output .= '<' . esc_attr( $tag ) . ' class="' . esc_attr( apply_filters( 'gutentor_post_module_main_wrap_class', gutentor_concat_space( 'section-' . $gID, 'gutentor-post-module', 'gutentor-post-module-p2', 'gutentor-post-' . $post_number, $align, 'gutentor-template-' . $template, $default_class ), $attributes ) ) . '" id="' . esc_attr( $blockID ) . '" ' . GutentorAnimationOptionsDataAttr( $blockComponentAnimation ) . '>' . "\n";
$output .= apply_filters( 'gutentor_post_module_before_container', '', $attributes );
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_container_class', 'grid-container', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_grid_row_class', 'grid-row', $attributes ) ) . "'>";
$output .= apply_filters( 'gutentor_post_module_before_block_items', '', $attributes );
/*post query*/
$output .= apply_filters( 'gutentor_post_module_p2_query_data', '', $gutentor_p2_news_the_query, $attributes );
$output .= apply_filters( 'gutentor_post_module_after_block_items', '', $attributes );
$output .= '</div>';/*.grid-row*/
$output .= '</div>';/*.grid-container*/
$output .= apply_filters( 'gutentor_post_module_after_container', '', $attributes );
$output .= '</' . esc_attr( $tag ) . '>';/*.gutentor-blog-post-wrapper*/
endif;
// Restore original Post Data.
wp_reset_postdata();
return $output;
}
}
}
Gutentor_P2::get_instance()->run();

View File

@@ -0,0 +1,335 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_P3_Hooks' ) ) {
/**
* Block Specific Hooks Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_P3_Hooks extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 1.0.1
* @var string
*/
protected $block_name = 'p3';
/**
* Prevent some functions to called many times
*
* @access private
* @since 2.0.0
* @var integer
*/
private static $counter = 0;
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.0.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'slick' ),
'style_handles' => array( 'slick' ),
);
}
/**
* Add Filter
*
* @access public
* @since 2.0.0
* @return void
*/
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
add_filter( $hook, array( $component, $callback ), $priority, $accepted_args );
}
/**
* Add Action
*
* @access public
* @since 2.0.0
* @return void
*/
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
add_action( $hook, array( $component, $callback ), $priority, $accepted_args );
}
/**
* Run Block
*
* @access public
* @since 2.0.0
* @return void
*/
public function run() {
parent::run();
/*Block Specific PHP hooks*/
$this->add_filter( 'gutentor_post_module_main_wrap_class', $this, 'add_carousel_arrow_class', 15, 2 );
$this->add_filter( 'gutentor_post_module_grid_row_class', $this, 'add_carousel_row', 15, 2 );
$this->add_filter( 'gutentor_post_module_attr', $this, 'add_carousel_data', 15, 2 );
$this->add_filter( 'gutentor_post_module_grid_column_class', $this, 'add_carousel_class', 15, 2 );
$this->add_filter( 'gutentor_post_module_before_block_items', $this, 'add_carousel_arrow', 15, 2 );
}
/**
* Adding Carousel Class
*
* @param {array} output
* @param {object} props
* @return {array}
*/
public function add_carousel_arrow_class( $output, $attributes ) {
$gutentorBlockName = ( isset( $attributes['gName'] ) ) ? $attributes['gName'] : '';
$block_list = array( 'gutentor/p1' );
if ( ! in_array( $gutentorBlockName, $block_list ) ) {
return $output;
}
if ( ! isset( $attributes['p1CarouselOpt'] ) || ! $attributes['p1CarouselOpt']['enable'] ) {
return $output;
}
if ( ! isset( $attributes['p1CarouselOpt']['arrowsPosition'] ) ) {
return $output;
}
$arrow_position = $attributes['p1CarouselOpt']['arrowsPosition'];
$enable_desktop_arrow = isset( $attributes['p1CarouselOpt']['arrows'] ) && $attributes['p1CarouselOpt']['arrows'];
$enable_tablet_arrow = isset( $attributes['p1CarouselOpt']['arrowsT'] ) && $attributes['p1CarouselOpt']['arrowsT'];
$enable_mobile_arrow = isset( $attributes['p1CarouselOpt']['arrowsM'] ) && $attributes['p1CarouselOpt']['arrowsM'];
$arrow_position_desktop = array_key_exists( 'desktop', $arrow_position ) ? $arrow_position['desktop'] : false;
if ( $enable_desktop_arrow && $arrow_position_desktop ) {
$output = gutentor_concat_space( $output, $arrow_position_desktop . '-desktop' );
}
$arrow_position_tablet = array_key_exists( 'tablet', $arrow_position ) ? $arrow_position['tablet'] : false;
if ( $enable_tablet_arrow && $arrow_position_tablet ) {
$output = gutentor_concat_space( $output, $arrow_position_tablet . '-tablet' );
}
$arrow_position_mobile = array_key_exists( 'mobile', $arrow_position ) ? $arrow_position['mobile'] : false;
if ( $enable_mobile_arrow && $arrow_position_mobile ) {
$output = gutentor_concat_space( $output, $arrow_position_mobile . '-mobile' );
}
return $output;
}
/**
* Adding Container Remove Classes
*
* @param {array} output
* @param {object} props
* @return string
*/
public function add_carousel_row( $output, $attributes ) {
if ( ! isset( $attributes['p1CarouselOpt'] ) || ! $attributes['p1CarouselOpt']['enable'] ) {
return $output;
}
$local_data = str_replace( 'grid-row', '', $output );
if ( isset( $attributes['p1CarouselOpt']['carouselID'] ) ) {
$local_data = gutentor_concat_space( $local_data, $attributes['p1CarouselOpt']['carouselID'] );
}
return gutentor_concat_space( $local_data, 'gutentor-module-carousel-row' );
}
/**
* Adding Carousel Data
*
* @param {array} output
* @param {object} props
* @return {array}
*/
public function add_carousel_data( $output, $attributes ) {
if ( ! isset( $attributes['p1CarouselOpt'] ) || ! $attributes['p1CarouselOpt']['enable'] ) {
return $output;
}
$p1CarouselOpt = $attributes['p1CarouselOpt'];
$local_data = array();
if ( isset( $p1CarouselOpt['dots'] ) ) {
$local_data['data-dots'] = ( $p1CarouselOpt['dots'] ) ? 'true' : 'false';
}
if ( isset( $p1CarouselOpt['dotsT'] ) ) {
$local_data['data-dotstablet'] = ( $p1CarouselOpt['dotsT'] ) ? 'true' : 'false';
}
if ( isset( $p1CarouselOpt['dotsM'] ) ) {
$local_data['data-dotsmobile'] = ( $p1CarouselOpt['dotsM'] ) ? 'true' : 'false';
}
if ( isset( $p1CarouselOpt['arrowNext'] ) ) {
$local_data['data-nextarrow'] = ( $p1CarouselOpt['arrowNext'] ) ? $p1CarouselOpt['arrowNext'] : '';
}
if ( isset( $p1CarouselOpt['arrowsPrev'] ) ) {
$local_data['data-prevarrow'] = ( $p1CarouselOpt['arrowsPrev'] ) ? $p1CarouselOpt['arrowsPrev'] : '';
}
if ( isset( $p1CarouselOpt['arrows'] ) ) {
$local_data['data-arrows'] = ( $p1CarouselOpt['arrows'] ) ? 'true' : 'false';
}
if ( isset( $p1CarouselOpt['arrowsT'] ) ) {
$local_data['data-arrowstablet'] = ( $p1CarouselOpt['arrowsT'] ) ? 'true' : 'false';
}
if ( isset( $p1CarouselOpt['arrowsM'] ) ) {
$local_data['data-arrowsmobile'] = ( $p1CarouselOpt['arrowsM'] ) ? 'true' : 'false';
}
if ( isset( $p1CarouselOpt['arrowsPosition']['desktop'] ) ) {
$local_data['data-arrowsPositionDesktop'] = ( $p1CarouselOpt['arrowsPosition']['desktop'] . '-desktop' );
}
if ( isset( $p1CarouselOpt['arrowsPosition']['tablet'] ) ) {
$local_data['data-arrowsPositionTablet'] = ( $p1CarouselOpt['arrowsPosition']['tablet'] . '-tablet' );
}
if ( isset( $p1CarouselOpt['arrowsPosition']['mobile'] ) ) {
$local_data['data-arrowsPositionMobile'] = ( $p1CarouselOpt['arrowsPosition']['mobile'] . '-mobile' );
}
if ( isset( $p1CarouselOpt['infinite'] ) ) {
$local_data['data-infinite'] = ( $p1CarouselOpt['infinite'] ) ? 'true' : 'false';
}
if ( isset( $p1CarouselOpt['speed'] ) ) {
$local_data['data-speed'] = $p1CarouselOpt['speed'];
}
if ( isset( $p1CarouselOpt['autoplay'] ) ) {
$local_data['data-autoplay'] = ( $p1CarouselOpt['autoplay'] ) ? 'true' : 'false';
if ( isset( $p1CarouselOpt['autoplaySpeed'] ) ) {
$local_data['data-autoplayspeed'] = $p1CarouselOpt['autoplaySpeed'];
}
if ( isset( $p1CarouselOpt['pauseOnFocus'] ) ) {
$local_data['data-pauseonfocus'] = ( $p1CarouselOpt['pauseOnFocus'] ) ? 'true' : 'false';
}
if ( isset( $p1CarouselOpt['pauseOnHover'] ) ) {
$local_data['data-pauseonhover'] = ( $p1CarouselOpt['pauseOnHover'] ) ? 'true' : 'false';
}
}
if ( isset( $p1CarouselOpt['draggable'] ) ) {
$local_data['data-draggable'] = ( $p1CarouselOpt['draggable'] ) ? 'true' : 'false';
}
/*center mode*/
if ( isset( $p1CarouselOpt['cmondesktop'] ) ) {
$local_data['data-cmondesktop'] = ( $p1CarouselOpt['cmondesktop'] ) ? 'true' : 'false';
if ( isset( $p1CarouselOpt['cmpaddingdesktop'] ) ) {
$local_data['data-cmpaddingdesktop'] = ( $p1CarouselOpt['cmpaddingdesktop'] ) ? $p1CarouselOpt['cmpaddingdesktop'] : '';
}
}
if ( isset( $p1CarouselOpt['cmontablet'] ) ) {
$local_data['data-cmontablet'] = ( $p1CarouselOpt['cmontablet'] ) ? 'true' : 'false';
if ( isset( $p1CarouselOpt['cmpaddingtablet'] ) ) {
$local_data['data-cmpaddingtablet'] = ( $p1CarouselOpt['cmpaddingtablet'] ) ? $p1CarouselOpt['cmpaddingtablet'] : '';
}
}
if ( isset( $p1CarouselOpt['cmonmobile'] ) ) {
$local_data['data-cmonmobile'] = ( $p1CarouselOpt['cmonmobile'] ) ? 'true' : 'false';
if ( isset( $p1CarouselOpt['cmpaddingmobile'] ) ) {
$local_data['data-cmpaddingmobile'] = ( $p1CarouselOpt['cmpaddingmobile'] ) ? $p1CarouselOpt['cmpaddingmobile'] : '';
}
}
if ( isset( $p1CarouselOpt['slideitem']['desktop'] ) ) {
$local_data['data-slideitemdesktop'] = $p1CarouselOpt['slideitem']['desktop'];
}
if ( isset( $p1CarouselOpt['slideitem']['tablet'] ) ) {
$local_data['data-slideitemtablet'] = $p1CarouselOpt['slideitem']['tablet'];
}
if ( isset( $p1CarouselOpt['slideitem']['mobile'] ) ) {
$local_data['data-slideitemmobile'] = $p1CarouselOpt['slideitem']['mobile'];
}
if ( isset( $p1CarouselOpt['slidescroll']['desktop'] ) ) {
$local_data['data-slidescroll-desktop'] = $p1CarouselOpt['slidescroll']['desktop'];
}
if ( isset( $p1CarouselOpt['slidescroll']['tablet'] ) ) {
$local_data['data-slidescroll-tablet'] = $p1CarouselOpt['slidescroll']['tablet'];
}
if ( isset( $p1CarouselOpt['slidescroll']['mobile'] ) ) {
$local_data['data-slidescroll-mobile'] = $p1CarouselOpt['slidescroll']['mobile'];
}
return $local_data;
}
/**
* Adding carousel class
*
* @param {array} output
* @param {object} props
* @return {array}
*/
public function add_carousel_class( $output, $attributes ) {
if ( ! isset( $attributes['p1CarouselOpt'] ) || ! $attributes['p1CarouselOpt']['enable'] ) {
return $output;
}
return gutentor_concat_space( $output, 'gutentor-carousel-item' );
}
/**
* Adding carousel class
*
* @param {array} output
* @param {object} props
* @return {array}
*/
public function add_carousel_arrow( $output, $attributes ) {
$gutentorBlockName = ( isset( $attributes['gName'] ) ) ? $attributes['gName'] : '';
$block_list = array( 'gutentor/p1' );
if ( ! in_array( $gutentorBlockName, $block_list ) ) {
return $output;
}
if ( ! isset( $attributes['p1CarouselOpt'] ) || ! $attributes['p1CarouselOpt']['enable'] ) {
return $output;
}
$p1CarouselOpt = ( isset( $attributes['p1CarouselOpt'] ) && $attributes['p1CarouselOpt']['enable'] ) ? $attributes['p1CarouselOpt'] : false;
$desktop_row_position = ( $p1CarouselOpt && isset( $p1CarouselOpt['arrowsPosition']['desktop'] ) && $p1CarouselOpt['arrowsPosition']['desktop'] ) ? $p1CarouselOpt['arrowsPosition']['desktop'] . '-desktop' : false;
if ( $desktop_row_position != 'gutentor-slick-a-default-desktop' ) {
$output .= '<div class="gutentor-slick-arrows"></div>';
}
return $output;
}
}
}
/**
* Return instance of Gutentor_P3_Hooks class
*
* @since 1.0.0
*/
if ( ! function_exists( 'gutentor_p3_hooks' ) ) {
function gutentor_p3_hooks() {
return Gutentor_P3_Hooks::get_instance();
}
}
gutentor_p3_hooks()->run();

View File

@@ -0,0 +1,77 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_P4' ) ) {
/**
* Functions related to Google Map
*
* @package Gutentor
* @since 1.0.1
*/
class Gutentor_P4 extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 1.0.1
* @var string
*/
protected $block_name = 'p4';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 1.0.1
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 1.0.1
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'flexMenu' ),
);
}
/**
* Just return content.
* It is for view_script_handles
*
* @param array $attributes Attributes array.
* @param string $content Content is always string.
* @return string
* @since 1.0.1
* @access public
*/
public function render_callback( $attributes, $content ) {
return $content;
}
}
}
Gutentor_P4::get_instance()->run();

View File

@@ -0,0 +1,313 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_P5' ) ) {
/**
* Functions related to Blog Post
*
* @package Gutentor
* @since 1.0.1
*/
class Gutentor_P5 extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 1.0.1
* @var string
*/
protected $block_name = 'p5';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @return object
* @since 1.0.1
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 1.0.1
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'acmeticker' ),
);
}
/**
* Load Dependencies
* Used for blog template loading
*
* @since 1.0.1
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function load_dependencies() {
require_once GUTENTOR_PATH . 'includes/block-templates/ticker/class-ticker-p5-templates.php';
}
/**
* Returns attributes for this Block
*
* @static
* @access public
* @return array
* @since 1.0.1
*/
public function get_attrs() {
$blog_post_attr = array(
'gID' => array(
'type' => 'string',
'default' => '',
),
'timestamp' => array(
'type' => 'number',
'default' => 0,
),
'gName' => array(
'type' => 'string',
'default' => 'gutentor/p5',
),
'p5Temp' => array(
'type' => 'string',
'default' => 'gutentor_p5_template1',
),
'pTaxType' => array(
'type' => 'string',
'default' => 'category',
),
'pTaxOperator' => array(
'type' => 'string',
'default' => 'IN',
),
'pTaxTerm' => array(
'type' => 'array',
'items' => array(
'type' => 'object',
'label' => array(
'type' => 'string',
),
'value' => array(
'type' => 'number',
),
),
),
'pPostType' => array(
'type' => 'string',
'default' => 'post',
),
'pIncludePosts' => array(
'type' => 'string',
),
'pExcludePosts' => array(
'type' => 'string',
),
'pOffsetPosts' => array(
'type' => 'number',
),
'gStyle' => array(
'type' => 'string',
'default' => 'gutentor-blog-grid',
),
'postsToShow' => array(
'type' => 'number',
'default' => 6,
),
'order' => array(
'type' => 'string',
'default' => 'desc',
),
'orderBy' => array(
'type' => 'string',
'default' => 'date',
),
'categories' => array(
'type' => 'string',
'default' => '',
),
'gutentorBlogPostImageLink' => array(
'type' => 'boolean',
'default' => false,
),
'gutentorBlogPostImageLinkNewTab' => array(
'type' => 'boolean',
'default' => false,
),
'p5OnNewsTxt' => array(
'type' => 'boolean',
'default' => true,
),
'p5Type' => array(
'type' => 'string',
'default' => 'marquee',
),
'p5Direction' => array(
'type' => 'string',
'default' => 'up',
),
'p5NewsTxt' => array(
'type' => 'string',
'default' => __( 'News', 'gutentor' ),
),
'p5Speed' => array(
'type' => 'number',
'default' => 0.05,
),
'p5PauseOnHover' => array(
'type' => 'boolean',
'default' => false,
),
'p5OnControl' => array(
'type' => 'boolean',
'default' => true,
),
);
$blog_partial_attrs = array_merge_recursive( $blog_post_attr, $this->get_module_common_attrs() );
return array_merge_recursive( $blog_partial_attrs, $this->get_module_query_elements_common_attrs() );
}
/**
* Render Blog Post Data
*
* @param array $attributes
* @param string $content
* @return string
* @since 1.0.1
* @access public
*/
public function render_callback( $attributes, $content ) {
$blockID = isset( $attributes['pID'] ) ? $attributes['pID'] : $attributes['gID'];
$gID = isset( $attributes['gID'] ) ? $attributes['gID'] : '';
$output = '';
$default_class = gutentor_block_add_default_classes( 'gutentor-p5', $attributes );
// the query
$args = array(
'posts_per_page' => $attributes['postsToShow'],
'post_type' => isset( $attributes['pPostType'] ) ? $attributes['pPostType'] : 'post',
'orderby' => $attributes['orderBy'],
'order' => $attributes['order'],
'cat' => $attributes['categories'],
'paged' => isset( $attributes['paged'] ) ? $attributes['paged'] : 1,
);
if ( isset( $attributes['pTaxType'] ) && ! empty( $attributes['pTaxType'] ) &&
isset( $attributes['pTaxTerm'] ) && ! empty( $attributes['pTaxTerm'] ) ) {
$args['taxonomy'] = $attributes['pTaxType'];
$args['taxOperator'] = $attributes['pTaxOperator'] ? $attributes['pTaxOperator'] : 'IN';
if ( is_array( $attributes['pTaxTerm'] ) ) {
$p1_terms = array();
foreach ( $attributes['pTaxTerm'] as $p1_term ) {
$p1_terms [] = $p1_term['value'];
}
$args['term'] = $p1_terms;
} elseif ( is_string( $attributes['pTaxTerm'] ) || is_numeric( $attributes['pTaxTerm'] ) ) {
$args['term'] = $attributes['pTaxTerm'];
}
}
if ( isset( $attributes['pAuthor'] ) && ! empty( $attributes['pAuthor'] ) ) {
if ( is_array( $attributes['pAuthor'] ) ) {
$author_list = array();
foreach ( $attributes['pAuthor'] as $data ) {
$author_list[] = $data['value'];
}
$args['author__in'] = $author_list;
}
}
if ( isset( $attributes['pIncludePosts'] ) && ! empty( $attributes['pIncludePosts'] ) ) {
$args['post__in'] = $attributes['pIncludePosts'];
}
if ( isset( $attributes['pExcludePosts'] ) && ! empty( $attributes['pExcludePosts'] ) ) {
$args['post__not_in'] = $attributes['pExcludePosts'];
}
if ( isset( $attributes['pOffsetPosts'] ) ) {
$args['offset'] = $attributes['pOffsetPosts'];
}
$tag = $attributes['mTag'] ? $attributes['mTag'] : 'div';
$news_ticker_header = $attributes['p5NewsTxt'] ? $attributes['p5NewsTxt'] : '';
$template = $attributes['p5Temp'] ? $attributes['p5Temp'] : '';
$align = isset( $attributes['align'] ) ? 'align' . $attributes['align'] : '';
$blockComponentAnimation = isset( $attributes['mAnimation'] ) ? $attributes['mAnimation'] : '';
$the_query = new WP_Query( gutentor_get_query( $args ) );
if ( $the_query->have_posts() ) :
$tag = gutentor_get_module_tag( $tag );
$output .= '<' . esc_attr( $tag ) . ' class="' . esc_attr( apply_filters( 'gutentor_post_module_main_wrap_class', gutentor_concat_space( 'gutentor-post-module', 'gutentor-post-module-p5', 'section-' . $gID, $template, $align, $default_class ), $attributes ) ) . '" id="' . esc_attr( $blockID ) . '" data-gbid="' . esc_attr( $gID ) . '" ' . GutentorAnimationOptionsDataAttr( $blockComponentAnimation ) . '' . gutentor_get_html_attr( apply_filters( 'gutentor_edit_news_ticker_data_attr', array(), $attributes ) ) . '>' . "\n";
$output .= apply_filters( 'gutentor_post_module_before_container', '', $attributes );
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_p5_newsticker_wrap_class', 'gutentor-news-ticker', $attributes ) ) . "'>";
$output .= apply_filters( 'gutentor_post_module_before_block_items', '', $attributes );
if ( $attributes['p5OnNewsTxt'] ) {
$output .= "<div class='gutentor-news-ticker-label'>" . esc_html( $news_ticker_header ) . '</div>';/*.ul*/
}
$output .= "<div class='gutentor-news-ticker-box'>";
$output .= "<div class='gutentor-news-ticker-wrap'>";
$output .= "<ul class='gutentor-news-ticker-data'>";
while ( $the_query->have_posts() ) :
$the_query->the_post();
$output .= '<li>';
$output .= apply_filters( 'gutentor_post_module_p5_query_data', '', get_post(), $attributes );
$output .= '</li>';/*.li*/
endwhile;
$output .= '</ul>';/*.ul*/
$output .= '</div>';/*.gutentor-news-ticker-wrap*/
$output .= '</div>';/*.gutentor-news-ticker-box*/
if ( 'vertical' === $attributes['p5Type'] ) {
$hor = ' gutentor-news-ticker-vertical-controls';
} else {
$hor = ' gutentor-news-ticker-horizontal-controls';
}
if ( $attributes['p5OnControl'] ) {
$output .= "<div class='gutentor-news-ticker-controls" . $hor . "'>";/*.ul*/
if ( $attributes['p5Type'] !== 'marquee' ) {
$output .= '<Button type="button" class="gutentor-news-ticker-arrow gutentor-news-ticker-prev"></Button>';
}
$output .= '<Button type="button" class="gutentor-news-ticker-action gutentor-news-ticker-pause"></Button>';
if ( $attributes['p5Type'] !== 'marquee' ) {
$output .= '<Button type="button" class="gutentor-news-ticker-arrow gutentor-news-ticker-next"></Button>';
}
$output .= '</div>';/*.gutentor-news-ticker-controls*/
}
$output .= apply_filters( 'gutentor_post_module_after_block_items', '', $attributes );
$output .= '</div>';/*.grid-container*/
$output .= apply_filters( 'gutentor_post_module_after_container', '', $attributes );
$output .= '</' . esc_attr( $tag ) . '>';/*.gutentor-blog-post-wrapper*/
endif;
// Restore original Post Data
wp_reset_postdata();
return $output;
}
}
}
Gutentor_P5::get_instance()->run();

View File

@@ -0,0 +1,365 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_P6' ) ) {
/**
* Functions related to Blog Post
*
* @package Gutentor
* @since 1.0.1
*/
class Gutentor_P6 extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 1.0.1
* @var string
*/
protected $block_name = 'p6';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 1.0.1
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.0.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'magnific-popup' ),
'style_handles' => array( 'magnific-popup' ),
);
}
/**
* Load Dependencies
* Used for blog template loading
*
* @since 1.0.1
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function load_dependencies() {
require_once GUTENTOR_PATH . 'includes/block-templates/duplex/class-duplex-p6-t1.php';
require_once GUTENTOR_PATH . 'includes/block-templates/duplex/class-duplex-p6-t2.php';
}
/**
* Returns attributes for this Block
*
* @static
* @access public
* @since 1.0.1
* @return array
*/
public function get_attrs() {
$blog_post_attr = array(
'gID' => array(
'type' => 'string',
'default' => '',
),
/*column*/
'blockItemsColumn' => array(
'type' => 'object',
'default' => array(
'desktop' => 'grid-md-4',
'tablet' => 'grid-sm-4',
'mobile' => 'grid-xs-12',
),
),
'timestamp' => array(
'type' => 'number',
'default' => 0,
),
'gName' => array(
'type' => 'string',
'default' => 'gutentor/p6',
),
'p6Temp' => array(
'type' => 'string',
'default' => 'gutentor_p6_template1',
),
'gStyle' => array(
'type' => 'string',
'default' => 'gutentor-blog-grid',
),
'pTaxTerm' => array(
'type' => 'array',
'items' => array(
'type' => 'object',
'label' => array(
'type' => 'string',
),
'value' => array(
'type' => 'number',
),
),
),
'pTaxType' => array(
'type' => 'string',
'default' => 'category',
),
'pTaxOperator' => array(
'type' => 'string',
'default' => 'IN',
),
'pPostType' => array(
'type' => 'string',
'default' => 'post',
),
'pIncludePosts' => array(
'type' => 'string',
),
'pExcludePosts' => array(
'type' => 'string',
),
'pOffsetPosts' => array(
'type' => 'number',
),
'postsToShow' => array(
'type' => 'number',
'default' => 6,
),
'order' => array(
'type' => 'string',
'default' => 'desc',
),
'orderBy' => array(
'type' => 'string',
'default' => 'date',
),
'categories' => array(
'type' => 'string',
'default' => '',
),
'gutentorBlogPostImageLink' => array(
'type' => 'boolean',
'default' => false,
),
'pReverseContent' => array(
'type' => 'boolean',
'default' => false,
),
'pOnColInList' => array(
'type' => 'boolean',
'default' => false,
),
'pNoFoundTxt' => array(
'type' => 'string',
'default' => 'Nothing Found',
),
'gutentorBlogPostImageLinkNewTab' => array(
'type' => 'boolean',
'default' => false,
),
'fpWooOnPrice' => array(
'type' => 'boolean',
'default' => true,
),
'fpWooOnFreeTxt' => array(
'type' => 'boolean',
'default' => false,
),
'fpWooFreeTxt' => array(
'type' => 'string',
'default' => __( 'Free', 'gutentor' ),
),
'fpWooOnRating' => array(
'type' => 'boolean',
'default' => true,
),
'pOnFPTagMeta1' => array(
'type' => 'boolean',
'default' => true,
),
'pOnFPTagMeta2' => array(
'type' => 'boolean',
'default' => true,
),
'eFPOnWl' => array(
'type' => 'boolean',
'default' => true,
),
/*Featured Post avatar*/
'pFPOnAvatar' => array(
'type' => 'boolean',
'default' => false,
),
'pFPAvatarPos' => array(
'type' => 'string',
'default' => 'g-avatar-img-fp-t-l',
),
'pFPAvatarSize' => array(
'type' => 'string',
'default' => '48',
),
'pFPAvatarOColor' => array(
'type' => 'object',
'default' => array(
'enable' => false,
'normal' => '',
'hover' => '',
),
),
'pFPOnByAuthor' => array(
'type' => 'boolean',
'default' => false,
),
);
$blog_partial_attrs = array_merge_recursive( $blog_post_attr, $this->get_module_common_attrs() );
$blog_partial_attrs = array_merge_recursive( $blog_partial_attrs, $this->get_module_query_elements_common_attrs() );
return array_merge_recursive( $blog_partial_attrs, $this->get_module_featured_post_query_elements_common_attrs() );
}
/**
* Render Blog Post Data
*
* @since 1.0.1
* @access public
*
* @param array $attributes
* @param string $content
* @return string
*/
public function render_callback( $attributes, $content ) {
$blockID = isset( $attributes['pID'] ) ? $attributes['pID'] : $attributes['gID'];
$gID = isset( $attributes['gID'] ) ? $attributes['gID'] : '';
$output = '';
$default_class = gutentor_block_add_default_classes( 'gutentor-p6', $attributes );
$tag = $attributes['mTag'] ? $attributes['mTag'] : 'div';
$template = $attributes['p6Temp'] ? $attributes['p6Temp'] : '';
$align = isset( $attributes['align'] ) ? 'align' . $attributes['align'] : '';
$blockComponentAnimation = isset( $attributes['mAnimation'] ) ? $attributes['mAnimation'] : '';
$nothing_found_text = isset( $attributes['pNoFoundTxt'] ) ? $attributes['pNoFoundTxt'] : '';
/*query args*/
$query_args = array(
'posts_per_page' => isset( $attributes['postsToShow'] ) ? $attributes['postsToShow'] : 6,
'post_type' => isset( $attributes['pPostType'] ) ? $attributes['pPostType'] : 'post',
'orderby' => isset( $attributes['orderBy'] ) ? $attributes['orderBy'] : 'date',
'order' => isset( $attributes['order'] ) ? $attributes['order'] : 'desc',
'paged' => isset( $attributes['paged'] ) ? $attributes['paged'] : 1,
'ignore_sticky_posts' => true,
'post_status' => 'publish',
);
/*Backward compatible*/
if ( isset( $attributes['categories'] ) && ! empty( $attributes['categories'] ) ) {
if ( is_array( $attributes['categories'] ) && ! gutentor_is_array_empty( $attributes['categories'] ) ) {
$query_args['taxonomy'] = 'category';
$query_args['term'] = $attributes['categories'];
}
if ( ! is_array( $attributes['categories'] ) ) {
$query_args['taxonomy'] = 'category';
$query_args['term'] = $attributes['categories'];
}
}
if ( isset( $attributes['pTaxType'] ) && ! empty( $attributes['pTaxType'] ) &&
isset( $attributes['pTaxTerm'] ) && ! empty( $attributes['pTaxTerm'] ) ) {
$query_args['taxonomy'] = $attributes['pTaxType'];
$query_args['taxOperator'] = $attributes['pTaxOperator'] ? $attributes['pTaxOperator'] : 'IN';
if ( is_array( $attributes['pTaxTerm'] ) ) {
$p1_terms = array();
foreach ( $attributes['pTaxTerm'] as $p1_term ) {
$p1_terms [] = $p1_term['value'];
}
$query_args['term'] = $p1_terms;
} elseif ( is_string( $attributes['pTaxTerm'] ) || is_numeric( $attributes['pTaxTerm'] ) ) {
$query_args['term'] = $attributes['pTaxTerm'];
}
}
if ( isset( $attributes['pAuthor'] ) && ! empty( $attributes['pAuthor'] ) ) {
if ( is_array( $attributes['pAuthor'] ) ) {
$author_list = array();
foreach ( $attributes['pAuthor'] as $data ) {
$author_list[] = $data['value'];
}
$query_args['author__in'] = $author_list;
}
}
if ( isset( $attributes['offset'] ) ) {
$query_args['offset'] = $attributes['offset'];
}
if ( isset( $attributes['pIncludePosts'] ) && ! empty( $attributes['pIncludePosts'] ) ) {
$query_args['post__in'] = $attributes['pIncludePosts'];
}
if ( isset( $attributes['pExcludePosts'] ) && ! empty( $attributes['pExcludePosts'] ) ) {
$query_args['post__not_in'] = $attributes['pExcludePosts'];
}
if ( isset( $attributes['pOffsetPosts'] ) ) {
$query_args['offset'] = $attributes['pOffsetPosts'];
}
/*Search query*/
if ( isset( $attributes['s'] ) && ! empty( $attributes['s'] ) ) {
$query_args['s'] = $attributes['s'];
}
$the_query = new WP_Query( gutentor_get_query( $query_args ) );
$single_post_class = $the_query->post_count === 1 ? 'gutentor-single-post' : '';
$tag = gutentor_get_module_tag( $tag );
$output .= '<' . esc_attr( $tag ) . ' class="' . esc_attr( apply_filters( 'gutentor_post_module_main_wrap_class', gutentor_concat_space( 'section-' . $gID, 'gutentor-post-module', 'gutentor-post-module-p6', $single_post_class, $template, $align, $default_class ), $attributes ) ) . '" id="' . esc_attr( $blockID ) . '" data-gbid="' . esc_attr( $gID ) . '" ' . GutentorAnimationOptionsDataAttr( $blockComponentAnimation ) . '>' . "\n";
$output .= apply_filters( 'gutentor_post_module_before_container', '', $attributes );
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_container_class', 'grid-container', $attributes ) ) . "'>";
$output .= apply_filters( 'gutentor_post_module_before_block_items', '', $attributes );
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_post_module_grid_row_class', 'grid-row', $attributes ) ) . "' " . gutentor_get_html_attr( apply_filters( 'gutentor_post_module_attr', array(), $attributes ) ) . '>';
if ( $the_query->have_posts() ) :
$output .= apply_filters( 'gutentor_post_module_p6_query_data', '', $the_query, $attributes, $content );
else :
$output .= '<header class="g-n-f-t-1"><h2 class="g-n-f-title">' . esc_html( $nothing_found_text ) . '</h2></header>';
endif;
$output .= '</div>';/*.grid-row*/
$output .= apply_filters( 'gutentor_post_module_after_block_items', '', $attributes );
$output .= '</div>';/*.grid-container*/
$output .= apply_filters( 'gutentor_post_module_after_container', '', $attributes );
$output .= '</' . esc_attr( $tag ) . '>';/*.gutentor-blog-post-wrapper*/
// Restore original Post Data.
wp_reset_postdata();
return $output;
}
}
}
Gutentor_P6::get_instance()->run();

View File

@@ -0,0 +1,274 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_T1' ) ) {
/**
* Functions related to Terms
*
* @package Gutentor
* @since 1.0.1
*/
class Gutentor_T1 extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 1.0.1
* @var string
*/
protected $block_name = 't1';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 1.0.1
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Load Dependencies
* Used for blog template loading
*
* @since 1.0.1
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function load_dependencies() {
require_once GUTENTOR_PATH . 'includes/block-templates/normal/class-normal-t1-templates.php';
}
/**
* Returns attributes for this Block
*
* @static
* @access public
* @since 1.0.1
* @return array
*/
protected function get_attrs() {
$term_attr = array(
'gID' => array(
'type' => 'string',
'default' => '',
),
'gName' => array(
'type' => 'string',
'default' => 'gutentor/t1',
),
'termStyle' => array(
'type' => 'string',
'default' => 'gtf-grid',
),
/*Query*/
't1Temp' => array(
'type' => 'string',
'default' => 'gutentor_t1_template1',
),
't1Taxonomy' => array(
'type' => 'string',
'default' => 'category',
),
't1Order' => array(
'type' => 'string',
'default' => 'desc',
),
't1OrderBy' => array(
'type' => 'string',
'default' => 'date',
),
't1IncludeTerms' => array(
'type' => 'string',
),
't1ExcludeTerms' => array(
'type' => 'string',
),
't1Number' => array(
'type' => 'number',
'default' => 6,
),
't1HideEmpty' => array(
'type' => 'boolean',
'default' => 'true',
),
'tRevCont' => array(
'type' => 'boolean',
'default' => false,
),
'tOnCol' => array(
'type' => 'boolean',
'default' => false,
),
/*global*/
't2ContentMargin' => array(
'type' => 'object',
),
't2ContentPadding' => array(
'type' => 'object',
'default' => array(
'type' => 'px',
'mTop' => '15',
'mRight' => '15',
'mBottom' => '15',
'mLeft' => '15',
),
),
't2BgProps' => array(
'type' => 'object',
'default' => array(
'size' => 'cover',
'pos' => 'center',
'repeat' => 'no-repeat',
'attachment' => 'scroll',
),
),
'blockSortableItems' => array(
'type' => 'object',
'default' => array(
array(
'itemValue' => 'featured-image',
'itemLabel' => __( 'Featured Image', 'gutentor' ),
),
array(
'itemValue' => 'title',
'itemLabel' => __( 'Title', 'gutentor' ),
),
array(
'itemValue' => 'count',
'itemLabel' => __( 'Count', 'gutentor' ),
),
array(
'itemValue' => 'description',
'itemLabel' => __( 'Description/Excerpt', 'gutentor' ),
),
array(
'itemValue' => 'button',
'itemLabel' => __( 'Button', 'gutentor' ),
),
),
),
'tTypeTermQuery' => array(
'type' => 'string',
'default' => 'default',
),
'tTermQuery' => array(
'type' => 'string',
'default' => '',
),
);
$term_partial_attr = array_merge_recursive( $term_attr, $this->get_module_common_attrs() );
return array_merge_recursive( $term_partial_attr, $this->get_term_common_attrs() );
}
/**
* Render Term Data
*
* @since 1.0.1
* @access public
*
* @param array $attributes
* @param string $content
* @return string
*/
public function render_callback( $attributes, $content ) {
$blockID = isset( $attributes['mID'] ) ? $attributes['mID'] : $attributes['gID'];
$gID = isset( $attributes['gID'] ) ? $attributes['gID'] : '';
$tTypeTermQuery = isset( $attributes['tTypeTermQuery'] ) ? $attributes['tTypeTermQuery'] : 'default';
$output = '';
$default_class = gutentor_block_add_default_classes( 'gutentor-t1', $attributes );
$tag = $attributes['mTag'] ? $attributes['mTag'] : 'section';
$template = $attributes['t1Temp'] ? $attributes['t1Temp'] : '';
$termStyle = $attributes['termStyle'] ? $attributes['termStyle'] : '';
$tRevCont = $attributes['tRevCont'] ? $attributes['tRevCont'] : '';
$tRevContClass = ( $termStyle === 'gtf-list' && $tRevCont ) ? 'gtf-reverse-list' : '';
$tOnImgW = isset( $attributes['tOnImgW'] ) && $attributes['tOnImgW'];
$tImgW = isset( $attributes['tImgW'] ) && $attributes['tImgW'];
$enable_featured_img = isset( $attributes['tOnFImg'] ) && $attributes['tOnFImg'];
$enabledWidth = ( $template !== 'gutentor_t1_template2' && $enable_featured_img && $tOnImgW && $tImgW ) ? 'gutentor-enabled-width' : '';
$align = isset( $attributes['align'] ) ? 'align' . $attributes['align'] : '';
$blockComponentAnimation = isset( $attributes['mAnimation'] ) ? $attributes['mAnimation'] : '';
/*
Query
*/
$term_query_args = array(
'taxonomy' => isset( $attributes['t1Taxonomy'] ) ? $attributes['t1Taxonomy'] : 'category',
);
if ( $tTypeTermQuery === 'default' ) {
/*query args*/
$term_query_args = array(
'taxonomy' => isset( $attributes['t1Taxonomy'] ) ? $attributes['t1Taxonomy'] : 'category',
'orderby' => isset( $attributes['t1OrderBy'] ) ? $attributes['t1OrderBy'] : 'date',
'order' => isset( $attributes['t1Order'] ) ? $attributes['t1Order'] : 'desc',
'hide_empty' => isset( $attributes['t1HideEmpty'] ) ? $attributes['t1HideEmpty'] : true,
'number' => isset( $attributes['t1Number'] ) ? $attributes['t1Number'] : 6,
);
if ( isset( $attributes['t1IncludeTerms'] ) && ! empty( $attributes['t1IncludeTerms'] ) ) {
$term_query_args['include'] = explode( ',', $attributes['t1IncludeTerms'] );
}
if ( isset( $attributes['t1ExcludeTerms'] ) && ! empty( $attributes['t1ExcludeTerms'] ) ) {
$term_query_args['exclude'] = explode( ',', $attributes['t1ExcludeTerms'] );
}
}
if ( $tTypeTermQuery === 'custom' ) {
$tTermQueryJson = isset( $attributes['tTermQuery'] ) ? $attributes['tTermQuery'] : false;
$tTermQueryData = json_decode( $tTermQueryJson, true );
$term_query_args = array_merge( $term_query_args, $tTermQueryData );
}
$terms = get_terms( gutentor_get_term_query( $term_query_args ) );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
$tag = gutentor_get_module_tag( $tag );
$output .= '<' . esc_attr( $tag ) . ' id="' . esc_attr( $blockID ) . '" class="' . esc_attr( apply_filters( 'gutentor_term_module_main_wrap_class', gutentor_concat_space( 'section-' . $gID, 'gutentor-module', 'gtf-module', 'gutentor-term-module', 'gutentor-term-module-t1', $align, $termStyle, $tRevContClass, $enabledWidth, $template, $default_class ), $attributes ) ) . '" id="' . esc_attr( $blockID ) . '" ' . GutentorAnimationOptionsDataAttr( $blockComponentAnimation ) . '>' . "\n";
$output .= apply_filters( 'gutentor_term_module_before_container', '', $attributes );
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_container_class', 'grid-container', $attributes ) ) . "'>";
$output .= apply_filters( 'gutentor_term_module_before_block_items', '', $attributes );
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_grid_row_class', 'grid-row', $attributes ) ) . "' " . gutentor_get_html_attr( apply_filters( 'gutentor_term_module_attr', array(), $attributes ) ) . '>';
$output .= apply_filters( 'gutentor_term_module_before_block_items', '', $attributes );
$index = 0;
foreach ( $terms as $term ) {
/*term query*/
$output .= apply_filters( 'gutentor_term_module_t1_query_data', '', $term, $attributes, $index );
++$index;
}
$output .= '</div>';/*.grid-row*/
$output .= apply_filters( 'gutentor_term_module_after_block_items', '', $attributes );
$output .= '</div>';/*.grid-container*/
$output .= apply_filters( 'gutentor_term_module_after_container', '', $attributes );
$output .= '</' . esc_attr( $tag ) . '>';/*.gutentor-blog-term-wrapper*/
}
return $output;
}
}
}
Gutentor_T1::get_instance()->run();

View File

@@ -0,0 +1,197 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_T2' ) ) {
/**
* Functions related to Terms
*
* @package Gutentor
* @since 1.0.1
*/
class Gutentor_T2 extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 1.0.1
* @var string
*/
protected $block_name = 't2';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 1.0.1
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Returns attributes for this Block
*
* @static
* @access public
* @since 1.0.1
* @return array
*/
protected function get_attrs() {
$term_attr = array(
'gID' => array(
'type' => 'string',
'default' => '',
),
'gName' => array(
'type' => 'string',
'default' => 'gutentor/t2',
),
/*Query*/
't2Temp' => array(
'type' => 'number',
'default' => 1,
),
't2Taxonomy' => array(
'type' => 'string',
'default' => 'category',
),
't2Order' => array(
'type' => 'string',
'default' => 'desc',
),
't2OrderBy' => array(
'type' => 'string',
'default' => 'date',
),
't2IncludeTerms' => array(
'type' => 'string',
),
't2ExcludeTerms' => array(
'type' => 'string',
),
't2Number' => array(
'type' => 'number',
),
't2HideEmpty' => array(
'type' => 'boolean',
'default' => 'true',
),
/*global*/
't2ContentMargin' => array(
'type' => 'object',
),
't2ContentPadding' => array(
'type' => 'object',
'default' => array(
'type' => 'px',
'mTop' => '15',
'mRight' => '15',
'mBottom' => '15',
'mLeft' => '15',
),
),
't2BgProps' => array(
'type' => 'object',
'default' => array(
'size' => 'cover',
'pos' => 'center',
'repeat' => 'no-repeat',
'attachment' => 'scroll',
),
),
);
$term_partial_attr = array_merge_recursive( $term_attr, $this->get_module_common_attrs() );
return array_merge_recursive( $term_partial_attr, $this->get_term_common_attrs() );
}
/**
* Render Blog Post Data
*
* @since 1.0.1
* @access public
*
* @param array $attributes
* @param string $content
* @return string
*/
public function render_callback( $attributes, $content ) {
$blockID = isset( $attributes['mID'] ) ? $attributes['mID'] : $attributes['gID'];
$gID = isset( $attributes['gID'] ) ? $attributes['gID'] : '';
$output = '';
$default_class = gutentor_block_add_default_classes( 'gutentor-t2', $attributes );
$tag = $attributes['mTag'] ? $attributes['mTag'] : 'section';
$template = $attributes['t2Temp'] ? $attributes['t2Temp'] : '';
$align = isset( $attributes['align'] ) ? 'align' . $attributes['align'] : '';
$blockComponentAnimation = isset( $attributes['mAnimation'] ) ? $attributes['mAnimation'] : '';
/*
Query
*/
$taxonomy = isset( $attributes['t2Taxonomy'] ) ? $attributes['t2Taxonomy'] : 'category';
$orderby = isset( $attributes['t2OrderBy'] ) ? $attributes['t2OrderBy'] : 'date';
$order = isset( $attributes['t2Order'] ) ? $attributes['t2Order'] : 'desc';
$hide_empty = isset( $attributes['t2HideEmpty'] ) ? $attributes['t2HideEmpty'] : true;
$include = isset( $attributes['t2IncludeTerms'] ) ? $attributes['t2IncludeTerms'] : '';
$exclude = isset( $attributes['t2ExcludeTerms'] ) ? $attributes['t2ExcludeTerms'] : '';
$number = isset( $attributes['t2Number'] ) ? $attributes['t2Number'] : 5;
$terms = get_terms(
gutentor_get_term_query(
array(
'taxonomy' => $taxonomy,
'orderby' => $orderby,
'order' => $order,
'hide_empty' => $hide_empty,
'include' => $include,
'exclude' => $exclude,
'number' => $number,
)
)
);
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
$tag = gutentor_get_module_tag( $tag );
$output .= '<' . esc_attr( $tag ) . ' id="' . esc_attr( $blockID ) . '" class="' . esc_attr( apply_filters( 'gutentor_term_module_main_wrap_class', gutentor_concat_space( 'section-' . $gID, 'gutentor-module', 'gtf-module', 'gutentor-term-module', 'gutentor-term-module-t2', $align, 'g-loop-' . $number, 'g-template-' . $template, $default_class ), $attributes ) ) . '" id="' . esc_attr( $blockID ) . '" ' . GutentorAnimationOptionsDataAttr( $blockComponentAnimation ) . '>' . "\n";
$output .= apply_filters( 'gutentor_term_module_before_container', '', $attributes );
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_container_class', 'grid-container', $attributes ) ) . "'>";
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_term_module_grid_row_class', 'grid-row', $attributes ) ) . "'>";
$output .= apply_filters( 'gutentor_term_module_before_block_items', '', $attributes );
/*term query*/
$output .= apply_filters( 'gutentor_term_module_t2_query_data', '', $terms, $attributes );
$output .= apply_filters( 'gutentor_term_module_after_block_items', '', $attributes );
$output .= '</div>';/*.grid-row*/
$output .= '</div>';/*.grid-container*/
$output .= apply_filters( 'gutentor_term_module_after_container', '', $attributes );
$output .= '</' . esc_attr( $tag ) . '>';/*.gutentor-blog-term-wrapper*/
}
return $output;
}
}
}
Gutentor_T2::get_instance()->run();

View File

@@ -0,0 +1,324 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_T3_Hooks' ) ) {
/**
* Block Specific Hooks Class For Gutentor
*
* @package Gutentor
* @since 2.0.0
*/
class Gutentor_T3_Hooks extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 1.0.1
* @var string
*/
protected $block_name = 't3';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 2.0.0
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.0.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'slick' ),
'style_handles' => array( 'slick' ),
);
}
/**
* Add Filter
*
* @access public
* @since 2.0.0
* @return void
*/
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
add_filter( $hook, array( $component, $callback ), $priority, $accepted_args );
}
/**
* Add Action
*
* @access public
* @since 2.0.0
* @return void
*/
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
add_action( $hook, array( $component, $callback ), $priority, $accepted_args );
}
/**
* Run Block
*
* @access public
* @since 2.0.0
* @return void
*/
public function run() {
parent::run();
/*Block Specific PHP hooks*/
$this->add_filter( 'gutentor_term_module_main_wrap_class', $this, 'add_carousel_arrow_class', 15, 2 );
$this->add_filter( 'gutentor_term_module_grid_row_class', $this, 'add_carousel_row', 15, 2 );
$this->add_filter( 'gutentor_term_module_attr', $this, 'add_carousel_data', 15, 2 );
$this->add_filter( 'gutentor_term_module_article_class', $this, 'add_carousel_class', 15, 2 );
$this->add_filter( 'gutentor_term_module_before_block_items', $this, 'add_carousel_arrow', 15, 2 );
}
/**
* Adding Carousel Class
*
* @param {array} output
* @param {object} props
* @return {array}
*/
public function add_carousel_arrow_class( $output, $attributes ) {
$gutentorBlockName = ( isset( $attributes['gName'] ) ) ? $attributes['gName'] : '';
$block_list = array( 'gutentor/t1' );
if ( ! in_array( $gutentorBlockName, $block_list ) ) {
return $output;
}
if ( ! isset( $attributes['t1CarouselOpt'] ) || ! $attributes['t1CarouselOpt']['enable'] ) {
return $output;
}
if ( ! isset( $attributes['t1CarouselOpt']['arrowsPosition'] ) ) {
return $output;
}
$arrow_position = $attributes['t1CarouselOpt']['arrowsPosition'];
$enable_desktop_arrow = isset( $attributes['t1CarouselOpt']['arrows'] ) && $attributes['t1CarouselOpt']['arrows'];
$enable_tablet_arrow = isset( $attributes['t1CarouselOpt']['arrowsT'] ) && $attributes['t1CarouselOpt']['arrowsT'];
$enable_mobile_arrow = isset( $attributes['t1CarouselOpt']['arrowsM'] ) && $attributes['t1CarouselOpt']['arrowsM'];
$arrow_position_desktop = array_key_exists( 'desktop', $arrow_position ) ? $arrow_position['desktop'] : false;
if ( $enable_desktop_arrow && $arrow_position_desktop ) {
$output = gutentor_concat_space( $output, $arrow_position_desktop . '-desktop' );
}
$arrow_position_tablet = array_key_exists( 'tablet', $arrow_position ) ? $arrow_position['tablet'] : false;
if ( $enable_tablet_arrow && $arrow_position_tablet ) {
$output = gutentor_concat_space( $output, $arrow_position_tablet . '-tablet' );
}
$arrow_position_mobile = array_key_exists( 'mobile', $arrow_position ) ? $arrow_position['mobile'] : false;
if ( $enable_mobile_arrow && $arrow_position_mobile ) {
$output = gutentor_concat_space( $output, $arrow_position_mobile . '-mobile' );
}
return $output;
}
/**
* Adding Container Remove Classes
*
* @param {array} output
* @param {object} props
* @return string
*/
public function add_carousel_row( $output, $attributes ) {
if ( ! isset( $attributes['t1CarouselOpt'] ) || ! $attributes['t1CarouselOpt']['enable'] ) {
return $output;
}
$local_data = str_replace( 'grid-row', '', $output );
if ( isset( $attributes['t1CarouselOpt']['carouselID'] ) ) {
$local_data = gutentor_concat_space( $local_data, $attributes['t1CarouselOpt']['carouselID'] );
}
return gutentor_concat_space( $local_data, 'gutentor-module-carousel-row' );
}
/**
* Adding Carousel Data
*
* @param {array} output
* @param {object} props
* @return {array}
*/
public function add_carousel_data( $output, $attributes ) {
if ( ! isset( $attributes['t1CarouselOpt'] ) || ! $attributes['t1CarouselOpt']['enable'] ) {
return $output;
}
$t1CarouselOpt = $attributes['t1CarouselOpt'];
$local_data = array();
if ( isset( $t1CarouselOpt['dots'] ) ) {
$local_data['data-dots'] = ( $t1CarouselOpt['dots'] ) ? 'true' : 'false';
}
if ( isset( $t1CarouselOpt['dotsT'] ) ) {
$local_data['data-dotstablet'] = ( $t1CarouselOpt['dotsT'] ) ? 'true' : 'false';
}
if ( isset( $t1CarouselOpt['dotsM'] ) ) {
$local_data['data-dotsmobile'] = ( $t1CarouselOpt['dotsM'] ) ? 'true' : 'false';
}
if ( isset( $t1CarouselOpt['arrowNext'] ) ) {
$local_data['data-nextarrow'] = ( $t1CarouselOpt['arrowNext'] ) ? $t1CarouselOpt['arrowNext'] : '';
}
if ( isset( $t1CarouselOpt['arrowsPrev'] ) ) {
$local_data['data-prevarrow'] = ( $t1CarouselOpt['arrowsPrev'] ) ? $t1CarouselOpt['arrowsPrev'] : '';
}
if ( isset( $t1CarouselOpt['arrows'] ) ) {
$local_data['data-arrows'] = ( $t1CarouselOpt['arrows'] ) ? 'true' : 'false';
}
if ( isset( $t1CarouselOpt['arrowsT'] ) ) {
$local_data['data-arrowstablet'] = ( $t1CarouselOpt['arrowsT'] ) ? 'true' : 'false';
}
if ( isset( $t1CarouselOpt['arrowsM'] ) ) {
$local_data['data-arrowsmobile'] = ( $t1CarouselOpt['arrowsM'] ) ? 'true' : 'false';
}
if ( isset( $t1CarouselOpt['arrowsPosition']['desktop'] ) ) {
$local_data['data-arrowsPositionDesktop'] = ( $t1CarouselOpt['arrowsPosition']['desktop'] . '-desktop' );
}
if ( isset( $t1CarouselOpt['arrowsPosition']['tablet'] ) ) {
$local_data['data-arrowsPositionTablet'] = ( $t1CarouselOpt['arrowsPosition']['tablet'] . '-tablet' );
}
if ( isset( $t1CarouselOpt['arrowsPosition']['mobile'] ) ) {
$local_data['data-arrowsPositionMobile'] = ( $t1CarouselOpt['arrowsPosition']['mobile'] . '-mobile' );
}
if ( isset( $t1CarouselOpt['infinite'] ) ) {
$local_data['data-infinite'] = ( $t1CarouselOpt['infinite'] ) ? 'true' : 'false';
}
if ( isset( $t1CarouselOpt['speed'] ) ) {
$local_data['data-speed'] = $t1CarouselOpt['speed'];
}
if ( isset( $t1CarouselOpt['autoplay'] ) ) {
$local_data['data-autoplay'] = ( $t1CarouselOpt['autoplay'] ) ? 'true' : 'false';
if ( isset( $t1CarouselOpt['autoplaySpeed'] ) ) {
$local_data['data-autoplayspeed'] = $t1CarouselOpt['autoplaySpeed'];
}
if ( isset( $t1CarouselOpt['pauseOnFocus'] ) ) {
$local_data['data-pauseonfocus'] = ( $t1CarouselOpt['pauseOnFocus'] ) ? 'true' : 'false';
}
if ( isset( $t1CarouselOpt['pauseOnHover'] ) ) {
$local_data['data-pauseonhover'] = ( $t1CarouselOpt['pauseOnHover'] ) ? 'true' : 'false';
}
}
if ( isset( $t1CarouselOpt['draggable'] ) ) {
$local_data['data-draggable'] = ( $t1CarouselOpt['draggable'] ) ? 'true' : 'false';
}
/*center mode*/
if ( isset( $t1CarouselOpt['cmondesktop'] ) ) {
$local_data['data-cmondesktop'] = ( $t1CarouselOpt['cmondesktop'] ) ? 'true' : 'false';
if ( isset( $t1CarouselOpt['cmpaddingdesktop'] ) ) {
$local_data['data-cmpaddingdesktop'] = ( $t1CarouselOpt['cmpaddingdesktop'] ) ? $t1CarouselOpt['cmpaddingdesktop'] : '';
}
}
if ( isset( $t1CarouselOpt['cmontablet'] ) ) {
$local_data['data-cmontablet'] = ( $t1CarouselOpt['cmontablet'] ) ? 'true' : 'false';
if ( isset( $t1CarouselOpt['cmpaddingtablet'] ) ) {
$local_data['data-cmpaddingtablet'] = ( $t1CarouselOpt['cmpaddingtablet'] ) ? $t1CarouselOpt['cmpaddingtablet'] : '';
}
}
if ( isset( $t1CarouselOpt['cmonmobile'] ) ) {
$local_data['data-cmonmobile'] = ( $t1CarouselOpt['cmonmobile'] ) ? 'true' : 'false';
if ( isset( $t1CarouselOpt['cmpaddingmobile'] ) ) {
$local_data['data-cmpaddingmobile'] = ( $t1CarouselOpt['cmpaddingmobile'] ) ? $t1CarouselOpt['cmpaddingmobile'] : '';
}
}
if ( isset( $t1CarouselOpt['slideitem']['desktop'] ) ) {
$local_data['data-slideitemdesktop'] = $t1CarouselOpt['slideitem']['desktop'];
}
if ( isset( $t1CarouselOpt['slideitem']['tablet'] ) ) {
$local_data['data-slideitemtablet'] = $t1CarouselOpt['slideitem']['tablet'];
}
if ( isset( $t1CarouselOpt['slideitem']['mobile'] ) ) {
$local_data['data-slideitemmobile'] = $t1CarouselOpt['slideitem']['mobile'];
}
if ( isset( $t1CarouselOpt['slidescroll']['desktop'] ) ) {
$local_data['data-slidescroll-desktop'] = $t1CarouselOpt['slidescroll']['desktop'];
}
if ( isset( $t1CarouselOpt['slidescroll']['tablet'] ) ) {
$local_data['data-slidescroll-tablet'] = $t1CarouselOpt['slidescroll']['tablet'];
}
if ( isset( $t1CarouselOpt['slidescroll']['mobile'] ) ) {
$local_data['data-slidescroll-mobile'] = $t1CarouselOpt['slidescroll']['mobile'];
}
return $local_data;
}
/**
* Adding carousel class
*
* @param {array} output
* @param {object} props
* @return {array}
*/
public function add_carousel_class( $output, $attributes ) {
if ( ! isset( $attributes['t1CarouselOpt'] ) || ! $attributes['t1CarouselOpt']['enable'] ) {
return $output;
}
return gutentor_concat_space( $output, 'gutentor-carousel-item' );
}
/**
* Adding carousel class
*
* @param {array} output
* @param {object} props
* @return {array}
*/
public function add_carousel_arrow( $output, $attributes ) {
$gutentorBlockName = ( isset( $attributes['gName'] ) ) ? $attributes['gName'] : '';
$block_list = array( 'gutentor/t1' );
if ( ! in_array( $gutentorBlockName, $block_list ) ) {
return $output;
}
if ( ! isset( $attributes['t1CarouselOpt'] ) || ! $attributes['t1CarouselOpt']['enable'] ) {
return $output;
}
$t1CarouselOpt = ( isset( $attributes['t1CarouselOpt'] ) && $attributes['t1CarouselOpt']['enable'] ) ? $attributes['t1CarouselOpt'] : false;
$desktop_row_position = ( $t1CarouselOpt && $t1CarouselOpt['arrowsPosition']['desktop'] ) ? $t1CarouselOpt['arrowsPosition']['desktop'] . '-desktop' : false;
if ( $desktop_row_position !== 'gutentor-slick-a-default-desktop' ) {
$output .= '<div class="gutentor-slick-arrows"></div>';
}
return $output;
}
}
}
/**
* Return instance of Gutentor_T3_Hooks class
*
* @since 1.0.0
*/
if ( ! function_exists( 'gutentor_t3_hooks' ) ) {
function gutentor_t3_hooks() {
return Gutentor_T3_Hooks::get_instance();
}
}
gutentor_t3_hooks()->run();

View File

@@ -0,0 +1,501 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Blog_Post' ) ) {
/**
* Functions related to Blog Post
*
* @package Gutentor
* @since 1.0.1
*/
class Gutentor_Blog_Post extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 1.0.1
* @var string
*/
protected $block_name = 'blog-post';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 1.0.1
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Load Dependencies
* Used for blog template loading
*
* @since 1.0.1
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function load_dependencies() {
require_once GUTENTOR_PATH . 'includes/block-templates/widgets/class-widget-blog-post-templates.php';
}
/**
* Returns attributes for this Block
*
* @static
* @access public
* @since 1.0.1
* @return array
*/
protected function get_attrs() {
$blog_post_attr = array(
'blockID' => array(
'type' => 'string',
'default' => '',
),
'timestamp' => array(
'type' => 'number',
'default' => 0,
),
'gutentorBlockName' => array(
'type' => 'string',
),
/*blog specific*/
'blockBlogTemplate' => array(
'type' => 'string',
'default' => 'blog-template1',
),
'blockBlogStyle' => array(
'type' => 'string',
'default' => 'blog-grid',
),
'postsToShow' => array(
'type' => 'number',
'default' => 6,
),
'entryMetaFontSize' => array(
'type' => 'number',
'default' => 14,
),
'order' => array(
'type' => 'string',
'default' => 'desc',
),
'orderBy' => array(
'type' => 'string',
'default' => 'date',
),
'categories' => array(
'type' => 'string',
'default' => '',
),
'gutentorBlogPostImageLink' => array(
'type' => 'boolean',
'default' => false,
),
'gutentorBlogPostImageLinkNewTab' => array(
'type' => 'boolean',
'default' => false,
),
'enablePostImage' => array(
'type' => 'boolean',
'default' => true,
),
'enablePostTitle' => array(
'type' => 'boolean',
'default' => true,
),
'enablePostAuthor' => array(
'type' => 'boolean',
'default' => true,
),
'enablePostDate' => array(
'type' => 'boolean',
'default' => true,
),
'enablePostCategory' => array(
'type' => 'boolean',
'default' => true,
),
'enablePostExcerpt' => array(
'type' => 'boolean',
'default' => true,
),
'excerptLength' => array(
'type' => 'number',
'default' => 100,
),
'enableButton' => array(
'type' => 'boolean',
'default' => true,
),
'buttonIcon' => array(
'type' => 'object',
'default' => array(
'label' => 'fa-book',
'value' => 'fas fa-book',
'code' => 'f108',
),
),
'buttonText' => array(
'type' => 'string',
'default' => __( 'Read More', 'gutentor' ),
),
'imageDisplayOptions' => array(
'type' => 'string',
'default' => 'normal-image',
),
'bgImageOptions' => array(
'type' => 'object',
'default' => array(
'backgroundImage' => '',
'height' => array(
'desktop' => 50,
'tablet' => 50,
'mobile' => 50,
),
'backgroundSize' => '',
'backgroundPosition' => '',
'backgroundRepeat' => '',
'backgroundAttachment' => '',
),
),
'imageBorder' => array(
'type' => 'object',
'default' => array(
'borderStyle' => 'none',
'borderTop' => '',
'borderRight' => '',
'borderBottom' => '',
'borderLeft' => '',
'borderColor' => '',
'borderRadiusType' => 'px',
'borderRadiusTop' => '',
'borderRadiusRight' => '',
'borderRadiusBottom' => '',
'borderRadiusLeft' => '',
),
),
'imageOverlayColor' => array(
'type' => 'object',
'default' => array(
'enable' => false,
'normal' => '',
'hover' => '',
),
),
'entryMetaColor' => array(
'type' => 'object',
'default' => array(
'enable' => false,
'normal' => '',
'hover' => '',
),
),
'blockEntryMetaTypography' => array(
'type' => 'object',
'default' => array(
'fontType' => '',
'systemFont' => '',
'googleFont' => '',
'customFont' => '',
'fontSize' => array(
'desktop' => '',
'tablet' => '',
'mobile' => '',
),
'fontWeight' => '',
'textTransform' => '',
'fontStyle' => '',
'textDecoration' => '',
'lineHeight' => array(
'desktop' => '',
'tablet' => '',
'mobile' => '',
),
'letterSpacing' => array(
'desktop' => '',
'tablet' => '',
'mobile' => '',
),
),
),
'blockEntryMetaMargin' => array(
'type' => 'object',
'default' => array(
'type' => 'px',
'desktopTop' => '',
'desktopRight' => '',
'desktopBottom' => '',
'desktopLeft' => '',
'tabletTop' => '',
'tabletRight' => '',
'tabletBottom' => '',
'tabletLeft' => '',
'mobileTop' => '',
'mobileRight' => '',
'mobileBottom' => '',
'mobileLeft' => '',
),
),
'blockEntryMetaPadding' => array(
'type' => 'object',
'default' => array(
'type' => 'px',
'desktopTop' => '',
'desktopRight' => '',
'desktopBottom' => '',
'desktopLeft' => '',
'tabletTop' => '',
'tabletRight' => '',
'tabletBottom' => '',
'tabletLeft' => '',
'mobileTop' => '',
'mobileRight' => '',
'mobileBottom' => '',
'mobileLeft' => '',
),
),
'mBGImageSrc' => array(
'type' => 'string',
'default' => 'self-hosted-local',
),
'mBGVideoSrc' => array(
'type' => 'string',
'default' => 'self-hosted-local',
),
'mBGVideoUrl' => array(
'type' => 'string',
'default' => 'https://www.youtube.com/watch?v=bGMi7L78hVk',
),
);
return array_merge_recursive( $blog_post_attr, $this->get_single_item_common_attrs() );
}
/**
* Blog Post Attributes Default Values
*
* @since 1.0.1
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function get_default_values() {
$blog_attr = array(
'blockID' => '',
'gutentorBlockName' => '',
'timestamp' => 0,
'blockBlogStyle' => 'blog-grid',
'blockBlogTemplate' => 'blog-template1',
'postsToShow' => 6,
'entryMetaFontSize' => 14,
'order' => 'desc',
'orderBy' => 'date',
'categories' => '',
'enablePostImage' => true,
'enablePostTitle' => true,
'enablePostAuthor' => true,
'enablePostDate' => true,
'enablePostCategory' => true,
'enablePostExcerpt' => true,
'excerptLength' => 100,
'enableButton' => true,
'gutentorBlogPostImageLink' => false,
'gutentorBlogPostImageLinkNewTab' => false,
'buttonIcon' => array(
'label' => 'fa-book',
'value' => 'fas fa-book',
'code' => 'f108',
),
'buttonText' => __( 'Read More', 'gutentor' ),
'imageDisplayOptions' => 'normal-image',
'bgImageOptions' => array(
'backgroundImage' => '',
'height' => array(
'desktop' => 50,
'tablet' => 50,
'mobile' => 50,
),
'backgroundSize' => '',
'backgroundPosition' => '',
'backgroundRepeat' => '',
'backgroundAttachment' => '',
),
'imageBorder' => array(
'borderStyle' => 'none',
'borderTop' => '',
'borderRight' => '',
'borderBottom' => '',
'borderLeft' => '',
'borderColor' => '',
'borderRadiusType' => 'px',
'borderRadiusTop' => '',
'borderRadiusRight' => '',
'borderRadiusBottom' => '',
'borderRadiusLeft' => '',
),
'imageOverlayColor' => array(
'enable' => false,
'normal' => '',
'hover' => '',
),
'entryMetaColor' => array(
'enable' => false,
'normal' => '',
'hover' => '',
),
'blockEntryMetaTypography' => array(
'fontType' => '',
'systemFont' => '',
'googleFont' => '',
'customFont' => '',
'fontSize' => array(
'desktop' => '',
'tablet' => '',
'mobile' => '',
),
'fontWeight' => '',
'textTransform' => '',
'fontStyle' => '',
'textDecoration' => '',
'lineHeight' => array(
'desktop' => '',
'tablet' => '',
'mobile' => '',
),
'letterSpacing' => array(
'desktop' => '',
'tablet' => '',
'mobile' => '',
),
),
'blockEntryMetaMargin' => array(
'type' => 'px',
'desktopTop' => '',
'desktopRight' => '',
'desktopBottom' => '',
'desktopLeft' => '',
'tabletTop' => '',
'tabletRight' => '',
'tabletBottom' => '',
'tabletLeft' => '',
'mobileTop' => '',
'mobileRight' => '',
'mobileBottom' => '',
'mobileLeft' => '',
),
'blockEntryMetaPadding' => array(
'type' => 'px',
'desktopTop' => '',
'desktopRight' => '',
'desktopBottom' => '',
'desktopLeft' => '',
'tabletTop' => '',
'tabletRight' => '',
'tabletBottom' => '',
'tabletLeft' => '',
'mobileTop' => '',
'mobileRight' => '',
'mobileBottom' => '',
'mobileLeft' => '',
),
);
$blog_attr = apply_filters( 'gutentor_blog_post_get_default_values', $blog_attr );
return $blog_attr;
}
/**
* Render Blog Post Data
*
* @since 1.0.1
* @access public
*
* @param array $attributes
* @param string $content
* @return string
*/
public function render_callback( $attributes, $content ) {
$blockID = isset( $attributes['blockID'] ) ? $attributes['blockID'] : '';
$output = '';
$default_class = gutentor_block_add_default_classes( 'gutentor-blog-post', $attributes );
// the query
$args = array(
'posts_per_page' => $attributes['postsToShow'],
'orderby' => $attributes['orderBy'],
'order' => $attributes['order'],
'cat' => $attributes['categories'],
'ignore_sticky_posts' => 1,
);
$tag = $attributes['blockSectionHtmlTag'] ? $attributes['blockSectionHtmlTag'] : 'section';
$template = $attributes['blockBlogTemplate'] ? $attributes['blockBlogTemplate'] : '';
$align = isset( $attributes['align'] ) ? 'align' . $attributes['align'] : '';
$blockComponentAnimation = isset( $attributes['blockComponentAnimation'] ) ? $attributes['blockComponentAnimation'] : '';
$blockItemsWrapAnimation = isset( $attributes['blockItemsWrapAnimation'] ) ? $attributes['blockItemsWrapAnimation'] : '';
$the_query = new WP_Query( gutentor_get_query( $args ) );
if ( $the_query->have_posts() ) :
$tag = gutentor_get_module_tag( $tag );
$output .= '<' . esc_attr( $tag ) . ' class="' . esc_attr( apply_filters( 'gutentor_save_section_class', 'gutentor-section gutentor-blog-post-wrapper ' . gutentor_concat_space( $template, $align, $default_class ) . '', $attributes ) ) . '" id="section-' . esc_attr( $blockID ) . '" ' . GutentorAnimationOptionsDataAttr( $blockComponentAnimation ) . '>' . "\n";
$output .= apply_filters( 'gutentor_save_before_container', '', $attributes );
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_save_container_class', 'grid-container', $attributes ) ) . "'>";
$output .= apply_filters( 'gutentor_save_before_block_items', '', $attributes );
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_save_grid_item_wrap_class', 'gutentor-grid-item-wrap', $attributes ) ) . " ' " . apply_filters( 'gutentor_save_grid_item_wrap_attr', '', $attributes ) . ' ' . GutentorAnimationOptionsDataAttr( $blockItemsWrapAnimation ) . '>';
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_save_grid_row_class', 'grid-row', $attributes ) ) . " ' " . apply_filters( 'gutentor_save_grid_row_attr', '', $attributes ) . '>';
while ( $the_query->have_posts() ) :
$the_query->the_post();
$thumb_class = has_post_thumbnail() ? 'gutentor-post-has-thumb' : 'gutentor-post-no-thumb';
$output .= "<article class='" . esc_attr( apply_filters( 'gutentor_save_grid_column_class', $thumb_class, $attributes ) ) . "'>";
$output .= '<div class="gutentor-single-item">';
$output .= apply_filters( 'gutentor_save_blog_post_block_template_data', '', get_post(), $attributes );
$output .= '</div>';/*.gutentor-single-item*/
$output .= '</article>';/*.article*/
endwhile;
$output .= '</div>';/*.grid-row*/
$output .= '</div>';/*.grid-row-item-wrap*/
$output .= apply_filters( 'gutentor_save_after_block_items', '', $attributes );
$output .= '</div>';/*.grid-container*/
$output .= apply_filters( 'gutentor_save_after_container', '', $attributes );
$output .= '</' . esc_attr( $tag ) . '>';/*.gutentor-blog-post-wrapper*/
endif;
// Restore original Post Data.
wp_reset_postdata();
return $output;
}
}
}
Gutentor_Blog_Post::get_instance()->run();

View File

@@ -0,0 +1,77 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Counter_Box' ) ) {
/**
* Functions related to Google Map
*
* @package Gutentor
* @since 1.0.1
*/
class Gutentor_Counter_Box extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 1.0.1
* @var string
*/
protected $block_name = 'counter-box';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 1.0.1
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 1.0.1
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'countUp' ),
);
}
/**
* Just return content.
* It is for view_script_handles
*
* @param array $attributes Attributes array.
* @param string $content Content is always string.
* @return string
* @since 1.0.1
* @access public
*/
public function render_callback( $attributes, $content ) {
return $content;
}
}
}
Gutentor_Counter_Box::get_instance()->run();

View File

@@ -0,0 +1,78 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Gallery' ) ) {
/**
* Functions related to Progress bar
*
* @package Gutentor
* @since 3.0.6
*/
class Gutentor_Gallery extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 3.0.6
* @var string
*/
protected $block_name = 'gallery';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 3.0.6
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.0.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'magnific-popup', 'masonry' ),
'style_handles' => array( 'magnific-popup' ),
);
}
/**
* Just return content.
* It is for view_script_handles
*
* @param array $attributes Attributes array.
* @param string $content Content is always string.
* @return string
* @since 3.0.6
* @access public
*/
public function render_callback( $attributes, $content ) {
return $content;
}
}
}
Gutentor_Gallery::get_instance()->run();

View File

@@ -0,0 +1,247 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Google_Map' ) ) {
/**
* Functions related to Google Map
*
* @package Gutentor
* @since 1.0.1
*/
class Gutentor_Google_Map extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 1.0.1
* @var string
*/
protected $block_name = 'google-map';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 1.0.1
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.2.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'gutentor-google-maps', 'google-maps' ),
);
}
/**
* Google Map Attributes Default Value
*
* @since 1.0.0
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function get_default_values() {
$google_map_attr = array(
'id' => '',
'location' => 'La Sagrada Familia, Barcelona, Spain',
'containerWidth' => 'grid-container',
'latitude' => '41.4036299',
'longitude' => '2.1743558000000576',
'type' => 'roadmap',
'zoom' => 15,
'mapHeight' => array(
'type' => 'px',
'desktop' => '250',
'tablet' => '250',
'mobile' => '150',
),
'draggable' => true,
'mapTypeControl' => true,
'zoomControl' => true,
'fullscreenControl' => true,
'streetViewControl' => true,
'markers' => array(),
);
$google_map_attr = apply_filters( 'gutentor_google_map_get_default_values', $google_map_attr );
return $google_map_attr;
}
/**
* Returns attributes for this Block
*
* @static
* @access public
* @since 1.0.0
* @return array
*/
protected function get_attrs() {
$google_map_attr = array(
'id' => array(
'type' => 'string',
),
'blockID' => array(
'type' => 'string',
),
'gutentorBlockName' => array(
'type' => 'string',
),
'containerWidth' => array(
'type' => 'string',
'default' => 'grid-container',
),
'location' => array(
'type' => 'string',
'default' => 'La Sagrada Familia, Barcelona, Spain',
),
'latitude' => array(
'type' => 'string',
'default' => '41.4036299',
),
'longitude' => array(
'type' => 'string',
'default' => '2.1743558000000576',
),
'type' => array(
'type' => 'string',
'default' => 'roadmap',
),
'zoom' => array(
'type' => 'number',
'default' => 15,
),
'mapHeight' => array(
'type' => 'object',
'default' => array(
'type' => 'px',
'desktop' => '250',
'tablet' => '250',
'mobile' => '150',
),
),
'draggable' => array(
'type' => 'boolean',
'default' => true,
),
'mapTypeControl' => array(
'type' => 'boolean',
'default' => true,
),
'zoomControl' => array(
'type' => 'boolean',
'default' => true,
),
'fullscreenControl' => array(
'type' => 'boolean',
'default' => true,
),
'streetViewControl' => array(
'type' => 'boolean',
'default' => true,
),
'markers' => array(
'type' => 'object',
'default' => array(),
),
'mBGImageSrc' => array(
'type' => 'string',
'default' => 'self-hosted-local',
),
'mBGVideoSrc' => array(
'type' => 'string',
'default' => 'self-hosted-local',
),
'mBGVideoUrl' => array(
'type' => 'string',
'default' => 'https://www.youtube.com/watch?v=bGMi7L78hVk',
),
);
return $google_map_attr;
}
/**
* Render Google Map Data
*
* @since 1.0.1
* @access public
*
* @param array $attributes
* @param string $content
* @return string
*/
public function render_callback( $attributes, $content ) {
$id = isset( $attributes['id'] ) ? $attributes['id'] : 'gutentor-google-map-' . wp_rand( 10, 100 );
$blockID = isset( $attributes['blockID'] ) ? $attributes['blockID'] : '';
$default_class = gutentor_block_add_default_classes( 'gutentor-google-map', $attributes );
$align = isset( $attributes['align'] ) ? 'align' . $attributes['align'] : '';
$tag = $attributes['blockSectionHtmlTag'] ? $attributes['blockSectionHtmlTag'] : 'section';
$blockComponentAnimation = isset( $attributes['blockComponentAnimation'] ) ? $attributes['blockComponentAnimation'] : '';
$blockItemsWrapAnimation = isset( $attributes['blockItemsWrapAnimation'] ) ? $attributes['blockItemsWrapAnimation'] : '';
$tag = gutentor_get_module_tag( $tag );
$local_attr = array();
$local_attr['id'] = $id;
$local_attr['location'] = $attributes['location'];
$local_attr['latitude'] = $attributes['latitude'];
$local_attr['longitude'] = $attributes['longitude'];
$local_attr['zoom'] = $attributes['zoom'];
$local_attr['type'] = $attributes['type'];
$local_attr['draggable'] = $attributes['draggable'];
$local_attr['mapTypeControl'] = $attributes['mapTypeControl'];
$local_attr['zoomControl'] = $attributes['zoomControl'];
$local_attr['fullscreenControl'] = $attributes['fullscreenControl'];
$local_attr['streetViewControl'] = $attributes['streetViewControl'];
$local_attr['markers'] = $attributes['markers'];
$output = '<' . esc_attr( $tag ) . ' class="' . esc_attr( apply_filters( 'gutentor_save_section_class', gutentor_concat_space( 'gutentor-section gutentor-google-map', $align, $default_class ), $attributes ) ) . '" id="section-' . esc_attr( $blockID ) . '" ' . GutentorAnimationOptionsDataAttr( $blockComponentAnimation ) . '>' . "\n";
$output .= apply_filters( 'gutentor_save_before_container', '', $attributes );
$output .= "<div class='" . esc_attr( apply_filters( 'gutentor_save_container_class', 'grid-container', $attributes ) ) . "'>";
$output .= apply_filters( 'gutentor_save_before_block_items', '', $attributes );
$output .= '<div class="' . esc_attr( apply_filters( 'gutentor_save_grid_row_class', esc_attr( 'gutentor-grid-item-wrap' ), $attributes ) ) . '" id="' . esc_attr( $id ) . '" ' . GutentorAnimationOptionsDataAttr( $blockItemsWrapAnimation ) . '></div>' . "\n";
$output .= apply_filters( 'gutentor_save_after_block_items', '', $attributes );
$output .= '</div>' . "\n";
$output .= apply_filters( 'gutentor_save_after_container', '', $attributes );
$output .= '</' . esc_attr( $tag ) . '>' . "\n";
$output .= '<script type="text/javascript">' . "\n";
$output .= ' /* <![CDATA[ */' . "\n";
$output .= ' if ( ! window.gutentorGoogleMaps ) window.gutentorGoogleMaps =[];' . "\n";
$output .= ' window.gutentorGoogleMaps.push( { container: "' . esc_attr( $id ) . '", attributes: ' . wp_json_encode( $local_attr ) . ' } );' . "\n";
$output .= ' /* ]]> */' . "\n";
$output .= '</script>' . "\n";
return $output;
}
}
}
Gutentor_Google_Map::get_instance()->run();

View File

@@ -0,0 +1,78 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Image_Slider' ) ) {
/**
* Functions related to Progress bar
*
* @package Gutentor
* @since 3.0.6
*/
class Gutentor_Image_Slider extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 3.0.6
* @var string
*/
protected $block_name = 'image-slider';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 3.0.6
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.0.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'slick' ),
'style_handles' => array( 'slick' ),
);
}
/**
* Just return content.
* It is for view_script_handles
*
* @param array $attributes Attributes array.
* @param string $content Content is always string.
* @return string
* @since 3.0.6
* @access public
*/
public function render_callback( $attributes, $content ) {
return $content;
}
}
}
Gutentor_Image_Slider::get_instance()->run();

View File

@@ -0,0 +1,77 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Progress_Bar' ) ) {
/**
* Functions related to Progress bar
*
* @package Gutentor
* @since 3.0.6
*/
class Gutentor_Progress_Bar extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 3.0.6
* @var string
*/
protected $block_name = 'progress-bar';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 3.0.6
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.0.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'jquery-easypiechart' ),
);
}
/**
* Just return content.
* It is for view_script_handles
*
* @param array $attributes Attributes array.
* @param string $content Content is always string.
* @return string
* @since 3.0.6
* @access public
*/
public function render_callback( $attributes, $content ) {
return $content;
}
}
}
Gutentor_Progress_Bar::get_instance()->run();

View File

@@ -0,0 +1,78 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Video_Popup' ) ) {
/**
* Functions related to Progress bar
*
* @package Gutentor
* @since 3.0.6
*/
class Gutentor_Video_Popup extends Gutentor_Block_Base {
/**
* Name of the block.
*
* @access protected
* @since 3.0.6
* @var string
*/
protected $block_name = 'video-popup';
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 3.0.6
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Set register_block_type_args variable on parent
* Used for blog template loading
*
* @since 3.0.6
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
public function register_block_type_args() {
$this->register_block_type_args = array(
'view_script_handles' => array( 'magnific-popup' ),
'style_handles' => array( 'magnific-popup' ),
);
}
/**
* Just return content.
* It is for view_script_handles
*
* @param array $attributes Attributes array.
* @param string $content Content is always string.
* @return string
* @since 3.0.6
* @access public
*/
public function render_callback( $attributes, $content ) {
return $content;
}
}
}
Gutentor_Video_Popup::get_instance()->run();

View File

@@ -0,0 +1,90 @@
<?php
/**
* Gutentor Cron
*
* @package Gutentor
* @subpackage Classes/Cron
* @since 3.2.1
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Gutentor_Cron Class
*
* This class handles scheduled events
*
* @since 3.2.1
*/
class Gutentor_Cron {
/**
* Init WordPress hook
*
* @since 3.2.1
* @see Gutentor_Cron::weekly_events()
*/
public function __construct() {
add_filter( 'cron_schedules', array( $this, 'add_schedules' ) );
add_action( 'wp', array( $this, 'schedule_events' ) );
}
/**
* Registers new cron schedules
*
* @since 3.2.1
*
* @param array $schedules
* @return array
*/
public function add_schedules( $schedules = array() ) {
/*Adds once weekly to the existing schedules*/
$schedules['weekly'] = array(
'interval' => 604800,
'display' => __( 'Once Weekly', 'gutentor' ),
);
return $schedules;
}
/**
* Schedules our events
*
* @since 3.2.1
* @return void
*/
public function schedule_events() {
$this->weekly_events();
$this->daily_events();
}
/**
* Schedule weekly events
*
* @access private
* @since 3.2.1
* @return void
*/
private function weekly_events() {
if ( ! wp_next_scheduled( 'gutentor_weekly_scheduled_events' ) ) {
wp_schedule_event( time(), 'weekly', 'gutentor_weekly_scheduled_events' );
}
}
/**
* Schedule daily events
*
* @access private
* @since 3.2.1
* @return void
*/
private function daily_events() {
if ( ! wp_next_scheduled( 'gutentor_daily_scheduled_events' ) ) {
wp_schedule_event( time(), 'daily', 'gutentor_daily_scheduled_events' );
}
}
}
$gutentor_cron = new Gutentor_Cron();

View File

@@ -0,0 +1,42 @@
<?php
/**
* Fired during plugin deactivation
*
* @link https://www.gutentor.com/
* @since 1.0.0
*
* @package Gutentor
*/
/**
* Fired during plugin deactivation.
*
* This class defines all code necessary to run during the plugin's deactivation.
*
* @since 1.0.0
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
class Gutentor_Deactivator {
/**
* Short Description. (use period)
*
* Long Description.
*
* @since 1.0.0
*/
public static function deactivate() {
update_option( '__gutentor_do_redirect', false );
global $current_user;
$user_id = $current_user->ID;
$ignored_notice_partially = get_user_meta( $user_id, 'gutentor_templateberg_notice_calendar', true );
// Delete partial notice remove data.
if ( $ignored_notice_partially ) {
delete_user_meta( $user_id, 'gutentor_templateberg_notice_calendar' );
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,312 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! function_exists( 'gutentor_sanitize_color' ) ) :
/**
* Color sanitization callback
* https://wordpress.stackexchange.com/questions/257581/escape-hexadecimals-rgba-values
*
* @since 1.0.0
*/
function gutentor_sanitize_color( $color ) {
if ( empty( $color ) || is_array( $color ) ) {
return '';
}
// If string does not start with 'rgba', then treat as hex.
// sanitize the hex color and finally convert hex to rgba
if ( false === strpos( $color, 'rgba' ) ) {
return sanitize_hex_color( $color );
}
// By now we know the string is formatted as an rgba color so we need to further sanitize it.
$color = str_replace( ' ', '', $color );
sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha );
return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')';
}
endif;
if ( ! function_exists( 'gutentor_sanitize_field_background' ) ) :
/**
* Sanitize Field Background
*
* @since Gutentor 1.0.0
*
* @param $input
* @return array
*/
function gutentor_sanitize_field_background( $input, $gutentor_setting ) {
$input_decoded = json_decode( $input, true );
$output = array();
if ( ! empty( $input_decoded ) ) {
foreach ( $input_decoded as $key => $value ) {
switch ( $key ) :
case 'background-size':
case 'background-position':
case 'background-repeat':
case 'background-attachment':
$output[ $key ] = sanitize_key( $value );
break;
case 'background-image':
$output[ $key ] = esc_url_raw( $value );
break;
case 'background-color':
case 'background-hover-color':
case 'background-color-title':
case 'title-font-color':
case 'background-color-post':
case 'site-title-color':
case 'site-tagline-color':
case 'post-font-color':
case 'text-color':
case 'text-hover-color':
case 'title-color':
case 'link-color':
case 'link-hover-color':
case 'on-sale-bg':
case 'on-sale-color':
case 'out-of-stock-bg':
case 'out-of-stock-color':
case 'rating-color':
case 'grid-list-color':
case 'grid-list-hover-color':
case 'categories-color':
case 'categories-hover-color':
case 'deleted-price-color':
case 'deleted-price-hover-color':
case 'price-color':
case 'price-hover-color':
case 'content-color':
case 'content-hover-color':
case 'tab-list-color':
case 'tab-content-color':
case 'tab-list-border-color':
case 'tab-content-border-color':
case 'background-stripped-color':
case 'button-color':
case 'button-hover-color':
case 'icon-color':
case 'icon-hover-color':
case 'meta-color':
case 'next-prev-color':
case 'next-prev-hover-color':
case 'button-bg-color':
case 'button-bg-hover-color':
$output[ $key ] = gutentor_sanitize_color( $value );
break;
default:
$output[ $key ] = sanitize_text_field( $value );
break;
endswitch;
}
return wp_json_encode( $output );
}
return $input;
}
endif;
if ( ! function_exists( 'gutentor_sanitize_checkbox' ) ) :
/*
* Boolean check.
* @since 2.1.0
*/
function gutentor_sanitize_checkbox( $checked ) {
return ( ( isset( $checked ) && true == $checked ) ? true : false );
}
endif;
if ( ! function_exists( 'gutentor_sanitize_array' ) ) :
/*
* Array check.
* @since 2.1.0
*/
function gutentor_sanitize_array( $checked ) {
return is_array( $checked ) ? $checked : array();
}
endif;
/* Validation */
if ( ! function_exists( 'gutentor_get_allowed_text_tags' ) ) :
/**
* Get valid text tags
*
* @see src\global-components\i18n\options.js
*
* @since 3.3.6
* @access public
*
* @return array valid text tags.
*/
function gutentor_get_allowed_text_tags() {
return apply_filters( 'gutentor_get_allowed_text_tags', array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'div', 'span' ) );
}
endif;
if ( ! function_exists( 'gutentor_get_title_tag' ) ) :
/**
* Get valid title tag
*
* @since 3.3.6
* @access public
*
* @param string $title_tag Title tag.
* @return string valid title tag.
*/
function gutentor_get_title_tag( $title_tag ) {
$allowed_tags = gutentor_get_allowed_text_tags();
if ( in_array( $title_tag, $allowed_tags, true ) ) {
return $title_tag;
} else {
return 'h3';
}
}
endif;
if ( ! function_exists( 'gutentor_get_allowed_module_tags' ) ) :
/**
* Get valid module tags
*
* @see src\global-components\i18n\options.js
*
* @since 3.3.6
* @access public
*
* @return array valid module tags.
*/
function gutentor_get_allowed_module_tags() {
return apply_filters( 'gutentor_get_allowed_module_tags', array( 'section', 'div', 'header', 'footer', 'main', 'article', 'aside' ) );
}
endif;
if ( ! function_exists( 'gutentor_get_module_tag' ) ) :
/**
* Get valid module tag
*
* @since 3.3.6
* @access public
*
* @param string $tag Module tag.
* @return string valid module tag.
*/
function gutentor_get_module_tag( $tag ) {
$allowed_tags = gutentor_get_allowed_module_tags();
if ( in_array( $tag, $allowed_tags, true ) ) {
return $tag;
} else {
return 'div';
}
}
endif;
if ( ! function_exists( 'gutentor_esc_svg' ) ) :
/**
* Escape for SVG HTML
*
* @since 3.4.4
* @param string $svg_html HTML.
* @return string escaped HTML
* @author codersantosh <codersantosh@gmail.com>
*/
function gutentor_esc_svg( $svg_html ) {
$allowed_html = array(
'svg' => array(
'xmlns' => array(),
'fill' => array(),
'viewbox' => array(),
'role' => array(),
'aria-hidden' => array(),
'focusable' => array(),
'height' => array(),
'width' => array(),
'xmlns:xlink' => array(),
'id' => array(),
'class' => array(),
'style' => array(),
'transform' => array(),
'opacity' => array(),
'preserveaspectratio' => array(),
),
'path' => array(
'd' => array(),
'fill' => array(),
'stroke' => array(),
'stroke-width' => array(),
'stroke-linecap' => array(),
'stroke-linejoin' => array(),
'id' => array(),
'class' => array(),
'style' => array(),
'transform' => array(),
'opacity' => array(),
),
'lineargradient' => array(
'gradientunits' => array(),
'gradienttransform' => array(),
'spreadmethod' => array(),
'x1' => array(),
'y1' => array(),
'x2' => array(),
'y2' => array(),
'id' => array(),
'class' => array(),
'style' => array(),
'transform' => array(),
'opacity' => array(),
),
'stop' => array(
'offset' => array(),
'stop-color' => array(),
'stop-opacity' => array(),
'id' => array(),
'class' => array(),
'style' => array(),
'transform' => array(),
'opacity' => array(),
),
'g' => array(
'id' => array(),
'class' => array(),
'style' => array(),
'transform' => array(),
'opacity' => array(),
),
'text' => array(
'x' => array(),
'y' => array(),
'dy' => array(),
'text-anchor' => array(),
'font-family' => array(),
'font-size' => array(),
'font-weight' => array(),
'fill' => array(),
'id' => array(),
'class' => array(),
'style' => array(),
'transform' => array(),
'opacity' => array(),
),
'tspan' => array(
'id' => array(),
'class' => array(),
'style' => array(),
'transform' => array(),
'opacity' => array(),
),
);
return wp_kses( $svg_html, $allowed_html );
}
endif;

View File

@@ -0,0 +1,969 @@
<?php
/**
* The Gutentor theme hooks callback functionality of the plugin.
*
* @link https://www.gutentor.com/
* @since 1.0.0
*
* @package Gutentor
*/
/**
* The Gutentor theme hooks callback functionality of the plugin.
*
* Since Gutentor theme is hooks base theme, this file is main callback to add/remove/edit the functionality of the Gutentor Plugin
*
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
class Gutentor_Hooks {
/**
* The ID of this plugin.
*
* @since 1.0.0
* @access private
* @var string $plugin_name The ID of this plugin.
*/
private $plugin_name;
/**
* The version of this plugin.
*
* @since 1.0.0
* @access private
* @var string $version The current version of this plugin.
*/
private $version;
/**
* Library loaded
* Check it Library Loaded
*
* @since 2.1.2
* @access public
* @var string $library_loaded
*/
public $library_loaded = false;
/**
* Initialize the class and set its properties.
*
* @since 1.0.0
*/
public function __construct() {}
/**
* Main Gutentor_Hooks Instance
* Initialize the class and set its properties.
*
* @since 1.0.0
* @return object $instance Gutentor_Hooks Instance
*/
public static function instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new Gutentor_Hooks();
$instance->plugin_name = GUTENTOR_PLUGIN_NAME;
$instance->version = GUTENTOR_VERSION;
}
// Always return the instance.
return $instance;
}
/**
* Get Thumbnail all sizes.
*
* @since 2.0.0
*/
public static function get_thumbnail_all_sizes() {
$sizes = get_intermediate_image_sizes();
$image_sizes = array();
$image_sizes[] = array(
'value' => 'full',
'label' => esc_html__( 'Full', 'gutentor' ),
);
foreach ( $sizes as $size ) {
if ( in_array( $size, array( 'thumbnail', 'medium', 'medium_large', 'large' ), true ) ) {
$image_sizes[] = array(
'value' => $size,
'label' => ucwords( trim( str_replace( array( '-', '_' ), array( ' ', ' ' ), $size ) ) ),
);
}
}
return $image_sizes;
}
/**
* Get Thumbnail all sizes.
*
* @since 2.0.0
*/
public static function get_updated_thumbnail_all_sizes() {
$sizes = get_intermediate_image_sizes();
$image_sizes = array();
$image_sizes[] = array(
'value' => 'full',
'label' => esc_html__( 'Full', 'gutentor' ),
);
foreach ( $sizes as $size ) {
$image_sizes[] = array(
'value' => $size,
'label' => ucwords( trim( str_replace( array( '-', '_' ), array( ' ', ' ' ), $size ) ) ),
);
}
return $image_sizes;
}
/**
* Callback functions for block_categories,
* Adding Block Categories
*
* @since 1.0.0
* @access public
*
* @param array $categories
* @return array
*/
public function add_block_categories( $categories ) {
return array_merge(
array(
array(
'slug' => 'gutentor-elements',
'title' => __( 'Gutentor Elements', 'gutentor' ),
),
array(
'slug' => 'gutentor-modules',
'title' => __( 'Gutentor Modules', 'gutentor' ),
),
array(
'slug' => 'gutentor-posts',
'title' => __( 'Gutentor Posts', 'gutentor' ),
),
array(
'slug' => 'gutentor-terms',
'title' => __( 'Gutentor Terms', 'gutentor' ),
),
array(
'slug' => 'gutentor',
'title' => __( 'Gutentor Widgets', 'gutentor' ),
),
),
$categories
);
}
/**
* Callback functions for after_setup_theme,
* Add Gutentor global color palatte
*
* @since 3.0.0
* @access public
*
* @param null
* @return void
*/
public function add_color_palette() {
$global_colors = gutentor_get_options( 'color-palettes' );
if ( ! empty( $global_colors ) ) {
// Get the current set of colors.
$colors = get_theme_support( 'editor-color-palette' );
if ( isset( $colors[0] ) ) {
$colors = $colors[0];
}
// If no colors, create defaults.
if ( empty( $colors ) ) {
$colors = array(
array(
'name' => __( 'Black', 'gutentor' ),
'slug' => 'black',
'color' => '#000000',
),
array(
'name' => __( 'Dark Gray', 'gutentor' ),
'slug' => 'dark-gray',
'color' => '#A9A9A9',
),
array(
'name' => __( 'Silver', 'gutentor' ),
'slug' => 'silver',
'color' => '#C0C0C0',
),
array(
'name' => __( 'White Smoke', 'gutentor' ),
'slug' => 'white-smoke',
'color' => '#F5F5F5',
),
array(
'name' => __( 'White', 'gutentor' ),
'slug' => 'white',
'color' => '#ffffff',
),
array(
'name' => __( 'Pink', 'gutentor' ),
'slug' => 'pink',
'color' => '#FFC0CB',
),
array(
'name' => __( 'LightPink', 'gutentor' ),
'slug' => 'light-pink',
'color' => '#FFB6C1',
),
array(
'name' => __( 'Orchid', 'gutentor' ),
'slug' => 'orchid',
'color' => '#DA70D6',
),
array(
'name' => __( 'Violet', 'gutentor' ),
'slug' => 'violet',
'color' => '#EE82EE',
),
array(
'name' => __( 'Sky Blue', 'gutentor' ),
'slug' => 'sky-blue',
'color' => '#87CEEB',
),
array(
'name' => __( 'Light Cyan', 'gutentor' ),
'slug' => 'light-cyan',
'color' => '#E0FFFF',
),
array(
'name' => __( 'PaleGreen', 'gutentor' ),
'slug' => 'pale-green',
'color' => '#98FB98',
),
array(
'name' => __( 'Blue', 'gutentor' ),
'slug' => 'blue',
'color' => '#0000FF',
),
array(
'name' => __( 'Navy', 'gutentor' ),
'slug' => 'navy',
'color' => '#000080',
),
array(
'name' => __( 'Orange', 'gutentor' ),
'slug' => 'orange',
'color' => '#FFA500',
),
array(
'name' => __( 'Dark Orange ', 'gutentor' ),
'slug' => 'dark-orange ',
'color' => '#FF8C00',
),
array(
'name' => __( 'Tomato ', 'gutentor' ),
'slug' => 'tomato',
'color' => '#FF6347',
),
array(
'name' => __( 'Maroon ', 'gutentor' ),
'slug' => 'maroon',
'color' => '#800000',
),
);
}
if ( empty( $global_colors ) ) {
$global_colors = array();
}
// Append our global colors with the theme/default ones.
if ( is_array( $global_colors ) ) {
$colors = array_merge( $colors, $global_colors );
}
add_theme_support( 'editor-color-palette', $colors );
}
}
/**
* Callback functions for init,
* Register scripts and styles
*
* @since 2.1.2
* @access public
*
* @param null
* @return void
*/
function register_script_style(){ // phpcs:ignore
/*Animate CSS*/
wp_register_style(
'animate',
GUTENTOR_URL . 'assets/library/animatecss/animate.min.css',
array(),
'3.7.2'
);
/*CountUP JS*/
wp_register_script(
'countUp', // Handle.
GUTENTOR_URL . 'assets/library/countUp/countUp.min.js',
array( 'jquery' ), // Dependencies.
'1.9.3', // Version.
true // Enqueue the script in the footer.
);
/*flexMenu*/
wp_register_script(
'flexMenu', // Handle.
GUTENTOR_URL . 'assets/library/flexMenu/flexmenu.min.js',
array( 'jquery' ), // Dependencies
'1.6.2', // Version: File modification time.
true // Enqueue the script in the footer.
);
/*FontAwesome CSS*/
if ( 4 == gutentor_get_options( 'fa-version' ) ) {
wp_register_style(
'fontawesome', // Handle.
GUTENTOR_URL . 'assets/library/font-awesome-4.7.0/css/font-awesome.min.css',
array(),
'4'
);
} else {
wp_register_style(
'fontawesome', // Handle.
GUTENTOR_URL . 'assets/library/fontawesome/css/all.min.css',
array(),
'5.12.0'
);
}
/*Isotope Js*/
wp_register_script(
'isotope', // Handle.
GUTENTOR_URL . 'assets/library/isotope/isotope.pkgd.min.js',
array( 'jquery' ), // Dependencies, defined above.
'3.0.6', // Version: File modification time.
true // Enqueue the script in the footer.
);
/*jquery-easypiechart Js*/
wp_register_script(
'jquery-easypiechart', // Handle.
GUTENTOR_URL . 'assets/library/jquery-easypiechart/jquery.easypiechart.min.js',
array( 'jquery' ), // Dependencies, defined above.
'2.1.7', // Version: File modification time.
true // Enqueue the script in the footer.
);
/*Magnific Popup CSS*/
wp_register_style(
'magnific-popup',
GUTENTOR_URL . 'assets/library/magnific-popup/magnific-popup.min.css',
array(),
'1.8.0'
);
wp_style_add_data( 'magnific-popup', 'rtl', 'replace' );
/*Magnific Popup JS*/
wp_register_script(
'magnific-popup', // Handle.
GUTENTOR_URL . 'assets/library/magnific-popup/jquery.magnific-popup.min.js',
array( 'jquery' ), // Dependencies, defined above.
'1.1.0', // Version: File modification time.
true // Enqueue the script in the footer.
);
/*Slick CSS*/
wp_register_style(
'slick',
GUTENTOR_URL . 'assets/library/slick/slick.min.css',
array(),
'1.8.1'
);
/*Slick JS*/
wp_register_script(
'slick', // Handle.
GUTENTOR_URL . 'assets/library/slick/slick.min.js',
array( 'jquery' ), // Dependencies, defined above.
'1.8.1', // Version: File modification time.
true // Enqueue the script in the footer.
);
/*sticky sidebar*/
wp_register_script(
'theia-sticky-sidebar', // Handle.
GUTENTOR_URL . 'assets/library/theia-sticky-sidebar/theia-sticky-sidebar.min.js',
array( 'jquery' ), // Dependencies
'4.0.1', // Version
true // Enqueue the script in the footer.
);
/*Wow js*/
wp_register_script(
'wow', // Handle.
GUTENTOR_URL . 'assets/library/wow/wow.min.js',
array( 'jquery' ), // Dependencies
'1.2.1', // Version: File modification time.
true // Enqueue the script in the footer.
);
/*AcmeTicker*/
wp_register_script(
'acmeticker', // Handle.
GUTENTOR_URL . 'assets/library/acmeticker/acmeticker.min.js',
array( 'jquery' ), // Dependencies
'1.0.0', // Version
true // Enqueue the script in the footer.
);
/* Wpness Grid Styles*/
wp_register_style(
'wpness-grid',
GUTENTOR_URL . 'assets/library/wpness-grid/wpness-grid' . GUTENTOR_SCRIPT_PREFIX . '.css',
array(),
'1.0.0'
);
/*
Gutentor Specific CSS/JS */
wp_register_style(
'gutentor', // Handle.
GUTENTOR_URL . 'dist/blocks.style.build.css',
array( 'wp-editor' ), // Dependency to include the CSS after it.
GUTENTOR_VERSION // Version: File modification time.
);
/*Gutentor Woo CSS/JS*/
wp_register_style(
'gutentor-woo', // Handle.
GUTENTOR_URL . 'dist/gutentor-woocommerce.css',
array( 'wp-editor' ), // Dependency to include the CSS after it.
GUTENTOR_VERSION // Version: File modification time.
);
/*Gutentor Edd CSS/JS*/
wp_register_style(
'gutentor-edd', // Handle.
GUTENTOR_URL . 'dist/gutentor-edd.css',
array( 'wp-editor' ), // Dependency to include the CSS after it.
GUTENTOR_VERSION // Version: File modification time.
);
/*
Google Map JS
Load Frontend only
Used By:
gutentor/google-map
gutentor/e4
*/
// Get the API key
if ( gutentor_get_options( 'map-api' ) ) {
$apikey = gutentor_get_options( 'map-api' );
} else {
$apikey = false;
}
// Don't output anything if there is no API key.
if ( ! ( null === $apikey || empty( $apikey ) ) ) {
wp_register_script(
'gutentor-google-maps',
GUTENTOR_URL . 'assets/js/google-map-loader' . GUTENTOR_SCRIPT_PREFIX . '.js',
array( 'jquery' ), // Dependencies, defined above.
'1.0.0',
true
);
wp_register_script(
'google-maps',
'https://maps.googleapis.com/maps/api/js?key=' . $apikey . '&libraries=places&callback=initMapScript',
array( 'gutentor-google-maps' ),
'1.0.0',
true
);
}
wp_register_script(
'gutentor-block', // Handle.
GUTENTOR_URL . 'assets/js/gutentor' . GUTENTOR_SCRIPT_PREFIX . '.js',
array( 'jquery' ), // Dependencies, defined above.
GUTENTOR_VERSION, // Version: File modification time.
true // Enqueue the script in the footer.
);
/*CSS for default/popular themes*/
$templates = array( 'twentynineteen', 'twentytwenty', 'generatepress', 'astra' );
$current_template = get_template();
if ( in_array( $current_template, $templates ) ) {
wp_register_style(
'gutentor-theme-' . esc_attr( $current_template ), // Handle.
GUTENTOR_URL . 'dist/gutentor-' . esc_attr( $current_template ) . '.css',
array(), // Dependency to include the CSS after it.
GUTENTOR_VERSION // Version: File modification time.
);
wp_style_add_data( 'gutentor-theme-' . esc_attr( $current_template ), 'rtl', 'replace' );
}
}
/**
* Load scripts and styles
*
* @since 2.1.2
* @access public
*
* @param null
* @return void
*/
function load_lib_assets() {
if ( ! is_admin() ) {
/*
fontawesome CSS
load front end and backend
Reason: Common for many blocks
*/
wp_enqueue_style( 'fontawesome' );
wp_style_add_data( 'fontawesome', 'rtl', 'replace' );
/*
wpness grid Needed for Admin and Frontend.
Reason: Common for many blocks*/
wp_enqueue_style( 'wpness-grid' );
wp_style_add_data( 'wpness-grid', 'rtl', 'replace' );
/*
Animate CSS
load front
Reason: needed on all blocks since animate option is everywhere
*/
wp_enqueue_style( 'animate' );
wp_style_add_data( 'animate', 'rtl', 'replace' );
/*
Wow is needed for Animate CSS
Reason: needed on all blocks since animate option is everywhere*/
wp_enqueue_script( 'wow' );
} else {
/*
fontawesome CSS
load front end and backend
Reason: Common for many blocks
*/
wp_enqueue_style( 'fontawesome' );
wp_style_add_data( 'fontawesome', 'rtl', 'replace' );
/*wpness grid Needed for Admin and Frontend*/
wp_enqueue_style( 'wpness-grid' );
wp_style_add_data( 'wpness-grid', 'rtl', 'replace' );
}
$this->library_loaded = true;
if ( gutentor_is_edit_page() ) {
$this->load_last_scripts();
} else {
/* Check this TODO */
wp_enqueue_style( 'gutentor' );
wp_style_add_data( 'gutentor', 'rtl', 'replace' );
}
}
/**
* Callback functions for enqueue_block_assets,
* Enqueue Gutenberg block assets for both frontend + backend.
*
* @since 1.0.0
* @access public
*
* @param null
* @return void
*/
function block_assets() { // phpcs:ignore
$this->load_lib_assets();
}
/**
* Load gutentor scripts at last
* Because it has lot of dependency
*
* @since 2.1.2
* @access public
*
* @param null
* @return void|boolean
*/
function load_last_scripts() {
if ( ! $this->library_loaded && ! function_exists( 'gutentor_template' ) ) {
return false;
}
/* Check this TODO */
wp_enqueue_style( 'gutentor' );
wp_style_add_data( 'gutentor', 'rtl', 'replace' );
/*For WooCommerce*/
if ( gutentor_is_woocommerce_active() ) {
wp_enqueue_style( 'gutentor-woo' );
wp_style_add_data( 'gutentor-woo', 'rtl', 'replace' );
}
/*For Edd*/
if ( gutentor_is_edd_active() ) {
wp_enqueue_style( 'gutentor-edd' );
wp_style_add_data( 'gutentor-edd', 'rtl', 'replace' );
}
/*CSS for default/popular themes*/
$templates = array( 'twentynineteen', 'twentytwenty', 'generatepress', 'astra' );
$current_template = get_template();
if ( in_array( $current_template, $templates ) ) {
wp_enqueue_style( 'gutentor-theme-' . esc_attr( $current_template ) );
wp_style_add_data( 'gutentor-theme-' . esc_attr( $current_template ), 'rtl', 'replace' );
}
/*Reusable block fixed*/
$reusable_blocks = gutentor_get_reusable_block_ids();
if ( ! isset( $GLOBALS['GUTENTOR_GLOBAL']['reusable_block'] ) ) {
$GLOBALS['GUTENTOR_GLOBAL']['reusable_block'] = $reusable_blocks;
} else {
$reusable_blocks = array_merge( $GLOBALS['GUTENTOR_GLOBAL']['reusable_block'], $reusable_blocks );
$GLOBALS['GUTENTOR_GLOBAL']['reusable_block'] = $reusable_blocks;
}
if ( $reusable_blocks ) {
$upload_dir = wp_upload_dir();
foreach ( $reusable_blocks as $reusable_block ) {
if ( file_exists( $upload_dir['basedir'] . '/gutentor/p-' . $reusable_block . '.css' ) ) {
$css_info = get_post_meta( $reusable_block, 'gutentor_css_info', true );
wp_enqueue_style( 'gutentor-dynamic-' . $reusable_block, trailingslashit( $upload_dir['baseurl'] ) . 'gutentor/p-' . $reusable_block . '.css', false, isset( $css_info['saved_version'] ) ? $css_info['saved_version'] : '' );
}
}
}
wp_enqueue_script( 'gutentor-block' );
wp_localize_script(
'gutentor-block',
'gutentorLS',
apply_filters(
'gutentor_block_frontend_localize_data',
array(
'fontAwesomeVersion' => gutentor_get_options( 'fa-version' ),
'restNonce' => wp_create_nonce( 'wp_rest' ),
'restUrl' => esc_url_raw( rest_url() ),
)
)
);
}
/**
* Callback functions for enqueue_block_editor_assets,
* Enqueue Gutenberg block assets for backend only.
*
* @since 1.0.0
* @access public
*
* @return void
*/
public function block_editor_assets() { // phpcs:ignore
if ( ! is_admin() ) {
return;
}
// edd wishlist scripts loads in backend
if ( function_exists( 'edd_wl_print_scripts' ) ) {
edd_wl_print_scripts();
}
global $pagenow;
$dependencies = array( 'jquery', 'lodash', 'wp-api', 'wp-i18n', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-keycodes', 'wp-plugins', 'wp-rich-text', 'wp-viewport' );
if ( gutentor_is_edit_page() ) {
array_push( $dependencies, 'wp-editor', 'wp-edit-post' );
} elseif ( $pagenow === 'widgets.php' ) {
array_push( $dependencies, 'wp-edit-widgets' );
}
// Scripts.
wp_enqueue_script(
'gutentor', // Handle.
GUTENTOR_URL . 'dist/blocks.build.js', // Block.build.js: We register the block here. Built with Webpack.
$dependencies, // Dependencies, defined above.
GUTENTOR_VERSION, // Version: File modification time.
true // Enqueue the script in the footer.
);
wp_set_script_translations( 'gutentor', 'gutentor' );
$localize__data = apply_filters(
'gutentor_block_editor_localize_data',
array(
'currentTheme' => get_template(),
'currentScreen' => get_current_screen(),
'postModuleGlobalCategoriesColor' => gutentor_pm_post_categories_color( true ),
'thumbnailAllSizes' => self::get_thumbnail_all_sizes(),
'updatedThumbnailAllSizes' => self::get_updated_thumbnail_all_sizes(),
'mapsAPI' => gutentor_get_options( 'map-api' ),
'dirUrl' => GUTENTOR_URL,
'gutentorLogo' => GUTENTOR_URL . 'assets/img/gutentor-logo.png',
'iconSvg' => GUTENTOR_URL . 'assets/img/block-icons/icon.svg',
'singleColSvg' => GUTENTOR_URL . 'assets/img/block-icons/single-column.svg',
'pricingSvg' => GUTENTOR_URL . 'assets/img/block-icons/pricing.svg',
'simpleTextSvg' => GUTENTOR_URL . 'assets/img/block-icons/simple-text.svg',
'coverSvg' => GUTENTOR_URL . 'assets/img/block-icons/cover.svg',
'carouselSvg' => GUTENTOR_URL . 'assets/img/block-icons/carousel.svg',
'sliderSvg' => GUTENTOR_URL . 'assets/img/block-icons/slider.svg',
'openHoursSvg' => GUTENTOR_URL . 'assets/img/block-icons/opening-hours.svg',
'notificationSvg' => GUTENTOR_URL . 'assets/img/block-icons/notification.svg',
'advancedTextSvg' => GUTENTOR_URL . 'assets/img/block-icons/advance-text.svg',
'featuredSvg' => GUTENTOR_URL . 'assets/img/block-icons/featured-block.svg',
'tabSvg' => GUTENTOR_URL . 'assets/img/block-icons/tabs.svg',
'counterSvg' => GUTENTOR_URL . 'assets/img/block-icons/counter.svg',
'contentBoxSvg' => GUTENTOR_URL . 'assets/img/block-icons/content-box.svg',
'buttonSvg' => GUTENTOR_URL . 'assets/img/block-icons/button.svg',
'buttonGroupSvg' => GUTENTOR_URL . 'assets/img/block-icons/button-group.svg',
'dynamicColSvg' => GUTENTOR_URL . 'assets/img/block-icons/dynamic-col.svg',
'advancedColSvg' => GUTENTOR_URL . 'assets/img/block-icons/advanced-col.svg',
'AdvPostSvg' => GUTENTOR_URL . 'assets/img/block-icons/advanced-post-module.svg',
'newsTickerSvg' => GUTENTOR_URL . 'assets/img/block-icons/news-ticker.svg',
'postFeaturedModuleSvg' => GUTENTOR_URL . 'assets/img/block-icons/post-feature-module.svg',
'postModuleSvg' => GUTENTOR_URL . 'assets/img/block-icons/post-module.svg',
'duplexPostModuleSvg' => GUTENTOR_URL . 'assets/img/block-icons/duplex-post-module.svg',
/*widget blocks*/
'aboutSvgW' => GUTENTOR_URL . 'assets/img/block-icons/about.svg',
'authorSvgW' => GUTENTOR_URL . 'assets/img/block-icons/author.svg',
'calltoactionSvgW' => GUTENTOR_URL . 'assets/img/block-icons/calltoaction.svg',
'countdownSvgW' => GUTENTOR_URL . 'assets/img/block-icons/countdown.svg',
'dividerSvgW' => GUTENTOR_URL . 'assets/img/block-icons/divider.svg',
'gallerySvgW' => GUTENTOR_URL . 'assets/img/block-icons/gallery.svg',
'imageSvgW' => GUTENTOR_URL . 'assets/img/block-icons/image.svg',
'listSvgW' => GUTENTOR_URL . 'assets/img/block-icons/list.svg',
'mapSvgW' => GUTENTOR_URL . 'assets/img/block-icons/map.svg',
'restaurantmenuSvgW' => GUTENTOR_URL . 'assets/img/block-icons/restaurantmenu.svg',
'progressbarSvgW' => GUTENTOR_URL . 'assets/img/block-icons/progressbar.svg',
'ratingSvgW' => GUTENTOR_URL . 'assets/img/block-icons/rating.svg',
'showmoreSvgW' => GUTENTOR_URL . 'assets/img/block-icons/showmore.svg',
'socialSvgW' => GUTENTOR_URL . 'assets/img/block-icons/social.svg',
'teamSvgW' => GUTENTOR_URL . 'assets/img/block-icons/team.svg',
'testimonialsSvgW' => GUTENTOR_URL . 'assets/img/block-icons/testimonial.svg',
'timelineSvgW' => GUTENTOR_URL . 'assets/img/block-icons/timeline.svg',
'videoSvgW' => GUTENTOR_URL . 'assets/img/block-icons/video.svg',
'defaultImage' => GUTENTOR_URL . 'assets/img/default-image.jpg',
'previewOnFrontendImg' => GUTENTOR_URL . 'assets/img/preview-on-frontend.jpg',
'gutentorSvg' => GUTENTOR_URL . 'assets/img/gutentor.svg',
'gutentorWhiteSvg' => GUTENTOR_URL . 'assets/img/gutentor-white-logo.svg',
'gutentorBlackSvg' => GUTENTOR_URL . 'assets/img/gutentor-black-logo.svg',
'm6Svg' => GUTENTOR_URL . 'assets/img/block-icons/accordion-module.svg',
'm9Svg' => GUTENTOR_URL . 'assets/img/block-icons/shortcode.svg',
'templateLibrarySvg' => GUTENTOR_URL . 'assets/img/block-icons/template-library.svg',
'm12Svg' => GUTENTOR_URL . 'assets/img/block-icons/quote.svg',
'm13Svg' => GUTENTOR_URL . 'assets/img/block-icons/toc.svg',
'fontAwesomeVersion' => gutentor_get_options( 'fa-version' ),
'checkPostFormatSupport' => gutentor_check_post_format_support_enable(),
'postFormats' => gutentor_get_post_formats(),
'postFormatsIcons' => gutentor_get_all_post_format_icons(),
'postFormatsColors' => gutentor_post_format_colors( true ),
'postFeaturedFormatsColors' => gutentor_post_featured_format_colors(),
'is_woocommerce_active' => gutentor_is_woocommerce_active(),
'enableEditorTemplateLibrary' => gutentor_setting_enable_template_library(),
'enableExportButton' => gutentor_setting_enable_export_template_button(),
'gutentorPro' => array(
'active' => gutentor_pro_active(),
),
'edd' => array(
'active' => gutentor_is_edd_active(),
'review' => gutentor_is_edd_review_active(),
'wishlist' => gutentor_is_edd_wishlist_active(),
),
'templateberg' => array(
'active' => gutentor_is_templateberg_active(),
'account' => gutentor_templateberg_has_account(),
'notice' => gutentor_templateberg()->can_show_notification(),
'loading' => false,
'error' => false,
),
'gActiveProTemplates' => apply_filters(
'gutentor_is_pro_active',
array(
'Gutentor' => false,
)
),
'globalTypography' => gutentor_get_global_typography(),
'globalColor' => gutentor_get_global_color(),
'globalContainerWidth' => gutentor_get_global_container_width(),
'blockNameShortFullForm' => gutentor_block_name_short_full_form(),
'typo-apply-options' => gutentor_get_options( 'typo-apply-options' ),
'color-palettes' => gutentor_get_options( 'color-palettes' ),
'isEditPage' => gutentor_is_edit_page(),
'nonce' => wp_create_nonce( 'gutentorNonce' ),
)
);
wp_localize_script(
'gutentor',
'gutentor',
$localize__data
);
// Scripts.
wp_enqueue_script(
'gutentor-editor', // Handle.
GUTENTOR_URL . 'assets/js/block-editor' . GUTENTOR_SCRIPT_PREFIX . '.js',
array( 'jquery' ), // Dependencies, defined above.
GUTENTOR_VERSION, // Version: File modification time.
true // Enqueue the script in the footer.
);
/*Frontend styles*/
wp_enqueue_style( 'gutentor' );
wp_style_add_data( 'gutentor', 'rtl', 'replace' );
// Backend only styles.
wp_enqueue_style(
'gutentor-editor', // Handle.
GUTENTOR_URL . 'dist/blocks.editor.build.css',
array( 'wp-edit-blocks' ), // Dependency to include the CSS after it.
GUTENTOR_VERSION // Version: File modification time.
);
wp_style_add_data( 'gutentor-editor', 'rtl', 'replace' );
}
/**
* Callback functions for customize_preview_init,
*
* @since 3.2.3
* @access public
*
* @return void
*/
public function customize_preview_init() {
wp_enqueue_script( 'gutentor-customizer', GUTENTOR_URL . '/assets/js/customizer.js', array( 'customize-preview', 'customize-selective-refresh', 'wp-data' ), GUTENTOR_VERSION, true );
}
/**
* Callback functions for body_class,
* Adding Body Class.
*
* @since 1.0.0
* @access public
*
* @param array $classes array of classes.
* @return array
*/
function add_body_class( $classes ) {
$classes[] = 'gutentor-active';
return $classes;
}
/**
* Callback functions for body_class,
* Adding Admin Body Class.
*
* @since 1.0.0
* @access public
*
* @param array $classes array of classes.
* @return string
*/
function add_admin_body_class( $classes ) {
// Wrong: No space in the beginning/end.
$classes .= ' gutentor-active ';
$disable_full_with_editor = gutentor_get_options( 'wide-width-editor' );
if ( current_theme_supports( 'align-wide' ) && ! $disable_full_with_editor ) {
$classes = gutentor_concat_space( $classes, ' gutentor-wide-width ' );
}
return $classes;
}
/**
* Create Page Template
*
* @param {string} $templates
* @return string $templates
*/
function gutentor_add_page_template( $templates ) {
$templates['template-gutentor-full-width.php'] = esc_html__( 'Gutentor Full Width', 'gutentor' );
$templates['template-gutentor-canvas.php'] = esc_html__( 'Gutentor Canvas', 'gutentor' );
return $templates;
}
/**
* Redirect Custom Page Template
*
* @param {string} $templates
* @return string $templates
*/
function gutentor_redirect_page_template( $template ) {
$post = get_post();
$page_template = '';
if ( $post->ID ) {
$page_template = get_post_meta( $post->ID, '_wp_page_template', true );
}
$g_template = false;
if ( 'template-gutentor-full-width.php' == basename( $page_template ) ) {
$g_template = true;
$template = GUTENTOR_PATH . '/page-templates/template-gutentor-full-width.php';
} elseif ( 'template-gutentor-canvas.php' == basename( $page_template ) ) {
$g_template = true;
$template = GUTENTOR_PATH . '/page-templates/template-gutentor-canvas.php';
}
if ( $g_template ) {
remove_action( 'template_include', array( 'WC_Template_Loader', 'template_loader' ) );
}
return $template;
}
/**
* Allowed style on post save
* Since gutentor add internal style per post page
*
* @param array $allowedposttags
* @return array
*/
public function allow_style_tags( $allowedposttags ) {
$allowedposttags['style'] = array(
'type' => true,
);
return $allowedposttags;
}
/**
* By default gutentor use fontawesome 5
* Changing default fontawesome to 4
* Quick fix for acmethemes
*
* @param array $defaults, All default options of gutentor
* @return array $defaults, modified version of default
*/
function acmethemes_alter_default_options( $defaults ) {
$current_theme = wp_get_theme();
$current_theme_author = $current_theme->get( 'Author' );
if ( $current_theme_author != 'acmethemes' ) {
return $defaults;
}
$defaults['fa-version'] = 4; /*default is fontawesome 5, we change here 4*/
return $defaults;
}
/**
* Register Gutentor_Reusable_Block_Widget
*/
function register_gutentor_reusable_block_selector_widget() {
register_widget( 'Gutentor_WP_Block_Widget' );
}
}
/**
* Begins execution of the hooks.
*
* @since 1.0.0
*/
function gutentor_hooks() {
return Gutentor_Hooks::instance();
}

View File

@@ -0,0 +1,40 @@
<?php
/**
* Define the internationalization functionality
*
* Loads and defines the internationalization files for this plugin
* so that it is ready for translation.
*
* @link https://www.gutentor.com/
* @since 1.0.0
*
* @package Gutentor
*/
/**
* Define the internationalization functionality.
*
* Loads and defines the internationalization files for this plugin
* so that it is ready for translation.
*
* @since 1.0.0
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
class Gutentor_i18n {
/**
* Load the plugin text domain for translation.
*
* @since 1.0.0
*/
public function load_plugin_textdomain() {
load_plugin_textdomain(
'gutentor',
false,
dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
);
}
}

View File

@@ -0,0 +1,356 @@
<?php
/**
* The file that defines the core plugin class
*
* A class definition that includes attributes and functions used to
* add/remove/edit the functionality of the Gutentor Plugin
*
* @link https://www.gutentor.com/
* @since 1.0.0
*
* @package Gutentor
*/
/**
* The core plugin class.
*
* This is used to define internationalization, admin-specific hooks, and
* functionality of the plugin
*
* Also maintains the unique identifier of this plugin as well as the current
* version of the plugin.
*
* @since 1.0.0
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
class Gutentor {
/**
* The loader that's responsible for maintaining and registering all hooks that power
* the plugin.
*
* @since 1.0.0
* @access protected
* @var Gutentor_Loader $loader Maintains and registers all hooks for the plugin.
*/
protected $loader;
/**
* The unique identifier of this plugin.
*
* @since 1.0.0
* @access protected
* @var string $plugin_name The string used to uniquely identify this plugin.
*/
protected $plugin_name;
/**
* Full Name of plugin.
*
* @since 1.0.0
* @access protected
* @var string $plugin_full_name The string used to uniquely identify this plugin.
*/
protected $plugin_full_name;
/**
* The current version of the plugin.
*
* @since 1.0.0
* @access protected
* @var string $version The current version of the plugin.
*/
protected $version;
/**
* Main Instance
*
* Insures that only one instance of Gutentor exists in memory at any one
* time. Also prevents needing to define globals all over the place.
*
* @since 1.0.0
* @access public
*
* @return object
*/
public static function instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new Gutentor();
do_action( 'gutentor_loaded' );
}
// Always return the instance.
return $instance;
}
/**
* Define the core functionality of the plugin.
*
* Set the plugin name and the plugin version that can be used throughout the plugin.
* Load the dependencies, define the locale, and set the hooks for the admin area and
* the public-facing side of the site.
*
* @since 1.0.0
*/
public function run() {
if ( defined( 'GUTENTOR_VERSION' ) ) {
$this->version = GUTENTOR_VERSION;
} else {
$this->version = '1.0.0';
}
$this->plugin_name = GUTENTOR_PLUGIN_NAME;
$this->plugin_full_name = 'Gutentor';
if ( function_exists( 'register_block_type' ) ) {
$this->load_dependencies();
$this->set_locale();
$this->define_hooks();
$this->load_hooks();
}
}
/**
* Load the required dependencies for this plugin.
*
* Include the following files that make up the plugin:
*
* - Gutentor_Loader. Orchestrates the hooks of the plugin.
* - Gutentor_i18n. Defines internationalization functionality.
* - Gutentor_Admin. Defines all hooks for the admin area.
* - Gutentor_Public. Defines all hooks for the public side of the site.
*
* Create an instance of the loader which will be used to register the hooks
* with WordPress.
*
* @since 1.0.0
* @access private
*/
private function load_dependencies() {
/**
* The class responsible for orchestrating the actions and filters of the
* core plugin.
*/
require_once GUTENTOR_PATH . 'includes/loader.php';
/**
* The class responsible for defining internationalization functionality
* of the plugin.
*/
require_once GUTENTOR_PATH . 'includes/i18n.php';
/*Cron*/
require_once GUTENTOR_PATH . 'includes/class-gutentor-cron.php';
/*Pro*/
require_once GUTENTOR_PATH . 'includes/pro/gutentor-pro-init.php';
/*User data*/
require_once GUTENTOR_PATH . 'includes/admin/class-gutentor-tracking.php';
/**
* The class responsible for defining all actions that occur in the admin area.
*/
require_once GUTENTOR_PATH . 'includes/functions/sanitize.php';
require_once GUTENTOR_PATH . 'includes/functions/functions.php';
require_once GUTENTOR_PATH . 'includes/hooks.php';
/* admin */
require_once GUTENTOR_PATH . 'includes/admin/class-gutentor-helper.php';
require_once GUTENTOR_PATH . 'includes/admin/class-gutentor-admin.php';
require_once GUTENTOR_PATH . 'includes/admin/settings/class-admin-settings.php';
/*Widget*/
require_once GUTENTOR_PATH . 'includes/sidebar-widget/class-gutentor-wp-block-widget.php';
/*Meta*/
require_once GUTENTOR_PATH . 'includes/metabox/meta-box.php';
/*
Blocks*/
/*block-base*/
require_once GUTENTOR_PATH . 'includes/block-base/class-gutentor-block-base.php';
require_once GUTENTOR_PATH . 'includes/block-base/class-gutentor-query-elements.php';
require_once GUTENTOR_PATH . 'includes/block-base/class-gutentor-block-hooks.php';
require_once GUTENTOR_PATH . 'includes/block-base/class-gutentor-post-modules-hooks.php';
require_once GUTENTOR_PATH . 'includes/block-base/class-gutentor-term-modules-hooks.php';
/*Block Templates*/
require_once GUTENTOR_PATH . 'includes/block-templates/featured/featured.php';
/*Elements*/
require_once GUTENTOR_PATH . 'includes/blocks/elements/class-gutentor-e2.php';/* ***Do not remove required for PHP BLOCK*/
require_once GUTENTOR_PATH . 'includes/blocks/elements/class-gutentor-e3.php';/* ***Do not remove required for Enquee*/
require_once GUTENTOR_PATH . 'includes/blocks/elements/class-gutentor-e4.php';/* ***Do not remove required for PHP BLOCK*/
require_once GUTENTOR_PATH . 'includes/blocks/elements/class-gutentor-e9.php';/* ***Do not remove required for PHP BLOCK*/
require_once GUTENTOR_PATH . 'includes/blocks/elements/class-gutentor-e11.php';/* ***Do not remove required for PHP BLOCK*/
/*Widgets*/
require_once GUTENTOR_PATH . 'includes/blocks/widgets/class-gutentor-blog-post.php';/* ***Do not remove required for PHP BLOCK*/
require_once GUTENTOR_PATH . 'includes/blocks/widgets/class-gutentor-google-map.php';/* ***Do not remove required for PHP BLOCK*/
require_once GUTENTOR_PATH . 'includes/blocks/widgets/class-gutentor-counter-box.php';/* ***Do not remove required for Enquee*/
require_once GUTENTOR_PATH . 'includes/blocks/widgets/class-gutentor-progress-bar.php';/* ***Do not remove required for Enquee*/
require_once GUTENTOR_PATH . 'includes/blocks/widgets/class-gutentor-video-popup.php';/* ***Do not remove required for Enquee*/
require_once GUTENTOR_PATH . 'includes/blocks/widgets/class-gutentor-gallery.php';/* ***Do not remove required for Enquee*/
require_once GUTENTOR_PATH . 'includes/blocks/widgets/class-gutentor-image-slider.php';/* ***Do not remove required for Enquee*/
/*Post Modules*/
require_once GUTENTOR_PATH . 'includes/blocks/modules/class-gutentor-p1.php';/* ***Do not remove required for PHP BLOCK*/
require_once GUTENTOR_PATH . 'includes/blocks/modules/class-gutentor-p3.php';/* ***Do not remove required for PHP BLOCK*/
require_once GUTENTOR_PATH . 'includes/blocks/modules/class-gutentor-p2.php';/* ***Do not remove required for PHP BLOCK*/
require_once GUTENTOR_PATH . 'includes/blocks/modules/class-gutentor-p4.php';/* ***Do not remove required for Enquee*/
require_once GUTENTOR_PATH . 'includes/blocks/modules/class-gutentor-p5.php';/* ***Do not remove required for PHP BLOCK*/
require_once GUTENTOR_PATH . 'includes/blocks/modules/class-gutentor-p6.php';/* ***Do not remove required for PHP BLOCK*/
require_once GUTENTOR_PATH . 'includes/blocks/modules/class-gutentor-m0.php';/* ***Do not remove required for Enquee*/
require_once GUTENTOR_PATH . 'includes/blocks/modules/class-gutentor-m4.php';/* ***Do not remove required for Enquee*/
require_once GUTENTOR_PATH . 'includes/blocks/modules/class-gutentor-m5.php';/* ***Do not remove required for Enquee*/
require_once GUTENTOR_PATH . 'includes/blocks/modules/class-gutentor-m10.php';/* ***Do not remove required for Enquee*/
/*Term Modules*/
require_once GUTENTOR_PATH . 'includes/blocks/modules/class-gutentor-t1.php';/* ***Do not remove required for PHP BLOCK*/
require_once GUTENTOR_PATH . 'includes/blocks/modules/class-gutentor-t2.php';/* ***Do not remove required for PHP BLOCK*/
require_once GUTENTOR_PATH . 'includes/blocks/modules/class-gutentor-t3.php';/* ***Do not remove required for PHP BLOCK*/
/*Rest API*/
require_once GUTENTOR_PATH . 'includes/tools/class-gutentor-self-api-handler.php';
require_once GUTENTOR_PATH . 'includes/tools/class-gutentor-extend-api.php';
/*Advanced Import*/
require_once GUTENTOR_PATH . 'includes/tools/class-gutentor-advanced-import.php';
/*Tb Notice*/
require_once GUTENTOR_PATH . 'includes/tools/class-gutentor-templateberg.php';
/*Dynamic CSS*/
require_once GUTENTOR_PATH . 'includes/dynamic-css.php';
$this->loader = new Gutentor_Loader();
}
/**
* Define the locale for this plugin for internationalization.
*
* Uses the Gutentor_i18n class in order to set the domain and to register the hook
* with WordPress.
*
* @since 1.0.0
* @access private
*/
private function set_locale() {
$plugin_i18n = new Gutentor_i18n();
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
}
/**
* Register all of the hooks related to the admin area functionality
* of the plugin.
*
* @since 1.0.0
* @access private
*/
private function define_hooks() {
$plugin_hooks = gutentor_hooks();
/*Hook: Register Scripts*/
$this->loader->add_action( 'init', $plugin_hooks, 'register_script_style' );
/*Hook: Both Frontend and Backend assets.*/
$this->loader->add_action( 'enqueue_block_assets', $plugin_hooks, 'block_assets' );
/*
equal or greater than 20 doesnot work
Changed on 3.2.6
// $this->loader->add_action( 'wp_enqueue_scripts', $plugin_hooks, 'load_last_scripts', 999 );
*/
$this->loader->add_action( 'wp_footer', $plugin_hooks, 'load_last_scripts', 10 );
/*Hook: Editor assets.*/
$this->loader->add_action( 'enqueue_block_editor_assets', $plugin_hooks, 'block_editor_assets', 999 );
$this->loader->add_action( 'customize_preview_init', $plugin_hooks, 'customize_preview_init', 999 );
/*Hook: Adding Gutentor Color palatte.*/
$this->loader->add_action( 'after_setup_theme', $plugin_hooks, 'add_color_palette', 99999 );
/*Hook Adding Block Categories*/
if ( version_compare( get_bloginfo( 'version' ), '5.8', '>=' ) ) {
$this->loader->add_filter( 'block_categories_all', $plugin_hooks, 'add_block_categories', 99999 );
} else {
$this->loader->add_filter( 'block_categories', $plugin_hooks, 'add_block_categories', 99999 );
}
/*Adding Body Class*/
$this->loader->add_filter( 'body_class', $plugin_hooks, 'add_body_class' );
/*Adding Admin Body Class*/
$this->loader->add_filter( 'admin_body_class', $plugin_hooks, 'add_admin_body_class' );
/*
Adding page templates
From 3.0.3 replaced by gutentor\includes\admin\settings\class-admin-settings.php*/
// $this->loader->add_filter( 'theme_page_templates', $plugin_hooks, 'gutentor_add_page_template' );
// $this->loader->add_filter( 'page_template', $plugin_hooks, 'gutentor_redirect_page_template' );
/*Adding style*/
$this->loader->add_filter( 'wp_kses_allowed_html', $plugin_hooks, 'allow_style_tags' );
/*Quick fix for acmethemes fontawesome*/
$this->loader->add_filter( 'gutentor_default_options', $plugin_hooks, 'acmethemes_alter_default_options' );
$this->loader->add_action( 'widgets_init', $plugin_hooks, 'register_gutentor_reusable_block_selector_widget' );
}
/**
* Run the loader to execute all of the hooks with WordPress.
*
* @since 1.0.0
*/
public function load_hooks() {
$this->loader->run();
}
/**
* The name of the plugin used to uniquely identify it within the context of
* WordPress and to define internationalization functionality.
*
* @since 1.0.0
* @return string The name of the plugin.
*/
public function get_plugin_name() {
return $this->plugin_name;
}
/**
* The reference to the class that orchestrates the hooks with the plugin.
*
* @since 1.0.0
* @return Gutentor_Loader Orchestrates the hooks of the plugin.
*/
public function get_loader() {
return $this->loader;
}
/**
* Retrieve the version number of the plugin.
*
* @since 1.0.0
* @return string The version number of the plugin.
*/
public function get_version() {
return $this->version;
}
}

View File

@@ -0,0 +1,122 @@
<?php
/**
* Register all actions and filters for the plugin
*
* @link https://www.gutentor.com/
* @since 1.0.0
*
* @package Gutentor
*/
/**
* Register all actions and filters for the plugin.
*
* Maintain a list of all hooks that are registered throughout
* the plugin, and register them with the WordPress API. Call the
* run function to execute the list of actions and filters.
*
* @package Gutentor
* @author Gutentor <info@gutentor.com>
*/
class Gutentor_Loader {
/**
* The array of actions registered with WordPress.
*
* @since 1.0.0
* @access protected
* @var array $actions The actions registered with WordPress to fire when the plugin loads.
*/
protected $actions;
/**
* The array of filters registered with WordPress.
*
* @since 1.0.0
* @access protected
* @var array $filters The filters registered with WordPress to fire when the plugin loads.
*/
protected $filters;
/**
* Initialize the collections used to maintain the actions and filters.
*
* @since 1.0.0
*/
public function __construct() {
$this->actions = array();
$this->filters = array();
}
/**
* Add a new action to the collection to be registered with WordPress.
*
* @since 1.0.0
* @param string $hook The name of the WordPress action that is being registered.
* @param object $component A reference to the instance of the object on which the action is defined.
* @param string $callback The name of the function definition on the $component.
* @param int $priority Optional. The priority at which the function should be fired. Default is 10.
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
*/
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
}
/**
* Add a new filter to the collection to be registered with WordPress.
*
* @since 1.0.0
* @param string $hook The name of the WordPress filter that is being registered.
* @param object $component A reference to the instance of the object on which the filter is defined.
* @param string $callback The name of the function definition on the $component.
* @param int $priority Optional. The priority at which the function should be fired. Default is 10.
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
*/
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
}
/**
* A utility function that is used to register the actions and hooks into a single
* collection.
*
* @since 1.0.0
* @access private
* @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
* @param string $hook The name of the WordPress filter that is being registered.
* @param object $component A reference to the instance of the object on which the filter is defined.
* @param string $callback The name of the function definition on the $component.
* @param int $priority The priority at which the function should be fired.
* @param int $accepted_args The number of arguments that should be passed to the $callback.
* @return array The collection of actions and filters registered with WordPress.
*/
private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
$hooks[] = array(
'hook' => $hook,
'component' => $component,
'callback' => $callback,
'priority' => $priority,
'accepted_args' => $accepted_args,
);
return $hooks;
}
/**
* Register the filters and actions with WordPress.
*
* @since 1.0.0
*/
public function run() {
foreach ( $this->filters as $hook ) {
add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
}
foreach ( $this->actions as $hook ) {
add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
}
}
}

View File

@@ -0,0 +1,30 @@
.gutentor-custom-meta .components-select-control__input {
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
width: 100%;
}
.gutentor-custom-meta .components-base-control__field {
margin-bottom: 8px;
}
.gutentor-custom-meta .components-base-control__label {
margin-bottom: 4px;
display: inline-block;
}
.gutentor-custom-meta .gutentor-banner-img-wrap .button,
.gutentor-custom-meta .gutentor-meta-video-upload-wrap .button {
display: block;
margin: 5px 0;
}
.gutentor-custom-meta .gutentor-banner-img-wrap .cwp-image-preview-wrap,
.gutentor-custom-meta .gutentor-meta-video-upload-wrap .gutentor-video-preview-wrap {
display: block;
border: 1px dashed #ddd;
min-height: 100px;
margin: 10px auto;
background: #fbfbfb;
}

View File

@@ -0,0 +1,179 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Gutentor Custom Meta Boxes
*
* @package Gutentor
*/
if ( ! class_exists( 'Gutentor_Custom_Meta_Box' ) ) :
class Gutentor_Custom_Meta_Box {
/**
* Main Instance
*
* Insures that only one instance of Gutentor_Custom_Meta_Box exists in memory at any one
* time. Also prevents needing to define globals all over the place.
*
* @since 3.0.0
* @access public
*
* @return object
*/
public static function instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new Gutentor_Custom_Meta_Box();
}
// Always return the instance.
return $instance;
}
/**
* Run functionality with hooks
*
* @since 3.0.0
* @access public
*
* @return void
*/
public function run() {
if ( is_admin() ) {
add_action( 'load-post.php', array( $this, 'init_metabox' ) );
add_action( 'load-post-new.php', array( $this, 'init_metabox' ) );
}
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_meta_box_script' ) );
}
/**
* Enqueue scripts
* return void
*/
public function enqueue_meta_box_script() {
if ( gutentor_is_edit_page() && 'download' === get_post_type() ) {
wp_enqueue_style( 'gutentor-meta-box', GUTENTOR_URL . '/includes/metabox/meta-box.css', array(), '1.0.0' );
}
}
/**
* Meta box initialization.
*/
public function init_metabox() {
$options = gutentor_get_options();
$value = false;
if ( isset( $options['edd-demo-url'] ) && ! empty( $options['edd-demo-url'] ) ) {
$value = $options['edd-demo-url'];
}
if ( $value ) {
add_action( 'add_meta_boxes', array( $this, 'add_metabox' ) );
add_action( 'save_post', array( $this, 'save_metabox' ), 10, 2 );
}
}
/**
* Adds the meta box.
*/
public function add_metabox() {
add_meta_box(
'gutentor_edd_demo_url',
__( 'Gutentor', 'gutentor' ),
array( $this, 'render_metabox' ),
'download',
'side',
'low'
);
}
/**
* Renders the meta box.
*/
public function render_metabox( $post ) {
$gutentor_edd_demo_url_value = get_post_meta( $post->ID, 'gutentor_edd_demo_url', true );
// true ensures you get just one value instead of an array.
wp_nonce_field( basename( __FILE__ ), 'gutentor_meta_nonce' );
?>
<div class="gutentor-custom-meta components-base-control">
<div class="components-base-control__field">
<label class="components-base-control__label" for="gutentor_edd_demo_url"><?php echo esc_html__( 'Demo URL', 'gutentor' ); ?></label>
<input name="gutentor_edd_demo_url" value="<?php echo esc_attr( $gutentor_edd_demo_url_value ); ?>" id="gutentor_edd_demo_url" class="components-select-control__input" />
</div>
</div>
<?php
}
/**
* Handles saving the meta box.
*
* @param int $post_id Post ID.
* @param WP_Post $post Post object.
* @return null
*/
public function save_metabox( $post_id, $post ) {
/*
* A Guide to Writing Secure Themes Part 4: Securing Post Meta
*https://make.wordpress.org/themes/2015/06/09/a-guide-to-writing-secure-themes-part-4-securing-post-meta/
* */
if (
! isset( $_POST['gutentor_meta_nonce'] ) ||
! wp_verify_nonce( $_POST['gutentor_meta_nonce'], basename( __FILE__ ) ) || /*Protecting against unwanted requests*/
( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || /*Dealing with autosaves*/
! current_user_can( 'edit_post', $post_id )/*Verifying access rights*/
) {
return;
}
if ( 'download' != $_POST['post_type'] ) {
return $post_id;
}
if ( ! current_user_can( 'edit_post', $post_id ) ) {
return $post_id;
}
// Execute this saving function
// site layout.
if ( isset( $_POST['gutentor_edd_demo_url'] ) ) {
$old = get_post_meta( $post_id, 'gutentor_edd_demo_url', true );
$new = esc_url_raw( $_POST['gutentor_edd_demo_url'] );
if ( $new && $new != $old ) {
update_post_meta( $post_id, 'gutentor_edd_demo_url', $new );
} elseif ( '' == $new && $old ) {
delete_post_meta( $post_id, 'gutentor_edd_demo_url', $old );
}
}
}
}
endif;
/**
* Create Instance for Gutentor_Custom_Meta_Box
*
* @since 3.0.0
* @access public
*
* @param
*
* @return object
*/
if ( ! function_exists( 'gutentor_custom_meta_box' ) ) {
function gutentor_custom_meta_box() {
return Gutentor_Custom_Meta_Box::instance();
}
gutentor_custom_meta_box()->run();
}

View File

@@ -0,0 +1,387 @@
<?php
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Allows plugins to show license field.
*/
class Gutentor_Pro_License_Init {
private $slug = '';
public $menu_slug = '';
// for pro backward compatibility
public $api_url = '';
public $api_data = array();
public $plugin_file = '';
function __construct() {
$this->api_url = '';
$this->plugin_file = '';
$this->api_data = array();
}
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 3.2.1
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Class constructor.
*
* @uses plugin_basename()
* @uses hook()
*/
public function run() {
$this->slug = 'gutentor-pro';
$this->menu_slug = $this->slug . '-license';
// Set up hooks.
$this->init();
}
/**
* Set up WordPress hooks.
*
* @return void
*/
public function init() {
add_filter( 'admin_menu', array( $this, 'license_menu' ), 99 );
add_action( 'admin_init', array( $this, 'register_license_option' ), 10 );
add_action( 'admin_init', array( $this, 'upgrade_to_pro_notice' ), 10 );
add_action( 'admin_notices', array( $this, 'getting_started' ) );
}
/**
* Get license key
*
* @return string
*/
public function get_license_key() {
return trim( get_option( $this->slug . '_license_key' ) );
}
/**
* Adds the plugin license page to the admin menu.
*
* @return void
*/
function license_menu() {
add_submenu_page(
'gutentor',
esc_html__( 'License', 'gutentor' ),
esc_html__( 'License', 'gutentor' ),
'manage_options',
$this->menu_slug,
array( $this, 'license_page' )
);
}
/**
* Callback function from license_page.
*
* @return void
*/
function license_page() {
add_settings_section(
$this->slug . '_license',
esc_html__( 'Gutentor License', 'gutentor' ),
array( $this, 'license_key_settings_section' ),
$this->menu_slug
);
add_settings_field(
$this->slug . '_license_key',
'<label for="' . $this->slug . '_license_key' . '">' . esc_html__( 'License Key', 'gutentor' ) . '</label>',
array( $this, 'license_key_settings_field' ),
$this->menu_slug,
$this->slug . '_license'
);
$license = trim( get_option( $this->slug . '_license_key' ) );
if ( isset( $_GET['g-message'] ) && ! empty( $_GET['g-message'] ) ) {
?>
<div id="message" class="error notice is-dismissible">
<p><?php echo esc_html( $_GET['g-message'] ); ?></p>
</div>
<?php
}
?>
<div class="wrap" id="<?php echo esc_attr( $this->slug ); ?>-license-wrap">
<h2><?php esc_html_e( 'Gutentor License Options', 'gutentor' ); ?></h2>
<form method="post" action="options.php" id="<?php echo esc_attr( $this->slug ) . '-options-form'; ?>">
<?php
do_settings_sections( $this->menu_slug );
settings_fields( $this->slug . '_license' );
if ( $license ) {
$button_text = esc_html__( 'Delete License', 'gutentor' );
submit_button( $button_text, 'primary', 'btn-delete-license' );
} else {
$button_text = esc_html__( 'Save License', 'gutentor' );
submit_button( $button_text, 'primary', 'btn-save-license' );
}
?>
</form>
</div>
<script type="text/javascript">
let form = document.getElementById("<?php echo esc_attr( $this->slug ) . '-options-form'; ?>"),
license_field = document.getElementById("<?php echo esc_attr( $this->slug ) . '_license_key'; ?>");
if( document.getElementById('btn-delete-license')){
document.getElementById('btn-delete-license').addEventListener("click", function (evt) {
evt.preventDefault();
license_field.value = '';
form.submit();
});
}
</script>
<?php
}
/**
* Adds content to the settings section.
*
* @return void
*/
function license_key_settings_section() {
printf(
// translators: %1$s is an opening HTML link tag with a specific URL, %2$s is the closing HTML link tag, and %3$s is the closing HTML heading tag.
esc_html__( '%1$sGet your premium license%2$s for full features, premium Gutenberg templates, premium supports and many more.%3$s', 'gutentor' ),
'<h4><a href="https://www.gutentor.com/pricing" target="_blank" rel="nofollow noopener">',
'</a>',
'</h4>'
);
}
/**
* Outputs the license key settings field.
*
* @return void
*/
function license_key_settings_field() {
$license = $this->get_license_key();
?>
<h4>
<?php esc_html_e( 'Enter your license key.', 'gutentor' ); ?>
</h4>
<?php
printf(
'<input type="text" class="regular-text" id="' . esc_attr( $this->slug ) . '_license_key' . '" name="' . esc_attr( $this->slug ) . '_license_key' . '" value="%s" />',
esc_attr( $license )
);
if ( ! $license ) {
?>
<p class="description">
<?php
esc_html_e( 'You are using a free license.', 'gutentor' );
?>
<a href="https://www.gutentor.com/pricing" target="_blank" rel="nofollow noopener noindex">
<span><?php esc_html_e( 'Upgrade to Pro', 'gutentor' ); ?></span>
</a>
</p>
<?php
} else {
?>
<p class="description">
<?php
$upload_url = admin_url( 'plugin-install.php?tab=upload' );
$pro_url = 'https://www.gutentor.com/pricing';
// Use sprintf with wp_kses_post to allow HTML in the translation.
printf(
wp_kses_post(
// translators: %1$s is the URL for the plugin install page, %2$s is the URL for the Gutentor Pro pricing page.
__( 'Please install Gutentor Pro zip from <a href="%1$s">Plugin install page</a> or get Gutentor Pro from <a href="%2$s" target="_blank">Gutentor Pro Pricing</a>', 'gutentor' )
),
esc_url( $upload_url ),
esc_url( $pro_url )
);
?>
</p>
<?php
}
}
/**
* Registers the license key setting in the options table.
*
* @return void
*/
function register_license_option() {
register_setting( $this->slug . '_license', $this->slug . '_license_key', array( $this, 'sanitize_license' ) );
}
/**
* Sanitizes the license key.
*
* @param string $new The license key.
* @return string
*/
function sanitize_license( $new ) {
return sanitize_text_field( $new );
}
public function get_installed_time() {
$helper_options = json_decode( get_option( '__gutentor_helper_options' ), true );
if ( isset( $helper_options['installed_time'] ) ) {
return $helper_options['installed_time'];
}
$helper_options['installed_time'] = time();
update_option(
'__gutentor_helper_options',
wp_json_encode(
$helper_options
)
);
return false;
}
public function can_show_notice() {
global $current_user;
$user_id = $current_user->ID;
$ignored_notice = get_user_meta( $user_id, $this->slug . '_upgrade_to_pro_notice', true );
$ignored_notice_partially = get_user_meta( $user_id, $this->slug . '_upgrade_to_pro_notice_partially', true );
/**
* Return from notice display if:
*
* 1. The theme installed is less than 15 days ago.
* 2. If the user has ignored the message partially for 15 days.
* 3. Dismiss always if clicked on 'I Already Did' button.
*/
if ( ( $this->get_installed_time() && $this->get_installed_time() > strtotime( '-3 day' ) ) || ( $ignored_notice_partially > strtotime( '-15 day' ) ) || ( $ignored_notice ) ) {
return false;
}
return true;
}
/**
* Remove notice permanently
*
* Active callback of after_setup_theme
* return void
*/
public function upgrade_to_pro_notice() {
global $current_user;
$user_id = $current_user->ID;
/* If user clicks to ignore the notice, add info to user meta */
if ( isset( $_GET[ $this->slug . '_upgrade_to_pro_notice' ] ) && '0' == $_GET[ $this->slug . '_upgrade_to_pro_notice' ] ) {
add_user_meta( $user_id, $this->slug . '_upgrade_to_pro_notice', 'true', true );
}
/* If user clicks to ignore the notice, add that to their user meta */
if ( isset( $_GET[ $this->slug . '_upgrade_to_pro_notice_partially' ] ) && '0' == $_GET[ $this->slug . '_upgrade_to_pro_notice_partially' ] ) {
update_user_meta( $user_id, $this->slug . '_upgrade_to_pro_notice_partially', time() );
if ( isset( $_GET['go-license-page'] ) && '1' == $_GET['go-license-page'] ) {
wp_safe_redirect( admin_url( 'admin.php?page=' . $this->menu_slug ) );
}
}
}
/**
* Get Started Notice
* Active callback of admin_notices
* return void
*/
public function getting_started() {
if ( ! $this->can_show_notice() ) {
return;
}
global $current_user;
?>
<div class="notice updated <?php echo esc_attr( $this->slug ); ?>-review-notice" style="position:relative;padding:20px">
<img class="<?php echo esc_attr( $this->slug ); ?>-gsm-screenshot" src="<?php echo esc_url( GUTENTOR_URL . 'assets/img/gutentor-logo.png' ); ?>" alt="<?php esc_attr_e( 'Gutentor', 'gutentor' ); ?>" width="70px" style="margin-right:20px; float: left" />
<p>
<?php
printf(
/* Translators: %1$s current user display name. */
esc_html__(
'Howdy, %1$s! It seems that you have been using Gutentor for a few days. We hope you are happy with everything that the plugin has to offer. To fully take advantage of the best our plugin can offer, consider upgrading to premium version.',
'gutentor'
),
'<strong>' . esc_html( $current_user->display_name ) . '</strong>'
);
?>
</p>
<style type="text/css">
.btn-align-center{
display: -webkit-inline-box!important;
display: -ms-inline-flexbox!important;
display: inline-flex!important;
-webkit-box-align: center!important;
-ms-flex-align: center!important;
align-items: center!important;
}
</style>
<div class="links">
<a href="https://www.gutentor.com/pricing" class="btn button-primary btn-align-center" target="_blank" rel="nofollow noopener noindex">
<span class="dashicons dashicons-cart"></span>
<span><?php esc_html_e( 'Upgrade to Pro', 'gutentor' ); ?></span>
</a>
<a href="?<?php echo esc_attr( $this->slug ); ?>_upgrade_to_pro_notice_partially=0" class="btn button-secondary btn-align-center">
<span class="dashicons dashicons-thumbs-up"></span>
<span><?php esc_html_e( 'Maybe later', 'gutentor' ); ?></span>
</a>
<a href="?<?php echo esc_attr( $this->slug ); ?>_upgrade_to_pro_notice_partially=0&go-license-page=1" class="btn button-secondary btn-align-center" style="background: #218838;border-color: #218838;color: #fff">
<span class="dashicons dashicons-smiley"></span>
<span><?php esc_html_e( 'I already did', 'gutentor' ); ?></span>
</a>
<a href="?<?php echo esc_attr( $this->slug ); ?>_upgrade_to_pro_notice=0" class="btn-link">
<span><?php esc_html_e( "Don't show again", 'gutentor' ); ?></span>
</a>
</div>
<a class="notice-dismiss" style="text-decoration:none;" href="?<?php echo esc_attr( $this->slug ); ?>_upgrade_to_pro_notice_partially=0"></a>
</div>
<?php
}
}
/**
* Begins execution of the license.
*
* @since 1.0.0
*/
function gutentor_pro_license_init() {
return Gutentor_Pro_License_Init::get_instance();
}
add_action( 'init', 'gutentor_pro_license_init_run' );
function gutentor_pro_license_init_run() {
if ( is_admin() ) {
gutentor_pro_license_init()->run();
}
}

View File

@@ -0,0 +1,362 @@
<?php
/**
* Class for adding Reusable Block Widget
*
* @package AddonsPress
* @subpackage Gutentor
* @since 2.0.3
*/
if ( ! class_exists( 'Gutentor_WP_Block_Widget' ) ) {
class Gutentor_WP_Block_Widget extends WP_Widget {
/*defaults values for fields*/
private $defaults = array(
'title' => '',
'wp_block_id' => '',
);
/*Used Blocks*/
private $used_blocks = array();
/**
* All blocks on the widgets
*
* @var array
* @access public
* @since 1.0.0
*/
public static $unique_blocks = array();
function __construct() {
parent::__construct(
/*Base ID of your widget*/
'gutentor_wp_block_widget',
/*Widget name will appear in UI*/
esc_html__( 'Addons Gutentor Block', 'gutentor' ),
/*Widget description*/
array(
'description' => esc_html__( 'Feel free to add Gutenberg Block on the Widgets', 'gutentor' ),
)
);
/*Add Scripts*/
add_action( 'wp_enqueue_scripts', array( $this, 'scripts' ) );
add_action( 'wp_footer', array( $this, 'add_missing_assets' ) );
add_action( 'wp_footer', array( $this, 'add_used_blocks_css' ), 20 );
}
/*Widget Backend*/
public function form( $instance ) {
$instance = wp_parse_args( (array) $instance, $this->defaults );
/*default values*/
$wp_block_id = absint( $instance['wp_block_id'] );
printf(
'<h3><a href="%1$s" target="_blank">%2$s</a></h3>',
esc_url( admin_url( 'edit.php?post_type=wp_block' ) ),
esc_html__( 'Go to here to add Block', 'gutentor' )
);
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title (Optional)', 'gutentor' ); ?>:</label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
</p>
<?php
$item_arg = array(
'post_type' => 'wp_block',
'posts_per_page' => -1,
'post_status' => 'publish',
'order' => 'DESC',
);
$item_query = new WP_Query( gutentor_get_query( $item_arg ) );
if ( $item_query->have_posts() ) :
printf(
'<p><label for="%1$s">%2$s</label><br/><small>%4$s</small>' .
'<select class="widefat" id="%1$s" name="%3$s">',
esc_attr( $this->get_field_id( 'wp_block_id' ) ),
esc_html__( 'Select Block:', 'gutentor' ),
esc_attr( $this->get_field_name( 'wp_block_id' ) ),
esc_html__( 'Select block and its content will display in the frontend.', 'gutentor' )
);
printf(
'<option value="%1$s" %2$s>%3$s</option>',
0,
selected( 0, $wp_block_id, false ),
esc_html__( 'Select Block', 'gutentor' )
);
while ( $item_query->have_posts() ) :
$item_query->the_post();
printf(
'<option value="%1$s" %2$s>%3$s</option>',
absint( get_the_ID() ),
selected( get_the_ID(), $wp_block_id, false ),
esc_html( get_the_title() )
);
endwhile;
wp_reset_postdata();
echo '</select></p>';
endif;
}
/**
* Function to Updating widget replacing old instances with new
*
* @access public
* @since 1.0.0
*
* @param array $new_instance new arrays value
* @param array $old_instance old arrays value
* @return array
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = sanitize_text_field( $new_instance['title'] );
$instance['wp_block_id'] = absint( $new_instance['wp_block_id'] );
return $instance;
}
/**
* Function to Creating widget front-end. This is where the action happens
*
* @access public
* @since 1.0
*
* @param array $args widget setting
* @param array $instance saved values
* @return void
*/
public function widget( $args, $instance ) {
$instance = wp_parse_args( (array) $instance, $this->defaults );
/*default values*/
$title = apply_filters( 'widget_title', ! empty( $instance['title'] ) ? $instance['title'] : '', $instance, $this->id_base );
$wp_block_id = absint( $instance['wp_block_id'] );
echo $args['before_widget'];
if ( ! empty( $title ) ) {
echo $args['before_title'] . esc_html( $title ) . $args['after_title'];
}
if ( ! empty( $wp_block_id ) ) :
$g_args = array(
'p' => $wp_block_id,
'post_type' => 'wp_block',
);
$g_query = new WP_Query( gutentor_get_query( $g_args ) );
/*The Loop*/
if ( $g_query->have_posts() ) :
echo '<div class="gutentor-widget gutentor-wp-block-widget">';
while ( $g_query->have_posts() ) :
$g_query->the_post();
$already_used_blocks = false;
if ( isset( $GLOBALS['GUTENTOR_GLOBAL']['reusable_block'] ) ) {
$reusable_blocks = $GLOBALS['GUTENTOR_GLOBAL']['reusable_block'];
if ( in_array( get_the_ID(), $reusable_blocks ) ) {
$already_used_blocks = true;
} else {
array_push( $reusable_blocks, get_the_ID() );
$GLOBALS['GUTENTOR_GLOBAL']['reusable_block'] = $reusable_blocks;
}
} else {
$GLOBALS['GUTENTOR_GLOBAL']['reusable_block'] = array(
get_the_ID(),
);
}
if ( ! $already_used_blocks ) {
array_push( $this->used_blocks, get_the_ID() );
$css_info = get_post_meta( get_the_ID(), 'gutentor_css_info', true );
if ( isset( $css_info['blocks'] ) && is_array( $css_info['blocks'] ) ) {
self::$unique_blocks = array_unique( array_merge( self::$unique_blocks, $css_info['blocks'] ) );
}
}
the_content();
endwhile;
echo '</div>';
endif;
wp_reset_postdata();
endif;
echo $args['after_widget'];
}
/**
* Load scripts and styles
*
* @since 2.1.2
* @access public
*
* @param null
* @return void
*/
function scripts() {
if ( ! is_active_widget( false, false, $this->id_base, true ) ) {
return;
}
$gwb_options = $this->get_settings();
if ( is_array( $gwb_options ) && ! empty( $gwb_options ) ) {
foreach ( $gwb_options as $gwb_option ) {
if ( isset( $gwb_option['wp_block_id'] ) && $gwb_option['wp_block_id'] != 0 ) {
$wp_block_id = absint( $gwb_option['wp_block_id'] );
$g_args = array(
'p' => $wp_block_id,
'post_type' => 'wp_block',
);
$g_query = new WP_Query( gutentor_get_query( $g_args ) );
/*The Loop*/
if ( $g_query->have_posts() ) :
while ( $g_query->have_posts() ) :
$g_query->the_post();
gutentor_hooks()->load_lib_assets();
endwhile;
endif;
wp_reset_postdata();
}
}
}
}
/**
* Add missing assets if any
*
* @since 3.0.0
* @access public
*
* @param array $block_css_files url of blocks css files.
* @return void
*/
private function enqueue_missing_assets( $block_css_files ) {
if ( is_array( $block_css_files ) && ! empty( $block_css_files ) ) {
foreach ( $block_css_files as $file_url ) {
if ( $file_url ) {
$exploded = explode( '/', $file_url );
wp_enqueue_style(
'gutentor-missing-' . str_replace( '.css', '', end( $exploded ) ), // Handle.
$file_url,
false, // Dependency to include the CSS after it.
GUTENTOR_VERSION // Version: File modification time.
);
}
}
}
}
/**
* Add missing assets if any
* Reference from Gutentor_Dynamic_CSS -> get_blocks_css
*
* @since 3.0.0
* @access public
*
* @param null
* @return void
*/
public function add_missing_assets() {
$diff_blocks = array_diff( self::$unique_blocks, gutentor_dynamic_css()->get_unique_blocks() );
$block_css_files = array();
if ( is_array( $diff_blocks ) && ! empty( $diff_blocks ) ) {
/*global*/
if ( count( $diff_blocks ) === count( self::$unique_blocks ) ) {
$block_css_files[] = gutentor_dynamic_css()->get_static_css( 'global', true );
}
/*Slick*/
$slick = array(
'gutentor/image-slider',
'gutentor/m5',
'gutentor/m0',
'gutentor/p3',
'gutentor/t3',
);
if ( ! empty( array_intersect( $diff_blocks, $slick ) ) ) {
$block_css_files[] = gutentor_dynamic_css()->get_static_css( 'slick', true );
}
/*featured*/
$featured = array(
'gutentor/t1',
'gutentor/t2',
'gutentor/p2',
);
if ( ! empty( array_intersect( $diff_blocks, $featured ) ) ) {
$block_css_files[] = gutentor_dynamic_css()->get_static_css( 'featured', true );
}
/*Post/Tax Type*/
$types = array(
'gutentor/p1',
'gutentor/p2',
'gutentor/p3',
'gutentor/p4',
'gutentor/p5',
'gutentor/p6',
'gutentor/t1',
'gutentor/t2',
'gutentor/t3',
);
if ( ! empty( array_intersect( $diff_blocks, $types ) ) ) {
$block_css_files[] .= gutentor_dynamic_css()->get_static_css( 'global-type', true );
}
/*Widget*/
$widgets = array(
'gutentor/about-block',
'gutentor/accordion',
'gutentor/author-profile',
'gutentor/blog-post',
'gutentor/call-to-action',
'gutentor/content-box',
'gutentor/count-down',
'gutentor/counter-box',
'gutentor/divider',
'gutentor/featured-block',
'gutentor/gallery',
'gutentor/google-map',
'gutentor/icon-box',
'gutentor/image-box',
'gutentor/image-slider',
'gutentor/list',
'gutentor/notification',
'gutentor/opening-hours',
'gutentor/pricing',
'gutentor/progress-bar',
'gutentor/restaurant-menu',
'gutentor/show-more',
'gutentor/social',
'gutentor/tabs',
'gutentor/team',
'gutentor/testimonial',
'gutentor/timeline',
'gutentor/video-popup',
);
if ( ! empty( array_intersect( $diff_blocks, $widgets ) ) ) {
$block_css_files[] = gutentor_dynamic_css()->get_static_css( 'global-widget', true );
}
foreach ( $diff_blocks as $block ) {
$block_css_files[] = gutentor_dynamic_css()->get_static_css( $block, true );
}
$this->enqueue_missing_assets( $block_css_files );
}
}
public function add_used_blocks_css() {
if ( ! empty( $this->used_blocks ) ) {
foreach ( $this->used_blocks as $used_block ) {
$style = get_post_meta( $used_block, 'gutentor_dynamic_css', true );
if ( get_post_meta( $used_block, 'gutentor_gfont_url', true ) ) {
$fonts_url = get_post_meta( $used_block, 'gutentor_gfont_url', true );
echo '<link id="gutentor-google-fonts-' . esc_attr( $used_block ) . '" href="' . esc_url( $fonts_url ) . '" rel="stylesheet" />';
}
echo "<!-- Dynamic CSS -->\n<style type=\"text/css\" id='gutentor-used-block-$used_block'>\n" . wp_strip_all_tags( $style ) . "\n</style>";
}
}
}
} // Class Gutentor_WP_Block_Widget ends here
}

View File

@@ -0,0 +1,336 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Advanced_Import' ) ) {
/**
* Advanced Import
*
* @package Gutentor
* @since 1.0.1
*/
class Gutentor_Advanced_Import extends WP_Rest_Controller {
/**
* Rest route namespace.
*
* @var Gutentor_Advanced_Import
*/
public $namespace = 'gutentor-advanced-import/';
/**
* Rest route version.
*
* @var Gutentor_Advanced_Import
*/
public $version = 'v1';
/**
* Initialize the class
*/
public function run() {
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
add_action( 'gutentor_get_template_library', array( $this, 'add_dynamic_library' ) );
}
/**
* Register REST API route
*/
public function register_routes() {
$namespace = $this->namespace . $this->version;
register_rest_route(
$namespace,
'/fetch_templates',
array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array( $this, 'fetch_templates' ),
'permission_callback' => function () {
return current_user_can( 'edit_posts' );
},
'args' => array(
'reset' => array(
'type' => 'boolean',
'required' => false,
'description' => __( 'Reset True or False', 'gutentor' ),
),
),
),
)
);
register_rest_route(
$namespace,
'/import_template',
array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array( $this, 'import_template' ),
'permission_callback' => function () {
return current_user_can( 'edit_posts' );
},
'args' => array(
'url' => array(
'type' => 'string',
'required' => true,
'description' => __( 'URL of the JSON file.', 'gutentor' ),
),
),
),
)
);
}
/**
* Function to delete templates and bock json transient
*
* @since 2.0.9
* @return void
*/
public function delete_transient() {
/*Delete Template Library Transient*/
delete_transient( 'gutentor_get_template_library' );
/*Delete Block Json Transient*/
global $wpdb;
$transients = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '_transient_gutentor_get_block_json_%'" );
if ( $transients ) {
foreach ( $transients as $transient ) {
$transient = preg_replace( '/^_transient_/i', '', $transient );
delete_transient( $transient );
}
}
}
/**
* Function to fetch templates.
*
* @return array|bool|\WP_Error
*/
public function fetch_templates( \WP_REST_Request $request ) {
if ( ! current_user_can( 'edit_posts' ) ) {
return false;
}
if ( $request->get_param( 'reset' ) ) {
$this->delete_transient();
}
$templates_list = get_transient( 'gutentor_get_template_library' );
/*Get/Fetch templates*/
if ( empty( $templates_list ) ) {
if ( ! function_exists( 'run_gutentor_template_library' ) ) {
/*
if gutentor template library is not installed
fetch template library data from live*/
$url = 'https://www.demo.gutentor.com/wp-json/gutentor-tlapi/v1/fetch_templates/';
$body_args = array(
/*API version*/
'api_version' => wp_get_theme()['Version'],
/*lang*/
'site_lang' => get_bloginfo( 'language' ),
);
$raw_json = wp_safe_remote_get(
$url,
array(
'timeout' => 100,
'body' => $body_args,
)
);
if ( ! is_wp_error( $raw_json ) ) {
$demo_server = json_decode( wp_remote_retrieve_body( $raw_json ), true );
if ( json_last_error() === JSON_ERROR_NONE ) {
if ( is_array( $demo_server ) ) {
$templates_list = $demo_server;
}
}
} else {
return rest_ensure_response( $raw_json->get_error_message() );
}
} else {
/*
if gutentor template library is installed
fetch template library data from the plugin gutentor-template-library
special hooks for gutentor-template-library plugin*/
$templates_list = apply_filters( 'gutentor_advanced_import_gutentor_template_library', array() );
}
/*Store on transient*/
$templates_list = apply_filters( 'gutentor_get_template_library', $templates_list );
set_transient( 'gutentor_get_template_library', $templates_list, DAY_IN_SECONDS );
}
$templates = apply_filters( 'gutentor_advanced_import_templates', $templates_list );
return rest_ensure_response( $templates );
}
/**
* Function to fetch template JSON.
*
* @return array|bool|\WP_Error
*/
public function import_template( $request ) {
if ( ! current_user_can( 'edit_posts' ) ) {
return false;
}
$url = $request->get_param( 'url' );
$url_array = explode( '/', $url );
$block_id = $url_array[ count( $url_array ) - 5 ] . '-' . $url_array[ count( $url_array ) - 2 ];
$block_json = get_transient( 'gutentor_get_block_json_' . $block_id );
/*Get/Fetch templates*/
if ( empty( $block_json ) ) {
if ( $url ) {
$body_args = array(
/*API version*/
'api_version' => GUTENTOR_VERSION,
/*lang*/
'site_lang' => get_bloginfo( 'language' ),
);
$raw_json = wp_safe_remote_get(
$url,
array(
'timeout' => 100,
'body' => $body_args,
)
);
if ( ! is_wp_error( $raw_json ) ) {
$block_json = json_decode( wp_remote_retrieve_body( $raw_json ) );
/*Store on transient*/
ob_start();
set_transient( 'gutentor_get_block_json_' . $block_id, $block_json, DAY_IN_SECONDS );
ob_get_clean();
}
}
}
if ( $block_json ) {
return rest_ensure_response( $block_json );
}
return false;
}
/**
* Add Dynamic template
* Reusable blocks
*
* @access public
* @since 2.1.9
* @return array
*/
public function add_dynamic_library( $templates_list ) {
$d_list = array();
/*Reusable*/
$args = array(
'post_type' => 'wp_block',
'posts_per_page' => 100,
);
$the_query = new WP_Query( gutentor_get_query( $args ) );
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) :
$the_query->the_post();
$q_list = array();
$q_list['title'] = get_the_title();
$q_list['post_content'] = get_the_content();
$q_list['type'] = 'reusable';
$q_list['keywords'] = explode( ' ', get_the_title() );
$q_list['categories'] = array( 'reusable' );
$q_list['template_url'] = '';
$q_list['screenshot_url'] = '';
$q_list['demo_url'] = esc_url( get_edit_post_link() );
$d_list[] = $q_list;
endwhile;
endif;
wp_reset_postdata();
/*Patterns*/
if ( class_exists( 'WP_Block_Patterns_Registry' ) ) {
$p_lists = WP_Block_Patterns_Registry::get_instance()->get_all_registered();
if ( $p_lists && is_array( $p_lists ) ) {
foreach ( $p_lists as $p_list ) {
$q_list = array();
$q_list['title'] = $p_list['title'] ? $p_list['title'] : __( 'Untitled', 'gutentor' );
$q_list['post_content'] = $p_list['content'] ? $p_list['content'] : '';
$q_list['type'] = 'pattern';
$q_list['keywords'] = explode( ' ', $q_list['title'] );
$q_list['categories'] = isset( $p_list['categories'] ) ? $p_list['categories'] : array();
$q_list['template_url'] = '';
$q_list['screenshot_url'] = '';
$q_list['demo_url'] = '';
$d_list[] = $q_list;
}
}
}
if ( is_array( $templates_list ) ) {
return array_merge_recursive( $templates_list, $d_list );
}
return $d_list;
}
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 1.0.1
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Throw error on object clone
*
* The whole idea of the singleton design pattern is that there is a single
* object therefore, we don't want the object to be cloned.
*
* @access public
* @since 1.0.0
* @return void
*/
public function __clone() {
// Cloning instances of the class is forbidden.
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'gutentor' ), '1.0.0' );
}
/**
* Disable unserializing of the class
*
* @access public
* @since 1.0.0
* @return void
*/
public function __wakeup() {
// Unserializing instances of the class is forbidden.
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'gutentor' ), '1.0.0' );
}
}
}
Gutentor_Advanced_Import::get_instance()->run();

View File

@@ -0,0 +1,300 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Extend_Api' ) ) {
/**
* Gutentor_Woo
*
* @package Gutentor
* @since 2.1.9
*/
class Gutentor_Extend_Api {
/**
* Gets an instance of this object.
* Prevents duplicate instances which avoid artefacts and improves performance.
*
* @static
* @access public
* @since 2.1.9
* @return object
*/
public static function get_instance() {
// Store the instance locally to avoid private static replication.
static $instance = null;
// Only run these methods if they haven't been ran previously.
if ( null === $instance ) {
$instance = new self();
}
// Always return the instance.
return $instance;
}
/**
* Initialize the class
*/
public function run() {
add_filter( 'gutentor_rest_prepare_data_post', array( $this, 'add_post_comment_data' ), 10, 3 );
add_filter( 'gutentor_rest_prepare_data_page', array( $this, 'add_post_comment_data' ), 10, 3 );
add_filter( 'gutentor_rest_prepare_data_product', array( $this, 'add_product_data' ), 10, 3 );
add_filter( 'gutentor_rest_prepare_data_download', array( $this, 'add_edd_download_data' ), 10, 3 );
add_filter( 'woocommerce_loop_add_to_cart_link', array( $this, 'alter_cart_link' ), 10, 3 );
}
/**
* Add Comment data
*
* @static
* @access public
* @since 2.1.9
* @return array
*/
public function add_post_comment_data( $data, $post, $request ) {
$comments_count = wp_count_comments( $post->ID );
$data['gutentor_comment'] = $comments_count->total_comments;
return $data;
}
/**
* Add new badge on product
*
* @static
* @access public
* @since 2.1.9
* @return string
*/
public function new_badge_product( $class, $post, $product ) {
if ( ! $product ) {
global $product;
}
$newness_days = 30;
$created = strtotime( $product->get_date_created() );
if ( ( time() - ( 60 * 60 * 24 * $newness_days ) ) < $created ) {
return apply_filters( 'gutentor_woocommerce_new_badge', '<span class="' . esc_attr( $class ) . '">' . esc_html__( 'New!', 'gutentor' ) . '</span>', $post, $product );
}
return '';
}
/**
* Add new badge on download
*
* @static
* @access public
* @since 2.1.9
* @return string
*/
public function new_badge_download( $class, $post, $download ) {
if ( ! $download ) {
return '';
}
$newness_days = 30;
$created = strtotime( $download->post_date );
if ( ( time() - ( 60 * 60 * 24 * $newness_days ) ) < $created ) {
return apply_filters( 'gutentor_edd_new_badge', '<span class="' . esc_attr( $class ) . '">' . esc_html__( 'New!', 'gutentor' ) . '</span>', $post, $download );
}
return '';
}
/**
* Add Review
*
* @static
* @access public
* @since 2.1.9
* @return string
*/
public function gutentor_edd_review( $id ) {
$output = '';
// make sure edd reviews is active
if ( ! function_exists( 'edd_reviews' ) ) {
return $output;
}
$edd_reviews = edd_reviews();
if ( ! $edd_reviews ) {
return $output;
}
// get the average rating for this download
$average_rating = $edd_reviews->average_rating( false, $id );
if ( ! $average_rating ) {
return $output;
}
$rating = round( $average_rating * 2 ) / 2;
if ( ! $rating ) {
return $output;
}
$output .= '<div class="edd-review-meta-rating" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">';
for ( $i = 1; $i <= 5; $i++ ) {
if ( $i <= $rating ) {
$output .= '<span class="dashicons dashicons-star-filled"></span>';
} elseif ( $rating < $i && ( strpos( $rating, '.' ) !== false ) ) {
$output .= '<span class="dashicons dashicons-star-half"></span>';
$rating = absint( $rating );
} elseif ( $rating < $i ) {
$output .= '<span class="dashicons dashicons-star-empty"></span>';
}
}
$output .= '<div style="display:none" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">';
$output .= '<meta itemprop="worstRating" content="1" />';
$output .= '<span itemprop="ratingValue">' . esc_html( $rating ) . '</span>';
$output .= '<span itemprop="bestRating">5</span>';
$output .= '</div>';
$output .= '</div>';
return $output;
}
/**
* Add product data on gutentor rest data
*
* @static
* @access public
* @since 2.1.9
* @return array
*/
public function add_product_data( $data, $post, $request ) {
if ( ! gutentor_is_woocommerce_active() ) {
return $data;
}
$product = wc_get_product( $post->ID );
$rating = $product->get_average_rating();
$count = $product->get_rating_count();
$comments_count = wp_count_comments( $post->ID );
$author_id = $post->post_author;
$product_new_badge = 'gutentor-wc-new';
$product_fp_new_badge = 'gutentor-pf-wc-new';
if ( $product->is_on_sale() ) {
$data['product_sales_text'] = apply_filters( 'woocommerce_sale_flash', '<span class="onsale">' . esc_html__( 'Sale!', 'gutentor' ) . '</span>', $post, $product );
}
$data['product_regular_price'] = $product->get_regular_price();
$data['product_sale_price'] = wc_format_sale_price( wc_get_price_to_display( $product, array( 'price' => $product->get_regular_price() ) ), wc_get_price_to_display( $product ) ) . $product->get_price_suffix();
$data['product_price'] = ( $product->get_price() ) ? $product->get_price_html() : 'price-empty';
$data['product_price_empty'] = ( $product->get_price() ) ? 'price-not-empty' : wc_price( '0.00' );
$data['product_cart_label'] = $product->add_to_cart_text();
$data['product_rating_html'] = wc_get_rating_html( $rating, $count );
$data['product_new_badge'] = $this->new_badge_product( $product_new_badge, $post, $product );
$data['product_fp_new_badge'] = $this->new_badge_product( $product_fp_new_badge, $post, $product );
$data['product_author_name'] = get_the_author_meta( 'display_name', $author_id );
$data['product_author_url'] = get_the_author_meta( 'user_url', $author_id );
$data['product_comment'] = $comments_count->total_comments;
$data['product_placeholder_url'] = WC()->plugin_url() . '/assets/images/placeholder.png';
return $data;
}
/**
* Add download data on gutentor rest data
*
* @static
* @access public
* @since 2.1.9
* @return array
*/
public function add_edd_download_data( $data, $post, $request ) {
if ( ! gutentor_is_edd_active() ) {
return $data;
}
$download = edd_get_download( $post->ID );
$comments_count = wp_count_comments( $post->ID );
$author_id = $post->post_author;
$download_new_badge = 'gutentor-edd-new';
$download_fp_new_badge = 'gutentor-fp-edd-new';
// add download $options
$download_args = array(
'download_id' => $post->ID,
'class' => 'g-edd-wl',
'shortcode' => true,
);
$fp_download_args = array(
'download_id' => $post->ID,
'class' => 'gutentor-fp-edd-wish-list',
'shortcode' => true,
);
$output_favourite = $output_fp_favourite = $get_variable_pricing = '';
if ( gutentor_is_edd_favorites_active() ) {
ob_start();
$output_favourite .= edd_favorites_load_link( $post->ID ) . ob_get_clean();
ob_start();
$output_fp_favourite .= edd_favorites_load_link( $post->ID ) . ob_get_clean();
} elseif ( gutentor_is_edd_wishlist_active() ) {
$output_favourite .= edd_wl_wish_list_link( $download_args );
$output_fp_favourite .= edd_wl_wish_list_link( $fp_download_args );
}
if ( edd_has_variable_prices( $post->ID ) ) {
ob_start();
$get_variable_pricing = edd_purchase_variable_pricing( $post->ID ) . ob_get_clean();
}
$data['download_variable_price_html'] = $get_variable_pricing;
$data['download_has_variable_price'] = edd_has_variable_prices( $post->ID ) ? 'variable-price-true' : '';
$data['download_cart_label'] = edd_get_option( 'add_to_cart_text', esc_html__( 'Purchase', 'gutentor' ) );
$data['download_price'] = edd_has_variable_prices( $post->ID ) ? edd_price_range( $post->ID ) : edd_price( $post->ID, false );
$data['download_price_is_empty'] = gutentor_is_edd_has_price( $post->ID );
$data['download_rating_html'] = $this->gutentor_edd_review( $post->ID );
$data['download_wish_list'] = $output_favourite;
$data['download_fp_wish_list'] = $output_fp_favourite;
$data['download_new_badge'] = $this->new_badge_download( $download_new_badge, $post, $download );
$data['download_fp_new_badge'] = $this->new_badge_download( $download_fp_new_badge, $post, $download );
$data['download_author_name'] = get_the_author_meta( 'display_name', $author_id );
$data['download_author_url'] = get_the_author_meta( 'user_url', $author_id );
$data['download_comment'] = $comments_count->total_comments;
$data['download_placeholder_url'] = GUTENTOR_URL . 'assets/img/default-image.jpg';
return $data;
}
/**
* Modify cart html if gutentor-attributes set
*
* @static
* @access public
* @since 2.1.9
* @return string
*/
public function alter_cart_link( $output, $product, $args ) {
$attributes = isset( $args['gutentor-attributes'] ) ? $args['gutentor-attributes'] : false;
$buttonType = isset( $args['gutentor-btn-type'] ) ? $args['gutentor-btn-type'] : false;
if ( ! $attributes ) {
return $output;
}
$icon = '';
if ( $buttonType === 'featured' ) {
$btnClass = isset( $attributes['pFPBtnCName'] ) ? $attributes['pFPBtnCName'] : '';
$default_class = gutentor_concat_space( 'gutentor-button', 'gutentor-post-featured-button', $btnClass );
$icon_options = ( isset( $attributes['pFPBtnIconOpt'] ) ) ? $attributes['pFPBtnIconOpt'] : '';
$icon_position_class = GutentorButtonOptionsClasses( $icon_options );
if ( $icon_position_class == 'gutentor-icon-before' || $icon_position_class == 'gutentor-icon-after' ) {
$icon = ( isset( $attributes['pFPBtnIcon'] ) && $attributes['pFPBtnIcon']['value'] ) ? '<i class="gutentor-button-icon ' . $attributes['pFPBtnIcon']['value'] . '" ></i>' : '';
}
} else {
$btnClass = isset( $attributes['pBtnCName'] ) ? $attributes['pBtnCName'] : '';
$default_class = gutentor_concat_space( 'gutentor-button', 'gutentor-post-button', $btnClass );
$icon_options = ( isset( $attributes['pBtnIconOpt'] ) ) ? $attributes['pBtnIconOpt'] : '';
$icon_position_class = GutentorButtonOptionsClasses( $icon_options );
if ( $icon_position_class == 'gutentor-icon-before' || $icon_position_class == 'gutentor-icon-after' ) {
$icon = ( isset( $attributes['pBtnIcon'] ) && $attributes['pBtnIcon']['value'] ) ? '<i class="gutentor-button-icon ' . $attributes['pBtnIcon']['value'] . '" ></i>' : '';
}
}
$woo_class = esc_attr( isset( $args['class'] ) ? $args['class'] : 'button' );
$output = '<a href="' . esc_url( $product->add_to_cart_url() ) . '" data-quantity="' . esc_attr( isset( $args['quantity'] ) ? $args['quantity'] : 1 ) . '"
class="' . gutentor_concat_space( $default_class, $woo_class, GutentorButtonOptionsClasses( $icon_options ) ) . '" ' . ( isset( $args['attributes'] ) ? wc_implode_html_attributes( $args['attributes'] ) : '' ) . '>
' . $icon . '<span>' . esc_html( $product->add_to_cart_text() ) . '</span></a>';
return $output;
}
}
}
Gutentor_Extend_Api::get_instance()->run();

Some files were not shown because too many files have changed in this diff Show More