Skip to content

Commit 3a6f6d5

Browse files
author
Alexandra Nantel
committed
SQL and PHP cases
PHP true,false,null in lowercase SQL keywords uppercase
1 parent 3047c6f commit 3a6f6d5

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

extension.driver.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ public function install(){
66
try{
77
Symphony::Database()->query("
88
CREATE TABLE IF NOT EXISTS `tbl_fields_selectbox_link` (
9-
`id` int(11) unsigned NOT NULL auto_increment,
10-
`field_id` int(11) unsigned NOT NULL,
11-
`allow_multiple_selection` enum('yes','no') NOT NULL default 'no',
12-
`hide_when_prepopulated` enum('yes','no') NOT NULL default 'no',
9+
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
10+
`field_id` INT(11) UNSIGNED NOT NULL,
11+
`allow_multiple_selection` ENUM('yes','no') NOT NULL default 'no',
12+
`hide_when_prepopulated` ENUM('yes','no') NOT NULL default 'no',
1313
`related_field_id` VARCHAR(255) NOT NULL,
14-
`limit` int(4) unsigned NOT NULL default '20',
14+
`limit` INT(4) UNSIGNED NOT NULL default '20',
1515
PRIMARY KEY (`id`),
1616
KEY `field_id` (`field_id`)
1717
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
@@ -90,7 +90,7 @@ public function update($previousVersion = false){
9090

9191
if(version_compare($previousVersion, '1.19', '<')){
9292
try{
93-
Symphony::Database()->query("ALTER TABLE `tbl_fields_selectbox_link` ADD COLUMN `show_association` enum('yes','no') NOT NULL default 'yes'");
93+
Symphony::Database()->query("ALTER TABLE `tbl_fields_selectbox_link` ADD COLUMN `show_association` ENUM('yes','no') NOT NULL default 'yes'");
9494
}
9595
catch(Exception $e){
9696
// Discard

fields/field.selectbox_link.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ public function fetchSuggestionTypes()
7070
public function createTable(){
7171
return Symphony::Database()->query(
7272
"CREATE TABLE IF NOT EXISTS `tbl_entries_data_" . $this->get('id') . "` (
73-
`id` int(11) unsigned NOT NULL auto_increment,
74-
`entry_id` int(11) unsigned NOT NULL,
75-
`relation_id` int(11) unsigned DEFAULT NULL,
73+
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
74+
`entry_id` INT(11) UNSIGNED NOT NULL,
75+
`relation_id` INT(11) UNSIGNED DEFAULT NULL,
7676
PRIMARY KEY (`id`),
7777
KEY `entry_id` (`entry_id`),
7878
KEY `relation_id` (`relation_id`)
@@ -91,7 +91,7 @@ public function set($field, $value){
9191
$this->_settings[$field] = $value;
9292
}
9393

94-
public function findOptions(array $existing_selection=NULL,$entry_id=NULL){
94+
public function findOptions(array $existing_selection = null, $entry_id = null){
9595
$values = array();
9696
$limit = $this->get('limit');
9797

@@ -116,7 +116,7 @@ public function findOptions(array $existing_selection=NULL,$entry_id=NULL){
116116
);
117117

118118
EntryManager::setFetchSorting($section->getSortingField(), $section->getSortingOrder());
119-
$entries = EntryManager::fetch(NULL, $section->get('id'), $limit, 0, null, null, false, false);
119+
$entries = EntryManager::fetch(null, $section->get('id'), $limit, 0, null, null, false, false);
120120

121121
$results = array();
122122
foreach($entries as $entry) {
@@ -157,7 +157,7 @@ public function getToggleStates(){
157157
return $output;
158158
}
159159

160-
public function toggleFieldData(array $data, $newState, $entry_id=null){
160+
public function toggleFieldData(array $data, $newState, $entry_id = null){
161161
$data['relation_id'] = $newState;
162162
return $data;
163163
}
@@ -182,7 +182,7 @@ public function fetchAssociatedEntryIDs($value){
182182
));
183183
}
184184

185-
public function fetchAssociatedEntrySearchValue($data, $field_id=NULL, $parent_entry_id=NULL){
185+
public function fetchAssociatedEntrySearchValue($data, $field_id = null, $parent_entry_id = null){
186186
// We dont care about $data, but instead $parent_entry_id
187187
if(!is_null($parent_entry_id)) return $parent_entry_id;
188188

@@ -442,7 +442,7 @@ public function displaySettingsPanel(XMLElement &$wrapper, $errors = null){
442442
$wrapper->appendChild($label);
443443

444444
// Options
445-
$div = new XMLElement('div', NULL, array('class' => 'two columns'));
445+
$div = new XMLElement('div', null, array('class' => 'two columns'));
446446
$wrapper->appendChild($div);
447447

448448
// Allow selection of multiple items
@@ -477,7 +477,7 @@ public function displaySettingsPanel(XMLElement &$wrapper, $errors = null){
477477
}
478478

479479
public function checkPostFieldData($data, &$message, $entry_id = null){
480-
$message = NULL;
480+
$message = null;
481481

482482
if (is_array($data)) {
483483
$data = isset($data['relation_id'])
@@ -524,7 +524,7 @@ public function commit(){
524524

525525
SectionManager::removeSectionAssociation($id);
526526
foreach($this->get('related_field_id') as $field_id){
527-
SectionManager::createSectionAssociation(NULL, $id, $field_id, $this->get('show_association') == 'yes' ? true : false);
527+
SectionManager::createSectionAssociation(null, $id, $field_id, $this->get('show_association') == 'yes' ? true : false);
528528
}
529529

530530
return true;
@@ -537,7 +537,7 @@ public function commit(){
537537
public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null) {
538538
$entry_ids = array();
539539
$options = array(
540-
array(NULL, false, NULL)
540+
array(null, false, null)
541541
);
542542

543543
if(!is_null($data['relation_id'])){
@@ -578,7 +578,7 @@ public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWit
578578
if($this->get('required') != 'yes') $label->appendChild(new XMLElement('i', __('Optional')));
579579
$label->appendChild(
580580
Widget::Select($fieldname, $options, ($this->get('allow_multiple_selection') == 'yes' ? array(
581-
'multiple' => 'multiple') : NULL
581+
'multiple' => 'multiple') : null
582582
))
583583
);
584584

@@ -588,7 +588,7 @@ public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWit
588588
else $wrapper->appendChild($label);
589589
}
590590

591-
public function processRawFieldData($data, &$status, &$message=null, $simulate=false, $entry_id=null) {
591+
public function processRawFieldData($data, &$status, &$message = null, $simulate = false, $entry_id = null) {
592592
$status = self::__OK__;
593593
$result = array();
594594

@@ -636,7 +636,7 @@ public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = fa
636636
$wrapper->appendChild($list);
637637
}
638638

639-
public function getParameterPoolValue(array $data, $entry_id=NULL){
639+
public function getParameterPoolValue(array $data, $entry_id = null){
640640
return $this->prepareExportValue($data, ExportableField::LIST_OF + ExportableField::ENTRY, $entry_id);
641641
}
642642

@@ -850,7 +850,7 @@ public function fetchFilterableOperators()
850850
);
851851
}
852852

853-
public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation=false){
853+
public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation = false){
854854
$field_id = $this->get('id');
855855

856856
if(preg_match('/^sql:\s*/', $data[0], $matches)) {
@@ -962,7 +962,7 @@ private function getRelatedFieldsId() {
962962
return explode(',', $related_field_id);
963963
}
964964

965-
public function buildSortingSQL(&$joins, &$where, &$sort, $order='ASC'){
965+
public function buildSortingSQL(&$joins, &$where, &$sort, $order = 'ASC'){
966966
if(in_array(strtolower($order), array('random', 'rand'))) {
967967
$sort = 'ORDER BY RAND()';
968968
}

0 commit comments

Comments
 (0)