Changeset 732491
- Timestamp:
- 06/26/2013 11:41:07 PM (13 years ago)
- Location:
- pagely-reseller-management/trunk
- Files:
-
- 1 added
- 5 edited
-
inc/helpers.php (modified) (2 diffs)
-
inc/options_page.php (added)
-
partner-api.php (modified) (69 diffs)
-
readme.txt (modified) (2 diffs)
-
views/complete.php (modified) (1 diff)
-
views/order_step1.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pagely-reseller-management/trunk/inc/helpers.php
r702419 r732491 34 34 if ( !is_ssl() && !$pagely->_is_sandbox() ) { 35 35 36 echo "<script type='text/javascript'>window.location = '$location'</script>";37 die();36 // echo "<script type='text/javascript'>window.location = '$location'</script>"; 37 // die(); 38 38 } 39 39 … … 56 56 } 57 57 58 function get_products() { 59 60 $pagely = PagelyApi::init(); 61 return $pagely->_get_products(); 62 } 58 63 // enable sessions 59 64 function pp_session_enable(){ -
pagely-reseller-management/trunk/partner-api.php
r728580 r732491 4 4 Plugin URI: https://docs-api.pagely.com/reseller-plugin/ 5 5 Description: For Pagely Resellers 6 Version: 3.1. 46 Version: 3.1.5 7 7 Author: joshua.strebel 8 8 Author URI: https://page.ly … … 70 70 } 71 71 72 // require some helper functions72 // require some helper public functions 73 73 require_once(PP_PLUGIN_ASSETS_PATH."/inc/helpers.php"); 74 74 … … 81 81 var $pagely_api_sec = ''; 82 82 var $bypass_pagely_varnish = true; // if running on page.ly, need to bypass varnish 83 84 83 var $live_endpoint = 'https://api.pagely.com/v1'; 85 var $sandbox_endpoint = 'https://sandbox-api.pagely.com/v1'; 86 // var $sandbox_endpoint = 'http://api.hcs/v1'; 87 88 84 // var $sandbox_endpoint = 'https://sandbox-api.pagely.com/v1'; 85 var $sandbox_endpoint = 'http://api.hcs/v1'; 89 86 var $api_endpoint = ''; 90 91 var $pp_portal_url = 'https://atomic.pagely.com/'; 87 static $pp_portal_url = 'https://atomic.pagely.com/'; 92 88 var $locale = ''; 89 var $page_slug; 90 var $options_page = ''; 93 91 94 var $page_slug; 95 96 function &init() { 97 static $instance = false; 98 if ( !$instance ) { 99 $instance = new PagelyApi; 100 } 101 return $instance; 102 103 } 104 105 // main init to run on admin screens 106 function pagelyApi() { 107 // GLOBALS 92 public function __construct() { 93 // GLOBALS 108 94 global $wp_rewrite,$wp_version; 109 110 111 95 // get the post slug and create session 112 96 113 add_action('init',array(&$this, '_test_session') ,20); 97 98 add_action('init',array($this, '_test_session') ,20); 114 99 115 100 … … 129 114 } 130 115 116 131 117 132 118 // IF ROLE ADMIN 133 119 if ( current_user_can('administrator') ) { 134 120 // only add the options page if role is admin 135 add_action( 'admin_menu', array(&$this, '_create_menu') ,20); 121 122 add_action( 'admin_menu', array('PagelyAPIOptions', '_create_menu') ,20); 136 123 137 124 } 138 125 139 126 // after wp has fully loaded, enqueue scripts on only the correct page(s) 140 add_action( 'wp',array( &$this, '_load_scripts_head'),1);127 add_action( 'wp',array($this, '_load_scripts_head'),1); 141 128 142 129 … … 149 136 150 137 // these are ajax handlers 151 add_action( 'wp_ajax_pagely_jax_formvalidate_callback', array( &$this,'_pagely_jax_formvalidate_callback') );152 add_action( 'wp_ajax_nopriv_pagely_jax_formvalidate_callback', array( &$this,'_pagely_jax_formvalidate_callback') );153 154 add_action( 'wp_ajax_pagely_jax_accformsubmit_callback', array( &$this,'_pagely_jax_accformsubmit_callback') );155 add_action( 'wp_ajax_nopriv_pagely_jax_accformsubmit_callback', array( &$this,'_pagely_jax_accformsubmit_callback') );156 157 add_action( 'wp_ajax_pagely_jax_payformsubmit_callback', array( &$this,'_pagely_jax_payformsubmit_callback') );158 add_action( 'wp_ajax_nopriv_pagely_jax_payformsubmit_callback', array( &$this,'_pagely_jax_payformsubmit_callback') );159 160 add_action( 'wp_ajax_pagely_jax_addtocart_callback', array( &$this,'_pagely_jax_addtocart_callback') );161 add_action( 'wp_ajax_nopriv_pagely_jax_addtocart_callback', array( &$this,'_pagely_jax_addtocart_callback') );162 163 add_action( 'wp_ajax_pagely_jax_removefromcart_callback', array( &$this,'_pagely_jax_removefromcart_callback') );164 add_action( 'wp_ajax_nopriv_pagely_jax_removefromcart_callback', array( &$this,'_pagely_jax_removefromcart_callback') );165 166 add_action( 'wp_ajax_pagely_jax_purchase_cart_callback', array( &$this,'_pagely_jax_purchase_cart_callback') );167 add_action( 'wp_ajax_nopriv_pagely_jax_purchase_cart_callback', array( &$this,'_pagely_jax_purchase_cart_callback') );168 169 add_action( 'wp_ajax_pagely_jax_generic_callback', array( &$this,'_pagely_jax_generic_callback') );170 add_action( 'wp_ajax_nopriv_pagely_jax_generic_callback', array( &$this,'_pagely_jax_generic_callback') );171 172 add_action( 'wp_ajax_pagely_jax_gopaypal_callback', array( &$this,'_pagely_jax_gopaypal_callback') );173 add_action( 'wp_ajax_nopriv_pagely_jax_gopaypal_callback', array( &$this,'_pagely_jax_gopaypal_callback') );138 add_action( 'wp_ajax_pagely_jax_formvalidate_callback', array($this,'_pagely_jax_formvalidate_callback') ); 139 add_action( 'wp_ajax_nopriv_pagely_jax_formvalidate_callback', array($this,'_pagely_jax_formvalidate_callback') ); 140 141 add_action( 'wp_ajax_pagely_jax_accformsubmit_callback', array($this,'_pagely_jax_accformsubmit_callback') ); 142 add_action( 'wp_ajax_nopriv_pagely_jax_accformsubmit_callback', array($this,'_pagely_jax_accformsubmit_callback') ); 143 144 add_action( 'wp_ajax_pagely_jax_payformsubmit_callback', array($this,'_pagely_jax_payformsubmit_callback') ); 145 add_action( 'wp_ajax_nopriv_pagely_jax_payformsubmit_callback', array($this,'_pagely_jax_payformsubmit_callback') ); 146 147 add_action( 'wp_ajax_pagely_jax_addtocart_callback', array($this,'_pagely_jax_addtocart_callback') ); 148 add_action( 'wp_ajax_nopriv_pagely_jax_addtocart_callback', array($this,'_pagely_jax_addtocart_callback') ); 149 150 add_action( 'wp_ajax_pagely_jax_removefromcart_callback', array($this,'_pagely_jax_removefromcart_callback') ); 151 add_action( 'wp_ajax_nopriv_pagely_jax_removefromcart_callback', array($this,'_pagely_jax_removefromcart_callback') ); 152 153 add_action( 'wp_ajax_pagely_jax_purchase_cart_callback', array($this,'_pagely_jax_purchase_cart_callback') ); 154 add_action( 'wp_ajax_nopriv_pagely_jax_purchase_cart_callback', array($this,'_pagely_jax_purchase_cart_callback') ); 155 156 add_action( 'wp_ajax_pagely_jax_generic_callback', array($this,'_pagely_jax_generic_callback') ); 157 add_action( 'wp_ajax_nopriv_pagely_jax_generic_callback', array($this,'_pagely_jax_generic_callback') ); 158 159 add_action( 'wp_ajax_pagely_jax_gopaypal_callback', array($this,'_pagely_jax_gopaypal_callback') ); 160 add_action( 'wp_ajax_nopriv_pagely_jax_gopaypal_callback', array($this,'_pagely_jax_gopaypal_callback') ); 174 161 175 162 176 163 return; 177 164 178 } 179 180 function _test_session() { 165 } 166 167 168 169 public function &init() { 170 static $instance = false; 171 if ( !$instance ) { 172 $instance = new PagelyApi; 173 174 } 175 return $instance; 176 177 } 178 179 public function _test_session() { 181 180 $slug = get_option('pp-signup-slug'); 182 181 if ( preg_match('/'.$slug .'/i',$_SERVER['REQUEST_URI'],$matches) || preg_match('/admin-ajax.php/i',$_SERVER['REQUEST_URI'],$matches) ) { … … 186 185 187 186 } 188 function _load_scripts_head() {187 public function _load_scripts_head() { 189 188 global $post; 190 189 … … 222 221 223 222 // Is sandbox mode active? 224 function _is_sandbox() {223 public function _is_sandbox() { 225 224 $api_options = get_option('pp_api'); 226 225 $sandbox = $api_options['pp_mode']; … … 232 231 // return the API key from database 233 232 // api key is saved in the options table. You need 2 keys. 234 function _api_key() {233 public function _api_key() { 235 234 $api_options = get_option('pp_api'); 236 235 return $api_key = $api_options['api_key']; … … 238 237 239 238 //are signups on? 240 function _signups_on() {239 public function _signups_on() { 241 240 $api_options = get_option('pp_api'); 242 241 $allow_signups = $api_options['signups_active']; … … 249 248 250 249 //are signups on? 251 function _get_trial_length() {250 public function _get_trial_length() { 252 251 $api_options = get_option('pp_api'); 253 252 $free_trial_days = $api_options['free_trial_days']; … … 260 259 261 260 // This is the header so Page.ly varnish will not cache pages. 262 function _set_response_header() {261 public function _set_response_header() { 263 262 if ($this->bypass_pagely_varnish) { 264 263 header("X-No-Cache: true"); … … 267 266 268 267 // get custom css 269 function _custom_css() {268 public function _custom_css() { 270 269 $api_options = get_option('pp_api'); 271 270 return $api_options['custom_css']; … … 273 272 274 273 /*********************** 275 * PAGE.LY API SESSION MANAGEMENT FUNCTIONS274 * PAGE.LY API SESSION MANAGEMENT public functionS 276 275 ***********************/ 277 276 278 277 // get some value from the session 279 function _get_pp_session($key = false) {278 public function _get_pp_session($key = false) { 280 279 if ( $key && isset($_SESSION['pp_order'][$key]) ) { 281 280 return $_SESSION['pp_order'][$key]; … … 290 289 291 290 // set some value in the session 292 function _set_pp_session( $array ) {291 public function _set_pp_session( $array ) { 293 292 294 293 foreach ($array as $k => $v) { … … 298 297 299 298 // clear the session 300 function _clear_pp_session () {299 public function _clear_pp_session () { 301 300 // Unset all of the session variables. 302 301 $_SESSION = array(); … … 310 309 /* ASSETS */ 311 310 // script js in footer of admin pages 312 function _footer_scripts() { ?>311 public function _footer_scripts() { ?> 313 312 <!--<script type='text/javascript'> 314 jQuery(document).ready( function($) {313 jQuery(document).ready(public function($) { 315 314 }); 316 315 </script> … … 322 321 323 322 // render admin head styles 324 function _head_styles() {323 public function _head_styles() { 325 324 global $wp_version; 326 325 // no styles to load at this time 327 326 } 328 327 329 /************ 330 * THE PAGE.LY API OPTIONS PAGE 331 *************/ 332 function _create_menu() { 333 //create new top-level menu 334 $pagely_options = get_option('pp_api'); 335 336 if (isset($pagely_options['pp_menu_placement']) && 'sub' == $pagely_options['pp_menu_placement'] ) { 337 add_options_page( 'Pagely Partner API', 'Pagely API', 'administrator', __FILE__, array(&$this, '_settings_page')); 338 } else { 339 add_menu_page('Pagely Partner API', 'Pagely API', 'administrator', __FILE__, array(&$this, '_settings_page'),'',99); 340 } 341 342 343 add_action( 'admin_init', array(&$this, '_register_PagelyApi_settings') ); 344 } 345 346 // api options page settings and sections 347 function _register_PagelyApi_settings() { 348 349 // TODO check the validity of the API key(s) 350 $api_check = $this->_test_api(); 351 352 353 // we store the options in an array called pp_api 354 $pagely_options = get_option('pp_api'); 355 if ( !isset($pagely_options['reseller_id']) ) { 356 // get reseller id 357 $reseller = $this->_pagely_api_request($method = 'GET','/resellers/single', $params = array()); 358 $reseller = json_decode($reseller); 359 $pagely_options['reseller_id'] = $reseller->id; 360 $pagely_options['support_url'] = $reseller->support_link; 361 update_option('pp_api',$pagely_options); 362 $pagely_options = get_option('pp_api'); 363 364 } 365 366 register_setting( 'pp_api', 'pp_api', array(&$this, '_sanitize_options')); 367 368 // settings sections 369 add_settings_section( 370 'pp_api', // ID used to identify this section and with which to register options 371 'Partner API Settings', // Title to be displayed on the administration page 372 array(&$this, '_pagely_options_section_callback'), // Callback used to render the description of the section 373 'partner-api' // Page on which to add this section of options 374 ); 375 376 // settings fields 377 add_settings_field( 378 'pp_mode', // ID used to identify the field throughout the theme 379 'API Mode', // The label to the left of the option interface element 380 array(&$this, '_pagely_options_field_mode'), // The name of the function responsible for rendering the option interface 381 'partner-api', // The page on which this option will be displayed 382 'pp_api', // The name of the section to which this field belongs 383 array( $pagely_options['pp_mode'], 'pp_mode' ) // The array of arguments to pass to the 384 ); 385 386 // settings fields 387 add_settings_field( 388 'pp_menu_placement', // ID used to identify the field throughout the theme 389 'WP Menu Placement', // The label to the left of the option interface element 390 array(&$this, '_pagely_options_field_menu'), // The name of the function responsible for rendering the option interface 391 'partner-api', // The page on which this option will be displayed 392 'pp_api', // The name of the section to which this field belongs 393 array( $pagely_options['pp_menu_placement'], 'pp_menu_placement' ) // The array of arguments to pass to the 394 ); 395 // settings fields 396 add_settings_field( 397 'api_key', 398 'Your API key', 399 array(&$this, '_pagely_options_field_apikey'), 400 'partner-api', 401 'pp_api', 402 array( $pagely_options['api_key'], 'api_key' ) 403 ); 404 405 if ($api_check) { // show these settings if the apu check passed 406 407 // the support url settings field 408 if (!isset($pagely_options['signups_active'])) { $pagely_options['signups_active'] = 1; } 409 add_settings_field( 410 'signups_active', 411 'Allow new Signups', 412 array(&$this, '_pagely_options_field_active'), 413 'partner-api', 414 'pp_api', 415 array( $pagely_options['signups_active'], 'signups_active' ) 416 ); 417 418 // the support url settings field 419 if (!isset($pagely_options['support_url'])) { $pagely_options['support_url'] = 'https://support.pagely.com'; } 420 add_settings_field( 421 'support_url', 422 'Support Site', 423 array(&$this, '_pagely_options_field_support_url'), 424 'partner-api', 425 'pp_api', 426 array( $pagely_options['support_url'], 'support_url' ) 427 ); 428 429 430 // free_trial length 431 if ($pagely_options['reseller_id'] == 1) { 432 if (!isset($pagely_options['free_trial_days'])) { $pagely_options['free_trial_days'] = 0; } 433 add_settings_field( 434 'free_trial_days', 435 'Length of Free Trial (Days)', 436 array(&$this, '_pagely_options_field_free_trial'), 437 'partner-api', 438 'pp_api', 439 array( $pagely_options['free_trial_days'], 'free_trial_days' ) 440 ); 441 } 442 443 // order_by 444 if (!isset($pagely_options['order_by'])) { $pagely_options['order_by'] = array(); } 445 add_settings_field( 446 'order_by', 447 'Order Plans by', 448 array(&$this, '_pagely_options_field_order_by'), 449 'partner-api', 450 'pp_api', 451 array( $pagely_options['order_by'], 'order_by' ) 452 ); 453 454 // the plans to show settings field 455 if (!isset($pagely_options['plans_to_show'])) { $pagely_options['plans_to_show'] = array(); } 456 add_settings_field( 457 'plans_to_show', 458 'Choose up to 3 plans for customers to purchase', 459 array(&$this, '_pagely_options_field_plans_to_show'), 460 'partner-api', 461 'pp_api', 462 array( $pagely_options['plans_to_show'], 'plans_to_show' ) 463 ); 464 465 // the products to show settings field 466 if (!isset($pagely_options['products_to_show'])) { $pagely_options['products_to_show'] = array(); } 467 468 add_settings_field( 469 'products_to_show', 470 'Choose which products to show', 471 array(&$this, '_pagely_options_field_products_to_show'), 472 'partner-api', 473 'pp_api', 474 array( $pagely_options['products_to_show'], 'products_to_show' ) 475 ); 476 477 // custom css 478 if (!isset($pagely_options['custom_css'])) { $pagely_options['custom_css'] = ""; } 479 480 add_settings_field( 481 'custom_css', 482 'Your Custom CSS (optional)', 483 array(&$this, '_pagely_options_field_custom_css'), 484 'partner-api', 485 'pp_api', 486 array( $pagely_options['custom_css'], 'custom_css' ) 487 ); 488 489 490 } 491 } 492 493 494 // WP Menu Placement 495 function _pagely_options_field_menu($args) { 496 497 $args[0] == 'main' ? $checked1 = "selected='selected'" : $checked1 = ''; 498 $args[0] == 'sub' ? $checked2 = "selected='selected'" : $checked2 = ''; 499 500 echo "<select id='{$args[1]}' name='pp_api[{$args[1]}]'> 501 <option value='main' {$checked1}>Top Level</option> 502 <option value='sub' {$checked2}>Settings Sub-menu item</option> 503 </select><span class='inline-help'>Access this page via a Top level menu item, or move under the Settings Menu.</span>"; 504 } 505 506 // Order by key field 507 function _pagely_options_field_order_by($args) { 508 509 $args[0] == 0 ? $checked1 = "selected='selected'" : $checked1 = ''; 510 $args[0] == 1 ? $checked2 = "selected='selected'" : $checked2 = ''; 511 512 echo "<select id='{$args[1]}' name='pp_api[{$args[1]}]'> 513 <option value='0' {$checked1}>Price: Low-to-High</option> 514 <option value='1' {$checked2}>Price: High-to-Low</option> 515 </select>"; 516 } 517 518 // free trial days_dropdown 519 function _pagely_options_field_free_trial($args) { 520 521 $args[0] == 0 ? $checked1 = "selected='selected'" : $checked1 = ''; 522 $args[0] == 5 ? $checked2 = "selected='selected'" : $checked2 = ''; 523 $args[0] == 10 ? $checked3 = "selected='selected'" : $checked3 = ''; 524 $args[0] == 15 ? $checked4 = "selected='selected'" : $checked4 = ''; 525 $args[0] == 30 ? $checked5 = "selected='selected'" : $checked5 = ''; 526 527 echo "<select id='{$args[1]}' name='pp_api[{$args[1]}]'> 528 <option value='0' {$checked1}>0</option> 529 <option value='5' {$checked2}>5</option> 530 <option value='10' {$checked3}>10</option> 531 <option value='15' {$checked4}>15</option> 532 <option value='30' {$checked5}>30</option> 533 </select>"; 534 } 535 536 // api key field 537 function _pagely_options_field_apikey($args) { 538 echo "<input id='{$args[1]}' name='pp_api[{$args[1]}]' size='40' type='text' value='{$args[0]}' required/> <span class='description'>Key given to you at registration</span>"; 539 } 540 541 // api mode selection live/sandbox 542 function _pagely_options_field_mode($args) { 543 $args[0] == 0 ? $checked1 = "selected='selected'" : $checked1 = ''; 544 $args[0] == 1 ? $checked2 = "selected='selected'" : $checked2 = ''; 545 echo "<select id='{$args[1]}' name='pp_api[{$args[1]}]'><option value='0' {$checked1}>Sandbox</option><option value='1' {$checked2}>Live</option></select> <span class='description'>Sandbox for is for testing, be sure to switch to live when ready. Recently added plans may not be available in Sandbox mode right away.</span>"; 546 547 } 548 549 // support url field 550 function _pagely_options_field_support_url($args) { 551 echo "<input id='{$args[1]}' name='pp_api[{$args[1]}]' size='40' type='text' value='{$args[0]}' required/> <span class='description'>Url of your support desk, or use https://support.pagely.com</span>"; 552 } 553 554 // active field 555 function _pagely_options_field_active($args) { 556 557 $args[0] == 0 ? $checked1 = "selected='selected'" : $checked1 = ''; 558 $args[0] == 1 ? $checked2 = "selected='selected'" : $checked2 = ''; 559 560 echo "<select id='{$args[1]}' name='pp_api[{$args[1]}]'> 561 <option value='0' {$checked1}>No</option> 562 <option value='1' {$checked2}>Yes</option> 563 </select> <span class='description'>Will show a maintenance message on cart pages.</span>"; 564 } 565 566 567 568 // checkboxes for which plans to show. 569 function _pagely_options_field_plans_to_show($args) { 570 // this can be improved 571 $portal = $this->pp_portal_url; 572 // print_r($args[0]); 573 574 $all_plans = $this->_get_reseller_plans($limit = 20,$offset = 0); 575 576 if ( is_array($all_plans->objects) && count($all_plans->objects) > 0 ) { 577 echo "<div id='plans_check'> 578 <table class='wp-list-table widefat' cellspacing='0'> 579 <thead> 580 <tr> 581 <th scope='col' id='cb' class='manage-column column-show column-cb check-column'></th> 582 <th scope='col' id='plan' class='manage-column column-plan'>Plan</th> 583 <th scope='col' id='price' class='manage-column column-price'>Price</th> 584 <th scope='col' id='featured' class='manage-column column-featured'>Featured</th> 585 <th scope='col' id='hidden' class='manage-column column-hidden'>*Hidden</th> 586 </tr> 587 </thead>"; 588 589 foreach ($all_plans->objects as $p) { 590 if ($p->active == "1") { 591 $checked = ''; 592 $checkradio = ''; 593 if (is_array($args[0])) { 594 if ( in_array($p->id,$args[0]) ) { $checked = "checked='checked'";} 595 } 596 597 $visible = $p->visible == 0 ? '<span style="color:#ccc">Yes</span>' : '<span style="color:green;">No</span>'; 598 599 if ( isset($args[0]['plan_default']) && $args[0]['plan_default'] == $p->id) {$checkradio = "checked='checked'";} 600 echo "<tr> 601 <td> 602 <input type='checkbox' class='required' id='{$args[1]}{$p->id}' name='pp_api[{$args[1]}][]' value='{$p->id}' {$checked} /> 603 </td> 604 <td>{$p->name}</td> 605 <td>".$this->_cash($p->price)."</td> 606 <td><input type='radio' name='pp_api[{$args[1]}][plan_default]' value='{$p->id}' {$checkradio}/></td> 607 <td>{$visible}</td> 608 </tr>"; 609 } 610 } 611 612 echo "</table><span class='description'>These are all the hosting plans that are active in our system for your account. You may choose 3 at any one time to list for sale via this plugin. If you wish to modify or create plans, visit the <a href='https://photon.pagely.com'>API Portal</a>.</span> <strong>*Hidden</strong> plans may be purchased by the customer here, but are hidden from within the dashboard. Use case is for plans you only want new customers to see."; 613 } else { 614 615 // no plans 616 echo "<span class='description'>You have not created any plans yet. <a href='https://photon.pagely.com'>Login to the Portal and create some.</a></span>"; 617 618 } 619 620 621 } 622 623 // checkboxes for which products to show. 624 function _pagely_options_field_products_to_show($args) { 625 // this can be improved 626 627 // checkboxes for which plans to show. 628 $portal = $this->pp_portal_url; 629 630 $all_products = $this->_get_reseller_products($limit = 10,$offset = 0); 631 // echo '<pre>'; 632 //print_r($all_products); 633 if ( is_array($all_products->objects) && count($all_products->objects) > 0 ) { 634 echo "<table class='wp-list-table widefat' cellspacing='0'> 635 <thead> 636 <tr> 637 <th scope='col' id='cb' class='manage-column column-show column-cb check-column'></th> 638 <th scope='col' id='plan' class='manage-column column-plan'>Product</th> 639 <th scope='col' id='plan' class='manage-column column-plan'>Price</th> 640 <th scope='col' id='plan' class='manage-column column-plan'>Recurring</th> 641 642 </tr> 643 </thead>"; 644 645 foreach ($all_products->objects as $p) { 646 if ($p->active == "1") { 647 $checked = ''; 648 649 if (is_array($args[0])) { 650 651 if ( in_array($p->id,$args[0]) ) { 652 $checked = "checked='checked'"; 653 } 654 655 } 656 657 ($p->recurring == 1) ? $recurring = "Yes" : $recurring = "No"; 658 659 660 echo "<tr> 661 <td><input type='checkbox' class='required' id='{$args[1]}{$p->id}' name='pp_api[{$args[1]}][]' value='{$p->id}' {$checked} /></td> 662 <td><label for='{$args[1]}{$p->id}'>{$p->name}</label></td> 663 <td> ".$this->_cash($p->price)."</td> 664 <td>{$recurring}</td> 665 </tr>"; 666 } 667 } 668 669 echo "</table><span class='description'>These are all the hosting plans that are active in our system for your account. You may choose 3 at any one time to list for sale via this plugin. If you wish to modify or create plans, visit the <a href='https://photon.pagely.com'>API Portal</a>.</span></div>"; 670 671 } else { 672 // no products 673 echo "<span class='description'>You have not created any products yet. <a href='https://photon.pagely.com'>Login to the Portal and create some.</a></span>"; 674 675 } 676 677 } 678 679 // custom css textarea 680 function _pagely_options_field_custom_css($args) { 681 echo "<textarea id='{$args[1]}' name='pp_api[{$args[1]}]' style='width:70%' rows='10'>{$args[0]}</textarea>"; 682 } 683 684 685 // unused callback 686 function _pagely_options_section_callback() { 687 $this->_clear_cached_keys(); 688 return; 689 } 690 691 692 // sanitize some shiz 693 function _sanitize_options($input) { 694 // Create our array for storing the validated options 695 $output = array(); 696 697 // Loop through each of the incoming options 698 foreach( $input as $key => $value ) { 699 if( isset( $input[$key] ) ) { 700 // Strip all HTML and PHP tags and properly handle quoted strings 701 if (is_array($input[ $key ])) { 702 foreach ($input[ $key ] as $k => $v) { 703 $output[$key][$k] = strip_tags( stripslashes( $v ) ); 704 } 705 } else { 706 $output[$key] = strip_tags( stripslashes( $input[ $key ] ) ); 707 } 708 } 709 } 710 711 // Return the array processing any additional functions filtered by this action 712 return $output; 713 } 714 715 // the actual settings page 716 function _settings_page() { 717 718 wp_enqueue_script( 'pp-options' ); // is this needed still? 719 if ($_POST) { 720 if ($_POST['cache_clear']) { 721 722 $this->_clear_cached_keys(); 723 724 725 $this->_dialog( 'Cache Cleared' ,$type = 'notice'); 726 } else { 727 $this->_dialog( 'Posted' ,$type = 'notice'); 728 } 729 } 730 echo $this->_get_view( PP_PLUGIN_ASSETS_PATH . 'views/options-page.php'); 731 732 733 } 734 735 function _clear_cached_keys() { 736 737 //clear cached plans 738 delete_transient( 'pp_plans' ); 739 update_option( 'pp_plans', '' ); 740 //clear caches products 741 delete_transient( 'pp_products' ); 742 update_option( 'pp_products', '' ); 743 744 } 745 328 329 746 330 /************ 747 331 * RENDERS THE ORDER FORM 748 332 *************/ 749 function _render_pagely_order_form($slug) {333 public function _render_pagely_order_form($slug) { 750 334 751 335 // keep the track of which page the form is on … … 791 375 } 792 376 } 377 378 if (isset($_POST['pagely_order']['product_id'])) { 379 // plan preselected 380 $this->_set_pp_session( array('preselected_plan' => $_POST['pagely_order']['product_id'] ) ); 381 // we'll check this session value on the order form and hide the plan selection. 382 // if we already have a product selected we need to empty the cart and add the new one 383 //TODO chekc cart 384 $product_id = $this->_get_pp_session('product_id'); 385 if (!empty($product_id)) { 386 //get cart 387 $cart = $this->_cart_contents(); 388 389 if (!empty($cart)) { 390 foreach ($cart as $k => $v) { 391 if ( $v['id'] == $product_id) { 392 // remove item 393 $this->_delitem_cart($k); 394 // add the new plan 395 $newplan = $this->_get_product($_POST['pagely_order']['product_id']); 396 // build item 397 $newitem = array( 398 'type' => 'default', 399 'id' => $newplan->id, 400 'name' => $newplan->name, 401 'price' => $newplan->price, 402 'desc' => $newplan->desc, 403 'qty' => 1, 404 'recurring' => 1, 405 ); 406 // add to cart 407 $this->_additem_cart($newitem); 408 } 409 } 410 } 411 412 } 413 } 793 414 $this->_set_pp_session( array('site' => home_url( '/' ).$slug ) ); 794 415 $this->_set_pp_session( array('page' => $slug ) ); 795 416 796 // our _get_view function loads an html snippet417 // our _get_view public function loads an html snippet 797 418 echo $this->_get_view(PP_PLUGIN_ASSETS_PATH . 'views/order-form.php' ); 798 419 } 799 420 800 421 // this is the final page, after products 801 function _render_pagely_complete($slug) {422 public function _render_pagely_complete($slug) { 802 423 if ( session_id() ) { 803 424 $this->_clear_pp_session(); … … 809 430 810 431 /************ 811 * API CART FUNCTIONS432 * API CART public functionS 812 433 *************/ 813 434 … … 815 436 // this is the total on the payment page 816 437 // dont think we use this anywhere 817 function _cart_contents_js() {438 public function _cart_contents_js() { 818 439 819 440 $cart = $this->_cart_contents(); … … 839 460 840 461 // get the count of cart items 841 function _cart_total_items() {462 public function _cart_total_items() { 842 463 $cart = $this->_cart_contents(); 843 464 return count($cart); … … 845 466 846 467 // get the dollar amount total of cart 847 function _cart_total() {468 public function _cart_total() { 848 469 $cart = $this->_get_pp_session('cart'); 849 470 $cart = $this->_calc_cart_total($cart); … … 852 473 853 474 // get the contents (items) of cart 854 function _cart_contents() {475 public function _cart_contents() { 855 476 // we want to return json of the cart items 856 477 $cart = $this->_get_pp_session('cart'); … … 866 487 // add an item to the cart 867 488 // this adds the item to the session 868 function _additem_cart($item = false) {489 public function _additem_cart($item = false) { 869 490 if (! $item ) { 870 491 //look for post … … 905 526 } 906 527 907 // function just returns a money format decimal based on locale settings528 // public function just returns a money format decimal based on locale settings 908 529 // locale is not fully implemented 909 function _cash($amt) {530 public function _cash($amt) { 910 531 // we want to return json of the cart items 911 532 $sym = "$"; … … 915 536 916 537 // remove an item from the cart 917 function _delitem_cart($item_id = false) {538 public function _delitem_cart($item_id = false) { 918 539 if (!$item_id && $_POST['item_id']) { 919 540 $item_id = $_POST['item_id']; … … 936 557 937 558 // calc the cart total 938 function _calc_cart_total($cart = false) {559 public function _calc_cart_total($cart = false) { 939 560 $total = 0; 940 561 foreach ($cart['items'] as $item) { … … 947 568 948 569 // empty the cart 949 function _clear_cart() {570 public function _clear_cart() { 950 571 $this->_set_pp_session( array('cart' => array()) ); 951 572 } … … 955 576 ***************/ 956 577 // dont think we use this 957 function _render_pagely_payment_form() {578 public function _render_pagely_payment_form() { 958 579 959 580 $this->_set_pp_session( array('last_activity' => time() ) ); … … 974 595 * @return[body] returned will be a json response, see our API docs 975 596 */ 976 function _get_reseller_plans($limit = 25,$offset = 0) {597 public function _get_reseller_plans($limit = 25,$offset = 0) { 977 598 978 599 $pagely_options = get_option('pp_api'); … … 1000 621 1001 622 // get a single plan, $plan_id, un cached 1002 function _get_plan($plan_id) {623 public function _get_plan($plan_id) { 1003 624 $plan = $this->_pagely_api_request($method = 'GET','/bill_plans/single', $params = array( 1004 625 'id'=> $plan_id … … 1006 627 ); 1007 628 return json_decode($plan); 629 } 630 631 // get a single product, $plan_id, un cached 632 public function _get_product($product_id) { 633 $product = $this->_pagely_api_request($method = 'GET','/bill_products/single', $params = array( 634 'id'=> $product_id 635 ) 636 ); 637 return json_decode($product); 1008 638 } 1009 639 … … 1017 647 * @return[body] returned will be a json response, see our API docs 1018 648 */ 1019 function _get_reseller_products($limit = 10,$offset = 0) {649 public function _get_reseller_products($limit = 10,$offset = 0) { 1020 650 1021 651 $pagely_options = get_option('pp_api'); … … 1049 679 * @return[body] returned will be a json response, see our API docs 1050 680 */ 1051 function _pagely_jax_formvalidate_callback() {681 public function _pagely_jax_formvalidate_callback() { 1052 682 header( "Content-Type: application/json" ); 1053 683 … … 1093 723 * @return[body] returned will be a json response, see our API docs 1094 724 */ 1095 function _pagely_jax_accformsubmit_callback() {725 public function _pagely_jax_accformsubmit_callback() { 1096 726 // we did the form validation client side, so lets call this input good for now and save it to the session. 1097 727 header( "Content-Type: application/json" ); … … 1128 758 1129 759 // send the previously saved data from the session, to the api 1130 function _send_account_data() {760 public function _send_account_data() { 1131 761 1132 762 $form = $this->_get_pp_session('acc_form_post'); … … 1174 804 $form['domain_type'] = isset($form['domain_type']) ? $form['domain_type'] : 0; 1175 805 $form['domain'] = isset($form['domain']) ? $form['domain'] : ''; 806 $form['is_hosted'] = isset($form['is_hosted']) ? $form['is_hosted'] : 1; 1176 807 1177 808 $this->_set_pp_session( array('account_id' => $result->id) ); … … 1181 812 $this->_set_pp_session( array('promo_code' => $form['promo_code'] ) ); 1182 813 $this->_set_pp_session( array('domain_type' => $form['domain_type'] ) ); 1183 814 $this->_set_pp_session( array('is_hosted' => $form['is_hosted'] ) ); 815 $this->_set_pp_session( array('product_id' => $form['product_id'] ) ); 1184 816 $result->message = "Welcome aboard <em>{$result->object->name}</em>!"; 1185 817 … … 1187 819 // we need to add an item to the cart 1188 820 1189 // get the plan_id 1190 $plan_id = $form['plan']; 1191 // get the plan details 1192 1193 // this call is direct to the api to make sure we have the latest info 1194 $plan = $this->_get_plan($plan_id); 1195 1196 // build item 1197 $item = array( 1198 'type' => 'default', 1199 'id' => $plan->id, 1200 'name' => $plan->name, 1201 'price' => $plan->price, 1202 'desc' => $plan->desc, 1203 'qty' => 1, 1204 'recurring' => 1, 1205 ); 821 // if a hosted plan do... 822 if ($form['is_hosted'] == 1 && isset($form['plan']) ) { 823 // get the plan_id 824 $plan_id = $form['plan']; 825 826 // get the plan details 827 // this call is direct to the api to make sure we have the latest info 828 $plan = $this->_get_plan($plan_id); 829 830 // build item 831 $item = array( 832 'type' => 'default', 833 'id' => $plan->id, 834 'name' => $plan->name, 835 'price' => $plan->price, 836 'desc' => $plan->desc, 837 'qty' => 1, 838 'recurring' => 1, 839 ); 840 841 } else if($form['is_hosted'] == 0 && isset($form['product_id']) ) { 842 // else this is just a product, like CDN or domain reg 843 844 $product_id = $form['product_id']; 845 // get the product details 846 // this call is direct to the api to make sure we have the latest info 847 $product = $this->_get_product($product_id); 848 // build item 849 $item = array( 850 'type' => $product->type, 851 'id' => $product->id, 852 'name' => $product->name, 853 'price' => $product->price, 854 'desc' => $product->desc, 855 'qty' => 1, 856 'recurring' => $product->recurring, 857 ); 858 859 } 1206 860 // add to cart 1207 861 $this->_additem_cart($item); 1208 862 1209 // add registration to the cart if needed for domain 1210 if ( $form['domain_type'] == 1) { 863 /* if ( $form['domain_type'] == 1) { 1211 864 1212 865 $item = array( … … 1222 875 $this->_additem_cart($item); 1223 876 } 877 */ 1224 878 1225 879 } … … 1235 889 * @return[body] returned will be a json response, see our API docs 1236 890 */ 1237 function _pagely_jax_gopaypal_callback() {891 public function _pagely_jax_gopaypal_callback() { 1238 892 header( "Content-Type: application/json" ); 1239 893 … … 1304 958 * @return[body] returned will be a json response, see our API docs 1305 959 */ 1306 function _pagely_jax_payformsubmit_callback() {960 public function _pagely_jax_payformsubmit_callback() { 1307 961 1308 962 header( "Content-Type: application/json" ); … … 1388 1042 if ($this->_get_pp_session('paid') == 1 && !$this->_get_pp_session('domain_queued')) { 1389 1043 $domain_push = $this->_put_domain($params); 1390 $domain_push = json_decode($domain_push);1044 //$domain_push = json_decode($domain_push); 1391 1045 if($domain_push->result != 2) { 1392 1046 // there was an error pushing the domain to the install queue … … 1395 1049 } 1396 1050 } 1397 $this->_clear_cart(); 1051 1052 1053 if ( $this->_get_pp_session('is_hosted') == 1 && !$this->_get_pp_session('product_id')) { 1054 $this->_clear_cart(); 1055 } else { 1056 //we shoudl have a product in the cart we need too add a purchase for 1057 $this->_set_pp_session( array('domain_queued' => 'true') ); 1058 $this->_set_pp_session( array('order_complete' => 'true') ); 1059 $this->purchase_cart(); 1060 1061 } 1398 1062 1399 1063 } else { … … 1414 1078 */ 1415 1079 1416 function _put_domain($oldparams = false) {1080 public function _put_domain($oldparams = false) { 1417 1081 $params = array(); 1418 1082 $this->_set_pp_session( array('last_activity' => time() ) ); … … 1420 1084 1421 1085 // never trust user input, rebuild the post array before sending. 1086 $params['is_hosted'] = $this->_get_pp_session('is_hosted'); 1422 1087 $params['account_id'] = $this->_get_pp_session('account_id'); 1423 1088 $params['domain'] = $this->_get_pp_session('domain'); … … 1463 1128 * @return[body] returned will be a json response, see our API docs 1464 1129 */ 1465 function _process_post_paypal() {1130 public function _process_post_paypal() { 1466 1131 global $post; 1467 1132 pp_session_enable(); … … 1478 1143 } 1479 1144 } 1480 $this->_clear_cart(); 1145 if ( $this->_get_pp_session('is_hosted') == 1 && !$this->_get_pp_session('product_id') ) { 1146 $this->_clear_cart(); 1147 } else { 1148 //purchase the products in the cart 1149 $this->purchase_cart(); 1150 $this->_set_pp_session( array('domain_queued' => 'true') ); 1151 $this->_set_pp_session( array('order_complete' => 'true') ); 1152 wp_redirect( $this->_get_pp_session('site').'?complete=true', 301 ); 1153 1154 } 1481 1155 } else { 1482 1156 $this->_set_pp_session( array('paid' => 0) ); … … 1495 1169 */ 1496 1170 1497 function _pagely_jax_purchase_cart_callback() {1171 public function _pagely_jax_purchase_cart_callback() { 1498 1172 header( "Content-Type: application/json" ); 1499 1173 1500 // get the cart contents 1174 $result = _purchase_cart(); 1175 echo json_encode($result); 1176 die(); 1177 } 1178 1179 public function purchase_cart() { 1180 1181 // get the cart contents 1501 1182 $cart_contents = $this->_cart_contents(); 1502 1183 … … 1544 1225 $result->failures = $failure; 1545 1226 } 1546 1547 echo json_encode($result); 1548 die(); 1549 } 1550 1227 1228 return $result; 1229 } 1551 1230 1552 1231 … … 1554 1233 * AJAX add item to cart 1555 1234 ******************************/ 1556 function _pagely_jax_addtocart_callback() {1235 public function _pagely_jax_addtocart_callback() { 1557 1236 header( "Content-Type: application/json" ); 1558 1237 … … 1619 1298 * AJAX remove item to cart 1620 1299 ******************************/ 1621 function _pagely_jax_removefromcart_callback() {1300 public function _pagely_jax_removefromcart_callback() { 1622 1301 1623 1302 $item_hash = $_POST['item_id']; … … 1635 1314 * @return[body] returned will be a json response, see our API docs 1636 1315 */ 1637 function _pagely_jax_generic_callback() {1316 public function _pagely_jax_generic_callback() { 1638 1317 $posted = $_POST; 1639 1318 switch ($posted['ppdo']) { … … 1655 1334 */ 1656 1335 1657 function _test_api() {1336 public function _test_api() { 1658 1337 1659 1338 $params = array(); … … 1682 1361 1683 1362 /*************************** 1684 * WRAPPER FUNCTIONFOR ALL PAGELY API REQUESTS1685 * This function makes a remote request to the Pagely REST API1363 * WRAPPER public function FOR ALL PAGELY API REQUESTS 1364 * This public function makes a remote request to the Pagely REST API 1686 1365 * @param string $method GET | POST | PUT | DELETE 1687 1366 * @param string $uri the controller and method to call on teh api … … 1690 1369 * @return[body] returned will be a json response, see our API docs 1691 1370 */ 1692 function _pagely_api_request($method = 'GET', $uri = '/controller/method', $params = array() ) {1371 public function _pagely_api_request($method = 'GET', $uri = '/controller/method', $params = array() ) { 1693 1372 1694 1373 // setup the request … … 1762 1441 1763 1442 /************ 1764 * MISC FUNCTIONS1443 * MISC public functionS 1765 1444 *************/ 1766 1445 // send an email to support 1767 1446 // dont think we use this 1768 function _support_email($to,$from,$subject,$msg) {1447 public function _support_email($to,$from,$subject,$msg) { 1769 1448 wp_mail( $to, $subject, $message); 1770 1449 } 1771 1450 1772 1451 // support site 1773 function _supportsite() {1452 public function _supportsite() { 1774 1453 // get option 1775 1454 $key = 'support_url'; … … 1781 1460 1782 1461 // These are the 3 plan id's the user selected on the options page 1783 function _get_plans_to_show() {1462 public function _get_plans_to_show() { 1784 1463 $key = 'plans_to_show'; 1785 1464 $api_options = get_option('pp_api'); … … 1791 1470 1792 1471 // These are the product id's the user selected on the options page 1793 function _get_products_to_show() {1472 public function _get_products_to_show() { 1794 1473 $key = 'products_to_show'; 1795 1474 $api_options = get_option('pp_api'); … … 1801 1480 1802 1481 1803 // This function filters the 3 selected against all plans1482 // This public function filters the 3 selected against all plans 1804 1483 // to return a full plan object for each of the 3 1805 1484 // we do this way for now so we always get an uncached list before saving locally 1806 function _get_plans() {1485 public function _get_plans() { 1807 1486 $plans = $this->_get_reseller_plans(10,0); 1808 1487 $plans_to_show = $this->_get_plans_to_show(); … … 1813 1492 1814 1493 $return_plans = array(); 1815 1494 if (!is_array($plans_to_show)) { 1495 return $return_plans; 1496 } 1816 1497 // check short list against master list 1817 1498 if ($plans->result == 2 && count($plans->objects) > 0 ) { … … 1825 1506 if ($order_by == 0) { 1826 1507 // sort by $p->price, low to high 1827 usort($return_plans['plans'], array( &$this, "_sort_plans_asc"));1508 usort($return_plans['plans'], array($this, "_sort_plans_asc")); 1828 1509 1829 1510 } else if ($order_by == 1) { 1830 1511 // sort by $p->price, high to low 1831 1512 1832 usort($return_plans['plans'], array( &$this, "_sort_plans_desc"));1513 usort($return_plans['plans'], array($this, "_sort_plans_desc")); 1833 1514 1834 1515 } … … 1847 1528 1848 1529 // sort array of objects 1849 function _sort_plans_asc($a, $b) {1530 public function _sort_plans_asc($a, $b) { 1850 1531 $al = $a->price; 1851 1532 $bl = $b->price; … … 1857 1538 1858 1539 // sort array of objects 1859 function _sort_plans_desc($a, $b) {1540 public function _sort_plans_desc($a, $b) { 1860 1541 $al = $a->price; 1861 1542 $bl = $b->price; … … 1866 1547 } 1867 1548 1868 // This function filters the selected products against all products1549 // This public function filters the selected products against all products 1869 1550 // to return a full product object for each 1870 function _get_products() {1551 public function _get_products() { 1871 1552 $products = $this->_get_reseller_products(10,0); 1872 1553 //print_r($products); 1873 1554 $products_to_show = $this->_get_products_to_show(); 1555 1556 $api_options = get_option('pp_api'); 1557 $order_by = $api_options['order_by']; // 0 is price: low to high, 1 is price: high to low 1558 1874 1559 if (!$products_to_show) { 1875 1560 return false; … … 1884 1569 } 1885 1570 } 1571 1572 // sort 1573 if ($order_by == 0) { 1574 // sort by $p->price, low to high 1575 usort($return_products, array($this, "_sort_plans_asc")); 1576 1577 } else if ($order_by == 1) { 1578 // sort by $p->price, high to low 1579 1580 usort($return_products, array($this, "_sort_plans_desc")); 1581 1582 } 1583 1886 1584 // return selected plans 1887 1585 if (count($return_products) > 0) { … … 1895 1593 // some error messages and warning. jquery.dialog // 1896 1594 // pretty sure we dropped jquery ui 1897 function _dialog($msg,$type = 'error') {1595 public function _dialog($msg,$type = 'error') { 1898 1596 switch ($type) { 1899 1597 case 'error': … … 1908 1606 1909 1607 /********** 1910 * loads a view file, should be last function of class1608 * loads a view file, should be last public function of class 1911 1609 **********/ 1912 function _get_view($filename) {1610 public function _get_view($filename) { 1913 1611 if (is_file($filename)) { 1914 1612 ob_start(); … … 1926 1624 // load the plugin 1927 1625 add_action( 'init', array( 'PagelyApi', 'init' ),1); 1928 1626 //$PagelyApi = new PagelyApi; 1929 1627 // no closing php tag 1628 require_once(PP_PLUGIN_ASSETS_PATH."/inc/options_page.php"); 1629 -
pagely-reseller-management/trunk/readme.txt
r728580 r732491 3 3 Tags: admin, administration, plugin, website reseller, hosting, Wordpress, CMS, page.ly,pagely Wordpress Hosting 4 4 Requires at least: 3.4 5 Tested up to: 3.5. 15 Tested up to: 3.5.2 6 6 Stable tag: trunk 7 7 License: GPLv2 or later … … 20 20 Read [the documentation here](https://docs-api.pagely.com/reseller-plugin/). 21 21 == Changelog == 22 = 3.1.5 = 23 new options page class, and options 22 24 = 3.1.4 = 23 25 Added additional client ip header to API calls. Allow for plugin options page to me moved under the Settings Menu. -
pagely-reseller-management/trunk/views/complete.php
r702419 r732491 1 1 <!-- order complete --> 2 2 3 <div id="pp"> 3 4 <div class="hero-unit"> 4 5 <h2>Order Complete. Thank You.</h2> 5 <p>Please allow a few moments for your new s ite to provision and then <strong>check your email</strong> for your welcome information. <strong>Thanks again and Welcome Aboard!</strong></p>6 <p>Please allow a few moments for your new service to provision and then <strong>check your email</strong> for your welcome information. <strong>Thanks again and Welcome Aboard!</strong></p> 6 7 7 8 <?php if( isset($_GET['product_fails']) ) { ?> -
pagely-reseller-management/trunk/views/order_step1.php
r702419 r732491 3 3 </span></div>--> 4 4 <?php 5 6 5 $preselected_plan = $this->_get_pp_session('preselected_plan'); 7 6 $plans = $this->_get_plans(); 7 $products = $this->_get_products(); 8 $api_options = get_option('pp_api'); 8 9 9 10 $form = $this->_get_pp_session('acc_form_post'); … … 16 17 $this_site = str_replace(array('http://','https://'),'',site_url()); 17 18 19 if ( !isset($api_options['products_only']) || $api_options['products_only'] == 0 ) { 20 $product_only = false; 21 } else { 22 $product_only = true; 23 } 18 24 if (!empty($_POST) && $referer_parse['host'] == $this_site && isset($_POST['auto_submit']) ) { 19 25 $posted_from_dff_page = true; … … 46 52 47 53 <div class="well"> 54 <?php if ( !$product_only) { ?> 55 <input type="hidden" name="pagely_order[is_hosted]" value="1"/> 56 48 57 <div class="control-group"> 49 58 <label class="control-label" for="input01">Plan</label> … … 77 86 </div> 78 87 </div> 88 89 <?php } else { // just products ?> 90 <input type="hidden" name="pagely_order[is_hosted]" value="0"/> 91 <div class="control-group"> 92 <label class="control-label" for="input01">Item</label> 93 <div class="controls"> 94 <?php if (!empty($preselected_plan)) { 95 foreach ($products as $p) { 96 if ($p->id == $preselected_plan) {?> 97 <p class="lead" style="margin:0"><?php echo $p->name;?> <button id="planchange"class="btn btn-mini pull-right">Change</button></p> 98 <?php } 99 } 100 } ?> 101 <select id="planselector" name="pagely_order[product_id]" class="required <?php if (!empty($preselected_plan)){?>hide<?php }?>"> 102 <?php foreach ($products as $p) { 103 if ( $p->id == $products['default'] ) { 104 $recommended = $p->id; 105 } 106 107 if (!$preselected_plan) { 108 $selected = $recommended; 109 } else { 110 $selected = $preselected_plan; 111 } 112 113 $featured = false; 114 $price = explode('.',$p->price); 115 if( !$preselected_plan && $recommended == $p->id ) { $featured = 'featured'; } 116 ?> 117 <option value="<?php echo $p->id?>" <?php if( $selected == $p->id) { echo 'selected="selected"'; } ?>><?php echo $p->name?> | $<?php echo $p->price;?></option> 118 <?php } ?> 119 </select> 120 121 </div> 122 </div> 123 124 <?php } ?> 125 79 126 </div><!--well--> 80 127 … … 85 132 <div class="controls"> 86 133 87 <input id="po_domain" name="pagely_order[domain]" type="text" class="span3 required" placeholder="domain.com" value="<?php if (isset($form['domain']) ) { echo $form['domain']; }?>"> < span class="help-inline">Change at anytime. Does not include registration.</span>134 <input id="po_domain" name="pagely_order[domain]" type="text" class="span3 required" placeholder="domain.com" value="<?php if (isset($form['domain']) ) { echo $form['domain']; }?>"> <?php if ($product_only) { ?><span class="help-inline">What domain to use with this item?</span><?php } else { ?><span class="help-inline">Change at anytime. Does not include registration.</span><?php }?> 88 135 <span class="validation_msg"></span> 89 136 </div> … … 212 259 <div class="well cen"> 213 260 <p><button id="pay_by_paypal" class="btn btn-large btn-success">PayPal</button></p> 214 <p class="lead">Pay easily from your PaypalAccount</p>261 <p class="lead">Pay easily with your PayPal<sup>®</sup> Account</p> 215 262 <?php wp_nonce_field('pagely_pay_submit','pagely_order_pay_nounce'); ?> 216 263
Note: See TracChangeset
for help on using the changeset viewer.