admin-bar-menu.php
3 years ago
ajax-pagination.php
2 years ago
class-ecs-core.php
2 months ago
class-ecs-module-base.php
1 month ago
class-ecs-modules-manager.php
2 months ago
dynamic-style.php
3 years ago
ecs-dependencies.php
6 years ago
ecs-notices.php
6 years ago
enqueue-styles.php
2 years ago
pro-features.php
2 months ago
pro-preview.php
6 years ago
pro-preview.php
346 lines
| 1 | <?php |
| 2 | /* |
| 3 | * |
| 4 | * Pro features preview |
| 5 | * |
| 6 | */ |
| 7 | if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 8 | |
| 9 | add_action( 'ECS_after_control', function($skin){ |
| 10 | ecs_days_old(); |
| 11 | |
| 12 | $skin->add_control( |
| 13 | 'pro_features', |
| 14 | [ |
| 15 | 'label' => '<i class="fa fa-lock" aria-hidden="true"></i> '.__( 'See <b>Pro</b> features', 'ele-custom-skin' ), |
| 16 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 17 | 'label_off' => __( 'Hide', 'ele-custom-skin' ), |
| 18 | 'label_on' => __( 'Show', 'ele-custom-skin' ), |
| 19 | 'return_value' => 'yes', |
| 20 | 'separator' => 'before', |
| 21 | 'default' => ecs_days_old() > 8 ? '' : 'yes', |
| 22 | 'frontend_available' => true, |
| 23 | 'selectors' =>[' '=>' '], |
| 24 | ] |
| 25 | ); |
| 26 | |
| 27 | $skin->add_control( |
| 28 | 'is_display_conditions', |
| 29 | [ |
| 30 | 'label' => '<i class="fa fa-lock" aria-hidden="true"></i> '.__( '<b>Enable Display Conditions</b>', 'ele-custom-skin' ), |
| 31 | 'description' => __( 'Use templates based on Display Conditions set on Loop Templates', 'ele-custom-skin' ), |
| 32 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 33 | 'label_off' => __( 'No', 'ele-custom-skin' ), |
| 34 | 'label_on' => __( 'Yes', 'ele-custom-skin' ), |
| 35 | 'return_value' => 'yes', |
| 36 | 'separator' => 'before', |
| 37 | 'default' => '', |
| 38 | 'frontend_available' => true, |
| 39 | 'selectors' =>[' '=>' '], |
| 40 | 'condition' => [ |
| 41 | $skin->get_id().'_pro_features' => 'yes' |
| 42 | ], |
| 43 | |
| 44 | ] |
| 45 | ); |
| 46 | |
| 47 | $skin->add_control( |
| 48 | 'alternating_templates', |
| 49 | [ |
| 50 | 'label' => '<i class="fa fa-lock" aria-hidden="true"></i> '.__( '<b>Alternating templates</b>', 'ele-custom-skin' ), |
| 51 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 52 | 'label_off' => __( 'Hide', 'ele-custom-skin' ), |
| 53 | 'label_on' => __( 'Show', 'ele-custom-skin' ), |
| 54 | 'return_value' => 'yes', |
| 55 | 'separator' => 'before', |
| 56 | 'default' => '', |
| 57 | 'frontend_available' => true, |
| 58 | 'selectors' =>[' '=>' '], |
| 59 | 'condition' => [ |
| 60 | $skin->get_id().'_pro_features' => 'yes' |
| 61 | ], |
| 62 | |
| 63 | ] |
| 64 | ); |
| 65 | |
| 66 | $repeater = new \Elementor\Repeater(); |
| 67 | |
| 68 | $repeater->add_control( |
| 69 | 'nth', |
| 70 | [ |
| 71 | 'label' => __( '<i><b>n</b></i> th post', 'ele-custom-skin' ), |
| 72 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 73 | 'label_block' => false, |
| 74 | 'separator' => 'after', |
| 75 | 'placeholder' => __( 'nth', 'ele-custom-skin' ), |
| 76 | 'default' => __( '1', 'ele-custom-skin' ), |
| 77 | 'min' => 1, |
| 78 | 'dynamic' => [ |
| 79 | 'active' => true, |
| 80 | ], |
| 81 | ] |
| 82 | ); |
| 83 | |
| 84 | |
| 85 | $repeater->add_control( |
| 86 | 'skin_template', |
| 87 | [ |
| 88 | 'label' => __( 'Select a default template', 'ele-custom-skin' ), |
| 89 | 'type' => \Elementor\Controls_Manager::SELECT2, |
| 90 | 'label_block' => true, |
| 91 | 'default' => [], |
| 92 | 'options' => $skin->get_skin_template(), |
| 93 | ] |
| 94 | ); |
| 95 | |
| 96 | $skin->add_control( |
| 97 | 'template_list', |
| 98 | [ |
| 99 | 'label' => '', |
| 100 | 'type' => \Elementor\Controls_Manager::REPEATER, |
| 101 | 'fields' => $repeater->get_controls(), |
| 102 | 'default' => [ |
| 103 | [ |
| 104 | 'nth' => 1, |
| 105 | 'skin_template' => [] |
| 106 | ], |
| 107 | ], |
| 108 | 'condition' => [ |
| 109 | $skin->get_id().'_alternating_templates' => 'yes', |
| 110 | $skin->get_id().'_pro_features' => 'yes' |
| 111 | ], |
| 112 | 'title_field' => '<p style="text-align:center;"><i class="fa fa-lock" aria-hidden="true"></i> '.__('Template for every ', 'ele-custom-skin').'{{{nth}}}'.__('th post', 'ele-custom-skin').'</p>', |
| 113 | ] |
| 114 | ); |
| 115 | |
| 116 | |
| 117 | $skin->add_control( |
| 118 | 'display_title', |
| 119 | [ |
| 120 | 'label' => __( 'Display Mode', 'ele-custom-skin' ), |
| 121 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 122 | 'separator' => 'before', |
| 123 | 'condition' => [ |
| 124 | $skin->get_id().'_pro_features' => 'yes' |
| 125 | ], |
| 126 | ] |
| 127 | ); |
| 128 | if ('2019-09-20' <= date("Y-m-d")) $skin->add_control( |
| 129 | 'masonrys', |
| 130 | [ |
| 131 | 'label' => '<i class="fa fa-lock" aria-hidden="true"></i> '.__( 'Masonry', 'ele-custom-skin' ), |
| 132 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 133 | 'label_off' => __( 'Off', 'ele-custom-skin' ), |
| 134 | 'label_on' => __( 'On', 'ele-custom-skin' ), |
| 135 | 'return_value' => 'yes', |
| 136 | 'default' => 'no', |
| 137 | 'frontend_available' => true, |
| 138 | 'condition' => [ |
| 139 | $skin->get_id().'_same_height!' => '100%', |
| 140 | $skin->get_id().'_post_slider!' => 'yes', |
| 141 | $skin->get_id().'_pro_features' => 'yes' |
| 142 | ], |
| 143 | ] |
| 144 | ); |
| 145 | $skin->add_control( |
| 146 | 'same_height', |
| 147 | [ |
| 148 | 'label' => '<i class="fa fa-lock" aria-hidden="true"></i> '.__( 'Same Height', 'ele-custom-skin' ), |
| 149 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 150 | 'label_off' => __( 'Off', 'ele-custom-skin' ), |
| 151 | 'label_on' => __( 'On', 'ele-custom-skin' ), |
| 152 | 'return_value' => '100%', |
| 153 | 'default' => 'auto', |
| 154 | 'condition' => [ |
| 155 | $skin->get_id().'_pro_features' => 'yes' |
| 156 | ], |
| 157 | ] |
| 158 | ); |
| 159 | |
| 160 | |
| 161 | |
| 162 | /** |
| 163 | * |
| 164 | * Starting the slider part |
| 165 | * |
| 166 | **/ |
| 167 | |
| 168 | $skin->add_control( |
| 169 | 'post_slider', |
| 170 | [ |
| 171 | 'label' => '<i class="fa fa-lock" aria-hidden="true"></i> '.__( 'Show in Slider', 'ele-custom-skin' ), |
| 172 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 173 | 'label_off' => __( 'Off', 'ele-custom-skin' ), |
| 174 | 'label_on' => __( 'On', 'ele-custom-skin' ), |
| 175 | 'return_value' => 'yes', |
| 176 | 'default' => '', |
| 177 | 'frontend_available' => true, |
| 178 | 'condition' => [ |
| 179 | $skin->get_id().'_masonrys!' => 'yes', |
| 180 | $skin->get_id().'_pro_features' => 'yes', |
| 181 | ], |
| 182 | ] |
| 183 | ); |
| 184 | |
| 185 | |
| 186 | $skin->add_control( |
| 187 | 'slider_title', |
| 188 | [ |
| 189 | 'label' => __( 'Slider Options', 'ele-custom-skin' ), |
| 190 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 191 | 'separator' => 'before', |
| 192 | 'condition' => [ |
| 193 | $skin->get_id().'_post_slider' => 'yes', |
| 194 | $skin->get_id().'_pro_features' => 'yes', |
| 195 | ], |
| 196 | ] |
| 197 | ); |
| 198 | $slides_to_show = range( 1, 10 ); |
| 199 | $slides_to_show = array_combine( $slides_to_show, $slides_to_show ); |
| 200 | $skin->add_responsive_control( |
| 201 | 'slides_to_show', |
| 202 | [ |
| 203 | 'label' => __( 'Slides to Show', 'ele-custom-skin' ), |
| 204 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 205 | 'options' => [ |
| 206 | '' => __( 'Default', 'ele-custom-skin' ), |
| 207 | ] + $slides_to_show, |
| 208 | 'condition' => [ |
| 209 | $skin->get_id().'_post_slider' => 'yes', |
| 210 | $skin->get_id().'_pro_features' => 'yes', |
| 211 | ], |
| 212 | 'frontend_available' => true, |
| 213 | ] |
| 214 | ); |
| 215 | $skin->add_responsive_control( |
| 216 | 'slides_to_scroll', |
| 217 | [ |
| 218 | 'label' => __( 'Slides to Scroll', 'ele-custom-skin' ), |
| 219 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 220 | 'description' => __( 'Set how many slides are scrolled per swipe.', 'ele-custom-skin' ), |
| 221 | 'options' => [ |
| 222 | '' => __( 'Default', 'ele-custom-skin' ), |
| 223 | ] + $slides_to_show, |
| 224 | 'condition' => [ |
| 225 | $skin->get_id().'_slides_to_show!' => '1', |
| 226 | $skin->get_id().'_post_slider' => 'yes', |
| 227 | $skin->get_id().'_pro_features' => 'yes', |
| 228 | ], |
| 229 | 'frontend_available' => true, |
| 230 | ] |
| 231 | ); |
| 232 | $skin->add_control( |
| 233 | 'navigation', |
| 234 | [ |
| 235 | 'label' => __( 'Navigation', 'ele-custom-skin' ), |
| 236 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 237 | 'default' => 'both', |
| 238 | 'options' => [ |
| 239 | 'both' => __( 'Arrows and Dots', 'ele-custom-skin' ), |
| 240 | 'arrows' => __( 'Arrows', 'ele-custom-skin' ), |
| 241 | 'dots' => __( 'Dots', 'ele-custom-skin' ), |
| 242 | 'none' => __( 'None', 'ele-custom-skin' ), |
| 243 | ], |
| 244 | 'condition' => [ |
| 245 | $skin->get_id().'_post_slider' => 'yes', |
| 246 | $skin->get_id().'_pro_features' => 'yes', |
| 247 | ], |
| 248 | 'frontend_available' => true, |
| 249 | ] |
| 250 | ); |
| 251 | |
| 252 | /* |
| 253 | |
| 254 | end slider |
| 255 | |
| 256 | */ |
| 257 | |
| 258 | |
| 259 | $skin->add_control( |
| 260 | 'key_title', |
| 261 | [ |
| 262 | 'label' => __( 'Dynamic Everywhere', 'ele-custom-skin' ), |
| 263 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 264 | 'separator' => 'before', |
| 265 | 'condition' => [ |
| 266 | $skin->get_id().'_pro_features' => 'yes' |
| 267 | ], |
| 268 | ] |
| 269 | ); |
| 270 | $skin->add_control( |
| 271 | 'use_keywords', |
| 272 | [ |
| 273 | 'label' => '<i class="fa fa-lock" aria-hidden="true"></i> '.__( 'Using Dynamic Keywords', 'ele-custom-skin' ), |
| 274 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 275 | 'label_on' => __( 'Yes', 'ele-custom-skin' ), |
| 276 | 'label_off' => __( 'No', 'ele-custom-skin' ), |
| 277 | 'return_value' => 'yes', |
| 278 | 'default' => 'no', |
| 279 | 'condition' => [ |
| 280 | $skin->get_id().'_pro_features' => 'yes' |
| 281 | ], |
| 282 | ] |
| 283 | ); |
| 284 | |
| 285 | $skin->add_control( |
| 286 | 'keywords_note', |
| 287 | [ |
| 288 | 'label' => '', |
| 289 | 'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 290 | 'raw' => '<div>Replace all the dynamic {{keywords}} from the Loop Template.</div>', |
| 291 | 'condition' => [ |
| 292 | $skin->get_id().'_pro_features' => 'yes' |
| 293 | ], |
| 294 | ] |
| 295 | ); |
| 296 | |
| 297 | $skin->add_control( |
| 298 | 'link_to', |
| 299 | [ |
| 300 | 'label' => '<i class="fa fa-lock" aria-hidden="true"></i> '.__( '<b>Make entire post a link?</b>', 'ele-custom-skin' ), |
| 301 | 'description' => __( 'Make the entire Loop Template clickable.', 'ele-custom-skin' ), |
| 302 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 303 | 'label_off' => __( 'No', 'ele-custom-skin' ), |
| 304 | 'label_on' => __( 'Yes', 'ele-custom-skin' ), |
| 305 | 'return_value' => 'yes', |
| 306 | 'separator' => 'before', |
| 307 | 'default' => '', |
| 308 | 'frontend_available' => true, |
| 309 | 'selectors' =>[' '=>' '], |
| 310 | 'condition' => [ |
| 311 | $skin->get_id().'_pro_features' => 'yes' |
| 312 | ], |
| 313 | ] |
| 314 | ); |
| 315 | |
| 316 | $skin->add_control( |
| 317 | 'postlink', |
| 318 | [ |
| 319 | 'label' => __( 'Link', 'ele-custom-skin' ), |
| 320 | 'description' => __( 'For this link to be SEO friendly please add a link to title or other widgets inside Loop Template.', 'ele-custom-skin' ), |
| 321 | 'type' => \Elementor\Controls_Manager::URL, |
| 322 | 'dynamic' => [ |
| 323 | 'active' => true, |
| 324 | ], |
| 325 | 'placeholder' => __( 'https://your-link.com', 'ele-custom-skin' ), |
| 326 | 'condition' => [ |
| 327 | $skin->get_id().'_link_to' => 'yes', |
| 328 | $skin->get_id().'_pro_features' => 'yes', |
| 329 | ], |
| 330 | 'show_label' => false, |
| 331 | ] |
| 332 | ); |
| 333 | |
| 334 | $skin->add_control( |
| 335 | 'upgrade_note', |
| 336 | [ |
| 337 | 'label' => '<i class="fa fa-lock-open" aria-hidden="true"></i> <b>'.__( 'Unlock PRO features. ', 'ele-custom-skin' ).'</b>', |
| 338 | 'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 339 | 'separator' => 'before', |
| 340 | 'raw' => '<div style="padding-top:10px;line-height:1.6em;text-align:center;"><p>'.__( 'Get full features with <b><i>Ele Custom Skin PRO</i></b>, ', 'ele-custom-skin' ).'</p><p style="padding-top:10px;"><a class="elementor-button elementor-button-default elementor-button-go-pro" href="https://dudaster.com/ecs-pro/" target="_blank">'.__( 'Go Pro', 'ele-custom-skin' ).'</a></p></div>', |
| 341 | 'content_classes' => 'your-class', |
| 342 | ] |
| 343 | ); |
| 344 | |
| 345 | } , 10, 3 ); |
| 346 |