Commit inicial - WordPress Análisis de Precios Unitarios

- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-03 21:04:30 -06:00
commit a22573bf0b
24068 changed files with 4993111 additions and 0 deletions

View File

@@ -0,0 +1,404 @@
<?php
/**
* Created by PhpStorm.
* User: Ovidiu
* Date: 3/6/2017
* Time: 1:58 PM
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden
}
class TCB_Admin_Ajax {
const ACTION = 'tcb_admin_ajax_controller';
const NONCE = 'tcb_admin_ajax_request';
/**
* Init the object, during the AJAX request. Adds ajax handlers and verifies nonces
*/
public function init() {
add_action( 'wp_ajax_' . self::ACTION, [ $this, 'handle' ] );
}
/**
* Sets the request's header with server protocol and status
* Sets the request's body with specified $message
*
* @param string $message the error message.
* @param string $status the error status.
*/
protected function error( $message, $status = '404 Not Found' ) {
header( $_SERVER['SERVER_PROTOCOL'] . ' ' . $status ); //phpcs:ignore
echo esc_attr( $message );
wp_die();
}
/**
* Returns the params from $_POST or $_REQUEST
*
* @param int $key the parameter kew.
* @param null $default the default value.
*
* @return mixed|null|$default
*/
protected function param( $key, $default = null ) {
return isset( $_POST[ $key ] ) ? map_deep( $_POST[ $key ], 'sanitize_text_field' ) : ( isset( $_REQUEST[ $key ] ) ? map_deep( $_REQUEST[ $key ], 'sanitize_text_field' ) : $default );
}
/**
* Entry-point for each ajax request
* This should dispatch the request to the appropriate method based on the "route" parameter
*
* @return array|object
*/
public function handle() {
if ( ! check_ajax_referer( self::NONCE, '_nonce', false ) ) {
$this->error( sprintf( __( 'Invalid request.', 'thrive-cb' ) ) );
}
$route = $this->param( 'route' );
$route = preg_replace( '#([^a-zA-Z0-9-_])#', '', $route );
$method_name = $route . '_action';
if ( ! method_exists( $this, $method_name ) ) {
$this->error( sprintf( __( 'Method %s not implemented', 'thrive-cb' ), $method_name ) );
}
wp_send_json( $this->{$method_name}() );
}
/**
* Returns the templates grouped by category.
*
* Retrieves the templates and categories
*
* //todo transform into a rest route
* //todo return separately, not grouped, and do the rest in JS ( skip the complex processing logic )
*
* @return array
*/
public function templates_fetch_action() {
$templates_grouped_by_categories = [];
$method = empty( $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] ) ? 'GET' : sanitize_text_field( $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] );
switch ( $method ) {
case 'GET':
$templates = TCB\UserTemplates\Template::localize();
$templates = array_map( static function ( $template ) {
$template['name'] = $template['label'];
unset( $template['label'] );
return $template;
}, $templates );
$templates = array_reverse( $templates );
if ( $search = $this->param( 'search' ) ) {
$templates = tcb_filter_templates( $templates, $search );
}
$categories = TCB\UserTemplates\Category::get_all();
/* todo: this next section has to be refactored (see function comments), for now it has to stay like this in order to avoid having to rewrite the JS */
$templates_for_category = tcb_admin_get_category_templates( $templates );
foreach ( $categories as $category ) {
/* @var \TCB\UserTemplates\Category */
$category_instance = \TCB\UserTemplates\Category::get_instance_with_id( $category['id'] );
if ( empty( $category_instance->get_meta( 'type' ) ) ) {
$templates_grouped_by_categories[] = [
'id' => $category['id'],
'name' => $category['name'],
'tpl' => empty( $templates_for_category[ $category['id'] ] ) ? [] : $templates_for_category[ $category['id'] ],
];
}
}
$templates_grouped_by_categories[] = [
'id' => 'uncategorized',
'name' => __( 'Uncategorized templates', 'thrive-cb' ),
'tpl' => empty( $templates_for_category['uncategorized'] ) ? [] : $templates_for_category['uncategorized'],
];
$page_template_identifier = \TCB\UserTemplates\Category::PAGE_TEMPLATE_IDENTIFIER;
$templates_grouped_by_categories[] = [
'id' => $page_template_identifier,
'name' => __( 'Page Templates', 'thrive-cb' ),
'tpl' => empty( $templates_for_category[ $page_template_identifier ] ) ? [] : $templates_for_category[ $page_template_identifier ],
];
break;
case 'POST':
case 'PUT':
case 'PATCH':
case 'DELETE':
$this->error( __( 'Invalid call', 'thrive-cb' ) );
break;
default:
break;
}
return $templates_grouped_by_categories;
}
/**
* Category rename and category delete
*
* //todo transform into a rest route
*
* @return array
*/
public function template_category_model_action() {
$model = json_decode( file_get_contents( 'php://input' ), true );
$method = empty( $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] ) ? 'GET' : sanitize_text_field( $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] );
$response = [];
switch ( $method ) {
case 'POST':
case 'PUT':
case 'PATCH':
$categories = TCB\UserTemplates\Category::get_all();
if ( empty( $categories ) ) {
$this->error( __( 'The template category list is empty!', 'thrive-cb' ) );
break;
}
if ( ! is_numeric( $model['id'] ) || empty( $model['name'] ) ) {
$this->error( __( 'Invalid parameters', 'thrive-cb' ) );
break;
}
/* @var TCB\UserTemplates\Category $category_instance */
$category_instance = TCB\UserTemplates\Category::get_instance_with_id( $model['id'] );
$category_instance->rename( $model['name'] );
$response = [
'text' => __( 'The category name was modified!', 'thrive-cb' ),
];
break;
case 'DELETE':
$id = $this->param( 'id', '' );
if ( ! is_numeric( $id ) ) {
$this->error( __( 'Undefined parameter: id', 'thrive-cb' ) );
break;
}
$templates = TCB\UserTemplates\Template::get_all();
// Move existing templates belonging to the deleted category to uncategorized
$templates_grouped_by_category = tcb_admin_get_category_templates( $templates );
if ( ! empty( $templates_grouped_by_category[ $id ] ) ) {
foreach ( $templates_grouped_by_category[ $id ] as $template ) {
if ( isset( $template['id_category'] ) && (int) $template['id_category'] === (int) $id ) {
/* @var \TCB\UserTemplates\Template $template_instance */
$template_instance = TCB\UserTemplates\Template::get_instance_with_id( $template['id'] );
if ( empty( $_POST['extra_setting_check'] ) ) {
$template_instance->update( [ 'id_category' => '' ] );
} else {
$template_instance->delete();
}
}
}
}
/* @var TCB\UserTemplates\Category $category_instance */
$category_instance = TCB\UserTemplates\Category::get_instance_with_id( $id );
$category_instance->delete();
$response = [
'text' => __( 'The category was deleted!', 'thrive-cb' ),
];
break;
case 'GET':
$this->error( __( 'Invalid call', 'thrive-cb' ) );
break;
default:
break;
}
return $response;
}
/**
* Template Category action callback
*
* Strictly for adding new categories
* //todo transform into a rest route
*
* @return array
*/
public function template_category_action() {
$model = json_decode( file_get_contents( 'php://input' ), true );
$method = empty( $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] ) ? 'GET' : sanitize_text_field( $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] );
$response = [];
switch ( $method ) {
case 'POST':
case 'PUT':
case 'PATCH':
if ( empty( $model['category'] ) ) {
$this->error( __( 'Category parameter could not be found!', 'thrive-cb' ) );
break;
}
/* multiple categories can be saved at the same time....for some reason */
foreach ( $model['category'] as $category ) {
TCB\UserTemplates\Category::add( $category );
}
$response = [
'text' => __( 'The category was saved!', 'thrive-cb' ),
];
break;
case 'DELETE':
case 'GET':
$this->error( __( 'Invalid call', 'thrive-cb' ) );
break;
default:
break;
}
return $response;
}
/**
* Template update - name and category
* Template delete
* Template preview
*
* //todo change to rest routes
*
* @return array
*/
public function template_action() {
$model = json_decode( file_get_contents( 'php://input' ), true );
$method = empty( $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] ) ? 'GET' : sanitize_text_field( $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] );
$response = [];
switch ( $method ) {
case 'POST':
case 'PUT':
case 'PATCH':
if ( empty( $model['id'] ) || empty( $model['name'] ) ) {
$this->error( __( 'Invalid parameters', 'thrive-cb' ) );
break;
}
$data_to_update = [
'name' => $model['name'],
];
if ( isset( $model['id_category'] ) ) {
$data_to_update['id_category'] = $model['id_category'];
}
/* @var \TCB\UserTemplates\Template $template_instance */
$template_instance = \TCB\UserTemplates\Template::get_instance_with_id( $model['id'] );
$template_instance->update( $data_to_update );
$response = [ 'text' => __( 'The template saved!', 'thrive-cb' ) ];
break;
case 'DELETE':
$id = $this->param( 'id', '' );
/* @var \TCB\UserTemplates\Template $template_instance */
$template_instance = \TCB\UserTemplates\Template::get_instance_with_id( $id );
$template_instance->delete();
$response = [ 'text' => __( 'The template was deleted!', 'thrive-cb' ) ];
break;
/* template preview */
case 'GET':
$id = $this->param( 'id', '' );
if ( ! is_numeric( $id ) ) {
$this->error( __( 'Undefined parameter: id', 'thrive-cb' ) );
break;
}
/* @var \TCB\UserTemplates\Template $template_instance */
$template_instance = \TCB\UserTemplates\Template::get_instance_with_id( $id );
$response = $template_instance->get();
if ( empty( $response['thumb'] ) ) {
$response['thumb'] = [
'url' => '',
'w' => '',
'h' => '',
];
}
if ( empty( $response['thumb']['url'] ) ) {
$response['thumb']['url'] = TCB_Utils::get_placeholder_url();
}
break;
default:
break;
}
return $response;
}
/**
* upgrade the post_meta key for a post marking it as "migrated" to TCB2.0
* Takes care of 2 things:
* appends wordpress content at the end of tcb content, saves that into the TCB content
* and
* updates the post_content field to a text and images version of all the content
*/
public function migrate_post_content_action() {
$post_id = $this->param( 'post_id' );
$post = tcb_post( $post_id );
$post->migrate();
return [ 'success' => true ];
}
/**
* Enables the TCB-only editor for a post
*/
public function enable_tcb_action() {
tcb_post( $this->param( 'post_id' ) )->enable_editor();
return [ 'success' => true ];
}
/**
* Disable the TCB-only editor for a post
*/
public function disable_tcb_action() {
tcb_post( $this->param( 'post_id' ) )->disable_editor();
return [ 'success' => true ];
}
/**
* Change post status created by Gutenberg so Architect can open it
*/
public function change_post_status_gutenberg_action() {
if ( get_post_status( $this->param( 'post_id' ) ) === 'auto-draft' ) {
$post = array(
'ID' => $this->param( 'post_id' ),
'post_status' => 'draft',
);
wp_update_post( $post );
}
return [ 'success' => true ];
}
}
$tcb_admin_ajax = new TCB_Admin_Ajax();
$tcb_admin_ajax->init();

View File

@@ -0,0 +1,140 @@
<?php
/**
* Created by PhpStorm.
* User: Danut
* Date: 12/9/2015
* Time: 12:21 PM
*/
class TCB_Product extends TVE_Dash_Product_Abstract {
protected $tag = 'tcb';
protected $version = TVE_VERSION;
protected $slug = 'thrive-visual-editor';
protected $title = 'Thrive Architect';
protected $productIds = [];
protected $type = 'plugin';
protected $needs_architect = true;
/**
* Whether or not the current user can open the architect editor based on the current request
* e.g.
* editing a TL form and having TL access
* etc
*
* @param int $post_id if want to check if the current user can edit the current post
*
* @return bool
*/
public static function has_external_access( $post_id = null ) {
$has_external_access = true;
if ( $post_id ) {
$has_external_access = current_user_can( 'edit_post', $post_id );
if ( $has_external_access && isset( $_REQUEST['tar_editor_page'] ) && (int) $_REQUEST['tar_editor_page'] === 1 ) {
/* other plugins ( TL, TA, TU ) check post-related info on the 'tcb_user_has_plugin_edit_cap' hook, so we should setup the global post for them */
global $post;
$post = get_post( $post_id );
setup_postdata( $post );
}
}
/**
* If Architect and plugin or just the plugin can't be used the post isn't available to edit
*/
return $has_external_access && apply_filters( 'tcb_user_has_plugin_edit_cap', static::has_access() );
}
/**
* Whether or not the current user can edit current post and has TAr access
*
* @param int $post_id current post id
*
* @return bool has access or not
*/
public static function has_post_access( $post_id ) {
return current_user_can( 'edit_post', $post_id ) && apply_filters( 'tcb_user_has_post_access', static::has_access() );
}
public function __construct( $data = [] ) {
parent::__construct( $data );
$this->logoUrl = tve_editor_css( 'images/thrive-architect-logo.png' );
$this->logoUrlWhite = tve_editor_css( 'images/thrive-architect-logo-white.png' );
$this->description = __( 'Create beautiful content & conversion optimized landing pages.', 'thrive-cb' );
$this->button = array(
'label' => __( 'View Video Tutorial', 'thrive-cb' ),
'data-source' => 'NgZO13Am6XA',
'active' => true,
'classes' => 'tvd-open-video',
);
$this->moreLinks = array(
'tutorials' => array(
'class' => 'tve-leads-tutorials',
'icon_class' => 'tvd-icon-graduation-cap',
'href' => 'https://thrivethemes.com/thrive-architect-tutorials/',
'target' => '_blank',
'text' => __( 'Tutorials', 'thrive-cb' ),
),
'support' => array(
'class' => 'tve-leads-tutorials',
'icon_class' => 'tvd-icon-life-bouy',
'href' => 'https://thrivethemes.com/support/',
'target' => '_blank',
'text' => __( 'Support', 'thrive-cb' ),
),
);
}
/**
* Reset all TCB data
*
* @return bool|void
*/
public static function reset_plugin() {
$query = new WP_Query( array(
'post_type' => array(
'tcb_lightbox',
TCB_CT_POST_TYPE,
TCB_Symbols_Post_Type::SYMBOL_POST_TYPE,
\TCB\inc\helpers\FormSettings::POST_TYPE,
\TCB\UserTemplates\Template::get_post_type_name(),
\TCB\SavedLandingPages\Saved_Lp::get_post_type_name(),
),
'fields' => 'ids',
'posts_per_page' => '-1',
)
);
$post_ids = $query->posts;
foreach ( $post_ids as $id ) {
wp_delete_post( $id, true );
}
$options = [
'tve_display_save_notification',
'tve_social_fb_app_id',
'tve_comments_disqus_shortname',
'tve_comments_facebook_admins',
'tve_fa_kit',
TCB\UserTemplates\Template::OPTION_KEY,
];
foreach ( $options as $option ) {
delete_option( $option );
}
delete_user_option( get_current_user_id(), 'tcb_pinned_elements' );
}
}

