@@ -8,13 +8,13 @@ |
||
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | public function updateCMSFields(FieldList $fields) { |
| 11 | - $galleryField = new TreeDropdownField( |
|
| 11 | + $galleryField = new TreeDropdownField( |
|
| 12 | 12 | "AttachedGalleryID", |
| 13 | 13 | _t('AttachedGalleryExtension.CHOOSE_A_GALLERY', "Choose another gallery to show on this page"), |
| 14 | 14 | "GalleryPage" |
| 15 | 15 | ); |
| 16 | 16 | |
| 17 | - $fields->addFieldToTab( "Root."._t('AttachedGalleryExtension.ATTACHED_GALLERY', 'Attached Gallery'), $galleryField ); |
|
| 17 | + $fields->addFieldToTab("Root."._t('AttachedGalleryExtension.ATTACHED_GALLERY', 'Attached Gallery'), $galleryField); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | /* |
@@ -8,10 +8,10 @@ |
||
| 8 | 8 | protected $enabled = true; |
| 9 | 9 | |
| 10 | 10 | function run($request) { |
| 11 | - $imagesToProcess = GalleryImage::get()->filter('ExifRead', false); |
|
| 12 | - foreach ($imagesToProcess->getIterator() as $image) { |
|
| 13 | - echo 'Processing image '.$image->Title.'<br/>'; |
|
| 14 | - $image->processExifData(); |
|
| 15 | - } |
|
| 11 | + $imagesToProcess = GalleryImage::get()->filter('ExifRead', false); |
|
| 12 | + foreach ($imagesToProcess->getIterator() as $image) { |
|
| 13 | + echo 'Processing image '.$image->Title.'<br/>'; |
|
| 14 | + $image->processExifData(); |
|
| 15 | + } |
|
| 16 | 16 | } |
| 17 | 17 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | class ImageMetaDataExtension extends DataExtension implements Mappable { |
| 4 | - static $db = array( |
|
| 4 | + static $db = array( |
|
| 5 | 5 | 'Lat' => 'Decimal(18,15)', |
| 6 | 6 | 'Lon' => 'Decimal(18,15)', |
| 7 | 7 | 'ZoomLevel' => 'Int', |
@@ -19,21 +19,21 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | public function processExifData() { |
| 22 | - error_log('Processing exif data for '.$this->owner->ID); |
|
| 23 | - $filename = BASE_PATH.'/'.$this->owner->Image()->Filename; |
|
| 24 | - error_log('Checking '.$filename); |
|
| 25 | - |
|
| 26 | - // when the image is first saved, the file will still be a temp file |
|
| 27 | - if (file_exists($filename)) { |
|
| 28 | - try { |
|
| 29 | - $exif = exif_read_data($filename,0,true); |
|
| 22 | + error_log('Processing exif data for '.$this->owner->ID); |
|
| 23 | + $filename = BASE_PATH.'/'.$this->owner->Image()->Filename; |
|
| 24 | + error_log('Checking '.$filename); |
|
| 25 | + |
|
| 26 | + // when the image is first saved, the file will still be a temp file |
|
| 27 | + if (file_exists($filename)) { |
|
| 28 | + try { |
|
| 29 | + $exif = exif_read_data($filename,0,true); |
|
| 30 | 30 | |
| 31 | - $aperture = $exif['COMPUTED']['ApertureFNumber']; |
|
| 31 | + $aperture = $exif['COMPUTED']['ApertureFNumber']; |
|
| 32 | 32 | |
| 33 | - $aperture = str_replace('f/', '', $aperture); |
|
| 34 | - error_log('APERTURE:'.$aperture); |
|
| 33 | + $aperture = str_replace('f/', '', $aperture); |
|
| 34 | + error_log('APERTURE:'.$aperture); |
|
| 35 | 35 | |
| 36 | - $this->owner->Aperture = $aperture; |
|
| 36 | + $this->owner->Aperture = $aperture; |
|
| 37 | 37 | |
| 38 | 38 | $shutterspeed = ''; |
| 39 | 39 | if (isset($exif['ExposureTime'])) { |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | $shutterspeed = $exif['EXIF']['ExposureTime']; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - error_log('EXPOSURE:'.$shutterspeed); |
|
| 46 | - $this->owner->ShutterSpeed = $shutterspeed; |
|
| 45 | + error_log('EXPOSURE:'.$shutterspeed); |
|
| 46 | + $this->owner->ShutterSpeed = $shutterspeed; |
|
| 47 | 47 | if (isset($exif['DateTimeOriginal'])) { |
| 48 | 48 | $this->owner->TakenAt = $exif['DateTimeOriginal']; |
| 49 | 49 | } else { |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | error_log('ISO:'.$iso); |
| 62 | 62 | |
| 63 | 63 | |
| 64 | - // coors |
|
| 65 | - if (isset($exif['GPS'])) { |
|
| 64 | + // coors |
|
| 65 | + if (isset($exif['GPS'])) { |
|
| 66 | 66 | $gps = $exif['GPS']; |
| 67 | - $latarray = $gps['GPSLatitude']; |
|
| 67 | + $latarray = $gps['GPSLatitude']; |
|
| 68 | 68 | $degrees = $latarray[0]; |
| 69 | 69 | $parts = explode('/', $degrees); |
| 70 | 70 | $degrees = $parts[0] / $parts[1]; |
@@ -76,12 +76,12 @@ discard block |
||
| 76 | 76 | $seconds = $parts[0] / $parts[1]; |
| 77 | 77 | |
| 78 | 78 | error_log('LATITUDE: DMS='.$degrees.','.$minutes.','.$seconds); |
| 79 | - $latitude = $degrees+$minutes/60+$seconds/3600; |
|
| 79 | + $latitude = $degrees+$minutes/60+$seconds/3600; |
|
| 80 | 80 | error_log('LAT:'.$latitude); |
| 81 | 81 | |
| 82 | 82 | error_log('LATITUDE:'.$latitude); |
| 83 | 83 | |
| 84 | - $lonarray = $gps['GPSLongitude']; |
|
| 84 | + $lonarray = $gps['GPSLongitude']; |
|
| 85 | 85 | $degrees = $lonarray[0]; |
| 86 | 86 | $parts = explode('/', $degrees); |
| 87 | 87 | $degrees = $parts[0] / $parts[1]; |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | $parts = explode('/', $seconds); |
| 93 | 93 | $seconds = $parts[0] / $parts[1]; |
| 94 | 94 | |
| 95 | - $longitude = $degrees+$minutes/60+$seconds/3600; |
|
| 96 | - $this->owner->Lat = $latitude; |
|
| 97 | - $this->owner->Lon = $longitude; |
|
| 98 | - } else { |
|
| 95 | + $longitude = $degrees+$minutes/60+$seconds/3600; |
|
| 96 | + $this->owner->Lat = $latitude; |
|
| 97 | + $this->owner->Lon = $longitude; |
|
| 98 | + } else { |
|
| 99 | 99 | error_log('*** NO GPS DATA ***'); |
| 100 | 100 | } |
| 101 | 101 | $image = $this->owner->Image(); |
@@ -104,46 +104,46 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | $this->owner->ExifRead = true; |
| 107 | - $this->owner->write(); |
|
| 108 | - } |
|
| 109 | - catch (Exception $e) { |
|
| 110 | - error_log($e); |
|
| 111 | - } |
|
| 107 | + $this->owner->write(); |
|
| 108 | + } |
|
| 109 | + catch (Exception $e) { |
|
| 110 | + error_log($e); |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | - } |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | 115 | |
| 116 | - //print_r($exif); |
|
| 116 | + //print_r($exif); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
| 120 | 120 | |
| 121 | 121 | public function onAfterWriteNOT() { |
| 122 | - error_log('GI: On after write'); |
|
| 123 | - parent::onAfterWrite(); |
|
| 122 | + error_log('GI: On after write'); |
|
| 123 | + parent::onAfterWrite(); |
|
| 124 | 124 | |
| 125 | - if (!($this->owner->ExifRead)) { |
|
| 126 | - error_log('processing exif data'); |
|
| 127 | - $this->processExifData(); |
|
| 128 | - } |
|
| 125 | + if (!($this->owner->ExifRead)) { |
|
| 126 | + error_log('processing exif data'); |
|
| 127 | + $this->processExifData(); |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - error_log('/GI: On after write'); |
|
| 130 | + error_log('/GI: On after write'); |
|
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - public function requireDefaultRecordsNOT() { |
|
| 136 | - parent::requireDefaultRecords(); |
|
| 137 | - error_log('**** REQUIRE DEFAULT RECORDS FOR IMAGES ****'); |
|
| 138 | - $imagesToProcess = GalleryImage::get()->filter('ExifRead', false); |
|
| 139 | - foreach ($imagesToProcess->getIterator() as $image) { |
|
| 140 | - $image->processExifData(); |
|
| 141 | - } |
|
| 142 | - } |
|
| 135 | + public function requireDefaultRecordsNOT() { |
|
| 136 | + parent::requireDefaultRecords(); |
|
| 137 | + error_log('**** REQUIRE DEFAULT RECORDS FOR IMAGES ****'); |
|
| 138 | + $imagesToProcess = GalleryImage::get()->filter('ExifRead', false); |
|
| 139 | + foreach ($imagesToProcess->getIterator() as $image) { |
|
| 140 | + $image->processExifData(); |
|
| 141 | + } |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | 144 | |
| 145 | 145 | |
| 146 | - public function getMappableLatitude() { |
|
| 146 | + public function getMappableLatitude() { |
|
| 147 | 147 | return $this->owner->Lat; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | ); |
| 15 | 15 | |
| 16 | 16 | |
| 17 | - static $defaults = array ('Lat' =>0, 'Lon' => 0, 'Zoom' => 4); |
|
| 17 | + static $defaults = array('Lat' =>0, 'Lon' => 0, 'Zoom' => 4); |
|
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | // when the image is first saved, the file will still be a temp file |
| 27 | 27 | if (file_exists($filename)) { |
| 28 | 28 | try { |
| 29 | - $exif = exif_read_data($filename,0,true); |
|
| 29 | + $exif = exif_read_data($filename, 0, true); |
|
| 30 | 30 | |
| 31 | 31 | $aperture = $exif['COMPUTED']['ApertureFNumber']; |
| 32 | 32 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $shutterspeed = ''; |
| 39 | 39 | if (isset($exif['ExposureTime'])) { |
| 40 | 40 | $shutterspeed = $exif['ExposureTime']; |
| 41 | - } else{ |
|
| 41 | + } else { |
|
| 42 | 42 | $shutterspeed = $exif['EXIF']['ExposureTime']; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $this->owner->TakenAt = $exif['EXIF']['DateTimeOriginal']; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $iso=''; |
|
| 53 | + $iso = ''; |
|
| 54 | 54 | if (isset($exif['ISOSpeedRatings'])) { |
| 55 | 55 | $iso = $exif['ISOSpeedRatings']; |
| 56 | 56 | } else { |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $seconds = $parts[0] / $parts[1]; |
| 77 | 77 | |
| 78 | 78 | error_log('LATITUDE: DMS='.$degrees.','.$minutes.','.$seconds); |
| 79 | - $latitude = $degrees+$minutes/60+$seconds/3600; |
|
| 79 | + $latitude = $degrees+$minutes / 60+$seconds / 3600; |
|
| 80 | 80 | error_log('LAT:'.$latitude); |
| 81 | 81 | |
| 82 | 82 | error_log('LATITUDE:'.$latitude); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $parts = explode('/', $seconds); |
| 93 | 93 | $seconds = $parts[0] / $parts[1]; |
| 94 | 94 | |
| 95 | - $longitude = $degrees+$minutes/60+$seconds/3600; |
|
| 95 | + $longitude = $degrees+$minutes / 60+$seconds / 3600; |
|
| 96 | 96 | $this->owner->Lat = $latitude; |
| 97 | 97 | $this->owner->Lon = $longitude; |
| 98 | 98 | } else { |
@@ -105,8 +105,7 @@ |
||
| 105 | 105 | |
| 106 | 106 | $this->owner->ExifRead = true; |
| 107 | 107 | $this->owner->write(); |
| 108 | - } |
|
| 109 | - catch (Exception $e) { |
|
| 108 | + } catch (Exception $e) { |
|
| 110 | 109 | error_log($e); |
| 111 | 110 | } |
| 112 | 111 | |
@@ -2,21 +2,21 @@ |
||
| 2 | 2 | |
| 3 | 3 | class GalleryFolder extends PageWithImage { |
| 4 | 4 | |
| 5 | - private static $allowed_children = array( |
|
| 6 | - 'GalleryFolder', |
|
| 7 | - 'GalleryPage' |
|
| 8 | - ); |
|
| 5 | + private static $allowed_children = array( |
|
| 6 | + 'GalleryFolder', |
|
| 7 | + 'GalleryPage' |
|
| 8 | + ); |
|
| 9 | 9 | |
| 10 | - public function getCMSFields() { |
|
| 11 | - $fields = parent::getCMSFields(); |
|
| 12 | - $fields->renameField('Content','Brief Summary'); |
|
| 13 | - return $fields; |
|
| 14 | - } |
|
| 10 | + public function getCMSFields() { |
|
| 11 | + $fields = parent::getCMSFields(); |
|
| 12 | + $fields->renameField('Content','Brief Summary'); |
|
| 13 | + return $fields; |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - /* Summary is a remapping of the content */ |
|
| 17 | - public function Summary() { |
|
| 18 | - return $this->Content; |
|
| 19 | - } |
|
| 16 | + /* Summary is a remapping of the content */ |
|
| 17 | + public function Summary() { |
|
| 18 | + return $this->Content; |
|
| 19 | + } |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | class GalleryFolder_Controller extends PageWithImage_Controller { |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | public function getCMSFields() { |
| 11 | 11 | $fields = parent::getCMSFields(); |
| 12 | - $fields->renameField('Content','Brief Summary'); |
|
| 12 | + $fields->renameField('Content', 'Brief Summary'); |
|
| 13 | 13 | return $fields; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -2,40 +2,40 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | class GalleryPage extends PageWithImage {
|
| 4 | 4 | |
| 5 | - public static $has_many = array( |
|
| 6 | - 'GalleryImages' => 'GalleryImage' |
|
| 7 | - ); |
|
| 5 | + public static $has_many = array( |
|
| 6 | + 'GalleryImages' => 'GalleryImage' |
|
| 7 | + ); |
|
| 8 | 8 | |
| 9 | 9 | private static $db = array( |
| 10 | 10 | 'GalleryDate' => 'Date' |
| 11 | 11 | ); |
| 12 | 12 | |
| 13 | - private static $icon = 'ss3gallery/icons/photo.png'; |
|
| 13 | + private static $icon = 'ss3gallery/icons/photo.png'; |
|
| 14 | 14 | |
| 15 | 15 | |
| 16 | - public function getCMSFields() {
|
|
| 17 | - $fields = parent::getCMSFields(); |
|
| 18 | - $gridFieldConfig = GridFieldConfig_RecordEditor::create(); |
|
| 19 | - //$gridFieldConfig->addComponent(new GridFieldBulkEditingTools()); |
|
| 20 | - $gridFieldConfig->addComponent($gbu = new GridFieldBulkUpload()); |
|
| 21 | - $gridFieldConfig->addComponent($gbm = new GridFieldBulkManager()); |
|
| 22 | - $gridFieldConfig->addComponent(new GridFieldSortableRows('SortOrder'));
|
|
| 23 | - $galleryimagesi18n = _t('GalleryImage.PLURALNAME', "Gallery Images");
|
|
| 24 | - //$gbu->setConfig('fileRelationName','Image');
|
|
| 25 | - $gbu->setConfig('folderName', 'galleries/'.$this->ID);
|
|
| 26 | - //$gbm->setConfig('editableFields', array('Title'));
|
|
| 27 | - $gbm->setConfig('fieldsNameBlacklist', array('Lat','Lon','ZoomLevel'));
|
|
| 28 | - $gridfield = new GridField("GalleryImages", $galleryimagesi18n, $this->GalleryImages()->sort("SortOrder"), $gridFieldConfig);
|
|
| 29 | - $fields->addFieldToTab('Root.'.$galleryimagesi18n, $gridfield);
|
|
| 16 | + public function getCMSFields() {
|
|
| 17 | + $fields = parent::getCMSFields(); |
|
| 18 | + $gridFieldConfig = GridFieldConfig_RecordEditor::create(); |
|
| 19 | + //$gridFieldConfig->addComponent(new GridFieldBulkEditingTools()); |
|
| 20 | + $gridFieldConfig->addComponent($gbu = new GridFieldBulkUpload()); |
|
| 21 | + $gridFieldConfig->addComponent($gbm = new GridFieldBulkManager()); |
|
| 22 | + $gridFieldConfig->addComponent(new GridFieldSortableRows('SortOrder'));
|
|
| 23 | + $galleryimagesi18n = _t('GalleryImage.PLURALNAME', "Gallery Images");
|
|
| 24 | + //$gbu->setConfig('fileRelationName','Image');
|
|
| 25 | + $gbu->setConfig('folderName', 'galleries/'.$this->ID);
|
|
| 26 | + //$gbm->setConfig('editableFields', array('Title'));
|
|
| 27 | + $gbm->setConfig('fieldsNameBlacklist', array('Lat','Lon','ZoomLevel'));
|
|
| 28 | + $gridfield = new GridField("GalleryImages", $galleryimagesi18n, $this->GalleryImages()->sort("SortOrder"), $gridFieldConfig);
|
|
| 29 | + $fields->addFieldToTab('Root.'.$galleryimagesi18n, $gridfield);
|
|
| 30 | 30 | |
| 31 | 31 | $fields->addFieldToTab('Root.Date', new DateField('GalleryDate'));
|
| 32 | - return $fields; |
|
| 32 | + return $fields; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | public function Map() {
|
| 38 | - $photosWithLocation = $this->GalleryImages()->where('Lat != 0 AND Lon !=0');
|
|
| 38 | + $photosWithLocation = $this->GalleryImages()->where('Lat != 0 AND Lon !=0');
|
|
| 39 | 39 | if ($photosWithLocation->count() == 0) {
|
| 40 | 40 | return 'No locations found'; // don't render a map |
| 41 | 41 | } |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | class GalleryPage_Controller extends Page_Controller {
|
| 62 | 62 | |
| 63 | - public static $allowed_actions = array ( |
|
| 64 | - ); |
|
| 63 | + public static $allowed_actions = array ( |
|
| 64 | + ); |
|
| 65 | 65 | |
| 66 | - public function GetGalleryImages() {
|
|
| 67 | - return $this->GalleryImages()->sort("SortOrder");
|
|
| 68 | - } |
|
| 66 | + public function GetGalleryImages() {
|
|
| 67 | + return $this->GalleryImages()->sort("SortOrder");
|
|
| 68 | + } |
|
| 69 | 69 | } |
| 70 | 70 | \ No newline at end of file |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | //$gbu->setConfig('fileRelationName','Image');
|
| 25 | 25 | $gbu->setConfig('folderName', 'galleries/'.$this->ID);
|
| 26 | 26 | //$gbm->setConfig('editableFields', array('Title'));
|
| 27 | - $gbm->setConfig('fieldsNameBlacklist', array('Lat','Lon','ZoomLevel'));
|
|
| 27 | + $gbm->setConfig('fieldsNameBlacklist', array('Lat', 'Lon', 'ZoomLevel'));
|
|
| 28 | 28 | $gridfield = new GridField("GalleryImages", $galleryimagesi18n, $this->GalleryImages()->sort("SortOrder"), $gridFieldConfig);
|
| 29 | 29 | $fields->addFieldToTab('Root.'.$galleryimagesi18n, $gridfield);
|
| 30 | 30 | |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | $map = $photosWithLocation->getRenderableMap(); |
| 43 | 43 | // $map->setDelayLoadMapFunction( true ); |
| 44 | - $map->setZoom( 10 ); |
|
| 45 | - $map->setAdditionalCSSClasses( 'fullWidthMap' ); |
|
| 46 | - $map->setShowInlineMapDivStyle( true ); |
|
| 44 | + $map->setZoom(10); |
|
| 45 | + $map->setAdditionalCSSClasses('fullWidthMap');
|
|
| 46 | + $map->setShowInlineMapDivStyle(true); |
|
| 47 | 47 | $map->setClusterer(true); |
| 48 | 48 | /* |
| 49 | 49 | foreach($this->MapLayers() as $layer) {
|
@@ -53,14 +53,14 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | //$map->addKML('http://assets.tripodtravel.co.nz/cycling/meuang-nont-to-bang-sue-loop.kml');
|
| 56 | - $map->setSize('100%','600px');
|
|
| 56 | + $map->setSize('100%', '600px');
|
|
| 57 | 57 | return $map; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | } |
| 61 | 61 | class GalleryPage_Controller extends Page_Controller {
|
| 62 | 62 | |
| 63 | - public static $allowed_actions = array ( |
|
| 63 | + public static $allowed_actions = array( |
|
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | 66 | public function GetGalleryImages() {
|
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | $customise['Aperture'] = $galleryImage->Aperture; |
| 31 | 31 | $customise['ShutterSpeed'] = $galleryImage->ShutterSpeed; |
| 32 | 32 | |
| 33 | - //set the caption |
|
| 33 | + //set the caption |
|
| 34 | 34 | $customise['Title'] = $galleryImage->Title; |
| 35 | 35 | |
| 36 | 36 | //overide the defaults with the arguments supplied |
@@ -3,12 +3,12 @@ discard block |
||
| 3 | 3 | class GalleryImageShortCodeHandler { |
| 4 | 4 | |
| 5 | 5 | // taken from http://www.ssbits.com/tutorials/2010/2-4-using-short-codes-to-embed-a-youtube-video/ and adapted for SS3 |
| 6 | - public static function parse_gallery_image( $arguments, $caption = null, $parser = null ) { |
|
| 6 | + public static function parse_gallery_image($arguments, $caption = null, $parser = null) { |
|
| 7 | 7 | // public static function link_shortcode_handler($arguments, $content = null, $parser = null) { |
| 8 | 8 | |
| 9 | 9 | // first things first, if we dont have a video ID, then we don't need to |
| 10 | 10 | // go any further |
| 11 | - if ( empty( $arguments['id'] ) ) { |
|
| 11 | + if (empty($arguments['id'])) { |
|
| 12 | 12 | return; |
| 13 | 13 | } |
| 14 | 14 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | error_log('ID:'.$arguments['id']); |
| 19 | 19 | |
| 20 | 20 | |
| 21 | - $galleryImage = DataObject::get_by_id('GalleryImage',$arguments['id']); |
|
| 21 | + $galleryImage = DataObject::get_by_id('GalleryImage', $arguments['id']); |
|
| 22 | 22 | error_log('GALLERY IMAGE:'.$galleryImage); |
| 23 | 23 | |
| 24 | 24 | |
@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | $customise['Title'] = $galleryImage->Title; |
| 35 | 35 | |
| 36 | 36 | //overide the defaults with the arguments supplied |
| 37 | - $customise = array_merge( $customise, $arguments ); |
|
| 37 | + $customise = array_merge($customise, $arguments); |
|
| 38 | 38 | |
| 39 | 39 | //get our YouTube template |
| 40 | - $template = new SSViewer( 'ShortCodeGalleryImage' ); |
|
| 40 | + $template = new SSViewer('ShortCodeGalleryImage'); |
|
| 41 | 41 | |
| 42 | 42 | //return the customised template |
| 43 | - return $template->process( new ArrayData( $customise ) ); |
|
| 43 | + return $template->process(new ArrayData($customise)); |
|
| 44 | 44 | |
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | \ No newline at end of file |
@@ -4,8 +4,8 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | public static $db = array( |
| 7 | - 'SortOrder' => 'Int', |
|
| 8 | - 'Title' => 'Varchar' |
|
| 7 | + 'SortOrder' => 'Int', |
|
| 8 | + 'Title' => 'Varchar' |
|
| 9 | 9 | ); |
| 10 | 10 | |
| 11 | 11 | // One-to-one relationship with gallery page |
@@ -14,28 +14,28 @@ discard block |
||
| 14 | 14 | 'GalleryPage' => 'GalleryPage' |
| 15 | 15 | ); |
| 16 | 16 | |
| 17 | - // tidy up the CMS by not showing these fields |
|
| 17 | + // tidy up the CMS by not showing these fields |
|
| 18 | 18 | public function getCMSFields() {
|
| 19 | - $fields = parent::getCMSFields(); |
|
| 20 | - $fields->removeFieldFromTab("Root.Main","GalleryPageID");
|
|
| 19 | + $fields = parent::getCMSFields(); |
|
| 20 | + $fields->removeFieldFromTab("Root.Main","GalleryPageID");
|
|
| 21 | 21 | $fields->removeFieldFromTab("Root.Main","SortOrder");
|
| 22 | 22 | $fields->renameField('Title', _t('GalleryImage.TITLE', 'Title'));
|
| 23 | 23 | $fields->renameField('Image', _t('GalleryImage.IMAGE', 'Image'));
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | - return $fields; |
|
| 26 | + return $fields; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | // Tell the datagrid what fields to show in the table |
| 30 | - public static $summary_fields = array( |
|
| 31 | - 'ID' => 'ID', |
|
| 32 | - 'Title' => 'Title', |
|
| 33 | - 'Thumbnail' => 'Thumbnail' |
|
| 34 | - ); |
|
| 30 | + public static $summary_fields = array( |
|
| 31 | + 'ID' => 'ID', |
|
| 32 | + 'Title' => 'Title', |
|
| 33 | + 'Thumbnail' => 'Thumbnail' |
|
| 34 | + ); |
|
| 35 | 35 | |
| 36 | 36 | // this function creates the thumnail for the summary fields to use |
| 37 | - public function getThumbnail() {
|
|
| 38 | - return $this->Image()->CMSThumbnail(); |
|
| 37 | + public function getThumbnail() {
|
|
| 38 | + return $this->Image()->CMSThumbnail(); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | // tidy up the CMS by not showing these fields |
| 18 | 18 | public function getCMSFields() {
|
| 19 | 19 | $fields = parent::getCMSFields(); |
| 20 | - $fields->removeFieldFromTab("Root.Main","GalleryPageID");
|
|
| 21 | - $fields->removeFieldFromTab("Root.Main","SortOrder");
|
|
| 20 | + $fields->removeFieldFromTab("Root.Main", "GalleryPageID");
|
|
| 21 | + $fields->removeFieldFromTab("Root.Main", "SortOrder");
|
|
| 22 | 22 | $fields->renameField('Title', _t('GalleryImage.TITLE', 'Title'));
|
| 23 | 23 | $fields->renameField('Image', _t('GalleryImage.IMAGE', 'Image'));
|
| 24 | 24 | |
@@ -72,18 +72,18 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | |
| 75 | - function HorizontalMargin( $intendedWidth ) {
|
|
| 75 | + function HorizontalMargin($intendedWidth) {
|
|
| 76 | 76 | //FIXME - is there a way to avoid a database call here? |
| 77 | - $image100 = $this->Image()->SetRatioSize(100,100); |
|
| 78 | - $result = ( $intendedWidth-$image100->Width )/2; |
|
| 77 | + $image100 = $this->Image()->SetRatioSize(100, 100); |
|
| 78 | + $result = ($intendedWidth-$image100->Width) / 2; |
|
| 79 | 79 | error_log('HORIZONTAL MARGIN:'.$result);
|
| 80 | 80 | return $result; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - function VerticalMargin( $intendedHeight ) {
|
|
| 83 | + function VerticalMargin($intendedHeight) {
|
|
| 84 | 84 | //FIXME - is there a way to avoid a database call here? |
| 85 | - $image100 = $this->Image()->SetRatioSize(100,100); |
|
| 86 | - return ( $intendedHeight-$image100->Height )/2; |
|
| 85 | + $image100 = $this->Image()->SetRatioSize(100, 100); |
|
| 86 | + return ($intendedHeight-$image100->Height) / 2; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | } |
| 90 | 90 | \ No newline at end of file |
@@ -1,2 +1,2 @@ |
||
| 1 | 1 | <?php |
| 2 | -ShortcodeParser::get('default')->register('GalleryImage',array('GalleryImageShortCodeHandler','parse_gallery_image')); |
|
| 2 | +ShortcodeParser::get('default')->register('GalleryImage', array('GalleryImageShortCodeHandler', 'parse_gallery_image')); |
|