Changeset 623369
- Timestamp:
- 11/10/2012 02:32:50 PM (13 years ago)
- Location:
- wp-spreadshirt
- Files:
-
- 4 edited
- 1 copied
-
tags/1.6 (copied) (copied from wp-spreadshirt/trunk)
-
tags/1.6/readme.txt (modified) (3 diffs)
-
tags/1.6/wp-spreadshirt.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/wp-spreadshirt.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-spreadshirt/tags/1.6/readme.txt
r612453 r623369 5 5 Requires at least: 3.0.1 6 6 Tested up to: 3.5 7 Stable tag: 1. 57 Stable tag: 1.6 8 8 9 9 Adding a shortcode to show your Spreadshirt-Articles in a page or post. … … 14 14 15 15 Example: 16 `[spreadshirt shop_url="http://chaoz.spreadshirt.de/" shop_id="602194" ]`16 `[spreadshirt shop_url="http://chaoz.spreadshirt.de/" shop_id="602194" shop_location="eu/na"]` 17 17 or 18 `[spreadshirt shop_url="http://chaoz.spreadshirt.de/shop/" shop_id="602194" ]`18 `[spreadshirt shop_url="http://chaoz.spreadshirt.de/shop/" shop_id="602194" shop_location="eu/na"]` 19 19 20 20 The Shop-URL **must** contain the trailing slash. … … 30 30 31 31 == Changelog == 32 33 = 1.6 = 34 * New option for shortcode. `shop_location` Set this to "eu" for european based shops or to "na" for northern america based shops. Spreadshirt has two separated APIs for this location. This will hopefully fix some problems displaying the wrong articles. 32 35 33 36 = 1.5 = -
wp-spreadshirt/tags/1.6/wp-spreadshirt.php
r612453 r623369 4 4 * Plugin URI: http://ppfeufer.de/wordpress-plugin/wp-spreadshirt/ 5 5 * Description: Adding a shortcode to show your Spreadshirt-Articles in a page or post. 6 * Version: 1. 56 * Version: 1.6 7 7 * Author: H.-Peter Pfeufer 8 8 * Author URI: http://ppfeufer.de … … 82 82 extract(shortcode_atts(array( 83 83 'shop_id' => '', 84 'shop_url' => '' 84 'shop_url' => '', 85 'shop_location' => 'eu' 85 86 ), $atts)); 86 87 87 88 if(!empty($shop_id) && !empty($shop_url)) { 88 $array_ArticleData = $this->_get_spreadshirt_data($shop_url, $shop_id); 89 /** 90 * Let's see what API we have to talk to. 91 * 92 * @since 1.6 93 * @author ppfeufer 94 */ 95 $var_sApiUrl = ''; 96 switch($shop_location) { 97 case 'eu': 98 $var_sApiUrl = 'http://api.spreadshirt.net/api/v1/shops/' . $shop_id . '/articleCategories/510/articles'; 99 break; 100 101 case 'na': 102 $var_sApiUrl = 'http://api.spreadshirt.com/api/v1/shops/' . $shop_id . '/articleCategories/510/articles'; 103 break; 104 } // END switch($shop_location) 105 106 $array_ArticleData = $this->_get_spreadshirt_data($shop_url, $var_sApiUrl); 89 107 90 108 if($array_ArticleData === false) { … … 140 158 * @return boolean|multitype:multitype:string 141 159 */ 142 private function _get_spreadshirt_data($var_sShopUri = null, $var_s ShopId = null) {143 if(!empty($var_sShopUri) && !empty($var_s ShopId)) {160 private function _get_spreadshirt_data($var_sShopUri = null, $var_sApiUrl) { 161 if(!empty($var_sShopUri) && !empty($var_sApiUrl)) { 144 162 $array_Articles = get_transient('spreadshirt-article-data'); 145 163 146 164 if($array_Articles === false) { 147 $var_sXmlShop = wp_remote_retrieve_body(wp_remote_get( 'http://api.spreadshirt.net/api/v1/shops/' . $var_sShopId . '/articleCategories/510/articles'));165 $var_sXmlShop = wp_remote_retrieve_body(wp_remote_get($var_sApiUrl)); 148 166 149 167 if(is_wp_error($var_sXmlShop)) { 150 168 return false; 151 169 } // END if(is_wp_error($var_sXmlShop)) 170 171 /** 172 * Check if we have a valid XML. 173 * If not, the shop seems to be not existing. 174 * 175 * @since 1.6 176 * @author ppfeufer 177 */ 178 if(substr($var_sXmlShop, 0, 5) != "<?xml") { 179 echo __('The Shop doesn\'t exist', $this->var_sTextdomain); 180 181 return false; 182 } // if(substr($var_sXmlShop, 0, 5) != "<?xml") 152 183 153 184 try { -
wp-spreadshirt/trunk/readme.txt
r612453 r623369 5 5 Requires at least: 3.0.1 6 6 Tested up to: 3.5 7 Stable tag: 1. 57 Stable tag: 1.6 8 8 9 9 Adding a shortcode to show your Spreadshirt-Articles in a page or post. … … 14 14 15 15 Example: 16 `[spreadshirt shop_url="http://chaoz.spreadshirt.de/" shop_id="602194" ]`16 `[spreadshirt shop_url="http://chaoz.spreadshirt.de/" shop_id="602194" shop_location="eu/na"]` 17 17 or 18 `[spreadshirt shop_url="http://chaoz.spreadshirt.de/shop/" shop_id="602194" ]`18 `[spreadshirt shop_url="http://chaoz.spreadshirt.de/shop/" shop_id="602194" shop_location="eu/na"]` 19 19 20 20 The Shop-URL **must** contain the trailing slash. … … 30 30 31 31 == Changelog == 32 33 = 1.6 = 34 * New option for shortcode. `shop_location` Set this to "eu" for european based shops or to "na" for northern america based shops. Spreadshirt has two separated APIs for this location. This will hopefully fix some problems displaying the wrong articles. 32 35 33 36 = 1.5 = -
wp-spreadshirt/trunk/wp-spreadshirt.php
r612453 r623369 4 4 * Plugin URI: http://ppfeufer.de/wordpress-plugin/wp-spreadshirt/ 5 5 * Description: Adding a shortcode to show your Spreadshirt-Articles in a page or post. 6 * Version: 1. 56 * Version: 1.6 7 7 * Author: H.-Peter Pfeufer 8 8 * Author URI: http://ppfeufer.de … … 82 82 extract(shortcode_atts(array( 83 83 'shop_id' => '', 84 'shop_url' => '' 84 'shop_url' => '', 85 'shop_location' => 'eu' 85 86 ), $atts)); 86 87 87 88 if(!empty($shop_id) && !empty($shop_url)) { 88 $array_ArticleData = $this->_get_spreadshirt_data($shop_url, $shop_id); 89 /** 90 * Let's see what API we have to talk to. 91 * 92 * @since 1.6 93 * @author ppfeufer 94 */ 95 $var_sApiUrl = ''; 96 switch($shop_location) { 97 case 'eu': 98 $var_sApiUrl = 'http://api.spreadshirt.net/api/v1/shops/' . $shop_id . '/articleCategories/510/articles'; 99 break; 100 101 case 'na': 102 $var_sApiUrl = 'http://api.spreadshirt.com/api/v1/shops/' . $shop_id . '/articleCategories/510/articles'; 103 break; 104 } // END switch($shop_location) 105 106 $array_ArticleData = $this->_get_spreadshirt_data($shop_url, $var_sApiUrl); 89 107 90 108 if($array_ArticleData === false) { … … 140 158 * @return boolean|multitype:multitype:string 141 159 */ 142 private function _get_spreadshirt_data($var_sShopUri = null, $var_s ShopId = null) {143 if(!empty($var_sShopUri) && !empty($var_s ShopId)) {160 private function _get_spreadshirt_data($var_sShopUri = null, $var_sApiUrl) { 161 if(!empty($var_sShopUri) && !empty($var_sApiUrl)) { 144 162 $array_Articles = get_transient('spreadshirt-article-data'); 145 163 146 164 if($array_Articles === false) { 147 $var_sXmlShop = wp_remote_retrieve_body(wp_remote_get( 'http://api.spreadshirt.net/api/v1/shops/' . $var_sShopId . '/articleCategories/510/articles'));165 $var_sXmlShop = wp_remote_retrieve_body(wp_remote_get($var_sApiUrl)); 148 166 149 167 if(is_wp_error($var_sXmlShop)) { 150 168 return false; 151 169 } // END if(is_wp_error($var_sXmlShop)) 170 171 /** 172 * Check if we have a valid XML. 173 * If not, the shop seems to be not existing. 174 * 175 * @since 1.6 176 * @author ppfeufer 177 */ 178 if(substr($var_sXmlShop, 0, 5) != "<?xml") { 179 echo __('The Shop doesn\'t exist', $this->var_sTextdomain); 180 181 return false; 182 } // if(substr($var_sXmlShop, 0, 5) != "<?xml") 152 183 153 184 try {
Note: See TracChangeset
for help on using the changeset viewer.