Base.class.php
5 years ago
View.Slide.UPCP.class.php
4 years ago
View.Slide.URP.class.php
4 years ago
View.Slide.WooCommerce.class.php
4 years ago
View.Slide.class.php
4 years ago
View.Slider.class.php
4 years ago
View.class.php
4 years ago
View.class.php
135 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Base class for any view requested on the front end. |
| 5 | * |
| 6 | * @since 2.0.0 |
| 7 | */ |
| 8 | class ewdusView extends ewdusBase { |
| 9 | |
| 10 | /** |
| 11 | * Post type to render |
| 12 | */ |
| 13 | public $post_type = null; |
| 14 | |
| 15 | /** |
| 16 | * Map types of content to the template which will render them |
| 17 | */ |
| 18 | public $content_map = array( |
| 19 | 'title' => 'content/title', |
| 20 | ); |
| 21 | |
| 22 | /** |
| 23 | * Initialize the class |
| 24 | * @since 2.0.0 |
| 25 | */ |
| 26 | public function __construct( $args ) { |
| 27 | |
| 28 | // Parse the values passed |
| 29 | $this->parse_args( $args ); |
| 30 | |
| 31 | // Filter the content map so addons can customize what and how content |
| 32 | // is output. Filters are specific to each view, so for this base view |
| 33 | // you would use the filter 'ewd_us_content_map_ewdusView' |
| 34 | $this->content_map = apply_filters( 'ewd_us_content_map_' . get_class( $this ), $this->content_map ); |
| 35 | |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Render the view and enqueue required stylesheets |
| 40 | * |
| 41 | * @note This function should always be overridden by an extending class |
| 42 | * @since 2.0.0 |
| 43 | */ |
| 44 | public function render() { |
| 45 | |
| 46 | $this->set_error( |
| 47 | array( |
| 48 | 'type' => 'render() called on wrong class' |
| 49 | ) |
| 50 | ); |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Load a template file for views |
| 55 | * |
| 56 | * First, it looks in the current theme's /ewd-us-templates/ directory. Then it |
| 57 | * will check a parent theme's /ewd-us-templates/ directory. If nothing is found |
| 58 | * there, it will retrieve the template from the plugin directory. |
| 59 | |
| 60 | * @since 2.0.0 |
| 61 | * @param string template Type of template to load (eg - slider, slide) |
| 62 | */ |
| 63 | function find_template( $template ) { |
| 64 | |
| 65 | $this->template_dirs = array( |
| 66 | get_stylesheet_directory() . '/' . EWD_US_TEMPLATE_DIR . '/', |
| 67 | get_template_directory() . '/' . EWD_US_TEMPLATE_DIR . '/', |
| 68 | EWD_US_PLUGIN_DIR . '/' . EWD_US_TEMPLATE_DIR . '/' |
| 69 | ); |
| 70 | |
| 71 | $this->template_dirs = apply_filters( 'ewd_us_template_directories', $this->template_dirs ); |
| 72 | |
| 73 | foreach ( $this->template_dirs as $dir ) { |
| 74 | if ( file_exists( $dir . $template . '.php' ) ) { |
| 75 | return $dir . $template . '.php'; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | return false; |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Enqueue stylesheets |
| 84 | */ |
| 85 | public function enqueue_assets() { |
| 86 | |
| 87 | //enqueue assets here |
| 88 | } |
| 89 | |
| 90 | public function add_custom_styling() { |
| 91 | global $ewd_us_controller; |
| 92 | |
| 93 | echo '<style>'; |
| 94 | if ( $ewd_us_controller->settings->get_setting( 'styling-slide-title-font' ) != '' ) { echo '.ewd-us-slide .ewd-us-slide-title { font-family: \'' . $ewd_us_controller->settings->get_setting( 'styling-slide-title-font' ) . '\' !important; }'; } |
| 95 | if ( $ewd_us_controller->settings->get_setting( 'styling-slide-title-font-size' ) != '' ) { echo '.ewd-us-slide .ewd-us-slide-title { font-size: ' . $ewd_us_controller->settings->get_setting( 'styling-slide-title-font-size' ) . ' !important; }'; } |
| 96 | if ( $ewd_us_controller->settings->get_setting( 'styling-slide-title-font-color' ) != '' ) { echo '.ewd-us-slide .ewd-us-slide-title { color: ' . $ewd_us_controller->settings->get_setting( 'styling-slide-title-font-color' ) . ' !important; }'; } |
| 97 | if ( $ewd_us_controller->settings->get_setting( 'styling-slide-text-font' ) != '' ) { echo '.ewd-us-slide .ewd-us-slide-excerpt { font-family: \'' . $ewd_us_controller->settings->get_setting( 'styling-slide-text-font' ) . '\' !important; }'; } |
| 98 | if ( $ewd_us_controller->settings->get_setting( 'styling-slide-text-font-size' ) != '' ) { echo '.ewd-us-slide .ewd-us-slide-excerpt { font-size: ' . $ewd_us_controller->settings->get_setting( 'styling-slide-text-font-size' ) . ' !important; }'; } |
| 99 | if ( $ewd_us_controller->settings->get_setting( 'styling-slide-text-font-color' ) != '' ) { echo '.ewd-us-slide .ewd-us-slide-excerpt, .ewd-us-slide .ewd-us-slide-excerpt p { color: ' . $ewd_us_controller->settings->get_setting( 'styling-slide-text-font-color' ) . ' !important; }'; } |
| 100 | if ( $ewd_us_controller->settings->get_setting( 'styling-button-font' ) != '' ) { echo '.ewd-us-slide .ewd-us-slide-buttons li a { font-family: \'' . $ewd_us_controller->settings->get_setting( 'styling-button-font' ) . '\' !important; }'; } |
| 101 | if ( $ewd_us_controller->settings->get_setting( 'styling-button-font-size' ) != '' ) { echo '.ewd-us-slide .ewd-us-slide-buttons li a { font-size: ' . $ewd_us_controller->settings->get_setting( 'styling-button-font-size' ) . ' !important; }'; } |
| 102 | if ( $ewd_us_controller->settings->get_setting( 'styling-button-background-color' ) != '' ) { echo '.ewd-us-slide .ewd-us-slide-buttons li a { background: ' . $ewd_us_controller->settings->get_setting( 'styling-button-background-color' ) . ' !important; }'; } |
| 103 | if ( $ewd_us_controller->settings->get_setting( 'styling-button-border-color' ) != '' ) { echo '.ewd-us-slide .ewd-us-slide-buttons li a { border-color: ' . $ewd_us_controller->settings->get_setting( 'styling-button-border-color' ) . ' !important; }'; } |
| 104 | if ( $ewd_us_controller->settings->get_setting( 'styling-button-text-color' ) != '' ) { echo '.ewd-us-slide .ewd-us-slide-buttons li a { color: ' . $ewd_us_controller->settings->get_setting( 'styling-button-text-color' ) . ' !important; }'; } |
| 105 | if ( $ewd_us_controller->settings->get_setting( 'styling-button-background-hover-color' ) != '' ) { echo '.ewd-us-slide .ewd-us-slide-buttons li a:hover { background: ' . $ewd_us_controller->settings->get_setting( 'styling-button-background-hover-color' ) . ' !important; }'; } |
| 106 | if ( $ewd_us_controller->settings->get_setting( 'styling-button-border-hover-color' ) != '' ) { echo '.ewd-us-slide .ewd-us-slide-buttons li a:hover { border-color: ' . $ewd_us_controller->settings->get_setting( 'styling-button-border-hover-color' ) . ' !important; }'; } |
| 107 | if ( $ewd_us_controller->settings->get_setting( 'styling-button-text-hover-color' ) != '' ) { echo '.ewd-us-slide .ewd-us-slide-buttons li a:hover { color: ' . $ewd_us_controller->settings->get_setting( 'styling-button-text-hover-color' ) . 'px !important; }'; } |
| 108 | if ( $ewd_us_controller->settings->get_setting( 'styling-arrow-color' ) != '' ) { echo '.ewd-us-slider .ewd-us-nav-arrow .ewd-us-slider-icon { color: ' . $ewd_us_controller->settings->get_setting( 'styling-arrow-color' ) . ' !important; }'; } |
| 109 | if ( $ewd_us_controller->settings->get_setting( 'styling-arrow-font-size' ) != '' ) { echo '.ewd-us-slider .ewd-us-nav-arrow .ewd-us-slider-icon { font-size: ' . $ewd_us_controller->settings->get_setting( 'styling-arrow-font-size' ) . 'px !important; }'; } |
| 110 | if ( $ewd_us_controller->settings->get_setting( 'styling-arrow-line-height' ) != '' ) { echo '.ewd-us-slider .ewd-us-nav-arrow .ewd-us-slider-icon { line-height: ' . $ewd_us_controller->settings->get_setting( 'styling-arrow-line-height' ) . ' !important; }'; } |
| 111 | if ( $ewd_us_controller->settings->get_setting( 'styling-arrow-background-size' ) != '' ) { echo '.ewd-us-slider .ewd-us-nav-arrow .ewd-us-arrow-div { width: ' . $ewd_us_controller->settings->get_setting( 'styling-arrow-background-size' ) . ' !important; }'; } |
| 112 | if ( $ewd_us_controller->settings->get_setting( 'styling-arrow-background-color' ) != '' ) { echo '.ewd-us-slider .ewd-us-nav-arrow .ewd-us-arrow-div { background: ' . $ewd_us_controller->settings->get_setting( 'styling-arrow-background-color' ) . ' !important; }'; } |
| 113 | if ( $ewd_us_controller->settings->get_setting( 'styling-clickable-area-background-color' ) != '' ) { echo '.ewd-us-slider .ewd-us-nav-arrow { background: ' . $ewd_us_controller->settings->get_setting( 'styling-clickable-area-background-color' ) . ' !important; }'; } |
| 114 | if ( $ewd_us_controller->settings->get_setting( 'styling-clickable-area-size' ) != '' ) { echo '.ewd-us-slider .ewd-us-nav-arrow { width: ' . $ewd_us_controller->settings->get_setting( 'styling-clickable-area-size' ) . ' !important; }'; } |
| 115 | |
| 116 | if ( $ewd_us_controller->settings->get_setting( 'timer-bar' ) == 'top' ) { echo '#ewd-us-timer-bar { top: 0; }'; } |
| 117 | if ( $ewd_us_controller->settings->get_setting( 'timer-bar' ) == 'bottom' ) { echo '#ewd-us-timer-bar { bottom: 0; }'; } |
| 118 | |
| 119 | if ( $ewd_us_controller->settings->get_setting( 'youtube-show-content' ) ) { echo '.ewd-us-video .ewd-us-slide-text { display: block !important; }'; } |
| 120 | if ( $ewd_us_controller->settings->get_setting( 'youtube-video-opacity' ) != '' ) { echo '.ewd-us-video { opacity: ' . $ewd_us_controller->settings->get_setting( 'youtube-video-opacity' ) . ' !important; }'; } |
| 121 | |
| 122 | if ( is_admin_bar_showing() ) { |
| 123 | echo ".lg-outer { margin-top: 32px; } \n"; |
| 124 | echo ".lg-outer .lg-thumb-outer { bottom: 32px; } \n"; |
| 125 | echo "@media screen and (max-width: 782px) { \n"; |
| 126 | echo ".lg-outer { margin-top: 46px; } \n"; |
| 127 | echo ".lg-outer .lg-thumb-outer { bottom: 46px; } \n"; |
| 128 | echo "} \n"; |
| 129 | } |
| 130 | |
| 131 | echo '</style>'; |
| 132 | } |
| 133 | |
| 134 | } |
| 135 |