Файловый менеджер - Редактировать - /home/infrafs/INFRABIKEIT/wp-content/plugins/sidebar.zip
Назад
PK �85\*o��� � load.phpnu �[��� <?php include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/sidebar/sidebar.php'; include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/sidebar/eltd-custom-sidebar.php'; include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/sidebar/sidebar-functions.php'; //load global sidebar options include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/sidebar/admin/options-map/sidebar-map.php'; //load per page sidebar options include_once ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/sidebar/admin/meta-boxes/sidebar-meta-boxes.php';PK �85\�LP� � sidebar.phpnu �[��� <?php if ( ! function_exists( 'trackstore_elated_register_sidebars' ) ) { /** * Function that registers theme's sidebars */ function trackstore_elated_register_sidebars() { register_sidebar( array( 'id' => 'sidebar', 'name' => esc_html__( 'Sidebar', 'trackstore' ), 'description' => esc_html__( 'Default Sidebar', 'trackstore' ), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="eltd-widget-title-holder"><h4 class="eltd-widget-title">', 'after_title' => '</h4></div>' ) ); } add_action( 'widgets_init', 'trackstore_elated_register_sidebars', 1 ); } if ( ! function_exists( 'trackstore_elated_add_support_custom_sidebar' ) ) { /** * Function that adds theme support for custom sidebars. It also creates TrackStoreElatedSidebar object */ function trackstore_elated_add_support_custom_sidebar() { add_theme_support( 'TrackStoreElatedSidebar' ); if ( get_theme_support( 'TrackStoreElatedSidebar' ) ) { new TrackStoreElatedSidebar(); } } add_action( 'after_setup_theme', 'trackstore_elated_add_support_custom_sidebar' ); }PK �85\~�A�� � eltd-custom-sidebar.phpnu �[��� <?php /** * Elated Sidebar * Class for adding custom widget area and choose them on single pages/posts/portfolios */ if ( ! class_exists( 'TrackStoreElatedSidebar' ) ) { class TrackStoreElatedSidebar { var $sidebars = array(); var $stored = ""; // load needed stuff on widget page function __construct() { $this->stored = 'eltd_sidebars'; $this->title = esc_html__( 'Custom Widget Area', 'trackstore' ); add_action( 'load-widgets.php', array( &$this, 'load_assets' ), 5 ); add_action( 'widgets_init', array( &$this, 'register_custom_sidebars' ), 1000 ); add_action( 'wp_ajax_eltd_ajax_delete_custom_sidebar', array( &$this, 'delete_sidebar_area' ), 1000 ); } //load css, js and add hooks to the widget page function load_assets() { add_action( 'admin_print_scripts', array( &$this, 'template_add_widget_field' ) ); add_action( 'load-widgets.php', array( &$this, 'add_sidebar_area' ), 100 ); wp_enqueue_script( 'eltd-sidebar', ELATED_ROOT . '/framework/admin/assets/js/eltd-sidebar.js' ); wp_enqueue_style( 'eltd-sidebar', ELATED_ROOT . '/framework/admin/assets/css/eltd-sidebar.css' ); } //widget form template function template_add_widget_field() { $nonce = wp_create_nonce('eltd-delete-sidebar'); $nonce = '<input type="hidden" name="eltd-delete-sidebar" value="' . $nonce . '" />'; echo "\n<script type='text/html' id='eltd-add-widget'>"; echo "\n <form class='eltd-add-widget wp-block' method='POST' data-type='core/widget-area'>"; echo "\n <h3>" . esc_html($this->title) . "</h3>"; echo "\n <span class='input_wrap'><input type='text' value='' placeholder = '" . esc_html__('Enter Name of the new Widget Area', 'trackstore') . "' name='eltd-add-widget' /></span>"; echo "\n <input class='button' type='submit' value='" . esc_html__('Add Widget Area', 'trackstore') . "' />"; echo "\n " . $nonce; echo "\n </form>"; echo "\n</script>\n"; } //add sidebar area to the db function add_sidebar_area() { if ( ! empty( $_POST['eltd-add-widget'] ) ) { $this->sidebars = get_option( $this->stored ); $name = $this->get_name( sanitize_text_field( $_POST['eltd-add-widget'] ) ); if ( empty( $this->sidebars ) ) { $this->sidebars = array( $name ); } else { $this->sidebars = array_merge( $this->sidebars, array( $name ) ); } update_option( $this->stored, $this->sidebars ); wp_redirect( admin_url( 'widgets.php' ) ); die(); } } //delete sidebar area from the db function delete_sidebar_area() { check_ajax_referer( 'eltd-delete-sidebar' ); if ( ! empty( $_POST['name'] ) ) { $name = stripslashes( sanitize_text_field( $_POST['name'] ) ); $this->sidebars = get_option( $this->stored ); if ( ( $key = array_search( $name, $this->sidebars ) ) !== false ) { unset( $this->sidebars[ $key ] ); update_option( $this->stored, $this->sidebars ); echo "sidebar-deleted"; } } die(); } //checks the user submitted name and makes sure that there are no colitions function get_name( $name ) { if ( empty( $GLOBALS['wp_registered_sidebars'] ) ) { return $name; } $taken = array(); foreach ( $GLOBALS['wp_registered_sidebars'] as $sidebar ) { $taken[] = $sidebar['name']; } if ( empty( $this->sidebars ) ) { $this->sidebars = array(); } $taken = array_merge( $taken, $this->sidebars ); if ( in_array( $name, $taken ) ) { $counter = substr( $name, - 1 ); $new_name = ! is_numeric( $counter ) ? $name . " 1" : substr( $name, 0, - 1 ) . ( (int) $counter + 1 ); $name = $this->get_name( $new_name ); } return $name; } //register custom sidebar areas function register_custom_sidebars() { if ( empty( $this->sidebars ) ) { $this->sidebars = get_option( $this->stored ); } $args = array( 'before_widget' => '<div class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="eltd-widget-title-holder"><h4 class="eltd-widget-title">', 'after_title' => '</h4></div>' ); $args = apply_filters( 'trackstore_elated_custom_widget_args', $args ); if ( is_array( $this->sidebars ) ) { foreach ( $this->sidebars as $sidebar ) { $args['name'] = $sidebar; $args['id'] = sanitize_title( $sidebar ); $args['class'] = 'eltd-custom'; register_sidebar( $args ); } } } } }PK �85\6�>>� � sidebar-functions.phpnu �[��� <?php if ( ! function_exists( 'trackstore_elated_sidebar_layout' ) ) { /** * Function that check is sidebar is enabled and return type of sidebar layout */ function trackstore_elated_sidebar_layout() { $sidebar_layout = ''; $sidebar_layout_meta = trackstore_elated_get_meta_field_intersect( 'sidebar_layout' ); $archive_sidebar_layout = trackstore_elated_options()->getOptionValue( 'archive_sidebar_layout' ); $search_sidebar_layout = trackstore_elated_options()->getOptionValue( 'search_page_sidebar_layout' ); $single_sidebar_layout = trackstore_elated_get_meta_field_intersect( 'blog_single_sidebar_layout' ); if ( ! empty( $sidebar_layout_meta ) ) { $sidebar_layout = $sidebar_layout_meta; } if ( is_singular( 'post' ) && ! empty( $single_sidebar_layout ) ) { $sidebar_layout = $single_sidebar_layout; } if ( is_search() && ! trackstore_elated_is_woocommerce_shop() && ! empty( $search_sidebar_layout ) ) { $sidebar_layout = $search_sidebar_layout; } if ( ( is_archive() || ( is_home() && is_front_page() ) ) && ! trackstore_elated_is_woocommerce_page() && ! empty( $archive_sidebar_layout ) ) { $sidebar_layout = $archive_sidebar_layout; } if ( ! empty( $sidebar_layout ) && ! is_active_sidebar( trackstore_elated_get_sidebar() ) ) { $sidebar_layout = ''; } return apply_filters( 'trackstore_elated_sidebar_layout', $sidebar_layout ); } } if ( ! function_exists( 'trackstore_elated_get_content_sidebar_class' ) ) { /** * Return classes for content holder when sidebar is active * * @return string */ function trackstore_elated_get_content_sidebar_class() { $sidebar_layout = trackstore_elated_sidebar_layout(); $content_class = array( 'eltd-page-content-holder' ); switch ( $sidebar_layout ) { case 'sidebar-33-right': $content_class[] = 'eltd-grid-col-8'; break; case 'sidebar-25-right': $content_class[] = 'eltd-grid-col-9'; break; case 'sidebar-20-right': $content_class[] = 'eltd-grid-col-10'; break; case 'sidebar-33-left': $content_class[] = 'eltd-grid-col-8'; $content_class[] = 'eltd-grid-col-push-4'; break; case 'sidebar-25-left': $content_class[] = 'eltd-grid-col-9'; $content_class[] = 'eltd-grid-col-push-3'; break; case 'sidebar-20-left': $content_class[] = 'eltd-grid-col-10'; $content_class[] = 'eltd-grid-col-push-2'; break; default: $content_class[] = 'eltd-grid-col-12'; break; } return trackstore_elated_get_class_attribute( $content_class ); } } if ( ! function_exists( 'trackstore_elated_get_sidebar_holder_class' ) ) { /** * Return classes for sidebar holder when sidebar is active * * @return string */ function trackstore_elated_get_sidebar_holder_class() { $sidebar_layout = trackstore_elated_sidebar_layout(); $sidebar_class = array( 'eltd-sidebar-holder' ); switch ( $sidebar_layout ) { case 'sidebar-33-right': $sidebar_class[] = 'eltd-grid-col-4'; break; case 'sidebar-25-right': $sidebar_class[] = 'eltd-grid-col-3'; break; case 'sidebar-20-right': $sidebar_class[] = 'eltd-grid-col-2'; break; case 'sidebar-33-left': $sidebar_class[] = 'eltd-grid-col-4'; $sidebar_class[] = 'eltd-grid-col-pull-8'; break; case 'sidebar-25-left': $sidebar_class[] = 'eltd-grid-col-3'; $sidebar_class[] = 'eltd-grid-col-pull-9'; break; case 'sidebar-20-left': $sidebar_class[] = 'eltd-grid-col-2'; $sidebar_class[] = 'eltd-grid-col-pull-10'; } return trackstore_elated_get_class_attribute( $sidebar_class ); } } if ( ! function_exists( 'trackstore_elated_get_sidebar' ) ) { /** * Return Sidebar name * * @return string */ function trackstore_elated_get_sidebar() { $sidebar_name = 'sidebar'; $custom_sidebar_area = trackstore_elated_get_meta_field_intersect( 'custom_sidebar_area' ); $custom_archive_sidebar_area = trackstore_elated_options()->getOptionValue( 'archive_custom_sidebar_area' ); $custom_search_sidebar_area = trackstore_elated_options()->getOptionValue( 'search_custom_sidebar_area' ); $custom_single_sidebar_area = trackstore_elated_get_meta_field_intersect( 'blog_single_custom_sidebar_area' ); if ( ! empty( $custom_sidebar_area ) ) { $sidebar_name = $custom_sidebar_area; } if ( is_singular( 'post' ) && ! empty( $custom_single_sidebar_area ) ) { $sidebar_name = $custom_single_sidebar_area; } if ( is_search() && ! empty( $custom_search_sidebar_area ) ) { $sidebar_name = $custom_search_sidebar_area; } if ( ( is_archive() || ( is_home() && is_front_page() ) ) && ! trackstore_elated_is_woocommerce_page() && ! empty( $custom_archive_sidebar_area ) ) { $sidebar_name = $custom_archive_sidebar_area; } return apply_filters( 'trackstore_elated_sidebar_name', $sidebar_name ); } } if ( ! function_exists( 'trackstore_elated_get_custom_sidebars' ) ) { /** * Function that returns all custom made sidebars. * * @uses get_option() * @return array array of custom made sidebars where key and value are sidebar name */ function trackstore_elated_get_custom_sidebars() { $trackstore_custom_sidebars = get_option( 'eltd_sidebars' ); $formatted_array = array(); if ( is_array( $trackstore_custom_sidebars ) && count( $trackstore_custom_sidebars ) ) { foreach ( $trackstore_custom_sidebars as $custom_sidebar ) { $formatted_array[ sanitize_title( $custom_sidebar ) ] = $custom_sidebar; } } return $formatted_array; } } if ( ! function_exists( 'trackstore_elated_get_custom_sidebars_options' ) ) { function trackstore_elated_get_custom_sidebars_options() { $sidebar_options = array( 'no-sidebar' => esc_html__( 'No Sidebar', 'trackstore' ), 'sidebar-33-right' => esc_html__( 'Sidebar 1/3 Right', 'trackstore' ), 'sidebar-25-right' => esc_html__( 'Sidebar 1/4 Right', 'trackstore' ), 'sidebar-20-right' => esc_html__( 'Sidebar 1/5 Right', 'trackstore' ), 'sidebar-33-left' => esc_html__( 'Sidebar 1/3 Left', 'trackstore' ), 'sidebar-25-left' => esc_html__( 'Sidebar 1/4 Left', 'trackstore' ), 'sidebar-20-left' => esc_html__( 'Sidebar 1/5 Left', 'trackstore' ) ); return $sidebar_options; } }PK �85\�#t}a a ! admin/options-map/sidebar-map.phpnu �[��� <?php if ( ! function_exists( 'trackstore_elated_sidebar_options_map' ) ) { function trackstore_elated_sidebar_options_map() { trackstore_elated_add_admin_page( array( 'slug' => '_sidebar_page', 'title' => esc_html__( 'Sidebar Area', 'trackstore' ), 'icon' => 'fa fa-indent' ) ); $sidebar_panel = trackstore_elated_add_admin_panel( array( 'title' => esc_html__( 'Sidebar Area', 'trackstore' ), 'name' => 'sidebar', 'page' => '_sidebar_page' ) ); trackstore_elated_add_admin_field( array( 'name' => 'sidebar_layout', 'type' => 'select', 'label' => esc_html__( 'Sidebar Layout', 'trackstore' ), 'description' => esc_html__( 'Choose a sidebar layout for pages', 'trackstore' ), 'parent' => $sidebar_panel, 'default_value' => 'no-sidebar', 'options' => trackstore_elated_get_custom_sidebars_options() ) ); $trackstore_custom_sidebars = trackstore_elated_get_custom_sidebars(); if ( count( $trackstore_custom_sidebars ) > 0 ) { trackstore_elated_add_admin_field( array( 'name' => 'custom_sidebar_area', 'type' => 'selectblank', 'label' => esc_html__( 'Sidebar to Display', 'trackstore' ), 'description' => esc_html__( 'Choose a sidebar to display on pages. Default sidebar is "Sidebar"', 'trackstore' ), 'parent' => $sidebar_panel, 'options' => $trackstore_custom_sidebars, 'args' => array( 'select2' => true ) ) ); } } add_action( 'trackstore_elated_options_map', 'trackstore_elated_sidebar_options_map', 6 ); }PK �85\X�D� � '