| 1 |
<?php |
| 2 |
/** |
| 3 |
* This class will provide all kind of helper methods. |
| 4 |
*/ |
| 5 |
class NotificationX_ToggleFields { |
| 6 |
|
| 7 |
public static function common_fields(){ |
| 8 |
return array( |
| 9 |
'conversion_position', |
| 10 |
'delay_before', |
| 11 |
'display_last', |
| 12 |
'display_from', |
| 13 |
'display_for', |
| 14 |
'delay_between', |
| 15 |
'loop', |
| 16 |
'notification_preview', |
| 17 |
'conversion_size' |
| 18 |
); |
| 19 |
} |
| 20 |
|
| 21 |
public static function common_sections(){ |
| 22 |
return array( |
| 23 |
'image', |
| 24 |
); |
| 25 |
} |
| 26 |
|
| 27 |
public static function woocommerce(){ |
| 28 |
|
| 29 |
$fields = self::common_fields(); |
| 30 |
$fields[] = 'conversion_from'; |
| 31 |
$sections = self::common_sections(); |
| 32 |
$sections[] = 'themes'; |
| 33 |
$sections[] = 'conversion_link_options'; |
| 34 |
|
| 35 |
return apply_filters( 'nx_woocommerce_toggle_fields', array( |
| 36 |
'fields' => $fields, |
| 37 |
'sections' => $sections, |
| 38 |
)); |
| 39 |
} |
| 40 |
|
| 41 |
public static function woocommerce_hide(){ |
| 42 |
return apply_filters( 'nx_woocommerce_toggle_fields', array( |
| 43 |
'fields' => [ 'comments_template' ], |
| 44 |
'sections' => [], |
| 45 |
)); |
| 46 |
} |
| 47 |
|
| 48 |
public static function edd(){ |
| 49 |
$fields = self::common_fields(); |
| 50 |
$fields[] = 'conversion_from'; |
| 51 |
|
| 52 |
$sections = self::common_sections(); |
| 53 |
$sections[] = 'themes'; |
| 54 |
$sections[] = 'conversion_link_options'; |
| 55 |
|
| 56 |
return apply_filters( 'nx_edd_toggle_fields', array( |
| 57 |
'fields' => $fields, |
| 58 |
'sections' => $sections, |
| 59 |
)); |
| 60 |
} |
| 61 |
|
| 62 |
public static function edd_hide(){ |
| 63 |
return apply_filters( 'nx_edd_toggle_fields', array( |
| 64 |
'fields' => [ 'comments_template' ], |
| 65 |
'sections' => [], |
| 66 |
)); |
| 67 |
} |
| 68 |
|
| 69 |
public static function reviews(){ |
| 70 |
$fields = self::common_fields(); |
| 71 |
|
| 72 |
return apply_filters( 'nx_reviews_toggle_fields', array( |
| 73 |
'fields' => array_merge( $fields, array( 'reviews_source' ) ), |
| 74 |
'sections' => array( 'image' ) |
| 75 |
)); |
| 76 |
} |
| 77 |
|
| 78 |
public static function stats(){ |
| 79 |
$fields = self::common_fields(); |
| 80 |
|
| 81 |
return apply_filters( 'nx_stats_toggle_fields', array( |
| 82 |
'fields' => array_merge( $fields, array( 'stats_source' ) ), |
| 83 |
'sections' => array( 'image' ) |
| 84 |
)); |
| 85 |
} |
| 86 |
|
| 87 |
} |
| 88 |
|