From e772042d9ea271a7730346eab0e133c31a81d5e0 Mon Sep 17 00:00:00 2001 From: Alexandra Nantel Date: Fri, 28 Apr 2017 16:35:16 -0400 Subject: [PATCH 01/11] Update for Symphony 4.x Update release version. Update styles to match with Symphony 4.x layout. Include css file in Edit pages too. --- assets/section.oembed.css | 51 ++++++++++++++++++++++++++++++++---- extension.driver.php | 54 +++++++++++++++++++-------------------- extension.meta.xml | 45 +++++++++++++++++--------------- 3 files changed, 96 insertions(+), 54 deletions(-) diff --git a/assets/section.oembed.css b/assets/section.oembed.css index d6c619a..bfc2950 100644 --- a/assets/section.oembed.css +++ b/assets/section.oembed.css @@ -5,15 +5,56 @@ /** * CSS for the blueprintsection driver - * + * * @author nicolas */ div.compact label.oembed-other-title { - width:90%; - margin: 0 0 1.5rem 1.5rem; + width: calc(100% - 3rem); + margin: 0 0 0 3rem; } -.oembed-params-settings { - margin: 0 0 1.5rem 0; +.field-oembed label > div { + margin-top: 2px; +} + +.field-oembed label .frame { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + flex-wrap: wrap; +} + +.field-oembed label .frame > span { + display: none; +} + +.field-oembed label .frame > div { + order: 99; + flex-shrink: 0; + width: 100%; +} + +.field-oembed label .frame > a { + border-radius: 5px; + color: #fff; + font-size: 1.1rem; + font-style: normal; + font-weight: 300; + text-transform: uppercase; + line-height: 1.6rem; + margin-bottom: 1rem; + padding: 0.5rem 1rem; + border: none; + background: #2f77eb; + cursor: pointer; +} + +.field-oembed label .frame > a:hover { + background: #3B3D40; +} + +.field-oembed label .frame > a + span + a { + margin-left: 1rem; } diff --git a/extension.driver.php b/extension.driver.php index 48bf5a4..9072f9b 100644 --- a/extension.driver.php +++ b/extension.driver.php @@ -75,13 +75,11 @@ public function appendJS(Array $context) { time(), false ); - - return; } // section page, new or edit - if($c['driver'] == 'blueprintssections') { + if($c['driver'] == 'blueprintssections' || (isset($c['context']['section_handle']) && in_array($c['context']['page'], array('new', 'edit')))) { Administration::instance()->Page->addStylesheetToHead( URL . '/extensions/oembed_field/assets/section.oembed.css', @@ -89,9 +87,9 @@ public function appendJS(Array $context) { time() + 1, false ); - - return; } + + return; } @@ -103,26 +101,26 @@ public function appendJS(Array $context) { public function install() { // pre v1.3.1 $create = FieldOembed::createFieldTable(); - + // v1.3.1 $unique = FieldOembed::updateFieldTable_Unique(); - + // v1.3.2 $thumbs = FieldOembed::updateFieldTable_Thumbs(); - + // v1.4 $params = FieldOembed::updateFieldTable_QueryParams(); - + // v1.6 $ssl = FieldOembed::updateFieldTable_ForceSSL(); - + // v1.7.3 $uniqueMedia = FieldOembed::updateFieldTable_UniqueMedia(); - + return $create && $unique && $thumbs && $params && $ssl && $uniqueMedia; - + } - + /** * Creates the table needed for the settings of the field */ @@ -133,45 +131,45 @@ public function update($previousVersion = false) { if ($ret && version_compare($previousVersion,'1.3.1') == -1) { // update for unique setting $ret_unique = FieldOembed::updateFieldTable_Unique(); - + // set the return value $ret = $ret_unique; } - + // are we updating from lower than 1.3.2 ? if ($ret && version_compare($previousVersion, '1.3.2') == -1) { - + // update for the thumbs settings $ret_thumbs = FieldOembed::updateFieldTable_Thumbs(); - + // v1.4 // update for the params settings $ret_params = FieldOembed::updateFieldTable_QueryParams(); - + // update for the driver column && set all drivers as allowed by default $ret_driver = FieldOembed::updateFieldTable_Driver() && FieldOembed::updateFieldData_Driver(); - + // set the return value $ret = $ret_thumbs && $ret_params && $ret_driver; } - + // are we updating from lower or equal to 1.4 ? if ($ret && version_compare($previousVersion, '1.4') < 1) { // Fixes issue #22 $ret = FieldOembed::updateDataTable_Driver(); } - + // are we updating from lower then 1.6 ? if ($ret && version_compare($previousVersion, '1.6') < 0) { $ret = FieldOembed::updateFieldTable_ForceSSL(); } - + // are we updating from lower then 1.7.3 ? if ($ret && version_compare($previousVersion, '1.7.3') < 0) { $ret = FieldOembed::updateFieldTable_UniqueMedia(); } - + // are we updating from lower then 1.8 ? if ($ret && version_compare($previousVersion, '1.8') < 0) { $ret = FieldOembed::updateFieldTable_UniqueKey(); @@ -180,10 +178,10 @@ public function update($previousVersion = false) { if ($ret && version_compare($previousVersion, '1.8') < 0) { $ret = FieldOembed::updateDataTable_UniqueKey(); } - + return $ret; } - + /** * * Drops the table needed for the settings of the field @@ -191,8 +189,8 @@ public function update($previousVersion = false) { public function uninstall() { // pre v1.3.2 $field = FieldOembed::deleteFieldTable(); - + return $field; } - - } \ No newline at end of file + + } diff --git a/extension.meta.xml b/extension.meta.xml index 88f5897..13d86f6 100644 --- a/extension.meta.xml +++ b/extension.meta.xml @@ -50,6 +50,9 @@ + + - Update for Symphony 4.x + - Fix a PHP warning: CURLOPT are constants - Fix error in PHP 5.3: curl_strerror is 5.4+ @@ -157,57 +160,57 @@ - Refactored the request url parameters feature: You can add values to the oEmbed query string - YouTube driver fix for the shorten domain (part of issue #19) - Added the `show thumbnails in table` parameter: if disabled, title or url will be used - - Changes between the two branches (master and dev) are now synced + - Changes between the two branches (master and dev) are now synced - **This release has never been stable** - - Minor bug fixes + - Minor bug fixes - Added the `oembed requests parameters sets` field's setting (issue #11) ([see how it work]) (@deprecated) - Fixed a lot of typos (thanks @brando) - Tables now uses utf_8 and MyISAM - Refactored the drivers: They are now more easy to implement - - Changes between the two branches (master and dev) are now synced + - Changes between the two branches (master and dev) are now synced - Added the Twitter Driver :) Thanks @briandrum ! - - Added assets for the blueprints>section pages - - Added the 'unique' option - url can now be unique across a section + - Added assets for the blueprints>section pages + - Added the 'unique' option - url can now be unique across a section - Added Dailymotion, Qik (fix issue #9) and Viddler drivers (thanks Andrew!, pull request #8) - - Improved comments (a lot!) - - Fix a typo (issue #6) - - Added support for image (thumbnail) in table view (do not forget to add those site in JIT) + - Improved comments (a lot!) + - Fix a typo (issue #6) + - Added support for image (thumbnail) in table view (do not forget to add those site in JIT) - Refactored how the drivers are managed in the ServiceDispatcher (issue #10) - + - Public methods to get drivers and drivers names - Drivers are now all loaded by default - Drivers filename must now respect the `class.service[a-zA-Z0-9]+.php` regular expression - - Drivers are now listed in section field and publish page + - Drivers are now listed in section field and publish page - - Improved error management - Added a ref flag for that in the public method - - Added a method that permit change of the root tag name in the oEmbed response + - Improved error management - Added a ref flag for that in the public method + - Added a method that permit change of the root tag name in the oEmbed response - + - Update the YouTube driver to 1.2 - Fix when the entered url contains a # - + - Update the YouTube driver to 1.1 - Fix the width when the field is in the sidebar - + - Update for Symphony 2.2.2 compatibility - (do not need to check for the $simulate value as it seems to be always true) + (do not need to check for the $simulate value as it seems to be always true) - - - Couple of bug fixes + + - Couple of bug fixes - Adapted the code so oEmbed resources in the sidebar displays correctly - + - Added YouTube - + - First release - \ No newline at end of file + From d7823a101998dfb0b89bda09bfac14982afb5469 Mon Sep 17 00:00:00 2001 From: Alexandra Nantel Date: Wed, 17 May 2017 11:00:13 -0400 Subject: [PATCH 02/11] Update php-min/php-max info --- extension.meta.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension.meta.xml b/extension.meta.xml index 13d86f6..eda4322 100644 --- a/extension.meta.xml +++ b/extension.meta.xml @@ -50,7 +50,7 @@ - + - Update for Symphony 4.x From d1a7256b5741b6eef1aa3092730d37445344f31d Mon Sep 17 00:00:00 2001 From: Alexandra Nantel Date: Fri, 26 May 2017 15:08:54 -0400 Subject: [PATCH 03/11] Style fixes --- assets/section.oembed.css | 1 - 1 file changed, 1 deletion(-) diff --git a/assets/section.oembed.css b/assets/section.oembed.css index bfc2950..cd28def 100644 --- a/assets/section.oembed.css +++ b/assets/section.oembed.css @@ -41,7 +41,6 @@ div.compact label.oembed-other-title { color: #fff; font-size: 1.1rem; font-style: normal; - font-weight: 300; text-transform: uppercase; line-height: 1.6rem; margin-bottom: 1rem; From eb592fe16ce33d6831f232e66d55dca48c3f78c4 Mon Sep 17 00:00:00 2001 From: Alexandra Nantel Date: Thu, 24 Aug 2017 15:54:35 -0400 Subject: [PATCH 04/11] SQL and PHP cases PHP true,false,null in lowercase SQL keywords uppercase --- fields/field.oembed.php | 184 +++++++++++++-------------- lib/class.serviceDriver.php | 14 +- lib/drivers/class.serviceYouTube.php | 4 +- lib/parsers/class.parser.json.php | 10 +- lib/parsers/class.parser.xml.php | 4 +- 5 files changed, 108 insertions(+), 108 deletions(-) diff --git a/fields/field.oembed.php b/fields/field.oembed.php index 5f0433f..9f394ac 100644 --- a/fields/field.oembed.php +++ b/fields/field.oembed.php @@ -5,7 +5,7 @@ require_once(TOOLKIT . '/class.field.php'); require_once(EXTENSIONS . '/oembed_field/lib/class.serviceDispatcher.php'); require_once(EXTENSIONS . '/oembed_field/lib/class.serviceDriver.php'); - + /** * * Field class that will represent an oEmbed resource @@ -76,7 +76,7 @@ public function canPrePopulate(){ public function mustBeUnique(){ return ($this->get('unique') == 'yes'); } - + /** * This returns true if resource can only be used once across this field. */ @@ -95,7 +95,7 @@ public function requiresSQLGrouping(){ public function allowDatasourceParamOutput(){ return false; // @todo: should we allow to output the url ? } - + /** * @return array */ @@ -119,23 +119,23 @@ public function forceSSL() { * @param $message * @param $entry_id */ - public function checkPostFieldData($data, &$message, $entry_id=NULL){ + public function checkPostFieldData($data, &$message, $entry_id = null){ - $message = NULL; + $message = null; $required = ($this->get('required') == 'yes'); if ($required && strlen($data) == 0){ $message = __("'%s' is a required field.", array($this->get('label'))); return self::__MISSING_FIELDS__; } - + $url = $data; - + if (strlen($url) > 0 && !filter_var($url, FILTER_VALIDATE_URL)) { $message = __("%s: '%s' is not a valid URL.", array($this->get('label'), $url)); return self::__INVALID_FIELDS__; } - + $driver = ServiceDispatcher::getServiceDriver($url, $this->getAllowedDrivers()); // valid driver @@ -143,13 +143,13 @@ public function checkPostFieldData($data, &$message, $entry_id=NULL){ $message = __("%s: No ServiceDriver found for '%s'.", array($this->get('label'), $url)); return self::__INVALID_FIELDS__; } - + // uniqueness if (strlen($url) > 0 && $this->resourceMustBeUnique() && !$this->checkUniqueness($url, $entry_id)) { $message = __("%s: This field must be unique. An entry already contains this url.", array($this->get('label'), $url)); return self::__INVALID_FIELDS__; } - + return self::__OK__; } @@ -359,7 +359,7 @@ public function commit() { $settings['thumbs'] = empty($thumbs) ? 'no' : $thumbs; // @todo implement this - // do not comment the next line, as we can not store NULL into it + // do not comment the next line, as we can not store null into it $settings['refresh'] = $refresh; // Permit only some specific drivers @@ -367,7 +367,7 @@ public function commit() { // Force SSL setting $settings['force_ssl'] = empty($force_ssl) ? 'no' : $force_ssl; - + // the 'unique media' setting $settings['unique_media'] = empty($uniqueMedias) ? 'no' : $uniqueMedias; @@ -429,7 +429,7 @@ public function fetchIncludableElements() { * @param $wrapper * @param $data */ - 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) { if(!is_array($data) || empty($data) || empty($data['url'])) return; @@ -437,7 +437,7 @@ public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = fa /*if ((time() - $data['last_updated']) > ($this->_fields['refresh'] * 60)) { $data = VimeoHelper::updateClipInfo($data['clip_id'], $this->_fields['id'], $wrapper->getAttribute('id'), $this->Database); }*/ - + // store a pointer to the driver // @todo: use the `driver` column $driver = ServiceDispatcher::getServiceDriver($data['url'], $this->getAllowedDrivers()); @@ -449,21 +449,21 @@ public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = fa if ($parser == null) { throw new Exception('Unable to find parser for format: `' . $apiFormat . '`'); } - + // root for all values $field = new XMLElement($this->get('element_name')); - + $field->setAttributeArray(array( 'id' => $data['res_id'] )); - + $title = new XMLElement('title', General::sanitize($data['title'])); $title->setAttribute('handle', Lang::createHandle($data['title'])); $field->appendChild($title); $field->appendChild(new XMLElement('url', General::sanitize($data['url']))); $field->appendChild(new XMLElement('thumbnail', General::sanitize($data['thumbnail_url']))); $field->appendChild(new XMLElement('driver', General::sanitize($data['driver']))); - + $protocols = new XMLElement('protocols'); if ($driver->supportsSSL()) { $protocols->appendChild(new XMLElement('item', 'https')); @@ -555,7 +555,7 @@ public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = fa * @param string $fieldnamePrefix * @param string $fieldnamePostfix */ - 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) { $isRequired = $this->get('required') == 'yes'; $isUnique = $this->get('unique') == 'yes'; @@ -599,7 +599,7 @@ public function displayPublishPanel(XMLElement &$wrapper, $data = NULL, $flagWit __('Supported services: ') . implode(', ', $driverlinks) ); - if (strlen($value) == 0 || $flagWithError != NULL) { + if (strlen($value) == 0 || $flagWithError != null) { // do nothing @@ -654,7 +654,7 @@ public function displayPublishPanel(XMLElement &$wrapper, $data = NULL, $flagWit $label->appendChild($drivers); // error management - if($flagWithError != NULL) { + if($flagWithError != null) { $wrapper->appendChild(Widget::Error($label, $flagWithError)); } else { $wrapper->appendChild($label); @@ -667,13 +667,13 @@ public function displayPublishPanel(XMLElement &$wrapper, $data = NULL, $flagWit * @param XMLElement $wrapper * @param array $errors */ - public function displaySettingsPanel(XMLElement &$wrapper, $errors=NULL){ + public function displaySettingsPanel(XMLElement &$wrapper, $errors = null){ /* first line, label and such */ parent::displaySettingsPanel($wrapper, $errors); /* new line, drivers */ - $driv_wrap = new XMLElement('div', NULL, array('class'=>'oembed-drivers')); + $driv_wrap = new XMLElement('div', null, array('class'=>'oembed-drivers')); $driv_title = new XMLElement('label',__('Supported services Select to enable the service in the publish page')); $driv_title->appendChild(self::generateDriversSelectOptions($this->get(), 'fields['.$this->get('sortorder').'][driver][]')); if (isset($errors['driver'])) { @@ -682,20 +682,20 @@ public function displaySettingsPanel(XMLElement &$wrapper, $errors=NULL){ $driv_wrap->appendChild($driv_title); /* new line, update settings */ - $set_wrap = new XMLElement('div', NULL, array('class'=>'group')); + $set_wrap = new XMLElement('div', null, array('class'=>'group')); $label = Widget::Label(__('Update cache in minutes (leave blank to never update) Optional')); $label->appendChild(Widget::Input('fields['.$this->get('sortorder').'][refresh]', $this->get('refresh'))); $set_wrap->appendChild($label); /* new line, request params */ // Fixes issue #11 - $par_wrap = new XMLElement('div', NULL, array('class'=>'oembed-params-settings')); + $par_wrap = new XMLElement('div', null, array('class'=>'oembed-params-settings')); $par_title = new XMLElement('label', __('Request URL Parameters (Appended to the query string) Optional')); $par_title->appendChild(Widget::Input('fields['.$this->get('sortorder').'][query_params]', $this->get('query_params'))); $par_wrap->appendChild($par_title); /* new line, check boxes */ - $chk_wrap = new XMLElement('div', NULL, array('class' => 'compact two columns')); + $chk_wrap = new XMLElement('div', null, array('class' => 'compact two columns')); $chk_wrap->appendChild(new XMLElement('label', __('Other properties'), array('class'=>'oembed-other-title') )); $this->appendRequiredCheckbox($chk_wrap); $this->appendShowColumnCheckbox($chk_wrap); @@ -715,22 +715,22 @@ public static function generateDriversSelectOptions($settings, $name) { $drivers = ServiceDispatcher::getAllDriversNames(); sort($drivers, SORT_STRING); $drivers_options = array(); - + if (is_array($settings)) { $settings = (object) $settings; } - + // patch $d = $settings->{'driver'}; if (is_array($d)) { $d = implode(',', $d); } - + foreach ($drivers as $driver) { $selected = strpos($d, $driver) > -1; $drivers_options[] = array($driver, $selected); } - + return Widget::Select($name, $drivers_options, array('multiple'=>'multiple')); } @@ -740,47 +740,47 @@ public static function generateDriversSelectOptions($settings, $name) { * @param XMLElement $wrapper */ private function appendMustBeUniqueCheckbox(&$wrapper) { - $label = new XMLElement('label', NULL, array('class' => 'column')); - $chk = new XMLElement('input', NULL, array('name' => 'fields['.$this->get('sortorder').'][unique]', 'type' => 'checkbox')); - + $label = new XMLElement('label', null, array('class' => 'column')); + $chk = new XMLElement('input', null, array('name' => 'fields['.$this->get('sortorder').'][unique]', 'type' => 'checkbox')); + $label->appendChild($chk); $label->setValue(__('Make this field unique in the section'), false); if ($this->get('unique') == 'yes') { $chk->setAttribute('checked','checked'); } - + $wrapper->appendChild($label); } - + /** * * Utility (private) function to append a checkbox for the 'unique media' setting * @param XMLElement $wrapper */ private function appendResourceMustBeUniqueCheckbox(&$wrapper) { - $label = new XMLElement('label', NULL, array('class' => 'column')); - $chk = new XMLElement('input', NULL, array('name' => 'fields['.$this->get('sortorder').'][unique_media]', 'type' => 'checkbox')); - + $label = new XMLElement('label', null, array('class' => 'column')); + $chk = new XMLElement('input', null, array('name' => 'fields['.$this->get('sortorder').'][unique_media]', 'type' => 'checkbox')); + $label->appendChild($chk); $label->setValue(__('Make this field checks to insure resources are used only once across the field'), false); - + if ($this->get('unique_media') == 'yes') { $chk->setAttribute('checked','checked'); } - + $wrapper->appendChild($label); } - - + + /** * * Utility (private) function to append a checkbox for the 'thumbs' setting * @param XMLElement $wrapper */ private function appendShowThumbnailCheckbox(&$wrapper) { - $label = new XMLElement('label', NULL, array('class' => 'column')); - $chk = new XMLElement('input', NULL, array('name' => 'fields['.$this->get('sortorder').'][thumbs]', 'type' => 'checkbox')); + $label = new XMLElement('label', null, array('class' => 'column')); + $chk = new XMLElement('input', null, array('name' => 'fields['.$this->get('sortorder').'][thumbs]', 'type' => 'checkbox')); $label->appendChild($chk); $label->setValue(__('Show thumbnails in table'), false); @@ -798,8 +798,8 @@ private function appendShowThumbnailCheckbox(&$wrapper) { * @param XMLElement $wrapper */ private function appendForceSSLCheckbox(&$wrapper) { - $label = new XMLElement('label', NULL, array('class' => 'column')); - $chk = new XMLElement('input', NULL, array('name' => 'fields['.$this->get('sortorder').'][force_ssl]', 'type' => 'checkbox')); + $label = new XMLElement('label', null, array('class' => 'column')); + $chk = new XMLElement('input', null, array('name' => 'fields['.$this->get('sortorder').'][force_ssl]', 'type' => 'checkbox')); $label->appendChild($chk); $label->setValue(__('Force protocol-less embeding (allow ssl, only if the drivers supports it)'), false); @@ -819,15 +819,15 @@ private function appendForceSSLCheckbox(&$wrapper) { * @param int $entry_id * @return string - the html of the link */ - public function prepareTableValue($data, XMLElement $link=NULL, $entry_id=NULL){ + public function prepareTableValue($data, XMLElement $link = null, $entry_id = null){ $url = $data['url']; $thumb = $data['thumbnail_url']; $textValue = $this->prepareTextValue($data, $entry_id); - $value = NULL; + $value = null; // no url = early exit - if(strlen($url) == 0) return NULL; + if(strlen($url) == 0) return null; // no thumbnail or the parameter is not set ? if (empty($thumb) || $this->get('thumbs') != 'yes') { @@ -887,16 +887,16 @@ public function createTable(){ return Symphony::Database()->query(" CREATE TABLE `tbl_entries_data_$id` ( - `id` int(11) unsigned NOT NULL auto_increment, - `entry_id` int(11) unsigned NOT NULL, - `res_id` varchar(128), - `url` varchar(2048), - `url_oembed_xml` varchar(2048), - `title` varchar(2048), - `thumbnail_url` varchar(2048), - `oembed_xml` text, - `dateCreated` timestamp DEFAULT CURRENT_TIMESTAMP, - `driver` varchar(50), + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `entry_id` INT(11) UNSIGNED NOT NULL, + `res_id` VARCHAR(128), + `url` VARCHAR(2048), + `url_oembed_xml` VARCHAR(2048), + `title` VARCHAR(2048), + `thumbnail_url` VARCHAR(2048), + `oembed_xml` TEXT, + `dateCreated` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + `driver` VARCHAR(50), PRIMARY KEY (`id`), UNIQUE KEY `entry_id` (`entry_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -912,10 +912,10 @@ public static function createFieldTable() { return Symphony::Database()->query(" CREATE TABLE IF NOT EXISTS `$tbl` ( - `id` int(11) unsigned NOT NULL auto_increment, - `field_id` int(11) unsigned NOT NULL, - `refresh` int(11) unsigned NULL, - `driver` varchar(250) NOT NULL, + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `field_id` INT(11) UNSIGNED NOT NULL, + `refresh` INT(11) UNSIGNED NULL, + `driver` VARCHAR(250) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `field_id` (`field_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -931,7 +931,7 @@ public static function updateFieldTable_Unique() { return Symphony::Database()->query(" ALTER TABLE `$tbl` - ADD COLUMN `unique` enum('yes','no') NOT NULL DEFAULT 'no' + ADD COLUMN `unique` ENUM('yes','no') NOT NULL DEFAULT 'no' "); } @@ -944,7 +944,7 @@ public static function updateFieldTable_Thumbs() { return Symphony::Database()->query(" ALTER TABLE `$tbl` - ADD COLUMN `thumbs` enum('yes','no') NOT NULL DEFAULT 'no' + ADD COLUMN `thumbs` ENUM('yes','no') NOT NULL DEFAULT 'no' "); } @@ -957,7 +957,7 @@ public static function updateFieldTable_QueryParams() { return Symphony::Database()->query(" ALTER TABLE `$tbl` - ADD COLUMN `query_params` varchar(1024) NULL + ADD COLUMN `query_params` VARCHAR(1024) NULL "); } @@ -967,7 +967,7 @@ public static function updateFieldTable_Driver() { return Symphony::Database()->query(" ALTER TABLE `$tbl` - MODIFY COLUMN `driver` varchar(250) NOT NULL + MODIFY COLUMN `driver` VARCHAR(250) NOT NULL "); } @@ -985,29 +985,29 @@ public static function updateFieldData_Driver() { } public static function updateDataTable_Driver() { - + $fields = self::getFields(); - + // make sure the new driver column is add to // fields that already exists foreach ($fields as $field) { - + $id = $field->get('id'); - + // test is the column exist $col = Symphony::Database()->fetch(" SHOW COLUMNS FROM `tbl_entries_data_$id` WHERE `field` = 'driver' "); - + // if the col doest not exists if (!is_array($col) || count($col) == 0) { - + $ret = Symphony::Database()->query(" ALTER TABLE `tbl_entries_data_$id` - ADD COLUMN `driver` varchar(50) NOT NULL + ADD COLUMN `driver` VARCHAR(50) NOT NULL "); - + if (!$ret) { return false; } @@ -1015,20 +1015,20 @@ public static function updateDataTable_Driver() { } return true; } - + private static function getFields() { $fm = new FieldManager(Symphony::Engine()); // get all entries tables of type oEmbed $fields = $fm->fetch(null, null, 'ASC', 'id', 'oembed'); - + return $fields; } - + public static function updateDataTable_UniqueKey() { - + $fields = self::getFields(); - + // make sure the new driver column is add to // fields that already exists foreach ($fields as $field) { @@ -1040,46 +1040,46 @@ public static function updateDataTable_UniqueKey() { } return true; } - + public static function updateFieldTable_ForceSSL() { - + $tbl = self::FIELD_TBL_NAME; - + return Symphony::Database()->query(" ALTER TABLE `$tbl` ADD COLUMN `force_ssl` ENUM('yes','no') NOT NULL DEFAULT 'no' "); } - + public static function updateFieldTable_UniqueMedia() { - + $tbl = self::FIELD_TBL_NAME; - + return Symphony::Database()->query(" ALTER TABLE `$tbl` ADD COLUMN `unique_media` ENUM('yes','no') NOT NULL DEFAULT 'no' "); } - + public static function updateFieldTable_UniqueKey() { $tbl = self::FIELD_TBL_NAME; - + return Symphony::Database()->query(" ALTER TABLE `$tbl` ADD UNIQUE (`field_id`) "); } - + /** * * Drops the table needed for the settings of the field */ public static function deleteFieldTable() { $tbl = self::FIELD_TBL_NAME; - + return Symphony::Database()->query(" DROP TABLE IF EXISTS `$tbl` "); } - - } \ No newline at end of file + + } diff --git a/lib/class.serviceDriver.php b/lib/class.serviceDriver.php index b3aad72..d4ac665 100644 --- a/lib/class.serviceDriver.php +++ b/lib/class.serviceDriver.php @@ -133,7 +133,7 @@ public final function getDataFromSource($params, &$errorFlag) { } else { $error = isset($last['curl_error']) ? $last['curl_error'] : ''; } - + $data['error'] = __('Failed to load oEmbed data: %s', array( $error )); @@ -145,7 +145,7 @@ public final function getDataFromSource($params, &$errorFlag) { $parsedAray = @$parser->createArray($response, $this, $url, $errorFlag); - if (!$errorFlag && $parsedAray !== FALSE) { + if (!$errorFlag && $parsedAray !== false) { // merge the parsed data $data = array_merge($data, $parsedAray); } else { @@ -294,7 +294,7 @@ public function getNeededUrlsToJITimages() { public function supportsSSL() { return false; } - + /** * This flags indicate that the current driver is a native driver, * i.e. this driver uses the official oEmbed api of the provider. @@ -304,13 +304,13 @@ public function supportsSSL() { * found. Note that enabling multiple non-native drivers is not-recommanded. * * See: https://github.com/Solutions-Nitriques/oembed_field/pull/38 - * + * * @since 1.7 * * @return boolean */ public function isNative() { - return true; + return true; } /** @@ -326,7 +326,7 @@ public static function removeHTTPProtocol($value, $replaceValue = '//') { $value = str_replace('http://', $replaceValue, $value); return $value; } - + /** * Converts // to empty string or the specified * $replaceValue @@ -368,4 +368,4 @@ protected function getEmbedSize($options, $size) { return $options[$size. '_side']; } - } \ No newline at end of file + } diff --git a/lib/drivers/class.serviceYouTube.php b/lib/drivers/class.serviceYouTube.php index ea53d39..58bc660 100644 --- a/lib/drivers/class.serviceYouTube.php +++ b/lib/drivers/class.serviceYouTube.php @@ -43,7 +43,7 @@ public function getOEmbedApiUrl($params) { // may place the resource ID elsewhere in the hash (#) tag // if the url contains '#' (the real resource ID is the last part) - if (strpos($url, '#') !== FALSE) { + if (strpos($url, '#') !== false) { // split on every # or / $exploded = preg_split('/[\/#]/', $url); @@ -54,4 +54,4 @@ public function getOEmbedApiUrl($params) { return 'https://www.youtube.com/oembed?format=xml&url=' . $url . $query_params; } - } \ No newline at end of file + } diff --git a/lib/parsers/class.parser.json.php b/lib/parsers/class.parser.json.php index c1f5bf0..389c6b6 100644 --- a/lib/parsers/class.parser.json.php +++ b/lib/parsers/class.parser.json.php @@ -25,15 +25,15 @@ class serviceParserJSON extends ServiceParser { public function createArray($source, $driver, $url, &$errorFlag) { // get the data as an array $data = @json_decode($source, true); - - if ($data === FALSE) { + + if ($data === false) { $errorFlag = true; } - + if (!$errorFlag) { // original content $xml['xml'] = $source; - + $idTagName = $driver->getIdTagName(); if ($idTagName == null || !isset($data[$idTagName])) { $xml['id'] = Lang::createHandle($url); @@ -74,4 +74,4 @@ public function createJSON($source, $driver, $url, &$errorFlag) { return $source; } - } \ No newline at end of file + } diff --git a/lib/parsers/class.parser.xml.php b/lib/parsers/class.parser.xml.php index 920dca8..7714d16 100644 --- a/lib/parsers/class.parser.xml.php +++ b/lib/parsers/class.parser.xml.php @@ -31,7 +31,7 @@ public function createArray($source, $driver, $url, &$errorFlag) { if (!$errorFlag) { $xml['xml'] = @$doc->saveXML(); - if ($xml['xml'] === FALSE) { + if ($xml['xml'] === false) { $errorFlag = true; } else { @@ -76,4 +76,4 @@ public function createJSON($source, $driver, $url, &$errorFlag) { return json_encode($source); } - } \ No newline at end of file + } From 5c522bab689cd83fd3b391adf5cddcc647d78c04 Mon Sep 17 00:00:00 2001 From: Alexandra Nantel Date: Thu, 31 May 2018 11:21:11 -0400 Subject: [PATCH 05/11] Code refactoring for Database --- extension.meta.xml | 3 +- fields/field.oembed.php | 264 +++++++++++++++++++++++----------------- 2 files changed, 156 insertions(+), 111 deletions(-) diff --git a/extension.meta.xml b/extension.meta.xml index eda4322..33ddacf 100644 --- a/extension.meta.xml +++ b/extension.meta.xml @@ -1,6 +1,6 @@ - oEmbed Field + Field: oEmbed Easily embed videos/images from ANY* website that implements the oEmbed format. See http://oembed.com. Supported services: - **Vimeo** - **Youtube** @@ -52,6 +52,7 @@ - Update for Symphony 4.x + - Code refactoring for Database and EQFA - Fix a PHP warning: CURLOPT are constants diff --git a/fields/field.oembed.php b/fields/field.oembed.php index 9f394ac..69bd4ef 100644 --- a/fields/field.oembed.php +++ b/fields/field.oembed.php @@ -820,7 +820,6 @@ private function appendForceSSLCheckbox(&$wrapper) { * @return string - the html of the link */ public function prepareTableValue($data, XMLElement $link = null, $entry_id = null){ - $url = $data['url']; $thumb = $data['thumbnail_url']; $textValue = $this->prepareTextValue($data, $entry_id); @@ -883,109 +882,137 @@ public function prepareTextValue($data, $entry_id = null) { * Creates table needed for entries of invidual fields */ public function createTable(){ - $id = $this->get('id'); - - return Symphony::Database()->query(" - CREATE TABLE `tbl_entries_data_$id` ( - `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - `entry_id` INT(11) UNSIGNED NOT NULL, - `res_id` VARCHAR(128), - `url` VARCHAR(2048), - `url_oembed_xml` VARCHAR(2048), - `title` VARCHAR(2048), - `thumbnail_url` VARCHAR(2048), - `oembed_xml` TEXT, - `dateCreated` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - `driver` VARCHAR(50), - PRIMARY KEY (`id`), - UNIQUE KEY `entry_id` (`entry_id`) - ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - "); + return Symphony::Database() + ->create('tbl_entries_data_' . $this->get('id')) + ->ifNotExists() + ->charset('utf8') + ->collate('utf8_unicode_ci') + ->fields([ + 'id' => [ + 'type' => 'int(11)', + 'auto' => true, + ], + 'entry_id' => 'int(11)', + 'res_id' => 'varchar(128)', + 'url' => 'varchar(2048)', + 'url_oembed_xml' => 'varchar(2048)', + 'title' => 'varchar(2048)', + 'thumbnail_url' => 'varchar(2048)', + 'oembed_xml' => 'text', + 'dateCreated' => [ + 'type' => 'timestamp', + 'default' => 'current_timestamp' + ], + 'driver' => 'varchar(50)', + ]) + ->keys([ + 'id' => 'primary', + 'entry_id' => 'unique', + ]) + ->execute() + ->success(); } /** * Creates the table needed for the settings of the field */ public static function createFieldTable() { - - $tbl = self::FIELD_TBL_NAME; - - return Symphony::Database()->query(" - CREATE TABLE IF NOT EXISTS `$tbl` ( - `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - `field_id` INT(11) UNSIGNED NOT NULL, - `refresh` INT(11) UNSIGNED NULL, - `driver` VARCHAR(250) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `field_id` (`field_id`) - ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - "); + return Symphony::Database() + ->create(self::FIELD_TBL_NAME) + ->ifNotExists() + ->charset('utf8') + ->collate('utf8_unicode_ci') + ->fields([ + 'id' => [ + 'type' => 'int(11)', + 'auto' => true, + ], + 'field_id' => 'int(11)', + 'refresh' => [ + 'type' => 'int(11)', + 'null' => true, + ], + 'driver' => 'varchar(250)', + ]) + ->keys([ + 'id' => 'primary', + 'field_id' => 'unique', + ]) + ->execute() + ->success(); } /** * Updates the table for the new settings: `unique` */ public static function updateFieldTable_Unique() { - - $tbl = self::FIELD_TBL_NAME; - - return Symphony::Database()->query(" - ALTER TABLE `$tbl` - ADD COLUMN `unique` ENUM('yes','no') NOT NULL DEFAULT 'no' - "); + return Symphony::Database() + ->alter(self::FIELD_TBL_NAME) + ->add([ + 'unique' => [ + 'type' => 'enum', + 'values' => ['yes','no'], + 'default' => 'no', + ], + ]) + ->execute() + ->success(); } /** * Updates the table for the new settings: `thumbs` */ public static function updateFieldTable_Thumbs() { - - $tbl = self::FIELD_TBL_NAME; - - return Symphony::Database()->query(" - ALTER TABLE `$tbl` - ADD COLUMN `thumbs` ENUM('yes','no') NOT NULL DEFAULT 'no' - "); + return Symphony::Database() + ->alter(self::FIELD_TBL_NAME) + ->add([ + 'thumbs' => [ + 'type' => 'enum', + 'values' => ['yes','no'], + 'default' => 'no', + ], + ]) + ->execute() + ->success(); } /** * Updates the table for the new settings: `params_set_id` */ public static function updateFieldTable_QueryParams() { - - $tbl = self::FIELD_TBL_NAME; - - return Symphony::Database()->query(" - ALTER TABLE `$tbl` - ADD COLUMN `query_params` VARCHAR(1024) NULL - "); + return Symphony::Database() + ->alter(self::FIELD_TBL_NAME) + ->add([ + 'query_params' => [ + 'type' => 'varchar(2014)', + 'null' => true, + ], + ]) + ->execute() + ->success(); } public static function updateFieldTable_Driver() { - - $tbl = self::FIELD_TBL_NAME; - - return Symphony::Database()->query(" - ALTER TABLE `$tbl` - MODIFY COLUMN `driver` VARCHAR(250) NOT NULL - "); + return Symphony::Database() + ->alter(self::FIELD_TBL_NAME) + ->modify([ + 'driver' => 'varchar(250)', + ]) + ->execute() + ->success(); } public static function updateFieldData_Driver() { - - $tbl = self::FIELD_TBL_NAME; - - // allow all drivers for fields that already exists - $drivers = MySQL::cleanValue( implode(',',ServiceDispatcher::getAllDriversNames()) ); - - return Symphony::Database()->query(" - UPDATE `$tbl` - SET `driver` = '$drivers' - "); + return Symphony::Database() + ->update(self::FIELD_TBL_NAME) + ->set([ + 'driver' => MySQL::cleanValue( implode(',',ServiceDispatcher::getAllDriversNames())), + ]) + ->execute() + ->success(); } public static function updateDataTable_Driver() { - $fields = self::getFields(); // make sure the new driver column is add to @@ -995,18 +1022,25 @@ public static function updateDataTable_Driver() { $id = $field->get('id'); // test is the column exist - $col = Symphony::Database()->fetch(" - SHOW COLUMNS FROM `tbl_entries_data_$id` - WHERE `field` = 'driver' - "); + $col = Symphony::Database() + ->showColumns() + ->from('tbl_entries_data_' . $id) + ->where([ + 'field' => 'driver', + ]) + ->execute() + ->rows(); // if the col doest not exists if (!is_array($col) || count($col) == 0) { - $ret = Symphony::Database()->query(" - ALTER TABLE `tbl_entries_data_$id` - ADD COLUMN `driver` VARCHAR(50) NOT NULL - "); + $ret = Symphony::Database() + ->alter('tbl_entries_data_' . $id) + ->add([ + 'driver' => 'varchar(50)', + ]) + ->execute() + ->success(); if (!$ret) { return false; @@ -1026,48 +1060,58 @@ private static function getFields() { } public static function updateDataTable_UniqueKey() { - $fields = self::getFields(); // make sure the new driver column is add to // fields that already exists foreach ($fields as $field) { - $tbl = 'tbl_entries_data_' . $field->get('id'); - return Symphony::Database()->query(" - ALTER TABLE `$tbl` - ADD UNIQUE (`entry_id`) - "); + return Symphony::Database() + ->alter('tbl_entries_data_' . $field->get('id')) + ->addKey([ + 'entry_id' => 'unique', + ]) + ->execute() + ->success(); } return true; } public static function updateFieldTable_ForceSSL() { - - $tbl = self::FIELD_TBL_NAME; - - return Symphony::Database()->query(" - ALTER TABLE `$tbl` - ADD COLUMN `force_ssl` ENUM('yes','no') NOT NULL DEFAULT 'no' - "); + return Symphony::Database() + ->alter(self::FIELD_TBL_NAME) + ->add([ + 'force_ssl' => [ + 'type' => 'enum', + 'values' => ['yes','no'], + 'default' => 'no', + ], + ]) + ->execute() + ->success(); } public static function updateFieldTable_UniqueMedia() { - - $tbl = self::FIELD_TBL_NAME; - - return Symphony::Database()->query(" - ALTER TABLE `$tbl` - ADD COLUMN `unique_media` ENUM('yes','no') NOT NULL DEFAULT 'no' - "); + return Symphony::Database() + ->alter(self::FIELD_TBL_NAME) + ->add([ + 'unique_media' => [ + 'type' => 'enum', + 'values' => ['yes','no'], + 'default' => 'no', + ], + ]) + ->execute() + ->success(); } public static function updateFieldTable_UniqueKey() { - $tbl = self::FIELD_TBL_NAME; - - return Symphony::Database()->query(" - ALTER TABLE `$tbl` - ADD UNIQUE (`field_id`) - "); + return Symphony::Database() + ->alter(self::FIELD_TBL_NAME) + ->addKey([ + 'field_id' => 'unique', + ]) + ->execute() + ->success(); } /** @@ -1075,11 +1119,11 @@ public static function updateFieldTable_UniqueKey() { * Drops the table needed for the settings of the field */ public static function deleteFieldTable() { - $tbl = self::FIELD_TBL_NAME; - - return Symphony::Database()->query(" - DROP TABLE IF EXISTS `$tbl` - "); + return Symphony::Database() + ->drop(self::FIELD_TBL_NAME) + ->ifExists() + ->execute() + ->success(); } } From d91734586c5d153d703d7133ebcd9849bc93701a Mon Sep 17 00:00:00 2001 From: Alexandra Nantel Date: Thu, 31 May 2018 11:45:22 -0400 Subject: [PATCH 06/11] Add EQFA for filtering (url, title, driver) and make thumbnail in table visible --- fields/field.oembed.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fields/field.oembed.php b/fields/field.oembed.php index 69bd4ef..6a654c2 100644 --- a/fields/field.oembed.php +++ b/fields/field.oembed.php @@ -5,6 +5,7 @@ require_once(TOOLKIT . '/class.field.php'); require_once(EXTENSIONS . '/oembed_field/lib/class.serviceDispatcher.php'); require_once(EXTENSIONS . '/oembed_field/lib/class.serviceDriver.php'); + require_once EXTENSIONS . '/oembed_field/lib/class.entryqueryoembedadapter.php'; /** * @@ -38,6 +39,8 @@ class FieldOembed extends Field { public function __construct(){ // call the parent constructor parent::__construct(); + // set the EQFA + $this->entryQueryFieldAdapter = new EntryQueryoEmbedAdapter($this); // set the name of the field $this->_name = __('oEmbed Resource'); // permits to make it required @@ -55,11 +58,11 @@ public function __construct(){ } public function isSortable(){ - return false; // @todo: should we allow to sort by url/driver ? + return true; } public function canFilter(){ - return false; // @todo: should we allow to filter by url/driver ? + return true; } public function canImport(){ @@ -834,11 +837,7 @@ public function prepareTableValue($data, XMLElement $link = null, $entry_id = nu $value = $textValue; } else { // create a image - $thumb = ServiceDriver::removeHTTPProtocol($thumb); - $thumb = ServiceDriver::removeRelativeProtocol($thumb); - $img_path = URL . '/image/1/0/40/1/' . $thumb; - - $value = '' . General::sanitize($data['title']) .''; + $value = '' . General::sanitize($data['title']) .''; } // does this cell serve as a link ? From 5e6891c14e7c1da1de2dbfa18d421f642f0fbb74 Mon Sep 17 00:00:00 2001 From: Alexandra Nantel Date: Thu, 31 May 2018 11:45:39 -0400 Subject: [PATCH 07/11] Sure would be better with the EQFA file --- lib/class.entryqueryoembedadapter.php | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 lib/class.entryqueryoembedadapter.php diff --git a/lib/class.entryqueryoembedadapter.php b/lib/class.entryqueryoembedadapter.php new file mode 100644 index 0000000..c19b035 --- /dev/null +++ b/lib/class.entryqueryoembedadapter.php @@ -0,0 +1,36 @@ + ['var' => $filter, 'type' => 'string'], + ]); + + $columns = ['url', 'title', 'driver']; + + if ($this->isFilterRegex($filter)) { + return $this->createFilterRegexp($filter, $columns); + } elseif ($this->isFilterSQL($filter)) { + return $this->createFilterSQL($filter, $columns); + } elseif ($this->isFilterNotEqual($filter)) { + return $this->createFilterNotEqual($filter, $columns); + } + return $this->createFilterEquality($filter, $columns); + } + + public function getSortColumns() + { + return ['title']; + } +} From 54363347a19aaf5a51112d3905eab67e9d031277 Mon Sep 17 00:00:00 2001 From: Alexandra Nantel Date: Fri, 8 Jun 2018 16:02:27 -0400 Subject: [PATCH 08/11] default table cols to null --- fields/field.oembed.php | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/fields/field.oembed.php b/fields/field.oembed.php index 6a654c2..2aa9c3d 100644 --- a/fields/field.oembed.php +++ b/fields/field.oembed.php @@ -892,17 +892,38 @@ public function createTable(){ 'auto' => true, ], 'entry_id' => 'int(11)', - 'res_id' => 'varchar(128)', - 'url' => 'varchar(2048)', - 'url_oembed_xml' => 'varchar(2048)', - 'title' => 'varchar(2048)', - 'thumbnail_url' => 'varchar(2048)', - 'oembed_xml' => 'text', + 'res_id' => [ + 'type' => 'varchar(128)', + 'null' => true, + ], + 'url' => [ + 'type' => 'varchar(2048)', + 'null' => true, + ], + 'url_oembed_xml' => [ + 'type' => 'varchar(2048)', + 'null' => true, + ], + 'title' => [ + 'type' => 'varchar(2048)', + 'null' => true, + ], + 'thumbnail_url' => [ + 'type' => 'varchar(2048)', + 'null' => true, + ], + 'oembed_xml' => [ + 'type' => 'text', + 'null' => true, + ], 'dateCreated' => [ 'type' => 'timestamp', 'default' => 'current_timestamp' ], - 'driver' => 'varchar(50)', + 'driver' => [ + 'type' => 'varchar(50)', + 'null' => auto, + ], ]) ->keys([ 'id' => 'primary', From d5398ab3cde6c407cbb0d5bf705f7c4c60748740 Mon Sep 17 00:00:00 2001 From: Alexandra Nantel Date: Tue, 19 Jun 2018 11:38:14 -0400 Subject: [PATCH 09/11] Remove deprecated cleanValue --- fields/field.oembed.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fields/field.oembed.php b/fields/field.oembed.php index 2aa9c3d..95d6d09 100644 --- a/fields/field.oembed.php +++ b/fields/field.oembed.php @@ -1026,7 +1026,7 @@ public static function updateFieldData_Driver() { return Symphony::Database() ->update(self::FIELD_TBL_NAME) ->set([ - 'driver' => MySQL::cleanValue( implode(',',ServiceDispatcher::getAllDriversNames())), + 'driver' => implode(',',ServiceDispatcher::getAllDriversNames()), ]) ->execute() ->success(); From 76bcc649aca9ae571ad3b5a5ddffb06926d5ebc3 Mon Sep 17 00:00:00 2001 From: Alexandra Nantel Date: Tue, 18 Dec 2018 09:47:11 -0500 Subject: [PATCH 10/11] Remote SQL collate and charset definitions. --- fields/field.oembed.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fields/field.oembed.php b/fields/field.oembed.php index 95d6d09..36f3807 100644 --- a/fields/field.oembed.php +++ b/fields/field.oembed.php @@ -884,8 +884,6 @@ public function createTable(){ return Symphony::Database() ->create('tbl_entries_data_' . $this->get('id')) ->ifNotExists() - ->charset('utf8') - ->collate('utf8_unicode_ci') ->fields([ 'id' => [ 'type' => 'int(11)', @@ -940,8 +938,6 @@ public static function createFieldTable() { return Symphony::Database() ->create(self::FIELD_TBL_NAME) ->ifNotExists() - ->charset('utf8') - ->collate('utf8_unicode_ci') ->fields([ 'id' => [ 'type' => 'int(11)', From b853ec4fe86f9e3375346139edd0297edf4d538b Mon Sep 17 00:00:00 2001 From: Alexandra Nantel Date: Fri, 1 Feb 2019 13:52:51 -0500 Subject: [PATCH 11/11] Apply patch by @nitriques - Fix error with php 7.2 --- fields/field.oembed.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fields/field.oembed.php b/fields/field.oembed.php index 36f3807..7615a8f 100644 --- a/fields/field.oembed.php +++ b/fields/field.oembed.php @@ -366,7 +366,7 @@ public function commit() { $settings['refresh'] = $refresh; // Permit only some specific drivers - $settings['driver'] = empty($drivers) || count($drivers) < 0 ? null : $drivers; + $settings['driver'] = empty($drivers) ? null : $drivers; // Force SSL setting $settings['force_ssl'] = empty($force_ssl) ? 'no' : $force_ssl;