WP init
@@ -0,0 +1,250 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Controls_Ajax_Select2_Api extends Core\Handler_Api {
|
||||
|
||||
public function config() {
|
||||
$this->prefix = 'ajaxselect2';
|
||||
}
|
||||
|
||||
public function get_post_list() {
|
||||
|
||||
if ( ! current_user_can( 'edit_posts' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$query_args = array(
|
||||
'post_type' => 'post',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => 15,
|
||||
);
|
||||
|
||||
if ( isset( $this->request['ids'] ) ) {
|
||||
$ids = explode( ',', $this->request['ids'] );
|
||||
$query_args['post__in'] = $ids;
|
||||
}
|
||||
if ( isset( $this->request['s'] ) ) {
|
||||
$query_args['s'] = $this->request['s'];
|
||||
}
|
||||
|
||||
$query = new \WP_Query( $query_args );
|
||||
$options = array();
|
||||
if ( $query->have_posts() ) :
|
||||
while ( $query->have_posts() ) {
|
||||
$query->the_post();
|
||||
$options[] = array(
|
||||
'id' => get_the_ID(),
|
||||
'text' => get_the_title(),
|
||||
);
|
||||
}
|
||||
endif;
|
||||
|
||||
return array( 'results' => $options );
|
||||
wp_reset_postdata();
|
||||
}
|
||||
|
||||
public function get_page_list() {
|
||||
if ( ! current_user_can( 'edit_posts' ) ) {
|
||||
return;
|
||||
}
|
||||
$query_args = array(
|
||||
'post_type' => 'page',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => 15,
|
||||
);
|
||||
|
||||
if ( isset( $this->request['ids'] ) ) {
|
||||
$ids = explode( ',', $this->request['ids'] );
|
||||
$query_args['post__in'] = $ids;
|
||||
}
|
||||
if ( isset( $this->request['s'] ) ) {
|
||||
$query_args['s'] = $this->request['s'];
|
||||
}
|
||||
|
||||
$query = new \WP_Query( $query_args );
|
||||
$options = array();
|
||||
if ( $query->have_posts() ) :
|
||||
while ( $query->have_posts() ) {
|
||||
$query->the_post();
|
||||
$options[] = array(
|
||||
'id' => get_the_ID(),
|
||||
'text' => get_the_title(),
|
||||
);
|
||||
}
|
||||
endif;
|
||||
|
||||
return array( 'results' => $options );
|
||||
wp_reset_postdata();
|
||||
}
|
||||
|
||||
public function get_singular_list() {
|
||||
$query_args = array(
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => 15,
|
||||
'post_type' => 'any',
|
||||
);
|
||||
|
||||
if ( isset( $this->request['ids'] ) ) {
|
||||
$ids = explode( ',', $this->request['ids'] );
|
||||
$query_args['post__in'] = $ids;
|
||||
$query_args['posts_per_page'] = 200;
|
||||
}
|
||||
if ( isset( $this->request['s'] ) ) {
|
||||
$query_args['s'] = $this->request['s'];
|
||||
}
|
||||
|
||||
$query = new \WP_Query( $query_args );
|
||||
$options = array();
|
||||
if ( $query->have_posts() ) :
|
||||
while ( $query->have_posts() ) {
|
||||
$query->the_post();
|
||||
$options[] = array(
|
||||
'id' => get_the_ID(),
|
||||
'text' => get_the_title(),
|
||||
);
|
||||
}
|
||||
endif;
|
||||
|
||||
return array( 'results' => $options );
|
||||
wp_reset_postdata();
|
||||
}
|
||||
|
||||
public function get_category() {
|
||||
|
||||
$taxonomy = 'category';
|
||||
$query_args = array(
|
||||
'taxonomy' => array( 'category' ), // taxonomy name
|
||||
'orderby' => 'name',
|
||||
'order' => 'DESC',
|
||||
'hide_empty' => true,
|
||||
'number' => 10,
|
||||
);
|
||||
|
||||
if ( isset( $this->request['ids'] ) ) {
|
||||
$ids = explode( ',', $this->request['ids'] );
|
||||
$query_args['include'] = $ids;
|
||||
}
|
||||
if ( isset( $this->request['s'] ) ) {
|
||||
$query_args['name__like'] = $this->request['s'];
|
||||
}
|
||||
|
||||
$terms = get_terms( $query_args );
|
||||
|
||||
$options = array();
|
||||
|
||||
if ( is_countable( $terms ) && count( $terms ) > 0 ) :
|
||||
|
||||
foreach ( $terms as $term ) {
|
||||
$options[] = array(
|
||||
'id' => $term->term_id,
|
||||
'text' => $term->name,
|
||||
);
|
||||
}
|
||||
endif;
|
||||
return array( 'results' => $options );
|
||||
}
|
||||
|
||||
public function get_product_list() {
|
||||
$query_args = array(
|
||||
'post_type' => 'product',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => 15,
|
||||
);
|
||||
|
||||
if ( isset( $this->request['ids'] ) ) {
|
||||
$ids = explode( ',', $this->request['ids'] );
|
||||
$query_args['post__in'] = $ids;
|
||||
}
|
||||
if ( isset( $this->request['s'] ) ) {
|
||||
$query_args['s'] = $this->request['s'];
|
||||
}
|
||||
|
||||
$query = new \WP_Query( $query_args );
|
||||
$options = array();
|
||||
if ( $query->have_posts() ) :
|
||||
while ( $query->have_posts() ) {
|
||||
$query->the_post();
|
||||
$options[] = array(
|
||||
'id' => get_the_ID(),
|
||||
'text' => get_the_title(),
|
||||
);
|
||||
}
|
||||
endif;
|
||||
|
||||
return array( 'results' => $options );
|
||||
wp_reset_postdata();
|
||||
}
|
||||
|
||||
public function get_product_cat() {
|
||||
$query_args = array(
|
||||
'taxonomy' => array( 'product_cat' ), // taxonomy name
|
||||
'orderby' => 'name',
|
||||
'order' => 'DESC',
|
||||
'hide_empty' => false,
|
||||
'number' => 6,
|
||||
);
|
||||
|
||||
if ( isset( $this->request['ids'] ) ) {
|
||||
$ids = explode( ',', $this->request['ids'] );
|
||||
$query_args['include'] = $ids;
|
||||
}
|
||||
if ( isset( $this->request['s'] ) ) {
|
||||
$query_args['name__like'] = $this->request['s'];
|
||||
}
|
||||
|
||||
$terms = get_terms( $query_args );
|
||||
|
||||
$options = array();
|
||||
|
||||
if ( is_countable( $terms ) && count( $terms ) > 0 ) :
|
||||
foreach ( $terms as $term ) {
|
||||
$options[] = array(
|
||||
'id' => $term->term_id,
|
||||
'text' => $term->name,
|
||||
);
|
||||
}
|
||||
endif;
|
||||
|
||||
return array( 'results' => $options );
|
||||
}
|
||||
|
||||
public function get_elementor_template_list(){
|
||||
if ( ! current_user_can( 'edit_posts' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$query_args = array(
|
||||
'post_type' => 'elementor_library',
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => 15,
|
||||
);
|
||||
|
||||
if ( isset( $this->request['ids'] ) ) {
|
||||
$ids = explode( ',', $this->request['ids'] );
|
||||
$query_args['post__in'] = $ids;
|
||||
}
|
||||
|
||||
if ( isset( $this->request['s'] ) ) {
|
||||
$query_args['s'] = $this->request['s'];
|
||||
}
|
||||
|
||||
$query = new \WP_Query( $query_args );
|
||||
$options = array();
|
||||
if ( $query->have_posts() ) :
|
||||
while ( $query->have_posts() ) {
|
||||
$query->the_post();
|
||||
$options[] = array(
|
||||
'id' => get_the_ID(),
|
||||
'text' => get_the_title(),
|
||||
);
|
||||
}
|
||||
endif;
|
||||
|
||||
return array( 'results' => $options );
|
||||
wp_reset_postdata();
|
||||
}
|
||||
}
|
||||
|
||||
new Controls_Ajax_Select2_Api();
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Controls;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Ajax_Select2 extends \Elementor\Base_Data_Control {
|
||||
|
||||
public function get_api_url() {
|
||||
return get_rest_url() . 'elementskit/v1';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get select2 control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `select2`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'ajaxselect2';
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue ontrol scripts and styles.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function enqueue() {
|
||||
// Define script dependencies if needed.
|
||||
$dependencies = array('jquery'); // Replace 'jquery' with the appropriate dependency.
|
||||
|
||||
// Register the script with version and set it to load in the footer.
|
||||
wp_register_script('elementskit-js-ajaxchoose-control', Init::get_url() . 'assets/js/ajaxchoose.js', $dependencies, '1.0.0', true);
|
||||
|
||||
// Enqueue the script.
|
||||
wp_enqueue_script('elementskit-js-ajaxchoose-control');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get select2 control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the select2 control. Used to return the
|
||||
* default settings while initializing the select2 control.
|
||||
*
|
||||
* @since 1.8.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return array(
|
||||
'options' => array(),
|
||||
'multiple' => false,
|
||||
'select2options' => array(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render select2 control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
$control_uid = $this->get_control_uid();
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label for="<?php echo esc_attr( $control_uid ); ?>" class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<# var multiple = ( data.multiple ) ? 'multiple' : ''; #>
|
||||
<select
|
||||
id="<?php echo esc_attr( $control_uid ); ?>"
|
||||
class="elementor-megamenuajaxselect2"
|
||||
type="megamenuajaxselect2" {{ multiple }}
|
||||
data-setting="{{ data.name }}"
|
||||
data-ajax-url="<?php echo esc_attr( $this->get_api_url() . '/{{data.options}}/' ); ?>"
|
||||
>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
.elementor-image-choices{margin:0 0 -2px 0}.elementor-image-choices img{max-width:100%;height:auto;border:0;display:block}.elementor-image-choices:after{content:"";clear:both;display:block}.image-choose-label-block{padding:3px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box;margin-left:-3px;vertical-align:middle}.image-choose-label-block:nth-child(4n){clear:both}.image-choose-label-block .imagesmall{width:100%;height:auto;display:block;cursor:pointer}.image-choose-label-block .imagelarge{position:fixed;margin-bottom:5px;display:block;z-index:99999;visibility:hidden;opacity:0;-webkit-transition:opacity .2s linear;transition:opacity .2s linear;border:5px solid #222;background:#fff}.image-choose-label-block .imagelarge:after{position:absolute;left:-5px;top:-15px;content:'';width:0;height:0;border-bottom:10px solid #222;border-right:20px solid transparent}.image-choose-label-block .imagelarge.preview-top{-webkit-transform:translateY(-100%);transform:translateY(-100%)}.image-choose-label-block .imagelarge.preview-top:after{bottom:-15px;top:auto;border-bottom:0;border-top:10px solid #222;border-right:20px solid transparent}.image-choose-label-block:hover .imagelarge{visibility:visible;opacity:1}.image-choose-label-block input{display:none!important}.elementor-image-choices-label{display:block}.elementor-image-choices .elementor-image-choices-label{border:3px solid rgba(0,0,0,.08);padding:2px}.elementor-image-choices input.checked+.elementor-image-choices-label{border:3px solid #a4afb7}
|
||||
@@ -0,0 +1 @@
|
||||
.widgetarea_warper_edit{display:none;position:absolute;top:0;right:0;color:#fff;background:#71d7f7;line-height:1;padding:7px 8px;font-size:11px;border-bottom-left-radius:3px;cursor:pointer;z-index:99999}.widgetarea_warper_editable{min-height:30px;min-width:100px;position:relative}.widgetarea_iframe_modal{display:none}.widgetarea_iframe_modal .dialog-widget-content{position:static!important;margin-top:10px}.elementor-editor-active .widgetarea_warper_editable:hover{outline:1px solid #71d7f7}.elementor-editor-active .widgetarea_warper_editable:hover>.widgetarea_warper_edit{display:block}.elementor-editor-active .widgetarea_warper_editable .widgetarea_warper_editable .widgetarea_warper_edit{display:none!important}
|
||||
@@ -0,0 +1 @@
|
||||
.widgetarea_warper_editable{position:relative}.widgetarea_warper_editable:hover{outline:1px solid #71d7f7}.widgetarea_warper_editable:hover .widgetarea_warper_edit{display:block}.widgetarea_iframe_modal{display:none}.widgetarea_iframe_modal .dialog-message{position:relative}.widgetarea_iframe_modal iframe{position:absolute;top:0;bottom:0;right:0;left:0;width:100%;height:100%}.widgetarea_iframe_modal .dialog-widget-content{position:static!important;margin-top:10px}.widgetarea_warper_edit{display:none;position:absolute;top:0;right:0;color:#fff;background:#71d7f7;line-height:1;padding:7px 8px;font-size:11px;border-bottom-left-radius:3px;cursor:pointer}.elementskit-dynamic-content-modal .dialog-widget-content{max-width:90%!important;margin-top:20px!important;margin-bottom:20px!important;margin:0 auto}.elementor-device-desktop #elementor-preview-responsive-wrapper{min-width:auto!important}.elementskit-dynamic-content-modal .dialog-message{overflow:unset!important}
|
||||
@@ -0,0 +1 @@
|
||||
jQuery(window).on("elementor:init",(function(){"use strict";var e=elementor.modules.controls.BaseData.extend({onReady:function(){var e=this,t=e.ui.select,a=t.attr("data-ajax-url"),n=window.wpApiSettings.nonce;t.select2({ajax:{url:a,dataType:"json",headers:{"X-WP-Nonce":n},data:function(e){return{s:e.term}}},cache:!0});var r=void 0!==e.getControlValue()?e.getControlValue():"";r.isArray&&(r=e.getControlValue().join()),jQuery.ajax({url:a,dataType:"json",headers:{"X-WP-Nonce":n},data:{ids:String(r)}}).then((function(e){null!==e&&e.results.length>0&&(jQuery.each(e.results,(function(e,a){var n=new Option(a.text,a.id,!0,!0);t.append(n).trigger("change")})),t.trigger({type:"select2:select",params:{data:e}}))}))},onBeforeDestroy:function(){this.ui.select.data("select2")&&this.ui.select.select2("destroy"),this.el.remove()}});elementor.addControlView("ajaxselect2",e)}));
|
||||
@@ -0,0 +1 @@
|
||||
jQuery(window).on("elementor:init",(function(){"use strict";var e=elementor.modules.controls.BaseData,t=e.extend({ui:function(){var t=e.prototype.ui.apply(this,arguments);return t.inputs='[type="radio"]',t},events:function(){return _.extend(e.prototype.events.apply(this,arguments),{"mousedown label":"onMouseDownLabel","mouseover label":"onMouseOverLabel","click @ui.inputs":"onClickInput","change @ui.inputs":"onBaseInputChange"})},onMouseOverLabel:function(e){var t=this.$(e.currentTarget),o=jQuery(window).height(),n=t.offset(),i=o/2,r=t.find(".imagelarge"),a={left:n.left+t.width(),top:0};n.top<=i?(r.removeClass("preview-top"),a.top=n.top+t.height()+17):(r.addClass("preview-top"),a.top=n.top-7),r.css(a)},onMouseDownLabel:function(e){var t=this.$(e.currentTarget),o=this.$("#"+t.attr("for"));o.data("checked",o.prop("checked")),this.ui.inputs.removeClass("checked"),o.data("checked",o.addClass("checked"))},onClickInput:function(e){if(this.model.get("toggle")){var t=this.$(e.currentTarget);t.data("checked")&&t.prop("checked",!1).trigger("change")}},onRender:function(){e.prototype.onRender.apply(this,arguments);var t=this.getControlValue();t&&(this.ui.inputs.filter('[value="'+t+'"]').prop("checked",!0),this.ui.inputs.filter('[value="'+t+'"]').addClass("checked"))}},{onPasteStyle:function(e,t){return""===t||undefined!==e.options[t]}});elementor.addControlView("imagechoose",t)}));
|
||||
@@ -0,0 +1 @@
|
||||
!function(e,t){"use strict";if("undefined"==typeof window.parent)return;let n=window.parent;var o=function(){t.config.environmentMode.edit&&(n.jQuery("#elementor-editor-dark-mode-css").length>0&&n.jQuery("body").addClass("elementor-editor-dark-mode"),t.hooks.addAction("frontend/element_ready/global",(function(t){(t.find(".widgetarea_warper_edit").on("click",(async function(){var t=n.jQuery(".widgetarea_iframe_modal"),o=t.find("#widgetarea-control-iframe"),a=t.find(".dialog-lightbox-loading"),r=t.find(".dialog-type-lightbox"),i=e(this).parent().attr("data-elementskit-widgetarea-key"),d=e(this).parent().attr("data-elementskit-widgetarea-index"),l=window.elementskit.resturl+"dynamic-content/content_editor/widget/"+i+"-"+d;n.jQuery("body").attr("data-elementskit-widgetarea-key",i),n.jQuery("body").attr("data-elementskit-widgetarea-load","false"),r.show(),t.show(),a.show(),o.contents().find("#elementor-loading").show(),o.css("z-index","-1");try{const e=await fetch(l,{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":n.ElementsKitLayoutManager.nonce}});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);o.attr("src",e.url),o.loading="lazy"}catch(s){console.error("Error:",s)}o.on("load",(function(){a.hide(),o.show(),o.contents().find("#elementor-loading").hide(),o.css("z-index","1")}))})),"undefined"!=typeof n.jQuery)&&n.jQuery(".widgetarea_iframe_modal").find(".eicon-close").on("click",(function(){n.jQuery("body").attr("data-elementskit-widgetarea-load","true")}))})))};e(window).on("elementor/frontend/init",o)}(jQuery,window.elementorFrontend);
|
||||
@@ -0,0 +1 @@
|
||||
jQuery(window).on("elementor:init",(function(){"use strict";jQuery(".eicon-close").on("click",(function(){jQuery(".widgetarea_iframe_modal").css("display","none")}));var e=elementor.modules.controls.BaseData,t=e.extend({ui:function(){var t=e.prototype.ui.apply(this,arguments);return t.inputs='[type="text"]',t},events:function(){return _.extend(e.prototype.events.apply(this,arguments),{"change @ui.inputs":"onBaseInputChange"})},onBaseInputChange:function(e){clearTimeout(this.correctionTimeout);var t=e.currentTarget,n=this.getInputValue(t);this.validators.slice(0),this.container.settings.validators[this.model.get("name")];this.updateElementModel(n,t)},onDestroy:function(){clearInterval(window.ekitWidgetAreaInterval)},onRender:function(){e.prototype.onRender.apply(this,arguments);var t=this;clearInterval(window.ekitWidgetAreaInterval),window.ekitWidgetAreaInterval=setInterval((function(){var e=jQuery("body").attr("data-elementskit-widgetarea-load"),n=jQuery("body").attr("data-elementskit-widgetarea-key");if("true"==e&&1==t.isRendered){var a,i=(new Date).getTime(),r=n.split("***");a=(r=r[0])+"***"+i,jQuery("body").attr("data-elementskit-widgetarea-load","false"),t.setValue(a)}}),1e3)}},{});elementor.addControlView("widgetarea",t)}));
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Controls;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Elementor controls manager.
|
||||
*
|
||||
* Elementor controls manager handler class is responsible for registering and
|
||||
* initializing all the supported controls, both regular controls and the group
|
||||
* controls.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Controls_Manager extends \Elementor\Controls_Manager {
|
||||
const IMAGECHOOSE = 'imagechoose';
|
||||
const AJAXSELECT2 = 'ajaxselect2';
|
||||
const WIDGETAREA = 'widgetarea';
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Controls;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Image_Choose extends \Elementor\Base_Data_Control {
|
||||
|
||||
/**
|
||||
* Get choose control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `choose`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'imagechoose';
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue ontrol scripts and styles.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function enqueue() {
|
||||
// Define script dependencies if needed.
|
||||
$dependencies = array('jquery'); // Replace 'jquery' with the appropriate dependency.
|
||||
|
||||
// styles
|
||||
wp_register_style( 'elementskit-css-image-choose-control', Init::get_url() . 'assets/css/imagechoose.css', array(), '1.0.0' );
|
||||
wp_enqueue_style( 'elementskit-css-image-choose-control' );
|
||||
|
||||
// script
|
||||
wp_register_script( 'elementskit-js-image-choose-control', Init::get_url() . 'assets/js/imagechoose.js', $dependencies, '1.0.0', true);
|
||||
wp_enqueue_script( 'elementskit-js-image-choose-control' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render choose control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
$control_uid = $this->get_control_uid( '{{value}}' );
|
||||
?>
|
||||
<div class="elementor-control-field">
|
||||
<label class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<div class="elementor-image-choices">
|
||||
<# _.each( data.options, function( options, value ) { #>
|
||||
<div class="image-choose-label-block" style="width:{{ options.width }}">
|
||||
<input id="<?php echo esc_attr( $control_uid ); ?>" type="radio" name="elementor-choose-{{ data.name }}-{{ data._cid }}" value="{{ value }}">
|
||||
<label class="elementor-image-choices-label" for="<?php echo esc_attr( $control_uid ); ?>" title="{{ options.title }}">
|
||||
<img class="imagesmall" src="{{ options.imagesmall }}" alt="{{ options.title }}" {{ options.imagesmallheight ? `style=height:` + options.imagesmallheight : `` }} />
|
||||
<span class="imagelarge">
|
||||
<img src="{{ options.imagelarge }}" alt="{{ options.title }}" />
|
||||
</span>
|
||||
<span class="elementor-screen-only">{{{ options.title }}}</span>
|
||||
</label>
|
||||
</div>
|
||||
<# } ); #>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get choose control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the choose control. Used to return the
|
||||
* default settings while initializing the choose control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return array(
|
||||
'label_block' => true,
|
||||
'options' => array(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Controls;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Init {
|
||||
|
||||
// instance of all control's base class
|
||||
public static function get_url() {
|
||||
return \ElementsKit_Lite::module_url() . 'controls/';
|
||||
}
|
||||
public static function get_dir() {
|
||||
return \ElementsKit_Lite::module_dir() . 'controls/';
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
|
||||
// Includes necessary files
|
||||
$this->include_files();
|
||||
|
||||
// Initilizating control hooks
|
||||
add_action( 'elementor/controls/register', array( $this, 'image_choose' ), 11 );
|
||||
add_action( 'elementor/controls/register', array( $this, 'ajax_select2' ), 11 );
|
||||
add_action( 'elementor/controls/register', array( $this, 'widgetarea' ), 11 );
|
||||
|
||||
// Initilizating control scripts
|
||||
add_action( 'elementor/frontend/after_enqueue_styles', array( $this, 'widgetarea_enqueue_styles_editor' ) );
|
||||
add_action( 'elementor/frontend/after_enqueue_scripts', array( $this, 'widgetarea_enqueue_scripts_editor' ), 22 );
|
||||
|
||||
// Initilizating control classes
|
||||
$widget_area_utils = new Widget_Area_Utils();
|
||||
$widget_area_utils->init();
|
||||
}
|
||||
|
||||
private function include_files() {
|
||||
// Controls_Manager
|
||||
include_once self::get_dir() . 'control-manager.php';
|
||||
|
||||
// image choose
|
||||
include_once self::get_dir() . 'image-choose.php';
|
||||
|
||||
// ajax select2
|
||||
include_once self::get_dir() . 'ajax-select2.php';
|
||||
include_once self::get_dir() . 'ajax-select2-api.php';
|
||||
|
||||
// widgetarea
|
||||
include_once self::get_dir() . 'widget-area-utils.php';
|
||||
include_once self::get_dir() . 'widget-area.php';
|
||||
}
|
||||
|
||||
public function image_choose( $controls_manager ) {
|
||||
$controls_manager->register( new \ElementsKit_Lite\Modules\Controls\Image_Choose() );
|
||||
}
|
||||
|
||||
public function ajax_select2( $controls_manager ) {
|
||||
$controls_manager->register( new \ElementsKit_Lite\Modules\Controls\Ajax_Select2() );
|
||||
}
|
||||
|
||||
public function widgetarea( $controls_manager ) {
|
||||
$controls_manager->register( new \ElementsKit_Lite\Modules\Controls\Widget_Area() );
|
||||
}
|
||||
|
||||
public function widgetarea_enqueue_scripts_editor() {
|
||||
/**
|
||||
* widgetarea-editor.js
|
||||
*
|
||||
* Use dependencies ['jquery', 'elementor-frontend']
|
||||
* Using ['jquery', 'elementor-editor'] causes Advanced Widgets content editor window not to open
|
||||
*/
|
||||
if ( is_preview() || \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
|
||||
wp_enqueue_script( 'elementskit-js-widgetarea-control-editor', self::get_url() . 'assets/js/widgetarea-editor.js', array( 'jquery', 'elementor-frontend' ), \ElementsKit_Lite::version(), true );
|
||||
}
|
||||
}
|
||||
|
||||
public function widgetarea_enqueue_styles_editor() {
|
||||
if ( is_preview() || \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
|
||||
wp_enqueue_style( 'elementskit-css-widgetarea-control-editor', self::get_url() . 'assets/css/widgetarea-editor.css', array(), \ElementsKit_Lite::version() );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php defined( 'ABSPATH' ) || exit; ?>
|
||||
<div class="dialog-widget dialog-lightbox-widget dialog-type-buttons dialog-type-lightbox elementor-templates-modal elementskit-dynamic-content-modal" id="elementor-template-widgetarea-modal-container" style="display: none;">
|
||||
<div class="dialog-widget-content dialog-lightbox-widget-content">
|
||||
<div class="dialog-header dialog-lightbox-header">
|
||||
<div class="elementor-templates-modal__header">
|
||||
<div class="elementor-templates-modal__header__logo-area">
|
||||
<div class="elementor-templates-modal__header__logo">
|
||||
<span class="elementor-templates-modal__header__logo__icon-wrapper">
|
||||
<i class="eicon-elementor"></i>
|
||||
</span>
|
||||
<span class="elementor-templates-modal__header__logo__title"><?php esc_html_e( 'Widget Area', 'elementskit-lite' ); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="elementor-templates-modal__header__items-area">
|
||||
<div class="elementor-templates-modal__header__close elementor-templates-modal__header__close--normal elementor-templates-modal__header__item">
|
||||
<i class="eicon-close" aria-hidden="true" title="<?php echo esc_attr__( 'Close', 'elementskit-lite' ); ?>"></i>
|
||||
<span class="elementor-screen-only"><?php esc_html_e( 'Close', 'elementskit-lite' ); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dialog-message dialog-lightbox-message">
|
||||
<div class="dialog-content dialog-lightbox-content" style="display: block;">
|
||||
<div id="elementor-template-library-templates" data-template-source="remote">
|
||||
|
||||
<div id="elementor-template-library-templates-container">
|
||||
<iframe id="widgetarea-control-iframe"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dialog-loading dialog-lightbox-loading" style="display: block;">
|
||||
<div id="elementor-template-library-loading">
|
||||
<div class="elementor-loader-wrapper">
|
||||
<div class="elementor-loader">
|
||||
<div class="elementor-loader-boxes">
|
||||
<div class="elementor-loader-box"></div>
|
||||
<div class="elementor-loader-box"></div>
|
||||
<div class="elementor-loader-box"></div>
|
||||
<div class="elementor-loader-box"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="elementor-loading-title"><?php esc_html_e( 'Loading', 'elementskit-lite' ); ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="dialog-buttons-wrapper dialog-lightbox-buttons-wrapper"></div> -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Controls;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Widget_Area_Utils {
|
||||
|
||||
function init() {
|
||||
add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'modal_content' ) );
|
||||
|
||||
add_action( 'wp_ajax_ekit_widgetarea_content', array( $this, 'ekit_widgetarea_content' ) );
|
||||
add_action( 'wp_ajax_nopriv_ekit_widgetarea_content', array( $this, 'ekit_widgetarea_content' ) );
|
||||
}
|
||||
|
||||
public function ekit_widgetarea_content() {
|
||||
|
||||
if ( !isset($_POST['nonce']) || !wp_verify_nonce( sanitize_key( wp_unslash( $_POST['nonce'] ) ), 'ekit_pro' ) ) {
|
||||
wp_die();
|
||||
}
|
||||
|
||||
$post_id = isset($_POST['post_id']) ? intval( $_POST['post_id'] ) : 0;
|
||||
|
||||
if ( 'publish' !== get_post_status( $post_id ) ) {
|
||||
wp_die();
|
||||
}
|
||||
|
||||
if ( isset( $post_id ) ) {
|
||||
$elementor = \Elementor\Plugin::instance();
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo str_replace( '#elementor', '', \ElementsKit_Lite\Utils::render_tab_content( $elementor->frontend->get_builder_content_for_display( $post_id ), $post_id ) );
|
||||
} else {
|
||||
echo esc_html__( 'Click on the Edit Content button to edit/add the content.', 'elementskit-lite' );
|
||||
}
|
||||
|
||||
wp_die();
|
||||
}
|
||||
|
||||
public function modal_content() {
|
||||
ob_start(); ?>
|
||||
<div class="widgetarea_iframe_modal">
|
||||
<?php include 'widget-area-modal.php'; ?>
|
||||
</div>
|
||||
<?php
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
echo \ElementsKit_Lite\Utils::render( $output ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Already escaped inside of the buffering content
|
||||
}
|
||||
|
||||
/**
|
||||
* $index for old version & data support
|
||||
*/
|
||||
public static function parse( $content, $widget_key, $tab_id = 1, $isAjax = '', $index = null ) {
|
||||
$key = ( $content == '' ) ? $widget_key : $content;
|
||||
$extract_key = explode( '***', $key );
|
||||
$extract_key = $extract_key[0];
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div class="widgetarea_warper widgetarea_warper_editable" data-elementskit-widgetarea-key="<?php echo esc_attr( $extract_key ); ?>" data-elementskit-widgetarea-index="<?php echo esc_attr( $tab_id ); ?>">
|
||||
<div class="widgetarea_warper_edit" data-elementskit-widgetarea-key="<?php echo esc_attr( $extract_key ); ?>" data-elementskit-widgetarea-index="<?php echo esc_attr( $tab_id ); ?>">
|
||||
<i class="eicon-edit" aria-hidden="true"></i>
|
||||
<span><?php esc_html_e( 'Edit Content', 'elementskit-lite' ); ?></span>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$builder_post_title = 'dynamic-content-widget-' . $extract_key . '-' . $tab_id;
|
||||
$builder_post = \ElementsKit_Lite\Utils::get_page_by_title( $builder_post_title, 'elementskit_content' );
|
||||
$elementor = \Elementor\Plugin::instance();
|
||||
|
||||
/**
|
||||
* this checking for already existing content of tab.
|
||||
*/
|
||||
$post_id = isset( $builder_post->ID ) ? $builder_post->ID : null;
|
||||
if ( ! $post_id ) {
|
||||
$builder_post_title = 'dynamic-content-widget-' . $extract_key . '-' . $index;
|
||||
$builder_post = \ElementsKit_Lite\Utils::get_page_by_title( $builder_post_title, 'elementskit_content' );
|
||||
}
|
||||
|
||||
if ( $isAjax === 'yes' ) {
|
||||
$post_id = isset( $builder_post->ID ) ? $builder_post->ID : '';
|
||||
echo '<div class="ekit-widget-area-container" data-ajax-post-id="' . esc_attr($post_id). '"></div>';
|
||||
} else {
|
||||
?>
|
||||
<div class="ekit-widget-area-container">
|
||||
<?php
|
||||
if ( isset( $builder_post->ID ) ) {
|
||||
$builder_post_id = $builder_post->ID;
|
||||
|
||||
// if wpml is active, get the post id from wpml
|
||||
if( defined( 'ICL_SITEPRESS_VERSION' ) ) {
|
||||
$language_details = apply_filters( 'wpml_post_language_details', NULL, get_the_ID() );
|
||||
if( !is_wp_error($language_details) ) {
|
||||
$builder_post_id = apply_filters( 'wpml_object_id', $builder_post_id, 'elementskit_content', true, $language_details['language_code'] );
|
||||
}
|
||||
}
|
||||
|
||||
$builder_content = $elementor->frontend->get_builder_content_for_display($builder_post_id);
|
||||
$rendered_tab_content = \ElementsKit_Lite\Utils::render_tab_content($builder_content, $builder_post_id);
|
||||
// Remove '#elementor' from the rendered content, except when it's part of 'href="#elementor"'
|
||||
$final_content = preg_replace('/(?<!href=")#elementor/', '', $rendered_tab_content);
|
||||
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo $final_content;
|
||||
} else {
|
||||
echo esc_html__( 'Click on the Edit Content button to edit/add the content.', 'elementskit-lite' );
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Controls;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Widget_Area extends \Elementor\Base_Data_Control {
|
||||
/**
|
||||
* Get choose control type.
|
||||
*
|
||||
* Retrieve the control type, in this case `choose`.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*
|
||||
* @return string Control type.
|
||||
*/
|
||||
public function get_type() {
|
||||
return 'widgetarea';
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue ontrol scripts and styles.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function enqueue() {
|
||||
// Define script dependencies if needed.
|
||||
$dependencies = array('jquery'); // Replace 'jquery' with the appropriate dependency.
|
||||
// styles
|
||||
wp_register_style( 'elementskit-css-widgetarea-control-inspactor', Init::get_url() . 'assets/css/widgetarea-inspactor.css', array(), '1.0.0' );
|
||||
wp_enqueue_style( 'elementskit-css-widgetarea-control-inspactor' );
|
||||
|
||||
// script
|
||||
wp_register_script( 'elementskit-js-widgetarea-control-inspactor', Init::get_url() . 'assets/js/widgetarea-inspactor.js', $dependencies, '1.0.0', true );
|
||||
wp_enqueue_script( 'elementskit-js-widgetarea-control-inspactor' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render choose control output in the editor.
|
||||
*
|
||||
* Used to generate the control HTML in the editor using Underscore JS
|
||||
* template. The variables for the class are available using `data` JS
|
||||
* object.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function content_template() {
|
||||
$control_uid = $this->get_control_uid();
|
||||
?>
|
||||
<div style="display:none" class="elementor-control-field">
|
||||
<label for="<?php echo esc_attr( $control_uid ); ?>" class="elementor-control-title">{{{ data.label }}}</label>
|
||||
<div class="elementor-control-input-wrapper">
|
||||
<input id="<?php echo esc_attr( $control_uid ); ?>" type="text" data-setting="{{ data.name }}" />
|
||||
</div>
|
||||
</div>
|
||||
<# if ( data.description ) { #>
|
||||
<div class="elementor-control-field-description">{{{ data.description }}}</div>
|
||||
<# } #>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get choose control default settings.
|
||||
*
|
||||
* Retrieve the default settings of the choose control. Used to return the
|
||||
* default settings while initializing the choose control.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access protected
|
||||
*
|
||||
* @return array Control default settings.
|
||||
*/
|
||||
protected function get_default_settings() {
|
||||
return array(
|
||||
'label_block' => true,
|
||||
'show_edit_button' => false,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class ElementsKit_Cpt_Api extends Core\Handler_Api {
|
||||
|
||||
public function config() {
|
||||
$this->prefix = 'dynamic-content';
|
||||
$this->param = '/(?P<type>\w+)/(?P<key>\w+(|[-]\w+))/';
|
||||
}
|
||||
|
||||
public function get_content_editor() {
|
||||
|
||||
if (current_user_can('edit_posts')) {
|
||||
$content_key = $this->request['key'];
|
||||
$content_type = $this->request['type'];
|
||||
$builder_post_title = 'dynamic-content-' . $content_type . '-' . $content_key;
|
||||
$builder_post_id = Utils::get_page_by_title( $builder_post_title, 'elementskit_content' );
|
||||
|
||||
if ( is_null( $builder_post_id ) ) {
|
||||
$defaults = array(
|
||||
'post_content' => '',
|
||||
'post_title' => $builder_post_title,
|
||||
'post_name' => $builder_post_title,
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'elementskit_content',
|
||||
);
|
||||
$builder_post_id = wp_insert_post( $defaults );
|
||||
update_post_meta( $builder_post_id, '_wp_page_template', 'elementor_canvas' );
|
||||
} else {
|
||||
$builder_post_id = $builder_post_id->ID;
|
||||
}
|
||||
} else {
|
||||
wp_die( esc_html__( 'You are not allowed to access this page.', 'elementskit-lite' ) );
|
||||
}
|
||||
|
||||
// if wpml is active and wpml not set for this post
|
||||
if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
|
||||
$builder_post_id = $this->set_wpml_data($builder_post_id);
|
||||
}
|
||||
|
||||
$url = admin_url( 'post.php?post=' . $builder_post_id . '&action=elementor' );
|
||||
wp_safe_redirect( $url );
|
||||
exit;
|
||||
}
|
||||
|
||||
public function set_wpml_data($builder_post_id) {
|
||||
global $sitepress;
|
||||
$default_language = $sitepress->get_default_language();
|
||||
$wpml_element_type = apply_filters( 'wpml_element_type', 'elementskit_content' );
|
||||
$trid = $sitepress->get_element_trid( $builder_post_id, $wpml_element_type );
|
||||
if( ! $trid ) {
|
||||
$sitepress->set_element_language_details( $builder_post_id, $wpml_element_type, false, $default_language, null, false );
|
||||
}
|
||||
|
||||
// get wpml post by language code
|
||||
$referer = wp_get_referer();
|
||||
$referer = wp_parse_url($referer);
|
||||
$referer = !empty($referer['query']) ? $referer['query'] : '';
|
||||
$referer = parse_str($referer, $referer_args);
|
||||
|
||||
if( !empty($referer_args['post']) ) {
|
||||
$language_details = apply_filters( 'wpml_post_language_details', NULL, $referer_args['post'] );
|
||||
if( !is_wp_error($language_details) ) {
|
||||
$builder_post_id = apply_filters( 'wpml_object_id', $builder_post_id, 'elementskit_content', true, $language_details['language_code'] );
|
||||
}
|
||||
}
|
||||
|
||||
return $builder_post_id;
|
||||
}
|
||||
}
|
||||
new ElementsKit_Cpt_Api();
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Dynamic_Content;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Cpt {
|
||||
|
||||
public function __construct() {
|
||||
$this->post_type();
|
||||
register_deactivation_hook( __FILE__, 'flush_rewrite_rules' );
|
||||
register_activation_hook( __FILE__, array( $this, 'flush_rewrites' ) );
|
||||
}
|
||||
|
||||
public function post_type() {
|
||||
|
||||
$labels = array(
|
||||
'name' => _x( 'ElementsKit items', 'Post Type General Name', 'elementskit-lite' ),
|
||||
'singular_name' => _x( 'ElementsKit item', 'Post Type Singular Name', 'elementskit-lite' ),
|
||||
'menu_name' => esc_html__( 'ElementsKit item', 'elementskit-lite' ),
|
||||
'name_admin_bar' => esc_html__( 'ElementsKit item', 'elementskit-lite' ),
|
||||
'archives' => esc_html__( 'Item Archives', 'elementskit-lite' ),
|
||||
'attributes' => esc_html__( 'Item Attributes', 'elementskit-lite' ),
|
||||
'parent_item_colon' => esc_html__( 'Parent Item:', 'elementskit-lite' ),
|
||||
'all_items' => esc_html__( 'All Items', 'elementskit-lite' ),
|
||||
'add_new_item' => esc_html__( 'Add New Item', 'elementskit-lite' ),
|
||||
'add_new' => esc_html__( 'Add New', 'elementskit-lite' ),
|
||||
'new_item' => esc_html__( 'New Item', 'elementskit-lite' ),
|
||||
'edit_item' => esc_html__( 'Edit Item', 'elementskit-lite' ),
|
||||
'update_item' => esc_html__( 'Update Item', 'elementskit-lite' ),
|
||||
'view_item' => esc_html__( 'View Item', 'elementskit-lite' ),
|
||||
'view_items' => esc_html__( 'View Items', 'elementskit-lite' ),
|
||||
'search_items' => esc_html__( 'Search Item', 'elementskit-lite' ),
|
||||
'not_found' => esc_html__( 'Not found', 'elementskit-lite' ),
|
||||
'not_found_in_trash' => esc_html__( 'Not found in Trash', 'elementskit-lite' ),
|
||||
'featured_image' => esc_html__( 'Featured Image', 'elementskit-lite' ),
|
||||
'set_featured_image' => esc_html__( 'Set featured image', 'elementskit-lite' ),
|
||||
'remove_featured_image' => esc_html__( 'Remove featured image', 'elementskit-lite' ),
|
||||
'use_featured_image' => esc_html__( 'Use as featured image', 'elementskit-lite' ),
|
||||
'insert_into_item' => esc_html__( 'Insert into item', 'elementskit-lite' ),
|
||||
'uploaded_to_this_item' => esc_html__( 'Uploaded to this item', 'elementskit-lite' ),
|
||||
'items_list' => esc_html__( 'Items list', 'elementskit-lite' ),
|
||||
'items_list_navigation' => esc_html__( 'Items list navigation', 'elementskit-lite' ),
|
||||
'filter_items_list' => esc_html__( 'Filter items list', 'elementskit-lite' ),
|
||||
);
|
||||
$rewrite = array(
|
||||
'slug' => 'elementskit-content',
|
||||
'with_front' => true,
|
||||
'pages' => false,
|
||||
'feeds' => false,
|
||||
);
|
||||
$args = array(
|
||||
'label' => esc_html__( 'ElementsKit item', 'elementskit-lite' ),
|
||||
'description' => esc_html__( 'elementskit_content', 'elementskit-lite' ),
|
||||
'labels' => $labels,
|
||||
'supports' => array( 'title', 'editor', 'elementor', 'permalink' ),
|
||||
'hierarchical' => true,
|
||||
'public' => true,
|
||||
'show_ui' => false,
|
||||
'show_in_menu' => false,
|
||||
'menu_position' => 5,
|
||||
'show_in_admin_bar' => false,
|
||||
'show_in_nav_menus' => false,
|
||||
'can_export' => true,
|
||||
'has_archive' => false,
|
||||
'publicly_queryable' => true,
|
||||
'rewrite' => $rewrite,
|
||||
'query_var' => true,
|
||||
'exclude_from_search' => true,
|
||||
'publicly_queryable' => true,
|
||||
'capability_type' => 'page',
|
||||
'show_in_rest' => true,
|
||||
'rest_base' => 'elementskit-content',
|
||||
);
|
||||
register_post_type( 'elementskit_content', $args );
|
||||
}
|
||||
|
||||
public function flush_rewrites() {
|
||||
$this->post_type();
|
||||
flush_rewrite_rules();
|
||||
}
|
||||
}
|
||||
|
||||
new Cpt();
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Dynamic_Content;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Init {
|
||||
|
||||
public static function get_url() {
|
||||
return \ElementsKit_Lite::module_url() . 'dynamic-content/';
|
||||
}
|
||||
public static function get_dir() {
|
||||
return \ElementsKit_Lite::module_dir() . 'dynamic-content/';
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
|
||||
// Includes necessary files
|
||||
$this->include_files();
|
||||
}
|
||||
|
||||
private function include_files() {
|
||||
// Controls_Manager
|
||||
include_once self::get_dir() . 'cpt.php';
|
||||
include_once self::get_dir() . 'cpt-api.php';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\ElementsKit_Icon_Pack;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Icons {
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_frontend' ) );
|
||||
|
||||
add_filter( 'elementor/icons_manager/additional_tabs', array( $this, 'add_font' ) );
|
||||
}
|
||||
|
||||
public function enqueue_frontend() {
|
||||
wp_enqueue_style( 'elementor-icons-ekiticons', Init::get_url() . 'assets/css/ekiticons.css', array(), \ElementsKit_Lite::version() );
|
||||
}
|
||||
|
||||
public function add_font( $font ) {
|
||||
$font_new['ekiticons'] = array(
|
||||
'name' => 'ekiticons',
|
||||
'label' => esc_html__( 'ElementsKit Icon Pack', 'elementskit-lite' ),
|
||||
'url' => Init::get_url() . 'assets/css/ekiticons.css',
|
||||
'prefix' => 'icon-',
|
||||
'displayPrefix' => 'icon',
|
||||
'labelIcon' => 'icon icon-ekit',
|
||||
'ver' => \ElementsKit_Lite::version(),
|
||||
'fetchJson' => Init::get_url() . 'assets/js/ekiticons.json',
|
||||
'native' => true,
|
||||
);
|
||||
return array_merge( $font, $font_new );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\ElementsKit_Icon_Pack;
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
class Init {
|
||||
public static function get_url() {
|
||||
return \ElementsKit_Lite::module_url() . 'elementskit-icon-pack/';
|
||||
}
|
||||
|
||||
public static function get_dir() {
|
||||
return \ElementsKit_Lite::module_dir() . 'elementskit-icon-pack/';
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'admin_enqueue_scripts', [$this, 'enqueue_admin_icon_css'] );
|
||||
|
||||
if (!self::is_svg_icon_experiment()) {
|
||||
add_action('elementor/frontend/before_enqueue_scripts', array($this, 'enqueue_frontend'));
|
||||
}
|
||||
|
||||
add_action('elementor/preview/enqueue_styles', array($this, 'enqueue_frontend'));
|
||||
add_filter('elementor/icons_manager/additional_tabs', array($this, 'register_icon_pack_to_elementor'));
|
||||
add_filter('elementor/widget/render_content', array($this, 'filter_widget_content'), 10, 2);
|
||||
}
|
||||
|
||||
// Enqueue admin CSS for widget icons
|
||||
public function enqueue_admin_icon_css( $hook ) {
|
||||
if ( $hook !== 'elementor_page_elementor-element-manager' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp_enqueue_style( 'widget-icons', \ElementsKit_Lite::widget_url() . 'init/assets/css/editor.css', [], \ElementsKit_Lite::version() );
|
||||
|
||||
// Inline CSS to adjust icon display in Elementor's Element Manager
|
||||
$css = 'td .ekit-widget-icon{max-width:13px;overflow:hidden;min-height:auto;font-size:inherit;}td .ekit-widget-icon:after{display:none}';
|
||||
wp_add_inline_style( 'widget-icons', $css );
|
||||
}
|
||||
|
||||
public function enqueue_frontend() {
|
||||
wp_enqueue_style( 'elementor-icons-ekiticons', self::get_url() . 'assets/css/ekiticons.css', array(), \ElementsKit_Lite::version() );
|
||||
}
|
||||
|
||||
public function register_icon_pack_to_elementor($font) {
|
||||
$font_new['ekiticons'] = array(
|
||||
'name' => 'ekiticons',
|
||||
'label' => esc_html__('ElementsKit Icon Pack', 'elementskit-lite'),
|
||||
'prefix' => 'icon-',
|
||||
'displayPrefix' => 'icon',
|
||||
'labelIcon' => 'icon icon-ekit',
|
||||
'ver' => \ElementsKit_Lite::version(),
|
||||
'fetchJson' => self::get_url() . 'assets/js/ekiticons.json',
|
||||
'native' => true,
|
||||
);
|
||||
|
||||
if (!self::is_svg_icon_experiment()) {
|
||||
$font_new['ekiticons']['url'] = self::get_url() . 'assets/css/ekiticons.css';
|
||||
} else {
|
||||
$font_new['ekiticons']['enqueue'] = [self::get_url() . 'assets/css/ekiticons.css'];
|
||||
}
|
||||
|
||||
return array_merge($font, $font_new);
|
||||
}
|
||||
|
||||
public function filter_widget_content($widget_content, $widget) {
|
||||
// Check if it's in Elementor editor
|
||||
if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
|
||||
return $widget_content; // return normal content
|
||||
}
|
||||
|
||||
$ekit_svg_icon = self::is_svg_icon_experiment();
|
||||
|
||||
// Match all <i> tags with class containing "icon icon-"
|
||||
if ($ekit_svg_icon && strpos($widget_content, 'icon icon-') !== false) {
|
||||
$widget_content = preg_replace_callback('/<i[^>]*class="([^"]*)"[^>]*><\/i>/', function ($matches) {
|
||||
$full_class_string = $matches[1]; // Get the entire class string
|
||||
|
||||
// Check if this icon has the icon icon- pattern
|
||||
if (strpos($full_class_string, 'icon icon-') !== false) {
|
||||
// Extract the specific icon name
|
||||
preg_match('/icon icon-([^\s"]+)/', $full_class_string, $icon_matches);
|
||||
$icon_name = $icon_matches[1]; // This gives us "down-arrow1"
|
||||
|
||||
$icon = [
|
||||
'library' => 'ekiticons',
|
||||
'value' => 'icon icon-' . $icon_name,
|
||||
];
|
||||
|
||||
// Get the ElementsKit icon HTML
|
||||
$get_icon = self::get_icon_html($icon);
|
||||
|
||||
// Now extract any additional classes
|
||||
$extra_classes = preg_replace('/\s*icon icon-[^\s"]+\s*/', ' ', $full_class_string);
|
||||
$extra_classes = trim($extra_classes);
|
||||
|
||||
// If we have extra classes, add them to the generated icon HTML
|
||||
if (!empty($extra_classes)) {
|
||||
// Add extra classes to the generated icon
|
||||
$get_icon = str_replace('class="', 'class="' . $extra_classes . ' ', $get_icon);
|
||||
}
|
||||
|
||||
return $get_icon;
|
||||
}
|
||||
|
||||
// If no match found, return the original
|
||||
return $matches[0];
|
||||
}, $widget_content);
|
||||
}
|
||||
|
||||
return $widget_content;
|
||||
}
|
||||
|
||||
public static function is_svg_icon_experiment() {
|
||||
$elementskit_options = get_option( 'elementskit_options' );
|
||||
$inline_svg = $elementskit_options['user_data']['inline_svg']['is_enable'] ?? false;
|
||||
return apply_filters( 'elementskit_font_icon_inline_svg', $inline_svg );
|
||||
}
|
||||
|
||||
public static function get_svg_icon($icon, $attributes = []) {
|
||||
// go for ekit svg icon
|
||||
$file = \ElementsKit_Lite::module_dir() . 'elementskit-icon-pack/' . 'assets/json/icons.json';
|
||||
$get_file_content = \Elementor\Utils::file_get_contents($file);
|
||||
|
||||
// check condition for svg icon
|
||||
if (!$get_file_content) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$icons = json_decode($get_file_content, true);
|
||||
$icon_name = str_replace('icon icon-', '', strtolower($icon['value']));
|
||||
$svg = isset($icons[$icon_name]) ? $icons[$icon_name] : false;
|
||||
|
||||
if ( empty($svg['paths']) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$attributes['class'][] = 'ekit-svg-icon';
|
||||
$attributes['class'][] = sprintf('icon-%s', $icon_name);
|
||||
$attributes['viewBox'] = $svg['viewBox'];
|
||||
$attributes['xmlns'] = 'http://www.w3.org/2000/svg';
|
||||
|
||||
$svg_html = sprintf('<svg %s>', \Elementor\Utils::render_html_attributes($attributes));
|
||||
|
||||
foreach ($svg['paths'] as $path) {
|
||||
$svg_html .= sprintf('<path d="%s"></path>', esc_attr($path));
|
||||
}
|
||||
|
||||
$svg_html .= '</svg>';
|
||||
|
||||
return $svg_html;
|
||||
}
|
||||
|
||||
public static function get_icon_html($icon, $attributes = [], $tag = 'i') {
|
||||
if ( empty( $icon['library'] ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( 'ekiticons' === $icon['library'] && self::is_svg_icon_experiment() ) {
|
||||
$content = self::get_svg_icon($icon, $attributes);
|
||||
|
||||
if ( ! empty( $content ) ) {
|
||||
return $content;
|
||||
}
|
||||
} else {
|
||||
return \Elementor\Icons_Manager::try_get_icon_html($icon, $attributes, $tag);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: remove this function if not used
|
||||
public static function icon($icon, $attributes = [], $tag = 'i') {
|
||||
if ( empty( $icon['library'] ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( 'ekiticons' === $icon['library'] && self::is_svg_icon_experiment() ) {
|
||||
$content = self::get_svg_icon($icon, $attributes);
|
||||
|
||||
if ( ! empty( $content ) ) {
|
||||
\Elementor\Utils::print_unescaped_internal_string($content);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
\Elementor\Icons_Manager::render_icon($icon, $attributes, $tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Activator {
|
||||
public static $instance = null;
|
||||
|
||||
protected $templates;
|
||||
public $header_template;
|
||||
public $footer_template;
|
||||
|
||||
protected $current_theme;
|
||||
protected $current_template;
|
||||
|
||||
protected $post_type = 'elementskit_template';
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'wp', array( $this, 'hooks' ) );
|
||||
}
|
||||
|
||||
public function hooks() {
|
||||
$this->current_template = basename( get_page_template_slug() );
|
||||
if ( $this->current_template == 'elementor_canvas' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->current_theme = get_template();
|
||||
|
||||
switch ( $this->current_theme ) {
|
||||
case 'astra':
|
||||
new Theme_Hooks\Astra( self::template_ids() );
|
||||
break;
|
||||
|
||||
case 'neve':
|
||||
new Theme_Hooks\Neve( self::template_ids() );
|
||||
break;
|
||||
|
||||
case 'generatepress':
|
||||
case 'generatepress-child':
|
||||
new Theme_Hooks\Generatepress( self::template_ids() );
|
||||
break;
|
||||
|
||||
case 'oceanwp':
|
||||
case 'oceanwp-child':
|
||||
new Theme_Hooks\Oceanwp( self::template_ids() );
|
||||
break;
|
||||
|
||||
case 'bb-theme':
|
||||
case 'bb-theme-child':
|
||||
new Theme_Hooks\Bbtheme( self::template_ids() );
|
||||
break;
|
||||
|
||||
case 'genesis':
|
||||
case 'genesis-child':
|
||||
new Theme_Hooks\Genesis( self::template_ids() );
|
||||
break;
|
||||
|
||||
case 'twentynineteen':
|
||||
new Theme_Hooks\TwentyNineteen( self::template_ids() );
|
||||
break;
|
||||
|
||||
case 'my-listing':
|
||||
case 'my-listing-child':
|
||||
new Theme_Hooks\MyListing( self::template_ids() );
|
||||
break;
|
||||
|
||||
default:
|
||||
new Theme_Hooks\Theme_Support( self::template_ids() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static function template_ids() {
|
||||
$cached = wp_cache_get( 'elementskit_template_ids' );
|
||||
if ( false !== $cached ) {
|
||||
return $cached;
|
||||
}
|
||||
|
||||
$instance = self::instance();
|
||||
$instance->the_filter();
|
||||
|
||||
$ids = array(
|
||||
$instance->header_template,
|
||||
$instance->footer_template,
|
||||
);
|
||||
|
||||
if ( $instance->header_template != null ) {
|
||||
\ElementsKit_Lite\Utils::render_elementor_content_css( $instance->header_template );
|
||||
}
|
||||
|
||||
if ( $instance->footer_template != null ) {
|
||||
\ElementsKit_Lite\Utils::render_elementor_content_css( $instance->footer_template );
|
||||
}
|
||||
|
||||
wp_cache_set( 'elementskit_template_ids', $ids );
|
||||
return $ids;
|
||||
}
|
||||
|
||||
|
||||
protected function the_filter() {
|
||||
$arg = array(
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'id',
|
||||
'order' => 'DESC',
|
||||
'post_status' => 'publish',
|
||||
'post_type' => $this->post_type,
|
||||
'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
|
||||
array(
|
||||
'key' => 'elementskit_template_activation',
|
||||
'value' => 'yes',
|
||||
'compare' => '=',
|
||||
),
|
||||
),
|
||||
);
|
||||
$this->templates = get_posts( $arg );
|
||||
|
||||
// more conditions can be triggered at once
|
||||
// don't use switch case
|
||||
// may impliment and callable by dynamic class in future
|
||||
|
||||
// entire site
|
||||
if ( ! is_admin() ) {
|
||||
$filters = array(
|
||||
array(
|
||||
'key' => 'condition_a',
|
||||
'value' => 'entire_site',
|
||||
),
|
||||
);
|
||||
$this->get_header_footer( $filters );
|
||||
}
|
||||
}
|
||||
|
||||
protected function get_header_footer( $filters ) {
|
||||
$template_id = array();
|
||||
|
||||
if ( $this->templates != null ) {
|
||||
foreach ( $this->templates as $template ) {
|
||||
$template = $this->get_full_data( $template );
|
||||
$match_found = true;
|
||||
|
||||
// WPML Language Check
|
||||
if ( defined( 'ICL_LANGUAGE_CODE' ) ) :
|
||||
$current_lang = apply_filters( 'wpml_post_language_details', null, $template['ID'] );
|
||||
|
||||
if ( ! empty( $current_lang ) && ! $current_lang['different_language'] && ( $current_lang['language_code'] == ICL_LANGUAGE_CODE ) ) :
|
||||
$template_id[ $template['type'] ] = $template['ID'];
|
||||
endif;
|
||||
endif;
|
||||
|
||||
foreach ( $filters as $filter ) {
|
||||
if ( $filter['key'] == 'condition_singular_id' ) {
|
||||
$ids = explode( ',', $template[ $filter['key'] ] );
|
||||
if ( ! in_array( $filter['value'], $ids ) ) {
|
||||
$match_found = false;
|
||||
}
|
||||
} elseif ( $template[ $filter['key'] ] != $filter['value'] ) {
|
||||
$match_found = false;
|
||||
}
|
||||
if ( $filter['key'] == 'condition_a' && $template[ $filter['key'] ] == 'singular' && count( $filters ) < 2 ) {
|
||||
$match_found = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $match_found == true ) {
|
||||
if ( $template['type'] == 'header' ) {
|
||||
$this->header_template = isset( $template_id['header'] ) ? $template_id['header'] : $template['ID'];
|
||||
}
|
||||
if ( $template['type'] == 'footer' ) {
|
||||
$this->footer_template = isset( $template_id['footer'] ) ? $template_id['footer'] : $template['ID'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function get_full_data( $post ) {
|
||||
if ( $post != null ) {
|
||||
return array_merge(
|
||||
(array) $post,
|
||||
array(
|
||||
'type' => get_post_meta( $post->ID, 'elementskit_template_type', true ),
|
||||
'condition_a' => get_post_meta( $post->ID, 'elementskit_template_condition_a', true ),
|
||||
'condition_singular' => get_post_meta( $post->ID, 'elementskit_template_condition_singular', true ),
|
||||
'condition_singular_id' => get_post_meta( $post->ID, 'elementskit_template_condition_singular_id', true ),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static function instance() {
|
||||
if ( is_null( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
#elementskit-template-modalinput-form .attr-modal-content{-webkit-transition:opaicty .5s ease;transition:opaicty .5s ease;position:relative}#elementskit-template-modalinput-form .attr-modal-content .ekit-spinner{position:absolute;top:50%!important;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);z-index:6}#elementskit-template-modalinput-form .attr-modal-body{min-height:434px;max-height:435px;overflow-y:auto;overflow-x:hidden}#elementskit-template-modalinput-form .attr-form-control{font-size:14px;height:50px;border:1px solid #e5e5e5;border-radius:5px}#elementskit-template-modalinput-form .attr-form-control:focus{border:1px solid #f2295b;-webkit-box-shadow:none;box-shadow:none;outline:0}#elementskit-template-modalinput-form .attr-input-label{display:inline-block;font-weight:700;font-size:14px}@media (max-width:767px){#elementskit-template-modalinput-form .attr-input-label{margin-bottom:10px}}@media (min-width:768px){#elementskit-template-modalinput-form .attr-input-label{min-width:30%}}#elementskit-template-modalinput-form .select2-container{display:block;min-width:70%;max-width:100%}#elementskit-template-modalinput-form .select2-container .select2-selection--multiple,#elementskit-template-modalinput-form .select2-container .select2-selection--single{height:50px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.07);box-shadow:0 1px 2px rgba(0,0,0,.07);padding:.375rem .75rem;border-radius:.25rem;line-height:1;font-size:14px;-webkit-transition:border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;transition:border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}#elementskit-template-modalinput-form .select2-container .select2-selection--multiple{height:auto}#elementskit-template-modalinput-form .select2-container .selection{display:block}#elementskit-template-modalinput-form .select2-container--default .select2-selection--single{border-color:#ddd}#elementskit-template-modalinput-form .select2-container--default .select2-selection--single .select2-selection__rendered{line-height:1;padding-left:0}#elementskit-template-modalinput-form .select2-container--default .select2-selection--single .select2-selection__arrow{height:100%;width:30px}#elementskit-template-modalinput-form .select2-container--default .select2-selection--multiple{border-color:#ddd}@media (min-width:768px){#elementskit-template-modalinput-form .ekit-input-group{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}}#elementskit-template-modalinput-form .ekit-switch-group{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.loading .attr-modal-content::before{opacity:.8;position:absolute;content:"";top:0;left:0;height:100%;width:100%;background-color:#fff;-webkit-transition:opaicty .5s ease;transition:opaicty .5s ease;z-index:5;border-radius:inherit}.loading .ekit-spinner{display:block}.attr-modal-dialog-centered{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%}.attr-modal-dialog-centered>form{width:100%}.modal-backdrop{position:fixed;top:0;left:0;width:100vw;height:100vh;background-color:rgba(0,0,0,.5)}.modal-backdrop{z-index:9999}.attr-modal{z-index:10000}.ekit_multipile_ajax_search_filed .select2-container--default .select2-selection--multiple .select2-selection__choice{line-height:1.5;font-size:.9em;border:none;border-radius:0;color:#6d7882}.elementskit_type_filter_tab_container .nav-tab:first-child{margin-left:0}.ekit-headerfooter-status{display:inline-block;margin-left:5px;padding:2px 5px 3px;color:#fff;background-color:#888;border-radius:3px;font-size:10px;line-height:1;font-weight:400}.ekit-headerfooter-status-active{background-color:#00cd00}
|
||||
@@ -0,0 +1 @@
|
||||
jQuery(document).ready((function(t){"use strict";function e(e){t(".ekit-template-modalinput-title").val(e.title),t(".ekit-template-modalinput-condition_a").val(e.condition_a),t(".ekit-template-modalinput-condition_singular").val(e.condition_singular),t(".ekit-template-modalinput-condition_singular_id").val(e.condition_singular_id),t(".ekit-template-modalinput-type").val(e.type);var a=t(".ekit-template-modalinput-activition");"yes"==e.activation?a.prop("checked",!0):a.prop("checked",!1),t(".ekit-template-modalinput-activition, .ekit-template-modalinput-type, .ekit-template-modalinput-condition_a, .ekit-template-modalinput-condition_singular").trigger("change");var i=t(".ekit-template-modalinput-condition_singular_id");t.ajax({url:window.elementskit.resturl+"ajaxselect2/singular_list",dataType:"json",data:{ids:String(e.condition_singular_id)}}).then((function(e){null!==e&&e.results.length>0&&(i.html(" "),t.each(e.results,(function(t,e){var a=new Option(e.text,e.id,!0,!0);i.append(a).trigger("change")})),i.trigger({type:"select2:select",params:{data:e}}))}))}t(".row-actions .edit a, .page-title-action, .row-title").on("click",(function(a){a.preventDefault();var i=0,n=t("#elementskit_headerfooter_modal"),l=t(this).parents(".column-title"),o=t("#elementskit-template-modalinput-form").attr("data-nonce");if(n.addClass("loading"),n.modal("show"),l.length>0)i=l.find(".hidden").attr("id").split("_")[1],t.ajax({url:window.elementskit.resturl+"my-template/get/"+i,type:"get",headers:{"X-WP-Nonce":o},dataType:"json",success:function(t){e(t),n.removeClass("loading")}});else{e({title:"",type:"header",condition_a:"entire_site",condition_singular:"all",activation:""}),n.removeClass("loading")}n.find("form").attr("data-ekit-id",i)})),t(".ekit-template-modalinput-type").on("change",(function(){var e=t(this).val(),a=t(".ekit-template-headerfooter-option-container");"section"==e?a.hide():a.show()})),t(".ekit-template-modalinput-condition_a").on("change",(function(){var e=t(this).val(),a=t(".ekit-template-modalinput-condition_singular-container");"singular"==e?a.show():a.hide()})),t(".ekit-template-modalinput-condition_singular").on("change",(function(){var e=t(this).val(),a=t(".ekit-template-modalinput-condition_singular_id-container");"selective"==e?a.show():a.hide()})),t(".elementskit-template-save-btn-editor").on("click",(function(){var e=t("#elementskit-template-modalinput-form");e.attr("data-open-editor","1"),e.trigger("submit")})),t("#elementskit-template-modalinput-form").on("submit",(function(e){e.preventDefault();var a=t("#elementskit_headerfooter_modal");a.addClass("loading");var i=t(this).serialize(),n=t(this).attr("data-ekit-id"),l=t(this).attr("data-open-editor"),o=t(this).attr("data-editor-url"),r=t(this).attr("data-nonce");t.ajax({url:window.elementskit.resturl+"my-template/update/"+n,data:i,type:"get",headers:{"X-WP-Nonce":r},dataType:"json",success:function(e){a.removeClass("loading");var i=t("#post-"+e.data.id);i.length>0&&(i.find(".column-type").html(e.data.type_html),i.find(".column-condition").html(e.data.cond_text),i.find(".row-title").html(e.data.title).attr("aria-label",e.data.title)),"1"==l?window.location.href=o+"?post="+e.data.id+"&action=elementor":"0"==n&&location.reload()}})})),t(".ekit-template-modalinput-condition_singular_id").select2({ajax:{url:window.elementskit.resturl+"ajaxselect2/singular_list",dataType:"json",data:function(t){return{s:t.term}}},cache:!0,placeholder:"--",dropdownParent:t("#elementskit_headerfooter_modal_body")});var a=t(".wp-header-end"),i="",n=new URL(window.location.href).searchParams.get("elementskit_type_filter");n=null==n?"all":n,t.each({all:"All",header:"Header",footer:"Footer"},(function(t,e){var a=function(t,e,a){null==a&&(a="");var i=new RegExp("\\b("+e+"=).*?(&|#|$)");return t.search(i)>=0?t.replace(i,"$1"+a+"$2"):(t=t.replace(/[?#]$/,""))+(t.indexOf("?")>0?"&":"?")+e+"="+a}(window.location.href,"elementskit_type_filter",t);i+=`\n <a href="${a}" class="${n==t?"elementskit_type_filter_active nav-tab-active":" "} elementskit_type_filter_tab_item nav-tab">${e}</a>\n `,i+="\n"})),a.after('<div class="elementskit_type_filter_tab_container nav-tab-wrapper">'+i+"</div><br/>")}));
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class ElementsKit_HeaderFooterBuilder_Api extends Core\Handler_Api {
|
||||
|
||||
public function config() {
|
||||
$this->prefix = 'my-template';
|
||||
$this->param = '/(?P<id>\w+)/';
|
||||
}
|
||||
|
||||
public function get_update() {
|
||||
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$id = $this->request['id'];
|
||||
$open_editor = $this->request['open_editor'];
|
||||
|
||||
$title = ( $this->request['title'] == '' ) ? ( 'ElementsKit_Lite Template #' . time() ) : $this->request['title'];
|
||||
$activation = $this->request['activation'];
|
||||
$type = $this->request['type'];
|
||||
$condition_a = ( $type == 'section' ) ? '' : $this->request['condition_a'];
|
||||
$condition_singular = ( $type == 'section' ) ? '' : $this->request['condition_singular'];
|
||||
$condition_singular_id = ( $type == 'section' ) ? '' : ( is_array( $this->request['condition_singular_id'] ) ? implode( ',', $this->request['condition_singular_id'] ) : $this->request['condition_singular_id'] );
|
||||
|
||||
$post_data = array(
|
||||
'post_title' => $title,
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'elementskit_template',
|
||||
);
|
||||
|
||||
$post = get_post( $id );
|
||||
|
||||
if ( $post == null ) {
|
||||
// $post_data['post_author'] = $this->request['post_author'];
|
||||
$id = wp_insert_post( $post_data );
|
||||
} else {
|
||||
$post_data['ID'] = $id;
|
||||
wp_update_post( $post_data );
|
||||
}
|
||||
|
||||
update_post_meta( $id, '_wp_page_template', 'elementor_canvas' );
|
||||
update_post_meta( $id, 'elementskit_template_activation', $activation );
|
||||
update_post_meta( $id, 'elementskit_template_type', $type );
|
||||
update_post_meta( $id, 'elementskit_template_condition_a', $condition_a );
|
||||
update_post_meta( $id, 'elementskit_template_condition_singular', $condition_singular );
|
||||
update_post_meta( $id, 'elementskit_template_condition_singular_id', $condition_singular_id );
|
||||
|
||||
// if wpml is active and wpml not set for this post
|
||||
if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
|
||||
global $sitepress;
|
||||
$wpml_element_type = apply_filters( 'wpml_element_type', 'elementskit_template' );
|
||||
$sitepress->set_element_language_details( $id, $wpml_element_type, false, $sitepress->get_current_language(), null, false );
|
||||
}
|
||||
|
||||
if ( $open_editor == 'true' ) {
|
||||
$url = get_admin_url() . '/post.php?post=' . $id . '&action=elementor';
|
||||
wp_safe_redirect( $url );
|
||||
exit;
|
||||
} else {
|
||||
$cond = ucwords(
|
||||
str_replace(
|
||||
'_',
|
||||
' ',
|
||||
$condition_a
|
||||
. ( ( $condition_a == 'singular' )
|
||||
? ( ( $condition_singular != '' )
|
||||
? ( ' > ' . $condition_singular
|
||||
. ( ( $condition_singular_id != '' )
|
||||
? ' > ' . $condition_singular_id
|
||||
: '' ) )
|
||||
: '' )
|
||||
: '' )
|
||||
)
|
||||
);
|
||||
|
||||
return array(
|
||||
'saved' => true,
|
||||
'data' => array(
|
||||
'id' => $id,
|
||||
'title' => $title,
|
||||
'type' => $type,
|
||||
'activation' => $activation,
|
||||
'cond_text' => $cond,
|
||||
'type_html' => ( ucfirst( $type ) . ( ( $activation == 'yes' )
|
||||
? ( '<span class="ekit-headerfooter-status ekit-headerfooter-status-active">' . esc_html__( 'Active', 'elementskit-lite' ) . '</span>' )
|
||||
: ( '<span class="ekit-headerfooter-status ekit-headerfooter-status-inactive">' . esc_html__( 'Inactive', 'elementskit-lite' ) . '</span>' ) ) ),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function get_get() {
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
$id = $this->request['id'];
|
||||
$post = get_post( $id );
|
||||
if ( $post != null ) {
|
||||
return array(
|
||||
'title' => $post->post_title,
|
||||
'status' => $post->post_status,
|
||||
'activation' => get_post_meta( $post->ID, 'elementskit_template_activation', true ),
|
||||
'type' => get_post_meta( $post->ID, 'elementskit_template_type', true ),
|
||||
'condition_a' => get_post_meta( $post->ID, 'elementskit_template_condition_a', true ),
|
||||
'condition_singular' => get_post_meta( $post->ID, 'elementskit_template_condition_singular', true ),
|
||||
'condition_singular_id' => get_post_meta( $post->ID, 'elementskit_template_condition_singular_id', true ),
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
new ElementsKit_HeaderFooterBuilder_Api();
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Cpt_Hooks {
|
||||
public static $instance = null;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
add_action( 'admin_init', array( $this, 'add_author_support_to_column' ), 10 );
|
||||
add_filter( 'manage_elementskit_template_posts_columns', array( $this, 'set_columns' ) );
|
||||
add_action( 'manage_elementskit_template_posts_custom_column', array( $this, 'render_column' ), 10, 2 );
|
||||
add_filter( 'parse_query', array( $this, 'query_filter' ) );
|
||||
}
|
||||
|
||||
public function add_author_support_to_column() {
|
||||
add_post_type_support( 'elementskit_template', 'author' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set custom column for template list.
|
||||
*/
|
||||
public function set_columns( $columns ) {
|
||||
|
||||
$date_column = $columns['date'];
|
||||
$author_column = $columns['author'];
|
||||
|
||||
unset( $columns['date'] );
|
||||
unset( $columns['author'] );
|
||||
|
||||
$columns['type'] = esc_html__( 'Type', 'elementskit-lite' );
|
||||
$columns['condition'] = esc_html__( 'Conditions', 'elementskit-lite' );
|
||||
$columns['date'] = $date_column;
|
||||
$columns['author'] = $author_column;
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render Column
|
||||
*
|
||||
* Enqueue js and css to frontend.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
public function render_column( $column, $post_id ) {
|
||||
switch ( $column ) {
|
||||
case 'type':
|
||||
$type = get_post_meta( $post_id, 'elementskit_template_type', true );
|
||||
$active = get_post_meta( $post_id, 'elementskit_template_activation', true );
|
||||
|
||||
$output = ucfirst( $type ) . ( ( $active == 'yes' )
|
||||
? ( '<span class="ekit-headerfooter-status ekit-headerfooter-status-active">' . esc_html__( 'Active', 'elementskit-lite' ) . '</span>' )
|
||||
: ( '<span class="ekit-headerfooter-status ekit-headerfooter-status-inactive">' . esc_html__( 'Inactive', 'elementskit-lite' ) . '</span>' ) );
|
||||
|
||||
echo wp_kses($output, \ElementsKit_Lite\Utils::get_kses_array());
|
||||
|
||||
break;
|
||||
case 'condition':
|
||||
$cond = array(
|
||||
'condition_a' => get_post_meta( $post_id, 'elementskit_template_condition_a', true ),
|
||||
'condition_singular' => get_post_meta( $post_id, 'elementskit_template_condition_singular', true ),
|
||||
'condition_singular_id' => get_post_meta( $post_id, 'elementskit_template_condition_singular_id', true ),
|
||||
);
|
||||
|
||||
echo esc_html(ucwords(
|
||||
str_replace(
|
||||
'_',
|
||||
' ',
|
||||
$cond['condition_a']
|
||||
. ( ( $cond['condition_a'] == 'singular' )
|
||||
? ( ( $cond['condition_singular'] != '' )
|
||||
? ( ' > ' . $cond['condition_singular']
|
||||
. ( ( $cond['condition_singular_id'] != '' )
|
||||
? ' > ' . $cond['condition_singular_id']
|
||||
: '' ) )
|
||||
: '' )
|
||||
: '' )
|
||||
)
|
||||
));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function query_filter( $query ) {
|
||||
global $pagenow;
|
||||
$current_page = isset( $_GET['post_type'] ) ? sanitize_text_field(wp_unslash($_GET['post_type'])) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We are using wordpress default query filter for managing menu items
|
||||
|
||||
if ( is_admin()
|
||||
&& 'elementskit_template' == $current_page
|
||||
&& 'edit.php' == $pagenow
|
||||
&& isset( $_GET['elementskit_type_filter'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We are using wordpress default query filter for managing menu items
|
||||
&& $_GET['elementskit_type_filter'] != '' // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We are using wordpress default query filter for managing menu items
|
||||
&& $_GET['elementskit_type_filter'] != 'all' // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We are using wordpress default query filter for managing menu items
|
||||
) {
|
||||
$type = sanitize_text_field(wp_unslash($_GET['elementskit_type_filter'])); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We are using wordpress default query filter for managing menu items
|
||||
$query->query_vars['meta_key'] = 'elementskit_template_type'; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
|
||||
$query->query_vars['meta_value'] = $type; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value
|
||||
$query->query_vars['meta_compare'] = '=';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function instance() {
|
||||
if ( is_null( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\HeaderFooterBuilder;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Cpt {
|
||||
|
||||
public function __construct() {
|
||||
$this->post_type();
|
||||
|
||||
add_action( 'admin_menu', array( $this, 'cpt_menu' ) );
|
||||
add_filter( 'single_template', array( $this, 'load_canvas_template' ) );
|
||||
}
|
||||
|
||||
public function post_type() {
|
||||
|
||||
$labels = array(
|
||||
'name' => esc_html__( 'Templates', 'elementskit-lite' ),
|
||||
'singular_name' => esc_html__( 'Template', 'elementskit-lite' ),
|
||||
'menu_name' => esc_html__( 'Header Footer', 'elementskit-lite' ),
|
||||
'name_admin_bar' => esc_html__( 'Header Footer', 'elementskit-lite' ),
|
||||
'add_new' => esc_html__( 'Add New', 'elementskit-lite' ),
|
||||
'add_new_item' => esc_html__( 'Add New Template', 'elementskit-lite' ),
|
||||
'new_item' => esc_html__( 'New Template', 'elementskit-lite' ),
|
||||
'edit_item' => esc_html__( 'Edit Template', 'elementskit-lite' ),
|
||||
'view_item' => esc_html__( 'View Template', 'elementskit-lite' ),
|
||||
'all_items' => esc_html__( 'All Templates', 'elementskit-lite' ),
|
||||
'search_items' => esc_html__( 'Search Templates', 'elementskit-lite' ),
|
||||
'parent_item_colon' => esc_html__( 'Parent Templates:', 'elementskit-lite' ),
|
||||
'not_found' => esc_html__( 'No Templates found.', 'elementskit-lite' ),
|
||||
'not_found_in_trash' => esc_html__( 'No Templates found in Trash.', 'elementskit-lite' ),
|
||||
);
|
||||
|
||||
$args = array(
|
||||
'labels' => $labels,
|
||||
'public' => true,
|
||||
'rewrite' => false,
|
||||
'show_ui' => true,
|
||||
'show_in_menu' => false,
|
||||
'show_in_nav_menus' => false,
|
||||
'exclude_from_search' => true,
|
||||
'capability_type' => 'page',
|
||||
'show_in_rest' => true,
|
||||
'rest_base' => 'elementskit-template',
|
||||
'hierarchical' => false,
|
||||
'supports' => array( 'title', 'thumbnail', 'elementor' ),
|
||||
);
|
||||
|
||||
register_post_type( 'elementskit_template', $args );
|
||||
}
|
||||
|
||||
public function cpt_menu() {
|
||||
$link_our_new_cpt = 'edit.php?post_type=elementskit_template';
|
||||
add_submenu_page( 'elementskit', esc_html__( 'Header Footer', 'elementskit-lite' ), esc_html__( 'Header Footer', 'elementskit-lite' ), 'manage_options', $link_our_new_cpt );
|
||||
}
|
||||
|
||||
function load_canvas_template( $single_template ) {
|
||||
|
||||
global $post;
|
||||
|
||||
if ( 'elementskit_template' == $post->post_type ) {
|
||||
|
||||
$elementor_2_0_canvas = ELEMENTOR_PATH . '/modules/page-templates/templates/canvas.php';
|
||||
|
||||
if ( file_exists( $elementor_2_0_canvas ) ) {
|
||||
return $elementor_2_0_canvas;
|
||||
} else {
|
||||
return ELEMENTOR_PATH . '/includes/page-templates/canvas.php';
|
||||
}
|
||||
}
|
||||
|
||||
return $single_template;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new Cpt();
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Init {
|
||||
|
||||
public $dir;
|
||||
|
||||
public $url;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
// get current directory path
|
||||
$this->dir = dirname( __FILE__ ) . '/';
|
||||
|
||||
// get current module's url
|
||||
$this->url = \ElementsKit_Lite::plugin_url() . 'modules/header-footer/';
|
||||
|
||||
// enqueue scripts
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles' ) );
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
||||
|
||||
// include all necessary files
|
||||
$this->include_files();
|
||||
|
||||
add_action( 'admin_footer', array( $this, 'modal_view' ) );
|
||||
|
||||
Cpt_Hooks::instance();
|
||||
Activator::instance();
|
||||
}
|
||||
|
||||
public function include_files() {
|
||||
include_once $this->dir . 'cpt.php';
|
||||
include_once $this->dir . 'cpt-api.php';
|
||||
}
|
||||
|
||||
public function modal_view() {
|
||||
$screen = get_current_screen();
|
||||
if ( $screen->id == 'edit-elementskit_template' ) {
|
||||
include_once $this->dir . 'views/modal-editor.php';
|
||||
}
|
||||
}
|
||||
|
||||
public function enqueue_styles() {
|
||||
$screen = get_current_screen();
|
||||
if ( $screen->id == 'edit-elementskit_template' ) {
|
||||
wp_enqueue_style( 'select2', $this->url . 'assets/css/select2.min.css', false, \ElementsKit_Lite::version() );
|
||||
wp_enqueue_style( 'elementskit-menu-admin-style', $this->url . 'assets/css/admin-style.css', false, \ElementsKit_Lite::version() );
|
||||
}
|
||||
}
|
||||
|
||||
public function enqueue_scripts() {
|
||||
$screen = get_current_screen();
|
||||
if ( $screen->id == 'edit-elementskit_template' ) {
|
||||
wp_enqueue_script( 'select2', $this->url . 'assets/js/select2.min.js', array( 'jquery' ), true, \ElementsKit_Lite::version() );
|
||||
wp_enqueue_script( 'elementskit-menu-admin-script', $this->url . 'assets/js/admin-script.js', array( 'jquery' ), true, \ElementsKit_Lite::version() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Astra theme compatibility.
|
||||
*/
|
||||
class Astra {
|
||||
|
||||
/**
|
||||
* Instance of Elementor Frontend class.
|
||||
*
|
||||
* @var \Elementor\Frontend()
|
||||
*/
|
||||
private $elementor;
|
||||
|
||||
private $header;
|
||||
private $footer;
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
$this->header = $template_ids[0];
|
||||
$this->footer = $template_ids[1];
|
||||
|
||||
if ( defined( 'ELEMENTOR_VERSION' ) && is_callable( 'Elementor\Plugin::instance' ) ) {
|
||||
$this->elementor = \Elementor\Plugin::instance();
|
||||
}
|
||||
|
||||
if ( $this->header != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_header_markup' ), 10 );
|
||||
add_action( 'astra_header', array( $this, 'add_plugin_header_markup' ) );
|
||||
}
|
||||
|
||||
if ( $this->footer != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_footer_markup' ), 10 );
|
||||
add_action( 'astra_footer', array( $this, 'add_plugin_footer_markup' ) );
|
||||
}
|
||||
}
|
||||
|
||||
// header actions
|
||||
public function remove_theme_header_markup() {
|
||||
remove_action( 'astra_header', 'astra_header_markup' );
|
||||
}
|
||||
|
||||
public function add_plugin_header_markup() {
|
||||
do_action( 'elementskit/template/before_header' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-header">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->header ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_header' );
|
||||
}
|
||||
|
||||
|
||||
// footer actions
|
||||
public function remove_theme_footer_markup() {
|
||||
remove_action( 'astra_footer', 'astra_footer_markup' );
|
||||
}
|
||||
|
||||
public function add_plugin_footer_markup() {
|
||||
do_action( 'elementskit/template/before_footer' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-footer">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->footer ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_footer' );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* BB theme theme compatibility.
|
||||
*/
|
||||
class Bbtheme {
|
||||
|
||||
/**
|
||||
* Instance of Elementor Frontend class.
|
||||
*
|
||||
* @var \Elementor\Frontend()
|
||||
*/
|
||||
private $elementor;
|
||||
|
||||
private $header;
|
||||
private $footer;
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
$this->header = $template_ids[0];
|
||||
$this->footer = $template_ids[1];
|
||||
|
||||
if ( defined( 'ELEMENTOR_VERSION' ) && is_callable( 'Elementor\Plugin::instance' ) ) {
|
||||
$this->elementor = \Elementor\Plugin::instance();
|
||||
}
|
||||
|
||||
if ( $this->header != null ) {
|
||||
add_filter( 'fl_header_enabled', '__return_false' );
|
||||
add_action( 'fl_before_header', array( $this, 'add_plugin_header_markup' ) );
|
||||
}
|
||||
|
||||
if ( $this->footer != null ) {
|
||||
add_filter( 'fl_footer_enabled', '__return_false' );
|
||||
add_action( 'fl_after_content', array( $this, 'add_plugin_footer_markup' ) );
|
||||
}
|
||||
}
|
||||
|
||||
// header actions
|
||||
public function add_plugin_header_markup() {
|
||||
|
||||
if ( class_exists( '\FLTheme' ) ) {
|
||||
$header_layout = \FLTheme::get_setting( 'fl-header-layout' );
|
||||
|
||||
if ( 'none' == $header_layout || is_page_template( 'tpl-no-header-footer.php' ) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
do_action( 'elementskit/template/before_header' );
|
||||
?>
|
||||
<header id="masthead" itemscope="itemscope" itemtype="https://schema.org/WPHeader">
|
||||
<div class="ekit-template-content-markup ekit-template-content-header">
|
||||
<?php
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->header ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
?>
|
||||
</div>
|
||||
</header>
|
||||
<style>
|
||||
[data-type="header"] {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
do_action( 'elementskit/template/after_header' );
|
||||
}
|
||||
|
||||
|
||||
// footer actions
|
||||
public function add_plugin_footer_markup() {
|
||||
if ( is_page_template( 'tpl-no-header-footer.php' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
do_action( 'elementskit/template/before_footer' );
|
||||
?>
|
||||
|
||||
<footer itemscope="itemscope" itemtype="https://schema.org/WPFooter">
|
||||
<?php
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->footer ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
?>
|
||||
</footer>
|
||||
|
||||
<?php
|
||||
do_action( 'elementskit/template/after_footer' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* GeneratePress theme compatibility.
|
||||
*/
|
||||
class Generatepress {
|
||||
|
||||
/**
|
||||
* Instance of Elementor Frontend class.
|
||||
*
|
||||
* @var \Elementor\Frontend()
|
||||
*/
|
||||
private $elementor;
|
||||
|
||||
private $header;
|
||||
private $footer;
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
$this->header = $template_ids[0];
|
||||
$this->footer = $template_ids[1];
|
||||
|
||||
if ( defined( 'ELEMENTOR_VERSION' ) && is_callable( 'Elementor\Plugin::instance' ) ) {
|
||||
$this->elementor = \Elementor\Plugin::instance();
|
||||
}
|
||||
|
||||
if ( $this->header != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_header_markup' ), 10 );
|
||||
add_action( 'generate_header', array( $this, 'add_plugin_header_markup' ) );
|
||||
}
|
||||
|
||||
if ( $this->footer != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_footer_markup' ), 10 );
|
||||
add_action( 'generate_footer', array( $this, 'add_plugin_footer_markup' ) );
|
||||
}
|
||||
}
|
||||
|
||||
// header actions
|
||||
public function remove_theme_header_markup() {
|
||||
remove_action( 'generate_header', 'generate_construct_header' );
|
||||
}
|
||||
|
||||
public function add_plugin_header_markup() {
|
||||
do_action( 'elementskit/template/before_header' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-header">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->header ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_header' );
|
||||
}
|
||||
|
||||
|
||||
// footer actions
|
||||
public function remove_theme_footer_markup() {
|
||||
remove_action( 'generate_footer', 'generate_construct_footer_widgets', 5 );
|
||||
remove_action( 'generate_footer', 'generate_construct_footer' );
|
||||
}
|
||||
|
||||
public function add_plugin_footer_markup() {
|
||||
do_action( 'elementskit/template/before_footer' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-footer">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->footer ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_footer' );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Genesis theme compatibility.
|
||||
*/
|
||||
class Genesis {
|
||||
|
||||
/**
|
||||
* Instance of Elementor Frontend class.
|
||||
*
|
||||
* @var \Elementor\Frontend()
|
||||
*/
|
||||
private $elementor;
|
||||
|
||||
private $header;
|
||||
private $footer;
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
$this->header = $template_ids[0];
|
||||
$this->footer = $template_ids[1];
|
||||
|
||||
if ( defined( 'ELEMENTOR_VERSION' ) && is_callable( 'Elementor\Plugin::instance' ) ) {
|
||||
$this->elementor = \Elementor\Plugin::instance();
|
||||
}
|
||||
|
||||
if ( $this->header != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_header_markup' ), 10 );
|
||||
add_action( 'ocean_header', array( $this, 'add_plugin_header_markup' ) );
|
||||
add_action( 'genesis_header', array( $this, 'genesis_header_markup_open' ), 16 );
|
||||
add_action( 'genesis_header', array( $this, 'genesis_header_markup_close' ), 25 ); }
|
||||
|
||||
if ( $this->footer != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_footer_markup' ), 10 );
|
||||
add_action( 'genesis_footer', array( $this, 'genesis_footer_markup_open' ), 16 );
|
||||
add_action( 'genesis_footer', array( $this, 'genesis_footer_markup_close' ), 25 );
|
||||
add_action( 'ocean_footer', array( $this, 'add_plugin_footer_markup' ) );
|
||||
}
|
||||
}
|
||||
|
||||
// header actions
|
||||
public function remove_theme_header_markup() {
|
||||
for ( $priority = 0; $priority < 16; $priority ++ ) {
|
||||
remove_all_actions( 'genesis_header', $priority );
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Open markup for header.
|
||||
*/
|
||||
public function genesis_header_markup_open() {
|
||||
|
||||
genesis_markup(
|
||||
array(
|
||||
'html5' => '<header %s>',
|
||||
'xhtml' => '<div id="header">',
|
||||
'context' => 'site-header',
|
||||
)
|
||||
);
|
||||
|
||||
genesis_structural_wrap( 'header' );
|
||||
}
|
||||
/**
|
||||
* Close MArkup for header.
|
||||
*/
|
||||
public function genesis_header_markup_close() {
|
||||
|
||||
genesis_structural_wrap( 'header', 'close' );
|
||||
genesis_markup(
|
||||
array(
|
||||
'html5' => '</header>',
|
||||
'xhtml' => '</div>',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function add_plugin_header_markup() {
|
||||
do_action( 'elementskit/template/before_header' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-header">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->header ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_header' );
|
||||
}
|
||||
|
||||
|
||||
// footer actions
|
||||
public function remove_theme_footer_markup() {
|
||||
for ( $priority = 0; $priority < 16; $priority ++ ) {
|
||||
remove_all_actions( 'genesis_footer', $priority );
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Open markup for footer.
|
||||
*/
|
||||
public function genesis_footer_markup_open() {
|
||||
|
||||
genesis_markup(
|
||||
array(
|
||||
'html5' => '<footer %s>',
|
||||
'xhtml' => '<div id="footer" class="footer">',
|
||||
'context' => 'site-footer',
|
||||
)
|
||||
);
|
||||
genesis_structural_wrap( 'footer', 'open' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Close markup for footer.
|
||||
*/
|
||||
public function genesis_footer_markup_close() {
|
||||
|
||||
genesis_structural_wrap( 'footer', 'close' );
|
||||
genesis_markup(
|
||||
array(
|
||||
'html5' => '</footer>',
|
||||
'xhtml' => '</div>',
|
||||
)
|
||||
);
|
||||
}
|
||||
public function add_plugin_footer_markup() {
|
||||
do_action( 'elementskit/template/before_footer' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-footer">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->footer ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_footer' );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
if ( ! function_exists( 'hfe_render_header' ) ) {
|
||||
function hfe_render_header() {
|
||||
global $elementskit_template_ids;
|
||||
if ( $elementskit_template_ids[0] == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
do_action( 'elementskit/template/before_header' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-header">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $elementskit_template_ids[0] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_header' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'get_hfe_header_id' ) ) {
|
||||
function get_hfe_header_id() {
|
||||
global $elementskit_template_ids;
|
||||
return $elementskit_template_ids[0];
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'hfe_render_footer' ) ) {
|
||||
function hfe_render_footer() {
|
||||
global $elementskit_template_ids;
|
||||
if ( $elementskit_template_ids[1] == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
do_action( 'elementskit/template/before_header' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-header">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $elementskit_template_ids[1] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_header' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'get_hfe_footer_id' ) ) {
|
||||
function get_hfe_footer_id() {
|
||||
global $elementskit_template_ids;
|
||||
return $elementskit_template_ids[1];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* MyListing support for the header footer.
|
||||
*/
|
||||
class MyListing {
|
||||
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
global $elementskit_template_ids;
|
||||
|
||||
$elementskit_template_ids = $template_ids;
|
||||
include 'my-listing-functions.php';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Neve theme compatibility.
|
||||
*/
|
||||
class Neve {
|
||||
|
||||
/**
|
||||
* Instance of Elementor Frontend class.
|
||||
*
|
||||
* @var \Elementor\Frontend()
|
||||
*/
|
||||
private $elementor;
|
||||
|
||||
private $header;
|
||||
private $footer;
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
$this->header = $template_ids[0];
|
||||
$this->footer = $template_ids[1];
|
||||
|
||||
if ( defined( 'ELEMENTOR_VERSION' ) && is_callable( 'Elementor\Plugin::instance' ) ) {
|
||||
$this->elementor = \Elementor\Plugin::instance();
|
||||
}
|
||||
|
||||
if ( $this->header != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_header_markup' ), 10 );
|
||||
add_action( 'neve_do_header', array( $this, 'add_plugin_header_markup' ) );
|
||||
}
|
||||
|
||||
if ( $this->footer != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_footer_markup' ), 10 );
|
||||
add_action( 'neve_do_footer', array( $this, 'add_plugin_footer_markup' ) );
|
||||
}
|
||||
}
|
||||
|
||||
// header actions
|
||||
public function remove_theme_header_markup() {
|
||||
remove_all_actions( 'hfg_header_render' );
|
||||
}
|
||||
|
||||
public function add_plugin_header_markup() {
|
||||
do_action( 'elementskit/template/before_header' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-header">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->header ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_header' );
|
||||
}
|
||||
|
||||
// footer actions
|
||||
public function remove_theme_footer_markup() {
|
||||
remove_all_actions( 'hfg_footer_render' );
|
||||
}
|
||||
|
||||
public function add_plugin_footer_markup() {
|
||||
do_action( 'elementskit/template/before_footer' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-footer">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->footer ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_footer' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Oceanwp theme compatibility.
|
||||
*/
|
||||
class Oceanwp {
|
||||
|
||||
/**
|
||||
* Instance of Elementor Frontend class.
|
||||
*
|
||||
* @var \Elementor\Frontend()
|
||||
*/
|
||||
private $elementor;
|
||||
|
||||
private $header;
|
||||
private $footer;
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
$this->header = $template_ids[0];
|
||||
$this->footer = $template_ids[1];
|
||||
|
||||
if ( defined( 'ELEMENTOR_VERSION' ) && is_callable( 'Elementor\Plugin::instance' ) ) {
|
||||
$this->elementor = \Elementor\Plugin::instance();
|
||||
}
|
||||
|
||||
if ( $this->header != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_header_markup' ), 10 );
|
||||
add_action( 'ocean_header', array( $this, 'add_plugin_header_markup' ) );
|
||||
}
|
||||
|
||||
if ( $this->footer != null ) {
|
||||
add_action( 'template_redirect', array( $this, 'remove_theme_footer_markup' ), 10 );
|
||||
add_action( 'ocean_footer', array( $this, 'add_plugin_footer_markup' ) );
|
||||
}
|
||||
}
|
||||
|
||||
// header actions
|
||||
public function remove_theme_header_markup() {
|
||||
remove_action( 'ocean_top_bar', 'oceanwp_top_bar_template' );
|
||||
remove_action( 'ocean_header', 'oceanwp_header_template' );
|
||||
remove_action( 'ocean_page_header', 'oceanwp_page_header_template' );
|
||||
}
|
||||
|
||||
public function add_plugin_header_markup() {
|
||||
do_action( 'elementskit/template/before_header' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-header">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->header ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_header' );
|
||||
}
|
||||
|
||||
|
||||
// footer actions
|
||||
public function remove_theme_footer_markup() {
|
||||
remove_action( 'ocean_footer', 'oceanwp_footer_template' );
|
||||
}
|
||||
|
||||
public function add_plugin_footer_markup() {
|
||||
do_action( 'elementskit/template/before_footer' );
|
||||
echo '<div class="ekit-template-content-markup ekit-template-content-footer">';
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $this->footer ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
echo '</div>';
|
||||
do_action( 'elementskit/template/after_footer' );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Force fully replace the header footer.
|
||||
*/
|
||||
class Theme_Support {
|
||||
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
if ( $template_ids[0] != null ) {
|
||||
add_action( 'get_header', array( $this, 'get_header' ) );
|
||||
}
|
||||
if ( $template_ids[1] != null ) {
|
||||
add_action( 'get_footer', array( $this, 'get_footer' ) );
|
||||
}
|
||||
}
|
||||
|
||||
public function get_header( $name ) {
|
||||
require __DIR__ . '/../views/theme-support-header.php';
|
||||
|
||||
$templates = array();
|
||||
$name = (string) $name;
|
||||
if ( '' !== $name ) {
|
||||
$templates[] = "header-{$name}.php";
|
||||
}
|
||||
|
||||
$templates[] = 'header.php';
|
||||
|
||||
// Avoid running wp_head hooks again
|
||||
remove_all_actions( 'wp_head' );
|
||||
ob_start();
|
||||
// It cause a `require_once` so, in the get_header it self it will not be required again.
|
||||
locate_template( $templates, true );
|
||||
ob_get_clean();
|
||||
}
|
||||
|
||||
public function get_footer( $name ) {
|
||||
require __DIR__ . '/../views/theme-support-footer.php';
|
||||
|
||||
$templates = array();
|
||||
$name = (string) $name;
|
||||
if ( '' !== $name ) {
|
||||
$templates[] = "footer-{$name}.php";
|
||||
}
|
||||
|
||||
$templates[] = 'footer.php';
|
||||
|
||||
ob_start();
|
||||
// It cause a `require_once` so, in the get_header it self it will not be required again.
|
||||
locate_template( $templates, true );
|
||||
ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Header_Footer\Theme_Hooks;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* TwentyNineteen support for the header footer.
|
||||
*/
|
||||
class TwentyNineteen {
|
||||
|
||||
|
||||
/**
|
||||
* Run all the Actions / Filters.
|
||||
*/
|
||||
function __construct( $template_ids ) {
|
||||
if ( $template_ids[0] != null ) {
|
||||
add_action( 'get_header', array( $this, 'get_header' ) );
|
||||
}
|
||||
if ( $template_ids[1] != null ) {
|
||||
add_action( 'get_footer', array( $this, 'get_footer' ) );
|
||||
}
|
||||
}
|
||||
|
||||
public function get_header( $name ) {
|
||||
add_action(
|
||||
'elementskit/template/after_header',
|
||||
function() {
|
||||
echo '<div id="page" class="site">';
|
||||
echo '<div id="content" class="site-content">';
|
||||
}
|
||||
);
|
||||
require __DIR__ . '/../views/theme-support-header.php';
|
||||
|
||||
$templates = array();
|
||||
$name = (string) $name;
|
||||
if ( '' !== $name ) {
|
||||
$templates[] = "header-{$name}.php";
|
||||
}
|
||||
|
||||
$templates[] = 'header.php';
|
||||
|
||||
// Avoid running wp_head hooks again
|
||||
remove_all_actions( 'wp_head' );
|
||||
ob_start();
|
||||
// It cause a `require_once` so, in the get_header it self it will not be required again.
|
||||
locate_template( $templates, true );
|
||||
ob_get_clean();
|
||||
}
|
||||
|
||||
public function get_footer( $name ) {
|
||||
add_action(
|
||||
'elementskit/template/after_footer',
|
||||
function() {
|
||||
echo '</div></div>';
|
||||
}
|
||||
);
|
||||
|
||||
require __DIR__ . '/../views/theme-support-footer.php';
|
||||
|
||||
$templates = array();
|
||||
$name = (string) $name;
|
||||
if ( '' !== $name ) {
|
||||
$templates[] = "footer-{$name}.php";
|
||||
}
|
||||
|
||||
$templates[] = 'footer.php';
|
||||
|
||||
ob_start();
|
||||
// It cause a `require_once` so, in the get_header it self it will not be required again.
|
||||
locate_template( $templates, true );
|
||||
ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<div class="attr-modal attr-fade" id="elementskit_headerfooter_modal" tabindex="-1" role="dialog" aria-labelledby="elementskit_headerfooter_modalLabel">
|
||||
<div class="attr-modal-dialog attr-modal-dialog-centered" role="document">
|
||||
<form action="" method="get" id="elementskit-template-modalinput-form" data-open-editor="0" data-editor-url="<?php echo esc_url(get_admin_url()); ?>" data-nonce="<?php echo esc_attr(wp_create_nonce( 'wp_rest' )); ?>">
|
||||
<!-- <input type="hidden" name="post_author" value ="<?php //echo get_current_user_id(); ?>"> -->
|
||||
<div class="attr-modal-content">
|
||||
<div class="attr-modal-header">
|
||||
<button type="button" class="attr-close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="attr-modal-title" id="elementskit_headerfooter_modalLabel"><?php esc_html_e( 'Template Settings', 'elementskit-lite' ); ?></h4>
|
||||
</div>
|
||||
<div class="attr-modal-body" id="elementskit_headerfooter_modal_body">
|
||||
<div class="ekit-input-group">
|
||||
<label class="attr-input-label"><?php esc_html_e( 'Title:', 'elementskit-lite' ); ?></label>
|
||||
<input required type="text" name="title" class="ekit-template-modalinput-title attr-form-control">
|
||||
</div>
|
||||
<br />
|
||||
<div class="ekit-input-group">
|
||||
<label class="attr-input-label"><?php esc_html_e( 'Type:', 'elementskit-lite' ); ?></label>
|
||||
<select name="type" class="ekit-template-modalinput-type attr-form-control">
|
||||
<option value="header"><?php esc_html_e( 'Header', 'elementskit-lite' ); ?></option>
|
||||
<option value="footer"><?php esc_html_e( 'Footer', 'elementskit-lite' ); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
<div class="ekit-template-headerfooter-option-container">
|
||||
<div class="ekit-input-group">
|
||||
<label class="attr-input-label"><?php esc_html_e( 'Conditions:', 'elementskit-lite' ); ?></label>
|
||||
<select name="condition_a" class="ekit-template-modalinput-condition_a attr-form-control">
|
||||
<option value="entire_site"><?php esc_html_e( 'Entire Site', 'elementskit-lite' ); ?></option>
|
||||
<option value="singular"><?php esc_html_e( 'Singular (Only Pro)', 'elementskit-lite' ); ?></option>
|
||||
<option value="archive"><?php esc_html_e( 'Archive (Only Pro)', 'elementskit-lite' ); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<div class="ekit-template-modalinput-condition_singular-container">
|
||||
<div class="ekit-input-group">
|
||||
<label class="attr-input-label"></label>
|
||||
<select name="condition_singular" class="ekit-template-modalinput-condition_singular attr-form-control">
|
||||
<option value="all"><?php esc_html_e( 'All Singulars (Only Pro)', 'elementskit-lite' ); ?></option>
|
||||
<option value="front_page"><?php esc_html_e( 'Front Page (Only Pro)', 'elementskit-lite' ); ?></option>
|
||||
<option value="all_posts"><?php esc_html_e( 'All Posts (Only Pro)', 'elementskit-lite' ); ?></option>
|
||||
<option value="all_pages"><?php esc_html_e( 'All Pages (Only Pro)', 'elementskit-lite' ); ?></option>
|
||||
<option value="selective"><?php esc_html_e( 'Selective Singular (Only Pro)', 'elementskit-lite' ); ?></option>
|
||||
<option value="404page"><?php esc_html_e( '404 Page (Only Pro)', 'elementskit-lite' ); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<div class="ekit-template-modalinput-condition_singular_id-container ekit_multipile_ajax_search_filed">
|
||||
<div class="ekit-input-group">
|
||||
<label class="attr-input-label"></label>
|
||||
<select multiple name="condition_singular_id" class="ekit-template-modalinput-condition_singular_id"></select>
|
||||
</div>
|
||||
<br />
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<div class="ekit-switch-group">
|
||||
<label class="attr-input-label"><?php esc_html_e( 'Activate/Deactivate:', 'elementskit-lite' ); ?></label>
|
||||
<div class="ekit-admin-input-switch">
|
||||
<input checked="" type="checkbox" value="yes"
|
||||
class="ekit-admin-control-input ekit-template-modalinput-activition"
|
||||
name="activation" id="ekit_activation_modal_input">
|
||||
<label class="ekit-admin-control-label" for="ekit_activation_modal_input">
|
||||
<span class="ekit-admin-control-label-switch" data-active="ON"
|
||||
data-inactive="OFF"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
<div class="attr-modal-footer">
|
||||
<button type="button" class="attr-btn attr-btn-default elementskit-template-save-btn-editor"><?php esc_html_e( 'Edit content', 'elementskit-lite' ); ?></button>
|
||||
<button type="submit" class="attr-btn attr-btn-primary elementskit-template-save-btn"><?php esc_html_e( 'Save changes', 'elementskit-lite' ); ?></button>
|
||||
</div>
|
||||
<div class="ekit-spinner"></div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php do_action( 'elementskit/template/before_footer' ); ?>
|
||||
<div class="ekit-template-content-markup ekit-template-content-footer ekit-template-content-theme-support">
|
||||
<?php
|
||||
$template = \ElementsKit_Lite\Modules\Header_Footer\Activator::template_ids();
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content( $template[1] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
?>
|
||||
</div>
|
||||
<?php do_action( 'elementskit/template/after_footer' ); ?>
|
||||
<?php wp_footer(); ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* The template for displaying the header
|
||||
*
|
||||
* This is the template that displays all of the <head> section, opens the <body> tag and adds the site's header.
|
||||
*
|
||||
* @package ElementsKit_Lite
|
||||
*/
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
$enable_skip_link = apply_filters( 'elementskit_enable_skip_link', true );
|
||||
$skip_link_url = apply_filters( 'elementskit_skip_link_url', '#content' );
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
|
||||
<head>
|
||||
<meta charset="<?php bloginfo('charset'); ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<?php if (! current_theme_supports('title-tag')) : ?>
|
||||
<title>
|
||||
<?php echo esc_html(wp_get_document_title()); ?>
|
||||
</title>
|
||||
<?php endif; ?>
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
|
||||
<body <?php body_class(); ?>>
|
||||
|
||||
<?php wp_body_open(); ?>
|
||||
|
||||
<?php if ($enable_skip_link) { ?>
|
||||
<a class="skip-link screen-reader-text" href="<?php echo esc_url($skip_link_url); ?>">
|
||||
<?php echo esc_html__('Skip to content', 'elementskit-lite'); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
||||
<?php do_action('elementskit/template/before_header'); ?>
|
||||
|
||||
<div class="ekit-template-content-markup ekit-template-content-header ekit-template-content-theme-support">
|
||||
<?php
|
||||
$template = \ElementsKit_Lite\Modules\Header_Footer\Activator::template_ids();
|
||||
echo \ElementsKit_Lite\Utils::render_elementor_content($template[0]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Displaying with Elementor content rendering
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php do_action('elementskit/template/after_header'); ?>
|
||||
@@ -0,0 +1 @@
|
||||
.elementskit-add-template-button{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;width:40px;height:40px;padding:0;background-color:#f2295b;border-width:0;border-radius:30px;vertical-align:-2px;cursor:pointer}.elementskit-add-template-button>img{display:block;width:16px;height:16px!important;margin:12px auto 0}
|
||||
|
After Width: | Height: | Size: 446 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Layout_Manager;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Init {
|
||||
private $dir;
|
||||
private $url;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
// get current directory path.
|
||||
$this->dir = dirname( __FILE__ ) . '/';
|
||||
|
||||
// get current module's url.
|
||||
$this->url = \ElementsKit_Lite::plugin_url() . 'modules/layout-manager/';
|
||||
|
||||
// print views and tab variables on footer.
|
||||
add_action( 'elementor/editor/footer', array( $this, 'script_variables' ) );
|
||||
|
||||
// enqueue editor js for elementor.
|
||||
add_action( 'elementor/editor/before_enqueue_scripts', array( $this, 'editor_scripts' ), 1 );
|
||||
|
||||
// enqueue editor css.
|
||||
add_action( 'elementor/editor/after_enqueue_styles', array( $this, 'editor_styles' ) );
|
||||
|
||||
// enqueue modal's preview css.
|
||||
add_action( 'elementor/preview/enqueue_styles', array( $this, 'preview_styles' ) );
|
||||
|
||||
new Layout_List_Api();
|
||||
new Layout_Import_Api();
|
||||
}
|
||||
|
||||
public function editor_scripts() {
|
||||
wp_enqueue_script( 'ekit-layout-library-script', $this->url . 'assets/js/ekit-layout-library.js', array( 'jquery', 'wp-element' ), \ElementsKit_Lite::version(), true );
|
||||
}
|
||||
|
||||
public function editor_styles() {
|
||||
wp_enqueue_style( 'ekit-layout-library-style', $this->url . 'assets/css/ekit-layout-library.css', array(), \ElementsKit_Lite::version() );
|
||||
}
|
||||
|
||||
public function preview_styles() {
|
||||
wp_enqueue_style( 'ekit-layout-library-preview-style', $this->url . 'assets/css/preview.css', array(), \ElementsKit_Lite::version() );
|
||||
}
|
||||
|
||||
public function script_variables() { ?>
|
||||
<script type="text/javascript">
|
||||
|
||||
var ElementsKitLayoutManager = {
|
||||
"defaultTab": "pages",
|
||||
"nonce": "<?php echo esc_attr(wp_create_nonce( 'wp_rest' )); ?>",
|
||||
"buttonIcon": "<?php echo esc_url( \ElementsKit_Lite\Libs\Framework\Attr::get_url() . 'assets/images/ekit_icon.svg' ); ?>",
|
||||
"infoIcon": "<?php echo esc_url( $this->url . 'assets/img/info.svg' ); ?>",
|
||||
"apiUrl": "<?php echo esc_url( get_rest_url( null, 'elementskit/v1/layout-manager-api/layout_list' ) ); ?>",
|
||||
"hasPro": <?php echo ( \ElementsKit_Lite::package_type() == 'free' ? 'false' : 'true' ); ?>,
|
||||
"licenseStatus": "<?php echo esc_attr( \ElementsKit_Lite::license_status() ); ?>",
|
||||
"links": {
|
||||
"go_premium": "https://wpmet.com/elementskit-pricing",
|
||||
"active_license": "<?php echo esc_url( admin_url() ); ?>admin.php?page=elementskit-license"
|
||||
},
|
||||
"banner": {
|
||||
"enable": true,
|
||||
"img": "<?php echo esc_url( $this->url . 'assets/img/banner.jpg' ); ?>",
|
||||
"link": "https://wpmet.com/layout-manager-banner",
|
||||
"target": '_blank'
|
||||
}
|
||||
};
|
||||
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Layout_Manager;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use Elementor\Core\Common\Modules\Ajax\Module as Ajax;
|
||||
|
||||
class Layout_Import_Api {
|
||||
public function __construct() {
|
||||
add_action( 'elementor/ajax/register_actions', array( $this, 'register_ajax_actions' ) );
|
||||
}
|
||||
|
||||
public function register_ajax_actions( Ajax $ajax ) {
|
||||
$ajax->register_ajax_action(
|
||||
'get_elementskit_template_data',
|
||||
function( $data ) {
|
||||
if ( ! current_user_can( 'edit_posts' ) ) {
|
||||
throw new \Exception( 'Access Denied' );
|
||||
}
|
||||
|
||||
if ( ! empty( $data['editor_post_id'] ) ) {
|
||||
$editor_post_id = absint( $data['editor_post_id'] );
|
||||
|
||||
if ( ! get_post( $editor_post_id ) ) {
|
||||
throw new \Exception( esc_html__( 'Post not found', 'elementskit-lite' ) );
|
||||
}
|
||||
|
||||
\Elementor\Plugin::instance()->db->switch_to_post( $editor_post_id );
|
||||
}
|
||||
|
||||
if ( empty( $data['template_id'] ) ) {
|
||||
throw new \Exception( esc_html__( 'Template id missing', 'elementskit-lite' ) );
|
||||
}
|
||||
|
||||
$result = $this->get_template_data( $data );
|
||||
|
||||
return $result;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private function get_template_data( array $args ) {
|
||||
$source = new Library_Source();
|
||||
$data = $source->get_data( $args );
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Layout_Manager;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Layout_List_Api extends \ElementsKit_Lite\Core\Handler_Api {
|
||||
|
||||
public function config() {
|
||||
$this->prefix = 'layout-manager-api';
|
||||
}
|
||||
|
||||
public function get_layout_list() {
|
||||
$param = array_merge( \ElementsKit_Lite::license_data(), $_GET, array( 'action' => 'get_layout_list' ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Passed in elementor's hook for get url which has processed the nonce already.
|
||||
|
||||
$response = wp_remote_get(
|
||||
\ElementsKit_Lite::api_url() . 'layout-manager-api/?' . http_build_query( $param ),
|
||||
array(
|
||||
'timeout' => 30,
|
||||
'headers' => array(
|
||||
'Content-Type' => 'application/json',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
return json_decode( wp_remote_retrieve_body( $response ) );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Layout_Manager;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
|
||||
use Elementor\TemplateLibrary\Source_Base;
|
||||
|
||||
class Library_Source extends Source_Base {
|
||||
|
||||
public function get_id() {
|
||||
return 'elementskit-layout-manager';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return __( 'ElementsKit Layout Manager', 'elementskit-lite' );
|
||||
}
|
||||
|
||||
public function register_data() {}
|
||||
|
||||
public function save_item( $template_data ) {
|
||||
return new \WP_Error( 'invalid_request', 'Cannot save template to a elementskit layout manager' );
|
||||
}
|
||||
|
||||
public function update_item( $new_data ) {
|
||||
return new \WP_Error( 'invalid_request', 'Cannot update template to a elementskit layout manager' );
|
||||
}
|
||||
|
||||
public function delete_template( $template_id ) {
|
||||
return new \WP_Error( 'invalid_request', 'Cannot delete template from a elementskit layout manager' );
|
||||
}
|
||||
|
||||
public function export_template( $template_id ) {
|
||||
return new \WP_Error( 'invalid_request', 'Cannot export template from a elementskit layout manager' );
|
||||
}
|
||||
|
||||
public function get_items( $args = array() ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
public function get_item( $template_id ) {
|
||||
$templates = $this->get_items();
|
||||
|
||||
return $templates[ $template_id ];
|
||||
}
|
||||
|
||||
public function request_template_data( $template_id ) {
|
||||
if ( empty( $template_id ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$body = array(
|
||||
'home_url' => trailingslashit( home_url() ),
|
||||
'plugin_version' => \ElementsKit_Lite::version(),
|
||||
);
|
||||
|
||||
$query = array_merge(
|
||||
array(
|
||||
'action' => 'get_layout_data',
|
||||
'layout_id' => $template_id,
|
||||
),
|
||||
\ElementsKit_Lite::license_data()
|
||||
);
|
||||
|
||||
$request_url = \ElementsKit_Lite::api_url() . 'layout-manager-api/' . '?' . http_build_query( $query );
|
||||
$response = wp_remote_get(
|
||||
$request_url,
|
||||
array(
|
||||
'timeout' => 30,
|
||||
)
|
||||
);
|
||||
|
||||
return wp_remote_retrieve_body( $response );
|
||||
}
|
||||
|
||||
public function get_data( array $args, $context = 'display' ) {
|
||||
$data = $this->request_template_data( $args['template_id'] );
|
||||
|
||||
$data = json_decode( $data, true );
|
||||
|
||||
if ( empty( $data ) || empty( $data['content'] ) ) {
|
||||
throw new \Exception( esc_html__( 'Template does not have any content', 'elementskit-lite' ) );
|
||||
}
|
||||
|
||||
$data['content'] = $this->replace_elements_ids( $data['content'] );
|
||||
$data['content'] = $this->process_export_import_content( $data['content'], 'on_import' );
|
||||
|
||||
$post_id = $args['editor_post_id'];
|
||||
$document = \Elementor\Plugin::instance()->documents->get( $post_id );
|
||||
|
||||
if ( $document ) {
|
||||
$data['content'] = $document->get_elements_raw_data( $data['content'], true );
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite;
|
||||
|
||||
use ElementsKit_Lite\Libs\Framework\Attr;
|
||||
use ElementsKit_Lite\Modules\Megamenu\Init;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Megamenu_Api extends Core\Handler_Api {
|
||||
|
||||
public function config() {
|
||||
$this->prefix = 'megamenu';
|
||||
}
|
||||
|
||||
public function get_save_menuitem_settings() {
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
$menu_item_id = $this->request['settings']['menu_id'];
|
||||
$menu_item_settings = wp_json_encode( $this->request['settings'], JSON_UNESCAPED_UNICODE );
|
||||
update_post_meta( $menu_item_id, Init::$menuitem_settings_key, $menu_item_settings );
|
||||
|
||||
return array(
|
||||
'saved' => 1,
|
||||
'message' => esc_html__( 'Saved', 'elementskit-lite' ),
|
||||
);
|
||||
}
|
||||
|
||||
public function get_get_menuitem_settings() {
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
$menu_item_id = $this->request['menu_id'];
|
||||
|
||||
$data = get_post_meta( $menu_item_id, Init::$menuitem_settings_key, true );
|
||||
return (array) json_decode( $data );
|
||||
}
|
||||
|
||||
public function get_megamenu_content() {
|
||||
$menu_item_id = intval($this->request['id']);
|
||||
|
||||
if ('publish' !== get_post_status ($menu_item_id) || post_password_required($menu_item_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$elementor = \Elementor\Plugin::instance();
|
||||
$output = $elementor->frontend->get_builder_content_for_display($menu_item_id);
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
new Megamenu_Api();
|
||||
@@ -0,0 +1 @@
|
||||
.icons-selector *{margin:0;padding:0;border:0;font-size:100%;vertical-align:baseline}.icons-selector,.icons-selector *,.icons-selector :after,.icons-selector :before,.icons-selector:after,.icons-selector:before{-webkit-box-sizing:content-box;box-sizing:content-box}.icons-selector{display:inline-block;vertical-align:middle;text-align:left}.icons-selector .selector{width:100px;height:40px}.icons-selector .selector-button{width:39px;height:100%;display:block;text-align:center;cursor:pointer;float:left}.icons-selector .selector-button i{line-height:38px;text-align:center}.icons-selector .selected-icon{display:block;width:60px;height:100%;float:left;text-align:center}.icons-selector .selected-icon i{line-height:40px;font-size:18px;cursor:default}.icons-selector .selector-popup{position:absolute;z-index:10000;background-color:#fefefe;padding:5px;height:auto;width:342px;margin-top:-1px}.icons-selector .selector-category select,.icons-selector .selector-search input[type=text]{border:0;line-height:20px;padding:10px 2.5%;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;margin-bottom:5px;font-size:12px;display:block}.icons-selector .selector-category select{height:40px}.icons-selector .selector-category select option{padding:10px}.icons-selector input::-webkit-input-placeholder{text-transform:uppercase}.icons-selector input:-moz-placeholder{text-transform:uppercase}.icons-selector input::-moz-placeholder{text-transform:uppercase}.icons-selector input:-ms-input-placeholder{text-transform:uppercase}.icons-selector .selector-search{position:relative}.icons-selector .selector-search i{position:absolute;right:10px;top:7px}.icons-selector .fip-icons-container{width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;padding:5px}.icons-selector .fip-icons-container .loading{font-size:24px;margin:0 auto;padding:20px 0;text-align:center;width:100%}.icons-selector .fip-box{display:inline-block;margin:2px;width:60px;line-height:42px;text-align:center;cursor:pointer;vertical-align:top;height:40px}.icons-selector .selector-footer{line-height:12px;padding:5px 5px 0 5px;text-align:center}.icons-selector .selector-footer,.icons-selector .selector-footer i{font-size:14px}.icons-selector .selector-arrows{float:right}.icons-selector .selector-pages{font-size:11px;float:left}.icons-selector .selector-arrows i{cursor:pointer}.icons-selector .selector-footer em{font-style:italic}.icons-selector .icons-picker-error i:before{color:#eee}@font-face{font-family:iconpicker;src:url(../fonts/iconpicker.eot?90190138);src:url(../fonts/iconpicker.eot?90190138#iefix) format('embedded-opentype'),url(../fonts/iconpicker.woff?90190138) format('woff'),url(../fonts/iconpicker.ttf?90190138) format('truetype'),url(../fonts/iconpicker.svg?90190138#iconpicker) format('svg');font-weight:400;font-style:normal}.icons-selector [class*=" fip-icon-"]:before,.icons-selector [class^=fip-icon-]:before{font-family:iconpicker;font-style:normal;font-weight:400;speak:none;display:inline-block;text-decoration:inherit;width:1em;margin-right:.2em;text-align:center;font-variant:normal;text-transform:none;line-height:1em;margin-left:.2em}.icons-selector .fip-icon-search:before{content:'\e812';cursor:default}.icons-selector .fip-icon-cancel:before{content:'\e814';cursor:pointer}.icons-selector .fip-icon-block:before{content:'\e84e';color:#fed0d0}.icons-selector .fip-icon-down-dir:before{content:'\e800'}.icons-selector .fip-icon-up-dir:before{content:'\e813'}.icons-selector .fip-icon-left-dir:before{content:'\e801'}.icons-selector .fip-icon-right-dir:before{content:'\e802'}.icons-selector .fip-icon-spin3:before{content:'\e815'}.icons-selector .fip-icon-spin3{-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear;display:inline-block}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>Copyright (C) 2014 by original authors @ fontello.com</metadata>
|
||||
<defs>
|
||||
<font id="iconpicker" horiz-adv-x="1000" >
|
||||
<font-face font-family="iconpicker" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
|
||||
<missing-glyph horiz-adv-x="1000" />
|
||||
<glyph glyph-name="spin3" unicode="" d="m494 850c-266 0-483-210-494-472c-1-19 13-20 13-20l84 0c16 0 19 10 19 18c10 199 176 358 378 358c107 0 205-45 273-118l-58-57c-11-12-11-27 5-31l247-50c21-5 46 11 37 44l-58 227c-2 9-16 22-29 13l-65-60c-89 91-214 148-352 148z m409-508c-16 0-19-10-19-18c-10-199-176-358-377-358c-108 0-205 45-274 118l59 57c10 12 10 27-5 31l-248 50c-21 5-46-11-37-44l58-227c2-9 16-22 30-13l64 60c89-91 214-148 353-148c265 0 482 210 493 473c1 18-13 19-13 19l-84 0z" horiz-adv-x="1000" />
|
||||
<glyph glyph-name="search" unicode="" d="m643 386q0 103-74 176t-176 74t-177-74t-73-176t73-177t177-73t176 73t74 177z m286-465q0-29-22-50t-50-21q-30 0-50 21l-191 191q-100-69-223-69q-80 0-153 31t-125 84t-84 125t-31 153t31 152t84 126t125 84t153 31t152-31t126-84t84-126t31-152q0-123-69-223l191-191q21-21 21-51z" horiz-adv-x="928.6" />
|
||||
<glyph glyph-name="cancel" unicode="" d="m724 112q0-22-15-38l-76-76q-16-15-38-15t-38 15l-164 165l-164-165q-16-15-38-15t-38 15l-76 76q-16 16-16 38t16 38l164 164l-164 164q-16 16-16 38t16 38l76 76q16 16 38 16t38-16l164-164l164 164q16 16 38 16t38-16l76-76q15-15 15-38t-15-38l-164-164l164-164q15-15 15-38z" horiz-adv-x="785.7" />
|
||||
<glyph glyph-name="block" unicode="" d="m732 352q0 90-48 164l-421-420q76-50 166-50q62 0 118 25t96 65t65 97t24 119z m-557-167l421 421q-75 50-167 50q-83 0-153-40t-110-112t-41-152q0-91 50-167z m682 167q0-88-34-168t-91-137t-137-92t-166-34t-167 34t-137 92t-91 137t-34 168t34 167t91 137t137 91t167 34t166-34t137-91t91-137t34-167z" horiz-adv-x="857.1" />
|
||||
<glyph glyph-name="down-dir" unicode="" d="m571 457q0-14-10-25l-250-250q-11-11-25-11t-25 11l-250 250q-11 11-11 25t11 25t25 11h500q14 0 25-11t10-25z" horiz-adv-x="571.4" />
|
||||
<glyph glyph-name="up-dir" unicode="" d="m571 171q0-14-10-25t-25-10h-500q-15 0-25 10t-11 25t11 26l250 250q10 10 25 10t25-10l250-250q10-11 10-26z" horiz-adv-x="571.4" />
|
||||
<glyph glyph-name="left-dir" unicode="" d="m357 600v-500q0-14-10-25t-26-11t-25 11l-250 250q-10 11-10 25t10 25l250 250q11 11 25 11t26-11t10-25z" horiz-adv-x="357.1" />
|
||||
<glyph glyph-name="right-dir" unicode="" d="m321 350q0-14-10-25l-250-250q-11-11-25-11t-25 11t-11 25v500q0 15 11 25t25 11t25-11l250-250q10-10 10-25z" horiz-adv-x="357.1" />
|
||||
</font>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Megamenu;
|
||||
|
||||
use ElementsKit_Lite;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Init {
|
||||
|
||||
public $dir;
|
||||
|
||||
public $url;
|
||||
|
||||
public static $menuitem_settings_key = 'elementskit_menuitem_settings';
|
||||
public static $megamenu_settings_key = 'megamenu_settings';
|
||||
|
||||
public function __construct() {
|
||||
|
||||
// get current directory path
|
||||
$this->dir = dirname( __FILE__ ) . '/';
|
||||
|
||||
// get current module's url
|
||||
$this->url = \ElementsKit_Lite::plugin_url() . 'modules/megamenu/';
|
||||
|
||||
// enqueue scripts
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles' ) );
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
||||
|
||||
// include all necessary files
|
||||
$this->include_files();
|
||||
|
||||
new Options();
|
||||
}
|
||||
|
||||
public function include_files() {
|
||||
include $this->dir . 'api.php';
|
||||
include $this->dir . 'walker-nav-menu.php';
|
||||
|
||||
$backward_class_file = ElementsKit_Lite::plugin_dir() . 'compatibility/backward/walker-nav-menu-backward-compatiblity.php';
|
||||
if ( file_exists( $backward_class_file ) ) {
|
||||
include $backward_class_file;
|
||||
}
|
||||
}
|
||||
|
||||
public function enqueue_styles() {
|
||||
$screen = get_current_screen();
|
||||
if ( $screen->base == 'nav-menus' ) {
|
||||
wp_enqueue_style( 'wp-color-picker' );
|
||||
wp_enqueue_style( 'fonticonpicker', $this->url . 'assets/css/jquery.fonticonpicker.css', false, \ElementsKit_Lite::version() );
|
||||
wp_enqueue_style( 'elementskit-menu-admin-style', $this->url . 'assets/css/admin-style.css', false, \ElementsKit_Lite::version() );
|
||||
}
|
||||
}
|
||||
|
||||
public function enqueue_scripts() {
|
||||
$screen = get_current_screen();
|
||||
if ( $screen->base == 'nav-menus' ) {
|
||||
wp_enqueue_script( 'fonticonpicker', $this->url . 'assets/js/jquery.fonticonpicker.min.js', array( 'jquery' ), \ElementsKit_Lite::version(), true );
|
||||
wp_enqueue_script( 'elementskit-menu-admin-script', $this->url . 'assets/js/admin-script.js', array( 'jquery', 'wp-color-picker' ), \ElementsKit_Lite::version(), true );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Megamenu;
|
||||
|
||||
use ElementsKit_Lite\Libs\Framework\Attr;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Options {
|
||||
private $dir;
|
||||
private $url;
|
||||
|
||||
protected $current_menu_id = null;
|
||||
|
||||
public function __construct() {
|
||||
// get current directory path
|
||||
$this->dir = dirname( __FILE__ ) . '/';
|
||||
|
||||
// get current module's url
|
||||
$this->url = \ElementsKit_Lite::plugin_url() . 'modules/megamenu/';
|
||||
|
||||
add_action( 'admin_footer', array( $this, 'options_menu_item' ) );
|
||||
add_action( 'admin_footer', array( $this, 'options_megamenu' ) );
|
||||
add_action( 'admin_head', array( $this, 'save_megamenu_options' ) );
|
||||
}
|
||||
|
||||
public function current_menu_id() {
|
||||
|
||||
if ( null !== $this->current_menu_id ) {
|
||||
return $this->current_menu_id;
|
||||
}
|
||||
|
||||
$nav_menus = wp_get_nav_menus( array( 'orderby' => 'name' ) );
|
||||
$menu_count = count( $nav_menus );
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We are taking menu id from the URL. The method only can access admin. So nonce verification is not required.
|
||||
$nav_menu_selected_id = isset( $_REQUEST['menu'] ) ? (int) $_REQUEST['menu'] : 0;
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We are taking menu id from the URL. The method only can access admin. So nonce verification is not required.
|
||||
$add_new_screen = ( isset( $_GET['menu'] ) && 0 == $_GET['menu'] ) ? true : false;
|
||||
|
||||
$this->current_menu_id = $nav_menu_selected_id;
|
||||
|
||||
// If we have one theme location, and zero menus, we take them right into editing their first menu
|
||||
$page_count = wp_count_posts( 'page' );
|
||||
$one_theme_location_no_menus = ( 1 == count( get_registered_nav_menus() ) && ! $add_new_screen && empty( $nav_menus ) && ! empty( $page_count->publish ) ) ? true : false;
|
||||
|
||||
// Get recently edited nav menu
|
||||
$recently_edited = absint( get_user_option( 'nav_menu_recently_edited' ) );
|
||||
if ( empty( $recently_edited ) && is_nav_menu( $this->current_menu_id ) ) {
|
||||
$recently_edited = $this->current_menu_id;
|
||||
}
|
||||
|
||||
// Use $recently_edited if none are selected
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We are checking the menu id exist or not. The method only can access admin. So nonce verification is not required.
|
||||
if ( empty( $this->current_menu_id ) && ! isset( $_GET['menu'] ) && is_nav_menu( $recently_edited ) ) {
|
||||
$this->current_menu_id = $recently_edited;
|
||||
}
|
||||
|
||||
// On deletion of menu, if another menu exists, show it
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We are checking the post action type. The method only can access admin. So nonce verification is not required.
|
||||
if ( ! $add_new_screen && 0 < $menu_count && isset( $_GET['action'] ) && 'delete' == $_GET['action'] ) {
|
||||
$this->current_menu_id = $nav_menus[0]->term_id;
|
||||
}
|
||||
|
||||
// Set $this->current_menu_id to 0 if no menus
|
||||
if ( $one_theme_location_no_menus ) {
|
||||
$this->current_menu_id = 0;
|
||||
} elseif ( empty( $this->current_menu_id ) && ! empty( $nav_menus ) && ! $add_new_screen ) {
|
||||
// if we have no selection yet, and we have menus, set to the first one in the list
|
||||
$this->current_menu_id = $nav_menus[0]->term_id;
|
||||
}
|
||||
|
||||
return $this->current_menu_id;
|
||||
}
|
||||
|
||||
public static function get_icons() {
|
||||
return include \ElementsKit_Lite::module_dir() . 'elementskit-icon-pack/icon-list.php';
|
||||
}
|
||||
|
||||
function options_menu_item() {
|
||||
$screen = get_current_screen();
|
||||
if ( $screen->base != 'nav-menus' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
include 'views/options-menu-item.php';
|
||||
}
|
||||
|
||||
function options_megamenu() {
|
||||
$screen = get_current_screen();
|
||||
if ( $screen->base != 'nav-menus' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$menu_id = $this->current_menu_id();
|
||||
$data = Attr::instance()->utils->get_option( Init::$megamenu_settings_key, array() );
|
||||
$data = ( isset( $data[ 'menu_location_' . $menu_id ] ) ) ? $data[ 'menu_location_' . $menu_id ] : array();
|
||||
|
||||
include 'views/options-megamenu.php';
|
||||
}
|
||||
|
||||
public function save_megamenu_options() {
|
||||
$screen = get_current_screen();
|
||||
|
||||
if ( $screen->base != 'nav-menus' || ! isset( $_POST['update-nav-menu-nonce'] ) || !wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['update-nav-menu-nonce'] ) ), 'update-nav_menu') ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$menu_id = isset( $_POST['menu'] ) ? wp_unslash(intval($_POST['menu'])) : 0;
|
||||
$is_enabled = isset( $_POST['is_enabled'] ) ? wp_unslash(intval($_POST['is_enabled'])) : 0;
|
||||
|
||||
$data = Attr::instance()->utils->get_option( Init::$megamenu_settings_key, array() );
|
||||
$data[ 'menu_location_' . $menu_id ] = array(
|
||||
'is_enabled' => $is_enabled,
|
||||
);
|
||||
|
||||
Attr::instance()->utils->save_option( Init::$megamenu_settings_key, $data );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<script>
|
||||
var elementskit_options_megamenu_markup = `
|
||||
<fieldset class="menu-settings-group elementskit-options-megamenu" id="elementskit-options-megamenu">
|
||||
<legend class="menu-settings-group-name attr-text-bold"><?php esc_html_e( 'ElementsKit Megamenu', 'elementskit-lite' ); ?></legend>
|
||||
<div class="menu-settings-input checkbox-input">
|
||||
<input name="is_enabled" type="checkbox" <?php checked( ( isset( $data['is_enabled'] ) ? $data['is_enabled'] : '' ), '1' ); ?> id="elementskit-menu-metabox-input-is-enabled" class="elementskit-menu-is-enabled" value="1">
|
||||
<label for="elementskit-menu-metabox-input-is-enabled"><?php esc_html_e( 'Enable this menu for Megamenu content', 'elementskit-lite' ); ?></label><br>
|
||||
<p class="notice notice-warning" style="margin-top: 10px;padding-top: 10px;padding-bottom: 10px;background:#f3f3f3;">After enabling this, you need to use ElementsKit's header-footer module with <b>elementskit nav-menu</b> widget to show the mega menu. <a href="https://help.wpmet.com/docs/mega-menu-module/" target="_blank">See here how to do it.</a></p>
|
||||
</div>
|
||||
</fieldset>
|
||||
`;
|
||||
|
||||
var elementskit_megamenu_nonce = `<?php echo esc_attr( wp_create_nonce( 'wp_rest' ) ); ?>`;
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,191 @@
|
||||
<div class="attr-modal attr-fade" id="attr_menu_control_panel_modal" tabindex="-1" role="dialog">
|
||||
<div class="attr-modal-dialog attr-modal-dialog-centered" role="document">
|
||||
<div class="attr-modal-content ekit_menu_modal_content">
|
||||
<div class="attr-modal-header">
|
||||
<ul class="tb-nav tb-nav-tabs ekit_menu_control_nav" role="tablist">
|
||||
<li role="presentation" id="attr_content_nav" class="attr-active"><a class="attr-nav-link" href="#attr_content_tab" aria-controls="attr_content_tab"
|
||||
role="tab" data-attr-toggle="tab"><?php esc_html_e( 'Content', 'elementskit-lite' ); ?></a></li>
|
||||
<li role="presentation" id="attr_icon_nav"><a class="attr-nav-link ekit-<?php echo esc_attr(ElementsKit_Lite::package_type()); ?>-labal" href="#attr_icon_tab" aria-controls="attr_icon_tab" role="tab"
|
||||
data-attr-toggle="tab"><?php esc_html_e( 'Icon', 'elementskit-lite' ); ?></a></li>
|
||||
<li role="presentation" id="attr_badge_nav"><a class="attr-nav-link ekit-<?php echo esc_attr(ElementsKit_Lite::package_type()); ?>-labal" href="#attr_badge_tab" aria-controls="attr_badge_tab"
|
||||
role="tab" data-attr-toggle="tab"><?php esc_html_e( 'Badge', 'elementskit-lite' ); ?></a></li>
|
||||
<li role="presentation" id="attr_badge_nav"><a class="attr-nav-link" href="#attr_vertical_menu_setting_tab" aria-controls="attr_vertical_menu_setting_tab"
|
||||
role="tab" data-attr-toggle="tab"><?php esc_html_e( 'Settings', 'elementskit-lite' ); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="attr-modal-body ekit-wid-con">
|
||||
<div class="attr-tab-content">
|
||||
<div role="tabpanel" class="attr-tab-pane attr-active" id="attr_content_tab">
|
||||
<?php if ( defined( 'ELEMENTOR_VERSION' ) ) : ?>
|
||||
<div class="switch-wrapper">
|
||||
<input type="checkbox" value="1" id="elementskit-menu-item-enable" />
|
||||
<label for="elementskit-menu-item-enable"><span><em></em></span></label>
|
||||
</div>
|
||||
<div id="elementskit-menu-builder-warper">
|
||||
<small
|
||||
class="elementskit-menu-mega-submenu enabled_item"><?php esc_html_e( 'Megamenu enabled', 'elementskit-lite' ); ?></small>
|
||||
<small
|
||||
class="elementskit-menu-mega-submenu disabled_item"><?php esc_html_e( 'Megamenu disabled', 'elementskit-lite' ); ?></small>
|
||||
|
||||
<button disabled type="button" id="elementskit-menu-builder-trigger"
|
||||
class="elementskit-menu-elementor-button button" data-attr-toggle="modal"
|
||||
data-target="#elementskit-menu-builder-modal">
|
||||
<img src="<?php echo esc_url( $this->url ); ?>/assets/images/elementor-icon.png"
|
||||
alt="<?php esc_attr_e( 'elementskit megamenu', 'elementskit-lite' ); ?>" />
|
||||
<?php esc_html_e( 'Edit megamenu content', 'elementskit-lite' ); ?>
|
||||
</button>
|
||||
|
||||
<div id="mobile_submenu_content_type" class="ekit-<?php echo esc_attr(ElementsKit_Lite::package_type()); ?>-labal ekit-<?php echo esc_attr(ElementsKit_Lite::package_type()); ?>-labal-container">
|
||||
<strong><?php esc_html_e( 'Use mobile submenu as:', 'elementskit-lite' ); ?></strong>
|
||||
<span><input type="radio" name="content_type" checked value="builder_content"> <?php esc_html_e( 'builder content', 'elementskit-lite' ); ?></span>
|
||||
<span><input type="radio" name="content_type" value="submenu_list"> <?php esc_html_e( 'wp submenu list', 'elementskit-lite' ); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<p class="no-elementor-notice">
|
||||
<?php esc_html_e( 'This plugin requires Elementor page builder to edt megamenu items content', 'elementskit-lite' ); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div role="tabpanel" class="attr-tab-pane" id="attr_icon_tab">
|
||||
<table class="option-table ekit-<?php echo esc_attr(ElementsKit_Lite::package_type()); ?>-labal-container">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><strong><?php esc_html_e( 'Choose icon color', 'elementskit-lite' ); ?></strong></td>
|
||||
<td class="alignright">
|
||||
<input type="text" value="#bada55" class="elementskit-menu-wpcolor-picker"
|
||||
id="elementskit-menu-icon-color-field" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><?php esc_html_e( 'Select icon', 'elementskit-lite' ); ?></strong></td>
|
||||
<td class="alignright">
|
||||
<select id="elementskit-menu-icon-field" class="elementskit-menu-icon-picker">
|
||||
<option value=""><?php esc_html_e( 'No icon', 'elementskit-lite' ); ?></option>
|
||||
<?php
|
||||
foreach ( self::get_icons() as $icon_class ) {
|
||||
echo "<option value='" . esc_attr( $icon_class ) . "'>'" . esc_html( $icon_class ) . "'</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div role="tabpanel" class="attr-tab-pane" id="attr_badge_tab">
|
||||
<table class="option-table ekit-<?php echo esc_attr(ElementsKit_Lite::package_type()); ?>-labal ekit-<?php echo esc_attr(ElementsKit_Lite::package_type()); ?>-labal-container">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><strong><?php esc_html_e( 'Badge text', 'elementskit-lite' ); ?></strong></td>
|
||||
<td class="alignright">
|
||||
<input type="text"
|
||||
placeholder="<?php esc_html_e( 'Badge Text', 'elementskit-lite' ); ?>"
|
||||
id="elementskit-menu-badge-text-field" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><strong><?php esc_html_e( 'Choose badge color', 'elementskit-lite' ); ?></strong></td>
|
||||
<td class="alignright">
|
||||
<input type="text" class="elementskit-menu-wpcolor-picker" value="#ffffff"
|
||||
id="elementskit-menu-badge-color-field" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><strong><?php esc_html_e( 'Choose badge background', 'elementskit-lite' ); ?></strong>
|
||||
</td>
|
||||
<td class="alignright">
|
||||
<input type="text" class="elementskit-menu-wpcolor-picker" value="#bada55"
|
||||
id="elementskit-menu-badge-background-field" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div role="tabpanel" class="attr-tab-pane" id="attr_vertical_menu_setting_tab">
|
||||
<table class="option-table">
|
||||
<tbody class="xs_menu_settings_panel">
|
||||
<tr id="xs_megamenu_width_type">
|
||||
<td><strong><?php esc_html_e( 'Mega Menu Width as:', 'elementskit-lite' ); ?></strong></td>
|
||||
<td class="alignright ekit_width_lists">
|
||||
<input type="radio" name="width_type" id="width_type_default" value="default_width" checked>
|
||||
<label for="width_type_default"><?php esc_html_e( 'Default Width', 'elementskit-lite' ); ?></label>
|
||||
<input type="radio" id="width_type_full" name="width_type" value="full_width">
|
||||
<label for="width_type_full"><?php esc_html_e( 'Full Width', 'elementskit-lite' ); ?></label>
|
||||
<input type="radio" id="width_type_custom" name="width_type" value="custom_width">
|
||||
<label for="width_type_custom"><?php esc_html_e( 'Custom Width', 'elementskit-lite' ); ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="menu-width-container">
|
||||
<td><strong><?php esc_html_e( 'Menu Width', 'elementskit-lite' ); ?></strong></td>
|
||||
<td class="alignright">
|
||||
<input type="text" placeholder="<?php esc_html_e( '750px', 'elementskit-lite' ); ?>" id="elementskit-menu-vertical-menu-width-field" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="vertical_megamenu_position_type">
|
||||
<td><strong><?php esc_html_e( 'Mega Menu Position as:', 'elementskit-lite' ); ?></strong></td>
|
||||
<td class="alignright">
|
||||
<input type="radio" id="position_type_top" name="position_type" value="top_position">
|
||||
<label for="position_type_top"><?php esc_html_e( 'Default', 'elementskit-lite' ); ?></label>
|
||||
<input type="radio" name="position_type" id="position_type_relative" checked value="relative_position">
|
||||
<label for="position_type_relative"><?php esc_html_e( 'Relative', 'elementskit-lite' ); ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="enable_ajax_load">
|
||||
<td><strong><?php esc_html_e( 'Enable Ajax Load:', 'elementskit-lite' ); ?></strong></td>
|
||||
<td class="alignright">
|
||||
<input type="radio" id="ajax_load_yes" name="megamenu_ajax_load" value="yes">
|
||||
<label for="ajax_load_yes"><?php esc_html_e( 'Yes', 'elementskit-lite' ); ?></label>
|
||||
<input type="radio" id="ajax_load_no" name="megamenu_ajax_load" checked value="no">
|
||||
<label for="ajax_load_no"><?php esc_html_e( 'No', 'elementskit-lite' ); ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="attr-modal-footer">
|
||||
<input type="hidden" id="elementskit-menu-modal-menu-id">
|
||||
<input type="hidden" id="elementskit-menu-modal-menu-has-child">
|
||||
<div class="clearfix ekit-modal-controls">
|
||||
<div class="left-content">
|
||||
<button class="btn-modal-close" type="button" data-dismiss="modal">
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" xmlns="https://www.w3.org/2000/svg">
|
||||
<line fill="none" stroke="#000" stroke-width="1.1" x1="1" y1="1" x2="13" y2="13"></line>
|
||||
<line fill="none" stroke="#000" stroke-width="1.1" x1="13" y1="1" x2="1" y2="13"></line>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
<div class="right-content">
|
||||
<a class="button button-default alignleft" href="https://help.wpmet.com/docs/mega-menu-module/" target="_blank" >Megamenu Turorial</a>
|
||||
|
||||
<span class='spinner'></span>
|
||||
<?php echo wp_kses( get_submit_button( esc_html__( 'Save', 'elementskit-lite' ), 'elementskit-menu-item-save button-primary alignright', '', false ), ['input'=>['class'=>[], 'type'=>[], 'value'=>[]]] ); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span id="elementskit-menu-modal-spinner" class='spinner'></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="attr-modal attr-fade" id="elementskit-menu-builder-modal" tabindex="-1" role="dialog"
|
||||
aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||
<div class="attr-modal-dialog attr-modal-dialog-centered" role="document">
|
||||
<div class="attr-modal-content">
|
||||
<div class="attr-modal-body">
|
||||
<button class="ekit_close" type="button" data-dismiss="modal"><svg width="20" height="20"
|
||||
viewBox="0 0 20 20" xmlns="https://www.w3.org/2000/svg">
|
||||
<line fill="none" stroke="#fff" stroke-width="1.4" x1="1" y1="1" x2="19" y2="19"></line>
|
||||
<line fill="none" stroke="#fff" stroke-width="1.4" x1="19" y1="1" x2="1" y2="19"></line>
|
||||
</svg></button>
|
||||
<iframe id="elementskit-menu-builder-iframe" src="" frameborder="0"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,329 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite;
|
||||
|
||||
use \ElementsKit_Lite\Modules\Megamenu\Init;
|
||||
use \ElementsKit_Lite\Libs\Framework\Attr;
|
||||
|
||||
class ElementsKit_Menu_Walker extends \Walker_Nav_Menu {
|
||||
|
||||
public $menu_Settings;
|
||||
|
||||
// custom methods
|
||||
public function get_item_meta( $menu_item_id ) {
|
||||
$meta_key = Init::$menuitem_settings_key;
|
||||
$data = get_post_meta( $menu_item_id, $meta_key, true );
|
||||
$data = (array) json_decode( $data );
|
||||
|
||||
$default = array(
|
||||
'menu_id' => null,
|
||||
'menu_has_child' => '',
|
||||
'menu_enable' => 0,
|
||||
'menu_icon' => '',
|
||||
'menu_icon_color' => '',
|
||||
'menu_badge_text' => '',
|
||||
'menu_badge_color' => '',
|
||||
'menu_badge_background' => '',
|
||||
'mobile_submenu_content_type' => 'builder_content',
|
||||
'vertical_megamenu_position_type' => 'relative_position',
|
||||
'vertical_menu_width' => '',
|
||||
'megamenu_width_type' => 'default_width',
|
||||
'megamenu_ajax_load' => 'no',
|
||||
);
|
||||
return array_merge( $default, $data );
|
||||
}
|
||||
|
||||
public function is_megamenu( $menu_slug ) {
|
||||
$menu_obj = wp_get_nav_menu_object($menu_slug);
|
||||
$menu_slug = ( ( ( gettype( $menu_obj ) == 'object' ) && ( isset( $menu_obj->slug ) ) ) ? $menu_obj->slug : $menu_slug );
|
||||
|
||||
$cache_key = 'elementskit_megamenu_data_' . $menu_slug;
|
||||
$cached = wp_cache_get( $cache_key );
|
||||
if ( false !== $cached ) {
|
||||
return $cached;
|
||||
}
|
||||
|
||||
$return = 0;
|
||||
|
||||
$modules_all = \ElementsKit_Lite\Config\Module_List::instance()->get_list();
|
||||
$modules_active = \ElementsKit_Lite\Libs\Framework\Classes\Utils::instance()->get_option( 'module_list', $modules_all );
|
||||
$modules_active = ( ! isset( $modules_active[0] ) ? array_keys( $modules_active ) : $modules_active );
|
||||
|
||||
$settings = Attr::instance()->utils->get_option( Init::$megamenu_settings_key, array() );
|
||||
$term = get_term_by( 'slug', $menu_slug, 'nav_menu' );
|
||||
|
||||
if ( in_array( 'megamenu', $modules_active )
|
||||
&& isset( $term->term_id )
|
||||
&& isset( $settings[ 'menu_location_' . $term->term_id ] )
|
||||
&& $settings[ 'menu_location_' . $term->term_id ]['is_enabled'] == '1' ) {
|
||||
|
||||
$return = 1;
|
||||
}
|
||||
|
||||
wp_cache_set( $cache_key, $return );
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function is_megamenu_item( $item_meta, $menu ) {
|
||||
if ( $this->is_megamenu( $menu ) == 1 && $item_meta['menu_enable'] == 1 && class_exists( 'Elementor\Plugin' ) ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the list before the elements are added.
|
||||
*
|
||||
* @see Walker::start_lvl()
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param string $output Passed by reference. Used to append additional content.
|
||||
* @param int $depth Depth of menu item. Used for padding.
|
||||
* @param array $args An array of arguments. @see wp_nav_menu()
|
||||
*/
|
||||
public function start_lvl( &$output, $depth = 0, $args = array() ) {
|
||||
$indent = str_repeat( "\t", $depth );
|
||||
$output .= "\n$indent<ul class=\"elementskit-dropdown elementskit-submenu-panel\">\n";
|
||||
}
|
||||
/**
|
||||
* Ends the list of after the elements are added.
|
||||
*
|
||||
* @see Walker::end_lvl()
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param string $output Passed by reference. Used to append additional content.
|
||||
* @param int $depth Depth of menu item. Used for padding.
|
||||
* @param array $args An array of arguments. @see wp_nav_menu()
|
||||
*/
|
||||
public function end_lvl( &$output, $depth = 0, $args = array() ) {
|
||||
$indent = str_repeat( "\t", $depth );
|
||||
$output .= "$indent</ul>\n";
|
||||
}
|
||||
/**
|
||||
* Start the element output.
|
||||
*
|
||||
* @see Walker::start_el()
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param string $output Passed by reference. Used to append additional content.
|
||||
* @param object $item Menu item data object.
|
||||
* @param int $depth Depth of menu item. Used for padding.
|
||||
* @param array $args An array of arguments. @see wp_nav_menu()
|
||||
* @param int $id Current item ID.
|
||||
*/
|
||||
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
|
||||
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
|
||||
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
|
||||
$classes[] = 'menu-item-' . $item->ID;
|
||||
|
||||
/**
|
||||
* Filter the CSS class(es) applied to a menu item's list item element.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @since 4.1.0 The `$depth` parameter was added.
|
||||
*
|
||||
* @param array $classes The CSS classes that are applied to the menu item's `<li>` element.
|
||||
* @param object $item The current menu item.
|
||||
* @param array $args An array of {@see wp_nav_menu()} arguments.
|
||||
* @param int $depth Depth of menu item. Used for padding.
|
||||
*/
|
||||
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) );
|
||||
// New
|
||||
$class_names .= ' nav-item';
|
||||
$item_meta = $this->get_item_meta( $item->ID );
|
||||
$is_megamenu_item = $this->is_megamenu_item( $item_meta, $args->menu );
|
||||
|
||||
if ( in_array( 'menu-item-has-children', $classes ) || $is_megamenu_item == true ) {
|
||||
$class_names .= ' elementskit-dropdown-has ' . $item_meta['vertical_megamenu_position_type'] . ' elementskit-dropdown-menu-' . $item_meta['megamenu_width_type'] . '';
|
||||
}
|
||||
|
||||
if ( $is_megamenu_item == true ) {
|
||||
$class_names .= ' elementskit-megamenu-has';
|
||||
}
|
||||
|
||||
if ( $item_meta['mobile_submenu_content_type'] == 'builder_content' ) {
|
||||
$class_names .= ' elementskit-mobile-builder-content';
|
||||
}
|
||||
|
||||
if ( in_array( 'current-menu-item', $classes ) ) {
|
||||
$class_names .= ' active';
|
||||
}
|
||||
|
||||
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
|
||||
|
||||
/**
|
||||
* Filter the ID applied to a menu item's list item element.
|
||||
*
|
||||
* @since 3.0.1
|
||||
* @since 4.1.0 The `$depth` parameter was added.
|
||||
*
|
||||
* @param string $menu_id The ID that is applied to the menu item's `<li>` element.
|
||||
* @param object $item The current menu item.
|
||||
* @param array $args An array of {@see wp_nav_menu()} arguments.
|
||||
* @param int $depth Depth of menu item. Used for padding.
|
||||
*/
|
||||
$id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args, $depth );
|
||||
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
|
||||
// New
|
||||
$data_attr = '';
|
||||
switch ( $item_meta['megamenu_width_type'] ) {
|
||||
case 'default_width':
|
||||
$data_attr = esc_attr( ' data-vertical-menu=750px' );
|
||||
break;
|
||||
|
||||
case 'full_width':
|
||||
$data_attr = ' data-vertical-menu=""';
|
||||
break;
|
||||
|
||||
case 'custom_width':
|
||||
$data_attr = $item_meta['vertical_menu_width'] === '' ? esc_attr( ' data-vertical-menu=750px' ) : esc_attr( ' data-vertical-menu=' . $item_meta['vertical_menu_width'] . '' );
|
||||
break;
|
||||
|
||||
default:
|
||||
$data_attr = esc_attr( ' data-vertical-menu=750px' );
|
||||
break;
|
||||
}
|
||||
//
|
||||
$output .= $indent . '<li' . $id . $class_names . $data_attr . '>';
|
||||
$atts = array();
|
||||
$atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : '';
|
||||
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
|
||||
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
|
||||
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
|
||||
|
||||
$submenu_indicator = '';
|
||||
|
||||
// New
|
||||
if ( $depth === 0 ) {
|
||||
$atts['class'] = 'ekit-menu-nav-link';
|
||||
}
|
||||
if ( $depth === 0 && in_array( 'menu-item-has-children', $classes ) ) {
|
||||
$atts['class'] .= ' ekit-menu-dropdown-toggle';
|
||||
}
|
||||
if ( in_array( 'menu-item-has-children', $classes ) || $is_megamenu_item == true ) {
|
||||
// Use an if statement to conditionally display the submenu indicator icon
|
||||
if(!empty($args->submenu_indicator_icon)) {
|
||||
$submenu_indicator .= $args->submenu_indicator_icon;
|
||||
} else {
|
||||
$submenu_indicator .= '<i class="icon icon-down-arrow1 elementskit-submenu-indicator"></i>';
|
||||
}
|
||||
}
|
||||
if ( $depth > 0 ) {
|
||||
$manual_class = array_values( $classes )[0] . ' ' . 'dropdown-item';
|
||||
$atts ['class'] = $manual_class;
|
||||
}
|
||||
if ( in_array( 'current-menu-item', $item->classes ) ) {
|
||||
$atts['class'] .= ' active';
|
||||
}
|
||||
|
||||
//
|
||||
/**
|
||||
* Filter the HTML attributes applied to a menu item's anchor element.
|
||||
*
|
||||
* @since 3.6.0
|
||||
* @since 4.1.0 The `$depth` parameter was added.
|
||||
*
|
||||
* @param array $atts {
|
||||
* The HTML attributes applied to the menu item's `<a>` element, empty strings are ignored.
|
||||
*
|
||||
* @type string $title Title attribute.
|
||||
* @type string $target Target attribute.
|
||||
* @type string $rel The rel attribute.
|
||||
* @type string $href The href attribute.
|
||||
* }
|
||||
* @param object $item The current menu item.
|
||||
* @param array $args An array of {@see wp_nav_menu()} arguments.
|
||||
* @param int $depth Depth of menu item. Used for padding.
|
||||
*/
|
||||
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth );
|
||||
$attributes = '';
|
||||
foreach ( $atts as $attr => $value ) {
|
||||
if ( ! empty( $value ) ) {
|
||||
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
|
||||
$attributes .= ' ' . $attr . '="' . $value . '"';
|
||||
}
|
||||
}
|
||||
$item_output = $args->before;
|
||||
// New
|
||||
|
||||
//
|
||||
$item_output .= '<a' . $attributes . '>';
|
||||
|
||||
if ( $this->is_megamenu( $args->menu ) == 1 ) {
|
||||
// add badge text
|
||||
if ( $item_meta['menu_badge_text'] != '' ) {
|
||||
$badge_style = 'background:' . $item_meta['menu_badge_background'] . '; color:' . $item_meta['menu_badge_color'];
|
||||
$badge_carret_style = 'border-top-color:' . $item_meta['menu_badge_background'];
|
||||
$item_output .= '<span style="' . $badge_style . '" class="ekit-menu-badge">' . $item_meta['menu_badge_text'] . '<i style="' . $badge_carret_style . '" class="ekit-menu-badge-arrow"></i></span>';
|
||||
}
|
||||
|
||||
// add menu icon & style
|
||||
if ( $item_meta['menu_icon'] != '' ) {
|
||||
$icon_style = 'color:' . $item_meta['menu_icon_color'];
|
||||
$item_output .= '<i class="ekit-menu-icon ' . $item_meta['menu_icon'] . '" style="' . $icon_style . '" ></i>';
|
||||
}
|
||||
}
|
||||
|
||||
/** This filter is documented in wp-includes/post-template.php */
|
||||
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
|
||||
$item_output .= $submenu_indicator . '</a>';
|
||||
$item_output .= $args->after;
|
||||
/**
|
||||
* Filter a menu item's starting output.
|
||||
*
|
||||
* The menu item's starting output only includes `$args->before`, the opening `<a>`,
|
||||
* the menu item's title, the closing `</a>`, and `$args->after`. Currently, there is
|
||||
* no filter for modifying the opening and closing `<li>` for a menu item.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param string $item_output The menu item's starting HTML output.
|
||||
* @param object $item Menu item data object.
|
||||
* @param int $depth Depth of menu item. Used for padding.
|
||||
* @param array $args An array of {@see wp_nav_menu()} arguments.
|
||||
*/
|
||||
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
|
||||
}
|
||||
/**
|
||||
* Ends the element output, if needed.
|
||||
*
|
||||
* @see Walker::end_el()
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param string $output Passed by reference. Used to append additional content.
|
||||
* @param object $item Page data object. Not used.
|
||||
* @param int $depth Depth of page. Not Used.
|
||||
* @param array $args An array of arguments. @see wp_nav_menu()
|
||||
*/
|
||||
public function end_el( &$output, $item, $depth = 0, $args = array() ) {
|
||||
if ( $depth === 0 ) {
|
||||
if ( $this->is_megamenu( $args->menu ) == 1 ) {
|
||||
$item_meta = $this->get_item_meta( $item->ID );
|
||||
if ( $item_meta['menu_enable'] == 1 && class_exists( 'Elementor\Plugin' ) ) {
|
||||
$builder_post_title = 'dynamic-content-megamenu-menuitem' . $item->ID;
|
||||
$builder_post = Utils::get_page_by_title( $builder_post_title, 'elementskit_content' );
|
||||
$output .= '<div class="elementskit-megamenu-panel">';
|
||||
if ( $builder_post != null ) {
|
||||
$elementor = \Elementor\Plugin::instance();
|
||||
$mega_menu_output = $elementor->frontend->get_builder_content_for_display( $builder_post->ID );
|
||||
|
||||
// if ajax load is enable and not elementor editor mode
|
||||
if(!empty($item_meta['megamenu_ajax_load']) && $item_meta['megamenu_ajax_load'] == 'yes') {
|
||||
$mega_menu_output = sprintf('<div class="megamenu-ajax-load" data-id="%1$s"></div>', $builder_post->ID);
|
||||
}
|
||||
|
||||
$output .= $mega_menu_output;
|
||||
} else {
|
||||
$output .= esc_html__( 'No content found', 'elementskit-lite' );
|
||||
}
|
||||
|
||||
$output .= '</div>';
|
||||
}
|
||||
}
|
||||
$output .= "</li>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* OnePageScroll 1.0.0
|
||||
*
|
||||
* @license GPLv2+
|
||||
*
|
||||
* Copyright (C) 2020 by WpMet
|
||||
*/.ops-enabled body,html.ops-enabled{margin:0;padding:0;overflow:hidden;-webkit-tap-highlight-color:transparent}.ops-section{position:relative;box-sizing:border-box}.ops-slide{float:left}.ops-slide,.ops-slidesContainer{height:100%;display:block}.ops-slides{z-index:1;height:100%;overflow:hidden;position:relative;transition:all .3s ease-out}.ops-section.ops-table,.ops-slide.ops-table{display:table;table-layout:fixed;width:100%}.ops-tableCell{display:table-cell;vertical-align:middle;width:100%;height:100%}.ops-slidesContainer{float:left;position:relative}.ops-controlArrow{-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;-ms-user-select:none;position:absolute;z-index:4;top:50%;cursor:pointer;width:0;height:0;border-style:solid;margin-top:-38px;transform:translate3d(0,0,0)}.ops-controlArrow.ops-prev{left:15px;width:0;border-width:38.5px 34px 38.5px 0;border-color:transparent #fff transparent transparent}.ops-controlArrow.ops-next{right:15px;border-width:38.5px 0 38.5px 34px;border-color:transparent transparent transparent #fff}.ops-scrollable{overflow:hidden;position:relative}.ops-scroller{overflow:hidden}.iScrollIndicator{border:0!important}.ops-notransition{transition:none!important}#ops-nav{position:fixed;z-index:100;margin-top:-32px;top:50%;opacity:1;transform:translate3d(0,0,0)}#ops-nav.ops-right{right:17px}#ops-nav.ops-left{left:17px}.ops-slidesNav{position:absolute;z-index:4;opacity:1;transform:translate3d(0,0,0);left:0!important;right:0;margin:0 auto!important}.ops-slidesNav.ops-bottom{bottom:17px}.ops-slidesNav.ops-top{top:17px}#ops-nav ul,.ops-slidesNav ul{margin:0;padding:0}#ops-nav ul li,.ops-slidesNav ul li{display:block;width:14px;height:13px;margin:7px;position:relative}.ops-slidesNav ul li{display:inline-block}#ops-nav ul li a,.ops-slidesNav ul li a{display:block;position:relative;z-index:1;width:100%;height:100%;cursor:pointer;text-decoration:none}#ops-nav ul li a.active span,#ops-nav ul li:hover a.active span,.ops-slidesNav ul li a.active span,.ops-slidesNav ul li:hover a.active span{height:12px;width:12px;margin:-6px 0 0 -6px;border-radius:100%}#ops-nav ul li a span,.ops-slidesNav ul li a span{border-radius:50%;position:absolute;z-index:1;height:4px;width:4px;border:0;background:#333;left:50%;top:50%;margin:-2px 0 0 -2px;transition:all .1s ease-in-out}#ops-nav ul li:hover a span,.ops-slidesNav ul li:hover a span{width:10px;height:10px;margin:-5px 0 0 -5px}#ops-nav ul li .ops-tooltip{position:absolute;top:-2px;color:#fff;font-size:14px;font-family:arial,helvetica,sans-serif;white-space:nowrap;max-width:220px;overflow:hidden;display:block;opacity:0;width:0;cursor:pointer}#ops-nav ul li:hover .ops-tooltip,#ops-nav.ops-show-active a.active+.ops-tooltip{transition:opacity .2s ease-in;width:auto;opacity:1}#ops-nav ul li .ops-tooltip.ops-right{right:20px}#ops-nav ul li .ops-tooltip.ops-left{left:20px}.ops-auto-height .ops-slide,.ops-auto-height .ops-tableCell,.ops-auto-height.ops-section,.ops-normal-scroll.ops-section{height:auto!important}.ops-responsive .ops-auto-height-responsive .ops-slide,.ops-responsive .ops-auto-height-responsive .ops-tableCell,.ops-responsive .ops-auto-height-responsive.ops-section{height:auto!important}.elementor-element-edit-mode.ops-section{min-height:100vh}.ops-section:not(.ops-normal-scroll){display:flex;align-items:center}.ops-section:not(.ops-normal-scroll)>.elementor-container{width:100%}.elementor .elementor-section.ops-section:not(.ops-normal-scroll){overflow:hidden}.ops-sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media (min-width:1025px) and (max-width:99999px){.ops-wrapper .elementor-hidden-desktop{display:none}}@media (min-width:768px) and (max-width:1024px){.ops-wrapper .elementor-hidden-tablet{display:none}}@media (max-width:767px){.ops-wrapper .elementor-hidden-mobile{display:none}}
|
||||
@@ -0,0 +1 @@
|
||||
!function(e){"use strict";var n,t={init:function(){n=elementor.$previewContents.find("#onepage_scroll_nav_wrap"),elementor.settings.page.addChangeCallback("ekit_onepagescroll",t.updateMarkup),elementor.settings.page.addChangeCallback("ekit_onepagescroll_nav",t.updateMarkup),elementor.settings.page.addChangeCallback("ekit_onepagescroll_nav_pos",t.updateMarkup),elementor.settings.page.addChangeCallback("ekit_onepagescroll_nav_icon",t.updateMarkup),t.updateMarkup()},updateMarkup:function(){e.post(window.ajaxurl,{action:"generate_navigation_markup",navStyle:elementorFrontend.getPageSettings("ekit_onepagescroll_nav"),navPos:elementorFrontend.getPageSettings("ekit_onepagescroll_nav_pos"),navIcon:elementorFrontend.getPageSettings("ekit_onepagescroll_nav_icon")},(function(t){if(t.length>7){var a=n.html(t).find("li"),o=a.parent();e.each(elementor.elements.models,(function(e){this.attributes.settings.attributes.ekit_has_onepagescroll_dot&&0!==e&&a.clone().appendTo(o)}))}}))}};e(window).on("init",t.init)}(jQuery);
|
||||
@@ -0,0 +1,263 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor;
|
||||
|
||||
use \ElementsKit_Lite\Modules\Onepage_Scroll\Init;
|
||||
|
||||
class ElementsKit_Pro_Extend_Onepage_Scroll {
|
||||
public function __construct() {
|
||||
/**
|
||||
* Pro Page Controls
|
||||
*/
|
||||
add_action( 'elementor/element/wp-page/ekit_page_settings/before_section_end', array( $this, 'pro_page_controls' ) );
|
||||
|
||||
/**
|
||||
* Pro Section Controls
|
||||
*/
|
||||
add_action( 'elementor/element/section/ekit_onepagescroll_section/before_section_end', array( $this, 'pro_section_controls' ) );
|
||||
|
||||
/**
|
||||
* Flexbox Container Support
|
||||
*/
|
||||
add_action( 'elementor/element/container/ekit_onepagescroll_section/before_section_end', array( $this, 'pro_section_controls' ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pro Page Controls
|
||||
*/
|
||||
public function pro_page_controls( Controls_Stack $element ) {
|
||||
$element->add_control(
|
||||
'ekit_onepagescroll_heading',
|
||||
array(
|
||||
'label' => __( 'Onepage Scroll Settings', 'elementskit-lite' ),
|
||||
'type' => \Elementor\Controls_Manager::HEADING,
|
||||
'separator' => 'before',
|
||||
'condition' => array(
|
||||
'ekit_onepagescroll' => 'block',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'ekit_onepagescroll_nav',
|
||||
array(
|
||||
'label' => esc_html__( 'Navigation Style', 'elementskit-lite' ),
|
||||
'type' => Controls_Manager::SELECT,
|
||||
'default' => '0',
|
||||
'groups' => array(
|
||||
'0' => esc_html__( 'None', 'elementskit-lite' ),
|
||||
array(
|
||||
'label' => esc_html__( 'Circle', 'elementskit-lite' ),
|
||||
'options' => array(
|
||||
'circle-scale-up' => esc_html__( 'Scale Up', 'elementskit-lite' ),
|
||||
'circle-fill-in' => esc_html__( 'Fill In', 'elementskit-lite' ),
|
||||
'circle-fill-out' => esc_html__( 'Fill Out', 'elementskit-lite' ),
|
||||
'circle-stroke' => esc_html__( 'Stroke', 'elementskit-lite' ),
|
||||
'circle-stroke-dot' => esc_html__( 'Stroke Dot', 'elementskit-lite' ),
|
||||
'circle-stroke-simple' => esc_html__( 'Stroke Simple', 'elementskit-lite' ),
|
||||
'circle-dot-move' => esc_html__( 'Dot Move', 'elementskit-lite' ),
|
||||
'circle-timeline' => esc_html__( 'Timeline', 'elementskit-lite' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Square', 'elementskit-lite' ),
|
||||
'options' => array(
|
||||
'square-scale-up' => esc_html__( 'Scale Up', 'elementskit-lite' ),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'label' => esc_html__( 'Line', 'elementskit-lite' ),
|
||||
'options' => array(
|
||||
'line-grow' => esc_html__( 'Line Grow', 'elementskit-lite' ),
|
||||
'line-shrink' => esc_html__( 'Line Shrink', 'elementskit-lite' ),
|
||||
'line-fill' => esc_html__( 'Line Fill', 'elementskit-lite' ),
|
||||
'line-move' => esc_html__( 'Line Move', 'elementskit-lite' ),
|
||||
),
|
||||
),
|
||||
'icon' => esc_html__( 'Custom Icon', 'elementskit-lite' ),
|
||||
),
|
||||
'frontend_available' => true,
|
||||
'condition' => array(
|
||||
'ekit_onepagescroll' => 'block',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'ekit_onepagescroll_nav_icon',
|
||||
array(
|
||||
'label' => esc_html__( 'Navigation Icon', 'elementskit-lite' ),
|
||||
'type' => Controls_Manager::ICONS,
|
||||
'default' => array(
|
||||
'value' => 'fas fa-circle',
|
||||
'library' => 'solid',
|
||||
),
|
||||
'frontend_available' => true,
|
||||
'condition' => array(
|
||||
'ekit_onepagescroll' => 'block',
|
||||
'ekit_onepagescroll_nav' => 'icon',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'ekit_onepagescroll_nav_pos',
|
||||
array(
|
||||
'label' => esc_html__( 'Navigation Position', 'elementskit-lite' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'default' => 'right',
|
||||
'options' => array(
|
||||
'top' => array(
|
||||
'title' => esc_html__( 'Top', 'elementskit-lite' ),
|
||||
'icon' => 'fa fa-angle-up',
|
||||
),
|
||||
'bottom' => array(
|
||||
'title' => esc_html__( 'Bottom', 'elementskit-lite' ),
|
||||
'icon' => 'fa fa-angle-down',
|
||||
),
|
||||
'left' => array(
|
||||
'title' => esc_html__( 'Left', 'elementskit-lite' ),
|
||||
'icon' => 'fa fa-angle-left',
|
||||
),
|
||||
'right' => array(
|
||||
'title' => esc_html__( 'Right', 'elementskit-lite' ),
|
||||
'icon' => 'fa fa-angle-right',
|
||||
),
|
||||
),
|
||||
'toggle' => false,
|
||||
'frontend_available' => true,
|
||||
'condition' => array(
|
||||
'ekit_onepagescroll' => 'block',
|
||||
'ekit_onepagescroll_nav!' => '0',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'ekit_onepagescroll_nav_pos_offset',
|
||||
array(
|
||||
'label' => esc_html__( 'Navigation Position Offset', 'elementskit-lite' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => array( 'px', '%' ),
|
||||
'range' => array(
|
||||
'px' => array(
|
||||
'min' => 0,
|
||||
'max' => 1000,
|
||||
'step' => 10,
|
||||
),
|
||||
'%' => array(
|
||||
'min' => 0,
|
||||
'max' => 100,
|
||||
),
|
||||
),
|
||||
'default' => array(
|
||||
'unit' => '%',
|
||||
'size' => '50',
|
||||
),
|
||||
'condition' => array(
|
||||
'ekit_onepagescroll' => 'block',
|
||||
'ekit_onepagescroll_nav!' => '0',
|
||||
),
|
||||
'selectors' => array(
|
||||
'.onepage_scroll_nav.met-top, .onepage_scroll_nav.met-bottom' => 'left: {{SIZE}}{{UNIT}};',
|
||||
'.onepage_scroll_nav.met-left, .onepage_scroll_nav.met-right' => 'top: {{SIZE}}{{UNIT}};',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'ekit_onepagescroll_nav_spacing',
|
||||
array(
|
||||
'label' => esc_html__( 'Navigation Spacing', 'elementskit-lite' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => array( 'px', '%' ),
|
||||
'default' => array(
|
||||
'unit' => 'px',
|
||||
'size' => '20',
|
||||
),
|
||||
'condition' => array(
|
||||
'ekit_onepagescroll' => 'block',
|
||||
'ekit_onepagescroll_nav!' => '0',
|
||||
),
|
||||
'selectors' => array(
|
||||
'.onepage_scroll_nav:not(.met-top):not(.met-bottom) li:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};',
|
||||
'.onepage_scroll_nav:not(.met-left):not(.met-right) li:not(:last-child)' => 'margin-right: {{SIZE}}{{UNIT}};',
|
||||
|
||||
'.onepage_scroll_nav.nav-style-circle-timeline:not(.met-top):not(.met-bottom) li:before' => 'height: calc({{SIZE}}{{UNIT}} - 1px)',
|
||||
'.onepage_scroll_nav.nav-style-circle-timeline:not(.met-left):not(.met-right) li:before' => 'width: calc({{SIZE}}{{UNIT}} - 1px)',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'ekit_onepagescroll_nav_color',
|
||||
array(
|
||||
'label' => esc_html__( 'Navigation Color', 'elementskit-lite' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#111',
|
||||
'condition' => array(
|
||||
'ekit_onepagescroll' => 'block',
|
||||
'ekit_onepagescroll_nav!' => '0',
|
||||
),
|
||||
'selectors' => array(
|
||||
/**
|
||||
* .editor:met_color
|
||||
*/
|
||||
'.onepage_scroll_nav .editor\:met_color' => 'color: {{VALUE}};',
|
||||
|
||||
/**
|
||||
* .editor:met_bgc
|
||||
* .editor:before:met_bgc
|
||||
*/
|
||||
'.onepage_scroll_nav .editor\:met_bgc, .onepage_scroll_nav .editor\:before\:met_bgc:before' => 'background-color: {{VALUE}};',
|
||||
|
||||
/**
|
||||
* .editor:met_bdc
|
||||
* .editor:active:met_bdc
|
||||
*/
|
||||
'.onepage_scroll_nav .editor\:met_bdc, .onepage_scroll_nav .active > .editor\:active\:met_bdc' => 'border-color: {{VALUE}};',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$element->add_group_control(
|
||||
\Elementor\Group_Control_Typography::get_type(),
|
||||
array(
|
||||
'name' => 'ekit_onepagescroll_nav_tooltip_font',
|
||||
'label' => esc_html__( 'Tooltip Typography', 'elementskit-lite' ),
|
||||
'selector' => '.onepage_scroll_nav .nav_tooltip',
|
||||
'condition' => array(
|
||||
'ekit_onepagescroll' => 'block',
|
||||
'ekit_onepagescroll_nav!' => '0',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pro Section Controls
|
||||
*/
|
||||
public function pro_section_controls( $element ) {
|
||||
$element->add_control(
|
||||
'ekit_has_onepagescroll_dot',
|
||||
array(
|
||||
'label' => esc_html__( 'Enable Dot', 'elementskit-lite' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'frontend_available' => true,
|
||||
'default' => 'yes',
|
||||
'render_type' => 'none',
|
||||
)
|
||||
);
|
||||
$element->add_control(
|
||||
'ekit_onepagescroll_tooltip_text',
|
||||
array(
|
||||
'label' => esc_html__( 'Tooltip Text', 'elementskit-lite' ),
|
||||
'type' => Controls_Manager::TEXT,
|
||||
'frontend_available' => true,
|
||||
'render_type' => 'none',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
<?php
|
||||
|
||||
namespace Elementor;
|
||||
|
||||
use \ElementsKit_Lite\Modules\Onepage_Scroll\Init;
|
||||
|
||||
class ElementsKit_Extend_Onepage_Scroll {
|
||||
|
||||
public function __construct() {
|
||||
/**
|
||||
* Page Controls
|
||||
*/
|
||||
add_action( 'elementor/documents/register_controls', array( $this, 'register_page_controls' ) );
|
||||
|
||||
/**
|
||||
* Section Controls
|
||||
*/
|
||||
add_action( 'elementor/element/section/section_advanced/after_section_end', array( $this, 'register_section_controls' ) );
|
||||
|
||||
/**
|
||||
* Flexbox Container Support
|
||||
*/
|
||||
add_action( 'elementor/element/container/section_layout/after_section_end', array( $this, 'register_section_controls' ) );
|
||||
|
||||
/**
|
||||
* Navigation Markup
|
||||
*/
|
||||
add_action( 'wp_footer', array( $this, 'generate_navigation_markup' ) );
|
||||
add_action( 'wp_ajax_generate_navigation_markup', array( $this, 'generate_navigation_markup' ) );
|
||||
|
||||
/**
|
||||
* Pro Notice
|
||||
*/
|
||||
if ( \ElementsKit_Lite::package_type() === 'free' ) {
|
||||
add_action( 'elementor/element/wp-page/ekit_page_settings/before_section_end', array( $this, 'pro_panel_notice' ), 99 );
|
||||
add_action( 'elementor/element/section/ekit_onepagescroll_section/before_section_end', array( $this, 'pro_panel_notice' ), 99 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pro Panel Notice
|
||||
*/
|
||||
public function pro_panel_notice( $element ) {
|
||||
$element->add_control(
|
||||
'ekit_control_get_pro',
|
||||
array(
|
||||
'label' => esc_html__( 'Unlock more possibilities', 'elementskit-lite' ),
|
||||
'type' => \Elementor\Controls_Manager::CHOOSE,
|
||||
'options' => array(
|
||||
'1' => array(
|
||||
'icon' => 'eicon-lock',
|
||||
),
|
||||
),
|
||||
'default' => '1',
|
||||
'toggle' => false,
|
||||
'separator' => 'before',
|
||||
'description' => sprintf('<span class="ekit-widget-pro-feature"> %1$s <a href="https://wpmet.com/elementskit-pricing" target="_blank"> %2$s </a> %3$s </span>',
|
||||
esc_html__('Get the', 'elementskit-lite'),
|
||||
esc_html__('Pro version', 'elementskit-lite'),
|
||||
esc_html__('for more awesome elements and powerful modules.', 'elementskit-lite'),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Page Controls
|
||||
*/
|
||||
public function register_page_controls( Controls_Stack $element ) {
|
||||
$element->start_controls_section(
|
||||
'ekit_page_settings',
|
||||
array(
|
||||
'label' => esc_html__( 'ElementsKit Settings', 'elementskit-lite' ),
|
||||
'tab' => Controls_Manager::TAB_SETTINGS,
|
||||
)
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'ekit_onepagescroll',
|
||||
array(
|
||||
'label' => esc_html__( 'Enable Onepage Scroll', 'elementskit-lite' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'return_value' => 'block',
|
||||
'frontend_available' => true,
|
||||
'selectors' => array(
|
||||
'div.onepage_scroll_nav' => 'display: {{VALUE}};',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$element->end_controls_section();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Section Controls
|
||||
*/
|
||||
public function register_section_controls( Controls_Stack $element ) {
|
||||
$element->start_controls_section(
|
||||
'ekit_onepagescroll_section',
|
||||
array(
|
||||
'label' => esc_html__( 'ElementsKit Onepage Scroll', 'elementskit-lite' ),
|
||||
'tab' => Controls_Manager::TAB_ADVANCED,
|
||||
'hide_in_inner' => true,
|
||||
)
|
||||
);
|
||||
|
||||
$element->add_control(
|
||||
'ekit_has_onepagescroll',
|
||||
array(
|
||||
'label' => esc_html__( 'Enable Section', 'elementskit-lite' ),
|
||||
'type' => Controls_Manager::SWITCHER,
|
||||
'frontend_available' => true,
|
||||
'return_value' => 'section',
|
||||
'prefix_class' => 'ops-',
|
||||
)
|
||||
);
|
||||
|
||||
$element->end_controls_section();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Navigation Markup
|
||||
*/
|
||||
public function generate_navigation_markup() {
|
||||
$is_active = Init::get_page_setting( 'ekit_onepagescroll' );
|
||||
$is_nav = $nav_style = Init::get_page_setting( 'ekit_onepagescroll_nav' );
|
||||
$is_pro = \ElementsKit_Lite::package_type() === 'pro';
|
||||
$is_editor = \Elementor\Plugin::$instance->preview->is_preview_mode();
|
||||
$nav_pos = Init::get_page_setting( 'ekit_onepagescroll_nav_pos' );
|
||||
$nav_icon = Init::get_page_setting( 'ekit_onepagescroll_nav_icon' );
|
||||
|
||||
if ( ! ( $is_pro && $is_active && $is_nav ) ) {
|
||||
return;
|
||||
} elseif ( $is_editor ) {
|
||||
echo '<div id="onepage_scroll_nav_wrap">';
|
||||
}
|
||||
|
||||
$classlist = array(
|
||||
'wrapper' => 'nav-style-' . $nav_style . ' met_d--none met_pos--fixed ',
|
||||
'ul' => 'met_list--none met_m--0 met_p--0 met_lh--0 ',
|
||||
'li' => 'met_not_last_mb--20 ',
|
||||
'link' => '',
|
||||
'tooltip' => '',
|
||||
'arrow' => '',
|
||||
'span' => '',
|
||||
);
|
||||
|
||||
switch ( $nav_pos ) {
|
||||
case 'top':
|
||||
$classlist['wrapper'] .= 'met-' . $nav_pos . ' met_top--0 met_left--50p met_translateLeft--m50p met_my--20 ';
|
||||
$classlist['ul'] .= 'met_d--flex ';
|
||||
$classlist['li'] = 'met_not_last_mr--20 ';
|
||||
|
||||
$classlist['tooltip'] .= 'met_top--100p ';
|
||||
$classlist['arrow'] .= 'met_bdb_color--current met_top--100p ';
|
||||
break;
|
||||
|
||||
case 'bottom':
|
||||
$classlist['wrapper'] .= 'met-' . $nav_pos . ' met_bottom--0 met_left--50p met_translateLeft--m50p met_my--20 ';
|
||||
$classlist['ul'] .= 'met_d--flex ';
|
||||
$classlist['li'] = 'met_not_last_mr--20 ';
|
||||
|
||||
$classlist['tooltip'] .= 'met_bottom--100p ';
|
||||
$classlist['arrow'] .= 'met_bdt_color--current met_bottom--100p ';
|
||||
break;
|
||||
|
||||
case 'left':
|
||||
$classlist['wrapper'] .= 'met-' . $nav_pos . ' met_top--50p met_left--0 met_translateTop--m50p met_mx--20 ';
|
||||
|
||||
$classlist['tooltip'] .= 'met_left--100p ';
|
||||
$classlist['arrow'] .= 'met_bdr_color--current met_left--100p ';
|
||||
break;
|
||||
|
||||
case 'right':
|
||||
$classlist['wrapper'] .= 'met-' . $nav_pos . ' met_top--50p met_right--0 met_translateTop--m50p met_mx--20 ';
|
||||
|
||||
$classlist['tooltip'] .= 'met_right--100p ';
|
||||
$classlist['arrow'] .= 'met_bdl_color--current met_right--100p ';
|
||||
break;
|
||||
}
|
||||
|
||||
$nav_styles = array(
|
||||
'circle-scale-up',
|
||||
'circle-fill-in',
|
||||
'circle-fill-out',
|
||||
'circle-stroke',
|
||||
'circle-stroke-dot',
|
||||
'circle-stroke-simple',
|
||||
'circle-dot-move',
|
||||
'circle-timeline',
|
||||
'square-scale-up',
|
||||
'line-grow',
|
||||
'line-shrink',
|
||||
'line-fill',
|
||||
'line-move',
|
||||
'icon',
|
||||
);
|
||||
|
||||
if( in_array($nav_style, $nav_styles) ) {
|
||||
include_once 'nav-styles/' . $nav_style . '.php';
|
||||
}
|
||||
|
||||
if ( $is_editor ) :
|
||||
echo '</div>';
|
||||
endif;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Onepage_Scroll;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Init {
|
||||
private $dir;
|
||||
private $url;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
// get current directory path
|
||||
$this->dir = dirname( __FILE__ ) . '/';
|
||||
|
||||
// get current module's url
|
||||
$this->url = \ElementsKit_Lite::plugin_url() . 'modules/onepage-scroll/';
|
||||
|
||||
// enqueue styles and scripts
|
||||
add_action( 'elementor/frontend/after_enqueue_styles', array( $this, 'load_styles' ) );
|
||||
add_action( 'elementor/frontend/before_enqueue_scripts', array( $this, 'load_scripts' ) );
|
||||
add_action( 'elementor/frontend/before_enqueue_scripts', array( $this, 'editor_scripts' ) );
|
||||
|
||||
// include all necessary files
|
||||
$this->include_files();
|
||||
|
||||
// calling the sticky controls
|
||||
new \Elementor\ElementsKit_Extend_Onepage_Scroll();
|
||||
|
||||
if ( \ElementsKit_Lite::package_type() === 'pro' ) :
|
||||
new \Elementor\ElementsKit_Pro_Extend_Onepage_Scroll();
|
||||
endif;
|
||||
}
|
||||
|
||||
public function include_files() {
|
||||
include $this->dir . 'extend-controls.php';
|
||||
include $this->dir . 'extend-controls-pro.php';
|
||||
}
|
||||
|
||||
public function load_styles() {
|
||||
if ( self::get_page_data_setting( 'ekit_onepagescroll' ) ) :
|
||||
wp_enqueue_style( 'one-page-scroll', $this->url . 'assets/css/one-page-scroll.min.css', array(), \ElementsKit_Lite::version() );
|
||||
endif;
|
||||
}
|
||||
|
||||
public function load_scripts() {
|
||||
if ( self::get_page_data_setting( 'ekit_onepagescroll' ) ) :
|
||||
wp_enqueue_script( 'one-page-scroll', $this->url . 'assets/js/one-page-scroll.js', array( 'jquery', 'elementor-frontend' ), \ElementsKit_Lite::version(), true );
|
||||
endif;
|
||||
}
|
||||
|
||||
public function editor_scripts() {
|
||||
// todo: has some conflicts with dependency.
|
||||
// wp_enqueue_script( 'ekit-onepage-scroll-editor', $this->url . 'assets/js/editor.js', ['jquery', 'elementor-editor', 'elementor-frontend'], \ElementsKit_Lite::version(), true );
|
||||
}
|
||||
|
||||
public static function get_settings_model() {
|
||||
$post_id = get_the_ID();
|
||||
$page_settings_manager = \Elementor\Core\Settings\Manager::get_settings_managers( 'page' );
|
||||
return $page_settings_manager->get_model( $post_id );
|
||||
}
|
||||
|
||||
public static function get_page_data_setting( $id ) {
|
||||
$page_settings = self::get_settings_model()->get_data('settings');
|
||||
return isset($page_settings[$id]) ? $page_settings[$id] : false;
|
||||
}
|
||||
|
||||
public static function get_page_setting( $id ) {
|
||||
$settings_model = self::get_settings_model();
|
||||
return $settings_model->get_settings( $id );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Circle - Dot Move
|
||||
*/
|
||||
|
||||
$classlist['li'] .= 'before:met_pos--absolute before:met_w--16 before:met_h--16 before:met_transition--300ms before:met_radius--circle before:met_top--0 before:met_left--0 editor:before:met_bgc';
|
||||
|
||||
$classlist['link'] .= 'met_d--block met_pos--relative';
|
||||
|
||||
$classlist['span'] = 'met_d--block met_w--16 met_h--16 editor:met_bgc met_radius--circle met_transition--300ms met_opacity--30 a:hover:met_opacity--100';
|
||||
|
||||
$classlist['tooltip'] .= 'nav_tooltip met_d--none met_pos--absolute met_px--8 met_py--5 met_color--white editor:met_bgc met_radius--4 met_fs--14 met_lh--16 met_text--nowrap met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
$classlist['arrow'] .= 'met_d--none met_pos--absolute editor:met_color met_bd--6 met_bdc--none met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
if ( $nav_pos === 'top' || $nav_pos === 'bottom' ) :
|
||||
$classlist['tooltip'] .= 'met_left--50p met_translateLeft--m50p met_my--12 ';
|
||||
$classlist['arrow'] .= 'met_left--50p met_translateLeft--m50p ';
|
||||
else :
|
||||
$classlist['tooltip'] .= 'met_top--50p met_translateTop--m50p met_mx--12 ';
|
||||
$classlist['arrow'] .= 'met_top--50p met_translateTop--m50p ';
|
||||
endif;
|
||||
|
||||
?>
|
||||
<div class="onepage_scroll_nav <?php echo esc_attr( $classlist['wrapper'] ); ?>">
|
||||
<ul class="<?php echo esc_attr( $classlist['ul'] ); ?>">
|
||||
<li data-menuanchor="section_1" class="<?php echo esc_attr( $classlist['li'] ); ?>">
|
||||
<a href="#section_1" class="<?php echo esc_attr( $classlist['link'] ); ?>">
|
||||
<span class="<?php echo esc_attr( $classlist['span'] ); ?>"></span>
|
||||
|
||||
<span class="<?php echo esc_attr( $classlist['tooltip'] ); ?>"></span>
|
||||
<span class="<?php echo esc_attr( $classlist['arrow'] ); ?>"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Circle - Fill In
|
||||
*/
|
||||
|
||||
$classlist['link'] .= 'met_pos--relative met_d--block met_w--16 met_h--16 met_bd--2 editor:met_color editor:met_bdc met_radius--circle active:met_shadow_inset--8 hover:met_opacity--60 active:met_opacity--100 met_transition--300ms';
|
||||
|
||||
$classlist['tooltip'] .= 'nav_tooltip met_d--none met_pos--absolute met_px--8 met_py--5 met_color--white editor:met_bgc met_radius--4 met_fs--14 met_lh--16 met_text--nowrap met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
$classlist['arrow'] .= 'met_d--none met_pos--absolute editor:met_color met_bd--6 met_bdc--none met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
if ( $nav_pos === 'top' || $nav_pos === 'bottom' ) :
|
||||
$classlist['tooltip'] .= 'met_left--50p met_translateLeft--m50p met_my--12 ';
|
||||
$classlist['arrow'] .= 'met_left--50p met_translateLeft--m50p ';
|
||||
else :
|
||||
$classlist['tooltip'] .= 'met_top--50p met_translateTop--m50p met_mx--12 ';
|
||||
$classlist['arrow'] .= 'met_top--50p met_translateTop--m50p ';
|
||||
endif;
|
||||
|
||||
?>
|
||||
<div class="onepage_scroll_nav <?php echo esc_attr( $classlist['wrapper'] ); ?>">
|
||||
<ul class="<?php echo esc_attr( $classlist['ul'] ); ?>">
|
||||
<li data-menuanchor="section_1" class="<?php echo esc_attr( $classlist['li'] ); ?>">
|
||||
<a href="#section_1" class="<?php echo esc_attr( $classlist['link'] ); ?>">
|
||||
<span class="<?php echo esc_attr( $classlist['tooltip'] ); ?>"></span>
|
||||
<span class="<?php echo esc_attr( $classlist['arrow'] ); ?>"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Circle - Fill Out
|
||||
*/
|
||||
|
||||
$classlist['link'] = 'met_d--block met_pos--relative';
|
||||
|
||||
$classlist['span'] = 'met_d--block met_w--16 met_h--16 editor:met_color met_radius--circle met_shadow_inset--6 active:_:met_shadow_inset--1 met_opacity--30 a:hover:met_opacity--60 active:_:met_opacity--100 met_transition--300ms active:_:met_scale--150';
|
||||
|
||||
$classlist['tooltip'] .= 'nav_tooltip met_d--none met_pos--absolute met_px--8 met_py--5 met_color--white editor:met_bgc met_radius--4 met_fs--14 met_lh--16 met_text--nowrap met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
$classlist['arrow'] .= 'met_d--none met_pos--absolute editor:met_color met_bd--6 met_bdc--none met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
if ( $nav_pos === 'top' || $nav_pos === 'bottom' ) :
|
||||
$classlist['tooltip'] .= 'met_left--50p met_translateLeft--m50p met_my--12 ';
|
||||
$classlist['arrow'] .= 'met_left--50p met_translateLeft--m50p ';
|
||||
else :
|
||||
$classlist['tooltip'] .= 'met_top--50p met_translateTop--m50p met_mx--12 ';
|
||||
$classlist['arrow'] .= 'met_top--50p met_translateTop--m50p ';
|
||||
endif;
|
||||
|
||||
?>
|
||||
<div class="onepage_scroll_nav <?php echo esc_attr( $classlist['wrapper'] ); ?>">
|
||||
<ul class="<?php echo esc_attr( $classlist['ul'] ); ?>">
|
||||
<li data-menuanchor="section_1" class="<?php echo esc_attr( $classlist['li'] ); ?>">
|
||||
<a href="#section_1" class="<?php echo esc_attr( $classlist['link'] ); ?>">
|
||||
<span class="<?php echo esc_attr( $classlist['span'] ); ?>"></span>
|
||||
|
||||
<span class="<?php echo esc_attr( $classlist['tooltip'] ); ?>"></span>
|
||||
<span class="<?php echo esc_attr( $classlist['arrow'] ); ?>"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Circle - Scale Up
|
||||
*/
|
||||
|
||||
$classlist['link'] .= 'met_pos--relative met_d--block';
|
||||
|
||||
$classlist['span'] = 'met_d--block met_w--16 met_h--16 editor:met_bgc met_radius--circle met_transition--300ms met_opacity--30 a:hover:met_opacity--100 active:_:met_opacity--100 active:_:met_scale--150';
|
||||
|
||||
$classlist['tooltip'] .= 'nav_tooltip met_d--none met_pos--absolute met_px--8 met_py--5 met_color--white editor:met_bgc met_radius--4 met_fs--14 met_lh--16 met_text--nowrap met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
$classlist['arrow'] .= 'met_d--none met_pos--absolute editor:met_color met_bd--6 met_bdc--none met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
if ( $nav_pos === 'top' || $nav_pos === 'bottom' ) :
|
||||
$classlist['tooltip'] .= 'met_left--50p met_translateLeft--m50p met_my--12 ';
|
||||
$classlist['arrow'] .= 'met_left--50p met_translateLeft--m50p ';
|
||||
else :
|
||||
$classlist['tooltip'] .= 'met_top--50p met_translateTop--m50p met_mx--12 ';
|
||||
$classlist['arrow'] .= 'met_top--50p met_translateTop--m50p ';
|
||||
endif;
|
||||
|
||||
?>
|
||||
<div class="onepage_scroll_nav <?php echo esc_attr( $classlist['wrapper'] ); ?>">
|
||||
<ul class="<?php echo esc_attr( $classlist['ul'] ); ?>">
|
||||
<li data-menuanchor="section_1" class="<?php echo esc_attr( $classlist['li'] ); ?>">
|
||||
<a href="#section_1" class="<?php echo esc_attr( $classlist['link'] ); ?>">
|
||||
<span class="<?php echo esc_attr( $classlist['span'] ); ?>"></span>
|
||||
|
||||
<span class="<?php echo esc_attr( $classlist['tooltip'] ); ?>"></span>
|
||||
<span class="<?php echo esc_attr( $classlist['arrow'] ); ?>"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Circle - Stroke Dot
|
||||
*/
|
||||
|
||||
$classlist['link'] .= 'met_d--block met_pos--relative met_w--20 met_h--20 editor:met_color met_bd--2 met_bdc--none editor:active:met_bdc met_radius--circle met_transition--300ms';
|
||||
|
||||
$classlist['span'] = 'met_d--block met_h--16 editor:met_bgc met_radius--circle met_opacity--70 hover:met_opacity--100 active:_:met_opacity--1 active:_:met_scale--40 met_transition--300ms';
|
||||
|
||||
$classlist['tooltip'] .= 'nav_tooltip met_d--none met_pos--absolute met_px--8 met_py--5 met_color--white editor:met_bgc met_radius--4 met_fs--14 met_lh--16 met_text--nowrap met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
$classlist['arrow'] .= 'met_d--none met_pos--absolute editor:met_color met_bd--6 met_bdc--none met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
if ( $nav_pos === 'top' || $nav_pos === 'bottom' ) :
|
||||
$classlist['tooltip'] .= 'met_left--50p met_translateLeft--m50p met_my--12 ';
|
||||
$classlist['arrow'] .= 'met_left--50p met_translateLeft--m50p ';
|
||||
else :
|
||||
$classlist['tooltip'] .= 'met_top--50p met_translateTop--m50p met_mx--12 ';
|
||||
$classlist['arrow'] .= 'met_top--50p met_translateTop--m50p ';
|
||||
endif;
|
||||
|
||||
?>
|
||||
<div class="onepage_scroll_nav <?php echo esc_attr( $classlist['wrapper'] ); ?>">
|
||||
<ul class="<?php echo esc_attr( $classlist['ul'] ); ?>">
|
||||
<li data-menuanchor="section_1" class="<?php echo esc_attr( $classlist['li'] ); ?>">
|
||||
<a href="#section_1" class="<?php echo esc_attr( $classlist['link'] ); ?>">
|
||||
<span class="<?php echo esc_attr( $classlist['span'] ); ?>"></span>
|
||||
|
||||
<span class="<?php echo esc_attr( $classlist['tooltip'] ); ?>"></span>
|
||||
<span class="<?php echo esc_attr( $classlist['arrow'] ); ?>"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Circle - Stroke Simple
|
||||
*/
|
||||
|
||||
$classlist['link'] .= 'met_d--block met_pos--relative met_w--16 met_h--16 met_bd--2 editor:met_bdc met_opacity--30 active:met_opacity--100 met_radius--circle met_transition--300ms';
|
||||
|
||||
$classlist['tooltip'] .= 'nav_tooltip met_d--none met_pos--absolute met_px--8 met_py--5 met_color--white editor:met_bgc met_radius--4 met_fs--14 met_lh--16 met_text--nowrap met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
$classlist['arrow'] .= 'met_d--none met_pos--absolute editor:met_color met_bd--6 met_bdc--none met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
if ( $nav_pos === 'top' || $nav_pos === 'bottom' ) :
|
||||
$classlist['tooltip'] .= 'met_left--50p met_translateLeft--m50p met_my--12 ';
|
||||
$classlist['arrow'] .= 'met_left--50p met_translateLeft--m50p ';
|
||||
else :
|
||||
$classlist['tooltip'] .= 'met_top--50p met_translateTop--m50p met_mx--12 ';
|
||||
$classlist['arrow'] .= 'met_top--50p met_translateTop--m50p ';
|
||||
endif;
|
||||
|
||||
?>
|
||||
<div class="onepage_scroll_nav <?php echo esc_attr( $classlist['wrapper'] ); ?>">
|
||||
<ul class="<?php echo esc_attr( $classlist['ul'] ); ?>">
|
||||
<li data-menuanchor="section_1" class="<?php echo esc_attr( $classlist['li'] ); ?>">
|
||||
<a href="#section_1" class="<?php echo esc_attr( $classlist['link'] ); ?>">
|
||||
<span class="<?php echo esc_attr( $classlist['tooltip'] ); ?>"></span>
|
||||
<span class="<?php echo esc_attr( $classlist['arrow'] ); ?>"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Circle - Stroke
|
||||
*/
|
||||
|
||||
$classlist['link'] .= 'met_d--block met_pos--relative met_w--20 met_h--20 met_bd--2 met_bdc--none editor:active:met_bdc met_radius--circle met_transition--300ms';
|
||||
|
||||
$classlist['span'] = 'met_d--block met_h--16 editor:met_bgc met_radius--circle met_opacity--30 a:hover:met_opacity--100 active:_:met_opacity--0 met_transition--300ms';
|
||||
|
||||
$classlist['tooltip'] .= 'nav_tooltip met_d--none met_pos--absolute met_px--8 met_py--5 met_color--white editor:met_bgc met_radius--4 met_fs--14 met_lh--16 met_text--nowrap met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
$classlist['arrow'] .= 'met_d--none met_pos--absolute editor:met_color met_bd--6 met_bdc--none met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
if ( $nav_pos === 'top' || $nav_pos === 'bottom' ) :
|
||||
$classlist['tooltip'] .= 'met_left--50p met_translateLeft--m50p met_my--12 ';
|
||||
$classlist['arrow'] .= 'met_left--50p met_translateLeft--m50p ';
|
||||
else :
|
||||
$classlist['tooltip'] .= 'met_top--50p met_translateTop--m50p met_mx--12 ';
|
||||
$classlist['arrow'] .= 'met_top--50p met_translateTop--m50p ';
|
||||
endif;
|
||||
|
||||
?>
|
||||
<div class="onepage_scroll_nav <?php echo esc_attr( $classlist['wrapper'] ); ?>">
|
||||
<ul class="<?php echo esc_attr( $classlist['ul'] ); ?>">
|
||||
<li data-menuanchor="section_1" class="<?php echo esc_attr( $classlist['li'] ); ?>">
|
||||
<a href="#section_1" class="<?php echo esc_attr( $classlist['link'] ); ?>">
|
||||
<span class="<?php echo esc_attr( $classlist['span'] ); ?>"></span>
|
||||
|
||||
<span class="<?php echo esc_attr( $classlist['tooltip'] ); ?>"></span>
|
||||
<span class="<?php echo esc_attr( $classlist['arrow'] ); ?>"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Circle - Stroke Simple
|
||||
*/
|
||||
|
||||
$classlist['li'] .= 'met_pos--relative before:met_content after:met_content before:met_pos--absolute after:met_pos--absolute editor:met_color before:met_opacity--30 after:met_opacity--30 before:last:met_d--none after:first:met_d--none after:active:met_d--none ';
|
||||
|
||||
$classlist['link'] .= 'met_d--block met_pos--relative';
|
||||
|
||||
$classlist['span'] .= 'met_d--block met_w--12 met_h--12 met_bd--2 editor:met_bdc active:_:met_bd--1 met_opacity--30 a:hover:met_opacity--60 active:_:met_opacity--100 met_radius--circle met_transition--300ms active:_:met_scale--150';
|
||||
|
||||
$classlist['tooltip'] .= 'nav_tooltip met_d--none met_pos--absolute met_px--8 met_py--5 met_color--white editor:met_bgc met_radius--4 met_fs--14 met_lh--16 met_text--nowrap met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
$classlist['arrow'] .= 'met_d--none met_pos--absolute editor:met_color met_bd--6 met_bdc--none met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
if ( $nav_pos === 'top' || $nav_pos === 'bottom' ) :
|
||||
$classlist['li'] .= 'before:met_w--19 active:before:met_w--18 before:met_top--5 before:met_left--12 before:active:met_left--13 before:met_bdt--2 after:met_bdt--2 after:met_w--1 after:met_left--m1 after:met_top--5';
|
||||
|
||||
$classlist['tooltip'] .= 'met_left--50p met_translateLeft--m50p met_my--12 ';
|
||||
$classlist['arrow'] .= 'met_left--50p met_translateLeft--m50p ';
|
||||
else :
|
||||
$classlist['li'] .= 'before:met_h--19 active:before:met_h--18 before:met_left--5 before:met_top--12 before:active:met_top--13 before:met_bdl--2 after:met_bdl--2 after:met_h--1 after:met_top--m1 after:met_left--5';
|
||||
|
||||
$classlist['tooltip'] .= 'met_top--50p met_translateTop--m50p met_mx--12 ';
|
||||
$classlist['arrow'] .= 'met_top--50p met_translateTop--m50p ';
|
||||
endif;
|
||||
|
||||
?>
|
||||
<div class="onepage_scroll_nav <?php echo esc_attr( $classlist['wrapper'] ); ?>">
|
||||
<ul class="<?php echo esc_attr( $classlist['ul'] ); ?>">
|
||||
<li data-menuanchor="section_1" class="<?php echo esc_attr( $classlist['li'] ); ?>">
|
||||
<a href="#section_1" class="<?php echo esc_attr( $classlist['link'] ); ?>">
|
||||
<span class="<?php echo esc_attr( $classlist['span'] ); ?>"></span>
|
||||
|
||||
<span class="<?php echo esc_attr( $classlist['tooltip'] ); ?>"></span>
|
||||
<span class="<?php echo esc_attr( $classlist['arrow'] ); ?>"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Icon
|
||||
*/
|
||||
|
||||
$classlist['link'] .= 'met_d--block met_pos--relative ';
|
||||
|
||||
$classlist['span'] = $nav_icon['value'] . ' editor:met_color met_transition--300ms met_opacity--30 a:hover:met_opacity--100 active:_:met_opacity--100';
|
||||
|
||||
$classlist['tooltip'] .= 'nav_tooltip met_d--none met_pos--absolute met_px--8 met_py--5 met_color--white editor:met_bgc met_radius--4 met_fs--14 met_lh--16 met_text--nowrap met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
$classlist['arrow'] .= 'met_d--none met_pos--absolute editor:met_color met_bd--6 met_bdc--none met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
if ( $nav_pos === 'top' || $nav_pos === 'bottom' ) :
|
||||
$classlist['tooltip'] .= 'met_left--50p met_translateLeft--m50p met_my--12 ';
|
||||
$classlist['arrow'] .= 'met_left--50p met_translateLeft--m50p ';
|
||||
else :
|
||||
$classlist['tooltip'] .= 'met_top--50p met_translateTop--m50p met_mx--12 ';
|
||||
$classlist['arrow'] .= 'met_top--50p met_translateTop--m50p ';
|
||||
endif;
|
||||
|
||||
?>
|
||||
<div class="onepage_scroll_nav <?php echo esc_attr( $classlist['wrapper'] ); ?>">
|
||||
<ul class="<?php echo esc_attr( $classlist['ul'] ); ?>">
|
||||
<li data-menuanchor="section_1" class="<?php echo esc_attr( $classlist['li'] ); ?>">
|
||||
<a href="#section_1" class="<?php echo esc_attr( $classlist['link'] ); ?>">
|
||||
<span class="<?php echo esc_attr( $classlist['span'] ); ?>"></span>
|
||||
|
||||
<span class="<?php echo esc_attr( $classlist['tooltip'] ); ?>"></span>
|
||||
<span class="<?php echo esc_attr( $classlist['arrow'] ); ?>"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Line - Line Fill
|
||||
*/
|
||||
|
||||
$classlist['link'] .= 'met_d--block met_pos--relative ';
|
||||
|
||||
$classlist['span1'] = 'met_d--block editor:met_color met_pos--absolute met_opacity--30 ';
|
||||
$classlist['span2'] = 'met_d--block editor:met_color met_transition--300ms met_scale--0 ';
|
||||
|
||||
$classlist['tooltip'] .= 'nav_tooltip met_d--none met_pos--absolute met_px--8 met_py--5 met_color--white editor:met_bgc met_radius--4 met_fs--14 met_lh--16 met_text--nowrap met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
$classlist['arrow'] .= 'met_d--none met_pos--absolute editor:met_color met_bd--6 met_bdc--none met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
if ( $nav_pos === 'top' || $nav_pos === 'bottom' ) :
|
||||
$classlist['span1'] .= 'met_w--48 met_bdt--4';
|
||||
$classlist['span2'] .= 'active:_:met_scaleX--100 met_w--48 met_bdt--4 met_scale--right';
|
||||
|
||||
$classlist['tooltip'] .= 'met_left--50p met_translateLeft--m50p met_my--12 ';
|
||||
$classlist['arrow'] .= 'met_left--50p met_translateLeft--m50p ';
|
||||
else :
|
||||
$classlist['span1'] .= 'met_h--48 met_bdl--4';
|
||||
$classlist['span2'] .= 'active:_:met_scaleY--100 met_h--48 met_bdl--4 met_scale--bottom';
|
||||
|
||||
$classlist['tooltip'] .= 'met_top--50p met_translateTop--m50p met_mx--12 ';
|
||||
$classlist['arrow'] .= 'met_top--50p met_translateTop--m50p ';
|
||||
endif;
|
||||
|
||||
?>
|
||||
<div class="onepage_scroll_nav <?php echo esc_attr( $classlist['wrapper'] ); ?>">
|
||||
<ul class="<?php echo esc_attr( $classlist['ul'] ); ?>">
|
||||
<li data-menuanchor="section_1" class="<?php echo esc_attr( $classlist['li'] ); ?>">
|
||||
<a href="#section_1" class="<?php echo esc_attr( $classlist['link'] ); ?>">
|
||||
<span class="<?php echo esc_attr( $classlist['span1'] ); ?>"></span>
|
||||
<span class="<?php echo esc_attr( $classlist['span2'] ); ?>"></span>
|
||||
|
||||
<span class="<?php echo esc_attr( $classlist['tooltip'] ); ?>"></span>
|
||||
<span class="<?php echo esc_attr( $classlist['arrow'] ); ?>"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Line - Line Grow
|
||||
*/
|
||||
|
||||
$classlist['li'] = '';
|
||||
$classlist['link'] .= 'met_d--block met_pos--relative ';
|
||||
|
||||
$classlist['span'] = 'met_d--block editor:met_color met_transition--300ms met_opacity--30 a:hover:met_opacity--60 active:_:met_opacity--100 met_scale--' . $nav_pos;
|
||||
|
||||
$classlist['tooltip'] .= 'nav_tooltip met_d--none met_pos--absolute met_px--8 met_py--5 met_color--white editor:met_bgc met_radius--4 met_fs--14 met_lh--16 met_text--nowrap met_transition--300ms met_opacity--0 active:_:met_opacity--100 ';
|
||||
|
||||
$classlist['arrow'] .= 'met_d--none met_pos--absolute editor:met_color met_bd--6 met_bdc--none met_transition--300ms met_opacity--0 active:_:met_opacity--100 ';
|
||||
|
||||
if ( $nav_pos === 'top' || $nav_pos === 'bottom' ) :
|
||||
$classlist['link'] .= ' met_pl--10';
|
||||
$classlist['span'] .= ' met_h--24 met_bdl--2 met_pr--10 a:hover:met_scaleY--200 active:_:met_scaleY--200';
|
||||
|
||||
$classlist['tooltip'] .= 'met_left--50p met_translateLeft--m50p met_my--36 ';
|
||||
$classlist['arrow'] .= 'met_left--50p met_translateLeft--m50p met_my--24 ';
|
||||
else :
|
||||
$classlist['link'] .= ' met_pt--10';
|
||||
$classlist['span'] .= ' met_w--24 met_bdt--2 met_pb--10 a:hover:met_scaleX--200 active:_:met_scaleX--200';
|
||||
|
||||
$classlist['tooltip'] .= 'met_top--50p met_translateTop--m50p met_mx--36 ';
|
||||
$classlist['arrow'] .= 'met_top--50p met_translateTop--m50p met_mx--24 ';
|
||||
endif;
|
||||
|
||||
?>
|
||||
<div class="onepage_scroll_nav <?php echo esc_attr( $classlist['wrapper'] ); ?>">
|
||||
<ul class="<?php echo esc_attr( $classlist['ul'] ); ?>">
|
||||
<li data-menuanchor="section_1" class="<?php echo esc_attr( $classlist['li'] ); ?>">
|
||||
<a href="#section_1" class="<?php echo esc_attr( $classlist['link'] ); ?>">
|
||||
<span class="<?php echo esc_attr( $classlist['span'] ); ?>"></span>
|
||||
|
||||
<span class="<?php echo esc_attr( $classlist['tooltip'] ); ?>"></span>
|
||||
<span class="<?php echo esc_attr( $classlist['arrow'] ); ?>"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Line - Line Move
|
||||
*/
|
||||
|
||||
// Overrides
|
||||
$classlist['li'] .= 'before:met_pos--absolute before:met_top--0 before:met_left--0 editor:before:met_bgc before:met_transition--300ms ';
|
||||
|
||||
$classlist['link'] .= 'met_d--block met_pos--relative ';
|
||||
|
||||
$classlist['span'] = 'met_d--block editor:met_color met_opacity--30 ';
|
||||
|
||||
$classlist['tooltip'] .= 'nav_tooltip met_d--none met_pos--absolute met_px--8 met_py--5 met_color--white editor:met_bgc met_radius--4 met_fs--14 met_lh--16 met_text--nowrap met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
$classlist['arrow'] .= 'met_d--none met_pos--absolute editor:met_color met_bd--6 met_bdc--none met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
if ( $nav_pos === 'top' || $nav_pos === 'bottom' ) :
|
||||
$classlist['li'] .= 'before:met_h--4 before:met_w--48';
|
||||
$classlist['span'] .= 'met_w--48 met_bdt--4';
|
||||
|
||||
$classlist['tooltip'] .= 'met_left--50p met_translateLeft--m50p met_my--12 ';
|
||||
$classlist['arrow'] .= 'met_left--50p met_translateLeft--m50p ';
|
||||
else :
|
||||
$classlist['li'] .= 'before:met_w--4 before:met_h--48';
|
||||
$classlist['span'] .= 'met_h--48 met_bdl--4';
|
||||
|
||||
$classlist['tooltip'] .= 'met_top--50p met_translateTop--m50p met_mx--12 ';
|
||||
$classlist['arrow'] .= 'met_top--50p met_translateTop--m50p ';
|
||||
endif;
|
||||
|
||||
?>
|
||||
<div class="onepage_scroll_nav <?php echo esc_attr( $classlist['wrapper'] ); ?>">
|
||||
<ul class="<?php echo esc_attr( $classlist['ul'] ); ?>">
|
||||
<li data-menuanchor="section_1" class="<?php echo esc_attr( $classlist['li'] ); ?>">
|
||||
<a href="#section_1" class="<?php echo esc_attr( $classlist['link'] ); ?>">
|
||||
<span class="<?php echo esc_attr( $classlist['span'] ); ?>"></span>
|
||||
|
||||
<span class="<?php echo esc_attr( $classlist['tooltip'] ); ?>"></span>
|
||||
<span class="<?php echo esc_attr( $classlist['arrow'] ); ?>"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Line - Line Grow
|
||||
*/
|
||||
|
||||
$classlist['link'] .= 'met_d--block met_pos--relative';
|
||||
|
||||
$classlist['span'] = 'met_d--block editor:met_color met_transition--300ms met_opacity--30 a:hover:met_opacity--100 active:_:met_opacity--100 met_scale--' . $nav_pos;
|
||||
|
||||
$classlist['tooltip'] .= 'nav_tooltip met_d--none met_pos--absolute met_px--8 met_py--5 met_color--white editor:met_bgc met_radius--4 met_fs--14 met_lh--16 met_text--nowrap met_transition--300ms met_opacity--0 active:_:met_opacity--100 ';
|
||||
|
||||
$classlist['arrow'] .= 'met_d--none met_pos--absolute editor:met_color met_bd--6 met_bdc--none met_transition--300ms met_opacity--0 active:_:met_opacity--100 ';
|
||||
|
||||
if ( $nav_pos === 'top' || $nav_pos === 'bottom' ) :
|
||||
$classlist['span'] .= ' met_h--48 met_bdl--6 active:_:met_scaleY--20';
|
||||
|
||||
$classlist['tooltip'] .= 'met_left--50p met_translateLeft--m50p met_my--m28 ';
|
||||
$classlist['arrow'] .= 'met_left--50p met_translateLeft--m50p met_my--m40 ';
|
||||
else :
|
||||
$classlist['span'] .= ' met_w--48 met_bdt--6 active:_:met_scaleX--20';
|
||||
|
||||
$classlist['tooltip'] .= 'met_top--50p met_translateTop--m50p met_mx--m28 ';
|
||||
$classlist['arrow'] .= 'met_top--50p met_translateTop--m50p met_mx--m40 ';
|
||||
endif;
|
||||
|
||||
?>
|
||||
<div class="onepage_scroll_nav <?php echo esc_attr( $classlist['wrapper'] ); ?>">
|
||||
<ul class="<?php echo esc_attr( $classlist['ul'] ); ?>">
|
||||
<li data-menuanchor="section_1" class="<?php echo esc_attr( $classlist['li'] ); ?>">
|
||||
<a href="#section_1" class="<?php echo esc_attr( $classlist['link'] ); ?>">
|
||||
<span class="<?php echo esc_attr( $classlist['span'] ); ?>"></span>
|
||||
|
||||
<span class="<?php echo esc_attr( $classlist['tooltip'] ); ?>"></span>
|
||||
<span class="<?php echo esc_attr( $classlist['arrow'] ); ?>"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Square - Scale Up
|
||||
*/
|
||||
|
||||
$classlist['link'] .= 'met_d--block met_pos--relative';
|
||||
|
||||
$classlist['span'] = 'met_d--block met_w--20 met_h--20 editor:met_bgc active:_:met_bgc--nonei met_bd--2 editor:met_bdc met_transition--300ms met_opacity--8 a:hover:met_opacity--100 active:_:met_opacity--100 active:_:met_scale--150';
|
||||
|
||||
$classlist['tooltip'] .= 'nav_tooltip met_d--none met_pos--absolute met_px--8 met_py--5 met_color--white editor:met_bgc met_radius--4 met_fs--14 met_lh--16 met_text--nowrap met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
$classlist['arrow'] .= 'met_d--none met_pos--absolute editor:met_color met_bd--6 met_bdc--none met_transition--300ms met_opacity--0 a:hover:met_opacity--100 active:_:met_opacity--100 ';
|
||||
|
||||
if ( $nav_pos === 'top' || $nav_pos === 'bottom' ) :
|
||||
$classlist['tooltip'] .= 'met_left--50p met_translateLeft--m50p met_my--12 ';
|
||||
$classlist['arrow'] .= 'met_left--50p met_translateLeft--m50p ';
|
||||
else :
|
||||
$classlist['tooltip'] .= 'met_top--50p met_translateTop--m50p met_mx--12 ';
|
||||
$classlist['arrow'] .= 'met_top--50p met_translateTop--m50p ';
|
||||
endif;
|
||||
|
||||
?>
|
||||
<div class="onepage_scroll_nav <?php echo esc_attr( $classlist['wrapper'] ); ?>">
|
||||
<ul class="<?php echo esc_attr( $classlist['ul'] ); ?>">
|
||||
<li data-menuanchor="section_1" class="<?php echo esc_attr( $classlist['li'] ); ?>">
|
||||
<a href="#section_1" class="<?php echo esc_attr( $classlist['link'] ); ?>">
|
||||
<span class="<?php echo esc_attr( $classlist['span'] ); ?>"></span>
|
||||
|
||||
<span class="<?php echo esc_attr( $classlist['tooltip'] ); ?>"></span>
|
||||
<span class="<?php echo esc_attr( $classlist['arrow'] ); ?>"></span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
namespace ElementsKit_Lite\Modules\Widget_Builder\Api;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Common extends \ElementsKit_Lite\Core\Handler_Api {
|
||||
|
||||
public function config() {
|
||||
$this->prefix = 'widget-builder';
|
||||
$this->param = '/(?P<id>\w+(|[-]\w+))/';
|
||||
}
|
||||
|
||||
private function fix_title( $title ) {
|
||||
return ( $title == '' ) ? ( 'ElementsKit_Lite Custom Widget #' . time() ) : $title;
|
||||
}
|
||||
|
||||
|
||||
public function post_push() {
|
||||
|
||||
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
|
||||
|
||||
return array(
|
||||
'success' => false,
|
||||
'message' => array(
|
||||
esc_html__( 'Not enough permission.', 'elementskit-lite' ),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
$id = $this->request['id'];
|
||||
$data = json_decode( $this->request['data'] );
|
||||
|
||||
if ( ! property_exists( $data, 'title' ) || ! property_exists( $data, 'tabs' ) || ! ( $data->tabs instanceof \stdClass ) ) {
|
||||
|
||||
return array(
|
||||
'success' => false,
|
||||
'message' => array(
|
||||
esc_html__( 'Invalid data.', 'elementskit-lite' ),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
$title = $this->fix_title( $data->title );
|
||||
|
||||
$widget_data = array(
|
||||
'post_title' => $title,
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'elementskit_widget',
|
||||
);
|
||||
|
||||
$widget = get_post( $id );
|
||||
|
||||
if ( $widget == null ) {
|
||||
$id = wp_insert_post( $widget_data );
|
||||
} else {
|
||||
$widget_data['ID'] = $id;
|
||||
wp_update_post( $widget_data );
|
||||
}
|
||||
update_post_meta( $id, '_elementor_edit_mode', 'builder' );
|
||||
update_post_meta( $id, '_wp_page_template', 'elementor_canvas' );
|
||||
|
||||
$data->push_id = $id;
|
||||
|
||||
//update_post_meta( $id, '_wp_page_template', 'elementor_canvas' );
|
||||
update_post_meta( $id, 'elementskit_custom_widget_data', $data );
|
||||
\ElementsKit_Lite\Modules\Widget_Builder\Widget_File::instance()->create( $data, $id );
|
||||
|
||||
return array(
|
||||
'success' => true,
|
||||
'message' => array(
|
||||
esc_html__( 'Widget data saved!', 'elementskit-lite' ),
|
||||
),
|
||||
'push_id' => $id,
|
||||
);
|
||||
}
|
||||
|
||||
public function post_pull() {
|
||||
|
||||
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
|
||||
|
||||
return array(
|
||||
'success' => false,
|
||||
'message' => array(
|
||||
esc_html__( 'Not enough permission.', 'elementskit-lite' ),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
$id = $this->request['id'];
|
||||
$default = array(
|
||||
'title' => 'New Widget',
|
||||
'icon' => 'eicon-cog',
|
||||
'categories' => array( 'basic' ),
|
||||
'push_id' => $id,
|
||||
'markup' => '',
|
||||
'css' => '',
|
||||
'js' => '',
|
||||
'css_includes' => '',
|
||||
'js_includes' => '',
|
||||
'tabs' => array(
|
||||
'content' => array(),
|
||||
'style' => array(),
|
||||
'advanced' => array(),
|
||||
),
|
||||
);
|
||||
|
||||
$widget_data = get_post_meta( $id, 'elementskit_custom_widget_data', true );
|
||||
|
||||
return is_object( $widget_data ) ? $widget_data : $default;
|
||||
}
|
||||
|
||||
|
||||
public function post_import() {
|
||||
|
||||
//$id = $this->request['id'];
|
||||
|
||||
return array(
|
||||
'success' => true,
|
||||
'message' => 'hi',
|
||||
//'file' => $this->request
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
#post-body-content,#postbox-container-1{display:none}#post-body{margin-right:0!important}#elementskit-widget-builder-markup .inside{margin-top:0;padding:0}#elementskit-widget-builder-markup>.postbox-header,.meta-box-sortables:first-child{display:none}.postbox{border-width:0}.js .postbox>.handlediv{display:none}.postbox>h2{display:none}#wpbody-content{padding-bottom:0}#wpfooter{display:none}#elementor-panel-header-menu-button{visibility:hidden}#elementor-panel-footer-tools>div:not(#elementor-panel-footer-responsive){display:none}.elementor-add-new-section>:not(.elementor-add-section-button):not(.elementor-add-section-drag-title){display:none!important}.elementor-add-section-button{margin-left:30px;margin-right:30px}
|
||||
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 4.0 KiB |