| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | -* | |
| 3 | +* | |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | // Disallow direct access. |
| 7 | 7 | defined('ABSPATH') or die("Access denied"); |
| @@ -11,9 +11,9 @@ | ||
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * This class should replace any other controllers that |
| 14 | 14 | * has methods for interacting with a single Block (e.g block-ajax!) |
| 15 | -* | |
| 15 | +* | |
| 16 | 16 | * All single Block actions (e.g edit, new and save) should be placed/moved here |
| 17 | 17 | * in the future! |
| 18 | 18 | */ |
| 19 | 19 | class CJTBlockController extends CJTAjaxController { |
| @@ -19,16 +19,16 @@ | ||
| 19 | 19 | class CJTBlockController extends CJTAjaxController { |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * put your comment there... |
| 23 | - * | |
| 23 | + * | |
| 24 | 24 | * @var mixed |
| 25 | 25 | */ |
| 26 | 26 | protected $controllerInfo = array('model' => 'x-block', 'model_file' => 'xblock'); |
| 27 | - | |
| 27 | + | |
| 28 | 28 | /** |
| 29 | 29 | * put your comment there... |
| 30 | - * | |
| 30 | + * | |
| 31 | 31 | */ |
| 32 | 32 | public function __construct() { |
| 33 | 33 | parent::__construct(); |
| 34 | 34 | // Actions! |
| @@ -37,18 +37,18 @@ | ||
| 37 | 37 | $this->registryAction('loadUrl'); |
| 38 | 38 | $this->registryAction('getCode'); |
| 39 | 39 | $this->registryAction('downloadCodeFile'); |
| 40 | 40 | } |
| 41 | - | |
| 41 | + | |
| 42 | 42 | /** |
| 43 | 43 | * put your comment there... |
| 44 | - * | |
| 44 | + * | |
| 45 | 45 | */ |
| 46 | 46 | public function downloadCodeFileAction() { |
| 47 | 47 | // BlockId, currentActiveFile. |
| 48 | - $blockId = sanitize_text_field( $_GET['blockId'] ); | |
| 49 | - $fileId = sanitize_text_field( $_GET['fileId'] ); | |
| 50 | - $returnAs = sanitize_text_field( $_GET['returnAs'] ); | |
| 48 | + $blockId = $_GET['blockId']; | |
| 49 | + $fileId = $_GET['fileId']; | |
| 50 | + $returnAs = $_GET['returnAs']; | |
| 51 | 51 | // Get current File Code. |
| 52 | 52 | $tblCodeFile = new CJTBlockFilesTable(cssJSToolbox::getInstance()->getDBDriver()); |
| 53 | 53 | $codeFile = $tblCodeFile->set('id', $fileId) |
| 54 | 54 | ->set('blockId', $blockId) |
| @@ -76,9 +76,9 @@ | ||
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * Query single block based on the provided criteria! |
| 80 | - * | |
| 80 | + * | |
| 81 | 81 | */ |
| 82 | 82 | public function getBlockByAction() { |
| 83 | 83 | // Initialize. |
| 84 | 84 | $returns = array_flip($_GET['returns']); |
| @@ -87,35 +87,35 @@ | ||
| 87 | 87 | $inputs['filter'] = $_GET['filter']; |
| 88 | 88 | // Query Block. |
| 89 | 89 | $this->response = array_intersect_key((array) $this->model->getBlockBy(), $returns); |
| 90 | 90 | } |
| 91 | - | |
| 91 | + | |
| 92 | 92 | /** |
| 93 | 93 | * Get assigment panel objects page. |
| 94 | - * | |
| 94 | + * | |
| 95 | 95 | */ |
| 96 | 96 | public function getAPOPAction() { |
| 97 | 97 | // Read inputs. |
| 98 | 98 | $iPerPage = (int) $_GET['iPerPage']; |
| 99 | 99 | $blockId = (int) $_GET['block']; |
| 100 | - $oTypeParams = (array) $_GET['typeParams']; | |
| 101 | - $offset = (int) $_GET['index']; | |
| 100 | + $oTypeParams = $_GET['typeParams']; | |
| 101 | + $offset = $_GET['index']; | |
| 102 | 102 | $assignedOnly = ($_GET['assignedOnly'] == 'false') ? false : true; |
| 103 | 103 | $initialize = ($_GET['initialize'] == 'false') ? false : true; |
| 104 | 104 | // Get the corresponding type object |
| 105 | 105 | // for handling the request. |
| 106 | - $typeName = (string) $oTypeParams['targetType']; | |
| 106 | + $typeName = $oTypeParams['targetType']; | |
| 107 | 107 | /** |
| 108 | 108 | * put your comment there... |
| 109 | - * | |
| 109 | + * | |
| 110 | 110 | * @var CJT_Models_Block_Assignmentpanel_Base |
| 111 | 111 | */ |
| 112 | 112 | $typeObject = CJT_Models_Block_Assignmentpanel_Base |
| 113 | - ::getInstance($assignedOnly, | |
| 113 | + ::getInstance($assignedOnly, | |
| 114 | 114 | $typeName, |
| 115 | - $offset, | |
| 116 | - $iPerPage, | |
| 117 | - $blockId, | |
| 115 | + $offset, | |
| 116 | + $iPerPage, | |
| 117 | + $blockId, | |
| 118 | 118 | $oTypeParams); |
| 119 | 119 | // Fetch next page. |
| 120 | 120 | $items = $typeObject->getItems(); |
| 121 | 121 | // Return result |
| @@ -123,20 +123,20 @@ | ||
| 123 | 123 | $this->response['items'] = $items; |
| 124 | 124 | // Return count only when the list is activated for |
| 125 | 125 | // the first time. |
| 126 | 126 | if ($initialize) { |
| 127 | - $this->response['total'] = $typeObject->getTotalCount(); | |
| 127 | + $this->response['total'] = $typeObject->getTotalCount(); | |
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | - | |
| 130 | + | |
| 131 | 131 | /** |
| 132 | 132 | * put your comment there... |
| 133 | - * | |
| 133 | + * | |
| 134 | 134 | * @deprecated this is just a redirect to the CJTBlockContoller::getAction(). |
| 135 | 135 | */ |
| 136 | 136 | protected function loadUrlAction() { |
| 137 | 137 | // Read inputs. |
| 138 | - $url = (string) $_GET['url']; | |
| 138 | + $url = $_GET['url']; | |
| 139 | 139 | // Read URL. |
| 140 | 140 | $response = wp_remote_get($url); |
| 141 | 141 | if ($error = $response instanceof WP_Error) { |
| 142 | 142 | // State an error! |