View File

@@ -0,0 +1,260 @@
<?php
/**
* Class TCB_Stock_Library
*
* Handles the stock image library functionality.
*/
class TCB_Stock_Library {
/**
* TCB_Stock_Library constructor.
* Sets up action hooks.
*/
public function __construct() {
// Use higher priority (5) to ensure Thrive loads before Optimole (default 10)
add_action( 'wp_enqueue_media', array( $this, 'enqueue_scripts' ), 5 );
add_action( 'wp_ajax_unsplash_list', array( $this, 'unsplash_list_callback' ) );
add_action( 'wp_ajax_unsplash_download_image', array( $this, 'unsplash_download_image_callback' ) );
add_action( 'wp_ajax_nopriv_unsplash_download_image', array( $this, 'unsplash_download_image_callback' ) );
}
/**
* Enqueue necessary scripts and styles for the stock image library.
*/
public function enqueue_scripts() {
// Only block Optimole when we're in the TAR editor context
if ( $this->is_tar_editor_context() ) {
$this->block_optimole_media_script();
}
$js_suffix = TCB_Utils::get_js_suffix();
tve_enqueue_script( 'unsplash_media_tab_js', tcb_admin()->admin_url( 'assets/js/stock-library' . $js_suffix), array( 'jquery' ), TVE_VERSION, false );
tve_enqueue_style( 'tcb-admin-stock-images', tcb_admin()->admin_url( 'assets/css/tcb-admin-stock-images.css' ), array(), TVE_VERSION, false );
$nonce = wp_create_nonce( 'unsplash_api_nonce' );
wp_localize_script(
'unsplash_media_tab_js',
'unsplashApi',
array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'nonce' => $nonce,
)
);
}
/**
* Check if we're in the TAR (Thrive Architect) editor context.
*
* @return bool True if we're in the TAR editor context, false otherwise.
*/
private function is_tar_editor_context() {
// Check for the main TAR editor flag (covers most cases)
if ( defined( 'TVE_EDITOR_FLAG' ) && ! empty( $_GET[ TVE_EDITOR_FLAG ] ) ) {
return true;
}
// Check for TAR editor page parameter (covers AJAX requests)
if ( ! empty( $_REQUEST['tar_editor_page'] ) ) {
return true;
}
return false;
}
/**
* Block Optimole's media modal script to prevent conflicts with Thrive's stock library.
*/
private function block_optimole_media_script() {
// Check if Optimole is active and has the DAM class
if ( ! class_exists( 'Optml_Dam' ) ) {
return;
}
// Get the Optimole DAM instance
$optml_dam_instance = null;
if ( class_exists( 'Optml_Main' ) && method_exists( 'Optml_Main', 'instance' ) ) {
$main_instance = Optml_Main::instance();
if ( isset( $main_instance->dam ) ) {
$optml_dam_instance = $main_instance->dam;
}
}
// Remove Optimole's media script hooks
if ( $optml_dam_instance ) {
// Remove the enqueue_media_scripts action
remove_action( 'wp_enqueue_media', array( $optml_dam_instance, 'enqueue_media_scripts' ), 10 );
// Remove print_media_templates action as well
remove_action( 'print_media_templates', array( $optml_dam_instance, 'print_media_template' ), 10 );
}
// Also check for any already enqueued scripts and remove them
static $action_registered = false;
if ( ! $action_registered ) {
add_action( 'wp_print_scripts', array( $this, 'dequeue_optimole_scripts' ), 999 );
$action_registered = true;
}
}
/**
* Dequeue Optimole media scripts if they were already enqueued.
*/
public function dequeue_optimole_scripts() {
wp_dequeue_script( 'optml-media-modal' );
wp_deregister_script( 'optml-media-modal' );
wp_dequeue_style( 'optml-media-modal' );
wp_deregister_style( 'optml-media-modal' );
}
/**
* Handle AJAX request to fetch a list of images from Unsplash.
*/
public function unsplash_list_callback() {
check_ajax_referer( 'unsplash_api_nonce', 'nonce' );
$count = min( isset( $_POST['count'] ) ? intval( $_POST['count'] ) : 10, 30 );
$page = isset( $_POST['page'] ) ? intval( $_POST['page'] ) : 1;
$search = isset( $_POST['search'] ) ? sanitize_text_field( wp_unslash( $_POST['search'] ) ) : '';
$allowed_order_by = array( 'relevant', 'latest', 'oldest' );
$allowed_orientation = array( 'landscape', 'portrait', 'squarish' );
$order_by = isset( $_POST['order_by'] ) && in_array( wp_unslash( $_POST['order_by'] ), $allowed_order_by ) ? sanitize_text_field( wp_unslash( $_POST['order_by'] ) ) : 'relevant';
$orientation = isset( $_POST['orientation'] ) && in_array( wp_unslash( $_POST['orientation'] ), $allowed_orientation ) ? sanitize_text_field( wp_unslash( $_POST['orientation'] ) ) : '';
$api_url = 'https://service-api.thrivethemes.com/api/unsplash/unsplash_service.php?action=list&page=' . $page . '&count=' . $count . '&order_by=' . rawurlencode( $order_by );
if ( ! empty( $search ) ) {
$api_url .= '&keyword=' . rawurlencode( $search ) . '&orientation=' . rawurlencode( $orientation );
}
$response = wp_remote_get( $api_url );
if ( is_wp_error( $response ) ) {
wp_send_json_error( 'Error connecting to the Unsplash API' );
return;
}
$data = json_decode( wp_remote_retrieve_body( $response ), true );
if ( is_null( $data ) || ! isset( $data['results'] ) ) {
wp_send_json_error( 'Invalid JSON response from Unsplash service' );
return;
}
wp_send_json_success(
array(
'total' => $data['total'],
'total_pages' => $data['total_pages'],
'results' => $data['results'],
)
);
}
/**
* Handle AJAX request to download an image from Unsplash.
*/
public function unsplash_download_image_callback() {
check_ajax_referer( 'unsplash_api_nonce', 'nonce' );
$photo_id = isset( $_POST['photo_id'] ) ? sanitize_text_field( wp_unslash( $_POST['photo_id'] ) ) : '';
if ( empty( $photo_id ) ) {
wp_send_json_error( 'No photo ID provided' );
return;
}
$photo_size = 'full';
$download_success = false;
$unsplash_api_url = 'https://service-api.thrivethemes.com/api/unsplash/unsplash_service.php?action=download&photo_id=' . urlencode( $photo_id ) . '&photo_size=' . $photo_size;
$response = wp_remote_get( $unsplash_api_url );
if ( is_wp_error( $response ) ) {
wp_send_json_error( 'Error retrieving image information from Unsplash service.' );
return;
}
$data = json_decode( wp_remote_retrieve_body( $response ), true );
if ( ! isset( $data['download_url'] ) ) {
wp_send_json_error( 'Missing download URL in Unsplash service response.' );
return;
}
$download_url = esc_url_raw( $data['download_url'] );
$title = isset( $_POST['title'] ) ? sanitize_text_field( wp_unslash( $_POST['title'] ) ) : '';
$alt_text = isset( $_POST['alt_text'] ) ? sanitize_text_field( wp_unslash( $_POST['alt_text'] ) ) : ( isset( $data['alt_description'] ) ? sanitize_text_field( $data['alt_description'] ) : '' );
$caption = isset( $_POST['caption'] ) ? sanitize_text_field( wp_unslash( $_POST['caption'] ) ) : '';
$description = isset( $_POST['description'] ) ? sanitize_textarea_field( wp_unslash( $_POST['description'] ) ) : '';
$filename = isset( $_POST['filename'] ) ? sanitize_file_name( wp_unslash( $_POST['filename'] ) ) : ( isset( $photo_id ) ? sanitize_text_field( $photo_id ) : '' );
$image_response = wp_remote_get( $download_url );
if ( is_wp_error( $image_response ) ) {
wp_send_json_error( 'Error downloading image from Unsplash.' );
return;
}
$image_body = wp_remote_retrieve_body( $image_response );
$mime_type = wp_remote_retrieve_header( $image_response, 'content-type' );
if ( ! $image_body ) {
wp_send_json_error( 'Error reading image content from Unsplash.' );
return;
}
$file_extension_map = array(
'image/jpeg' => '.jpg',
'image/png' => '.png',
'image/gif' => '.gif',
);
if ( ! isset( $file_extension_map[ $mime_type ] ) ) {
wp_send_json_error( 'Unsupported image type: ' . $mime_type );
return;
}
$file_extension = $file_extension_map[ $mime_type ];
$filename = sanitize_file_name( $filename . $file_extension );
$upload_dir = wp_upload_dir();
$file_path = $upload_dir['path'] . '/' . $filename;
if ( file_put_contents( $file_path, $image_body ) !== false ) {
$download_success = true;
}
if ( ! $download_success ) {
wp_send_json_error( 'Error saving image to the uploads directory.' );
return;
}
$attachment = array(
'guid' => $upload_dir['url'] . '/' . basename( $file_path ),
'post_mime_type' => $mime_type,
'post_title' => $title,
'post_content' => $description,
'post_status' => 'inherit',
'post_excerpt' => $caption,
);
$attach_id = wp_insert_attachment( $attachment, $file_path );
if ( file_exists( ABSPATH . 'wp-admin/includes/image.php' ) ) {
$attach_data = wp_generate_attachment_metadata( $attach_id, $file_path );
if ( ! $attach_data ) {
wp_send_json_error( 'Error generating attachment metadata.' );
return;
}
} else {
if ( ! wp_update_attachment_metadata( $attach_id, $attach_data ) ) {
wp_send_json_error( 'Error updating attachment metadata.' );
return;
}
return;
}
$attach_data = wp_generate_attachment_metadata( $attach_id, $file_path );
wp_update_attachment_metadata( $attach_id, $attach_data );
update_post_meta( $attach_id, '_wp_attachment_image_alt', $alt_text );
wp_send_json_success(
array(
'message' => 'Image downloaded, added to the media library, and added to Thrive Architect',
'attachment_id' => $attach_id,
)
);
}
}

View File

