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,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>";