Changeset 530018
- Timestamp:
- 04/11/2012 06:28:51 PM (14 years ago)
- Location:
- affiliate-press
- Files:
-
- 8 added
- 3 edited
- 7 copied
-
assets (added)
-
assets/banner-772x250.jpg (added)
-
tags/0.3.3 (copied) (copied from affiliate-press/trunk)
-
tags/0.3.3/affiliate-press.php (copied) (copied from affiliate-press/trunk/affiliate-press.php) (3 diffs)
-
tags/0.3.3/images/close.png (copied) (copied from affiliate-press/trunk/images/close.png)
-
tags/0.3.3/includes/class-affiliate-press.php (copied) (copied from affiliate-press/trunk/includes/class-affiliate-press.php) (5 diffs)
-
tags/0.3.3/readme.txt (copied) (copied from affiliate-press/trunk/readme.txt) (4 diffs)
-
tags/0.3.3/scripts/message.js (copied) (copied from affiliate-press/trunk/scripts/message.js)
-
tags/0.3.3/styles.css (copied) (copied from affiliate-press/trunk/styles.css)
-
tags/0.3.3/views/feed-add-wizard-step1.php (added)
-
tags/0.3.3/views/feed-add-wizard-step2.php (added)
-
tags/0.3.3/views/feed-add-wizard-step3.php (added)
-
trunk/affiliate-press.php (modified) (3 diffs)
-
trunk/includes/class-affiliate-press.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/views/feed-add-wizard-step1.php (added)
-
trunk/views/feed-add-wizard-step2.php (added)
-
trunk/views/feed-add-wizard-step3.php (added)
Legend:
- Unmodified
- Added
- Removed
-
affiliate-press/tags/0.3.3/affiliate-press.php
r529401 r530018 2 2 /** 3 3 * @package Affiliate_Press 4 * @version 0.3. 24 * @version 0.3.3 5 5 */ 6 6 /* … … 9 9 Description: Affiliate Press allows you to set up an affiliate website based on product feeds as easy as 1-2-3. 10 10 Author: ldebrouwer 11 Version: 0.3. 211 Version: 0.3.3 12 12 Author URI: http://lucdebrouwer.nl/ 13 13 */ … … 31 31 function AP_activation() { 32 32 include( LDB_AP_PATH . 'affiliate-press-upgrade.php' ); 33 update_option( 'LDB_Affiliate_Press_Version', '0.3. 2' );33 update_option( 'LDB_Affiliate_Press_Version', '0.3.3' ); 34 34 wp_schedule_event( time(), 'hourly', 'AP_cronjob' ); 35 35 } -
affiliate-press/tags/0.3.3/includes/class-affiliate-press.php
r529401 r530018 29 29 $pages[] = add_submenu_page( 'affiliate_press', __( 'Feeds', 'LDB_AP' ), __( 'Feeds', 'LDB_AP' ), 'manage_options', 'affiliate_press_feeds', array( &$this, 'AP_feeds' ) ); 30 30 $pages[] = add_submenu_page( 'affiliate_press', __( 'Add New Feed', 'LDB_AP' ), __( 'Add New Feed', 'LDB_AP' ), 'manage_options', 'affiliate_press_add', array( &$this, 'AP_addFeed' ) ); 31 $pages[] = add_submenu_page( 'affiliate_press', __( 'Add New Feed Wizard', 'LDB_AP' ), __( 'Add New Feed Wizard', 'LDB_AP' ), 'manage_options', 'affiliate_press_add_wizard', array( &$this, 'AP_addFeedWizard' ) ); 31 32 foreach( $pages as $page ) 32 33 add_action( 'admin_print_styles-' . $page, array( &$this, 'AP_loadStyle' ) ); … … 56 57 } 57 58 59 /* Function to change the title on hidden pages */ 58 60 function AP_changeTitle( $admin_title, $title ) { 59 61 if( isset( $_GET['page'] ) && isset( $this->titles[ $_GET['page'] ] ) ) … … 128 130 } 129 131 132 /* Function that determines the sortable columns on the products index page. */ 130 133 function AP_sortableColumns() { 131 134 return array( … … 285 288 } 286 289 290 /* Function that shows the add feed page. */ 291 function AP_addFeedWizard() { 292 $step = 1; 293 if( isset( $_POST['step'] ) ) { 294 $step = $_POST['step'] + 1; 295 } 296 if( $step === 2 ) { 297 if( $this->AP_issetAndNotEmpty( $_POST, array( 'title', 'currency', 'url' ) ) ) { 298 $nodes = $this->AP_fetchNodesWithChildren( $_POST['url'] ); 299 $item_xpath = $this->AP_buildSelect( 'item_xpath', $nodes, false, true ); 300 } else { 301 $this->AP_setMessage( __( "You didn't fill out all the required fields.", 'LDB_AP' ), 'warning' ); 302 $step = 1; 303 } 304 } else if( $step === 3 ) { 305 if( $this->AP_issetAndNotEmpty( $_POST, array( 'title', 'currency', 'url', 'item_xpath' ) ) ) { 306 $xpath = array(); 307 $fields = array( 'name', 'image', 'price', 'link', 'identifier' ); 308 $nodes = $this->AP_fetchChildNodes( $_POST['url'], $_POST['item_xpath'] ); 309 foreach( $fields as $field ) { 310 $xpath[ $field ] = $this->AP_buildSelect( $field . '_xpath', $nodes, false, true ); 311 } 312 $matches = $this->AP_buildSelect( 'matches', $this->AP_getCustomFields() ); 313 } else { 314 $nodes = $this->AP_fetchNodesWithChildren( $_POST['url'] ); 315 $item_xpath = $this->AP_buildSelect( 'item_xpath', $nodes, false, true ); 316 $this->AP_setMessage( __( "You didn't fill out all the required fields.", 'LDB_AP' ), 'warning' ); 317 $step = 2; 318 } 319 } 320 include( LDB_AP_VIEW_PATH . 'feed-add-wizard-step' . $step . '.php' ); 321 } 322 323 /* Function that check if the data in an array is set and not empty */ 324 function AP_issetAndNotEmpty( $var, $keys ) { 325 $check = true; 326 foreach( $keys as $key ) { 327 if( !isset( $var[ $key ] ) || empty( $var[ $key ] ) ) 328 $check = false; 329 330 } 331 return $check; 332 } 333 334 /* Function that fetches all XPath nodes that have children and occur multiple times. */ 335 function AP_fetchNodesWithChildren( $url ) { 336 $nodes = array(); 337 $temp = array(); 338 $data = wp_remote_get( $url ); 339 $body = new DOMDocument(); 340 @$body->loadXML( $data['body'] ); 341 $xpath = new DOMXPath( $body ); 342 $items = $xpath->query( '//*[count(*)>0]' ); 343 foreach( $items as $item ) { 344 if( in_array( $item->nodeName, $temp ) && !in_array( $item->nodeName, $nodes ) ) { 345 $nodes['//' . $item->nodeName] = '//' .$item->nodeName; 346 } 347 $temp[] = $item->nodeName; 348 } 349 return $nodes; 350 } 351 352 /* Function that fetches the childnodes for the first occurence of a certain node. */ 353 function AP_fetchChildNodes( $url, $item_xpath ) { 354 $nodes = array(); 355 $data = wp_remote_get( $url ); 356 $body = new DOMDocument(); 357 @$body->loadXML( $data['body'] ); 358 $xpath = new DOMXPath( $body ); 359 $query = $item_xpath . '[1]/*'; 360 $items = $xpath->query( $item_xpath . '[1]/*' ); 361 foreach( $items as $item ) { 362 if( !in_array( $item->nodeName, $nodes ) ) { 363 $nodes['.//' . $item->nodeName] = './/' .$item->nodeName; 364 } 365 } 366 return $nodes; 367 } 368 287 369 /* Function that shows the edit feed page. */ 288 370 function AP_editFeed() { … … 305 387 if( isset( $_GET['post'] ) ) { 306 388 $postinfo = get_post( $_GET['post'] ); 307 $this->AP_setMessage( sprintf( __( 'The draft for %s was created succes fully.', 'LDB_AP' ), $postinfo->post_title ), 'success' );389 $this->AP_setMessage( sprintf( __( 'The draft for %s was created successfully.', 'LDB_AP' ), $postinfo->post_title ), 'success' ); 308 390 } else if( isset( $_GET['linkto'] ) ) { 309 391 $postinfo = get_post( $_GET['linkto'] ); -
affiliate-press/tags/0.3.3/readme.txt
r529401 r530018 2 2 Contributors: ldebrouwer 3 3 Donate link: http://luc.me/40 4 Tags: affiliate, affiliates, product, products, product feed, product feeds 4 Tags: affiliate, affiliates, product, products, product feed, product feeds, feed, feeds 5 5 Requires at least: 3.3 6 6 Tested up to: 3.4 7 Stable tag: 0.3. 27 Stable tag: 0.3.3 8 8 9 9 Affiliate Press allows you to set up an affiliate website based on product feeds as easy as 1-2-3. … … 13 13 Affiliate Press is a plugin that allows you to create products ( as a custom post type ) based on product feeds. It also collects other data for these products, such as prices and affiliate links, which are shown on the product pages in the front end, effectively allowing you to set up your own affiliate website as easy as 1-2-3. 14 14 15 Affiliate Press was specifically developed to be compatible with multiple affiliate programs and networks, aiming to support a broader range of feeds and therefor more competitive prices for your visitor. 16 17 Currently I'm looking for people who are willing to send me examples of their product feeds so I can improve this plugin further. Please send your XML product feeds as attachment to [[email protected]](mailto:[email protected]). 18 15 19 Follow Luc De Brouwer on [Facebook](https://www.facebook.com/lucdebrouwernl) & [Twitter](http://twitter.com/ldebrouwer). 16 20 … … 18 22 19 23 1. Upload the `affiliate-press` folder to the `/wp-content/plugins/` directory 20 1. Activate the Affiliate Press plugin through the `Plugins`menu in WordPress24 1. Activate the Affiliate Press plugin through the 'Plugins' menu in WordPress 21 25 1. Configure the plugin by going to the `Affiliate Press` menu that appears in your admin menu 22 26 … … 52 56 53 57 == Changelog == 58 59 = 0.3.3 = 60 * Added the 'Add New Feed Wizard'. It's still rudimentary and feedback would be highly appreciated. Should work like a charm with Daisycon feeds. 54 61 55 62 = 0.3.2 = -
affiliate-press/trunk/affiliate-press.php
r529401 r530018 2 2 /** 3 3 * @package Affiliate_Press 4 * @version 0.3. 24 * @version 0.3.3 5 5 */ 6 6 /* … … 9 9 Description: Affiliate Press allows you to set up an affiliate website based on product feeds as easy as 1-2-3. 10 10 Author: ldebrouwer 11 Version: 0.3. 211 Version: 0.3.3 12 12 Author URI: http://lucdebrouwer.nl/ 13 13 */ … … 31 31 function AP_activation() { 32 32 include( LDB_AP_PATH . 'affiliate-press-upgrade.php' ); 33 update_option( 'LDB_Affiliate_Press_Version', '0.3. 2' );33 update_option( 'LDB_Affiliate_Press_Version', '0.3.3' ); 34 34 wp_schedule_event( time(), 'hourly', 'AP_cronjob' ); 35 35 } -
affiliate-press/trunk/includes/class-affiliate-press.php
r529401 r530018 29 29 $pages[] = add_submenu_page( 'affiliate_press', __( 'Feeds', 'LDB_AP' ), __( 'Feeds', 'LDB_AP' ), 'manage_options', 'affiliate_press_feeds', array( &$this, 'AP_feeds' ) ); 30 30 $pages[] = add_submenu_page( 'affiliate_press', __( 'Add New Feed', 'LDB_AP' ), __( 'Add New Feed', 'LDB_AP' ), 'manage_options', 'affiliate_press_add', array( &$this, 'AP_addFeed' ) ); 31 $pages[] = add_submenu_page( 'affiliate_press', __( 'Add New Feed Wizard', 'LDB_AP' ), __( 'Add New Feed Wizard', 'LDB_AP' ), 'manage_options', 'affiliate_press_add_wizard', array( &$this, 'AP_addFeedWizard' ) ); 31 32 foreach( $pages as $page ) 32 33 add_action( 'admin_print_styles-' . $page, array( &$this, 'AP_loadStyle' ) ); … … 56 57 } 57 58 59 /* Function to change the title on hidden pages */ 58 60 function AP_changeTitle( $admin_title, $title ) { 59 61 if( isset( $_GET['page'] ) && isset( $this->titles[ $_GET['page'] ] ) ) … … 128 130 } 129 131 132 /* Function that determines the sortable columns on the products index page. */ 130 133 function AP_sortableColumns() { 131 134 return array( … … 285 288 } 286 289 290 /* Function that shows the add feed page. */ 291 function AP_addFeedWizard() { 292 $step = 1; 293 if( isset( $_POST['step'] ) ) { 294 $step = $_POST['step'] + 1; 295 } 296 if( $step === 2 ) { 297 if( $this->AP_issetAndNotEmpty( $_POST, array( 'title', 'currency', 'url' ) ) ) { 298 $nodes = $this->AP_fetchNodesWithChildren( $_POST['url'] ); 299 $item_xpath = $this->AP_buildSelect( 'item_xpath', $nodes, false, true ); 300 } else { 301 $this->AP_setMessage( __( "You didn't fill out all the required fields.", 'LDB_AP' ), 'warning' ); 302 $step = 1; 303 } 304 } else if( $step === 3 ) { 305 if( $this->AP_issetAndNotEmpty( $_POST, array( 'title', 'currency', 'url', 'item_xpath' ) ) ) { 306 $xpath = array(); 307 $fields = array( 'name', 'image', 'price', 'link', 'identifier' ); 308 $nodes = $this->AP_fetchChildNodes( $_POST['url'], $_POST['item_xpath'] ); 309 foreach( $fields as $field ) { 310 $xpath[ $field ] = $this->AP_buildSelect( $field . '_xpath', $nodes, false, true ); 311 } 312 $matches = $this->AP_buildSelect( 'matches', $this->AP_getCustomFields() ); 313 } else { 314 $nodes = $this->AP_fetchNodesWithChildren( $_POST['url'] ); 315 $item_xpath = $this->AP_buildSelect( 'item_xpath', $nodes, false, true ); 316 $this->AP_setMessage( __( "You didn't fill out all the required fields.", 'LDB_AP' ), 'warning' ); 317 $step = 2; 318 } 319 } 320 include( LDB_AP_VIEW_PATH . 'feed-add-wizard-step' . $step . '.php' ); 321 } 322 323 /* Function that check if the data in an array is set and not empty */ 324 function AP_issetAndNotEmpty( $var, $keys ) { 325 $check = true; 326 foreach( $keys as $key ) { 327 if( !isset( $var[ $key ] ) || empty( $var[ $key ] ) ) 328 $check = false; 329 330 } 331 return $check; 332 } 333 334 /* Function that fetches all XPath nodes that have children and occur multiple times. */ 335 function AP_fetchNodesWithChildren( $url ) { 336 $nodes = array(); 337 $temp = array(); 338 $data = wp_remote_get( $url ); 339 $body = new DOMDocument(); 340 @$body->loadXML( $data['body'] ); 341 $xpath = new DOMXPath( $body ); 342 $items = $xpath->query( '//*[count(*)>0]' ); 343 foreach( $items as $item ) { 344 if( in_array( $item->nodeName, $temp ) && !in_array( $item->nodeName, $nodes ) ) { 345 $nodes['//' . $item->nodeName] = '//' .$item->nodeName; 346 } 347 $temp[] = $item->nodeName; 348 } 349 return $nodes; 350 } 351 352 /* Function that fetches the childnodes for the first occurence of a certain node. */ 353 function AP_fetchChildNodes( $url, $item_xpath ) { 354 $nodes = array(); 355 $data = wp_remote_get( $url ); 356 $body = new DOMDocument(); 357 @$body->loadXML( $data['body'] ); 358 $xpath = new DOMXPath( $body ); 359 $query = $item_xpath . '[1]/*'; 360 $items = $xpath->query( $item_xpath . '[1]/*' ); 361 foreach( $items as $item ) { 362 if( !in_array( $item->nodeName, $nodes ) ) { 363 $nodes['.//' . $item->nodeName] = './/' .$item->nodeName; 364 } 365 } 366 return $nodes; 367 } 368 287 369 /* Function that shows the edit feed page. */ 288 370 function AP_editFeed() { … … 305 387 if( isset( $_GET['post'] ) ) { 306 388 $postinfo = get_post( $_GET['post'] ); 307 $this->AP_setMessage( sprintf( __( 'The draft for %s was created succes fully.', 'LDB_AP' ), $postinfo->post_title ), 'success' );389 $this->AP_setMessage( sprintf( __( 'The draft for %s was created successfully.', 'LDB_AP' ), $postinfo->post_title ), 'success' ); 308 390 } else if( isset( $_GET['linkto'] ) ) { 309 391 $postinfo = get_post( $_GET['linkto'] ); -
affiliate-press/trunk/readme.txt
r529401 r530018 2 2 Contributors: ldebrouwer 3 3 Donate link: http://luc.me/40 4 Tags: affiliate, affiliates, product, products, product feed, product feeds 4 Tags: affiliate, affiliates, product, products, product feed, product feeds, feed, feeds 5 5 Requires at least: 3.3 6 6 Tested up to: 3.4 7 Stable tag: 0.3. 27 Stable tag: 0.3.3 8 8 9 9 Affiliate Press allows you to set up an affiliate website based on product feeds as easy as 1-2-3. … … 13 13 Affiliate Press is a plugin that allows you to create products ( as a custom post type ) based on product feeds. It also collects other data for these products, such as prices and affiliate links, which are shown on the product pages in the front end, effectively allowing you to set up your own affiliate website as easy as 1-2-3. 14 14 15 Affiliate Press was specifically developed to be compatible with multiple affiliate programs and networks, aiming to support a broader range of feeds and therefor more competitive prices for your visitor. 16 17 Currently I'm looking for people who are willing to send me examples of their product feeds so I can improve this plugin further. Please send your XML product feeds as attachment to [[email protected]](mailto:[email protected]). 18 15 19 Follow Luc De Brouwer on [Facebook](https://www.facebook.com/lucdebrouwernl) & [Twitter](http://twitter.com/ldebrouwer). 16 20 … … 18 22 19 23 1. Upload the `affiliate-press` folder to the `/wp-content/plugins/` directory 20 1. Activate the Affiliate Press plugin through the `Plugins`menu in WordPress24 1. Activate the Affiliate Press plugin through the 'Plugins' menu in WordPress 21 25 1. Configure the plugin by going to the `Affiliate Press` menu that appears in your admin menu 22 26 … … 52 56 53 57 == Changelog == 58 59 = 0.3.3 = 60 * Added the 'Add New Feed Wizard'. It's still rudimentary and feedback would be highly appreciated. Should work like a charm with Daisycon feeds. 54 61 55 62 = 0.3.2 =
Note: See TracChangeset
for help on using the changeset viewer.