Example #1
0
 /**
  * Returns the singleton instance of the class.
  *
  * @since 1.0.0
  *
  * @return object The Soliloquy_Metaboxes_Lite object.
  */
 public static function get_instance()
 {
     if (!isset(self::$instance) && !self::$instance instanceof Soliloquy_Metaboxes_Lite) {
         self::$instance = new Soliloquy_Metaboxes_Lite();
     }
     return self::$instance;
 }
Example #2
0
    /**
     * Adds soliloquy fields to the  bulk editing screens
     *
     * @since 1.3.1
     *
     * @param string $column_name Column Name
     * @param string $post_type Post Type
     * @return HTML
     */
    public function bulk_edit_custom_box($column_name, $post_type)
    {
        // Check post type is soliloquy
        if ('soliloquy' !== $post_type) {
            return;
        }
        // Only apply to shortcode column
        if ('shortcode' !== $column_name) {
            return;
        }
        // Get metabox instance
        $this->metabox = Soliloquy_Metaboxes_Lite::get_instance();
        switch ($column_name) {
            case 'shortcode':
                wp_nonce_field('soliloquy', 'soliloquy');
                ?>
                
                <fieldset class="inline-edit-col-left inline-edit-soliloquy">
	                
                    <div class="inline-edit-col inline-edit-<?php 
                echo $column_name;
                ?>
">
	                
		                <label class="inline-edit-group">
					    	<span class="title"><?php 
                _e('Slider Theme', 'soliloquy');
                ?>
</span>
							
							<select name="_soliloquy[slider_theme]">
								
					            <?php 
                foreach ((array) $this->metabox->get_slider_themes() as $i => $data) {
                    ?>
					            
					                <option value="<?php 
                    echo $data['value'];
                    ?>
"><?php 
                    echo $data['name'];
                    ?>
</option>
					                
					            <?php 
                }
                ?>
					            
							</select>
						
						</label>          
						
						<label class="inline-edit-group">
						
	                		<span class="title"><?php 
                _e('Slider Transition', 'soliloquy');
                ?>
</span>
							<div class="soliloquy-select">
								<select id="soliloquy-config-transition" name="_soliloquy[transition]" class="soliloquy-chosen" data-soliloquy-chosen-options='{ "disable_search":"true", "width": "100%" }'>
			                
			                       <?php 
                foreach ((array) $this->metabox->get_slider_transitions() as $i => $data) {
                    ?>
			                           <option value="<?php 
                    echo $data['value'];
                    ?>
"><?php 
                    echo $data['name'];
                    ?>
</option>
			                       <?php 
                }
                ?>
			                
							</select>
							</div>
	                    </label>	

                    </div>
                
                </fieldset>
                
                <?php 
                break;
        }
    }
Example #3
0
/**
 * Refreshes the DOM view for a slider.
 *
 * @since 1.0.0
 */
function soliloquy_lite_ajax_refresh()
{
    // Run a security check first.
    check_ajax_referer('soliloquy-refresh', 'nonce');
    // Prepare variables.
    $post_id = absint($_POST['post_id']);
    $slider = '';
    // Grab all slider data.
    $slider_data = get_post_meta($post_id, '_sol_slider_data', true);
    // If there are no slider items, don't do anything.
    if (empty($slider_data) || empty($slider_data['slider'])) {
        echo json_encode(array('error' => true));
        die;
    }
    // Loop through the data and build out the slider view.
    foreach ((array) $slider_data['slider'] as $id => $data) {
        $slider .= Soliloquy_Metaboxes_Lite::get_instance()->get_slider_item($id, $data, $data['type'], $post_id);
    }
    echo json_encode(array('success' => $slider));
    die;
}