Changeset 1046241
- Timestamp:
- 12/16/2014 10:24:34 PM (11 years ago)
- Location:
- advertising-manager/trunk
- Files:
-
- 4 edited
-
advertising-manager.php (modified) (2 diffs)
-
deploy.txt (modified) (2 diffs)
-
lib/Advman/Upgrade.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
advertising-manager/trunk/advertising-manager.php
r1045321 r1046241 7 7 Author: Scott Switzer 8 8 Author URI: http://github.com/switzer 9 Version: 3.5 9 Version: 3.5.1 10 10 Text Domain: advman 11 11 Domain Path: /languages … … 30 30 31 31 32 define('ADVMAN_VERSION', '3.5 ');32 define('ADVMAN_VERSION', '3.5.1'); 33 33 define('ADVMAN_PATH', dirname(__FILE__)); 34 34 define('ADVMAN_LIB', ADVMAN_PATH . '/lib/Advman'); -
advertising-manager/trunk/deploy.txt
r1045321 r1046241 31 31 4. In the readme file (Changelog) 32 32 5. Upgrade Wordpress tested version in readme file (at the top) 33 6. in this build file (search for the version number 3.5 - there are a number of places in this file where the version exists)33 6. in this build file (search for the version number 3.5.1 - there are a number of places in this file where the version exists) 34 34 7. check the upgrade to make sure any version upgrades are correct 35 35 … … 49 49 - Tag the version in wordpress 50 50 cd ~/code/wordpress/advertising-manager 51 svn cp trunk tags/3.5 52 svn ci -m "tagging version 3.5 "51 svn cp trunk tags/3.5.1 52 svn ci -m "tagging version 3.5.1" -
advertising-manager/trunk/lib/Advman/Upgrade.php
r1045321 r1046241 10 10 $version = Advman_Upgrade::_get_version($data); 11 11 Advman_Upgrade::_backup($data, $version); 12 $versions = array('3.4', '3.4.2', '3.4.3', '3.4.7', '3.4.9', '3.4.12', '3.4.14', '3.4.15', '3.4.20', '3.4.25', '3.4.29', '3.5 ');12 $versions = array('3.4', '3.4.2', '3.4.3', '3.4.7', '3.4.9', '3.4.12', '3.4.14', '3.4.15', '3.4.20', '3.4.25', '3.4.29', '3.5.1'); 13 13 foreach ($versions as $v) { 14 14 if (version_compare($version, $v, '<')) { … … 34 34 } 35 35 36 static function advman_3_5 (&$data)36 static function advman_3_5_1(&$data) 37 37 { 38 38 // Check to see if we need to migrate any old ad tags to new ad tags … … 50 50 ); 51 51 52 $args = array('numberposts' => -1, 'post_type' => array('post','page'), 'suppress_filters' => false);53 $posts = get_posts($args);54 52 $found_posts = 0; 55 53 $found_ads = 0; 56 foreach ($posts as $post) { 57 $ad_found_in_post = false; 58 if (!empty($post->post_content)) { 59 foreach ($patterns as $pattern) { 60 if (preg_match_all($pattern, $post->post_content, $matches)) { 61 if (!empty($matches[1])) { 62 for ($i=0; $i<sizeof($matches[1]); $i++) { 63 $name = $matches[1][$i]; 64 $ad = Advman_Upgrade::_selectAd($data, $name); 65 if (!$ad) { 66 $name = html_entity_decode($name); 54 55 $offset = 0; 56 $numberposts = 10; 57 58 $args = array('numberposts' => $numberposts, 'offset' => $offset, 'post_type' => array('post','page'), 'suppress_filters' => false); 59 $posts = get_posts($args); 60 61 while ($posts) { 62 foreach ($posts as $post) { 63 $ad_found_in_post = false; 64 if (!empty($post->post_content)) { 65 foreach ($patterns as $pattern) { 66 if (preg_match_all($pattern, $post->post_content, $matches)) { 67 if (!empty($matches[1])) { 68 for ($i=0; $i<sizeof($matches[1]); $i++) { 69 $name = $matches[1][$i]; 67 70 $ad = Advman_Upgrade::_selectAd($data, $name); 68 } 69 if (!$ad) { 70 $name = str_replace(";","\\;",$name); 71 $ad = Advman_Upgrade::_selectAd($data, $name); 72 } 73 if ($ad) { 74 $found_ads++; 75 if (!$ad_found_in_post) { 76 $ad_found_in_post = true; 77 $found_posts++; 71 if (!$ad) { 72 $name = html_entity_decode($name); 73 $ad = Advman_Upgrade::_selectAd($data, $name); 74 } 75 if (!$ad) { 76 $name = str_replace(";","\\;",$name); 77 $ad = Advman_Upgrade::_selectAd($data, $name); 78 } 79 if ($ad) { 80 $found_ads++; 81 if (!$ad_found_in_post) { 82 $ad_found_in_post = true; 83 $found_posts++; 84 } 78 85 } 79 86 } 80 } 81 } else {82 $found_ads++;83 if (!$ad_found_in_post) {84 $ad_found_in_post = true;85 $found_posts++;87 } else { 88 $found_ads++; 89 if (!$ad_found_in_post) { 90 $ad_found_in_post = true; 91 $found_posts++; 92 } 86 93 } 87 94 } … … 89 96 } 90 97 } 98 $offset += $numberposts; 99 $args = array('numberposts' => $numberposts, 'offset' => $offset, 'post_type' => array('post','page'), 'suppress_filters' => false); 100 $posts = get_posts($args); 91 101 } 92 102 if ($found_ads) { … … 116 126 ); 117 127 118 $args = array('numberposts' => -1, 'post_type' => array('post','page'), 'suppress_filters' => false); 128 $offset = 0; 129 $numberposts = 10; 130 131 $args = array('numberposts' => $numberposts, 'offset' => $offset, 'post_type' => array('post','page'), 'suppress_filters' => false); 119 132 $posts = get_posts($args); 120 foreach ($posts as $post) { 121 if (!empty($post->post_content)) { 122 $post_content = $post->post_content; 123 foreach ($patterns as $pattern) { 124 if (preg_match_all($pattern, $post->post_content, $matches)) { 125 if (!empty($matches[1])) { 126 for ($i=0; $i<sizeof($matches[1]); $i++) { 127 $name = $matches[1][$i]; 128 $ad = Advman_Upgrade::_selectAd($data, $name); 129 if (!$ad) { 130 $name = html_entity_decode($name); 133 134 while ($posts) { 135 foreach ($posts as $post) { 136 if (!empty($post->post_content)) { 137 $post_content = $post->post_content; 138 foreach ($patterns as $pattern) { 139 if (preg_match_all($pattern, $post->post_content, $matches)) { 140 if (!empty($matches[1])) { 141 for ($i = 0; $i < sizeof($matches[1]); $i++) { 142 $name = $matches[1][$i]; 131 143 $ad = Advman_Upgrade::_selectAd($data, $name); 144 if (!$ad) { 145 $name = html_entity_decode($name); 146 $ad = Advman_Upgrade::_selectAd($data, $name); 147 } 148 if (!$ad) { 149 $name = str_replace(";", "\\;", $name); 150 $ad = Advman_Upgrade::_selectAd($data, $name); 151 } 152 if ($ad) { 153 $search = $matches[0][$i]; 154 $replace = "[ad name=\"$name\"]"; 155 $post_content = str_replace($search, $replace, $post_content); 156 } 132 157 } 133 if (!$ad) { 134 $name = str_replace(";","\\;",$name); 135 $ad = Advman_Upgrade::_selectAd($data, $name); 136 } 137 if ($ad) { 138 $search = $matches[0][$i]; 139 $replace = "[ad name=\"$name\"]"; 140 $post_content = str_replace($search, $replace, $post_content); 141 } 158 } else { 159 $search = str_replace("/", "", $pattern); 160 $replace = "[ad]"; 161 $post_content = str_replace($search, $replace, $post_content); 142 162 } 143 } else {144 $search = str_replace("/","",$pattern);145 $replace = "[ad]";146 $post_content = str_replace($search, $replace, $post_content);147 163 } 148 } } 149 if ($post->post_content != $post_content) { 150 $post->post_content = $post_content; 151 wp_update_post($post); 152 } 153 } 164 } 165 if ($post->post_content != $post_content) { 166 $post->post_content = $post_content; 167 wp_update_post($post); 168 } 169 } 170 } 171 172 $offset += $numberposts; 173 $args = array('numberposts' => $numberposts, 'offset' => $offset, 'post_type' => array('post','page'), 'suppress_filters' => false); 174 $posts = get_posts($args); 154 175 } 155 176 } -
advertising-manager/trunk/readme.txt
r1045321 r1046241 5 5 Requires at least: 2.5 6 6 Tested up to: 4.0.1 7 Stable tag: 3.5 7 Stable tag: 3.5.1 8 8 License: GPLv2 or later 9 9 … … 106 106 == Upgrade Notice == 107 107 108 = 3.5 = 109 * Fixed shortcodes issue introduces with WP 4.0.1 110 * Fixed messages that printed in debugging mode 111 * Initial analytics screen 108 = 3.5.1 = 109 * Only update 10 posts at a time when upgrading shortcodes 112 110 113 111 == Change Log == 112 113 = 3.5.1 = 114 * Only update 10 posts at a time when upgrading shortcodes 114 115 115 116 = 3.5 =
Note: See TracChangeset
for help on using the changeset viewer.