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,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();

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,812 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Template_Info' ) ) {
/**
* Gutentor Template Info
* Copy of wp-includes\template-loader.php, wp-includes\template.php files and locate_block_template function
* to retrive template info
* If we can directly get currently template info, we may delete this file
*
* @package Gutentor
* @since 3.1.9
*/
class Gutentor_Template_Info {
/*
wp-includes\template-loader.php
*/
public function get_template_info() {
$tag_templates = array(
'is_embed' => 'get_embed_template',
'is_404' => 'get_404_template',
'is_search' => 'get_search_template',
'is_front_page' => 'get_front_page_template',
'is_home' => 'get_home_template',
'is_privacy_policy' => 'get_privacy_policy_template',
'is_post_type_archive' => 'get_post_type_archive_template',
'is_tax' => 'get_taxonomy_template',
'is_attachment' => 'get_attachment_template',
'is_single' => 'get_single_template',
'is_page' => 'get_page_template',
'is_singular' => 'get_singular_template',
'is_category' => 'get_category_template',
'is_tag' => 'get_tag_template',
'is_author' => 'get_author_template',
'is_date' => 'get_date_template',
'is_archive' => 'get_archive_template',
);
$template = false;
// Loop through each of the template conditionals, and find the appropriate template file.
foreach ( $tag_templates as $tag => $template_getter ) {
if ( call_user_func( $tag ) ) {
if ( method_exists( $this, $template_getter ) ) {
$template = $this->$template_getter();
}
}
if ( $template ) {
break;
}
}
if ( ! $template ) {
$template = $this->get_index_template();
}
return $template;
}
/**
* Find a block template with equal or higher specificity than a given PHP template file.
*
* Internally, this communicates the block content that needs to be used by the template canvas through a global variable.
*
* @since 5.8.0
*
* @global string $_wp_current_template_content
*
* @param string $template Path to the template. See locate_template().
* @param string $type Sanitized filename without extension.
* @param string[] $templates A list of template candidates, in descending order of priority.
* @return WP_Block_Template|null template A template object, or null if none could be found.
*/
function locate_block_template( $template, $type, array $templates ) {
if ( $template ) {
/*
* locate_template() has found a PHP template at the path specified by $template.
* That means that we have a fallback candidate if we cannot find a block template
* with higher specificity.
*
* Thus, before looking for matching block themes, we shorten our list of candidate
* templates accordingly.
*/
// Locate the index of $template (without the theme directory path) in $templates.
$relative_template_path = str_replace(
array( get_stylesheet_directory() . '/', get_template_directory() . '/' ),
'',
$template
);
$index = array_search( $relative_template_path, $templates, true );
// If the template hiearchy algorithm has successfully located a PHP template file,
// we will only consider block templates with higher or equal specificity.
$templates = array_slice( $templates, 0, $index + 1 );
}
return resolve_block_template( $type, $templates, $template );
}
/**
* Retrieve path to a template
*
* Used to quickly retrieve the path of a template without including the file
* extension. It will also check the parent theme, if the file exists, with
* the use of locate_template(). Allows for more generic template location
* without the use of the other get_*_template() functions.
*
* @since 1.5.0
*
* @param string $type Filename without extension.
* @param string[] $templates An optional list of template candidates.
* @return WP_Block_Template|null template A template object, or null if none could be found.
*/
function get_query_template( $type, $templates = array() ) {
$type = preg_replace( '|[^a-z0-9-]+|', '', $type );
if ( empty( $templates ) ) {
$templates = array( "{$type}.php" );
}
/**
* Filters the list of template filenames that are searched for when retrieving a template to use.
*
* The dynamic portion of the hook name, `$type`, refers to the filename -- minus the file
* extension and any non-alphanumeric characters delimiting words -- of the file to load.
* The last element in the array should always be the fallback template for this query type.
*
* Possible hook names include:
*
* - `404_template_hierarchy`
* - `archive_template_hierarchy`
* - `attachment_template_hierarchy`
* - `author_template_hierarchy`
* - `category_template_hierarchy`
* - `date_template_hierarchy`
* - `embed_template_hierarchy`
* - `frontpage_template_hierarchy`
* - `home_template_hierarchy`
* - `index_template_hierarchy`
* - `page_template_hierarchy`
* - `paged_template_hierarchy`
* - `privacypolicy_template_hierarchy`
* - `search_template_hierarchy`
* - `single_template_hierarchy`
* - `singular_template_hierarchy`
* - `tag_template_hierarchy`
* - `taxonomy_template_hierarchy`
*
* @since 4.7.0
*
* @param string[] $templates A list of template candidates, in descending order of priority.
*/
$templates = apply_filters( "{$type}_template_hierarchy", $templates );
$template = locate_template( $templates );
return $this->locate_block_template( $template, $type, $templates );
}
/**
* Retrieve path of index template in current or parent template.
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'index'.
*
* @since 3.0.0
*
* @see $this->get_query_template()
*
* @return WP_Block_Template|null template A template object, or null if none could be found.
*/
function get_index_template() {
return $this->get_query_template( 'index' );
}
/**
* Retrieve path of 404 template in current or parent template.
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is '404'.
*
* @since 1.5.0
*
* @see $this->get_query_template()
*
* @return WP_Block_Template|null template A template object, or null if none could be found.
*/
function get_404_template() {
return $this->get_query_template( '404' );
}
/**
* Retrieve path of archive template in current or parent template.
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'archive'.
*
* @since 1.5.0
*
* @see $this->get_query_template()
*
* @return WP_Block_Template|null template A template object, or null if none could be found.
*/
function get_archive_template() {
$post_types = array_filter( (array) get_query_var( 'post_type' ) );
$templates = array();
if ( count( $post_types ) == 1 ) {
$post_type = reset( $post_types );
$templates[] = "archive-{$post_type}.php";
}
$templates[] = 'archive.php';
return $this->get_query_template( 'archive', $templates );
}
/**
* Retrieve path of post type archive template in current or parent template.
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'archive'.
*
* @since 3.7.0
*
* @see get_archive_template()
*
* @return string Full path to archive template file.
*/
function get_post_type_archive_template() {
$post_type = get_query_var( 'post_type' );
if ( is_array( $post_type ) ) {
$post_type = reset( $post_type );
}
$obj = get_post_type_object( $post_type );
if ( ! ( $obj instanceof WP_Post_Type ) || ! $obj->has_archive ) {
return '';
}
return get_archive_template();
}
/**
* Retrieve path of author template in current or parent template.
*
* The hierarchy for this template looks like:
*
* 1. author-{nicename}.php
* 2. author-{id}.php
* 3. author.php
*
* An example of this is:
*
* 1. author-john.php
* 2. author-1.php
* 3. author.php
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'author'.
*
* @since 1.5.0
*
* @see $this->get_query_template()
*
* @return WP_Block_Template|null template A template object, or null if none could be found.
*/
function get_author_template() {
$author = get_queried_object();
$templates = array();
if ( $author instanceof WP_User ) {
$templates[] = "author-{$author->user_nicename}.php";
$templates[] = "author-{$author->ID}.php";
}
$templates[] = 'author.php';
return $this->get_query_template( 'author', $templates );
}
/**
* Retrieve path of category template in current or parent template.
*
* The hierarchy for this template looks like:
*
* 1. category-{slug}.php
* 2. category-{id}.php
* 3. category.php
*
* An example of this is:
*
* 1. category-news.php
* 2. category-2.php
* 3. category.php
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'category'.
*
* @since 1.5.0
* @since 4.7.0 The decoded form of `category-{slug}.php` was added to the top of the
* template hierarchy when the category slug contains multibyte characters.
*
* @see $this->get_query_template()
*
* @return object Full path to category template file.
*/
function get_category_template() {
$category = get_queried_object();
$templates = array();
if ( ! empty( $category->slug ) ) {
$slug_decoded = urldecode( $category->slug );
if ( $slug_decoded !== $category->slug ) {
$templates[] = "category-{$slug_decoded}.php";
}
$templates[] = "category-{$category->slug}.php";
$templates[] = "category-{$category->term_id}.php";
}
$templates[] = 'category.php';
return $this->get_query_template( 'category', $templates );
}
/**
* Retrieve path of tag template in current or parent template.
*
* The hierarchy for this template looks like:
*
* 1. tag-{slug}.php
* 2. tag-{id}.php
* 3. tag.php
*
* An example of this is:
*
* 1. tag-wordpress.php
* 2. tag-3.php
* 3. tag.php
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'tag'.
*
* @since 2.3.0
* @since 4.7.0 The decoded form of `tag-{slug}.php` was added to the top of the
* template hierarchy when the tag slug contains multibyte characters.
*
* @see $this->get_query_template()
*
* @return object Full path to tag template file.
*/
function get_tag_template() {
$tag = get_queried_object();
$templates = array();
if ( ! empty( $tag->slug ) ) {
$slug_decoded = urldecode( $tag->slug );
if ( $slug_decoded !== $tag->slug ) {
$templates[] = "tag-{$slug_decoded}.php";
}
$templates[] = "tag-{$tag->slug}.php";
$templates[] = "tag-{$tag->term_id}.php";
}
$templates[] = 'tag.php';
return $this->get_query_template( 'tag', $templates );
}
/**
* Retrieve path of custom taxonomy term template in current or parent template.
*
* The hierarchy for this template looks like:
*
* 1. taxonomy-{taxonomy_slug}-{term_slug}.php
* 2. taxonomy-{taxonomy_slug}.php
* 3. taxonomy.php
*
* An example of this is:
*
* 1. taxonomy-location-texas.php
* 2. taxonomy-location.php
* 3. taxonomy.php
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'taxonomy'.
*
* @since 2.5.0
* @since 4.7.0 The decoded form of `taxonomy-{taxonomy_slug}-{term_slug}.php` was added to the top of the
* template hierarchy when the term slug contains multibyte characters.
*
* @see $this->get_query_template()
*
* @return object Full path to custom taxonomy term template file.
*/
function get_taxonomy_template() {
$term = get_queried_object();
$templates = array();
if ( ! empty( $term->slug ) ) {
$taxonomy = $term->taxonomy;
$slug_decoded = urldecode( $term->slug );
if ( $slug_decoded !== $term->slug ) {
$templates[] = "taxonomy-$taxonomy-{$slug_decoded}.php";
}
$templates[] = "taxonomy-$taxonomy-{$term->slug}.php";
$templates[] = "taxonomy-$taxonomy.php";
}
$templates[] = 'taxonomy.php';
return $this->get_query_template( 'taxonomy', $templates );
}
/**
* Retrieve path of date template in current or parent template.
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'date'.
*
* @since 1.5.0
*
* @see $this->get_query_template()
*
* @return object Full path to date template file.
*/
function get_date_template() {
return $this->get_query_template( 'date' );
}
/**
* Retrieve path of home template in current or parent template.
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'home'.
*
* @since 1.5.0
*
* @see $this->get_query_template()
*
* @return object Full path to home template file.
*/
function get_home_template() {
$templates = array( 'home.php', 'index.php' );
return $this->get_query_template( 'home', $templates );
}
/**
* Retrieve path of front page template in current or parent template.
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'frontpage'.
*
* @since 3.0.0
*
* @see $this->get_query_template()
*
* @return object Full path to front page template file.
*/
function get_front_page_template() {
$templates = array( 'front-page.php' );
return $this->get_query_template( 'frontpage', $templates );
}
/**
* Retrieve path of Privacy Policy page template in current or parent template.
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'privacypolicy'.
*
* @since 5.2.0
*
* @see $this->get_query_template()
*
* @return object Full path to privacy policy template file.
*/
function get_privacy_policy_template() {
$templates = array( 'privacy-policy.php' );
return $this->get_query_template( 'privacypolicy', $templates );
}
/**
* Retrieve path of page template in current or parent template.
*
* The hierarchy for this template looks like:
*
* 1. {Page Template}.php
* 2. page-{page_name}.php
* 3. page-{id}.php
* 4. page.php
*
* An example of this is:
*
* 1. page-templates/full-width.php
* 2. page-about.php
* 3. page-4.php
* 4. page.php
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'page'.
*
* @since 1.5.0
* @since 4.7.0 The decoded form of `page-{page_name}.php` was added to the top of the
* template hierarchy when the page name contains multibyte characters.
*
* @see $this->get_query_template()
*
* @return object Full path to page template file.
*/
function get_page_template() {
$id = get_queried_object_id();
$template = get_page_template_slug();
$pagename = get_query_var( 'pagename' );
if ( ! $pagename && $id ) {
// If a static page is set as the front page, $pagename will not be set.
// Retrieve it from the queried object.
$post = get_queried_object();
if ( $post ) {
$pagename = $post->post_name;
}
}
$templates = array();
if ( $template && 0 === validate_file( $template ) ) {
$templates[] = $template;
}
if ( $pagename ) {
$pagename_decoded = urldecode( $pagename );
if ( $pagename_decoded !== $pagename ) {
$templates[] = "page-{$pagename_decoded}.php";
}
$templates[] = "page-{$pagename}.php";
}
if ( $id ) {
$templates[] = "page-{$id}.php";
}
$templates[] = 'page.php';
return $this->get_query_template( 'page', $templates );
}
/**
* Retrieve path of search template in current or parent template.
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'search'.
*
* @since 1.5.0
*
* @see $this->get_query_template()
*
* @return object Full path to search template file.
*/
function get_search_template() {
return $this->get_query_template( 'search' );
}
/**
* Retrieve path of single template in current or parent template. Applies to single Posts,
* single Attachments, and single custom post types.
*
* The hierarchy for this template looks like:
*
* 1. {Post Type Template}.php
* 2. single-{post_type}-{post_name}.php
* 3. single-{post_type}.php
* 4. single.php
*
* An example of this is:
*
* 1. templates/full-width.php
* 2. single-post-hello-world.php
* 3. single-post.php
* 4. single.php
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'single'.
*
* @since 1.5.0
* @since 4.4.0 `single-{post_type}-{post_name}.php` was added to the top of the template hierarchy.
* @since 4.7.0 The decoded form of `single-{post_type}-{post_name}.php` was added to the top of the
* template hierarchy when the post name contains multibyte characters.
* @since 4.7.0 `{Post Type Template}.php` was added to the top of the template hierarchy.
*
* @see $this->get_query_template()
*
* @return object Full path to single template file.
*/
function get_single_template() {
$object = get_queried_object();
$templates = array();
if ( ! empty( $object->post_type ) ) {
$template = get_page_template_slug( $object );
if ( $template && 0 === validate_file( $template ) ) {
$templates[] = $template;
}
$name_decoded = urldecode( $object->post_name );
if ( $name_decoded !== $object->post_name ) {
$templates[] = "single-{$object->post_type}-{$name_decoded}.php";
}
$templates[] = "single-{$object->post_type}-{$object->post_name}.php";
$templates[] = "single-{$object->post_type}.php";
}
$templates[] = 'single.php';
return $this->get_query_template( 'single', $templates );
}
/**
* Retrieves an embed template path in the current or parent template.
*
* The hierarchy for this template looks like:
*
* 1. embed-{post_type}-{post_format}.php
* 2. embed-{post_type}.php
* 3. embed.php
*
* An example of this is:
*
* 1. embed-post-audio.php
* 2. embed-post.php
* 3. embed.php
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'embed'.
*
* @since 4.5.0
*
* @see $this->get_query_template()
*
* @return object Full path to embed template file.
*/
function get_embed_template() {
$object = get_queried_object();
$templates = array();
if ( ! empty( $object->post_type ) ) {
$post_format = get_post_format( $object );
if ( $post_format ) {
$templates[] = "embed-{$object->post_type}-{$post_format}.php";
}
$templates[] = "embed-{$object->post_type}.php";
}
$templates[] = 'embed.php';
return $this->get_query_template( 'embed', $templates );
}
/**
* Retrieves the path of the singular template in current or parent template.
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'singular'.
*
* @since 4.3.0
*
* @see $this->get_query_template()
*
* @return object Full path to singular template file
*/
function get_singular_template() {
return $this->get_query_template( 'singular' );
}
/**
* Retrieve path of attachment template in current or parent template.
*
* The hierarchy for this template looks like:
*
* 1. {mime_type}-{sub_type}.php
* 2. {sub_type}.php
* 3. {mime_type}.php
* 4. attachment.php
*
* An example of this is:
*
* 1. image-jpeg.php
* 2. jpeg.php
* 3. image.php
* 4. attachment.php
*
* The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'}
* and {@see '$type_template'} dynamic hooks, where `$type` is 'attachment'.
*
* @since 2.0.0
* @since 4.3.0 The order of the mime type logic was reversed so the hierarchy is more logical.
*
* @see $this->get_query_template()
*
* @global array $posts
*
* @return object Full path to attachment template file.
*/
function get_attachment_template() {
$attachment = get_queried_object();
$templates = array();
if ( $attachment ) {
if ( false !== strpos( $attachment->post_mime_type, '/' ) ) {
list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
} else {
list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
}
if ( ! empty( $subtype ) ) {
$templates[] = "{$type}-{$subtype}.php";
$templates[] = "{$subtype}.php";
}
$templates[] = "{$type}.php";
}
$templates[] = 'attachment.php';
return $this->get_query_template( 'attachment', $templates );
}
/*
wp-includes\template-loader.php
*/
public function get_template_part_info( $attributes ) {
$template_part_query = new WP_Query(
gutentor_get_query(
array(
'post_type' => 'wp_template_part',
'post_status' => 'publish',
'post_name__in' => array( $attributes['slug'] ),
'tax_query' => array(
array(
'taxonomy' => 'wp_theme',
'field' => 'slug',
'terms' => $attributes['theme'],
),
),
'posts_per_page' => 1,
'no_found_rows' => true,
)
)
);
return $template_part_query->have_posts() ? $template_part_query->next_post() : null;
}
/**
* 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' );
}
}
}

View File

@@ -0,0 +1,312 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Gutentor_Templateberg' ) ) {
/**
* Advanced Import
*
* @package Gutentor
* @since 1.0.1
*/
class Gutentor_Templateberg extends WP_Rest_Controller {
/**
* Rest route namespace.
*
* @var Gutentor_Templateberg
*/
public $namespace = 'gutentor-advanced-import/';
/**
* Rest route version.
*
* @var Gutentor_Templateberg
*/
public $version = 'v1';
/**
* Initialize the class
*/
public function run() {
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
}
/**
* Register REST API route
*/
public function register_routes() {
$namespace = $this->namespace . $this->version;
register_rest_route(
$namespace,
'/tb_sure_do_condition',
array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array( $this, 'tb_sure_do_condition' ),
'permission_callback' => function () {
return current_user_can( 'edit_posts' );
},
'args' => array(
'reset' => array(
'type' => 'boolean',
'required' => false,
'description' => __( 'Reset True or False', 'gutentor' ),
),
),
),
)
);
}
/**
* Install Gutentor
* return void
*/
public function install_templateberg() {
$slug = 'templateberg';
$plugin = 'templateberg/templateberg.php';
$status = array(
'install' => 'plugin',
'slug' => sanitize_key( wp_unslash( $slug ) ),
);
/*prevent gutentor to redirect*/
update_option( '__templateberg_do_redirect', false );
require_once ABSPATH . 'wp-admin/includes/file.php';
include_once ABSPATH . 'wp-admin/includes/plugin.php';
if ( is_plugin_active_for_network( $plugin ) || is_plugin_active( $plugin ) ) {
// Plugin is activated.
return $status;
}
if ( ! current_user_can( 'install_plugins' ) ) {
$status['errorMessage'] = __( 'Sorry, you are not allowed to install plugins on this site.', 'gutentor' );
return $status;
}
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
// Looks like a plugin is installed, but not active.
if ( file_exists( WP_PLUGIN_DIR . '/' . $slug ) ) {
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
$status['plugin'] = $plugin;
$status['pluginName'] = $plugin_data['Name'];
if ( current_user_can( 'activate_plugin', $plugin ) && is_plugin_inactive( $plugin ) ) {
$result = activate_plugin( $plugin );
if ( is_wp_error( $result ) ) {
$status['errorCode'] = $result->get_error_code();
$status['errorMessage'] = $result->get_error_message();
return $status;
}
return $status;
}
}
$api = plugins_api(
'plugin_information',
array(
'slug' => sanitize_key( wp_unslash( $slug ) ),
'fields' => array(
'sections' => false,
),
)
);
if ( is_wp_error( $api ) ) {
$status['errorMessage'] = $api->get_error_message();
return $status;
}
$status['pluginName'] = $api->name;
$skin = new WP_Ajax_Upgrader_Skin();
$upgrader = new Plugin_Upgrader( $skin );
$result = $upgrader->install( $api->download_link );
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
$status['debug'] = $skin->get_upgrade_messages();
}
if ( is_wp_error( $result ) ) {
$status['errorCode'] = $result->get_error_code();
$status['errorMessage'] = $result->get_error_message();
return $status;
} elseif ( is_wp_error( $skin->result ) ) {
$status['errorCode'] = $skin->result->get_error_code();
$status['errorMessage'] = $skin->result->get_error_message();
return $status;
} elseif ( $skin->get_errors()->get_error_code() ) {
$status['errorMessage'] = $skin->get_error_messages();
return $status;
} elseif ( is_null( $result ) ) {
require_once ABSPATH . 'wp-admin/includes/file.php';
WP_Filesystem();
global $wp_filesystem;
$status['errorCode'] = 'unable_to_connect_to_filesystem';
$status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.', 'gutentor' );
// Pass through the error from WP_Filesystem if one was raised.
if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
$status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() );
}
return $status;
}
$install_status = install_plugin_install_status( $api );
if ( current_user_can( 'activate_plugin', $install_status['file'] ) && is_plugin_inactive( $install_status['file'] ) ) {
$result = activate_plugin( $install_status['file'] );
if ( is_wp_error( $result ) ) {
$status['errorCode'] = $result->get_error_code();
$status['errorMessage'] = $result->get_error_message();
return $status;
}
}
return $status;
}
/**
* Function to get notification date
*
* @since 3.0.8
* @return string Date Time.
*/
public function get_notification_calendar() {
return get_user_meta( get_current_user_id(), 'gutentor_templateberg_notice_calendar', true );
}
/**
* Check if we can show notification
*
* @since 3.0.8
* @return boolean condition
*/
public function can_show_notification() {
if ( gutentor_is_templateberg_active() && gutentor_templateberg_has_account() && ! gutentor_setting_enable_template_library() ) {
return false;
}
$icalendar = $this->get_notification_calendar();
/**
* Return from notice display if:
* 5 days
* 1. If the user has ignored the message partially for 15 days.
*/
if ( $icalendar > strtotime( '-5 day' ) ) {
return false;
}
return true;
}
/**
* Function to set Purchase info
*
* @since 1.0.0
* @param WP_REST_Request $request Full details about the request.
* @return bool|WP_REST_Response.
*/
public function tb_sure_do_condition( \WP_REST_Request $request ) {
$output = false;
if ( ! current_user_can( 'edit_posts' ) ) {
return false;
}
if ( $request->get_param( 'condition' ) ) {
$condition = sanitize_text_field( $request->get_param( 'condition' ) );
switch ( $condition ) {
case 'maybe':
$output = update_user_meta( get_current_user_id(), 'gutentor_templateberg_notice_calendar', time() );
break;
case 'active':
$output = $this->install_templateberg();
break;
case 'account':
$output = admin_url( 'admin.php?page=templateberg' );
break;
case 'gutentor':
case 'refresh':
if ( gutentor_is_templateberg_active() && gutentor_templateberg_has_account() ) {
$options = gutentor_get_options();
$options['enable-import-block'] = false;
update_option( 'gutentor_settings_options', $options );
}
$output = gutentor_get_options();
break;
}
}
return rest_ensure_response( $output );
}
/**
* 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' );
}
}
}
/**
* Begins execution of the hooks.
*
* @since 1.0.0
*/
function gutentor_templateberg() {
return Gutentor_Templateberg::get_instance();
}
gutentor_templateberg()->run();