Base.class.php
5 years ago
View.Slide.UPCP.class.php
1 year ago
View.Slide.URP.class.php
1 year ago
View.Slide.WooCommerce.class.php
1 year ago
View.Slide.class.php
1 year ago
View.Slider.class.php
1 year ago
View.class.php
1 year ago
View.class.php
144 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 | // Locations that should be searched for templates |
| 23 | public $template_dirs; |
| 24 | |
| 25 | // Default labels, used a fallbacks if no admin inputted label exists |
| 26 | public $label_defaults = array(); |
| 27 | |
| 28 | // The classes that should be added to the main form div |
| 29 | public $classes; |
| 30 | |
| 31 | /** |
| 32 | * Initialize the class |
| 33 | * @since 2.0.0 |
| 34 | */ |
| 35 | public function __construct( $args ) { |
| 36 | |
| 37 | // Parse the values passed |
| 38 | $this->parse_args( $args ); |
| 39 | |
| 40 | // Filter the content map so addons can customize what and how content |
| 41 | // is output. Filters are specific to each view, so for this base view |
| 42 | // you would use the filter 'ewd_us_content_map_ewdusView' |
| 43 | $this->content_map = apply_filters( 'ewd_us_content_map_' . get_class( $this ), $this->content_map ); |
| 44 | |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Render the view and enqueue required stylesheets |
| 49 | * |
| 50 | * @note This function should always be overridden by an extending class |
| 51 | * @since 2.0.0 |
| 52 | */ |
| 53 | public function render() { |
| 54 | |
| 55 | $this->set_error( |
| 56 | array( |
| 57 | 'type' => 'render() called on wrong class' |
| 58 | ) |
| 59 | ); |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Load a template file for views |
| 64 | * |
| 65 | * First, it looks in the current theme's /ewd-us-templates/ directory. Then it |
| 66 | * will check a parent theme's /ewd-us-templates/ directory. If nothing is found |
| 67 | * there, it will retrieve the template from the plugin directory. |
| 68 | |
| 69 | * @since 2.0.0 |
| 70 | * @param string template Type of template to load (eg - slider, slide) |
| 71 | */ |
| 72 | function find_template( $template ) { |
| 73 | |
| 74 | $this->template_dirs = array( |
| 75 | get_stylesheet_directory() . '/' . EWD_US_TEMPLATE_DIR . '/', |
| 76 | get_template_directory() . '/' . EWD_US_TEMPLATE_DIR . '/', |
| 77 | EWD_US_PLUGIN_DIR . '/' . EWD_US_TEMPLATE_DIR . '/' |
| 78 | ); |
| 79 | |
| 80 | $this->template_dirs = apply_filters( 'ewd_us_template_directories', $this->template_dirs ); |
| 81 | |
| 82 | foreach ( $this->template_dirs as $dir ) { |
| 83 | if ( file_exists( $dir . $template . '.php' ) ) { |
| 84 | return $dir . $template . '.php'; |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | return false; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * Enqueue stylesheets |
| 93 | */ |
| 94 | public function enqueue_assets() { |
| 95 | |
| 96 | //enqueue assets here |
| 97 | } |
| 98 | |
| 99 | public function add_custom_styling() { |
| 100 | global $ewd_us_controller; |
| 101 | |
| 102 | echo '<style>'; |
| 103 | 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; }'; } |
| 104 | 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; }'; } |
| 105 | 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; }'; } |
| 106 | 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; }'; } |
| 107 | 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; }'; } |
| 108 | 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; }'; } |
| 109 | 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; }'; } |
| 110 | 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; }'; } |
| 111 | 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; }'; } |
| 112 | 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; }'; } |
| 113 | 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; }'; } |
| 114 | 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; }'; } |
| 115 | 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; }'; } |
| 116 | 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; }'; } |
| 117 | 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; }'; } |
| 118 | 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; }'; } |
| 119 | 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; }'; } |
| 120 | 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; }'; } |
| 121 | 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; }'; } |
| 122 | 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; }'; } |
| 123 | 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; }'; } |
| 124 | |
| 125 | if ( $ewd_us_controller->settings->get_setting( 'timer-bar' ) == 'top' ) { echo '#ewd-us-timer-bar { top: 0; }'; } |
| 126 | if ( $ewd_us_controller->settings->get_setting( 'timer-bar' ) == 'bottom' ) { echo '#ewd-us-timer-bar { bottom: 0; }'; } |
| 127 | |
| 128 | if ( $ewd_us_controller->settings->get_setting( 'youtube-show-content' ) ) { echo '.ewd-us-video .ewd-us-slide-text { display: block !important; }'; } |
| 129 | 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; }'; } |
| 130 | |
| 131 | if ( is_admin_bar_showing() ) { |
| 132 | echo ".lg-outer { margin-top: 32px; } \n"; |
| 133 | echo ".lg-outer .lg-thumb-outer { bottom: 32px; } \n"; |
| 134 | echo "@media screen and (max-width: 782px) { \n"; |
| 135 | echo ".lg-outer { margin-top: 46px; } \n"; |
| 136 | echo ".lg-outer .lg-thumb-outer { bottom: 46px; } \n"; |
| 137 | echo "} \n"; |
| 138 | } |
| 139 | |
| 140 | echo '</style>'; |
| 141 | } |
| 142 | |
| 143 | } |
| 144 |