acf-boolean.php
3 years ago
acf-choice.php
3 years ago
acf-text.php
3 years ago
browser.php
3 years ago
condition.php
3 years ago
date-range.php
3 years ago
date.php
3 years ago
day.php
3 years ago
device.php
3 years ago
ip-location.php
3 years ago
lang.php
3 years ago
login-status.php
3 years ago
operating-system.php
3 years ago
page.php
3 years ago
post-type.php
3 years ago
post.php
3 years ago
return-visitor.php
3 years ago
shortcode.php
3 years ago
static-page.php
3 years ago
time-range.php
3 years ago
url-referer.php
3 years ago
url-string.php
3 years ago
user-role.php
3 years ago
woo-cart-products.php
3 years ago
woo-cat-page.php
3 years ago
woo-category.php
3 years ago
woo-last-purchase.php
3 years ago
woo-orders.php
3 years ago
woo-product-cat.php
3 years ago
woo-product-price.php
3 years ago
woo-product-stock.php
3 years ago
woo-total-price.php
3 years ago
static-page.php
87 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Returning User Condition Handler. |
| 4 | */ |
| 5 | |
| 6 | namespace PremiumAddons\Includes\PA_Display_Conditions\Conditions; |
| 7 | |
| 8 | // Elementor Classes. |
| 9 | use Elementor\Controls_Manager; |
| 10 | |
| 11 | // PA Classes. |
| 12 | use PremiumAddons\Includes\Helper_Functions; |
| 13 | |
| 14 | if ( ! defined( 'ABSPATH' ) ) { |
| 15 | exit; // Exit if accessed directly. |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * Class Static_Page |
| 20 | */ |
| 21 | class Static_Page extends Condition { |
| 22 | |
| 23 | /** |
| 24 | * Get Controls Options. |
| 25 | * |
| 26 | * @access public |
| 27 | * @since 4.9.22 |
| 28 | * |
| 29 | * @return array|void controls options |
| 30 | */ |
| 31 | public function get_control_options() { |
| 32 | |
| 33 | return array( |
| 34 | 'type' => Controls_Manager::SELECT, |
| 35 | 'options' => array( |
| 36 | 'home' => __( 'Homepage', 'premium-addons-for-elementor' ), |
| 37 | 'static' => __( 'Front Page', 'premium-addons-for-elementor' ), |
| 38 | 'blog' => __( 'Blog', 'premium-addons-for-elementor' ), |
| 39 | '404' => __( '404 Page', 'premium-addons-for-elementor' ), |
| 40 | ), |
| 41 | 'default' => 'home', |
| 42 | 'label_block' => true, |
| 43 | 'condition' => array( |
| 44 | 'pa_condition_key' => 'static_page', |
| 45 | ), |
| 46 | ); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Compare Condition Value. |
| 51 | * |
| 52 | * @access public |
| 53 | * @since 4.9.22 |
| 54 | * |
| 55 | * @param array $settings element settings. |
| 56 | * @param string $operator condition operator. |
| 57 | * @param string $value condition value. |
| 58 | * @param string $compare_val condition value. |
| 59 | * @param string|bool $tz time zone. |
| 60 | |
| 61 | * @return bool|void |
| 62 | */ |
| 63 | public function compare_value( $settings, $operator, $value, $compare_val, $tz ) { |
| 64 | |
| 65 | switch ( $value ) { |
| 66 | case 'home': |
| 67 | $condition_result = is_front_page() && is_home(); |
| 68 | break; |
| 69 | |
| 70 | case 'static': |
| 71 | $condition_result = is_front_page() && ! is_home(); |
| 72 | break; |
| 73 | |
| 74 | case 'static': |
| 75 | $condition_result = ! is_front_page() && is_home(); |
| 76 | break; |
| 77 | |
| 78 | default: |
| 79 | $condition_result = is_404(); |
| 80 | break; |
| 81 | } |
| 82 | |
| 83 | return Helper_Functions::get_final_result( $condition_result, $operator ); |
| 84 | } |
| 85 | |
| 86 | } |
| 87 |