Changeset 1791029
- Timestamp:
- 12/22/2017 03:27:54 AM (8 years ago)
- Location:
- customdonations/trunk
- Files:
-
- 4 edited
-
classes/cd-config-class.php (modified) (3 diffs)
-
classes/cd-shortcode-class.php (modified) (1 diff)
-
customdonations.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
customdonations/trunk/classes/cd-config-class.php
r1790427 r1791029 19 19 register_setting('customdonations', 'customdonations_options'); 20 20 add_settings_section('customdonations_section_loggedin', __('Logged-in User Options', 'customdonations'), null, 'customdonations'); 21 //add_settings_section('customdonations_section_loggedin', __('Logged-in User Options', 'customdonations'), [$this, 'customdonations_section_loggedin_callback'], 'customdonations');22 21 add_settings_field('customdonations_memberid_enabled', __('Fill a value for <em>memberId</em> when a logged-in user donates?', 'customdonations'), [$this, 'customdonations_field_memberid_enabled_callback'], 'customdonations', 'customdonations_section_loggedin', ['label_for' => 'customdonations_memberid_enabled', 'class' => 'customdonations_memberid_enabled_row', 'customdonations_custom_data' => 'custom']); 23 22 add_settings_field('customdonations_memberid_field', __('The following field will be used as memberId for logged-in users:', 'customdonations'), [$this, 'customdonations_field_memberid_field_callback'], 'customdonations', 'customdonations_section_loggedin', ['label_for' => 'customdonations_memberid_field', 'class' => 'customdonations_memberid_field_row', 'customdonations_custom_data' => 'custom']); 24 23 add_settings_field('customdonations_firsttime', '', [$this, 'customdonations_field_firsttime_callback'], 'customdonations', 'customdonations_section_loggedin', ['label_for' => 'customdonations_firsttime', 'customdonations_custom_data' => 'custom']); 25 24 add_settings_section('customdonations_section_account', __('Account Information (optional)', 'customdonations'), null, 'customdonations'); 26 //add_settings_section('customdonations_section_account', __('Account Information (optional)', 'customdonations'), [$this, 'customdonations_section_account_callback'], 'customdonations');27 25 add_settings_field('customdonations_acctid', __('Account', 'customdonations'), [$this, 'customdonations_field_account_callback'], 'customdonations', 'customdonations_section_account', ['label_for' => 'customdonations_acctid', 'class' => 'customdonations_account_row', 'customdonations_custom_data' => 'custom']); 28 26 } … … 32 30 */ 33 31 function customdonations_field_memberid_enabled_callback($args) { 34 $value = is_null($this->config['customdonations_firsttime']) ? 'on' : $this->config[$args['label_for']]; //value is true by default - if there is ever a save, then the value provided in that save is the value we will go with. 32 $checked_orig = !isset($this->config[$args['label_for']]) ? false : $this->config[$args['label_for']]; 33 $value = is_null($this->config['customdonations_firsttime']) ? 'on' : $checked_orig; //value is true by default - if there is ever a save, then the value provided in that save is the value we will go with. 35 34 ?> 36 35 <input type=checkbox id="<?php echo esc_attr($args['label_for']); ?>" name="customdonations_options[<?php echo esc_attr($args['label_for']); ?>]" <?php checked($value, 'on') ?>> … … 113 112 function customdonations_configuration_page() { 114 113 $this->config_page = add_menu_page('Shortcode Configuration', 'CustomDonations', 'manage_options', 'customdonations', [$this, 'customdonations_configuration_page_html'], plugins_url('../cd-logo-sq.svg', __FILE__)); 115 add_action('admin_print_scripts-' . $this->config_page, [$this, 'customdonations_config_inline_js'], 9999);116 114 } 117 115 -
customdonations/trunk/classes/cd-shortcode-class.php
r1790427 r1791029 13 13 $opts = get_option('customdonations_options'); //get settings from the database 14 14 $config_acctid = boolval($opts['customdonations_acctid']) ? $opts['customdonations_acctid'] : null; //is there an account id configured in the DB? 15 $this->memberid_enabled = ( $opts['customdonations_memberid_enabled'] === 'on') ? true : false;15 $this->memberid_enabled = (isset($opts['customdonations_memberid_enabled']) && $opts['customdonations_memberid_enabled'] === 'on') ? true : false; 16 16 $this->memberid_field = $opts['customdonations_memberid_field']; //what field should be used for logged-in users? 17 $this->allocation = boolval($allocation) ? esc_attr($allocation) : null; //optional18 $this->form = boolval($form) ? esc_attr($form) : null; //definitely required - not good if missing!19 $this->account = boolval($account) ? $account : $config_acctid; //if value for account is changed in shortcode, use that - otherwise go with the value specified in the config.17 $this->allocation = isset($allocation) ? esc_attr($allocation) : null; //optional 18 $this->form = isset($form) ? esc_attr($form) : null; //definitely required - not good if missing! 19 $this->account = isset($account) ? $account : $config_acctid; //if value for account is changed in shortcode, use that - otherwise go with the value specified in the config. 20 20 $this->memberId = boolval($this->memberid_enabled) ? $this->fill_memberid_field() : null; //if we aren't wanting to fill memberId for logged-in users, use null as the value 21 21 $this->mode = ($mode === 'live' || $mode === 'test') ? esc_attr($mode) : null; //there is an issue if mode isn't provided. -
customdonations/trunk/customdonations.php
r1790427 r1791029 6 6 * Author URI: https://www.customdonations.com 7 7 * Text Domain: customdonations 8 * Version: 1.0 8 * Version: 1.0.1 9 9 * License: GPLv2 10 10 * License URI: https://www.gnu.org/licenses/gpl-2.0.html -
customdonations/trunk/readme.txt
r1790427 r1791029 2 2 Tested up to: 4.9.1 3 3 Requires PHP: 5.2 4 Stable tag: 1.0 4 Stable tag: 1.0.1 5 5 License: GPLv2 6 6 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 42 42 43 43 == Changelog == 44 = 1.0.0 = 44 = 1.0.1 = 45 Minor settings fixes. 46 = 1.0 = 45 47 Initial release
Note: See TracChangeset
for help on using the changeset viewer.