PluginProbe
Code Engine – PHP Snippets, AI Functions & Automation for WordPress / 0.4.0
Code Engine – PHP Snippets, AI Functions & Automation for WordPress v0.4.0
0.5.7 0.5.6 0.5.5 0.5.4 0.5.3 0.5.2 0.5.1 0.5.0 0.4.9 0.4.8 0.4.7 0.4.6 trunk 0.0.1 0.0.2 0.2.8 0.2.9 0.3.0 0.3.1 0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 All 33 releases
← All changes | classes/core.php +16 -20 0.3.70.4.0 View file →
@@ -20,9 +20,9 @@
20 20 public function __construct() {
21 21 global $mwcode;
22 22
23 23 $this->site_url = get_site_url();
24 - $this->is_rest = MeowCommon_Helpers::is_rest();
24 + $this->is_rest = MeowKit_MWCODE_Helpers::is_rest();
25 25 $this->is_cli = defined( 'WP_CLI' ) && WP_CLI;
26 26
27 27 // Snippets
28 28 $snippet = new Meow_MWCODE_Modules_Snippet( $this );
@@ -39,10 +39,10 @@
39 39 }
40 40
41 41 function init() {
42 42 // Initialize the licenser for Pro version
43 - if ( class_exists( 'MeowCommonPro_Licenser' ) ) {
44 - $this->licenser = new MeowCommonPro_Licenser( MWCODE_PREFIX, MWCODE_ENTRY, MWCODE_DOMAIN, MWCODE_ITEM_ID, MWCODE_VERSION );
43 + if ( class_exists( 'MeowKitPro_MWCODE_Licenser' ) ) {
44 + $this->licenser = new MeowKitPro_MWCODE_Licenser( MWCODE_PREFIX, MWCODE_ENTRY, MWCODE_DOMAIN, MWCODE_ITEM_ID, MWCODE_VERSION );
45 45 }
46 46
47 47 // Part of the core, settings and stuff
48 48 $this->admin = new Meow_MWCODE_Admin( $this );
@@ -110,8 +110,11 @@
110 110 "api_token" => md5( time() . rand() ),
111 111
112 112 //MCP
113 113 "mcp_support" => false,
114 +
115 + //MAINTENANCE
116 + "clean_uninstall" => false,
114 117 ];
115 118 }
116 119
117 120 function get_all_options( ) {
@@ -125,19 +128,15 @@
125 128 return $options;
126 129 }
127 130
128 131 function update_options( $options ) {
129 - $current_options = get_option($this->option_name);
130 132
131 - if ($current_options === $options) {
132 - // $this->log('💾 The options are already the expected value.');
133 - } else {
134 - if ( !update_option( $this->option_name, $options, false ) ) {
135 - $this->log( '💾 There was an issue updating the options.' );
136 - }
133 + $options = $this->sanitize_options( $options );
134 +
135 + if ( !update_option( $this->option_name, $options, false ) ) {
136 + $this->log( '💾 There was an issue updating the options.' );
137 137 }
138 -
139 - $options = $this->sanitize_options( $options );
138 +
140 139 return $options;
141 140 }
142 141
143 142 function update_option( $option, $value ) {
@@ -180,12 +179,8 @@
180 179 // Note: We don't disable MCP support here anymore
181 180 // It will be checked at runtime in the MCP class
182 181 }
183 182
184 - if ( $options_modified ) {
185 - update_option( $this->option_name, $options, false );
186 - }
187 -
188 183 return $options;
189 184 }
190 185
191 186 private function updateAIEngineStatus( &$options ) {
@@ -285,10 +280,10 @@
285 280 $value = array_map( 'trim', $value );
286 281 }
287 282
288 283 if ( $type === 'array' ) {
289 - $value = json_encode( $value );
290 - $value = str_replace( '\\', '', $value );
284 + // Convert to PHP array format instead of JSON
285 + $value = var_export( $value, true );
291 286 }
292 287
293 288 return [ $name, $value ];
294 289 }
@@ -441,13 +436,14 @@
441 436 if ( $index < count( $params['args'] ) - 1 ) {
442 437 $params['code'] .= ', ';
443 438 }
444 439 }
440 +
445 441 $params['code'] .= ");\necho print_r(\$mwcode_result, true);";
446 442
447 443 $error = null;
448 444 $output = null;
449 -
445 +
450 446 try {
451 447 ob_start();
452 448 eval( $params['code'] );
453 449 $output = ob_get_clean();
@@ -597,9 +593,9 @@
597 593 $blocked = false;
598 594 //$blocked = true;
599 595 }
600 596 // Block REST requests that aren't whitelisted
601 - elseif ( MeowCommon_Helpers::is_rest() && !Meow_MWCODE_Core::is_white_listed_rest() ) {
597 + elseif ( MeowKit_MWCODE_Helpers::is_rest() && !Meow_MWCODE_Core::is_white_listed_rest() ) {
602 598 $blocked = true;
603 599 }
604 600
605 601 if ( empty( $this->snippet ) ) {