diff --git a/extension.driver.php b/extension.driver.php index 9c952d7..e512a9c 100644 --- a/extension.driver.php +++ b/extension.driver.php @@ -6,12 +6,12 @@ public function install(){ try{ Symphony::Database()->query(" CREATE TABLE IF NOT EXISTS `tbl_fields_selectbox_link` ( - `id` int(11) unsigned NOT NULL auto_increment, - `field_id` int(11) unsigned NOT NULL, - `allow_multiple_selection` enum('yes','no') NOT NULL default 'no', - `hide_when_prepopulated` enum('yes','no') NOT NULL default 'no', + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `field_id` INT(11) UNSIGNED NOT NULL, + `allow_multiple_selection` ENUM('yes','no') NOT NULL default 'no', + `hide_when_prepopulated` ENUM('yes','no') NOT NULL default 'no', `related_field_id` VARCHAR(255) NOT NULL, - `limit` int(4) unsigned NOT NULL default '20', + `limit` INT(4) UNSIGNED NOT NULL default '20', PRIMARY KEY (`id`), KEY `field_id` (`field_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -90,7 +90,7 @@ public function update($previousVersion = false){ if(version_compare($previousVersion, '1.19', '<')){ try{ - Symphony::Database()->query("ALTER TABLE `tbl_fields_selectbox_link` ADD COLUMN `show_association` enum('yes','no') NOT NULL default 'yes'"); + Symphony::Database()->query("ALTER TABLE `tbl_fields_selectbox_link` ADD COLUMN `show_association` ENUM('yes','no') NOT NULL default 'yes'"); } catch(Exception $e){ // Discard diff --git a/fields/field.selectbox_link.php b/fields/field.selectbox_link.php index 321b0fc..320dd97 100755 --- a/fields/field.selectbox_link.php +++ b/fields/field.selectbox_link.php @@ -70,9 +70,9 @@ public function fetchSuggestionTypes() public function createTable(){ return Symphony::Database()->query( "CREATE TABLE IF NOT EXISTS `tbl_entries_data_" . $this->get('id') . "` ( - `id` int(11) unsigned NOT NULL auto_increment, - `entry_id` int(11) unsigned NOT NULL, - `relation_id` int(11) unsigned DEFAULT NULL, + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `entry_id` INT(11) UNSIGNED NOT NULL, + `relation_id` INT(11) UNSIGNED DEFAULT NULL, PRIMARY KEY (`id`), KEY `entry_id` (`entry_id`), KEY `relation_id` (`relation_id`) @@ -91,7 +91,7 @@ public function set($field, $value){ $this->_settings[$field] = $value; } - public function findOptions(array $existing_selection=NULL,$entry_id=NULL){ + public function findOptions(array $existing_selection = null, $entry_id = null){ $values = array(); $limit = $this->get('limit'); @@ -116,7 +116,7 @@ public function findOptions(array $existing_selection=NULL,$entry_id=NULL){ ); EntryManager::setFetchSorting($section->getSortingField(), $section->getSortingOrder()); - $entries = EntryManager::fetch(NULL, $section->get('id'), $limit, 0, null, null, false, false); + $entries = EntryManager::fetch(null, $section->get('id'), $limit, 0, null, null, false, false); $results = array(); foreach($entries as $entry) { @@ -157,7 +157,7 @@ public function getToggleStates(){ return $output; } - public function toggleFieldData(array $data, $newState, $entry_id=null){ + public function toggleFieldData(array $data, $newState, $entry_id = null){ $data['relation_id'] = $newState; return $data; } @@ -182,7 +182,7 @@ public function fetchAssociatedEntryIDs($value){ )); } - public function fetchAssociatedEntrySearchValue($data, $field_id=NULL, $parent_entry_id=NULL){ + public function fetchAssociatedEntrySearchValue($data, $field_id = null, $parent_entry_id = null){ // We dont care about $data, but instead $parent_entry_id if(!is_null($parent_entry_id)) return $parent_entry_id; @@ -442,7 +442,7 @@ public function displaySettingsPanel(XMLElement &$wrapper, $errors = null){ $wrapper->appendChild($label); // Options - $div = new XMLElement('div', NULL, array('class' => 'two columns')); + $div = new XMLElement('div', null, array('class' => 'two columns')); $wrapper->appendChild($div); // Allow selection of multiple items @@ -477,7 +477,7 @@ public function displaySettingsPanel(XMLElement &$wrapper, $errors = null){ } public function checkPostFieldData($data, &$message, $entry_id = null){ - $message = NULL; + $message = null; if (is_array($data)) { $data = isset($data['relation_id']) @@ -524,7 +524,7 @@ public function commit(){ SectionManager::removeSectionAssociation($id); foreach($this->get('related_field_id') as $field_id){ - SectionManager::createSectionAssociation(NULL, $id, $field_id, $this->get('show_association') == 'yes' ? true : false); + SectionManager::createSectionAssociation(null, $id, $field_id, $this->get('show_association') == 'yes' ? true : false); } return true; @@ -537,7 +537,7 @@ public function commit(){ public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null) { $entry_ids = array(); $options = array( - array(NULL, false, NULL) + array(null, false, null) ); if(!is_null($data['relation_id'])){ @@ -578,7 +578,7 @@ public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWit if($this->get('required') != 'yes') $label->appendChild(new XMLElement('i', __('Optional'))); $label->appendChild( Widget::Select($fieldname, $options, ($this->get('allow_multiple_selection') == 'yes' ? array( - 'multiple' => 'multiple') : NULL + 'multiple' => 'multiple') : null )) ); @@ -588,7 +588,7 @@ public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWit else $wrapper->appendChild($label); } - public function processRawFieldData($data, &$status, &$message=null, $simulate=false, $entry_id=null) { + public function processRawFieldData($data, &$status, &$message = null, $simulate = false, $entry_id = null) { $status = self::__OK__; $result = array(); @@ -636,7 +636,7 @@ public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = fa $wrapper->appendChild($list); } - public function getParameterPoolValue(array $data, $entry_id=NULL){ + public function getParameterPoolValue(array $data, $entry_id = null){ return $this->prepareExportValue($data, ExportableField::LIST_OF + ExportableField::ENTRY, $entry_id); } @@ -850,7 +850,7 @@ public function fetchFilterableOperators() ); } - public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation=false){ + public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation = false){ $field_id = $this->get('id'); if(preg_match('/^sql:\s*/', $data[0], $matches)) { @@ -962,7 +962,7 @@ private function getRelatedFieldsId() { return explode(',', $related_field_id); } - public function buildSortingSQL(&$joins, &$where, &$sort, $order='ASC'){ + public function buildSortingSQL(&$joins, &$where, &$sort, $order = 'ASC'){ if(in_array(strtolower($order), array('random', 'rand'))) { $sort = 'ORDER BY RAND()'; }