Skip to content

Commit

Permalink
Merge pull request #11 from ThatGerber/importer
Browse files Browse the repository at this point in the history
0.2.0
  • Loading branch information
chriswgerber committed May 12, 2015
2 parents 7970afe + 90b5e7f commit 9de1034
Show file tree
Hide file tree
Showing 19 changed files with 7,674 additions and 5,604 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ cache

# Ignore Composer directory
/vendor/

# Ignore WordPress repo
/plugin/
12,844 changes: 7,329 additions & 5,515 deletions build/logs/clover.xml

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions build/wordpress-files.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
index.php
plugin.php
readme.txt
js/
lib/
src/
widget/
41 changes: 41 additions & 0 deletions build/wordpress_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

BUILD=`pwd`;

echo 'Building WordPress plugin.';

echo -n 'What is the version number? ';
read VERSION;
echo "$VERSION";

cd $BUILD/../;

###
# Change Version Number
###
echo "Updating version to $VERSION";
sed -i '' "s|\* Version: *.*.*|\* Version: $VERSION|" plugin.php

###
# Make directory of files to import
###
mkdir plugin/;
rsync -av --files-from=build/wordpress-files.txt . plugin/

###
# Move vendor files to lib folder
###
mkdir lib;
rsync -vah vendor/ plugin/lib/

###
# Change autoload
###
echo "Changing location of autoload";
sed -i '' "s|require_once 'vendor/autoload.php'|require_once 'lib/autoload.php'|" plugin/plugin.php

###
# Return Home; We're Complete
###
cd $BUILD;
echo 'Build Complete.';
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"name": "ThatGerber/dfp-ads",
"description": "WordPress plugin for DoubleClick for Publishers",
"require": {
"ddeboer/data-import": "@stable"
},
"require-dev": {
"phpunit/phpunit": "4.6.*",
"codeclimate/php-test-reporter": "dev-master"
Expand Down
39 changes: 0 additions & 39 deletions inc/class.dfp_ads_import_form.php

This file was deleted.

60 changes: 45 additions & 15 deletions plugin.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
/**
* DFP Ad Manager Bootstrap File
*
* @wordpress-plugin
* Plugin Name: DFP - DoubleClick Ad Manager
* Plugin URI: http://www.chriswgerber.com/dfp-ads/
* Description: Manages ad code for DoubleClick for Publishers
* Version: 0.1.0
* Author: Chris W. Gerber
* Author URI: http://www.chriswgerber.com/
* License: GPL-2.0+
Expand All @@ -13,23 +14,29 @@
* Github Plugin URI: https://github.com/ThatGerber/dfp-ads
* GitHub Branch: master
*
* Version: 0.1.0
*
* The Plugin File
*
* @link http://www.chriswgerber.com/dfp-ads
* @since 0.0.1
* @subpackage DFP-Ads
*/
define( 'EPG_AD_PLUGIN_VER', '0.1.0' );

include( 'inc/helper_functions.php' );
include( 'inc/abstract.dfp_ads_form.php' );
include( 'inc/class.dfp_ads.php' );
include( 'inc/class.dfp_ads_post_type.php' );
include( 'inc/class.dfp_ads_input.php' );
include( 'inc/class.dfp_ad_position.php' );
include( 'inc/class.dfp_ads_settings_form.php' );
include( 'inc/class.dfp_ads_admin.php' );
define( 'EPG_AD_PLUGIN_VER', '0.2.0' );

/* Autoload */
require_once 'vendor/autoload.php';

/* Library */
include( 'src/helper_functions.php' );
include( 'src/abstract.dfp_ads_form.php' );
include( 'src/class.dfp_ads.php' );
include( 'src/class.dfp_ads_post_type.php' );
include( 'src/class.dfp_ads_input.php' );
include( 'src/class.dfp_ad_position.php' );
include( 'src/class.dfp_ads_settings_form.php' );
include( 'src/class.dfp_ads_import_form.php' );
include( 'src/class.dfp_ads_admin.php' );
include( 'widget/widget.ad_position.php' );

/*
Expand Down Expand Up @@ -172,9 +179,32 @@
add_action( 'admin_menu', array( $ad_admin, 'register_menu_page' ) );
add_action( 'admin_init', array( $ad_admin, 'menu_page_init' ) );

// Import Page
$ad_form = new DFP_Ads_Settings_Form;
$ad_admin = new DFP_Ads_Admin( $ad_form );
/*
* Import Page
*/
add_filter( 'dfp_ads_import_sections', ( function( $sections ) {
$sections['import_data'] = array(
'id' => 'import_data',
'title' => 'Import from CSV'
);

return $sections;
} ) );
add_filter( 'dfp_ads_import_fields', ( function( $fields ) {
$fields['file_import'] = array(
'id' => 'import_csv',
'field' => 'file',
'callback' => 'file',
'title' => 'Import CSV from DFP',
'section' => 'import_data',
'description' => 'Upload a CSV File directly from DoubleClick for Publishers'
);

return $fields;
} ) );

$import_form = new DFP_Ads_Import_Form;
$ad_admin = new DFP_Ads_Admin( $import_form );
$ad_admin->menu_title = 'Import';
$ad_admin->plugin_slug = 'import';
$ad_admin->options_str = 'DFP_Ads_Import';
Expand All @@ -191,4 +221,4 @@
*/
add_action( 'widgets_init', ( function( $fields ) {
register_widget("DFP_Ads_Widget");
}) );
}) );
21 changes: 16 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ Simpler management of DFP (*DoubleClick for Publishers*) ad positions
<a name="Installation"></a>
## Installation

