Overview

Classes

  • Bright
  • BrightWoocommerceConstants
  • BrightWoocommerceIntegration
  • WoocommerceExtensions

Functions

  • bright_add_quicktags
  • bright_add_token_tag
  • bright_call_api_for_course
  • bright_check_compat
  • bright_curl
  • bright_curl_error
  • bright_echo_message
  • bright_extract_embed_code
  • bright_fetch_template_text
  • bright_fetch_user_attributes
  • bright_get_authentication_code_for_user
  • bright_get_avatar_url
  • bright_get_course_data
  • bright_get_course_list_with_registrations
  • bright_get_course_providers
  • bright_get_registration_data
  • bright_get_registration_list
  • bright_get_reportage_urls
  • bright_get_template_data
  • bright_get_user
  • bright_learning_paths_load_bright_customization_scripts
  • bright_load_custom_wp_admin_style
  • bright_load_scripts
  • bright_log
  • bright_manage_woocommerce_order
  • bright_menu_admin
  • bright_menu_overview
  • bright_menu_settings
  • bright_menu_sync
  • bright_message
  • bright_register_user_to_course
  • bright_render_as_javascript
  • bright_reset_token
  • bright_results_matrix
  • bright_return_as_javascript
  • bright_rewrite_embed_code
  • bright_run_stored_query
  • bright_set_current_course_provider
  • bright_shortcode_func
  • bright_stop
  • bright_stub
  • bright_support
  • bright_template_pack_load_bright_customization_scripts
  • bright_template_pack_load_bright_customization_styles
  • bright_update_all_users
  • bright_update_realmuser_meta
  • bright_update_user_licenses
  • bright_update_user_meta
  • btp_create_header_text
  • dump_bright_js_for_footer
  • setup_bright_menu
  • Overview
  • Class
  1: <?php
  2: 
  3: function bright_menu_settings() {
  4:     if (!current_user_can('manage_options')) {
  5:       wp_die(bright_message('You do not have sufficient permissions to access this page.'));
  6:     }
  7: 
  8:     $hidden_field_name = 'bright_submit_hidden';
  9:     // See if the user has posted us some information
 10:     // If they did, this hidden field will be set to 'Y'
 11: 
 12: 
 13: 
 14:     // variables for the field and option names 
 15:     $opt_name = 'bright_api_url';
 16:     $data_field_name = 'bright_api_url';
 17: 
 18:     // Read in existing option value from database
 19:     $opt_val = get_option( $opt_name );
 20: 
 21:     if(isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y') {
 22:         // Read their posted value
 23:         $opt_val = $_POST[ $data_field_name ];
 24: 
 25:         // Save the posted value in the database
 26:         update_option( $opt_name, $opt_val );
 27:     }
 28: 
 29: 
 30:     // variables for the field and option names 
 31:     $opt_name = 'bright_scorm_cloud_app_id';
 32:     $data_field_name = 'bright_scorm_cloud_app_id';
 33: 
 34:     // Read in existing option value from database
 35:     $opt_val = get_option( $opt_name );
 36: 
 37:     if(isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y') {
 38:         // Read their posted value
 39:         $opt_val = $_POST[ $data_field_name ];
 40: 
 41:         // Save the posted value in the database
 42:         update_option( $opt_name, $opt_val );
 43:     }
 44: 
 45: 
 46:     // variables for the field and option names 
 47:     $opt_name = 'bright_scorm_cloud_secret_key';
 48:     $data_field_name = 'bright_scorm_cloud_secret_key';
 49: 
 50:     // Read in existing option value from database
 51:     $opt_val = get_option( $opt_name );
 52: 
 53:     if(isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y') {
 54:         // Read their posted value
 55:         $opt_val = $_POST[ $data_field_name ];
 56: 
 57:         // Save the posted value in the database
 58:         update_option( $opt_name, $opt_val );
 59:     }
 60: 
 61: 
 62:     // variables for the field and option names 
 63:     $opt_name = 'bright_realm_guid';
 64:     $data_field_name = 'bright_realm_guid';
 65: 
 66:     // Read in existing option value from database
 67:     $opt_val = get_option( $opt_name );
 68: 
 69:     if(isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y') {
 70:         // Read their posted value
 71:         $opt_val = $_POST[ $data_field_name ];
 72: 
 73:         // Save the posted value in the database
 74:         update_option( $opt_name, $opt_val );
 75:     }
 76: 
 77: 
 78:     // variables for the field and option names 
 79:     $opt_name = 'bright_secret_key';
 80:     $data_field_name = 'bright_secret_key';
 81: 
 82:     // Read in existing option value from database
 83:     $opt_val = get_option( $opt_name );
 84: 
 85:     if(isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y') {
 86:         // Read their posted value
 87:         $opt_val = $_POST[ $data_field_name ];
 88: 
 89:         // Save the posted value in the database
 90:         update_option( $opt_name, $opt_val );
 91:     }
 92: 
 93: 
 94:     // variables for the field and option names 
 95:     $opt_name = 'bright_usermeta_export';
 96:     $data_field_name = 'bright_usermeta_export';
 97: 
 98:     // Read in existing option value from database
 99:     $opt_val = get_option( $opt_name );
100: 
101:     if(isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y') {
102:         // Read their posted value
103:         $opt_val = $_POST[ $data_field_name ];
104: 
105:         // Save the posted value in the database
106:         update_option( $opt_name, $opt_val );
107:     }
108: 
109: 
110:     if( isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) {
111:       bright_reset_token();
112:       $api_key = bright_get_authentication_code_for_user(wp_get_current_user());
113: ?>
114: <div class="updated"><p><strong>API KEY: <?php  echo ($api_key) ?></strong></p></div>
115: <div class="<?php echo empty($api_key) ? 'error' : 'updated'; ?>"><p><strong><?php echo('Settings checked and <strong>' . (empty($api_key) ? 'failed' : 'succeeded') . '</strong>.') ?></strong></p></div>
116: <div class="updated"><p><strong><?php _e('settings saved.', 'bright-menu' ); ?></strong></p></div>
117: <?php 
118: 
119:   if (empty($api_key)) {
120:   ?>
121: <div class="error"><p><?php echo bright_curl_error(); ?></p></div>
122: <?php 
123:   }
124: } ?>
125: <img src="http://www.aura-software.com/wp-content/uploads/2012/04/just-bulb-01.png"/>
126: <div class="wrap">
127:   <h2><?php bright_echo_message('Bright Settings'); ?></h2>
128:   <form name="form1" method="post" action="">
129:     <div class="bright-compat">
130:       <?php echo   bright_check_compat(); ?>
131:     </div>
132:     <table>
133:   
134: 
135: <?php
136:     $opt_name = 'bright_api_url';
137:     $opt_val = get_option( $opt_name );
138: ?>
139: <div title="<?php _e("") ?>">
140:       <tr title="<?php _e("") ?>">
141:         <td><div title="<?php _e("") ?>"><?php _e("Bright API URL:", 'bright-menu' ); ?></div></td>
142:         <td><input type="text" name="bright_api_url" value="<?php echo $opt_val; ?>" size="50"></td>
143:       </tr>
144: </div>
145: 
146:        <tr>
147:          <td colspan="2"><hr/></td>
148:        </tr>
149: 
150: <?php
151:     $opt_name = 'bright_scorm_cloud_app_id';
152:     $opt_val = get_option( $opt_name );
153: ?>
154: <div title="<?php _e("") ?>">
155:       <tr title="<?php _e("") ?>">
156:         <td><div title="<?php _e("") ?>"><?php _e("SCORM Cloud Application ID:", 'bright-menu' ); ?></div></td>
157:         <td><input type="text" name="bright_scorm_cloud_app_id" value="<?php echo $opt_val; ?>" size="10"></td>
158:       </tr>
159: </div>
160: 
161: <?php
162:     $opt_name = 'bright_scorm_cloud_secret_key';
163:     $opt_val = get_option( $opt_name );
164: ?>
165: <div title="<?php _e("") ?>">
166:       <tr title="<?php _e("") ?>">
167:         <td><div title="<?php _e("") ?>"><?php _e("SCORM Cloud Secret Key:", 'bright-menu' ); ?></div></td>
168:         <td><input type="text" name="bright_scorm_cloud_secret_key" value="<?php echo $opt_val; ?>" size="50"></td>
169:       </tr>
170: </div>
171: 
172:        <tr>
173:          <td colspan="2"><hr/></td>
174:        </tr>
175: 
176: <?php
177:     $opt_name = 'bright_realm_guid';
178:     $opt_val = get_option( $opt_name );
179: ?>
180: <div title="<?php _e("") ?>">
181:       <tr title="<?php _e("") ?>">
182:         <td><div title="<?php _e("") ?>"><?php _e("Bright Realm GUID:", 'bright-menu' ); ?></div></td>
183:         <td><input type="text" name="bright_realm_guid" value="<?php echo $opt_val; ?>" size="20"></td>
184:       </tr>
185: </div>
186: 
187: <?php
188:     $opt_name = 'bright_secret_key';
189:     $opt_val = get_option( $opt_name );
190: ?>
191: <div title="<?php _e("") ?>">
192:       <tr title="<?php _e("") ?>">
193:         <td><div title="<?php _e("") ?>"><?php _e("Bright Realm Secret Key:", 'bright-menu' ); ?></div></td>
194:         <td><input type="text" name="bright_secret_key" value="<?php echo $opt_val; ?>" size="50"></td>
195:       </tr>
196: </div>
197: 
198:        <tr>
199:          <td colspan="2"><hr/></td>
200:        </tr>
201: 
202: <?php
203:     $opt_name = 'bright_usermeta_export';
204:     $opt_val = get_option( $opt_name );
205: ?>
206: <div title="<?php _e("This is a list of 'usermeta' keys that will by synced to bright's realm user table") ?>">
207:       <tr title="<?php _e("This is a list of 'usermeta' keys that will by synced to bright's realm user table") ?>">
208:         <td><div title="<?php _e("This is a list of 'usermeta' keys that will by synced to bright's realm user table") ?>"><?php _e("UserMeta Sync:", 'bright-menu' ); ?></div></td>
209:         <td><input type="text" name="bright_usermeta_export" value="<?php echo $opt_val; ?>" size="80"></td>
210:       </tr>
211: </div>
212: 
213:   <hr/>
214:   <tr>
215:     <td>
216:       <p class="submit"><input type="submit" name="Test Settings" class="button-primary" value="<?php esc_attr_e('Test Settings') ?>"/></p>
217:     </td>
218:     <td>
219:       <p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>"/></p>
220:     </td>
221:     <td>
222:       <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
223:     </td>
224:   </tr>
225: </form>
226: </div>
227: 
228: <?php } ?>
229: 
API documentation generated by ApiGen