Changeset 1000862
- Timestamp:
- 10/02/2014 07:38:34 PM (12 years ago)
- Location:
- advertising-manager/trunk
- Files:
-
- 6 added
- 9 edited
-
advertising-manager.php (modified) (3 diffs)
-
deploy.txt (modified) (2 diffs)
-
developer.txt (modified) (2 diffs)
-
lib/Advman/Admin.php (modified) (5 diffs)
-
lib/Advman/Analytics.php (added)
-
lib/Advman/List.php (added)
-
lib/Advman/Template/Ad/List.php (modified) (1 diff)
-
lib/Advman/Template/Ad/Preview.php (added)
-
lib/Advman/Template/Table (added)
-
lib/Advman/Template/Table/Analytics.php (added)
-
lib/Advman/Template/Table/List.php (added)
-
lib/Advman/Upgrade.php (modified) (1 diff)
-
lib/OX/Swifty.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
scripts/advman.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
advertising-manager/trunk/advertising-manager.php
r995695 r1000862 1 1 <?php 2 2 3 /* 3 4 Plugin Name: Advertising Manager … … 6 7 Author: Scott Switzer 7 8 Author URI: http://github.com/switzer 8 Version: 3.4.2 89 Version: 3.4.29 9 10 Text Domain: advman 10 11 Domain Path: /languages … … 29 30 30 31 31 define('ADVMAN_VERSION', '3.4.2 8');32 define('ADVMAN_VERSION', '3.4.29'); 32 33 define('ADVMAN_PATH', dirname(__FILE__)); 33 34 define('ADVMAN_LIB', ADVMAN_PATH . '/lib/Advman'); -
advertising-manager/trunk/deploy.txt
r962336 r1000862 30 30 3. in the readme file (stable tag at the top) 31 31 4. In the readme file (Changelog) 32 5. in this build file (search for the version number 3.4.2 8- there are a number of places in this file where the version exists)32 5. in this build file (search for the version number 3.4.29 - there are a number of places in this file where the version exists) 33 33 6. check the upgrade to make sure any version upgrades are correct 34 34 … … 48 48 - Tag the version in wordpress 49 49 cd ~/code/wordpress/advertising-manager 50 svn cp trunk tags/3.4.2 851 svn ci -m "tagging version 3.4.2 8"50 svn cp trunk tags/3.4.29 51 svn ci -m "tagging version 3.4.29" -
advertising-manager/trunk/developer.txt
r958424 r1000862 9 9 vagrant ssh 10 10 11 # Building a new docker file (not needed if you have not updated wordpress) 12 docker build --no-cache -t switzer/wordpress /home/core/share/switzer/wordpress/ 13 11 14 # From coreos command prompt 12 15 docker run --name mysql -e MYSQL_ROOT_PASSWORD=password -p 3306:3306 -d mysql … … 17 20 # You will now be inside the docker instance at the command prompt 18 21 ln -s /usr/src/code/wordpress/advertising-manager/trunk /var/www/html/wp-content/plugins/advertising-manager 19 exit ;22 exit 20 23 21 24 # Back to the coreos command prompt -
advertising-manager/trunk/lib/Advman/Admin.php
r995695 r1000862 1 1 <?php 2 2 require_once (ADVMAN_LIB . '/Tools.php'); 3 require_once (ADVMAN_LIB . '/AdList.php'); 3 require_once (ADVMAN_LIB . '/List.php'); 4 require_once (ADVMAN_LIB . '/Analytics.php'); 4 5 5 6 class Advman_Admin … … 12 13 global $wp_version; 13 14 14 add_object_page(__('Ads', 'advman'), __('Ads', 'advman'), 8, 'advman-list', array('Advman_Ad_List','process'), ADVMAN_URL . '/images/advman-menu-icon.svg'); 15 $ad_list_hook = add_submenu_page('advman-list', __('All Ads', 'advman'), __('All Ads', 'advman'), 8, 'advman-list', array('Advman_Ad_List','process')); 15 add_object_page(__('Ads', 'advman'), __('Ads', 'advman'), 8, 'advman-list', array('Advman_List','process'), ADVMAN_URL . '/images/advman-menu-icon.svg'); 16 $list_hook = add_submenu_page('advman-list', __('All Ads', 'advman'), __('All Ads', 'advman'), 8, 'advman-list', array('Advman_List','process')); 17 // $analytics_hook = add_submenu_page('advman-list', __('Analytics', 'advman'), __('Analytics', 'advman'), 8, 'advman-analytics', array('Advman_Analytics','process')); 16 18 add_submenu_page('advman-list', __('Create New Ad', 'advman'), __('Create New', 'advman'), 8, 'advman-ad-new', array('Advman_Admin','create')); 17 19 add_submenu_page(null, __('Edit Ad', 'advman'), __('Edit', 'advman'), 8, 'advman-ad', array('Advman_Admin','edit_ad')); … … 21 23 22 24 // List items 23 add_action("load-$ad_list_hook", array('Advman_Ad_List', 'add_options')); 24 add_action("admin_head-$ad_list_hook", array('Advman_Ad_List', 'add_contextual_help' )); 25 add_action("admin_head-$ad_list_hook", array('Advman_Ad_List', 'add_css' )); 25 add_action("load-$list_hook", array('Advman_List', 'add_options')); 26 add_action("admin_head-$list_hook", array('Advman_List', 'add_contextual_help' )); 27 add_action("admin_head-$list_hook", array('Advman_List', 'add_css' )); 28 // Analytics items 29 // add_action("load-$analytics_hook", array('Advman_Analytics', 'add_options')); 30 // add_action("admin_head-$analytics_hook", array('Advman_Analytics', 'add_contextual_help' )); 31 // add_action("admin_head-$analytics_hook", array('Advman_Analytics', 'add_css' )); 26 32 27 33 add_action('admin_enqueue_scripts', array('Advman_Admin', 'admin_enqueue_scripts')); … … 51 57 case 'advman-ad-new' : Advman_Admin::import_action($action); break; 52 58 case 'advman-ad' : Advman_Admin::ad_action($action); break; 53 case 'advman-list' : Advman_Ad_List::init(); break; 59 case 'advman-analytics' : Advman_Analytics::init(); break; 60 case 'advman-list' : Advman_List::init(); break; 54 61 case 'advman-network' : Advman_Admin::network_action($action); break; 55 62 } … … 359 366 } 360 367 break; 368 369 case 'advman-analytics' : 370 $template = Advman_Tools::get_template('Table_Analytics'); 371 $template->display(); 372 break; 361 373 } 362 374 363 375 if (!$template) { 364 $template = Advman_Tools::get_template(' Ad_List');376 $template = Advman_Tools::get_template('Table_List'); 365 377 $template->display(); 366 378 } -
advertising-manager/trunk/lib/Advman/Template/Ad/List.php
r958719 r1000862 1 1 <?php 2 class Advman_Template_ Ad_List2 class Advman_Template_List 3 3 { 4 4 function display($target = null, $filter = null) -
advertising-manager/trunk/lib/Advman/Upgrade.php
r995597 r1000862 24 24 function advman_3_4_29(&$data) 25 25 { 26 // Convert stats to a new format 27 $stats = $data['stats']; 28 $new_stats = array(); 29 30 foreach ($stats as $dt => $stat) { 31 foreach ($stat as $adId => $impressions) { 32 $new_stats['d'][$dt]['ad'][$adId]['i'] = $impressions; 33 } 34 } 35 $data['stats'] = $new_stats; 36 26 37 // Remove publisher-id (not used) 27 38 if (isset($data['settings']['publisher-id'])) { -
advertising-manager/trunk/lib/OX/Swifty.php
r947064 r1000862 57 57 return $this->dal->update_stats($stats); 58 58 } 59 60 function getStats() 61 { 62 return $this->dal->select_stats(); 63 } 64 65 function incrementStats($ad) 59 60 /* 61 * The goal of this method is to give back stats for a date range: 62 * - by entity 63 * - # imps 64 * - # clicks 65 * - # views 66 * - # vs. prev. imps 67 * - # vs. prev. clicks 68 * - # vs. prev. views 69 * returns an array of this structure: 70 * [ad_id][i] = number of impressions 71 * [ad_id][i-] = number of impressions from the immediately previous segment 72 */ 73 function getStats($date_range = null, $entity_breakdown = 'ad', $date_breakdown = 'hour', $previous = false) 74 { 75 // If no date range specified, then get it for today 76 if (!$date_range) { 77 $today = date('Y-m-d'); 78 $date_range = array( 79 'begin' => $today, 80 'end' => $today 81 ); 82 } 83 84 // For now, entity breakdown is always 'ads' 85 $entity_breakdown = 'ads'; 86 87 // For now, date breakdown is always by day 88 // $date_breakdown = 'd'; 89 90 // If previous timeperiod, find the range of days immediately preceding the date range 91 if ($previous) { 92 93 } 94 // Get the begin and end dates. These dates are passed in as 'Y-m-d'. 95 $begin = strtotime($date_range['begin']); 96 $end = strtotime($date_range['end']) + 86400; // begin/end are inclusive, so add a day to the end 97 98 // If you want the previous time period, then some math is needed to get the start and end dates of the previous timeperiod 99 if ($previous) { 100 $diff = ($end - $begin); 101 $begin -= $diff; 102 $end -= $diff; 103 } 104 105 // Get the raw statistics 106 $stats = $this->dal->select_stats(); 107 108 // Sum up stats for this date range 109 $sum_stats = array(); 110 foreach ($stats['d'] as $dtstr => $stat) { 111 $dt = strtotime($dtstr); 112 if ($dt >= $begin && $dt < $end) { 113 // Get the entity breakdown 114 $s = $stat[$entity_breakdown]; 115 // Loop through each of the entities and sum up 116 foreach ($s as $id => $data) { 117 if (!isset($sum_stats[$id])) { 118 $sum_stats[$id] = $data; 119 } else { 120 foreach($data as $v => $n) { 121 // Either create a new node or increment the node 122 $sum_stats[$id][$v] = (!isset($sum_stats[$id][$v])) ? $n : $sum_stats[$id][$v] + $n; 123 } 124 $sum_stats[$id]['i'] += $data['i']; 125 } 126 if ($entity_breakdown == 'ads') { 127 $ad = $this->getAd($id); 128 if ($ad) { 129 $sum_stats[$id]['name'] = $ad->name; 130 } 131 } 132 } 133 } 134 } 135 136 return $sum_stats; 137 } 138 139 function incrementStats($ad, $type = 'i') 66 140 { 67 141 $date = date("Y-m-d"); 142 $hour = date('H'); 68 143 $adId = $ad->id; 144 69 145 if ($this->getSetting('stats')) { 70 $stats = $this->getStats(); 71 if (empty($stats[$date][$adId])) { 72 $stats[$date][$adId] = 0; 73 } 74 $stats[$date][$adId]++; 146 147 $stats = $this->dal->select_stats(); 148 149 // Increment date stats 150 if (empty($stats['d'][$date]['ads'][$adId][$type])) { 151 $stats['d'][$date]['ads'][$adId][$type] = 0; 152 } 153 $stats['d'][$date]['ads'][$adId][$type]++; 154 155 // Increment hour stats 156 if (empty($stats['h'][$date][$hour]['ads'][$adId][$type])) { 157 $stats['h'][$date][$hour]['ads'][$adId][$type] = 0; 158 } 159 $stats['h'][$date][$hour]['ads'][$adId][$type]++; 160 75 161 $this->setStats($stats); 76 162 } -
advertising-manager/trunk/readme.txt
r962999 r1000862 4 4 Tags: ad, admin, adsense, adserver, advertisement, advertising, affiliate, banner, google, manager, rotate, widget 5 5 Requires at least: 2.5 6 Tested up to: 3.9.27 Stable tag: 3.4.2 86 Tested up to: 4.0 7 Stable tag: 3.4.29 8 8 License: GPLv2 or later 9 9 … … 97 97 * By default, show a placeholder ad (not the real ad) for admin users so that ad quality is higher 98 98 * Add ability to show in an email 99 * Send daily and weekly statistics information 100 99 * Move stats into its own table http://codex.wordpress.org/Creating_Tables_with_Plugins 100 101 == Bugs == 102 103 * Setting number of ads to display in ad-list does not work. 104 * Unable to configure what columns to display in ad-list. 101 105 102 106 == Upgrade Notice == 103 107 104 = 3.4.2 8=105 * Fixed bug when using filtering by tag or category106 * Re moved templates for wordpress versions 2.4 and earlier107 * Reformatted code in preparation for ad slots108 = 3.4.29 = 109 * Tested for Wordpress 4.0 110 * Reformatted code to prepare for Analytics - coming soon! 111 * Fixed bug with previewing ad 108 112 109 113 == Change Log == 114 115 = 3.4.29 = 116 * Tested for Wordpress 4.0 117 * Reformatted code to prepare for Analytics - coming soon! 118 * Fixed bug with previewing ad 110 119 111 120 = 3.4.28 = -
advertising-manager/trunk/scripts/advman.css
r949874 r1000862 44 44 width: 10%; 45 45 } 46 .fixed .column-impressions { 47 text-align: right; 48 } 46 49 .fixed .column-advman-notes { 47 50 width: 15%;
Note: See TracChangeset
for help on using the changeset viewer.