| @@ -7,7 +7,7 @@ discard block | ||
| 7 | 7 |  { | 
| 8 | 8 | public static $searchable_fields = array( | 
| 9 | 9 | 'WebsiteLink', | 
| 10 | - ); | |
| 10 | + ); | |
| 11 | 11 | |
| 12 | 12 | public static $db = array( | 
| 13 | 13 | // title to show in model admin | 
| @@ -33,7 +33,7 @@ discard block | ||
| 33 | 33 | // stats | 
| 34 | 34 | 'Impressions' => 'Int', | 
| 35 | 35 | 'Clickthroughs' => 'Int', | 
| 36 | - ); | |
| 36 | + ); | |
| 37 | 37 | |
| 38 | 38 | public static $has_one = array( | 
| 39 | 39 | 'AdvertImage' => 'Image', | 
| @@ -75,7 +75,7 @@ discard block | ||
| 75 | 75 | // a Javascript toggle on this field displays either the adbroker text field, or an image with URL | 
| 76 | 76 |          $fields->addFieldToTab('Root.Main', new DropdownField('AdvertSource', 'The type of advert', | 
| 77 | 77 |              singleton('Advert')->dbObject('AdvertSource')->enumValues() | 
| 78 | - )); | |
| 78 | + )); | |
| 79 | 79 | |
| 80 | 80 |          if ($this->ID == 0) { | 
| 81 | 81 | $html = '<div class="field text">An image can be uploaded after the advert is saved for the first time</div>'; | 
| @@ -118,11 +118,11 @@ discard block | ||
| 118 | 118 | parent::onBeforeWrite(); | 
| 119 | 119 | } | 
| 120 | 120 | |
| 121 | - /* | |
| 121 | + /* | |
| 122 | 122 | Calculate a digital signature from several of the fields | 
| 123 | 123 | */ | 
| 124 | - public function CalculateDigitalSignature() | |
| 125 | -  { | |
| 124 | + public function CalculateDigitalSignature() | |
| 125 | +    { | |
| 126 | 126 | /* because we save the impression counter on every rendition this cannot include | 
| 127 | 127 | - number of impressions | 
| 128 | 128 | - last edited | 
| @@ -133,5 +133,5 @@ discard block | ||
| 133 | 133 |      $hashed = hash('sha512', $data); | 
| 134 | 134 |      //error_log("HASH CREATED:".$hashed); | 
| 135 | 135 | return $hashed; | 
| 136 | - } | |
| 136 | + } | |
| 137 | 137 | } | 
| @@ -69,7 +69,7 @@ discard block | ||
| 69 | 69 |          $mainTab->setTitle(_t('SiteTree.TABMAIN', 'Main')); | 
| 70 | 70 | |
| 71 | 71 | // human readable title | 
| 72 | -        $fields->addFieldToTab('Root.Main',  new TextField('Title', | |
| 72 | +        $fields->addFieldToTab('Root.Main', new TextField('Title', | |
| 73 | 73 | 'Human readable title for the advert')); | 
| 74 | 74 | |
| 75 | 75 | // a Javascript toggle on this field displays either the adbroker text field, or an image with URL | 
| @@ -89,10 +89,10 @@ discard block | ||
| 89 | 89 | } | 
| 90 | 90 | |
| 91 | 91 | // quick tags, faster than the grid editor - these are processed prior to save to create/assign tags | 
| 92 | -        $fields->addFieldToTab('Root.Main',  new TextField('WebsiteLink', | |
| 92 | +        $fields->addFieldToTab('Root.Main', new TextField('WebsiteLink', | |
| 93 | 93 | 'The URL that will be shown when the advert image is clicked')); | 
| 94 | 94 | |
| 95 | -        $fields->addFieldToTab('Root.Main',  new TextareaField('AdbrokerJavascript', | |
| 95 | +        $fields->addFieldToTab('Root.Main', new TextareaField('AdbrokerJavascript', | |
| 96 | 96 | 'JavaScript provided by the adbroker')); | 
| 97 | 97 | |
| 98 | 98 |          $fields->addFieldToTab('Root.Main', $sdf = new DateField('StartDate', 'The date the advert becomes active')); | 
| @@ -128,8 +128,8 @@ discard block | ||
| 128 | 128 | - last edited | 
| 129 | 129 | Otherwise the clickthrough will fail | 
| 130 | 130 | */ | 
| 131 | - $data = $this->ID.'_'.$this->AdvertCategory()->Title.'_'.$this->AdvertLayoutType()->Title.'_'.$this->AdbrokerJavascript; | |
| 132 | - $data .= '_'.$this->StartDate.'_'.$this->FinishDate.'_'.$this->ClickThroughs.'_advert'; | |
| 131 | + $data = $this->ID . '_' . $this->AdvertCategory()->Title . '_' . $this->AdvertLayoutType()->Title . '_' . $this->AdbrokerJavascript; | |
| 132 | + $data .= '_' . $this->StartDate . '_' . $this->FinishDate . '_' . $this->ClickThroughs . '_advert'; | |
| 133 | 133 |      $hashed = hash('sha512', $data); | 
| 134 | 134 |      //error_log("HASH CREATED:".$hashed); | 
| 135 | 135 | return $hashed; | 
| @@ -47,7 +47,7 @@ | ||
| 47 | 47 | parent::onBeforeWrite(); | 
| 48 | 48 | } | 
| 49 | 49 | |
| 50 | - /* | |
| 50 | + /* | |
| 51 | 51 | Get the advert category. Either use the cached advert category, or traverse the tree towards the root looking for it | 
| 52 | 52 | */ | 
| 53 | 53 | public function CalculateAdvertCategoryID() |