diff --git a/.standard.json b/.standard.json index 5d326d2..8891683 100644 --- a/.standard.json +++ b/.standard.json @@ -1 +1 @@ -{"404.php":[],"archive-jetpack-portfolio.php":[],"archive.php":[],"attachment.php":[],"comments.php":[],"footer.php":[],"functions.php":[],"header.php":[],"inc/admin/welcome-screen/class-shapely-notify-system.php":[],"inc/admin/welcome-screen/class-shapely-welcome.php":[],"inc/admin/welcome-screen/sections/actions-required.php":[],"inc/admin/welcome-screen/sections/getting-started.php":[],"inc/admin/welcome-screen/sections/recommended-plugins.php":[],"inc/admin/welcome-screen/sections/support.php":[],"inc/class-shapely-related-posts.php":[],"inc/class-wp-bootstrap-navwalker.php":[],"inc/custom-controls/class-shapely-logo-dimensions.php":[],"inc/customizer.php":[],"inc/extras.php":[],"inc/jetpack.php":[],"inc/libraries/epsilon-framework/class-epsilon-autoloader.php":[],"inc/libraries/epsilon-framework/class-epsilon-framework.php":[],"inc/libraries/epsilon-framework/classes/class-epsilon-color-coded-categories.php":[],"inc/libraries/epsilon-framework/classes/class-epsilon-color-scheme.php":[],"inc/libraries/epsilon-framework/classes/class-epsilon-content-backup.php":[],"inc/libraries/epsilon-framework/classes/class-epsilon-customizer.php":[],"inc/libraries/epsilon-framework/classes/class-epsilon-notifications.php":[],"inc/libraries/epsilon-framework/classes/class-epsilon-notify-system.php":[],"inc/libraries/epsilon-framework/classes/class-epsilon-repeater-templates.php":[],"inc/libraries/epsilon-framework/classes/class-epsilon-sanitizers.php":[],"inc/libraries/epsilon-framework/classes/class-epsilon-typography.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-color-picker.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-color-scheme.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-customizer-navigation.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-icon-picker.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-image.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-layouts.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-repeater.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-section-repeater.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-slider.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-text-editor.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-toggle.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-typography.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-upsell.php":[],"inc/libraries/epsilon-framework/customizer/sections/class-epsilon-section-pro.php":[],"inc/libraries/epsilon-framework/customizer/sections/class-epsilon-section-recommended-actions.php":[],"inc/libraries/epsilon-framework/customizer/settings/class-epsilon-setting-repeater.php":[],"inc/socialnav.php":[],"inc/template-tags.php":[],"index.php":[],"page-templates/full-width.php":[],"page-templates/no-sidebar.php":[],"page-templates/sidebar-left.php":[],"page-templates/sidebar-right.php":[],"page-templates/template-home.php":[],"page.php":[],"search.php":[],"sidebar-footer.php":[],"sidebar.php":[],"single-jetpack-portfolio.php":[],"single.php":[],"template-parts/content-attachment.php":[],"template-parts/content-grid-small.php":[],"template-parts/content-grid-wide.php":[],"template-parts/content-none.php":[],"template-parts/content-page.php":[],"template-parts/content-portfolio.php":[],"template-parts/content-search.php":[],"template-parts/content.php":[],"template-parts/layouts/blog-grid.php":[],"template-parts/layouts/blog-large-image-grid.php":[],"template-parts/layouts/blog-large-image.php":[],"woocommerce.php":[],"woocommerce/product-searchform.php":[]} \ No newline at end of file +{"404.php":[],"archive-jetpack-portfolio.php":[],"archive.php":[],"attachment.php":[],"comments.php":[],"footer.php":[],"functions.php":[],"header.php":[],"inc/admin/welcome-screen/class-shapely-notify-system.php":[],"inc/admin/welcome-screen/class-shapely-welcome.php":[],"inc/admin/welcome-screen/sections/actions-required.php":[],"inc/admin/welcome-screen/sections/getting-started.php":[],"inc/admin/welcome-screen/sections/recommended-plugins.php":[],"inc/admin/welcome-screen/sections/support.php":[],"inc/class-shapely-builder.php":[],"inc/class-shapely-notify-system.php":[],"inc/class-shapely-related-posts.php":[],"inc/class-shapely.php":[],"inc/class-wp-bootstrap-navwalker.php":[],"inc/custom-controls/class-shapely-logo-dimensions.php":[],"inc/customizer.php":[],"inc/extras.php":[],"inc/jetpack.php":[],"inc/libraries/epsilon-framework/class-epsilon-autoloader.php":[],"inc/libraries/epsilon-framework/class-epsilon-framework.php":[],"inc/libraries/epsilon-framework/classes/backend/class-epsilon-content-backup.php":[],"inc/libraries/epsilon-framework/classes/backend/class-epsilon-notifications.php":[],"inc/libraries/epsilon-framework/classes/backend/class-epsilon-notify-system.php":[],"inc/libraries/epsilon-framework/classes/class-epsilon-ajax-controller.php":[],"inc/libraries/epsilon-framework/classes/class-epsilon-customizer.php":[],"inc/libraries/epsilon-framework/classes/helpers/class-epsilon-helper.php":[],"inc/libraries/epsilon-framework/classes/helpers/class-epsilon-sanitizers.php":[],"inc/libraries/epsilon-framework/classes/output/class-epsilon-color-coded-categories.php":[],"inc/libraries/epsilon-framework/classes/output/class-epsilon-color-scheme.php":[],"inc/libraries/epsilon-framework/classes/output/class-epsilon-page-generator.php":[],"inc/libraries/epsilon-framework/classes/output/class-epsilon-repeater-templates.php":[],"inc/libraries/epsilon-framework/classes/output/class-epsilon-typography.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-button-group.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-color-picker.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-color-scheme.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-customizer-navigation.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-icon-picker.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-image.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-layouts.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-repeater.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-section-repeater.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-slider.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-text-editor.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-toggle.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-typography.php":[],"inc/libraries/epsilon-framework/customizer/controls/class-epsilon-control-upsell.php":[],"inc/libraries/epsilon-framework/customizer/panels/class-epsilon-panel-regular.php":[],"inc/libraries/epsilon-framework/customizer/sections/class-epsilon-section-doubled.php":[],"inc/libraries/epsilon-framework/customizer/sections/class-epsilon-section-pro.php":[],"inc/libraries/epsilon-framework/customizer/sections/class-epsilon-section-recommended-actions.php":[],"inc/libraries/epsilon-framework/customizer/settings/class-epsilon-setting-repeater.php":[],"inc/libraries/welcome-screen/class-epsilon-welcome-screen.php":[],"inc/libraries/welcome-screen/sections/getting-started.php":[],"inc/libraries/welcome-screen/sections/recommended-actions.php":[],"inc/libraries/welcome-screen/sections/recommended-plugins.php":[],"inc/libraries/welcome-screen/sections/support.php":[],"inc/socialnav.php":[],"inc/template-tags.php":[],"index.php":[],"page-templates/full-width.php":[],"page-templates/no-sidebar.php":[],"page-templates/sidebar-left.php":[],"page-templates/sidebar-right.php":[],"page-templates/template-home.php":[],"page-templates/template-widget.php":[],"page.php":[],"search.php":[],"sidebar-footer.php":[],"sidebar.php":[],"single-jetpack-portfolio.php":[],"single.php":[],"template-parts/content-attachment.php":[],"template-parts/content-grid-small.php":[],"template-parts/content-grid-wide.php":[],"template-parts/content-none.php":[],"template-parts/content-page.php":[],"template-parts/content-portfolio.php":[],"template-parts/content-search.php":[],"template-parts/content.php":[],"template-parts/layouts/blog-grid.php":[],"template-parts/layouts/blog-large-image-grid.php":[],"template-parts/layouts/blog-large-image.php":[],"woocommerce.php":[],"woocommerce/product-searchform.php":[]} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 94ce7a1..c4f48cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,9 +38,7 @@ script: - mkdir -p build/logs - find -L . -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l - if [[ "$SNIFF" == "1" ]]; then jshint ./assets/js/*.js; fi -- if [[ "$SNIFF" == "1" ]]; then jshint ./inc/admin/welcome-screen/js/*.js; fi - if [[ "$SNIFF" == "1" ]]; then jscs ./assets/js/*.js; fi -- if [[ "$SNIFF" == "1" ]]; then jscs ./inc/admin/welcome-screen/js/*.js; fi - if [[ "$SNIFF" == "1" ]]; then grunt textdomain; fi - if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/scripts/phpcs -p -s -v -n ./*.php --standard=./phpcs.ruleset.xml --extensions=php; fi diff --git a/assets/js/customizer.js b/assets/js/customizer.js index 2c87b44..1a1c571 100644 --- a/assets/js/customizer.js +++ b/assets/js/customizer.js @@ -35,15 +35,19 @@ } ); control.widthElement.keyup( function() { - if ( control.respectRatio && control.hasLogo ) { - control.calculateRatio( 'width' ); + if ( control.hasLogo ) { + if ( control.respectRatio ) { + control.calculateRatio( 'width' ); + } control.shapelyInterval = setInterval( control.updateControl, 1000, control ); } } ); control.heightElement.keyup( function() { - if ( control.respectRatio && control.hasLogo ) { - control.calculateRatio( 'height' ); + if ( control.hasLogo ) { + if ( control.respectRatio ) { + control.calculateRatio( 'height' ); + } control.shapelyInterval = setInterval( control.updateControl, 1000, control ); } } ); diff --git a/assets/js/shapely-scripts.js b/assets/js/shapely-scripts.js index 93d0602..5d396c5 100644 --- a/assets/js/shapely-scripts.js +++ b/assets/js/shapely-scripts.js @@ -341,6 +341,7 @@ } ); } else { + $( play ).on( 'click', function( e ) { var parent = $( this ).parents( '.video-widget' ), instance = $( parent ).data( 'vide' ), diff --git a/changelog.txt b/changelog.txt index bd09f61..c14ca0e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +### 1.2.1 + Implemented milestone https://github.com/puikinsh/shapely/milestone/5 + ### 1.1.6 Implemented milestone https://github.com/puikinsh/shapely/milestone/2 diff --git a/functions.php b/functions.php index 386674f..82f9cf9 100644 --- a/functions.php +++ b/functions.php @@ -114,71 +114,6 @@ function shapely_setup() { add_theme_support( 'wc-product-gallery-slider' ); add_theme_support( 'customize-selective-refresh-widgets' ); - // Welcome screen - if ( is_admin() ) { - global $shapely_required_actions, $shapely_recommended_plugins; - - $shapely_recommended_plugins = array( - 'contact-form-7' => array( - 'recommended' => false, - ), - 'fancybox-for-wordpress' => array( - 'recommended' => false, - ), - 'wordpress-seo' => array( - 'recommended' => false, - ), - ); - - /* - * id - unique id; required - * title - * description - * check - check for plugins (if installed) - * plugin_slug - the plugin's slug (used for installing the plugin) - * - */ - $path = WPMU_PLUGIN_DIR . '/shapely-companion/inc/views/shapely-demo-content.php'; - if ( ! file_exists( $path ) ) { - $path = WP_PLUGIN_DIR . '/shapely-companion/inc/views/shapely-demo-content.php'; - if ( ! file_exists( $path ) ) { - $path = false; - } - } - - $shapely_required_actions = array( - array( - 'id' => 'shapely-req-ac-install-companion-plugin', - 'title' => Shapely_Notify_System::shapely_companion_title(), - 'description' => Shapely_Notify_System::shapely_companion_description(), - 'check' => Shapely_Notify_System::shapely_has_plugin( 'shapely-companion' ), - 'plugin_slug' => 'shapely-companion', - ), - array( - 'id' => 'shapely-req-ac-install-wp-jetpack-plugin', - 'title' => Shapely_Notify_System::shapely_jetpack_title(), - 'description' => Shapely_Notify_System::shapely_jetpack_description(), - 'check' => Shapely_Notify_System::shapely_has_plugin( 'jetpack' ), - 'plugin_slug' => 'jetpack', - ), - array( - 'id' => 'shapely-req-ac-install-contact-form-7', - 'title' => Shapely_Notify_System::shapely_cf7_title(), - 'description' => Shapely_Notify_System::shapely_cf7_description(), - 'check' => Shapely_Notify_System::shapely_has_plugin( 'contact-form-7' ), - 'plugin_slug' => 'contact-form-7', - ), - array( - 'id' => 'shapely-req-import-content', - 'title' => esc_html__( 'Import content', 'shapely' ), - 'external' => $path, - 'check' => Shapely_Notify_System::shapely_check_import_req(), - ), - - ); - - require get_template_directory() . '/inc/admin/welcome-screen/class-shapely-welcome.php'; - }// End if(). // Enable Shortcodes in widgets add_filter( 'widget_text', 'do_shortcode' ); @@ -328,16 +263,6 @@ function shapely_scripts() { add_action( 'wp_enqueue_scripts', 'shapely_scripts' ); -// Include Epsilon Framework -require_once 'inc/libraries/epsilon-framework/class-epsilon-autoloader.php'; -$args = array( - 'controls' => array( 'slider', 'toggle' ), // array of controls to load - 'sections' => array( 'recommended-actions', 'pro' ), // array of sections to load - 'backup' => false, -); - -new Epsilon_Framework( $args ); - /** * Custom template tags for this theme. */ @@ -374,9 +299,9 @@ function shapely_scripts() { require get_template_directory() . '/inc/class-shapely-related-posts.php'; /** - * Load the system checks ( used for notifications ) + * Load the shapely class */ -require get_template_directory() . '/inc/admin/welcome-screen/class-shapely-notify-system.php'; +require get_template_directory() . '/inc/class-shapely.php'; /** * Load the shapely page builder class diff --git a/inc/admin/welcome-screen/class-shapely-welcome.php b/inc/admin/welcome-screen/class-shapely-welcome.php deleted file mode 100644 index ac95567..0000000 --- a/inc/admin/welcome-screen/class-shapely-welcome.php +++ /dev/null @@ -1,417 +0,0 @@ -theme_name = $theme->get( 'Name' ); - $this->theme_slug = $theme->get( 'TextDomain' ); - - /** - * Add the notice in the admin backend - */ - $this->shapely_activation_admin_notice(); - - } - - /** - * Creates the dashboard page - * - * @see add_theme_page() - * @since 1.8.2.4 - */ - public function shapely_welcome_register_menu() { - $action_count = $this->count_actions(); - $title = $action_count > 0 ? esc_html__( 'About Shapely', 'shapely' ) . '' . esc_html( $action_count ) . '' : esc_html__( 'About Shapely', 'shapely' ); - - add_theme_page( - 'About shapely', $title, 'edit_theme_options', 'shapely-welcome', array( - $this, - 'shapely_welcome_screen', - ) - ); - } - - /** - * Adds an admin notice upon successful activation. - * - * @since 1.8.2.4 - */ - public function shapely_activation_admin_notice() { - if ( ! class_exists( 'Epsilon_Notifications' ) ) { - return; - } - - if ( empty( $this->notice ) ) { - $this->notice = ''; - - /* Translators: %1$s - Theme Name */ - $this->notice .= '

