Skip to content

Commit c16bc11

Browse files
committed
Renamed all the classes.
Adblock Plus blocked uniads module in CMS area so it was unusable. Now it should be OK.
1 parent 3502cba commit c16bc11

19 files changed

+113
-106
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ The ads will be shown in this way:
6262
...
6363

6464

65-
Check the AdObject class for more.
65+
Check the UniadsObject class for more.

_config.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
<?php
22

33
define('ADS_MODULE_DIR', basename(dirname(__FILE__)));
4-
5-
Object::add_extension('Page', 'AdvertisementExtension');

_config/config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
Name: uniads
3+
---
4+
Page:
5+
extensions:
6+
- 'UniadsExtension'

_config/routes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ After: framework/routes#coreroutes
44
---
55
Director:
66
rules:
7-
'advrt-click//$Action/$ID' : 'AdController'
7+
'uniads-click//$Action/$ID' : 'UniadsController'

code/controllers/AdAdmin.php renamed to code/controllers/UniadsAdmin.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
22

33
/**
4-
* Description of AdAdmin
4+
* Description of UniadsAdmin
55
*
66
* @author Elvinas Liutkevičius <[email protected]>
77
* @author Marcus Nyeholt <[email protected]>
88
* @license BSD http://silverstripe.org/BSD-license
99
*/
10-
class AdAdmin extends ModelAdmin {
10+
class UniadsAdmin extends ModelAdmin {
1111
public static $managed_models = array(
12-
'AdObject',
13-
'AdCampaign',
14-
'AdClient',
15-
'AdZone',
12+
'UniadsObject',
13+
'UniadsCampaign',
14+
'UniadsClient',
15+
'UniadsZone',
1616
);
1717

1818
static $allowed_actions = array(
@@ -36,23 +36,23 @@ public function __construct() {
3636
public function preview(SS_HTTPRequest $request) {
3737
$request->shift();
3838
$adID = (int) $request->param('ID');
39-
$ad = DataObject::get_by_id('AdObject', $adID);
39+
$ad = DataObject::get_by_id('UniadsObject', $adID);
4040

4141
if (!$ad) {
4242
Controller::curr()->httpError(404);
4343
return;
4444
}
4545

4646
// No impression and click tracking for previews
47-
$conf = AdObject::config();
47+
$conf = UniadsObject::config();
4848
$conf->use_js_tracking = false;
4949
$conf->record_impressions = false;
5050
$conf->record_impressions_stats = false;
5151

5252
// Block stylesheets and JS that are not required (using our own template)
5353
Requirements::clear();
5454

55-
$template = new SSViewer('AdPreviewPage');
55+
$template = new SSViewer('UniadsPreview');
5656

5757
return $template->Process($ad);
5858
}

code/controllers/AdController.php renamed to code/controllers/UniadsController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

33
/**
4-
* Description of AdController
4+
* Description of UniadsController
55
*
66
* @author Elvinas Liutkevičius <[email protected]>
77
* @author Marcus Nyeholt <[email protected]>
88
* @license BSD http://silverstripe.org/BSD-license
99
*/
10-
class AdController extends Controller {
10+
class UniadsController extends Controller {
1111

1212
public function clk() {
1313
$this->GetAdAndLogClick($this->request->requestVar('id'));
@@ -23,15 +23,15 @@ public function go() {
2323
private function GetAdAndLogClick($id) {
2424
$id = (int) $id;
2525
if ($id) {
26-
$ad = DataObject::get_by_id('AdObject', $id);
26+
$ad = DataObject::get_by_id('UniadsObject', $id);
2727
if ($ad && $ad->exists()) {
28-
$conf = AdObject::config();
28+
$conf = UniadsObject::config();
2929
if ($conf->record_clicks) {
3030
$ad->Clicks++;
3131
$ad->write();
3232
}
3333
if ($conf->record_clicks_stats) {
34-
$clk = new AdClick;
34+
$clk = new UniadsClick;
3535
$clk->AdID = $ad->ID;
3636
$clk->write();
3737
}

code/dataobjects/AdCampaign.php renamed to code/dataobjects/UniadsCampaign.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

33
/**
4-
* Description of AdCampaign
4+
* Description of UniadsCampaign
55
*
66
* @author Elvinas Liutkevičius <[email protected]>
77
* @author Marcus Nyeholt <[email protected]>
88
* @license BSD http://silverstripe.org/BSD-license
99
*/
10-
class AdCampaign extends DataObject {
10+
class UniadsCampaign extends DataObject {
1111
public static $db = array(
1212
'Title' => 'Varchar',
1313
'Starts' => 'Date',
@@ -23,11 +23,11 @@ class AdCampaign extends DataObject {
2323
);
2424

2525
public static $has_many = array(
26-
'Ads' => 'AdObject',
26+
'Ads' => 'UniadsObject',
2727
);
2828

2929
public static $has_one = array(
30-
'Client' => 'AdClient',
30+
'Client' => 'UniadsClient',
3131
);
3232

3333
public function getCMSFields() {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

33
/**
4-
* Description of AdClick
4+
* Description of UniadsClick
55
*
66
* @author Marcus Nyeholt <[email protected]>
77
* @license BSD http://silverstripe.org/BSD-license
88
*/
9-
class AdClick extends AdImpression {
10-
9+
class UniadsClick extends UniadsImpression {
10+
1111
}

code/dataobjects/AdClient.php renamed to code/dataobjects/UniadsClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

33
/**
4-
* Description of AdClient
4+
* Description of UniadsClient
55
*
66
* @author Elvinas Liutkevičius <[email protected]>
77
* @author Marcus Nyeholt <[email protected]>
88
* @license BSD http://silverstripe.org/BSD-license
99
*/
10-
class AdClient extends DataObject {
10+
class UniadsClient extends DataObject {
1111
public static $db = array(
1212
'Title' => 'Varchar(128)',
1313
'ContactEmail' => 'Text',

code/dataobjects/AdImpression.php renamed to code/dataobjects/UniadsImpression.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

33
/**
4-
* Description of AdImpression
4+
* Description of UniadsImpression
55
*
66
* @author Elvinas Liutkevičius <[email protected]>
77
* @author Marcus Nyeholt <[email protected]>
88
* @license BSD http://silverstripe.org/BSD-license
99
*/
10-
class AdImpression extends DataObject {
10+
class UniadsImpression extends DataObject {
1111
public static $db = array(
1212
'UserAgent' => 'Varchar(128)',
1313
'BrowserVersion' => 'Varchar',
@@ -23,7 +23,7 @@ class AdImpression extends DataObject {
2323

2424
public static $has_one = array(
2525
'User' => 'Member',
26-
'Ad' => 'AdObject',
26+
'Ad' => 'UniadsObject',
2727
);
2828

2929
public function onBeforeWrite() {

0 commit comments

Comments
 (0)