@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | namespace eoxia; |
| 13 | 13 | |
| 14 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 14 | +if (!defined('ABSPATH')) {
|
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | * @version 1.0.0 |
| 30 | 30 | */ |
| 31 | 31 | public function __construct() {
|
| 32 | - add_action( 'admin_enqueue_scripts', array( $this, 'callback_mixed_enqueue_scripts' ), 9 ); |
|
| 33 | - add_action( 'wp_enqueue_scripts', array( $this, 'callback_mixed_enqueue_scripts' ), 9 ); |
|
| 34 | - add_action( 'init', array( $this, 'callback_plugins_loaded' ) ); |
|
| 32 | + add_action('admin_enqueue_scripts', array($this, 'callback_mixed_enqueue_scripts'), 9);
|
|
| 33 | + add_action('wp_enqueue_scripts', array($this, 'callback_mixed_enqueue_scripts'), 9);
|
|
| 34 | + add_action('init', array($this, 'callback_plugins_loaded'));
|
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -43,15 +43,15 @@ discard block |
||
| 43 | 43 | * @return void |
| 44 | 44 | */ |
| 45 | 45 | public function callback_mixed_enqueue_scripts() {
|
| 46 | - wp_register_script( 'wpeo-assets-scripts', Config_Util::$init['eo-framework']->core->url . 'assets/js/dest/wpeo-assets.js', array( 'jquery' ), \eoxia\Config_Util::$init['eo-framework']->version, false ); |
|
| 47 | - wp_enqueue_script( 'wpeo-assets-datepicker-js', Config_Util::$init['eo-framework']->core->url . 'assets/js/dest/jquery.datetimepicker.full.js', array( 'jquery' ), \eoxia\Config_Util::$init['eo-framework']->version, false ); |
|
| 46 | + wp_register_script('wpeo-assets-scripts', Config_Util::$init['eo-framework']->core->url . 'assets/js/dest/wpeo-assets.js', array('jquery'), \eoxia\Config_Util::$init['eo-framework']->version, false);
|
|
| 47 | + wp_enqueue_script('wpeo-assets-datepicker-js', Config_Util::$init['eo-framework']->core->url . 'assets/js/dest/jquery.datetimepicker.full.js', array('jquery'), \eoxia\Config_Util::$init['eo-framework']->version, false);
|
|
| 48 | 48 | |
| 49 | - wp_enqueue_style( 'wpeo-font-awesome-free', Config_Util::$init['eo-framework']->core->url . 'assets/css/fontawesome/fontawesome-all.min.css', array(), \eoxia\Config_Util::$init['eo-framework']->version ); |
|
| 50 | - wp_enqueue_style( 'wpeo-assets-styles', Config_Util::$init['eo-framework']->core->url . 'assets/css/style.min.css', \eoxia\Config_Util::$init['eo-framework']->version ); |
|
| 51 | - wp_enqueue_style( 'wpeo-assets-datepicker', Config_Util::$init['eo-framework']->core->url . 'assets/css/jquery.datetimepicker.css', array(), \eoxia\Config_Util::$init['eo-framework']->version ); |
|
| 49 | + wp_enqueue_style('wpeo-font-awesome-free', Config_Util::$init['eo-framework']->core->url . 'assets/css/fontawesome/fontawesome-all.min.css', array(), \eoxia\Config_Util::$init['eo-framework']->version); |
|
| 50 | + wp_enqueue_style('wpeo-assets-styles', Config_Util::$init['eo-framework']->core->url . 'assets/css/style.min.css', \eoxia\Config_Util::$init['eo-framework']->version);
|
|
| 51 | + wp_enqueue_style('wpeo-assets-datepicker', Config_Util::$init['eo-framework']->core->url . 'assets/css/jquery.datetimepicker.css', array(), \eoxia\Config_Util::$init['eo-framework']->version);
|
|
| 52 | 52 | |
| 53 | - wp_localize_script( 'wpeo-assets-scripts', 'wpeo_framework', $this->get_localize_script_data() ); |
|
| 54 | - wp_enqueue_script( 'wpeo-assets-scripts' ); |
|
| 53 | + wp_localize_script('wpeo-assets-scripts', 'wpeo_framework', $this->get_localize_script_data());
|
|
| 54 | + wp_enqueue_script('wpeo-assets-scripts');
|
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | * @version 1.0.0 |
| 93 | 93 | */ |
| 94 | 94 | public function callback_plugins_loaded() {
|
| 95 | - $plugin_dir = str_replace( '\\', '/', WP_PLUGIN_DIR ); |
|
| 96 | - $full_plugin_path = str_replace( '\\', '/', \eoxia\Config_Util::$init['main']->full_plugin_path ); |
|
| 97 | - $path = str_replace( $plugin_dir, '', $full_plugin_path ); |
|
| 98 | - load_plugin_textdomain( 'eoxia', false, $path . 'core/external/' . PLUGIN_EO_FRAMEWORK_DIR . '/core/assets/languages/' ); |
|
| 95 | + $plugin_dir = str_replace('\\', '/', WP_PLUGIN_DIR);
|
|
| 96 | + $full_plugin_path = str_replace('\\', '/', \eoxia\Config_Util::$init['main']->full_plugin_path);
|
|
| 97 | + $path = str_replace($plugin_dir, '', $full_plugin_path); |
|
| 98 | + load_plugin_textdomain('eoxia', false, $path . 'core/external/' . PLUGIN_EO_FRAMEWORK_DIR . '/core/assets/languages/');
|
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | namespace eoxia; |
| 13 | 13 | |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if (!defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( '\eoxia\CSV_Util' ) ) { |
|
| 18 | +if (!class_exists('\eoxia\CSV_Util')) { |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Méthodes utilitaires pour les fichiers CSV. |
@@ -43,20 +43,20 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @todo: Est-ce utile ? Utilisé par quel plugin ? |
| 45 | 45 | */ |
| 46 | - public function read_and_set_index( $csv_path, $list_index = array() ) { |
|
| 47 | - if ( empty( $csv_path ) ) { |
|
| 46 | + public function read_and_set_index($csv_path, $list_index = array()) { |
|
| 47 | + if (empty($csv_path)) { |
|
| 48 | 48 | return false; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $data = array(); |
| 52 | - $csv_content = file( $csv_path ); |
|
| 53 | - if ( ! empty( $csv_content ) ) { |
|
| 54 | - foreach ( $csv_content as $key => $line ) { |
|
| 55 | - if ( 0 !== $key ) { |
|
| 56 | - $data[ $key ] = str_getcsv( $line ); |
|
| 57 | - foreach ( $data[ $key ] as $i => $entry ) { |
|
| 58 | - if ( ! empty( $list_index[ $i ] ) ) { |
|
| 59 | - $data[ $key ][ $list_index[ $i ] ] = $entry; |
|
| 52 | + $csv_content = file($csv_path); |
|
| 53 | + if (!empty($csv_content)) { |
|
| 54 | + foreach ($csv_content as $key => $line) { |
|
| 55 | + if (0 !== $key) { |
|
| 56 | + $data[$key] = str_getcsv($line); |
|
| 57 | + foreach ($data[$key] as $i => $entry) { |
|
| 58 | + if (!empty($list_index[$i])) { |
|
| 59 | + $data[$key][$list_index[$i]] = $entry; |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | namespace eoxia; |
| 13 | 13 | |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if (!defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( '\eoxia\Post_Util' ) ) { |
|
| 18 | +if (!class_exists('\eoxia\Post_Util')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * Gestion des posts |
| 21 | 21 | */ |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @return bool true|false |
| 43 | 43 | */ |
| 44 | - public static function is_parent( $parent_id, $children_id ) { |
|
| 45 | - $list_parent_id = get_post_ancestors( $children_id ); |
|
| 46 | - if ( ! empty( $list_parent_id ) && in_array( $parent_id, $list_parent_id, true ) ) { |
|
| 44 | + public static function is_parent($parent_id, $children_id) { |
|
| 45 | + $list_parent_id = get_post_ancestors($children_id); |
|
| 46 | + if (!empty($list_parent_id) && in_array($parent_id, $list_parent_id, true)) { |
|
| 47 | 47 | return true; |
| 48 | 48 | } |
| 49 | 49 | return false; |
@@ -60,15 +60,15 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @return boolean |
| 62 | 62 | */ |
| 63 | - public static function have_child( $parent_id, $post_types ) { |
|
| 63 | + public static function have_child($parent_id, $post_types) { |
|
| 64 | 64 | $child = get_children(array( |
| 65 | 65 | 'numberposts' => 1, |
| 66 | 66 | 'post_parent' => $parent_id, |
| 67 | 67 | 'post_type' => $post_types, |
| 68 | 68 | 'output' => 'ARRAY_A', |
| 69 | - ) ); |
|
| 69 | + )); |
|
| 70 | 70 | |
| 71 | - if ( ! empty( $child ) ) { |
|
| 71 | + if (!empty($child)) { |
|
| 72 | 72 | return true; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | namespace eoxia; |
| 13 | 13 | |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if (!defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( '\eoxia\ZIP_Util' ) ) { |
|
| 18 | +if (!class_exists('\eoxia\ZIP_Util')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * Gestion des fichiers ZIP |
| 21 | 21 | */ |
@@ -47,20 +47,20 @@ discard block |
||
| 47 | 47 | * @type array $list_file Contenant plusieurs index avec le nom des fichiers dézippés. |
| 48 | 48 | * } |
| 49 | 49 | */ |
| 50 | - public function unzip( $zip_path, $destination_path ) { |
|
| 50 | + public function unzip($zip_path, $destination_path) { |
|
| 51 | 51 | $zip = new \ZipArchive; |
| 52 | - $data = array( 'state' => true, 'list_file' => array() ); |
|
| 52 | + $data = array('state' => true, 'list_file' => array()); |
|
| 53 | 53 | |
| 54 | - if ( $zip->open( $zip_path ) === true ) { |
|
| 55 | - if ( ! $zip->extractTo( $destination_path ) ) { |
|
| 54 | + if ($zip->open($zip_path) === true) { |
|
| 55 | + if (!$zip->extractTo($destination_path)) { |
|
| 56 | 56 | $data['state'] = false; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // Récupérations de tous les fichiers. |
| 60 | - for ( $i = 0; $i < $zip->numFiles; $i++ ) { |
|
| 61 | - $filename = $zip->getNameIndex( 0 ); |
|
| 60 | + for ($i = 0; $i < $zip->numFiles; $i++) { |
|
| 61 | + $filename = $zip->getNameIndex(0); |
|
| 62 | 62 | |
| 63 | - if ( isset( $filename ) ) { |
|
| 63 | + if (isset($filename)) { |
|
| 64 | 64 | $data['list_file'][] = $filename; |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -12,11 +12,11 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | namespace eoxia; |
| 14 | 14 | |
| 15 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 15 | +if (!defined('ABSPATH')) {
|
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if ( ! class_exists( '\eoxia\External_Util' ) ) {
|
|
| 19 | +if (!class_exists('\eoxia\External_Util')) {
|
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * Gestion des externals |
@@ -47,15 +47,15 @@ discard block |
||
| 47 | 47 | * bool Si aucune erreur s'est produite. |
| 48 | 48 | *} |
| 49 | 49 | */ |
| 50 | - public function exec( $path, $plugin_slug ) {
|
|
| 51 | - if ( empty( \eoxia\Config_Util::$init[ $plugin_slug ]->externals ) ) {
|
|
| 52 | - return new \WP_Error( 'broke', __( 'Aucun module a charger', $plugin_slug ) ); |
|
| 50 | + public function exec($path, $plugin_slug) {
|
|
| 51 | + if (empty(\eoxia\Config_Util::$init[$plugin_slug]->externals)) {
|
|
| 52 | + return new \WP_Error('broke', __('Aucun module a charger', $plugin_slug));
|
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if ( ! empty( \eoxia\Config_Util::$init[ $plugin_slug ]->externals ) ) {
|
|
| 56 | - foreach ( \eoxia\Config_Util::$init[ $plugin_slug ]->externals as $external_json_path ) {
|
|
| 57 | - self::inc_config( $plugin_slug, $path . $external_json_path ); |
|
| 58 | - self::inc( $plugin_slug, $path . $external_json_path ); |
|
| 55 | + if (!empty(\eoxia\Config_Util::$init[$plugin_slug]->externals)) {
|
|
| 56 | + foreach (\eoxia\Config_Util::$init[$plugin_slug]->externals as $external_json_path) {
|
|
| 57 | + self::inc_config($plugin_slug, $path . $external_json_path); |
|
| 58 | + self::inc($plugin_slug, $path . $external_json_path); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @return void |
| 75 | 75 | */ |
| 76 | - public function inc_config( $plugin_slug, $module_json_path ) {
|
|
| 77 | - \eoxia\Config_Util::g()->init_config( $module_json_path, $plugin_slug ); |
|
| 76 | + public function inc_config($plugin_slug, $module_json_path) {
|
|
| 77 | + \eoxia\Config_Util::g()->init_config($module_json_path, $plugin_slug); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -88,21 +88,21 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @return void |
| 90 | 90 | */ |
| 91 | - public function inc( $plugin_slug, $module_json_path ) {
|
|
| 92 | - $module_name = basename( $module_json_path, '.config.json' ); |
|
| 93 | - $module_path = dirname( $module_json_path ); |
|
| 91 | + public function inc($plugin_slug, $module_json_path) {
|
|
| 92 | + $module_name = basename($module_json_path, '.config.json'); |
|
| 93 | + $module_path = dirname($module_json_path); |
|
| 94 | 94 | |
| 95 | - if ( ! empty( \eoxia\Config_Util::$init['external'] ) ) {
|
|
| 96 | - foreach ( \eoxia\Config_Util::$init['external'] as $external_name => $config ) {
|
|
| 97 | - if ( ! empty( $config->dependencies ) ) {
|
|
| 98 | - foreach ( $config->dependencies as $folder_name => $folder_conf ) {
|
|
| 95 | + if (!empty(\eoxia\Config_Util::$init['external'])) {
|
|
| 96 | + foreach (\eoxia\Config_Util::$init['external'] as $external_name => $config) {
|
|
| 97 | + if (!empty($config->dependencies)) {
|
|
| 98 | + foreach ($config->dependencies as $folder_name => $folder_conf) {
|
|
| 99 | 99 | $path_to_module_and_dependence_folder = $config->path . '/' . $folder_name . '/'; |
| 100 | 100 | |
| 101 | - if ( ! empty( $folder_conf->priority ) ) {
|
|
| 102 | - $this->inc_priority_file( $path_to_module_and_dependence_folder, $folder_name, $folder_conf->priority ); |
|
| 101 | + if (!empty($folder_conf->priority)) {
|
|
| 102 | + $this->inc_priority_file($path_to_module_and_dependence_folder, $folder_name, $folder_conf->priority); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - \eoxia\Include_util::g()->in_folder( $path_to_module_and_dependence_folder ); |
|
| 105 | + \eoxia\Include_util::g()->in_folder($path_to_module_and_dependence_folder); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -120,13 +120,13 @@ discard block |
||
| 120 | 120 | * @param array $list_priority_file La liste des chemins des fichiers à inclure en priorité. |
| 121 | 121 | * @return void |
| 122 | 122 | */ |
| 123 | - public function inc_priority_file( $path_to_module_and_dependence_folder, $dependence_folder, $list_priority_file ) {
|
|
| 124 | - if ( ! empty( $list_priority_file ) ) {
|
|
| 125 | - foreach ( $list_priority_file as $file_name ) {
|
|
| 126 | - $path_file = realpath( $path_to_module_and_dependence_folder . $file_name . '.' . $dependence_folder . '.php' ); |
|
| 123 | + public function inc_priority_file($path_to_module_and_dependence_folder, $dependence_folder, $list_priority_file) {
|
|
| 124 | + if (!empty($list_priority_file)) {
|
|
| 125 | + foreach ($list_priority_file as $file_name) {
|
|
| 126 | + $path_file = realpath($path_to_module_and_dependence_folder . $file_name . '.' . $dependence_folder . '.php'); |
|
| 127 | 127 | |
| 128 | - if ( file_exists( $path_file ) ) {
|
|
| 129 | - require_once( $path_file ); |
|
| 128 | + if (file_exists($path_file)) {
|
|
| 129 | + require_once($path_file); |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | namespace eoxia; |
| 13 | 13 | |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if (!defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( '\eoxia\View_Util' ) ) { |
|
| 18 | +if (!class_exists('\eoxia\View_Util')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * Gestion des vues pour les templates. |
| 21 | 21 | */ |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @return void |
| 47 | 47 | */ |
| 48 | - public static function exec( $namespace, $module_name, $view_path_without_ext, $args = array(), $filter = true ) { |
|
| 49 | - $path_to_view = Config_Util::$init[ $namespace ]->$module_name->path . '/view/' . $view_path_without_ext . '.view.php'; |
|
| 48 | + public static function exec($namespace, $module_name, $view_path_without_ext, $args = array(), $filter = true) { |
|
| 49 | + $path_to_view = Config_Util::$init[$namespace]->$module_name->path . '/view/' . $view_path_without_ext . '.view.php'; |
|
| 50 | 50 | |
| 51 | - if ( $filter ) { |
|
| 52 | - $args = apply_filters( $module_name . '_' . $view_path_without_ext, $args, $module_name, $view_path_without_ext ); |
|
| 51 | + if ($filter) { |
|
| 52 | + $args = apply_filters($module_name . '_' . $view_path_without_ext, $args, $module_name, $view_path_without_ext); |
|
| 53 | 53 | } |
| 54 | - extract( $args ); |
|
| 55 | - require( $path_to_view ); |
|
| 54 | + extract($args); |
|
| 55 | + require($path_to_view); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | } // End if(). |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | namespace eoxia; |
| 13 | 13 | |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if (!defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( '\eoxia\Singleton_Util' ) ) { |
|
| 18 | +if (!class_exists('\eoxia\Singleton_Util')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * Le singleton |
| 21 | 21 | */ |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | * @return \eoxia\Singleton_Util L'instance courante |
| 57 | 57 | */ |
| 58 | 58 | final public static function g() { |
| 59 | - if ( ! isset( self::$instance ) || get_called_class() !== get_class( self::$instance ) ) { |
|
| 59 | + if (!isset(self::$instance) || get_called_class() !== get_class(self::$instance)) { |
|
| 60 | 60 | $class_name = get_called_class(); |
| 61 | 61 | $new_instance = new $class_name(); |
| 62 | 62 | // extending classes can set $instance to any value, so check to make sure it's still unset before giving it the default value. |
| 63 | - if ( ! isset( self::$instance ) || get_called_class() !== get_class( self::$instance ) ) { |
|
| 63 | + if (!isset(self::$instance) || get_called_class() !== get_class(self::$instance)) { |
|
| 64 | 64 | self::$instance = $new_instance; |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | namespace eoxia; |
| 13 | 13 | |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if (!defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( '\eoxia\JSON_Util' ) ) { |
|
| 18 | +if (!class_exists('\eoxia\JSON_Util')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * Méthodes utiles pour les fichiers JSON. |
| 21 | 21 | */ |
@@ -38,21 +38,21 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return array Les données du fichier JSON |
| 40 | 40 | */ |
| 41 | - public function open_and_decode( $path_to_json, $output = 'STDCLASS' ) { |
|
| 42 | - if ( ! file_exists( $path_to_json ) ) { |
|
| 43 | - return new \WP_Error( 'broke', __( 'Enabled to load JSON file', 'eoxia' ) ); |
|
| 41 | + public function open_and_decode($path_to_json, $output = 'STDCLASS') { |
|
| 42 | + if (!file_exists($path_to_json)) { |
|
| 43 | + return new \WP_Error('broke', __('Enabled to load JSON file', 'eoxia')); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - $config_content = file_get_contents( $path_to_json ); |
|
| 46 | + $config_content = file_get_contents($path_to_json); |
|
| 47 | 47 | |
| 48 | - if ( 'STDCLASS' === $output ) { |
|
| 49 | - $data = json_decode( $config_content ); |
|
| 50 | - } elseif ( 'ARRAY_A' === $output ) { |
|
| 51 | - $data = json_decode( $config_content, true ); |
|
| 48 | + if ('STDCLASS' === $output) { |
|
| 49 | + $data = json_decode($config_content); |
|
| 50 | + } elseif ('ARRAY_A' === $output) { |
|
| 51 | + $data = json_decode($config_content, true); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if ( null === $data && json_last_error() !== JSON_ERROR_NONE ) { |
|
| 55 | - return new \WP_Error( 'broke', __( 'Error in JSON file', 'eoxia' ) ); |
|
| 54 | + if (null === $data && json_last_error() !== JSON_ERROR_NONE) { |
|
| 55 | + return new \WP_Error('broke', __('Error in JSON file', 'eoxia')); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | return $data; |
@@ -67,18 +67,18 @@ discard block |
||
| 67 | 67 | * @param string $json_to_decode La chaine de caractère JSON. |
| 68 | 68 | * @return array Les données décodées |
| 69 | 69 | */ |
| 70 | - public function decode( $json_to_decode ) { |
|
| 71 | - if ( ! is_string( $json_to_decode ) ) { |
|
| 70 | + public function decode($json_to_decode) { |
|
| 71 | + if (!is_string($json_to_decode)) { |
|
| 72 | 72 | return $json_to_decode; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - $json_decoded = json_decode( $json_to_decode, true ); |
|
| 75 | + $json_decoded = json_decode($json_to_decode, true); |
|
| 76 | 76 | |
| 77 | - if ( ! $json_decoded ) { |
|
| 78 | - $json_to_decode = str_replace( '\\', '', $json_to_decode ); |
|
| 79 | - $json_decoded = json_decode( $json_to_decode, true ); |
|
| 77 | + if (!$json_decoded) { |
|
| 78 | + $json_to_decode = str_replace('\\', '', $json_to_decode); |
|
| 79 | + $json_decoded = json_decode($json_to_decode, true); |
|
| 80 | 80 | |
| 81 | - if ( ! $json_decoded ) { |
|
| 81 | + if (!$json_decoded) { |
|
| 82 | 82 | return $json_to_decode; |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | namespace eoxia; |
| 13 | 13 | |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if (!defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( '\eoxia\Include_Util' ) ) { |
|
| 18 | +if (!class_exists('\eoxia\Include_Util')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * Gestion des inclusions. |
| 21 | 21 | */ |
@@ -39,15 +39,15 @@ discard block |
||
| 39 | 39 | * @param string $folder_path Le chemin du dossier. |
| 40 | 40 | * @return void |
| 41 | 41 | */ |
| 42 | - public function in_folder( $folder_path ) { |
|
| 43 | - $list_file_name = scandir( $folder_path ); |
|
| 42 | + public function in_folder($folder_path) { |
|
| 43 | + $list_file_name = scandir($folder_path); |
|
| 44 | 44 | |
| 45 | - if ( ! empty( $list_file_name ) ) { |
|
| 46 | - foreach ( $list_file_name as $file_name ) { |
|
| 47 | - if ( '.' !== $file_name && '..' !== $file_name && 'index.php' !== $file_name && '.git' !== $file_name && 'README.md' !== $file_name ) { |
|
| 45 | + if (!empty($list_file_name)) { |
|
| 46 | + foreach ($list_file_name as $file_name) { |
|
| 47 | + if ('.' !== $file_name && '..' !== $file_name && 'index.php' !== $file_name && '.git' !== $file_name && 'README.md' !== $file_name) { |
|
| 48 | 48 | |
| 49 | - $file_path = realpath( $folder_path . $file_name ); |
|
| 50 | - $file_success = require_once( $file_path ); |
|
| 49 | + $file_path = realpath($folder_path . $file_name); |
|
| 50 | + $file_success = require_once($file_path); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | } |