PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / trunk
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder vtrunk
2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 All 78 releases
ablocks / includes / import / theme-options / code-star.php

code-star.php in aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder trunk, at includes/import/theme-options/code-star.php

40 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ABlocks\import\ThemeOptions;
4
5 use ABlocks\Helper;
6
7 class CodeStar {
8
9 public static function import( string $file_path ) {
10 Helper::emit_sse_message([
11 'action' => 'log',
12 'level' => 'info',
13 'message' => __( 'Starting CodeStar theme options import process.', 'ablocks' ),
14 ]);
15 if ( file_exists( $file_path ) ) {
16 //phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
17 $options_data = json_decode( file_get_contents( $file_path ), true );
18
19 // Apply the options data using Codestar functions
20 if ( function_exists( 'cs_set_option' ) ) {
21 foreach ( $options_data as $option_key => $option_value ) {
22 cs_set_option( $option_key, $option_value );
23 }
24 }
25 Helper::emit_sse_message([
26 'action' => 'log',
27 'level' => 'info',
28 'message' => __( 'Codestar theme options imported successfully.', 'ablocks' ),
29 ]);
30 } else {
31 Helper::emit_sse_message([
32 'action' => 'log',
33 'level' => 'warning',
34 'message' => __( 'Codestar theme options import file not found!', 'ablocks' ),
35 ]);
36 }//end if
37 }
38
39 }
40