PluginProbe
CSS & JavaScript Toolbox / 6.0.9
CSS & JavaScript Toolbox v6.0.9
trunk 0.3 0.8 10 10.1 11 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.9.1 12 12.0 12.0.1 12.0.3 12.0.4 12.0.5 12.0.6 12.0.7 6.0 6.0.11 All 60 releases
← All changes | controllers/block-ajax.php +6 -102 11.56.0.9 View file →
@@ -32,53 +32,20 @@
32 32 add_action('wp_ajax_cjtoolbox_get_revision', array(&$this, '_doAction'));
33 33 add_action('wp_ajax_cjtoolbox_get_revisions', array(&$this, '_doAction'));
34 34 // Redirects
35 35 $this->registryAction('getBlockBy');
36 - $this->registryAction('getAPOP');
37 - $this->registryAction('restoreRevision');
38 - $this->registryAction('loadUrl');
39 - $this->registryAction('downloadCodeFile');
40 - $this->registryAction('getAllAssignment');
41 36 }
42 -
37 +
43 38 /**
44 39 * put your comment there...
45 40 *
46 41 * @deprecated this is just a redirect to the CJTBlockContoller::getAction().
47 42 */
48 - protected function downloadCodeFileAction() {
49 - // Pass to CJTBlockController!
50 - $this->redirect('block');
51 - }
52 -
53 - /**
54 - * put your comment there...
55 - *
56 - */
57 - protected function getAllAssignmentAction() {
58 - $this->redirect('block');
59 - }
60 -
61 - /**
62 - * put your comment there...
63 - *
64 - * @deprecated this is just a redirect to the CJTBlockContoller::getAction().
65 - */
66 - protected function getAPOPAction() {
67 - // Pass to CJTBlockController!
68 - $this->redirect('block');
69 - }
70 -
71 - /**
72 - * put your comment there...
73 - *
74 - * @deprecated this is just a redirect to the CJTBlockContoller::getAction().
75 - */
76 43 protected function getBlockByAction() {
77 44 // Pass to CJTBlockController!
78 45 $this->redirect('block');
79 46 }
80 -
47 +
81 48 /**
82 49 * put your comment there...
83 50 *
84 51 * @deprecated All will be moved to other controllers in the future versions.
@@ -102,31 +69,13 @@
102 69 *
103 70 * @deprecated All will be moved to other controllers in the future versions.
104 71 */
105 72 public function getRevisionAction() {
106 - // Initialize
107 73 $model = $this->getModel('blocks');
108 - $tblCodeFile = new CJTBlockFilesTable(cssJSToolbox::getInstance()->getDBDriver());
109 - // Inputs.
110 - $revisionId = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
111 74 // Get request parameters.
112 - $revision['id'] = $revisionId;
113 - $revision['fields'] = array('id', 'links', 'expressions', 'masterFile');
75 + $revision['id'] = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
76 + $revision['fields'] = array('id', 'code', 'pinPoint', 'links', 'expressions');
114 77 $revision = $model->getBlock($revision['id'], array(), $revision['fields']);
115 - // Get revisioned code file.
116 - $revision->code = $tblCodeFile->set('blockId', $revisionId)
117 - ->set('id', $revision->masterFile)
118 - ->load()
119 - ->getData()->code;
120 - // Discard Pins.
121 - $customPins = array_keys( CJTBlockModel::getCustomPins() );
122 -
123 - foreach ( $customPins as $customPinName )
124 - {
125 - $revision->{$customPinName} = false;
126 - }
127 -
128 - // Return revision.
129 78 $this->response = $revision;
130 79 }
131 80
132 81 /**
@@ -134,14 +83,12 @@
134 83 *
135 84 * @deprecated All will be moved to other controllers in the future versions.
136 85 */
137 86 public function getRevisionsAction() {
138 - // initialize.
139 87 $model = $this->getModel('blocks');
140 88 // Get request parameters.
141 89 $blockId = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
142 90 // Get block revisions.
143 - $revisions['filter']['masterFile'] = $_GET['activeFileId'];
144 91 $revisions['filter']['parent'] = $blockId;
145 92 $revisions['filter']['type'] = 'revision';
146 93 // Its mandatory to select fields instead of using just .*.
147 94 // This is because id field must be first to be used as the array key
@@ -151,58 +98,15 @@
151 98 // Create view.
152 99 $view = $this->getView('blocks/revisions');
153 100 // Push view vars.
154 101 $view->blockId = $blockId;
155 - $view->revisions = array_reverse($revisions);
102 + $view->revisions = $revisions;
156 103 // Set output header.
157 104 $this->httpContentType = 'text/html';
158 105 // Return view content.
159 106 $this->response = $view->getTemplate('default');
160 107 }
161 -
162 - /**
163 - * put your comment there...
164 - *
165 - * @deprecated this is just a redirect to the CJTBlockContoller::getAction().
166 - */
167 - protected function loadUrlAction() {
168 - // Pass to CJTBlockController!
169 - $this->redirect('block');
170 - }
171 -
172 - /**
173 - * put your comment there...
174 - *
175 - */
176 - protected function restoreRevisionAction() {
177 - // Initialize.
178 - $mdlBlocks = new CJTBlocksModel();
179 - $tblCodeFile = new CJTBlockFilesTable(cssJSToolbox::getInstance()->getDBDriver());
180 - // Get revision ID.
181 - $rId = (int) $_GET['rid'];
182 - $bId = (int) $_GET['bid'];
183 - // Get Revision Block + Revision Code.
184 - $revisionBlock = $mdlBlocks->getBlock($rId, array(), array('id', 'pinPoint', 'links', 'expressions', 'masterFile'));
185 - $revisionBlock->code = $tblCodeFile->set('blockId', $rId)
186 - ->set('id', $revisionBlock->masterFile)
187 - ->load()
188 - ->getData()->code;
189 - // If code === null set it to empoty string '' as null woulod
190 - // prevent the field from being in the query, cause SQL error.
191 - if ($revisionBlock->code === null) {
192 - $revisionBlock->code = '';
193 - }
194 - // Code File Fields.
195 - $revisionBlock->activeFileId = $revisionBlock->masterFile;
196 - $revisionBlock->masterFile = null; // This is just for querying CodeFile. DONT UPDATE.
197 - // Restore Block.
198 - $revisionBlock->id = $bId;
199 - $mdlBlocks->update($revisionBlock, true);
200 - $mdlBlocks->save();
201 - // Return TRUE.
202 - $this->response = true;
203 - }
204 -
108 +
205 109 /**
206 110 * Update exists block property value.
207 111 *
208 112 *