' . sprintf( esc_html__( 'Welcome to %1$s', 'shapely' ), $this->theme_name ) . '

'; - $this->notice .= '

'; - $this->notice .= - sprintf( /* Translators: Notice */ - esc_html__( 'Welcome! Thank you for choosing %3$s! To fully take advantage of the best our theme can offer please make sure you visit our %1$swelcome page%2$s.', 'shapely' ), - '', - '', - $this->theme_name - ); - $this->notice .= '

'; - /* Translators: %1$s - Theme Name */ - $this->notice .= '

' . sprintf( esc_html__( 'Get started with %1$s', 'shapely' ), $this->theme_name ) . '

'; - - } - - $notifications = Epsilon_Notifications::get_instance(); - $notifications->add_notice( - array( - 'id' => 'shapely_install_notice', - 'type' => 'notice epsilon-big', - 'message' => $this->notice, - ) - ); - } - - /** - * Display an admin notice linking to the welcome screen - * - * @since 1.8.2.4 - */ - public function shapely_welcome_admin_notice() { - ?> -
-

', '' ); ?>

-

-

-
- absint( $this->count_actions() ), - 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ), - 'template_directory' => esc_url( get_template_directory_uri() ), - 'no_required_actions_text' => esc_html__( 'Hooray! There are no required actions for you right now.', 'shapely' ), - ) - ); - - } - - /** - * Load scripts for customizer page - * - * @since 1.8.2.4 - */ - public function shapely_welcome_scripts_for_customizer() { - - wp_enqueue_style( 'shapely-welcome-screen-customizer-css', get_template_directory_uri() . '/inc/admin/welcome-screen/css/welcome_customizer.css' ); - - } - - /** - * Dismiss required actions - * - * @since 1.8.2.4 - */ - public function shapely_dismiss_required_action_callback() { - - global $shapely_required_actions; - - $action_id = ( isset( $_GET['id'] ) ) ? $_GET['id'] : 0; - - echo esc_html( wp_unslash( $action_id ) ); /* this is needed and it's the id of the dismissable required action */ - - if ( ! empty( $action_id ) ) : - - /* if the option exists, update the record for the specified id */ - if ( get_option( 'shapely_show_required_actions' ) ) : - - $shapely_show_required_actions = get_option( 'shapely_show_required_actions' ); - - switch ( esc_html( $_GET['todo'] ) ) { - case 'add': - $shapely_show_required_actions[ $action_id ] = true; - break; - case 'dismiss': - $shapely_show_required_actions[ $action_id ] = false; - break; - default: - return new WP_Error( 'Action denied!', __( 'I\'ve fallen and can\'t get up', 'shapely' ) ); - break; - } - - update_option( 'shapely_show_required_actions', $shapely_show_required_actions ); - - /* create the new option,with false for the specified id */ - else : - - $shapely_show_required_actions_new = array(); - - if ( ! empty( $shapely_required_actions ) ) : - - foreach ( $shapely_required_actions as $shapely_required_action ) : - - if ( $shapely_required_action['id'] == $action_id ) : - $shapely_show_required_actions_new[ $shapely_required_action['id'] ] = false; - else : - $shapely_show_required_actions_new[ $shapely_required_action['id'] ] = true; - endif; - - endforeach; - - update_option( 'shapely_show_required_actions', $shapely_show_required_actions_new ); - - endif; - - endif; - - endif; - - die(); // this is required to return a proper result - } - - /** - * - */ - public function count_actions() { - global $shapely_required_actions; - - $shapely_show_required_actions = get_option( 'shapely_show_required_actions' ); - if ( ! $shapely_show_required_actions ) { - $shapely_show_required_actions = array(); - } - - $i = 0; - foreach ( $shapely_required_actions as $action ) { - $true = false; - $dismissed = false; - - if ( ! $action['check'] ) { - $true = true; - } - - if ( ! empty( $shapely_show_required_actions ) && isset( $shapely_show_required_actions[ $action['id'] ] ) && ! $shapely_show_required_actions[ $action['id'] ] ) { - $true = false; - } - - if ( $true ) { - $i ++; - } - } - - return $i; - } - - public function call_plugin_api( $slug ) { - include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); - $call_api = get_transient( 'shapely_plugin_information_transient_' . $slug ); - if ( false === $call_api ) { - $call_api = plugins_api( - 'plugin_information', array( - 'slug' => $slug, - 'fields' => array( - 'downloaded' => false, - 'rating' => false, - 'description' => false, - 'short_description' => true, - 'donate_link' => false, - 'tags' => false, - 'sections' => true, - 'homepage' => true, - 'added' => false, - 'last_updated' => false, - 'compatibility' => false, - 'tested' => false, - 'requires' => false, - 'downloadlink' => false, - 'icons' => true, - ), - ) - ); - set_transient( 'shapely_plugin_information_transient_' . $slug, $call_api, 30 * MINUTE_IN_SECONDS ); - } - - return $call_api; - } - - public function check_active( $slug ) { - $slug2 = Shapely_Notify_System::_get_plugin_basename_from_slug( $slug ); - - $path = WP_PLUGIN_DIR . '/' . $slug2; - if ( ! file_exists( $path ) ) { - $path = false; - } - - if ( file_exists( $path ) ) { - include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); - - $needs = is_plugin_active( $slug2 ) ? 'deactivate' : 'activate'; - - return array( - 'status' => is_plugin_active( $slug2 ), - 'needs' => $needs, - ); - } - - return array( - 'status' => false, - 'needs' => 'install', - ); - } - - public function check_for_icon( $arr ) { - if ( ! empty( $arr['svg'] ) ) { - $plugin_icon_url = $arr['svg']; - } elseif ( ! empty( $arr['2x'] ) ) { - $plugin_icon_url = $arr['2x']; - } elseif ( ! empty( $arr['1x'] ) ) { - $plugin_icon_url = $arr['1x']; - } else { - $plugin_icon_url = $arr['default']; - } - - return $plugin_icon_url; - } - - public function create_action_link( $state, $slug ) { - $slug2 = Shapely_Notify_System::_get_plugin_basename_from_slug( $slug ); - - switch ( $state ) { - case 'install': - return wp_nonce_url( - add_query_arg( - array( - 'action' => 'install-plugin', - 'plugin' => $slug, - ), - network_admin_url( 'update.php' ) - ), - 'install-plugin_' . $slug - ); - break; - case 'deactivate': - return add_query_arg( - array( - 'action' => 'deactivate', - 'plugin' => rawurlencode( $slug2 ), - 'plugin_status' => 'all', - 'paged' => '1', - '_wpnonce' => wp_create_nonce( 'deactivate-plugin_' . $slug2 ), - ), admin_url( 'plugins.php' ) - ); - break; - case 'activate': - return add_query_arg( - array( - 'action' => 'activate', - 'plugin' => rawurlencode( $slug2 ), - 'plugin_status' => 'all', - 'paged' => '1', - '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $slug2 ), - ), admin_url( 'plugins.php' ) - ); - break; - } - } - - /** - * Welcome screen content - * - * @since 1.8.2.4 - */ - public function shapely_welcome_screen() { - require_once( ABSPATH . 'wp-load.php' ); - require_once( ABSPATH . 'wp-admin/admin.php' ); - require_once( ABSPATH . 'wp-admin/admin-header.php' ); - - $shapely = wp_get_theme(); - $active_tab = isset( $_GET['tab'] ) ? wp_unslash( $_GET['tab'] ) : 'getting_started'; - $action_count = $this->count_actions(); - - ?> - -
- -

- -
- - - - - - - - - -
- - Actions required tab */ - var shapelyNrActionsRequired = shapelyWelcomeScreenObject.nr_actions_required; - - if ( ( 'undefined' !== typeof shapelyNrActionsRequired ) && ( 0 !== shapelyNrActionsRequired ) ) { - jQuery( 'li.shapely-w-red-tab a' ).append( '' + shapelyNrActionsRequired + '' ); - } - - /* Dismiss required actions */ - jQuery( '.shapely-required-action-button' ).click(function() { - - var id = jQuery( this ).attr( 'id' ), - action = jQuery( this ).attr( 'data-action' ); - jQuery.ajax({ - type: 'GET', - data: { action: 'shapely_dismiss_required_action', id: id, todo: action }, - dataType: 'html', - url: shapelyWelcomeScreenObject.ajaxurl, - beforeSend: function( data, settings ) { - jQuery( '.shapely-tab-pane#actions_required h1' ).append( '
' ); - }, - success: function( data ) { - location.reload(); - jQuery( '#temp_load' ).remove(); - /* Remove loading gif */ - }, - error: function( jqXHR, textStatus, errorThrown ) { - console.log( jqXHR + ' :: ' + textStatus + ' :: ' + errorThrown ); - } - }); - }); -}); diff --git a/inc/admin/welcome-screen/js/welcome_customizer.js b/inc/admin/welcome-screen/js/welcome_customizer.js deleted file mode 100644 index 839f42f..0000000 --- a/inc/admin/welcome-screen/js/welcome_customizer.js +++ /dev/null @@ -1,9 +0,0 @@ -jQuery( document ).ready(function() {// jscs:ignore validateLineBreaks - var shapelyAboutpage = shapelyWelcomeScreenCustomizerObject.aboutpage; - var shapelyNrActionsRequired = shapelyWelcomeScreenCustomizerObject.nr_actions_required; - - /* Number of required actions */ - if ( ( 'undefined' !== typeof shapelyNrActionsRequired ) && ( 'undefined' !== typeof shapelyNrActionsRequired ) && ( '0' !== shapelyNrActionsRequired ) ) { - jQuery( '#accordion-section-themes .accordion-section-title' ).append( '' + shapelyNrActionsRequired + '' ); - } -}); diff --git a/inc/admin/welcome-screen/sections/actions-required.php b/inc/admin/welcome-screen/sections/actions-required.php deleted file mode 100644 index ce693f6..0000000 --- a/inc/admin/welcome-screen/sections/actions-required.php +++ /dev/null @@ -1,99 +0,0 @@ - - -
- - $shapely_required_action_value ) : - $hidden = false; - if ( isset( $shapely_show_required_actions[ $shapely_required_action_value['id'] ] ) && false === $shapely_show_required_actions[ $shapely_required_action_value['id'] ] ) { - $hidden = true; - } - if ( isset( $shapely_required_action_value['check'] ) && $shapely_required_action_value['check'] ) { - continue; - } - ?> -
- - - - - -

- -

-

- - ' . wp_kses_post( $shapely_required_action_value['help'] ); -endif; -?> -

- - check_active( $shapely_required_action_value['plugin_slug'] ); - $url = $this->create_action_link( $active['needs'], $shapely_required_action_value['plugin_slug'] ); - $label = ''; - - switch ( $active['needs'] ) { - case 'install': - $class = 'install-now button'; - $label = esc_html__( 'Install', 'shapely' ); - break; - case 'activate': - $class = 'activate-now button button-primary'; - $label = esc_html__( 'Activate', 'shapely' ); - break; - case 'deactivate': - $class = 'deactivate-now button'; - $label = esc_html__( 'Deactivate', 'shapely' ); - break; - } - - ?> -

- -

- -
- ' . esc_html__( 'Hooray! There are no required actions for you right now.', 'shapely' ) . ''; - endif; - ?> - -
diff --git a/inc/admin/welcome-screen/sections/recommended-plugins.php b/inc/admin/welcome-screen/sections/recommended-plugins.php deleted file mode 100644 index c3035fb..0000000 --- a/inc/admin/welcome-screen/sections/recommended-plugins.php +++ /dev/null @@ -1,53 +0,0 @@ - - - diff --git a/inc/admin/welcome-screen/class-shapely-notify-system.php b/inc/class-shapely-notify-system.php similarity index 100% rename from inc/admin/welcome-screen/class-shapely-notify-system.php rename to inc/class-shapely-notify-system.php diff --git a/inc/class-shapely-related-posts.php b/inc/class-shapely-related-posts.php index 50cb4c9..c64282e 100644 --- a/inc/class-shapely-related-posts.php +++ b/inc/class-shapely-related-posts.php @@ -226,9 +226,9 @@ function output_related_posts() { echo '
'; if ( has_post_thumbnail( $related_posts->post->ID ) ) { - echo '' . get_the_post_thumbnail( $related_posts->post->ID, 'shapely-grid' ) . ''; + echo '' . get_the_post_thumbnail( $related_posts->post->ID, 'shapely-grid' ) . ''; } else { - echo ''; + echo ''; } if ( $show_title ) { diff --git a/inc/class-shapely.php b/inc/class-shapely.php new file mode 100644 index 0000000..1309002 --- /dev/null +++ b/inc/class-shapely.php @@ -0,0 +1,185 @@ + array( + 'recommended' => false, + ), + 'fancybox-for-wordpress' => array( + 'recommended' => false, + ), + ); + + public $recommended_actions; + + public $theme_slug = 'shapely'; + + function __construct() { + + if ( ! is_admin() && ! is_customize_preview() ) { + return; + } + + $this->load_class(); + + $this->recommended_actions = apply_filters( + 'shapely_required_actions', array( + array( + 'id' => 'shapely-req-import-content', + 'title' => esc_html__( 'Import Demo Content', 'shapely' ), + 'description' => esc_html__( 'Clicking the button below will install and activate plugins, add widgets and set static front page to your WordPress installation. Click advanced to customize the import process.', 'shapely' ), + 'help' => $this->generate_action_html(), + 'check' => Shapely_Notify_System::shapely_has_content(), + ), + array( + 'id' => 'shapely-req-ac-install-companion-plugin', + 'title' => Shapely_Notify_System::shapely_companion_title(), + 'description' => Shapely_Notify_System::shapely_companion_description(), + 'check' => Shapely_Notify_System::shapely_has_plugin( 'shapely-companion' ), + 'plugin_slug' => 'shapely-companion', + ), + array( + 'id' => 'shapely-req-ac-install-wp-jetpack-plugin', + 'title' => Shapely_Notify_System::shapely_jetpack_title(), + 'description' => Shapely_Notify_System::shapely_jetpack_description(), + 'check' => Shapely_Notify_System::shapely_has_plugin( 'jetpack' ), + 'plugin_slug' => 'jetpack', + ), + array( + 'id' => 'shapely-req-ac-install-contact-form-7', + 'title' => Shapely_Notify_System::shapely_cf7_title(), + 'description' => Shapely_Notify_System::shapely_cf7_description(), + 'check' => Shapely_Notify_System::shapely_has_plugin( 'contact-form-7' ), + 'plugin_slug' => 'contact-form-7', + ), + ) + ); + + $this->init_epsilon(); + $this->init_welcome_screen(); + + // Hooks + add_action( 'customize_register', array( $this, 'init_customizer' ) ); + + } + + public function load_class() { + + if ( ! is_admin() && ! is_customize_preview() ) { + return; + } + + require_once get_template_directory() . '/inc/libraries/epsilon-framework/class-epsilon-autoloader.php'; + require_once get_template_directory() . '/inc/class-shapely-notify-system.php'; + require_once get_template_directory() . '/inc/libraries/welcome-screen/class-epsilon-welcome-screen.php'; + + } + + public function init_epsilon() { + + $args = array( + 'controls' => array( 'slider', 'toggle' ), // array of controls to load + 'sections' => array( 'recommended-actions', 'pro' ), // array of sections to load + 'backup' => false, + ); + + new Epsilon_Framework( $args ); + + } + + public function init_welcome_screen() { + + Epsilon_Welcome_Screen::get_instance( + $config = array( + 'theme-name' => 'Shapely', + 'theme-slug' => 'shapely', + 'actions' => $this->recommended_actions, + 'plugins' => $this->recommended_plugins, + ) + ); + + } + + public function init_customizer( $wp_customize ) { + $current_theme = wp_get_theme(); + $wp_customize->add_section( + new Epsilon_Section_Recommended_Actions( + $wp_customize, 'epsilon_recomended_section', array( + 'title' => esc_html__( 'Recomended Actions', 'shapely' ), + 'social_text' => esc_html( $current_theme->get( 'Author' ) ) . esc_html__( ' is social :', 'shapely' ), + 'plugin_text' => esc_html__( 'Recomended Plugins :', 'shapely' ), + 'actions' => $this->recommended_actions, + 'plugins' => $this->recommended_plugins, + 'theme_specific_option' => $this->theme_slug . '_show_required_actions', + 'theme_specific_plugin_option' => $this->theme_slug . '_show_required_plugins', + 'facebook' => 'https://www.facebook.com/colorlib', + 'twitter' => 'https://twitter.com/colorlib', + 'wp_review' => true, + 'priority' => 0, + ) + ) + ); + + } + + private function generate_action_html() { + + $import_actions = array( + 'set-frontpage' => esc_html__( 'Set Static FrontPage', 'shapely' ), + 'import-widgets' => esc_html__( 'Import HomePage Widgets', 'shapely' ), + ); + + $import_plugins = array( + 'shapely-companion' => esc_html__( 'Shapely Companion', 'shapely' ), + 'jetpack' => esc_html__( 'Jetpack', 'shapely' ), + 'contact-form-7' => esc_html__( 'Contact Form 7', 'shapely' ), + ); + + $plugins_html = ''; + + if ( is_customize_preview() ) { + $url = 'themes.php?page=%1$s-welcome&tab=%2$s'; + $html = '' . __( 'Import Demo Content', 'shapely' ) . ''; + } else { + $html = '

' . __( 'Import Demo Content', 'shapely' ) . ''; + $html .= '' . __( 'Advanced', 'shapely' ) . '

'; + $html .= '
'; + + foreach ( $import_plugins as $id => $label ) { + if ( ! Shapely_Notify_System::shapely_has_plugin( $id ) ) { + $plugins_html .= $this->generate_checkbox( $id, $label, 'plugins' ); + } + } + + if ( '' != $plugins_html ) { + $html .= '
'; + $html .= '

' . __( 'Plugins', 'shapely' ) . '

'; + $html .= '
'; + $html .= $plugins_html; + $html .= '
'; + $html .= '
'; + } + + $html .= '
'; + $html .= '

' . __( 'Demo Content', 'shapely' ) . '

'; + $html .= '
'; + foreach ( $import_actions as $id => $label ) { + $html .= $this->generate_checkbox( $id, $label ); + } + $html .= '
'; + $html .= '
'; + $html .= '
'; + } + + return $html; + + } + + private function generate_checkbox( $id, $label, $name = 'options', $block = false ) { + $string = ''; + return sprintf( $string, $name, $id, $label ); + } + +} +new Shapely(); diff --git a/inc/customizer.php b/inc/customizer.php index d1e4ec0..ecdcbfd 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -75,60 +75,15 @@ function shapely_customize_register( $wp_customize ) { */ function shapely_customizer( $wp_customize ) { - // Recomended actions - global $shapely_required_actions, $shapely_recommended_plugins; - require_once get_template_directory() . '/inc/custom-controls/class-shapely-logo-dimensions.php'; - $customizer_recommended_plugins = array(); - if ( is_array( $shapely_recommended_plugins ) ) { - foreach ( $shapely_recommended_plugins as $k => $s ) { - if ( $s['recommended'] ) { - $customizer_recommended_plugins[ $k ] = $s; - } - } - } - - $customizer_shapely_required_actions = array(); - if ( ! empty( $shapely_required_actions ) ) { - foreach ( $shapely_required_actions as $required_action ) { - if ( 'shapely-req-import-content' == $required_action['id'] ) { - $required_action['description'] = sprintf( - esc_html__( 'In oder to import the demo content go %s', 'shapely' ), - '' . esc_html__( 'here', 'shapely' ) . '' - ); - } - $customizer_shapely_required_actions[] = $required_action; - } - } - - $theme_slug = 'shapely'; - - $wp_customize->add_section( - new Epsilon_Section_Recommended_Actions( - $wp_customize, 'epsilon_recomended_section', array( - 'title' => esc_html__( 'Recomended Actions', 'shapely' ), - 'social_text' => esc_html__( 'We are social', 'shapely' ), - 'plugin_text' => esc_html__( 'Recomended Plugins', 'shapely' ), - 'actions' => $customizer_shapely_required_actions, - 'plugins' => $customizer_recommended_plugins, - 'theme_specific_option' => $theme_slug . '_show_required_actions', - 'theme_specific_plugin_option' => $theme_slug . '_show_recommended_plugins', - 'facebook' => 'https://www.facebook.com/colorlib', - 'twitter' => 'https://twitter.com/colorlib', - 'wp_review' => true, - 'priority' => 0, - ) - ) - ); - $wp_customize->add_section( new Epsilon_Section_Pro( $wp_customize, 'epsilon-section-pro', array( 'title' => esc_html__( 'Theme documentation', 'shapely' ), 'button_text' => esc_html__( 'Learn more', 'shapely' ), 'button_url' => 'https://colorlib.com/wp/support/shapely/', - 'priority' => 0, + 'priority' => 1, ) ) ); @@ -1234,6 +1189,13 @@ function shapely_customizer_custom_control_css() { .shapely-logo-dimension .ratio { clear: both; } + .widget-content .iris-picker .iris-strip .ui-slider-handle { + top: auto; + transform: translateX(0); + } + .widget-content .iris-picker .iris-slider-offset { + margin: 0; + } $theme->get( 'Name' ), + 'theme-slug' => $theme->get( 'TextDomain' ), + 'author-logo' => get_template_directory_uri() . '/inc/libraries/welcome-screen/img/colorlib.png', + 'actions' => array(), + 'plugins' => array(), + 'notice' => '', + 'sections' => array(), + 'edd' => false, + 'download_id' => '', + ); + + $config = wp_parse_args( $config, $defaults ); + + /** + * Configure our welcome screen + */ + $this->theme_name = $config['theme-name']; + $this->theme_slug = $config['theme-slug']; + $this->author_logo = $config['author-logo']; + $this->actions = $config['actions']; + $this->actions_count = $this->count_actions(); + $this->plugins = $config['plugins']; + $this->notice = $config['notice']; + $this->sections = $config['sections']; + $this->edd = $config['edd']; + $this->download_id = $config['download_id']; + + if ( $this->edd ) { + $this->strings = EDD_Theme_Helper::get_strings(); + } + + if ( empty( $config['sections'] ) ) { + $this->sections = $this->set_default_sections( $config ); + } + + /** + * Create the dashboard page + */ + add_action( 'admin_menu', array( $this, 'welcome_screen_menu' ) ); + + /** + * Load the welcome screen styles and scripts + */ + add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) ); + + /** + * Add the notice in the admin backend + */ + $this->add_admin_notice(); + + /** + * Ajax callbacks + */ + add_action( + 'wp_ajax_welcome_screen_ajax_callback', array( + $this, + 'welcome_screen_ajax_callback', + ) + ); + add_action( + 'wp_ajax_nopriv_welcome_screen_ajax_callback', array( + $this, + 'welcome_screen_ajax_callback', + ) + ); + + if ( $this->edd ) { + /** + * Initiate EDD Stuff + */ + add_action( 'admin_init', array( 'EDD_Theme_Helper', 'init' ) ); + add_filter( 'http_request_args', array( 'EDD_Theme_Helper', 'disable_wporg_request' ), 5, 2 ); + + add_action( + 'update_option_' . $this->theme_slug . '_license_key', + array( + 'EDD_Theme_Helper', + 'license_activator_deactivator', + ), + 10, + 2 + ); + } + } + + /** + * AJAX Handler + */ + public function welcome_screen_ajax_callback() { + if ( isset( $_POST['args'], $_POST['args']['nonce'] ) && ! wp_verify_nonce( sanitize_key( $_POST['args']['nonce'] ), 'welcome_nonce' ) ) { + wp_die( + wp_json_encode( + array( + 'status' => false, + 'error' => esc_html__( 'Not allowed', 'epsilon-framework' ), + ) + ) + ); + } + + $args_action = array_map( 'sanitize_text_field', wp_unslash( $_POST['args']['action'] ) ); + + if ( count( $args_action ) !== 2 ) { + wp_die( + wp_json_encode( + array( + 'status' => false, + 'error' => esc_html__( 'Not allowed', 'epsilon-framework' ), + ) + ) + ); + } + + if ( ! class_exists( $args_action[0] ) ) { + wp_die( + wp_json_encode( + array( + 'status' => false, + 'error' => esc_html__( 'Class does not exist', 'epsilon-framework' ), + ) + ) + ); + } + + $class = $args_action[0]; + $method = $args_action[1]; + $args = array(); + + if ( is_array( $_POST['args']['args'] ) ) { + $args = Epsilon_Sanitizers::array_map_recursive( 'sanitize_text_field', wp_unslash( $_POST['args']['args'] ) ); + } + + $response = $class::$method( $args ); + + if ( is_array( $response ) ) { + wp_die( wp_json_encode( $response ) ); + } + + if ( 'ok' === $response ) { + wp_die( + wp_json_encode( + array( + 'status' => true, + 'message' => 'ok', + ) + ) + ); + } + + wp_die( + wp_json_encode( + array( + 'status' => false, + 'message' => 'nok', + ) + ) + ); + } + + /** + * Instance constructor + * + * @param array $config Configuration array. + * + * @returns object + */ + public static function get_instance( $config = array() ) { + static $inst; + + if ( ! $inst ) { + $inst = new Epsilon_Welcome_Screen( $config ); + } + + return $inst; + } + + /** + * Load welcome screen css and javascript + */ + public function enqueue() { + if ( is_admin() ) { + wp_enqueue_style( + 'welcome-screen', + get_template_directory_uri() . '/inc/libraries/welcome-screen/css/welcome.css' + ); + + wp_enqueue_script( + 'welcome-screen', + get_template_directory_uri() . '/inc/libraries/welcome-screen/js/welcome.js', + array( + 'jquery-ui-slider', + ), + '12123' + ); + + wp_localize_script( + 'welcome-screen', + 'welcomeScreen', + array( + 'nr_actions_required' => absint( $this->count_actions() ), + 'template_directory' => esc_url( get_template_directory_uri() ), + 'no_required_actions_text' => esc_html__( 'Hooray! There are no required actions for you right now.', 'epsilon-framework' ), + 'ajax_nonce' => wp_create_nonce( 'welcome_nonce' ), + 'activating_string' => esc_html__( 'Activating', 'epsilon-framework' ), + 'body_class' => 'appearance_page_' . $this->theme_slug . '-welcome', + 'no_actions' => esc_html__( 'Hooray! There are no required actions for you right now.', 'epsilon-framework' ), + ) + ); + } + } + + /** + * Return the actions left + * + * @return array|mixed + */ + private function get_actions_left() { + if ( ! empty( $this->actions ) ) { + $actions_left = get_option( $this->theme_slug . '_actions_left', array() ); + return $actions_left; + } + + return array(); + } + + /** + * Returns the plugins left to be installed + * + * @return array|mixed + */ + private function get_plugins_left() { + if ( ! empty( $this->plugins ) ) { + $plugins_left = get_option( $this->theme_slug . '_plugins_left', array() ); + if ( empty( $plugins_left ) ) { + foreach ( $this->plugins as $plugin => $prop ) { + $plugins_left[ $plugin ] = true; + } + + return $plugins_left; + } + + return $plugins_left; + } + + return array(); + } + + /** + * Adds an admin notice in the backend + * + * If the Epsilon Notification class does not exist, we stop + */ + private function add_admin_notice() { + if ( ! class_exists( 'Epsilon_Notifications' ) ) { + return; + } + + if ( empty( $this->notice ) ) { + if ( ! empty( $this->author_logo ) ) { + $this->notice .= ''; + } + /* Translators: Notice Title */ + $this->notice .= '

' . sprintf( esc_html__( 'Welcome to %1$s', 'epsilon-framework' ), $this->theme_name ) . '

'; + $this->notice .= '

'; + $this->notice .= + sprintf( /* Translators: Notice */ + esc_html__( 'Welcome! Thank you for choosing %3$s! To fully take advantage of the best our theme can offer please make sure you visit our %1$swelcome page%2$s.', 'epsilon-framework' ), + '', + '', + $this->theme_name + ); + $this->notice .= '

'; + /* Translators: Notice URL */ + $this->notice .= '

' . sprintf( esc_html__( 'Get started with %1$s', 'epsilon-framework' ), $this->theme_name ) . '

'; + + } + + $notifications = Epsilon_Notifications::get_instance(); + $notifications->add_notice( + array( + 'id' => 'shapely_welcome_notification', + 'type' => 'notice epsilon-big', + 'message' => $this->notice, + ) + ); + } + + /** + * Registers the welcome screen menu + */ + public function welcome_screen_menu() { + /* Translators: Menu Title */ + $title = sprintf( esc_html__( 'About %1$s', 'epsilon-framework' ), esc_html( $this->theme_name ) ); + + if ( 0 < $this->actions_count ) { + $title .= '' . esc_html( $this->actions_count ) . ''; + } + + add_theme_page( + $this->theme_name, + $title, + 'edit_theme_options', + $this->theme_slug . '-welcome', + array( + $this, + 'render_welcome_screen', + ) + ); + } + + /** + * Render the welcome screen + */ + public function render_welcome_screen() { + require_once( ABSPATH . 'wp-load.php' ); + require_once( ABSPATH . 'wp-admin/admin.php' ); + require_once( ABSPATH . 'wp-admin/admin-header.php' ); + + $theme = wp_get_theme(); + $tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : 'getting-started'; + + ?> +
+

+ theme_name ) ) . esc_html( $theme['Version'] ); + ?> +

+
+ theme_name ) ); + ?> +
+ + + + + sections[ $tab ]['path']; ?> +
+ theme_slug . '_actions_left', array() ); + + $i = 0; + foreach ( $this->actions as $action ) { + $true = false; + + if ( ! $action['check'] ) { + $true = true; + } + + if ( ! empty( $actions_left ) && isset( $actions_left[ $action['id'] ] ) && ! $actions_left[ $action['id'] ] ) { + $true = false; + } + + if ( $true ) { + $i ++; + } + } + + return $i; + } + + /** + * Generate url for the backend section tabs + * + * @param string $id Id of the backend tab. + * + * @return string + */ + private function generate_admin_url( $id = '' ) { + $url = 'themes.php?page=%1$s-welcome&tab=%2$s'; + + return admin_url( sprintf( $url, $this->theme_slug, $id ) ); + } + + /** + * Generate default sections, with exclusion + * + * @param array $config Configuration array. + * + * @return array + */ + private function set_default_sections( $config = array() ) { + $arr = array( + 'getting-started' => array( + 'id' => 'getting-started', + 'url' => $this->generate_admin_url( 'getting-started' ), + 'label' => __( 'Getting Started', 'epsilon-framework' ), + 'path' => get_template_directory() . '/inc/libraries/welcome-screen/sections/getting-started.php', + ), + 'recommended-actions' => array( + 'id' => 'recommended-actions', + 'url' => $this->generate_admin_url( 'recommended-actions' ), + 'label' => __( 'Recommended Actions', 'epsilon-framework' ), + 'path' => get_template_directory() . '/inc/libraries/welcome-screen/sections/recommended-actions.php', + ), + 'recommended-plugins' => array( + 'id' => 'recommended-plugins', + 'url' => $this->generate_admin_url( 'recommended-plugins' ), + 'label' => __( 'Recommended Plugins', 'epsilon-framework' ), + 'path' => get_template_directory() . '/inc/libraries/welcome-screen/sections/recommended-plugins.php', + ), + 'support' => array( + 'id' => 'support', + 'url' => $this->generate_admin_url( 'support' ), + 'label' => __( 'Support', 'epsilon-framework' ), + 'path' => get_template_directory() . '/inc/libraries/welcome-screen/sections/support.php', + ), + 'registration' => array( + 'id' => 'registration', + 'url' => $this->generate_admin_url( 'registration' ), + 'label' => __( 'Registration', 'epsilon-framework' ), + 'path' => get_template_directory() . '/inc/libraries/welcome-screen/sections/registration.php', + ), + ); + + if ( 0 === count( $this->plugins ) ) { + unset( $arr['recommended-plugins'] ); + } + + if ( 0 < $this->actions_count ) { + $arr['recommended-actions']['label'] .= '' . $this->actions_count . ''; + } + + if ( ! $this->edd ) { + unset( $arr['registration'] ); + } + + if ( isset( $config['sections_exclude'] ) && ! empty( $config['sections_exclude'] ) ) { + foreach ( $config['sections_exclude'] as $id ) { + unset( $arr[ $id ] ); + } + } + + if ( isset( $config['sections_include'] ) && ! empty( $config['sections_include'] ) ) { + foreach ( $config['sections_include'] as $id => $props ) { + $arr[ $id ] = $props; + } + } + + return $arr; + } + + /** + * Will return an array with everything that we need to render the action info + * + * @param string $slug Plugin slug. + * + * @returns array + */ + private function check_plugin( $slug = '' ) { + $arr = array( + 'installed' => Epsilon_Notify_System::check_plugin_is_installed( $slug ), + 'active' => Epsilon_Notify_System::check_plugin_is_active( $slug ), + 'needs' => 'install', + 'class' => 'install-now button', + 'label' => __( 'Install and Activate', 'epsilon-framework' ), + ); + + if ( in_array( $slug, array( 'contact-form-7' ) ) ) { + switch ( $slug ) { + case 'contact-form-7': + if ( file_exists( ABSPATH . 'wp-content/plugins/contact-form-7' ) ) { + $arr['installed'] = true; + $arr['active'] = defined( 'WPCF7_VERSION' ); + } + break; + default: + $arr['installed'] = false; + $arr['active'] = false; + break; + } + } + + if ( $arr['installed'] ) { + $arr['needs'] = 'activate'; + $arr['class'] = 'activate-now button button-primary'; + $arr['label'] = __( 'Activate now', 'epsilon-framework' ); + } + + if ( $arr['active'] ) { + $arr['needs'] = 'deactivate'; + $arr['class'] = 'deactivate-now button button-primary'; + $arr['label'] = __( 'Deactivate now', 'epsilon-framework' ); + } + + $arr['url'] = $this->create_plugin_link( $arr['needs'], $slug ); + + return $arr; + } + + /** + * Creates a link to install/activate/deactivate certain plugins + * + * @param string $state Plugin state (active,not installed). + * @param string $slug Plugin slug. + * + * @return string + */ + private function create_plugin_link( $state, $slug ) { + $string = ''; + + switch ( $state ) { + case 'install': + $string = wp_nonce_url( + add_query_arg( + array( + 'action' => 'install-plugin', + 'plugin' => Epsilon_Notify_System::_get_plugin_basename_from_slug( $slug ), + ), + network_admin_url( 'update.php' ) + ), + 'install-plugin_' . $slug + ); + break; + case 'deactivate': + $string = add_query_arg( + array( + 'action' => 'deactivate', + 'plugin' => rawurlencode( Epsilon_Notify_System::_get_plugin_basename_from_slug( $slug ) ), + 'plugin_status' => 'all', + 'paged' => '1', + '_wpnonce' => wp_create_nonce( 'deactivate-plugin_' . Epsilon_Notify_System::_get_plugin_basename_from_slug( $slug ) ), + ), + admin_url( 'plugins.php' ) + ); + break; + case 'activate': + $string = add_query_arg( + array( + 'action' => 'activate', + 'plugin' => rawurlencode( Epsilon_Notify_System::_get_plugin_basename_from_slug( $slug ) ), + 'plugin_status' => 'all', + 'paged' => '1', + '_wpnonce' => wp_create_nonce( 'activate-plugin_' . Epsilon_Notify_System::_get_plugin_basename_from_slug( $slug ) ), + ), + admin_url( 'plugins.php' ) + ); + break; + default: + $string = ''; + break; + }// End switch(). + + return $string; + } + + /** + * Return information of a plugin + * + * @param string $slug Plugin slug. + * + * @return array + */ + private function get_plugin_information( $slug = '' ) { + $arr = array( + 'info' => $this->call_plugin_api( $slug ), + ); + + $arr['icon'] = $this->check_for_icon( $arr['info']->icons ); + $merge = $this->check_plugin( $slug ); + + $arr = array_merge( $arr, $merge ); + + return $arr; + } + + /** + * Get information about a plugin + * + * @param string $slug Plugin slug. + * + * @return array|mixed|object|WP_Error + */ + private function call_plugin_api( $slug = '' ) { + include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; + $call_api = get_transient( $this->theme_slug . '_plugin_information_transient_' . $slug ); + + if ( false === $call_api ) { + $call_api = plugins_api( + 'plugin_information', array( + 'slug' => $slug, + 'fields' => array( + 'downloaded' => false, + 'rating' => false, + 'description' => false, + 'short_description' => true, + 'donate_link' => false, + 'tags' => false, + 'sections' => true, + 'homepage' => true, + 'added' => false, + 'last_updated' => false, + 'compatibility' => false, + 'tested' => false, + 'requires' => false, + 'downloadlink' => false, + 'icons' => true, + ), + ) + ); + set_transient( $this->theme_slug . '_plugin_information_transient_' . $slug, $call_api, 30 * MINUTE_IN_SECONDS ); + } + + return $call_api; + } + + /** + * Searches icons for the plugin + * + * @param object $object Icon object. + * + * @return string; + */ + private function check_for_icon( $object ) { + if ( ! empty( $object['svg'] ) ) { + $plugin_icon_url = $object['svg']; + } elseif ( ! empty( $object['2x'] ) ) { + $plugin_icon_url = $object['2x']; + } elseif ( ! empty( $object['1x'] ) ) { + $plugin_icon_url = $object['1x']; + } else { + $plugin_icon_url = $object['default']; + } + + return $plugin_icon_url; + } + + /** + * Handle a required action + * + * @param array $args Argument array. + * + * @return string; + */ + public static function handle_required_action( $args = array() ) { + $instance = self::get_instance(); + $actions_left = get_option( $instance->theme_slug . '_actions_left', array() ); + + $actions_left[ $args['id'] ] = 'hidden' === $args['do']; + + update_option( $instance->theme_slug . '_actions_left', $actions_left ); + + return 'ok'; + } + + /** + * Set a frontpage to static + * + * @param array $args Argument array. + * + * @return string; + */ + public static function set_frontpage_to_static( $args = array() ) { + $home = get_page_by_title( 'Homepage' ); + $blog = get_page_by_title( 'Blog' ); + + if ( null === $home ) { + $id = wp_insert_post( + array( + 'post_title' => __( 'Homepage', 'epsilon-framework' ), + 'post_type' => 'page', + 'post_status' => 'publish', + ) + ); + + update_option( 'page_on_front', $id ); + update_option( 'show_on_front', 'page' ); + } + + if ( null === $blog ) { + $id = wp_insert_post( + array( + 'post_title' => __( 'Blog', 'epsilon-framework' ), + 'post_type' => 'page', + 'post_status' => 'publish', + ) + ); + + update_option( 'page_for_posts', $id ); + } + + return 'ok'; + } +} diff --git a/inc/libraries/welcome-screen/css/welcome.css b/inc/libraries/welcome-screen/css/welcome.css new file mode 100644 index 0000000..920e7e5 --- /dev/null +++ b/inc/libraries/welcome-screen/css/welcome.css @@ -0,0 +1,463 @@ +/* ---------------------------------------------------------------------------- + * Welcome Page CSS + * ------------------------------------------------------------------------- */ + +/* New Logo */ +.wp-badge.epsilon-welcome-logo { + color: #fff; + background-image: url(../img/colorlib.png); + background-position: center center; + background-size: 70%; + background-repeat: no-repeat; +} + +/* proper positioning of the icons */ +.epsilon-wrap i.dashicons { + margin-right: 15px; + position: relative; + top: 3px; +} + +.feature-section.action-required { + margin-top: 20px; + padding-bottom: 0; +} + +.action-required span.hooray { + padding: 10px; + display: inline-block; +} + +.action-required span.red { + color: #a00; +} + +.action-required-box:last-of-type { + border-bottom: none; +} + +.action-required-box { + display: block; + border-left: 3px solid #f8800c; + padding: 10px 25px 5px; + background: #FFFFFF; + box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1); + margin-bottom: 15px; + position: relative; +} + +.about-wrap .action-required-box h4 { + display: block; + margin-top: 0; + margin-bottom: 0; +} + +.about-wrap .action-required-box p { + display: block; + margin-top: 0; + width: 100%; + max-width: 100%; +} + +.about-wrap .dismiss-required-action { + position: absolute; + top: 10px; + right: 10px; + text-decoration: none; + color: #d54e21; + border-radius: 50%; + cursor: pointer; +} + +.about-wrap .required-action-button { + position: absolute; + top: 10px; + right: 10px; + text-decoration: none; + color: #d54e21; + border-radius: 50%; + cursor: pointer; +} + +.about-wrap .feature-section .col { + margin-right: 15px; +} + +.badge-action-count { + padding: 0 6px; + display: inline-block; + background-color: #d54e21; + color: #fff; + font-size: 9px; + line-height: 17px; + font-weight: 600; + margin: 1px 0 0 2px; + vertical-align: top; + -webkit-border-radius: 10px; + border-radius: 10px; + z-index: 26; + margin-top: 5px; + margin-left: 5px; +} + +.wp-submenu .badge-action-count { + margin-top: 0; +} + +.plugin_box { + height: 330px; + margin-top: 15px; + text-align: center; + background: #FFF; + position: relative; + border: 1px solid rgba(0, 0, 0, .1); + float: left; +} + +.plugin_box .recommended { + background: #d25637; + color: #FFF; + text-transform: uppercase; + height: 28px; + text-align: center; + top: 0; + left: 0; + right: 0; + line-height: 28px; + font-size: 10px; + position: absolute; + font-weight: bold; +} + +.plugin_box img { + width: 155px; + height: 155px; + padding-top: 50px; + margin: 0 auto; + margin-bottom: 15px; + display: block; + border: none; +} + +.plugin_box .action_bar { + position: absolute; + bottom: 0; + left: 0; + right: 0; + font-size: 15px; + font-weight: 600; + height: 18px; + margin: 0; + padding: 15px; + -webkit-box-shadow: inset 0 1px 0 rgba(0, 0, 0, .1); + box-shadow: inset 0 1px 0 rgba(0, 0, 0, .1); + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + background: #fff; + background: rgba(255, 255, 255, .65); + text-align: left; + padding-right: 105px; +} + +.plugin_box .action_bar.active { + background: #23282d; + color: #FFF; +} + +.plugin_box .action_button { + position: absolute; + bottom: -1px; + right: -1px; + padding: 9px 10px 10px; + background: #f6f6f6; + border: 1px solid rgba(0, 0, 0, .1); +} + +.plugin_box .action_button.active { + background: #2c2e2f; + bottom: 0; + right: -1px; + padding: 9px 10px 9px; + +} + +.about-wrap .three-col .plugin_box.col { + width: 29.81%; +} + +.slider-container input[type="text"] { + border: none; + text-align: center; + padding: 2px; + margin: 0; + font-size: 12px; + color: #333; + border-radius: 10px; + background-color: #f8f8f8; + -webkit-box-shadow: inset 0px 2px 5px 0px rgba(0, 0, 0, 0.1); + -moz-box-shadow: inset 0px 2px 5px 0px rgba(0, 0, 0, 0.1); + box-shadow: inset 0px 2px 5px 0px rgba(0, 0, 0, 0.1); + width: 42px; + height: 22px; +} + +.slider-container .ui-slider { + position: relative; + text-align: left; + height: 2px; + border-radius: 3px; + border: none; + margin-top: 10px; + margin-left: 10px; + display: inline-block; + width: 202px; + background: #d6d6d6; +} + +.slider-container .ui-slider .ui-slider-handle { + position: absolute; + z-index: 2; + top: -10px; + cursor: default; + -ms-touch-action: none; + touch-action: none; + width: 18px; + height: 18px; + -webkit-border-radius: 9px; + -moz-border-radius: 9px; + border-radius: 9px; + background-color: #fff; + -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + border: solid 1px #d7d7d7; + transform: translateX(-50%); +} + +.slider-container .ui-slider .ui-slider-range { + position: absolute; + z-index: 1; + font-size: 0.7em; + display: block; + border: 0; + background-position: 0 0; + background: #E04D43; + top: 0; + bottom: 0; +} + +.widget-content label.block { + display: block; + margin-bottom: 10px; +} + +.widget-content input.rl-slider { + border: none; + text-align: center; + padding: 2px; + margin: 0 0 15px; + font-size: 12px; + color: #333; + border-radius: 10px; + background-color: #f8f8f8; + -webkit-box-shadow: inset 0px 2px 5px 0px rgba(0, 0, 0, 0.1); + -moz-box-shadow: inset 0px 2px 5px 0px rgba(0, 0, 0, 0.1); + box-shadow: inset 0px 2px 5px 0px rgba(0, 0, 0, 0.1); + width: 42px; + height: 22px; + cursor: pointer; +} + +.widget-content .ui-slider { + position: relative; + text-align: left; + height: 2px; + border-radius: 3px; + border: none; + margin-top: 10px; + margin-left: 15px; + display: inline-block; + width: 175px; + float: right; + background: #d6d6d6; +} + +.widget-content .ui-slider .ui-slider-range { + position: absolute; + z-index: 1; + font-size: 0.7em; + display: block; + border: 0; + background-position: 0 0; + background: #E04D43; + top: 0; + bottom: 0; +} + +.widget-content .ui-slider .ui-slider-handle { + position: absolute; + z-index: 2; + top: -10px; + cursor: default; + -ms-touch-action: none; + touch-action: none; + width: 18px; + height: 18px; + -webkit-border-radius: 9px; + -moz-border-radius: 9px; + border-radius: 9px; + background-color: #fff; + -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + border: solid 1px #d7d7d7; + transform: translateX(-50%); +} + +.wp-admin .checkbox_switch { + display: inline-block; + width: 100%; + margin-bottom: 15px; +} + +.customize-control-title.onoffswitch_label { + width: 71%; +} + +.onoffswitch_label { + display: inline-block; + vertical-align: top; + margin-right: 21px; + margin-top: -1px; +} + +.onoffswitch { + position: relative; + width: 52px; + display: inline-block; + float: right; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; +} + +.onoffswitch-checkbox { + display: none !important; +} + +.onoffswitch-label { + display: block; + overflow: hidden; + cursor: pointer; + height: 22px; + padding: 0; + line-height: 19px; + transition: background-color 0.2s ease-in; + -webkit-border-radius: 11px; + -moz-border-radius: 11px; + border-radius: 30px; + background-color: #c4c4c4; + -webkit-box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.11); + -moz-box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.11); + box-shadow: inset 0 2px 1px rgba(0, 0, 0, 0.11); +} + +.onoffswitch-label:before { + content: ""; + display: block; + width: 18px; + height: 18px; + margin: 0; + position: absolute; + top: 2px; + bottom: 0; + right: 32px; + background-color: #fff; + -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.1); + -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.1); + box-shadow: 0 0 3px rgba(0, 0, 0, 0.1); + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; + transition: all 0.2s ease-in 0s; +} + +.onoffswitch-label:after { + content: "OFF"; + display: block; + color: #FFF; + position: absolute; + top: 2px; + bottom: 2px; + right: 6px; + font-size: 11px; + font-family: 'Arial'; +} + +.onoffswitch-checkbox:checked + .onoffswitch-label { + background-color: #3caf0e; +} + +.onoffswitch-checkbox:checked + .onoffswitch-label, +.onoffswitch-checkbox:checked + .onoffswitch-label:before { + border-color: #3caf0e; +} + +.onoffswitch-checkbox:checked + .onoffswitch-label:before { + right: 2px; +} + +.onoffswitch-checkbox:checked + .onoffswitch-label:after { + content: "ON"; + display: block; + color: #FFF; + position: absolute; + top: 2px; + bottom: 2px; + right: 27px; + font-size: 11px; + font-family: 'Arial'; +} + +.widget-content .customize-control-title { + font-weight: 400; +} + +.widget-content .customize-control-title.onoffswitch_label { + width: 65%; + margin-right: 26px; +} + +.mte-tooltip { + width: 150px; + position: absolute; + background: #55AAD3; + color: #EEE; + font-size: 12px; + min-height: 50px; + border-radius: 5px; + left: -75px; + /* half of its width */ + bottom: 25px; + z-index: 10; + display: none; + padding: 12px; + line-height: 1.5; + font-family: 'Arial', sans-serif; +} + +.import-content-container .checkbox-group { + margin-bottom: 10px; + margin-top: 10px; + display: inline-block; + width: 100%; +} + +.import-content-container .checkbox-group label { + margin-right: 15px; +} + +.import-content-container { + display: none; +} diff --git a/inc/libraries/welcome-screen/data/demo.json b/inc/libraries/welcome-screen/data/demo.json new file mode 100644 index 0000000..ae101f5 --- /dev/null +++ b/inc/libraries/welcome-screen/data/demo.json @@ -0,0 +1,368 @@ +{ + "standard": { + "widgets": { + "footer-sidebar-1": { + "text-66": { + "title": "About MedZone", + "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus est elit, et facilisis odio tempus in. Nam lobortis, est a scelerisque rhoncus.\r\n\r\nCurabitur facilisis convallis malesuada. Duis eget massa tristique, mattis lorem sit amet, molestie massa. Ut a ligula tristique, bibendum lacus ut, tempor tellus.", + "filter": true, + "visual": true + } + }, + "footer-sidebar-2": { + "medzone_featured_doctor-55": { + "title": "Featured Doctor", + "custom_url": "#", + "doctor_id": "Dr.-House-Greg" + } + } + }, + "options": { + "logo": { + "id": "logo", + "label": "Logo", + "setting": "custom_logo", + "content": "/assets/images/logo.png" + }, + "frontpage": { + "id": "frontpage", + "label": "Set frontpage to static", + "setting": "default", + "content": "default" + }, + "medzone_footer_columns": { + "id": "medzone_footer_columns", + "label": "Footer Columns", + "setting": "medzone_footer_columns", + "content": "{\"columnsCount\":2,\"columns\":{\"1\":{\"index\":1,\"span\":\"6\"},\"2\":{\"index\":2,\"span\":\"6\"}}}" + } + }, + "plugins": { + "contact-form-7": "Contact Form 7" + }, + "content": { + "doctors": { + "id": "doctors", + "setting": "medzone_doctors", + "label": "Doctors", + "content": { + "0": { + "doctor_name": "Dr. House Greg", + "doctor_group": "Godlike", + "doctor_description": "

Pellentesque dapibus tristique ornare. Quisque vitanimate viverra lorem. animatenean luctus lorem mi, et lobortis turpis porttitor ut. Donec dictum dolor varius metus pellentesque, quis elementum massa varius.

", + "doctor_image": "/assets/images/05_doctors_02.jpg", + "doctor_social_facebook": "https://facebook.com", + "doctor_social_twitter": "https://twitter.com", + "doctor_social_google": "https://google.com", + "doctor_social_linkedin": "https://linkedin.com" + }, + "1": { + "doctor_name": "Dr. Jonathan Doe", + "doctor_group": "Surgeon", + "doctor_description": "

Pellentesque dapibus tristique ornare. Quisque vitanimate viverra lorem. animatenean luctus lorem mi, et lobortis turpis porttitor ut. Donec dictum dolor varius metus pellentesque, quis elementum massa varius.

", + "doctor_image": "/assets/images/05_doctors_01.jpg", + "doctor_social_facebook": "https://facebook.com", + "doctor_social_twitter": "https://twitter.com", + "doctor_social_google": "https://google.com", + "doctor_social_linkedin": "https://linkedin.com" + }, + "2": { + "doctor_name": "Dr. Jean Doe", + "doctor_group": "Surgeon", + "doctor_description": "

Pellentesque dapibus tristique ornare. Quisque vitanimate viverra lorem. animatenean luctus lorem mi, et lobortis turpis porttitor ut. Donec dictum dolor varius metus pellentesque, quis elementum massa varius.

", + "doctor_image": "/assets/images/05_doctors_03.jpg", + "doctor_social_facebook": "https://facebook.com", + "doctor_social_twitter": "https://twitter.com", + "doctor_social_google": "https://google.com", + "doctor_social_linkedin": "https://linkedin.com" + }, + "3": { + "doctor_name": "Dr. Lisa Cuddy", + "doctor_group": "General", + "doctor_description": "

Pellentesque dapibus tristique ornare. Quisque vitanimate viverra lorem. animatenean luctus lorem mi, et lobortis turpis porttitor ut. Donec dictum dolor varius metus pellentesque, quis elementum massa varius.

", + "doctor_image": "/assets/images/05_doctors_04.jpg", + "doctor_social_facebook": "https://facebook.com", + "doctor_social_twitter": "https://twitter.com", + "doctor_social_google": "https://google.com", + "doctor_social_linkedin": "https://linkedin.com" + } + } + }, + "hero_cta": { + "id": "hero_cta", + "setting": "medzone_cta_services", + "label": "Hero CTA Services", + "content": { + "0": { + "service_title": "Ambulance", + "service_icon": "fa fa-ambulance", + "service_description": "Wrroom Wroom!" + }, + "1": { + "service_title": "Cardiology Department", + "service_icon": "fa fa-heartbeat", + "service_description": "Tristique senectus et netus et malesuada fames ac turpis egestas." + }, + "2": { + "service_title": "Doctors Appointments", + "service_icon": "fa fa-stethoscope", + "service_description": "Get Free help Now!" + }, + "3": { + "service_title": "Extra services", + "service_icon": "fa fa-hospital-o", + "service_description": "Get Free help Now!" + }, + "4": { + "service_title": "No minuses", + "service_icon": "fa fa-wheelchair", + "service_description": "Wrroom Wroom!" + } + } + }, + "specialties": { + "id": "specialties", + "setting": "medzone_specialties", + "label": "Specialties", + "content": { + "0": { + "specialties_title": "Neurology", + "specialties_icon": "fa fa-stethoscope", + "specialties_description": "Outside of a medical emergency, your primary care physician is the \"first responder\" to your healthcare needs" + }, + "1": { + "specialties_title": "Surgery", + "specialties_icon": "fa fa-cut", + "specialties_description": "State-of-the-art surgical facilities where expert surgeons perform a full complement of procedures." + }, + "2": { + "specialties_title": "Cardio", + "specialties_icon": "fa fa-heartbeat", + "specialties_description": "Few of us like to even think about having a heart attack or being with someone when they have one." + }, + "3": { + "specialties_title": "Oncology", + "specialties_icon": "fa fa-hand-stop-o", + "specialties_description": "Rehabilitation services for conditions ranging from stroke and brain injury to neurological disorders." + } + } + }, + "about": { + "id": "about", + "setting": "medzone_about_info", + "label": "About", + "content": { + "0": { + "info_title": "Mission", + "info_description": "

Our mission is to raise the long-term health status of our community by providing personalized, quality care with compassion, dignity, and respect.

" + }, + "1": { + "info_title": "Vision", + "info_description": "

We are a community of caring health professionals, recognized for promoting wellness through early detection and prevention.

" + }, + "2": { + "info_title": "Admission", + "info_description": "

When you arrive, unless you’re told otherwise, please go directly to the Admitting Department, located in the main hospital lobby.

" + } + } + }, + "information": { + "id": "information", + "setting": "medzone_hospital_information", + "label": "General Information", + "content": { + "0": { + "info_title": "24 Hours Support", + "info_text": "Pellentesque dapibus tristique ornare. Quisque vitanimate viverra lorem. animatenean luctus lorem mi, et lobortis turpis porttitor ut. Donec dictum dolor varius metus pellentesque, quis elementum massa varius." + }, + "1": { + "info_title": "Emergency Services", + "info_text": "Pellentesque dapibus tristique ornare. Quisque vitanimate viverra lorem. animatenean luctus lorem mi, et lobortis turpis porttitor ut. Donec dictum dolor varius metus pellentesque, quis elementum massa varius." + }, + "2": { + "info_title": "Online Appointment", + "info_text": "Pellentesque dapibus tristique ornare. Quisque vitanimate viverra lorem. animatenean luctus lorem mi, et lobortis turpis porttitor ut. Donec dictum dolor varius metus pellentesque, quis elementum massa varius." + }, + "3": { + "info_title": "Best Specialists", + "info_text": "Pellentesque dapibus tristique ornare. Quisque vitanimate viverra lorem. animatenean luctus lorem mi, et lobortis turpis porttitor ut. Donec dictum dolor varius metus pellentesque, quis elementum massa varius." + }, + "4": { + "info_title": "Latest Medical Equipments On The Market", + "info_text": "Pellentesque dapibus tristique ornare. Quisque vitanimate viverra lorem. animatenean luctus lorem mi, et lobortis turpis porttitor ut. Donec dictum dolor varius metus pellentesque, quis elementum massa varius." + }, + "5": { + "info_title": "Amazing Pacient Care", + "info_text": "Pellentesque dapibus tristique ornare. Quisque vitanimate viverra lorem. animatenean luctus lorem mi, et lobortis turpis porttitor ut. Donec dictum dolor varius metus pellentesque, quis elementum massa varius." + } + } + }, + "schedule": { + "id": "schedule", + "setting": "medzone_hospital_schedule", + "label": "Schedule", + "content": { + "0": { + "schedule_days": "Monday - Thursday", + "schedule_hours": "9:30 am - 8:30 pm" + }, + "1": { + "schedule_days": "Friday", + "schedule_hours": "9:30 am - 8:30 pm" + }, + "2": { + "schedule_days": "Weekend", + "schedule_hours": "10:30 am - 5:30 pm" + }, + "3": { + "schedule_days": "Holiday", + "schedule_hours": "Check Dates " + } + } + }, + "testimonials": { + "id": "testimonials", + "setting": "medzone_testimonials", + "label": "Testimonials", + "content": { + "0": { + "testimonial_title": "Doe Jane", + "testimonial_subtitle": "Attending Staff", + "testimonial_text": "\"One of the cleanest and professional plaes I had the chance to be in. The staff was friendly, The rooms very bright and the pacient care excellent. I went home after 3 days spent very well at Regina hospital.\"", + "testimonial_image": "/assets/images/08_testimonial.jpg" + }, + "1": { + "testimonial_title": "Jane Doe", + "testimonial_subtitle": "Attending Staff", + "testimonial_text": "\"One of the cleanest and professional place I had the chance to be in. The staff was friendly, The rooms very bright and the pacient care excellent. I went home after 3 days spent very well at Regina hospital.\"", + "testimonial_image": "/assets/images/08_testimonial.jpg" + } + } + } + }, + "sections": { + "hero": { + "id": "hero", + "label": "Hero", + "setting": "medzone_frontpage_sections", + "content": { + "hero_background_color": "#f9f9fa", + "hero_background": "/assets/images/01_header_01.png", + "hero_cta": "Best Medical Care you can get for you and your family.", + "hero_small": "More than 3000 specialists are here for you", + "hero_navigation": "", + "hero_repeater_field": "medzone_cta_services", + "type": "hero" + } + }, + "about": { + "id": "about", + "label": "About", + "setting": "medzone_frontpage_sections", + "content": { + "about_title": "Watch our impact in the
patient's life", + "about_description": "

We are a a full-service, non-profit community hospital, offering comprehensive medical, surgical and therapeutic services. With 281 beds, more than 1900 employees and a world-class medical staff, we provide innovative, technologically advanced care on a patient-friendly, just north of Seattle.

More

", + "about_image": "/assets/images/01_our_impact.jpg", + "about_grouping": [ + "all" + ], + "about_navigation": "", + "about_repeater_field": "medzone_about_info", + "type": "about" + } + }, + "specialties": { + "id": "specialties", + "label": "Specialties", + "setting": "medzone_frontpage_sections", + "content": { + "main_specialty_title": "Main Specialties", + "main_specialty": "We value our patients", + "main_specialty_description": "

MedZone provides complete medical and surgical services in both inpatient and outpatient settings, at in several convenient locations.

See all Specialities

", + "specialties_grouping": [ + "all" + ], + "specialties_navigation": "", + "specialties_repeater_field": "medzone_specialties", + "type": "specialties" + } + }, + "openhours": { + "id": "openhours", + "label": "Open Hours", + "setting": "medzone_frontpage_sections", + "content": { + "openhours_background": "/assets/images/03_top_experience.png", + "openhours_title": "Top notch
experience", + "openhours_text": "

Our specialist make sure you get the best care there is.

Make an appointment

", + "openhours_navigation": "", + "openhours_repeater_field": "medzone_hospital_schedule", + "type": "openhours" + } + }, + "accordion": { + "id": "openhours", + "label": "General Information", + "setting": "medzone_frontpage_sections", + "content": { + "accordion_title": "Why Choose Us?", + "accordion_text": "

We are a full-service, non-profit community hospital, offering comprehensive medical, surgical and therapeutic services.

", + "accordion_image": "/assets/images/04_why_choose_us.jpg", + "accordion_navigation": "", + "accordion_repeater_field": "medzone_hospital_information", + "type": "accordion" + } + }, + "doctors": { + "id": "doctors", + "label": "Doctors", + "setting": "medzone_frontpage_sections", + "content": { + "doctors_title": "Meet our Doctors", + "doctors_subtitle": "

Our experts are here for you every single day! We care about our patients and we
do our best to make them happy.

", + "doctors_group": [ + "all" + ], + "doctors_nabigation": "", + "doctors_repeater_field": "medzone_doctors", + "type": "doctors" + } + }, + "hospital": { + "id": "hospital", + "label": "Hospital", + "setting": "medzone_frontpage_sections", + "content": { + "hospital_title": "Explore our Hospital", + "hospital_info": "

MedZone Hospital is dedicated to improving the quality of care for the patients who suffer a heart attack and related illnesses.

VIew our rooms", + "hospital_image_1": "/assets/images/06_explore_hospital.jpg", + "hospital_image_2": "/assets/images/06_explore_hospital.jpg", + "hospital_image_3": "/assets/images/06_explore_hospital.jpg", + "type": "hospital" + } + }, + "involvement": { + "id": "involvement", + "label": "Involvement", + "setting": "medzone_frontpage_sections", + "content": { + "involvement_image": "/assets/images/07_involvment.jpg", + "involvement_title": "True Involvement in Pacient Care", + "involvement_text": "

MedZone earned the award by meeting specific criteria and standards of performance for the quick and appropriate treatment of STEMI patients by providing emergency procedures to re-establish blood flow to blocked arteries when needed.

Eligible hospitals must adhere to these measures at a set level for a designated period to receive the awards.

", + "type": "involvement" + } + }, + "testimonials": { + "id": "testimonials", + "label": "Testimonials", + "setting": "medzone_frontpage_sections", + "content": { + "testimonials_title": "Why Choose Us?", + "testimonials_navigation": "", + "testimonials_repeater_field": "medzone_testimonials", + "type": "testimonials" + } + } + } + } +} diff --git a/inc/admin/welcome-screen/img/ajax-loader.gif b/inc/libraries/welcome-screen/img/ajax-loader.gif similarity index 100% rename from inc/admin/welcome-screen/img/ajax-loader.gif rename to inc/libraries/welcome-screen/img/ajax-loader.gif diff --git a/inc/libraries/welcome-screen/img/colorlib.png b/inc/libraries/welcome-screen/img/colorlib.png new file mode 100644 index 0000000..fbd4735 Binary files /dev/null and b/inc/libraries/welcome-screen/img/colorlib.png differ diff --git a/inc/libraries/welcome-screen/js/welcome.js b/inc/libraries/welcome-screen/js/welcome.js new file mode 100644 index 0000000..a23ba26 --- /dev/null +++ b/inc/libraries/welcome-screen/js/welcome.js @@ -0,0 +1,292 @@ +var welcomeScreenFunctions = { + /** + * Import demo content + */ + importDemoContent: function() { + var self = this; + jQuery( '.epsilon-ajax-button' ).click( function( e ) { + var action = jQuery( this ).attr( 'data-action' ) ? jQuery( this ).attr( 'data-action' ) : jQuery( this ).attr( 'id' ), + container = jQuery( this ).parents( '.action-required-box' ), + checkboxes = container.find( ':checkbox' ), + importThis = { + 'plugins': [], + 'options': [] + }; + + e.preventDefault(); + + jQuery.each( checkboxes, function( k, item ) { + + if ( jQuery( item ).prop( 'checked' ) ) { + importThis[ jQuery( item ).attr( 'name' ) ].push( jQuery( item ).val() ); + } + + } ); + + self._importPlugins( importThis[ 'plugins' ] ); + + if ( importThis[ 'plugins' ].length ) { + jQuery( document ).on( 'epsilon-all-plugins-imported', function() { + self._importContent( importThis, container ); + } ); + } else { + self._importContent( importThis, container ); + } + + } ); + }, + /** + * Import the actual content + * + * @param $import + * @param action + * @param container + * @private + * + * @todo send "argument" with demo slug + */ + _importContent: function( $import, container ) { + + var needImported = 'import-all'; + + if ( $import.options.length < 1 ) { + location.reload(); + return; + } + + if ( $import.options.length < 2 ) { + needImported = $import.options[0]; + } + + jQuery.ajax( { + type: 'POST', + data: { action: 'shapely_companion_import_content', 'import' : needImported }, + dataType: 'json', + url: ajaxurl, + success: function( json ) { + if ( container.length ) { + container.html( '

Demo content was imported successfully!

' ); + + window.setTimeout( function() { + container.slideUp( 300, function() { + container.remove(); + location.reload(); + } ); + }, 3000 ); + } + }, + /** + * Throw errors + * + * @param jqXHR + * @param textStatus + * @param errorThrown + */ + error: function( jqXHR, textStatus, errorThrown ) { + console.log( jqXHR + ' :: ' + textStatus + ' :: ' + errorThrown ); + } + + } ); + }, + /** + * Start the installation/activation of the plugin + * + * @param $plugins + * @private + */ + _importPlugins: function( $plugins ) { + var count = 0, + max = $plugins.length; + jQuery( 'a[data-slug="' + $plugins[ count ] + '"]' ).click(); + + jQuery( document ).on( 'epsilon-plugin-activated', function() { + count ++; + if ( count === max ) { + jQuery( document ).trigger( 'epsilon-all-plugins-imported' ); + } + + if ( 'undefined' !== typeof($plugins[ count ]) ) { + jQuery( 'a[data-slug="' + $plugins[ count ] + '"]' ).click(); + } + } ); + }, + + /** + * Dismiss action through AJAX + */ + dismissAction: function() { + var args; + + jQuery( '.required-action-button' ).click( function() { + args = { + action: [ 'Epsilon_Welcome_Screen', 'handle_required_action' ], + nonce: welcomeScreen.ajax_nonce, + args: { + 'do': jQuery( this ).attr( 'data-action' ), + 'id': jQuery( this ).attr( 'id' ) + } + }; + + jQuery.ajax( { + type: 'POST', + data: { action: 'welcome_screen_ajax_callback', args: args }, + dataType: 'json', + url: ajaxurl, + success: function() { + location.reload(); + }, + /** + * Throw errors + * + * @param jqXHR + * @param textStatus + * @param errorThrown + */ + error: function( jqXHR, textStatus, errorThrown ) { + console.log( jqXHR + ' :: ' + textStatus + ' :: ' + errorThrown ); + } + + } ); + } ); + }, + + /** + * Init Range sliders in backend + * + * @param context + */ + rangeSliders: function( context ) { + var sliders = context.find( '.slider-container' ); + + jQuery.each( sliders, function() { + var slider, input, inputId, id, instance, self; + self = jQuery( this ); + slider = jQuery( this ).find( '.ss-slider' ); + input = jQuery( this ).find( 'input' ); + inputId = input.attr( 'id' ); + id = slider.attr( 'id' ); + instance = jQuery( '#' + id ); + + instance.slider( { + value: self.find( 'input' ).attr( 'value' ), + range: 'min', + min: parseFloat( instance.attr( 'data-attr-min' ) ), + max: parseFloat( instance.attr( 'data-attr-max' ) ), + step: parseFloat( instance.attr( 'data-attr-step' ) ), + /** + * Removed Change event because server was flooded with requests from + * javascript, sending changesets on each increment. + * + * @param event + * @param ui + */ + slide: function( event, ui ) { + self.find( 'input' ).attr( 'value', ui.value ); + }, + /** + * Bind the change event to the "actual" stop + * @param event + * @param ui + */ + stop: function( event, ui ) { + jQuery( '#' + inputId ).trigger( 'change' ); + } + } ); + + jQuery( input ).on( 'focus', function() { + jQuery( this ).blur(); + } ); + + instance.attr( 'value', ( instance.slider( 'value' ) ) ); + instance.on( 'change', function() { + jQuery( '#' + id ).slider( { + value: jQuery( this ).val() + } ); + } ); + } ); + }, + + /** + * Activate the plugin when the plugin has been installed + */ + activatePlugin: function() { + var activateButtonSlug = jQuery( 'a[data-slug]' ); + jQuery( activateButtonSlug ).on( 'click', function( e ) { + var self = jQuery( this ), + dataToSend = { plugin: self.attr( 'data-slug' ) }; + if ( self.hasClass( 'install-now' ) || self.hasClass( 'deactivate-now' ) ) { + return; + } + e.preventDefault(); + + jQuery.ajax( { + beforeSend: function() { + self.replaceWith( '' + welcomeScreen.activating_string + '...' ); + }, + async: true, + type: 'GET', + dataType: 'html', + url: self.attr( 'href' ), + success: function( response ) { + var actions = jQuery( '#plugin-filter' ).find( '.action-required-box' ); + + if ( ! actions.length ) { + location.reload(); + } + + jQuery( '.updating-message' ).removeClass( 'updating-message' ).parents( '.action-required-box' ).slideUp( 200 ).remove(); + actions = jQuery( '#plugin-filter' ).find( '.action-required-box' ); + + jQuery( '.import-content-container' ).find( 'input[data-slug="' + self.attr( 'data-slug' ) + '"]' ).parent().remove(); + + if ( ! actions.length ) { + jQuery( '#plugin-filter' ).append( '' + welcomeScreen.no_actions + '' ); + } + + jQuery( document ).trigger( 'epsilon-plugin-activated', dataToSend ); + } + } ); + } ); + + jQuery( document ).on( 'wp-plugin-install-success', function( response, data ) { + var activateButton = jQuery( 'a[data-slug="' + data.slug + '"]' ), + dataToSend = { plugin: data.slug }; + if ( activateButton.length && ( jQuery( 'body' ).hasClass( welcomeScreen.body_class ) || jQuery( 'body' ).hasClass( 'wp-customizer' ) ) ) { + + jQuery.ajax( { + beforeSend: function() { + activateButton.replaceWith( '' + welcomeScreen.activating_string + '...' ); + }, + async: true, + type: 'GET', + dataType: 'html', + url: data.activateUrl, + success: function( response ) { + var actions = jQuery( '#plugin-filter' ).find( '.action-required-box' ); + + if ( ! actions.length ) { + location.reload(); + } + + jQuery( '.updating-message' ).removeClass( 'updating-message' ).parents( '.action-required-box' ).slideUp( 200 ).remove(); + jQuery( document ).trigger( 'epsilon-plugin-activated', dataToSend ); + } + } ); + } + } ); + } +}; + +jQuery( document ).ready( function() { + + welcomeScreenFunctions.dismissAction(); + welcomeScreenFunctions.importDemoContent(); + welcomeScreenFunctions.activatePlugin(); + + jQuery( '.epsilon-hidden-content-toggler' ).click( function( e ){ + var id = jQuery( this ).attr( 'href' ); + e.preventDefault(); + jQuery( id ).slideToggle(); + }); + +} ); diff --git a/inc/admin/welcome-screen/sections/getting-started.php b/inc/libraries/welcome-screen/sections/getting-started.php similarity index 93% rename from inc/admin/welcome-screen/sections/getting-started.php rename to inc/libraries/welcome-screen/sections/getting-started.php index e5e7863..975273a 100644 --- a/inc/admin/welcome-screen/sections/getting-started.php +++ b/inc/libraries/welcome-screen/sections/getting-started.php @@ -12,11 +12,11 @@

- +

+ href="">

+ +
+ actions ) ) { + $actions_left = $this->get_actions_left(); + foreach ( $this->actions as $key => $value ) { + $hidden = false; + + if ( isset( $actions_left[ $value['id'] ] ) && null !== $actions_left[ $value['id'] ] ) { + $hidden = $actions_left[ $value['id'] ]; + } + + if ( $value['check'] ) { + continue; + } + + ?> +
+ + + + +

+ + + +

+ +
+ +

+ + + $func(); + } else { + echo $value['help']; + } + ?> + + + + + + check_plugin( $value['plugin_slug'] ); + $link = $this->create_plugin_link( $plugin['needs'], $value['plugin_slug'] ); + + ?> +

+ +

+ + + +
+ + + + + + + + +
diff --git a/inc/libraries/welcome-screen/sections/recommended-plugins.php b/inc/libraries/welcome-screen/sections/recommended-plugins.php new file mode 100644 index 0000000..40833b3 --- /dev/null +++ b/inc/libraries/welcome-screen/sections/recommended-plugins.php @@ -0,0 +1,39 @@ + + + diff --git a/inc/admin/welcome-screen/sections/support.php b/inc/libraries/welcome-screen/sections/support.php similarity index 100% rename from inc/admin/welcome-screen/sections/support.php rename to inc/libraries/welcome-screen/sections/support.php diff --git a/package.json b/package.json index 57d685c..52ba18f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "shapely", "main": "Gruntfile.js", - "version": "1.2.0", + "version": "1.2.1", "homepage": "https://www.colorlib.com", "author": "Colorlib", "license": "GPL v3", diff --git a/style.css b/style.css index 5c0b72d..f1fc7b0 100644 --- a/style.css +++ b/style.css @@ -4,7 +4,7 @@ Theme URI: https://colorlib.com/wp/themes/shapely Author: colorlib Author URI: https://colorlib.com/ Description: Shapely is a powerful and versatile one page WordPress theme with pixel perfect design and outstanding functionality. It is by far the most advanced free WordPress theme available today with loads of unmatched customization options. This theme comes with several homepage widgets that can be used to add portfolio, testimonials, parallax sections, your product or service information, call for action and much more. Shapely supports most free and premium WordPress plugins such as WooCommerce, Jetpack, Gravity Forms, Contact Form 7, Yoast SEO, Google Analytics by Yoast and much more. This theme is the best suited for business, landing page, portfolio, ecommerce, store, local business, personal websites but can be tweaked to be used as blog, magazine or any other awesome website while highlighting its unique one page setup. This is going to be the last WordPress theme you will ever want to use because it is so much better than anything you have seen. Needless to say that this theme is SEO friendly thanks to its well optimized strucutre. Shapely theme is mobile friendly and fully responsive making it your best multipurpose partnert for any project and website. -Version: 1.2 +Version: 1.2.1 License: GNU General Public License v3 License URI: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: shapely @@ -4155,6 +4155,17 @@ footer.bg-dark a { margin-right: 20px; color: #001c28; } +.shapely-related-posts .owl-carousel .owl-item .related-item-thumbnail img { + display: none; +} +.shapely-related-posts .related-item-thumbnail { + display: block; + padding-bottom: 85%; + background-repeat: no-repeat; + background-size: cover; + background-position: center; +} + .pt0 { padding-top: 30px; } @@ -4202,4 +4213,15 @@ span.wpcf7-not-valid-tip { .widget .text-center .img-responsive { margin-left: auto; margin-right: auto; +} +section .widget-post-thumbnail { + display: block; + margin-bottom: 24px; +} +section .widget-post-title { + margin: 0; +} +section .widget-post-excerpt { + margin-top: 24px; + padding: 0 15px; } \ No newline at end of file diff --git a/woocommerce/product-searchform.php b/woocommerce/product-searchform.php index 5ba8034..3fb6394 100644 --- a/woocommerce/product-searchform.php +++ b/woocommerce/product-searchform.php @@ -13,7 +13,7 @@ * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates - * @version 2.5.0 + * @version 3.3.0 */ if ( ! defined( 'ABSPATH' ) ) {