@@ -0,0 +1,568 @@
<?php
/**
* FileName class-tcb-symbols-rest-controller.php.
*
* @project : thrive-visual-editor
* @developer: Dragos Petcu
*/
class TCB_REST_Symbols_Controller extends WP_REST_Posts_Controller {
public static $version = 1;
/**
* Constructor.
* We are overwriting the post type for this rest controller
*/
public function __construct() {
parent::__construct( TCB_Symbols_Post_Type::SYMBOL_POST_TYPE );
$this->namespace = 'tcb/v' . self::$version;
$this->rest_base = 'symbols';
$this->register_meta_fields();
$this->hooks();
}
/**
* Hooks to change the post rest api
*/
public function hooks() {
add_filter( "rest_prepare_{$this->post_type}", [ $this, 'rest_prepare_symbol' ], 10, 2 );
add_filter( "rest_insert_{$this->post_type}", [ $this, 'rest_insert_symbol' ], 10, 2 );
add_action( "rest_after_insert_{$this->post_type}", [ $this, 'rest_after_insert' ], 10, 2 );
add_action( 'rest_delete_' . TCB_Symbols_Taxonomy::SYMBOLS_TAXONOMY, [ $this, 'rest_delete_category' ], 10, 1 );
add_action( "rest_{$this->post_type}_query", [ $this, 'override_per_page' ], 10, 1 );
}
/**
* Override the per page limit for the rest api in case there are people with over 100 symbols
*
* @param $args
*
* @return mixed
*/
public function override_per_page( $params ) {
if ( isset( $params['posts_per_page'] ) ) {
$params['posts_per_page'] = '300';
}
return $params;
}
/**
* Register additional rest routes for symbols
*/
public function register_routes() {
parent::register_routes();
register_rest_route( $this->namespace, '/' . $this->rest_base . '/cloud', array(
array(
'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_cloud_items' ],
'permission_callback' => [ $this, 'get_items_permissions_check' ],
),
) );
register_rest_route( $this->namespace, '/' . $this->rest_base . '/cloud/(?P<id>.+)', array(
'args' => array(
'id' => array(
'description' => __( 'Unique identifier for the object.' ),
'type' => 'string',
),
),
array(
'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_cloud_item' ],
'permission_callback' => [ $this, 'get_items_permissions_check' ],
),
) );
}
/**
* Check to see if the user hase permission to view cloud items
*
* @param WP_REST_Request $request
*
* @return bool
*/
public function get_items_permissions_check( $request ) {
return TCB_Product::has_external_access();
}
/**
* @param WP_REST_Request $request
*
* @return array|WP_Error|WP_REST_Response
*/
public function get_cloud_items( $request ) {
if ( ! ( $type = $request->get_param( 'type' ) ) ) {
return new WP_Error( 'rest_invalid_element_type', __( 'Invalid element type' ), [ 'status' => 500 ] );
}
/** @var TCB_Cloud_Template_Element_Abstract $element */
if ( ! ( $element = tcb_elements()->element_factory( $type ) ) || ! is_a( $element, 'TCB_Cloud_Template_Element_Abstract' ) ) {
return new WP_Error( 'rest_invalid_element_type', __( 'Invalid element type', 'thrive-cb' ) . " ({$type})", [ 'status' => 500 ] );
}
$templates = $element->get_cloud_templates();
if ( is_wp_error( $templates ) ) {
return $templates;
}
$templates = $this->prepare_templates_for_response( $templates );
return new WP_REST_Response( $templates );
}
/**
* Transform the resulted templates array to be used in a backbone collection
*
* @param $templates
*
* @return array
*/
public function prepare_templates_for_response( $templates ) {
$results = [];
foreach ( $templates as $template ) {
$results[] = $template;
}
return $results;
}
/**
* Check to see if the user has permission to view an item from cloud
*
* @return bool
*/
public function get_cloud_item_permission_check() {
return tcb_has_external_cap();
}
/**
* Get symbol template from the cloud
*
* @param $request WP_REST_Request
*
* @return array|WP_Error|WP_REST_Response
*/
public function get_cloud_item( $request ) {
if ( ! ( $type = $request->get_param( 'type' ) ) ) {
return new WP_Error( 'rest_invalid_element_type', __( 'Invalid element type', 'thrive-cb' ), [ 'status' => 500 ] );
}
if ( ! ( $id = $request->get_param( 'id' ) ) ) {
return new WP_Error( 'invalid_id', __( 'Missing template id', 'thrive-cb' ), [ 'status' => 500 ] );
}
/** @var TCB_Cloud_Template_Element_Abstract $element */
if ( ! ( $element = tcb_elements()->element_factory( $type ) ) || ! is_a( $element, 'TCB_Cloud_Template_Element_Abstract' ) ) {
return new WP_Error( 'rest_invalid_element_type', __( 'Invalid element type', 'thrive-cb' ) . " ({$type})", [ 'status' => 500 ] );
}
$data = $element->get_cloud_template_data( $id );
if ( is_wp_error( $data ) ) {
return $data;
}
return new WP_REST_Response( $data );
}
/**
* Checks if a given request has access to create a post.
*
* @param WP_REST_Request $request Full details about the request.
*
* @return true|WP_Error True if the request has access to create items, WP_Error object otherwise.
* @since 4.7.0
*
*/
public function create_item_permissions_check( $request ) {
$parent_response = parent::create_item_permissions_check( $request );
//if we are making a duplicate symbol revert to default, do not check for duplicate titles
if ( isset( $request['old_id'] ) || is_wp_error( $parent_response ) ) {
return $parent_response;
}
return $this->check_duplicate_title( $request );
}
/**
* Checks if a given request has access to update a post.
*
* @param WP_REST_Request $request Full details about the request.
*
* @return true|WP_Error True if the request has access to update the item, WP_Error object otherwise.
* @since 4.7.0
*
*/
public function update_item_permissions_check( $request ) {
$parent_response = parent::update_item_permissions_check( $request );
if ( is_wp_error( $parent_response ) ) {
return $parent_response;
}
return $this->check_duplicate_title( $request );
}
/**
* Check if there already exists a symbol with the same title
*
* @param WP_REST_Request $request
*
* @return bool|WP_Error
*/
public function check_duplicate_title( $request ) {
$post_title = $this->get_post_title_from_request( $request );
if ( $post_title ) {
$post = tve_get_page_by_title( $post_title, TCB_Symbols_Post_Type::SYMBOL_POST_TYPE );
if ( $post && $post->post_status !== 'trash' ) {
return new WP_Error( 'rest_cannot_create_post', __( 'Sorry, you are not allowed to create global elements with the same title', 'thrive-cb' ), [ 'status' => 409 ] );
}
}
return true;
}
/**
* Get post title from request
*
* @param WP_REST_Request $request
*/
public function get_post_title_from_request( $request ) {
$post_title = '';
$schema = $this->get_item_schema();
if ( ! empty( $schema['properties']['title'] ) && isset( $request['title'] ) ) {
if ( is_string( $request['title'] ) ) {
$post_title = $request['title'];
} elseif ( ! empty( $request['title']['raw'] ) ) {
$post_title = $request['title']['raw'];
}
}
return $post_title;
}
/**
* Add the taxonomy data to the rest response
*
* @param WP_REST_Response $response
* @param WP_Post $post
*
* @return mixed
*/
public function rest_prepare_symbol( $response, $post ) {
$taxonomies = $response->data[ TCB_Symbols_Taxonomy::SYMBOLS_TAXONOMY ];
foreach ( $taxonomies as $key => $term_id ) {
$term = get_term_by( 'term_id', $term_id, TCB_Symbols_Taxonomy::SYMBOLS_TAXONOMY );
$response->data[ TCB_Symbols_Taxonomy::SYMBOLS_TAXONOMY ][ $key ] = $term;
}
/* add the thumbnail data */
$default_thumb_data = TCB_Utils::get_placeholder_data();
$response->data['thumb'] = TCB_Utils::get_thumb_data( $post->ID, TCB_Symbols_Post_Type::SYMBOL_THUMBS_FOLDER, $default_thumb_data );
$response->data['edit_url'] = tcb_get_editor_url( $post->ID );
return $response;
}
/**
* After a symbol is created generate a new thumb for it ( if we are duplicating the symbol )
*
* @param WP_Post $post Inserted or updated post object.
* @param WP_REST_Request $request Request object.
*
* @return WP_Error|bool
*/
public function rest_insert_symbol( $post, $request ) {
if ( isset( $request['old_id'] ) ) {
$this->ensure_unique_title( $request, $post );
if ( ! $this->copy_thumb( $request['old_id'], $post->ID ) ) {
return new WP_Error( 'could_not_generate_file', __( 'We were not able to copy the symbol', 'thrive-cb' ), [ 'status' => 500 ] );
};
$old_global_data = get_post_meta( $request['old_id'], 'tve_globals', true );
if ( ! empty( $old_global_data ) ) {
update_post_meta( $post->ID, 'tve_globals', $old_global_data );
}
}
update_post_meta( $post->ID, 'export_id', base_convert( time(), 10, 36 ) );
if ( isset( $request['thumb'] ) ) {
return $this->download_thumb( $request, $post->ID );
}
return true;
}
/**
* Action called after a symbol has been created
*
* @param WP_Post $post Inserted or updated post object.
*
*/
public function rest_after_insert( $post ) {
$head_css = get_post_meta( $post->ID, 'tve_custom_css', true );
/* update css specially when we get css from the cloud */
update_post_meta( $post->ID, 'tve_custom_css', str_replace( '|TEMPLATE_ID|', $post->ID, $head_css ) );
}
/**
* It handles also the case when a symbol is created starting with a template from cloud
*
* @param $request WP_REST_Request
* @param $post_id
*
* @return bool|WP_Error
*/
public function download_thumb( $request, $post_id ) {
$thumb = $request['thumb'];
$path = $thumb['url'];
$upload_dir = wp_upload_dir();
if ( strpos( $path, 'no-template-preview' ) !== false ) {
return new WP_Error( 'could_not_generate_file', __( "The inital thumbnail doesn't exists", 'thrive-cb' ), [ 'status' => 500 ] );
}
if ( strpos( $path, 'http' ) === false ) {
$path = 'http:' . $path;
} else {
$thumb_id = isset( $request['thumb_id'] ) ? $request['thumb_id'] : '';
$path = trailingslashit( $upload_dir['basedir'] ) . TCB_Symbols_Post_Type::SYMBOL_THUMBS_FOLDER . '/' . $thumb_id . '.png';
}
//check first if the directory exists. If not, create it
$dir_path = trailingslashit( $upload_dir['basedir'] ) . TCB_Symbols_Post_Type::SYMBOL_THUMBS_FOLDER;
if ( ! is_dir( $dir_path ) ) {
wp_mkdir_p( $dir_path );
}
$new_path = $dir_path . '/' . $post_id . '.png';
/* add the new thumbnail data to the post meta */
TCB_Utils::save_thumbnail_data( $post_id, $thumb );
return @copy( $path, $new_path );
}
/**
* When we duplicate a post, the duplicate will take the title_{id}, to not have symbols with the same name
*
* @param WP_REST_Request $request
* @param WP_Post $post
*/
public function ensure_unique_title( $request, $post ) {
$post_title = $this->get_post_title_from_request( $request );
$new_title = __( 'Copy of ', 'thrive-cb' ) . $post_title;
$same_title_post = tve_get_page_by_title( $new_title, TCB_Symbols_Post_Type::SYMBOL_POST_TYPE );
if ( $same_title_post && $same_title_post->post_status !== 'trash' ) {
$new_title = $new_title . '_' . $post->ID;
}
$post->post_title = $new_title;
wp_update_post( $post );
}
/**
* Get path for symbol thumbnail
*
* @param int $old_id
* @param int $new_id
*
* @return bool
*/
public function copy_thumb( $old_id, $new_id ) {
$upload_dir = wp_upload_dir();
$old_path = trailingslashit( $upload_dir['basedir'] ) . TCB_Symbols_Post_Type::SYMBOL_THUMBS_FOLDER . '/' . $old_id . '.png';
$new_path = trailingslashit( $upload_dir['basedir'] ) . TCB_Symbols_Post_Type::SYMBOL_THUMBS_FOLDER . '/' . $new_id . '.png';
if ( file_exists( $old_path ) ) {
$thumb_data = TCB_Utils::get_thumb_data( $old_id, TCB_Symbols_Post_Type::SYMBOL_THUMBS_FOLDER );
if ( ! empty( $thumb_data ) ) {
TCB_Utils::save_thumbnail_data( $new_id, $thumb_data );
}
return copy( $old_path, $new_path );
}
return true;
}
/**
* Return symbol html from meta
*
* @param array $postdata
*
* @return mixed
*/
public function get_symbol_html( $postdata ) {
$symbol_id = $postdata['id'];
return get_post_meta( $symbol_id, 'tve_updated_post', true );
}
/**
* Update symbol html from meta
*
* @param string $meta_value
* @param WP_Post $post_obj
* @param string $meta_key
*
* @return bool|int
*/
public function update_symbol_html( $meta_value, $post_obj, $meta_key ) {
/**
* Update the symbol html(form meta value) for a specific meta key
*
* @param string $meta_key
* @param string $meta_value
*/
$meta_value = apply_filters( 'tve_update_symbol_html', $meta_key, $meta_value );
return update_post_meta( $post_obj->ID, $meta_key, $meta_value );
}
/**
* Get symbol css from meta
*
* @param array $postdata
*
* @return mixed
*/
public function get_symbol_css( $postdata ) {
$symbol_id = $postdata['id'];
return get_post_meta( $symbol_id, 'tve_custom_css', true );
}
/**
* Update symbols css from meta
*
* @param string $css existing css
* @param WP_Post $post_obj
* @param string $meta_key
* @param WP_Rest_Request $request
*
* @return bool|int
*/
public function update_symbol_css( $css, $post_obj, $meta_key, $request ) {
//if old_id is sent -> we are in the duplicate cas, and we need to replace the id from the css with the new one
if ( isset( $request['old_id'] ) ) {
$css = str_replace( "_{$request['old_id']}", "_{$post_obj->ID}", $css );
}
return update_post_meta( $post_obj->ID, $meta_key, $css );
}
/**
* Move symbol from one category to another
*
* @param string $new_term_id
* @param WP_Post $post_obj
*
* @return array|bool|WP_Error
*/
public function move_symbol( $new_term_id, $post_obj ) {
if ( (int) $new_term_id === 0 ) {
//if the new category is the uncategorized one, we just have to delete the existing ones
return $this->remove_current_terms( $post_obj );
}
//get the new category and make sure that it exists
$term = get_term_by( 'term_id', $new_term_id, TCB_Symbols_Taxonomy::SYMBOLS_TAXONOMY );
if ( $term ) {
$this->remove_current_terms( $post_obj );
return wp_set_object_terms( $post_obj->ID, $term->name, TCB_Symbols_Taxonomy::SYMBOLS_TAXONOMY );
}
return false;
}
/**
* Remove the symbol from the current category( term )
*
* @param WP_Post $post_obj
*
* @return bool|WP_Error
*/
public function remove_current_terms( $post_obj ) {
$post_terms = wp_get_post_terms( $post_obj->ID, TCB_Symbols_Taxonomy::SYMBOLS_TAXONOMY );
if ( ! empty( $post_terms ) ) {
$term_name = $post_terms[0]->name;
return wp_remove_object_terms( $post_obj->ID, $term_name, TCB_Symbols_Taxonomy::SYMBOLS_TAXONOMY );
}
return true;
}
/**
* Add custom meta fields for comments to use them with the rest api
*/
public function register_meta_fields() {
register_rest_field( $this->get_object_type(), 'tve_updated_post', [
'get_callback' => [ $this, 'get_symbol_html' ],
'update_callback' => [ $this, 'update_symbol_html' ],
] );
register_rest_field( $this->get_object_type(), 'tve_custom_css', [
'get_callback' => [ $this, 'get_symbol_css' ],
'update_callback' => [ $this, 'update_symbol_css' ],
] );
register_rest_field( $this->get_object_type(), 'move_symbol', [
'update_callback' => [ $this, 'move_symbol' ],
] );
}
/**
* After a category is deleted we need to move the symbols to uncategorized
*
* @param WP_Term $term The deleted term.
*/
public function rest_delete_category( $term ) {
$posts = get_posts( array(
'post_type' => TCB_Symbols_Post_Type::SYMBOL_POST_TYPE,
'numberposts' => - 1,
'tax_query' => array(
array(
'taxonomy' => TCB_Symbols_Taxonomy::SYMBOLS_TAXONOMY,
'field' => 'id',
'terms' => $term->term_id,
),
),
) );
if ( ! empty( $posts ) ) {
foreach ( $posts as $post ) {
$this->remove_current_terms( $post );
}
}
}
}

