first commit

This commit is contained in:
Ryan Ariana
2024-05-06 11:04:37 +07:00
commit aee061ddba
7322 changed files with 2918816 additions and 0 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
@font-face{font-family:"stratum";src:url("../fonts/stratum.eot");src:url("../fonts/stratum.eot?#iefix") format("eot"),url("../fonts/stratum.woff") format("woff"),url("../fonts/stratum.ttf") format("truetype"),url("../fonts/stratum.svg#stratum") format("svg")}[class^="stratum-icon-"],[class*=" stratum-icon-"]{font-family:"stratum";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-style:normal;font-variant:normal;font-weight:normal;font-size:inherit;line-height:1;text-decoration:none;text-transform:none}[class^="stratum-icon-"]:before,[class*=" stratum-icon-"]:before{display:block}.stratum-icon-advanced-accordion:before{content:"\E001"}.stratum-icon-advanced-google-map:before{content:"\E002"}.stratum-icon-advanced-posts:before{content:"\E003"}.stratum-icon-advanced-slider:before{content:"\E004"}.stratum-icon-advanced-tabs:before{content:"\E005"}.stratum-icon-banner:before{content:"\E006"}.stratum-icon-circle-progress-bar:before{content:"\E007"}.stratum-icon-countdown:before{content:"\E008"}.stratum-icon-counter:before{content:"\E009"}.stratum-icon-flip-box:before{content:"\E00A"}.stratum-icon-horizontal-timeline:before{content:"\E00B"}.stratum-icon-image-accordion:before{content:"\E00C"}.stratum-icon-image-hotspot:before{content:"\E00D"}.stratum-icon-instagram:before{content:"\E00E"}.stratum-icon-lottie-animations:before{content:"\E00F"}.stratum-icon-masonry-gallery:before{content:"\E010"}.stratum-icon-price-list:before{content:"\E011"}.stratum-icon-price-menu:before{content:"\E012"}.stratum-icon-price-table:before{content:"\E013"}.stratum-icon-testimonial-carousel:before{content:"\E014"}.stratum-icon-vertical-timeline:before{content:"\E015"}

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1_copy" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
y="0px" viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
<g>
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="3.5147" y1="124.4853" x2="124.4853" y2="3.5147">
<stop offset="0" style="stop-color:#F50000"/>
<stop offset="1" style="stop-color:#FAC212"/>
</linearGradient>
<path style="fill:url(#SVGID_1_);" d="M116,128H12c-6.63,0-12-5.37-12-12V12C0,5.37,5.37,0,12,0h104c6.63,0,12,5.37,12,12v104
C128,122.63,122.63,128,116,128z"/>
</g>
<g style="opacity:0.2;">
<g>
<path d="M83.28,60.38L83.28,60.38L48.75,40.44l0,0c3.59-6.22,11.54-8.35,17.76-4.76l12.01,6.94
C84.74,46.21,86.87,54.16,83.28,60.38z"/>
</g>
<g>
<path d="M83.28,84.63L83.28,84.63l-33.78-19.5c-6.22-3.59-8.35-11.54-4.76-17.76l0,0l33.77,19.5
C84.74,70.46,86.87,78.41,83.28,84.63z"/>
</g>
<g>
<path d="M79.29,91.56L79.29,91.56c-3.59,6.22-11.54,8.35-17.76,4.76l-12.05-6.96c-6.22-3.59-8.35-11.54-4.76-17.76l0,0
L79.29,91.56z"/>
</g>
</g>
<g>
<g>
<path style="fill:#FFFFFF;" d="M83.28,58.38L83.28,58.38L48.75,38.44l0,0c3.59-6.22,11.54-8.35,17.76-4.76l12.01,6.94
C84.74,44.21,86.87,52.16,83.28,58.38z"/>
</g>
<g>
<path style="fill:#FFFFFF;" d="M83.28,82.63L83.28,82.63l-33.78-19.5c-6.22-3.59-8.35-11.54-4.76-17.76l0,0l33.77,19.5
C84.74,68.46,86.87,76.41,83.28,82.63z"/>
</g>
<g>
<path style="fill:#FFFFFF;" d="M79.29,89.56L79.29,89.56c-3.59,6.22-11.54,8.35-17.76,4.76l-12.05-6.96
c-6.22-3.59-8.35-11.54-4.76-17.76l0,0L79.29,89.56z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,642 @@
<?php
namespace Stratum;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Admin_Page {
private $version;
private $prefix;
private $we_devs_settings_api;
public function __construct() {
$this->we_devs_settings_api = new \WeDevs_Settings_API;
$settings = Settings::get_instance();
$this->version = $settings->getVersion();
$this->prefix = $settings->getPrefix();
add_action( 'admin_init', array($this, 'admin_init') );
add_action( 'admin_init', array($this, 'checkInstagramQueryURL') );
add_action( 'admin_menu', array($this, 'admin_menu') );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueueAdminAssets' ) );
}
/**
* Enqueue Admin Page js and css
*/
public function enqueueAdminAssets() {
//CSS
wp_enqueue_style(
"{$this->prefix}-admin-page",
stratum_get_plugin_url( 'assets/css/admin-page.min.css' ),
[],
$this->version
);
wp_enqueue_style(
"{$this->prefix}-icons-style",
stratum_get_plugin_url( './assets/css/stratum.min.css' ),
apply_filters(
'stratum/editor_css/dependencies',
[]
),
$this->version
);
}
public function admin_init() {
//Fill settings
$this->we_devs_settings_api->set_sections( $this->get_settings_sections() );
$this->we_devs_settings_api->set_fields( $this->get_settings_fields() );
//Init settings
$this->we_devs_settings_api->admin_init();
}
public function stratum_instagram_notice_success() {
?>
<div class="notice notice-success">
<p><?php esc_html_e( 'Instagram: access token updated.', 'stratum' ); ?></p>
</div>
<?php
}
public function stratum_instagram_notice_error() {
?>
<div class="notice notice-error">
<p><?php esc_html_e('Instagram: access denied.', 'stratum'); ?></p>
</div>
<?php
}
public function checkInstagramQueryURL()
{
global $pagenow;
if ($pagenow == 'admin.php' && isset($_GET['instagram-token'])) {
$stratum_api = get_option( 'stratum_api', [] );
$stratum_api['instagram_access_token'] = sanitize_text_field($_GET['instagram-token']);
update_option('stratum_api', $stratum_api);
delete_transient( 'stratum_instagram_response_data' ); //Delete cache data
wp_redirect(add_query_arg(
array(
'stratum-instagram-success' => true,
),
admin_url( 'admin.php?page=stratum-settings#stratum_api' )
)
); //Redirect
}
if (isset($_GET['stratum-instagram-success'])) {
add_action( 'admin_notices', [$this, 'stratum_instagram_notice_success'] );
}
if (isset($_GET['stratum-instagram-error'])) {
add_action( 'admin_notices', [$this, 'stratum_instagram_notice_error'] );
}
}
public function admin_menu() {
add_menu_page(
esc_html__( 'Stratum', 'stratum' ),
esc_html__( 'Stratum', 'stratum' ),
'manage_options',
'stratum',
array($this, 'about_page'),
'data:image/svg+xml;base64,' . base64_encode(
'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 112 112">
<g>
<path fill="gray" d="M83.28,58.38L83.28,58.38L48.75,38.44l0,0c3.59-6.22,11.54-8.35,17.76-4.76l12.01,6.94
C84.74,44.21,86.87,52.16,83.28,58.38z"/>
</g>
<g>
<path fill="gray" d="M83.28,82.63L83.28,82.63l-33.78-19.5c-6.22-3.59-8.35-11.54-4.76-17.76l0,0l33.77,19.5
C84.74,68.46,86.87,76.41,83.28,82.63z"/>
</g>
<g>
<path fill="gray" d="M79.29,89.56L79.29,89.56c-3.59,6.22-11.54,8.35-17.76,4.76l-12.05-6.96
c-6.22-3.59-8.35-11.54-4.76-17.76l0,0L79.29,89.56z"/>
</g>
</svg>'
),
90
);
add_submenu_page(
'stratum',
esc_html__( 'Stratum Settings', 'stratum' ),
esc_html__( 'Settings', 'stratum' ),
'manage_options',
'stratum-settings',
array( $this, 'plugin_page' )
);
}
public function about_page(){
$settings = \Stratum\Settings::get_instance();
$pluginData = $settings->getPluginData();
$storeUrl = isset( $pluginData['PluginURI'] ) ? $pluginData['PluginURI'] : 'https://motopress.com/';
?>
<div class="wrap stratum-wrap about-wrap">
<img class="stratum-logo" src="<?php echo esc_url(stratum_get_plugin_url( 'assets/img/logo.svg' )); ?>">
<h1 class="stratum-heading">
<?php echo esc_html__( 'Stratum', 'stratum' ); ?> <?php echo esc_html($this->version); ?>
<a class="button button-primary" target="_blank" href="<?php echo esc_url( $storeUrl ); ?>"><?php echo esc_html__( 'Home Page', 'stratum' ); ?></a>
</h1>
<p><?php echo esc_html__( 'Advanced Elementor addon to extend the page builder capabilities and add more widgets.', 'stratum' ); ?></p>
<hr>
<h3><?php echo esc_html__( 'Changelog', 'stratum' ); ?></h3>
<div class="stratum-about-list">
<!-- start markdowntohtml.com -->
<p>= 1.4.0, Mar 25 2024 =</p>
<ul>
<li>Added Instagram Access Token encryption.</li>
<li>Minor bugfixes and improvements.</li>
</ul>
<p>= 1.3.16, Feb 13 2024 =</p>
<ul>
<li>Minor bugfixes and improvements.</li>
</ul>
<p>= 1.3.15, May 24 2023 =</p>
<ul>
<li>Improved compatibility with latest Elementor versions.</li>
<li>Minor bugfixes and improvements.</li>
</ul>
<p>= 1.3.14, Mar 10 2023 =</p>
<ul>
<li>Fixed miscellaneous Elementor deprecations.</li>
</ul>
<p>= 1.3.13, Mar 23 2022 =</p>
<ul>
<li>Fixed an issue with missing descriptions in the Vertical Timeline widget.</li>
<li>Fixed an issue with multiple markers in the Advanced Google Maps widget.</li>
<li>Fixed an issue when the Swiper slider may not have been initialized with the "Improved Asset Loading" Elementor option enabled.</li>
<li>Fixed an issue with the currency alignment in the Price Table widget.</li>
<li>Minor bugfixes and improvements.</li>
</ul>
<p>= 1.3.12, Nov 30 2021 =</p>
<ul>
<li>Fixed an issue with Advanced Slider on mobile devices.</li>
</ul>
<p>= 1.3.11, Oct 27 2021 =</p>
<ul>
<li>Security - sanitization and escaping.</li>
</ul>
<p>= 1.3.10, Aug 17 2021 =</p>
<ul>
<li>Fixed an issue with links in Horizontal Timeline and Accordion widgets.</li>
</ul>
<p>= 1.3.9, Jul 21 2021 =</p>
<ul>
<li>Minor bugfixes and improvements.</li>
</ul>
<p>= 1.3.8, May 5 2021 =</p>
<ul>
<li>Minor bugfixes and improvements.</li>
</ul>
<p>= 1.3.7, Apr 1 2021 =</p>
<ul>
<li>Added Table widget.</li>
<li>Added Content Switcher widget.</li>
<li>Added the ability to automatically refresh Instagram access token.</li>
<li>Minor bugfixes and improvements.</li>
</ul>
<p>= 1.3.6, Feb 17 2021 =</p>
<ul>
<li>Minor bugfixes and improvements.</li>
</ul>
<p>= 1.3.5, Dec 23 2020 =</p>
<ul>
<li>Improved compatibility with WordPress 5.6 and Elementor Pro.</li>
<li>Minor bugfixes and improvements.</li>
</ul>
<p>= 1.3.4, Sep 8 2020 =</p>
<ul>
<li>Minor bugfixes and improvements.</li>
</ul>
<p>= 1.3.3, Aug 28 2020 =</p>
<ul>
<li>Added Vertical Timeline widget.</li>
<li>Added Horizontal Timeline widget.</li>
<li>Added Lottie Animations widget.</li>
<li>Added Countdown widget.</li>
</ul>
<p>= 1.3.2, Aug 12 2020 =</p>
<ul>
<li>Improved compatibility with WordPress 5.5.</li>
</ul>
<p>= 1.3.1, Jul 31 2020 =</p>
<ul>
<li>Fixed an issue with Instagram widget.</li>
</ul>
<p>= 1.3.0, Jun 10 2020 =</p>
<ul>
<li>Added Advanced Accordion widget.</li>
<li>Added Advanced Tabs widget.</li>
<li>Added Image Accordion widget.</li>
<li>Improved the plugin color palette.</li>
<li>Added the Templates Library control.</li>
<li>Fixed an issue with &quot;Instagram getToken&quot; in the Instagram widget.</li>
<li>Fixed an issue with controls in the Advanced Google Maps widget.</li>
<li>Minor bugfixes and improvements.</li>
</ul>
<p>= 1.2.0, Apr 29 2020 =</p>
<ul>
<li>Added Advanced Google Map widget.</li>
<li>Added Advanced Posts widget.</li>
<li>Added Advanced Slider widget.</li>
<li>Added Testimonial Carousel widget.</li>
<li>Added Flip Box widget.</li>
<li>Minor bugfixes and improvements.</li>
</ul>
<p>= 1.1.0, Mar 30 2020 =</p>
<ul>
<li>Added Image Hotspot widget.</li>
<li>Added Masonry Gallery widget.</li>
<li>Added Circular Progress Bar widget.</li>
<li>Minor bugfixes and improvements.</li>
</ul>
<p>= 1.0.0, Mar 6 2020 =</p>
<ul>
<li>Initial commit.</li>
</ul>
<!-- end -->
</div>
</div>
<?php
}
public function get_settings_sections() {
$sections = apply_filters( 'stratum_settings_sections', array(
array(
'id' => 'stratum_widgets',
'title' => esc_html__( 'Elements', 'stratum' ),
'addons' => true,
'icon' => 'dashicons dashicons-admin-tools',
),
array(
'id' => 'stratum_style',
'title' => esc_html__( 'Style', 'stratum' ),
'icon' => 'dashicons dashicons-admin-site-alt3',
),
array(
'id' => 'stratum_api',
'title' => esc_html__( 'API', 'stratum' ),
'icon' => 'dashicons dashicons-admin-network',
),
) );
return $sections;
}
/**
* Returns all the settings fields
*
* @return array settings fields
*/
public function get_settings_fields() {
$encryption = new String_Encryption();
$stratum_api = get_option( 'stratum_api', [] );
$instagram_access_token = isset( $stratum_api['instagram_access_token'] ) ? $encryption->decrypt( $stratum_api['instagram_access_token'] ) : '';
$settings_fields = apply_filters( 'stratum_settings_fields', array(
'stratum_widgets' => apply_filters( 'stratum_required_widgets', array(
array(
'name' => 'instagram',
'label' => esc_html__( 'Instagram', 'stratum' ),
'desc' => esc_html__( 'Real-life Instagram feed in your WordPress.', 'stratum' ),
'icon' => 'stratum-icon-instagram',
'type' => 'toggle',
'default' => 'on'
),
array(
'name' => 'banner',
'label' => esc_html__( 'Banner', 'stratum' ),
'desc' => esc_html__( 'Creative animated banners for promos and announcements.', 'stratum' ),
'icon' => 'stratum-icon-banner',
'type' => 'toggle',
'default' => 'on'
),
array(
'name' => 'counter',
'label' => esc_html__( 'Counter', 'stratum' ),
'desc' => esc_html__( 'Animated counters to visualize data.', 'stratum' ),
'icon' => 'stratum-icon-counter',
'type' => 'toggle',
'default' => 'on'
),
array(
'name' => 'price-menu',
'label' => esc_html__( 'Price Menu', 'stratum' ),
'desc' => esc_html__( 'Food menus or other listings with prices.', 'stratum' ),
'icon' => 'stratum-icon-price-menu',
'type' => 'toggle',
'default' => 'on'
),
array(
'name' => 'price-list',
'label' => esc_html__( 'Price List', 'stratum' ),
'desc' => esc_html__( 'Price variables or categorized lists of individual menu items.', 'stratum' ),
'icon' => 'stratum-icon-price-list',
'type' => 'toggle',
'default' => 'on'
),
array(
'name' => 'price-table',
'label' => esc_html__( 'Price Table', 'stratum' ),
'desc' => esc_html__( 'Pricing and comparison tables.', 'stratum' ),
'icon' => 'stratum-icon-price-table',
'type' => 'toggle',
'default' => 'on'
),
array(
'name' => 'table',
'label' => esc_html__( 'Table', 'stratum' ),
'desc' => esc_html__( 'Build responsive tables and customize their content and styling.', 'stratum' ),
'icon' => 'eicon-table',
'type' => 'toggle',
'default' => 'on'
),
array(
'name' => 'content-switcher',
'label' => esc_html__( 'Content Switcher', 'stratum' ),
'desc' => esc_html__( 'Add a toggle or structure your content into switchable tabs - perfect for pricing plans and data organization.', 'stratum' ),
'icon' => 'eicon-dual-button',
'type' => 'toggle',
'default' => 'on'
),
array(
'name' => 'image-hotspot',
'label' => esc_html__( 'Image Hotspot', 'stratum' ),
'desc' => esc_html__( 'Animated pointers with tooltips to place over images.', 'stratum' ),
'icon' => 'stratum-icon-image-hotspot',
'type' => 'toggle',
'default' => 'on'
),
array(
'name' => 'circle-progress-bar',
'label' => esc_html__( 'Circle Progress Bar', 'stratum' ),
'desc' => esc_html__( 'A circle-shaped bar with an animated activity progress indicator.', 'stratum' ),
'icon' => 'stratum-icon-circle-progress-bar',
'type' => 'toggle',
'default' => 'on'
),
array(
'name' => 'masonry-gallery',
'label' => esc_html__( 'Masonry Gallery', 'stratum' ),
'desc' => esc_html__( 'A masonry-styled responsive image gallery.', 'stratum' ),
'icon' => 'stratum-icon-masonry-gallery',
'type' => 'toggle',
'default' => 'on'
),
array(
'name' => 'advanced-slider',
'label' => esc_html__( 'Advanced Slider', 'stratum' ),
'desc' => esc_html__( 'A fully customizable slider, including the number of columns, horizontal and vertical scrolling, navigation, etc.', 'stratum' ),
'icon' => 'stratum-icon-advanced-slider',
'type' => 'toggle',
'default' => 'on'
),
array(
'name' => 'advanced-posts',
'label' => esc_html__( 'Advanced Posts', 'stratum' ),
'desc' => esc_html__( 'Showcase your automatically sourced posts and pages in different grid or list layouts.', 'stratum' ),
'icon' => 'stratum-icon-advanced-posts',
'type' => 'toggle',
'default' => 'on'
),
array(
'name' => 'advanced-accordion',
'label' => esc_html__( 'Advanced Accordion', 'stratum' ),
'desc' => esc_html__( 'Horizontal accordion tabs with support for custom Library templates.', 'stratum' ),
'icon' => 'stratum-icon-advanced-accordion',
'type' => 'toggle',
'default' => 'on'
),
array(
'name' => 'advanced-tabs',
'label' => esc_html__( 'Advanced Tabs', 'stratum' ),
'desc' => esc_html__( 'Fully customizable horizontal or vertical-oriented tabs with support for custom Library templates.', 'stratum' ),
'icon' => 'stratum-icon-advanced-tabs',
'type' => 'toggle',
'default' => 'on'
),
array(
'name' => 'countdown',
'label' => esc_html__( 'Countdown', 'stratum' ),
'desc' => esc_html__( 'Dynamic countdown timer with deeply customizable numeric values and time labels.', 'stratum' ),
'icon' => 'stratum-icon-countdown',
'type' => 'toggle',
'default' => 'on'
),
[
'name' => 'testimonial-carousel',
'label' => esc_html__( 'Testimonial Carousel', 'stratum' ),
'desc' => esc_html__( 'A ready-made template for admin-added testimonials.', 'stratum' ),
'icon' => 'stratum-icon-testimonial-carousel',
'type' => 'toggle',
'default' => 'on'
],
[
'name' => 'advanced-google-map',
'label' => esc_html__( 'Advanced Google Map', 'stratum' ),
'desc' => esc_html__( 'Google Maps with customizable location markets and map styles.', 'stratum' ),
'icon' => 'stratum-icon-advanced-google-map',
'type' => 'toggle',
'default' => 'on'
],
[
'name' => 'flip-box',
'label' => esc_html__( 'Flip Box', 'stratum' ),
'desc' => esc_html__( 'Flip Box with animation that is triggered on hover and fully customizable front & back sections.', 'stratum' ),
'icon' => 'stratum-icon-flip-box',
'type' => 'toggle',
'default' => 'on'
],
[
'name' => 'image-accordion',
'label' => esc_html__( 'Image Accordion', 'stratum' ),
'desc' => esc_html__( 'Highlight your images with amazing hover and click effects using Image Accordion', 'stratum' ),
'icon' => 'stratum-icon-image-accordion',
'type' => 'toggle',
'default' => 'on'
],
[
'name' => 'vertical-timeline',
'label' => esc_html__( 'Vertical Timeline', 'stratum' ),
'desc' => esc_html__( 'Display events on your pages using Vertical Timeline widget, that allows adding content, including icons, imagery, and descriptions', 'stratum' ),
'icon' => 'stratum-icon-vertical-timeline',
'type' => 'toggle',
'default' => 'on'
],
[
'name' => 'horizontal-timeline',
'label' => esc_html__( 'Horizontal Timeline', 'stratum' ),
'desc' => esc_html__( 'Let the visitors know about the events and projects on your website using the Horizontal Timeline widget', 'stratum' ),
'icon' => 'stratum-icon-horizontal-timeline',
'type' => 'toggle',
'default' => 'on'
],
[
'name' => 'lottie-animations',
'label' => esc_html__( 'Lottie Animations', 'stratum' ),
'desc' => esc_html__( 'Lottie Animations widget give you the ability to easily add Lottie Animations to your Elementor pages with no need to add custom code', 'stratum' ),
'icon' => 'stratum-icon-lottie-animations',
'type' => 'toggle',
'default' => 'on'
]
) ),
'stratum_style' => array(
array(
'name' => 'primary_color',
'label' => esc_html__( 'Primary color', 'stratum' ),
'desc' => esc_html__( 'Select your primary color. Default: #3878ff', 'stratum' ),
'type' => 'color',
'default' => '#3878ff'
),
array(
'name' => 'secondary_color',
'label' => esc_html__( 'Secondary color (Hover)', 'stratum' ),
'desc' => esc_html__( 'Select your secondary color. Default: #565656', 'stratum' ),
'type' => 'color',
'default' => '#565656'
),
array(
'name' => 'background_color',
'label' => esc_html__( 'Background color', 'stratum' ),
'desc' => esc_html__( 'Select your secondary color. Default: #71d7f7', 'stratum' ),
'type' => 'color',
'default' => '#71d7f7'
),
array(
'name' => 'background_color_active',
'label' => esc_html__( 'Background color (Active)', 'stratum' ),
'desc' => esc_html__( 'Select your secondary color. Default: #0097c6', 'stratum' ),
'type' => 'color',
'default' => '#0097c6'
),
array(
'name' => 'background_color_hover',
'label' => esc_html__( 'Background color (Hover)', 'stratum' ),
'desc' => esc_html__( 'Select your secondary color. Default: #008fbc', 'stratum' ),
'type' => 'color',
'default' => '#008fbc'
),
),
'stratum_api' => [
'instagram_access_token' => [
'name' => 'instagram_access_token',
'label' => esc_html__( 'Instagram Access Token', 'stratum' ),
'desc_btn' => esc_html__( 'Connect Instagram Account', 'stratum' ),
'desc_class' => 'large',
'desc_link' => esc_url(
'https://api.instagram.com/oauth/authorize?client_id=910186402812397&redirect_uri=' .
'https://api.getmotopress.com/get_instagram_token.php&scope=user_profile,user_media&response_type=code&state=' .
admin_url( 'admin.php' )
),
'type' => 'text',
'is_encrypted' => true,
],
'google_api_key' => [
'name' => 'google_api_key',
'label' => esc_html__( 'Google Maps API Key', 'stratum' ),
'desc' => sprintf( '<a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_blank">%s</a>', esc_html__( 'Get the API key', 'stratum' ) ),
'type' => 'text'
]
]
) );
if ( ! empty( $instagram_access_token ) ) {
$settings_fields['stratum_api']['instagram_access_token']['desc_extra_btn'] = esc_html__( 'Refresh Access Token', 'stratum' );
$settings_fields['stratum_api']['instagram_access_token']['desc_extra_class'] = 'large';
$settings_fields['stratum_api']['instagram_access_token']['desc_extra_link'] = esc_url(
'https://api.getmotopress.com/refresh_instagram_token.php?access_token='.$instagram_access_token.'&state=' .
admin_url( 'admin.php?page=stratum-settings#stratum_api' )
);
try {
$profile_data_json = wp_remote_get(
'https://graph.instagram.com/me?fields=username&access_token=' . $instagram_access_token
);
if ( ( ! is_wp_error( $profile_data_json ) ) && ( 200 === wp_remote_retrieve_response_code( $profile_data_json ) ) ) {
$profile_data = json_decode( $profile_data_json['body'] );
if ( json_last_error() === JSON_ERROR_NONE ) {
$profile_display_val = '';
if ( isset( $profile_data->username ) ) {
$profile_display_val = $profile_data->username;
} elseif ( isset( $profile_data->id ) ) {
$profile_display_val = $profile_data->id;
}
$settings_fields['stratum_api']['instagram_access_token']['desc'] =
! empty( $profile_display_val )
? sprintf(
//translators: %s is username or user id
esc_html__('Account: %s', 'stratum'),
esc_html( $profile_data->username )
)
: '';
}
}
} catch ( \Exception $profile_data_exception ) {
$settings_fields['stratum_api']['instagram_access_token']['desc'] = esc_html( $profile_data_exception->getMessage() );
}
stratum()->get_token_manager()->schedule_token_refresh_event();
}
return $settings_fields;
}
public function plugin_page() {
if ( isset( $_GET['settings-updated'] ) ) {
printf( '<div class="updated"><p>%s</p></div>', esc_html__( 'Plugin settings updated successfully', 'stratum' ) );
}
$count = count( $this->get_settings_sections() );
if ( $count <= 1 ) {
$class = 'stratum-settings-sections-no';
} else {
$class = 'stratum-settings-sections-yes';
}
echo '<div class="stratum-wrap about-wrap stratum-settings-wrap '. esc_attr( $class ) .'">';
$this->we_devs_settings_api->show_navigation();
$this->we_devs_settings_api->show_forms();
echo '</div>';
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace Stratum\Managers;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Class Ajax_Manager
* @package Stratum
*/
class Ajax_Manager {
/**
* Ajax_Manager constructor.
*/
public function __construct() {
//Ajax (Admin)
add_action( 'elementor/ajax/register_actions', [ $this, 'register_admin_ajax_actions' ] );
}
public function register_admin_ajax_actions($ajax_manager) {
$ajax_manager->register_ajax_action( 'stratum_get_elementor_templates', [ $this, 'stratum_get_elementor_templates' ] );
}
public static function stratum_get_elementor_templates($data = []){
$args = [
'post_type' => 'elementor_library',
'posts_per_page' => -1,
];
//Call from AJAX
if (!empty($data)){
//Check nonce
$nonce = $data['nonce'];
if ( ! wp_verify_nonce( $nonce, 'stratum_nonce_get_elementor_templates' ) ) {
wp_send_json_error();
}
}
$page_templates = get_posts($args);
$options = array();
if (!empty($page_templates) && !is_wp_error($page_templates)) {
foreach ($page_templates as $post) {
$options[$post->ID] = $post->post_title;
}
}
return $options;
}
public function register_ajax_action($action, $func){
add_action( "wp_ajax_{$action}", [ $this, $func ] );
add_action( "wp_ajax_nopriv_{$action}", [ $this, $func ] );
}
}

View File

@@ -0,0 +1,243 @@
<?php
namespace Stratum\Ajax;
use Stratum\Managers\Ajax_Manager;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Advanced_Posts_Ajax extends Ajax_Manager {
private static $instance = null;
public function __construct() {
$this->register_ajax_action( 'stratum_ajax_get_articles', 'get_articles' );
}
public static function get_instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
public function get_articles($settings, $type = 'ajax') {
if ( $type == 'ajax' ) {
//Check nonce
$nonce = sanitize_text_field( $_POST['nonce'] );
if ( ! wp_verify_nonce( $nonce, 'stratum_nonce_get_articles' ) ) {
wp_send_json_error();
}
$settings = isset( $_POST['settings'] ) ? (array) $_POST['settings'] : array();
$settings = stratum_recursive_sanitize_array( $settings );
}
extract( shortcode_atts( array(
'slide_animation_effect' => '',
'slide_text_animation_effect' => '',
'title_typography_html_tag' => 'h3',
'show_image' => '',
'show_title' => '',
'title_over_image' => '',
'show_content' => '',
'show_excerpt' => '',
'show_read_more' => '',
'read_more_text' => '',
'open_new_tab' => '',
'excerpt_length' => apply_filters( 'excerpt_length', 25 ),
'show_meta' => array(),
'meta_fields_divider' => '',
'image_size' => '',
'posts_layout' => '',
'pagination' => '',
'load_more_pagination' => '',
'load_more_text' => '',
'column_gap' => '',
'row_gap' => '',
'masonry' => '',
'columns' => '',
'columns_tablet' => '',
'columns_mobile' => '',
'animate_on_scroll' => '',
//Swiper
'navigation' => 'both',
'pagination_style' => 'bullets',
//--Swiper
), $settings ) );
$title_typography_html_tag = stratum_validate_heading_html_tag( $title_typography_html_tag );
$widget_class = 'stratum-advanced-posts';
$out = "";
//Query builder
$query_args = [];
stratum_build_custom_query( $query_args, $settings );
$q = new \WP_Query( $query_args );
if ( $q->have_posts() ){
while( $q->have_posts() ):
$q->the_post();
$item_class = stratum_css_class([
$widget_class . '__post',
(($show_title == 'yes' && $title_over_image == 'yes') ? 'title_over_image' : ''),
((($posts_layout == 'grid' || $posts_layout == 'list') && ($animate_on_scroll == 'yes' || ($masonry == 'yes' && intval($columns) > 1))) ? "masonry-item" : ''),
]);
$out .= "<article id='post-".esc_attr(get_the_ID())."' class='".esc_attr( $item_class )."'>";
$out .= "<div class='".esc_attr( $widget_class . '__post-wrapper' )."'>";
if ( $show_image == 'yes' ) {
$out .= "<div class='".esc_attr( $widget_class . '__post-thumbnail' )."'>";
$out .= "<a href='".esc_url(get_permalink())."' class='".esc_attr( $widget_class . '__post-link' )."'>";
ob_start();
the_post_thumbnail( $image_size,
array(
'alt' => the_title_attribute( 'echo=0' ),
'class' => esc_attr( $widget_class . '__post-thumbnail-image' ),
)
);
$out .= ob_get_clean();
$out .= "<div class='".esc_attr( $widget_class . '__post-thumbnail-overlay' )."'></div>";
if ( $show_title == 'yes' && $title_over_image == 'yes' ) {
$out .= "<{$title_typography_html_tag} class='".esc_attr( $widget_class . '__post-title' )."'>";
$out .= esc_html( get_the_title() );
$out .= "</{$title_typography_html_tag}>";
}
$out .= "</a>";
$out .= "</div>";
}
$out .= "<div class='".esc_attr( $widget_class . '__content-wrapper' )."'>";
$out .= "<div class='".esc_attr( $widget_class . '__entry-header' )."'>";
if ( $show_title == 'yes' && $title_over_image == '' ) {
ob_start();
the_title( '<'.esc_attr($title_typography_html_tag).' class="'.esc_attr( $widget_class . '__post-title' ).'"><a href="'.esc_url(get_permalink()).'">', '</a></'.esc_attr($title_typography_html_tag).'>' );
$out .= ob_get_clean();
}
if (!empty($show_meta)){
$out .= "<div class='".esc_attr( $widget_class . '__entry-meta' )."'>";
if (in_array("date", $show_meta)){
$archive_year = get_the_time('Y');
$archive_month = get_the_time('m');
$archive_day = get_the_time('d');
$out .= "<span class='".esc_attr( $widget_class . '__post-date' )."'>";
$out .= "<time datetime='".esc_attr( get_the_date( 'c' ) )."'>";
$out .= "<a href='".get_day_link( $archive_year, $archive_month, $archive_day)."'>";
$out .= esc_html( get_the_date( '' ) );
$out .= "</a>";
$out .= "</time>";
$out .= "</span>";
}
if (in_array("author", $show_meta)){
$out .= in_array("date", $show_meta) ? "<span class='".esc_attr( $widget_class . '__meta-fields-divider' )."'>".esc_html($meta_fields_divider)."</span>" : '';
$out .= "<div class='".esc_attr( $widget_class . '__post-author' )."'>";
$out .= "<a href='".esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) )."'>";
$out .= esc_html( get_the_author() );
$out .= "</a>";
$out .= "</div>";
}
if (in_array("categories", $show_meta)){
$out .= (in_array("date", $show_meta) || in_array("author", $show_meta)) ? "<span class='".esc_attr( $widget_class . '__meta-fields-divider' )."'>".esc_html($meta_fields_divider)."</span>" : '';
$out .= "<div class='".esc_attr( $widget_class . '__post-categories' )."'>";
$out .= get_the_category_list(', ');
$out .= "</div>";
}
if (in_array("comments", $show_meta)){
$out .= (in_array("date", $show_meta) || in_array("author", $show_meta) || in_array("categories", $show_meta)) ? "<span class='".esc_attr( $widget_class . '__meta-fields-divider' )."'>".esc_html($meta_fields_divider)."</span>" : '';
$out .= "<div class='".esc_attr( $widget_class . '__post-comments' )."'>";
$out .= "<a href='".esc_url( get_comments_link() )."'>";
if ( get_comments_number() ) {
$out .= esc_html(
sprintf(
_n( '%d Comment', '%d Comments', get_comments_number(), 'stratum' ),
get_comments_number()
)
);
} else {
$out .= esc_html__( 'No comments', 'stratum' );
}
$out .= "</a>";
$out .= "</div>";
}
$out .= "</div>";
}
$out .= "</div>";
if ( $show_content == 'yes' ) {
$out .= "<div class='".esc_attr( $widget_class . '__post-content' )."'>";
if ( $show_excerpt == 'yes' ) {
if ( $excerpt_length ) {
\Stratum\Excerpt_Helper::get_instance()->setExcerptLength( $excerpt_length );
add_filter( 'excerpt_length', array( 'Stratum\Excerpt_Helper', 'excerpt_length' ), 999 );
}
$out .= get_the_excerpt();
remove_filter( 'excerpt_length', array( 'Stratum\Excerpt_Helper', 'excerpt_length' ), 999 );
} else {
ob_start();
the_content();
$out .= ob_get_clean();
}
$out .= "</div>";
}
if ( $show_read_more == 'yes' ) {
$out .= "<div class='".esc_attr( $widget_class . '__entry-footer' )."'>";
$out .= "<div class='".esc_attr( $widget_class . '__read-more' )."'>";
$out .= "<a href='".esc_url( get_permalink() )."'".($open_new_tab == 'yes' ? " target='_blank'" : '').">";
$out .= esc_html($read_more_text);
$out .= "</a>";
$out .= "</div>";
$out .= "</div>";
}
$out .= "</div>";
$out .= "</div>";
$out .= "</article>";
endwhile;
wp_reset_postdata();
} else {
$out .= '<p>' . esc_html__( 'Nothing found.', 'stratum' ) . '</p>';
}
if ($type == 'render'){
return $out;
} elseif ($type == 'ajax'){
echo $out; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
wp_die();
}
}
}
new Advanced_Posts_Ajax();

View File

@@ -0,0 +1,53 @@
<?php
namespace Stratum\Managers;
use \Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Class Controls_Manager
* @package Stratum
*/
class Controls_Manager {
private $prefix;
/**
* Controls_Manager constructor.
*/
public function __construct() {
$settings = \Stratum\Settings::get_instance();
$this->prefix = $settings->getPrefix();
add_action( 'elementor/controls/register', [ $this, 'register_controls' ] );
}
public function register_controls() {
if ( defined( 'ELEMENTOR_PATH' ) && class_exists( 'Elementor\Element_Base' ) ) {
if ( class_exists( 'Elementor\Plugin' ) ) {
if ( is_callable( 'Elementor\Plugin', 'instance' ) ) {
$elementor = Plugin::instance();
if ( isset( $elementor->controls_manager ) ) {
//Files controls list
$controls = array(
'group_control_typography',
'ajax_control',
);
foreach ($controls as $key => $control_name) {
$path = stratum_get_plugin_path( '/includes/controls/' . $control_name . '.php' );
if ( file_exists( $path ) ) {
require_once( $path );
}
}
}
}
}
}
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Stratum;
use \Elementor\Control_Select2;
use \Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Stratum_AJAX_Control extends Control_Select2 {
const QUERY = 'stratum_ajax_control';
public function get_type() {
return static::QUERY;
}
/**
* 'query' can be used for passing query args in the structure and format used by WP_Query.
* @return array
*/
protected function get_default_settings() {
return array_merge(
parent::get_default_settings(), [
'query' => '',
]
);
}
}
Plugin::instance()->controls_manager->register( new Stratum_AJAX_Control() );

View File

@@ -0,0 +1,106 @@
<?php
namespace Stratum;
use \Elementor\Group_Control_Base;
use \Elementor\Group_Control_Typography;
use \Elementor\Controls_Manager;
use \Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Stratum_Group_Control_Typography extends Group_Control_Base {
protected static $fields;
public static function get_type() {
return 'stratum_typography';
}
protected function init_fields() {
$default_fields = new Group_Control_Typography();
$fields = $default_fields->init_fields();
//Extend control (Add field)
$fields['html_tag'] = [
'label' => esc_html__( 'HTML Tag', 'stratum' ),
'type' => Controls_Manager::SELECT,
'options' => [
'h1' => esc_html__( 'H1', 'stratum' ),
'h2' => esc_html__( 'H2', 'stratum' ),
'h3' => esc_html__( 'H3', 'stratum' ),
'h4' => esc_html__( 'H4', 'stratum' ),
'h5' => esc_html__( 'H5', 'stratum' ),
'h6' => esc_html__( 'H6', 'stratum' ),
'div' => esc_html__( 'div', 'stratum' ),
'p' => esc_html__( 'p', 'stratum' ),
'span' => esc_html__( 'span', 'stratum' ),
],
];
return $fields;
}
protected function prepare_fields( $fields ) {
array_walk(
$fields, function( &$field, $field_name ) {
if ( in_array( $field_name, [ 'typography', 'popover_toggle' ] ) ) {
return;
}
$selector_value = ! empty( $field['selector_value'] ) ? $field['selector_value'] : str_replace( '_', '-', $field_name ) . ': {{VALUE}};';
$typography_field = $this->get_args();
if(isset($typography_field['defaults'])){
$defaults_arr = $typography_field['defaults'];
}
if(isset($typography_field['mobile_defaults'])){
$mobile_defaults_arr = $typography_field['mobile_defaults'];
}
if(isset($typography_field['tablet_defaults'])){
$tablet_defaults_arr = $typography_field['tablet_defaults'];
}
//Set defaults values to all fields
if (isset($typography_field['defaults'])){
if (isset($defaults_arr)){
if ( isset($defaults_arr[$field_name])){
$field['default'] = $defaults_arr[$field_name];
}
}
}
if (isset($typography_field['mobile_defaults'])){
if (isset($mobile_defaults_arr[$field_name])){
$field['mobile_default'] = $mobile_defaults_arr[$field_name];
}
}
if (isset($typography_field['tablet_defaults'])){
if (isset($tablet_defaults_arr[$field_name])){
$field['tablet_default'] = $tablet_defaults_arr[$field_name];
}
}
//--Set defaults values to all fields
if($field_name != 'html_tag'){ //Not render styles if
$field['selectors'] = [
'{{SELECTOR}}' => $selector_value,
];
}
}
);
return parent::prepare_fields( $fields );
}
protected function get_default_options() {
return [
'popover' => [
'starter_name' => 'typography',
'starter_title' => esc_html_x( 'Typography', 'Typography Control', 'stratum' ),
],
];
}
}
Plugin::instance()->controls_manager->add_group_control( 'stratum_typography', new Stratum_Group_Control_Typography() );

View File

@@ -0,0 +1,35 @@
<?php
namespace Stratum;
class Excerpt_Helper {
/**
* @var Excerpt_Helper
*/
private static $instance = null;
/**
* @var int
*/
private static $excerpt_length;
/**
* @return Stratum
*/
public static function get_instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
public function setExcerptLength( $excerpt_length ) {
self::$excerpt_length = $excerpt_length;
}
public static function excerpt_length() {
return self::$excerpt_length;
}
}

View File

@@ -0,0 +1,333 @@
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Gets plugin's absolute directory path.
*
* @param string $path Relative path
*
* @return string
*/
function stratum_get_plugin_path( $path = '' ) {
return STRATUM_PLUGIN_DIR . trim( $path, '/' );
}
/**
* Gets plugin's URL.
*
* @param string $path
*
* @return string
*/
function stratum_get_plugin_url( $path = '' ) {
return plugins_url( $path, STRATUM_PLUGIN_FILE );
}
//Check if this Elementor page
function stratum_is_elementor($id = '') {
global $post;
if (!empty($id)) {
return \Elementor\Plugin::$instance->documents->get($id)->is_built_with_elementor();
} else {
return \Elementor\Plugin::$instance->documents->get($post->ID)->is_built_with_elementor();
}
}
function stratum_generate_swiper_options($settings = []){
if (empty($settings)) return;
extract( shortcode_atts( array(
//Swiper
'columns_count' => '1',
'slides_in_columns' => '1',
'slides_to_scroll' => '1',
'slider_direction' => 'horizontal',
'auto_height' => '',
'navigation' => 'both',
'pagination_style' => 'bullets',
'dynamic_bullets' => '',
'keyboard_control' => '',
'mousewheel_control' => '',
'item_center' => '',
'spacing_slides' => '',
'free_mode' => '',
'slide_effects' => 'slide',
'autoplay' => '',
'autoplay_speed' => '',
'pause_on_hover' => 'yes',
'loop' => '',
'animation_speed' => '',
'simulate_touch' => '',
//--Swiper
//Extra options
'slide_text_animation_delay' => 500,
'coverflow_visible' => '',
//Responsive
'columns_count_tablet' => '',
'columns_count_mobile' => '',
'slides_in_columns_tablet' => '',
'slides_in_columns_mobile' => '',
'slides_to_scroll_tablet' => '',
'slides_to_scroll_mobile' => '',
'spacing_slides_tablet' => '',
'spacing_slides_mobile' => ''
), $settings ) );
$spaceBetween = ( is_array( $spacing_slides ) && array_key_exists( 'size', $spacing_slides ) ) ?
absint( $spacing_slides['size'] ) : 0;
$spaceBetween_tablet = ( is_array( $spacing_slides_tablet ) && array_key_exists( 'size', $spacing_slides_tablet ) ) ?
absint( $spacing_slides_tablet['size'] ) : $spaceBetween;
$spaceBetween_mobile = ( is_array( $spacing_slides_mobile ) && array_key_exists( 'size', $spacing_slides_mobile ) ) ?
absint( $spacing_slides_mobile['size'] ) : $spaceBetween;
$options = array(
'slidesPerView' => ($columns_count != 'auto') ? ( ($slide_effects == 'cube') ? 1 : (int)$columns_count ) : $columns_count,
'slidesPerColumn' => (int)$slides_in_columns,
'slidesPerColumnFill' => 'row', //column
'slidesPerGroup' => (int)$slides_to_scroll,
'direction' => $slider_direction,
'autoHeight' => (($free_mode == 'yes' || (int)$slides_in_columns != 1) ? false : ($auto_height == 'yes')),
'keyboard' => $keyboard_control == 'yes',
'mousewheel' => $mousewheel_control == 'yes',
'centeredSlides' => $item_center == 'yes',
'spaceBetween' => $spaceBetween,
'freeMode' => $free_mode == 'yes',
'effect' => (($slider_direction == 'vertical' && $slide_effects == 'cube') ? 'slide' : $slide_effects),
'autoplay' => ($autoplay == 'yes') ? array('delay' => $autoplay_speed) : false,
'autoplayPause' => ($autoplay == 'yes' && $pause_on_hover == 'yes'),
'loop' => $loop == 'yes',
'speed' => $animation_speed,
'allowTouchMove' => $simulate_touch == 'yes',
'textAnimationDelay' => (int) $slide_text_animation_delay,
'coverflow_visible' => ($coverflow_visible == 'visible'),
//Responsive
'responsive' => array(
'slidesPerView_tablet' => ( $columns_count_tablet != 'auto') ? (int)$columns_count_tablet : $columns_count_tablet,
'slidesPerView_mobile' => ( $columns_count_mobile != 'auto') ? (int)$columns_count_mobile : $columns_count_mobile,
'slidesPerColumn_tablet' => (int)$slides_in_columns_tablet,
'slidesPerColumn_mobile' => (int)$slides_in_columns_mobile,
'slidesPerGroup_tablet' => (int)$slides_to_scroll_tablet,
'slidesPerGroup_mobile' => (int)$slides_to_scroll_mobile,
'spaceBetween_tablet' => $spaceBetween_tablet,
'spaceBetween_mobile' => $spaceBetween_mobile,
)
);
if ($navigation != 'none'){
//Arrows
$navigation_arrows = true;
//Bullets
$navigation_pagination = array(
'el' => '.swiper-pagination',
'type' => $pagination_style,
'clickable' => true,
'dynamicBullets' => ($dynamic_bullets == 'yes'),
);
//Scrollbar
$navigation_scrollbar = array(
'el' => '.swiper-scrollbar',
'draggable' => true
);
if ($navigation == 'both'){
$options['navigation'] = $navigation_arrows;
if ($pagination_style == 'scrollbar'){
$options['scrollbar'] = $navigation_scrollbar;
} else {
$options['pagination'] = $navigation_pagination;
}
} else if ($navigation == 'arrows') {
$options['navigation'] = $navigation_arrows;
} else if ($navigation == 'pagination') {
if ($pagination_style == 'scrollbar'){
$options['scrollbar'] = $navigation_scrollbar;
} else {
$options['pagination'] = $navigation_pagination;
}
}
}
return $options;
}
function stratum_get_taxonomies($post_type){
$taxonomies = get_object_taxonomies( $post_type, 'objects' );
$return = [];
if (!empty($taxonomies)){
foreach ($taxonomies as $key => $taxonomy_name) {
$return[$key] = $taxonomy_name->labels->name;
}
}
return $return;
}
function stratum_get_terms($taxonomy){
$return = [];
$terms = get_terms(array(
'taxonomy' => $taxonomy,
'hide_empty' => true,
));
if (!empty($terms)){
foreach ($terms as $key => $term_name) {
$taxonomy_obj = get_taxonomy( $term_name->taxonomy );
$return[$term_name->slug] = $term_name->name;
}
}
return $return;
}
function stratum_build_custom_query(&$query_args = [], $settings = []){
if ((isset($settings['include_ids']) && $settings['include_ids'] != '') || isset($settings['post_type'])){
$query_args = array(
'posts_per_page' => $settings['posts_per_page'],
'ignore_sticky_posts' => 1,
'post_status' => 'publish',
'order' => $settings['order'],
'orderby' => $settings['orderby'],
);
if ( isset($settings['ignore_sticky_posts']) ){
$query_args['ignore_sticky_posts'] = $settings['ignore_sticky_posts'];
}
if (isset($settings['page'])){
$paged = $settings['page'];
} else {
$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
}
if ( isset($settings['pagination']) && $settings['pagination'] == 'yes' ){
$query_args['paged'] = $paged;
}
}
//Exclude by IDs && Current Post ID
if ((isset($settings['exclude_ids']) && $settings['exclude_ids'] != '') || $settings['exclude_current']){
$ids_arr = [];
if ((isset($settings['exclude_ids']) && $settings['exclude_ids'] != '')){
$ids_arr = array_map( 'intval', explode(',', $settings['exclude_ids']) );
}
if ($settings['exclude_current']){
$ids_arr[] = get_the_ID();
}
$query_args['post__not_in'] = $ids_arr;
}
//Filter by IDs
if (isset($settings['include_ids']) && $settings['include_ids'] != ''){
$ids_arr = array_map( 'intval', explode(',', $settings['include_ids']) );
$query_args['post__in'] = $ids_arr;
}
//Set post_type
if ( isset($settings['post_type'])){
$query_args['post_type'] = $settings['post_type'];
if ( !empty($settings['taxonomies'])){
$query_args['tax_query'] = array(
'relation' => $settings['terms_relation'],
);
$taxonomy_arr = [];
//Get terms from taxonomy (Make arr)
foreach ($settings['taxonomies'] as $taxonomy_key => $taxonomy_name) {
if (isset($settings[$taxonomy_name.'_terms'])){
foreach ($settings[$taxonomy_name.'_terms'] as $term_key => $term_value) {
$taxonomy_arr[$taxonomy_name][] = $term_value;
}
}
}
//Add array to query
if (!empty($taxonomy_arr)){
foreach ($taxonomy_arr as $taxonomy_name => $terms_arr) {
foreach ($terms_arr as $term_index => $term_name) {
$query_args['tax_query'][] = array(
'taxonomy' => $taxonomy_name,
'field' => 'slug',
'terms' => $term_name
);
}
}
}
}
}
}
function stratum_css_class($class_array){
return implode(' ', array_filter($class_array));
}
/**
* Recursive sanitation for an array
*
* @param $array
*
* @return mixed
*/
function stratum_recursive_sanitize_array( $array ) {
foreach ( $array as $key => &$value ) {
if ( is_array( $value ) ) {
$value = stratum_recursive_sanitize_array($value);
}
else {
$value = sanitize_text_field( $value );
}
}
return $array;
}
/**
* Validate an HTML tag against a safe allowed list.
*
* @param string $tag
*
* @return string Valid HTML tag allowed for headings
*/
function stratum_validate_heading_html_tag( $tag ) {
$allowed_tags = array(
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'div',
'span',
'p',
);
return in_array( strtolower( $tag ), $allowed_tags ) ? $tag : 'div';
}

View File

@@ -0,0 +1,867 @@
<?php
/**
* weDevs Settings API wrapper class modified for Stratum
*
* @version 1.3 (27-Sep-2016)
*
* @author Tareq Hasan <tareq@weDevs.com>
* @link https://tareq.co Tareq Hasan
* @example example/oop-example.php How to use the class
*/
use Stratum\String_Encryption;
if ( !class_exists( 'WeDevs_Settings_API' ) ):
class WeDevs_Settings_API {
/**
* settings sections array
*
* @var array
*/
protected $settings_sections = array();
/**
* Settings fields array
*
* @var array
*/
protected $settings_fields = array();
public function __construct() {
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
}
/**
* Enqueue scripts and styles
*/
function admin_enqueue_scripts() {
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_media();
wp_enqueue_script( 'wp-color-picker' );
wp_enqueue_script( 'jquery' );
}
/**
* Set settings sections
*
* @param array $sections setting sections array
*/
function set_sections( $sections ) {
$this->settings_sections = $sections;
return $this;
}
/**
* Add a single section
*
* @param array $section
*/
function add_section( $section ) {
$this->settings_sections[] = $section;
return $this;
}
/**
* Set settings fields
*
* @param array $fields settings fields array
*/
function set_fields( $fields ) {
$this->settings_fields = $fields;
return $this;
}
function add_field( $section, $field ) {
$defaults = array(
'name' => '',
'label' => '',
'desc' => '',
'type' => 'text'
);
$arg = wp_parse_args( $field, $defaults );
$this->settings_fields[$section][] = $arg;
return $this;
}
/**
* Initialize and registers the settings sections and fileds to WordPress
*
* Usually this should be called at `admin_init` hook.
*
* This function gets the initiated settings sections and fields. Then
* registers them to WordPress and ready for use.
*/
function admin_init() {
//register settings sections
foreach ( $this->settings_sections as $section ) {
if ( isset($section['desc']) && !empty($section['desc']) ) {
$section['desc'] = '<div class="inside">' . $section['desc'] . '</div>';
$callback = create_function('', 'echo "' . str_replace( '"', '\"', $section['desc'] ) . '";');
} else if ( isset( $section['callback'] ) ) {
$callback = $section['callback'];
} else {
$callback = null;
}
add_settings_section( $section['id'], $section['title'], $callback, $section['id'] );
}
//register settings fields
foreach ( $this->settings_fields as $section => $field ) {
foreach ( $field as $option ) {
$name = $option['name'];
$type = isset( $option['type'] ) ? $option['type'] : 'text';
$label = isset( $option['label'] ) ? $option['label'] : '';
$callback = isset( $option['callback'] ) ? $option['callback'] : array( $this, 'callback_' . $type );
$args = array(
'id' => $name,
'class' => isset( $option['class'] ) ? $option['class'] : $name,
'label_for' => "{$section}[{$name}]",
'desc' => isset( $option['desc'] ) ? $option['desc'] : '',
'desc_btn' => isset( $option['desc_btn'] ) ? $option['desc_btn'] : '',
'desc_link' => isset( $option['desc_link'] ) ? $option['desc_link'] : '',
'desc_class' => isset( $option['desc_class'] ) ? $option['desc_class'] : '',
'desc_extra_btn' => isset( $option['desc_extra_btn'] ) ? $option['desc_extra_btn'] : '',
'desc_extra_link' => isset( $option['desc_extra_link'] ) ? $option['desc_extra_link'] : '',
'desc_extra_class' => isset( $option['desc_extra_class'] ) ? $option['desc_extra_class'] : '',
'name' => $label,
'section' => $section,
'size' => isset( $option['size'] ) ? $option['size'] : null,
'options' => isset( $option['options'] ) ? $option['options'] : '',
'std' => isset( $option['default'] ) ? $option['default'] : '',
'sanitize_callback' => isset( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : '',
'type' => $type,
'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : '',
'min' => isset( $option['min'] ) ? $option['min'] : '',
'max' => isset( $option['max'] ) ? $option['max'] : '',
'step' => isset( $option['step'] ) ? $option['step'] : '',
'icon' => isset( $option['icon'] ) ? $option['icon'] : '',
);
add_settings_field( "{$section}[{$name}]", $label, $callback, $section, $section, $args );
}
}
// creates our settings in the options table
foreach ( $this->settings_sections as $section ) {
register_setting( $section['id'], $section['id'], array( $this, 'sanitize_options' ) );
}
}
/**
* Get field description for display
*
* @param array $args settings field args
*/
public function get_field_description( $args ) {
$desc = '';
if ( ! empty( $args['desc'] ) ) {
$desc = sprintf( '<p class="description">%s</p>', $args['desc'] );
}
if ( ! empty( $args['desc_btn'] ) ) {
$desc .= sprintf( '<p class="regular-text"><a href="%s" class="button button-primary description_button %s">%s</a></p>', (!empty($args['desc_link']) ? $args['desc_link'] : '#'), $args['desc_class'], $args['desc_btn'] );
}
if ( ! empty( $args['desc_extra_btn'] ) ) {
$desc .= sprintf( '<p class="regular-text"><a href="%s" class="button button-primary description_button %s">%s</a></p>', (!empty($args['desc_extra_link']) ? $args['desc_extra_link'] : '#'), $args['desc_extra_class'], $args['desc_extra_btn'] );
}
return $desc;
}
/**
* Displays a text field for a settings field
*
* @param array $args settings field args
*/
function callback_text( $args ) {
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
$type = isset( $args['type'] ) ? $args['type'] : 'text';
$placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
$html = sprintf( '<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder );
$html .= $this->get_field_description( $args );
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Displays a url field for a settings field
*
* @param array $args settings field args
*/
function callback_url( $args ) {
$this->callback_text( $args );
}
/**
* Displays a number field for a settings field
*
* @param array $args settings field args
*/
function callback_number( $args ) {
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
$type = isset( $args['type'] ) ? $args['type'] : 'number';
$placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
$min = ( $args['min'] == '' ) ? '' : ' min="' . $args['min'] . '"';
$max = ( $args['max'] == '' ) ? '' : ' max="' . $args['max'] . '"';
$step = ( $args['step'] == '' ) ? '' : ' step="' . $args['step'] . '"';
$html = sprintf( '<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step );
$html .= $this->get_field_description( $args );
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Displays a checkbox for a settings field
*
* @param array $args settings field args
*/
function callback_checkbox( $args ) {
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$html = '<fieldset>';
$html .= sprintf( '<label for="wpuf-%1$s[%2$s]">', $args['section'], $args['id'] );
$html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="off" />', $args['section'], $args['id'] );
$html .= sprintf( '<input type="checkbox" class="checkbox" id="wpuf-%1$s[%2$s]" name="%1$s[%2$s]" value="on" %3$s />', $args['section'], $args['id'], checked( $value, 'on', false ) );
$html .= sprintf( '%1$s</label>', $args['desc'] );
$html .= '</fieldset>';
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Displays a toggle for a settings field
*
* @param array $args settings field args
*/
function callback_toggle( $args ) {
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$html = '<fieldset>';
$html .= sprintf( '<label class="toggle-btn'.esc_attr( $value == 'on' ? ' active': '' ).'" for="wpuf-%1$s[%2$s]">', $args['section'], $args['id'] );
$html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="off" />', $args['section'], $args['id'] );
$html .= sprintf( '<input type="checkbox" class="checkbox cb-value" id="wpuf-%1$s[%2$s]" name="%1$s[%2$s]" value="on" %3$s />', $args['section'], $args['id'], checked( $value, 'on', false ) );
$html .= '<span class="round-btn"></span>';
$html .= '</label>';
$html .= '</fieldset>';
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Displays a toggle for a settings field
*
* @param array $args settings field args
*/
function callback_section_title( $args ) {
$html = '<fieldset class="stratum-section-title-area">';
$html .= '<h2 class="stratum-section-title">';
$html .= esc_html( $args['name'] );
$html .= '</h2>';
if( array_key_exists('desc', $args) ){
if( $args['desc'] ){
$html .= sprintf( '<p class="about-text">%1$s</p>', $args['desc'] );
}
}
$html .= '</fieldset>';
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Displays a multicheckbox for a settings field
*
* @param array $args settings field args
*/
function callback_multicheck( $args ) {
$value = $this->get_option( $args['id'], $args['section'], $args['std'] );
$html = '<fieldset>';
$html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id'] );
foreach ( $args['options'] as $key => $label ) {
$checked = isset( $value[$key] ) ? $value[$key] : '0';
$html .= sprintf( '<label for="wpuf-%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
$html .= sprintf( '<input type="checkbox" class="checkbox" id="wpuf-%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $checked, $key, false ) );
$html .= sprintf( '%1$s</label><br>', $label );
}
$html .= $this->get_field_description( $args );
$html .= '</fieldset>';
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Displays a radio button for a settings field
*
* @param array $args settings field args
*/
function callback_radio( $args ) {
$value = $this->get_option( $args['id'], $args['section'], $args['std'] );
$html = '<fieldset>';
foreach ( $args['options'] as $key => $label ) {
$html .= sprintf( '<label for="wpuf-%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
$html .= sprintf( '<input type="radio" class="radio" id="wpuf-%1$s[%2$s][%3$s]" name="%1$s[%2$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $value, $key, false ) );
$html .= sprintf( '%1$s</label><br>', $label );
}
$html .= $this->get_field_description( $args );
$html .= '</fieldset>';
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Displays a selectbox for a settings field
*
* @param array $args settings field args
*/
function callback_select( $args ) {
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
$html = sprintf( '<select class="%1$s" name="%2$s[%3$s]" id="%2$s[%3$s]">', $size, $args['section'], $args['id'] );
foreach ( $args['options'] as $key => $label ) {
$html .= sprintf( '<option value="%s"%s>%s</option>', $key, selected( $value, $key, false ), $label );
}
$html .= sprintf( '</select>' );
$html .= $this->get_field_description( $args );
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Displays a textarea for a settings field
*
* @param array $args settings field args
*/
function callback_textarea( $args ) {
$value = esc_textarea( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
$placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="'.$args['placeholder'].'"';
$html = sprintf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value );
$html .= $this->get_field_description( $args );
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Displays the html for a settings field
*
* @param array $args settings field args
* @return string
*/
function callback_html( $args ) {
echo $this->get_field_description( $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Displays a rich text textarea for a settings field
*
* @param array $args settings field args
*/
function callback_wysiwyg( $args ) {
$value = $this->get_option( $args['id'], $args['section'], $args['std'] );
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : '500px';
echo '<div style="max-width: ' . esc_attr( $size ) . ';">';
$editor_settings = array(
'teeny' => true,
'textarea_name' => $args['section'] . '[' . $args['id'] . ']',
'textarea_rows' => 10
);
if ( isset( $args['options'] ) && is_array( $args['options'] ) ) {
$editor_settings = array_merge( $editor_settings, $args['options'] );
}
wp_editor( $value, $args['section'] . '-' . $args['id'], $editor_settings );
echo '</div>';
echo $this->get_field_description( $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Displays a file upload field for a settings field
*
* @param array $args settings field args
*/
function callback_file( $args ) {
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
$id = $args['section'] . '[' . $args['id'] . ']';
$label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : esc_html__( 'Choose File' );
$html = sprintf( '<input type="text" class="%1$s-text wpsa-url" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
$html .= '<input type="button" class="button wpsa-browse" value="' . $label . '" />';
$html .= $this->get_field_description( $args );
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Displays a password field for a settings field
*
* @param array $args settings field args
*/
function callback_password( $args ) {
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
$html = sprintf( '<input type="password" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
$html .= $this->get_field_description( $args );
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Displays a color picker field for a settings field
*
* @param array $args settings field args
*/
function callback_color( $args ) {
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
$html = sprintf( '<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std'] );
$html .= $this->get_field_description( $args );
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Displays a select box for creating the pages select box
*
* @param array $args settings field args
*/
function callback_pages( $args ) {
$dropdown_args = array(
'selected' => esc_attr($this->get_option($args['id'], $args['section'], $args['std'] ) ),
'name' => $args['section'] . '[' . $args['id'] . ']',
'id' => $args['section'] . '[' . $args['id'] . ']',
'echo' => 0
);
$html = wp_dropdown_pages( $dropdown_args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Sanitize callback for Settings API
*
* @return mixed
*/
function sanitize_options( $options ) {
if ( !$options ) {
return $options;
}
foreach( $options as $option_slug => $option_value ) {
$sanitize_callback = $this->get_sanitize_callback( $option_slug );
// If callback is set, call it
if ( $sanitize_callback ) {
$options[ $option_slug ] = call_user_func( $sanitize_callback, $option_value );
continue;
}
}
return $options;
}
/**
* Get sanitization callback for given option slug
*
* @param string $slug option slug
*
* @return mixed string or bool false
*/
function get_sanitize_callback( $slug = '' ) {
if ( empty( $slug ) ) {
return false;
}
// Iterate over registered fields and see if we can find proper callback
foreach( $this->settings_fields as $section => $options ) {
foreach ( $options as $option ) {
if ( $option['name'] != $slug ) {
continue;
}
// Return the callback name
$callback = isset( $option['sanitize_callback'] ) && is_callable( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : false;
if ( ! $callback && $this->is_option_encrypted( $option['name'], $section ) ) {
$callback = array( $this, 'encrypt_option' );
}
return $callback;
}
}
return false;
}
/**
* Get the value of a settings field
*
* @param string $option settings field name
* @param string $section the section name this field belongs to
* @param string $default default text if it's not found
* @return string
*/
function get_option( $option, $section, $default = '' ) {
$options = get_option( $section );
if ( isset( $options[$option] ) ) {
return $this->maybe_decrypt_option( $option, $section, $options[ $option ] );
}
return $default;
}
function maybe_decrypt_option( $option, $section, $option_value ) {
if ( $this->is_option_encrypted( $option, $section ) ) {
$encryption = new String_Encryption();
return $encryption->decrypt( $option_value );
}
return $option_value;
}
function is_option_encrypted( $option, $section ) {
return isset( $this->settings_fields[ $section ][ $option ][ 'is_encrypted' ] )
&& filter_var( $this->settings_fields[ $section ][ $option ][ 'is_encrypted' ], FILTER_VALIDATE_BOOLEAN );
}
function encrypt_option( $option_value ) {
$encryption = new String_Encryption();
return $encryption->encrypt( $option_value );
}
/**
* Show navigations as tab
*
* Shows all the settings section labels as tab
*/
function show_navigation() {
$html = '<div class="nav-tab-wrapper">';
$count = count( $this->settings_sections );
// don't show the navigation if only one section exists
if ( $count === 1 ) {
return;
}
foreach ( $this->settings_sections as $tab ) {
if( array_key_exists('icon', $tab) ){
$html .= sprintf( '<a href="#%1$s" class="nav-tab" id="%1$s-tab"><i class="%3$s"></i>%2$s</a>', $tab['id'], $tab['title'], $tab['icon'] );
}else{
$html .= sprintf( '<a href="#%1$s" class="nav-tab" id="%1$s-tab">%2$s</a>', $tab['id'], $tab['title'] );
}
}
$html .= '</div>';
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Prints out all settings sections added to a particular settings page
*/
function do_settings_sections( $page ) {
global $wp_settings_sections, $wp_settings_fields;
if ( ! isset( $wp_settings_sections[ $page ] ) ) {
return;
}
foreach ( (array) $wp_settings_sections[ $page ] as $section ) {
if ( $section['title'] ) {
echo '<h2>' . esc_html( $section['title'] ) . '</h2>';
}
if ( $section['callback'] ) {
call_user_func( $section['callback'], $section );
}
if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) {
continue;
}
echo '<div class="form-addons-container">';
$this->do_settings_fields( $page, $section['id'] );
echo '</div>';
}
}
/**
* Print out the settings fields for a particular settings section.
*
* Part of the Settings API. Use this in a settings page to output
* a specific section. Should normally be called by do_settings_sections()
* rather than directly.
*
* @global $wp_settings_fields Storage array of settings fields and their pages/sections.
*
* @since 2.7.0
*
* @param string $page Slug title of the admin page whose settings fields you want to show.
* @param string $section Slug title of the settings section whose fields you want to show.
*/
function do_settings_fields( $page, $section ) {
global $wp_settings_fields;
if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) {
return;
}
foreach ( (array) $wp_settings_fields[ $page ][ $section ] as $field ) {
$class = '';
if ( $field['args']['type'] == 'section_title' ) {
$class = 'form-addons-section-title';
}else{
if ( ! empty( $field['args']['class'] ) ) {
$class = $field['args']['class'];
}
}
echo '<div class="form-addon ' . esc_attr( $class ) . '">';
echo '<div class="form-addon-inner">';
echo '<div class="addon-name">';
if( array_key_exists('icon', $field['args']) ){
if($field['args']['icon']){
echo '<i class="' . esc_attr( $field['args']['icon'] ) . '"></i>';
}
}
echo '<h3 class="addon-title">' . esc_html( $field['title'] ) . '</h3>';
if( $field['args']['desc'] ){
echo '<span class="addon-desc">' . esc_html( $field['args']['desc'] ) . '</span>';
}
echo '</div>';
echo '<div class="addon-switch">';
call_user_func( $field['callback'], $field['args'] );
echo '</div>';
echo '</div>';
echo '</div>';
}
}
/**
* Show the section settings forms
*
* This function displays every sections in a different form
*/
function show_forms() {
?>
<div class="metabox-holder">
<?php foreach ( $this->settings_sections as $form ) { ?>
<div id="<?php echo esc_attr( $form['id'] ); ?>" class="group" style="display: none;">
<form method="post" action="options.php">
<div class="stratum-settings-submit stratum-settings-submit-top">
<div class="stratum-settings-submit-top-inner">
<h3>Stratum Settings</h3>
<?php submit_button(); ?>
</div>
</div>
<?php
do_action( 'wsa_form_top_' . $form['id'], $form );
settings_fields( $form['id'] );
if( array_key_exists('addons', $form) ){
$this->do_settings_sections( $form['id'] );
}else{
do_settings_sections( $form['id'] );
}
do_action( 'wsa_form_bottom_' . $form['id'], $form );
if ( isset( $this->settings_fields[ $form['id'] ] ) ):
?>
<div class="stratum-settings-submit">
<?php submit_button(); ?>
</div>
<?php endif; ?>
</form>
</div>
<?php } ?>
</div>
<?php
$this->script();
}
/**
* Tabbable JavaScript codes & Initiate Color Picker
*
* This code uses localstorage for displaying active tabs
*/
function script() {
?>
<script>
jQuery(document).ready(function($) {
// toggle
$('.cb-value').click(function() {
var mainParent = $(this).parent('.toggle-btn');
if($(mainParent).find('input.cb-value').is(':checked')) {
$(mainParent).addClass('active');
} else {
$(mainParent).removeClass('active');
}
});
// Settings sticky top
$(document).ready(function() {
var stickyTop = $('.stratum-settings-submit-top').offset().top;
$(window).scroll(function() {
var windowTop = $(window).scrollTop();
if (stickyTop < windowTop && $(".stratum-settings-wrap").height() + $(".stratum-settings-wrap").offset().top - $(".stratum-settings-submit-top").height() > windowTop) {
$('.stratum-settings-submit-top').addClass('stratum-settings-submit-top-fixed');
} else {
$('.stratum-settings-submit-top').removeClass('stratum-settings-submit-top-fixed');
}
});
});
//Initiate Color Picker
$('.wp-color-picker-field').wpColorPicker();
// Switches option sections
$('.group').hide();
var activetab = '';
if (typeof(localStorage) != 'undefined' ) {
activetab = localStorage.getItem("activetab");
}
//if url has section id as hash then set it as active or override the current local storage value
if(window.location.hash){
activetab = window.location.hash;
if (typeof(localStorage) != 'undefined' ) {
localStorage.setItem("activetab", activetab);
}
}
if (activetab != '' && $(activetab).length ) {
$(activetab).fadeIn();
} else {
$('.group:first').fadeIn();
}
$('.group .collapsed').each(function(){
$(this).find('input:checked').parent().parent().parent().nextAll().each(
function(){
if ($(this).hasClass('last')) {
$(this).removeClass('hidden');
return false;
}
$(this).filter('.hidden').removeClass('hidden');
});
});
if (activetab != '' && $(activetab + '-tab').length ) {
$(activetab + '-tab').addClass('nav-tab-active');
}
else {
$('.nav-tab-wrapper a:first').addClass('nav-tab-active');
}
$('.nav-tab-wrapper a').click(function(evt) {
$('.nav-tab-wrapper a').removeClass('nav-tab-active');
$(this).addClass('nav-tab-active').blur();
var clicked_group = $(this).attr('href');
if (typeof(localStorage) != 'undefined' ) {
localStorage.setItem("activetab", $(this).attr('href'));
}
$('.group').hide();
$(clicked_group).fadeIn();
evt.preventDefault();
});
$('.wpsa-browse').on('click', function (event) {
event.preventDefault();
var self = $(this);
// Create the media frame.
var file_frame = wp.media.frames.file_frame = wp.media({
title: self.data('uploader_title'),
button: {
text: self.data('uploader_button_text'),
},
multiple: false
});
file_frame.on('select', function () {
attachment = file_frame.state().get('selection').first().toJSON();
self.prev('.wpsa-url').val(attachment.url).change();
});
// Finally, open the modal
file_frame.open();
});
});
</script>
<?php
$this->add_style();
}
function add_style() {
global $wp_version;
if (version_compare($wp_version, '3.8', '<=')):
?>
<style type="text/css">
.form-table th { padding: 20px 10px; }
</style>
<?php
endif;
}
}
endif;

View File

@@ -0,0 +1,24 @@
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
require_once dirname( __FILE__ ) . '/functions.php';
require_once dirname( __FILE__ ) . '/string-encryption.php';
require_once dirname( __FILE__ ) . '/excerpt-helper.php';
require_once dirname( __FILE__ ) . '/main.php';
require_once dirname( __FILE__ ) . '/translation.php';
require_once dirname( __FILE__ ) . '/settings.php';
require_once dirname( __FILE__ ) . '/scripts-manager.php';
require_once dirname( __FILE__ ) . '/widgets-manager.php';
require_once dirname( __FILE__ ) . '/ajax-manager.php';
require_once dirname( __FILE__ ) . '/controls-manager.php';
require_once dirname( __FILE__ ) . '/token-manager.php';
require_once dirname( __FILE__ ) . '/rest-api.php';
require_once dirname( __FILE__ ) . '/version-control.php';
require_once dirname( __FILE__ ) . '/admin-page.php';
require_once dirname( __FILE__ ) . '/stratum-sections.php';
require_once dirname( __FILE__ ) . '/libraries/class.settings-api.php';
//premium
require_once dirname( __FILE__ ) . '/premium.php';

View File

@@ -0,0 +1,115 @@
<?php
namespace Stratum;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
final class Stratum {
/**
* @var Stratum
*/
private static $instance = null;
/**
* @var Settings
*/
private $settings;
/**
* @var Scripts_Manager
*/
private $scripts_manager;
/**
* @var Widgets_Manager
*/
private $widgets_manager;
/**
* @var Controls_Manager
*/
private $controls_manager;
/**
* @var Token_Manager
*/
private $token_manager;
/**
* @var Ajax_Manager
*/
private $ajax_manager;
/**
* @var VersionControl
*/
private $version_control;
/**
* @var Rest_API
*/
private $rest_api;
/**
* @var admin-page
*/
private $admin_page;
private function __construct() {
$this->scripts_manager = new \Stratum\Managers\Scripts_Manager();
$this->widgets_manager = new \Stratum\Managers\Widgets_Manager();
$this->controls_manager = new \Stratum\Managers\Controls_Manager();
$this->token_manager = new \Stratum\Managers\Token_Manager();
$this->ajax_manager = new \Stratum\Managers\Ajax_Manager();
$this->version_control = new Version_Control();
$this->rest_api = new Rest_API();
$this->admin_page = new Admin_page();
}
/**
* @return Scripts_Manager
*/
public function get_scripts_manager() {
return $this->scripts_manager;
}
/**
* @return Widgets_Manager
*/
public function get_widgets_manager() {
return $this->widgets_manager;
}
/**
* @return Controls_Manager
*/
public function get_controls_manager() {
return $this->controls_manager;
}
/**
* @return Token_Manager
*/
public function get_token_manager() {
return $this->token_manager;
}
/**
* @return Ajax_Manager
*/
public function get_ajax_manager() {
return $this->ajax_manager;
}
/**
* @return Stratum
*/
public static function get_instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
}

View File

@@ -0,0 +1,80 @@
<?php
namespace Stratum;
class Premium {
private static $instance = null;
/**
* Premium constructor.
*/
public function __construct() {
add_action( 'admin_menu', array($this, 'admin_menu'), 99 );
}
public static function get_instance()
{
if (self::$instance == null)
{
self::$instance = new Premium();
}
return self::$instance;
}
public function admin_menu() {
add_submenu_page(
'stratum',
esc_html__( 'Go Premium', 'stratum' ),
'<span class="dashicons dashicons-superhero-alt" style="font-size:17px;vertical-align:middle;"></span> ' .
esc_html__( 'Go Premium', 'stratum' ),
'manage_options',
'stratum-premium',
array( $this, 'premium_page' )
);
}
public function premium_page() {
$settings = \Stratum\Settings::get_instance();
$pluginData = $settings->getPluginData();
$storeUrl = isset( $pluginData['PluginURI'] ) ? $pluginData['PluginURI'] : '#';
$storeUrl = add_query_arg(
array(
'utm_source' => 'dashboard',
'utm_medium' => 'go-premium-button',
'utm_campaign' => 'stratum-premium',
),
$storeUrl
);
$compareUrl = add_query_arg(
array(
'utm_source' => 'dashboard',
'utm_medium' => 'compare-button',
'utm_campaign' => 'stratum-premium',
),
'https://motopress.com/stratum-elementor-widgets-pro-vs-lite/'
);
?>
<div class="wrap">
<h1><?php esc_html_e('Go Premium', 'stratum'); ?></h1>
<div class="card">
<p><?php esc_html_e('Stratum Pro unlocks access to numerous customization settings in many widgets. Work faster by employing your custom templates, achieve fancier motion effects and shapes, design better.', 'stratum'); ?></p>
<a href="<?php echo esc_url($storeUrl); ?>" class="button button-primary" target="_blank">
<?php esc_html_e('Go Premium', 'stratum'); ?></a>
<a href="<?php echo esc_url($compareUrl); ?>" class="button" target="_blank">
<?php esc_html_e('Lite vs Pro', 'stratum'); ?></a>
</div>
</div>
<?php
}
}
new Premium();

View File

@@ -0,0 +1,68 @@
<?php
namespace Stratum;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Class REST API
* @package Stratum
*/
class Rest_API {
protected $_namespace = 'Stratum/v1';
/**
* RestAPI constructor.
*/
public function __construct( ) {
add_action( 'rest_api_init', [ $this, 'register_rest_route' ] );
}
public function register_rest_route(){
register_rest_route( $this->_namespace, '/templates', array(
array(
'methods' => 'GET',
'callback' => [ $this, 'get_templates' ],
'permission_callback' => [ $this, 'permissions_check' ],
),
'schema' => array( $this, 'templates_schema' )
) );
}
public function permissions_check( $request ) {
if ( ! current_user_can( 'read' ) ) {
return new \WP_Error(
'rest_forbidden',
esc_html__( 'Forbidden.' ),
array( 'status' => $this->authorization_status_code() )
);
}
return true;
}
// Sets up the proper HTTP status code for authorization.
public function authorization_status_code() {
$status = 401;
if ( is_user_logged_in() ) {
$status = 403;
}
return $status;
}
/**
* Schema for a templates.
*
* @param WP_REST_Request $request Current request.
*/
public function templates_schema() {
}
public function get_templates($object) {
}
}

View File

@@ -0,0 +1,395 @@
<?php
namespace Stratum\Managers;
use \Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Class ScriptsManager
* @package Stratum
*/
class Scripts_Manager {
private $version;
private $prefix;
private $google_api_key;
/**
* ScriptsManager constructor.
*/
public function __construct() {
$settings = \Stratum\Settings::get_instance();
$this->version = $settings->getVersion();
$this->prefix = $settings->getPrefix();
$stratum_api = get_option( 'stratum_api', [] );
$this->google_api_key = isset( $stratum_api['google_api_key'] ) ? $stratum_api['google_api_key'] : '';
$this->init();
}
public function init() {
//==============Actions==============
add_action( 'elementor/init', [ $this, 'elementor_loaded' ] );
//Editor
add_action( 'elementor/editor/after_enqueue_styles', [ $this, 'enqueue_editor_document_scripts' ] );
add_action( 'elementor/editor/after_enqueue_styles', [ $this, 'enqueue_editor_panel_styles' ] );
add_action( 'elementor/editor/after_enqueue_styles', [ $this, 'enqueue_icons_font_styles' ] );
add_action( 'elementor/editor/after_enqueue_styles', [ $this, 'register_fontawesome_dependencies' ] );
//Frontend
add_action( 'elementor/frontend/before_register_scripts', [ $this, 'register_scripts_dependencies' ] );
add_action( 'elementor/frontend/before_register_styles' , [ $this, 'register_styles_dependencies' ] );
add_action( 'elementor/frontend/after_enqueue_styles' , [ $this, 'register_fontawesome_dependencies' ] );
add_action( 'elementor/frontend/after_enqueue_styles' , [ $this, 'enqueue_frontend_styles' ] );
add_action( 'elementor/frontend/after_enqueue_scripts', [ $this, 'enqueue_frontend_scripts' ] );
//Preview
add_action( 'elementor/editor/after_save', [ $this, 'on_save_options' ], 10, 2 );
}
public function elementor_loaded() {
wp_enqueue_script(
"{$this->prefix}-editor-panel-js",
stratum_get_plugin_url( 'assets/js/editor-panel.min.js' ),
apply_filters(
'stratum/editor_blocks_js/dependencies',
[
'jquery',
]
),
$this->version,
true
);
}
//JS load
public function enqueue_frontend_scripts() {
$this->load_locale_data();
wp_enqueue_script(
"{$this->prefix}-frontend-js",
stratum_get_plugin_url( 'assets/js/frontend.min.js' ),
apply_filters(
'stratum/editor_blocks_js/dependencies',
[
'imagesloaded'
]
),
$this->version,
true
);
wp_localize_script(
"{$this->prefix}-frontend-js",
'stratum',
apply_filters(
'stratum/editor_blocks_js/localize_data',
[
'localeData' => $this->get_locale_data( 'stratum' ),
'settings' => [
'wide_support' => get_theme_support( 'align-wide' ),
],
'ajax_url' => admin_url( 'admin-ajax.php' ),
'nonces' => array(
'get_articles' => wp_create_nonce( 'stratum_nonce_get_articles' ),
'get_elementor_templates' => wp_create_nonce( 'stratum_nonce_get_elementor_templates' ),
)
]
)
);
}
public function register_scripts_dependencies() {
//Countdown
wp_register_script(
'jquery-plugin',
stratum_get_plugin_url( 'vendors/jquery.countdown/jquery.plugin.min.js' ),
[ 'jquery' ],
'1.0',
true
);
wp_register_script(
'jquery-countdown',
stratum_get_plugin_url( 'vendors/jquery.countdown/jquery.countdown.min.js' ),
[ 'jquery', 'jquery-plugin' ],
'2.1.0',
true
);
preg_match( '/^(.*)_/', get_locale(), $current_locale );
$locale_prefix = isset( $current_locale[ 1 ] ) && $current_locale[ 1 ] !='en' ? $current_locale[ 1 ] : '';
if ( $locale_prefix != '' ) {
$locale_path = 'vendors/jquery.countdown/localization/jquery.countdown-' . $locale_prefix . '.js';
if ( file_exists( stratum_get_plugin_url( $locale_path ) ) ) {
wp_register_script(
'jquery-countdown-' . $locale_prefix,
stratum_get_plugin_url( $locale_path ),
[ 'jquery-countdown' ],
'2.1.0',
true
);
}
}
//Image hotspots dependencies
wp_register_script(
'draggabilly',
stratum_get_plugin_url( 'vendors/draggabilly/draggabilly.pkgd.min.js' ),
[ 'jquery' ],
'2.2.0',
true
);
wp_register_script(
'popper',
stratum_get_plugin_url( 'vendors/tippy/popper.min.js' ),
[ 'jquery' ],
'2.4.0',
true
);
wp_register_script(
'tippy',
stratum_get_plugin_url( 'vendors/tippy/tippy-bundle.umd.min.js' ),
[ 'jquery', 'popper' ],
'6.2.3',
true
);
wp_register_script(
'jquery-masonry',
stratum_get_plugin_url( 'vendors/masonry/masonry.pkgd.min.js' ),
[],
'4.2.2',
true
);
wp_register_script(
'anim-on-scroll',
stratum_get_plugin_url( 'vendors/AnimOnScroll/AnimOnScroll.js' ),
[ 'modernizr-custom' ],
'1.0.0',
true
);
wp_register_script(
'modernizr-custom',
stratum_get_plugin_url( 'vendors/modernizr/modernizr.custom.js' ),
[],
'2.6.2',
true
);
wp_register_script(
'donutty',
stratum_get_plugin_url( 'vendors/donutty/donutty-jquery.min.js' ),
[],
'2.0.0',
true
);
wp_register_script(
'waypoints',
stratum_get_plugin_url( 'vendors/waypoints/jquery.waypoints.min.js' ),
[ 'jquery' ],
'4.0.1',
true
);
wp_register_script(
'countup',
stratum_get_plugin_url( 'vendors/countup/countUp.min.js' ),
[],
'2.0.4',
true
);
wp_register_script(
'google-map-styles',
stratum_get_plugin_url( 'vendors/stratum/google-map-styles.min.js' ),
[],
$this->version,
true
);
wp_register_script(
'google-map-api',
'https://maps.googleapis.com/maps/api/js?key='.$this->google_api_key,
[],
'3.40',
true
);
wp_register_script(
'lottie-animations-api',
stratum_get_plugin_url( 'vendors/lottie/lottie.min.js' ),
[],
'5.7.1',
true
);
}
//JS Elementor Document Scripts
public function enqueue_editor_document_scripts() {
wp_enqueue_script(
"{$this->prefix}-editor-document-js",
stratum_get_plugin_url( 'assets/js/editor-document.min.js' ),
[
'jquery',
],
$this->version,
true
);
}
//CSS load (Panel)
public function enqueue_editor_panel_styles() {
wp_enqueue_style(
"{$this->prefix}-editor-panel",
stratum_get_plugin_url( 'assets/css/editor-panel.min.css' ),
apply_filters(
'stratum/editor_css/dependencies',
[]
),
$this->version
);
}
//CSS load (in iframe)
public function enqueue_frontend_styles() {
wp_enqueue_style(
"{$this->prefix}-widgets-style",
stratum_get_plugin_url( 'assets/css/style.min.css' ),
apply_filters(
'stratum/frontend_css/dependencies',
[]
),
$this->version
);
}
public function register_styles_dependencies() {
wp_register_style(
'tippy-themes',
stratum_get_plugin_url( 'vendors/tippy/themes.css' ),
[],
'6.2.3'
);
wp_register_style(
'tippy-animation',
stratum_get_plugin_url( 'vendors/tippy/animations.css' ),
[],
'6.2.3'
);
wp_register_style(
'scroll-anim-effects',
stratum_get_plugin_url( 'vendors/AnimOnScroll/scrollAnimEffects.css' )
);
}
//CSS load (icons)
public function enqueue_icons_font_styles() {
wp_enqueue_style(
"{$this->prefix}-icons-style",
stratum_get_plugin_url( '/assets/css/stratum.min.css' ),
apply_filters(
'stratum/editor_css/dependencies',
[]
),
$this->version
);
}
//Register fontawesome
public function register_fontawesome_dependencies() {
wp_register_script(
'font-awesome-4-shim',
ELEMENTOR_ASSETS_URL . 'lib/font-awesome/js/v4-shims.min.js',
[],
ELEMENTOR_VERSION
);
wp_register_style(
'font-awesome-5-all',
ELEMENTOR_ASSETS_URL . 'lib/font-awesome/css/all.min.css',
false,
ELEMENTOR_VERSION
);
wp_register_style(
'font-awesome-4-shim',
ELEMENTOR_ASSETS_URL . 'lib/font-awesome/css/v4-shims.min.css',
[],
ELEMENTOR_VERSION
);
}
public function on_save_options($post_id, $editor_data) {
$settings = Plugin::$instance->documents->get( $post_id )->get_settings();
}
public function load_locale_data() {
$locale_data = $this->get_locale_data( 'stratum' );
wp_add_inline_script(
'wp-i18n',
'wp.i18n.setLocaleData( ' . json_encode( $locale_data ) . ', "'. $this->prefix .'" );'
);
}
public function get_locale_data($domain) {
$translations = get_translations_for_domain( $domain );
$locale = array(
'' => array(
'domain' => $domain,
'lang' => is_admin() ? get_user_locale() : get_locale()
)
);
if ( ! empty( $translations->headers[ 'Plural-Forms' ] ) ) {
$locale[ '' ][ 'plural_forms' ] = $translations->headers[ 'Plural-Forms' ];
}
foreach ( $translations->entries as $msgid => $entry ) {
$locale[ $msgid ] = $entry->translations;
}
return $locale;
}
public function get_image_sizes() {
global $_wp_additional_image_sizes;
$sizes = get_intermediate_image_sizes();
$result = array();
foreach ( $sizes as $size ) {
if ( in_array( $size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {
$result[ $size ] = ucwords( trim( str_replace( array( '-', '_' ), array( ' ', ' ' ), $size ) ) );
} else {
$result[ $size ] = sprintf(
'%1$s (%2$sx%3$s)',
ucwords( trim( str_replace( array( '-', '_' ), array( ' ', ' ' ), $size ) ) ),
$_wp_additional_image_sizes[ $size ][ 'width' ],
$_wp_additional_image_sizes[ $size ][ 'height' ]
);
}
}
return array_merge( array( 'full' => esc_html__( 'Full', 'stratum' ), ), $result );
}
}

View File

@@ -0,0 +1,67 @@
<?php
namespace Stratum;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Settings {
private static $instance = null;
private $version;
private $prefix;
private $pluginName;
private $pluginData;
/**
* Settings constructor.
*/
public function __construct() {
if( !function_exists('get_plugin_data') ){
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}
$this->pluginData = get_plugin_data(STRATUM_PLUGIN_FILE);
$this->version = $this->pluginData['Version'];
$this->prefix = $this->pluginData['TextDomain'];
$this->pluginName = $this->pluginData['Name'];
}
public static function get_instance()
{
if (self::$instance == null)
{
self::$instance = new Settings();
}
return self::$instance;
}
/**
* @return string
*/
public function getVersion() {
return $this->version;
}
/**
* @return string
*/
public function getPrefix() {
return $this->prefix;
}
/**
* @return string
*/
public function getPluginName() {
return $this->pluginName;
}
/**
* @return array
*/
public function getPluginData() {
return $this->pluginData;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,34 @@
<?php
/**
* Class: Stratum_Widget_Base
*/
namespace Stratum;
use \Elementor\Widget_Base;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
abstract class Stratum_Widget_Base extends Widget_Base {
public function __construct( $data = [], $args = null ) {
parent::__construct( $data, $args );
}
public function get_name() {
return 'stratum-'.$this->widget_name;
}
public function render_widget( $type = 'php', $extra_params = array() ) {
if ( $type == 'php' ) {
//Get all settings
$settings = $this->get_settings();
}
$file_name = stratum_get_plugin_path( '/includes/templates/' . $this->widget_name . '.php' );
if ( !is_readable( $file_name ) ) return;
ob_start();
require ($file_name);
echo ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}

View File

@@ -0,0 +1,93 @@
<?php
namespace Stratum;
final class String_Encryption {
private $cipher = 'aes-256-ctr';
private $salt;
private $passphrase;
public function __construct() {
$this->salt = $this->get_salt();
$this->passphrase = $this->get_passphrase();
}
public function encrypt( $string_to_encrypt ) {
if ( empty( $string_to_encrypt ) ) {
return $string_to_encrypt;
}
if ( ! $this->can_encrypt() ) {
return $string_to_encrypt;
}
$ivlen = openssl_cipher_iv_length( $this->cipher );
$iv = openssl_random_pseudo_bytes( $ivlen );
$encrypted_string = openssl_encrypt(
$string_to_encrypt . $this->salt,
$this->cipher,
$this->passphrase,
0,
$iv
);
return base64_encode( $iv . $encrypted_string );
}
public function decrypt( $string_to_decrypt ) {
if ( ! $this->can_encrypt() ) {
return $string_to_decrypt;
}
$encrypted_string = base64_decode( $string_to_decrypt, true );
$ivlen = openssl_cipher_iv_length( $this->cipher );
$iv = substr( $encrypted_string, 0, $ivlen );
$encrypted_string = substr( $encrypted_string, $ivlen );
$decrypted_string = openssl_decrypt(
$encrypted_string,
$this->cipher,
$this->passphrase,
0,
$iv
);
if ( ! $decrypted_string || substr( $decrypted_string, -strlen( $this->salt ) ) !== $this->salt ) {
return $string_to_decrypt;
}
return substr( $decrypted_string, 0, -strlen( $this->salt ) );
}
private function can_encrypt() {
if ( ! function_exists( 'openssl_encrypt' ) ) {
return false;
}
if ( ! in_array( $this->cipher, openssl_get_cipher_methods() ) ) {
return false;
}
return true;
}
private function get_passphrase() {
if ( function_exists( 'wp_salt' ) && wp_salt() ) {
return wp_salt();
}
return 'stratum_non_secret_passphrase';
}
private function get_salt() {
return 'stratum_non_secret_salt';
}
}

View File

@@ -0,0 +1,136 @@
<?php
use Elementor\Frontend;
use Elementor\Icons_Manager;
extract( shortcode_atts( array(
'accordion_items' => array(),
'expand_icon' => '',
'expand_icon_active' => '',
'accordion_type' => 'accordion',
'accordion_collapsible' => '',
'accordion_interactivity' => 'click',
'equal_height' => '',
), $settings ) );
$widget_class = 'stratum-advanced-accordion';
$class = stratum_css_class([
$widget_class,
]);
$accordion_options = [
'accordion_type' => $accordion_type,
'accordion_collapsible' => ($accordion_collapsible == 'yes'),
'accordion_interactivity' => $accordion_interactivity,
'equal_height' => (($equal_height == 'yes' && $accordion_type == 'accordion') ? true : false),
];
$out = "";
$frontend = new Frontend;
ob_start();
Icons_Manager::render_icon( $expand_icon, [ 'aria-hidden' => 'true' ] );
$expand_icon_html = ob_get_clean();
ob_start();
Icons_Manager::render_icon( $expand_icon_active, [ 'aria-hidden' => 'true' ] );
$expand_icon_active_html = ob_get_clean();
$once_active = false;
?>
<div class="<?php echo esc_attr( $class ); ?>" data-accordion-options="<?php echo esc_attr( json_encode($accordion_options) ); ?>">
<div class="<?php echo esc_attr( $widget_class . '__wrapper' ); ?>">
<?php
foreach ( $accordion_items as $index => $item ) {
$current_item = 'elementor-repeater-item-'.$item['_id'];
$item_class = stratum_css_class([
$widget_class . '__item',
(($item['active'] == 'yes' && $once_active == false) ? 'active-accordion' : ''),
$current_item
]);
if ($accordion_type == 'accordion' && $item['active'] == 'yes'){
$once_active = true;
}
ob_start();
Icons_Manager::render_icon( $item['title_icon'], [ 'aria-hidden' => 'true' ] );
$title_icon_html = ob_get_clean();
ob_start();
Icons_Manager::render_icon( $item['title_icon_active'], [ 'aria-hidden' => 'true' ] );
$title_icon_active_html = ob_get_clean();
?>
<div class="<?php echo esc_attr( $item_class ); ?>">
<div class="<?php echo esc_attr( $widget_class . '__item-header' ); ?>">
<div class="<?php echo esc_attr( $widget_class . '__title' ); ?>">
<?php
if ( ! empty( $title_icon_html ) || ! empty( $title_icon_active_html ) ) {
?>
<span class="<?php echo esc_attr( $widget_class . '__title-icon' ); ?>">
<?php
if ( ! empty( $title_icon_html ) ) {
?>
<span class="normal"><?php echo $title_icon_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped?></span>
<?php
}
if ( ! empty( $title_icon_active_html ) ) {
?>
<span class="active"><?php echo $title_icon_active_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped?></span>
<?php
}
?>
</span>
<?php
}
echo esc_html($item['title']);
?>
</div>
<div class="<?php echo esc_attr( $widget_class . '__expand-icon' ); ?>">
<?php
if ( ! empty( $expand_icon_html ) ) {
?>
<span class="normal"><?php echo $expand_icon_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
<?php
}
if ( ! empty( $expand_icon_active_html ) ) {
?>
<span class="active"><?php echo $expand_icon_active_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
<?php
}
?>
</div>
</div>
<div class="<?php echo esc_attr( $widget_class . '__item-content' ); ?>">
<div class="<?php echo esc_attr( $widget_class . '__item-wrapper' ); ?>">
<div class="<?php echo esc_attr( $widget_class . '__item-content-overlay' ); ?>"></div>
<div class="<?php echo esc_attr( $widget_class . '__text' ); ?>">
<?php
if ( $item['content_type'] == 'text' ) {
if ( !empty($item['text']) ) {
echo wp_kses_post( $item['text'] );
}
} elseif ( $item['content_type'] == 'template' ) {
if ( !empty($item['accordion_template']) ) {
echo $frontend->get_builder_content($item['accordion_template'], true); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
?>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>

View File

@@ -0,0 +1,49 @@
<?php
$class = 'stratum-advanced-google-map';
$out = "";
//Get Api Key
$stratum_api = get_option( 'stratum_api', [] );
$api_key = isset( $stratum_api['google_api_key'] ) ? $stratum_api['google_api_key'] : '';
//If Empty Key
if ( empty( $api_key ) ) {
if ( current_user_can( 'manage_options' ) ) {
?>
<div class="<?php echo esc_attr( $class ); ?>">
<div class="<?php echo esc_attr( $class. '__notice' ); ?>">
<p><?php echo esc_html__( 'Whoops! It seems like you didn\'t set Google Map API key. You can set it from Stratum > Settings > API > Google Api Key', 'stratum' ); ?></p>
</div>
</div>
<?php
} else {
return '';
}
}
$options = [
'center' => [
'mapLat' => esc_attr( $settings[ 'map_lat' ] ),
'mapLng' => esc_attr( $settings[ 'map_lng' ] )
],
'controls' => [
'streetViewControl' => !empty( $settings[ 'street_view_control' ] ) ? true : false,
'mapTypeControl' => !empty( $settings[ 'map_type_control' ] ) ? true : false,
'zoomControl' => !empty( $settings[ 'zoom_control' ] ) ? true : false,
'fullscreenControl' => !empty( $settings[ 'fullscreen_control' ] ) ? true : false
],
'zoomLevel' => $settings[ 'zoom_level' ],
'markerTypeSetup' => $settings[ 'marker_type_setup' ],
'mapTypeSetup' => $settings[ 'map_type_setup' ],
'interaction' => $settings[ 'interaction' ],
'markers' => $this->get_markers_options( $settings ),
'mapTheme' => $this->set_map_theme_style( $settings )
];
$map_options = json_encode( $options );
?>
<div class="<?php echo esc_attr( $class ) ?>" data-map-options="<?php echo esc_attr( $map_options ); ?>">
<div class="<?php echo esc_attr( $class.'__container' ) ;?>"></div>
</div>

View File

@@ -0,0 +1,368 @@
<?php
use Stratum\Ajax\Advanced_Posts_Ajax;
extract( shortcode_atts( array(
'slide_animation_effect' => '',
'slide_text_animation_effect' => '',
'title_typography_html_tag' => 'h3',
'show_image' => '',
'show_title' => '',
'show_content' => '',
'show_excerpt' => '',
'show_read_more' => '',
'read_more_text' => '',
'open_new_tab' => '',
'excerpt_length' => apply_filters( 'excerpt_length', 25 ),
'show_meta' => array(),
'meta_fields_divider' => '',
'image_size' => '',
'image_hover_effect' => '',
'posts_layout' => '',
'pagination' => '',
'page_pagination_style' => '',
'scroll_icon' => '',
'load_more_text' => '',
'column_gap' => '',
'row_gap' => '',
'masonry' => '',
'columns' => '',
'columns_tablet' => '',
'columns_mobile' => '',
'animate_on_scroll' => '',
'animation_effects' => '',
//Swiper
'columns_count' => '1',
'slides_in_columns' => '1',
'navigation' => 'both',
'pagination_style' => 'bullets',
//--Swiper
), $settings ) );
//Query builder
$query_args = [];
stratum_build_custom_query( $query_args, $settings );
$q = new \WP_Query( $query_args );
$widget_class = 'stratum-advanced-posts';
$class = stratum_css_class([
$widget_class,
'layout-'.$posts_layout,
($masonry == '' || intval($columns) == 1 || $posts_layout == 'carousel' || $posts_layout == 'list' ? 'masonry-disable' : 'masonry-enable'),
(($posts_layout == 'grid' && $masonry == '') ? "elementor-grid-{$columns} elementor-grid-tablet-{$columns_tablet} elementor-grid-mobile-{$columns_mobile}" : ''),
((($posts_layout == 'grid' || $posts_layout == 'list') && $image_hover_effect != 'none') ? "image-effect-".esc_attr( $image_hover_effect ) : ''),
(($posts_layout == 'carousel' && $slide_animation_effect != 'none') ? "slide-effect-".esc_attr( $slide_animation_effect ) : ''),
(($posts_layout == 'carousel' && $slide_text_animation_effect != 'none' && (intval($columns_count) == 1 && intval($slides_in_columns) == 1 )) ? "has-text-animation-".esc_attr( $slide_text_animation_effect ) : '')
]);
$wrapper_class = stratum_css_class([
$widget_class . '__wrapper',
(($posts_layout == 'grid' && $masonry == '') ? 'elementor-grid' : ''),
((($posts_layout == 'grid' || $posts_layout == 'list') && ($animate_on_scroll == 'yes' || ($masonry == 'yes' && intval($columns) > 1))) ? "masonry-grid" : ''),
((($posts_layout == 'grid' || $posts_layout == 'list') && $animate_on_scroll == 'yes') ? "animate_on_scroll ".esc_attr($animation_effects) : ''),
]);
$query_options = [
//Query args
'include_ids' => $settings['include_ids'],
'post_type' => $settings['post_type'],
'posts_per_page' => $settings['posts_per_page'],
'order' => $settings['order'],
'orderby' => $settings['orderby'],
'ignore_sticky_posts' => $settings['ignore_sticky_posts'],
'pagination' => $settings['pagination'],
'exclude_ids' => $settings['exclude_ids'],
'exclude_current' => $settings['exclude_current'],
'taxonomies' => $settings['taxonomies'],
'terms_relation' => $settings['terms_relation'],
//Settings
'posts_layout' => $settings['posts_layout'],
'columns' => $settings['columns'],
'masonry' => $settings['masonry'],
'animate_on_scroll' => $settings['animate_on_scroll'],
'show_title' => $settings['show_title'],
'show_image' => $settings['show_image'],
'image_size' => $settings['image_size'],
'title_typography_html_tag' => stratum_validate_heading_html_tag( $settings['title_typography_html_tag'] ),
'title_over_image' => $settings['title_over_image'],
'show_meta' => $settings['show_meta'],
'meta_fields_divider' => $settings['meta_fields_divider'],
'show_content' => $settings['show_content'],
'show_excerpt' => $settings['show_excerpt'],
'excerpt_length' => $settings['excerpt_length'],
'show_read_more' => $settings['show_read_more'],
'open_new_tab' => $settings['open_new_tab'],
'read_more_text' => $settings['read_more_text'],
];
//Add terms from taxonomies list
if (!empty($settings['taxonomies'])){
foreach ($settings['taxonomies'] as $taxonomy_key => $taxonomy_name) {
if (isset($settings[$taxonomy_name.'_terms'])){
$query_options[$taxonomy_name.'_terms'] = $settings[$taxonomy_name.'_terms'];
}
}
}
$masonry_options = [
'columns' => $columns,
'column_gap' => $column_gap['size'],
'row_gap' => $row_gap['size'],
];
$title_typography_html_tag = stratum_validate_heading_html_tag( $title_typography_html_tag );
//Generate options for swiper
$slider_options = stratum_generate_swiper_options($settings);
if ( $posts_layout == 'grid' || $posts_layout == 'list' ) {
?>
<div class="<?php echo esc_attr( $class ); ?>"
<?php
if ( $pagination == 'yes' && ( $page_pagination_style == 'load_more_btn' || $page_pagination_style == 'load_more_scroll' ) ) {
?>
data-query-options="<?php echo esc_attr( json_encode( $query_options ) ); ?>"
<?php
}
?>
>
<div class="<?php echo esc_attr( $wrapper_class ); ?>" data-masonry-options="<?php echo esc_attr( json_encode( $masonry_options ) ); ?>">
<?php
if ( $posts_layout == 'grid' && intval($columns) > 1 && $masonry == 'yes' ) {
?>
<div class="grid-sizer masonry-col-<?php echo esc_attr( $columns ); ?>"></div>
<?php
}
//Get Articles
echo Advanced_Posts_Ajax::get_instance()->get_articles($settings, 'render'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>
</div>
<?php
if ( $pagination == 'yes' ) {
if ( $page_pagination_style == 'load_more_btn' || $page_pagination_style == 'load_more_scroll' ) {
?>
<nav class="ajax_load_more_pagination <?php if ( $page_pagination_style == 'load_more_scroll' ) { ?> load_more_scroll <?php } ?>" role="navigation">
<?php
if ( $page_pagination_style == 'load_more_scroll' ) {
?>
<span class="<?php echo esc_attr( $widget_class . '__ajax-load-more-arrow' ); ?>"><i class="<?php echo esc_attr( $scroll_icon ); ?>"></i></span>
<?php
}
?>
<a class="<?php echo esc_attr( $widget_class . '__ajax-load-more-btn' ); ?>" href="#" data-current-page="1" data-max-page="<?php echo esc_attr($q->max_num_pages); ?>"><?php echo esc_html($load_more_text); ?></a>
</nav>
<?php
} else if ( $page_pagination_style == 'navigation' ) {
?>
<nav class="navigation pagination" role="navigation">
<h2 class="screen-reader-text"><?php echo esc_html__('Posts navigation', 'stratum'); ?></h2>
<div class="nav-links">
<?php
$pagination_args = array(
'base' => str_replace( 999999999, '%#%', esc_url( get_pagenum_link( 999999999 ) ) ),
'total' => $q->max_num_pages,
'current' => max( 1, get_query_var( 'paged' ) ),
'format' => '?paged=%#%',
'show_all' => false,
'type' => 'plain',
'end_size' => 2,
'mid_size' => 1,
'prev_next' => true,
'prev_text' => sprintf( '<i></i> %1$s', esc_html_x( '<', 'Previous post', 'stratum' ) ),
'next_text' => sprintf( '%1$s <i></i>', esc_html_x( '>', 'Next post', 'stratum' ) ),
'add_args' => false,
'add_fragment' => ''
);
$pagination_args = apply_filters( 'stratum/widgets/advanced-posts/pagination_args', $pagination_args );
echo paginate_links( $pagination_args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>
</div>
</nav>
<?php
}
}
?>
</div>
<?php
} elseif ( $posts_layout == 'carousel' ) {
?>
<div class="<?php echo esc_attr( $class ); ?>" data-slider-options="<?php echo esc_attr( json_encode( $slider_options ) ); ?>">
<div class="swiper swiper-container">
<div class="swiper-wrapper">
<?php
if ( $q->have_posts() ) {
while( $q->have_posts() ):
$q->the_post();
$post_id = get_the_ID();
$url = get_the_post_thumbnail_url($post_id, $image_size);
?>
<div class="swiper-slide <?php echo esc_attr( $widget_class . '__post' ); ?>">
<div class="<?php echo esc_attr( $widget_class . '__image' ); ?>" style="background-image: url('<?php echo esc_url($url); ?>');"></div>
<div class="<?php echo esc_attr( $widget_class . '__slide-content' ); ?>">
<div class="<?php echo esc_attr( $widget_class . '__slide-wrapper' ); ?>">
<div class="<?php echo esc_attr( $widget_class . '__slide-container' ); ?>">
<?php
if ( !empty( $show_meta ) ) {
?>
<div class="<?php echo esc_attr( $widget_class . '__entry-meta' ); ?>">
<?php
if ( in_array("date", $show_meta) ) {
$archive_year = get_the_time('Y');
$archive_month = get_the_time('m');
$archive_day = get_the_time('d');
?>
<span class="<?php echo esc_attr( $widget_class . '__post-date' ); ?>">
<time datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>">
<a href="<?php echo esc_url( get_day_link( $archive_year, $archive_month, $archive_day) ); ?>">
<?php echo esc_html( get_the_date( '' ) ); ?>
</a>
</time>
</span>
<?php
}
if ( in_array("author", $show_meta) ) {
if ( in_array("date", $show_meta) ) {
?>
<span class="<?php echo esc_attr( $widget_class . '__meta-fields-divider' ); ?>"><?php echo esc_html($meta_fields_divider); ?></span>
<?php
}
?>
<div class="<?php echo esc_attr( $widget_class . '__post-author' ); ?>">
<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>">
<?php echo esc_html( get_the_author() ); ?>
</a>
</div>
<?php
}
if ( in_array("categories", $show_meta) ) {
if ( in_array("date", $show_meta) || in_array("author", $show_meta) ) {
?>
<span class="<?php echo esc_attr( $widget_class . '__meta-fields-divider' ); ?>"><?php echo esc_html($meta_fields_divider); ?></span>
<?php
}
?>
<div class="<?php echo esc_attr( $widget_class . '__post-categories' ); ?>">
<?php echo get_the_category_list(', '); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
<?php
}
if ( in_array("comments", $show_meta) ) {
if ( in_array("date", $show_meta) || in_array("author", $show_meta) || in_array("categories", $show_meta) ) {
?>
<span class="<?php echo esc_attr( $widget_class . '__meta-fields-divider' ); ?>"><?php echo esc_html($meta_fields_divider); ?></span>
<?php
}
?>
<div class="<?php echo esc_attr( $widget_class . '__post-comments' ); ?>">
<a href="<?php echo esc_url( get_comments_link() ); ?>">
<?php
if ( get_comments_number() ) {
echo esc_html(
sprintf(
_n( '%d Comment', '%d Comments', get_comments_number(), 'stratum' ),
get_comments_number()
)
);
} else {
echo esc_html__( 'No comments', 'stratum' );
}
?>
</a>
</div>
<?php
}
?>
</div>
<?php
}
if ( $show_title == 'yes' ) {
the_title( '<'.esc_attr($title_typography_html_tag).' class="'.esc_attr( $widget_class . '__post-title' ).'"><a href="'.esc_url(get_permalink()).'">', '</a></'.esc_attr($title_typography_html_tag).'>' );
}
if ( $show_content == 'yes' ) {
?>
<div class="<?php echo esc_attr( $widget_class . '__post-content' ); ?>">
<?php
if ( $show_excerpt == 'yes' ) {
if ( $excerpt_length ) {
\Stratum\Excerpt_Helper::get_instance()->setExcerptLength( $excerpt_length );
add_filter( 'excerpt_length', array( 'Stratum\Excerpt_Helper', 'excerpt_length' ), 999 );
}
the_excerpt();
remove_filter( 'excerpt_length', array( 'Stratum\Excerpt_Helper', 'excerpt_length' ), 999 );
} else {
the_content();
}
?>
</div>
<?php
}
if ( $show_read_more == 'yes' ) {
?>
<div class="<?php echo esc_attr( $widget_class . '__entry-footer' ); ?>">
<div class="<?php echo esc_attr( $widget_class . '__read-more' ); ?>">
<a href="<?php the_permalink() ?>" <?php if ( $open_new_tab == 'yes') { ?> target="_blank" <?php } ?>>
<?php echo esc_html($read_more_text); ?>
</a>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
<div class="<?php echo esc_attr( $widget_class . '__overlay' ); ?>"></div>
</div>
<?php
endwhile;
wp_reset_postdata();
} else {
?><p><?php echo esc_html__( 'Nothing found.', 'stratum' ); ?></p><?php
}
?>
</div>
<?php
if ( $navigation == 'both' || $navigation == 'pagination' ) {
if ($pagination_style == 'scrollbar'){
?><div class="swiper-scrollbar"></div><?php
} else {
?><div class="swiper-pagination"></div><?php
}
}
?>
</div>
<?php
if ( $navigation == 'both' || $navigation == 'arrows' ) {
?>
<div class="stratum-swiper-button-prev"></div>
<div class="stratum-swiper-button-next"></div>
<?php
}
?>
</div>
<?php
}

View File

@@ -0,0 +1,122 @@
<?php
use Elementor\Utils;
extract( shortcode_atts( array(
'animation_effect' => '',
'text_animation_effect' => '',
'sub_title_typography_html_tag' => 'div',
'title_typography_html_tag' => 'h3',
'description_typography_html_tag' => 'div',
'slides' => array(),
'image_size' => '',
//Swiper
'columns_count' => '1',
'slides_in_columns' => '1',
'navigation' => 'both',
'pagination_style' => 'bullets',
//--Swiper
), $settings ) );
$sub_title_typography_html_tag = stratum_validate_heading_html_tag( $sub_title_typography_html_tag );
$title_typography_html_tag = stratum_validate_heading_html_tag( $title_typography_html_tag );
$description_typography_html_tag = stratum_validate_heading_html_tag( $description_typography_html_tag );
$widget_class = 'stratum-advanced-slider';
$class = stratum_css_class([
$widget_class,
($animation_effect !='none' ? "stratum-effect-".esc_attr( $animation_effect ) : ''),
(($text_animation_effect !='none' && (intval($columns_count) == 1 && intval($slides_in_columns) == 1 ) ) ? "has-text-animation-".esc_attr( $text_animation_effect ) : '')
]);
//Generate options for swiper
$slider_options = stratum_generate_swiper_options($settings);
?>
<div class="<?php echo esc_attr( $class ); ?>" data-slider-options="<?php echo esc_attr( json_encode($slider_options) ); ?>">
<div class="swiper swiper-container">
<div class="swiper-wrapper">
<?php
foreach ( $slides as $index => $item ) {
$id = $item[ 'image' ][ 'id' ];
if ( $id ) {
$url = wp_get_attachment_image_url($id, $image_size );
} else {
$url = Utils::get_placeholder_image_src();
}
$current_item = 'elementor-repeater-item-'.$item['_id'];
?>
<div class="swiper-slide <?php echo esc_attr($current_item); ?>">
<div class="<?php echo esc_attr( $widget_class . '__image' ); ?>" style="background-image: url('<?php echo esc_url($url); ?>'); "></div>
<div class="<?php echo esc_attr( $widget_class . '__slide-content' ); ?>">
<div class="<?php echo esc_attr( $widget_class . '__slide-wrapper' ); ?>">
<div class="<?php echo esc_attr( $widget_class . '__slide-container' ); ?>">
<?php
if ( !empty($item['sub_title']) ) {
?>
<<?php echo esc_html($sub_title_typography_html_tag); ?> class="<?php echo esc_attr( $widget_class . '__sub-title' ); ?>">
<?php echo esc_html($item['sub_title']); ?>
</<?php echo esc_html($sub_title_typography_html_tag); ?>>
<?php
}
if ( !empty($item['title']) ) {
?>
<<?php echo esc_html($title_typography_html_tag); ?> class="<?php echo esc_attr( $widget_class . '__title' );?>">
<?php echo esc_html($item['title']); ?>
</<?php echo esc_html($title_typography_html_tag); ?>>
<?php
}
if ( !empty($item['description']) ) {
?>
<<?php echo esc_html($description_typography_html_tag); ?> class="<?php echo esc_attr( $widget_class . '__description' ); ?>">
<?php echo esc_html($item['description']); ?>
</<?php echo esc_html($description_typography_html_tag); ?>>
<?php
}
if ( !empty($item['button_text']) ) {
?>
<div class="<?php echo esc_attr( $widget_class . '__button' ); ?>">
<a href="<?php echo esc_url( $item['button_link']['url'] ) ?>" <?php if ( $item['button_link']['is_external'] ) { ?>target="_blank" <?php } ?> ><?php echo esc_html( $item['button_text'] ); ?></a>
</div>
<?php
}
?>
</div>
</div>
</div>
<div class="<?php echo esc_attr( $widget_class . '__overlay' ); ?>"></div>
</div>
<?php
}
?>
</div>
<?php
if ( $navigation == 'both' || $navigation == 'pagination' ) {
if ( $pagination_style == 'scrollbar' ) {
?>
<div class="swiper-scrollbar"></div>
<?php
} else {
?>
<div class="swiper-pagination"></div>
<?php
}
}
?>
</div>
<?php
if ( $navigation == 'both' || $navigation == 'arrows' ) {
?>
<div class="stratum-swiper-button-prev"></div>
<div class="stratum-swiper-button-next"></div>
<?php
}
?>
</div>

View File

@@ -0,0 +1,125 @@
<?php
use Elementor\Frontend;
use Elementor\Icons_Manager;
extract( shortcode_atts( array(
'tabs_items' => array(),
'item_icon' => '',
'tabs_layout' => 'horizontal',
'tabs_interactivity' => 'click',
'equal_height' => '',
'content_animation' => '',
), $settings ) );
$widget_class = 'stratum-advanced-tabs';
$is_active = false;
foreach ( $tabs_items as $index => $item ) {
if ($item['active']){
$is_active = true;
}
}
$class = stratum_css_class([
$widget_class,
'tabs-layout-'.esc_attr($tabs_layout),
($content_animation != 'none' ? $content_animation.'-animation' : ''),
]);
$accordion_options = [
'tabs_interactivity' => $tabs_interactivity,
'equal_height' => ($equal_height == 'yes' ? true : false),
];
$frontend = new Frontend;
ob_start();
Icons_Manager::render_icon( $item_icon, [ 'aria-hidden' => 'true' ] );
$item_icon_html = ob_get_clean();
$once_active_nav = false;
$once_active_content = false;
?>
<div class="<?php echo esc_attr( $class ); ?>" data-tabs-options="<?php echo esc_attr( json_encode($accordion_options) ); ?>">
<div class="<?php echo esc_attr( $widget_class . '__navigation' ); ?>">
<?php
foreach ( $tabs_items as $index => $item ) {
$current_item = 'elementor-repeater-item-'.$item['_id'];
$item_class = stratum_css_class([
$widget_class . '__navigation-item',
(($item['active'] == 'yes' && $once_active_nav == false) || ($index == 0 && $is_active == false) ? 'active-nav' : ''),
$current_item
]);
if ($item['active'] == 'yes'){
$once_active_nav = true;
}
ob_start();
Icons_Manager::render_icon( $item['tab_icon'], [ 'aria-hidden' => 'true' ] );
$item_icon_html = ob_get_clean();
?>
<div data-tab-id="<?php echo esc_attr($index); ?>" class="<?php echo esc_attr( $item_class ); ?>">
<?php
if ( !empty($item['tab_title']) ) {
?>
<div class="<?php echo esc_attr( $widget_class . '__title' ); ?>">
<?php echo esc_html($item['tab_title']); ?>
</div>
<?php
}
if ( !empty($item_icon_html) ) {
?>
<div class="<?php echo esc_attr( $widget_class . '__icon' ); ?>">
<span><?php echo $item_icon_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
</div>
<?php
}
?>
</div>
<?php
}
?>
</div>
<div class="<?php echo esc_attr( $widget_class . '__content' ); ?>">
<?php
foreach ( $tabs_items as $index => $item ) {
$current_item = 'elementor-repeater-item-'.$item['_id'];
$item_class = stratum_css_class([
$widget_class . '__content-item',
(($item['active'] == 'yes' && $once_active_content == false ) || ($index == 0 && $is_active == false) ? 'active-content' : ''),
$current_item
]);
if ($item['active'] == 'yes'){
$once_active_content = true;
}
?>
<div data-tab-id="<?php echo esc_attr($index); ?>" class="<?php echo esc_attr( $item_class );?>">
<div class="<?php echo esc_attr( $widget_class . '__content-wrapper' ); ?>">
<div class="<?php echo esc_attr( $widget_class . '__content-overlay' ); ?>"></div>
<div class="<?php echo esc_attr( $widget_class . '__text' ); ?>">
<?php
if ( $item['content_type'] == 'text' ) {
if ( !empty($item['tab_text']) ) {
echo wp_kses_post( $item['tab_text'] );
}
} elseif ( $item['content_type'] == 'template' ) {
if ( !empty($item['tab_template']) ) {
echo $frontend->get_builder_content($item['tab_template'], true); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
?>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>

View File

@@ -0,0 +1,76 @@
<?php
use Elementor\Utils;
extract( shortcode_atts( [
'image' => '',
'image_size' => '',
'hosted_url' => '',
'title' => '',
'text' => '',
'title_typography_html_tag' => 'h5',
'link' => '',
'link_target' => '',
'link_rel' => '',
'animation_effect' => 'none',
'text_animation_effect' => 'none',
'background_type' => 'image'
], $settings ) );
$class = 'stratum-banner';
$title_typography_html_tag = stratum_validate_heading_html_tag( $title_typography_html_tag );
$id = $image[ 'id' ];
$link = !empty( $link ) ? $link : "#";
$url = wp_get_attachment_image_url( $image[ 'id' ], $image_size );
$srcset = wp_get_attachment_image_srcset($image[ 'id' ], $image_size);
?>
<figure class="<?php echo esc_attr( $class . ' stratum-effect-' . $animation_effect . ' has-text-animation-' . $text_animation_effect ); ?> ">
<a href="<?php echo esc_url( $link ); ?>" class="<?php echo esc_attr( $class.'__link' ); ?>"
<?php
if ( ! empty( $link_target ) ) {
?>
target="<?php echo esc_attr( $link_target ); ?>"
<?php
}
if ( ! empty( $link_rel ) ) {
?>
rel="<?php echo esc_attr( $link_rel ); ?>"
<?php
}
?>
>
<?php
if ( $link ) {
?>
<div class="<?php echo esc_attr( $class.'__wrapper' ); ?>">
<?php
if ( $background_type == 'video' ) {
?>
<video class="<?php echo esc_attr( $class.'__video' ); ?>" autoplay muted loop>
<source src="<?php echo esc_url( $hosted_url[ 'url' ] ); ?>" type='video/mp4'>
</video>
<?php
} else {
?>
<img src="<?php if ( empty( $id ) ) { echo esc_url(Utils::get_placeholder_image_src()); } else { esc_url( $url ); } ?>" class="<?php echo esc_attr( $class . '__image' . ' wp-image-' . $id ); ?>" srcset="<?php echo esc_attr( $srcset ); ?>"/>
<?php
}
?>
<div class="<?php echo esc_attr( $class.'__overlay' ); ?>"></div>
<figcaption class="<?php echo esc_attr( $class.'__content' ); ?>">
<div class="<?php echo esc_attr( $class.'__content-wrapper' ); ?>">
<div class="<?php echo esc_attr( $class.'__content-container' ); ?>">
<<?php echo esc_html($title_typography_html_tag); ?> class="<?php echo esc_attr( $class.'__title' ); ?>"><?php echo esc_html( $title ); ?></<?php echo esc_html($title_typography_html_tag); ?>>
<div class="<?php echo esc_attr( $class.'__text' ); ?>"><?php echo esc_html( $text ); ?></div>
</div>
</div>
</figcaption>
</div>
<?php
}
?>
</a>
</figure>

View File

@@ -0,0 +1,102 @@
<?php
//Settings
$text = ($type == 'php') ? $settings['text'] : '{{{settings.text}}}';
$show_percents = ($type == 'php') ? $settings['show_percents'] : '{{{settings.show_percents}}}';
$value = ($type == 'php') ? $settings['value'] : '{{{settings.value}}}';
$round = ($type == 'php') ? $settings['round'] : '{{{settings.round}}}';
$circle = ($type == 'php') ? $settings['circle'] : '{{{settings.circle}}}';
$padding = ($type == 'php') ? $settings['padding'] : '{{{settings.padding}}}';
$widget_width = ($type == 'php') ? $settings['widget_width'] : '{{{settings.widget_width}}}';
$thickness = ($type == 'php') ? $settings['thickness'] : '{{{settings.thickness}}}';
$line_color = ($type == 'php') ? $settings['line_color'] : '{{{settings.line_color}}}';
$background_color = ($type == 'php') ? $settings['background_color'] : '{{{settings.background_color}}}';
//=======================RENDER TYPE=======================
$js_settings = '';
//-----------PHP-----------
if ( $type == 'php' ) {
$options = [
'min' => 0,
'max' => 100,
'value' => isset($value['size']) ? $value['size'] : $value,
'text' => ($show_percents == 'yes' ? true : false),
'round' => ($round == 'yes' ? true : false),
'circle' => ($circle == 'yes' ? true : false),
'padding' => isset($padding['size']) ? $padding['size'] : $padding,
'radius' => ($widget_width['size'] / 2),
'thickness' => isset($thickness['size']) ? $thickness['size'] : $thickness,
'bg' => $background_color,
'color' => $line_color
];
$this->add_render_attribute( 'widget', [
'class' => [ 'stratum-circle-progress-bar' ]
] );
$this->add_render_attribute( 'wrapper', [
'class' => 'stratum-circle-progress-bar__wrapper',
'data-options' => json_encode( $options )
] );
//-----------/PHP-----------
}
//-----------JS (BACKBONE)-----------
elseif ( $type == 'js' ) {
?>
<#
const options = {
min: 0,
max: 100,
value: (settings.value.size != '' ? settings.value.size : 0),
text: (settings.show_percents == 'yes' ? true : false),
round: (settings.round == 'yes' ? true : false),
circle: (settings.circle == 'yes' ? true : false),
padding: settings.padding.size,
radius: (settings.widget_width.size / 2),
thickness: settings.thickness.size,
bg: settings.background_color,
color: settings.line_color
};
view.addRenderAttribute( 'widget', {
'class': [ 'stratum-circle-progress-bar' ]
} );
view.addRenderAttribute( 'wrapper', {
'class': [ 'stratum-circle-progress-bar__wrapper' ],
'data-options': JSON.stringify(options),
} );
#>
<?php
}
//-----------/JS (BACKBONE)-----------
//Render attr
$attr_widget = ($type == 'php') ? $this->get_render_attribute_string( 'widget' ) : "{{{ view.getRenderAttributeString( 'widget' ) }}}";
$attr_wrapper = ($type == 'php') ? $this->get_render_attribute_string( 'wrapper' ): "{{{ view.getRenderAttributeString( 'wrapper' ) }}}";
?>
<div <?php echo $attr_widget; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div <?php echo $attr_wrapper; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php
if ( $show_percents != 'yes' ) {
if ( $type == 'php' ) {
if ( ! empty( $text ) ) {
?>
<span class="stratum-circle-progress-bar__title"><?php echo esc_html( $text ); ?></span>
<?php
}
} elseif ( $type == 'js' ) {
?>
<# if ( settings.show_percents == '' && settings.text != '' ) { #>
<span class="stratum-circle-progress-bar__title"><?php echo esc_html( $text ); ?></span>
<# } #>
<?php
}
}
?>
</div>
</div>

View File

@@ -0,0 +1,167 @@
<?php
use \Elementor\Frontend;
extract( shortcode_atts( array(
'content_type' => '',
'content_items' => array(),
'content_animation' => '',
), $settings ) );
$frontend = new Frontend;
$class = 'stratum-content-switcher';
$wrap_class = $class;
$animation_class = stratum_css_class( [ ( $content_animation != 'none' ? $content_animation.'-animation' : 'none-animation' ) ] );
if ( $content_type === 'multiple' ) {
$wrap_class .= ' is-multiple';
}
if ( $content_type === 'toggle' ) {
$wrap_class .= ' is-toggle';
}
$once_active_nav = false;
$once_active_sw = false;
$once_active_content = false;
$is_active = false;
$unique_id = uniqid();
foreach ( $content_items as $index => $item ) {
if ( $item[ 'active' ] ) {
$is_active = true;
}
}
?>
<div class="<?php echo esc_attr( $wrap_class ); ?> ">
<div class="<?php echo esc_attr( $class . '__wrapper' ); ?>">
<div class="<?php echo esc_attr( $class . '__nav' ) ;?>">
<?php
if ( $content_type === 'multiple' ) :
?>
<div class="<?php echo esc_attr( $class . '__nav-content' ); ?>">
<div class="<?php echo esc_attr( $class . '__nav-pill' ); ?>"></div>
<ul class="<?php echo esc_attr( $class . '__nav-items' ); ?>">
<?php
foreach ( $content_items as $index => $item ) :
$item_class = stratum_css_class( [
$class . '__nav-item',
( ( $item[ 'active' ] == 'yes' && $once_active_nav == false) || ( $index == 0 && $is_active == false ) ? 'is-active' : '' )
] );
if ( $item[ 'active' ] == 'yes' ) :
$once_active_nav = true;
endif;
if ( $content_type !== 'multiple' ) {
$toggleNavCounter++;
if ( $toggleNavCounter === 3 ) {
break;
}
}
if ( $item[ 'title' ] != '' ) :
?>
<li data-tab-id="<?php echo esc_attr( $index ); ?>" class="<?php echo esc_attr( $item_class ); ?>">
<a class="<?php echo esc_attr( $class . '__nav-button' ); ?>" href="#" data-content="id-content-<?php echo esc_attr( $item[ '_id' ] . $unique_id ); ?>">
<span class="<?php echo esc_attr( $class . '__nav-title' );?>"><?php echo esc_html__( $item[ 'title' ], 'stratum' ); ?></span>
</a>
</li>
<?php
endif;
endforeach;
?>
</ul>
</div>
<?php
else :
$toggleNavCounter = 0;
?>
<label class="<?php echo esc_attr( $class . '__label' ); ?>">
<?php
foreach ( $content_items as $index => $item ) :
$toggleNavCounter++;
$item_class = stratum_css_class( [
$class . '__nav-item',
( ( $item[ 'active' ] == 'yes' && $once_active_sw == false) || ( $index == 0 && $is_active == false ) ? 'is-active' : '' )
] );
if ( $item[ 'active' ] == 'yes' ) :
$once_active_sw = true;
endif;
if ( $toggleNavCounter === 3 ) {
break;
}
if ( $item[ 'title' ] != '' ) :
?>
<a class="<?php echo esc_attr( $item_class . ' ' . $class . '__nav-button' ); ?>" href="#" data-content="id-content-<?php echo esc_attr( $item[ '_id' ] . $unique_id ); ?>">
<span class="<?php echo esc_attr( $class . '__nav-title' ); ?>"><?php echo esc_html( $item[ 'title' ] ); ?></span>
</a>
<?php
if ( $toggleNavCounter === 1 ) {
?>
<input type="checkbox" />
<i class="<?php echo esc_attr( $class . '__toggle' ); ?>"></i>
<?php
}
endif;
endforeach;
?>
</label>
<?php
endif;
?>
</div>
<div class="<?php echo esc_attr( $class . '__content' . ' ' . $animation_class ); ?>">
<?php
foreach ( $content_items as $index => $item ) :
$item_class = stratum_css_class( [
$class . '__item',
( ( $item[ 'active' ] == 'yes' && $once_active_content == false) || ( $index == 0 && $is_active == false ) ? 'is-active' : '' )
] );
if ( $item[ 'active' ] == 'yes' ) :
$once_active_content = true;
endif;
if ( $content_type !== 'multiple' ) {
$toggleContentCounter = 0;
$toggleContentCounter++;
if ( $toggleContentCounter === 3 ) {
break;
}
}
if ( ! empty( $item[ 'content_template' ] ) ) :
?>
<div class="<?php echo esc_attr( $item_class ); ?>" id="id-content-<?php echo esc_attr( $item[ '_id' ] . $unique_id ); ?>" >
<div class="<?php echo esc_attr( $class . '__item-wrapper' ); ?>">
<?php echo $frontend->get_builder_content( $item[ 'content_template' ], true ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
</div>
<?php
else :
?>
<div class="content-not-found" id="id-content-<?php echo esc_attr( $item[ '_id' ] . $unique_id ); ?>"></div>
<?php
endif;
endforeach;
?>
</div>
</div>
</div>

View File

@@ -0,0 +1,92 @@
<?php
use \Elementor\Plugin;
$current_date = new \DateTime(current_time('Y-m-d H:i:s')); //Server time
try {
$target_date = new \DateTime( $settings['date_time'] );
} catch ( Exception $e ) {
return esc_html__( 'Invalid date.', 'stratum' );
}
if ( $current_date < $target_date ) {
$dateTime_until = $current_date->diff( $target_date )->format( "+%yy +%mo +%dd +%hh +%im +%ss" );
} else {
$dateTime_until = 'negative';
}
extract( shortcode_atts( array(
'date_time' => $dateTime_until,
'show_years' => 'yes',
'show_months' => 'yes',
'show_weeks' => 'yes',
'show_days' => 'yes',
'show_hours' => 'yes',
'show_minutes' => 'yes',
'show_seconds' => 'yes',
'show_labels' => 'yes',
'custom_labels' => '',
'label_years' => 'Years',
'label_months' => 'Months',
'label_weeks' => 'Weeks',
'label_days' => 'Days',
'label_hours' => 'Hours',
'label_minutes' => 'Minutes',
'label_seconds' => 'Seconds',
'stratum_expire_actions' => [],
'message_after_expire' => '',
'expire_redirect_url' => '',
), $settings ) );
if ($custom_labels == 'yes'){
$custom_labels_arr = array(
$label_years,
$label_months,
$label_weeks,
$label_days,
$label_hours,
$label_minutes,
$label_seconds
);
}
$is_editor = Plugin::instance()->editor->is_edit_mode();
$countdown_options = array(
( $show_years == 'yes' ? 'data-years="true"' : '' ),
( $show_months == 'yes' ? 'data-months="true"' : '' ),
( $show_weeks == 'yes' ? 'data-weeks="true"' : '' ),
( $show_days == 'yes' ? 'data-days="true"' : '' ),
( $show_hours == 'yes' ? 'data-hours="true"' : '' ),
( $show_minutes == 'yes' ? 'data-minutes="true"' : '' ),
( $show_seconds == 'yes' ? 'data-seconds="true"' : '' ),
( $custom_labels == 'yes' ? "data-labels='".json_encode($custom_labels_arr)."'" : '' ),
((!$is_editor && !empty( $settings['stratum_expire_actions'] )) ? "data-expire-actions='".json_encode($stratum_expire_actions)."'" : '' ),
((!$is_editor && is_array($stratum_expire_actions) && in_array("redirect", $stratum_expire_actions) && $expire_redirect_url['url'] != '') ? "data-expire-url='".esc_url($expire_redirect_url['url'])."'" : '' ),
((!$is_editor && is_array($stratum_expire_actions) && in_array("message", $stratum_expire_actions) && $message_after_expire != '') ? "data-expire-text='".$message_after_expire."'" : '' )
);
$countdown_options_str = implode( ' ', $countdown_options );
$widget_name = 'stratum-countdown';
$class = $block_name = 'stratum-countdown';
$wrapper_class = stratum_css_class([
$widget_name . '__wrapper',
($show_labels == 'yes' ? '' : 'hide_labels')
]);
?>
<div class="<?php echo esc_attr( $class ); ?>">
<div class="<?php echo esc_attr( $wrapper_class ); ?>">
<div class="<?php
echo esc_attr( $widget_name ); ?>__content" data-datetime="<?php
echo esc_attr( !empty( $dateTime_until ) ? $dateTime_until : '' ); ?>" <?php
echo $countdown_options_str; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
</div>
</div>
</div>

View File

@@ -0,0 +1,122 @@
<?php
$start = $type == 'php' ? $settings[ 'start' ] : '{{{settings.start}}}';
$end = $type == 'php' ? $settings[ 'end'] : '{{{settings.end}}}';
$prefix = $type == 'php' ? $settings[ 'prefix' ] : '{{{settings.prefix}}}';
$suffix = $type == 'php' ? $settings[ 'suffix' ] : '{{{settings.suffix}}}';
$duration = $type == 'php' ? $settings[ 'duration' ] : '{{{settings.duration}}}';
$numerals = $type == 'php' ? $settings[ 'numerals' ] : '{{{settings.numerals}}}';
$smooth_animation = $type == 'php' ? $settings[ 'smooth_animation' ] : '{{{settings.smooth_animation}}}';
$display_separator = $type == 'php' ? $settings[ 'display_separator' ] : '{{{settings.display_separator}}}';
$decimal_places = $type == 'php' ? $settings[ 'decimal_places' ] : '{{{settings.decimal_places}}}';
$animation_effect = $type == 'php' ? $settings[ 'animation_effect' ] : '{{{settings.animation_effect}}}';
$decimal_separator = $type == 'php' ? $settings[ 'decimal_separator' ] : '{{{settings.decimal_separator}}}';
$thousands_separator = $type == 'php' ? $settings[ 'thousands_separator' ] : '{{{settings.thousands_separator}}}';
//=======================RENDER TYPE=======================
$js_settings = '';
//-----------PHP-----------
if ( $type == 'php' ) {
$options = [
'start' => !empty( $start ) ? $start : 0,
'end' => !empty( $end ) ? $end : 100,
'decimalPlaces' => !empty( $decimal_places ) ? $decimal_places : 0,
'duration' => !empty( $duration ) ? $duration : 3,
'useEasing' => !empty( $smooth_animation ) ? true : false,
'useGrouping' => !empty( $display_separator ) ? true : false,
'separator' => $thousands_separator,
'decimal' => $decimal_separator,
'easingFn' => $animation_effect,
'numerals' => $numerals
];
$this->add_render_attribute( 'widget', [
'class' => [ 'stratum-counter' ]
] );
$this->add_render_attribute( 'wrapper', [
'class' => 'stratum-counter__wrapper',
'data-options' => json_encode( $options )
] );
//-----------/PHP-----------
}
//-----------JS (BACKBONE)-----------
else if ( $type == 'js' ) {
?>
<#
const { start, end, decimal_places, duration, smooth_animation, display_separator, thousands_separator, decimal_separator, animation_effect, numerals } = settings;
const options = {
start: start != '' ? start: 0,
end: end != '' ? end: 0,
decimalPlaces: decimal_places != '' ? decimal_places : 0,
duration: duration != '' ? duration : 3,
useEasing: smooth_animation != '' ? true : false,
useGrouping: display_separator != '' ? true : false,
separator: thousands_separator,
decimal: decimal_separator,
easingFn: animation_effect,
numerals: numerals
};
view.addRenderAttribute( 'widget', {
'class': [ 'stratum-counter' ]
} );
view.addRenderAttribute( 'wrapper', {
'class': [ 'stratum-counter__wrapper' ],
'data-options': JSON.stringify( options )
} );
#>
<?php
}
//-----------/JS (BACKBONE)-----------
$class = 'stratum-counter';
//Render attr
$widget_class = $type == 'php' ? $this->get_render_attribute_string( 'widget' ) : "{{{ view.getRenderAttributeString( 'widget' ) }}}";
$widget_wrapper = $type == 'php' ? $this->get_render_attribute_string( 'wrapper' ) : "{{{ view.getRenderAttributeString( 'wrapper' ) }}}";
?>
<div <?php echo $widget_class; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div <?php echo $widget_wrapper; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php
if ( $type == 'php' ) {
if ( ! empty( $prefix ) ) { ?>
<p class="stratum-counter__prefix"><?php echo esc_html( $prefix ); ?></p>
<?php }
} elseif ( $type == 'js' ) {
?>
<# if ( settings.prefix != '' ) { #>
<p class="stratum-counter__prefix"><?php echo esc_html( $prefix ); ?></p>
<# } #>
<?php
}
?>
<span class="<?php echo esc_attr( $class ); ?>__number"></span>
<?php
if ( $type == 'php' ) {
if ( ! empty( $suffix ) ) { ?>
<p class="stratum-counter__suffix"><?php echo esc_html( $suffix ); ?></p>
<?php }
} elseif ( $type == 'js' ) {
?>
<# if ( settings.suffix != '' ) { #>
<p class="stratum-counter__suffix"><?php echo esc_html( $suffix ); ?></p>
<# } #>
<?php
}
?>
</div>
</div>

View File

@@ -0,0 +1,83 @@
<?php
extract(shortcode_atts([
'image' => [],
'link' => [],
'image_size' => 'full',
'flip_effect' => 'flip',
'flip_direction' => 'right',
'icon_shape' => 'circle',
'icon_view' => 'default',
'show_button' => '',
'button_text' => ''
], $settings ));
$class = $this->get_name();
/* #region Flip Box classes */
$widget_class = [ $class, 'flip-box-effect-'.esc_attr( $flip_effect ) ];
$icon_class = [ $class.'__icon-wrapper', 'stratum-view-'.$icon_view ];
if ( $flip_effect == 'flip' || $flip_effect == 'slide' || $flip_effect == 'push' ) {
array_push(
$widget_class,
'flip-box-direction-'.esc_attr( $flip_direction )
);
}
if ( $icon_view != 'default' && $icon_shape == 'circle' || $icon_shape == 'square' ) {
array_push(
$icon_class,
'stratum-shape-'.esc_attr( $icon_shape )
);
}
$this->add_render_attribute( 'widget', 'class', $widget_class );
$this->add_render_attribute( 'icon-wrapper', 'class', $icon_class );
/* #endregion */
$widget_class = $this->get_render_attribute_string( 'widget' );
?>
<div <?php echo $widget_class // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div class="<?php echo esc_attr( $class.'__inner' ); ?>">
<div class="<?php echo esc_attr( $class . '__layer ' . $class . '__front' ); ?>">
<div class="<?php echo esc_attr( $class.'__layer__overlay' ); ?>">
<div class="<?php echo esc_attr( $class.'__layer__inner' ); ?>">
<?php
$graphic = $settings[ 'graphic_element' ];
if ( $graphic == 'icon' ) {
echo $this->flip_box_render_icon( $settings ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else if ( $graphic == 'image' ) {
echo $this->flip_box_render_image( $image, $image_size ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
$title = $settings[ 'front_title_text' ];
$description = $settings[ 'front_description_text' ];
?>
<h3 class="<?php echo esc_attr( $class.'__title' ); ?>"><?php echo esc_html( $title ); ?></h3>
<div class="<?php echo esc_attr( $class.'__description' ); ?>"><?php echo esc_html( $description ); ?></div>
</div>
</div>
</div>
<div class="<?php echo esc_attr( $class . '__layer ' . $class . '__back' ); ?>">
<div class="<?php echo esc_attr( $class . '__layer__overlay' ); ?>">
<div class="<?php echo esc_attr( $class.'__layer__inner' ); ?>">
<?php
$title = $settings[ 'back_title_text' ];
$description = $settings[ 'back_description_text' ];
?>
<h3 class="<?php echo esc_attr( $class.'__title' ); ?>"><?php echo esc_html( $title ); ?></h3>
<div class="<?php echo esc_attr( $class.'__description' ); ?>"><?php echo esc_html( $description ); ?></div>
<?php
if ( !empty($button_text) && $show_button == 'yes' ) {
echo $this->flip_box_render_button( $button_text, $link ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,132 @@
<?php
$class = 'stratum-horizontal-timeline';
$alignment = $settings[ 'horizontal_alignment' ];
$this->add_render_attribute( 'widget', [
'class' => [
$class,
$class . '--align-' . $alignment
]
] );
$widget_class = $this->get_render_attribute_string( 'widget' );
?>
<div <?php echo $widget_class; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div class="<?php echo esc_attr( $class . '__inner' ); ?>">
<div class="<?php echo esc_attr( $class . '__track' ); ?>">
<?php
/* #region Render card */
$layout = $settings[ 'horisontal_layout' ]; ?>
<div class="<?php echo esc_attr( $class . '__list ' . $class . '__list--top' ); ?>"><?php
foreach ( $settings[ 'items_content' ] as $index => $item ) {
$uniqid = uniqid();
$is_active = $item[ 'is_item_active' ];
$title_html_tag = $settings[ 'item_title_tag' ];
$this->add_render_attribute( 'item' . $uniqid, [ 'class' => [
$class . '-item',
!empty( $is_active ) ? 'is-active' : '',
'elementor-repeater-item-' . esc_attr( $item[ '_id' ] )
] ] );
$item_class = $this->get_render_attribute_string( 'item' . $uniqid );
?>
<div <?php echo $item_class; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php
if ( $layout != 'bottom' ) {
if ( $layout == 'chess' ) {
if ( (int)bcmod( strval( $index + 1 ), '2' ) != 0 ) {
echo $this->_generate_card_content( $class, $item, $settings, $title_html_tag, $index); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else { ?>
<div class="<?php echo esc_attr( $class . '-item__meta' ); ?>">
<?php echo esc_html( $item[ 'item_meta' ] ); ?>
</div>
<?php }
} else {
echo $this->_generate_card_content($class, $item, $settings, $title_html_tag, $index); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
} else if ( $layout == 'bottom' ) { ?>
<div class="<?php echo esc_attr( $class . '-item__meta' ); ?>">
<?php echo esc_html( $item[ 'item_meta' ] ); ?>
</div><?php
} ?>
</div>
<?php } ?>
</div>
<?php
/* #endregion */
/* #region Render points */
?>
<div class="<?php echo esc_attr( $class . '__list ' . $class . '__list--middle' ); ?>">
<div class="<?php echo esc_attr( $class . '__line' ); ?>"></div>
<?php
foreach ( $settings[ 'items_content' ] as $index => $item ) {
$uniqid = uniqid();
$is_active = $item[ 'is_item_active' ];
$this->add_render_attribute( 'item' . $uniqid, [ 'class' => [
$class . '-item',
!empty( $is_active ) ? 'is-active' : '',
'elementor-repeater-item-' . esc_attr( $item[ '_id' ] )
] ] );
$item_class = $this->get_render_attribute_string( 'item' . $uniqid );
?>
<div <?php echo $item_class; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div class="<?php echo esc_attr( $class . '-item__point' ); ?>">
<?php echo $this->_generate_point_content( $class, $item, $index ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
</div>
<?php } ?>
</div>
<?php
/* #endregion */
/* #region Render meta */
?>
<div class="<?php echo esc_attr( $class . '__list ' . $class . '__list--bottom' ); ?>">
<?php
foreach ( $settings[ 'items_content' ] as $index => $item ) {
$uniqid = uniqid();
$is_active = $item[ 'is_item_active' ];
$this->add_render_attribute( 'item' . $uniqid, [ 'class' => [
$class . '-item',
!empty( $is_active ) ? 'is-active' : '',
'elementor-repeater-item-' . esc_attr( $item[ '_id' ] )
] ] );
$item_class = $this->get_render_attribute_string( 'item' . $uniqid );
?>
<div <?php echo $item_class; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php
if ( $layout != 'bottom' ) {
if ( $layout == 'chess' ) {
if ( (int)bcmod( strval( $index + 1 ), '2' ) != 0 ) { ?>
<div class="<?php echo esc_attr( $class . '-item__meta' ); ?>">
<?php echo esc_html( $item[ 'item_meta' ] ); ?>
</div>
<?php
} else {
echo $this->_generate_card_content($class, $item, $settings, $title_html_tag, $index); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
} else { ?>
<div class="<?php echo esc_attr( $class . '-item__meta' ); ?>">
<?php echo esc_html( $item[ 'item_meta' ] ); ?>
</div><?php
}
} else if ( $layout == 'bottom' ) {
echo $this->_generate_card_content($class, $item, $settings, $title_html_tag, $index); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} ?>
</div>
<?php } ?>
</div><?php
/* #endregion */
?>
</div>
</div>
</div>

View File

@@ -0,0 +1,92 @@
<?php
extract(shortcode_atts([
'direction' => 'horizontal',
'active_type' => 'activate-on-click',
'skew_switcher' => '',
'skew_direction' => 'right',
'content_align' => 'center',
'hovered_default_active' => 0,
'opened_default_active' => 0
], $settings ));
$class = $this->get_name();
/* #region Widget classes */
$widget_class = [ $class, 'image-accordion-' . esc_attr( $direction ), $active_type ];
$skew_class = '';
if ( $skew_switcher && $direction == 'horizontal' ) {
$skew_class = 'skew-direction-' . $skew_direction;
array_push(
$widget_class,
'image-accordion-skew'
);
}
$this->add_render_attribute( 'widget', 'class', $widget_class );
$widget_class = $this->get_render_attribute_string( 'widget' );
/* #endregion */
?>
<div <?php echo $widget_class; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div class="<?php echo esc_attr( trim( $class . '__container' . ' ' . $skew_class ) ); ?>"><?php
foreach ( $settings[ 'image_content' ] as $index => $item ) {
/* #region Item classes */
$item_classes = [ $class . '__item' ,'elementor-repeater-item-' . esc_attr( $item[ '_id' ] ) ];
$default_active = $active_type == 'activate-on-click' ? $opened_default_active : $hovered_default_active;
if ( $default_active && ($default_active - 1) == $index ) {
array_push( $item_classes, 'default-active' );
}
$this->add_render_attribute( 'item' . $index, [ 'class' => $item_classes ] );
$item_classes = $this->get_render_attribute_string( 'item' . $index );
/* #endregion */
?>
<div <?php echo $item_classes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div class="<?php echo esc_attr( $class . '__background' ); ?>"></div>
<div class="<?php echo esc_attr( $class . '__overlay' ); ?>">
<?php
/* #region Content classes */
$this->add_render_attribute( 'content', [ 'class' => [ $class . '__content', 'image-accordion-' . $content_align ] ] );
$content_classes = $this->get_render_attribute_string( 'content' );
/* #endregion */
if ( $item[ 'content_switcher' ] ) {
$title = $item[ 'item_title' ];
$description = $item[ 'item_description' ];
?>
<div <?php echo $content_classes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php
if ( $item[ 'icon_switcher' ] ) {
$icon = $item[ 'icon_updated' ]; ?>
<i class="<?php echo esc_attr( $class . '__icon ' . $icon ); ?>"></i>
<?php } ?>
<h3 class="<?php echo esc_attr( $class . '__title' ); ?>">
<?php echo esc_html( $title ); ?>
</h3>
<div class="<?php echo esc_attr( $class . '__description' ); ?>">
<?php echo esc_html( $description ) ?>
</div>
<?php
/* #region Render button */
$link = $item[ 'link' ];
$button_text = $item[ 'button_text' ];
$show_button = $item[ 'show_button' ];
if ( ! empty( $button_text ) && $show_button == 'yes' ) {
echo $this->image_accordion_render_button( $index, $button_text, $link ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/* #endregion */
?>
</div>
<?php } ?>
</div>
</div>
<?php } ?>
</div>
</div>

View File

@@ -0,0 +1,137 @@
<?php
use Elementor\Group_Control_Image_Size;
use Elementor\Utils;
use Elementor\Core\Settings\Manager;
if ( $type == 'php' ) {
$dot_animation = $settings[ 'hotspot_dot_animation' ];
$dot_classes = [
'stratum-image-hotspot__dot',
!empty( $dot_animation ) ? 'has-animation-pulse' : ''
];
}
$class = 'stratum-image-hotspot';
$url_placeholder = Utils::get_placeholder_image_src();
?>
<div class="<?php echo esc_attr( $class ); ?>">
<div class="<?php echo esc_attr( $class.'__wrapper' ); ?>">
<div class="<?php echo esc_attr( $class.'__image' ); ?>">
<?php
if ( $type == 'php' ) {
list( , $id ) = array_values( $settings[ 'image' ] );
if ( empty( $id ) ) { ?>
<img src="<?php echo esc_url( $url_placeholder ); ?>"/><?php
} else {
echo Group_Control_Image_Size::get_attachment_image_html( $settings ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
} elseif ( $type == 'js' ) {
?>
<# if ( settings.image.url != '' ) {
const image = {
id: settings.image.id,
url: settings.image.url,
size: settings.image_size,
model: view.getEditModel()
};
const image_url = elementor.imagesManager.getImageUrl( image );
#>
<img class="wp-image-{{ settings.image.id }}" src="{{ image_url }}" />
<# } else { #>
<img src="<?php echo esc_url( $url_placeholder ); ?>"/>
<# } #>
<?php
}?>
</div>
<?php
if ( $type == 'php' ) {
foreach ( $settings[ 'hot_spots' ] as $index => $item ) {
$icon_class = $item[ 'hotspot_icon' ];
$merge = array_merge( $dot_classes, [ 'elementor-repeater-item-'.esc_attr( $item[ '_id' ] ) ] );
$this->add_render_attribute( 'dot'.$index, [ 'class' => $merge ] );
$dot_class = $this->get_render_attribute_string( 'dot'.$index );
$wrapper = [
'class' => $class.'__dot-wrapper'
];
if ( !empty( $item[ 'tooltip' ] ) ) {
$options = [
'open' => !empty( $item[ 'open_by_default' ] ) ? true : false,
'tooltipArrow' => !empty( $item[ 'tooltip_arrow' ] ) ? true : false,
'placement' => $item[ 'placement' ],
'tooltipTheme' => $item[ 'tooltip_theme' ],
'tooltipAnimation' => $item[ 'tooltip_animation' ],
'tooltipTrigger' => $item[ 'tooltip_interactivity' ],
'tooltipContent' => $item[ 'tooltip_content' ],
'tooltipTitle' => $item[ 'tooltip_title' ]
];
$wrapper[ 'data-options' ] = json_encode( $options );
}
$this->add_render_attribute( 'wrapper'.$index, $wrapper );
$wrapper_class = $this->get_render_attribute_string( 'wrapper'.$index );
echo $this->get_dot_template( $class, $dot_class, $wrapper_class, $icon_class, $type, $item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
} elseif ( $type == 'js' ) {
?>
<# let index = 0; #>
<# _.each( settings.hot_spots, item => { #>
<#
const { tooltip, open_by_default, placement, tooltip_arrow, tooltip_theme } = settings.hot_spots[ index ];
const { tooltip_animation, tooltip_interactivity } = settings.hot_spots[ index ];
let options;
if ( tooltip != '' ) {
options = {
open : open_by_default != '' ? true : false,
tooltipArrow: tooltip_arrow != '' ? true : false,
tooltipAnimation: tooltip_animation,
tooltipTrigger: tooltip_interactivity,
tooltipContent: item.tooltip_content,
tooltipTheme: tooltip_theme,
tooltipTitle: item.tooltip_title,
placement : placement
}
}
view.addRenderAttribute( 'dot' + index, {
'class': [
'stratum-image-hotspot__dot',
settings.hotspot_dot_animation != '' ? 'has-animation-pulse' : '',
'elementor-repeater-item-' + item._id
]
} );
view.addRenderAttribute( 'wrapper' + index, {
'class': [ 'stratum-image-hotspot__dot-wrapper' ],
...tooltip && {
'data-options': JSON.stringify( options )
}
} );
#>
<?php
$icon_class = "{{ item.hotspot_icon }}";
$dot_class = "{{{ view.getRenderAttributeString( 'dot' + index ) }}}";
$wrapper_class = "{{{ view.getRenderAttributeString( 'wrapper' + index ) }}}";
echo $this->get_dot_template( $class, $dot_class, $wrapper_class, $icon_class, $type ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>
<# index++; } ); #>
<?php
}?>
</div>
</div>

View File

@@ -0,0 +1,55 @@
<?php
extract( shortcode_atts( array(
'items' => 6,
'columns' => 3,
'columns_mobile' => 3,
'columns_tablet' => 3,
'animate_on_scroll' => '',
'animation_effects' => '',
), $settings ) );
extract( shortcode_atts(
array(
'media' => array()
),
$extra_params
) );
$widget_name = 'stratum-instagram';
$class = $block_name = 'stratum-instagram';
$wrapper_class = 'stratum-instagram__wrapper masonry-grid' . ( $animate_on_scroll == 'yes' ? (' ' . $animation_effects . ' animate_on_scroll') : '' );
?>
<div class="<?php echo esc_attr( $class ); ?>">
<div class="<?php echo esc_attr( $wrapper_class ); ?>">
<?php
$counter = 1;
foreach ( $media as $value ) {
if ( $counter <= $items ) {
$alt = '';
if ( isset( $value->caption ) ) {
$alt = wp_trim_words( $value->caption );
}
?>
<div class="<?php echo esc_attr( $widget_name ); ?>__item masonry-item">
<div class="<?php echo esc_attr( $widget_name ); ?>__media-wrapper">
<a class="<?php echo esc_attr( $widget_name ); ?>__media-link" target="_blank" href="<?php echo esc_url( $value->permalink ); ?>">
<?php
if ( $value->media_type == 'IMAGE' || $value->media_type == 'CAROUSEL_ALBUM' ){ ?>
<img class="<?php echo esc_attr( $widget_name ); ?>__media" src="<?php echo esc_url( $value->media_url ); ?>" alt="<?php echo esc_attr( $alt ); ?>"/>
<?php } elseif ($value->media_type == 'VIDEO'){ ?>
<img class="<?php echo esc_attr( $widget_name ); ?>__media" src="<?php echo esc_url( $value->thumbnail_url ); ?>" alt="<?php echo esc_attr( $alt ); ?>"/>
<?php } ?>
</a>
</div>
</div>
<?php }
$counter ++;
} ?>
</div>
</div>

View File

@@ -0,0 +1,37 @@
<?php
$anim_url = $settings[ 'lottie_url' ];
if( empty( $anim_url ) ) {
return;
}
$class = 'stratum-lottie-animations';
$out = "";
$this->add_render_attribute( 'wrapper', [
'class' => [ $class.'__wrapper' ],
'data-lottie-url' => $settings[ 'lottie_url' ],
'data-lottie-render' => $settings[ 'lottie_renderer' ],
'data-lottie-loop' => $settings[ 'lottie_loop' ],
'data-lottie-reverse' => $settings[ 'lottie_reverse' ],
'data-lottie-speed' => $settings[ 'lottie_speed' ],
'data-lottie-hover' => $settings[ 'lottie_hover' ]
]);
if( $settings[ 'animate_on_scroll' ] ) {
$this->add_render_attribute( 'wrapper', [
'class' => 'stratum-lottie-scroll',
'data-lottie-scroll' => 'true',
'data-scroll-start' => $settings['animate_view']['sizes']['start'],
'data-scroll-end' => $settings['animate_view']['sizes']['end'],
'data-scroll-speed' => $settings[ 'animate_speed' ][ 'size' ]
]);
}
$wrapper_classes = $this->get_render_attribute_string( 'wrapper' );
?>
<div class="<?php echo esc_attr( $class ); ?>">
<div <?php echo $wrapper_classes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>></div>
</div>

View File

@@ -0,0 +1,60 @@
<?php
extract( shortcode_atts( array(
'gallery_images' => array(),
'gallery_columns' => array(),
'gutter' => array(),
'animate_on_scroll' => false,
'animation_effects' => '',
'image_size' => '',
), $settings ) );
$class = 'stratum-masonry-gallery';
$gallery_id = uniqid( 'gallery-' );
$options = [
'columns' => $gallery_columns['size'],
'gutter' => $gutter['size'],
'animate' => ($animate_on_scroll == 'yes' ? true : false)
];
?>
<div class="<?php echo esc_attr( $class ) . ($animate_on_scroll == 'yes' ? ' animate_on_scroll' : ''); ?> masonry-grid <?php
echo esc_attr($animation_effects); ?>" data-options="<?php echo esc_attr(json_encode($options)); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>">
<div class="grid-sizer masonry-col-<?php echo esc_attr($gallery_columns['size']); ?>"></div>
<?php
foreach ( $gallery_images as $index => $image ) {
$data_img = $this->_get_image_attributes( $image[ 'id' ] );
$url = wp_get_attachment_image_url( $image[ 'id' ], $image_size );
$srcset = wp_get_attachment_image_srcset( $image[ 'id' ], $image_size );
$caption = wp_get_attachment_caption( $image[ 'id' ] );
?>
<div class="<?php echo esc_attr( $class . '__item' ); ?> masonry-item">
<?php
if (is_admin()){ ?>
<a href="#" class="<?php echo esc_attr( $class . '__link' ); ?>">
<?php } else { ?>
<a data-elementor-open-lightbox="default" data-elementor-lightbox-slideshow="<?php echo esc_attr($gallery_id); ?>" href="<?php
echo esc_url($image['url']); ?>" class="<?php echo esc_attr( $class . '__link' ); ?>">
<?php } ?>
<div class="<?php echo esc_attr( $class . '__image' ); ?>">
<figure>
<img class="wp-image-<?php echo esc_attr($image[ 'id' ]); ?>" alt="<?php
echo esc_attr( $data_img[ 'alt' ] ); ?>" src="<?php echo esc_url($url); ?>" srcset="<?php
echo $srcset; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>"><?php
if ( ! empty( $caption ) ) { ?>
<figcaption class="<?php echo esc_attr( $class . '__caption' ); ?>">
<?php echo wp_kses_post( $data_img[ 'caption' ] ); ?>
</figcaption>
<?php } ?>
</figure>
</div>
<div class="<?php echo esc_attr( $class . '__overlay' ); ?>"></div>
</a>
</div>
<?php } ?>
</div>

View File

@@ -0,0 +1,63 @@
<?php
use Elementor\Utils;
extract( shortcode_atts( [
'image' => '',
'image_size' => 'full',
'item_title' => '',
'item_price' => '',
'title_html_tag' => 'h3',
'list_title' => '',
'image_position' => '',
'show_image' => 'no',
'title_price_connector' => false
], $settings ) );
$class = 'stratum-price-list';
$title_html_tag = stratum_validate_heading_html_tag( $title_html_tag );
?>
<div class="<?php echo esc_attr( $class.' '.$image_position ); ?>">
<?php
if ( $image[ 'id' ] && $show_image == 'yes' ) {
$url = wp_get_attachment_image_url( $image[ 'id' ], $image_size );
$srcset = wp_get_attachment_image_srcset( $image[ 'id' ], $image_size );
?>
<div class="<?php echo esc_attr( $class.'__image-wrapper' ); ?>">
<img src="<?php echo esc_url( $url ); ?>" class="wp-image-<?php echo esc_attr( $image[ 'id' ] . ' ' . $class . '__image' ); ?>" srcset="<?php echo esc_attr( $srcset ); ?>"/>
</div>
<?php
}
?>
<div class="<?php echo esc_attr( $class . '__wrapper' ); ?>">
<div class="<?php echo esc_attr( $class . '__content' ); ?>">
<<?php echo esc_html($title_html_tag); ?> class="<?php echo esc_attr( $class.'__heading' ); ?>"><?php echo esc_html( $list_title ); ?></<?php echo esc_html($title_html_tag); ?>>
<div class="<?php echo esc_attr( $class.'__items' ); ?>">
<?php
foreach ( $settings[ 'list_items' ] as $index => $item ) {
?>
<div class="<?php echo esc_attr( $class.'__item' ); ?>">
<?php
$tag_name = stratum_validate_heading_html_tag( $item[ 'title_html_tag' ] );
$title = $item[ 'item_title' ];
$price = $item[ 'item_price' ];
?>
<<?php echo esc_html($tag_name); ?> class="<?php echo esc_attr( $class.'__title' ); ?>"><?php echo esc_html( $title );?></<?php echo esc_html($tag_name); ?>>
<?php
if ( $title_price_connector == 'yes' ) {
?>
<span class="<?php echo esc_attr( $class.'__connector' ); ?>"></span>
<?php
}
?>
<span class="<?php echo esc_attr( $class.'__price' ); ?>"><?php echo esc_html( $price ); ?></span>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,67 @@
<?php
use Elementor\Utils;
extract( shortcode_atts( array(
'title_price_connector' => false,
'items_divider' => false,
'menu_items' => array(),
), $settings ) );
$class = 'stratum-price-menu';
?>
<div class="<?php echo esc_attr( $class ); ?>">
<div class="<?php echo esc_attr( $class.'__items' ); ?>">
<?php
foreach ( $menu_items as $index => $item ) {
?>
<div class="<?php echo esc_attr( 'elementor-repeater-item-'.$item['_id'] . ' ' . $class . '__item-wrapper' ); ?>">
<div class="<?php echo esc_attr( $class . '__item' ); ?>">
<?php
$id = $item[ 'image' ][ 'id' ];
if ( $id && $item[ 'show_image' ] ) {
$image_size = $item[ 'image_size' ];
$url = wp_get_attachment_image_url( $id, $image_size );
$srcset = wp_get_attachment_image_srcset( $id, $image_size );
?>
<div class="<?php echo esc_attr( $class . '__image image-align-' . $item[ 'image_align' ] ); ?>">
<img class="wp-image-<?php echo esc_attr( $id ); ?>" src="<?php echo esc_url( $url ); ?>" srcset="<?php echo esc_attr( $srcset ); ?>"/>
</div>
<?php
}
?>
<div class="<?php echo esc_attr( $class . '__content' ); ?>">
<div class="<?php echo esc_attr( $class . '__header' ); ?>">
<?php
$tag_name = stratum_validate_heading_html_tag( $item[ 'title_html_tag' ] );
$menu_title = $item[ 'menu_title' ];
$menu_price = $item[ 'menu_price' ];
?>
<<?php echo esc_html($tag_name); ?> class="<?php echo esc_attr( $class . '__title' ); ?>"><?php echo esc_html( $menu_title ); ?></<?php echo esc_html($tag_name); ?>>
<?php
if ( $title_price_connector == 'yes' ) {
?>
<span class="<?php echo esc_attr( $class . '__connector' ); ?>"></span>
<?php
}
?>
<span class="<?php echo esc_attr( $class . '__price' ); ?>"><?php echo esc_html( $menu_price ); ?></span>
</div>
<div class="<?php echo esc_attr( $class . '__description' ); ?>"><?php echo esc_html( $item[ 'menu_description' ] ); ?></div>
<?php
if ( $items_divider == 'yes') {
?>
<div class="<?php echo esc_attr( $class . '__divider' ); ?>"></div>
<?php
}
?>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>

View File

@@ -0,0 +1,146 @@
<?php
extract( shortcode_atts( array(
'title' => '',
'title_typography' => array(),
'title_typography_html_tag' => '',
'subtitle' => '',
'subtitles_typography' => array(),
'subtitles_typography_html_tag' => '',
'price_text' => '',
'price' => '',
'price_typography' => array(),
'price_currency' => '',
'price_description' => '',
'content_items' => '',
'align' => '',
'button_show' => '',
'button_text' => '',
'button_url' => '',
'title_color' => '',
'title_color_hover' => '',
'subtitle_color' => '',
'subtitle_color_hover' => '',
'price_color' => '',
'price_color_hover' => '',
'price_text_color' => '',
'price_text_color_hover' => '',
'description_color' => '',
'description_color_hover' => '',
'content_color' => '',
'content_color_hover' => '',
'button_color_font' => '',
'button_color_font_hover' => '',
'button_color_background' => '',
'button_color_background_hover' => '',
), $settings ) );
$class = 'stratum-price-table';
$title = wp_kses( $title, array(
'span' => array(),
'mark' => array(),
'b' => array(),
'strong' => array(),
'br' => array()
), $title );
$title_typography_html_tag = stratum_validate_heading_html_tag( $title_typography_html_tag );
$subtitles_typography_html_tag = stratum_validate_heading_html_tag( $subtitles_typography_html_tag );
?>
<div class="<?php echo esc_attr($class); ?>">
<div class="<?php echo esc_attr($class); ?>__wrapper">
<?php
//Headers
if( !empty($subtitle) || !empty($title) ) {
?>
<div class="<?php echo esc_attr($class); ?>__header">
<?php
if ( !empty($subtitle) ) {
?>
<<?php echo esc_attr($subtitles_typography_html_tag); ?> class="<?php echo esc_attr($class); ?> __subtitle"><?php echo esc_html($subtitle); ?></<?php echo esc_attr($subtitles_typography_html_tag); ?>>
<?php
}
if ( !empty($title) ) {
?>
<<?php echo esc_attr($title_typography_html_tag); ?> class="<?php echo esc_attr($class);?>__title"><?php echo esc_html($title); ?></<?php echo esc_attr($title_typography_html_tag); ?>>
<?php
}
?>
</div>
<?php
}
//Price section
if ( !empty($price_text) || !empty($price) || !empty($price_description) ) {
?>
<div class="<?php echo esc_attr($class); ?>__price-wrapper">
<?php
if ( !empty($price_text) ) {
?>
<div class="<?php echo esc_attr($class); ?>__price-text"><?php echo esc_html($price_text); ?></div>
<?php
}
if ( !empty($price) ) {
?>
<p class="<?php echo esc_attr($class); ?>__price"><?php echo esc_html($price);
if ( !empty( $price_currency ) ) {
?><i class="<?php echo esc_attr($class); ?>__price-currency"><?php echo esc_html($price_currency); ?></i><?php
}
?></p>
<?php
}
if ( !empty($price_description) ) {
?>
<p class="<?php echo esc_attr($class); ?>__price-description"><?php echo esc_html($price_description); ?></p>
<?php
}
?>
</div>
<?php
}
//Content section
if ( !empty($content_items) ) {
?>
<div class="<?php echo esc_attr($class); ?>__content-wrapper">
<ul>
<?php
foreach ($content_items as $key => $item) {
$item_id = 'elementor-repeater-item-'.esc_attr($item['_id']);
?>
<li class="<?php echo esc_attr($item_id . ' ' . $class . '__content');?>"><?php
if ( !empty($item['item_icon']) ) {
?><i class="<?php echo esc_attr($item['item_icon']); ?>"></i> <?php
}
echo esc_html($item['item_text']);
?></li>
<?php
}
?>
</ul>
</div>
<?php
}
if ( $button_show == 'yes' ) {
//Button
?>
<div class="<?php echo esc_attr($class); ?>__button elementor-widget-button">
<a href="<?php echo esc_url($button_url['url']); ?>" class="button elementor-button" <?php
if ( $button_url['is_external'] ) {
?>
target="_blank"
<?php
}
?>
><?php echo esc_html($button_text); ?></a>
</div>
<?php
}
?>
</div>
</div>

View File

@@ -0,0 +1,186 @@
<?php
use \Elementor\Frontend;
use \Elementor\Icons_Manager;
extract( shortcode_atts( array(
'table_head_items' => array(),
'table_body_items' => array(),
'table_head_alignment_horizontal' => '',
'table_body_alignment_horizontal' => '',
), $settings ) );
$class = 'stratum-table';
$table_tr = [];
$table_td = [];
$frontend = new Frontend;
?>
<div class="<?php echo esc_attr( $class ); ?>">
<table class="<?php echo esc_attr( $class . '__table' ); ?>">
<thead>
<tr>
<?php
foreach ( $table_head_items as $key => $table_head ) :
$current_text_align = ! empty( $table_head[ 'table_content_alignment' ] ) ? $table_head[ 'table_content_alignment' ] : null;
$current_bg = ! empty( $table_head[ 'table_head_unique_bgcolor' ] ) ? "style='background: " . esc_attr( $table_head[ 'table_head_unique_bgcolor' ] ) . ";'" : null;
$current_text_color = ! empty( $table_head[ 'table_head_unique_text_color' ] ) ? "style='color: " . esc_attr( $table_head[ 'table_head_unique_text_color' ] ) . ";'" : null;
$current_icon_color = ! empty( $table_head[ 'table_head_unique_icon_color' ] ) ? "color: " . esc_attr( $table_head[ 'table_head_unique_icon_color' ] ) . ";" : null;
$current_media_space = ! empty( $table_head[ 'table_head_icon_margin' ][ 'top' ] ) || ! empty( $table_head[ 'table_head_icon_margin' ][ 'right' ] ) || ! empty( $table_head[ 'table_head_icon_margin' ][ 'bottom' ] ) || ! empty( $table_head[ 'table_head_icon_margin' ][ 'left' ] ) ? "margin: " . $table_head[ 'table_head_icon_margin' ][ 'top' ] . $table_head[ 'table_head_icon_margin' ][ 'unit' ] . ' ' . $table_head[ 'table_head_icon_margin' ][ 'right' ] . $table_head[ 'table_head_icon_margin' ][ 'unit' ] . ' ' . $table_head[ 'table_head_icon_margin' ][ 'bottom' ] . $table_head[ 'table_head_icon_margin' ][ 'unit' ] . ' ' . $table_head[ 'table_head_icon_margin' ][ 'left' ] . $table_head[ 'table_head_icon_margin' ][ 'unit' ] . ";" : null;
$icon_style = ! empty( $current_media_space ) || ! empty( $current_icon_color ) ? sprintf( 'style="%1$s %2$s"', esc_attr( $current_media_space ), esc_attr( $current_icon_color ) ) : null;
?>
<th colspan="<?php echo esc_attr( $table_head[ 'table_colspan_head' ] ); ?>" <?php echo $current_bg; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div class="<?php echo esc_attr( $class . '__header-cell' ) . ' ' . esc_attr( 'align-content-' . ( ! empty( $current_text_align ) ? $current_text_align : $table_head_alignment_horizontal ) ); ?>">
<span class="<?php echo esc_attr( $class . '__cell-title' ) . ' ' . esc_attr( 'has-media-' . $table_head[ 'table_head_pos' ] ); ?>" <?php echo $current_text_color; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php echo esc_html__( $table_head[ 'table_head_title' ] );
if ( $table_head[ 'table_head_icon_type' ] != 'none' ) :
?>
<span class="<?php echo esc_attr( $class . '__cell-icon' );?>" <?php echo $icon_style; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped?>>
<?php
if ( $table_head[ 'table_head_icon_type' ] == 'icon' ) :
$migrated = isset( $table_head[ '__fa4_migrated' ][ 'table_head_icons' ] );
$is_new = empty( $table_head[ 'table_head_icon' ] );
if ( $is_new || $migrated ) :
Icons_Manager::render_icon( $table_head[ 'table_head_icons' ], [ 'aria-hidden' => 'true' ] );
else: ?>
<i class="<?php echo esc_attr( $table_head[ 'table_head_icon' ] ); ?>"></i>
<?php endif;
elseif ( $table_head[ 'table_head_icon_type' ] == 'image' ) :
?>
<img src="<?php
echo esc_url( $table_head[ 'table_head_image' ][ 'url' ] ); ?>" alt="<?php
echo esc_attr( get_post_meta( $table_head[ 'table_head_image' ][ 'id' ], '_wp_attachment_image_alt', true ) );
?>" style="width: <?php echo esc_attr( $table_head[ 'table_head_image_size' ] ); ?>px"/><?php
endif; ?>
</span>
<?php
endif; ?>
</span>
</div>
</th><?php
endforeach; ?>
</tr>
</thead>
<tbody>
<?php
foreach ( $table_body_items as $key => $table_body ) :
$row_id = uniqid();
if ( $table_body[ 'table_col_select' ] == 'Row' ) :
$table_tr[] = [
'id' => $row_id,
'type' => $table_body[ 'table_col_select' ]
];
endif;
if ( $table_body[ 'table_col_select' ] == 'Col' ) :
$table_tr_keys = array_keys( $table_tr );
$last_key = end( $table_tr_keys );
$table_td[] = [
'row_id' => $table_tr[ $last_key ][ 'id' ],
'type' => $table_body[ 'table_col_select' ],
'title' => esc_html__( $table_body[ 'table_col_title' ] ),
'content_type' => $table_body[ 'table_col_content_type' ],
'table_colspan' => $table_body[ 'table_colspan_body' ],
'template' => $table_body[ 'table_col_template' ],
'editor' => $table_body[ 'table_col_editor' ],
'icon_type' => $table_body[ 'table_col_icon_type' ],
'f4_comp' => isset( $table_body[ '__fa4_migrated' ][ 'table_col_icons' ] ),
'icon' => empty( $table_body[ 'table_col_icon' ] ),
'icons' => $table_body[ 'table_col_icons' ],
'image' => $table_body[ 'table_col_image' ],
'image_size' => $table_body[ 'table_col_image_size' ],
'icon_pos' => $table_body[ 'table_col_pos' ],
'content_align' => $table_body[ 'table_col_content_alignment' ],
'icon_color' => $table_body[ 'table_body_unique_icon_color' ],
'media_space' => $table_body[ 'table_col_margin' ],
'text_color' => $table_body[ 'table_body_unique_text_color' ],
'bg_color' => $table_body[ 'table_body_unique_bgcolor' ],
];
endif;
endforeach;
for ( $i = 0; $i < count( $table_tr ); $i++ ) :
?>
<tr>
<?php
for ( $j = 0; $j < count( $table_td ); $j++ ) :
if ( $table_tr[ $i ][ 'id' ] === $table_td[ $j ][ 'row_id' ] ) :
$body_text_align = ! empty( $table_td[ $j ][ 'content_align' ] ) ? $table_td[ $j ][ 'content_align' ] : null;
$body_bg = ! empty( $table_td[ $j ][ 'bg_color' ] ) ? "style='background: " . $table_td[ $j ][ 'bg_color' ] . ";'" : null;
$body_text_color = ! empty( $table_td[ $j ][ 'text_color' ] ) ? "style='color: " . esc_attr( $table_td[ $j ][ 'text_color' ] ) . ";'" : null;
$body_icon_color = ! empty( $table_td[ $j ][ 'icon_color' ] ) ? "color: " . esc_attr( $table_td[ $j ][ 'icon_color' ] ) . ";" : null;
$body_media_space = ! empty( $table_td[ $j ][ 'media_space' ][ 'top' ] ) || ! empty( $table_td[ $j ][ 'media_space' ][ 'right' ] ) || ! empty( $table_td[ $j ][ 'media_space' ][ 'bottom' ] ) || ! empty( $table_td[ $j ][ 'media_space' ][ 'left' ] ) ? "margin: " . $table_td[ $j ][ 'media_space' ][ 'top' ] . $table_td[ $j ][ 'media_space' ][ 'unit' ] . ' ' . $table_td[ $j ][ 'media_space' ][ 'right' ] . $table_td[ $j ][ 'media_space' ][ 'unit' ] . ' ' . $table_td[ $j ][ 'media_space' ][ 'bottom' ] . $table_td[ $j ][ 'media_space' ][ 'unit' ] . ' ' . $table_td[ $j ][ 'media_space' ][ 'left' ] . $table_td[ $j ][ 'media_space' ][ 'unit' ] . ";" : null;
$body_icon_style = ! empty( $body_media_space ) || ! empty( $body_icon_color ) ? sprintf( 'style="%1$s %2$s"', esc_attr( $body_media_space ), esc_attr( $body_icon_color ) ) : null;
?>
<td <?php echo $body_bg; ?> colspan="<?php echo esc_attr( $table_td[ $j ][ 'table_colspan' ] ); ?>"><?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<div class="<?php echo esc_attr( $class . '__body-cell' ) . ' ' . esc_attr( 'align-content-' . ( ! empty( $body_text_align ) ? $body_text_align : $table_body_alignment_horizontal ) ); ?>">
<?php
if ( $table_td[ $j ][ 'content_type' ] === 'default' ) :
?>
<span class="<?php echo esc_attr( $class . '__cell-title' ) . ' ' . esc_attr( 'has-media-' . $table_td[ $j ][ 'icon_pos' ] ); ?>" <?php echo $body_text_color; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php echo wp_kses_post( $table_td[ $j ][ 'title' ] );
if ( $table_td[ $j ][ 'icon_type' ] != 'none' ) :
?>
<span class="<?php echo esc_attr( $class . '__cell-icon' ); ?>" <?php echo $body_icon_style; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php
if ( $table_td[ $j ][ 'icon_type' ] == 'icon' ) :
$migrated = isset( $table_td[ $j ][ 'f4_comp' ] );
$is_new = empty( $table_td[ $j ][ 'icon' ] );
if ( $is_new || $migrated ) :
Icons_Manager::render_icon( $table_td[ $j ][ 'icons' ], [ 'aria-hidden' => 'true' ] );
else: ?>
<i class="<?php echo esc_attr( $table_td[ $j ][ 'icon' ] ); ?>"></i><?php
endif;
elseif ( $table_td[ $j ][ 'icon_type' ] == 'image' ) :
?>
<img src="<?php
echo esc_url( $table_td[ $j ][ 'image' ][ 'url' ] ); ?>" alt="<?php
echo esc_attr( get_post_meta( $table_td[ $j ][ 'image' ][ 'id' ], '_wp_attachment_image_alt', true ) );
?>" style="width: <?php echo esc_attr( $table_td[ $j ][ 'image_size' ] ); ?>px"/><?php
endif;
?>
</span>
<?php
endif; ?>
</span>
<?php
elseif ( $table_td[ $j ][ 'content_type' ] === 'template' ) :
$get_template = $frontend->get_builder_content( $table_td[ $j ][ 'template' ], true );
if ( ! empty( $get_template ) ) :
echo $get_template; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
else : ?>
<span><?php echo esc_html__( 'Template is not found', 'stratum' ); ?></span>
<?php endif;
else : ?>
<div class="<?php echo esc_attr( $class . '__editor-content' ); ?>">
<?php echo $table_td[ $j ][ 'editor' ]; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div><?php
endif;
?>
</div>
</td><?php
endif;
endfor;
?>
</tr><?php
endfor; ?>
</tbody>
</table>
</div>

View File

@@ -0,0 +1,82 @@
<?php
use Elementor\Utils;
extract( shortcode_atts( array(
//Swiper
'navigation' => 'both',
'pagination_style' => 'bullets',
'heading_typography_html_tag' => 'h3',
'subtitle_typography_html_tag' => 'span',
//--Swiper
), $settings ) );
$class = 'stratum-testimonial-carousel';
$slider_options = stratum_generate_swiper_options( $settings );
$heading_typography_html_tag = stratum_validate_heading_html_tag( $heading_typography_html_tag );
$subtitle_typography_html_tag = stratum_validate_heading_html_tag( $subtitle_typography_html_tag );
?>
<div class="<?php echo esc_attr( $class ); ?>" data-slider-options="<?php echo esc_attr( json_encode( $slider_options ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>">
<div class="swiper swiper-container stratum-main-swiper">
<div class="swiper-wrapper">
<?php
foreach ( $settings[ 'slides' ] as $index => $item ) {
$current_item = 'elementor-repeater-item-' . $item[ '_id' ];?>
<div class="swiper-slide <?php echo esc_attr( $current_item ); ?>">
<div class="<?php echo esc_attr( $class . "__wrapper" ); ?>">
<div class="<?php echo esc_attr( $class . "__container" ); ?>">
<div class="<?php echo esc_attr( $class . "__container-inner" ) ;?>">
<div class="<?php echo esc_attr( $class . "__footer" ); ?>">
<?php
list( , $id ) = array_values( $item[ 'image' ] );
if ( ! empty( $item[ 'image' ][ 'url' ] ) ) {
$url_placeholder = Utils::get_placeholder_image_src();
$srcset = wp_get_attachment_image_srcset( $id, 'full' );
$url = wp_get_attachment_image_url ( $id, 'full' );
$src_url = empty( $url ) ? $url_placeholder : $url;
?>
<img src="<?php echo esc_url( $src_url ); ?>" class="<?php
echo esc_attr( $class . '__image' ) . " wp-image-" . esc_attr( $id ) ?>" srcset="<?php
echo $srcset; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>"/>
<?php } ?>
</div>
<div class="<?php echo esc_attr( $class . "__content" ); ?>">
<div class="<?php echo esc_attr( $class . "__cite" );?> ">
<<?php echo esc_html( $heading_typography_html_tag ); ?> class="<?php echo esc_attr( $class . "__heading" ); ?>">
<?php echo esc_html( $item[ 'heading' ] ); ?>
</<?php echo esc_html( $heading_typography_html_tag ); ?>>
<<?php echo esc_html( $subtitle_typography_html_tag ); ?> class="<?php echo esc_attr( $class . "__subtitle" ); ?>">
<?php echo esc_html( $item[ 'subtitle' ] ); ?>
</<?php echo esc_html( $subtitle_typography_html_tag ); ?>>
</div>
<div class="<?php echo esc_attr( $class . "__text" ); ?>">
<?php echo esc_html( $item[ 'content' ] ); ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
</div><?php
//swiper-wrapper
if ( $navigation == 'both' || $navigation == 'pagination' ) {
if ( $pagination_style == 'scrollbar' ) { ?>
<div class="swiper-scrollbar"></div>
<?php } else { ?>
<div class="swiper-pagination"></div>
<?php }
}?>
</div><?php
//swiper-container
if ( $navigation == 'both' || $navigation == 'arrows' ) { ?>
<div class="stratum-swiper-button-prev"></div>
<div class="stratum-swiper-button-next"></div>
<?php } ?>
</div>

View File

@@ -0,0 +1,104 @@
<?php
$class = 'stratum-vertical-timeline';
$alignment = $settings[ 'vertical_alignment' ];
$this->add_render_attribute( 'widget', [
'class' => [
$class,
$class . '--align-' . $alignment
],
'data-animation' => esc_attr( $settings[ 'animate_cards' ] )
]);
$this->add_render_attribute( 'inner', [
'class' => [
$class . '-item__inner',
$class . '-item__inner' . $this->_get_alignment( $settings, 'vertical' )
]
]);
$item_classes = [
$class . '-item',
$this->_get_alignment( $settings, 'horizontal' )
];
$widget_classes = $this->get_render_attribute_string( 'widget' );
$inner_classes = $this->get_render_attribute_string( 'inner' );
?>
<div <?php echo $widget_classes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div class="<?php echo esc_attr( $class . '__line' ); ?>">
<div class="<?php echo esc_attr( $class . '__line-progress' ); ?>"></div>
</div>
<div class="<?php echo esc_attr( $class . '__list' ); ?>"><?php
foreach ( $settings[ 'image_content' ] as $index => $item ) {
$merge = array_merge( $item_classes, [ 'elementor-repeater-item-' . esc_attr( $item[ '_id' ] ) ] );
$title_html_tag = stratum_validate_heading_html_tag( $settings[ 'title_tag' ] );
$this->add_render_attribute( 'item' . $index, [ 'class' => $merge ] );
$item_class = $this->get_render_attribute_string( 'item' . $index );
?>
<div <?php echo $item_class; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div <?php echo $inner_classes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div class="<?php echo esc_attr( $class . '-item__card' ); ?>">
<div class="<?php echo esc_attr( $class . '-item__card-inner' );?>">
<?php
/* #region Render image */
if ( !empty( $item[ 'show_item_image' ] ) ) {
echo $this->_get_timeline_image( $class, $item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/* #endregion */
?>
<div class="<?php echo esc_attr( $class . '-item__card-content' );?>">
<?php
if ( ! empty( $item[ 'item_link' ][ 'url' ] ) ) {
$this->add_link_attributes( 'url' . $index, $item[ 'item_link' ] ); ?>
<a class="<?php echo esc_attr( $class . '-item__card-link' );?>" <?php
echo $this->get_render_attribute_string( 'url' . $index ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>>
<?php } ?>
<<?php echo esc_html($title_html_tag); ?> class="<?php echo esc_attr( $class . '-item__card-title' );?>">
<?php echo esc_html( $item[ 'item_title' ] ); ?>
</<?php echo esc_html($title_html_tag); ?>>
<?php
if ( ! empty( $item[ 'item_link' ][ 'url' ] ) ) { ?>
</a>
<?php }
if ( $item[ 'item_description_type' ] === 'default' ) { ?>
<div class="<?php echo esc_attr( $class . '-item__card-description' ); ?>">
<?php echo esc_html( $item[ 'item_description' ] ); ?>
</div>
<?php } else { ?>
<div class="<?php echo esc_attr( $class . '-item__card-description' ); ?>">
<?php echo wp_kses_post( $item[ 'item_description_editor' ] ); ?>
</div>
<?php } ?>
</div>
<div class="<?php echo esc_attr( $class . '-item__card-arrow' ); ?>"></div>
</div>
</div>
<div class="<?php echo esc_attr( $class . '-item__point' ); ?>">
<?php
echo $this->_generate_point_content( $class, $item, $index ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>
</div>
<div class="<?php echo esc_attr( $class . '-item__meta' ); ?>">
<div class="<?php echo esc_attr( $class . '-item__meta-content' ); ?>">
<?php echo esc_html( $item[ 'item_meta' ] ); ?>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
</div>

View File

@@ -0,0 +1,128 @@
<?php
namespace Stratum\Managers;
use Stratum\String_Encryption;
class Token_Manager {
public function __construct() {
// Deactivation hook.
register_deactivation_hook( STRATUM_PLUGIN_FILE, [ $this, 'clear_scheduled_event' ] );
// Action hook to execute when the event is run
add_action( 'stratum_refresh_instagram_token', [ $this, 'refresh_instagram_token' ] );
add_filter( 'cron_schedules', [ $this , 'time_scheduled_event' ] );
add_action( 'update_option', [ $this, 'update_option' ], 10, 3 );
add_action( 'admin_init', [ $this, 'error_message' ] );
}
public function time_scheduled_event( $schedules ) {
if ( ! isset( $schedules[ 'two_weeks' ] ) ) {
/*
* https://developers.facebook.com/docs/instagram-basic-display-api/guides/long-lived-access-tokens/
*/
$schedules[ 'two_weeks' ] = [
'interval' => WEEK_IN_SECONDS * 2,
'display' => 'Once in Two Weeks'
];
}
return $schedules;
}
public function schedule_token_refresh_event() {
if ( ! wp_next_scheduled( 'stratum_refresh_instagram_token' ) ) {
wp_schedule_event( time(), 'two_weeks', 'stratum_refresh_instagram_token' );
}
}
public function update_option( $option_name, $old_value, $value ) {
if ( $option_name === 'stratum_api' ) {
delete_option( 'stratum_instagram_token_cron_error_message' );
if ( $value === '' ) {
$this->clear_scheduled_event();
}
}
}
public function clear_scheduled_event() {
$timestamp = wp_next_scheduled( 'stratum_refresh_instagram_token' );
if ( $timestamp ) {
wp_unschedule_event( $timestamp, 'stratum_refresh_instagram_token' );
}
}
public function refresh_instagram_token() {
$encryption = new String_Encryption();
$stratum_api = get_option( 'stratum_api', [] );
$instagram_access_token = isset( $stratum_api['instagram_access_token'] ) ? $encryption->decrypt( $stratum_api['instagram_access_token'] ) : '';
if ( ! empty( $instagram_access_token ) ) {
$api_req = 'https://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token&access_token=' . $instagram_access_token;
$response = wp_remote_get( $api_req );
if ( is_wp_error( $response ) ) {
update_option( 'stratum_instagram_token_cron_error_message', $response->get_error_message() );
} else {
$response_body = json_decode( wp_remote_retrieve_body( $response ), false );
if ( $response_body && json_last_error() === JSON_ERROR_NONE ) {
if ( $response_body->error ) {
update_option( 'stratum_instagram_token_cron_error_message', $response_body->error->message );
} else {
delete_option( 'stratum_instagram_token_cron_error_message' );
if ( ! empty( $response_body->access_token ) ) {
// Update token
$stratum_api[ 'instagram_access_token' ] = $encryption->encrypt( $response_body->access_token );
update_option( 'stratum_api', $stratum_api );
// Delete cache data
delete_transient( 'stratum_instagram_response_data' );
// Schedule token refresh
$this->schedule_token_refresh_event();
}
}
} else {
update_option( 'stratum_instagram_token_cron_error_message', __( 'Error in json_decode.', 'stratum' ) );
}
}
}
}
public function stratum_instagram_notice_token_error() {
$instagram_token_error_message = get_option( 'stratum_instagram_token_cron_error_message' );
if ( ! empty( $instagram_token_error_message ) ) {
?>
<div class="notice notice-error">
<p>
<?php
echo esc_html( sprintf(
//translators: %s is an error message
__( 'Update Instagram Token. Error: %s', 'stratum' ),
$instagram_token_error_message
) );
?>
</p>
</div>
<?php
}
}
public function error_message() {
global $pagenow;
if ( $pagenow && $pagenow == 'admin.php' && current_user_can( 'manage_options' ) ) {
if ( get_option( 'stratum_instagram_token_cron_error_message' ) !== '' ) {
add_action( 'admin_notices', [ $this, 'stratum_instagram_notice_token_error' ] );
}
}
}
}

View File

@@ -0,0 +1,12 @@
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Load translations from the MO file.
*/
function stratum_load_textdomain() {
load_plugin_textdomain( 'stratum', false, plugin_basename( STRATUM_PLUGIN_DIR ) . '/languages/' );
}
add_action( 'plugins_loaded', 'stratum_load_textdomain' );

View File

@@ -0,0 +1,77 @@
<?php
namespace Stratum;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Version_Control
{
/** @var string */
protected $plugin_version = '';
/** @var string */
protected $dbVersion = '';
/** @var bool */
protected $needUpgrade = false;
public function __construct(){
$settings = Settings::get_instance();
$this->plugin_version = $settings->getVersion();
$this->checkVersion();
$this->addActions();
}
protected function checkVersion()
{
$this->dbVersion = $this->getCurrentDatabaseVersion();
if (version_compare($this->plugin_version, $this->dbVersion, '>')) {
$this->needUpgrade = true;
}
}
protected function addActions()
{
if ($this->needUpgrade) {
add_action('init', [$this, 'upgrade']);
}
}
public function upgrade()
{
// Nothing to do at the moment
$this->afterUpgrade();
}
protected function afterUpgrade()
{
$this->setCurrentDatabaseVersion($this->plugin_version);
if (version_compare($this->plugin_version, $this->dbVersion, '!=')) {
$this->addVersionToHistory($this->plugin_version);
}
}
protected function getCurrentDatabaseVersion()
{
return get_option('stratum_db_version', '0.0.0');
}
protected function setCurrentDatabaseVersion($version)
{
update_option('stratum_db_version', $version);
}
protected function addVersionToHistory($version)
{
$versionHistory = get_option('stratum_db_version_history', []);
if (!in_array($version, $versionHistory)) {
$versionHistory[] = $version;
update_option('stratum_db_version_history', $versionHistory);
}
}
}

View File

@@ -0,0 +1,129 @@
<?php
namespace Stratum\Managers;
use \Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* Class WidgetsManager
* @package Stratum
*/
class Widgets_Manager {
private $prefix;
/**
* WidgetsManager constructor.
*/
public function __construct() {
$settings = \Stratum\Settings::get_instance();
$this->prefix = $settings->getPrefix();
add_action( 'elementor/widgets/register', [ $this, 'register_widgets' ], 12 );
add_action( 'elementor/elements/categories_registered', [ $this, 'register_widgets_categories' ] );
$this->register_ajax_templates();
}
//Group element under Theme slug
public function register_widgets_categories() {
Plugin::instance()->elements_manager->add_category(
'stratum-widgets',
[
'title' => esc_html__( 'Stratum Widgets', 'stratum' ),
'icon' => 'font'
],
0
);
}
public function unregister_standart_widgets() {
Plugin::instance()->widgets_manager->unregister( 'button' );
}
public function register_widgets() {
require_once stratum_get_plugin_path( '/includes/stratum-widget-base.php' );
if ( defined( 'ELEMENTOR_PATH' ) && class_exists( 'Elementor\Widget_Base' ) ) {
if ( class_exists( 'Elementor\Plugin' ) ) {
if ( is_callable( 'Elementor\Plugin', 'instance' ) ) {
$elementor = Plugin::instance();
if ( isset( $elementor->widgets_manager ) ) {
if ( method_exists( $elementor->widgets_manager, 'register' ) ) {
//Files widgets list
$widgets_list = [];
$stratum_get_widgets = get_option( 'stratum_widgets' );
if ( empty( $stratum_get_widgets ) ) {
//Get all files
if ( $handle = opendir( stratum_get_plugin_path( '/includes/widgets/' ) ) ) {
while ( ( $file = readdir( $handle ) ) !== false ) {
if ( $file != "." && $file != ".." ) {
$widgets_list[] = str_replace( ".php", '', $file );
}
}
closedir( $handle );
}
} else {
foreach ( $stratum_get_widgets as $widget_name => $enabled ) {
if ( $enabled == 'on' ) {
$widgets_list[] = $widget_name;
}
}
}
foreach ($widgets_list as $key => $widget_name) {
$path = stratum_get_plugin_path( '/includes/widgets/' . $widget_name . '.php' );
if ( file_exists( $path ) ) {
require_once( $path );
}
}
}
}
}
}
}
}
public function register_ajax_templates() {
if ( class_exists( 'Elementor\Plugin' ) ) {
if ( is_callable( 'Elementor\Plugin', 'instance' ) ) {
$widgets_list = [];
$stratum_get_widgets = get_option( 'stratum_widgets' );
if ( empty( $stratum_get_widgets ) ) {
//Get all files
if ( $handle = opendir( stratum_get_plugin_path( '/includes/widgets/' ) ) ) {
while ( ( $file = readdir( $handle ) ) !== false ) {
if ( $file != "." && $file != ".." ) {
$widgets_list[] = str_replace( ".php", '', $file );
}
}
closedir( $handle );
}
} else {
foreach ( $stratum_get_widgets as $widget_name => $enabled ) {
if ( $enabled == 'on' ) {
$widgets_list[] = $widget_name;
}
}
}
foreach ( $widgets_list as $key => $widget_name ) {
$path = stratum_get_plugin_path( '/includes/ajax-templates/' . $widget_name . '.php' );
if ( file_exists( $path ) ) {
require_once( $path );
}
}
}
}
}
}

View File

@@ -0,0 +1,975 @@
<?php
/**
* Class: Advanced_Accordion
* Name: Advanced Accordion
* Slug: advanced-accordion
*/
namespace Stratum;
use Elementor\Core\Base\Document;
use \Elementor\Group_Control_Background;
use \Elementor\Group_Control_Border;
use \Elementor\Group_Control_Box_Shadow;
use \Elementor\Controls_Manager;
use \Elementor\Utils;
use \Elementor\Plugin;
use \Elementor\Repeater;
use Stratum\Managers\Ajax_Manager;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Advanced_Accordion extends Stratum_Widget_Base {
protected $widget_name = 'advanced-accordion';
public function __construct($data = [], $args = null) {
parent::__construct( $data, $args );
}
public function get_title() {
return esc_html__( 'Advanced Accordion', 'stratum' );
}
public function get_script_depends() {
return [
'font-awesome-4-shim'
];
}
public function get_style_depends() {
return [
'font-awesome-5-all',
'font-awesome-4-shim'
];
}
public function get_keywords() {
return [ 'accordion', 'content', 'template' ];
}
public function get_icon() {
return 'stratum-icon-advanced-accordion';
}
public function get_categories() {
return [ 'stratum-widgets' ];
}
protected function register_controls() {
$controls = $this;
$background_color = !empty(get_option( 'stratum_style' )) ? (!empty(get_option( 'stratum_style' )['background_color']) ? get_option( 'stratum_style' )['background_color'] : '') : '#71d7f7';
$background_color_active = !empty(get_option( 'stratum_style' )) ? (!empty(get_option( 'stratum_style' )['background_color_active']) ? get_option( 'stratum_style' )['background_color_active'] : '') : '#0097c6';
$background_color_hover = !empty(get_option( 'stratum_style' )) ? (!empty(get_option( 'stratum_style' )['background_color_hover']) ? get_option( 'stratum_style' )['background_color_hover'] : '') : '#008fbc';
$document_types = Plugin::instance()->documents->get_document_types( [
'show_in_library' => true,
] );
/*-----------------------------------------------------------------------------------*/
/* Content Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'section_general',
[
'label' => esc_html__( 'General', 'stratum' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$controls->add_control(
'accordion_type',
[
'label' => esc_html__('Accordion Type', 'stratum'),
'type' => Controls_Manager::SELECT,
'default' => 'accordion',
'label_block' => false,
'options' => [
'accordion' => esc_html__('Accordion', 'stratum'),
'toggle' => esc_html__('Toggle', 'stratum'),
],
]
);
$controls->add_control(
'accordion_collapsible',
[
'label' => esc_html__( 'Collapsible', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'condition' => [
'accordion_type' => 'accordion'
],
]
);
$controls->add_control(
'accordion_interactivity',
[
'label' => esc_html__( 'Interactivity', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'click',
'options' => [
'click' => esc_html__( 'Click', 'stratum' ),
'mouseenter' => esc_html__( 'Hover', 'stratum' )
],
]
);
$repeater = new Repeater();
$repeater->add_control(
'title',
[
'label' => esc_html__( 'Title', 'stratum' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Lorem ipsum dolor sit amet.', 'stratum' ),
'dynamic' => [ 'active' => true ]
]
);
$repeater->start_controls_tabs( 'title_icon_styles' );
$repeater->start_controls_tab(
'title_icon_tab',
array(
'label' => esc_html__( 'Normal', 'stratum' ),
)
);
$repeater->add_control(
'title_icon',
[
'label' => esc_html__( 'Icon', 'stratum' ),
'type' => Controls_Manager::ICONS,
]
);
$repeater->end_controls_tab();
$repeater->start_controls_tab(
'title_icon_active_tab',
array(
'label' => esc_html__( 'Active', 'stratum' ),
)
);
$repeater->add_control(
'title_icon_active',
[
'label' => esc_html__( 'Icon', 'stratum' ),
'type' => Controls_Manager::ICONS,
]
);
$repeater->end_controls_tab();
$repeater->end_controls_tabs();
$repeater->add_control(
'content_type',
[
'label' => esc_html__('Content Type', 'stratum'),
'type' => Controls_Manager::SELECT,
'default' => 'text',
'label_block' => false,
'options' => [
'text' => esc_html__('Text', 'stratum'),
'template' => esc_html__('Template', 'stratum'),
],
'separator' => 'before',
]
);
$repeater->add_control(
'text',
[
'label' => esc_html__( 'Text', 'stratum' ),
'type' => Controls_Manager::WYSIWYG,
'dynamic' => [ 'active' => true ],
'condition' => [
'content_type' => 'text'
],
]
);
$repeater->add_control(
'accordion_template',
[
'label' => esc_html__('Template', 'stratum'),
'type' => Stratum_AJAX_Control::QUERY,
'label_block' => true,
'multiple' => false,
'ajax_route' => 'stratum_get_elementor_templates',
'autocomplete' => [
'object' => 'library_template',
'query' => [
'meta_query' => [
[
'key' => Document::TYPE_META_KEY,
'value' => array_keys( $document_types ),
'compare' => 'IN',
],
],
],
],
'options' => Ajax_Manager::stratum_get_elementor_templates(),
'condition' => [
'content_type' => 'template'
],
'description' => esc_html__( 'Here you can see sections you saved as templates.', 'stratum' ),
]
);
$repeater->add_control(
'manage_templates',
[
'label' => esc_html__( 'Manage Templates', 'stratum' ),
'label_block' => false,
'type' => Controls_Manager::BUTTON,
'button_type' => 'success',
'text' => esc_html__( 'Library', 'stratum' ),
'event' => 'stratum:OpenTemplatesLibrary',
'condition' => [
'content_type' => 'template'
],
]
);
$repeater->add_control(
'active',
[
'label' => esc_html__( 'Unfolded by default', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
]
);
$controls->add_control(
'accordion_items',
[
'label' => esc_html__( 'Accordion items', 'stratum' ),
'type' => Controls_Manager::REPEATER,
'title_field' => '{{{ title }}}',
'show_label' => true,
'fields' => $repeater->get_controls(),
'default' => [
[
'text' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'stratum' ),
'active' => 'yes'
],
[
'text' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'stratum' ),
'active' => 'no'
]
]
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'section_style',
[
'label' => esc_html__( 'General Style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->add_control(
'equal_height',
[
'label' => esc_html__( 'Equal container height', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'condition' => [
'accordion_type' => 'accordion'
],
]
);
$controls->add_control(
'items_spacing',
[
'label' => esc_html__( 'Spacing between items', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'size' => 1,
],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}}',
],
]
);
$controls->add_responsive_control(
'accordion_padding',
[
'label' => esc_html__( 'Items Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_responsive_control(
'accordion_margin',
[
'label' => esc_html__( 'Items Margin', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'accordion_border',
'label' => esc_html__( 'Border', 'stratum' ),
'selector' => '{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item',
'separator' => 'before',
]
);
$controls->add_responsive_control(
'accordion_border_radius',
[
'label' => esc_html__( 'Border Radius', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'condition' => [
'accordion_border_border!' => ''
],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'accordion_shadow',
'separator' => 'before',
'selector' => '{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item',
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'section_style_icon',
[
'label' => esc_html__( 'Expand icon style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->add_control(
'icon_position',
[
'label' => esc_html__( 'Icon position', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'right',
'prefix_class' => 'stratum-advanced-accordion-icons-position-',
'toggle' => false,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'eicon-h-align-left',
],
'right' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'eicon-h-align-right',
],
],
]
);
$controls->add_control(
'icon_size',
[
'label' => esc_html__( 'Icon Size', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'size' => 16,
],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__expand-icon' => 'font-size: {{SIZE}}{{UNIT}}',
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__expand-icon svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};'
],
]
);
$controls->add_control(
'icon_spacing',
[
'label' => esc_html__( 'Spacing', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'size' => 10,
],
'selectors' => [
'{{WRAPPER}}.stratum-advanced-accordion-icons-position-left .stratum-advanced-accordion .stratum-advanced-accordion__expand-icon' => 'margin-right: {{SIZE}}{{UNIT}}',
'{{WRAPPER}}.stratum-advanced-accordion-icons-position-right .stratum-advanced-accordion .stratum-advanced-accordion__expand-icon' => 'margin-left: {{SIZE}}{{UNIT}}',
],
]
);
$controls->start_controls_tabs( 'expand_icon_styles' );
$controls->start_controls_tab(
'expand_icon_tab',
array(
'label' => esc_html__( 'Normal', 'stratum' ),
)
);
$controls->add_control(
'expand_icon_color',
[
'label' => esc_html__( 'Icon Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-header .stratum-advanced-accordion__expand-icon .normal' => 'color: {{VALUE}}',
],
]
);
$controls->add_control(
'expand_icon',
[
'label' => esc_html__( 'Icon', 'stratum' ),
'type' => Controls_Manager::ICONS,
'default' => [
'value' => 'fas fa-chevron-right',
'library' => 'solid',
],
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'expand_icon_active_tab',
array(
'label' => esc_html__( 'Active', 'stratum' ),
)
);
$controls->add_control(
'expand_icon_active_color',
[
'label' => esc_html__( 'Icon Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-header .stratum-advanced-accordion__expand-icon .active' => 'color: {{VALUE}}',
],
]
);
$controls->add_control(
'expand_icon_active',
[
'label' => esc_html__( 'Icon', 'stratum' ),
'type' => Controls_Manager::ICONS,
'default' => [
'value' => 'fas fa-chevron-down',
'library' => 'solid',
],
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'expand_icon_hover',
array(
'label' => esc_html__( 'Hover', 'stratum' ),
)
);
$controls->add_control(
'expand_icon_hover_color',
[
'label' => esc_html__( 'Icon Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-header:hover .stratum-advanced-accordion__expand-icon span' => 'color: {{VALUE}}',
],
]
);
$controls->end_controls_tab();
$controls->end_controls_tabs();
$controls->end_controls_section();
$controls->start_controls_section(
'section_style_header',
[
'label' => esc_html__( 'Header style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->add_responsive_control(
'title_align',
[
'label' => esc_html__( 'Title Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'left',
'toggle' => false,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'fa fa-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'stratum' ),
'icon' => 'fa fa-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'fa fa-align-right',
],
],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__title' => 'text-align: {{VALUE}};',
],
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'header_typography',
'selector' => '{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__title',
'label' => esc_html__( 'Typography', 'stratum' ),
'render_type' => 'template',
'defaults' => [
'html_tag' => 'h3',
],
]
);
$controls->add_responsive_control(
'header_padding',
[
'label' => esc_html__( 'Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-header' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_responsive_control(
'header_margin',
[
'label' => esc_html__( 'Margin', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-header' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_control(
'head_icon_size',
[
'label' => esc_html__( 'Icon Size', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'size' => 16,
],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__title-icon i' => 'font-size: {{SIZE}}{{UNIT}}',
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__title-icon svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}',
],
'separator' => 'before',
]
);
$controls->add_control(
'head_icon_spacing',
[
'label' => esc_html__( 'Spacing', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'size' => 10,
],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__title-icon' => 'margin-right: {{SIZE}}{{UNIT}}',
],
]
);
$controls->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'header_border',
'label' => esc_html__( 'Border', 'stratum' ),
'separator' => 'before',
'selector' => '{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-header',
]
);
$controls->add_responsive_control(
'header_border_radius',
[
'label' => esc_html__( 'Border Radius', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'condition' => [
'header_border_border!' => ''
],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-header' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'header_shadow',
'separator' => 'before',
'selector' => '{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-header',
]
);
$controls->start_controls_tabs( 'header_styles' );
$controls->start_controls_tab(
'header_normal',
array(
'label' => esc_html__( 'Normal', 'stratum' ),
)
);
$controls->add_control(
'head_icon_color',
[
'label' => esc_html__( 'Icon Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-header .stratum-advanced-accordion__title-icon .normal' => 'color: {{VALUE}}',
],
]
);
$controls->add_control(
'custom_header_color',
[
'label' => esc_html__( 'Title Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'value' => '',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item .stratum-advanced-accordion__title' => 'color: {{VALUE}}',
]
]
);
$controls->add_control(
'custom_header_background_color',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => $background_color,
'value' => '',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item .stratum-advanced-accordion__item-header' => 'background-color: {{VALUE}}',
]
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'active_normal',
array(
'label' => esc_html__( 'Active', 'stratum' ),
)
);
$controls->add_control(
'head_icon_active_color',
[
'label' => esc_html__( 'Icon Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-header .stratum-advanced-accordion__title-icon .active' => 'color: {{VALUE}}',
],
]
);
$controls->add_control(
'custom_active_header_color',
[
'label' => esc_html__( 'Title Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'value' => '',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item.active-accordion .stratum-advanced-accordion__title' => 'color: {{VALUE}}',
]
]
);
$controls->add_control(
'custom_active_header_background_color',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => $background_color_active,
'value' => '',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item.active-accordion .stratum-advanced-accordion__item-header' => 'background-color: {{VALUE}}',
]
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'header_hover',
array(
'label' => esc_html__( 'Hover', 'stratum' ),
)
);
$controls->add_control(
'head_icon_hover_color',
[
'label' => esc_html__( 'Icon Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-header:hover .stratum-advanced-accordion__title-icon span' => 'color: {{VALUE}}',
],
]
);
$controls->add_control(
'custom_hover_header_color',
[
'label' => esc_html__( 'Title Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'value' => '',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item .stratum-advanced-accordion__item-header:hover .stratum-advanced-accordion__title' => 'color: {{VALUE}}',
]
]
);
$controls->add_control(
'custom_hover_header_background_color',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => $background_color_hover,
'value' => '',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item .stratum-advanced-accordion__item-header:hover' => 'background-color: {{VALUE}}',
]
]
);
$controls->end_controls_tab();
$controls->end_controls_tabs();
$controls->end_controls_section();
$controls->start_controls_section(
'section_style_content',
[
'label' => esc_html__( 'Content style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->add_control(
'custom_content_color',
[
'label' => esc_html__( 'Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'value' => '',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-content .stratum-advanced-accordion__text' => 'color: {{VALUE}}',
]
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'content_typography',
'selector' => '{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-content .stratum-advanced-accordion__text',
'label' => esc_html__( 'Typography', 'stratum' ),
'render_type' => 'template',
'defaults' => [
'html_tag' => 'h3',
],
]
);
$controls->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'content_background',
'types' => ['classic', 'gradient'],
'selector' => '{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-wrapper',
]
);
$controls->add_control(
'content_background_overlay',
[
'label' => esc_html__( 'Background Overlay', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-content-overlay' => 'background-color: {{VALUE}};'
],
'condition' => [
'content_background_image[id]!' => ''
]
]
);
$controls->add_responsive_control(
'content_padding',
[
'label' => esc_html__( 'Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'separator' => 'before',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'render_type' => 'template',
]
);
$controls->add_responsive_control(
'content_margin',
[
'label' => esc_html__( 'Margin', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'render_type' => 'template',
]
);
$controls->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'content_border',
'separator' => 'before',
'label' => esc_html__( 'Border', 'stratum' ),
'selector' => '{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-wrapper',
'render_type' => 'template',
]
);
$controls->add_responsive_control(
'content_border_radius',
[
'label' => esc_html__( 'Border Radius', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'condition' => [
'content_border_border!' => ''
],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-wrapper' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'content_shadow',
'selector' => '{{WRAPPER}} .stratum-advanced-accordion .stratum-advanced-accordion__item-wrapper',
]
);
$controls->end_controls_section();
}
//PHP template (refresh elements)
protected function render() {
$this->render_widget( 'php' );
}
//JavaScript "Backbone" template (live preview)
protected function content_template() {
}
public function render_plain_content( $instance = [] ) {}
}
Plugin::instance()->widgets_manager->register( new Advanced_Accordion() );

View File

@@ -0,0 +1,800 @@
<?php
/**
* Class: Advanced_Google_Map
* Name: Advanced Google Map
* Slug: advanced-google-map
*/
namespace Stratum;
use \Elementor\Controls_Manager;
use \Elementor\Utils;
use Elementor\Repeater;
use \Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Advanced_Google_Map extends Stratum_Widget_Base {
protected $widget_name = 'advanced-google-map';
public function __construct($data = [], $args = null) {
parent::__construct( $data, $args );
}
public function get_title() {
return esc_html__( 'Advanced Google Map', 'stratum' );
}
public function get_icon() {
return 'stratum-icon-advanced-google-map';
}
public function get_categories() {
return [ 'stratum-widgets' ];
}
public function get_script_depends() {
return [
'google-map-api',
'google-map-styles'
];
}
protected function register_controls() {
$controls = $this;
/*-----------------------------------------------------------------------------------*/
/* Content Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'general_settings',
[
'label' => esc_html__( 'General Settings', 'stratum' )
]
);
$controls->add_control(
'map_type_setup',
[
'label' => esc_html__( 'Google Map Type', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'single',
'label_block' => false,
'options' => [
'single' => esc_html__( 'Single', 'stratum' ),
'multiple' => esc_html__( 'Multiple Marker', 'stratum' )
],
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'interaction',
[
'label' => esc_html__( 'Zoom & Pan Interaction', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'cooperative',
'label_block' => false,
'separator' => 'after',
'description' => esc_html__( 'These options are applied on frontend only.', 'stratum' ),
'options' => [
'cooperative' => esc_html__( 'Prevent zoom on page scroll', 'stratum' ),
'greedy' => esc_html__( 'Enable zoom and pan', 'stratum' ),
'none' => esc_html__( ' Disable zoom and pan' , 'stratum' )
],
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'zoom_level',
[
'label' => esc_html__( 'Zoom Level', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 2,
'unit' => 'px'
],
'range' => [
'px' => [
'min' => 1,
'max' => 22
]
],
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'map_lat',
[
'label' => esc_html__( 'Center Latitude', 'stratum' ),
'type' => Controls_Manager::TEXT,
'label_block' => false,
'render_type' => 'none',
'frontend_available' => true,
'default' => esc_html__( '48.208174', 'stratum' )
]
);
$controls->add_control(
'map_lng',
[
'label' => esc_html__( 'Center Longitude', 'stratum' ),
'type' => Controls_Manager::TEXT,
'label_block' => false,
'render_type' => 'none',
'frontend_available' => true,
'default' => esc_html__( '16.373819', 'stratum' )
]
);
$controls->end_controls_section();
/*-----------------------------------------------------------------------------------*/
/* Map Marker Settings Tab
/*-----------------------------------------------------------------------------------*/
/**
* Map Settings (With Marker only for single)
*/
$controls->start_controls_section(
'map_marker_section',
[
'label' => esc_html__( 'Map Marker Settings', 'stratum' ),
'condition' => [
'map_type_setup' => ['single']
]
]
);
$controls->add_control(
'marker_title',
[
'label' => esc_html__( 'Title', 'stratum' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'default' => esc_html__( 'Marker', 'stratum' ),
'placeholder' => esc_html__( 'Type your title here...', 'stratum' ),
'condition' => [
'map_type_setup' => ['single']
],
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'marker_type_setup',
[
'label' => esc_html__( 'Address Type', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'address' => [
'title' => esc_html__( 'Address', 'stratum' ),
'icon' => 'fa fa-map'
],
'coordinates' => [
'title' => esc_html__( 'Coordinates', 'stratum' ),
'icon' => 'fa fa-map-marker'
]
],
'default' => 'coordinates',
'condition' => [
'map_type_setup' => ['single']
],
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'map_geo_address',
[
'label' => esc_html__( 'Geo Address', 'stratum' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'default' => esc_html__( 'Wien, Austria', 'stratum' ),
'condition' => [
'map_type_setup' => ['single'],
'marker_type_setup' => ['address']
],
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'marker_lat',
[
'label' => esc_html__( 'Marker Latitude', 'stratum' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'default' => esc_html__( '48.208174', 'stratum' ),
'condition' => [
'map_type_setup' => ['single'],
'marker_type_setup' => ['coordinates']
],
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'marker_lng',
[
'label' => esc_html__( 'Marker Longitude', 'stratum' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'default' => esc_html__( '16.373819', 'stratum' ),
'condition' => [
'map_type_setup' => ['single'],
'marker_type_setup' => ['coordinates']
],
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'marker_content',
[
'label' => esc_html__( 'Content', 'stratum' ),
'type' => Controls_Manager::TEXTAREA,
'label_block' => true,
'default' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'stratum' ),
'placeholder' => esc_html__( 'Type your content here...', 'stratum' ),
'condition' => [
'map_type_setup' => ['single']
],
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'is_open_popup',
[
'label' => esc_html__( 'Opened by default', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'label_on' => esc_html__( 'Yes', 'stratum' ),
'label_off' => esc_html__( 'No' , 'stratum' ),
'condition' => [
'map_type_setup' => ['single']
],
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'popup_max_width',
[
'label' => esc_html__( 'Popup Width', 'stratum' ),
'type' => Controls_Manager::NUMBER,
'label_block' => false,
'default' => 250,
'condition' => [
'map_type_setup' => ['single']
],
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'use_custom_icon',
[
'label' => esc_html__( 'Use Custom Icon', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'label_on' => esc_html__( 'Yes', 'stratum' ),
'label_off' => esc_html__( 'No' , 'stratum' ),
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'marker_icon',
[
'label' => esc_html__( 'Custom Icon', 'stratum' ),
'type' => Controls_Manager::MEDIA,
'condition' => [
'use_custom_icon' => 'yes'
],
'default' => [ 'url' => '' ],
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'marker_icon_width',
[
'label' => esc_html__( 'Icon Width', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 32,
'unit' => 'px'
],
'range' => [
'px' => [
'max' => 150
]
],
'condition' => [
'use_custom_icon' => 'yes',
'marker_icon[url]!' => ''
],
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'marker_icon_height',
[
'label' => esc_html__( 'Icon Height', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 32,
'unit' => 'px'
],
'range' => [
'px' => [
'max' => 150
]
],
'condition' => [
'use_custom_icon' => 'yes',
'marker_icon[url]!' => ''
],
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->end_controls_section();
/**
* Map Settings (With Markers only for Multiple)
*/
$controls->start_controls_section(
'map_markers_section',
[
'label' => esc_html__( 'Map Marker Settings', 'stratum' ),
'condition' => [
'map_type_setup' => ['multiple']
]
]
);
$markersRepeater = new Repeater();
$markersRepeater->add_control(
'marker_title',
[
'label' => esc_html__( 'Title', 'stratum' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'default' => esc_html__( 'Marker', 'stratum' ),
'placeholder' => esc_html__( 'Type your title here...', 'stratum' )
]
);
$markersRepeater->add_control(
'marker_lat',
[
'label' => esc_html__( 'Marker Latitude', 'stratum' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'default' => esc_html__( '48.208174', 'stratum' )
]
);
$markersRepeater->add_control(
'marker_lng',
[
'label' => esc_html__( 'Marker Longitude', 'stratum' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'default' => esc_html__( '16.373819', 'stratum' )
]
);
$markersRepeater->add_control(
'marker_content',
[
'label' => esc_html__( 'Content', 'stratum' ),
'type' => Controls_Manager::TEXTAREA,
'label_block' => true,
'default' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'stratum' ),
'placeholder' => esc_html__( 'Type your content here...', 'stratum' )
]
);
$markersRepeater->add_control(
'is_open_popup',
[
'label' => esc_html__( 'Opened by default', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'label_on' => esc_html__( 'Yes', 'stratum' ),
'label_off' => esc_html__( 'No', 'stratum' )
]
);
$markersRepeater->add_control(
'popup_max_width',
[
'label' => esc_html__( 'Popup Width', 'stratum' ),
'type' => Controls_Manager::NUMBER,
'label_block' => false,
'default' => 250
]
);
$markersRepeater->add_control(
'use_custom_icon',
[
'label' => esc_html__( 'Use Custom Icon', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'label_on' => esc_html__( 'Yes', 'stratum' ),
'label_off' => esc_html__( 'No', 'stratum' )
]
);
$markersRepeater->add_control(
'marker_icon',
[
'label' => esc_html__( 'Custom Icon', 'stratum' ),
'type' => Controls_Manager::MEDIA,
'condition' => [
'use_custom_icon' => 'yes'
],
'default' => [ 'url' => '' ]
]
);
$markersRepeater->add_control(
'marker_icon_width',
[
'label' => esc_html__( 'Icon Width', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 32,
'unit' => 'px',
],
'range' => [
'px' => [
'max' => 150
]
],
'condition' => [
'use_custom_icon' => 'yes',
'marker_icon[url]!' => ''
]
]
);
$markersRepeater->add_control(
'marker_icon_height',
[
'label' => esc_html__( 'Icon Height', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 32,
'unit' => 'px',
],
'range' => [
'px' => [
'max' => 150
]
],
'condition' => [
'use_custom_icon' => 'yes',
'marker_icon[url]!' => ''
]
]
);
$controls->add_control(
'markers',
[
'label' => '',
'type' => Controls_Manager::REPEATER,
'title_field' => '<i class="fa fa-map-marker" aria-hidden="true"></i> {{{ marker_title }}}',
'default' => [
[ 'marker_title' => esc_html__( 'Marker', 'stratum' ) ]
],
'item_actions' => [ 'sort' => false ],
'fields' => $markersRepeater->get_controls()
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'map_controls',
[
'label' => esc_html__( 'Map Controls', 'stratum' )
]
);
$controls->add_control(
'street_view_control',
[
'label' => esc_html__( 'Street View Controls', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'label_on' => esc_html__( 'On', 'stratum' ),
'label_off' => esc_html__( 'Off', 'stratum' ),
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'map_type_control',
[
'label' => esc_html__( 'Map Type Control', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'label_on' => esc_html__( 'On', 'stratum' ),
'label_off' => esc_html__( 'Off', 'stratum' ),
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'zoom_control',
[
'label' => esc_html__( 'Zoom Control', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'label_on' => esc_html__( 'On', 'stratum' ),
'label_off' => esc_html__( 'Off', 'stratum' ),
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'fullscreen_control',
[
'label' => esc_html__( 'Fullscreen Control', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'label_on' => esc_html__( 'On', 'stratum' ),
'label_off' => esc_html__( 'Off', 'stratum' ),
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->end_controls_section();
/*-----------------------------------------------------------------------------------*/
/* Map Marker Style Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'section_map_style_controls',
[
'label' => esc_html__( 'General Style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE
]
);
$controls->add_responsive_control(
'map_height',
[
'label' => esc_html__( 'Height', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 480,
'unit' => 'px'
],
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 1400,
'step' => 10
]
],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-google-map__container' => 'height: {{SIZE}}{{UNIT}};'
],
'render_type' => 'ui'
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'map_theme',
[
'label' => esc_html__( 'Map Theme', 'stratum' )
]
);
$controls->add_control(
'map_theme_source',
[
'label' => esc_html__( 'Theme Source', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'standard' => [
'title' => esc_html__( 'Google Standard', 'stratum' ),
'icon' => 'fa fa-map'
],
'snazzymaps' => [
'title' => esc_html__( 'Snazzy Maps', 'stratum' ),
'icon' => 'fa fa-map-marker'
],
'custom' => [
'title' => esc_html__( 'Custom', 'stratum' ),
'icon' => 'fa fa-edit'
]
],
'default' => 'standard',
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'map_standards_styles',
[
'label' => esc_html__( 'Google Themes', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'standard',
'options' => [
'standard' => esc_html__( 'Standard' , 'stratum' ),
'silver' => esc_html__( 'Silver' , 'stratum' ),
'retro' => esc_html__( 'Retro' , 'stratum' ),
'dark' => esc_html__( 'Dark' , 'stratum' ),
'night' => esc_html__( 'Night' , 'stratum' ),
'aubergine' => esc_html__( 'Aubergine' , 'stratum' )
],
'description' => sprintf( '<a href="https://mapstyle.withgoogle.com/" target="_blank">%1$s</a> %2$s', esc_html__( 'Click here', 'stratum' ), esc_html__( 'to generate your own theme and use JSON within a Custom style field.', 'stratum' ) ),
'condition' => [
'map_theme_source' => 'standard'
],
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'map_snazzy_styles',
[
'label' => esc_html__( 'Snazzy Maps Themes', 'stratum' ),
'type' => Controls_Manager::SELECT,
'label_block' => true,
'default' => 'blueWater',
'options' => [
'blueWater' => esc_html__( 'Blue Water' , 'stratum' ),
'ultraLight' => esc_html__( 'Ultra Light' , 'stratum' ),
'silverFox' => esc_html__( 'Silver Fox' , 'stratum' ),
'shadesOfGrey' => esc_html__( 'Shades of Grey', 'stratum' ),
'noLabels' => esc_html__( 'No Labels' , 'stratum' ),
'trekWild' => esc_html__( 'Trek Wild' , 'stratum' ),
'vintage' => esc_html__( 'Vintage' , 'stratum' ),
'wireframe' => esc_html__( 'Wireframe' , 'stratum' ),
'lightDream' => esc_html__( 'Light Dream' , 'stratum' )
],
'description' => sprintf( '<a href="https://snazzymaps.com/explore" target="_blank">%1$s</a> %2$s', esc_html__( 'Click here', 'stratum' ), esc_html__( 'to explore more themes and use JSON within a custom style field.', 'stratum' ) ),
'condition' => [
'map_theme_source'=> 'snazzymaps'
],
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->add_control(
'map_custom_style',
[
'label' => esc_html__( 'Custom Style', 'stratum' ),
'description' => sprintf( '<a href="https://mapstyle.withgoogle.com/" target="_blank">%1$s</a> %2$s', esc_html__( 'Click here', 'stratum' ), esc_html__( 'to get JSON style code to style your map', 'stratum' ) ),
'type' => Controls_Manager::TEXTAREA,
'condition' => [
'map_theme_source' => 'custom'
],
'render_type' => 'none',
'frontend_available' => true
]
);
$controls->end_controls_section();
}
protected function render() {
$this->render_widget( 'php' );
}
protected function content_template() {}
public function render_plain_content( $instance = [] ) {}
public function get_single_marker_option($marker) {
$single_options = [
'markerTitle' => $marker[ 'marker_title' ],
'markerContent' => $marker[ 'marker_content' ],
'popupMaxWidth' => $marker[ 'popup_max_width' ],
'isOpenPopup' => !empty( $marker[ 'is_open_popup' ] ) ? true : false
];
if ( $marker[ 'use_custom_icon' ] ) {
$custom_icon = [
'markerIcon' => $marker[ 'marker_icon' ],
'markerIconWidth' => $marker[ 'marker_icon_width' ],
'markerIconHeight' => $marker[ 'marker_icon_height' ]
];
$single_options[ 'customIcon' ] = $custom_icon;
}
return $single_options;
}
public function get_markers_options($settings) {
$map_markers_amount = $settings[ 'map_type_setup' ];
if ( $map_markers_amount == 'multiple' ) {
$markers_options = [];
foreach ( $settings[ 'markers' ] as $marker ) {
$marker_coords = [
'markerLat' => $marker[ 'marker_lat' ],
'markerLng' => $marker[ 'marker_lng' ]
];
$marker_options = $this->get_single_marker_option( $marker );
$markers_options []= array_merge( $marker_options, $marker_coords );
}
return $markers_options;
} else {
$marker_options = [];
$type_setup = $settings[ 'marker_type_setup' ];
if ( $type_setup == 'coordinates' ) {
$marker_coords = [
'markerLat' => $settings[ 'marker_lat' ],
'markerLng' => $settings[ 'marker_lng' ]
];
$marker_options []= array_merge( $marker_coords, $this->get_single_marker_option( $settings ) );
} else {
$geo = [ 'mapGeoAddress' => $settings[ 'map_geo_address' ] ];
$marker_options []= array_merge( $geo, $this->get_single_marker_option( $settings ) );
}
return $marker_options;
}
}
public function set_map_theme_style($settings) {
$theme_source = $settings[ 'map_theme_source' ];
$standards_styles = $settings[ 'map_standards_styles' ];
$snazzy_styles = $settings[ 'map_snazzy_styles' ];
if ( $theme_source == 'standard' ) {
return $standards_styles;
} else if ( $theme_source == 'snazzymaps' ) {
return $snazzy_styles;
} else {
return json_decode(strip_tags(
$settings[ 'map_custom_style' ]
));
}
}
}
Plugin::instance()->widgets_manager->register( new Advanced_Google_Map() );

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,999 @@
<?php
/**
* Class: Advanced_Tabs
* Name: Advanced Tabs
* Slug: advanced-tabs
*/
namespace Stratum;
use Elementor\Core\Base\Document;
use \Elementor\Group_Control_Background;
use \Elementor\Group_Control_Border;
use \Elementor\Group_Control_Box_Shadow;
use \Elementor\Controls_Manager;
use \Elementor\Utils;
use \Elementor\Plugin;
use \Elementor\Repeater;
use Stratum\Managers\Ajax_Manager;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Advanced_Tabs extends Stratum_Widget_Base {
protected $widget_name = 'advanced-tabs';
public function __construct($data = [], $args = null) {
parent::__construct( $data, $args );
}
public function get_title() {
return esc_html__( 'Advanced Tabs', 'stratum' );
}
public function get_script_depends() {
return [
'font-awesome-4-shim'
];
}
public function get_style_depends() {
return [
'font-awesome-5-all',
'font-awesome-4-shim'
];
}
public function get_keywords() {
return [ 'tabs', 'content', 'template' ];
}
public function get_icon() {
return 'stratum-icon-advanced-tabs';
}
public function get_categories() {
return [ 'stratum-widgets' ];
}
protected function register_controls() {
$controls = $this;
$background_color = !empty(get_option( 'stratum_style' )) ? (!empty(get_option( 'stratum_style' )['background_color']) ? get_option( 'stratum_style' )['background_color'] : '') : '#71d7f7';
$background_color_active = !empty(get_option( 'stratum_style' )) ? (!empty(get_option( 'stratum_style' )['background_color_active']) ? get_option( 'stratum_style' )['background_color_active'] : '') : '#0097c6';
$background_color_hover = !empty(get_option( 'stratum_style' )) ? (!empty(get_option( 'stratum_style' )['background_color_hover']) ? get_option( 'stratum_style' )['background_color_hover'] : '') : '#008fbc';
$document_types = Plugin::instance()->documents->get_document_types( [
'show_in_library' => true,
] );
/*-----------------------------------------------------------------------------------*/
/* Content Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'section_general',
[
'label' => esc_html__( 'General', 'stratum' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$controls->add_control(
'tabs_layout',
[
'label' => esc_html__('Tabs Layout', 'stratum'),
'type' => Controls_Manager::SELECT,
'default' => 'horizontal',
'label_block' => false,
'options' => [
'horizontal' => esc_html__('Horizontal', 'stratum'),
'vertical' => esc_html__('Vertical', 'stratum'),
'icon_box' => esc_html__('Icon Box', 'stratum'),
],
]
);
$controls->add_control(
'tabs_interactivity',
[
'label' => esc_html__( 'Interactivity', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'click',
'options' => [
'click' => esc_html__( 'Click', 'stratum' ),
'mouseenter' => esc_html__( 'Hover', 'stratum' )
],
]
);
$repeater = new Repeater();
$repeater->add_control(
'tab_title',
[
'label' => esc_html__( 'Title', 'stratum' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Title', 'stratum' ),
'dynamic' => [ 'active' => true ]
]
);
$repeater->add_control(
'tab_icon',
[
'label' => esc_html__( 'Icon', 'stratum' ),
'type' => Controls_Manager::ICONS,
'default' => [
'value' => 'fas fa-home',
'library' => 'solid',
],
]
);
$repeater->add_control(
'content_type',
[
'label' => esc_html__('Content Type', 'stratum'),
'type' => Controls_Manager::SELECT,
'default' => 'text',
'label_block' => false,
'options' => [
'text' => esc_html__('Text', 'stratum'),
'template' => esc_html__('Template', 'stratum'),
],
]
);
$repeater->add_control(
'tab_text',
[
'label' => esc_html__( 'Text', 'stratum' ),
'type' => Controls_Manager::WYSIWYG,
'default' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'stratum' ),
'dynamic' => [ 'active' => true ],
'condition' => [
'content_type' => 'text'
],
]
);
$repeater->add_control(
'tab_template',
[
'label' => esc_html__('Template', 'stratum'),
'type' => Stratum_AJAX_Control::QUERY,
'label_block' => true,
'multiple' => false,
'ajax_route' => 'stratum_get_elementor_templates',
'autocomplete' => [
'object' => 'library_template',
'query' => [
'meta_query' => [
[
'key' => Document::TYPE_META_KEY,
'value' => array_keys( $document_types ),
'compare' => 'IN',
],
],
],
],
'options' => Ajax_Manager::stratum_get_elementor_templates(),
'condition' => [
'content_type' => 'template'
],
'description' => esc_html__( 'Here you can see sections you saved as templates.', 'stratum' ),
]
);
$repeater->add_control(
'manage_templates',
[
'label' => esc_html__( 'Manage Templates', 'stratum' ),
'label_block' => false,
'type' => Controls_Manager::BUTTON,
'button_type' => 'success',
'text' => esc_html__( 'Library', 'stratum' ),
'event' => 'stratum:OpenTemplatesLibrary',
'condition' => [
'content_type' => 'template'
],
]
);
$repeater->add_control(
'active',
[
'label' => esc_html__( 'Active by default', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
]
);
$controls->add_control(
'tabs_items',
[
'label' => esc_html__( 'Tab items', 'stratum' ),
'title_field' => '<i class="{{ tab_icon.value }}" aria-hidden="true"></i> {{{ tab_title }}}',
'type' => Controls_Manager::REPEATER,
'fields' => $repeater->get_controls(),
'show_label' => true,
'default' => [
[
'text' => sprintf( esc_html__( 'Item #%d', 'stratum' ), 1 )
]
]
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'section_navigation_panel',
[
'label' => esc_html__( 'Navigation Panel Style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->add_responsive_control(
'nav_panel_width',
[
'label' => esc_html__( 'Navigation Width', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'%' => [
'min' => 0,
'max' => 50,
],
'px' => [
'min' => 0,
'max' => 500,
],
],
'default' => [
'size' => '15',
'unit' => '%',
],
'size_units' => [ '%', 'px' ],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs.tabs-layout-vertical .stratum-advanced-tabs__navigation' => 'min-width: {{SIZE}}{{UNIT}};',
],
'condition' => [
'tabs_layout' => ['vertical']
],
]
);
$controls->add_control(
'tabs_spacing',
[
'label' => esc_html__( 'Spacing between tabs', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'size' => 5,
],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs.tabs-layout-horizontal .stratum-advanced-tabs__navigation-item:not(:last-child)' => 'margin-right: {{SIZE}}{{UNIT}}',
'{{WRAPPER}} .stratum-advanced-tabs.tabs-layout-vertical .stratum-advanced-tabs__navigation-item:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}}',
'{{WRAPPER}} .stratum-advanced-tabs.tabs-layout-icon_box .stratum-advanced-tabs__navigation-item:not(:last-child)' => 'margin-right: {{SIZE}}{{UNIT}}',
],
]
);
$controls->add_control(
'nav_panel_postion_horizontal',
[
'label' => esc_html__( 'Tabs Position', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'top',
'prefix_class' => 'stratum-advanced-tabs-nav-horizontal-position-',
'toggle' => false,
'options' => [
'top' => [
'title' => esc_html__( 'Top', 'stratum' ),
'icon' => 'eicon-v-align-top',
],
'bottom' => [
'title' => esc_html__( 'Bottom', 'stratum' ),
'icon' => 'eicon-v-align-bottom',
],
],
'condition' => [
'equal_height' => 'yes',
'tabs_layout' => ['horizontal', 'icon_box']
],
]
);
$controls->add_control(
'nav_panel_postion_vertical',
[
'label' => esc_html__( 'Tabs Position', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'left',
'prefix_class' => 'stratum-advanced-tabs-nav-vertical-position-',
'toggle' => false,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'eicon-h-align-left',
],
'right' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'eicon-h-align-right',
],
],
'condition' => [
'tabs_layout' => 'vertical'
],
]
);
$controls->add_control(
'nav_panel_align_horizontal',
[
'label' => esc_html__( 'Tabs Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'left',
'prefix_class' => 'stratum-advanced-tabs-nav-horizontal-align-',
'toggle' => false,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'eicon-h-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'stratum' ),
'icon' => 'eicon-h-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'eicon-h-align-right',
],
'stretch' => [
'title' => esc_html__( 'Stretch', 'stratum' ),
'icon' => 'eicon-h-align-stretch',
],
],
'condition' => [
'tabs_layout' => ['horizontal', 'icon_box']
],
]
);
$controls->add_control(
'nav_panel_align_vertical',
[
'label' => esc_html__( 'Tabs Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'top',
'prefix_class' => 'stratum-advanced-tabs-nav-vertical-align-',
'toggle' => false,
'options' => [
'top' => [
'title' => esc_html__( 'Top', 'stratum' ),
'icon' => 'eicon-v-align-top',
],
'middle' => [
'title' => esc_html__( 'Middle', 'stratum' ),
'icon' => 'eicon-v-align-middle',
],
'bottom' => [
'title' => esc_html__( 'Bottom', 'stratum' ),
'icon' => 'eicon-v-align-bottom',
],
'stretch' => [
'title' => esc_html__( 'Stretch', 'stratum' ),
'icon' => 'eicon-v-align-stretch',
],
],
'condition' => [
'tabs_layout' => 'vertical'
],
]
);
$controls->add_responsive_control(
'nav_panel_padding',
[
'label' => esc_html__( 'Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_responsive_control(
'nav_panel_margin',
[
'label' => esc_html__( 'Margin', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'nav_panel_border',
'label' => esc_html__( 'Border', 'stratum' ),
'selector' => '{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation',
'separator' => 'before',
]
);
$controls->add_responsive_control(
'nav_panel_border_radius',
[
'label' => esc_html__( 'Border Radius', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'condition' => [
'nav_panel_border_border!' => ''
],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'nav_panel_shadow',
'separator' => 'before',
'selector' => '{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation',
]
);
$controls->add_control(
'nav_panel_background_color',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'value' => '',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation' => 'background-color: {{VALUE}}',
]
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'section_navigation_items',
[
'label' => esc_html__( 'Tabs Style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'nav_items_typography',
'selector' => '{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__title',
'label' => esc_html__( 'Typography', 'stratum' ),
'render_type' => 'template',
'defaults' => [
'html_tag' => 'h3',
],
]
);
$controls->add_responsive_control(
'nav_items_padding',
[
'label' => esc_html__( 'Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_responsive_control(
'nav_items_margin',
[
'label' => esc_html__( 'Margin', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation-item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'nav_items_border',
'label' => esc_html__( 'Border', 'stratum' ),
'selector' => '{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation-item',
'separator' => 'before',
]
);
$controls->add_responsive_control(
'nav_items_border_radius',
[
'label' => esc_html__( 'Border Radius', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'condition' => [
'nav_items_border_border!' => ''
],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'nav_items_shadow',
'separator' => 'before',
'selector' => '{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation-item',
]
);
$controls->start_controls_tabs( 'nav_items_styles' );
$controls->start_controls_tab(
'nav_items_normal',
array(
'label' => esc_html__( 'Normal', 'stratum' ),
)
);
$controls->add_control(
'custom_nav_items_color',
[
'label' => esc_html__( 'Title Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'value' => '',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation-item' => 'color: {{VALUE}}',
]
]
);
$controls->add_control(
'custom_nav_items_background_color',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => $background_color,
'value' => '',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation-item' => 'background-color: {{VALUE}}',
]
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'active_normal',
array(
'label' => esc_html__( 'Active', 'stratum' ),
)
);
$controls->add_control(
'custom_active_nav_items_color',
[
'label' => esc_html__( 'Title Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'value' => '',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation-item.active-nav' => 'color: {{VALUE}}',
]
]
);
$controls->add_control(
'custom_active_nav_items_background_color',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => $background_color_active,
'value' => '',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation-item.active-nav' => 'background-color: {{VALUE}}',
]
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'nav_items_hover',
array(
'label' => esc_html__( 'Hover', 'stratum' ),
)
);
$controls->add_control(
'custom_hover_nav_items_color',
[
'label' => esc_html__( 'Title Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'value' => '',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation-item:hover' => 'color: {{VALUE}}',
]
]
);
$controls->add_control(
'custom_hover_nav_items_background_color',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => $background_color_hover,
'value' => '',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation-item:hover' => 'background-color: {{VALUE}}',
]
]
);
$controls->end_controls_tab();
$controls->end_controls_tabs();
$controls->end_controls_section();
$controls->start_controls_section(
'section_style_icon',
[
'label' => esc_html__( 'Icon style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->add_control(
'icon_position_horizontal',
[
'label' => esc_html__( 'Icon position', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'left',
'prefix_class' => 'stratum-advanced-tabs-icons-horizontal-position-',
'toggle' => false,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'eicon-h-align-left',
],
'right' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'eicon-h-align-right',
],
],
'condition' => [
'tabs_layout' => ['horizontal', 'vertical']
],
]
);
$controls->add_control(
'icon_position_vertical',
[
'label' => esc_html__( 'Icon position', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'top',
'prefix_class' => 'stratum-advanced-tabs-icons-vertical-position-',
'toggle' => false,
'options' => [
'top' => [
'title' => esc_html__( 'Top', 'stratum' ),
'icon' => 'eicon-v-align-top',
],
'bottom' => [
'title' => esc_html__( 'Bottom', 'stratum' ),
'icon' => 'eicon-v-align-bottom',
],
],
'condition' => [
'tabs_layout' => 'icon_box'
],
]
);
$controls->add_control(
'icon_size',
[
'label' => esc_html__( 'Icon Size', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'size' => 16,
],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__icon i' => 'font-size: {{SIZE}}{{UNIT}}',
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__icon svg' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}}',
],
]
);
$controls->add_control(
'icon_spacing',
[
'label' => esc_html__( 'Spacing', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'size' => 10,
],
'selectors' => [
'{{WRAPPER}}.stratum-advanced-tabs-icons-horizontal-position-left .stratum-advanced-tabs .stratum-advanced-tabs__icon' => 'margin-right: {{SIZE}}{{UNIT}}',
'{{WRAPPER}}.stratum-advanced-tabs-icons-horizontal-position-right .stratum-advanced-tabs .stratum-advanced-tabs__icon' => 'margin-left: {{SIZE}}{{UNIT}}',
'{{WRAPPER}}.stratum-advanced-tabs-icons-vertical-position-top .stratum-advanced-tabs .stratum-advanced-tabs__icon' => 'margin-bottom: {{SIZE}}{{UNIT}}',
'{{WRAPPER}}.stratum-advanced-tabs-icons-vertical-position-bottom .stratum-advanced-tabs .stratum-advanced-tabs__icon' => 'margin-top: {{SIZE}}{{UNIT}}',
],
]
);
$controls->start_controls_tabs( 'icons_styles' );
$controls->start_controls_tab(
'icon_normal',
array(
'label' => esc_html__( 'Normal', 'stratum' ),
)
);
$controls->add_control(
'icon_color',
[
'label' => esc_html__( 'Icon Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation-item .stratum-advanced-tabs__icon' => 'color: {{VALUE}}',
],
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'icon_active',
array(
'label' => esc_html__( 'Active', 'stratum' ),
)
);
$controls->add_control(
'icon_active_color',
[
'label' => esc_html__( 'Icon Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation-item.active-nav .stratum-advanced-tabs__icon' => 'color: {{VALUE}}',
],
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'icon_hover',
array(
'label' => esc_html__( 'Hover', 'stratum' ),
)
);
$controls->add_control(
'icon_hover_color',
[
'label' => esc_html__( 'Icon Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__navigation-item:hover .stratum-advanced-tabs__icon' => 'color: {{VALUE}}',
],
]
);
$controls->end_controls_tab();
$controls->end_controls_tabs();
$controls->end_controls_section();
$controls->start_controls_section(
'section_style_content',
[
'label' => esc_html__( 'Content style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->add_control(
'content_animation',
[
'label' => esc_html__( 'Animation', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'none',
'options' => [
'none' => esc_html__( 'None', 'stratum' ),
'slide' => esc_html__( 'Slide', 'stratum' ),
'fade' => esc_html__( 'Fade', 'stratum' ),
],
]
);
$controls->add_control(
'equal_height',
[
'label' => esc_html__( 'Equal container height', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
]
);
$controls->add_control(
'custom_content_color',
[
'label' => esc_html__( 'Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'value' => '',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__content-item .stratum-advanced-tabs__text' => 'color: {{VALUE}}',
]
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'content_typography',
'selector' => '{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__content-item .stratum-advanced-tabs__text',
'label' => esc_html__( 'Typography', 'stratum' ),
'render_type' => 'template',
'defaults' => [
'html_tag' => 'h3',
],
]
);
$controls->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'content_background',
'types' => ['classic', 'gradient'],
'selector' => '{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__content',
]
);
$controls->add_control(
'content_background_overlay',
[
'label' => esc_html__( 'Background Overlay', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__content-overlay' => 'background-color: {{VALUE}};'
],
'condition' => [
'content_background_image[id]!' => ''
]
]
);
$controls->add_responsive_control(
'content_padding',
[
'label' => esc_html__( 'Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'separator' => 'before',
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_responsive_control(
'content_margin',
[
'label' => esc_html__( 'Margin', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__content' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'content_border',
'separator' => 'before',
'label' => esc_html__( 'Border', 'stratum' ),
'selector' => '{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__content',
]
);
$controls->add_responsive_control(
'content_border_radius',
[
'label' => esc_html__( 'Border Radius', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'condition' => [
'content_border_border!' => ''
],
'selectors' => [
'{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'content_shadow',
'selector' => '{{WRAPPER}} .stratum-advanced-tabs .stratum-advanced-tabs__content',
]
);
$controls->end_controls_section();
}
//PHP template (refresh elements)
protected function render() {
$this->render_widget( 'php' );
}
//JavaScript "Backbone" template (live preview)
protected function content_template() {
}
public function render_plain_content( $instance = [] ) {}
}
Plugin::instance()->widgets_manager->register( new Advanced_Tabs() );

View File

@@ -0,0 +1,553 @@
<?php
/**
* Class: Banner
* Name: Banner
* Slug: stratum-banner
*/
namespace Stratum;
use \Elementor\Controls_Manager;
use \Elementor\Utils;
use \Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Banner extends Stratum_Widget_Base {
protected $widget_name = 'banner';
public function get_title() {
return esc_html__( 'Banner', 'stratum' );
}
public function get_icon() {
return 'stratum-icon-banner';
}
public function get_categories() {
return [ 'stratum-widgets' ];
}
protected function register_controls() {
$controls = $this;
//Colors
$theme_colors_first_color = '#080808';
/*-----------------------------------------------------------------------------------*/
/* Content Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'section_content',
[
'label' => esc_html__( 'Content', 'stratum' )
]
);
$controls->add_control(
'image',
[
'label' => esc_html__( 'Image', 'stratum' ),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src()
],
'dynamic' => [ 'active' => true ],
'condition' => [
'background_type' => 'image'
]
]
);
$controls->add_control(
'image_size',
[
'type' => 'select',
'label' => esc_html__( 'Image Size', 'stratum' ),
'default' => 'full',
'options' => Stratum::get_instance()->get_scripts_manager()->get_image_sizes(),
'condition' => [
'background_type' => 'image'
]
]
);
$this->add_control(
'hosted_url',
[
'label' => esc_html__( 'Choose File', 'stratum' ),
'type' => Controls_Manager::MEDIA,
'media_type' => 'video',
'condition' => [
'background_type' => 'video'
]
]
);
$controls->add_control(
'background_type',
array(
'type' => 'select',
'label' => esc_html__( 'Background Type', 'stratum' ),
'default' => 'image',
'options' => [
'image' => esc_html__( 'Image', 'stratum' ),
'video' => esc_html__( 'Video', 'stratum' )
]
)
);
$controls->add_control(
'title',
[
'label' => esc_html__( 'Title', 'stratum' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Title', 'stratum' ),
'dynamic' => [ 'active' => true ]
]
);
$controls->add_control(
'text',
[
'label' => esc_html__( 'Description', 'stratum' ),
'type' => Controls_Manager::TEXTAREA,
'default' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'stratum' ),
'dynamic' => [ 'active' => true ]
]
);
$controls->add_control(
'link',
[
'label' => esc_html__( 'Link', 'stratum' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Paste URL or type to search', 'stratum' )
]
);
$controls->add_control(
'link_target',
[
'label' => esc_html__( 'Open link in new window', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'return_value' => '_blank',
'condition' => [
'link!' => ''
]
]
);
$controls->add_control(
'link_rel',
[
'label' => esc_html__( 'Add nofollow', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'return_value' => 'nofollow',
'condition' => [
'link!' => ''
]
]
);
$controls->end_controls_section();
/*-----------------------------------------------------------------------------------*/
/* Style Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'section_style',
[
'label' => esc_html__( 'Style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE
]
);
$controls->add_responsive_control(
'height',
[
'label' => esc_html__( 'Banner Height', 'stratum' ),
'type' => Controls_Manager::NUMBER,
'dynamic' => [ 'active' => true ],
'default' => '',
'selectors' => [
'{{WRAPPER}} .stratum-banner__wrapper' => 'height: {{VALUE}}px;'
]
]
);
$controls->add_responsive_control(
'block_paddings',
[
'label' => esc_html__( 'Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'selectors' => [
'{{WRAPPER}} .stratum-banner .stratum-banner__content-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_control(
'animation_effect',
[
'label' => esc_html__( 'Animation Effect', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'aries',
'options' => [
'none' => esc_html__( 'None' , 'stratum' ),
'aries' => esc_html__( 'Aries' , 'stratum' ),
'taurus' => esc_html__( 'Taurus', 'stratum' ),
'gemini' => esc_html__( 'Gemini', 'stratum' ),
'cancer' => esc_html__( 'Cancer', 'stratum' ),
'leo' => esc_html__( 'Leo' , 'stratum' ),
'virgo' => esc_html__( 'Virgo' , 'stratum' )
]
]
);
$controls->add_control(
'text_animation_effect',
[
'label' => esc_html__( 'Text Animation Effect', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'none',
'options' => [
'none' => esc_html__( 'None' , 'stratum' ),
'opacity' => esc_html__( 'Fade In' , 'stratum' ),
'opacity-top' => esc_html__( 'Fade In Up' , 'stratum' ),
'opacity-bottom' => esc_html__( 'Fade In Down' , 'stratum' ),
'opacity-left' => esc_html__( 'Fade In Left' , 'stratum' ),
'opacity-right' => esc_html__( 'Fade In Right', 'stratum' ),
'opacity-zoom-in' => esc_html__( 'Zoom In' , 'stratum' ),
'opacity-zoom-out' => esc_html__( 'Zoom Out' , 'stratum' )
]
]
);
$controls->add_responsive_control(
'title_align',
[
'label' => esc_html__( 'Title Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'left',
'toggle' => false,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'fa fa-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'stratum' ),
'icon' => 'fa fa-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'fa fa-align-right',
],
],
'selectors' => [
'{{WRAPPER}} .stratum-banner .stratum-banner__title' => 'text-align: {{VALUE}};',
],
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'selector' => '{{WRAPPER}} .stratum-banner__title',
'label' => esc_html__( 'Title Typography', 'stratum' ),
'render_type' => 'template',
'condition' => [
'title!' => ''
],
'defaults' => [
'html_tag' => 'h5',
],
]
);
$controls->add_control(
'title_width',
[
'label' => esc_html__( 'Title Width', 'stratum' ),
'type' => Controls_Manager::NUMBER,
'dynamic' => [ 'active' => true ],
'default' => '',
'selectors' => [
'{{WRAPPER}} .stratum-banner__title' => 'max-width: {{VALUE}}px;'
]
]
);
$controls->add_responsive_control(
'text_align',
[
'label' => esc_html__( 'Text Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'left',
'toggle' => false,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'fa fa-align-left',
],
'center' => [
'title' => esc_html__( 'None', 'stratum' ),
'icon' => 'fa fa-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'fa fa-align-right',
],
],
'selectors' => [
'{{WRAPPER}} .stratum-banner .stratum-banner__text' => 'text-align: {{VALUE}};',
],
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'subtitles_typography',
'selector' => '{{WRAPPER}} .stratum-banner__text',
'label' => esc_html__( 'Description Typography', 'stratum' ),
'render_type' => 'template',
'condition' => [
'text!' => ''
],
'exclude' => ['html_tag']
]
);
$controls->add_responsive_control(
'text_width',
[
'label' => esc_html__( 'Description Width', 'stratum' ),
'type' => Controls_Manager::NUMBER,
'dynamic' => [ 'active' => true ],
'default' => '',
'selectors' => [
'{{WRAPPER}} .stratum-banner__text' => 'max-width: {{VALUE}}px;'
]
]
);
$controls->add_responsive_control(
'block_horizontal_alignment',
[
'label' => esc_html__( 'Block Horizontal Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'flex-start',
'toggle' => false,
'options' => [
'flex-start' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'eicon-h-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'stratum' ),
'icon' => 'eicon-h-align-center',
],
'flex-end' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'eicon-h-align-right',
],
],
'selectors' => [
'{{WRAPPER}} .stratum-banner__content-wrapper' => 'align-items: {{VALUE}};'
]
]
);
$controls->add_responsive_control(
'block_vertical_alignment',
[
'label' => esc_html__( 'Block Vertical Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'flex-end',
'toggle' => false,
'options' => [
'flex-start' => [
'title' => esc_html__( 'Top', 'stratum' ),
'icon' => 'eicon-v-align-top',
],
'center' => [
'title' => esc_html__( 'Middle', 'stratum' ),
'icon' => 'eicon-v-align-middle',
],
'flex-end' => [
'title' => esc_html__( 'Bottom', 'stratum' ),
'icon' => 'eicon-v-align-bottom',
],
],
'selectors' => [
'{{WRAPPER}} .stratum-banner__content-wrapper' => 'justify-content: {{VALUE}};'
]
]
);
$controls->start_controls_tabs( 'banner_styles' );
$controls->start_controls_tab(
'banner_normal',
array(
'label' => esc_html__( 'Normal', 'stratum' ),
)
);
$controls->add_control(
'opacity',
[
'label' => esc_html__( 'Overlay Opacity', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 0.35
],
'range' => [
'px' => [
'max' => 1,
'min' => 0,
'step' => 0.01
]
],
'selectors' => [
'{{WRAPPER}} .stratum-banner__wrapper .stratum-banner__overlay' => 'opacity: {{SIZE}};'
]
]
);
$controls->add_control(
'custom_overlay_color',
[
'label' => esc_html__( 'Overlay Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => $theme_colors_first_color,
'value' => $theme_colors_first_color,
'selectors' => [
'{{WRAPPER}} .stratum-banner__wrapper .stratum-banner__overlay' => 'background-color: {{VALUE}}'
]
]
);
$controls->add_control(
'custom_title_color',
[
'label' => esc_html__( 'Title Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '#FFFFFF',
'value' => '#FFFFFF',
'selectors' => [
'{{WRAPPER}} .stratum-banner__wrapper .stratum-banner__title' => 'color: {{VALUE}}',
]
]
);
$controls->add_control(
'custom_text_color',
[
'label' => esc_html__( 'Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '#FFFFFF',
'value' => '#FFFFFF',
'selectors' => [
'{{WRAPPER}} .stratum-banner__wrapper .stratum-banner__text' => 'color: {{VALUE}}'
]
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'banner_hover',
array(
'label' => esc_html__( 'Hover', 'stratum' ),
)
);
$controls->add_control(
'custom_hover_opacity',
[
'label' => esc_html__( 'Overlay Opacity', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 0.5
],
'range' => [
'px' => [
'max' => 1,
'min' => 0,
'step' => 0.01
]
],
'selectors' => [
'{{WRAPPER}} .stratum-banner__wrapper:hover .stratum-banner__overlay' => 'opacity: {{SIZE}};'
]
]
);
$controls->add_control(
'custom_hover_overlay_color',
[
'label' => esc_html__( 'Overlay Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => $theme_colors_first_color,
'value' => $theme_colors_first_color,
'selectors' => [
'{{WRAPPER}} .stratum-banner__wrapper:hover .stratum-banner__overlay' => 'background-color: {{VALUE}}'
]
]
);
$controls->add_control(
'custom_hover_title_color',
[
'label' => esc_html__( 'Title Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '#FFFFFF',
'value' => '#FFFFFF',
'selectors' => [
'{{WRAPPER}} .stratum-banner__wrapper:hover .stratum-banner__title' => 'color: {{VALUE}}',
'{{WRAPPER}} .stratum-banner__wrapper .stratum-banner__content-wrapper:before' => 'border-color: {{VALUE}}',
'{{WRAPPER}} .stratum-banner__wrapper .stratum-banner__content-wrapper:after' => 'border-color: {{VALUE}}',
]
]
);
$controls->add_control(
'custom_hover_text_color',
[
'label' => esc_html__( 'Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '#FFFFFF',
'value' => '#FFFFFF',
'selectors' => [
'{{WRAPPER}} .stratum-banner__wrapper:hover .stratum-banner__text' => 'color: {{VALUE}}'
]
]
);
$controls->end_controls_tab();
$controls->end_controls_tabs();
$controls->end_controls_section();
}
protected function render() {
$this->render_widget( 'php' );
}
protected function content_template() {}
public function render_plain_content( $instance = [] ) {}
}
Plugin::instance()->widgets_manager->register( new Banner() );

View File

@@ -0,0 +1,354 @@
<?php
/**
* Class: Circle_Progress_Bar
* Name: Circle progress bar
* Slug: circle-progress-bar
*/
namespace Stratum;
use \Elementor\Controls_Manager;
use \Elementor\Utils;
use \Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Circle_Progress_Bar extends Stratum_Widget_Base {
protected $widget_name = 'circle-progress-bar';
public function __construct($data = [], $args = null) {
parent::__construct( $data, $args );
}
public function get_title() {
return esc_html__( 'Circle Progress Bar', 'stratum' );
}
public function get_script_depends() {
return [ 'donutty', 'waypoints' ];
}
public function get_icon() {
return 'stratum-icon-circle-progress-bar';
}
public function get_categories() {
return [ 'stratum-widgets' ];
}
protected function register_controls() {
$controls = $this;
$first_color = !empty(get_option( 'stratum_style' )) ? (!empty(get_option( 'stratum_style' )['primary_color']) ? get_option( 'stratum_style' )['primary_color'] : '') : '#3878ff';
/*-----------------------------------------------------------------------------------*/
/* Content Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'section_general',
[
'label' => esc_html__( 'General', 'stratum' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$controls->add_responsive_control(
'widget_align',
[
'label' => esc_html__( 'Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'left',
'toggle' => false,
'prefix_class' => 'stratum-circle-progress-bar-align%s-',
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'fa fa-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'stratum' ),
'icon' => 'fa fa-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'fa fa-align-right',
],
],
]
);
$controls->add_control(
'text',
[
'label' => esc_html__( 'Text', 'stratum' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Enter your title', 'stratum' ),
'default' => esc_html__( 'Text', 'stratum' ),
'label_block' => true,
'conditions' => [
'relation' => 'and',
'terms' => [
[
'name' => 'show_percents',
'operator' => '!=',
'value' => 'yes',
],
],
],
]
);
$controls->add_control(
'show_percents',
[
'label' => esc_html__( 'Show percent', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
]
);
$controls->add_responsive_control(
'widget_width',
[
'label' => esc_html__( 'Width', 'stratum' ),
"description" => esc_html__( 'In Pixels (px)', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'render_type' => 'ui',
'default' => [
'size' => 150,
],
'range' => [
'px' => [
'min' => 0,
'max' => 1000,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .stratum-circle-progress-bar__wrapper' => 'width: {{SIZE}}px',
],
]
);
$controls->add_control(
'value',
[
'label' => esc_html__( 'Progress', 'stratum' ),
'description' => esc_html__( 'In Percent (%)', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'size_units' => '%' ,
'render_type' => 'template',
'range' => [
'%' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => '%',
'size' => 75,
],
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'section_style',
[
'label' => esc_html__( 'Style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->add_control(
'round',
[
'label' => esc_html__( 'Round Corners', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
]
);
$controls->add_control(
'circle',
[
'label' => esc_html__( 'Circle', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes'
]
);
$controls->add_control(
'padding',
[
'label' => esc_html__( 'Background Padding', 'stratum' ),
"description" => esc_html__( 'In Pixels (px)', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'size_units' => '%' ,
'render_type' => 'template',
'range' => [
'%' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'unit' => '%',
'size' => 4,
],
]
);
$controls->add_control(
'thickness',
[
'label' => esc_html__( 'Line Thickness', 'stratum' ),
"description" => esc_html__( 'In Pixels (px)', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'size_units' => '%' ,
'render_type' => 'template',
'range' => [
'%' => [
'min' => 1,
'max' => 100,
],
],
'default' => [
'unit' => '%',
'size' => 10,
],
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'text_style',
'selector' => '{{WRAPPER}} .stratum-circle-progress-bar .donut-text, {{WRAPPER}} .stratum-circle-progress-bar__title',
'label' => esc_html__( 'Text Typography', 'stratum' ),
'render_type' => 'ui',
'exclude' => ['html_tag']
]
);
$controls->start_controls_tabs( 'tabs_color_style');
$controls->start_controls_tab(
'tab_color_normal',
[
'label' => esc_html__( 'Normal', 'stratum' ),
]
);
$controls->add_control(
'text_color',
[
'label' => esc_html__( 'Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'value' => '#000000',
'default' => '#000000',
'selectors' => [
'{{WRAPPER}} .stratum-circle-progress-bar .donut-text, {{WRAPPER}} .stratum-circle-progress-bar .stratum-circle-progress-bar__title' => 'color: {{VALUE}}',
],
]
);
$controls->add_control(
'line_color',
[
'label' => esc_html__( 'Line Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'value' => $first_color,
'default' => $first_color,
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-circle-progress-bar svg .donut-fill' => 'stroke: {{VALUE}}',
],
]
);
$controls->add_control(
'background_color',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'value' => '#4682b426',
'default' => '#4682b426',
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-circle-progress-bar svg .donut-bg' => 'stroke: {{VALUE}}',
],
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'tab_color_hover',
[
'label' => esc_html__( 'Hover', 'stratum' ),
]
);
$controls->add_control(
'text_color_hover',
[
'label' => esc_html__( 'Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'value' => '#000000',
'default' => '#000000',
'selectors' => [
'{{WRAPPER}} .stratum-circle-progress-bar:hover .donut-text, {{WRAPPER}} .stratum-circle-progress-bar:hover .stratum-circle-progress-bar__title' => 'color: {{VALUE}}',
],
]
);
$controls->add_control(
'line_color_hover',
[
'label' => esc_html__( 'Line Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'value' => $first_color,
'default' => $first_color,
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-circle-progress-bar:hover svg .donut-fill' => 'stroke: {{VALUE}}',
],
]
);
$controls->add_control(
'background_color_hover',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'value' => '#4682b426',
'default' => '#4682b426',
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-circle-progress-bar:hover svg .donut-bg' => 'stroke: {{VALUE}}',
],
]
);
$controls->end_controls_tab();
$controls->end_controls_tabs();
$controls->end_controls_section();
}
//PHP template (refresh elements)
protected function render() {
$this->render_widget( 'php' );
}
//JavaScript "Backbone" template (live preview)
protected function content_template() {
$this->render_widget( 'js' );
}
public function render_plain_content( $instance = [] ) {}
}
Plugin::instance()->widgets_manager->register( new Circle_Progress_Bar() );

View File

@@ -0,0 +1,666 @@
<?php
/**
* Class: Content_Switcher
* Name: Content Switcher
* Slug: stratum-content-switcher
*/
namespace Stratum;
use \Elementor\Core\Base\Document;
use \Elementor\Controls_Manager;
use \Elementor\Group_Control_Typography;
use \Elementor\Group_Control_Box_Shadow;
use \Elementor\Utils;
use \Elementor\Plugin;
use \Elementor\Repeater;
use Stratum\Managers\Ajax_Manager;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Content_Switcher extends Stratum_Widget_Base {
protected $widget_name = 'content-switcher';
public function get_title() {
return esc_html__( 'Content Switcher', 'stratum' );
}
public function get_icon() {
return 'eicon-dual-button';
}
public function get_categories() {
return [ 'stratum-widgets', 'switch', 'content' ];
}
protected function register_controls() {
$controls = $this;
$document_types = Plugin::instance()->documents->get_document_types( [
'show_in_library' => true,
] );
$controls->start_controls_section(
'section_content',
[
'label' => esc_html__( 'Content', 'stratum' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$controls->add_control(
'content_type',
[
'label' => esc_html__( 'Style', 'stratum' ),
'type' => Controls_Manager::SELECT,
'description' => esc_html__( '', 'stratum' ),
'default' => 'multiple',
'options' => [
'multiple' => esc_html__( 'Multiple Tabs', 'stratum' ),
'toggle' => esc_html__( 'Toggle Tabs', 'stratum' ),
],
]
);
$controls->add_control(
'content_type_description',
[
'raw' => '<strong>' . __( 'Please note:', 'stratum' ) . '</strong> ' . __( 'This style applies to only first two tabs.', 'stratum' ),
'type' => Controls_Manager::RAW_HTML,
'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
'render_type' => 'ui',
'condition' => [
'content_type' => 'toggle',
],
]
);
$repeater = new Repeater();
$repeater->add_control(
'title',
[
'label' => __( 'Title', 'stratum' ),
'type' => Controls_Manager::TEXT,
'default' => __( 'Annual', 'stratum' ),
'label_block' => true,
]
);
$repeater->add_control(
'content_template',
[
'label' => esc_html__( 'Template', 'stratum' ),
'type' => Stratum_AJAX_Control::QUERY,
'label_block' => true,
'multiple' => false,
'ajax_route' => 'stratum_get_elementor_templates',
'autocomplete' => [
'object' => 'library_template',
'query' => [
'meta_query' => [
[
'key' => Document::TYPE_META_KEY,
'value' => array_keys( $document_types ),
'compare' => 'IN',
],
],
],
],
'options' => Ajax_Manager::stratum_get_elementor_templates(),
'description' => esc_html__( 'Here you can see sections you saved as templates.', 'stratum' ),
]
);
$repeater->add_control(
'active',
[
'label' => esc_html__( 'Unfolded by default', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
]
);
$controls->add_control(
'content_items',
[
'label' => esc_html__( 'Items', 'stratum' ),
'type' => Controls_Manager::REPEATER,
'title_field' => '{{{ title }}}',
'fields' => $repeater->get_controls(),
'default' => [
[
'title' => esc_html__( 'Starter', 'stratum' ),
'active' => 'yes'
],
[
'title' => esc_html__( 'Advanced', 'stratum' ),
'active' => 'no'
]
]
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'section_style',
[
'label' => esc_html__( 'General Style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->add_responsive_control(
'tabs_alignment',
[
'label' => esc_html__( 'Navigation Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'center',
'toggle' => false,
'options' => [
'flex-start' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'eicon-h-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'stratum' ),
'icon' => 'eicon-h-align-center',
],
'flex-end' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'eicon-h-align-right',
]
],
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher .stratum-content-switcher__nav' => 'justify-content: {{VALUE}};',
]
]
);
$controls->add_responsive_control(
'content_items_padding',
[
'label' => esc_html__( 'Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-multiple .stratum-content-switcher__nav-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .stratum-content-switcher.is-toggle .stratum-content-switcher__label' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_responsive_control(
'content_items_border_radius',
[
'label' => esc_html__( 'Border Radius', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'default' => [
'top' => '20',
'bottom' => '20',
'left' => '20',
'right' => '20',
'unit' => 'px'
],
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-multiple .stratum-content-switcher__nav-content' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
'{{WRAPPER}} .stratum-content-switcher.is-toggle .stratum-content-switcher__label' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_control(
'tab_content_brcolor_multiple',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'default' => '#FFFFFF',
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-multiple .stratum-content-switcher__nav-content' => 'background-color: {{VALUE}}',
],
'condition' => [
'content_type' => 'multiple',
],
]
);
$controls->add_control(
'tab_content_brcolor_toggle',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-toggle .stratum-content-switcher__label' => 'background-color: {{VALUE}}',
],
'condition' => [
'content_type' => 'toggle',
],
]
);
$controls->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'content_items_shadow_multiple',
'selector' => '{{WRAPPER}} .stratum-content-switcher.is-multiple .stratum-content-switcher__nav-content',
'fields_options' => [
'box_shadow_type' => [
'default' => 'yes',
],
'box_shadow' => [
'default' => [
'horizontal' => 0,
'vertical' => 4,
'blur' => 24,
'spread' => 0,
'color' => 'rgba(0,0,0,0.1)',
],
],
],
'condition' => [
'content_type' => 'multiple',
],
]
);
$controls->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'content_items_shadow_toggle',
'selector' => '{{WRAPPER}} .stratum-content-switcher.is-toggle .stratum-content-switcher__label',
'condition' => [
'content_type' => 'toggle',
],
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'section_tabs_style',
[
'label' => esc_html__( 'Tabs Style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'tabs_items_typography',
'selector' => '{{WRAPPER}} .stratum-content-switcher .stratum-content-switcher__nav-title',
'label' => esc_html__( 'Typography', 'stratum' ),
]
);
$controls->add_responsive_control(
'tabs_items_padding_multiple',
[
'label' => esc_html__( 'Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'default' => [
'top' => '12',
'bottom' => '12',
'left' => '23',
'right' => '23',
'unit' => 'px'
],
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-multiple .stratum-content-switcher__nav-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'content_type' => 'multiple',
],
]
);
$controls->add_responsive_control(
'tabs_items_padding_toggle',
[
'label' => esc_html__( 'Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'default' => [
'top' => '0',
'bottom' => '0',
'left' => '15',
'right' => '15',
'unit' => 'px'
],
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-toggle .stratum-content-switcher__nav-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'content_type' => 'toggle',
],
]
);
$controls->add_responsive_control(
'tabs_items_border_radius',
[
'label' => esc_html__( 'Border Radius', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'default' => [
'top' => '20',
'bottom' => '20',
'left' => '20',
'right' => '20',
'unit' => 'px'
],
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-multiple .stratum-content-switcher__nav-pill' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->start_controls_tabs( 'tabs_styles' );
$controls->start_controls_tab(
'tab_normal',
[
'label' => esc_html__( 'Normal', 'stratum' ),
]
);
$controls->add_control(
'tab_text_color',
[
'label' => esc_html__( 'Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'default' => '#22262C',
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-multiple .stratum-content-switcher__nav-button' => 'color: {{VALUE}}',
'{{WRAPPER}} .stratum-content-switcher.is-toggle .stratum-content-switcher__nav-item > .stratum-content-switcher__nav-title' => 'color: {{VALUE}}',
],
]
);
$controls->add_control(
'tab_pill_bgcolor',
[
'label' => esc_html__( 'Pill Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'default' => '#F74A00',
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-multiple .stratum-content-switcher__nav-pill' => 'background-color: {{VALUE}}',
],
'condition' => [
'content_type' => 'multiple',
],
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'tab_hover',
[
'label' => esc_html__( 'Hover', 'stratum' ),
]
);
$controls->add_control(
'tab_text_color_hover',
[
'label' => esc_html__( 'Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-multiple .stratum-content-switcher__nav-item:hover > .stratum-content-switcher__nav-button' => 'color: {{VALUE}}',
'{{WRAPPER}} .stratum-content-switcher.is-toggle .stratum-content-switcher__nav-item:hover > .stratum-content-switcher__nav-title' => 'color: {{VALUE}}',
],
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'tab_active',
[
'label' => esc_html__( 'Active', 'stratum' ),
]
);
$controls->add_control(
'tab_text_color_active_multiple',
[
'label' => esc_html__( 'Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'default' => '#FFFFFF',
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-multiple .stratum-content-switcher__nav-item.is-active > .stratum-content-switcher__nav-button' => 'color: {{VALUE}}',
],
'condition' => [
'content_type' => 'multiple',
],
]
);
$controls->add_control(
'tab_text_color_active_toggle',
[
'label' => esc_html__( 'Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'default' => '#5D74DE',
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-toggle .stratum-content-switcher__nav-item.is-active > .stratum-content-switcher__nav-title' => 'color: {{VALUE}}',
],
'condition' => [
'content_type' => 'toggle',
],
]
);
$controls->end_controls_tab();
$controls->end_controls_tabs();
$controls->end_controls_section();
$controls->start_controls_section(
'section_switch_tabs_style',
[
'label' => esc_html__( 'Toggle Style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [
'content_type' => 'toggle',
],
]
);
$controls->add_responsive_control(
'switch_checkbox_container_padding',
[
'label' => esc_html__( 'Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'default' => [
'top' => '6',
'right' => '16',
'bottom' => '6',
'left' => '16',
'unit' => 'px',
],
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-toggle .stratum-content-switcher__toggle' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_responsive_control(
'switch_checkbox_size',
[
'label' => esc_html__( 'Checkbox Switcher Size', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'size' => 9,
'unit' => 'px',
],
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-toggle .stratum-content-switcher__toggle::before' => '--toggle-size: {{SIZE}}{{UNIT}};',
],
]
);
$controls->add_responsive_control(
'switch_checkbox_container_radius',
[
'label' => esc_html__( 'Switcher Border Radius', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'size' => 10,
'unit' => 'px',
],
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-toggle .stratum-content-switcher__toggle' => 'border-radius: {{SIZE}}{{UNIT}};',
],
]
);
$controls->add_responsive_control(
'switch_checkbox_radius',
[
'label' => esc_html__( 'Checkbox Switcher Border Radius', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
'%' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'size' => 50,
'unit' => '%',
],
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-toggle .stratum-content-switcher__toggle::before' => 'border-radius: {{SIZE}}{{UNIT}};',
],
]
);
$controls->add_control(
'switch_checkbox_bgcolor',
[
'label' => esc_html__( 'Switcher Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'default' => '#5D74DEA1',
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-toggle .stratum-content-switcher__toggle' => 'background: {{VALUE}}',
],
]
);
$controls->add_control(
'switch_checkbox_color',
[
'label' => esc_html__( 'Checkbox Switcher Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'default' => '#5D74DE',
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher.is-toggle .stratum-content-switcher__toggle::before' => 'background: {{VALUE}}',
],
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'section_content_style',
[
'label' => esc_html__( 'Content Style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->add_responsive_control(
'content_margin',
[
'label' => esc_html__( 'Margin', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'default' => [
'top' => '20',
'bottom' => '20',
'left' => '20',
'right' => '20',
'unit' => 'px'
],
'selectors' => [
'{{WRAPPER}} .stratum-content-switcher__item-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_control(
'content_animation',
[
'label' => esc_html__( 'Animation', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'fade',
'options' => [
'none' => esc_html__( 'None', 'stratum' ),
'fade' => esc_html__( 'Fade', 'stratum' ),
],
]
);
$controls->end_controls_section();
}
// PHP template (refresh elements)
protected function render() {
$this->render_widget( 'php' );
}
}
Plugin::instance()->widgets_manager->register( new Content_Switcher() );

View File

@@ -0,0 +1,582 @@
<?php
/**
* Class: Counter
* Name: Counter
* Slug: stratum-countdown
*/
namespace Stratum;
use \Elementor\Core\Schemes;
use \Elementor\Controls_Manager;
use \Elementor\Group_Control_Border;
use \Elementor\Utils;
use \Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Countdown extends Stratum_Widget_Base {
protected $widget_name = 'countdown';
public function __construct($data = [], $args = null) {
parent::__construct( $data, $args );
}
public function get_script_depends() {
$script_depends = [
'jquery-plugin',
'jquery-countdown'
];
preg_match( '/^(.*)_/', get_locale(), $current_locale );
$locale_prefix = isset( $current_locale[ 1 ] ) && $current_locale[ 1 ] !='en' ? $current_locale[ 1 ] : '';
if ( $locale_prefix != '' ) {
$locale_path = 'vendors/jquery.countdown/localization/jquery.countdown-' . $locale_prefix . '.js';
if ( file_exists( stratum_get_plugin_path( $locale_path ) ) ) {
$script_depends[] = 'jquery-countdown-' . $locale_prefix;
}
}
return $script_depends;
}
public function get_title() {
return esc_html__( 'Countdown', 'stratum' );
}
public function get_icon() {
return 'stratum-icon-countdown';
}
public function get_categories() {
return [ 'stratum-widgets' ];
}
protected function register_controls() {
$controls = $this;
/*-----------------------------------------------------------------------------------*/
/* Content Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'section_content',
[
'label' => esc_html__( 'Content', 'stratum' )
]
);
$controls->add_control(
'date_time',
[
'label' => esc_html__( 'Select Date', 'stratum' ),
'type' => Controls_Manager::DATE_TIME,
'default' => gmdate( 'Y-m-d H:i', strtotime( '+1 week' ) + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ),
/* translators: %s: Time zone. */
'description' => sprintf( esc_html__( 'Date set according to your timezone: %s.', 'stratum' ), Utils::get_timezone_string() ),
]
);
$controls->add_control(
'show_years',
[
'label' => esc_html__( 'Years', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Show', 'stratum' ),
'label_off' => esc_html__( 'Hide', 'stratum' ),
'default' => 'yes',
]
);
$controls->add_control(
'show_months',
[
'label' => esc_html__( 'Months', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Show', 'stratum' ),
'label_off' => esc_html__( 'Hide', 'stratum' ),
'default' => 'yes',
]
);
$controls->add_control(
'show_weeks',
[
'label' => esc_html__( 'Weeks', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Show', 'stratum' ),
'label_off' => esc_html__( 'Hide', 'stratum' ),
'default' => 'yes',
]
);
$controls->add_control(
'show_days',
[
'label' => esc_html__( 'Days', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Show', 'stratum' ),
'label_off' => esc_html__( 'Hide', 'stratum' ),
'default' => 'yes',
]
);
$controls->add_control(
'show_hours',
[
'label' => esc_html__( 'Hours', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Show', 'stratum' ),
'label_off' => esc_html__( 'Hide', 'stratum' ),
'default' => 'yes',
]
);
$controls->add_control(
'show_minutes',
[
'label' => esc_html__( 'Minutes', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Show', 'stratum' ),
'label_off' => esc_html__( 'Hide', 'stratum' ),
'default' => 'yes',
]
);
$controls->add_control(
'show_seconds',
[
'label' => esc_html__( 'Seconds', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Show', 'stratum' ),
'label_off' => esc_html__( 'Hide', 'stratum' ),
'default' => 'yes',
]
);
$controls->add_control(
'stratum_expire_actions',
[
'label' => esc_html__( 'Actions After Expire', 'stratum' ),
'description' => sprintf( esc_html__( 'Redirect, hide or show custom message', 'stratum' ), Utils::get_timezone_string() ),
'type' => Controls_Manager::SELECT2,
'options' => [
'redirect' => esc_html__( 'Redirect', 'stratum' ),
'hide' => esc_html__( 'Hide', 'stratum' ),
'message' => esc_html__( 'Show Message', 'stratum' ),
],
'label_block' => true,
'separator' => 'before',
'render_type' => 'none',
'multiple' => true
]
);
$controls->add_control(
'message_after_expire',
[
'label' => esc_html__( 'Message', 'stratum' ),
'type' => Controls_Manager::WYSIWYG,
'separator' => 'before',
'render_type' => 'none',
'dynamic' => [
'active' => true,
],
'condition' => [
'stratum_expire_actions' => 'message',
]
]
);
$controls->add_control(
'expire_redirect_url',
[
'label' => esc_html__( 'Redirect URL', 'stratum' ),
'type' => Controls_Manager::URL,
'separator' => 'before',
'options' => false,
'render_type' => 'none',
'dynamic' => [
'active' => true,
],
'condition' => [
'stratum_expire_actions' => 'redirect',
],
]
);
$controls->end_controls_section();
/*-----------------------------------------------------------------------------------*/
/* Style Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'section_style',
[
'label' => esc_html__( 'Style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE
]
);
$controls->add_control(
'show_labels',
[
'label' => esc_html__( 'Show Label', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => esc_html__( 'Show', 'stratum' ),
'label_off' => esc_html__( 'Hide', 'stratum' ),
'default' => 'yes',
'separator' => 'before',
]
);
$controls->add_control(
'custom_labels',
[
'label' => esc_html__( 'Custom Label', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'condition' => [
'show_labels!' => '',
],
]
);
$controls->add_control(
'label_years',
[
'label' => esc_html__( 'Years', 'stratum' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Years', 'stratum' ),
'placeholder' => esc_html__( 'Years', 'stratum' ),
'condition' => [
'show_labels!' => '',
'custom_labels!' => '',
'show_years' => 'yes',
],
]
);
$controls->add_control(
'label_months',
[
'label' => esc_html__( 'Months', 'stratum' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Months', 'stratum' ),
'placeholder' => esc_html__( 'Months', 'stratum' ),
'condition' => [
'show_labels!' => '',
'custom_labels!' => '',
'show_months' => 'yes',
],
]
);
$controls->add_control(
'label_weeks',
[
'label' => esc_html__( 'Weeks', 'stratum' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Weeks', 'stratum' ),
'placeholder' => esc_html__( 'Weeks', 'stratum' ),
'condition' => [
'show_labels!' => '',
'custom_labels!' => '',
'show_weeks' => 'yes',
],
]
);
$controls->add_control(
'label_days',
[
'label' => esc_html__( 'Days', 'stratum' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Days', 'stratum' ),
'placeholder' => esc_html__( 'Days', 'stratum' ),
'condition' => [
'show_labels!' => '',
'custom_labels!' => '',
'show_days' => 'yes',
],
]
);
$controls->add_control(
'label_hours',
[
'label' => esc_html__( 'Hours', 'stratum' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Hours', 'stratum' ),
'placeholder' => esc_html__( 'Hours', 'stratum' ),
'condition' => [
'show_labels!' => '',
'custom_labels!' => '',
'show_hours' => 'yes',
],
]
);
$controls->add_control(
'label_minutes',
[
'label' => esc_html__( 'Minutes', 'stratum' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Minutes', 'stratum' ),
'placeholder' => esc_html__( 'Minutes', 'stratum' ),
'condition' => [
'show_labels!' => '',
'custom_labels!' => '',
'show_minutes' => 'yes',
],
]
);
$controls->add_control(
'label_seconds',
[
'label' => esc_html__( 'Seconds', 'stratum' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Seconds', 'stratum' ),
'placeholder' => esc_html__( 'Seconds', 'stratum' ),
'condition' => [
'show_labels!' => '',
'custom_labels!' => '',
'show_seconds' => 'yes',
],
]
);
$controls->add_responsive_control(
'box_width',
[
'label' => esc_html__( 'Box Width', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 100,
],
'range' => [
'px' => [
'min' => 0,
'max' => 300,
],
],
'selectors' => [
'{{WRAPPER}} .stratum-countdown .countdown-section' => 'min-width: {{SIZE}}{{UNIT}};',
],
]
);
$controls->add_control(
'box_align_horizontal',
[
'label' => esc_html__( 'Box Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'center',
'prefix_class' => 'stratum-countdown-horizontal-align-',
'toggle' => false,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'eicon-h-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'stratum' ),
'icon' => 'eicon-h-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'eicon-h-align-right',
],
'stretch' => [
'title' => esc_html__( 'Stretch', 'stratum' ),
'icon' => 'eicon-h-align-stretch',
],
],
]
);
$controls->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'box_border',
'selector' => '{{WRAPPER}} .stratum-countdown .countdown-section',
'separator' => 'before',
]
);
$controls->add_control(
'box_border_radius',
[
'label' => esc_html__( 'Border Radius', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%' ],
'selectors' => [
'{{WRAPPER}} .stratum-countdown .countdown-section' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_responsive_control(
'box_spacing',
[
'label' => esc_html__( 'Space Between', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 10,
],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .stratum-countdown .countdown-section' => 'margin-left: calc( {{SIZE}}{{UNIT}}/2 );',
'{{WRAPPER}} .stratum-countdown .countdown-section' => 'margin-right: calc( {{SIZE}}{{UNIT}}/2 );',
],
]
);
$controls->add_responsive_control(
'box_padding',
[
'label' => esc_html__( 'Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .stratum-countdown .countdown-section' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'digits_typography',
'selector' => '{{WRAPPER}} .stratum-countdown .countdown-section .countdown-amount',
'label' => esc_html__( 'Digits Typography', 'stratum' ),
'render_type' => 'ui',
'exclude' => ['html_tag']
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'label_typography',
'selector' => '{{WRAPPER}} .stratum-countdown .countdown-section .countdown-period',
'label' => esc_html__( 'Label Typography', 'stratum' ),
'render_type' => 'ui',
'exclude' => ['html_tag']
]
);
$controls->start_controls_tabs( 'countdown_styles' );
$controls->start_controls_tab(
'countdown_normal',
array(
'label' => esc_html__( 'Normal', 'stratum' ),
)
);
$controls->add_control(
'box_color',
[
'label' => esc_html__( 'Box Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-countdown .countdown-section' => 'background-color: {{VALUE}}'
]
]
);
$controls->add_control(
'digit_color',
[
'label' => esc_html__( 'Digit Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-countdown .countdown-section .countdown-amount' => 'color: {{VALUE}}'
]
]
);
$controls->add_control(
'label_color',
[
'label' => esc_html__( 'Label Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-countdown .countdown-section .countdown-period' => 'color: {{VALUE}}'
]
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'countdown_hover',
array(
'label' => esc_html__( 'Hover', 'stratum' ),
)
);
$controls->add_control(
'hover_box_color',
[
'label' => esc_html__( 'Box Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}:hover .stratum-countdown .countdown-section' => 'background-color: {{VALUE}}'
]
]
);
$controls->add_control(
'hover_digit_color',
[
'label' => esc_html__( 'Digit Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}:hover .stratum-countdown .countdown-section .countdown-amount' => 'color: {{VALUE}}'
]
]
);
$controls->add_control(
'hover_label_color',
[
'label' => esc_html__( 'Label Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}:hover .stratum-countdown .countdown-section .countdown-period' => 'color: {{VALUE}}'
]
]
);
$controls->end_controls_tab();
$controls->end_controls_tabs();
$controls->end_controls_section();
}
//PHP template (refresh elements)
protected function render() {
$this->render_widget( 'php' );
}
//JavaScript "Backbone" template (live preview)
protected function content_template() {
}
public function render_plain_content( $instance = [] ) {}
}
Plugin::instance()->widgets_manager->register( new Countdown() );

View File

@@ -0,0 +1,358 @@
<?php
/**
* Class: Counter
* Name: Counter
* Slug: stratum-counter
*/
namespace Stratum;
use \Elementor\Controls_Manager;
use \Elementor\Utils;
use \Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Counter extends Stratum_Widget_Base {
protected $widget_name = 'counter';
public function __construct($data = [], $args = null) {
parent::__construct( $data, $args );
}
public function get_script_depends() {
return [ 'countup', 'waypoints' ];
}
public function get_title() {
return esc_html__( 'Counter', 'stratum' );
}
public function get_icon() {
return 'stratum-icon-counter';
}
public function get_categories() {
return [ 'stratum-widgets' ];
}
protected function register_controls() {
$controls = $this;
/*-----------------------------------------------------------------------------------*/
/* Content Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'section_content',
[
'label' => esc_html__( 'Content', 'stratum' )
]
);
$controls->add_control(
'start',
[
'label' => esc_html__( 'Start Value', 'stratum' ),
'type' => Controls_Manager::NUMBER,
'dynamic' => [ 'active' => true ],
'default' => 0
]
);
$controls->add_control(
'end',
[
'label' => esc_html__( 'End Value', 'stratum' ),
'type' => Controls_Manager::NUMBER,
'dynamic' => [ 'active' => true ],
'default' => 100
]
);
$controls->add_control(
'duration',
[
'label' => esc_html__( 'Animation Duration', 'stratum' ),
'type' => Controls_Manager::NUMBER,
'dynamic' => [ 'active' => true ],
'default' => 3
]
);
$controls->add_control(
'smooth_animation',
[
'label' => esc_html__( 'Smooth Animation', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => ''
]
);
$controls->add_control(
'prefix',
[
'label' => esc_html__( 'Counter Prefix', 'stratum' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'default' => ''
]
);
$controls->add_control(
'suffix',
[
'label' => esc_html__( 'Counter Suffix', 'stratum' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'default' => ''
]
);
$controls->add_responsive_control(
'horizontal_alignment',
[
'label' => esc_html__( 'Horizontal Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'flex-start',
'toggle' => false,
'options' => [
'flex-start' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'eicon-h-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'stratum' ),
'icon' => 'eicon-h-align-center',
],
'flex-end' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'eicon-h-align-right',
],
],
'selectors' => [
'{{WRAPPER}} .stratum-counter' => 'justify-content: {{VALUE}};'
]
]
);
$controls->end_controls_section();
/*-----------------------------------------------------------------------------------*/
/* Style Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'section_style',
[
'label' => esc_html__( 'Style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE
]
);
$controls->add_control(
'animation_effect',
[
'label' => esc_html__( 'Animation Effect', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'outExpo',
'options' => [
'outExpo' => esc_html__( 'OutExpo' , 'stratum' ),
'outQuintic' => esc_html__( 'OutQuintic', 'stratum' ),
'outCubic' => esc_html__( 'OutCubic' , 'stratum' )
]
]
);
$controls->add_control(
'display_separator',
[
'label' => esc_html__( 'Display Thousands Separator', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => ''
]
);
$controls->add_control(
'thousands_separator',
[
'label' => esc_html__( 'Thousands Separator', 'stratum' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'default' => ','
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'prefix__typography',
'selector' => '{{WRAPPER}} .stratum-counter__prefix',
'label' => esc_html__( 'Prefix Typography', 'stratum' ),
'render_type' => 'ui',
'exclude' => ['html_tag']
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'number__typography',
'selector' => '{{WRAPPER}} .stratum-counter__number',
'label' => esc_html__( 'Number Typography', 'stratum' ),
'render_type' => 'ui',
'exclude' => ['html_tag']
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'suffix__typography',
'selector' => '{{WRAPPER}} .stratum-counter__suffix',
'label' => esc_html__( 'Suffix Typography', 'stratum' ),
'render_type' => 'ui',
'exclude' => ['html_tag']
]
);
$controls->add_control(
'decimal_places',
[
'label' => esc_html__( 'Decimal Places', 'stratum' ),
'type' => Controls_Manager::NUMBER,
'dynamic' => [ 'active' => true ],
'min' => '0',
'default' => '0'
]
);
$controls->add_control(
'decimal_separator',
[
'label' => esc_html__( 'Decimal Separator', 'stratum' ),
'label_block' => true,
'type' => Controls_Manager::TEXT,
'default' => '.'
]
);
$controls->add_control(
'numerals',
[
'label' => esc_html__( 'Numerals', 'stratum' ),
'type' => Controls_Manager::SELECT,
'options' => [
'default' => esc_html__( 'Default' , 'stratum' ),
'eastern_arabic' => esc_html__( 'Eastern Arabic', 'stratum' ),
'farsi' => esc_html__( 'Farsi' , 'stratum' )
],
'default' => 'default'
]
);
$controls->start_controls_tabs( 'counter_styles' );
$controls->start_controls_tab(
'counter_normal',
array(
'label' => esc_html__( 'Normal', 'stratum' ),
)
);
$controls->add_control(
'prefix_color',
[
'label' => esc_html__( 'Prefix Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-counter .stratum-counter__prefix' => 'color: {{VALUE}}'
]
]
);
$controls->add_control(
'number_color',
[
'label' => esc_html__( 'Number Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-counter .stratum-counter__number' => 'color: {{VALUE}}'
]
]
);
$controls->add_control(
'suffix_color',
[
'label' => esc_html__( 'Suffix Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-counter .stratum-counter__suffix' => 'color: {{VALUE}}'
]
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'counter_hover',
array(
'label' => esc_html__( 'Hover', 'stratum' ),
)
);
$controls->add_control(
'hover_prefix_color',
[
'label' => esc_html__( 'Prefix Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}:hover .stratum-counter .stratum-counter__prefix' => 'color: {{VALUE}}'
]
]
);
$controls->add_control(
'hover_number_color',
[
'label' => esc_html__( 'Number Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}:hover .stratum-counter .stratum-counter__number' => 'color: {{VALUE}}'
]
]
);
$controls->add_control(
'hover_suffix_color',
[
'label' => esc_html__( 'Suffix Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}:hover .stratum-counter .stratum-counter__suffix' => 'color: {{VALUE}}'
]
]
);
$controls->end_controls_tab();
$controls->end_controls_tabs();
$controls->end_controls_section();
}
//PHP template (refresh elements)
protected function render() {
$this->render_widget( 'php' );
}
//JavaScript "Backbone" template (live preview)
protected function content_template() {
$this->render_widget( 'js' );
}
public function render_plain_content( $instance = [] ) {}
}
Plugin::instance()->widgets_manager->register( new Counter() );

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,999 @@
<?php
/**
* Class: Image_Accordion
* Name: Image Accordion
* Slug: image-accordion
*/
namespace Stratum;
use \Elementor\Plugin;
use Elementor\Repeater;
use \Elementor\Utils;
use \Elementor\Controls_Manager;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Text_Shadow;
use Elementor\Group_Control_Css_Filter;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Image_Accordion extends Stratum_Widget_Base {
protected $widget_name = 'image-accordion';
public function __construct($data = [], $args = null) {
parent::__construct( $data, $args );
}
public function get_title() {
return esc_html__( 'Image Accordion', 'stratum' );
}
public function get_icon() {
return 'stratum-icon-image-accordion';
}
public function get_categories() {
return [ 'stratum-widgets' ];
}
public function get_script_depends() {
return [
'font-awesome-4-shim'
];
}
public function get_style_depends() {
return [
'font-awesome-5-all',
'font-awesome-4-shim'
];
}
protected function register_controls() {
$controls = $this;
/*-----------------------------------------------------------------------------------*/
/* Content Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'general_settings_section',
[
'label' => esc_html__( 'General Settings', 'stratum' )
]
);
$repeater = new Repeater();
$repeater->add_control(
'image',
[
'label' => esc_html__( 'Image', 'stratum' ),
'type' => Controls_Manager::MEDIA,
'dynamic' => [ 'active' => true ],
'default' => [
'url' => Utils::get_placeholder_image_src()
],
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}}::before, {{WRAPPER}} {{CURRENT_ITEM}} .stratum-image-accordion__background' => 'background-image: url("{{URL}}");',
]
]
);
$repeater->add_control(
'image_size',
[
'label' => esc_html__( 'Size', 'stratum' ),
'type' => Controls_Manager::SELECT,
'options' => [
'auto' => esc_html__( 'Auto' , 'stratum' ),
'contain' => esc_html__( 'Contain', 'stratum' ),
'cover' => esc_html__( 'Cover' , 'stratum' ),
'custom' => esc_html__( 'Custom' , 'stratum' )
],
'default' => 'auto',
'label_block' => true,
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}}::before, {{WRAPPER}} {{CURRENT_ITEM}} .stratum-image-accordion__background' => 'background-size: {{VALUE}}',
]
]
);
$repeater->add_control(
'image_position',
[
'label' => esc_html__( 'Position', 'stratum' ),
'type' => Controls_Manager::SELECT,
'options' => [
'top left' => esc_html__( 'Top Left' , 'stratum' ),
'top center' => esc_html__( 'Top Center' , 'stratum' ),
'top right' => esc_html__( 'Top Right' , 'stratum' ),
'center center' => esc_html__( 'Center Center', 'stratum' ),
'center left' => esc_html__( 'Center Left' , 'stratum' ),
'center right' => esc_html__( 'Center Right' , 'stratum' ),
'bottom center' => esc_html__( 'Bottom Center', 'stratum' ),
'bottom left' => esc_html__( 'Bottom Left' , 'stratum' ),
'bottom right' => esc_html__( 'Bottom Right' , 'stratum' )
],
'default' => 'center center',
'label_block' => true,
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}}::before, {{WRAPPER}} {{CURRENT_ITEM}} .stratum-image-accordion__background' => 'background-position: {{VALUE}}',
]
]
);
$repeater->add_control(
'image_repeat',
[
'label' => esc_html__( 'Repeat', 'stratum' ),
'type' => Controls_Manager::SELECT,
'options' => [
'repeat' => esc_html__( 'Repeat' , 'stratum' ),
'no-repeat' => esc_html__( 'No-repeat', 'stratum' ),
'repeat-x' => esc_html__( 'Repeat-x' , 'stratum' ),
'repeat-y' => esc_html__( 'Repeat-y' , 'stratum' ),
],
'default' => 'repeat',
'label_block' => true,
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}}::before, {{WRAPPER}} {{CURRENT_ITEM}} .stratum-image-accordion__background' => 'background-repeat: {{VALUE}}',
]
]
);
$repeater->add_control(
'content_switcher',
[
'label' => esc_html__( 'Content', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => ''
]
);
$repeater->add_control(
'icon_switcher',
[
'label' => esc_html__( 'Icon', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'condition' => [
'content_switcher' => 'yes'
]
]
);
$repeater->add_control(
'icon_updated',
[
'label' => esc_html__( 'Icon', 'stratum' ),
'type' => Controls_Manager::ICON,
'default' => 'fas fa-star',
'label_block' => true,
'condition' => [
'icon_switcher' => 'yes'
]
]
);
$repeater->add_control(
'item_title',
[
'label' => esc_html__( 'Title', 'stratum' ),
'type' => Controls_Manager::TEXT,
'placeholder' => esc_html__( 'Type your title here...', 'stratum' ),
'dynamic' => [ 'active' => true ],
'condition' => [
'content_switcher' => 'yes'
]
]
);
$repeater->add_control(
'item_description',
[
'label' => esc_html__( 'Description', 'stratum' ),
'type' => Controls_Manager::TEXTAREA,
'placeholder' => esc_html__( 'Type your content here...', 'stratum' ),
'dynamic' => [ 'active' => true ],
'condition' => [
'content_switcher' => 'yes'
]
]
);
$repeater->add_control(
'custom_position',
[
'label' => esc_html__( 'Custom Position','stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'condition' => [
'content_switcher' => 'yes'
]
]
);
$repeater->add_responsive_control(
'horizontal_offset',
[
'label' => esc_html__( 'Horizontal Offset', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', 'em', '%' ],
'range' => [
'px' => [
'min' => 0,
'max' => 400
]
],
'label_block' => true,
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}} .stratum-image-accordion__content' => 'position: absolute; left: {{SIZE}}{{UNIT}}'
],
'condition' => [
'custom_position' => 'yes'
]
]
);
$repeater->add_responsive_control(
'ver_offset',
[
'label' => esc_html__( 'Vertical Offset', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', 'em', '%' ],
'range' => [
'px' => [
'min' => 0,
'max' => 400
]
],
'label_block' => true,
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}} .stratum-image-accordion__content' => 'position: absolute; top: {{SIZE}}{{UNIT}}'
],
'condition' => [
'custom_position' => 'yes'
]
]
);
$repeater->add_control(
'show_button',
[
'label' => esc_html__( 'Show button', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'separator' => 'before',
'condition' => [
'content_switcher' => 'yes'
]
]
);
$repeater->add_control(
'button_text',
[
'label' => esc_html__( 'Button Text', 'stratum' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Click Here', 'stratum' ),
'dynamic' => [
'active' => true
],
'condition' => [
'content_switcher' => 'yes',
'show_button!' => ''
]
]
);
$repeater->add_control(
'link',
[
'label' => esc_html__( 'Link', 'stratum' ),
'type' => Controls_Manager::URL,
'dynamic' => [
'active' => true
],
'condition' => [
'show_button!' => ''
],
'placeholder' => esc_html__( 'https://your-link.com', 'stratum' ),
'condition' => [
'content_switcher' => 'yes',
'show_button!' => ''
]
]
);
$controls->add_control(
'image_content',
[
'label' => '',
'type' => Controls_Manager::REPEATER,
'default' => [
[
'item_title' => sprintf( esc_html__( 'Item #%d', 'stratum' ), 1 ),
'item_description' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'stratum' )
],
[
'item_title' => sprintf( esc_html__( 'Item #%d', 'stratum' ), 2 ),
'item_description' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'stratum' )
],
[
'item_title' => sprintf( esc_html__( 'Item #%d', 'stratum' ), 3 ),
'item_description' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'stratum' )
]
],
'fields' => $repeater->get_controls(),
'title_field' => '{{{ item_title }}}'
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'display_options_section',
[
'label' => esc_html__( 'Display Options', 'stratum' )
]
);
$controls->add_control(
'hovered_default_active',
[
'label' => esc_html__( 'Hovered By Default Index', 'stratum' ),
'type' => Controls_Manager::NUMBER,
'condition' => [
'active_type' => 'activate-on-hover'
],
'description' => esc_html__( 'Set the index for the image to be hovered by default on page load, index starts from 1', 'stratum' )
]
);
$controls->add_control(
'opened_default_active',
[
'label' => esc_html__( 'Opened By Default Index', 'stratum' ),
'type' => Controls_Manager::NUMBER,
'condition' => [
'active_type' => 'activate-on-click'
],
'description' => esc_html__( 'Set the index for the image to be opened by default on page load, index starts from 1', 'stratum' )
]
);
$controls->add_control(
'direction',
[
'label' => esc_html__( 'Direction', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'horizontal',
'options' => [
'horizontal' => esc_html__( 'Horizontal','stratum' ),
'vertical' => esc_html__( 'Vertical' ,'stratum' )
],
'label_block' => true
]
);
$controls->add_control(
'skew_switcher',
[
'label' => esc_html__( 'Skew Images', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'condition' => [
'direction' => 'horizontal'
]
]
);
$controls->add_control(
'skew_direction',
[
'label' => esc_html__( 'Skew Direction', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'right',
'options' => [
'right' => esc_html__( 'Right','stratum' ),
'left' => esc_html__( 'Left' ,'stratum' )
],
'label_block' => true,
'condition' => [
'direction' => 'horizontal',
'skew_switcher' => 'yes'
]
]
);
$controls->add_control(
'active_type',
[
'label' => esc_html__( 'Accordion Style', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'activate-on-click',
'label_block' => false,
'options' => [
'activate-on-hover' => esc_html__( 'On Hover', 'stratum' ),
'activate-on-click' => esc_html__( 'On Click', 'stratum' )
],
'label_block' => true
]
);
$controls->add_responsive_control(
'height',
[
'label' => esc_html__( 'Image Height', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', 'em', 'vh' ],
'range' => [
'px' => [
'min' => 100,
'max' => 1000
]
],
'label_block' => true,
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__item' => 'height: {{SIZE}}{{UNIT}}'
]
]
);
$controls->add_responsive_control(
'content_position',
[
'label' => esc_html__( 'Content Vertical Position', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'flex-start' => [
'title' => esc_html__( 'Top', 'stratum' ),
'icon' => 'eicon-v-align-top'
],
'center' => [
'title' => esc_html__( 'Middle', 'stratum' ),
'icon' => 'eicon-v-align-middle'
],
'flex-end' => [
'title' => esc_html__( 'Bottom', 'stratum' ),
'icon' => 'eicon-v-align-bottom'
]
],
'toggle' => false,
'default' => 'center',
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__overlay' => 'justify-content: {{VALUE}};'
]
]
);
$controls->add_responsive_control(
'content_align',
[
'label' => esc_html__( 'Content Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title'=> esc_html__( 'Left', 'stratum' ),
'icon' => 'fa fa-align-left'
],
'center' => [
'title'=> esc_html__( 'Center', 'stratum' ),
'icon' => 'fa fa-align-center'
],
'right' => [
'title'=> esc_html__( 'Right', 'stratum' ),
'icon' => 'fa fa-align-right'
]
],
'default' => 'center',
'toggle' => false,
'render_type' => 'template',
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__content' => 'text-align: {{VALUE}};'
]
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'syle_front_section_section',
[
'label' => esc_html__( 'Images', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE
]
);
$controls->add_control(
'overlay_background',
[
'label' => esc_html__( 'Overlay Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__overlay' => 'background-color: {{VALUE}};'
]
]
);
$controls->add_control(
'overlay_hover_background',
[
'label' => esc_html__( 'Overlay Hover Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__item:hover .stratum-image-accordion__overlay' => 'background-color: {{VALUE}};'
]
]
);
$controls->start_controls_tabs( 'images_tabs' );
$controls->start_controls_tab(
'image_normal_tab',
[
'label' => esc_html__( 'Normal', 'stratum' )
]
);
$controls->add_group_control(
Group_Control_Css_Filter::get_type(),
[
'name' => 'css_filters_normal',
'selector' => '{{WRAPPER}} .stratum-image-accordion__background'
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'image_hover_tab',
[
'label' => esc_html__( 'Hover', 'stratum' )
]
);
$controls->add_group_control(
Group_Control_Css_Filter::get_type(),
[
'name' => 'css_filters_hover',
'selector' => '{{WRAPPER}} .stratum-image-accordion__item:hover .stratum-image-accordion__background'
]
);
$controls->end_controls_tab();
$controls->end_controls_tabs();
$controls->end_controls_section();
$controls->start_controls_section(
'icons_style_section',
[
'label' => esc_html__( 'Content', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE
]
);
$controls->start_controls_tabs( 'icons_active_tabs' );
$controls->start_controls_tab(
'icons_style_tab',
[
'label' => esc_html__( 'Icon', 'stratum' )
]
);
$controls->add_control(
'icon_color',
[
'label' => esc_html__( 'Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__icon' => 'color: {{VALUE}};'
]
]
);
$controls->add_control(
'icon_hover_color',
[
'label' => esc_html__( 'Hover Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__icon:hover' => 'color: {{VALUE}};'
]
]
);
$controls->add_control(
'icon_background_color',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__icon' => 'background-color: {{VALUE}};'
]
]
);
$controls->add_control(
'icon_background_hover_color',
[
'label' => esc_html__( 'Background Hover Color ', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__icon:hover' => 'background-color: {{VALUE}};'
]
]
);
$controls->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'icon_shadow',
'selector' => '{{WRAPPER}} .stratum-image-accordion__icon'
]
);
$controls->add_responsive_control(
'icon_size',
[
'label' => esc_html__( 'Size', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', 'em'],
'range' => [
'px' => [
'min' => 0,
'max' => 500
],
'em' => [
'min' => 0,
'max' => 20
]
],
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__icon' => 'font-size: {{SIZE}}{{UNIT}};'
]
]
);
$controls->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'icon_border',
'selector' => '{{WRAPPER}} .stratum-image-accordion__icon'
]
);
$controls->add_control(
'icon_border_radius',
[
'label' => esc_html__( 'Border Radius', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', '%' ,'em'],
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__icon' => 'border-radius: {{SIZE}}{{UNIT}};'
]
]
);
$controls->add_responsive_control(
'icon_margin',
[
'label' => esc_html__( 'Margin', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__icon' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
]
]
);
$controls->add_responsive_control(
'icon_padding',
[
'label' => esc_html__( 'Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__icon' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
]
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'titles_style_tab',
[
'label' => esc_html__( 'Title', 'stratum' )
]
);
$controls->add_control(
'title_color',
[
'label' => esc_html__( 'Color ', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__title' => 'color: {{VALUE}};'
]
]
);
$controls->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'selector' => '{{WRAPPER}} .stratum-image-accordion__title'
]
);
$controls->add_group_control(
Group_Control_Text_Shadow::get_type(),
[
'name' => 'title_shadow',
'selector' => '{{WRAPPER}} .stratum-image-accordion__title'
]
);
$controls->add_responsive_control(
'title_margin',
[
'label' => esc_html__( 'Margin', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
]
]
);
$controls->add_responsive_control(
'title_padding',
[
'label' => esc_html__( 'Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
]
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'description_style_tab',
[
'label' => esc_html__( 'Description', 'stratum' )
]
);
$controls->add_control(
'description_color',
[
'label' => esc_html__( 'Color ', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__description' => 'color: {{VALUE}};'
]
]
);
$controls->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'description_typography',
'selector' => '{{WRAPPER}} .stratum-image-accordion__description'
]
);
$controls->add_group_control(
Group_Control_Text_Shadow::get_type(),
[
'name' => 'description_shadow',
'selector' => '{{WRAPPER}} .stratum-image-accordion__description'
]
);
$controls->add_responsive_control(
'description_margin',
[
'label' => esc_html__( 'Margin', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__description' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
]
]
);
$controls->add_responsive_control(
'description_padding',
[
'label' => esc_html__( 'Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__description' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
]
]
);
$controls->end_controls_tab();
$controls->end_controls_tabs();
$controls->end_controls_section();
$controls->start_controls_section(
'button_style_section',
[
'label' => esc_html__( 'Button', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE
]
);
$controls->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'button_typography',
'selector' => '{{WRAPPER}} .stratum-image-accordion__button'
]
);
$controls->start_controls_tabs( 'button_tabs' );
$controls->start_controls_tab( 'normal',
[
'label' => esc_html__( 'Normal', 'stratum' )
]
);
$controls->add_control(
'button_text_color',
[
'label' => esc_html__( 'Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__button' => 'color: {{VALUE}};'
]
]
);
$controls->add_control(
'button_background_color',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__button' => 'background-color: {{VALUE}};'
]
]
);
$controls->add_control(
'button_border_color',
[
'label' => esc_html__( 'Border Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__button' => 'border-color: {{VALUE}};'
]
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'hover',
[
'label' => esc_html__( 'Hover', 'stratum' )
]
);
$controls->add_control(
'button_hover_text_color',
[
'label' => esc_html__( 'Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__button:hover' => 'color: {{VALUE}};'
]
]
);
$controls->add_control(
'button_hover_background_color',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__button:hover' => 'background-color: {{VALUE}};'
]
]
);
$controls->add_control(
'button_hover_border_color',
[
'label' => esc_html__( 'Border Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__button:hover' => 'border-color: {{VALUE}};'
]
]
);
$controls->end_controls_tab();
$controls->end_controls_tabs();
$controls->add_responsive_control(
'button_border_width',
[
'label' => esc_html__( 'Border Width', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 20
]
],
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__button' => 'border-width: {{SIZE}}{{UNIT}};'
],
'separator' => 'before'
]
);
$controls->add_responsive_control(
'button_border_radius',
[
'label' => esc_html__( 'Border Radius', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .stratum-image-accordion__button' => 'border-radius: {{SIZE}}{{UNIT}};'
],
'separator' => 'after'
]
);
$controls->end_controls_section();
}
protected function render() {
$this->render_widget( 'php' );
}
public function image_accordion_render_button( $index, $button_text, $link ) {
$out = '';
$this->add_render_attribute( 'button' . $index, 'class', [
'stratum-image-accordion__button'
] );
if ( ! empty( $link[ 'url' ] ) ) {
$this->add_link_attributes( 'button' . $index, $link );
}
$button_class = $this->get_render_attribute_string( 'button' . $index );
$out .= "<a " . ( empty( $link[ 'url' ] ) ? "href='#' " : '' ) . $button_class. ">" . esc_html( $button_text ) . "</a>";
return $out;
}
protected function content_template() {}
public function render_plain_content( $instance = [] ) {}
}
Plugin::instance()->widgets_manager->register( new Image_Accordion() );

View File

@@ -0,0 +1,459 @@
<?php
/**
* Class: Image_Hot_Spot
* Name: Image Hot Spots
* Slug: stratum-image-hotspot
*/
namespace Stratum;
use Elementor\Controls_Manager;
use Elementor\Utils;
use Elementor\Repeater;
use Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Image_Hot_Spot extends Stratum_Widget_Base {
protected $widget_name = 'image-hotspot';
public function __construct($data = [], $args = null) {
parent::__construct( $data, $args );
}
public function get_title() {
return esc_html__( 'Image Hotspot', 'stratum' );
}
public function get_script_depends() {
return [
'popper',
'tippy',
'draggabilly',
'font-awesome-4-shim'
];
}
public function get_style_depends() {
return [
'tippy-themes',
'tippy-animation',
'font-awesome-5-all',
'font-awesome-4-shim'
];
}
public function get_icon() {
return 'stratum-icon-image-hotspot';
}
public function get_categories() {
return [ 'stratum-widgets' ];
}
protected function register_controls() {
/*-----------------------------------------------------------------------------------*/
/* Content Tab
/*-----------------------------------------------------------------------------------*/
$controls = $this;
$controls->start_controls_section(
'section_content',
[
'label' => esc_html__( 'Content', 'stratum' )
]
);
$controls->add_control(
'image',
[
'label' => esc_html__( 'Image', 'stratum' ),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src()
],
'dynamic' => [ 'active' => true ]
]
);
$controls->add_control(
'image_size',
[
'type' => 'select',
'label' => esc_html__( 'Image Size', 'stratum' ),
'default' => 'full',
'options' => Stratum::get_instance()->get_scripts_manager()->get_image_sizes()
]
);
$repeater = new Repeater();
$repeater->start_controls_tabs( 'hot_spots_tabs' );
$repeater->start_controls_tab ( 'tab_content', [ 'label' => esc_html__( 'Content', 'stratum' ) ]);
$repeater->add_control(
'hotspot_icon',
[
'label' => esc_html__( 'Icon', 'stratum' ),
'type' => Controls_Manager::ICON,
'default' => 'fa fa-plus',
'label_block' => true,
]
);
$repeater->end_controls_tab();
$repeater->start_controls_tab( 'position', [ 'label' => esc_html__( 'Position', 'stratum' ) ] );
$repeater->add_control(
'left_position',
[
'label' => esc_html__( 'Left Position', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
'step' => 0.1
]
],
'default' => [
'unit' => '%',
'size' => 50
],
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}}' => 'left: {{SIZE}}%;'
]
]
);
$repeater->add_control(
'top_position',
[
'label' => esc_html__( 'Top Position', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
'step' => 0.1
]
],
'default' => [
'unit' => '%',
'size' => 50
],
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}}' => 'top: {{SIZE}}%;'
]
]
);
$repeater->end_controls_tab();
$repeater->start_controls_tab( 'tab_tooltip', [ 'label' => esc_html__( 'Tooltip', 'stratum' ) ] );
$repeater->add_control(
'tooltip',
[
'label' => esc_html__( 'Tooltip', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'label_on' => esc_html__( 'Yes', 'stratum' ),
'label_off' => esc_html__( 'No' , 'stratum' ),
'return_value' => 'yes'
]
);
$repeater->add_control(
'tooltip_title',
[
'label' => esc_html__( 'Title', 'stratum' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Lorem ipsum dolor sit amet.', 'stratum' ),
'label_block' => true,
'placeholder' => esc_html__( 'Type your title here...', 'stratum' ),
'condition' => [
'tooltip' => 'yes'
]
]
);
$repeater->add_control(
'tooltip_content',
[
'label' => esc_html__( 'Tooltip Content', 'stratum' ),
'type' => Controls_Manager::TEXTAREA,
'dynamic' => [
'active' => true,
],
'default' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'stratum' ),
'label_block' => true,
'placeholder' => esc_html__( 'Type your content here...', 'stratum' ),
'condition' => [
'tooltip' => 'yes'
]
]
);
$repeater->add_control(
'open_by_default',
[
'label' => esc_html__( 'Opened by default', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'label_on' => esc_html__( 'Yes', 'stratum' ),
'label_off' => esc_html__( 'No', 'stratum' ),
'return_value' => 'yes',
'condition' => [
'tooltip' => 'yes'
]
]
);
$repeater->add_control(
'tooltip_arrow',
[
'label' => esc_html__( 'Use Arrow', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'label_on' => esc_html__( 'Yes', 'stratum' ),
'label_off' => esc_html__( 'No' , 'stratum' ),
'return_value' => 'yes',
'condition' => [
'tooltip' => 'yes'
]
]
);
$repeater->add_control(
'placement',
[
'label' => esc_html__( 'Placement', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'top',
'options' => [
'top' => esc_html__( 'Top' , 'stratum' ),
'right' => esc_html__( 'Right' , 'stratum' ),
'bottom' => esc_html__( 'Bottom', 'stratum' ),
'left' => esc_html__( 'Left' , 'stratum' )
],
'condition' => [
'tooltip' => 'yes'
]
]
);
$repeater->add_control(
'tooltip_theme',
[
'label' => esc_html__( 'Theme', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'light',
'options' => [
'light' => esc_html__( 'Light' , 'stratum' ),
'dark' => esc_html__( 'Dark' , 'stratum' ),
'light-border' => esc_html__( 'Light Border', 'stratum' ),
'google' => esc_html__( 'Google' , 'stratum' ),
'translucent' => esc_html__( 'Translucent' , 'stratum' )
],
'condition' => [
'tooltip' => 'yes'
]
]
);
$repeater->add_control(
'tooltip_animation',
[
'label' => esc_html__( 'Animation', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'fade',
'options' => [
'shift-away' => esc_html__( 'Shift Away' , 'stratum' ),
'shift-toward' => esc_html__( 'Shift Toward', 'stratum' ),
'fade' => esc_html__( 'Fade' , 'stratum' ),
'scale' => esc_html__( 'Scale' , 'stratum' ),
'perspective' => esc_html__( 'Perspective' , 'stratum' )
],
'condition' => [
'tooltip' => 'yes'
]
]
);
$repeater->add_control(
'tooltip_interactivity',
[
'label' => esc_html__( 'Interactivity', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'hover',
'options' => [
'hover' => esc_html__( 'Hover', 'stratum' ),
'click' => esc_html__( 'Click', 'stratum' )
],
'condition' => [
'tooltip' => 'yes'
]
]
);
$repeater->end_controls_tab();
$repeater->end_controls_tabs();
$controls->add_control(
'hotspot_dot_animation',
[
'label' => esc_html__( 'Animation', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'label_on' => esc_html__( 'Yes', 'stratum' ),
'label_off' => esc_html__( 'No', 'stratum' ),
'return_value' => 'yes'
]
);
$controls->add_control(
'hot_spots',
[
'label' => '',
'title_field' => '<i class="{{ hotspot_icon }}" aria-hidden="true"></i> {{{ tooltip_title }}}',
'type' => Controls_Manager::REPEATER,
'default' => [
[
'feature_icon' => 'fa fa-plus',
'left_position' => 20,
'top_position' => 30
]
],
'fields' => $repeater->get_controls()
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'section_hotspot_style',
[
'label' => esc_html__( 'Hotspot', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE
]
);
$controls->add_responsive_control(
'hotspot_icon_size',
[
'label' => esc_html__( 'Size', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [ 'size' => '20' ],
'range' => [
'px' => [
'min' => 6,
'max' => 50,
'step' => 1
]
],
'size_units' => [ 'px' ],
'selectors' => [
'{{WRAPPER}} .stratum-image-hotspot__dot-content' => 'font-size: {{SIZE}}{{UNIT}};'
]
]
);
$controls->add_responsive_control(
'hotspot_dot_padding',
[
'label' => esc_html__( 'Point Spacing', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [ 'size' => '0' ],
'range' => [
'px' => [
'min' => 6,
'max' => 100,
'step' => 1
]
],
'size_units' => [ 'px' ],
'selectors' => [
'{{WRAPPER}} .stratum-image-hotspot__dot' => 'padding: {{SIZE}}{{UNIT}};'
]
]
);
$controls->add_responsive_control(
'hotspot_dot_opacity',
[
'label' => esc_html__( 'Point Opacity', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [ 'size' => '1' ],
'range' => [
'px' => [
'min' => 0,
'max' => 1,
'step' => 0.1
]
],
'selectors' => [
'{{WRAPPER}} .stratum-image-hotspot__dot' => 'opacity: {{SIZE}};'
]
]
);
$controls->add_control(
'icon_color_normal',
[
'label' => esc_html__( 'Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '#fff',
'selectors' => [
'{{WRAPPER}} .stratum-image-hotspot__dot-icon' => 'color: {{VALUE}}'
]
]
);
$controls->add_control(
'icon_bg_color_normal',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .stratum-image-hotspot__dot' => 'background-color: {{VALUE}}'
]
]
);
$controls->end_controls_section();
}
protected function render() {
$this->render_widget( 'php' );
}
protected function content_template() {
$this->render_widget( 'js' );
}
public function render_plain_content( $instance = [] ) {}
public function get_dot_template($class, $dot_class, $wrapper_class, $icon_class, $type, $item = null) {
$out = "";
$out .= "<div ".$dot_class.">";
$out .= "<div ".$wrapper_class."'>";
$out .= "<div class='".esc_attr( $class."__dot-content" )."'>";
$out .= "<i class='".esc_attr( $class."__dot-icon ".$icon_class )."'></i>";
$out .= "</div>";
$out .= "</div>";
$out .= "</div>";
return $out;
}
}
Plugin::instance()->widgets_manager->register( new Image_Hot_Spot() );

View File

@@ -0,0 +1,342 @@
<?php
/**
* Class: Stratum_Instagram
* Name: Instagram
* Slug: stratum-instagram
*/
namespace Stratum;
// use \Stratum\Stratum_Widget_Base;
use \Elementor\Controls_Manager;
use \Elementor\Utils;
use \Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Instagram extends Stratum_Widget_Base {
protected $widget_name = 'instagram';
public function __construct($data = [], $args = null) {
parent::__construct( $data, $args );
}
public function get_title() {
return esc_html__( 'Instagram', 'stratum' );
}
public function get_script_depends() {
return [
'anim-on-scroll',
'modernizr-custom',
];
}
public function get_style_depends() {
return [
'scroll-anim-effects',
];
}
public function get_icon() {
return 'stratum-icon-instagram';
}
public function get_categories() {
return [ 'stratum-widgets' ];
}
protected function register_controls() {
$controls = $this;
/*-----------------------------------------------------------------------------------*/
/* Content Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'section_content',
[
'label' => esc_html__( 'Content', 'stratum' ),
'tab' => Controls_Manager::TAB_CONTENT
]
);
$controls->add_control(
'items',
[
'label' => esc_html__( 'Number of items', 'stratum' ),
'type' => Controls_Manager::NUMBER,
'min' => 1,
'max' => 100,
'step' => 1,
'default' => 6
]
);
$stratum_api = get_option( 'stratum_api', [] );
$access_token = isset( $stratum_api['instagram_access_token'] ) ? $stratum_api['instagram_access_token'] : '';
if (empty($access_token)){
$controls->add_control(
'api_key',
[
'label' => esc_html__( 'API KEY', 'stratum' ),
'label_block' => true,
'type' => Controls_Manager::RAW_HTML,
'raw' => wp_kses(
sprintf(
__( 'Instagram Access Token is not set. <a href="%s" target="_blank">Connect Instagram Account</a>.', 'stratum' ),
admin_url( 'admin.php?page=stratum-settings#stratum_api' )
),
array( 'a' => array( 'href' => array(), 'target' => array() ) )
),
'content_classes' => 'api-key-description',
]
);
}
$controls->end_controls_section();
/*-----------------------------------------------------------------------------------*/
/* Style Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'section_style',
[
'label' => esc_html__( 'Style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE
]
);
$controls->add_control(
'animate_on_scroll',
[
'label' => esc_html__( 'Animate on scroll', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
]
);
$controls->add_control(
'animation_effects',
[
'label' => esc_html__( 'Animation Effect', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'effect-2',
'options' => [
'effect-1' => esc_html__( 'Opacity', 'stratum' ),
'effect-2' => esc_html__( 'Move Up', 'stratum' ),
'effect-3' => esc_html__( 'Scale up', 'stratum' ),
'effect-4' => esc_html__( 'Fall perspective', 'stratum' ),
'effect-5' => esc_html__( 'Fly', 'stratum' ),
'effect-6' => esc_html__( 'Flip', 'stratum' ),
'effect-7' => esc_html__( 'Helix', 'stratum' ),
'effect-8' => esc_html__( 'Zoom In 3D', 'stratum' ),
],
'condition' => [
'animate_on_scroll' => 'yes',
],
]
);
$controls->add_responsive_control(
'columns',
[
'label' => esc_html__( 'Columns', 'stratum' ),
'type' => Controls_Manager::NUMBER,
'min' => 1,
'max' => 6,
'step' => 1,
'default' => 3,
'selectors' => [
'{{WRAPPER}} .stratum-instagram .stratum-instagram__wrapper' => '--columns: {{VALUE}}',
],
]
);
$controls->add_responsive_control(
'padding_item',
[
'label' => esc_html__( 'Spacing', 'stratum' ),
'description' => esc_html__( 'In Pixels (px)', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 5,
],
'tablet_default' => [
'size' => 5,
],
'mobile_default' => [
'size' => 5,
],
'range' => [
'px' => [
'min' => 0,
'max' => 30,
'step' => 1,
],
],
'selectors' => [
'{{WRAPPER}} .stratum-instagram .stratum-instagram__item' => 'padding: {{SIZE}}px',
'{{WRAPPER}} .stratum-instagram .stratum-instagram__wrapper' => 'margin: -{{SIZE}}px',
],
]
);
$controls->start_controls_tabs( 'instagram_styles' );
$controls->start_controls_tab(
'instagram_normal',
array(
'label' => esc_html__( 'Normal', 'stratum' ),
)
);
$controls->add_control(
'background_color',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'value' => '#00000000',
'default' => '#00000000',
'selectors' => [
'{{WRAPPER}} .stratum-instagram .stratum-instagram__media-link:before' => 'background-color: {{VALUE}}',
],
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'instagram_hover',
array(
'label' => esc_html__( 'Hover', 'stratum' ),
)
);
$controls->add_control(
'background_hover_color',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'value' => '#0000002e',
'default' => '#0000002e',
'selectors' => [
'{{WRAPPER}} .stratum-instagram .stratum-instagram__media-link:hover:before' => 'background-color: {{VALUE}}',
],
]
);
$controls->end_controls_tab();
$controls->end_controls_tabs();
$controls->end_controls_section();
}
protected function render( $instance = [] ) {
$media = $this->get_media();
if ( ! $media['success'] ) {
?><p><?php
echo wp_kses(
$media['error'],
array( 'a' => array( 'href' => array(), 'target' => array() ) )
)
?></p><?php
return;
}
$this->render_widget( 'php', [ 'media' => $media['media'] ] );
}
protected function content_template() {}
public function render_plain_content( $instance = [] ) {}
private function get_media() {
$instagram_media = get_transient( 'stratum_instagram_response_data' );
$success = true;
$error = '';
// @todo: remove in next release
// added for backward compatibility
if ( isset( $instagram_media->data ) ) {
$instagram_media = $instagram_media->data;
}
if ( false === $instagram_media ) {
$encryption = new String_Encryption();
$stratum_api = get_option( 'stratum_api', [] );
$access_token = isset( $stratum_api['instagram_access_token'] ) ? $encryption->decrypt( $stratum_api['instagram_access_token'] ) : '';
//If Empty Token
if ( empty( $access_token ) ) {
if ( current_user_can( 'manage_options' ) ) {
$error = sprintf(
__( 'Instagram Access Token is not set. <a href="%s" target="_blank">Connect Instagram Account</a>.', 'stratum' ),
admin_url( 'admin.php?page=stratum-settings#stratum_api' )
);
}
return array(
'success' => false,
'error' => $error,
'media' => $instagram_media
);
}
//Get data from Instagram
$response = wp_remote_get(
'https://graph.instagram.com/me/media?fields=id,media_type,media_url,permalink,caption,thumbnail_url,children{media_url,thumbnail_url}&access_token=' . $access_token . '&limit=100',
array( 'timeout' => 15 )
);
if ( is_wp_error( $response ) ) {
$success = false;
if ( current_user_can( 'manage_options' ) ) {
$error = $response->get_error_message();
}
} else {
$instagram_media = json_decode( wp_remote_retrieve_body( $response ) );
//JSON valid
if ( json_last_error() === JSON_ERROR_NONE ) {
if ( isset( $instagram_media->error ) ) {
$success = false;
$error = sprintf(
__( 'The access token could not be decrypted. Your access token is currently invalid. <a href="%s" target="_blank">Please re-authorize your Instagram account</a>.', 'stratum' ),
admin_url( 'admin.php?page=stratum-settings#stratum_api' )
);
} else {
if ( $instagram_media->data ) {
$instagram_media = $instagram_media->data;
//Cache response
set_transient( 'stratum_instagram_response_data', $instagram_media, 30 * MINUTE_IN_SECONDS );
} else {
$success = false;
if ( current_user_can( 'manage_options' ) ) {
$error = $instagram_media->meta->error_message;
}
}
}
} else {
$success = false;
$error = __( 'Error in json_decode.', 'stratum' );
}
}
}
return array(
'success' => $success,
'error' => $error,
'media' => $instagram_media
);
}
}
Plugin::instance()->widgets_manager->register( new Instagram() );

View File

@@ -0,0 +1,431 @@
<?php
/**
* Class: Lottie_Animations
* Name: Lottie Animations
* Slug: lottie-animations
*/
namespace Stratum;
use \Elementor\Plugin;
use Elementor\Repeater;
use \Elementor\Utils;
use \Elementor\Controls_Manager;
use Elementor\Group_Control_Border;
use Elementor\Group_Control_Css_Filter;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Typography;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Lottie_Animations extends Stratum_Widget_Base {
protected $widget_name = 'lottie-animations';
public function __construct($data = [], $args = null) {
parent::__construct( $data, $args );
}
public function get_title() {
return esc_html__( 'Lottie Animations', 'stratum' );
}
public function get_icon() {
return 'stratum-icon-lottie-animations';
}
public function get_categories() {
return [ 'stratum-widgets' ];
}
public function get_script_depends() {
return [
'lottie-animations-api'
];
}
protected function register_controls() {
$controls = $this;
/*-----------------------------------------------------------------------------------*/
/* Content Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'general_settings',
[
'label' => esc_html__( 'General Settings', 'stratum' )
]
);
$controls->add_control(
'lottie_url',
[
'label' => esc_html__( 'Animation JSON URL', 'stratum' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [ 'active' => true ],
'description' => 'Get JSON code URL from <a href="https://lottiefiles.com/" target="_blank">here</a>',
'label_block' => true
]
);
$controls->add_control(
'lottie_loop',
[
'label' => esc_html__( 'Loop','stratum' ),
'type' => Controls_Manager::SWITCHER,
'return_value' => 'true',
'default' => ''
]
);
$controls->add_control(
'lottie_reverse',
[
'label' => esc_html__( 'Reverse', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'return_value' => 'true',
'default' => '',
'condition' => [
'lottie_loop' => 'true',
]
]
);
$controls->add_control(
'lottie_hover',
[
'label' => esc_html__( 'Only Play on Hover','stratum' ),
'type' => Controls_Manager::SWITCHER,
'return_value' => 'true',
'default' => ''
]
);
$controls->add_control(
'lottie_speed',
[
'label' => esc_html__( 'Animation Speed', 'stratum' ),
'type' => Controls_Manager::NUMBER,
'default' => 1,
'min' => 0.1,
'max' => 3,
'step' => 0.1
]
);
$controls->add_control(
'animate_on_scroll',
[
'label' => esc_html__( 'Animate On Scroll', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'return_value' => 'false',
'condition' => [
'lottie_hover!' => 'true',
'lottie_reverse!' => 'true'
]
]
);
$controls->add_control(
'animate_speed',
[
'label' => esc_html__( 'Speed', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 4
],
'range' => [
'px' => [
'max' => 10,
'step' => 0.1
]
],
'condition' => [
'lottie_hover!' => 'true',
'animate_on_scroll' => 'true',
'lottie_reverse!' => 'true'
]
]
);
$controls->add_control(
'animate_view',
[
'label' => esc_html__( 'Viewport', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'sizes' => [
'start' => 0,
'end' => 100
],
'unit' => '%'
],
'labels' => [
esc_html__( 'Bottom', 'stratum' ),
esc_html__( 'Top', 'stratum' )
],
'scales' => 1,
'handles' => 'range',
'condition' => [
'lottie_hover!' => 'true',
'animate_on_scroll' => 'true',
'lottie_reverse!' => 'true'
]
]
);
$controls->add_responsive_control(
'animation_size',
[
'label' => esc_html__( 'Size', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px', 'em', '%'],
'default' => [
'unit' => 'px',
'size' => 600
],
'range' => [
'px' => [
'min' => 1,
'max' => 800
],
'em' => [
'min' => 1,
'max' => 30
]
],
'render_type' => 'template',
'separator' => 'before',
'selectors' => [
'{{WRAPPER}} .stratum-lottie-animations__wrapper' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}'
]
]
);
$controls->add_control(
'lottie_rotate',
[
'label' => esc_html__( 'Rotate (degrees)', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'description' => esc_html__( 'Set rotation value in degress', 'stratum' ),
'range' => [
'px' => [
'min' => -180,
'max' => 180
]
],
'default' => [
'size' => 0
],
'selectors' => [
'{{WRAPPER}} .stratum-lottie-animations__wrapper' => 'transform: rotate({{SIZE}}deg)'
]
]
);
$controls->add_responsive_control(
'animation_align',
[
'label' => esc_html__( 'Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'options' => [
'flex-start' => [
'title'=> esc_html__( 'Left', 'stratum' ),
'icon' => 'fa fa-align-left'
],
'center' => [
'title'=> esc_html__( 'Center', 'stratum' ),
'icon' => 'fa fa-align-center'
],
'flex-end' => [
'title'=> esc_html__( 'Right', 'stratum' ),
'icon' => 'fa fa-align-right'
]
],
'default' => 'center',
'toggle' => false,
'separator' => 'before',
'selectors' => [
'{{WRAPPER}} .stratum-lottie-animations' => 'justify-content: {{VALUE}}'
]
]
);
$controls->add_control(
'lottie_renderer',
[
'label' => esc_html__( 'Render As', 'stratum' ),
'type' => Controls_Manager::SELECT,
'options' => [
'svg' => esc_html__( 'SVG', 'stratum' ),
'canvas' => esc_html__( 'Canvas', 'stratum' )
],
'default' => 'svg',
'prefix_class' => 'stratum-lottie-',
'render_type' => 'template',
'label_block' => true,
'separator' => 'before'
]
);
$controls->add_control('render_notice',
[
'raw' => esc_html__( 'Set render type to canvas if you\'re having performance issues on the page.', 'stratum' ),
'type' => Controls_Manager::RAW_HTML,
'content_classes' => 'elementor-panel-alert elementor-panel-alert-info'
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'section_lottie_style',
[
'label' => esc_html__( 'Animation', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
'show_label' => false
]
);
$controls->start_controls_tabs( 'tabs_lottie' );
$controls->start_controls_tab(
'tab_lottie_normal',
[
'label' => esc_html__( 'Normal', 'stratum' )
]
);
$controls->add_control(
'lottie_background',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-lottie-animations__wrapper' => 'background-color: {{VALUE}}'
]
]
);
$controls->add_control(
'opacity',
[
'label' => esc_html__( 'Opacity', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 1,
'min' => 0.10,
'step' => 0.01
]
],
'selectors' => [
'{{WRAPPER}} .stratum-lottie-animations__wrapper' => 'opacity: {{SIZE}}'
]
]
);
$controls->add_group_control(
Group_Control_Css_Filter::get_type(),
[
'name' => 'css_filters',
'selector' => '{{WRAPPER}} .stratum-lottie-animations__wrapper'
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'tab_lottie_hover',
[
'label' => esc_html__( 'Hover', 'stratum' )
]
);
$controls->add_control(
'lottie_hover_background',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-lottie-animations__wrapper:hover' => 'background-color: {{VALUE}}'
]
]
);
$controls->add_control(
'hover_opacity',
[
'label' => esc_html__( 'Opacity', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'max' => 1,
'min' => 0.10,
'step' => 0.01
],
],
'selectors' => [
'{{WRAPPER}} .stratum-lottie-animations__wrapper:hover' => 'opacity: {{SIZE}}'
]
]
);
$controls->add_group_control(
Group_Control_Css_Filter::get_type(),
[
'name' => 'hover_css_filters',
'selector' => '{{WRAPPER}} .stratum-lottie-animations__wrapper:hover'
]
);
$controls->end_controls_tab();
$controls->end_controls_tabs();
$controls->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'lottie_border',
'selector' => '{{WRAPPER}} .stratum-lottie-animations__wrapper',
'separator' => 'before'
]
);
$controls->add_control('lottie_border_radius',
[
'label' => esc_html__( 'Border Radius', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'selectors' => [
'{{WRAPPER}} .stratum-lottie-animations__wrapper' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}'
]
]
);
$controls->add_responsive_control('animation_padding',
[
'label' => esc_html__( 'Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} .stratum-lottie-animations__wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}'
]
]
);
$controls->end_controls_section();
}
protected function render() {
$this->render_widget( 'php' );
}
protected function content_template() {}
public function render_plain_content( $instance = [] ) {}
}
Plugin::instance()->widgets_manager->register( new Lottie_Animations() );

View File

@@ -0,0 +1,400 @@
<?php
/**
* Class: Images_Masonry
* Name: Images Masonry
* Slug: masonry-gallery
*/
namespace Stratum;
use \Elementor\Controls_Manager;
use \Elementor\Utils;
use \Elementor\Plugin;
use \Elementor\Group_Control_Background;
use \Elementor\Group_Control_Typography;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Images_Masonry extends Stratum_Widget_Base {
protected $widget_name = 'masonry-gallery';
public function __construct($data = [], $args = null) {
parent::__construct( $data, $args );
}
public function get_title() {
return esc_html__( 'Masonry Gallery', 'stratum' );
}
public function get_script_depends() {
return [
'jquery-masonry',
'anim-on-scroll',
'modernizr-custom'
];
}
public function get_style_depends() {
return [
'scroll-anim-effects'
];
}
public function get_icon() {
return 'stratum-icon-masonry-gallery';
}
public function get_categories() {
return [ 'stratum-widgets' ];
}
protected function register_controls() {
$controls = $this;
/*-----------------------------------------------------------------------------------*/
/* Content Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'section_general',
[
'label' => esc_html__( 'General', 'stratum' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$controls->add_control(
'gallery_images',
[
'label' => esc_html__( 'Gallery', 'stratum' ),
'type' => Controls_Manager::GALLERY,
'default' => [],
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'section_style',
[
'label' => esc_html__( 'Style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->add_control(
'image_size',
[
'type' => 'select',
'label' => esc_html__( 'Image Size', 'stratum' ),
'default' => 'full',
'options' => Stratum::get_instance()->get_scripts_manager()->get_image_sizes()
]
);
$controls->add_control(
'animate_on_scroll',
[
'label' => esc_html__( 'Animate on scroll', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'no',
]
);
$controls->add_control(
'animation_effects',
[
'label' => esc_html__( 'Animation Effect', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'effect-2',
'options' => [
'effect-1' => esc_html__( 'Opacity', 'stratum' ),
'effect-2' => esc_html__( 'Move Up', 'stratum' ),
'effect-3' => esc_html__( 'Scale up', 'stratum' ),
'effect-4' => esc_html__( 'Fall perspective', 'stratum' ),
'effect-5' => esc_html__( 'Fly', 'stratum' ),
'effect-6' => esc_html__( 'Flip', 'stratum' ),
'effect-7' => esc_html__( 'Helix', 'stratum' ),
'effect-8' => esc_html__( 'Zoom In 3D', 'stratum' ),
],
'condition' => [
'animate_on_scroll' => 'yes',
],
]
);
$controls->add_control(
'gallery_columns',
[
'label' => esc_html__( 'Columns', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 2,
],
'range' => [
'px' => [
'min' => 2,
'max' => 10,
'step' => 1,
],
],
]
);
$controls->add_control(
'gutter',
[
'label' => esc_html__( 'Gutter', 'stratum' ),
'description' => esc_html__( 'In Pixels (px)', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 2,
],
'range' => [
'px' => [
'min' => 0,
'max' => 30,
'step' => 1,
],
],
]
);
$controls->add_control(
'image_animation_speed',
[
'label' => esc_html__( 'Hover Animation Speed', 'stratum' ),
'description' => esc_html__( 'In Seconds', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 0.25,
],
'range' => [
'px' => [
'min' => 0.1,
'max' => 2,
'step' => 0.01,
],
],
'selectors' => [
'{{WRAPPER}} .stratum-masonry-gallery__image' => 'transition: all {{SIZE}}s linear',
'{{WRAPPER}} .stratum-masonry-gallery__overlay' => 'transition: all {{SIZE}}s linear',
'{{WRAPPER}} .stratum-masonry-gallery__caption' => 'transition: all {{SIZE}}s linear',
],
]
);
$controls->add_control(
'zoom_effect',
[
'prefix_class' => 'stratum-masonry-gallery-effect-',
'return_value' => 'zoom',
'label' => esc_html__( 'Zoom on hover', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'no',
]
);
$controls->add_control(
'grayscale_effect',
[
'prefix_class' => 'stratum-masonry-gallery-effect-',
'return_value' => 'grayscale',
'label' => esc_html__( 'Colorize on hover', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'no',
]
);
$controls->start_controls_tabs( 'overlay_styles' );
$controls->start_controls_tab(
'overlay_normal',
array(
'label' => esc_html__( 'Normal', 'stratum' ),
)
);
$controls->add_control(
'images_overlay_color',
[
'label' => esc_html__( 'Overlay Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'value' => '#00000078',
'default' => '#00000078',
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-masonry-gallery__item .stratum-masonry-gallery__overlay' => 'background-color: {{VALUE}}',
],
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'overlay_hover',
array(
'label' => esc_html__( 'Hover', 'stratum' ),
)
);
$controls->add_control(
'images_overlay_color_hover',
[
'label' => esc_html__( 'Overlay Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'value' => '#00000000',
'default' => '#00000000',
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-masonry-gallery__item:hover .stratum-masonry-gallery__overlay' => 'background-color: {{VALUE}}',
],
]
);
$controls->end_controls_tab();
$controls->end_controls_tabs();
$controls->end_controls_section();
$controls->start_controls_section(
'section_caption',
[
'label' => esc_html__( 'Caption', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->add_responsive_control(
'caption_padding',
[
'label' => __( 'Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em' ],
'selectors' => [
'{{WRAPPER}} .stratum-masonry-gallery__item .stratum-masonry-gallery__caption' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_responsive_control(
'caption_horizontal_align',
[
'label' => esc_html__( 'Horizontal Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'center',
'toggle' => false,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'fa fa-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'stratum' ),
'icon' => 'fa fa-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'fa fa-align-right',
],
],
'selectors' => [
'{{WRAPPER}} .stratum-masonry-gallery__item .stratum-masonry-gallery__caption' => 'text-align: {{VALUE}};',
],
]
);
$controls->add_responsive_control(
'caption_vertical_align',
[
'label' => esc_html__( 'Vertical Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'bottom',
'toggle' => false,
'options' => [
'top' => [
'title' => esc_html__( 'Top', 'stratum' ),
'icon' => 'eicon-v-align-top'
],
'middle' => [
'title' => esc_html__( 'Center', 'stratum' ),
'icon' => 'eicon-v-align-middle'
],
'bottom' => [
'title' => esc_html__( 'Bottom', 'stratum' ),
'icon' => 'eicon-v-align-bottom'
],
],
'selectors_dictionary' => [
'top' => 'top: 0; bottom: 0;',
'middle' => 'top: 50%; bottom: 0;',
'bottom' => 'bottom: 0; top: unset;',
],
'selectors' => [
'{{WRAPPER}} .stratum-masonry-gallery__item .stratum-masonry-gallery__caption' => '{{VALUE}}',
],
]
);
$controls->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'background',
'types' => [ 'classic', 'gradient' ],
'exclude' => [ 'image' ],
'selector' => '{{WRAPPER}} .stratum-masonry-gallery__item .stratum-masonry-gallery__caption',
]
);
$controls->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'caption_typography',
'selector' => '{{WRAPPER}} .stratum-masonry-gallery__item .stratum-masonry-gallery__caption',
'label' => esc_html__( 'Typography', 'stratum' ),
]
);
$controls->add_control(
'caption_color',
[
'label' => __( 'Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'default' => '#FFFFFF',
'value' => '',
'selectors' => [
'{{WRAPPER}} .stratum-masonry-gallery__item .stratum-masonry-gallery__caption' => 'color: {{VALUE}}',
]
]
);
$controls->end_controls_section();
}
//PHP template (refresh elements)
protected function render() {
$this->render_widget( 'php' );
}
//JavaScript "Backbone" template (live preview)
protected function content_template() {
}
public function render_plain_content( $instance = [] ) {}
public function _get_image_attributes( $id ) {
$attachment = get_post( $id );
$image_data = [
'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ),
'caption' => $attachment->post_excerpt,
'description' => $attachment->post_content,
'title' => $attachment->post_title,
];
return $image_data;
}
}
Plugin::instance()->widgets_manager->register( new Images_Masonry() );

View File

@@ -0,0 +1,369 @@
<?php
/**
* Class: Price_List
* Name: Price List
* Slug: stratum-price-list
*/
namespace Stratum;
use \Elementor\Controls_Manager;
use Elementor\Repeater;
use \Elementor\Utils;
use \Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Price_List extends Stratum_Widget_Base {
protected $widget_name = 'price-list';
public function __construct($data = [], $args = null) {
parent::__construct( $data, $args );
}
public function get_title() {
return esc_html__( 'Price List', 'stratum' );
}
public function get_icon() {
return 'stratum-icon-price-list';
}
public function get_categories() {
return [ 'stratum-widgets' ];
}
protected function register_controls() {
$controls = $this;
/*-----------------------------------------------------------------------------------*/
/* Content Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'section_content',
[
'label' => esc_html__( 'Content', 'stratum' )
]
);
$controls->add_control(
'list_title',
[
'label' => esc_html__( 'Heading', 'stratum' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [ 'active' => true ],
'default' => esc_html__( 'List Heading', 'stratum' )
]
);
$controls->add_control(
'title_html_tag',
[
'label' => esc_html__( 'Heading HTML Tag', 'stratum' ),
'type' => Controls_Manager::SELECT,
'options' => [
'h1' => esc_html__( 'H1' , 'stratum' ),
'h2' => esc_html__( 'H2' , 'stratum' ),
'h3' => esc_html__( 'H3' , 'stratum' ),
'h4' => esc_html__( 'H4' , 'stratum' ),
'h5' => esc_html__( 'H5', 'stratum' ),
'h6' => esc_html__( 'H6' , 'stratum' ),
'div' => esc_html__( 'div' , 'stratum' ),
'p' => esc_html__( 'p' , 'stratum' )
],
'default' => 'h5'
]
);
$repeater = new Repeater();
$repeater->add_control(
'item_title',
[
'label' => esc_html__( 'Title', 'stratum' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true
],
'label_block' => true,
'placeholder' => esc_html__( 'Title', 'stratum' ),
'default' => esc_html__( 'Title', 'stratum' )
]
);
$repeater->add_control(
'title_html_tag',
[
'label' => esc_html__( 'Title HTML Tag', 'stratum' ),
'type' => Controls_Manager::SELECT,
'options' => [
'h1' => esc_html__( 'H1' , 'stratum' ),
'h2' => esc_html__( 'H2' , 'stratum' ),
'h3' => esc_html__( 'H3' , 'stratum' ),
'h4' => esc_html__( 'H4' , 'stratum' ),
'h5' => esc_html__( 'H5 ', 'stratum' ),
'h6' => esc_html__( 'H6' , 'stratum' ),
'div' => esc_html__( 'div' , 'stratum' ),
'span' => esc_html__( 'span', 'stratum' ),
'p' => esc_html__( 'p' , 'stratum' )
],
'default' => 'span'
]
);
$repeater->add_control(
'item_price',
[
'label' => esc_html__( 'Price', 'stratum' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => '$11'
]
);
$controls->add_control(
'list_items',
[
'label' => '',
'type' => Controls_Manager::REPEATER,
'title_field' => '{{{ item_title }}}',
'default' => [
[
'item_title' => sprintf( esc_html__( 'Item #%d', 'stratum' ), 1 ),
'item_price' => '$69'
],
[
'item_title' => sprintf( esc_html__( 'Item #%d', 'stratum' ), 2 ),
'item_price' => '$49'
],
[
'item_title' => sprintf( esc_html__( 'Item #%d', 'stratum' ), 3 ),
'item_price' => '$19'
]
],
'fields' => $repeater->get_controls()
]
);
$controls->add_control(
'show_image',
[
'label' => esc_html__( 'Show Image', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'no',
'label_on' => esc_html__( 'On', 'stratum' ),
'label_off' => esc_html__( 'Off', 'stratum' ),
'return_value' => 'yes'
]
);
$controls->add_control(
'image_size',
[
'label' => esc_html__( 'Image Size', 'stratum' ),
'type' => 'select',
'default' => 'full',
'options' => \Stratum\Stratum::get_instance()->get_scripts_manager()->get_image_sizes(),
'condition' => [
'show_image' => 'yes'
]
]
);
$controls->add_control(
'image',
[
'label' => esc_html__( 'Image', 'stratum' ),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src()
],
'dynamic' => [
'active' => true
],
'condition' => [
'show_image' => 'yes'
]
]
);
$controls->add_control(
'image_width',
[
'label' => esc_html__( 'Image Width', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'default' => [
'size' => 250,
'unit' => 'px'
],
'range' => [
'px' => [
'max' => 600,
'min' => 10,
'step' => 1
]
],
'selectors' => [
'{{WRAPPER}} .stratum-price-list__image-wrapper' => 'width: {{SIZE}}{{UNIT}};'
],
'condition' => [
'show_image' => 'yes'
]
]
);
$controls->add_control(
'image_position',
[
'label' => esc_html__( 'Image position', 'stratum' ),
'type' => Controls_Manager::SELECT,
'default' => 'has-image-left',
'options' => [
'has-image-top' => esc_html__( 'Top' , 'stratum' ),
'has-image-left' => esc_html__( 'Left' , 'stratum' ),
'has-image-right' => esc_html__( 'Right', 'stratum' )
],
'condition' => [
'show_image' => 'yes'
]
]
);
$controls->add_control(
'title_price_connector',
[
'label' => esc_html__( 'Title-Price Separator', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'no',
'label_on' => esc_html__( 'Yes', 'stratum' ),
'label_off' => esc_html__( 'No', 'stratum' ),
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'section_style',
[
'label' => esc_html__( 'Style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->add_responsive_control(
'content_padding',
[
'label' => esc_html__( 'Content Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'selectors' => [
'{{WRAPPER}} .stratum-price-list .stratum-price-list__wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}'
],
'separator' => 'before'
]
);
$controls->start_controls_tabs( 'price_styles' );
$controls->start_controls_tab(
'price_normal',
array(
'label' => esc_html__( 'Normal', 'stratum' ),
)
);
$controls->add_control(
'heading_color',
[
'label' => esc_html__( 'Heading Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-price-list .stratum-price-list__heading' => 'color: {{VALUE}}',
],
]
);
$controls->add_control(
'title_color',
[
'label' => esc_html__( 'Title Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-price-list__items .stratum-price-list__title' => 'color: {{VALUE}}',
],
]
);
$controls->add_control(
'price_color',
[
'label' => esc_html__( 'Price Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-price-list__items .stratum-price-list__price' => 'color: {{VALUE}}',
],
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'price_hover',
array(
'label' => esc_html__( 'Hover', 'stratum' ),
)
);
$controls->add_control(
'heading_hover_color',
[
'label' => esc_html__( 'Heading Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-price-list:hover .stratum-price-list__heading' => 'color: {{VALUE}}',
],
]
);
$controls->add_control(
'title_hover_color',
[
'label' => esc_html__( 'Title Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-price-list:hover .stratum-price-list__title' => 'color: {{VALUE}}',
],
]
);
$controls->add_control(
'price_hover_color',
[
'label' => esc_html__( 'Price Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-price-list:hover .stratum-price-list__price' => 'color: {{VALUE}}',
],
]
);
$controls->end_controls_tab();
$controls->end_controls_tabs();
$controls->end_controls_section();
}
protected function render() {
$this->render_widget( 'php' );
}
protected function content_template() {}
public function render_plain_content( $instance = [] ) {}
}
Plugin::instance()->widgets_manager->register( new Price_List() );

View File

@@ -0,0 +1,396 @@
<?php
/**
* Class: Price_Menu
* Name: Price Menu
* Slug: stratum-price-menu
*/
namespace Stratum;
use \Elementor\Group_Control_Border;
use \Elementor\Group_Control_Box_Shadow;
use \Elementor\Controls_Manager;
use Elementor\Repeater;
use \Elementor\Utils;
use \Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Price_Menu extends Stratum_Widget_Base {
protected $widget_name = 'price-menu';
public function __construct($data = [], $args = null) {
parent::__construct( $data, $args );
}
public function get_title() {
return esc_html__( 'Price Menu', 'stratum' );
}
public function get_icon() {
return 'stratum-icon-price-menu';
}
public function get_categories() {
return [ 'stratum-widgets' ];
}
protected function register_controls() {
$controls = $this;
/*-----------------------------------------------------------------------------------*/
/* Content Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'section_content',
[
'label' => esc_html__( 'Content', 'stratum' )
]
);
$repeater = new Repeater();
$repeater->add_control(
'menu_title',
[
'label' => esc_html__( 'Title', 'stratum' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'label_block' => true,
'placeholder' => esc_html__( 'Title', 'stratum' ),
'default' => esc_html__( 'Title', 'stratum' )
]
);
$repeater->add_control(
'title_html_tag',
[
'label' => esc_html__( 'Title HTML Tag', 'stratum' ),
'type' => Controls_Manager::SELECT,
'options' => [
'h1' => esc_html__( 'H1' , 'stratum' ),
'h2' => esc_html__( 'H2' , 'stratum' ),
'h3' => esc_html__( 'H3' , 'stratum' ),
'h4' => esc_html__( 'H4' , 'stratum' ),
'h5' => esc_html__( 'H5', 'stratum' ),
'h6' => esc_html__( 'H6' , 'stratum' ),
'div' => esc_html__( 'div' , 'stratum' ),
'span' => esc_html__( 'span', 'stratum' ),
'p' => esc_html__( 'p' , 'stratum' )
],
'default' => 'span'
]
);
$repeater->add_control(
'menu_description',
[
'label' => esc_html__( 'Description', 'stratum' ),
'type' => Controls_Manager::TEXTAREA,
'dynamic' => [
'active' => true,
],
'label_block' => true,
'placeholder' => esc_html__( 'Description', 'stratum' ),
'default' => esc_html__( 'Description', 'stratum' )
]
);
$repeater->add_control(
'menu_price',
[
'label' => esc_html__( 'Price', 'stratum' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'default' => '$49'
]
);
$repeater->add_control(
'title_color',
[
'label' => esc_html__( 'Title Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}} .stratum-price-menu__title' => 'color: {{VALUE}}',
]
]
);
$repeater->add_control(
'price_color',
[
'label' => esc_html__( 'Price Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}} .stratum-price-menu__price' => 'color: {{VALUE}}',
]
]
);
$repeater->add_control(
'description_color',
[
'label' => esc_html__( 'Description Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}} .stratum-price-menu__description' => 'color: {{VALUE}}',
]
]
);
$repeater->add_control(
'show_image',
[
'label' => esc_html__( 'Show Image', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => '',
'label_on' => esc_html__( 'On', 'stratum' ),
'label_off' => esc_html__( 'Off', 'stratum' ),
'return_value' => 'yes'
]
);
$repeater->add_control(
'image_size',
[
'label' => esc_html__( 'Image Size', 'stratum' ),
'type' => 'select',
'default' => 'full',
'options' => Stratum::get_instance()->get_scripts_manager()->get_image_sizes(),
'condition' => [
'show_image' => 'yes'
]
]
);
$repeater->add_control(
'image_align',
[
'label' => esc_html__( 'Image Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'left',
'toggle' => false,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'fa fa-align-left',
],
'right' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'fa fa-align-right',
],
],
'condition' => [
'show_image' => 'yes'
]
]
);
$repeater->add_control(
'image',
[
'label' => esc_html__( 'Image', 'stratum' ),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src()
],
'dynamic' => [
'active' => true
],
'condition' => [
'show_image' => 'yes'
]
]
);
$controls->add_control(
'menu_items',
[
'label' => '',
'type' => Controls_Manager::REPEATER,
'title_field' => '{{{ menu_title }}}',
'default' => [
[
'menu_title' => sprintf( esc_html__( 'Item #%d', 'stratum' ), 1 ),
'menu_price' => '$69'
],
[
'menu_title' => sprintf( esc_html__( 'Item #%d', 'stratum' ), 2 ),
'menu_price' => '$49'
],
[
'menu_title' => sprintf( esc_html__( 'Item #%d', 'stratum' ), 3 ),
'menu_price' => '$19'
]
],
'fields' => $repeater->get_controls()
]
);
$controls->add_control(
'title_price_connector',
[
'label' => esc_html__( 'Title-Price Separator', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'no',
'label_on' => esc_html__( 'Yes', 'stratum' ),
'label_off' => esc_html__( 'No', 'stratum' ),
]
);
$controls->add_control(
'items_divider',
[
'label' => esc_html__( 'Items Separator', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'no',
'label_on' => esc_html__( 'Yes', 'stratum' ),
'label_off' => esc_html__( 'No', 'stratum' ),
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'section_style',
[
'label' => esc_html__( 'Style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->add_control(
'items_animate',
[
'label' => esc_html__( 'Animate items', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'return_value' => 'animate',
'default' => '',
'prefix_class' => 'stratum-price-menu-items-',
]
);
$controls->add_responsive_control(
'items_gap',
[
'label' => esc_html__( 'Items Gap', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'size_units' => [ 'px', 'em' ],
'selectors' => [
'{{WRAPPER}} .stratum-price-menu .stratum-price-menu__item-wrapper' => 'margin-bottom: {{SIZE}}{{UNIT}};',
],
]
);
$controls->add_responsive_control(
'items_images_width',
[
'label' => esc_html__( 'Image width', 'stratum' ),
'description' => esc_html__( 'In Percent (%)', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'%' => [
'min' => 0,
'max' => 80,
],
],
'size_units' => [ '%' ],
'default' => [
'size' => '50',
'unit' => '%',
],
'tablet_default' => [
'unit' => '%',
],
'mobile_default' => [
'unit' => '%',
],
'selectors' => [
'{{WRAPPER}} .stratum-price-menu .stratum-price-menu__image' => 'width: {{SIZE}}{{UNIT}};',
'{{WRAPPER}}.stratum-price-menu-items-animate .stratum-price-menu__image.image-align-left' => 'margin-left: -{{SIZE}}{{UNIT}};',
'{{WRAPPER}}.stratum-price-menu-items-animate .stratum-price-menu__image.image-align-right' => 'margin-right: -{{SIZE}}{{UNIT}};',
],
]
);
$controls->add_control(
'items_background_color',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'render_type' => 'ui',
'selectors' => [
'{{WRAPPER}} .stratum-price-menu .stratum-price-menu__item-wrapper' => 'background-color: {{VALUE}}',
],
]
);
$controls->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'items_border',
'label' => esc_html__( 'Border', 'stratum' ),
'selector' => '{{WRAPPER}} .stratum-price-menu .stratum-price-menu__item-wrapper',
]
);
$controls->add_control(
'items_border_radius',
[
'label' => esc_html__('Border Radius', 'stratum'),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => ['px', 'em', '%'],
'condition' => [
'items_border_border!' => ''
],
'selectors' => [
'{{WRAPPER}} .stratum-price-menu .stratum-price-menu__item-wrapper' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'items_shadow',
'selector' => '{{WRAPPER}} .stratum-price-menu .stratum-price-menu__item-wrapper',
]
);
$controls->add_responsive_control(
'items_paddings',
[
'label' => esc_html__( 'Content Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', '%', 'em' ],
'allowed_dimensions' => [ 'top', 'right', 'bottom', 'left' ],
'selectors' => [
'{{WRAPPER}} .stratum-price-menu .stratum-price-menu__content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$controls->end_controls_section();
}
protected function render() {
$this->render_widget( 'php' );
}
protected function content_template() {}
public function render_plain_content( $instance = [] ) {}
}
Plugin::instance()->widgets_manager->register( new Price_Menu() );

View File

@@ -0,0 +1,843 @@
<?php
/**
* Class: Price_Table
* Name: Price Table
* Slug: stratum-price-table
*/
namespace Stratum;
use \Elementor\Group_Control_Border;
use \Elementor\Controls_Manager;
use \Elementor\Utils;
use \Elementor\Plugin;
use \Elementor\Repeater;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Price_Table extends Stratum_Widget_Base {
protected $widget_name = 'price-table';
public function __construct($data = [], $args = null) {
parent::__construct( $data, $args );
}
public function get_title() {
return esc_html__( 'Price Table', 'stratum' );
}
public function get_icon() {
return 'stratum-icon-price-table';
}
public function get_categories() {
return [ 'stratum-widgets' ];
}
protected function register_controls() {
$controls = $this;
$first_color = '#000';
$second_color = '#000';
/*-----------------------------------------------------------------------------------*/
/* Content Tab
/*-----------------------------------------------------------------------------------*/
$controls->start_controls_section(
'section_general',
[
'label' => esc_html__( 'General', 'stratum' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
$controls->add_control(
'title',
[
'label' => esc_html__( 'Title', 'stratum' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Premium', 'stratum' ),
'title' => esc_html__( 'Title', 'stratum' ),
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'selector' => '{{WRAPPER}} .stratum-price-table__header .stratum-price-table__title',
'label' => esc_html__( 'Title Typography', 'stratum' ),
'render_type' => 'template',
'condition' => [
'title!' => ''
],
'defaults' => [
'html_tag' => 'h5',
],
]
);
$controls->add_control(
'subtitle',
[
'label' => esc_html__( 'Subtitle', 'stratum' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Plan', 'stratum' ),
'title' => esc_html__( 'Subtitle', 'stratum' ),
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'subtitles_typography',
'selector' => '{{WRAPPER}} .stratum-price-table__subtitle',
'label' => esc_html__( 'Subtitle Typography', 'stratum' ),
'render_type' => 'template',
'condition' => [
'subtitle!' => ''
],
'defaults' => [
'html_tag' => 'h4',
],
]
);
$controls->add_control(
'price_text',
[
'label' => esc_html__( 'Price Text', 'stratum' ),
'type' => Controls_Manager::TEXTAREA,
'rows' => 10,
'default' => esc_html__( 'Min Price', 'stratum' ),
'title' => esc_html__( 'Price Text', 'stratum' ),
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'price_text_typography',
'selector' => '{{WRAPPER}} .stratum-price-table__price-text',
'label' => esc_html__( 'Price Subtitle Typography', 'stratum' ),
'render_type' => 'template',
'condition' => [
'subtitle!' => ''
],
'exclude' => ['html_tag']
]
);
$controls->add_control(
'price',
[
'label' => esc_html__( 'Price', 'stratum' ),
'type' => Controls_Manager::NUMBER,
'step' => 1,
'default' => 7.50,
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'price_typography',
'selector' => '{{WRAPPER}} .stratum-price-table__price-wrapper .stratum-price-table__price',
'label' => esc_html__( 'Price Typography', 'stratum' ),
'render_type' => 'template',
'condition' => [
'price!' => ''
],
'exclude' => ['html_tag']
]
);
$controls->add_control(
'price_currency',
[
'label' => esc_html__( 'Currency', 'stratum' ),
'type' => Controls_Manager::TEXT,
'default' => '$',
'title' => esc_html__( 'Currency', 'stratum' ),
'condition' => [
'price!' => ''
],
]
);
$controls->add_control(
'currency_align',
[
'label' => esc_html__( 'Currency Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'right',
'prefix_class' => 'stratum-price-table-currency-align-',
'toggle' => false,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'fa fa-align-left',
],
'right' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'fa fa-align-right',
],
],
]
);
$controls->add_control(
'price_description',
[
'label' => esc_html__( 'Price description', 'stratum' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'per 10GH/s', 'stratum' ),
'title' => esc_html__( 'Price description', 'stratum' ),
]
);
$repeater = new Repeater();
$repeater->add_control(
'item_text',
[
'label' => esc_html__( 'Item text', 'stratum' ),
'type' => Controls_Manager::TEXT,
'label_block' => true,
'placeholder' => esc_html__( 'Caption', 'stratum' ),
'default' => esc_html__( 'Text', 'stratum' )
]
);
$repeater->add_control(
'item_icon',
[
'label_block' => true,
'label' => esc_html__( 'Item icon', 'stratum' ),
'type' => Controls_Manager::ICON
]
);
$repeater->add_control(
'icon_color',
[
'label' => esc_html__( 'Icon Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}}.stratum-price-table__content i' => 'color: {{VALUE}}',
],
'condition' => [
'item_icon!' => ''
]
]
);
$repeater->add_control(
'icon_color_hover',
[
'label' => esc_html__( 'Icon Color (Hover)', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}:hover {{CURRENT_ITEM}}.stratum-price-table__content i' => 'color: {{VALUE}}',
],
'condition' => [
'item_icon!' => ''
]
]
);
$controls->add_control(
'content_items',
[
'label' => esc_html__( 'List items', 'stratum' ),
'type' => Controls_Manager::REPEATER,
'title_field' => '{{{ item_text }}}',
'default' => [
[
'item_text' => esc_html__( 'First', 'stratum' )
],
[
'item_text' => esc_html__( 'Second', 'stratum' )
],
[
'item_text' => esc_html__( 'Third', 'stratum' )
]
],
'fields' => $repeater->get_controls()
]
);
$controls->add_responsive_control(
'align',
[
'label' => esc_html__( 'List Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'center',
'toggle' => false,
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'fa fa-align-left',
],
'center' => [
'title' => esc_html__( 'None', 'stratum' ),
'icon' => 'fa fa-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'fa fa-align-right',
],
],
'selectors' => [
'{{WRAPPER}} .stratum-price-table__wrapper .stratum-price-table__content-wrapper' => 'text-align: {{VALUE}};',
],
]
);
$controls->add_control(
'line_border',
[
'label' => esc_html__( 'List border', 'stratum' ),
'type' => Controls_Manager::POPOVER_TOGGLE,
'label_off' => esc_html__( 'Default', 'stratum' ),
'label_on' => esc_html__( 'Custom', 'stratum' ),
'return_value' => 'yes',
]
);
/*------------------------BORDER POPOVER------------------------*/
$controls->start_popover();
$controls->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'border',
'label' => esc_html__( 'Border', 'stratum' ),
'selector' => '{{WRAPPER}} .stratum-price-table__content-wrapper li',
'condition' => [
'line_border' => 'yes'
],
]
);
$controls->end_popover();
/*------------------------------------------------*/
$controls->add_control(
'button_show',
[
'label' => esc_html__( 'Show button', 'stratum' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'separator' => 'before',
]
);
$controls->add_responsive_control(
'button_align',
[
'label' => esc_html__( 'Button Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'center',
'toggle' => false,
'prefix_class' => 'stratum-price-table-button-align%s-',
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'stratum' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'eicon-text-align-right',
],
'full' => [
'title' => esc_html__( 'Justified', 'stratum' ),
'icon' => 'eicon-text-align-justify',
],
],
'condition' => [
'button_show' => 'yes'
],
]
);
$controls->add_control(
'button_text',
[
'label' => esc_html__( 'Button caption', 'stratum' ),
'type' => Controls_Manager::TEXT,
'default' => esc_html__( 'Purchase', 'stratum' ),
'title' => esc_html__( 'Button caption', 'stratum' ),
'condition' => [
'button_show' => 'yes'
],
]
);
$controls->add_control(
'button_url',
[
'label' => esc_html__( 'Button URL', 'stratum' ),
'type' => Controls_Manager::URL,
'placeholder' => 'https://',
'show_external' => true,
'default' => [
'url' => '',
'is_external' => true,
'nofollow' => true,
],
'condition' => [
'button_text!' => '',
'button_show' => 'yes'
],
]
);
$controls->add_control(
'stratum_button_border',
[
'label' => esc_html__( 'Button Border', 'stratum' ),
'type' => Controls_Manager::SELECT,
'options' => [
'' => esc_html__( 'None', 'stratum' ),
'solid' => esc_html__( 'Solid', 'stratum' ),
'double' => esc_html__( 'Double', 'stratum' ),
'dotted' => esc_html__( 'Dotted', 'stratum' ),
'dashed' => esc_html__( 'Dashed', 'stratum' ),
'groove' => esc_html__( 'Groove', 'stratum' ),
],
'selectors' => [
'{{WRAPPER}} .stratum-price-table__button .button' => 'border-style: {{VALUE}};',
],
]
);
$controls->add_responsive_control(
'button_border_width',
[
'label' => esc_html__( 'Button Border Width', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'default' => [
'top' => 1,
'right' => 1,
'bottom' => 1,
'left' => 1,
],
'selectors' => [
'{{WRAPPER}} .stratum-price-table__button .button' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'stratum_button_border!' => '',
]
]
);
$controls->add_control(
'button_radius',
[
'label' => esc_html__( 'Button Border Radius', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'condition' => [
'stratum_button_border!' => ''
],
'selectors' => [
'{{WRAPPER}} .stratum-price-table__button .button' => 'border-radius: {{SIZE}}{{UNIT}};',
],
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'section_style',
[
'label' => esc_html__( 'Style', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->start_controls_tabs( 'price_table_styles' );
$controls->start_controls_tab(
'price_table_normal',
array(
'label' => esc_html__( 'Normal', 'stratum' ),
)
);
$controls->add_control(
'title_color',
[
'label' => esc_html__( 'Title Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-price-table__header .stratum-price-table__title' => 'color: {{VALUE}}',
],
'conditions' => [
'relation' => 'and',
'terms' => [
[
'name' => 'title',
'operator' => '!=',
'value' => '',
],
],
],
]
);
$controls->add_control(
'subtitle_color',
[
'label' => esc_html__( 'Subtitle Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-price-table__subtitle' => 'color: {{VALUE}}',
],
'conditions' => [
'relation' => 'and',
'terms' => [
[
'relation' => 'or',
'terms' => [
[
'name' => 'subtitle',
'operator' => '!=',
'value' => ''
], [
'name' => 'price_text',
'operator' => '!=',
'value' => ''
]
]
]
],
],
]
);
$controls->add_control(
'price_color',
[
'label' => esc_html__( 'Price Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-price-table__price-wrapper .stratum-price-table__price' => 'color: {{VALUE}}',
],
'conditions' => [
'relation' => 'and',
'terms' => [
[
'name' => 'price',
'operator' => '!=',
'value' => '',
],
],
],
]
);
$controls->add_control(
'price_text_color',
[
'label' => esc_html__( 'Price Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-price-table__price-text' => 'color: {{VALUE}}',
],
'conditions' => [
'relation' => 'and',
'terms' => [
[
'relation' => 'or',
'terms' => [
[
'name' => 'subtitle',
'operator' => '!=',
'value' => ''
], [
'name' => 'price_text',
'operator' => '!=',
'value' => ''
]
]
]
],
],
]
);
$controls->add_control(
'description_color',
[
'label' => esc_html__( 'Description Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-price-table__price-wrapper .stratum-price-table__price-description' => 'color: {{VALUE}}',
],
'conditions' => [
'relation' => 'and',
'terms' => [
[
'name' => 'price_description',
'operator' => '!=',
'value' => '',
],
],
],
]
);
$controls->add_control(
'content_color',
[
'label' => esc_html__( 'Content Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-price-table__content-wrapper .stratum-price-table__content' => 'color: {{VALUE}}',
],
]
);
$controls->add_control(
'button_color_font',
[
'label' => esc_html__( 'Button Font Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-price-table__button .button' => 'color: {{VALUE}}',
],
]
);
$controls->add_control(
'button_color_background',
[
'label' => esc_html__( 'Button Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-price-table__button .button' => 'background-color: {{VALUE}}; border-color: {{VALUE}};',
],
]
);
$controls->add_control(
'button_color_border',
[
'label' => esc_html__( 'Button Border Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-price-table__button .button' => 'border-color: {{VALUE}};',
],
'condition' => [
'stratum_button_border!' => '',
],
]
);
$controls->end_controls_tab();
$controls->start_controls_tab(
'price_table_hover',
array(
'label' => esc_html__( 'Hover', 'stratum' ),
)
);
$controls->add_control(
'title_color_hover',
[
'label' => esc_html__( 'Title Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}:hover .stratum-price-table__header .stratum-price-table__title' => 'color: {{VALUE}}',
],
'conditions' => [
'relation' => 'and',
'terms' => [
[
'name' => 'title',
'operator' => '!=',
'value' => '',
],
],
],
]
);
$controls->add_control(
'subtitle_color_hover',
[
'label' => esc_html__( 'Subtitle Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}:hover .stratum-price-table__subtitle' => 'color: {{VALUE}}',
],
'conditions' => [
'relation' => 'and',
'terms' => [
[
'relation' => 'or',
'terms' => [
[
'name' => 'subtitle',
'operator' => '!=',
'value' => ''
], [
'name' => 'price_text',
'operator' => '!=',
'value' => ''
]
]
]
],
],
]
);
$controls->add_control(
'price_color_hover',
[
'label' => esc_html__( 'Price Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}:hover .stratum-price-table__price-wrapper .stratum-price-table__price' => 'color: {{VALUE}}',
],
'conditions' => [
'relation' => 'and',
'terms' => [
[
'name' => 'price',
'operator' => '!=',
'value' => '',
],
],
],
]
);
$controls->add_control(
'price_text_color_hover',
[
'label' => esc_html__( 'Price Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}:hover .stratum-price-table__price-text' => 'color: {{VALUE}}',
],
'conditions' => [
'relation' => 'and',
'terms' => [
[
'relation' => 'or',
'terms' => [
[
'name' => 'subtitle',
'operator' => '!=',
'value' => ''
], [
'name' => 'price_text',
'operator' => '!=',
'value' => ''
]
]
]
],
],
]
);
$controls->add_control(
'description_color_hover',
[
'label' => esc_html__( 'Description Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}:hover .stratum-price-table__price-wrapper .stratum-price-table__price-description' => 'color: {{VALUE}}',
],
'conditions' => [
'relation' => 'and',
'terms' => [
[
'name' => 'price_description',
'operator' => '!=',
'value' => '',
],
],
],
]
);
$controls->add_control(
'content_color_hover',
[
'label' => esc_html__( 'Content Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}:hover .stratum-price-table__content-wrapper .stratum-price-table__content' => 'color: {{VALUE}}',
],
]
);
$controls->add_control(
'button_color_font_hover',
[
'label' => esc_html__( 'Button Font Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}:hover .stratum-price-table__button .button:hover' => 'color: {{VALUE}}',
],
]
);
$controls->add_control(
'button_color_background_hover',
[
'label' => esc_html__( 'Button Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}:hover .stratum-price-table__button .button:hover' => 'background-color: {{VALUE}};',
],
]
);
$controls->add_control(
'button_color_border_hover',
[
'label' => esc_html__( 'Button Border Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}}:hover .stratum-price-table__button .button:hover' => 'border-color: {{VALUE}};',
],
'condition' => [
'stratum_button_border!' => '',
],
]
);
$controls->end_controls_tab();
$controls->end_controls_tabs();
$controls->end_controls_section();
}
protected function render() {
$this->render_widget( 'php' );
}
protected function content_template() {}
public function render_plain_content( $instance = [] ) {}
}
Plugin::instance()->widgets_manager->register( new Price_Table() );

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,521 @@
<?php
/**
* Class: Testimonial_Carousel
* Name: Testimonial Carousel
* Slug: stratum-testimonial-carousel
*/
namespace Stratum;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Box_Shadow;
use Elementor\Group_Control_Border;
use Elementor\Repeater;
use Elementor\Utils;
use Elementor\Core\Schemes;
use Elementor\Plugin;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Testimonial_Carousel extends Stratum_Widget_Base {
protected $widget_name = 'testimonial-carousel';
public $default_arrows_color = '#7a7a7a';
public function __construct($data = [], $args = null) {
parent::__construct( $data, $args );
}
public function get_title() {
return esc_html__( 'Testimonial Carousel', 'stratum' );
}
public function get_script_depends() {
return [
'swiper',
'font-awesome-4-shim'
];
}
public function get_style_depends() {
return [
'font-awesome-5-all',
'font-awesome-4-shim'
];
}
public function get_icon() {
return 'stratum-icon-testimonial-carousel';
}
public function get_categories() {
return [ 'stratum-widgets' ];
}
protected function register_controls() {
/*-----------------------------------------------------------------------------------*/
/* Content Tab
/*-----------------------------------------------------------------------------------*/
$controls = $this;
$controls->start_controls_section(
'section_content',
[
'label' => esc_html__( 'Content', 'stratum' )
]
);
$repeater = new Repeater();
$repeater->add_control(
'content',
[
'label' => esc_html__( 'Content', 'stratum' ),
'type' => Controls_Manager::TEXTAREA,
'dynamic' => [
'active' => true,
],
'label_block' => true,
'default' => esc_html__( 'Type your content here...', 'stratum' )
]
);
$repeater->add_control(
'image',
[
'label' => esc_html__( 'Image', 'stratum' ),
'type' => Controls_Manager::MEDIA,
'default' => [
'url' => Utils::get_placeholder_image_src()
],
'dynamic' => [ 'active' => true ]
]
);
$repeater->add_control(
'image_size',
[
'type' => 'select',
'label' => esc_html__( 'Image Size', 'stratum' ),
'default' => 'full',
'options' => Stratum::get_instance()->get_scripts_manager()->get_image_sizes()
]
);
$repeater->add_control(
'heading',
[
'label' => esc_html__( 'Heading', 'stratum' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'label_block' => true,
'placeholder' => esc_html__( 'Write heading...', 'stratum' )
]
);
$repeater->add_control(
'subtitle',
[
'label' => esc_html__( 'Subtitle', 'stratum' ),
'type' => Controls_Manager::TEXT,
'dynamic' => [
'active' => true,
],
'label_block' => true,
'placeholder' => esc_html__( 'Write subtitle...', 'stratum' )
]
);
$controls->add_control(
'slides',
[
'label' => 'Slides',
'type' => Controls_Manager::REPEATER,
'separator' => 'after',
'default' => [
[
'heading' => esc_html__( 'Title', 'stratum' ),
'subtitle' => esc_html__( 'Subtitle', 'stratum' ),
'content' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'stratum' )
],
[
'heading' => esc_html__( 'Title', 'stratum' ),
'subtitle' => esc_html__( 'Subtitle', 'stratum' ),
'content' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'stratum' )
],
[
'heading' => esc_html__( 'Title', 'stratum' ),
'subtitle' => esc_html__( 'Subtitle', 'stratum' ),
'content' => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'stratum' )
],
],
'fields' => $repeater->get_controls()
]
);
$controls->add_responsive_control(
'alignment',
[
'label' => esc_html__( 'Alignment', 'stratum' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'center',
'options' => [
'left' => [
'title' => esc_html__( 'Left', 'stratum' ),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => esc_html__( 'Center', 'stratum' ),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => esc_html__( 'Right', 'stratum' ),
'icon' => 'eicon-text-align-right',
],
],
'prefix_class' => 'stratum-testimonial-carousel-align%s-',
'separator' => 'before'
]
);
$controls->add_responsive_control(
'slider_width',
[
'type' => Controls_Manager::SLIDER,
'label' => esc_html__( 'Slider Width', 'stratum' ),
'range' => [
'px' => [
'min' => 100,
'max' => 1140
],
'%' => [
'min' => 50
],
],
'size_units' => [ '%', 'px' ],
'default' => [
'unit' => '%',
],
'tablet_default' => [
'unit' => '%',
'size' => 100,
],
'mobile_default' => [
'unit' => '%',
'size' => 100,
],
'selectors' => [
'{{WRAPPER}} .stratum-testimonial-carousel .stratum-testimonial-carousel__container' => 'max-width: {{SIZE}}{{UNIT}};'
],
]
);
$controls->add_responsive_control(
'content_width',
[
'type' => Controls_Manager::SLIDER,
'label' => esc_html__( 'Content Width', 'stratum' ),
'range' => [
'px' => [
'min' => 100,
'max' => 1140
],
'%' => [
'min' => 50
],
],
'size_units' => [ '%', 'px' ],
'default' => [
'unit' => '%'
],
'tablet_default' => [
'unit' => '%',
'size' => 100,
],
'mobile_default' => [
'unit' => '%',
'size' => 100,
],
'selectors' => [
'{{WRAPPER}} .stratum-testimonial-carousel .stratum-testimonial-carousel__content' => 'max-width: {{SIZE}}{{UNIT}};'
],
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'section_slides_style',
[
'label' => esc_html__( 'Slides', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE
]
);
$controls->add_control(
'slide_background_color',
[
'label' => esc_html__( 'Background Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-main-swiper .swiper-slide .stratum-testimonial-carousel__container' => 'background-color: {{VALUE}}'
],
]
);
$controls->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'slide_box_shadow',
'selector' => '{{WRAPPER}} .stratum-main-swiper .swiper-slide .stratum-testimonial-carousel__container',
]
);
$controls->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'slide_box_border',
'label' => esc_html__( 'Box Border', 'stratum' ),
'selector' => '{{WRAPPER}} .stratum-main-swiper .swiper-slide .stratum-testimonial-carousel__container',
'separator' => 'before'
]
);
$controls->add_control(
'slide_border_radius',
[
'label' => esc_html__( 'Border Radius', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%' ],
'range' => [
'%' => [
'max' => 50,
],
],
'selectors' => [
'{{WRAPPER}} .stratum-main-swiper .swiper-slide .stratum-testimonial-carousel__container' => 'border-radius: {{SIZE}}{{UNIT}}'
],
'condition' => [
'slide_box_border_border!' => ''
],
]
);
$controls->add_responsive_control(
'slide_padding',
[
'label' => esc_html__( 'Padding', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'selectors' => [
'{{WRAPPER}} .stratum-main-swiper .swiper-slide .stratum-testimonial-carousel__container-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}'
],
'separator' => 'before'
]
);
$controls->add_responsive_control(
'slide_margin',
[
'label' => esc_html__( 'Margin', 'stratum' ),
'type' => Controls_Manager::DIMENSIONS,
'selectors' => [
'{{WRAPPER}} .stratum-main-swiper .swiper-slide .stratum-testimonial-carousel__wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}'
],
'separator' => 'before'
]
);
$controls->end_controls_section();
$controls->start_controls_section(
'section_content_style',
[
'label' => esc_html__( 'Content', 'stratum' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$controls->add_control(
'image_style',
[
'label' => esc_html__( 'Image', 'stratum' ),
'type' => Controls_Manager::HEADING,
]
);
$controls->add_responsive_control(
'image_spacing',
[
'label' => esc_html__( 'Spacing', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .stratum-testimonial-carousel__footer' => 'margin-bottom: {{SIZE}}{{UNIT}}',
],
]
);
$controls->add_control(
'heading_style',
[
'label' => esc_html__( 'Heading', 'stratum' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before'
]
);
$controls->add_responsive_control(
'heading_spacing',
[
'label' => esc_html__( 'Spacing', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .stratum-testimonial-carousel__heading' => 'margin-bottom: {{SIZE}}{{UNIT}}',
],
]
);
$controls->add_control(
'heading_color',
[
'label' => esc_html__( 'Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-testimonial-carousel__heading' => 'color: {{VALUE}}'
],
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'heading_typography',
'selector' => '{{WRAPPER}} .stratum-testimonial-carousel__heading',
'label' => esc_html__( 'Heading Typography', 'stratum' ),
'render_type' => 'template',
'defaults' => [
'html_tag' => 'h3',
],
]
);
$controls->add_control(
'subtitle_style',
[
'label' => esc_html__( 'Subtitle', 'stratum' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before'
]
);
$controls->add_responsive_control(
'subtitle_spacing',
[
'label' => esc_html__( 'Spacing', 'stratum' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .stratum-testimonial-carousel__subtitle' => 'margin-bottom: {{SIZE}}{{UNIT}}',
],
]
);
$controls->add_control(
'subtitle_color',
[
'label' => esc_html__( 'Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-testimonial-carousel__subtitle' => 'color: {{VALUE}}'
],
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'subtitle_typography',
'selector' => '{{WRAPPER}} .stratum-testimonial-carousel__subtitle',
'label' => esc_html__( 'Subtitle Typography', 'stratum' ),
'render_type' => 'template',
'defaults' => [
'html_tag' => 'span',
],
]
);
$controls->add_control(
'content_style',
[
'label' => esc_html__( 'Content', 'stratum' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before'
]
);
$controls->add_control(
'content_color',
[
'label' => esc_html__( 'Text Color', 'stratum' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'{{WRAPPER}} .stratum-testimonial-carousel__text' => 'color: {{VALUE}}'
],
]
);
$controls->add_group_control(
Stratum_Group_Control_Typography::get_type(),
[
'name' => 'text_typography',
'selector' => '{{WRAPPER}} .stratum-testimonial-carousel__text',
'label' => esc_html__( 'Text Typography', 'stratum' ),
'render_type' => 'template'
]
);
$controls->end_controls_section();
$sections = new \Stratum\Sections( $this );
$sections->advanced_carousel(
[
'settings' => Controls_Manager::TAB_CONTENT,
'navigation' => Controls_Manager::TAB_STYLE
],
[],
[
'mousewheel_control',
'slides_to_scroll',
'dynamic_bullets',
]
);
}
protected function render() {
$this->render_widget( 'php' );
}
protected function content_template() {}
public function render_plain_content( $instance = [] ) {}
}
Plugin::instance()->widgets_manager->register( new Testimonial_Carousel() );

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,202 @@
=== Stratum - Elementor Widgets ===
Contributors: MotoPress
Donate link: https://motopress.com/
Tags: elementor, elementor addons, elementor plugins, elementor widgets, elementor extras, elementor essential addons, page builder, accordion, google map, slider, tabs, instagram, timeline, lottie, countdown, table
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 5.6
Stable tag: 1.4.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
20+ Premium Elementor widgets, including Advanced Slider, Instagram, Google Maps, Advanced Accordion, Post Grid.
== Description ==
Stratum is a free collection of 20+ [Elementor addons](https://motopress.com/products/stratum/) with the aim of enhancing the existing widget functionality of your favorite page builder. Not only do Elementor extras by Stratum provide you with highly-customizable elements but also offer automatic adjustment to the visual styling of your current theme.
* [View Demo](https://stratum.getmotopress.com/)
* [Stratum Elementor widgets](https://motopress.com/blog/category/stratum-elementor-widgets/) overview
* [Facebook Community](https://www.facebook.com/groups/stratumaddon)
* [Stratum Free/PRO Comparison Table](https://motopress.com/stratum-elementor-widgets-pro-vs-lite/?utm_source=wp-org-stratum-page&utm_medium=text-link&utm_campaign=stratum-pro-table)
[youtube https://www.youtube.com/watch?v=nXFzhxWzxdo]
= WHY STRATUM WIDGETS? =
* FREE collection of 20+ business-oriented widgets;
* Inherits visual styling of your current theme;
* Does NOT slow down your website;
* Elementor template library integration;
* Compatible with other Elementor addons;
* Fully-adaptive Elementor kit.
== LIST OF FREE ELEMENTOR WIDGETS ==
Take a look at the entire collection of Elementor essential addons by Stratum:
1. [Advanced Accordion](https://stratum.getmotopress.com/advanced-accordion/) - create interactive content using the horizontal accordion tabs; change the accordion type to toggle; integrate the accordion to your custom Library templates.
1. [Advanced Google Map](https://stratum.getmotopress.com/advanced-google-map/) - insert your business location on an interactive Google map; use the unlimited number of Google Maps custom markets and map styles.
1. [Advanced Posts](https://stratum.getmotopress.com/advanced-posts/) - display the latest project news & showcase the automatically sourced posts and pages using various grid, list, carousel, and masonry layouts.
1. [Advanced Slider](https://stratum.getmotopress.com/advanced-slider/) - display product carousels, intro sliders, to make the user focus on the important message; alter the number of columns, horizontal and vertical scrolling, navigation, etc.
1. [Advanced Tabs](https://stratum.getmotopress.com/advanced-tabs/) - create fully-customizable horizontal or vertical-oriented tabs that support custom Library templates; shrink the content alignment to space-consuming tabs.
1. [Banner](https://stratum.getmotopress.com/banner/) - create animated banners for promos and announcements; add dynamics to your WordPress page; promote several offers at once.
1. [Circle Progress Bar](https://stratum.getmotopress.com/circle-progress-bar/) - display the progress in percentages and/or with a text description.
1. [Counter](https://stratum.getmotopress.com/counter/) - visualize data using the dynamic animated counter widget.
1. [Flip Box](https://stratum.getmotopress.com/flip-box/) - make flip boxes with animation with fully customizable front & back sections; choose between 6 flip effects (the same number as the Pro widget).
1. [Image Accordion](https://stratum.getmotopress.com/image-accordion/) - create compact-style image galleries & banners with multiple-image display; highlight your images with amazing hover and click effects.
1. [Image Hotspot](https://stratum.getmotopress.com/image-hotspot/) - create animated pointers with tooltips and place them over images; change the styling of pointers & tooltips.
1. [Instagram](https://stratum.getmotopress.com/instagram/) - implement a real-life Instagram feed to your WordPress website; display any number of posts & change the number of columns; use it as a free PR tool to attract site visitors to follow your business Instagram profile.
1. [Masonry Gallery](https://stratum.getmotopress.com/masonry-gallery/) - create a stunning gallery display using multiple animation effects.
1. [Price List](https://stratum.getmotopress.com/price-list/) - create stunning menus, catalogs, and other types of price lists for a website of any kind.
1. [Price Menu](https://stratum.getmotopress.com/price-menu/) - display food menus or other listings with prices in a beautiful and structured way.
1. [Price Table](https://stratum.getmotopress.com/price-table/) - let customers compare the pricing for each product/service visually using this widget.
1. [Testimonial Carousel](https://stratum.getmotopress.com/testimonial-carousel/) - showcase testimonials in the most beautiful & space-consuming way using a carousel; edit reviews in the style that matches your entire website theme.
1. [Vertical Timeline](https://stratum.getmotopress.com/vertical-timeline/) - display events in a media-rich vertical timeline graph with smooth animation effects.
1. [Horizontal Timeline](https://stratum.getmotopress.com/horizontal-timeline/) - show events in chronological order using a horizontal timeline framework.
1. [Lottie Animations](https://stratum.getmotopress.com/lottie-animations/) - add high-quality animations to your WordPress site using the Lottie Animations library and customize animations further.
1. [Countdown](https://stratum.getmotopress.com/countdown/) - create a circle or box-styled animated countdown timer and set the real-time countdown up to seconds.
1. [Table](https://stratum.getmotopress.com/table/) - the table widget will allow you to create responsive data tables, style rows and columns.
1. [Content Switcher](https://stratum.getmotopress.com/content-switcher/) - create tabs or a toggle to structure your content, pricing plans or any other categorized data.
It makes no difference what kind of a business niche you are involved in, nor does it matter whether you develop an Elementor website for yourself or do it as a service. Stratum made both for beginners and pro users to get their best results while styling up content elements for their Elementor websites.
Unlike many other third-party Elementor plugins, Stratum offers premium addons for free. Also, the add-on includes several free alternatives to Elementor Pro widgets (Flip Box, Advanced Posts, Testimonial Carousel, etc).
== 20+ Business-Oriented Elementor Extras ==
The Stratum's widgets for Elementor help you add business-critical content modules to your website built with the Elementor page builder, including animated promo banners, ready-to-go elements for restaurant menus, pricing and comparison tables, and more beautiful content. Elementor plus Stratum means Elementor premium addons without extra charge!
All Stratum Elementor widgets are free, while advanced customization settings are available only in a PRO Stratum version.
[Check out all the extra features of Stratum](https://motopress.com/stratum-elementor-widgets-pro-vs-lite/?utm_source=wp-org-stratum-page&utm_medium=text-link&utm_campaign=stratum-pro).
== Ready-To-Go Styling of all Elementor Addons ==
The unique feature that differs Stratum for Elementor from many other premium third-party addons is the ability of any widget to inherit the styling of the current Elementor theme (typography and colors).
The default design set by Stratum addon is able to reduce the time for customizing and adjusting extra widgets to the theme.
== Template Library Integration ==
Integrating custom theme content into Stratum Elementor addons means increasing your working efficiency. Stratum stands for fast yet beautiful and advanced editing as in premium add ons.
== Build a Mega Menu with Elementor ==
Want to create a content-rich site navigation menu with Elementor widgets? The Stratum Mega Menu Elementor addon is the solution - you can feature your products, posts, banners or whatever content in submenus and fully tweak their styling. Get Elementor PRO addons for free!
* [Startum Elementor Mega Menu Plugin](https://motopress.com/products/stratum-menu/?utm_source=wp_org_stratum_page&utm_medium=text_link&utm_campaign=stratum_mega_menu)
* [Stratum Mega Menu Demo](https://stratum.getmotopress.com/stratum-mega-menu/?utm_source=wp_org_stratum_page&utm_medium=text_link&utm_campaign=stratum_mega_menu)
== Copyright ==
Stratum, Copyright (C) 2020, MotoPress https://motopress.com/
Stratum plugin is distributed under the terms of the GNU GPL.
== Credits ==
* class.settings-api.php, Copyright 2016 Tareq Hasan, MIT license.
* CountUp.js, Copyright 2019 Jamie Perkins, MIT license.
* nested.js, Copyright 2013 Andreas Pihlström, MIT license.
* masonry.pkgd.min.js, Copyright 2016 David DeSandro, MIT license.
* animOnScroll.js, Copyright 2013 Codrops, MIT license.
* modernizr.js, Copyright 2014 Faruk, Paul, Alex, Ryan, Patrick, Stu, and Richard, MIT license.
== Installation ==
1. Upload the plugin to the /wp-content/plugins/ directory.
2. Activate the Stratum - Elementor Addons plugin through the 'Plugins' menu in WordPress. (Elementor must be installed and activated!).
3. Find Stratum widgets in Elementor.
== Changelog ==
= 1.4.0, Mar 25 2024 =
* Added Instagram Access Token encryption.
* Minor bugfixes and improvements.
= 1.3.16, Feb 13 2024 =
* Minor bugfixes and improvements.
= 1.3.15, May 24 2023 =
* Improved compatibility with latest Elementor versions.
* Minor bugfixes and improvements.
= 1.3.14, Mar 10 2023 =
* Fixed miscellaneous Elementor deprecations.
= 1.3.13, Mar 23 2022 =
* Fixed an issue with missing descriptions in the Vertical Timeline widget.
* Fixed an issue with multiple markers in the Advanced Google Maps widget.
* Fixed an issue when the Swiper slider may not have been initialized with the "Improved Asset Loading" Elementor option enabled.
* Fixed an issue with the currency alignment in the Price Table widget.
* Minor bugfixes and improvements.
= 1.3.12, Nov 30 2021 =
* Fixed an issue with Advanced Slider on mobile devices.
= 1.3.11, Oct 27 2021 =
* Security - sanitization and escaping.
= 1.3.10, Aug 17 2021 =
* Fixed an issue with links in Horizontal Timeline and Accordion widgets.
= 1.3.9, Jul 21 2021 =
* Minor bugfixes and improvements.
= 1.3.8, May 5 2021 =
* Minor bugfixes and improvements.
= 1.3.7, Apr 1 2021 =
* Added Table widget.
* Added Content Switcher widget.
* Added the ability to automatically refresh Instagram access token.
* Minor bugfixes and improvements.
= 1.3.6, Feb 17 2021 =
* Minor bugfixes and improvements.
= 1.3.5, Dec 23 2020 =
* Improved compatibility with WordPress 5.6 and Elementor Pro.
* Minor bugfixes and improvements.
= 1.3.4, Sep 8 2020 =
* Minor bugfixes and improvements.
= 1.3.3, Aug 28 2020 =
* Added Vertical Timeline widget.
* Added Horizontal Timeline widget.
* Added Lottie Animations widget.
* Added Countdown widget.
= 1.3.2, Aug 12 2020 =
* Improved compatibility with WordPress 5.5.
= 1.3.1, Jul 31 2020 =
* Fixed an issue with Instagram widget.
= 1.3.0, Jun 10 2020 =
* Added Advanced Accordion widget.
* Added Advanced Tabs widget.
* Added Image Accordion widget.
* Improved the plugin color palette.
* Added the Templates Library control.
* Fixed an issue with "Instagram getToken" in the Instagram widget.
* Fixed an issue with controls in the Advanced Google Maps widget.
* Minor bugfixes and improvements.
= 1.2.0, Apr 29 2020 =
* Added Advanced Google Map widget.
* Added Advanced Posts widget.
* Added Advanced Slider widget.
* Added Testimonial Carousel widget.
* Added Flip Box widget.
* Minor bugfixes and improvements.
= 1.1.0, Mar 30 2020 =
* Added Image Hotspot widget.
* Added Masonry Gallery widget.
* Added Circular Progress Bar widget.
* Minor bugfixes and improvements.
= 1.0.0, Mar 6 2020 =
* Initial commit.

View File

@@ -0,0 +1,33 @@
<?php
/**
* Plugin Name: Stratum - Elementor Widgets
* Plugin URI: https://motopress.com/products/stratum/
* Description: Advanced Elementor addon to extend page builder capabilities and add more advanced features.
* Version: 1.4.0
* Author: MotoPress
* Author URI: https://motopress.com/
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: stratum
* Domain Path: /languages
*/
// Exit if accessed directly.
if ( !defined( 'ABSPATH' ) ) {
exit;
}
if ( !class_exists( 'Stratum\Stratum' ) ) {
define( 'STRATUM_PLUGIN_FILE', __FILE__ );
define( 'STRATUM_PLUGIN_DIR', plugin_dir_path( STRATUM_PLUGIN_FILE ) ); // The path with trailing slash
require_once plugin_dir_path( STRATUM_PLUGIN_FILE ) . 'includes/load.php';
function stratum() {
return \Stratum\Stratum::get_instance();
}
//Init Plugin
stratum();
}

View File

@@ -0,0 +1,250 @@
/**
* animOnScroll.js v1.0.0
* http://www.codrops.com
*
* Licensed under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2013, Codrops
* http://www.codrops.com
*/
;( function( window ) {
'use strict';
var docElem = window.document.documentElement;
function classReg( className ) {
return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
}
// classList support for class management
// altho to be fair, the api sucks because it won't accept multiple classes at once
var hasClass, addClass, removeClass;
if ( 'classList' in document.documentElement ) {
hasClass = function( elem, c ) {
return elem.classList.contains( c );
};
addClass = function( elem, c ) {
elem.classList.add( c );
};
removeClass = function( elem, c ) {
elem.classList.remove( c );
};
}
else {
hasClass = function( elem, c ) {
return classReg( c ).test( elem.className );
};
addClass = function( elem, c ) {
if ( !hasClass( elem, c ) ) {
elem.className = elem.className + ' ' + c;
}
};
removeClass = function( elem, c ) {
elem.className = elem.className.replace( classReg( c ), ' ' );
};
}
function toggleClass( elem, c ) {
var fn = hasClass( elem, c ) ? removeClass : addClass;
fn( elem, c );
}
var classie = {
// full names
hasClass: hasClass,
addClass: addClass,
removeClass: removeClass,
toggleClass: toggleClass,
// short names
has: hasClass,
add: addClass,
remove: removeClass,
toggle: toggleClass
};
// transport
if ( typeof define === 'function' && define.amd ) {
// AMD
define( classie );
} else {
// browser global
window.classie = classie;
}
function getViewportH() {
var client = docElem['clientHeight'],
inner = window['innerHeight'];
if( client < inner )
return inner;
else
return client;
}
function scrollY() {
return window.pageYOffset || docElem.scrollTop;
}
// http://stackoverflow.com/a/5598797/989439
function getOffset( el ) {
var offsetTop = 0, offsetLeft = 0;
do {
if ( !isNaN( el.offsetTop ) ) {
offsetTop += el.offsetTop;
}
if ( !isNaN( el.offsetLeft ) ) {
offsetLeft += el.offsetLeft;
}
} while( el = el.offsetParent )
return {
top : offsetTop,
left : offsetLeft
}
}
function inViewport( el, h ) {
var elH = el.offsetHeight,
scrolled = scrollY(),
viewed = scrolled + getViewportH(),
elTop = getOffset(el).top,
elBottom = elTop + elH,
// if 0, the element is considered in the viewport as soon as it enters.
// if 1, the element is considered in the viewport only when it's fully inside
// value in percentage (1 >= h >= 0)
h = h || 0;
return (elTop + elH * h) <= viewed && (elBottom - elH * h) >= scrolled;
}
function extend( a, b ) {
for( var key in b ) {
if( b.hasOwnProperty( key ) ) {
a[key] = b[key];
}
}
return a;
}
function AnimOnScroll( el, options, masonryOptions ) {
this.el = el;
this.options = extend( this.defaults, options );
this.masonryOptions = masonryOptions;
this._init();
}
AnimOnScroll.prototype = {
defaults : {
// Minimum and a maximum duration of the animation (random value is chosen)
minDuration : 0,
maxDuration : 0,
// The viewportFactor defines how much of the appearing item has to be visible in order to trigger the animation
// if we'd use a value of 0, this would mean that it would add the animation class as soon as the item is in the viewport.
// If we were to use the value of 1, the animation would only be triggered when we see all of the item in the viewport (100% of it)
viewportFactor : 0,
animateVisible : false
},
_init : function() {
this.items = Array.prototype.slice.call( jQuery(this.el).find('.masonry-item') );
this.itemsCount = this.items.length;
this.itemsRenderedCount = 0;
this.didScroll = false;
var self = this;
imagesLoaded( this.el, function() {
// initialize masonry
if (self.masonryOptions){
new Masonry( self.el, self.masonryOptions );
}
if( Modernizr.cssanimations ) {
// the items already shown...
self.items.forEach( function( el, i ) {
if( inViewport( el ) ) {
self._checkTotalRendered();
//fade item after init
if (self.options.animateVisible){
setTimeout( function() {
self._scrollPage();
}, 500 );
} else {
//show item on init
classie.add( el, 'shown' );
}
}
} );
// animate on scroll the items inside the viewport
window.addEventListener( 'scroll', function() {
self._onScrollFn();
}, false );
window.addEventListener( 'resize', function() {
self._resizeHandler();
}, false );
}
});
},
_onScrollFn : function() {
var self = this;
if( !this.didScroll ) {
this.didScroll = true;
setTimeout( function() { self._scrollPage(); }, 60 );
}
},
_scrollPage : function() {
var self = this;
this.items.forEach( function( el, i ) {
if( !classie.has( el, 'shown' ) && !classie.has( el, 'animate' ) && inViewport( el, self.options.viewportFactor ) ) {
setTimeout( function() {
var el_offset = $( self.el ).offset();
var el_scrollY = (parseFloat(scrollY() - el_offset.top) < 0) ? 0 : (scrollY() - el_offset.top);
var perspY = el_scrollY + getViewportH() / 2;
self.el.style.WebkitPerspectiveOrigin = '50% ' + perspY + 'px';
self.el.style.MozPerspectiveOrigin = '50% ' + perspY + 'px';
self.el.style.perspectiveOrigin = '50% ' + perspY + 'px';
self._checkTotalRendered();
if( self.options.minDuration && self.options.maxDuration ) {
var randDuration = ( Math.random() * ( self.options.maxDuration - self.options.minDuration ) + self.options.minDuration ) + 's';
el.style.WebkitAnimationDuration = randDuration;
el.style.MozAnimationDuration = randDuration;
el.style.animationDuration = randDuration;
}
classie.add( el, 'animate' );
}, 25 );
}
});
this.didScroll = false;
},
_resizeHandler : function() {
var self = this;
function delayed() {
self._scrollPage();
self.resizeTimeout = null;
}
if ( this.resizeTimeout ) {
clearTimeout( this.resizeTimeout );
}
this.resizeTimeout = setTimeout( delayed, 1000 );
},
_checkTotalRendered : function() {
++this.itemsRenderedCount;
if( this.itemsRenderedCount === this.itemsCount ) {
window.removeEventListener( 'scroll', this._onScrollFn );
}
}
}
// add to global namespace
window.AnimOnScroll = AnimOnScroll;
} )( window );

View File

@@ -0,0 +1,209 @@
.masonry-grid .masonry-item.shown,
.no-js .masonry-grid .masonry-item,
.no-cssanimations .masonry-grid .masonry-item
{
opacity: 1;
}
.masonry-grid .masonry-item a,
.masonry-grid .masonry-item img {
outline: none;
border: none;
display: block;
max-width: 100%;
}
/* Effect 1: opacity */
.masonry-grid.effect-1 .masonry-item.animate {
-webkit-animation: fadeIn 0.65s ease forwards;
animation: fadeIn 0.65s ease forwards;
}
@-webkit-keyframes fadeIn {
0% { }
100% { opacity: 1; }
}
@keyframes fadeIn {
0% { }
100% { opacity: 1; }
}
/* Effect 2: Move Up */
.masonry-grid.effect-2 .masonry-item.animate {
-webkit-transform: translateY(200px);
transform: translateY(200px);
-webkit-animation: moveUp 0.65s ease forwards;
animation: moveUp 0.65s ease forwards;
}
@-webkit-keyframes moveUp {
0% { }
100% { -webkit-transform: translateY(0); opacity: 1; }
}
@keyframes moveUp {
0% { }
100% { -webkit-transform: translateY(0); transform: translateY(0); opacity: 1; }
}
/* Effect 3: Scale up */
.masonry-grid.effect-3 .masonry-item.animate {
-webkit-transform: scale(0.6);
transform: scale(0.6);
-webkit-animation: scaleUp 0.65s ease-in-out forwards;
animation: scaleUp 0.65s ease-in-out forwards;
}
@-webkit-keyframes scaleUp {
0% { }
100% { -webkit-transform: scale(1); opacity: 1; }
}
@keyframes scaleUp {
0% { }
100% { -webkit-transform: scale(1); transform: scale(1); opacity: 1; }
}
/* Effect 4: fall perspective */
.masonry-grid.effect-4 {
-webkit-perspective: 1300px;
perspective: 1300px;
}
.masonry-grid.effect-4 .masonry-item.animate {
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-transform: translateZ(400px) translateY(300px) rotateX(-90deg);
transform: translateZ(400px) translateY(300px) rotateX(-90deg);
-webkit-animation: fallPerspective .8s ease-in-out forwards;
animation: fallPerspective .8s ease-in-out forwards;
}
@-webkit-keyframes fallPerspective {
0% { }
100% { -webkit-transform: translateZ(0px) translateY(0px) rotateX(0deg); opacity: 1; }
}
@keyframes fallPerspective {
0% { }
100% { -webkit-transform: translateZ(0px) translateY(0px) rotateX(0deg); transform: translateZ(0px) translateY(0px) rotateX(0deg); opacity: 1; }
}
/* Effect 5: fly (based on http://lab.hakim.se/scroll-effects/ by @hakimel) */
.masonry-grid.effect-5 {
-webkit-perspective: 1300px;
perspective: 1300px;
}
.masonry-grid.effect-5 .masonry-item.animate {
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-transform-origin: 50% 50% -300px;
transform-origin: 50% 50% -300px;
-webkit-transform: rotateX(-180deg);
transform: rotateX(-180deg);
-webkit-animation: fly .8s ease-in-out forwards;
animation: fly .8s ease-in-out forwards;
}
@-webkit-keyframes fly {
0% { }
100% { -webkit-transform: rotateX(0deg); opacity: 1; }
}
@keyframes fly {
0% { }
100% { -webkit-transform: rotateX(0deg); transform: rotateX(0deg); opacity: 1; }
}
/* Effect 6: flip (based on http://lab.hakim.se/scroll-effects/ by @hakimel) */
.masonry-grid.effect-6 {
-webkit-perspective: 1300px;
perspective: 1300px;
}
.masonry-grid.effect-6 .masonry-item.animate {
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-transform-origin: 0% 0%;
transform-origin: 0% 0%;
-webkit-transform: rotateX(-80deg);
transform: rotateX(-80deg);
-webkit-animation: flip .8s ease-in-out forwards;
animation: flip .8s ease-in-out forwards;
}
@-webkit-keyframes flip {
0% { }
100% { -webkit-transform: rotateX(0deg); opacity: 1; }
}
@keyframes flip {
0% { }
100% { -webkit-transform: rotateX(0deg); transform: rotateX(0deg); opacity: 1; }
}
/* Effect 7: helix (based on http://lab.hakim.se/scroll-effects/ by @hakimel) */
.masonry-grid.effect-7 {
-webkit-perspective: 1300px;
perspective: 1300px;
}
.masonry-grid.effect-7 .masonry-item.animate {
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-transform: rotateY(-180deg);
transform: rotateY(-180deg);
-webkit-animation: helix .8s ease-in-out forwards;
animation: helix .8s ease-in-out forwards;
}
@-webkit-keyframes helix {
0% { }
100% { -webkit-transform: rotateY(0deg); opacity: 1; }
}
@keyframes helix {
0% { }
100% { -webkit-transform: rotateY(0deg); transform: rotateY(0deg); opacity: 1; }
}
/* Effect 8: Zoom In */
.masonry-grid.effect-8 {
-webkit-perspective: 1300px;
perspective: 1300px;
}
.masonry-grid.effect-8 .masonry-item.animate {
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-transform: scale(0.4);
transform: scale(0.4);
-webkit-animation: popUp .8s ease-in forwards;
animation: popUp .8s ease-in forwards;
}
@-webkit-keyframes popUp {
0% { }
70% { -webkit-transform: scale(1.1); opacity: .8; -webkit-animation-timing-function: ease-out; }
100% { -webkit-transform: scale(1); opacity: 1; }
}
@keyframes popUp {
0% { }
70% { -webkit-transform: scale(1.1); transform: scale(1.1); opacity: .8; -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; }
100% { -webkit-transform: scale(1); transform: scale(1); opacity: 1; }
}
@media screen and (max-width: 900px) {
.masonry-grid .masonry-item {
width: 50%;
}
}
@media screen and (max-width: 400px) {
.masonry-grid .masonry-item {
width: 100%;
}
}

View File

@@ -0,0 +1,247 @@
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
// playground: stackblitz.com/edit/countup-typescript
var CountUp = /** @class */ (function () {
function CountUp(target, endVal, options) {
var _this = this;
this.target = target;
this.endVal = endVal;
this.options = options;
this.version = '2.0.4';
this.defaults = {
startVal: 0,
decimalPlaces: 0,
duration: 2,
useEasing: true,
useGrouping: true,
smartEasingThreshold: 999,
smartEasingAmount: 333,
separator: ',',
decimal: '.',
prefix: '',
suffix: ''
};
this.finalEndVal = null; // for smart easing
this.useEasing = true;
this.countDown = false;
this.error = '';
this.startVal = 0;
this.paused = true;
this.count = function (timestamp) {
if (!_this.startTime) {
_this.startTime = timestamp;
}
var progress = timestamp - _this.startTime;
_this.remaining = _this.duration - progress;
// to ease or not to ease
if (_this.useEasing) {
if (_this.countDown) {
_this.frameVal = _this.startVal - _this.easingFn(progress, 0, _this.startVal - _this.endVal, _this.duration);
}
else {
_this.frameVal = _this.easingFn(progress, _this.startVal, _this.endVal - _this.startVal, _this.duration);
}
}
else {
if (_this.countDown) {
_this.frameVal = _this.startVal - ((_this.startVal - _this.endVal) * (progress / _this.duration));
}
else {
_this.frameVal = _this.startVal + (_this.endVal - _this.startVal) * (progress / _this.duration);
}
}
// don't go past endVal since progress can exceed duration in the last frame
if (_this.countDown) {
_this.frameVal = (_this.frameVal < _this.endVal) ? _this.endVal : _this.frameVal;
}
else {
_this.frameVal = (_this.frameVal > _this.endVal) ? _this.endVal : _this.frameVal;
}
// decimal
_this.frameVal = Math.round(_this.frameVal * _this.decimalMult) / _this.decimalMult;
// format and print value
_this.printValue(_this.frameVal);
// whether to continue
if (progress < _this.duration) {
_this.rAF = requestAnimationFrame(_this.count);
}
else if (_this.finalEndVal !== null) {
// smart easing
_this.update(_this.finalEndVal);
}
else {
if (_this.callback) {
_this.callback();
}
}
};
// default format and easing functions
this.formatNumber = function (num) {
var neg = (num < 0) ? '-' : '';
var result, x, x1, x2, x3;
result = Math.abs(num).toFixed(_this.options.decimalPlaces);
result += '';
x = result.split('.');
x1 = x[0];
x2 = x.length > 1 ? _this.options.decimal + x[1] : '';
if (_this.options.useGrouping) {
x3 = '';
for (var i = 0, len = x1.length; i < len; ++i) {
if (i !== 0 && (i % 3) === 0) {
x3 = _this.options.separator + x3;
}
x3 = x1[len - i - 1] + x3;
}
x1 = x3;
}
// optional numeral substitution
if (_this.options.numerals && _this.options.numerals.length) {
x1 = x1.replace(/[0-9]/g, function (w) { return _this.options.numerals[+w]; });
x2 = x2.replace(/[0-9]/g, function (w) { return _this.options.numerals[+w]; });
}
return neg + _this.options.prefix + x1 + x2 + _this.options.suffix;
};
this.easeOutExpo = function (t, b, c, d) {
return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b;
};
this.options = __assign({}, this.defaults, options);
this.formattingFn = (this.options.formattingFn) ?
this.options.formattingFn : this.formatNumber;
this.easingFn = (this.options.easingFn) ?
this.options.easingFn : this.easeOutExpo;
this.startVal = this.validateValue(this.options.startVal);
this.frameVal = this.startVal;
this.endVal = this.validateValue(endVal);
this.options.decimalPlaces = Math.max(0 || this.options.decimalPlaces);
this.decimalMult = Math.pow(10, this.options.decimalPlaces);
this.resetDuration();
this.options.separator = String(this.options.separator);
this.useEasing = this.options.useEasing;
if (this.options.separator === '') {
this.options.useGrouping = false;
}
this.el = (typeof target === 'string') ? document.getElementById(target) : target;
if (this.el) {
this.printValue(this.startVal);
}
else {
this.error = '[CountUp] target is null or undefined';
}
}
// determines where easing starts and whether to count down or up
CountUp.prototype.determineDirectionAndSmartEasing = function () {
var end = (this.finalEndVal) ? this.finalEndVal : this.endVal;
this.countDown = (this.startVal > end);
var animateAmount = end - this.startVal;
if (Math.abs(animateAmount) > this.options.smartEasingThreshold) {
this.finalEndVal = end;
var up = (this.countDown) ? 1 : -1;
this.endVal = end + (up * this.options.smartEasingAmount);
this.duration = this.duration / 2;
}
else {
this.endVal = end;
this.finalEndVal = null;
}
if (this.finalEndVal) {
this.useEasing = false;
}
else {
this.useEasing = this.options.useEasing;
}
};
// start animation
CountUp.prototype.start = function (callback) {
if (this.error) {
return;
}
this.callback = callback;
if (this.duration > 0) {
this.determineDirectionAndSmartEasing();
this.paused = false;
this.rAF = requestAnimationFrame(this.count);
}
else {
this.printValue(this.endVal);
}
};
// pause/resume animation
CountUp.prototype.pauseResume = function () {
if (!this.paused) {
cancelAnimationFrame(this.rAF);
}
else {
this.startTime = null;
this.duration = this.remaining;
this.startVal = this.frameVal;
this.determineDirectionAndSmartEasing();
this.rAF = requestAnimationFrame(this.count);
}
this.paused = !this.paused;
};
// reset to startVal so animation can be run again
CountUp.prototype.reset = function () {
cancelAnimationFrame(this.rAF);
this.paused = true;
this.resetDuration();
this.startVal = this.validateValue(this.options.startVal);
this.frameVal = this.startVal;
this.printValue(this.startVal);
};
// pass a new endVal and start animation
CountUp.prototype.update = function (newEndVal) {
cancelAnimationFrame(this.rAF);
this.startTime = null;
this.endVal = this.validateValue(newEndVal);
if (this.endVal === this.frameVal) {
return;
}
this.startVal = this.frameVal;
if (!this.finalEndVal) {
this.resetDuration();
}
this.determineDirectionAndSmartEasing();
this.rAF = requestAnimationFrame(this.count);
};
CountUp.prototype.printValue = function (val) {
var result = this.formattingFn(val);
if (this.el.tagName === 'INPUT') {
var input = this.el;
input.value = result;
}
else if (this.el.tagName === 'text' || this.el.tagName === 'tspan') {
this.el.textContent = result;
}
else {
this.el.innerHTML = result;
}
};
CountUp.prototype.ensureNumber = function (n) {
return (typeof n === 'number' && !isNaN(n));
};
CountUp.prototype.validateValue = function (value) {
var newValue = Number(value);
if (!this.ensureNumber(newValue)) {
this.error = "[CountUp] invalid start or end value: " + value;
return null;
}
else {
return newValue;
}
};
CountUp.prototype.resetDuration = function () {
this.startTime = null;
this.duration = Number(this.options.duration) * 1000;
this.remaining = this.duration;
};
return CountUp;
}());

View File

@@ -0,0 +1 @@
var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var i,a=1,s=arguments.length;a<s;a++)for(var n in i=arguments[a])Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n]);return t}).apply(this,arguments)},CountUp=function(){function t(t,i,a){var s=this;this.target=t,this.endVal=i,this.options=a,this.version="2.0.4",this.defaults={startVal:0,decimalPlaces:0,duration:2,useEasing:!0,useGrouping:!0,smartEasingThreshold:999,smartEasingAmount:333,separator:",",decimal:".",prefix:"",suffix:""},this.finalEndVal=null,this.useEasing=!0,this.countDown=!1,this.error="",this.startVal=0,this.paused=!0,this.count=function(t){s.startTime||(s.startTime=t);var i=t-s.startTime;s.remaining=s.duration-i,s.useEasing?s.countDown?s.frameVal=s.startVal-s.easingFn(i,0,s.startVal-s.endVal,s.duration):s.frameVal=s.easingFn(i,s.startVal,s.endVal-s.startVal,s.duration):s.countDown?s.frameVal=s.startVal-(s.startVal-s.endVal)*(i/s.duration):s.frameVal=s.startVal+(s.endVal-s.startVal)*(i/s.duration),s.countDown?s.frameVal=s.frameVal<s.endVal?s.endVal:s.frameVal:s.frameVal=s.frameVal>s.endVal?s.endVal:s.frameVal,s.frameVal=Math.round(s.frameVal*s.decimalMult)/s.decimalMult,s.printValue(s.frameVal),i<s.duration?s.rAF=requestAnimationFrame(s.count):null!==s.finalEndVal?s.update(s.finalEndVal):s.callback&&s.callback()},this.formatNumber=function(t){var i,a,n,e,r,o=t<0?"-":"";if(i=Math.abs(t).toFixed(s.options.decimalPlaces),n=(a=(i+="").split("."))[0],e=a.length>1?s.options.decimal+a[1]:"",s.options.useGrouping){r="";for(var l=0,h=n.length;l<h;++l)0!==l&&l%3==0&&(r=s.options.separator+r),r=n[h-l-1]+r;n=r}return s.options.numerals&&s.options.numerals.length&&(n=n.replace(/[0-9]/g,function(t){return s.options.numerals[+t]}),e=e.replace(/[0-9]/g,function(t){return s.options.numerals[+t]})),o+s.options.prefix+n+e+s.options.suffix},this.easeOutExpo=function(t,i,a,s){return a*(1-Math.pow(2,-10*t/s))*1024/1023+i},this.options=__assign({},this.defaults,a),this.formattingFn=this.options.formattingFn?this.options.formattingFn:this.formatNumber,this.easingFn=this.options.easingFn?this.options.easingFn:this.easeOutExpo,this.startVal=this.validateValue(this.options.startVal),this.frameVal=this.startVal,this.endVal=this.validateValue(i),this.options.decimalPlaces=Math.max(this.options.decimalPlaces),this.decimalMult=Math.pow(10,this.options.decimalPlaces),this.resetDuration(),this.options.separator=String(this.options.separator),this.useEasing=this.options.useEasing,""===this.options.separator&&(this.options.useGrouping=!1),this.el="string"==typeof t?document.getElementById(t):t,this.el?this.printValue(this.startVal):this.error="[CountUp] target is null or undefined"}return t.prototype.determineDirectionAndSmartEasing=function(){var t=this.finalEndVal?this.finalEndVal:this.endVal;this.countDown=this.startVal>t;var i=t-this.startVal;if(Math.abs(i)>this.options.smartEasingThreshold){this.finalEndVal=t;var a=this.countDown?1:-1;this.endVal=t+a*this.options.smartEasingAmount,this.duration=this.duration/2}else this.endVal=t,this.finalEndVal=null;this.finalEndVal?this.useEasing=!1:this.useEasing=this.options.useEasing},t.prototype.start=function(t){this.error||(this.callback=t,this.duration>0?(this.determineDirectionAndSmartEasing(),this.paused=!1,this.rAF=requestAnimationFrame(this.count)):this.printValue(this.endVal))},t.prototype.pauseResume=function(){this.paused?(this.startTime=null,this.duration=this.remaining,this.startVal=this.frameVal,this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count)):cancelAnimationFrame(this.rAF),this.paused=!this.paused},t.prototype.reset=function(){cancelAnimationFrame(this.rAF),this.paused=!0,this.resetDuration(),this.startVal=this.validateValue(this.options.startVal),this.frameVal=this.startVal,this.printValue(this.startVal)},t.prototype.update=function(t){cancelAnimationFrame(this.rAF),this.startTime=null,this.endVal=this.validateValue(t),this.endVal!==this.frameVal&&(this.startVal=this.frameVal,this.finalEndVal||this.resetDuration(),this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count))},t.prototype.printValue=function(t){var i=this.formattingFn(t);"INPUT"===this.el.tagName?this.el.value=i:"text"===this.el.tagName||"tspan"===this.el.tagName?this.el.textContent=i:this.el.innerHTML=i},t.prototype.ensureNumber=function(t){return"number"==typeof t&&!isNaN(t)},t.prototype.validateValue=function(t){var i=Number(t);return this.ensureNumber(i)?i:(this.error="[CountUp] invalid start or end value: "+t,null)},t.prototype.resetDuration=function(){this.startTime=null,this.duration=1e3*Number(this.options.duration),this.remaining=this.duration},t}();

View File

@@ -0,0 +1,398 @@
/**
* donutty // Create SVG donut charts with Javascript
* @author simeydotme <simey.me@gmail.com>
* @version 2.0.0
* @license MIT
* @link http://simey.me
* @preserve
*/
(function( doc, win ) {
var donutty,
namespace = "http://www.w3.org/2000/svg";
function isDefined( input ) {
return typeof input !== "undefined";
}
function float( input ) {
return parseFloat( input, 10 );
}
function truth( input ) {
return isDefined( input ) && ( input === true || input === "true" );
}
donutty = win.Donutty = function( el, options ) {
if ( el && typeof el === "string" ) {
this.$wrapper = doc.querySelectorAll( el )[0];
} else if ( doc.querySelector( `.${el.className}` ) ) {
this.$wrapper = el;
} else {
this.$wrapper = doc.body;
options = el;
}
if ( !this.$wrapper ) {
return this;
}
if ( !isDefined( options ) ) {
options = this.getOptionsFromTag();
}
this.state = {};
this.options = options || {};
this.options.min = isDefined( this.options.min ) ? float( this.options.min ) : 0;
this.options.max = isDefined( this.options.max ) ? float( this.options.max ) : 100;
this.options.value = isDefined( this.options.value ) ? float( this.options.value ) : 50;
this.options.round = isDefined( this.options.round ) ? truth( this.options.round ) : true;
this.options.circle = isDefined( this.options.circle ) ? truth( this.options.circle ) : true;
this.options.padding = isDefined( this.options.padding ) ? float( this.options.padding ) : 4;
this.options.radius = float( this.options.radius ) || 50;
this.options.thickness = float( this.options.thickness ) || 10;
this.options.bg = this.options.bg || "rgba(70, 130, 180, 0.15)";
this.options.color = this.options.color || "mediumslateblue";
this.options.transition = this.options.transition || "all 1.2s cubic-bezier(0.57, 0.13, 0.18, 0.98)";
this.options.text = isDefined( this.options.text ) ? this.options.text : false;
this.init();
return this;
};
donutty.prototype.getOptionsFromTag = function() {
return JSON.parse(JSON.stringify(this.$wrapper.dataset));
};
donutty.prototype.init = function() {
this.$wrapper.donutty = this;
var values;
// create the state object from the options,
// and then get the dash values for use in element creation
this.createState();
values = this.getDashValues();
this.createSvg();
this.createBg( values );
this.createDonut( values );
this.createText();
this.insertFragments( values );
return this;
};
donutty.prototype.createState = function() {
this.state.min = this.options.min;
this.state.max = this.options.max;
this.state.value = this.options.value;
this.state.bg = this.options.bg;
this.state.color = this.options.color;
return this;
};
donutty.prototype.createText = function() {
if ( typeof this.options.text === "function" ) {
this.$text = doc.createElement( "span" );
this.$text.setAttribute( "class", "donut-text" );
this.$text.style.opacity = 0;
this.updateText();
}
return this;
};
donutty.prototype.createBg = function( values ) {
this.$bg = doc.createElementNS( namespace, "circle" );
this.$bg.setAttribute( "cx", "50%" );
this.$bg.setAttribute( "cy", "50%" );
this.$bg.setAttribute( "r", this.options.radius );
this.$bg.setAttribute( "fill", "transparent" );
this.$bg.setAttribute( "stroke", this.state.bg );
this.$bg.setAttribute( "stroke-width", this.options.thickness + this.options.padding );
this.$bg.setAttribute( "stroke-dasharray", values.full * values.multiplier );
this.$bg.setAttribute( "class", "donut-bg" );
if ( this.options.round ) {
this.$bg.setAttribute( "stroke-linecap", "round" );
}
return this;
};
donutty.prototype.createDonut = function( values ) {
this.$donut = doc.createElementNS( namespace, "circle" );
this.$donut.setAttribute( "fill", "transparent" );
this.$donut.setAttribute( "cx", "50%" );
this.$donut.setAttribute( "cy", "50%" );
this.$donut.setAttribute( "r", this.options.radius );
this.$donut.setAttribute( "stroke", this.state.color );
this.$donut.setAttribute( "stroke-width", this.options.thickness );
this.$donut.setAttribute( "stroke-dashoffset", values.full );
this.$donut.setAttribute( "stroke-dasharray", values.full );
this.$donut.setAttribute( "class", "donut-fill" );
this.$donut.style.opacity = 0;
if ( this.options.round ) {
this.$donut.setAttribute( "stroke-linecap", "round" );
}
return this;
};
donutty.prototype.createSvg = function() {
var viewbox = this.options.radius * 2 + this.options.thickness + ( this.options.padding * 2 ),
rotateExtra = this.options.round ? this.options.thickness / 3 : 0,
rotate = this.options.circle ? 90 + rotateExtra : -225;
this.$html = doc.createDocumentFragment();
this.$svg = doc.createElementNS( namespace, "svg" );
this.$svg.setAttribute( "xmlns", namespace );
this.$svg.setAttribute( "viewbox", "0 0 " + viewbox + " " + viewbox );
this.$svg.setAttribute( "transform", "rotate( " + rotate +" )" );
this.$svg.setAttribute( "preserveAspectRatio", "xMidYMid meet" );
this.$svg.setAttribute( "class", "donut" );
return this;
};
donutty.prototype.insertFragments = function( values ) {
this.$svg.appendChild( this.$bg );
this.$svg.appendChild( this.$donut );
this.$html.appendChild( this.$svg );
if ( this.$text ) {
this.$html.appendChild( this.$text );
}
this.$wrapper.appendChild( this.$html );
// because of a strange bug in browsers not updating
// the "preserveAspectRatio" setting when applied programmatically,
// we need to essentially delete the DOM fragment, and then
// set the innerHTML of the parent so that it updates in browser.
this.$wrapper.innerHTML = this.$wrapper.innerHTML;
// and because we just destroyed the DOM fragment and all
// the references to it, we now set all those references again.
this.$svg = this.$wrapper.querySelector(".donut");
this.$bg = this.$wrapper.querySelector(".donut-bg");
this.$donut = this.$wrapper.querySelector(".donut-fill");
if ( this.$text ) {
this.$text = this.$wrapper.querySelector(".donut-text");
}
// now the references are re-set, we can go
// ahead and animate the element again.
this.animate( values.fill, values.full );
};
donutty.prototype.getDashValues = function() {
var circumference,
percentageFilled,
absoluteFilled,
multiplier;
multiplier = this.options.circle ? 1 : 0.75;
circumference = 2 * Math.PI * this.options.radius;
percentageFilled = ( this.state.value - this.state.min ) / ( this.state.max - this.state.min ) * 100;
absoluteFilled = circumference - ( ( circumference * multiplier ) / 100 * percentageFilled );
if (
this.options.round &&
this.options.circle &&
percentageFilled < 100 &&
absoluteFilled < this.options.thickness
) {
// when in circle mode, if the linecaps are "round"
// then the circle would look complete if it is actually
// only ~97% complete, this is because the linecaps
// overhang the stroke.
absoluteFilled = this.options.thickness;
}
return {
fill: absoluteFilled,
full: circumference,
multiplier: multiplier
};
};
donutty.prototype.animate = function( fill, full ) {
var _this = this;
// ensure the transition property is applied before
// the actual properties are set, so that browser renders
// the transition
_this.$bg.style.transition = this.options.transition;
_this.$donut.style.transition = this.options.transition;
if ( _this.$text ) {
_this.$text.style.transition = this.options.transition;
}
// use a short timeout (~60fps) to simulate a new
// animation frame (not using rAF due to ie9 problems)
window.setTimeout( function() {
_this.$bg.setAttribute( "stroke", _this.state.bg );
_this.$bg.style.opacity = 1;
_this.$donut.setAttribute( "stroke-dashoffset", fill );
_this.$donut.setAttribute( "stroke-dasharray", full );
_this.$donut.setAttribute( "stroke", _this.state.color );
_this.$donut.style.opacity = 1;
if ( _this.$text ) {
_this.$text.style.opacity = 1;
}
}, 16 );
};
/**
* use the current state to set the text inside
* the text element (only if option is provided);
* @return {object} the donut instance
*/
donutty.prototype.updateText = function() {
if ( typeof this.options.text === "function" ) {
this.$text.innerHTML = this.options.text( this.state );
}
return this;
};
/**
* set an individual state property for the chart
* @param {string} prop the property to set
* @param {string/number} val the value of the given property
* @return {object} the donut instance
* @chainable
*/
donutty.prototype.set = function( prop, val ) {
var values;
if ( isDefined( prop ) && isDefined( val ) ) {
this.state[ prop ] = val;
values = this.getDashValues();
this.updateText();
this.animate( values.fill, values.full );
}
return this;
};
/**
* set multiple state properties with an object
* @param {object} newState a map of properties to set
* @return {object} the donut instance
* @chainable
*/
donutty.prototype.setState = function( newState ) {
var values;
if ( isDefined( newState.value ) ) {
this.state.value = newState.value;
}
if ( isDefined( newState.min ) ) {
this.state.min = newState.min;
}
if ( isDefined( newState.max ) ) {
this.state.max = newState.max;
}
if ( isDefined( newState.bg ) ) {
this.state.bg = newState.bg;
}
if ( isDefined( newState.color ) ) {
this.state.color = newState.color;
}
values = this.getDashValues();
this.updateText();
this.animate( values.fill, values.full );
return this;
};
}( document, window ));
// jquery constructor
( function( Donutty, $ ) {
if ( typeof window.$ !== "undefined" ) {
$( function() {
$.fn.donutty = function( options ) {
return $( this ).each( function() {
new Donutty( this, options );
});
};
$( "[data-donutty]" ).donutty();
});
} else {
console.warn( "Can't find jQuery to attach Donutty" );
}
}( Donutty, jQuery ));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
/*! Simple JavaScript Inheritance
* By John Resig http://ejohn.org/
* MIT Licensed.
*/
!function(){"use strict";var a=!1;window.JQClass=function(){},JQClass.classes={},JQClass.extend=function b(c){function d(){!a&&this._init&&this._init.apply(this,arguments)}var e=this.prototype;a=!0;var f=new this;a=!1;for(var g in c)if("function"==typeof c[g]&&"function"==typeof e[g])f[g]=function(a,b){return function(){var c=this._super;this._super=function(b){return e[a].apply(this,b||[])};var d=b.apply(this,arguments);return this._super=c,d}}(g,c[g]);else if("object"==typeof c[g]&&"object"==typeof e[g]&&"defaultOptions"===g){var h,i=e[g],j=c[g],k={};for(h in i)k[h]=i[h];for(h in j)k[h]=j[h];f[g]=k}else f[g]=c[g];return d.prototype=f,d.prototype.constructor=d,d.extend=b,d}}(),/*! Abstract base class for collection plugins v1.0.2.
Written by Keith Wood (wood.keith{at}optusnet.com.au) December 2013.
Licensed under the MIT license (http://keith-wood.name/licence.html). */
function($){"use strict";function camelCase(a){return a.replace(/-([a-z])/g,function(a,b){return b.toUpperCase()})}JQClass.classes.JQPlugin=JQClass.extend({name:"plugin",defaultOptions:{},regionalOptions:{},deepMerge:!0,_getMarker:function(){return"is-"+this.name},_init:function(){$.extend(this.defaultOptions,this.regionalOptions&&this.regionalOptions[""]||{});var a=camelCase(this.name);$[a]=this,$.fn[a]=function(b){var c=Array.prototype.slice.call(arguments,1),d=this,e=this;return this.each(function(){if("string"==typeof b){if("_"===b[0]||!$[a][b])throw"Unknown method: "+b;var f=$[a][b].apply($[a],[this].concat(c));if(f!==d&&void 0!==f)return e=f,!1}else $[a]._attach(this,b)}),e}},setDefaults:function(a){$.extend(this.defaultOptions,a||{})},_attach:function(a,b){if(a=$(a),!a.hasClass(this._getMarker())){a.addClass(this._getMarker()),b=$.extend(this.deepMerge,{},this.defaultOptions,this._getMetadata(a),b||{});var c=$.extend({name:this.name,elem:a,options:b},this._instSettings(a,b));a.data(this.name,c),this._postAttach(a,c),this.option(a,b)}},_instSettings:function(a,b){return{}},_postAttach:function(a,b){},_getMetadata:function(elem){try{var data=elem.data(this.name.toLowerCase())||"";data=data.replace(/(\\?)'/g,function(a,b){return b?"'":'"'}).replace(/([a-zA-Z0-9]+):/g,function(a,b,c){var d=data.substring(0,c).match(/"/g);return d&&d.length%2!==0?b+":":'"'+b+'":'}).replace(/\\:/g,":"),data=$.parseJSON("{"+data+"}");for(var key in data)if(data.hasOwnProperty(key)){var value=data[key];"string"==typeof value&&value.match(/^new Date\(([-0-9,\s]*)\)$/)&&(data[key]=eval(value))}return data}catch(a){return{}}},_getInst:function(a){return $(a).data(this.name)||{}},option:function(a,b,c){a=$(a);var d=a.data(this.name),e=b||{};return!b||"string"==typeof b&&"undefined"==typeof c?(e=(d||{}).options,e&&b?e[b]:e):void(a.hasClass(this._getMarker())&&("string"==typeof b&&(e={},e[b]=c),this._optionsChanged(a,d,e),$.extend(d.options,e)))},_optionsChanged:function(a,b,c){},destroy:function(a){a=$(a),a.hasClass(this._getMarker())&&(this._preDestroy(a,this._getInst(a)),a.removeData(this.name).removeClass(this._getMarker()))},_preDestroy:function(a,b){}}),$.JQPlugin={createPlugin:function(a,b){"object"==typeof a&&(b=a,a="JQPlugin"),a=camelCase(a);var c=camelCase(b.name);JQClass.classes[c]=JQClass.classes[a].extend(b),new JQClass.classes[c]}}}(jQuery);
//# sourceMappingURL=jquery.plugin.min.map

View File

@@ -0,0 +1,16 @@
/* http://keith-wood.name/countdown.html
Arabic (عربي) initialisation for the jQuery countdown extension
Translated by Talal Al Asmari (talal@psdgroups.com), April 2009. */
(function($) {
'use strict';
$.countdown.regionalOptions.ar = {
labels: ['سنوات','أشهر','أسابيع','أيام','ساعات','دقائق','ثواني'],
labels1: ['سنة','شهر','أسبوع','يوم','ساعة','دقيقة','ثانية'],
compactLabels: ['س','ش','أ','ي'],
whichLabels: null,
digits: ['٠','١','٢','٣','٤','٥','٦','٧','٨','٩'],
timeSeparator: ':',
isRTL: true
};
$.countdown.setDefaults($.countdown.regionalOptions.ar);
})(jQuery);

View File

@@ -0,0 +1,17 @@
/* http://keith-wood.name/countdown.html
* Bulgarian initialisation for the jQuery countdown extension
* Written by Manol Trendafilov manol@rastermania.com (2010) */
(function($) {
'use strict';
$.countdown.regionalOptions.bg = {
labels: ['Години','Месеца','Седмица','Дни','Часа','Минути','Секунди'],
labels1: ['Година','Месец','Седмица','Ден','Час','Минута','Секунда'],
compactLabels: ['l','m','n','d'],
compactLabels1: ['g','m','n','d'],
whichLabels: null,
digits: ['0','1','2','3','4','5','6','7','8','9'],
timeSeparator: ':',
isRTL: false
};
$.countdown.setDefaults($.countdown.regionalOptions.bg);
})(jQuery);

View File

@@ -0,0 +1,16 @@
/* http://keith-wood.name/countdown.html
* Bengali/Bangla initialisation for the jQuery countdown extension
* Written by Mohammed Tajuddin (tajuddin@chittagong-it.com) Jan 2011. */
(function($) {
'use strict';
$.countdown.regionalOptions.bn = {
labels: ['বছর','মাস','সপ্তাহ','দিন','ঘন্টা','মিনিট','সেকেন্ড'],
labels1: ['বছর','মাস','সপ্তাহ','দিন','ঘন্টা','মিনিট','সেকেন্ড'],
compactLabels: ['ব','মা','স','দি'],
whichLabels: null,
digits: ['0','1','2','3','4','5','6','7','8','9'],
timeSeparator: ':',
isRTL: false
};
$.countdown.setDefaults($.countdown.regionalOptions.bn);
})(jQuery);

View File

@@ -0,0 +1,19 @@
/* http://keith-wood.name/countdown.html
* Bosnian Latin initialisation for the jQuery countdown extension
* Written by Miralem Mehic miralem@mehic.info (2011) */
(function($) {
'use strict';
$.countdown.regionalOptions.bs = {
labels: ['Godina','Mjeseci','Sedmica','Dana','Sati','Minuta','Sekundi'],
labels1: ['Godina','Mjesec','Sedmica','Dan','Sat','Minuta','Sekunda'],
labels2: ['Godine','Mjeseca','Sedmica','Dana','Sata','Minute','Sekunde'],
compactLabels: ['g','m','t','d'],
whichLabels: function(amount) {
return (amount === 1 ? 1 : (amount >= 2 && amount <= 4 ? 2 : 0));
},
digits: ['0','1','2','3','4','5','6','7','8','9'],
timeSeparator: ':',
isRTL: false
};
$.countdown.setDefaults($.countdown.regionalOptions.bs);
})(jQuery);

View File

@@ -0,0 +1,16 @@
/* http://keith-wood.name/countdown.html
Catalan initialisation for the jQuery countdown extension
Written by Amanida Media www.amanidamedia.com (2010) */
(function($) {
'use strict';
$.countdown.regionalOptions.ca = {
labels: ['Anys','Mesos','Setmanes','Dies','Hores','Minuts','Segons'],
labels1: ['Anys','Mesos','Setmanes','Dies','Hores','Minuts','Segons'],
compactLabels: ['a','m','s','g'],
whichLabels: null,
digits: ['0','1','2','3','4','5','6','7','8','9'],
timeSeparator: ':',
isRTL: false
};
$.countdown.setDefaults($.countdown.regionalOptions.ca);
})(jQuery);

View File

@@ -0,0 +1,19 @@
/* http://keith-wood.name/countdown.html
* Czech initialisation for the jQuery countdown extension
* Written by Roman Chlebec (creamd@c64.sk) (2008) */
(function($) {
'use strict';
$.countdown.regionalOptions.cs = {
labels: ['Roků','Měsíců','Týdnů','Dní','Hodin','Minut','Sekund'],
labels1: ['Rok','Měsíc','Týden','Den','Hodina','Minuta','Sekunda'],
labels2: ['Roky','Měsíce','Týdny','Dny','Hodiny','Minuty','Sekundy'],
compactLabels: ['r','m','t','d'],
whichLabels: function(amount) {
return (amount === 1 ? 1 : (amount >= 2 && amount <= 4 ? 2 : 0));
},
digits: ['0','1','2','3','4','5','6','7','8','9'],
timeSeparator: ':',
isRTL: false
};
$.countdown.setDefaults($.countdown.regionalOptions.cs);
})(jQuery);

View File

@@ -0,0 +1,2 @@
/* http://keith-wood.name/countdown.html
Welsh initialisation for the jQuery countdown extension

View File

@@ -0,0 +1,16 @@
/* http://keith-wood.name/countdown.html
Danish initialisation for the jQuery countdown extension
Written by Buch (admin@buch90.dk). */
(function($) {
'use strict';
$.countdown.regionalOptions.da = {
labels: ['År','Måneder','Uger','Dage','Timer','Minutter','Sekunder'],
labels1: ['År','Måned','Uge','Dag','Time','Minut','Sekund'],
compactLabels: ['Å','M','U','D'],
whichLabels: null,
digits: ['0','1','2','3','4','5','6','7','8','9'],
timeSeparator: ':',
isRTL: false
};
$.countdown.setDefaults($.countdown.regionalOptions.da);
})(jQuery);

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