Documentation in progress.

<a name="#Install"></a>
### Install plugin

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

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

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

### Other priorities

* Full Test Suite for current code and all new features.

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

### 0.2.0

* Added functionality for importing DFP Ads
* Added Travis CI Integration.
* Added Composer
* Begin Unit Testing
* Added Code Coverage Reporting
* Updated JS to make extensions easier
* Added Asynchronous ad loading
* Made plugin compatible with PHP 5.3

### 0.1.0
* Initial pre-release

Expand Down
55 changes: 46 additions & 9 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,64 @@
=== DFP Ad Manager ===

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

Manager for ad positions and targeting through DoubleClick for Publishers.
Simpler management of DFP (DoubleClick for Publishers) ad positions

== Description ==

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

Follow development of the plugin on [Github.com/ThatGerber/dfp-ads](http://github.com/ThatGerber/dfp-ads]

== Installation ==

Documentation in progress
= Install plugin =

1. Download Zip File
2. Navigate to your website's admin page: `example.com/wp-admin/`
3. Go to Plugins, "Add New"
4. At the top of the page, choose "Upload Plugin"
5. Upload zip file and install now
6. Activate plugin

= Set Up Ad Network =

1. Visit [https://www.google.com/dfp/](https://www.google.com/dfp/) and get your Account ID
1. To find your Account ID, go to Settings. On the left sidebar, choose "Network Settings" and "All Network Settings".
2. Copy your "Network Code". It should be an 8-digit integer for identifying your ad network.
2. Visit the Ad Positions "Settings" in the WordPress Admin page.
3. Add the DFP Network Code for Identifying the ad network for ad positions.

== Screenshots ==

Visit [chriswgerber.com/dfp-ads/](http://www.chriswgerber.com/dfp-ads/) for screenshots and more information.

== Frequently Asked Questions ==

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

== Upgrade Notice ==

If you're coming from the pre-release, many features have been changed and improved. You will be required to re-setup your network.

== Changelog ==

= 0.2.0

* Added functionality for importing DFP Ads
* Added Travis CI Integration.
* Added Composer
* Begin Unit Testing
* Added Code Coverage Reporting
* Updated JS to make extensions easier
* Added Asynchronous ad loading
* Made plugin compatible with PHP 5.3

= 0.1.0
* Initial Release
* Initial Pre-Release
20 changes: 10 additions & 10 deletions inc/abstract.dfp_ads_form.php → src/abstract.dfp_ads_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ public function form_title( $title = null ) {
*/
public function text( $args ) {
// Why is it so nested?
$args = $args[0];
// Field values
$id = $this->options_str . '[' . $args['id'] . ']';
$title = $args['title'];
$value = ( ! isset( $this->values[ $args['id'] ] ) ? '' : $this->values[ $args['id'] ] );
$args = $args[0];
$id = $this->options_str . '[' . $args['id'] . ']';
$field = $args['field'];
$title = $args['title'];
$value = ( ! isset( $this->values[ $args['id'] ] ) ? '' : $this->values[ $args['id'] ] );
?>
<div>
<input type="<?php echo $args->field; ?>"
<input type="<?php _e( $field, 'dfp-ads' ); ?>"
id="<?php _e( $id, 'dfp-ads' ); ?>"
name="<?php _e( $id, 'dfp-ads' ); ?>"
value="<?php _e( $value, 'dfp-ads' ); ?>" />
Expand Down Expand Up @@ -135,10 +135,10 @@ public function ads_dropdown( $args ) {
<div>
<select id="<?php _e( $id, 'dfp-ads' ); ?>" name="<?php _e( $id, 'dfp-ads' ); ?>">
<?php dfp_ad_select_options( $value ); ?>
</select>
<?php if ( isset( $args['description'] ) ) {
echo '<p><em>'. $args['description'] . '</em></p>';
} ?>
</select>
<?php if ( isset( $args['description'] ) ) { ?>
<p><em><?php _e( $args['description'], 'dfp-ads'); ?></em></p>
<?php } ?>
</div>
<?php
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 9de1034

Please sign in to comment.