View File

@@ -0,0 +1,83 @@
<?php
/**
* Created by PhpStorm.
* User: Ovidiu
* Date: 3/14/2017
* Time: 10:01 AM
*/
/**
* TCB Javascript translations
*/
return [
'templates' => __( 'Templates', 'thrive-cb' ),
'dashboard' => __( 'Thrive Dashboard', 'thrive-cb' ),
'no_categories' => __( 'Please insert some categories!', 'thrive-cb' ),
'delete_template_txt' => __( 'Are you sure you want to delete the template "%s" ?', 'thrive-cb' ),
'delete_category_txt' => __( 'Are you sure you want to delete the category "%s" ?', 'thrive-cb' ),
'delete_symbol_txt' => __( 'Are you sure you want to delete the symbol "%s" ?', 'thrive-cb' ),
'delete_header_txt' => __( 'Are you sure you want to delete the header "%s" ?', 'thrive-cb' ),
'delete_footer_txt' => __( 'Are you sure you want to delete the footer "%s" ?', 'thrive-cb' ),
'show_more' => __( 'Show more templates', 'thrive-cb' ),
'show_less' => __( 'Show less templates', 'thrive-cb' ),
'symbols' => __( 'Symbols', 'thrive-cb' ),
'templates_symbols' => __( 'Templates & Symbols', 'thrive-cb' ),
'global_elements' => __( 'Global Elements', 'thrive-cb' ),
'category_save' => __( 'The category was saved successfully', 'thrive-cb' ),
'category_not_save' => __( 'There was an error while trying to save your category', 'thrive-cb' ),
'symbol_save' => __( 'The symbol was saved successfully', 'thrive-cb' ),
'header_save' => __( 'The header was saved successfully', 'thrive-cb' ),
'footer_save' => __( 'The footer was saved successfully', 'thrive-cb' ),
'symbol_not_save' => __( 'There was an error while trying to save the symbol', 'thrive-cb' ),
'header_not_save' => __( 'There was an error while trying to save the header', 'thrive-cb' ),
'footer_not_save' => __( 'There was an error while trying to save the footer', 'thrive-cb' ),
'uncategorized_symbols' => __( 'Uncategorized Symbols', 'thrive-cb' ),
'category_deleted' => __( 'The category was deleted', 'thrive-cb' ),
'category_not_deleted' => __( 'An error occurred and the category was not deleted', 'thrive-cb' ),
'symbol_deleted' => __( 'The symbol was deleted', 'thrive-cb' ),
'header_deleted' => __( 'The header was deleted', 'thrive-cb' ),
'footer_deleted' => __( 'The footer was deleted', 'thrive-cb' ),
'symbol_not_deleted' => __( 'An error occurred and the symbol was not deleted', 'thrive-cb' ),
'header_not_deleted' => __( 'An error occurred and the header was not deleted', 'thrive-cb' ),
'footer_not_deleted' => __( 'An error occurred and the footer was not deleted', 'thrive-cb' ),
'create_symbol' => __( 'Create new Symbol', 'thrive-cb' ),
'create_category' => __( 'Create a new Category', 'thrive-cb' ),
'create_header' => __( 'Create New Header', 'thrive-cb' ),
'create_footer' => __( 'Create New Footer', 'thrive-cb' ),
'create_new' => __( 'Create new', 'thrive-cb' ),
'description_category' => __( 'Organize your Symbols into categories for a better overview', 'thrive-cb' ),
'description_symbol' => __( 'Create a new symbol and load it on any page by using Thrive Architect', 'thrive-cb' ),
'save_category_text' => __( 'Save Category', 'thrive-cb' ),
'save_symbol_text' => __( 'Save and edit with Architect', 'thrive-cb' ),
'placeholder_category' => __( 'Enter Category Name', 'thrive-cb' ),
'placeholder_symbol' => __( 'Enter Symbol Name', 'thrive-cb' ),
'symbol_name_required' => __( 'Symbol name is required', 'thrive-cb' ),
'category_name_required' => __( 'Category name is required', 'thrive-cb' ),
'category_created' => __( 'The Category was successfully created!', 'thrive-cb' ),
'category_not_created' => __( 'There was an error while trying to create your category', 'thrive-cb' ),
'symbol_created' => __( 'The Symbol was successfully created!', 'thrive-cb' ),
'symbol_not_created' => __( 'There was an error while trying to create your symbol', 'thrive-cb' ),
'add_as_category' => __( 'Add as Category', 'thrive-cb' ),
'select_category' => __( 'Select Category...', 'thrive-cb' ),
'duplicate_symbol_success' => __( 'The symbol was duplicated', 'thrive-cb' ),
'duplicate_header_success' => __( 'The header was duplicated', 'thrive-cb' ),
'duplicate_footer_success' => __( 'The footer was duplicated', 'thrive-cb' ),
'cannot_duplicate_symbol' => __( 'The symbol could not be duplicated', 'thrive-cb' ),
'cannot_duplicate_header' => __( 'The header could not be duplicated', 'thrive-cb' ),
'cannot_duplicate_footer' => __( 'The footer could not be duplicated', 'thrive-cb' ),
'symbol_moved_success' => __( 'The symbol was moved successfully', 'thrive-cb' ),
'symbol_moved_error' => __( 'There was an error while trying to move the symbol', 'thrive-cb' ),
'search_symbol' => __( 'Search symbols', 'thrive-cb' ),
'search_ct' => __( 'Search templates', 'thrive-cb' ),
'search_headers' => __( 'Search headers', 'thrive-cb' ),
'search_footers' => __( 'Search footers', 'thrive-cb' ),
'symbol_name' => __( 'Symbol Name', 'thrive-cb' ),
'ct_name' => __( 'Template Name', 'thrive-cb' ),
'headers_name' => __( 'Header Name', 'thrive-cb' ),
'footers_name' => __( 'Footer Name', 'thrive-cb' ),
'header_name_required' => __( 'Header name is required', 'thrive-cb' ),
'footer_name_required' => __( 'Footer name is required', 'thrive-cb' ),
'empty_list' => __( 'You have no %s yet. You can start building %s by clicking on the button above.', 'thrive-cb' ),
'text_not_deleted' => __( 'This item could not be deleted', 'thrive-cb' ),
];

View File

