avada_builder.php
8 months ago
bricks_builder.php
8 months ago
divi_theme.php
8 months ago
google_site_kit.php
8 months ago
hive_press.php
8 months ago
maintenance.php
8 months ago
oxygen_builder.php
8 months ago
the_events_calendar.php
8 months ago
wpml.php
8 months ago
hive_press.php
44 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Legacy\EmailEncoderBundle\Integration; |
| 4 | |
| 5 | use OnlineOptimisation\EmailEncoderBundle\Traits\PluginHelper; |
| 6 | |
| 7 | class HivePress { |
| 8 | |
| 9 | use PluginHelper; |
| 10 | |
| 11 | public function boot (): void { |
| 12 | if ( $this->is_active() ) { |
| 13 | add_filter( 'eeb/settings/fields', [ $this, 'deactivate_logic' ], 10 ); |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | |
| 18 | public function is_active(): bool { |
| 19 | return defined( 'HP_FILE' ); |
| 20 | } |
| 21 | |
| 22 | |
| 23 | public function deactivate_logic( $fields ) { |
| 24 | |
| 25 | $uri = isset( $_SERVER['REQUEST_URI'] ) |
| 26 | ? wp_parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ) |
| 27 | : '' |
| 28 | ; |
| 29 | |
| 30 | $condition = preg_match( '#/account/listings/(\d+)/?$#', $uri ) |
| 31 | && is_array( $fields ) |
| 32 | && isset( $fields['protect']['value'] ) |
| 33 | ; |
| 34 | |
| 35 | if ( $condition ) { |
| 36 | // $this->log( 'HivePress: protecting; trait is working :)' ); |
| 37 | $fields[ 'protect' ]['value'] = $this->settings()::PROTECT_DISABLED; |
| 38 | } |
| 39 | |
| 40 | return $fields; |
| 41 | } |
| 42 | |
| 43 | } |
| 44 |