$value ) { if ( in_array( $value, array( '..', '.' ), true ) ) { continue; } if ( ! strpos( $value, '.' ) ) { $sub_dir = scandir( trailingslashit( $dir ) . $value ); foreach ( $sub_dir as $sub_dir_value ) { if ( in_array( $sub_dir_value, array( '..', '.' ), true ) ) { continue; } $file = new SplFileInfo( $sub_dir_value ); $check_ext = $file->getExtension(); $ext = pathinfo( $sub_dir_value, PATHINFO_EXTENSION ); if ( 'php' === $ext ) { $json_file = str_replace( '.php', '.json', $sub_dir_value ); $str_replace = str_replace( '.php', '', $sub_dir_value ); $str_replace = str_replace( '-', '_', $str_replace ); $json_path = trailingslashit( WDKIT_BUILDER_PATH ) . "bricks/{$value}/{$json_file}"; $json_data = wp_json_file_decode( $json_path ); $w_type = ! empty( $json_data->widget_data->widgetdata->publish_type ) ? $json_data->widget_data->widgetdata->publish_type : ''; $widget_id = ! empty( $json_data->widget_data->widgetdata->widget_id ) ? $json_data->widget_data->widgetdata->widget_id : ''; if ( ! empty( $w_type ) && 'Publish' === $w_type ) { if( ! in_array( $widget_id , $server_w_unique ) ){ $file = trailingslashit( WDKIT_BUILDER_PATH ) . "/bricks/{$value}/{$sub_dir_value}"; if ( class_exists( 'Bricks\Elements' ) ) { Bricks\Elements::register_element( $file ); } } } } } } } } } Wdkit_Bricks_Files_Load::instance(); }