PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.13.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.13.0
2.13.0 2.13.1 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 All 80 releases
← All changes | includes/import/theme-options/code-star.php +39 -0 2.7.72.13.0 View file →
@@ -1,0 +1,39 @@
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 +}