diff --git a/extension.driver.php b/extension.driver.php index 30ed20d..67d450f 100644 --- a/extension.driver.php +++ b/extension.driver.php @@ -24,12 +24,12 @@ public function install() { return Symphony::Database()->query(sprintf( "CREATE TABLE `%s` ( - `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, `destination` VARCHAR(255) NOT NULL, `validator` VARCHAR(255), - `unique` enum('yes','no') DEFAULT 'yes', - `default_main_lang` enum('yes','no') NOT NULL DEFAULT 'no', + `unique` ENUM('yes','no') DEFAULT 'yes', + `default_main_lang` ENUM('yes','no') NOT NULL DEFAULT 'no', `required_languages` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `field_id` (`field_id`) @@ -200,10 +200,10 @@ public function dFLSavePreferences($context){ if( !in_array('file-'.$lc, $columns) ) Symphony::Database()->query(sprintf( 'ALTER TABLE `%1$s` - ADD COLUMN `file-%2$s` varchar(255) default NULL, - ADD COLUMN `size-%2$s` int(11) unsigned NULL, - ADD COLUMN `mimetype-%2$s` varchar(50) default NULL, - ADD COLUMN `meta-%2$s` varchar(255) default NULL;', + ADD COLUMN `file-%2$s` VARCHAR(255) DEFAULT NULL, + ADD COLUMN `size-%2$s` INT(11) UNSIGNED NULL, + ADD COLUMN `mimetype-%2$s` VARCHAR(50) DEFAULT NULL, + ADD COLUMN `meta-%2$s` VARCHAR(255) DEFAULT NULL;', $entries_table, $lc )); } diff --git a/fields/field.multilingual_upload.php b/fields/field.multilingual_upload.php index b2caa7b..d2bdee6 100644 --- a/fields/field.multilingual_upload.php +++ b/fields/field.multilingual_upload.php @@ -22,19 +22,19 @@ public function __construct(){ public function createTable(){ $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, - `file` varchar(255) default NULL, - `size` int(11) unsigned NULL, - `mimetype` varchar(50) default NULL, - `meta` varchar(255) default NULL,"; + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `entry_id` INT(11) UNSIGNED NOT NULL, + `file` VARCHAR(255) DEFAULT NULL, + `size` INT(11) UNSIGNED NULL, + `mimetype` VARCHAR(50) DEFAULT NULL, + `meta` VARCHAR(255) DEFAULT NULL,"; foreach( FLang::getLangs() as $lc ){ $query .= sprintf(' - `file-%1$s` varchar(255) default NULL, - `size-%1$s` int(11) unsigned NULL, - `mimetype-%1$s` varchar(50) default NULL, - `meta-%1$s` varchar(255) default NULL,', + `file-%1$s` VARCHAR(255) DEFAULT NULL, + `size-%1$s` INT(11) UNSIGNED NULL, + `mimetype-%1$s` VARCHAR(50) DEFAULT NULL, + `meta-%1$s` VARCHAR(255) DEFAULT NULL,', $lc ); } @@ -205,7 +205,7 @@ public function commit() /* Publish */ /*------------------------------------------------------------------------------------------------*/ - public function displayPublishPanel(XMLElement &$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL, $entry_id = NULL){ + public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null){ Extension_Frontend_Localisation::appendAssets(); Extension_Multilingual_Upload_Field::appendAssets(); @@ -287,8 +287,8 @@ public function displayPublishPanel(XMLElement &$wrapper, $data = NULL, $flagWit /*------------------------------------------------------------------------------------------------*/ foreach ($langs as $lc) { - $div = new XMLElement('div', NULL, array('class' => 'file tab-panel tab-'.$lc)); - $frame = new XMLElement('div', NULL, array('class' => 'frame')); + $div = new XMLElement('div', null, array('class' => 'file tab-panel tab-'.$lc)); + $frame = new XMLElement('div', null, array('class' => 'frame')); $file = 'file-'.$lc; @@ -324,7 +324,7 @@ public function displayPublishPanel(XMLElement &$wrapper, $data = NULL, $flagWit $flagWithError = __('Destination folder, %s, is not writable. Please check permissions.', array($this->get('destination'))); } - if ($flagWithError != NULL ) { + if ($flagWithError != null ) { $wrapper->appendChild(Widget::Error($container, $flagWithError)); } else { @@ -338,7 +338,7 @@ public function displayPublishPanel(XMLElement &$wrapper, $data = NULL, $flagWit /* Input */ /*------------------------------------------------------------------------------------------------*/ - public function checkPostFieldData($data, &$message, $entry_id = NULL){ + public function checkPostFieldData($data, &$message, $entry_id = null){ $error = self::__OK__; $field_data = $data; $all_langs = FLang::getAllLangs(); @@ -377,7 +377,7 @@ public function checkPostFieldData($data, &$message, $entry_id = NULL){ return $error; } - public function processRawFieldData($data, &$status, &$message = NULL, $simulate = false, $entry_id = NULL){ + public function processRawFieldData($data, &$status, &$message = null, $simulate = false, $entry_id = null){ if(!is_array($data) || empty($data)) { return parent::processRawFieldData($data, $status, $message, $simulate, $entry_id); } @@ -466,7 +466,7 @@ protected function getCurrentData($entry_id) { /* Output */ /*------------------------------------------------------------------------------------------------*/ - public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = NULL, $entry_id = NULL){ + public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = null, $entry_id = null){ $lang_code = $this->getLang($data); $data['file'] = $data["file-$lang_code"]; $data['size'] = $data["size-$lang_code"]; @@ -476,7 +476,7 @@ public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = fa } // @todo: remove and fallback to default (Symphony 2.5 only?) - public function prepareTableValue($data, XMLElement $link = NULL, $entry_id = null){ + public function prepareTableValue($data, XMLElement $link = null, $entry_id = null){ $lang_code = $this->getLang($data); $data['file'] = $data["file-$lang_code"]; $data['size'] = $data["size-$lang_code"]; @@ -490,7 +490,7 @@ public function prepareTextValue($data, $entry_id = null) { return strip_tags($data["file-$lc"]); } - public function getParameterPoolValue(array $data, $entry_id = NULL) { + public function getParameterPoolValue(array $data, $entry_id = null) { $lc = $this->getLang(); return $data["file-$lc"]; } @@ -517,7 +517,7 @@ public function getExampleFormMarkup(){ /* Utilities */ /*------------------------------------------------------------------------------------------------*/ - public function entryDataCleanup($entry_id, $data = NULL) + public function entryDataCleanup($entry_id, $data = null) { foreach( FLang::getLangs() as $lc ){ $file_location = WORKSPACE.'/'.ltrim($data['file-'.$lc], '/');