Changeset 1922554
- Timestamp:
- 08/09/2018 08:58:28 PM (7 years ago)
- Location:
- edunext-openedx-integrator/trunk
- Files:
-
- 3 edited
-
includes/class-wp-edunext-marketing-site-settings.php (modified) (4 diffs)
-
includes/lib/class-wp-edunext-marketing-site-admin-api.php (modified) (3 diffs)
-
wp-edunext-marketing-site.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
edunext-openedx-integrator/trunk/includes/class-wp-edunext-marketing-site-settings.php
r1860650 r1922554 36 36 */ 37 37 public $settings = array(); 38 39 /** 40 * Available settings for plugin. 41 * @var string 42 * @access public 43 * @since 1.0.0 44 */ 45 public $active_tab = ''; 38 46 39 47 public function __construct ( $parent ) { … … 442 450 443 451 // Add section to page 452 $this->active_tab = $section; 444 453 add_settings_section( $section, $data['title'], array( $this, 'settings_section' ), $this->parent->_token . '_settings' ); 445 454 … … 457 466 458 467 // Add field to page 459 add_settings_field( $field['id'], $field['label'], array( $this->parent->admin, 'display_field' ), $this->parent->_token . '_settings', $section, array( 'field' => $field, 'prefix' => $this->base ) ); 468 add_settings_field( 469 $field['id'], 470 $field['label'], 471 array( $this->parent->admin, 'display_field' ), 472 $this->parent->_token . '_settings', 473 $section, 474 array( 'field' => $field, 'prefix' => $this->base ) 475 ); 460 476 } 461 477 … … 526 542 settings_fields( $this->parent->_token . '_settings' ); 527 543 do_settings_sections( $this->parent->_token . '_settings' ); 544 do_action($this->active_tab . '_after_settings_page_html'); 528 545 $html .= ob_get_clean(); 529 530 546 $html .= '<p class="submit">' . "\n"; 531 547 $html .= '<input type="hidden" name="tab" value="' . esc_attr( $tab ) . '" />' . "\n"; -
edunext-openedx-integrator/trunk/includes/lib/class-wp-edunext-marketing-site-admin-api.php
r1860650 r1922554 4 4 5 5 class WP_eduNEXT_Marketing_Site_Admin_API { 6 7 /** 8 * Where notices to be shown to the user are stored 9 */ 10 private $notices = array(); 11 private $error_notices = array(); 12 6 13 7 14 /** … … 10 17 public function __construct () { 11 18 add_action( 'save_post', array( $this, 'save_meta_boxes' ), 10, 1 ); 19 add_action('admin_notices', array($this, 'show_notices')); 12 20 } 13 21 … … 318 326 } 319 327 328 /** 329 * 330 */ 331 public function add_notice($type, $message) { 332 $notice = array( 333 'type' => $type, 334 'message' => $message 335 ); 336 if ($type === 'error') { 337 array_push($this->error_notices, $notice); 338 } else { 339 array_push($this->notices, $notice); 340 } 341 } 342 343 /** 344 * 345 */ 346 public function show_notices() { 347 $notices = array_merge($this->notices, $this->error_notices); 348 foreach ($notices as $message) { 349 ?> 350 <div class="<?= $message['type'] ?> notice"> 351 <p><?= __($message['message'], 'eox-core-api') ?></p> 352 </div> 353 <?php 354 } 355 } 356 357 320 358 } -
edunext-openedx-integrator/trunk/wp-edunext-marketing-site.php
r1863181 r1922554 22 22 require_once( 'includes/class-wp-edunext-marketing-site.php' ); 23 23 require_once( 'includes/class-wp-edunext-marketing-site-settings.php' ); 24 require_once( 'includes/class-wp-edunext-eox-core-api.php' ); 24 25 25 26 // Load plugin libraries … … 47 48 48 49 WP_eduNEXT_Marketing_Site(); 50 51 52 /** 53 * Returns the main instance of WP_EoxCoreApi to prevent the need to use globals. 54 * 55 * @since 1.0.0 56 * @return object WP_EoxCoreApi 57 */ 58 function WP_EoxCoreApi () { 59 $instance = WP_EoxCoreApi::instance( __FILE__, '1.1.0' ); 60 return $instance; 61 } 62 63 WP_EoxCoreApi();
Note: See TracChangeset
for help on using the changeset viewer.