Пример #1
0
    /**
     * Callback for displaying the UI for general settings tab.
     *
     * @since 1.0.0
     */
    public function settings_general_tab()
    {
        // Get settings
        $publishingDefault = get_option('soliloquy-publishing-default');
        $slide_position = get_option('soliloquy_slide_position');
        if (empty($slide_position)) {
            $slide_position = 'after';
        }
        ?>
        <div id="soliloquy-settings-general">
            <table class="form-table">
                <tbody>
                    <tr id="soliloquy-settings-key-box">
                        <th scope="row">
                            <label for="soliloquy-settings-key"><?php 
        _e('Soliloquy License Key', 'soliloquy');
        ?>
</label>
                        </th>
                        <td>
                            <form id="soliloquy-settings-verify-key" method="post">
                                <input type="password" name="soliloquy-license-key" id="soliloquy-settings-key" value="<?php 
        echo $this->base->get_license_key() ? $this->base->get_license_key() : '';
        ?>
" />
                                <?php 
        wp_nonce_field('soliloquy-key-nonce', 'soliloquy-key-nonce');
        ?>
                                <?php 
        submit_button(__('Verify Key', 'soliloquy'), 'primary', 'soliloquy-verify-submit', false);
        ?>
                                <?php 
        submit_button(__('Deactivate Key', 'soliloquy'), 'secondary', 'soliloquy-deactivate-submit', false);
        ?>
                                <p class="description"><?php 
        _e('License key to enable automatic updates for Soliloquy.', 'soliloquy');
        ?>
</p>
                            </form>
                        </td>
                    </tr>
                    <?php 
        $type = $this->base->get_license_key_type();
        if (!empty($type)) {
            ?>
                    <tr id="soliloquy-settings-key-type-box">
                        <th scope="row">
                            <label for="soliloquy-settings-key-type"><?php 
            _e('Soliloquy License Key Type', 'soliloquy');
            ?>
</label>
                        </th>
                        <td>
                            <form id="soliloquy-settings-key-type" method="post">
                                <span class="soliloquy-license-type"><?php 
            printf(__('Your license key type for this site is <strong>%s.</strong>', 'soliloquy'), $this->base->get_license_key_type());
            ?>
                                <input type="hidden" name="soliloquy-license-key" value="<?php 
            echo $this->base->get_license_key();
            ?>
" />
                                <?php 
            wp_nonce_field('soliloquy-key-nonce', 'soliloquy-key-nonce');
            ?>
                                <?php 
            submit_button(__('Refresh Key', 'soliloquy'), 'primary', 'soliloquy-refresh-submit', false);
            ?>
                                <p class="description"><?php 
            _e('Your license key type (handles updates and Addons). Click refresh if your license has been upgraded or the type is incorrect.', 'soliloquy');
            ?>
</p>
                            </form>
                        </td>
                    </tr>
                    <?php 
        }
        ?>
                    
                    <tr id="soliloquy-serialization-box">
                        <th scope="row">
                            <label for="soliloquy-serialization"><?php 
        _e('Fix Broken Migration', 'soliloquy');
        ?>
</label>
                        </th>
                        <td>
                            <form id="soliloquy-serialization" method="post">
                                <?php 
        wp_nonce_field('soliloquy-serialization-nonce', 'soliloquy-serialization-nonce');
        ?>
                                <?php 
        submit_button(__('Fix', 'soliloquy'), 'primary', 'soliloquy-serialization-submit', false);
        ?>
                                <p class="description"><?php 
        _e('If you have changed the URL of your WordPress web site, and manually executed a search/replace query on URLs in your WordPress database, your sliders will probably no longer show any slides.  <strong>If this is the case</strong>, click the button above to fix this. We recommend using a migration plugin or script next time :)', 'soliloquy');
        ?>
</p>
                            </form>
                        </td>
                    </tr>
                </tbody>
            </table>

            <!-- General Settings -->
            <form id="soliloquy-settings" method="post">
                <table class="form-table">
                    <tbody> 
                        <!-- Publishing Default -->
                        <tr id="soliloquy-publishing-default">
                            <th scope="row">
                                <label for="soliloquy-publishing-default"><?php 
        _e('New Slide Status', 'soliloquy');
        ?>
</label>
                            </th>
                            <td>
                                <select name="soliloquy-publishing-default" size="1">
	                                <option value="active"<?php 
        selected($publishingDefault, 'active');
        ?>
><?php 
        _e('Published', 'soliloquy');
        ?>
</option>
	                                <option value="pending"<?php 
        selected($publishingDefault, 'pending');
        ?>
><?php 
        _e('Draft', 'soliloquy');
        ?>
</option>
                                </select>
                                <p class="description"><?php 
        _e('Choose the default status of any new slides that are added/uploaded to your Soliloquy sliders. You can always change slides on an individual basis by editing them.', 'soliloquy');
        ?>
</p>
                            </td>
                        </tr>

                        <!-- Media Position -->
                        <tr id="soliloquy-slide-position-box">
                            <th scope="row">
                                <label for="soliloquy-slide-position"><?php 
        _e('New Slide Position', 'soliloquy');
        ?>
</label>
                            </th>
                            <td>
                                <select id="soliloquy-slide-position" name="soliloquy_slide_position">
                                    <?php 
        foreach ((array) Soliloquy_Common_Admin::get_instance()->get_slide_positions() as $i => $data) {
            ?>
                                        <option value="<?php 
            echo $data['value'];
            ?>
"<?php 
            selected($data['value'], $slide_position);
            ?>
><?php 
            echo $data['name'];
            ?>
</option>
                                    <?php 
        }
        ?>
                                </select>
                                <p class="description"><?php 
        _e('When adding slides to a Slider, choose whether to add slides before or after any existing slides.', 'soliloquy');
        ?>
</p>
                            </td>
                        </tr>

                        <!-- Submit -->
                        <tr>
                            <th scope="row">
                                &nbsp;
                            </th>
                            <td>
                                <?php 
        wp_nonce_field('soliloquy-settings-nonce', 'soliloquy-settings-nonce');
        submit_button(__('Update', 'soliloquy'), 'primary', 'soliloquy-settings-submit', false);
        ?>
                            </td>
                        </tr>      
                        
                        <?php 
        do_action('soliloquy_settings_general_box');
        ?>
                    </tbody>
                </table>
            </form>
        </div>
        <?php 
    }
Пример #2
0
 /**
  * Returns the singleton instance of the class.
  *
  * @since 1.0.0
  *
  * @return object The Soliloquy_Common_Admin object.
  */
 public static function get_instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof Soliloquy_Common_Admin) {
         self::$instance = new Soliloquy_Common_Admin();
     }
     return self::$instance;
 }