Skip to content

Commit 9de1034

Browse files
committed
Merge pull request #11 from ThatGerber/importer
0.2.0
2 parents 7970afe + 90b5e7f commit 9de1034

19 files changed

+7674
-5604
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ cache
4040

4141
# Ignore Composer directory
4242
/vendor/
43+
44+
# Ignore WordPress repo
45+
/plugin/

build/logs/clover.xml

+7,329-5,515
Large diffs are not rendered by default.

build/wordpress-files.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
index.php
2+
plugin.php
3+
readme.txt
4+
js/
5+
lib/
6+
src/
7+
widget/

build/wordpress_build.sh

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
BUILD=`pwd`;
4+
5+
echo 'Building WordPress plugin.';
6+
7+
echo -n 'What is the version number? ';
8+
read VERSION;
9+
echo "$VERSION";
10+
11+
cd $BUILD/../;
12+
13+
###
14+
# Change Version Number
15+
###
16+
echo "Updating version to $VERSION";
17+
sed -i '' "s|\* Version: *.*.*|\* Version: $VERSION|" plugin.php
18+
19+
###
20+
# Make directory of files to import
21+
###
22+
mkdir plugin/;
23+
rsync -av --files-from=build/wordpress-files.txt . plugin/
24+
25+
###
26+
# Move vendor files to lib folder
27+
###
28+
mkdir lib;
29+
rsync -vah vendor/ plugin/lib/
30+
31+
###
32+
# Change autoload
33+
###
34+
echo "Changing location of autoload";
35+
sed -i '' "s|require_once 'vendor/autoload.php'|require_once 'lib/autoload.php'|" plugin/plugin.php
36+
37+
###
38+
# Return Home; We're Complete
39+
###
40+
cd $BUILD;
41+
echo 'Build Complete.';

composer.json

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"name": "ThatGerber/dfp-ads",
33
"description": "WordPress plugin for DoubleClick for Publishers",
4+
"require": {
5+
"ddeboer/data-import": "@stable"
6+
},
47
"require-dev": {
58
"phpunit/phpunit": "4.6.*",
69
"codeclimate/php-test-reporter": "dev-master"

inc/class.dfp_ads_import_form.php

-39
This file was deleted.

plugin.php

+45-15
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
22
/**
3+
* DFP Ad Manager Bootstrap File
4+
*
35
* @wordpress-plugin
46
* Plugin Name: DFP - DoubleClick Ad Manager
57
* Plugin URI: http://www.chriswgerber.com/dfp-ads/
68
* Description: Manages ad code for DoubleClick for Publishers
7-
* Version: 0.1.0
89
* Author: Chris W. Gerber
910
* Author URI: http://www.chriswgerber.com/
1011
* License: GPL-2.0+
@@ -13,23 +14,29 @@
1314
* Github Plugin URI: https://github.com/ThatGerber/dfp-ads
1415
* GitHub Branch: master
1516
*
17+
* Version: 0.1.0
1618
*
1719
* The Plugin File
1820
*
1921
* @link http://www.chriswgerber.com/dfp-ads
2022
* @since 0.0.1
2123
* @subpackage DFP-Ads
2224
*/
23-
define( 'EPG_AD_PLUGIN_VER', '0.1.0' );
24-
25-
include( 'inc/helper_functions.php' );
26-
include( 'inc/abstract.dfp_ads_form.php' );
27-
include( 'inc/class.dfp_ads.php' );
28-
include( 'inc/class.dfp_ads_post_type.php' );
29-
include( 'inc/class.dfp_ads_input.php' );
30-
include( 'inc/class.dfp_ad_position.php' );
31-
include( 'inc/class.dfp_ads_settings_form.php' );
32-
include( 'inc/class.dfp_ads_admin.php' );
25+
define( 'EPG_AD_PLUGIN_VER', '0.2.0' );
26+
27+
/* Autoload */
28+
require_once 'vendor/autoload.php';
29+
30+
/* Library */
31+
include( 'src/helper_functions.php' );
32+
include( 'src/abstract.dfp_ads_form.php' );
33+
include( 'src/class.dfp_ads.php' );
34+
include( 'src/class.dfp_ads_post_type.php' );
35+
include( 'src/class.dfp_ads_input.php' );
36+
include( 'src/class.dfp_ad_position.php' );
37+
include( 'src/class.dfp_ads_settings_form.php' );
38+
include( 'src/class.dfp_ads_import_form.php' );
39+
include( 'src/class.dfp_ads_admin.php' );
3340
include( 'widget/widget.ad_position.php' );
3441

3542
/*
@@ -172,9 +179,32 @@
172179
add_action( 'admin_menu', array( $ad_admin, 'register_menu_page' ) );
173180
add_action( 'admin_init', array( $ad_admin, 'menu_page_init' ) );
174181

175-
// Import Page
176-
$ad_form = new DFP_Ads_Settings_Form;
177-
$ad_admin = new DFP_Ads_Admin( $ad_form );
182+
/*
183+
* Import Page
184+
*/
185+
add_filter( 'dfp_ads_import_sections', ( function( $sections ) {
186+
$sections['import_data'] = array(
187+
'id' => 'import_data',
188+
'title' => 'Import from CSV'
189+
);
190+
191+
return $sections;
192+
} ) );
193+
add_filter( 'dfp_ads_import_fields', ( function( $fields ) {
194+
$fields['file_import'] = array(
195+
'id' => 'import_csv',
196+
'field' => 'file',
197+
'callback' => 'file',
198+
'title' => 'Import CSV from DFP',
199+
'section' => 'import_data',
200+
'description' => 'Upload a CSV File directly from DoubleClick for Publishers'
201+
);
202+
203+
return $fields;
204+
} ) );
205+
206+
$import_form = new DFP_Ads_Import_Form;
207+
$ad_admin = new DFP_Ads_Admin( $import_form );
178208
$ad_admin->menu_title = 'Import';
179209
$ad_admin->plugin_slug = 'import';
180210
$ad_admin->options_str = 'DFP_Ads_Import';
@@ -191,4 +221,4 @@
191221
*/
192222
add_action( 'widgets_init', ( function( $fields ) {
193223
register_widget("DFP_Ads_Widget");
194-
}) );
224+
}) );

