Changeset 2624502
- Timestamp:
- 11/04/2021 12:26:11 PM (4 years ago)
- Location:
- sakura-network/tags
- Files:
-
- 2 edited
- 3 copied
-
1.0.8/readme.txt (modified) (2 diffs)
-
1.0.8/sakura.php (modified) (18 diffs)
-
1.0.9 (copied) (copied from sakura-network/trunk)
-
1.0.9/readme.txt (copied) (copied from sakura-network/trunk/readme.txt)
-
1.0.9/sakura.php (copied) (copied from sakura-network/trunk/sakura.php)
Legend:
- Unmodified
- Added
- Removed
-
sakura-network/tags/1.0.8/readme.txt
r2624498 r2624502 5 5 Tested up to: 5.6 6 6 Requires PHP: 7.0 7 Stable tag: 1.0. 87 Stable tag: 1.0.9 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 50 50 51 51 == Changelog == 52 53 = 1.0.8 - 2021-09-15 = 54 55 **Sakura network** 56 57 * new feature: choose network in dropdown. 52 58 53 59 = 1.0.8 - 2021-09-15 = -
sakura-network/tags/1.0.8/sakura.php
r2624498 r2624502 4 4 * Plugin URI: https://www.sakura.eco 5 5 * Description: An eCommerce toolkit that helps you show articles in a Sakura network. 6 * Version: 1.0. 86 * Version: 1.0.9 7 7 * Author: Sakura.eco 8 8 * Author URI: https://www.sakura.eco/ … … 51 51 * @var string 52 52 */ 53 public $version = '1.0. 8';53 public $version = '1.0.9'; 54 54 55 55 /** … … 406 406 public function render_widget_in_cart() { 407 407 $sakura_network_options = get_option('sakura_network_option'); // Array of All Options 408 if (!isset ($sakura_network_options['sakura_include_in_cart']) ||409 !$sakura_network_options['sakura_include_in_cart']) {408 $network_id = isset ($sakura_network_options['sakura_include_in_cart_network']) ? $sakura_network_options['sakura_include_in_cart_network'] : ''; 409 if ($network_id == '') 410 410 return; 411 } 412 $this->render_widget_in_place(); 411 $this->render_widget_in_place($network_id); 413 412 } 414 413 /** … … 417 416 public function render_widget_in_receipt_page() { 418 417 $sakura_network_options = get_option('sakura_network_option'); // Array of All Options 419 if (!isset ($sakura_network_options['sakura_include_in_receipt']) ||420 !$sakura_network_options['sakura_include_in_receipt']) {418 $network_id = isset ($sakura_network_options['sakura_include_in_receipt_network']) ? $sakura_network_options['sakura_include_in_receipt_network'] : ''; 419 if ($network_id == '') 421 420 return; 422 } 423 $this->render_widget_in_place(); 421 $this->render_widget_in_place($network_id); 424 422 } 425 423 /** … … 428 426 public function render_widget_in_thank_you() { 429 427 $sakura_network_options = get_option('sakura_network_option'); // Array of All Options 430 if (!isset ($sakura_network_options['sakura_include_in_thank_you']) ||431 !$sakura_network_options['sakura_include_in_thank_you']) {428 $network_id = isset ($sakura_network_options['sakura_include_in_thank_you_network']) ? $sakura_network_options['sakura_include_in_thank_you_network'] : ''; 429 if ($network_id == '') 432 430 return; 433 } 434 $this->render_widget_in_place(); 431 $this->render_widget_in_place($network_id); 435 432 } 436 433 /** 437 434 * render widget in place 438 435 */ 439 public function render_widget_in_place( ) {436 public function render_widget_in_place($network_id) { 440 437 do_action('sakura_record_activity', 'render_widget_in_place'); 441 438 $sakura_network_options = get_option( 'sakura_network_option' ); // Array of All Options … … 443 440 444 441 $sakura_server = apply_filters('sakura_update_server_address', 'https://www.sakura.eco'); 445 $url = $sakura_server . '/widget/' . $sakura_widget_key ;442 $url = $sakura_server . '/widget/' . $sakura_widget_key . '/' . $network_id; 446 443 447 444 $query_args = array(); … … 957 954 class SakuraNetwork { 958 955 private $sakura_network_options; 956 private $networks; 959 957 public function __construct() { 960 958 add_action( 'admin_menu', array( $this, 'sakura_network_add_plugin_page' ) ); … … 973 971 } 974 972 public function sakura_network_create_admin_page() { 975 $this->sakura_network_options = get_option( 'sakura_network_option' ); ?> 976 973 $this->sakura_network_options = get_option( 'sakura_network_option' ); 974 $this->networks = SC()->networks(); 975 976 ?> 977 977 978 <div class="wrap"> 978 979 <h2>Sakura Network</h2> … … 1011 1012 ); 1012 1013 1013 add_settings_field(1014 'sakura_secret_key', // id1015 'Sakura Secret Key', // title1016 array( $this, 'sakura_secret_key_callback' ), // callback1017 'sakura-network-admin', // page1018 'sakura_network_setting_section' // section1019 );1020 1014 add_settings_field( 1015 'sakura_secret_key', // id 1016 'Sakura Secret Key', // title 1017 array( $this, 'sakura_secret_key_callback' ), // callback 1018 'sakura-network-admin', // page 1019 'sakura_network_setting_section' // section 1020 ); 1021 1021 1022 add_settings_field( 1022 1023 'sakura_email_receipt_network', // id … … 1028 1029 1029 1030 add_settings_field( 1030 'sakura_include_in_cart ', // id1031 'sakura_include_in_cart_network', // id 1031 1032 'Include widget in cart page', // title 1032 1033 array( $this, 'sakura_include_in_cart_callback' ), // callback … … 1036 1037 1037 1038 add_settings_field( 1038 'sakura_include_in_receipt ', // id1039 'sakura_include_in_receipt_network', // id 1039 1040 'Include widget in receipt page', // title 1040 1041 array( $this, 'sakura_include_in_receipt_callback' ), // callback … … 1044 1045 1045 1046 add_settings_field( 1046 'sakura_include_in_thank_you ', // id1047 'sakura_include_in_thank_you_network', // id 1047 1048 'Include widget in thank you page', // title 1048 1049 array( $this, 'sakura_include_in_thank_you_callback' ), // callback … … 1057 1058 } 1058 1059 1059 if ( isset( $input['sakura_secret_key'] ) ) {1060 if ( isset( $input['sakura_secret_key'] ) ) { 1060 1061 $sanitary_values['sakura_secret_key'] = sanitize_text_field( $input['sakura_secret_key'] ); 1061 }1062 } 1062 1063 1063 1064 if ( isset( $input['sakura_email_receipt_network'] ) ) { … … 1065 1066 } 1066 1067 1068 1069 if ( isset( $input['sakura_include_in_cart_network'] ) ) { 1070 $sanitary_values['sakura_include_in_cart_network'] = sanitize_text_field( $input['sakura_include_in_cart_network'] ); 1071 } 1072 1073 if ( isset( $input['sakura_include_in_receipt_network'] ) ) { 1074 $sanitary_values['sakura_include_in_receipt_network'] = sanitize_text_field( $input['sakura_include_in_receipt_network'] ); 1075 } 1076 1077 if ( isset( $input['sakura_include_in_thank_you_network'] ) ) { 1078 $sanitary_values['sakura_include_in_thank_you_network'] = sanitize_text_field( $input['sakura_include_in_thank_you_network'] ); 1079 } 1080 1067 1081 if ( isset( $input['sakura_include_in_cart'] ) ) { 1068 1082 $sanitary_values['sakura_include_in_cart'] = sanitize_text_field( $input['sakura_include_in_cart'] ); … … 1095 1109 ); 1096 1110 } 1097 1098 public function sakura_email_receipt_callback() { 1099 $networks = SC()->networks(); 1100 $network = (isset( $this->sakura_network_options['sakura_email_receipt_network'] ))? 1101 $this->sakura_network_options['sakura_email_receipt_network']: 1111 public function email_dropdown( $field ) { 1112 $networks = $this->networks; 1113 $network = (isset( $this->sakura_network_options[$field] ))? 1114 $this->sakura_network_options[$field]: 1102 1115 ''; 1103 1116 $field_name = "sakura_network_option[" . $field . "]"; 1104 1117 if ($networks->{'status'} != 'success') { 1105 1118 echo '<h3>'; … … 1109 1122 ?> 1110 1123 <p> 1111 <select id= "sakura_email_receipt_network" name="sakura_network_option[sakura_email_receipt_network]"class='widefat' type="text">1124 <select id='<?php echo $field ?>' name='<?php echo $field_name ?>' class='widefat' type="text"> 1112 1125 <option value=''> 1113 1126 Don't include … … 1131 1144 } 1132 1145 } 1146 public function sakura_email_receipt_callback() { 1147 $this->email_dropdown('sakura_email_receipt_network'); 1148 } 1133 1149 public function sakura_include_in_cart_callback() { 1134 $sakura_include_in_cart = false; 1135 if (isset( $this->sakura_network_options['sakura_include_in_cart'] )) { 1136 $sakura_include_in_cart = $this->sakura_network_options['sakura_include_in_cart']; 1137 } 1138 $html = '<input type="checkbox" id="sakura_include_in_cart" name="sakura_network_option[sakura_include_in_cart]" value="1"' 1139 . checked( 1, $sakura_include_in_cart, false ) . '/>'; 1140 $html .= '<label for="sakura_include_in_cart_key">Include widget in cart page</label>'; 1141 1142 printf($html); 1150 $this->email_dropdown('sakura_include_in_cart_network'); 1143 1151 } 1144 1152 public function sakura_include_in_receipt_callback() { 1145 $sakura_include_in_receipt = false; 1146 if (isset( $this->sakura_network_options['sakura_include_in_receipt'] )) { 1147 $sakura_include_in_receipt = $this->sakura_network_options['sakura_include_in_receipt']; 1148 } 1149 $html = '<input type="checkbox" id="sakura_include_in_receipt" name="sakura_network_option[sakura_include_in_receipt]" value="1"' 1150 . checked( 1, $sakura_include_in_receipt, false ) . '/>'; 1151 $html .= '<label for="sakura_include_in_receipt_key">Include widget in receipt page</label>'; 1152 1153 printf($html); 1153 $this->email_dropdown('sakura_include_in_receipt_network'); 1154 1154 } 1155 1155 public function sakura_include_in_thank_you_callback() { 1156 $sakura_include_in_thank_you = false; 1157 if (isset( $this->sakura_network_options['sakura_include_in_thank_you'] )) { 1158 $sakura_include_in_thank_you = $this->sakura_network_options['sakura_include_in_thank_you']; 1159 } 1160 $html = '<input type="checkbox" id="sakura_include_in_thank_you" name="sakura_network_option[sakura_include_in_thank_you]" value="1"' 1161 . checked( 1, $sakura_include_in_thank_you, false ) . '/>'; 1162 $html .= '<label for="sakura_include_in_thank_you_key">Include widget in thank you page</label>'; 1163 1164 printf($html); 1156 $this->email_dropdown('sakura_include_in_thank_you_network'); 1165 1157 } 1166 1158 } … … 1269 1261 if ( is_admin() ) 1270 1262 $bulk_export = new BulkExport(); 1271
Note: See TracChangeset
for help on using the changeset viewer.