diff --git a/extension.driver.php b/extension.driver.php index d66c883..44d7a46 100644 --- a/extension.driver.php +++ b/extension.driver.php @@ -5,7 +5,7 @@ /* * Subscribe to delegates */ - + public function getSubscribedDelegates() { return array( array( @@ -15,22 +15,22 @@ public function getSubscribedDelegates() { ), ); } - + /*********** DELEGATES ***********************/ /* * Appends resource (js/css) files references into the head, if needed * @param array $context */ - + public function appendResources() { - + // store callback array locally $c = Administration::instance()->getPageCallback(); // publish page, new or edit if(in_array($c['context']['page'], array('index', 'new', 'edit'))){ - + $page = Administration::instance()->Page; $page->addScriptToHead(URL.'/extensions/color_chooser_field/assets/jquery.farbtastic.js', 3001); @@ -41,31 +41,31 @@ public function appendResources() { return; } } - + /* * Delegate fired when the extension is installed */ - + public function install(){ return Symphony::Database()->query("CREATE TABLE `tbl_fields_colorchooser` ( - `id` int(11) unsigned NOT NULL auto_increment, - `field_id` int(11) unsigned NOT NULL, + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `field_id` INT(11) UNSIGNED NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `field_id` (`field_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"); } - + /* * Delegate fired when the extension is uninstalled * Cleans settings and Database */ - + public function uninstall() { try { Symphony::Database()->query("DROP TABLE `tbl_fields_colorchooser`"); } catch( Exception $e ){} return true; - } + } } ?> diff --git a/fields/field.colorchooser.php b/fields/field.colorchooser.php index c46a4d4..25016f1 100644 --- a/fields/field.colorchooser.php +++ b/fields/field.colorchooser.php @@ -74,19 +74,19 @@ function groupRecords($records){ return $groups; } - function displaySettingsPanel(XMLElement &$wrapper, $errors = NULL){ + function displaySettingsPanel(XMLElement &$wrapper, $errors = null){ parent::displaySettingsPanel($wrapper, $errors); /* Option Group */ - $optgroup = new XMLElement('div', NULL, array('class' => 'two columns')); + $optgroup = new XMLElement('div', null, array('class' => 'two columns')); $this->appendRequiredCheckbox($optgroup); $this->appendShowColumnCheckbox($optgroup); $wrapper->appendChild($optgroup); } - function displayPublishPanel(XMLElement &$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL, $entry_id = NULL){ + function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null){ $value = $data['value']; $label = Widget::Label($this->get('label')); @@ -94,22 +94,22 @@ function displayPublishPanel(XMLElement &$wrapper, $data = NULL, $flagWithError if( $this->get('required') != 'yes' ) $label->appendChild(new XMLElement('i', 'Optional')); $label->appendChild(Widget::Input('fields'.$fieldnamePrefix.'['.$this->get('element_name').']'.$fieldnamePostfix, (strlen($value) != 0 ? $value : '#'))); - if( $flagWithError != NULL ) $wrapper->appendChild(Widget::Error($label, $flagWithError)); + if( $flagWithError != null ) $wrapper->appendChild(Widget::Error($label, $flagWithError)); else $wrapper->appendChild($label); } - public function displayDatasourceFilterPanel(XMLElement &$wrapper, $data = NULL, $errors = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL){ + public function displayDatasourceFilterPanel(XMLElement &$wrapper, $data = null, $errors = null, $fieldnamePrefix = null, $fieldnamePostfix = null){ $wrapper->appendChild(new XMLElement('h4', $this->get('label').' '.$this->Name().'')); $label = Widget::Label('Value'); - $label->appendChild(Widget::Input('fields[filter]'.($fieldnamePrefix ? '['.$fieldnamePrefix.']' : '').'['.$this->get('id').']'.($fieldnamePostfix ? '['.$fieldnamePostfix.']' : ''), ($data ? General::sanitize($data) : NULL))); + $label->appendChild(Widget::Input('fields[filter]'.($fieldnamePrefix ? '['.$fieldnamePrefix.']' : '').'['.$this->get('id').']'.($fieldnamePostfix ? '['.$fieldnamePostfix.']' : ''), ($data ? General::sanitize($data) : null))); $wrapper->appendChild($label); $wrapper->appendChild(new XMLElement('p', 'Accepts a 6 character color hex value beginning with \'#\'.', array('class' => 'help'))); } - public function checkPostFieldData($data, &$message, $entry_id = NULL){ - $message = NULL; + public function checkPostFieldData($data, &$message, $entry_id = null){ + $message = null; if( $this->get('required') == 'yes' && strlen($data) == 0 ){ $message = "This is a required field."; @@ -196,9 +196,9 @@ public function prepareTextValue($data, $entry_id = null) { 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, - `value` varchar(32) default NULL, + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `entry_id` INT(11) UNSIGNED NOT NULL, + `value` VARCHAR(32) DEFAULT NULL, PRIMARY KEY (`id`), KEY `entry_id` (`entry_id`), KEY `value` (`value`)