public function __construct($name) { $this->addonPath = '/addons/' . $name; $this->addonDir = WPUltimatePostGrid::get()->coreDir . $this->addonPath; $this->addonUrl = WPUltimatePostGrid::get()->coreUrl . $this->addonPath; $this->addonName = $name; }
public function migrate_if_needed() { // Get current migrated to version $migrate_version = get_option('wpupg_migrate_version', false); if (!$migrate_version) { $notices = false; $migrate_version = '0.0.1'; } else { $notices = true; } $migrate_special = ''; if (isset($_GET['wpupg_migrate'])) { $migrate_special = $_GET['wpupg_migrate']; } if ($migrate_version < '1.2') { require_once WPUltimatePostGrid::get()->coreDir . '/helpers/migration/1_2_active_colors.php'; } // Each version update once if ($migrate_version < WPUPG_VERSION) { WPUltimatePostGrid::addon('custom-templates')->default_templates(true); // Reset default templates // Update all grid caches $args = array('post_type' => WPUPG_POST_TYPE, 'post_status' => 'any', 'posts_per_page' => -1, 'nopaging' => true, 'fields' => 'ids'); $query = new WP_Query($args); $posts = $query->have_posts() ? $query->posts : array(); $grid_ids = array_map('intval', $posts); if (count($grid_ids) > 0) { update_option('wpupg_regenerate_grids_check', $grid_ids); } update_option('wpupg_migrate_version', WPUPG_VERSION); } }
public function add() { $assets = func_get_args(); foreach ($assets as $asset) { if (isset($asset['file'])) { if (!isset($asset['type'])) { $asset['type'] = pathinfo($asset['file'], PATHINFO_EXTENSION); } if (!isset($asset['priority'])) { $asset['priority'] = 10; } // Set a URL and DIR variable if (isset($asset['direct']) && $asset['direct']) { $asset['url'] = $asset['file']; $asset['dir'] = $asset['file']; } else { $base_url = WPUltimatePostGrid::get()->coreUrl; $base_dir = WPUltimatePostGrid::get()->coreDir; if (isset($asset['premium']) && $asset['premium']) { $base_url = WPUltimatePostGridPremium::get()->premiumUrl; $base_dir = WPUltimatePostGridPremium::get()->premiumDir; } $asset['url'] = $base_url . $asset['file']; $asset['dir'] = $base_dir . $asset['file']; } $this->assets[] = $asset; } } }
function hide_notice() { if (isset($_GET['wpupg_hide_new_notice'])) { check_admin_referer('wpupg_hide_new_notice', 'wpupg_hide_new_notice'); update_user_meta(get_current_user_id(), '_wpupg_hide_new_notice', get_option(WPUltimatePostGrid::get()->pluginName . '_version')); } }
public function faq_page() { if (!current_user_can('edit_posts')) { wp_die('You do not have sufficient permissions to access this page.'); } // Hide the new user notice update_user_meta(get_current_user_id(), '_wpupg_hide_new_notice', get_option(WPUltimatePostGrid::get()->pluginName . '_version')); include WPUltimatePostGrid::get()->coreDir . '/static/faq.php'; }
public function assets() { $fonts = array(); $templates = array(); // TODO Get fonts from templates foreach ($templates as $template) { if (isset($template->fonts) && count($template->fonts) > 0) { $fonts = array_merge($fonts, $template->fonts); } } if (count($fonts) > 0) { WPUltimatePostGrid::get()->helper('assets')->add(array('type' => 'css', 'file' => '//fonts.googleapis.com/css?family=' . implode('|', array_unique($fonts)), 'direct' => true, 'public' => true)); } }
public function meta_box_post($post) { include WPUltimatePostGrid::get()->coreDir . '/helpers/meta_boxes/meta_box_post.php'; }
*/ public function include_helper($helper) { foreach ($this->helper_dirs as $dir) { $file = $dir . '/' . $helper . '.php'; if (file_exists($file)) { require_once $file; } } } /** * Add a directory to look for helpers. */ public function add_helper_directory($dir) { if (is_dir($dir)) { $this->helper_dirs[] = $dir; } } /* * Quick access functions */ public function template($template) { return $this->addon('custom-templates')->get_template($template); } } // Premium version is responsible for instantiating if available if (!class_exists('WPUltimatePostGridPremium')) { WPUltimatePostGrid::get(); }
public function tinymce_plugin($plugin_array) { $plugin_array['wpupg_grid_shortcode'] = WPUltimatePostGrid::get()->coreUrl . '/js/tinymce_shortcode.js'; return $plugin_array; }
public function add_support_tab() { include WPUltimatePostGrid::get()->coreDir . '/static/support_tab.html'; }
public function activation_notice() { $notice = '<strong>WP Ultimate Post Grid</strong><br/>'; $notice .= '<a href="' . admin_url('edit.php?post_type=' . WPUPG_POST_TYPE . '&page=wpupg_faq&sub=whats_new') . '">Check out our latest changes on the <strong>Grids > FAQ</strong> page</a>'; WPUltimatePostGrid::get()->helper('notices')->add_admin_notice($notice); }
public function __construct() { add_filter('plugin_action_links_' . WPUltimatePostGrid::get()->corePath . '/wp-ultimate-post-grid.php', array($this, 'action_links')); }
/** * Helper functions */ public function set_dynamic_rules($dynamic_rules) { if (WPUltimatePostGrid::is_premium_active()) { $this->meta['wpupg_limit_posts'][0] = 'on'; $limit_rules = maybe_unserialize($this->meta('wpupg_limit_rules')); $limit_rules = is_array($limit_rules) ? $limit_rules : array(); $new_rules = array_merge($limit_rules, $dynamic_rules); $this->meta['wpupg_limit_rules'][0] = serialize($new_rules); $generated = WPUltimatePostGrid::get()->helper('grid_cache')->dynamic_generate($this); $this->meta['wpupg_posts'][0] = serialize($generated['cache']); $this->meta['wpupg_filter'][0] = $generated['filter']; } }
<?php /* * -> 1.2 * * Set active colors to hover colors */ $args = array('post_type' => WPUPG_POST_TYPE, 'post_status' => 'any', 'posts_per_page' => -1, 'nopaging' => true); $query = new WP_Query($args); $posts = $query->have_posts() ? $query->posts : array(); foreach ($posts as $grid_post) { $grid = new WPUPG_Grid($grid_post); $filter_type = $grid->filter_type(); if ($filter_type == 'isotope') { $filter_style = $grid->filter_style(); $filter_style['isotope']['background_active_color'] = $filter_style['isotope']['background_hover_color']; $filter_style['isotope']['text_active_color'] = $filter_style['isotope']['text_hover_color']; $filter_style['isotope']['border_active_color'] = $filter_style['isotope']['border_hover_color']; update_post_meta($grid->ID(), 'wpupg_filter_style', $filter_style); } } // Successfully migrated to 1.2 $migrate_version = '1.2'; update_option('wpupg_migrate_version', $migrate_version); if ($notices) { WPUltimatePostGrid::get()->helper('notices')->add_admin_notice('<strong>WP Ultimate Post Grid</strong> Successfully migrated to 1.2+'); }
?> ][type]" id="wpupg_limit_posts_rule_type_<?php echo $rule_id; ?> "> <?php foreach ($rule_type_options as $rule_type => $rule_type_name) { $selected = $rule_type == $rule['type'] ? ' selected="selected"' : ''; echo '<option value="' . esc_attr($rule_type) . '"' . $selected . '>' . $rule_type_name . '</option>'; } ?> </select> </td> <td> <img src="<?php echo WPUltimatePostGrid::get()->coreUrl . '/img/trash.png'; ?> " class="wpupg_rule_delete" title="<?php _e('Delete Rule', 'wp-ultimate-post-grid'); ?> "/> </td> </tr> <?php $rule_id++; } } ?> </tbody> </table> <a href="#" id="wpupg_add_rule"><?php
public function vafpress_shortcode_init() { require_once WPUltimatePostGrid::get()->coreDir . '/helpers/vafpress/vafpress_shortcode_whitelist.php'; require_once WPUltimatePostGrid::get()->coreDir . '/helpers/vafpress/vafpress_shortcode_options.php'; new VP_ShortcodeGenerator(array('name' => 'wpupg_shortcode_generator', 'template' => $shortcode_generator, 'modal_title' => 'WP Ultimate Post Grid ' . __('Shortcodes', 'wp-ultimate-post-grid'), 'button_title' => 'WP Ultimate Post Grid', 'types' => WPUltimatePostGrid::option('shortcode_editor_post_types', array('post', 'page')), 'main_image' => WPUltimatePostGrid::get()->coreUrl . '/img/icon_20.png', 'sprite_image' => WPUltimatePostGrid::get()->coreUrl . '/img/icon_sprite.png')); }
public function meta_box_pagination_style($post) { $grid = new WPUPG_Grid($post); include WPUltimatePostGrid::get()->coreDir . '/helpers/meta_boxes/meta_box_pagination_style.php'; }
<?php // Include part of site URL hash in HTML settings to update when site URL changes $sitehash = substr(md5(WPUltimatePostGrid::get()->coreUrl), 0, 8); $template_editor_button = WPUltimatePostGrid::is_addon_active('template-editor') ? 'grid_template_open_template_editor_active' . $sitehash : 'grid_template_open_template_editor_disabled'; $admin_menu = array('title' => 'WP Ultimate Post Grid ' . __('Settings', 'wp-ultimate-post-grid'), 'logo' => WPUltimatePostGrid::get()->coreUrl . '/img/logo.png', 'menus' => array(array('title' => __('Grid Template', 'wp-ultimate-post-grid'), 'name' => 'grid_template', 'icon' => 'font-awesome:fa-picture-o', 'menus' => array(array('title' => __('Template Editor', 'wp-ultimate-post-grid'), 'name' => 'grid_template_template_editor_menu', 'controls' => array(array('type' => 'section', 'title' => __('Template Editor', 'wp-ultimate-post-grid'), 'name' => 'grid_template_editor', 'fields' => array(array('type' => 'html', 'name' => $template_editor_button, 'binding' => array('field' => '', 'function' => 'wpupg_admin_template_editor')), array('type' => 'select', 'name' => 'template_editor_preview_grid', 'label' => __('Preview Grid', 'wp-ultimate-post-grid'), 'description' => __('This grid will be used for the preview in the editor.', 'wp-ultimate-post-grid'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpupg_admin_grids'))), 'default' => array('{{first}}')))))), array('title' => __('Advanced', 'wp-ultimate-post-grid'), 'name' => 'grid_template_advanced_menu', 'controls' => array(array('type' => 'section', 'title' => 'CSS', 'name' => 'grid_template_advanced_styling', 'fields' => array(array('type' => 'toggle', 'name' => 'grid_template_force_style', 'label' => __('Force CSS style', 'wp-ultimate-post-grid'), 'description' => __('This ensures maximum compatibility with most themes. Can be disabled for advanced usage.', 'wp-ultimate-post-grid'), 'default' => '1'), array('type' => 'toggle', 'name' => 'grid_template_inline_css', 'label' => __('Output Inline CSS', 'wp-ultimate-post-grid'), 'description' => __('When disabled the Template Editor will not output any inline CSS.', 'wp-ultimate-post-grid'), 'default' => '1'))))))), array('title' => __('Advanced', 'wp-ultimate-post-grid'), 'name' => 'advanced', 'icon' => 'font-awesome:fa-wrench', 'controls' => array(array('type' => 'section', 'title' => __('Shortcode Editor', 'wp-ultimate-post-grid'), 'name' => 'advanced_section_shortcode', 'fields' => array(array('type' => 'multiselect', 'name' => 'shortcode_editor_post_types', 'label' => __('Show shortcode editor for', 'wp-ultimate-post-grid'), 'description' => __('Where do you want to be able to insert grids with the shortcode editor?', 'wp-ultimate-post-grid'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpupg_admin_post_types'))), 'default' => array('post', 'page')))), array('type' => 'section', 'title' => __('Assets', 'wp-ultimate-post-grid'), 'name' => 'advanced_section_assets', 'fields' => array(array('type' => 'toggle', 'name' => 'assets_use_cache', 'label' => __('Cache Assets', 'wp-ultimate-post-grid'), 'description' => __('Disable this while developing.', 'wp-ultimate-post-grid'), 'default' => '1'))))), array('title' => __('Custom Code', 'wp-ultimate-post-grid'), 'name' => 'custom_code', 'icon' => 'font-awesome:fa-code', 'controls' => array(array('type' => 'codeeditor', 'name' => 'custom_code_public_css', 'label' => __('Public CSS', 'wp-ultimate-post-grid'), 'theme' => 'github', 'mode' => 'css'))), array('title' => __('FAQ & Support', 'wp-ultimate-post-grid'), 'name' => 'faq_support', 'icon' => 'font-awesome:fa-book', 'controls' => array(array('type' => 'notebox', 'name' => 'faq_support_notebox', 'label' => __('Need more help?', 'wp-ultimate-post-grid'), 'description' => '<a href="mailto:support@bootstrapped.ventures" target="_blank">WP Ultimate Post Grid ' . __('FAQ & Support', 'wp-ultimate-post-grid') . '</a>', 'status' => 'info')))));
} ?> "> What’s New </a><a href="<?php echo admin_url('edit.php?post_type=' . WPUPG_POST_TYPE . '&page=wpupg_faq&sub=support'); ?> " class="nav-tab<?php if ($sub == 'support') { echo ' nav-tab-active'; } ?> "> I need help! </a><a href="<?php echo admin_url('edit.php?post_type=' . WPUPG_POST_TYPE . '&page=wpupg_faq&sub=our_plugins'); ?> " class="nav-tab<?php if ($sub == 'our_plugins') { echo ' nav-tab-active'; } ?> "> Our Plugins </a> </h2> <?php include WPUltimatePostGrid::get()->coreDir . '/static/faq/' . $sub . '.php'; ?> </div>
<?php // Include part of site URL hash in HTML settings to update when site URL changes $sitehash = substr(md5(WPUltimatePostGrid::get()->coreUrl), 0, 8); $template_editor_button = WPUltimatePostGrid::is_addon_active('template-editor') ? 'grid_template_open_template_editor_active' . $sitehash : 'grid_template_open_template_editor_disabled'; $admin_menu = array('title' => 'WP Ultimate Post Grid ' . __('Settings', 'wp-ultimate-post-grid'), 'logo' => WPUltimatePostGrid::get()->coreUrl . '/img/logo.png', 'menus' => array(array('title' => __('Grid Template', 'wp-ultimate-post-grid'), 'name' => 'grid_template', 'icon' => 'font-awesome:fa-picture-o', 'menus' => array(array('title' => __('Template Editor', 'wp-ultimate-post-grid'), 'name' => 'grid_template_template_editor_menu', 'controls' => array(array('type' => 'notebox', 'name' => 'grid_template_premium_not_installed', 'label' => 'WP Ultimate Post Grid Premium', 'description' => __('These features are only available in', 'wp-ultimate-post-grid') . ' <a href="http://bootstrapped.ventures/wp-ultimate-post-grid/" target="_blank">WP Ultimate Post Grid Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpupg_admin_premium_not_installed')), array('type' => 'section', 'title' => __('Template Editor', 'wp-ultimate-post-grid'), 'name' => 'grid_template_editor', 'fields' => array(array('type' => 'html', 'name' => $template_editor_button, 'binding' => array('field' => '', 'function' => 'wpupg_admin_template_editor')), array('type' => 'select', 'name' => 'template_editor_preview_grid', 'label' => __('Preview Grid', 'wp-ultimate-post-grid'), 'description' => __('This grid will be used for the preview in the editor.', 'wp-ultimate-post-grid'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpupg_admin_grids'))), 'default' => array('{{first}}')))))), array('title' => __('Advanced', 'wp-ultimate-post-grid'), 'name' => 'grid_template_advanced_menu', 'controls' => array(array('type' => 'section', 'title' => 'CSS', 'name' => 'grid_template_advanced_styling', 'fields' => array(array('type' => 'toggle', 'name' => 'grid_template_force_style', 'label' => __('Force CSS style', 'wp-ultimate-post-grid'), 'description' => __('This ensures maximum compatibility with most themes. Can be disabled for advanced usage.', 'wp-ultimate-post-grid'), 'default' => '0'), array('type' => 'toggle', 'name' => 'grid_template_inline_css', 'label' => __('Output Inline CSS', 'wp-ultimate-post-grid'), 'description' => __('When disabled the Template Editor will not output any inline CSS.', 'wp-ultimate-post-grid'), 'default' => '1'))))))), array('title' => __('Grid', 'wp-ultimate-post-grid'), 'name' => 'grid', 'icon' => 'font-awesome:fa-th-large', 'controls' => array(array('type' => 'section', 'title' => __('Animations', 'wp-ultimate-post-grid'), 'name' => 'grid_animations', 'fields' => array(array('type' => 'slider', 'name' => 'grid_animation_speed', 'label' => __('Animation Speed', 'wp-ultimate-post-grid'), 'description' => __('Duration of the animations in seconds.', 'wp-ultimate-post-grid'), 'min' => '0', 'max' => '5', 'step' => '0.05', 'default' => '0.8'))))), array('title' => __('Filters', 'wp-ultimate-post-grid'), 'name' => 'filters', 'icon' => 'font-awesome:fa-filter', 'controls' => array(array('type' => 'notebox', 'name' => 'filters_premium_not_installed', 'label' => 'WP Ultimate Post Grid Premium', 'description' => __('These features are only available in', 'wp-ultimate-post-grid') . ' <a href="http://bootstrapped.ventures/wp-ultimate-post-grid/" target="_blank">WP Ultimate Post Grid Premium</a></strong>.', 'status' => 'warning', 'dependency' => array('field' => '', 'function' => 'wpupg_admin_premium_not_installed')), array('type' => 'section', 'title' => __('Dropdown Filters', 'wp-ultimate-post-grid'), 'name' => 'filters_dropdown', 'fields' => array(array('type' => 'color', 'name' => 'filters_dropdown_border_color', 'label' => __('Border Color', 'wp-ultimate-post-grid'), 'default' => '#AAAAAA', 'format' => 'hex'), array('type' => 'color', 'name' => 'filters_dropdown_text_color', 'label' => __('Default Text Color', 'wp-ultimate-post-grid'), 'default' => '#444444', 'format' => 'hex'), array('type' => 'color', 'name' => 'filters_dropdown_highlight_background_color', 'label' => __('Highlight Background Color', 'wp-ultimate-post-grid'), 'default' => '#5897FB', 'format' => 'hex'), array('type' => 'color', 'name' => 'filters_dropdown_highlight_text_color', 'label' => __('Highlight Text Color', 'wp-ultimate-post-grid'), 'default' => '#FFFFFF', 'format' => 'hex'))))), array('title' => __('Advanced', 'wp-ultimate-post-grid'), 'name' => 'advanced', 'icon' => 'font-awesome:fa-wrench', 'controls' => array(array('type' => 'section', 'title' => __('Shortcode Editor', 'wp-ultimate-post-grid'), 'name' => 'advanced_section_shortcode', 'fields' => array(array('type' => 'multiselect', 'name' => 'shortcode_editor_post_types', 'label' => __('Show shortcode editor for', 'wp-ultimate-post-grid'), 'description' => __('Where do you want to be able to insert grids with the shortcode editor?', 'wp-ultimate-post-grid'), 'items' => array('data' => array(array('source' => 'function', 'value' => 'wpupg_admin_post_types'))), 'default' => array('post', 'page')))), array('type' => 'section', 'title' => __('Assets', 'wp-ultimate-post-grid'), 'name' => 'advanced_section_assets', 'fields' => array(array('type' => 'toggle', 'name' => 'assets_use_cache', 'label' => __('Cache Assets', 'wp-ultimate-post-grid'), 'description' => __('Disable this while developing.', 'wp-ultimate-post-grid'), 'default' => '1'))))), array('title' => __('Custom Code', 'wp-ultimate-post-grid'), 'name' => 'custom_code', 'icon' => 'font-awesome:fa-code', 'controls' => array(array('type' => 'codeeditor', 'name' => 'custom_code_public_css', 'label' => __('Public CSS', 'wp-ultimate-post-grid'), 'theme' => 'github', 'mode' => 'css'))), array('title' => __('FAQ & Support', 'wp-ultimate-post-grid'), 'name' => 'faq_support', 'icon' => 'font-awesome:fa-book', 'controls' => array(array('type' => 'notebox', 'name' => 'faq_support_notebox', 'label' => __('Need more help?', 'wp-ultimate-post-grid'), 'description' => '<a href="mailto:support@bootstrapped.ventures" target="_blank">WP Ultimate Post Grid ' . __('FAQ & Support', 'wp-ultimate-post-grid') . '</a>', 'status' => 'info')))));
public function vafpress_menu_init() { require_once WPUltimatePostGrid::get()->coreDir . '/helpers/vafpress/vafpress_menu_whitelist.php'; require_once WPUltimatePostGrid::get()->coreDir . '/helpers/vafpress/vafpress_menu_options.php'; new VP_Option(array('is_dev_mode' => false, 'option_key' => 'wpupg_option', 'page_slug' => 'wpupg_admin', 'template' => $admin_menu, 'menu_page' => 'edit.php?post_type=' . WPUPG_POST_TYPE, 'use_auto_group_naming' => true, 'use_exim_menu' => true, 'minimum_role' => 'manage_options', 'layout' => 'fluid', 'page_title' => __('Settings', 'wp-ultimate-post-grid'), 'menu_label' => __('Settings', 'wp-ultimate-post-grid'))); }