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