/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Load the base class object. $this->base = Soliloquy_Lite::get_instance(); // Load the metabox class object. $this->metabox = Soliloquy_Metaboxes_Lite::get_instance(); // Update post type messages. add_filter('post_updated_messages', array($this, 'messages')); // Force the menu icon to be scaled to proper size (for Retina displays). add_action('admin_head', array($this, 'menu_icon')); // Check if any soliloquyv2 post types still exist, and if so migrate them once add_action('init', array($this, 'maybe_fix_soliloquyv2_cpts')); add_action('all_admin_notices', array($this, 'admin_header_html')); // Load CSS and JS. add_action('admin_enqueue_scripts', array($this, 'styles')); add_action('admin_enqueue_scripts', array($this, 'scripts')); // Append data to various admin columns. add_filter('manage_edit-soliloquy_columns', array(&$this, 'soliloquy_columns')); add_action('manage_soliloquy_posts_custom_column', array(&$this, 'soliloquy_custom_columns'), 10, 2); // Quick and Bulk Editing support. add_action('quick_edit_custom_box', array($this, 'quick_edit_custom_box'), 10, 2); // Single Item. add_action('bulk_edit_custom_box', array($this, 'bulk_edit_custom_box'), 10, 2); // Multiple Items. add_action('post_updated', array($this, 'bulk_edit_save')); // add_filter('post_row_actions', array( $this, 'slide_count' ), 10, 2); }
/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Load the base class object. $this->base = Soliloquy_Lite::get_instance(); $this->common = Soliloquy_Common_Admin_Lite::get_instance(); // Load metabox assets. add_action('admin_enqueue_scripts', array($this, 'meta_box_styles')); add_action('admin_enqueue_scripts', array($this, 'meta_box_scripts')); // Load the metabox hooks and filters. add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 100); // Modals //add_filter( 'media_view_strings', array( $this, 'media_view_strings' ) ); // Load all tabs. add_action('soliloquy_tab_slider', array($this, 'images_tab')); add_action('soliloquy_tab_config', array($this, 'config_tab')); add_action('soliloquy_tab_misc', array($this, 'misc_tab')); add_action('soliloquy_tab_mobile_lite', array($this, 'mobile_lite_tab')); add_action('soliloquy_tab_lightbox_lite', array($this, 'lightbox_lite_tab')); add_action('soliloquy_tab_pinterest_lite', array($this, 'pinterest_lite_tab')); add_action('soliloquy_tab_schedule_lite', array($this, 'schedule_lite_tab')); add_action('soliloquy_tab_carousel_lite', array($this, 'carousel_lite_tab')); add_action('soliloquy_tab_thumbnails_lite', array($this, 'thumbnails_lite_tab')); // Add action to save metabox config options. add_action('save_post', array($this, 'save_meta_boxes'), 10, 2); }
/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Load the base class object. $this->base = Soliloquy_Lite::get_instance(); // Add a custom media button to the editor. add_filter('media_buttons_context', array($this, 'media_button')); }
/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Base $this->base = Soliloquy_Lite::get_instance(); // Modals add_filter('Soliloquy_Media_View_Lite_strings', array($this, 'media_view_strings')); add_action('print_media_templates', array($this, 'print_media_templates')); }
public function __construct() { // Load the base class object. $this->base = Soliloquy_Lite::get_instance(); $this->common = Soliloquy_Common_Admin_Lite::get_instance(); // Add custom settings submenu. add_action('admin_menu', array($this, 'admin_menu')); }
/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Load the base class object. $this->base = Soliloquy_Lite::get_instance(); // Add custom settings submenu. add_action('admin_menu', array($this, 'admin_menu')); // Add callbacks for settings tabs. add_action('soliloquy_tab_settings_upgrade', array($this, 'settings_upgrade_tab')); }
/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Load the base class object. $this->base = Soliloquy_Lite::get_instance(); // Build the labels for the post type. $labels = apply_filters('soliloquy_post_type_labels', array('name' => __('Soliloquy Sliders', 'soliloquy'), 'singular_name' => __('Soliloquy', 'soliloquy'), 'add_new' => __('Add New', 'soliloquy'), 'add_new_item' => __('Add New Soliloquy Slider', 'soliloquy'), 'edit_item' => __('Edit Soliloquy Slider', 'soliloquy'), 'new_item' => __('New Soliloquy Slider', 'soliloquy'), 'view_item' => __('View Soliloquy Slider', 'soliloquy'), 'search_items' => __('Search Soliloquy Sliders', 'soliloquy'), 'not_found' => __('No Soliloquy sliders found.', 'soliloquy'), 'not_found_in_trash' => __('No Soliloquy sliders found in trash.', 'soliloquy'), 'parent_item_colon' => '', 'menu_name' => __('Soliloquy', 'soliloquy'))); // Build out the post type arguments. $args = apply_filters('soliloquy_post_type_args', array('labels' => $labels, 'public' => false, 'exclude_from_search' => false, 'show_ui' => true, 'show_in_admin_bar' => false, 'rewrite' => false, 'query_var' => false, 'menu_position' => apply_filters('soliloquy_post_type_menu_position', 248), 'menu_icon' => plugins_url('assets/css/images/menu-icon@2x.png', $this->base->file), 'supports' => array('title'))); // Register the post type with WordPress. register_post_type('soliloquy', $args); }
/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Load the base class object. $this->base = Soliloquy_Lite::get_instance(); // Check for upgrading sliders. add_action('admin_notices', array($this, 'legacy_upgrade')); add_action('admin_notices', array($this, 'legacy_upgrade_success')); // Delete any slider association on attachment deletion. Also delete any extra cropped images. add_action('delete_attachment', array($this, 'delete_slider_association')); add_action('delete_attachment', array($this, 'delete_cropped_image')); // Ensure slider display is correct when trashing/untrashing sliders. add_action('wp_trash_post', array($this, 'trash_slider')); add_action('untrash_post', array($this, 'untrash_slider')); }
/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Load the base class object. $this->base = Soliloquy_Lite::get_instance(); // Remove quick editing from the Soliloquy post type row actions. add_filter('post_row_actions', array($this, 'row_actions'), 10, 2); // Manage post type columns. add_filter('manage_edit-soliloquy_columns', array($this, 'soliloquy_columns')); add_filter('manage_soliloquy_posts_custom_column', array($this, 'soliloquy_custom_columns'), 10, 2); // Update post type messages. add_filter('post_updated_messages', array($this, 'messages')); // Force the menu icon to be scaled to proper size (for Retina displays). add_action('admin_head', array($this, 'menu_icon')); }
/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Load the base class object. $this->base = Soliloquy_Lite::get_instance(); // Load metabox assets. add_action('admin_enqueue_scripts', array($this, 'meta_box_styles')); add_action('admin_enqueue_scripts', array($this, 'meta_box_scripts')); // Load the metabox hooks and filters. add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 100); // Load all tabs. add_action('soliloquy_tab_images', array($this, 'images_tab')); add_action('soliloquy_tab_config', array($this, 'config_tab')); add_action('soliloquy_tab_misc', array($this, 'misc_tab')); // Add action to save metabox config options. add_action('save_post', array($this, 'save_meta_boxes'), 10, 2); }
/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Load the base class object. $this->base = Soliloquy_Lite::get_instance(); // Register main slider style. wp_register_style($this->base->plugin_slug . '-style', plugins_url('assets/css/soliloquy.css', $this->base->file), array(), $this->base->version); // Register main slider script. wp_register_script($this->base->plugin_slug . '-script', plugins_url('assets/js/soliloquy.js', $this->base->file), array('jquery'), $this->base->version, true); // Load hooks and filters. add_shortcode('soliloquy', array($this, 'shortcode')); add_filter('widget_text', 'do_shortcode'); }
/** * Returns the singleton instance of the class. * * @since 1.0.0 * * @return object The Soliloquy_Lite object. */ public static function get_instance() { if (!isset(self::$instance) && !self::$instance instanceof Soliloquy_Lite) { self::$instance = new Soliloquy_Lite(); } return self::$instance; }
/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() { // Load the base class object. $this->base = Soliloquy_Lite::get_instance(); }
/** * Upgrades sliders from v1 to v2. This also upgrades any current v2 users to the * proper post type. This is a mess and it was my fault. :-( I apologize to my customers * for making this so rough. You deserve better, and I will work hard to do better by * you! Thanks for hanging in there faithfully with me! * * @since 1.0.0 */ function upgrade_sliders() { // Run a security check first. check_ajax_referer('soliloquy-upgrade', 'nonce'); // Increase the time limit to account for large slider sets and suspend cache invalidations. set_time_limit(Soliloquy_Common_Lite::get_instance()->get_max_execution_time()); wp_suspend_cache_invalidation(true); // Update the license key from v1 to v2 if necessary. $v2_license = get_option('soliloquy'); if (!$v2_license || empty($v2_license['key']) || empty($v2_license['type'])) { $v1_license = get_option('soliloquy_license_key'); $new_license = Soliloquy_Lite::default_options(); if (!empty($v1_license['license'])) { $new_license['key'] = $v1_license['license']; } update_option('soliloquy', $new_license); // Force the new key to be validated. Soliloquy_License::get_instance()->validate_key(true); } // Grab all sliders from v1 and convert them to the new system. $sliders = get_posts(array('post_type' => 'soliloquy', 'posts_per_page' => -1)); // Loop through sliders and convert them. foreach ((array) $sliders as $slider) { // Grab meta from the v1 and v2 sliders. $meta = get_post_meta($slider->ID, '_soliloquy_settings', true); $v2_meta = get_post_meta($slider->ID, '_sol_slider_data', true); // Move meta from v1 to v2, or if already using v2, use v2 as a starting point. if (empty($v2_meta)) { $new_meta = array('id' => $slider->ID, 'config' => array(), 'slider' => array(), 'status' => 'active'); } else { $new_meta = $v2_meta; } // Splice meta from v1 to v2. if (!empty($new_meta['config']['gutter'])) { $new_meta['config']['gutter'] = 0; } if (!empty($new_meta['config']['position'])) { $new_meta['config']['position'] = 'none'; } if (!empty($new_meta['config']['mobile'])) { $new_meta['config']['mobile'] = 0; } $new_meta['config']['title'] = $slider->post_title; $new_meta['config']['slug'] = $slider->post_name; if (!empty($meta['width'])) { $new_meta['config']['slider_width'] = absint($meta['width']); } if (!empty($meta['height'])) { $new_meta['config']['slider_height'] = absint($meta['height']); } if (!empty($meta['default']) && 'cropped' !== $meta['default']) { $new_meta['config']['slider'] = 0; } if (!empty($meta['custom'])) { if ($meta['custom']) { if ('full' == $meta['custom']) { $new_meta['config']['slider_size'] = 'default'; } else { $new_meta['config']['slider_size'] = $meta['custom']; global $_wp_additional_image_sizes; if (isset($_wp_additional_image_sizes[$meta['custom']])) { $width = absint($_wp_additional_image_sizes[$meta['custom']]['width']); $height = absint($_wp_additional_image_sizes[$meta['custom']]['height']); } else { $width = absint(get_option($meta['custom'] . '_size_w')); $height = absint(get_option($meta['custom'] . '_size_h')); } if ($width) { $new_meta['config']['slider_width'] = $width; } if ($height) { $new_meta['config']['slider_height'] = $height; } } } } if (!empty($meta['transition'])) { if ('slide-horizontal' == $meta['transition']) { $new_meta['config']['transition'] = 'horizontal'; } else { if ('slide-vertical' == $meta['transition']) { $new_meta['config']['transition'] = 'vertical'; } else { $new_meta['config']['transition'] = 'fade'; } } } if (!empty($meta['speed'])) { $new_meta['config']['duration'] = $meta['speed']; } if (!empty($meta['duration'])) { $new_meta['config']['speed'] = $meta['duration']; } if (!empty($meta['animate'])) { $new_meta['config']['auto'] = $meta['animate']; } if (!empty($meta['navigation'])) { $new_meta['config']['arrows'] = $meta['navigation'] ? 1 : 0; } else { $new_meta['config']['arrows'] = 0; } if (!empty($meta['control'])) { $new_meta['config']['control'] = $meta['control'] ? 1 : 0; } else { $new_meta['config']['control'] = 0; } if (!empty($meta['keyboard'])) { $new_meta['config']['keyboard'] = $meta['keyboard']; } if (!empty($meta['pauseplay'])) { $new_meta['config']['pauseplay'] = $meta['pauseplay']; } if (!empty($meta['random'])) { $new_meta['config']['random'] = $meta['random']; } if (!empty($meta['number'])) { $new_meta['config']['start'] = $meta['number']; } if (!empty($meta['loop'])) { $new_meta['config']['loop'] = $meta['loop']; } if (!empty($meta['hover'])) { $new_meta['config']['hover'] = $meta['hover']; } if (!empty($meta['css'])) { $new_meta['config']['css'] = $meta['css']; } if (!empty($meta['smooth'])) { $new_meta['config']['smooth'] = $meta['smooth']; } if (!empty($meta['delay'])) { $new_meta['config']['delay'] = $meta['delay']; } // Set to the classic theme to keep people from going nuts with a theme change. if (!empty($meta['theme']) && 'metro' == $meta['theme']) { $new_meta['config']['slider_theme'] = 'metro'; } else { $new_meta['config']['slider_theme'] = 'classic'; } // Grab all attachments and add them to the slider. $attachments = get_posts(array('orderby' => 'menu_order', 'order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => $slider->ID, 'post_status' => null, 'posts_per_page' => -1)); // Loop through attachments and add them to the slider. foreach ((array) $attachments as $slide) { switch ($slide->post_mime_type) { case 'soliloquy/video': $new_meta['slider'][$slide->ID] = array('status' => 'active', 'id' => $slide->ID, 'src' => '', 'title' => isset($slide->post_title) ? $slide->post_title : '', 'link' => '', 'url' => isset($slide->post_content) ? $slide->post_content : '', 'thumb' => '', 'caption' => isset($slide->post_excerpt) ? $slide->post_excerpt : '', 'type' => 'video'); break; case 'soliloquy/html': $new_meta['slider'][$slide->ID] = array('status' => 'active', 'id' => $slide->ID, 'src' => '', 'title' => isset($slide->post_title) ? $slide->post_title : '', 'link' => '', 'code' => isset($slide->post_content) ? $slide->post_content : '', 'type' => 'html'); break; default: $url = wp_get_attachment_image_src($slide->ID, 'full'); $alt_text = get_post_meta($slide->ID, '_wp_attachment_image_alt', true); $new_meta['slider'][$slide->ID] = array('status' => 'active', 'id' => $slide->ID, 'src' => isset($url[0]) ? esc_url($url[0]) : '', 'title' => get_the_title($slide->ID), 'link' => get_post_meta($slide->ID, '_soliloquy_image_link', true), 'linktab' => get_post_meta($slider->ID, '_soliloquy_image_link_tab', true), 'alt' => !empty($alt_text) ? $alt_text : get_the_title($slide->ID), 'caption' => !empty($slide->post_excerpt) ? $slide->post_excerpt : '', 'filter' => get_post_meta($slide->ID, '_soliloquy_filters_image_filter', true), 'type' => 'image'); break; } } // Update the post meta for the new slider. update_post_meta($slider->ID, '_sol_slider_data', $new_meta); // Force the post to update. wp_update_post(array('ID' => $slider->ID, 'post_type' => 'soliloquy')); // Flush caches for any sliders. Soliloquy_Common_Lite::get_instance()->flush_slider_caches($slider->ID, $new_meta['config']['slug']); } // Now grab any v2 sliders and convert the post type back to the proper system. $v2_sliders = get_posts(array('post_type' => 'soliloquyv2', 'posts_per_page' => -1)); // Loop through the sliders, grab the data, delete and backwards convert them back to 'soliloquy' post type. foreach ((array) $v2_sliders as $slider) { // Grab any slider meta and add the attachment ID to the data array. $slider_meta = get_post_meta($slider->ID, '_sol_slider_data', true); if (!empty($slider_meta['slider'])) { foreach ($slider_meta['slider'] as $id => $data) { $slider_meta['slider'][$id]['id'] = $id; } } update_post_meta($slider->ID, '_sol_slider_data', $slider_meta); $data = array('ID' => $slider->ID, 'post_type' => 'soliloquy'); wp_update_post($data); // Flush caches for any sliders. Soliloquy_Common_Lite::get_instance()->flush_slider_caches($slider->ID); } // Turn off cache suspension and flush the cache to remove any cache inconsistencies. wp_suspend_cache_invalidation(false); wp_cache_flush(); // Update the option to signify that upgrading is complete. update_option('soliloquy_upgrade', true); // Send back the response. echo json_encode(true); die; }
<?php $base = Soliloquy_Lite::get_instance(); ?> <div id="soliloquy-header"> <div id="soliloquy-logo"><img src="<?php echo plugins_url('assets/images/soliloquy-logo.png', $base->file); ?> " alt="<?php _e('Soliloquy', 'soliloquy'); ?> "></div> </div>