readme.md

+16-5
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ Simpler management of DFP (*DoubleClick for Publishers*) ad positions
3030
<a name="Installation"></a>
3131
## Installation
3232

33-
Documentation in progress.
34-
3533
<a name="#Install"></a>
3634
### Install plugin
3735

@@ -71,11 +69,13 @@ Managing the tags will be made simple through an import function that works dire
7169

7270
Below are a list of items that need to be completed before the plugin is ready for release.
7371

74-
* Full Test Suite for current code and all new features.
75-
* Import tool for creating positions via a DFP Export CSV.
76-
* Extensibility in the Javascript file that powers the ad positions. I.e. the ability to add new, custom positions through an API.
7772
* Filter taxonomy names and values into page-level targeting for positions.
7873
* More precise validation of input values in custom metaboxes for ad positions.
74+
* Improve documentation on plugin.
75+
76+
### Other priorities
77+
78+
* Full Test Suite for current code and all new features.
7979

8080
<a name="FAQ"></a>
8181
## Frequently Asked Questions
@@ -85,6 +85,17 @@ Submit your questions at [chriswgerber.com/contact/](http://www.chriswgerber.com
8585
<a name="Changelog"></a>
8686
## Changelog
8787

88+
### 0.2.0
89+
90+
* Added functionality for importing DFP Ads
91+
* Added Travis CI Integration.
92+
* Added Composer
93+
* Begin Unit Testing
94+
* Added Code Coverage Reporting
95+
* Updated JS to make extensions easier
96+
* Added Asynchronous ad loading
97+
* Made plugin compatible with PHP 5.3
98+
8899
### 0.1.0
89100
* Initial pre-release
90101

readme.txt

+46-9
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,64 @@
11
=== DFP Ad Manager ===
22

3-
Contributors: chriswgerber
4-
Tags: dfp, doubleclick, ads, ad trafficking
5-
Requires at least: 3.0.0
6-
Tested up to: 4.1.1
7-
License: GPLv2 or later
8-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
3+
Stable tag: trunk
4+
Contributors: chriswgerber
5+
Requires at least: 3.0.0
6+
Tested up to: 4.1.1
7+
License: GPLv2 or later
8+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9+
Tags: dfp, doubleclick, ads, ad trafficking, ad ops
910

10-
Manager for ad positions and targeting through DoubleClick for Publishers.
11+
Simpler management of DFP (DoubleClick for Publishers) ad positions
1112

1213
== Description ==
1314

1415
**For simple management of DoubleClick for Publishers ad positions.**
1516

17+
Follow development of the plugin on [Github.com/ThatGerber/dfp-ads](http://github.com/ThatGerber/dfp-ads]
18+
1619
== Installation ==
1720

18-
Documentation in progress
21+
= Install plugin =
22+
23+
1. Download Zip File
24+
2. Navigate to your website's admin page: `example.com/wp-admin/`
25+
3. Go to Plugins, "Add New"
26+
4. At the top of the page, choose "Upload Plugin"
27+
5. Upload zip file and install now
28+
6. Activate plugin
29+
30+
= Set Up Ad Network =
31+
32+
1. Visit [https://www.google.com/dfp/](https://www.google.com/dfp/) and get your Account ID
33+
1. To find your Account ID, go to Settings. On the left sidebar, choose "Network Settings" and "All Network Settings".
34+
2. Copy your "Network Code". It should be an 8-digit integer for identifying your ad network.
35+
2. Visit the Ad Positions "Settings" in the WordPress Admin page.
36+
3. Add the DFP Network Code for Identifying the ad network for ad positions.
37+
38+
== Screenshots ==
39+
40+
Visit [chriswgerber.com/dfp-ads/](http://www.chriswgerber.com/dfp-ads/) for screenshots and more information.
1941

2042
== Frequently Asked Questions ==
2143

2244
Submit your questions at [chriswgerber.com/contact/](http://www.chriswgerber.com/contact/)
2345

46+
== Upgrade Notice ==
47+
48+
If you're coming from the pre-release, many features have been changed and improved. You will be required to re-setup your network.
49+
2450
== Changelog ==
2551

52+
= 0.2.0
53+
54+
* Added functionality for importing DFP Ads
55+
* Added Travis CI Integration.
56+
* Added Composer
57+
* Begin Unit Testing
58+
* Added Code Coverage Reporting
59+
* Updated JS to make extensions easier
60+
* Added Asynchronous ad loading
61+
* Made plugin compatible with PHP 5.3
62+
2663
= 0.1.0
27-
* Initial Release
64+
* Initial Pre-Release

inc/abstract.dfp_ads_form.php renamed to src/abstract.dfp_ads_form.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ public function form_title( $title = null ) {
9696
*/
9797
public function text( $args ) {
9898
// Why is it so nested?
99-
$args = $args[0];
100-
// Field values
101-
$id = $this->options_str . '[' . $args['id'] . ']';
102-
$title = $args['title'];
103-
$value = ( ! isset( $this->values[ $args['id'] ] ) ? '' : $this->values[ $args['id'] ] );
99+
$args = $args[0];
100+
$id = $this->options_str . '[' . $args['id'] . ']';
101+
$field = $args['field'];
102+
$title = $args['title'];
103+
$value = ( ! isset( $this->values[ $args['id'] ] ) ? '' : $this->values[ $args['id'] ] );
104104
?>
105105
<div>
106-
<input type="<?php echo $args->field; ?>"
106+
<input type="<?php _e( $field, 'dfp-ads' ); ?>"
107107
id="<?php _e( $id, 'dfp-ads' ); ?>"
108108
name="<?php _e( $id, 'dfp-ads' ); ?>"
109109
value="<?php _e( $value, 'dfp-ads' ); ?>" />
@@ -135,10 +135,10 @@ public function ads_dropdown( $args ) {
135135
<div>
136136
<select id="<?php _e( $id, 'dfp-ads' ); ?>" name="<?php _e( $id, 'dfp-ads' ); ?>">
137137
<?php dfp_ad_select_options( $value ); ?>
138-
</select>
139-
<?php if ( isset( $args['description'] ) ) {
140-
echo '<p><em>'. $args['description'] . '</em></p>';
141-
} ?>
138+
</select>
139+
<?php if ( isset( $args['description'] ) ) { ?>
140+
<p><em><?php _e( $args['description'], 'dfp-ads'); ?></em></p>
141+
<?php } ?>
142142
</div>
143143
<?php
144144
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)