| @@ -9,9 +9,9 @@ | ||
| 9 | 9 | private $plugin_dir; |
| 10 | 10 | private $plugin_url; |
| 11 | 11 | |
| 12 | 12 | public static function uses_new_css() { |
| 13 | - return (bool) paf( 'eoi_powerup_new_css' ); | |
| 13 | + return true; | |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function __construct( $layout_id ) { |
| 17 | 17 | $this->plugin_dir = FCA_EOI_PLUGIN_DIR; |
| @@ -32,8 +32,119 @@ | ||
| 32 | 32 | |
| 33 | 33 | return $scss; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | + public function layout_name( $id = '') { | |
| 37 | + | |
| 38 | + if ( empty ( $id ) ) { | |
| 39 | + $id = $this->layout_id; | |
| 40 | + } | |
| 41 | + | |
| 42 | + $layout_names = array( | |
| 43 | + 0 => __('No CSS', 'easy-opt-ins'), | |
| 44 | + 1 => __('Classic', 'easy-opt-ins'), | |
| 45 | + 2 => __('Ribbon', 'easy-opt-ins'), | |
| 46 | + 3 => __('Chevron', 'easy-opt-ins'), | |
| 47 | + 4 => __('Modern', 'easy-opt-ins'), | |
| 48 | + 5 => __('Light', 'easy-opt-ins'), | |
| 49 | + 6 => __('Dark', 'easy-opt-ins'), | |
| 50 | + 7 => __('Natural', 'easy-opt-ins'), | |
| 51 | + 8 => __('Elegant', 'easy-opt-ins'), | |
| 52 | + 9 => __('Bubble', 'easy-opt-ins'), | |
| 53 | + 10 => __( 'Optin Bar Blue', 'easy-opt-ins'), | |
| 54 | + 11 => __( 'Optin Bar Orange', 'easy-opt-ins'), | |
| 55 | + 12 => __( 'Optin Bar White', 'easy-opt-ins'), | |
| 56 | + 13 => __( 'Slide In Light', 'easy-opt-ins'), | |
| 57 | + 14 => __( 'Slide In Dark', 'easy-opt-ins'), | |
| 58 | + 15 => __( 'Rounded', 'easy-opt-ins'), | |
| 59 | + 16 => __( 'Flat', 'easy-opt-ins'), | |
| 60 | + 17 => __( 'Content Upgrade', 'easy-opt-ins'), | |
| 61 | + 18 => __( 'Image', 'easy-opt-ins'), | |
| 62 | + 19 => __( 'Padded Image', 'easy-opt-ins'), | |
| 63 | + 20 => __( 'Wide Image', 'easy-opt-ins'), | |
| 64 | + 21 => __( 'Content Upgrade - Image', 'easy-opt-ins'), | |
| 65 | + 22 => __( 'Content Upgrade - Wide Image', 'easy-opt-ins'), | |
| 66 | + ); | |
| 67 | + | |
| 68 | + return $layout_names[ $this->layout_number( $id ) ]; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public function layout_number( $id = '') { | |
| 72 | + | |
| 73 | + if ( empty ( $id ) ) { | |
| 74 | + $id = $this->layout_id; | |
| 75 | + } | |
| 76 | + | |
| 77 | + return preg_replace( '/[^0-9]/', '', $id ); | |
| 78 | + | |
| 79 | + } | |
| 80 | + | |
| 81 | + public function screenshot_src( $id = '') { | |
| 82 | + | |
| 83 | + if ( empty ( $id ) ) { | |
| 84 | + $id = $this->layout_id; | |
| 85 | + } | |
| 86 | + | |
| 87 | + if ( $this->layout_type === 'widget' ) { | |
| 88 | + $id = str_replace( 'widget', 'layout', $id ); | |
| 89 | + } | |
| 90 | + | |
| 91 | + if ( file_exists( FCA_EOI_PLUGIN_DIR . "/layouts/screenshots/$id.png" ) ) { | |
| 92 | + return FCA_EOI_PLUGIN_URL . "/layouts/screenshots/$id.png"; | |
| 93 | + } | |
| 94 | + | |
| 95 | + return FCA_EOI_PLUGIN_URL . "/assets/admin/no_image.png"; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public function layout_enabled() { | |
| 99 | + | |
| 100 | + $path = FCA_EOI_PLUGIN_DIR . '/layouts/' . $this->layout_type . '/' . $this->layout_id; | |
| 101 | + | |
| 102 | + if ( $this->layout_type === 'widget' ) { | |
| 103 | + $path = FCA_EOI_PLUGIN_DIR . '/layouts/' . $this->layout_type . '/layout_' . $this->layout_number; | |
| 104 | + } | |
| 105 | + | |
| 106 | + return file_exists( $path ); | |
| 107 | + | |
| 108 | + } | |
| 109 | + | |
| 110 | + public function layout_order( $id = '') { | |
| 111 | + | |
| 112 | + if ( empty ( $id ) ) { | |
| 113 | + $id = $this->layout_id; | |
| 114 | + } | |
| 115 | + | |
| 116 | + //LAYOUT ID => LAYOUT ORDER | |
| 117 | + $layout_order = array( | |
| 118 | + 16, // __( 'Flat', 'easy-opt-ins'), | |
| 119 | + 15, // __( 'Rounded', 'easy-opt-ins'), | |
| 120 | + 2, // __('Ribbon', 'easy-opt-ins'), | |
| 121 | + 5, // __('Light', 'easy-opt-ins'), | |
| 122 | + 1, // __('Classic', 'easy-opt-ins'), | |
| 123 | + 9, // __('Bubble', 'easy-opt-ins'), | |
| 124 | + 18, // __( 'Image', 'easy-opt-ins'), | |
| 125 | + 19, // __( 'Padded Image', 'easy-opt-ins'), | |
| 126 | + 20, // __( 'Wide Image', 'easy-opt-ins'), | |
| 127 | + 17, // __( 'Content Upgrade', 'easy-opt-ins'), | |
| 128 | + 21, // __( 'Content Upgrade - Image', 'easy-opt-ins'), | |
| 129 | + 22, // __( 'Content Upgrade - Wide Image', 'easy-opt-ins'), | |
| 130 | + 3, // __('Chevron', 'easy-opt-ins'), | |
| 131 | + 4, // __('Modern', 'easy-opt-ins'), | |
| 132 | + 6, // __('Dark', 'easy-opt-ins'), | |
| 133 | + 7, // __('Natural', 'easy-opt-ins'), | |
| 134 | + 8, // __('Elegant', 'easy-opt-ins'), | |
| 135 | + 10, // __( 'Optin Bar Blue', 'easy-opt-ins'), | |
| 136 | + 11, // __( 'Optin Bar Orange', 'easy-opt-ins'), | |
| 137 | + 12, // __( 'Optin Bar White', 'easy-opt-ins'), | |
| 138 | + 13, // __( 'Slide In Light', 'easy-opt-ins'), | |
| 139 | + 14, // __( 'Slide In Dark', 'easy-opt-ins'), | |
| 140 | + 0, //__('No CSS', 'easy-opt-ins'), | |
| 141 | + ); | |
| 142 | + | |
| 143 | + return array_search ( $this->layout_number( $id ), $layout_order ); | |
| 144 | + | |
| 145 | + } | |
| 146 | + | |
| 36 | 147 | public function path_to_html_wrapper() { |
| 37 | 148 | return $this->plugin_dir . $this->common_path() . $this->layout_type . '.html'; |
| 38 | 149 | } |
| 39 | 150 | |
| @@ -51,8 +162,12 @@ | ||
| 51 | 162 | } elseif ( $layout_type == 'postbox' ) { |
| 52 | 163 | return 'fca_eoi_layout_postbox'; |
| 53 | 164 | } elseif ( $layout_type == 'widget' ) { |
| 54 | 165 | return 'fca_eoi_layout_widget'; |
| 166 | + } elseif ( $layout_type == 'banner' ) { | |
| 167 | + return 'fca_eoi_layout_banner'; | |
| 168 | + } elseif ( $layout_type == 'overlay' ) { | |
| 169 | + return 'fca_eoi_layout_overlay'; | |
| 55 | 170 | } |
| 56 | 171 | return ''; |
| 57 | 172 | } |
| 58 | 173 | |