PluginProbe
The WP Remote WordPress Plugin / 4.97
The WP Remote WordPress Plugin v4.97
6.72 6.69 6.65 6.62 6.48 6.47 4.87 4.97 5.05 5.09 5.16 5.22 5.24 5.25 5.38 5.41 5.42 5.45 5.47 5.53 5.56 5.65 5.68 5.72 5.73 All 53 releases
wpremote / callback / wings / dynsync.php

dynsync.php in The WP Remote WordPress Plugin 4.97, at callback/wings/dynsync.php

92 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) exit;
4 if (!class_exists('BVDynSyncCallback')) :
5
6 require_once dirname( __FILE__ ) . '/../../wp_dynsync.php';
7
8 class BVDynSyncCallback extends BVCallbackBase {
9 public $db;
10 public $settings;
11
12 const DYNSYNC_WING_VERSION = 1.0;
13
14 public function __construct($callback_handler) {
15 $this->db = $callback_handler->db;
16 $this->settings = $callback_handler->settings;
17 }
18
19 public function dropDynSyncTable() {
20 return $this->db->dropBVTable(BVWPDynSync::$dynsync_table);
21 }
22
23 public function createDynSyncTable($usedbdelta = false) {
24 $db = $this->db;
25 $charset_collate = $db->getCharsetCollate();
26 $table = $this->db->getBVTable(BVWPDynSync::$dynsync_table);
27 $query = "CREATE TABLE $table (
28 id bigint(20) NOT NULL AUTO_INCREMENT,
29 site_id int NOT NULL,
30 event_type varchar(40) NOT NULL DEFAULT '',
31 event_tag varchar(40) NOT NULL DEFAULT '',
32 event_data text NOT NULL DEFAULT '',
33 PRIMARY KEY (id)
34 ) $charset_collate;";
35 return $db->createTable($query, BVWPDynSync::$dynsync_table, $usedbdelta);
36 }
37
38 public function process($request) {
39 $settings = $this->settings;
40 $params = $request->params;
41 switch ($request->method) {
42 case "truncdynsynctable":
43 $resp = array("status" => $this->db->truncateBVTable(BVWPDynSync::$dynsync_table));
44 break;
45 case "dropdynsynctable":
46 $resp = array("status" => $this->dropDynSyncTable());
47 break;
48 case "createdynsynctable":
49 $usedbdelta = array_key_exists('usedbdelta', $params);
50 $resp = array("status" => $this->createDynSyncTable($usedbdelta));
51 break;
52 case "setdynsync":
53 if (array_key_exists('dynplug', $params)) {
54 $settings->updateOption('bvdynplug', $params['dynplug']);
55 } else {
56 $settings->deleteOption('bvdynplug');
57 }
58 $settings->updateOption('bvDynSyncActive', $params['dynsync']);
59 $resp = array("status" => "done");
60 break;
61 case "setwoodyn":
62 $resp = array("status" => $settings->updateOption('bvWooDynSync', $params['woodyn']));
63 break;
64 case "setignorednames":
65 switch ($params['table']) {
66 case "options":
67 $settings->updateOption('bvIgnoredOptions', $params['names']);
68 break;
69 case "postmeta":
70 $settings->updateOption('bvIgnoredPostmeta', $params['names']);
71 break;
72 }
73 $resp = array("status" => "done");
74 break;
75 case "getignorednames":
76 switch ($params['table']) {
77 case "options":
78 $names = $settings->getOption('bvIgnoredOptions');
79 break;
80 case "postmeta":
81 $names = $settings->getOption('bvIgnoredPostmeta');
82 break;
83 }
84 $resp = array("names", $names);
85 break;
86 default:
87 $resp = false;
88 }
89 return $resp;
90 }
91 }
92 endif;