Skip to content

Commit bf4fcb5

Browse files
authored
Merge pull request #81 from INN/63-filter-data
63 filter data; rearrange plugin includes
2 parents 2851399 + afe1700 commit bf4fcb5

File tree

10 files changed

+613
-570
lines changed

10 files changed

+613
-570
lines changed

dfw-init.php

Lines changed: 5 additions & 546 deletions
Large diffs are not rendered by default.

dfw-options.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function dfw_option_page_html() {
3131
}
3232

3333
echo '<div class="wrap">';
34-
echo '<h2>Super Cool Ad ManagerOptions</h2>';
34+
echo '<h2>Super Cool Ad Manager Options</h2>';
3535
echo '<form method="post" action="options.php">';
3636

3737
settings_fields( 'doubleclick-for-wordpress' );

dfw.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,18 @@
1212

1313
define( 'DFP_VERSION', '0.2.0' );
1414

15-
include( 'dfw-init.php' );
16-
include( 'inc/block.php' );
15+
$includes = array(
16+
'/inc/class-doubleclick.php',
17+
'/inc/class-doubleclickadslot.php',
18+
'/inc/class-doubleclickbreakpoint.php',
19+
'/dfw-init.php',
20+
'/inc/block.php',
21+
'/inc/class-doubleclick-widget.php',
22+
'/dfw-options.php',
23+
);
24+
25+
foreach ( $includes as $include ) {
26+
if ( 0 === validate_file( dirname( __FILE__ ) . $include ) ) {
27+
require_once( dirname( __FILE__ ) . $include );
28+
}
29+
}

docs/Developer-API.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Developer API
22

3-
A `global $DoubleClick` variable is defined on plugin init, making it possible to define breakpoints
3+
A `global $doubleclick` variable is defined on plugin init, making it possible to define breakpoints
44
and place ads directly within your theme.
55

66
__Quick Function Links:__
77

8-
* [$DoubleClick->register_breakpoint($identifer,$args)](#doubleclick-register_breakpointidentiferargs)
9-
* [$DoubleClick->place_ad($identifer,$size,$breakpoints)](#doubleclick-place_adidentifersizebreakpoints)
8+
* [$doubleclick->register_breakpoint($identifier,$args)](#doubleclick-register_breakpointidentifierargs)
9+
* [$doubleclick->place_ad($identifier,$size,$breakpoints)](#doubleclick-place_adidentifiersizebreakpoints)
1010

1111
* * *
1212

1313
## 1. Define Breakpoints
1414

15-
##### $DoubleClick->register_breakpoint($identifer,$args)
15+
##### $doubleclick->register_breakpoint($identifier,$args)
1616

1717
You can make it easier for users to target breakpoints by defining them in `functions.php`
1818

@@ -21,24 +21,24 @@ You can make it easier for users to target breakpoints by defining them in `func
2121
```php
2222
function ad_setup() {
2323

24-
global $DoubleClick;
24+
global $doubleclick;
2525

2626
// Optionally define the network code directly in functions.php.
27-
// $DoubleClick->networkCode = "xxxxxxx";
27+
// $doubleclick->network_code = "xxxxxxx";
2828

2929
/* Define Breakpoints */
30-
$DoubleClick->register_breakpoint('phone', array('minWidth'=> 0,'maxWidth'=>720));
31-
$DoubleClick->register_breakpoint('tablet', array('minWidth'=>760,'maxWidth'=>1040));
32-
$DoubleClick->register_breakpoint('desktop', array('minWidth'=>1040,'maxWidth'=>1220));
33-
$DoubleClick->register_breakpoint('xl', array('minWidth'=>1220,'maxWidth'=>9999));
30+
$doubleclick->register_breakpoint('phone', array('min_width'=> 0,'max_width'=>720));
31+
$doubleclick->register_breakpoint('tablet', array('min_width'=>760,'max_width'=>1040));
32+
$doubleclick->register_breakpoint('desktop', array('min_width'=>1040,'max_width'=>1220));
33+
$doubleclick->register_breakpoint('xl', array('min_width'=>1220,'max_width'=>9999));
3434

3535
}
3636
add_action('dfw_setup','ad_setup');
3737
```
3838

3939
##### Paramaters:
4040

41-
__$identifer__
41+
__$identifier__
4242

4343
`String` A unique identifier for this breakpoint
4444

@@ -50,18 +50,18 @@ __$args__
5050

5151
## 2. Place Ads
5252

53-
### $DoubleClick->place_ad($identifer,$sizes,$args)
53+
### $doubleclick->place_ad($identifier,$sizes,$args)
5454

5555
Prints DOM to display an ad at the given breakpoint.
5656

5757
##### Example:
5858

5959
```php
6060

61-
global $DoubleClick;
61+
global $doubleclick;
6262

6363
// simple call:
64-
$DoubleClick->place_ad('my-identifer','300x250');
64+
$doubleclick->place_ad('my-identifier','300x250');
6565

6666
// more options:
6767
$sizes = array(
@@ -73,13 +73,13 @@ $args = array(
7373
'lazyLoad' => false // if set to true, the ad will load only once its within view on screen.
7474
);
7575

76-
$DoubleClick->place_ad('my-identifier',$sizes,$args);
76+
$doubleclick->place_ad('my-identifier',$sizes,$args);
7777
```
7878

7979

8080
##### Paramaters:
8181

82-
__$identifer__
82+
__$identifier__
8383

8484
`String` The Google Ad Manager identifier for an ad unit (GAM does not require you to create an identifier. If this does not match a value defined in GAM, a network-wide ad will still be requested).
8585

inc/block.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ function dfw_block_init() {
1616
return false;
1717
}
1818

19+
$plugin_file = dirname( __DIR__ ) . '/dfw.php';
20+
1921
// double dirname to get the plugin dir because this file is in `/inc/`.
2022
$dir = dirname( dirname( __FILE__ ) );
2123

2224
$block_js = 'js/block.js';
2325
wp_register_script(
2426
'dfw-block-editor',
25-
plugins_url( $block_js, dirname( __FILE__ ) ),
27+
plugins_url( $block_js, $plugin_file ),
2628
array(
2729
'wp-blocks',
2830
'wp-i18n',
@@ -53,7 +55,7 @@ function dfw_block_init() {
5355
$editor_css = 'css/editor.css';
5456
wp_register_style(
5557
'dfw-block-editor',
56-
plugins_url( $editor_css, dirname( __FILE__ ) ),
58+
plugins_url( $editor_css, $plugin_file ),
5759
array(
5860
),
5961
filemtime( "$dir/$block_js" )
File renamed without changes.

0 commit comments

Comments
 (0)