class Wp_Generator_Activator { public static function activate() { goto xhnXv; bLsiJ: $query = $wpdb->prepare("SELECT ID FROM {$tblPosts} WHERE post_type = %s", 'wpg_project'); goto ZHIhr; Fk4tJ: O586Q: goto PswF5; xaCiq: goto o6t7s; goto xq9yQ; dgLIU: LFonv: goto oY_JF; K5qEO: $instance = new self(); goto jP0Ws; xhnXv: global $wpdb; goto Irjzv; PkchY: if (!$results_projects) { goto nfFsO; } goto muDrZ; nhBPU: $colonne_tblCustomPrompt = ['ID' => 'mediumint(11) NOT NULL AUTO_INCREMENT', 'cprompt_filename' => 'VARCHAR(255) DEFAULT \'\' NOT NULL', 'cprompt_content' => 'TEXT DEFAULT \'\' NOT NULL']; goto OxU17; RMEpO: $tblPosts = $wpdb->get_blog_prefix() . 'posts'; goto s2oUm; O46fr: $existing_prompt = $wpdb->get_results("SELECT * FROM {$tblcustomPrompt} ORDER BY cprompt_content ASC", ARRAY_A); goto m8OWk; XP9RK: wp_schedule_event(time(), 'hourly', 'wp_cron'); goto ChdIl; QhehA: $wpdb->insert($configTable, ['tbl_name' => 'tbl_g_config'], ['%s']); goto xaCiq; x3LXG: $ids_to_exclude = implode(',', $results); goto U4jdP; WrCq5: $colonne_tblApikey = ['ID' => 'mediumint(11) NOT NULL AUTO_INCREMENT', 'tbl_api_key_val' => 'VARCHAR(255) DEFAULT \'\' NOT NULL', 'tbl_api_quota_used' => 'float DEFAULT 0 NOT NULL', 'tbl_api_costs' => 'float DEFAULT 0 NOT NULL', 'nb_task_progress' => 'float DEFAULT 0 NOT NULL', 'api_key_status' => 'VARCHAR(255) DEFAULT \'\' NOT NULL', 'openai_model' => 'VARCHAR(255) DEFAULT \'["gpt-3.5-turbo"]\' NOT NULL']; goto iVMc2; pQEcL: if (!empty($result)) { goto re3RI; } goto QhehA; jP0Ws: $instance->create_new_table($configTable, $colonne_tbl_config); goto gxWAZ; lpA0v: $wpdb->query("UPDATE {$tblPosts} SET post_parent = 0 WHERE post_parent IN ({$ids_to_exclude}) AND post_status IN ('publish','draft','future')"); goto Fk4tJ; W2lGP: hQCUI: goto x3LXG; YU2jE: $wpdb->query($query); goto X3Fck; ChdIl: VFdRE: goto KyUva; upUcM: nfFsO: goto lpA0v; OxU17: $instance->create_new_table($tblcustomPrompt, $colonne_tblCustomPrompt); goto O46fr; gxcdk: $tblcustomPrompt = $wpdb->get_blog_prefix() . 'tbl_custom_prompt'; goto nhBPU; bsfZu: $wpdb->query("DROP TABLE IF EXISTS {$table_wp_log}"); goto gR5Nw; iVMc2: $instance->create_new_table($tblApikey, $colonne_tblApikey); goto gxcdk; A75M2: $wpdb->query($query); goto XBCzF; gR5Nw: $configTable = $wpdb->get_blog_prefix() . 'tbl_config'; goto iegdW; FpRq_: $colonne_tblCta = ['ID' => 'mediumint(11) NOT NULL AUTO_INCREMENT', 'nom_cta' => 'VARCHAR(255) DEFAULT \'\' NOT NULL', 'shortcode' => 'VARCHAR(255) DEFAULT \'\' NOT NULL', 'html_cta' => 'TEXT DEFAULT \'\' NOT NULL']; goto PeRUb; m8OWk: if (empty($existing_prompt)) { goto LFonv; } goto Al7cv; PswF5: if (!(defined('DISABLE_WP_CRON') && DISABLE_WP_CRON)) { goto VFdRE; } goto GIEMt; mJHjt: huzwR: goto dgLIU; X3Fck: $results_projects = $wpdb->get_results("SELECT p.* FROM {$tblPosts} AS p LEFT JOIN {$tbl_post_meta} AS pm ON p.ID = pm.post_id AND pm.meta_key = 'wpg_project_id' WHERE p.post_parent IN ({$ids_to_exclude}) AND pm.post_id IS NULL"); goto PkchY; U4jdP: $query = $wpdb->prepare("DELETE FROM {$tblPosts} WHERE post_type = %s AND post_parent NOT IN ( {$ids_to_exclude} ) AND post_status != 'publish' AND post_status != 'draft' AND post_status != 'future'", 'wpg_bulk'); goto YU2jE; s2oUm: $tbl_post_meta = $wpdb->get_blog_prefix() . 'postmeta'; goto bLsiJ; Irjzv: $table_wp_log = $wpdb->get_blog_prefix() . 'tbl_log'; goto bsfZu; PeRUb: $instance->create_new_table($tblcta, $colonne_tblCta); goto RMEpO; Al7cv: foreach ($existing_prompt as $cp) { goto VWkKD; ZmpGq: $filename = WPGENERATOR_PLUGIN_DIR . '/admin/partials/prompts/' . $nom_fichier; goto E0jJ8; E0jJ8: $handle = fopen($filename, 'w+'); goto amFe0; ru0fm: JwROF: goto CSGCs; vC_w1: $content_file = json_encode(json_decode($cp['cprompt_content'])); goto ZmpGq; zv_0v: fclose($handle); goto ru0fm; VWkKD: $nom_fichier = $cp['cprompt_filename']; goto vC_w1; amFe0: flock($handle, LOCK_EX); goto UIcXO; efvzx: flock($handle, LOCK_UN); goto zv_0v; UIcXO: fwrite($handle, $content_file); goto efvzx; CSGCs: } goto mJHjt; RGtf2: L2ac6: goto upUcM; fAxL7: if (!empty($results)) { goto hQCUI; } goto rG3MW; XBCzF: goto O586Q; goto W2lGP; GIEMt: remove_filter('wp', 'spawn_cron'); goto XP9RK; iegdW: $colonne_tbl_config = ['ID' => 'mediumint(11) NOT NULL AUTO_INCREMENT', 'tbl_name' => 'text NOT NULL', 'tbl_language' => 'VARCHAR(255) DEFAULT \'fr\' NOT NULL', 'tbl_add_faq' => 'BOOLEAN DEFAULT 0 NOT NULL', 'tbl_add_featured_img' => 'BOOLEAN DEFAULT 1 NOT NULL', 'tbl_add_content_img' => 'BOOLEAN DEFAULT 1 NOT NULL', 'tbl_rewrite_hn_scrap' => 'BOOLEAN DEFAULT 1 NOT NULL', 'tbl_licence' => 'VARCHAR(255) DEFAULT \'OK\' NOT NULL', 'tbl_licence_is_valid' => 'BOOLEAN DEFAULT FALSE NOT NULL', 'wpg_type_slug' => 'VARCHAR(60) DEFAULT \'wpg\' NOT NULL', 'wpg_prefered_model' => 'VARCHAR(60) DEFAULT \'GPT-3.5\' NOT NULL']; goto K5qEO; rG3MW: $query = $wpdb->prepare("DELETE FROM {$tblPosts} WHERE post_type = %s AND post_status != 'publish' AND post_status != 'draft' AND post_status != 'future'", 'wpg_bulk'); goto A75M2; gxWAZ: $result = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$configTable} WHERE tbl_name = %s", 'tbl_g_config')); goto pQEcL; xq9yQ: re3RI: goto iLCA6; muDrZ: foreach ($results_projects as $post) { add_post_meta($post->ID, 'wpg_project_id', $post->post_parent); kkpEx: } goto RGtf2; iLCA6: o6t7s: goto p38ub; ZHIhr: $results = $wpdb->get_col($query); goto fAxL7; oY_JF: $tblcta = $wpdb->get_blog_prefix() . 'tbl_cta'; goto FpRq_; p38ub: $tblApikey = $wpdb->get_blog_prefix() . 'tbl_apikey_liste'; goto WrCq5; KyUva: } public function create_new_table($tableName, $colonneTable) { goto trlWE; hk6cD: MVyWO: goto WC5Cy; Dr8bY: $sql = "CREATE TABLE {$tableName} (\r\n ID mediumint(11) NOT NULL AUTO_INCREMENT,\r\n PRIMARY KEY (ID)\r\n ) {$charset_collate};"; goto yrdVV; UTAhq: foreach ($columnsToRemove as $columnName => $columnIndex) { $wpdb->query("ALTER TABLE {$tableName} DROP COLUMN {$columnName}"); Ur24L: } goto yrn32; nMkAa: require_once ABSPATH . 'wp-admin/includes/upgrade.php'; goto V2PCE; w7dOt: $existingColumns = $wpdb->get_col("DESCRIBE {$tableName}"); goto HRGE7; HRGE7: $columnsToAdd = array_diff_key($colonneTable, array_flip($existingColumns)); goto Bg_Mn; yrdVV: dbDelta($sql); goto f8KoS; Bg_Mn: foreach ($columnsToAdd as $columnName => $columnType) { $wpdb->query("ALTER TABLE {$tableName} ADD COLUMN {$columnName} {$columnType}"); ti2CQ: } goto QCpIx; b5HBX: goto MVyWO; goto XRmsq; cRuQm: $charset_collate = $wpdb->get_charset_collate(); goto nMkAa; QCpIx: e1NhT: goto PSO55; f8KoS: foreach ($colonneTable as $columnName => $columnType) { goto VS0zx; zoIuA: VN_HJ: goto GReut; VS0zx: if (!($columnName != 'ID')) { goto M3Zmy; } goto hhcNo; hhcNo: $wpdb->query("ALTER TABLE {$tableName} ADD COLUMN {$columnName} {$columnType}"); goto w28Pr; w28Pr: M3Zmy: goto zoIuA; GReut: } goto r5r2X; yrn32: c65YN: goto b5HBX; r5r2X: SXjQ8: goto hk6cD; V2PCE: if ($wpdb->get_var("SHOW TABLES LIKE '{$tableName}'") != $tableName) { goto a90Fi; } goto w7dOt; PSO55: $columnsToRemove = array_diff_key(array_flip($existingColumns), $colonneTable); goto UTAhq; trlWE: global $wpdb; goto cRuQm; XRmsq: a90Fi: goto Dr8bY; WC5Cy: } }