From 090c499960cb6b26c75cf05b9303b5dc8916026d Mon Sep 17 00:00:00 2001 From: Zulfikar Nore Date: Wed, 19 Apr 2017 15:34:56 +0100 Subject: [PATCH] First Comit Taking that most important step - public release :) --- README.MD | 36 ++ assets/css/editor.css | 108 ++++ assets/css/editor.min.css | 193 +++++++ assets/css/frontend.css | 108 ++++ assets/css/frontend.min.css | 108 ++++ assets/css/tables.css | 112 ++++ assets/js/editor.js | 0 assets/js/editor.min.js | 0 assets/js/frontend.js | 0 assets/js/frontend.min.js | 0 base/module-base.php | 94 ++++ changelog.txt | 4 + classes/utils.php | 32 ++ elementor-tables.php | 115 ++++ includes/admin.php | 61 ++ includes/modules-manager.php | 50 ++ license/admin.php | 221 ++++++++ license/api.php | 133 +++++ license/updater.php | 151 +++++ modules/tables/module.info.php | 8 + modules/tables/module.php | 25 + modules/tables/widgets/table-standard.php | 656 ++++++++++++++++++++++ plugin.php | 202 +++++++ 23 files changed, 2417 insertions(+) create mode 100644 README.MD create mode 100644 assets/css/editor.css create mode 100644 assets/css/editor.min.css create mode 100644 assets/css/frontend.css create mode 100644 assets/css/frontend.min.css create mode 100644 assets/css/tables.css create mode 100644 assets/js/editor.js create mode 100644 assets/js/editor.min.js create mode 100644 assets/js/frontend.js create mode 100644 assets/js/frontend.min.js create mode 100644 base/module-base.php create mode 100644 changelog.txt create mode 100644 classes/utils.php create mode 100644 elementor-tables.php create mode 100644 includes/admin.php create mode 100644 includes/modules-manager.php create mode 100644 license/admin.php create mode 100644 license/api.php create mode 100644 license/updater.php create mode 100644 modules/tables/module.info.php create mode 100644 modules/tables/module.php create mode 100644 modules/tables/widgets/table-standard.php create mode 100644 plugin.php diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..c50b44a --- /dev/null +++ b/README.MD @@ -0,0 +1,36 @@ +# Tables For Elementor + + +**Contributors:** [WPDevHQ](https://wpdevhq.com) +**Tags:** elementor, pagebuilder, page builder, page builder table, page builder tables, WordPress tables, table builder, builder tables +**Requires at least:** 4.4 +**Tested up to:** 4.7.3 +**Stable tag:** 1.0.0 +**License:** GPLv3 +**License URI:** https://www.gnu.org/licenses/gpl-3.0.html + +Adds a tables creation module to the [Elementor Pagebuilder](https://github.com/pojome/elementor) : Only a basic 2 column table format is available right now - more in the future! + +## Description ## +Tables For Elementor is an addon companion for the most advanced frontend drag & drop page builder - Elementor. Create Feature rich tables and customize them right inside the page builder. + +## Installation ## +* These instructions assumes you already have a WordPress site and the Elementor plugin installed and activated. Also, it is assumed that you already have at least one of the supported froms plugin installed and activated. + +1. Install using the WordPress built-in Plugin installer, or Extract the zip file and drop the contents in the `wp-content/plugins/` directory of your WordPress installation. +2. Activate the plugin through the 'Plugins' menu in WordPress. +3. Go to Pages > Add New +4. While in the Elementor Editor, drag and drop the Contact Form 7 widget to the location of your choice - if you have not created any forms then only the default form will be available for styling! +4. Configure as desired and save. +5. Done! Enjoy :) + +## Frequently Asked Questions ## + +**Non Yet!** + +## Changelog ## + +### 1.0.0 ### +* Initial release. + +Copyright: WPDevHQ https://wpdevhq.com \ No newline at end of file diff --git a/assets/css/editor.css b/assets/css/editor.css new file mode 100644 index 0000000..7270c6c --- /dev/null +++ b/assets/css/editor.css @@ -0,0 +1,108 @@ +.table { + display: flex; + flex-wrap: wrap; + margin: 0 auto; + padding: 2rem 0rem 0rem 0rem; + max-width: 1100px; +} + +.table-cell { + box-sizing: border-box; + flex-grow: 1; + width: 100%; + padding: 0.8em 1.2em; + overflow: hidden; + list-style-type: none; + outline: 1px solid #ddd; + text-align: center; + font-weight: 300; + margin-top: 1px; + margin-left: 1px; +} +.table-cell:first-child { + outline: 1px solid #fff; + background: transparent; +} +@media only screen and (max-width: 768px) { + .table-cell:first-child { + display: none; + } +} +.table-cell:nth-child(3) { + outline: 1px solid #30305b; +} +.table-cell:nth-child(-n+3) { + padding-top: 40px; + padding-bottom: 40px; +} +.table-cell > h3 { + font-size: 26px; + margin-top: 0; + margin-bottom: 3rem; +} + +.table-cell.cell-feature { + text-align: left; + font-size: 18px; +} +.table-cell.features a.btn:hover { + background-color: #85bafc; + border-color: #85bafc; + color: #30305b; +} +.table-cell.plattform { + color: limegreen; +} +.table-cell.plattform a.btn { + color: limegreen; +} +.table-cell.plattform a.btn:hover { + background-color: limegreen; + border-color: limegreen; + color: white; +} +.table-cell.enterprise { + background-color: #30305b; + color: #85bafc; +} +.table-cell.enterprise a.btn { + color: #85bafc; +} +.table-cell.enterprise a.btn:hover { + background-color: #85bafc; + border-color: #85bafc; + color: #30305b; +} + +/* Table columns +================================== */ +.table-cell { + width: calc(33.33% - 1px); +} +@media only screen and (max-width: 768px) { + .table-cell.cell-feature { + width: 100%; + text-align: center; + } +} + +svg.enterprise-check path { + fill: #30305b !important; +} + +a.btn { + border: 2px solid; + padding: .6rem .9rem .6rem .9rem; + font-weight: 400; + text-transform: uppercase; + text-decoration: none; + -webkit-transition: 0.2s ease-in-out; + -moz-transition: 0.2s ease-in-out; + -ms-transition: 0.2s ease-in-out; + -o-transition: 0.2s ease-in-out; + transition: 0.2s ease-in-out; + -webkit-border-radius: 0.3rem; + -moz-border-radius: 0.3rem; + -ms-border-radius: 0.3rem; + border-radius: 0.3rem; +} \ No newline at end of file diff --git a/assets/css/editor.min.css b/assets/css/editor.min.css new file mode 100644 index 0000000..c0adf6c --- /dev/null +++ b/assets/css/editor.min.css @@ -0,0 +1,193 @@ +/*! elementor-show - v1.0.0 - 25-02-2017 */ +@media screen and (min-width: 750px) { + .modal { + text-align: center; + padding: 0 !important; + } + + .modal:before { + content: ''; + display: inline-block; + height: 100%; + vertical-align: middle; + margin-right: -4px; + } + + .modal-dialog { + display: inline-block; + vertical-align: middle; + } + + .model-body { + overflow-y: scroll !important; + overflow-x: hidden !important; + } +} +.modal { + background-color: #27446e; + background-color: rgba(39, 68, 110, 0.5); +} + +.modal-dialog { + max-width: 1280px; + width: 100%; +} + +.modal,.modal:before, .modal-dialog, .modal-body { + z-index: 99999 !important; +} + +.modal-backdrop { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 10; +} +.modal-backdrop.fade { + filter: alpha(opacity=0); + opacity: 0; +} +.modal-backdrop.in { + filter: alpha(opacity=50); + opacity: .5; +} + +.modal-dialog { + text-align: left; +} + +.modal-title { + text-align: center; + vertical-align: middle; + padding-bottom: 20px; +} + +body.modal-open .elementor-widget-wrap { + z-index: auto; +} + +.show-modal { + cursor: pointer; +} + +.close { + font-size: 26px; + filter: alpha(opacity=50); + opacity: .5; +} +.close:hover, +.close:focus { + filter: alpha(opacity=80); + opacity: .8; +} + +.table { + display: flex; + flex-wrap: wrap; + margin: 0 auto; + padding: 2rem 0rem 0rem 0rem; + max-width: 1100px; +} + +.table-cell { + box-sizing: border-box; + flex-grow: 1; + width: 100%; + padding: 0.8em 1.2em; + overflow: hidden; + list-style-type: none; + outline: 1px solid #ddd; + text-align: center; + font-weight: 300; + margin-top: 1px; + margin-left: 1px; +} +.table-cell:first-child { + outline: 1px solid #fff; + background: transparent; +} +@media only screen and (max-width: 768px) { + .table-cell:first-child { + display: none; + } +} +.table-cell:nth-child(3) { + outline: 1px solid #30305b; +} +.table-cell:nth-child(-n+3) { + padding-top: 40px; + padding-bottom: 40px; +} +.table-cell > h3 { + font-size: 26px; + margin-top: 0; + margin-bottom: 3rem; +} + +.table-cell.cell-feature { + text-align: left; + font-size: 18px; +} +.table-cell.features a.btn:hover { + background-color: #85bafc; + border-color: #85bafc; + color: #30305b; +} +.table-cell.plattform { + color: limegreen; +} +.table-cell.plattform a.btn { + color: limegreen; +} +.table-cell.plattform a.btn:hover { + background-color: limegreen; + border-color: limegreen; + color: white; +} +.table-cell.enterprise { + background-color: #30305b; + color: #85bafc; +} +.table-cell.enterprise a.btn { + color: #85bafc; +} +.table-cell.enterprise a.btn:hover { + background-color: #85bafc; + border-color: #85bafc; + color: #30305b; +} + +/* Table columns +================================== */ +.table-cell { + width: calc(33.33% - 1px); +} +@media only screen and (max-width: 768px) { + .table-cell.cell-feature { + width: 100%; + text-align: center; + } +} + +svg.enterprise-check path { + fill: #30305b !important; +} + +a.btn { + border: 2px solid; + padding: .6rem .9rem .6rem .9rem; + font-weight: 400; + text-transform: uppercase; + text-decoration: none; + -webkit-transition: 0.2s ease-in-out; + -moz-transition: 0.2s ease-in-out; + -ms-transition: 0.2s ease-in-out; + -o-transition: 0.2s ease-in-out; + transition: 0.2s ease-in-out; + -webkit-border-radius: 0.3rem; + -moz-border-radius: 0.3rem; + -ms-border-radius: 0.3rem; + border-radius: 0.3rem; +} \ No newline at end of file diff --git a/assets/css/frontend.css b/assets/css/frontend.css new file mode 100644 index 0000000..7270c6c --- /dev/null +++ b/assets/css/frontend.css @@ -0,0 +1,108 @@ +.table { + display: flex; + flex-wrap: wrap; + margin: 0 auto; + padding: 2rem 0rem 0rem 0rem; + max-width: 1100px; +} + +.table-cell { + box-sizing: border-box; + flex-grow: 1; + width: 100%; + padding: 0.8em 1.2em; + overflow: hidden; + list-style-type: none; + outline: 1px solid #ddd; + text-align: center; + font-weight: 300; + margin-top: 1px; + margin-left: 1px; +} +.table-cell:first-child { + outline: 1px solid #fff; + background: transparent; +} +@media only screen and (max-width: 768px) { + .table-cell:first-child { + display: none; + } +} +.table-cell:nth-child(3) { + outline: 1px solid #30305b; +} +.table-cell:nth-child(-n+3) { + padding-top: 40px; + padding-bottom: 40px; +} +.table-cell > h3 { + font-size: 26px; + margin-top: 0; + margin-bottom: 3rem; +} + +.table-cell.cell-feature { + text-align: left; + font-size: 18px; +} +.table-cell.features a.btn:hover { + background-color: #85bafc; + border-color: #85bafc; + color: #30305b; +} +.table-cell.plattform { + color: limegreen; +} +.table-cell.plattform a.btn { + color: limegreen; +} +.table-cell.plattform a.btn:hover { + background-color: limegreen; + border-color: limegreen; + color: white; +} +.table-cell.enterprise { + background-color: #30305b; + color: #85bafc; +} +.table-cell.enterprise a.btn { + color: #85bafc; +} +.table-cell.enterprise a.btn:hover { + background-color: #85bafc; + border-color: #85bafc; + color: #30305b; +} + +/* Table columns +================================== */ +.table-cell { + width: calc(33.33% - 1px); +} +@media only screen and (max-width: 768px) { + .table-cell.cell-feature { + width: 100%; + text-align: center; + } +} + +svg.enterprise-check path { + fill: #30305b !important; +} + +a.btn { + border: 2px solid; + padding: .6rem .9rem .6rem .9rem; + font-weight: 400; + text-transform: uppercase; + text-decoration: none; + -webkit-transition: 0.2s ease-in-out; + -moz-transition: 0.2s ease-in-out; + -ms-transition: 0.2s ease-in-out; + -o-transition: 0.2s ease-in-out; + transition: 0.2s ease-in-out; + -webkit-border-radius: 0.3rem; + -moz-border-radius: 0.3rem; + -ms-border-radius: 0.3rem; + border-radius: 0.3rem; +} \ No newline at end of file diff --git a/assets/css/frontend.min.css b/assets/css/frontend.min.css new file mode 100644 index 0000000..7270c6c --- /dev/null +++ b/assets/css/frontend.min.css @@ -0,0 +1,108 @@ +.table { + display: flex; + flex-wrap: wrap; + margin: 0 auto; + padding: 2rem 0rem 0rem 0rem; + max-width: 1100px; +} + +.table-cell { + box-sizing: border-box; + flex-grow: 1; + width: 100%; + padding: 0.8em 1.2em; + overflow: hidden; + list-style-type: none; + outline: 1px solid #ddd; + text-align: center; + font-weight: 300; + margin-top: 1px; + margin-left: 1px; +} +.table-cell:first-child { + outline: 1px solid #fff; + background: transparent; +} +@media only screen and (max-width: 768px) { + .table-cell:first-child { + display: none; + } +} +.table-cell:nth-child(3) { + outline: 1px solid #30305b; +} +.table-cell:nth-child(-n+3) { + padding-top: 40px; + padding-bottom: 40px; +} +.table-cell > h3 { + font-size: 26px; + margin-top: 0; + margin-bottom: 3rem; +} + +.table-cell.cell-feature { + text-align: left; + font-size: 18px; +} +.table-cell.features a.btn:hover { + background-color: #85bafc; + border-color: #85bafc; + color: #30305b; +} +.table-cell.plattform { + color: limegreen; +} +.table-cell.plattform a.btn { + color: limegreen; +} +.table-cell.plattform a.btn:hover { + background-color: limegreen; + border-color: limegreen; + color: white; +} +.table-cell.enterprise { + background-color: #30305b; + color: #85bafc; +} +.table-cell.enterprise a.btn { + color: #85bafc; +} +.table-cell.enterprise a.btn:hover { + background-color: #85bafc; + border-color: #85bafc; + color: #30305b; +} + +/* Table columns +================================== */ +.table-cell { + width: calc(33.33% - 1px); +} +@media only screen and (max-width: 768px) { + .table-cell.cell-feature { + width: 100%; + text-align: center; + } +} + +svg.enterprise-check path { + fill: #30305b !important; +} + +a.btn { + border: 2px solid; + padding: .6rem .9rem .6rem .9rem; + font-weight: 400; + text-transform: uppercase; + text-decoration: none; + -webkit-transition: 0.2s ease-in-out; + -moz-transition: 0.2s ease-in-out; + -ms-transition: 0.2s ease-in-out; + -o-transition: 0.2s ease-in-out; + transition: 0.2s ease-in-out; + -webkit-border-radius: 0.3rem; + -moz-border-radius: 0.3rem; + -ms-border-radius: 0.3rem; + border-radius: 0.3rem; +} \ No newline at end of file diff --git a/assets/css/tables.css b/assets/css/tables.css new file mode 100644 index 0000000..1893f48 --- /dev/null +++ b/assets/css/tables.css @@ -0,0 +1,112 @@ +#el-tables .table { + display: flex; + flex-wrap: wrap; + margin: 0 auto; + padding: 2rem 0rem 0rem 0rem; + max-width: 100%; +} + +#el-tables .table-cell { + box-sizing: border-box; + flex-grow: 1; + width: 100%; + padding: 1em 1.4em; + overflow: hidden; + list-style-type: none; + outline: 1px solid #ddd; + text-align: center; + font-weight: 300; + margin-top: 1px; + margin-left: 1px; +} +#el-tables .table-cell:first-child { + outline: 1px solid #fff; + background: transparent; +} +@media only screen and (max-width: 768px) { + #el-tables .table-cell:first-child { + display: none; + } +} +#el-tables .table-cell:nth-child(3) { + outline: 1px solid #30305b; +} +#el-tables .table-cell:nth-child(-n+3) { + padding-top: 40px; + padding-bottom: 40px; +} +#el-tables .table-cell h3.column-table-title { + font-size: 26px; + margin-top: 0; + margin-bottom: 3rem; +} + +#el-tables .table-cell.cell-feature { + text-align: left; + font-size: 18px; +} +#el-tables .table-cell.features a.btn:hover { + background-color: #85bafc; + border-color: #85bafc; + color: #30305b; +} +#el-tables .table-cell.first-column { + color: #30305b; +} +#el-tables .table-cell.first-column a.btn { + background-color: #ffffff; + border-color: #30305b; + color: #30305b; +} +#el-tables .table-cell.first-column a.btn:hover { + background-color: #30305b; + border-color: #30305b; + color: #ffffff; +} +#el-tables .table-cell.second-column { + color: #85bafc; +} +#el-tables .table-cell.second-column a.btn { + background-color: #ffffff; + border-color: #ffffff; + color: #85bafc; +} +#el-tables .table-cell.second-column a.btn:hover { + background-color: #85bafc; + border-color: #85bafc; + color: #ffffff; +} + +#el-tables .table-cell p { + margin: 0; + padding: 0; +} + +/* Table columns +================================== */ +#el-tables .table-cell { + width: calc(33.33% - 1px); +} +@media only screen and (max-width: 768px) { + #el-tables .table-cell.cell-feature { + width: 100%; + text-align: center; + } +} + +#el-tables a.btn { + border: 2px solid; + padding: .6rem .9rem .6rem .9rem; + font-weight: 400; + text-transform: uppercase; + text-decoration: none; + -webkit-transition: 0.2s ease-in-out; + -moz-transition: 0.2s ease-in-out; + -ms-transition: 0.2s ease-in-out; + -o-transition: 0.2s ease-in-out; + transition: 0.2s ease-in-out; + -webkit-border-radius: 0.3rem; + -moz-border-radius: 0.3rem; + -ms-border-radius: 0.3rem; + border-radius: 0.3rem; +} \ No newline at end of file diff --git a/assets/js/editor.js b/assets/js/editor.js new file mode 100644 index 0000000..e69de29 diff --git a/assets/js/editor.min.js b/assets/js/editor.min.js new file mode 100644 index 0000000..e69de29 diff --git a/assets/js/frontend.js b/assets/js/frontend.js new file mode 100644 index 0000000..e69de29 diff --git a/assets/js/frontend.min.js b/assets/js/frontend.min.js new file mode 100644 index 0000000..e69de29 diff --git a/base/module-base.php b/base/module-base.php new file mode 100644 index 0000000..9306031 --- /dev/null +++ b/base/module-base.php @@ -0,0 +1,94 @@ +get_name() . '/assets/'; + } + + public function get_widgets() { + return []; + } + + public function __construct() { + $this->reflection = new \ReflectionClass( $this ); + + add_action( 'elementor/widgets/widgets_registered', [ $this, 'init_widgets' ] ); + } + + public function init_widgets() { + $widget_manager = \Elementor\Plugin::instance()->widgets_manager; + + foreach ( $this->get_widgets() as $widget ) { + $class_name = $this->reflection->getNamespaceName() . '\Widgets\\' . $widget; + $widget_manager->register_widget_type( new $class_name() ); + } + } + + public function add_component( $id, $instance ) { + $this->components[ $id ] = $instance; + } + + public function get_component( $id ) { + if ( isset( $this->components[ $id ] ) ) { + return $this->components[ $id ]; + } + + return false; + } +} diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..2e8da42 --- /dev/null +++ b/changelog.txt @@ -0,0 +1,4 @@ +# Tables For Elementor - by WPDevHQ + +#### 2017-04-19 v1.0.0 +* Initial release \ No newline at end of file diff --git a/classes/utils.php b/classes/utils.php new file mode 100644 index 0000000..3922c88 --- /dev/null +++ b/classes/utils.php @@ -0,0 +1,32 @@ +=' ) ) { + add_action( 'admin_notices', 'elementor_tables_fail_load_out_of_date' ); + return; + } + + require( ELEMENTOR_TABLES_PATH . 'plugin.php' ); +} +add_action( 'plugins_loaded', 'elementor_tables_load_plugin' ); + +/** + * Show in WP Dashboard notice about the plugin is not activated. + * + * @since 1.0.0 + * + * @return void + */ +function elementor_tables_fail_load() { + $screen = get_current_screen(); + if ( isset( $screen->parent_file ) && 'plugins.php' === $screen->parent_file && 'update' === $screen->id ) { + return; + } + + $plugin = 'elementor/elementor.php'; + + if ( _is_elementor_installed() ) { + if ( ! current_user_can( 'activate_plugins' ) ) { + return; + } + + $activation_url = wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $plugin ); + + $message = '

