Plugin Directory

Changeset 1922554


Ignore:
Timestamp:
08/09/2018 08:58:28 PM (7 years ago)
Author:
felipemontoya
Message:

Adding version 1.3.0 to the trunk

Location:
edunext-openedx-integrator/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • edunext-openedx-integrator/trunk/includes/class-wp-edunext-marketing-site-settings.php

    r1860650 r1922554  
    3636     */
    3737    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 = '';
    3846
    3947    public function __construct ( $parent ) {
     
    442450
    443451                // Add section to page
     452                $this->active_tab = $section;
    444453                add_settings_section( $section, $data['title'], array( $this, 'settings_section' ), $this->parent->_token . '_settings' );
    445454
     
    457466
    458467                    // 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                    );
    460476                }
    461477
     
    526542                settings_fields( $this->parent->_token . '_settings' );
    527543                do_settings_sections( $this->parent->_token . '_settings' );
     544                do_action($this->active_tab . '_after_settings_page_html');
    528545                $html .= ob_get_clean();
    529 
    530546                $html .= '<p class="submit">' . "\n";
    531547                    $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  
    44
    55class 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
    613
    714    /**
     
    1017    public function __construct () {
    1118        add_action( 'save_post', array( $this, 'save_meta_boxes' ), 10, 1 );
     19        add_action('admin_notices', array($this, 'show_notices'));
    1220    }
    1321
     
    318326    }
    319327
     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
    320358}
  • edunext-openedx-integrator/trunk/wp-edunext-marketing-site.php

    r1863181 r1922554  
    2222require_once( 'includes/class-wp-edunext-marketing-site.php' );
    2323require_once( 'includes/class-wp-edunext-marketing-site-settings.php' );
     24require_once( 'includes/class-wp-edunext-eox-core-api.php' );
    2425
    2526// Load plugin libraries
     
    4748
    4849WP_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 */
     58function WP_EoxCoreApi () {
     59    $instance = WP_EoxCoreApi::instance( __FILE__, '1.1.0' );
     60    return $instance;
     61}
     62
     63WP_EoxCoreApi();
Note: See TracChangeset for help on using the changeset viewer.