@@ -0,0 +1,121 @@
<?php
/**
* Created by PhpStorm.
* User: Ovidiu
* Date: 3/6/2017
* Time: 11:10 AM
*/
/**
* @return array
*/
function tcb_admin_get_localization() {
/** @var TCB_Symbols_Taxonomy $tcb_symbol_taxonomy */
global $tcb_symbol_taxonomy;
$terms = get_terms( [ 'slug' => [ 'headers', 'footers' ] ] );
$terms = array_map( function ( $term ) {
return $term->term_id;
}, $terms );
return array(
'admin_nonce' => wp_create_nonce( TCB_Admin_Ajax::NONCE ),
'dash_url' => admin_url( 'admin.php?page=tve_dash_section' ),
't' => include tcb_admin()->admin_path( 'includes/i18n.php' ),
'symbols_logo' => tcb_admin()->admin_url( 'assets/images/admin-logo.png' ),
'rest_routes' => array(
'symbols' => tcb_admin()->tcm_get_route_url( 'symbols' ),
'symbols_terms' => rest_url( sprintf( '%s/%s', 'wp/v2', TCB_Symbols_Taxonomy::SYMBOLS_TAXONOMY ) ),
'symbols_short_path' => TCB_Admin::TCB_REST_NAMESPACE . '/symbols',
),
'notifications' => TCB\Notifications\Main::get_localized_data(),
'nonce' => TCB_Utils::create_nonce(),
'symbols_tax' => TCB_Symbols_Taxonomy::SYMBOLS_TAXONOMY,
'symbols_tax_terms' => $tcb_symbol_taxonomy->get_symbols_tax_terms(),
'sections_tax_terms' => $tcb_symbol_taxonomy->get_symbols_tax_terms( true ),
'default_terms' => $tcb_symbol_taxonomy->get_default_terms(),
'symbols_number' => count( tcb_elements()->element_factory( 'symbol' )->get_all( [ 'category__not_in' => $terms ] ) ),
'symbols_dash' => admin_url( 'admin.php?page=tcb_admin_dashboard&tab_selected=symbol#templatessymbols' ),
);
}
/**
* @param array $templates
*
* @return array
* todo: we will not need this after we move the category grouping logic to JS ( see the comments in admin-ajax )
*/
function tcb_admin_get_category_templates( $templates = [] ) {
$template_categories = [];
$no_preview_img = TCB_Utils::get_placeholder_url();
foreach ( $templates as $template ) {
if ( empty( $template['image_url'] ) ) {
$template['image_url'] = $no_preview_img;
}
if ( isset( $template['id_category'] ) && is_numeric( $template['id_category'] ) ) {
$category_id = $template['id_category'];
/* @var \TCB\UserTemplates\Category */
$category_instance = \TCB\UserTemplates\Category::get_instance_with_id( $category_id );
switch ( $category_instance->get_meta( 'type' ) ) {
case 'uncategorized':
$group = 'uncategorized';
break;
case 'page_template':
$group = \TCB\UserTemplates\Category::PAGE_TEMPLATE_IDENTIFIER;
break;
default:
$group = $category_id;
break;
}
if ( empty( $template_categories[ $group ] ) ) {
$template_categories[ $group ] = [];
}
$template_categories[ $group ][] = $template;
}
}
return $template_categories;
}
/**
* Filter content templates by their name
*
* @param array $templates
* @param string $search
*
* @return array
*/
function tcb_filter_templates( $templates, $search ) {
$result = [];
foreach ( $templates as $template ) {
if ( stripos( $template['name'], $search ) !== false ) {
$result[] = $template;
}
}
return $result;
}
/**
* Displays an icon using svg format
*
* @param string $icon
* @param bool $return whether to return the icon as a string or to output it directly
*
* @return string|void
*/
function tcb_admin_icon( $icon, $return = false ) {
$html = '<svg class="tcb-admin-icon tcb-admin-icon-' . $icon . '"><use xlink:href="#icon-' . $icon . '"></use></svg>';
if ( false !== $return ) {
return $html;
}
echo $html; // phpcs:ignore
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-theme
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
?>
<?php include TVE_DASH_PATH . '/templates/header.phtml'; ?>
<div class="ls-breadcrumbs">
<a href="<?php echo admin_url( 'admin.php?page=tve_dash_section' ); ?>" class="tvd-breadcrumb-back">
<?php echo __( 'Thrive Dashboard', 'thrive-cb' ); ?>
</a>
<a href="<?php echo admin_url( 'admin.php?page=tve_lightspeed' ); ?>" class="tvd-breadcrumb-back">
<?php echo __( 'Project Lightspeed', 'thrive-cb' ); ?>
</a>
<span>
<?php echo __( 'Asset Optimization', 'thrive-cb' ); ?>
</span>
</div>
<div id="lightspeed-admin-wrapper"></div>

View File

@@ -0,0 +1,4 @@
<div id="tcb-admin-header-wrapper"></div>
<div id="tcb-admin-breadcrumbs-wrapper"></div>
<div id="tcb-admin-dashboard-wrapper"></div>
<?php include TVE_TCB_ROOT_PATH . 'admin/assets/css/fonts/tcb-admin-icons.svg' ?>

View File

@@ -0,0 +1,90 @@
<?php
$screen = get_current_screen();
$post_id = $post ? $post->ID : ( isset( $_GET['post_id'] ) ? $_GET['post_id'] : 0 );
?>
<html>
<body>
<form name="post" action="post.php" method="post" id="post">
<?php wp_nonce_field( 'update-post_' . $post->ID ) ?>
<input type="hidden" name="action" value="editpost"/>
<input type="hidden" name="originalaction" value="editpost"/>
<?php the_block_editor_meta_box_post_form_hidden_fields( $post ) ?>
<div id="poststuff" class="wp-admin wp-core-ui js">
<input style="display:none;margin-bottom: 10px" type="submit" name="save" id="publish" class="button button-primary button-large" value="Update">
<?php do_meta_boxes( $screen->id, 'side', $post ); ?>
<?php do_meta_boxes( $screen->id, 'normal', $post ); ?>
<?php do_meta_boxes( $screen->id, 'column3', $post ); ?>
<?php do_meta_boxes( $screen->id, 'column4', $post ); ?>
</div>
</form>
<script>
addLoadEvent = function ( func ) {
if ( typeof jQuery !== 'undefined' ) {
jQuery( function () {
func();
} );
} else if ( typeof wpOnload !== 'function' ) {
wpOnload = func;
} else {
var oldonload = wpOnload;
wpOnload = function () {
oldonload();
func();
}
}
};
var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>',
pagenow = '<?php echo esc_js( $screen->id ); ?>',
typenow = '<?php echo esc_js( $screen->post_type ); ?>',
isRtl = <?php echo (int) is_rtl(); ?>;
window.tcbTriggerSave = function () {
jQuery( '#publish' ).trigger( 'click' );
};
window.destroySortable = function () {
setTimeout( () => {
const $sortable = jQuery( '.meta-box-sortables' );
if ( $sortable.length && typeof $sortable.sortable === 'function' ) {
$sortable.sortable( 'destroy' );
}
}, 1000 );
};
window.removeExtraButtons = function () {
jQuery( '.handle-actions' ).children( ':not(.handlediv):not(.handle-order-higher):not(.handle-order-lower)' ).remove();
};
window.tcbToggleMetaBoxes = function ( metaBoxIds = [] ) {
if ( ! Array.isArray( metaBoxIds ) ) {
metaBoxIds = [];
}
jQuery( `.postbox:not('.hide-if-js')` ).toggleClass( 'very-hidden', metaBoxIds.length > 0 ).addClass( 'closed' );
metaBoxIds.forEach( metaBoxId => {
jQuery( `#${metaBoxId}` ).removeClass( 'closed very-hidden' )
} );
};
//on page load
addLoadEvent( () => {
removeExtraButtons();
document.documentElement.setAttribute( 'dir', 'ltr' )
const settingsHeader = document.querySelector( '#submitdiv .postbox-header h2' )
if ( settingsHeader ) {
settingsHeader.innerHTML = 'General settings';
}
Array.from( document.getElementsByTagName( 'a' ) ).forEach( element => {
element.setAttribute( 'target', '_blank' )
} )
} );
</script>

View File

@@ -0,0 +1,9 @@
<ul class="clearfix">
<# links.each( function( item, index ) { item.has_link = index < links.size() - 1 #>
<li class="tvd-breadcrumb <#= ( item.has_link ? '' : ' tqb-no-link' ) #>">
<# if ( item.has_link ) { #><a href="<#= item.get_url() #>"><# } #>
<#= _.escape ( item.get ( 'label' ) ) #>
<# if ( item.has_link ) { #></a><# } #>
</li>
<# } ) #>
</ul>

View File

@@ -0,0 +1,19 @@
<div class="tcb-tabs-container">
<div class="tcb-header-tabs">
<div class="tab-item active" data-content="ct" data-tab="templates"><?php echo __( 'Content Templates', 'thrive-cb' ); ?></div>
<div class="tab-item" data-content="symbol" data-tab="symbol"><?php echo __( 'Symbols & Blocks', 'thrive-cb' ); ?></div>
<div class="tab-item" data-content="notifications" data-tab="notifications"><?php echo __( 'Notification Toasts', 'thrive-cb' ); ?></div>
<div class="tab-item" data-content="headers" data-tab="templates"><?php echo __( 'Headers', 'thrive-cb' ); ?></div>
<div class="tab-item" data-content="footers" data-tab="templates"><?php echo __( 'Footers', 'thrive-cb' ); ?></div>
</div>
<div class="tabs-content">
<div class="tcb-tab-content ct-content active" data-content="ct"></div>
<div class="tcb-tab-content symbols-content" data-content="symbol"></div>
<div class="tcb-tab-content notifications-content" data-content="notifications"></div>
<div class="tcb-tab-content headers-content" data-content="headers"></div>
<div class="tcb-tab-content footers-content" data-content="footers"></div>
</div>
<div id="tve-page-loader">
<?php tcb_template( 'loading-spinner.php' ); ?>
</div>
</div>

View File

@@ -0,0 +1,24 @@
<div class="tcb-header <#= header.class #>">
<nav id="tcb-nav">
<# if ( header.class !== '' ) { #>
<div class="tcb-sym-left">
<span><?php echo __( 'Global Elements', 'thrive-cb' ) ?></span>
</div>
<# } #>
<div class="tvd-left">
<a href="<?php echo admin_url( 'admin.php?page=tcb_admin_dashboard' ) ?>" title="<?php echo __( 'Thrive Architect Home', 'thrive-cb' ) ?>">
<img src="<#= header.admin_logo_url #>"/>
</a>
</div>
<ul class="tvd-right">
<li>
<a id="tvd-share-modal" class="tvd-modal-trigger" href="#tvd-modal1"
data-overlay_class="tvd-white-bg" data-opacity=".95">
<span class="tvd-icon-heart"></span>
</a>
</li>
</ul>
</nav>
</div>
<?php include TVE_DASH_PATH . '/templates/share.phtml'; ?>

View File

@@ -0,0 +1,84 @@
<div class="ls-view-title"><?php echo __( 'Advanced Settings', 'thrive-cb' ); ?></div>
<div class="ls-advanced-settings-wrapper">
<p class="ls-advanced-setting-info">
<?php echo __( 'These optimization settings apply to WordPress core or 3rd party assets and may affect 3rd party plugin or theme functionality. Please make sure to thoroughly test your website after activating them.', 'thrive-cb' ); ?>
</p>
<?php if ( class_exists( '\TCB\Lightspeed\Gutenberg', false ) ): ?>
<div class="ls-advanced-gutenberg-settings">
<p class="ls-advanced-setting-disable-gutenberg">
<?php echo __( 'Disable loading Gutenberg scripts and styles on content where we can detect that it\'s not being used', 'thrive-cb' ); ?>
</p>
<div class="ls-option-item">
<input type="checkbox"
id="ls-disable-gutenberg-lp-checkbox"
data-key="<?php echo \TCB\Lightspeed\Gutenberg::DISABLE_GUTENBERG_LP; ?>"
class="noUi-target noUi-ltr noUi-horizontal noUi-background ls-advanced-setting-input"
<#= <?php echo TCB\Lightspeed\Gutenberg::DISABLE_GUTENBERG_LP ?> ? 'checked': '' #>>
<label for="ls-disable-gutenberg-lp-checkbox">
<?php echo __( 'Disable on Thrive Landing Pages', 'thrive-cb' ); ?>
</label>
</div>
<?php if ( tve_dash_is_ttb_active() ): ?>
<div class="ls-option-item">
<input type="checkbox"
id="ls-disable-gutenberg-content-checkbox"
data-key="<?php echo \TCB\Lightspeed\Gutenberg::DISABLE_GUTENBERG; ?>"
class="noUi-target noUi-ltr noUi-horizontal noUi-background ls-advanced-setting-input"
<#= <?php echo TCB\Lightspeed\Gutenberg::DISABLE_GUTENBERG ?> ? 'checked': '' #>>
<label for="ls-disable-gutenberg-content-checkbox">
<?php echo __( 'Disable on all content that uses a Thrive Theme Builder template', 'thrive-cb' ); ?>
</label>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ( \TCB\Integrations\WooCommerce\Main::active() ): ?>
<div class="ls-advanced-woocommerce-settings">
<p class="ls-advanced-setting-disable-woocommerce">
<?php echo __( 'Disable loading WooCommerce scripts and styles on content where we can detect that it\'s not being used', 'thrive-cb' ); ?>
</p>
<div class="ls-option-item">
<input type="checkbox"
id="ls-disable-woocommerce-lp-checkbox"
data-key="<?php echo \TCB\Lightspeed\Woocommerce::DISABLE_WOOCOMMERCE_LP; ?>"
class="noUi-target noUi-ltr noUi-horizontal noUi-background ls-advanced-setting-input"
<#= <?php echo TCB\Lightspeed\Woocommerce::DISABLE_WOOCOMMERCE_LP ?> ? 'checked': '' #>>
<label for="ls-disable-woocommerce-lp-checkbox">
<?php echo __( 'Disable on Thrive Landing Pages', 'thrive-cb' ); ?>
</label>
</div>
<?php if ( tve_dash_is_ttb_active() ): ?>
<div class="ls-option-item">
<input type="checkbox"
id="ls-disable-woocommerce-content-checkbox"
data-key="<?php echo \TCB\Lightspeed\Woocommerce::DISABLE_WOOCOMMERCE; ?>"
class="noUi-target noUi-ltr noUi-horizontal noUi-background ls-advanced-setting-input"
<#= <?php echo TCB\Lightspeed\Woocommerce::DISABLE_WOOCOMMERCE ?> ? 'checked': '' #> >
<label for="ls-disable-woocommerce-content-checkbox">
<?php echo __( 'Disable on all content that uses a Thrive Theme Builder template', 'thrive-cb' ); ?>
</label>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="ls-advanced-emoji-settings">
<p class="ls-advanced-setting-disable-emoji">
<?php echo __( 'Disable emojis', 'thrive-cb' ); ?>
</p>
<div class="ls-option-item">
<input type="checkbox"
id="ls-disable-emoji-lp-checkbox"
data-key="<?php echo \TCB\Lightspeed\Emoji::DISABLE_EMOJI; ?>"
class="noUi-target noUi-ltr noUi-horizontal noUi-background ls-advanced-setting-input"
<#= <?php echo TCB\Lightspeed\Emoji::DISABLE_EMOJI ?> ? 'checked': '' #>>
<label for="ls-disable-emoji-lp-checkbox">
<?php echo __( 'Prevent WordPress from automatically loading emojis in your pages.', 'thrive-cb' ); ?>
</label>
</div>
</div>
<a class="ls-save-advanced-settings tvd-waves-effect tvd-waves-light tvd-btn tvd-btn-green" style="width:300px;"><?php echo __( 'Save', 'thrive-cb' ); ?> </a>
<div class="page-content" style="width:300px; ">
<div class="progress-bar-wrapper" style="display: none;"></div>
</div>
</div>

View File

@@ -0,0 +1,46 @@
<div class="ls-view-title"><?php echo __( 'Font Settings', 'thrive-cb' ); ?></div>
<div class="ls-fonts-wrapper">
<div class="ls-option-item<#= canOptimizeFonts ? '' : ' ls-disabled-item' #>">
<input type="checkbox"
id="ls-enable-optimization-checkbox"
data-key="<?php echo \TCB\Lightspeed\Fonts::ENABLE_FONTS_OPTIMIZATION; ?>"
class="noUi-target noUi-ltr noUi-horizontal noUi-background ls-setting-input" <#= <?php echo TCB\Lightspeed\Fonts::ENABLE_FONTS_OPTIMIZATION ?> ? 'checked': '' #>>
<label for="ls-enable-optimization-checkbox">
<?php echo __( 'Enable Google Fonts Optimization', 'thrive-cb' ); ?>
</label>
<p class="ls-setting-info">
<?php echo __( 'Improves Google Fonts performance and combines multiple font requests for better Core Web Vital results.', 'thrive-cb' ); ?>
<a target="_blank" href="http://help.thrivethemes.com/en/articles/5448042-configuring-the-font-settings-in-project-lightspeed#h_31067c257a"><?php echo __( 'Learn more', 'thrive-cb' ); ?></a>
</p>
</div>
<div class="ls-option-item<#= canLoadFontsAsync ? '' : ' ls-disabled-item' #>">
<input type="checkbox"
id="ls-enable-async-fonts-checkbox"
data-key="<?php echo \TCB\Lightspeed\Fonts::ENABLE_ASYNC_FONTS_LOAD; ?>"
class="noUi-target noUi-ltr noUi-horizontal noUi-background ls-setting-input" <#= <?php echo TCB\Lightspeed\Fonts::ENABLE_ASYNC_FONTS_LOAD ?> ? 'checked': '' #>>
<label for="ls-enable-async-fonts-checkbox">
<?php echo __( 'Load Google Fonts Asynchronously', 'thrive-cb' ); ?>
</label>
<p class="ls-setting-info">
<?php echo __( 'Tells the browser to preload Google Fonts in the background, this can improve Core Web Vitals in some cases.', 'thrive-cb' ); ?>
<a target="_blank" href="http://help.thrivethemes.com/en/articles/5448042-configuring-the-font-settings-in-project-lightspeed#h_31067c257a/"><?php echo __( 'Learn more', 'thrive-cb' ); ?></a>
</p>
</div>
<div class="ls-option-item">
<input type="checkbox"
id="ls-disable-google-fonts-checkbox"
data-key="<?php echo \TCB\Lightspeed\Fonts::DISABLE_GOOGLE_FONTS; ?>"
class="noUi-target noUi-ltr noUi-horizontal noUi-background ls-setting-input" <#= <?php echo TCB\Lightspeed\Fonts::DISABLE_GOOGLE_FONTS ?> ? 'checked': '' #>>
<label for="ls-disable-google-fonts-checkbox">
<?php echo __( 'Disable all Google Fonts loaded by Thrive on your website.', 'thrive-cb' ); ?>
</label>
<p class="ls-setting-info">
<?php echo __( 'Prevent any Google font from loading in a page.', 'thrive-cb' ); ?>
<a target="_blank" href="http://help.thrivethemes.com/en/articles/5448042-configuring-the-font-settings-in-project-lightspeed#h_ac726f97ee">
<?php echo __( 'Learn more', 'thrive-cb' ); ?>
</a>
</p>
</div>
</div>

View File

@@ -0,0 +1,9 @@
<ul id="ls-menu-container"></ul>
<div>
<div id="ls-view-container"></div>
<div class="ls-footer">
<a href="<?php echo admin_url( 'admin.php?page=tve_dash_section' ); ?>" class="tvd-waves-effect tvd-waves-light tvd-btn-small tvd-btn-gray">
<?php echo __( 'Back To Dashboard', 'thrive-cb' ); ?>
</a>
</div>
</div>

View File

@@ -0,0 +1,3 @@
<li class="ls-menu-item<#= url.includes(currentRoute) ? ' active':'' #>">
<a href="<#= url #>"><#= label #></a>
</li>

View File

@@ -0,0 +1,15 @@
<div class="ls-optimization-wrapper">
<div class="page-content grey">
<div class="page-title"><?php echo __( 'Site Analysis Results', 'thrive-cb' ); ?></div>
<div class="page-text-wrapper">
<span class="big-icon success"></span>
<div class="text-title green-color">
<?php echo __( 'All assets on your site are optimized to the latest version', 'thrive-cb' ); ?>
</div>
</div>
<button class="lightspeed-button grey lightspeed-force-optimize">
<?php echo __( 'Rerun asset optimization', 'thrive-cb' ); ?>
</button>
</div>
<div class="page-footer"></div>
</div>

View File

@@ -0,0 +1,68 @@
<div class="ls-optimization-wrapper">
<div class="page-content ">
<svg id="lightspeed-icon" width="70" height="68" viewBox="0 0 70 68">
<g fill="none" fill-rule="evenodd">
<g>
<g>
<path d="M1.247 1.217H69.421V64.521H1.247z" transform="translate(-728 -189) translate(728 189)"/>
<path fill="#2A5082" fill-rule="nonzero" d="M68.39 0C69.279 0 70 .819 70 1.826v62.087c0 1.007-.722 1.826-1.61 1.826h-2.042l-.001-1.218h2.436V1.218H1.217v63.305l2.435-.001v1.218H1.61C.722 65.74 0 64.92 0 63.913V1.826C0 .82.722 0 1.61 0z" transform="translate(-728 -189) translate(728 189)"/>
<path stroke="#2A5082" stroke-width="1.2" d="M63.913 45.652V14.174c0-1.105-.895-2-2-2H8.087c-1.105 0-2 .895-2 2v31.478h0" transform="translate(-728 -189) translate(728 189)"/>
<path fill="#A3D4FF" stroke="#2A5082" stroke-width="1.2" d="M35.03 34.087c15.968 0 28.912 12.945 28.912 28.913 0 .717-.026 1.427-.077 2.13H54.7c.075-.7.113-1.41.113-2.13 0-10.926-8.857-19.783-19.783-19.783-10.925 0-19.782 8.857-19.782 19.783 0 .72.038 1.43.113 2.13H6.194c-.052-.703-.078-1.413-.078-2.13 0-15.968 12.945-28.913 28.913-28.913z" transform="translate(-728 -189) translate(728 189)"/>
<path fill="#2A5082" fill-rule="nonzero" d="M6.61 3.652c.624 0 1.13.507 1.13 1.131 0 .625-.506 1.131-1.13 1.131-.625 0-1.132-.506-1.132-1.13 0-.625.507-1.132 1.131-1.132zm4.976 0c.624 0 1.13.507 1.13 1.131 0 .625-.506 1.131-1.13 1.131-.625 0-1.131-.506-1.131-1.13 0-.625.506-1.132 1.13-1.132zm4.976 0c.625 0 1.131.507 1.131 1.131 0 .625-.506 1.131-1.13 1.131-.625 0-1.132-.506-1.132-1.13 0-.625.507-1.132 1.131-1.132zM5.508 7.913H64.551V9.13H5.508z"
transform="translate(-728 -189) translate(728 189)"/>
<g fill="#2A5082" fill-rule="nonzero">
<g>
<path d="M0 3.652H45.652V4.869H0zM0 0H45.652V1.217H0z" transform="translate(-728 -189) translate(728 189) translate(12.174 19.478)"/>
</g>
</g>
<path fill="#2A5082" fill-rule="nonzero" d="M52.348 4.261H64.52199999999999V5.478H52.348z" transform="translate(-728 -189) translate(728 189)"/>
<g stroke="#2A5082" stroke-linecap="round" stroke-width="1.5">
<path d="M2.243 14.923L2.763 19.159" transform="translate(-728 -189) translate(728 189) translate(9.16 34.391) scale(-1 1) rotate(70 0 13.466)"/>
<path d="M10.732 4.714L13.361 8.196" transform="translate(-728 -189) translate(728 189) translate(9.16 34.391) scale(-1 1) rotate(70 0 -10.75)"/>
<path d="M23.57 1.704L27.563 3.157" transform="translate(-728 -189) translate(728 189) translate(9.16 34.391) scale(-1 1) rotate(70 0 -34.083)"/>
<path d="M37.381 6.55L41.271 5.692" transform="translate(-728 -189) translate(728 189) translate(9.16 34.391) scale(-1 1) rotate(70 0 -50.042)"/>
<path d="M47.83 17.797L50.841 15.136" transform="translate(-728 -189) translate(728 189) translate(9.16 34.391) scale(-1 1) rotate(70 0 -53.992)"/>
</g>
<g fill="#2A5082" fill-rule="nonzero">
<path d="M.162.08c8.85.854 15.664 8.314 15.664 17.268 0 .254-.005.508-.016.76l-.02.379-1.199-.385c.012-.335.018-.586.018-.754 0-8.242-6.21-15.124-14.317-16.03L.162.081z" transform="translate(-728 -189) translate(728 189) translate(36.522 45.894)"/>
<path d="M11.285 10.968c.751 1.506 1.232 3.136 1.414 4.828l.033.34-1.243-.206c.02.019-.066-.4-.259-1.257-.289-1.285-.578-2.196-.892-2.866l-.046-.095.993-.744z" transform="translate(-728 -189) translate(728 189) translate(36.522 45.894)"/>
</g>
<g stroke="#2A5082" stroke-width="1.2" transform="translate(-728 -189) translate(728 189) translate(28.638 50.522)">
<path d="M9.267 18.085c2.417-.002 4.626-2.212 4.627-4.628.002-2.415-2.861-12.24-3.837-12.24-.975 0-5.044 9.403-5.181 11.977-.137 2.574 1.974 4.892 4.391 4.89z" transform="rotate(45 9.382 9.651)"/>
<circle cx="6.391" cy="12.478" r="2.13"/>
</g>
<path fill="#2A5082" fill-rule="nonzero"
d="M7.344 62.08l2.43.15v.85l-2.43-.042v-.959zm55.35-.442l.028.89-2.436.11-.032-.83 2.44-.17zM7.606 59.047l2.44.365-.086.635-2.44-.366.086-.634zm54.777-.45l.092.621-2.418.38-.091-.62 2.417-.38zM8.205 56.055l2.375.59-.147.592-2.376-.592.148-.59zm53.538-.432l.164.586-2.387.665-.163-.586 2.386-.665zM9.138 53.154l2.302.843-.21.572-2.302-.843.21-.572zm51.62-.433l.224.566-2.277.901-.224-.566 2.277-.9zm-48.88-4.937l2.046 1.316-.33.512-2.045-1.316.329-.512zm46.023-.415l.337.507-2.031 1.352-.338-.506 2.032-1.353zM13.7 45.31l1.901 1.544-.384.472-1.9-1.543.383-.473zm42.36-.365l.387.469-1.896 1.568-.388-.47 1.896-1.567zM15.78 43.066l1.707 1.769-.438.423-1.707-1.769.438-.423zm38.151-.345l.442.419-1.702 1.797-.441-.42 1.701-1.796zm-35.825-1.644L19.622 43l-.477.377-1.516-1.923.478-.377zm33.471-.307l.485.368-1.484 1.955-.485-.368 1.484-1.955zm-28.293-2.857l1.06 2.19-.548.265-1.06-2.19.548-.265zm23.06-.201l.554.254-1.018 2.217-.553-.254 1.018-2.217zm-20.244-.95l.816 2.313-.574.202-.816-2.312.574-.203zm17.41-.132l.579.191-.765 2.311-.578-.191.765-2.31zm-14.473-.692l.556 2.392-.593.138-.556-2.392.593-.138zm11.524-.084l.596.125-.503 2.391-.595-.125.502-2.391zm-8.436-.398l.327 2.44-.673.072-.327-2.44.673-.072zm5.457-.034l.723.058-.277 2.424-.723-.058.277-2.424z"
transform="translate(-728 -189) translate(728 189)"/>
</g>
</g>
</g>
</svg>
<div class="page-title"><?php echo __( 'Optimize assets for a blazing fast site', 'thrive-cb' ); ?></div>
<div class="page-text-wrapper">
<div class="text-title blue-color"><?php echo __( 'Asset optimization is vital for a fast site.', 'thrive-cb' ); ?></div>
<div class="text-main">
<div class="text-paragraph">
<?php echo __( 'This optimization tool ensure that assets such as javascript and CSS files are only loaded on pieces content where theyre actually used.', 'thrive-cb' ); ?>
</div>
<div class="text-paragraph">
<?php echo __( 'Your site must be analyzed first to find which assets can be optimized. Please note that site analysis may take 1-2 minutes depending on the size of your site', 'thrive-cb' ); ?>
</div>
<a target="_blank" class="link-text" href="https://help.thrivethemes.com/en/articles/5295426-what-is-the-asset-optimization-tool-how-does-it-work">
<?php echo __( 'Learn more about this tool ' ); ?>
</a>
</div>
</div>
<div class="page-button-wrapper white">
<div class="button-description bold">
<?php echo __( 'Click the button below to get started', 'thrive-cb' ); ?>
</div>
<button class="lightspeed-button blue-color lightspeed-analyze">
<span class="analyze-icon"></span>
<?php echo __( 'Analyze this site', 'thrive-cb' ); ?>
</button>
</div>
</div>
<div class="page-footer"></div>
</div>

View File

@@ -0,0 +1,5 @@
<div class="text-paragraph failed-item">
<span><#= index #></span>
<strong><#= group #></strong>
<span><#= name #></span>
</div>

View File

@@ -0,0 +1,43 @@
<div class="ls-optimization-wrapper">
<div class="page-content grey">
<div class="page-title">
<?php echo __( 'Asset optimization finished!', 'thrive-cb' ); ?>
<div class="page-subtitle"><#= optimizationTime #></div>
</div>
<div class="page-text-wrapper">
<div class="optimization-results-wrapper">
<div class="optimization-result">
<div class="result-wrapper success">
<span class="big-icon success"></span>
<div class="result-description">
<div class="number"><#= optimizedItems #></div>
<div class="description"><?php echo __( 'optimized assets', 'thrive-cb' ); ?></div>
</div>
</div>
</div>
<# if(failedItems > 0) { #>
<div class="optimization-result">
<div class="result-wrapper fail">
<span class="big-icon fail"></span>
<div class="result-description">
<div class="number"><#= failedItems #></div>
<div class="description"><?php echo __( 'failed to optimize*', 'thrive-cb' ); ?></div>
</div>
</div>
<button class="link-text show-failed"><?php echo __( '*View entire failed list', 'thrive-cb' ); ?></button>
</div>
<# } #>
</div>
<div class="failed-items"></div>
<div class="page-button-wrapper">
<div class="divider"></div>
<div class="button-description normal">
<?php echo __( 'Return to the control panel to enable optimized asset loading on your site', 'thrive-cb' ); ?>
</div>
<button class="lightspeed-button blue-color go-to-home">
<?php echo __( 'Go to control panel', 'thrive-cb' ); ?>
</button>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,12 @@
<div class="text-paragraph <#= status === 'running' ? 'optimizing':'' #>">
<# if(status === 'optimized') { #>
<span class="small-icon success"></span>
<# } else if(status === 'running') { #>
<span class="spinner is-active"></span>
<# } else if(status === 'fail') { #>
<span class="small-icon fail"></span>
<# } else { #>
<span class="waiting"></span>
<# } #>
<#= items.where( {optimized: true} ).length #> of <#= items.length #>&nbsp;<strong><#= label #></strong>&nbsp;have been optimized.
</div>

View File

@@ -0,0 +1,25 @@
<div class="ls-optimization-wrapper">
<div class="page-content grey">
<div class="page-title"><?php echo __( "Your assets aren't fully optimized", 'thrive-cb' ); ?></div>
<div class="page-text-wrapper">
<span class="big-icon warning"></span>
<div class="text-title red-color"><?php echo __( 'None of your assets are optimized. ', 'thrive-cb' ); ?></div>
<div class="text-main">
<div class="text-paragraph">
<?php echo __( 'Click the button below to migrate to the latest version for additional performance benefits. Once complete, you can disable and enable site optimizations at any time with a single click', 'thrive-cb' ); ?>
</div>
</div>
</div>
<button class="lightspeed-button blue-color lightspeed-optimize">
<?php echo __( 'Optimize my site', 'thrive-cb' ); ?>
</button>
<div class="page-footnote-wrapper">
<div class="footnote-text">
<?php echo __( 'Please note that optimization may take some time to complete depending on the size of your site. Youll see a live update of migration occurring. You can leave it running in the background and come back at any point to see progress.', 'thrive-cb' ); ?>
</div>
<a class="link-text" target="_blank" href="https://help.thrivethemes.com/en/articles/5295426-what-is-the-asset-optimization-tool-how-does-it-work">
<?php echo __( 'Learn more about the migration process', 'thrive-cb' ); ?>
</a>
</div>
</div>
</div>

View File

@@ -0,0 +1,23 @@
<div class="ls-optimization-wrapper">
<div class="page-content grey">
<div class="page-title"><?php echo __( "Some of your site assets aren't fully optimized", 'thrive-cb' ); ?></div>
<div class="page-text-wrapper">
<span class="big-icon continue"></span>
<div class="text-title blue-color">
<?php echo sprintf( __( '%s of %s items have been updated to the latest version.', 'thrive-cb' ),
'<#= optimizedItems #>',
'<#= totalItems #>'
); ?>
</div>
<div class="text-main">
<div class="text-paragraph">
<?php echo __( 'Click the button below to continue until your site is fully optimized.', 'thrive-cb' ); ?>
</div>
</div>
</div>
<button class="lightspeed-button blue-color lightspeed-optimize">
<?php echo __( 'Continue optimization', 'thrive-cb' ); ?>
</button>
</div>
<div class="page-footer"></div>
</div>

View File

@@ -0,0 +1,31 @@
<div class="ls-optimization-wrapper">
<div class="page-header">
<?php echo __( 'Please note this optimization tool will run in the background.<b> Please dont close the page</b> while it is running. If the migration fails before completing then you can rerun the tool and it will automatically continue from where it got to previously', 'thrive-cb' ); ?>
</div>
<div class="page-content white">
<div class="page-title"><?php echo __( 'Asset Optimization in Progress …', 'thrive-cb' ); ?></div>
<div class="page-text-wrapper">
<div class="text-main align-left">
<div class="text-paragraph mt-0 mb-5">
<span class="small-icon estimated-time-icon"></span>
<?php echo sprintf( __( 'Estimated time to completion:&nbsp<b>%s</b>', 'thrive-cb' ), '<span class="optimization-time"> ~ </span>' ); ?>
</div>
<div class="text-paragraph mt-0 mb-5">
<span class="small-icon success"></span>
<?php echo sprintf( __( '<b>%s of %s items</b>&nbsphave been updated to the latest version', 'thrive-cb' ), '<span class="optimized-items"> ~ </span>', '<span class="total-items"> ~ </span>' ); ?>
</div>
<div class="text-paragraph mt-0 red-color failed-optimization-wrapper">
<span class="small-icon fail"></span>
<?php echo sprintf( __( '<b>%s items</b>&nbspfailed to update', 'thrive-cb' ), '<span class="optimization-failed-items"> ~ </span>' ); ?>
</div>
</div>
</div>
<div class="currently-optimizing">
<?php echo __( 'Currently optimizing: ', 'thrive-cb' ); ?><span class="item-in-progress"></span>
</div>
<div class="progress-bar-wrapper"></div>
</div>
<div class="groups-to-optimize"></div>
</div>

View File

@@ -0,0 +1,16 @@
<div class="tvd-switch">
<div class="label-text">
<div class="text">
<?php echo __( 'Display optimized assets on the front end of your site ', 'thrive-cb' ); ?>
</div>
<span class="info-icon"></span>
<div class="info-tooltip" style="display:none">
<?php echo __( 'After your optimized code has been prepared, you can enable or disable it in one click with this toggle. When disabled, your website will fall back to loading the assets it did before optimization. You may need to analyze your site again before enabling.', 'thrive-cb' ); ?>
</div>
</div>
<label>
<input type="checkbox" class="tvd-toggle-input toggle-lightspeed" <#= isEnabled ? 'checked': '' #>>
<span class="tvd-lever"></span>
</label>
</div>

View File

@@ -0,0 +1,4 @@
<div class="progress-bar">
<div class="progress-bar-percentage"><#= progress #>%</div>
<div class="progress-bar-value" style="width: <#= progress #>%;"></div>
</div>

View File

@@ -0,0 +1,49 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
?>
<div class="tcb-modal-content sym-admin-modal">
<span class="tcb-modal-title">
<#= title #>
</span>
<div class="error-container"></div>
<p class="tcb-modal-description">
<#= description #>
</p>
<div class="save-container">
<div class="tvd-input-field">
<input type="text" class="content-title" name="title" placeholder="<#= placeholder #>">
</div>
<# if ( is_symbol && show_category ) { #>
<div class="tvd-input-field align-left category-container">
<label class="tcb-symbol-check" for="add_category">
<input id="add_category" type="checkbox" class="" name="add_category">
<span class="checkmark"></span>
<?php echo __( 'Add symbol to a category', 'thrive-cb' ); ?>
</label>
<div class="category_selection" style="display: none;">
<div class="">
<select id="tcb-save-template-categ-suggest"></select>
<input type="hidden" id="tcb-save-template-category-id" value=""/>
</div>
</div>
</div>
<# } #>
</div>
<div class="tcb-modal-footer">
<button type="button" class="tvd-modal-close">
<?php echo __( 'Cancel', 'thrive-cb' ) ?>
</button>
<a class="tvd-submit tvd-modal-save tvd-right" href="#" target="_blank" >
<#= save_text #>
</a>
</div>
</div>

View File

@@ -0,0 +1,39 @@
<div class="tcb-modal-content tcb-move-symbol">
<span class="tcb-modal-title">
<?php echo __( 'Move template to other category', 'thrive-cb' ) ?>
</span>
<p class="tcb-modal-description">
<?php echo __( 'Select from the dropdown bellow where do you want to move ', 'thrive-cb' ) ?>
</p>
<div class="save-container">
<div>
<label for="tcb-move-input"><?php echo __( 'Current Category ', 'thrive-cb' ) ?></label>
<input type="text" name="tcb-move-input" readonly="readonly" value="<#= model.get('name') #>">
</div>
<div>
<label for="tcb-admin-t-categ-combo" class="tcb-admin-t-categ-combo-label"><?php echo __( 'Select New Category ', 'thrive-cb' ) ?></label>
<select id="tcb-admin-t-categ-combo">
<#
TVE_Admin.globals.templates.each(function(tmodel, index) {
#>
<option value="<#= tmodel.get('id') #>"><#= tmodel.get('name') #></option>
<#
});
#>
</select>
</div>
</div>
<div class="tvd-modal-footer tcb-move-template-footer">
<button type="button" class="tvd-modal-close">
<?php echo __( 'Cancel', 'thrive-cb' ) ?>
</button>
<button type="button" class="tvd-submit tvd-modal-submit tvd-right">
<?php echo __( 'Save', 'thrive-cb' ) ?>
</button>
</div>
</div>

View File

@@ -0,0 +1,39 @@
<div class="tcb-modal-content tcb-move-symbol">
<span class="tcb-modal-title">
<?php echo __( 'Move template to other category', 'thrive-cb' ); ?>
</span>
<p class="tcb-modal-description">
<?php echo __( 'Select from the dropdown bellow where do you want to move ', 'thrive-cb' ) ?>
</p>
<div class="save-container">
<div>
<label for="tcb-move-input"><?php echo __( 'Current Category ', 'thrive-cb' ) ?></label>
<input type="text" name="tcb-move-input" readonly="readonly" value="<#= current_category['name'] #>">
</div>
<div>
<label for="tcb-admin-t-categ-combo" class="tcb-admin-t-categ-combo-label"><?php echo __( 'Select New Category ', 'thrive-cb' ) ?></label>
<select id="tcb-admin-t-categ-combo">
<# categories.each( function(category, index) { #>
<# if ( category.get('term_id') !== current_category['term_id'] ) { #>
<option value="<#= category.get('term_id') #>">
<#= category.get('name') #>
</option>
<# } #>
<# }); #>
</select>
</div>
</div>
<div class="tvd-modal-footer tcb-move-template-footer">
<button type="button" class="tvd-modal-close">
<?php echo __( 'Cancel', 'thrive-cb' ) ?>
</button>
<button type="button" class="tvd-submit tvd-modal-submit tvd-right">
<?php echo __( 'Save', 'thrive-cb' ) ?>
</button>
</div>
</div>

View File

@@ -0,0 +1,36 @@
<div class="tcb-modal-content sym-admin-modal tve-add-new-category">
<span class="tcb-modal-title"><?php echo __( 'Add New Category', 'thrive-cb' ) ?></span>
<p class="tcb-modal-description"><?php echo __( 'Here you can add one or more categories.', 'thrive-cb' ) ?></p>
<div class="tvd-row" id="tcb-categ-input"></div>
<div class="tvd-row">
<div class="tvd-col tvd-s12">
<a href="javascript:void(0)" class="tvd-left tvd-waves-effect tvd-waves-light tvd-btn tvd-btn-small tvd-btn-blue" id="tcb-add-new-category-input">
<?php echo __( 'Add new', 'thrive-cb' ) ?>
</a>
</div>
</div>
<div class="tvd-modal-footer tve-add-new-category-foio">
<button type="button" class="tvd-modal-close">
<?php echo __( 'Cancel', 'thrive-cb' ) ?>
</button>
<button type="button" class="tvd-submit tvd-modal-submit tvd-right">
<?php echo __( 'Save', 'thrive-cb' ) ?>
</button>
</div>
</div>
<div class="row hidden" id="tcb-categ-input-template" style="display: none;">
<div class="tcb-admin-text-element-wrapper">
<div class="tvd-col tvd-s11">
<input type="text" class="tcb-category-input-item" placeholder="<?php echo __( 'Enter the name of the new category', 'thrive-cb' ) ?>">
</div>
<div class="tvd-col tvd-s1">
<span class="tvd-icon-trash-o tvd-pointer tcb-admin-delete-text-element"></span>
</div>
</div>
</div>

View File

@@ -0,0 +1,6 @@
<div class="tcb-modal-tab-elem" data-id="<#= item.get('id') #>" data-type="symbol" data-cloud="<# if ( ! item.get('from_cloud') ) { #>0<# } else { #>1<# } #>">
<span class="tcb-modal-tab-item-title">
<#= ( item.get('title') )? item.get('title').rendered : item.get('post_title') #>
</span>
<div class="tcb-modal-tab-image" style="background-image: url('<#= item.get('thumb').url #>');"></div>
</div>

View File

@@ -0,0 +1,48 @@
<span class="tcb-modal-title"><?php echo __( 'Choose a ', 'thrive-cb' ) ?>
<#= section_name #>
</span>
<div class="tcb-modal-tabs">
<div class="sub-header">
<ul class="tcb-modal-tabs-links">
<li data-tab="create-hf"><?php echo __( 'Create New ', 'thrive-cb' ); ?>
<#= section_name #>
</li>
</ul>
<div class="abs-r">
<input type="text" class='search-sections' name="search-sections" id="search-sections" placeholder="<?php echo __( 'Search ', 'thrive-cb' ); ?><#= section_name + 's' #>&nbsp;&hellip;">
</div>
</div>
</div>
<div class="tcb-modal-tab-container create-hf">
<div class="tcb-modal-tabs-sep">
<span><?php echo __( 'Start with one of our templates' ); ?></span>
<span class="separator"></span>
<span class="tcb-hf-icon" data-direction="top"></span>
</div>
<div class="tcb-tabs-templates">
<div class="our-templates"></div>
</div>
<div class="tcb-modal-tabs-sep">
<span><?php echo __( 'Or use a saved ', 'thrive-cb' ); ?>
<#= section_name #><?php echo __( ' as a Template' ) ?></span>
<span class="separator"></span>
<span class="tcb-hf-icon" data-direction="top"></span>
</div>
<div class="tcb-tabs-templates">
<div class="saved-templates">
<div class="tcb-modal-tab-elem click">
<span class="tcb-modal-tab-item-title"><?php echo __( 'Our Template', 'thrive-cb' ) ?></span>
<div class="tcb-modal-tab-image" style="background-image: url('');"></div>
</div>
</div>
</div>
</div>
<div class="tcb-modal-footer pl-0 pr-0">
<button type="button" class="tcb-modal-close"><?php echo __( 'Cancel', 'thrive-cb' ) ?></button>
<button type="button" disabled="true" class="tcb-hf-right tve-button white-text green"><span class="user-action"><?php echo __( 'Choose ', 'thrive-cb' ) ?></span>
<#= section_name #>
</button>
</div>

View File

@@ -0,0 +1,22 @@
<div class="tcb-modal-tabs step-two mt-0 mb-20">
<span class="tcb-modal-title m-0"><?php echo __( 'Create a new ', 'thrive-cb' ) ?><#= type #></span>
</div>
<div class="error-container"></div>
<div class="tcb-modal-tab-container step-two">
<div class="mt-20">
<div class="tcb-hf-create-title">
<span>
<?php echo __( 'Give a name to your ', 'thrive-cb' ) ?><#= type #>:
</span>
<input type="text" class="item-title" id="dashboard-create-section" placeholder="Your New <#= type.charAt(0).toUpperCase() + type.slice(1) #>'s Name">
</div>
<div class="item-create"></div>
</div>
</div>
<div class="tcb-modal-footer">
<button type="button" class="tcb-hf-back"><?php echo __( 'Back', 'thrive-cb' ) ?></button>
<a href="#" target="_blank" class="tcb-hf-right tve-button white-text green"><?php echo __( 'Add New ', 'thrive-cb' ) ?><#= type #></a>
</div>

View File

@@ -0,0 +1 @@
<div class="sections-create-container"></div>

View File

@@ -0,0 +1,9 @@
<div class="no-search-results" style="display: none;">
<?php echo __( "Oups! We couldn't find anything called " ) ?><span class="search-word"><#= message #></span><?php echo __( '. Maybe search for something else ?' ); ?>
</div>
<div class="no-sections-on-site">
<?php echo __( "You don't have any " ) ?><span class="section-type"><#= type #></span><?php echo __( ' created on the site' ) ?>
</div>
<div class="no-sections-on-cloud">
<?php echo __( "For the moment we don't have any " ) ?><span class="section-type"><#= type #></span><?php echo __( ' created' ) ?>
</div>

View File

@@ -0,0 +1,30 @@
<div class="tvd-modal-content tvd-red tcb-delete-template">
<h3 class="tvd-white-text">
<#= text #>
</h3>
<div class="tvd-v-spacer"></div>
<div class="tvd-row hidden tcb-admin-extra-setting-row">
<div class="tvd-col tvd-s12 tvd-left">
<input type="checkbox" class="noUi-target noUi-ltr noUi-horizontal noUi-background" id="tcb-admin-extra-setting-check">
<label for="tcb-admin-extra-setting-check" class="tvd-white-text"><?php echo __( 'Also delete the saved templates', 'thrive-cb' ); ?></label>
</div>
</div>
</div>
<div class="tvd-modal-footer tvd-red tcb-delete-template">
<div class="tvd-row">
<div class="tvd-col tvd-s12 tvd-m6">
<a href="javascript:void(0)"
class="tvd-btn-flat tvd-btn-flat tvd-btn-flat-secondary tvd-btn-flat-light tvd-left tvd-modal-close">
<?php echo __( "Cancel", 'thrive-cb' ); ?>
</a>
</div>
<div class="tvd-col tvd-s12 tvd-m6">
<a href="javascript:void(0)"
class="tvd-modal-submit tvd-btn-flat tvd-btn-flat-primary tvd-btn-flat-light tvd-right">
<?php echo __( 'Delete', 'thrive-cb' ); ?>
</a>
</div>
</div>
</div>
<a href="javascript:void(0)" class="tvd-modal-action tvd-modal-close tvd-modal-close-x tvd-white-text"><i class="tvd-icon-close2"></i></a>

View File

@@ -0,0 +1,95 @@
<?php
use TCB\Notifications\Main;
$has_saved_custom_content = Main::get_custom_content();
$display_image = ! $has_saved_custom_content ? 'display-image' : '';
$custom_template_id = Main::get_notification_post_id();
?>
<div class="notifications-templates-wrapper active-template">
<div class="templates-type-wrapper">
<div class="templates-type">
<span>
<?php echo __( 'Currently active template', 'thrive-cb' ) ?>
</span>
</div>
</div>
<div class="templates-wrapper">
<div class='notifications-previews-wrapper notifications-default' data-id="0">
<div class="notifications-info">
<div class="notification-title">
<?php echo __( 'Default template', 'thrive-cb' ) ?>
</div>
<span class="info-icon">
<div class="info-tooltip" style="display:none">
<?php echo __( 'The default template cannot be edited, but will<br>load leaner code on your web pages.', 'thrive-cb' ); ?>
</div>
</span>
<div class="active-badge">
<?php echo __( 'Active', 'thrive-cb' ); ?>
</div>
<button class="activate-notification-template click">
<?php echo __( 'Make active', 'thrive-cb' ); ?>
</button>
</div>
<div class='notifications-wrapper'>
<div class='notification-wrapper notification-success display-image'></div>
<div class='notification-wrapper notification-error display-image'></div>
</div>
</div>
</div>
</div>
<div class="notifications-templates-wrapper inactive-templates <?php echo $has_saved_custom_content ? ' other-templates' : '' ?>">
<div class="templates-type-wrapper">
<div class="templates-type">
<span><?php echo __( $has_saved_custom_content ? 'Other available template ' : 'Inactive templates', 'thrive-cb' ) ?></span>
<span class="info-icon">
<div class="info-tooltip" style="display:none">
<?php echo __( 'To activate a template you must<br>first press Edit and then click Save', 'thrive-cb' ); ?>
</div>
</span>
</div>
</div>
<div class="templates-wrapper">
<div class='notifications-previews-wrapper notifications-custom' data-id='<?= $custom_template_id ?>'>
<div class="notifications-info">
<div class="notification-title">
<?php echo __( 'Custom templates', 'thrive-cb' ) ?>
</div>
<span class="info-icon">
<div class="info-tooltip" style="display:none">
<?php echo __( 'Custom notification templates can be visually<br>edited to fit your website brand.', 'thrive-cb' ); ?>
</div>
</span>
<div class="active-badge">
<?php echo __( 'Active', 'thrive-cb' ); ?>
</div>
<button class="activate-notification-template click">
<?php echo __( 'Make active', 'thrive-cb' ); ?>
</button>
</div>
<div class='notifications-wrapper'>
<div class='notification-wrapper notification-success <?= $display_image ?>'>
<?php if ( $has_saved_custom_content ) {
echo Main::get_notification_content( false, 'success', true, true );
} ?>
</div>
<div class='notification-wrapper notification-warning <?= $display_image ?>'>
<?php if ( $has_saved_custom_content ) {
echo Main::get_notification_content( false, 'warning', true, true );
} ?>
</div>
<div class='notification-wrapper notification-error <?= $display_image ?>'>
<?php if ( $has_saved_custom_content ) {
echo Main::get_notification_content( false, 'error', true, true );
} ?>
</div>
<div class='actions-wrapper'>
<a class='edit-notifications' href='<#= editLink #>' target="_blank"><?php echo $has_saved_custom_content ? __( 'Edit template', 'thrive-cb' ) : __( 'Edit and activate template', 'thrive-cb' ) ?></a>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,5 @@
<div class="symbols-categories-list">
<div class="term-item">
<?php echo __('Symbols','thrive-cb') ?>
</div>
</div>

View File

@@ -0,0 +1,11 @@
<div class="category-name">
<span class="cat-name"><#= category.get('name') #></span>
<# if ( category.get('term_id') !== 0 ) { #>
<a data-tooltip="<?php _e( 'Change Name', 'thrive-cb' ); ?>" data-position="top" class="tvd-tooltipped tvd-icon-pencil sym-cat-pen sym-pen edit-category-name"></a>
<a data-tooltip="<?php _e( 'Delete Category', 'thrive-cb' ); ?>" data-position="left" class="tvd-tooltipped sym-icon sym-delete delete-category">
<?php echo tcb_admin_icon( 'delete' ); ?>
</a>
<# } #>
</div>

View File

@@ -0,0 +1 @@
<div class="symbols-container"></div>

View File

@@ -0,0 +1,7 @@
<button class="create-category <# if ( ct_selected ) { #>sym-down<# } #>"><#= create_text #></button>
<# if ( ct_selected ) { #>
<div class="sym-btn-drop sym-move">
<span class="new-symbol"><?php echo __( 'Symbol', 'thrive-cb' ); ?></span>
<span class="new-cat"><?php echo __( 'Category', 'thrive-cb' ); ?></span>
</div>
<# } #>

View File

@@ -0,0 +1,23 @@
<div class="symbol-item modal-item" data-id="<#= item.get('id') #>">
<div class="sym-title-area">
<span class="symbol-title">
<span class="symbol-title-text"><#= item.get('title').rendered #></span>
<a data-tooltip="<?php _e( 'Change Name', 'thrive-cb' ); ?>" data-position="top" class="tvd-tooltipped tvd-icon-pencil sym-pen"></a>
</span>
<div class="sym-right-icons">
<a data-tooltip="<?php _e( 'Move to another Category', 'thrive-cb' ); ?>" data-position="top" class="tvd-tooltipped sym-icon sym-move">
<?php echo tcb_admin_icon( 'move-symbol' ); ?>
</a>
<a data-tooltip="<?php _e( 'Make a Copy', 'thrive-cb' ); ?>" data-position="top" class="tvd-tooltipped sym-icon sym-duplicate">
<?php echo tcb_admin_icon( 'duplicate' ); ?>
</a>
<a data-tooltip="<?php _e( 'Delete Symbol', 'thrive-cb' ); ?>" data-position="top" class="tvd-tooltipped sym-icon sym-delete">
<?php echo tcb_admin_icon( 'delete' ); ?>
</a>
</div>
</div>
<div style="background-image: url('<#= item.get('thumb').url #>');" class="sym-image edit-symbol" data-height="<#= item.get('thumb').h #>" data-width="<#= item.get('thumb').w #>">
<button><?php _e( 'Edit Symbol', 'thrive-cb' ); ?></button>
</div>
</div>

View File

@@ -0,0 +1,10 @@
<# if ( length === 0 ) { #>
<div class="sym-no-sym tcb-masonry-item">
<p><?php echo __( 'You have no symbols added in this category. You can either create a new symbol or move an existing symbol to this category.' ); ?></p>
<button class="sym-button open-create-modal"><?php echo __( 'Create New Symbol', 'thrive-cb' ); ?></button>
</div>
<# } else { #>
<div class="sym-add-item open-create-modal tcb-masonry-item">
<div><a class="sym-icon sym-plus"></a><?php echo __( 'Create New Symbol', 'thrive-cb' ); ?></div>
</div>
<# } #>

View File

@@ -0,0 +1,12 @@
<div class="symbols-error message-inline hf-only-admin">
<div class="tcb-notification">
<div class="tcb-notification-icon tcb-notification-icon-error">
<!-- --><?php //tcb_icon( 'close2' ) ?>
</div>
<div class="tcb-notification-content">
<div>
<pre><#= error_message #></pre>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,5 @@
<div class="search-input-container">
<#= input_title #>: <input type="search" placeholder="<#= input_placeholder #>&hellip;" name="search-symbols" class="search-symbols">
</div>

View File

@@ -0,0 +1,20 @@
<div class="symbol-item modal-item" data-id="<#= item.get('id') #>">
<div class="sym-title-area">
<span class="symbol-title">
<span class="symbol-title-text"><#= item.get('title').rendered #></span>
<a data-tooltip="<?php _e( 'Change Name', 'thrive-cb' ); ?>" data-position="top" class="tvd-tooltipped tvd-icon-pencil sym-pen"></a>
</span>
<div class="sym-right-icons">
<a data-tooltip="<?php _e( 'Make a Copy', 'thrive-cb' ); ?>" data-position="top" class="tvd-tooltipped sym-icon sym-duplicate">
<?php echo tcb_admin_icon( 'duplicate' ); ?>
</a>
<a data-tooltip="<?php _e( 'Delete ', 'thrive-cb' ); ?>" data-position="top" class="tvd-tooltipped sym-icon sym-delete">
<?php echo tcb_admin_icon( 'delete' ); ?>
</a>
</div>
</div>
<div style="background-image: url('<#= item.get('thumb').url #>');" class="sym-image edit-symbol" data-height="<#= item.get('thumb').h #>" data-width="<#= item.get('thumb').w #>">
<button><?php _e( 'Edit ', 'thrive-cb' ); ?><#= type.charAt(0).toUpperCase() + type.substr(1) #></button>
</div>
</div>

View File

@@ -0,0 +1 @@
<div class="sections-container"></div>

View File

@@ -0,0 +1,5 @@
<div class="sections-list-items tcb-masonry-grid"></div>
<div class="no-items"></div>
<div class="create-section"><?php echo __( 'Create New', 'thrive-cb' ) ?>
<#= type.charAt( 0 ).toUpperCase() + type.slice( 1, -1 ) #>
</div>

View File

@@ -0,0 +1,4 @@
<input id="tcb-admin-edit-text" data-bind="value" type="text" value="<#= item.get('value') #>">
<label for="tcb-admin-edit-text" <# if ( item.get( 'required' ) ) { #> data-error="<?php echo sprintf( __( '%s is required', 'thrive-cb' ), "<#= item.get( 'label' ) #>" ) ?>" <# } #> class="tvd-active">
<#= ( item.get('show_label') ? item.get('label') : '&nbsp;' ) #>
</label>

View File

@@ -0,0 +1,28 @@
<div class="tvd-row">
<div class="tvd-col tvd-s4">
<span class="tvd-card-title">
<#= model.get('name') #>
</span>
<# if(_.isNumber( model.get( 'id' ) )){ #>
<span data-tooltip="<?php _e( 'Change Text', 'thrive-cb' ); ?>" data-position="top" class="tvd-tooltipped tvd-icon-pencil tvd-pointer tcb-admin-edit-category-name"></span>
<# } #>
</div>
<div class="tvd-col tvd-s8">
<# if(_.isNumber( model.get( 'id' ) )){ #>
<span data-tooltip="<?php _e( 'Delete Category', 'thrive-cb' ); ?>" data-position="left" class="tvd-tooltipped tcb-admin-delete-category-item">
<?php echo tcb_admin_icon( 'delete' ); ?>
</span>
<# } #>
</div>
</div>
<# if ( ! collection_length ) { #>
<p><?php echo __('You have no templates added in this category. You can either save elements in Architect as Content Templates or move existing templates to this category'); ?></p>
<# } #>
<div class="tcb-masonry-grid fill-content tcb-admin-template-t-item"></div>
<div class="tvd-row tcb-admin-show-more-less hidden">
<div class="tvd-col tvd-s12 tvd-center">
<span class="tvd-pointer tcb-admin-show-more-less-btn"><?php echo __( ' Show more templates', 'thrive-cb' ) ?></span>
</div>
</div>

View File

@@ -0,0 +1,19 @@
<div class="tvd-row">
<div class="tvd-col tvd-s12">
<h3>
<#= model.get('name') #>
</h3>
</div>
</div>
<div class="tvd-row">
<div class="tvd-col tvd-s12 tcb-admin-template-preview">
<img src="<#= model.get('thumb') ? model.get('thumb').url : model.get('image_url') #>" alt="Template Image">
</div>
</div>
<div class="tvd-row">
<div class="tvd-col tvd-s12">
<a href="#templatessymbols" class="tvd-btn-flat tvd-btn-flat-primary tvd-btn-flat-dark tvd-waves-effect">
&laquo; <?php echo __( 'Back to templates & symbols', 'thrive-cb' ); ?>
</a>
</div>
</div>

View File

@@ -0,0 +1 @@
<div class="tvd-row" id="tcb-user-template-list"></div>

View File

@@ -0,0 +1,20 @@
<div class="tvd-ct-elem">
<div>
<div class="tcb-admin-template-name">
<span class="tvd-card-title">
<#= model.get('name') #>
</span>
<span data-tooltip="<?php _e( 'Change Text', 'thrive-cb' ); ?>" data-position="top" class="tvd-tooltipped tvd-icon-pencil tvd-pointer tcb-admin-edit-template-name"></span>
</div>
<a data-tooltip="<?php _e( 'Move to another Category', 'thrive-cb' ); ?>" data-position="top" class="tvd-tooltipped">
<?php echo tcb_admin_icon( 'move-symbol' ); ?>
</a>
<a data-tooltip="<?php _e( 'Delete Template', 'thrive-cb' ); ?>" data-position="top" class="tvd-tooltipped tcb-admin-delete-template-item">
<?php echo tcb_admin_icon( 'delete' ); ?>
</a>
</div>
<div class="tcb-admin-image-overlay-wrapper">
<img src="<#= model.get('thumb') && model.get('thumb').url ? model.get('thumb').url : model.get('image_url') #>" class="sym-image" data-height="<#= model.get('thumb').h || 120 #>" data-width="<#= model.get('thumb').w || 250 #>"/>
<a class="tcb-admin-preview-text" href="#template/<#= model.get('id') #>"><?php echo __( 'Preview', 'thrive-cb' ); ?></a>
</div>
</div>