' . __( 'Elementor Tables is not working because you need to activate the Elementor plugin.', 'elementor-tables' ) . '

'; + $message .= '

' . sprintf( '%s', $activation_url, __( 'Activate Elementor Now', 'elementor-tables' ) ) . '

'; + } else { + if ( ! current_user_can( 'install_plugins' ) ) { + return; + } + + $install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=elementor' ), 'install-plugin_elementor' ); + + $message = '

' . __( 'Elementor Tables is not working because you need to install the Elemenor plugin', 'elementor-tables' ) . '

'; + $message .= '

' . sprintf( '%s', $install_url, __( 'Install Elementor Now', 'elementor-tables' ) ) . '

'; + } + + echo '

' . $message . '

'; +} + +function elementor_tables_fail_load_out_of_date() { + if ( ! current_user_can( 'update_plugins' ) ) { + return; + } + + $file_path = 'elementor/elementor.php'; + + $upgrade_link = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $file_path, 'upgrade-plugin_' . $file_path ); + $message = '

' . __( 'Elementor Tables is not working because you are using an old version of Elementor.', 'elementor-tables' ) . '

'; + $message .= '

' . sprintf( '%s', $upgrade_link, __( 'Update Elementor Now', 'elementor-tables' ) ) . '

'; + + echo '
' . $message . '
'; +} + +if ( ! function_exists( '_is_elementor_installed' ) ) { + + function _is_elementor_installed() { + $file_path = 'elementor/elementor.php'; + $installed_plugins = get_plugins(); + + return isset( $installed_plugins[ $file_path ] ); + } +} + +add_action( 'wp_enqueue_scripts', 'enqueue_tables_style' ); +function enqueue_tables_style() { + wp_enqueue_style( 'show-tables', plugin_dir_url( __FILE__ ) . 'assets/css/tables.css', array() ); +} \ No newline at end of file diff --git a/includes/admin.php b/includes/admin.php new file mode 100644 index 0000000..d01c7e1 --- /dev/null +++ b/includes/admin.php @@ -0,0 +1,61 @@ +get_version() + ); + + wp_enqueue_style( 'elementor-show-admin' ); + } + + public function enqueue_scripts() { + $suffix = Utils::is_script_debug() ? '' : '.min'; + + wp_enqueue_script( + 'elementor-show-admin', + ELEMENTOR_TABLES_URL . 'assets/js/admin' . $suffix . '.js', + [], + Plugin::instance()->get_version(), + true + ); + + wp_localize_script( + 'elementor-show-admin', + 'ElementorTablesConfig', + Plugin::instance()->get_localize_settings() + ); + } + + public function remove_go_woostore_menu() { + remove_action( 'admin_menu', [ \Elementor\Plugin::instance()->settings, 'register_woostore_menu' ], Settings::MENU_PRIORITY_GO_PRO ); + } + + /** + * Admin constructor. + */ + public function __construct() { + add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_styles' ] ); + add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); + add_action( 'admin_menu', [ $this, 'remove_go_woostore_menu' ], 0 ); + } +} diff --git a/includes/modules-manager.php b/includes/modules-manager.php new file mode 100644 index 0000000..d68c99e --- /dev/null +++ b/includes/modules-manager.php @@ -0,0 +1,50 @@ +get_module_data( $module_id ); + if ( $module_data['required'] ) { + return true; + } + + $options = get_option( 'elementor_tables_active_modules', [] ); + if ( ! isset( $options[ $module_id ] ) ) { + return $module_data['default_activation']; + } + + return 'true' === $options[ $module_id ]; + } + + private function get_module_data( $module_id ) { + return isset( $this->_modules[ $module_id ] ) ? $this->_modules[ $module_id ] : false; + } + + public function __construct() { + $modules = [ + 'tables', + ]; + + // Fetch all modules data + foreach ( $modules as $module ) { + $this->_modules[ $module ] = require ELEMENTOR_TABLES_MODULES_PATH . $module . '/module.info.php'; + } + + foreach ( $this->_modules as $module_id => $module_data ) { + if ( ! $this->is_module_active( $module_id ) ) { + continue; + } + + $class_name = str_replace( '-', ' ', $module_id ); + $class_name = str_replace( ' ', '', ucwords( $class_name ) ); + $class_name = __NAMESPACE__ . '\\Modules\\' . $class_name . '\Module'; + + $class_name::instance(); + } + } +} diff --git a/license/admin.php b/license/admin.php new file mode 100644 index 0000000..b53d2a2 --- /dev/null +++ b/license/admin.php @@ -0,0 +1,221 @@ + true ] ); + } + + $license_key = trim( $_POST['elementor_show_license_key'] ); + + $data = API::activate_license( $license_key ); + if ( is_wp_error( $data ) ) { + wp_die( sprintf( '%s (%s) ', $data->get_error_message(), $data->get_error_code() ), __( 'Elementor WooStore', 'elementor-show' ), [ 'back_link' => true ] ); + } + + if ( API::STATUS_VALID !== $data['license'] ) { + $errors = [ + 'no_activations_left' => __( 'You have no more activations left. Please upgrade your licence for auto updates.', 'elementor-show' ), + 'expired' => __( 'Your license has expired. Please renew your licence in order to get auto-updates.', 'elementor-show' ), + 'missing' => __( 'Your license is missing. Please check your key again.', 'elementor-show' ), + 'revoked' => __( 'Your license has been revoked.', 'elementor-show' ), + 'item_name_mismatch' => sprintf( __( 'Your license has a name mismatch. Please go to your purchases and choose the proper key.', 'elementor-show' ), 'https://my.wpdevhq.com/my-account/' ), + ]; + + if ( isset( $errors[ $data['error'] ] ) ) { + $error_msg = $errors[ $data['error'] ]; + } else { + $error_msg = __( 'An error occurred, please try again', 'elementor-show' ) . ' (' . $data->error . ')'; + } + + wp_die( $error_msg, __( 'Elementor WooStore', 'elementor-show' ), [ 'back_link' => true ] ); + } + + self::set_license_key( $license_key ); + API::set_license_data( $data ); + + wp_safe_redirect( $_POST['_wp_http_referer'] ); + die; + } + + public function action_deactivate_license() { + check_admin_referer( 'elementor-show-license' ); + + API::deactivate_license(); + + delete_option( 'elementor_show_license_key' ); + + wp_safe_redirect( $_POST['_wp_http_referer'] ); + die; + } + + public function register_menu() { + $menu_text = __( 'License', 'elementor-show' ); + + add_submenu_page( + 'elementor', + $menu_text, + $menu_text, + 'manage_options', + 'elementor-license', + [ $this, 'display_page' ] + ); + } + + public function display_page() { + $license_key = self::get_license_key(); + ?> +
+

+ +
+ + +

+ +

+ +

buy it in our website.', 'elementor-show' ), 'https://my.wpdevhq.com/pro-license/' ); ?>

+ + + + + + + + + + +

your purchases. License key looks similar to this: fb351f05958872E193feb37a505a84be', 'elementor-show' ), 'http://my.wpdevhq.com/my-account/' ); ?>

+ + + + + + + + + + +

+ : + + + + + + + +

+ + +

Your license key has expired! Please visit to renew it or purchase a new one in order to get updates and support.', 'elementor-show' ); ?>

+ + + +
+
+ 'elementor-license' ], admin_url( 'admin.php' ) ); + + $license_key = self::get_license_key(); + if ( empty( $license_key ) ) { + $msg = sprintf( __( 'Welcome to Elementor WooStore! Please activate your license key to enable automatic updates.', 'elementor-show' ), $license_page_link ); + printf( '

%s

', $msg ); + return; + } + + $license_data = API::get_license_data(); + if ( empty( $license_data['license'] ) ) { + return; + } + + $errors = [ + API::STATUS_DISABLED => __( 'License is disabled', 'elementor-show' ), + API::STATUS_EXPIRED => __( 'License has expired', 'elementor-show' ), + API::STATUS_INVALID => sprintf( __( 'Something went wrong with license key\'s activation on your site. Please go to your account at WPDevHQ to get an updated license key.', 'elementor-show' ), 'http://my.wpdevhq.com/my-account/' ), + API::STATUS_SITE_INACTIVE => sprintf( __( 'The entered license key does not match the domain registered in our system, please deactivate the license and try reinserting it to receive updates.', 'elementor-show' ), $license_page_link ), + ]; + + if ( isset( $errors[ $license_data['license'] ] ) ) { + printf( '

%s

', $errors[ $license_data['license'] ] ); + return; + } + + if ( API::STATUS_VALID === $license_data['license'] ) { + $expires_time = strtotime( $license_data['expires'] ); + $notification_expires_time = strtotime( '-30 days', $expires_time ); + + if ( $notification_expires_time <= current_time( 'timestamp' ) ) { + $msg = sprintf( __( 'Note: Your license key will expire in %s.', 'elementor-show' ), human_time_diff( current_time( 'timestamp' ), $expires_time ) ); + printf( '
%s
', $msg ); + } + } + } + + public function filter_library_get_templates_args( $body_args ) { + $license_key = self::get_license_key(); + + if ( ! empty( $license_key ) ) { + $body_args['license'] = $license_key; + } + + return $body_args; + } + + public function __construct() { + add_action( 'admin_menu', [ $this, 'register_menu' ], 800 ); + add_action( 'admin_post_elementor_show_activate_license', [ $this, 'action_activate_license' ] ); + add_action( 'admin_post_elementor_show_deactivate_license', [ $this, 'action_deactivate_license' ] ); + + add_action( 'admin_notices', [ $this, 'admin_license_details' ], 20 ); + + // Add the licence key to Templates Library requests + add_filter( 'elementor/api/get_templates/body_args', [ $this, 'filter_library_get_templates_args' ] ); + + self::get_updater_instance(); + } +} diff --git a/license/api.php b/license/api.php new file mode 100644 index 0000000..8102410 --- /dev/null +++ b/license/api.php @@ -0,0 +1,133 @@ + ELEMENTOR_SHOW_VERSION, + 'item_name' => self::PRODUCT_NAME, + 'site_lang' => get_bloginfo( 'language' ), + 'url' => home_url(), + ] + ); + + $response = wp_remote_post( self::STORE_URL, [ + 'sslverify' => false, + 'timeout' => 40, + 'body' => $body_args, + ] ); + + if ( is_wp_error( $response ) ) { + return $response; + } + + $response_code = wp_remote_retrieve_response_code( $response ); + if ( 200 !== (int) $response_code ) { + return new \WP_Error( $response_code, __( 'HTTP Error', 'elementor-show' ) ); + } + + $data = json_decode( wp_remote_retrieve_body( $response ), true ); + if ( empty( $data ) || ! is_array( $data ) ) { + return new \WP_Error( 'no_json', __( 'An error occurred, please try again', 'elementor-show' ) ); + } + + return $data; + } + + public static function activate_license( $license_key ) { + $body_args = [ + 'edd_action' => 'activate_license', + 'license' => $license_key, + ]; + + $license_data = self::_remote_post( $body_args ); + + return $license_data; + } + + public static function deactivate_license() { + $body_args = [ + 'edd_action' => 'deactivate_license', + 'license' => Admin::get_license_key(), + ]; + + $license_data = self::_remote_post( $body_args ); + + return $license_data; + } + + public static function set_license_data( $license_data, $expiration = null ) { + if ( null === $expiration ) { + $expiration = 12 * HOUR_IN_SECONDS; + } + + set_transient( 'elementor_show_license_data', $license_data, $expiration ); + } + + public static function get_license_data( $force_request = false ) { + $license_data = get_transient( 'elementor_show_license_data' ); + + if ( false === $license_data || $force_request ) { + $body_args = [ + 'edd_action' => 'check_license', + 'license' => Admin::get_license_key(), + ]; + + $license_data = self::_remote_post( $body_args ); + + if ( is_wp_error( $license_data ) ) { + $license_data = [ + 'license' => 'http_error', + 'payment_id' => '0', + 'license_limit' => '0', + 'site_count' => '0', + 'activations_left' => '0', + ]; + + self::set_license_data( $license_data, 30 * MINUTE_IN_SECONDS ); + } else { + self::set_license_data( $license_data ); + } + } + + return $license_data; + } + + public static function get_version() { + $updater = Admin::get_updater_instance(); + + $body_args = [ + 'edd_action' => 'get_version', + 'name' => $updater->plugin_name, + 'slug' => $updater->plugin_slug, + 'version' => $updater->plugin_version, + 'license' => Admin::get_license_key(), + ]; + + $license_data = self::_remote_post( $body_args ); + + return $license_data; + } +} diff --git a/license/updater.php b/license/updater.php new file mode 100644 index 0000000..37a5a4b --- /dev/null +++ b/license/updater.php @@ -0,0 +1,151 @@ +plugin_version = ELEMENTOR_SHOW_VERSION; + $this->plugin_name = ELEMENTOR_SHOW_PLUGIN_BASE; + $this->plugin_slug = basename( ELEMENTOR_SHOW__FILE__, '.php' ); + $this->response_transient_key = md5( sanitize_key( $this->plugin_name ) . 'response_transient' ); + + $this->setup_hooks(); + $this->maybe_delete_transients(); + } + + private function setup_hooks() { + add_filter( 'pre_set_site_transient_update_plugins', [ $this, 'check_update' ] ); + add_filter( 'plugins_api', [ $this, 'plugins_api_filter' ], 10, 3 ); + + remove_action( 'after_plugin_row_' . $this->plugin_name, 'wp_plugin_update_row' ); + add_action( 'after_plugin_row_' . $this->plugin_name, [ $this, 'show_update_notification' ], 10, 2 ); + } + + private function maybe_delete_transients() { + global $pagenow; + + if ( 'update-core.php' === $pagenow && isset( $_GET['force-check'] ) ) { + delete_transient( $this->response_transient_key ); + } + } + + private function check_transient_data( $_transient_data ) { + if ( ! is_object( $_transient_data ) ) { + $_transient_data = new \stdClass; + } + + $version_info = get_transient( $this->response_transient_key . 'ss' ); + if ( false === $version_info ) { + $version_info = API::get_version(); + + if ( is_wp_error( $version_info ) ) { + $version_info = new \stdClass(); + $version_info->error = true; + } + + set_transient( $this->response_transient_key, $version_info, 12 * HOUR_IN_SECONDS ); + } + + if ( ! empty( $version_info->error ) ) { + return $_transient_data; + } + + if ( version_compare( $this->plugin_version, $version_info['new_version'], '<' ) ) { + $_transient_data->response[ $this->plugin_name ] = (object) $version_info; + } + + $_transient_data->last_checked = current_time( 'timestamp' ); + $_transient_data->checked[ $this->plugin_name ] = $this->plugin_version; + + return $_transient_data; + } + + public function check_update( $_transient_data ) { + global $pagenow; + + if ( ! is_object( $_transient_data ) ) { + $_transient_data = new \stdClass; + } + + if ( 'plugins.php' === $pagenow && is_multisite() ) { + return $_transient_data; + } + + return $this->check_transient_data( $_transient_data ); + } + + public function plugins_api_filter( $_data, $_action = '', $_args = null ) { + if ( 'plugin_information' !== $_action ) { + return $_data; + } + + if ( ! isset( $_args->slug ) || ( $_args->slug !== $this->plugin_slug ) ) { + return $_data; + } + + $cache_key = 'elementor_show_api_request_' . substr( md5( serialize( $this->plugin_slug ) ), 0, 15 ); + + $api_request_transient = get_site_transient( $cache_key ); + + if ( empty( $api_request_transient ) ) { + $api_response = API::get_version(); + + $_data = new \stdClass(); + + $_data->name = 'Elementor WooStore'; + $_data->slug = $this->plugin_slug; + $_data->author = 'WPDevHQ'; + $_data->homepage = 'http://wpdevhq.com/'; + + $_data->version = $api_response['new_version']; + $_data->last_updated = $api_response['last_updated']; + $_data->download_link = $api_response['download_link']; + $_data->banners = []; + + $_data->sections = unserialize( $api_response['sections'] ); + + //Expires in 1 day + set_site_transient( $cache_key, $_data, DAY_IN_SECONDS ); + } + + $_data = $api_request_transient; + + return $_data; + } + + public function show_update_notification( $file, $plugin ) { + if ( is_network_admin() ) { + return; + } + + if ( ! current_user_can( 'update_plugins' ) ) { + return; + } + + if ( ! is_multisite() ) { + return; + } + + if ( $this->plugin_name !== $file ) { + return; + } + + // Remove our filter on the site transient + remove_filter( 'pre_set_site_transient_update_plugins', [ $this, 'check_update' ] ); + + $update_cache = get_site_transient( 'update_plugins' ); + $update_cache = $this->check_transient_data( $update_cache ); + set_site_transient( 'update_plugins', $update_cache ); + + // Restore our filter + add_filter( 'pre_set_site_transient_update_plugins', [ $this, 'check_update' ] ); + } +} diff --git a/modules/tables/module.info.php b/modules/tables/module.info.php new file mode 100644 index 0000000..d3952fa --- /dev/null +++ b/modules/tables/module.info.php @@ -0,0 +1,8 @@ + __( 'Tables', 'elementor-tables' ), + 'required' => true, + 'default_activation' => true, +]; diff --git a/modules/tables/module.php b/modules/tables/module.php new file mode 100644 index 0000000..33072c6 --- /dev/null +++ b/modules/tables/module.php @@ -0,0 +1,25 @@ +add_actions(); + } + + public function get_name() { + return 'elementor-tables'; + } + + public function get_widgets() { + return [ + 'Table_Standard', // What is it goes here. + ]; + } + +} \ No newline at end of file diff --git a/modules/tables/widgets/table-standard.php b/modules/tables/widgets/table-standard.php new file mode 100644 index 0000000..a072908 --- /dev/null +++ b/modules/tables/widgets/table-standard.php @@ -0,0 +1,656 @@ +start_controls_section( + 'column_1_title', + [ + 'label' => __( 'First Option Title', 'elementor-tables' ), + ] + ); + + $this->add_control( + 'title1', + [ + 'label' => __( 'Title', 'elementor-tables' ), + 'type' => Controls_Manager::TEXT, + 'placeholder' => __( 'Enter your title', 'elementor-tables' ), + 'default' => __( 'Elementor', 'elementor-tables' ), + ] + ); + + $this->add_group_control( + Group_Control_Typography::get_type(), + [ + 'name' => 'title1_typography', + 'scheme' => Scheme_Typography::TYPOGRAPHY_1, + 'selector' => '{{WRAPPER}} .table-cell.first-column h3.column-table-title', + ] + ); + + $this->add_control( + 'view', + [ + 'label' => __( 'View', 'elementor-tables' ), + 'type' => Controls_Manager::HIDDEN, + 'default' => 'traditional', + ] + ); + + $this->end_controls_section(); + + $this->start_controls_section( + 'option_1_button', + [ + 'label' => __( 'Option 1 Button', 'elementor-tables' ), + ] + ); + + $this->add_control( + 'button1_cta', + [ + 'label' => __( 'CTA Text', 'elementor-tables' ), + 'type' => Controls_Manager::TEXT, + 'placeholder' => __( 'Download Now', 'elementor-tables' ), + 'default' => __( 'Download Now!', 'elementor-tables' ), + ] + ); + + $this->add_group_control( + Group_Control_Border::get_type(), + [ + 'name' => 'border1', + 'label' => __( 'Border', 'elementor-tables' ), + 'placeholder' => '1px', + 'default' => '1px', + 'selector' => '{{WRAPPER}} .table-cell.first-column a.btn', + ] + ); + + $this->add_control( + 'border1_radius', + [ + 'label' => __( 'Border Radius', 'elementor-tables' ), + 'type' => Controls_Manager::DIMENSIONS, + 'size_units' => [ 'px', '%' ], + 'selectors' => [ + '{{WRAPPER}} .table-cell.first-column a.btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', + ], + ] + ); + + $this->add_group_control( + Group_Control_Typography::get_type(), + [ + 'name' => 'button1_typography', + 'scheme' => Scheme_Typography::TYPOGRAPHY_1, + 'selector' => '{{WRAPPER}} .table-cell.first-column a.btn', + ] + ); + + $this->end_controls_section(); + + $this->start_controls_section( + 'column_2_title', + [ + 'label' => __( 'Second Option Title', 'elementor-tables' ), + ] + ); + + $this->add_control( + 'title2', + [ + 'label' => __( 'Title', 'elementor-tables' ), + 'type' => Controls_Manager::TEXT, + 'placeholder' => __( 'Enter your title', 'elementor-tables' ), + 'default' => __( 'Elementor Pro', 'elementor-tables' ), + ] + ); + + $this->add_group_control( + Group_Control_Typography::get_type(), + [ + 'name' => 'title2_typography', + 'scheme' => Scheme_Typography::TYPOGRAPHY_1, + 'selector' => '{{WRAPPER}} .table-cell.second-column h3.column-table-title', + ] + ); + + $this->add_control( + 'view', + [ + 'label' => __( 'View', 'elementor-tables' ), + 'type' => Controls_Manager::HIDDEN, + 'default' => 'traditional', + ] + ); + + $this->end_controls_section(); + + $this->start_controls_section( + 'option_2_button', + [ + 'label' => __( 'Option 2 Button', 'elementor-tables' ), + ] + ); + + $this->add_control( + 'button2_cta', + [ + 'label' => __( 'CTA Text', 'elementor-tables' ), + 'type' => Controls_Manager::TEXT, + 'placeholder' => __( 'View Details', 'elementor-tables' ), + 'default' => __( 'View Details!', 'elementor-tables' ), + ] + ); + + $this->add_group_control( + Group_Control_Border::get_type(), + [ + 'name' => 'button2_border', + 'label' => __( 'Border', 'elementor-tables' ), + 'placeholder' => '2px', + 'default' => '2px', + 'selector' => '{{WRAPPER}} .table-cell.second-column a.btn', + ] + ); + + $this->add_control( + 'button2_radius', + [ + 'label' => __( 'Border Radius', 'elementor-tables' ), + 'type' => Controls_Manager::DIMENSIONS, + 'size_units' => [ 'px', '%' ], + 'selectors' => [ + '{{WRAPPER}} .table-cell.second-column a.btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', + ], + ] + ); + + $this->add_group_control( + Group_Control_Typography::get_type(), + [ + 'name' => 'button2_typography', + 'scheme' => Scheme_Typography::TYPOGRAPHY_1, + 'selector' => '{{WRAPPER}} .table-cell.second-column a.btn', + ] + ); + + $this->end_controls_section(); + + $this->start_controls_section( + 'table_features', + [ + 'label' => __( 'Features', 'elementor-tables' ), + ] + ); + + $this->add_control( + 'feature_compare', + [ + 'label' => __( 'Icon Or Text', 'vividi' ), + 'type' => Controls_Manager::SELECT, + 'default' => 'icon', + 'options' => [ + 'icon' => __( 'Icon', 'elementor-tables' ), + 'text' => __( 'Text', 'elementor-tables' ), + ], + ] + ); + + $this->add_control( + 'features_list', + [ + 'label' => '', + 'type' => Controls_Manager::REPEATER, + 'default' => [ + [ + 'text' => __( 'Feature #1', 'elementor-tables' ), + 'option1_icon' => 'fa fa-check', + 'option2_icon' => 'fa fa-check', + ], + [ + 'text' => __( 'Feature #2', 'elementor-tables' ), + 'option1_icon' => 'fa fa-check', + 'option2_icon' => 'fa fa-check', + ], + [ + 'text' => __( 'Feature #3', 'elementor-tables' ), + 'option1_icon' => '', + 'option2_icon' => 'fa fa-check', + ], + ], + 'fields' => [ + [ + 'name' => 'text', + 'label' => __( 'Feature Name', 'elementor-tables' ), + 'type' => Controls_Manager::TEXTAREA, + 'label_block' => true, + 'placeholder' => __( 'Feature Name', 'elementor-tables' ), + 'default' => __( 'Feature Name', 'elementor-tables' ), + ], + [ + 'name' => 'option1_text', + 'label' => __( 'Supported or Not: Text', 'elementor-tables' ), + 'type' => Controls_Manager::TEXT, + 'label_block' => true, + 'default' => '', + ], + [ + 'name' => 'option1_icon', + 'label' => __( 'Supported or Not: Icon', 'elementor-tables' ), + 'type' => Controls_Manager::ICON, + 'label_block' => true, + 'default' => 'fa fa-check', + ], + [ + 'name' => 'option2_text', + 'label' => __( 'Supported or Not: Text', 'elementor-tables' ), + 'type' => Controls_Manager::TEXT, + 'label_block' => true, + 'default' => '', + ], + [ + 'name' => 'option2_icon', + 'label' => __( 'Supported or Not: Icon', 'elementor-tables' ), + 'type' => Controls_Manager::ICON, + 'label_block' => true, + 'default' => 'fa fa-check', + ], + ], + 'title_field' => '{{{ text }}}', + ] + ); + + $this->end_controls_section(); + + $this->start_controls_section( + 'column1_title_style', + [ + 'label' => __( 'First Option', 'elementor-tables' ), + 'tab' => Controls_Manager::TAB_STYLE, + ] + ); + + $this->add_control( + 'title1_bg', + [ + 'label' => __( 'Background Color', 'elementor-tables' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#ffffff', + 'selectors' => [ + '{{WRAPPER}} .table-cell.first-column' => 'background-color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'title1_color', + [ + 'label' => __( 'Title Color', 'elementor-tables' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#333333', + 'selectors' => [ + '{{WRAPPER}} .table-cell.first-column h3.column-table-title' => 'color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'button1_color', + [ + 'label' => __( 'Button Text', 'elementor-tables' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#ffffff', + 'selectors' => [ + '{{WRAPPER}} .table-cell.first-column a.btn' => 'color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'button1_hover', + [ + 'label' => __( 'Button Text Hover', 'elementor-tables' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#ffffff', + 'selectors' => [ + '{{WRAPPER}} .table-cell.first-column a.btn:hover' => 'color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'button1_bg', + [ + 'label' => __( 'Button BG', 'elementor-tables' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#30305b', + 'selectors' => [ + '{{WRAPPER}} .table-cell.first-column a.btn' => 'background-color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'button1_bg_hover', + [ + 'label' => __( 'Button BG Hover', 'elementor-tables' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#30305b', + 'selectors' => [ + '{{WRAPPER}} .table-cell.first-column a.btn:hover' => 'background-color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'button1_border_hover', + [ + 'label' => __( 'Button Border Hover', 'elementor-tables' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#30305b', + 'selectors' => [ + '{{WRAPPER}} .table-cell.first-column a.btn:hover' => 'border-color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'icon1_color', + [ + 'label' => __( 'Icon Color', 'elementor-tables' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#333333', + 'selectors' => [ + '{{WRAPPER}} .table-cell.first-icon i' => 'color: {{VALUE}};', + ], + ] + ); + + $this->end_controls_section(); + + $this->start_controls_section( + 'column2_title_style', + [ + 'label' => __( 'Second Option', 'elementor-tables' ), + 'tab' => Controls_Manager::TAB_STYLE, + ] + ); + + $this->add_control( + 'title2_bg', + [ + 'label' => __( 'Background Color', 'elementor-tables' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#30305b', + 'selectors' => [ + '{{WRAPPER}} .table-cell.second-column' => 'background-color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'title2_color', + [ + 'label' => __( 'Title Color', 'elementor-tables' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#ffffff', + 'selectors' => [ + '{{WRAPPER}} .table-cell.second-column h3.column-table-title' => 'color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'button2_color', + [ + 'label' => __( 'Button Text', 'elementor-tables' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#85bafc', + 'selectors' => [ + '{{WRAPPER}} .table-cell.second-column a.btn' => 'color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'button2_hover', + [ + 'label' => __( 'Button Text Hover', 'elementor-tables' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#ffffff', + 'selectors' => [ + '{{WRAPPER}} .table-cell.second-column a.btn:hover' => 'color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'button2_bg', + [ + 'label' => __( 'Button BG', 'elementor-tables' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#ffffff', + 'selectors' => [ + '{{WRAPPER}} .table-cell.second-column a.btn' => 'background-color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'button2_bg_hover', + [ + 'label' => __( 'Button BG Hover', 'elementor-tables' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#85bafc', + 'selectors' => [ + '{{WRAPPER}} .table-cell.second-column a.btn:hover' => 'background-color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'button2_border_hover', + [ + 'label' => __( 'Button Border Hover', 'elementor-tables' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#85bafc', + 'selectors' => [ + '{{WRAPPER}} .table-cell.second-column a.btn:hover' => 'border-color: {{VALUE}};', + ], + ] + ); + + $this->add_control( + 'icon2_color', + [ + 'label' => __( 'Icon Color', 'elementor-tables' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#333333', + 'selectors' => [ + '{{WRAPPER}} .table-cell.second-icon i' => 'color: {{VALUE}};', + ], + ] + ); + + $this->end_controls_section(); + + $this->start_controls_section( + 'features_style', + [ + 'label' => __( 'Features', 'elementor-tables' ), + 'tab' => Controls_Manager::TAB_STYLE, + ] + ); + + $this->add_control( + 'features_color', + [ + 'label' => __( 'Color', 'elementor-tables' ), + 'type' => Controls_Manager::COLOR, + 'scheme' => [ + 'type' => Scheme_Color::get_type(), + 'value' => Scheme_Color::COLOR_1, + ], + 'default' => '#333333', + 'selectors' => [ + '{{WRAPPER}} .table-cell.cell-feature' => 'color: {{VALUE}};', + ], + ] + ); + + $this->add_group_control( + Group_Control_Typography::get_type(), + [ + 'name' => 'features_typography', + 'scheme' => Scheme_Typography::TYPOGRAPHY_1, + 'selector' => '{{WRAPPER}} .table-cell.cell-feature', + ] + ); + + $this->end_controls_section(); + } + + protected function render() { + $settings = $this->get_settings(); + $title1 = $settings['title1']; + $title2 = $settings['title2']; + + $button1 = $settings['button1_cta']; + $button2 = $settings['button2_cta']; + ?> +
+
+
+

+ +

+ +
+
+

+ +

+ +
+ +
+ +
+
+ +

+
+
+ +

+
+ + +
+ _localize_settings; + } + + public function add_localize_settings( $setting_key, $setting_value = null ) { + if ( is_array( $setting_key ) ) { + $this->_localize_settings = array_replace_recursive( $this->_localize_settings, $setting_key ); + + return; + } + + if ( ! is_array( $setting_value ) || ! isset( $this->_localize_settings[ $setting_key ] ) || ! is_array( $this->_localize_settings[ $setting_key ] ) ) { + $this->_localize_settings[ $setting_key ] = $setting_value; + + return; + } + + $this->_localize_settings[ $setting_key ] = array_replace_recursive( $this->_localize_settings[ $setting_key ], $setting_value ); + } + + public function enqueue_styles() { + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; + + $direction_suffix = is_rtl() ? '-rtl' : ''; + + wp_enqueue_style( + 'elementor-tables', + ELEMENTOR_TABLES_URL . 'assets/css/frontend' . $direction_suffix . $suffix . '.css', + [], + Plugin::instance()->get_version() + ); + + if ( is_admin() ) { + wp_enqueue_style( + 'elementor-show-admin', + ELEMENTOR_TABLES_URL . 'assets/css/admin' . $direction_suffix . $suffix . '.css', + [], + Plugin::instance()->get_version() + ); + } + } + + public function enqueue_scripts() {} + + public function enqueue_panel_scripts() {} + + public function enqueue_panel_styles() { + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; + + wp_enqueue_style( + 'elementor-tables', + ELEMENTOR_TABLES_URL . 'assets/css/editor' . $suffix . '.css', + [ + 'elementor-editor' + ], + Plugin::instance()->get_version() + ); + } + + public function elementor_init() { + $this->_modules_manager = new Manager(); + + // Add element category in panel + \Elementor\Plugin::instance()->elements_manager->add_category( + 'table-elements', + [ + 'title' => __( 'Tables', 'elementor-tables' ), + 'icon' => 'font', + ], + 1 + ); + } + + protected function add_actions() { + add_action( 'elementor/init', [ $this, 'elementor_init' ] ); + + add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_panel_styles' ], 997 ); + //add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_panel_scripts' ] ); + + add_action( 'elementor/frontend/before_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); + add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_styles' ], 998 ); + } + + /** + * Plugin constructor. + */ + private function __construct() { + spl_autoload_register( [ $this, 'autoload' ] ); + + $this->_includes(); + + $this->add_actions(); + + if ( is_admin() ) { + new Admin(); + //new License\Admin(); + } + } +} + +if ( ! defined( 'ELEMENTOR_TABLES_TESTS' ) ) { + // In tests we run the instance manually. + Plugin::instance(); +}