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 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 __construct($name)
 {
     $this->addonPath = '/addons/' . $name;
     $this->addonDir = WPUltimatePostGrid::get()->coreDir . $this->addonPath;
     $this->addonUrl = WPUltimatePostGrid::get()->coreUrl . $this->addonPath;
     $this->addonName = $name;
 }
Example #4
0
 public function custom_css()
 {
     if (WPUltimatePostGrid::option('custom_code_public_css', '') !== '') {
         echo '<style type="text/css">';
         echo WPUltimatePostGrid::option('custom_code_public_css', '');
         echo '</style>';
     }
 }
 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';
 }
 /**
  * Return instance of self
  */
 public static function get($instantiated_by_premium = false)
 {
     // Instantiate self only once
     if (is_null(self::$instance)) {
         self::$instantiated_by_premium = $instantiated_by_premium;
         self::$instance = new self();
         self::$instance->init();
     }
     return self::$instance;
 }
function wpupg_admin_template_editor()
{
    if (WPUltimatePostGrid::is_addon_active('template-editor')) {
        $url = WPUltimatePostGrid::addon('template-editor')->editor_url();
        $button = '<a href="' . $url . '" class="button button-primary" target="_blank">' . __('Open the Template Editor', 'wp-ultimate-post-grid') . '</a>';
    } else {
        $button = '<a href="#" class="button button-primary button-disabled" disabled>' . __('Open the Template Editor', 'wp-ultimate-post-grid') . '</a>';
    }
    return $button;
}
 public function output($post, $args = array())
 {
     if (!$this->output_block($post, $args)) {
         return '';
     }
     if ($this->preset) {
         $this->url = WPUltimatePostGrid::addon('template-editor')->addonUrl . '/img/' . $this->preset . '.png';
     }
     $output = $this->before_output();
     $output .= '<img src="' . $this->url . '"' . $this->style() . '\\>';
     return $this->after_output($output, $post);
 }
Example #9
0
 public function shortcode($options)
 {
     $output = '';
     $slug = strtolower(trim($options['id']));
     if ($slug) {
         unset($options['id']);
         $post = get_page_by_path($slug, OBJECT, WPUPG_POST_TYPE);
         if (!is_null($post)) {
             $grid = new WPUPG_Grid($post);
             // Check if we need to filter the grid dynamically
             $dynamic_rules = array();
             if (count($options) > 0 && WPUltimatePostGrid::is_premium_active()) {
                 foreach ($options as $taxonomy => $terms) {
                     if (taxonomy_exists($taxonomy)) {
                         $dynamic_rules[] = array('post_type' => 'wpupg_dynamic', 'taxonomy' => $taxonomy, 'values' => explode(';', str_replace(',', ';', $terms)), 'type' => 'restrict');
                     }
                 }
             }
             if (count($dynamic_rules) > 0) {
                 $grid->set_dynamic_rules($dynamic_rules);
             }
             $filter_type = $grid->filter_type();
             $filter = '';
             if ($filter_type == 'isotope') {
                 $filter_style = $grid->filter_style();
                 $filter_style = $filter_style[$filter_type];
                 $style_data = ' data-filter-type="' . $filter_type . '"';
                 $style_data .= ' data-margin-vertical="' . $filter_style['margin_vertical'] . '"';
                 $style_data .= ' data-margin-horizontal="' . $filter_style['margin_horizontal'] . '"';
                 $style_data .= ' data-padding-vertical="' . $filter_style['padding_vertical'] . '"';
                 $style_data .= ' data-padding-horizontal="' . $filter_style['padding_horizontal'] . '"';
                 $style_data .= ' data-border-width="' . $filter_style['border_width'] . '"';
                 $style_data .= ' data-background-color="' . $filter_style['background_color'] . '"';
                 $style_data .= ' data-text-color="' . $filter_style['text_color'] . '"';
                 $style_data .= ' data-border-color="' . $filter_style['border_color'] . '"';
                 $style_data .= ' data-active-background-color="' . $filter_style['background_active_color'] . '"';
                 $style_data .= ' data-active-text-color="' . $filter_style['text_active_color'] . '"';
                 $style_data .= ' data-active-border-color="' . $filter_style['border_active_color'] . '"';
                 $style_data .= ' data-hover-background-color="' . $filter_style['background_hover_color'] . '"';
                 $style_data .= ' data-hover-text-color="' . $filter_style['text_hover_color'] . '"';
                 $style_data .= ' data-hover-border-color="' . $filter_style['border_hover_color'] . '"';
                 $multiselect = $grid->filter_multiselect() ? 'true' : 'false';
                 $inverse = $grid->filter_inverse() ? 'true' : 'false';
                 $filter .= '<div id="wpupg-grid-' . esc_attr($slug) . '-filter" class="wpupg-filter wpupg-filter-' . $filter_type . '" style="text-align: ' . $filter_style['alignment'] . ';" data-grid="' . esc_attr($slug) . '" data-type="' . $filter_type . '" data-multiselect="' . $multiselect . '" data-multiselect-type="' . $grid->filter_multiselect_type() . '" data-inverse="' . $inverse . '"' . $style_data . '>';
                 $filter .= $grid->filter();
                 $filter .= '</div>';
             }
             $output = apply_filters('wpupg_filter_shortcode', $filter, $grid);
         }
     }
     return $output;
 }
Example #10
0
 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));
     }
 }
<?php

// Grid should never be null. Construct just allows easy access to WPUPG_Grid functions in IDE.
if (is_null($grid)) {
    $grid = new WPUPG_Grid(0);
}
$premium_only = WPUltimatePostGrid::is_premium_active() ? '' : ' (' . __('Premium only', 'wp-ultimate-post-grid') . ')';
?>

<input type="hidden" name="wpupg_nonce" value="<?php 
echo wp_create_nonce('grid');
?>
" />
<table id="wpupg_form_data_source" class="wpupg_form">
    <tr>
        <td><label for="wpupg_post_types"><?php 
_e('Post Types', 'wp-ultimate-post-grid');
?>
</label></td>
        <td>
            <select name="wpupg_post_types" id="wpupg_post_types" class="wpupg-select2">
                <?php 
$post_types = get_post_types('', 'objects');
unset($post_types[WPUPG_POST_TYPE]);
unset($post_types['revision']);
unset($post_types['nav_menu_item']);
foreach ($post_types as $post_type => $options) {
    $selected = in_array($post_type, $grid->post_types()) ? ' selected="selected"' : '';
    echo '<option value="' . esc_attr($post_type) . '"' . $selected . '>' . $options->labels->name . '</option>';
}
?>
 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'));
 }
        ?>
][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 
Example #14
0
 public function meta_box_post($post)
 {
     include WPUltimatePostGrid::get()->coreDir . '/helpers/meta_boxes/meta_box_post.php';
 }
<?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+');
}
    </tr>
    <tr class="wpupg_divider">
        <td><label for="wpupg_filter_taxonomy_post"><?php 
_e('Taxonomy', 'wp-ultimate-post-grid');
?>
</label></td>
        <td>
            <?php 
$post_types = get_post_types('', 'objects');
unset($post_types[WPUPG_POST_TYPE]);
unset($post_types['revision']);
unset($post_types['nav_menu_item']);
foreach ($post_types as $post_type => $options) {
    $taxonomies = get_object_taxonomies($post_type, 'objects');
    if (count($taxonomies) > 0) {
        $multiple = WPUltimatePostGrid::is_premium_active() ? ' multiple' : '';
        echo '<div id="wpupg_filter_taxonomy_' . $post_type . '_container" class="wpupg_filter_taxonomy_container">';
        echo '<select name="wpupg_filter_taxonomy_' . $post_type . '[]" id="wpupg_filter_taxonomy_' . $post_type . '" class="wpupg-select2"' . $multiple . '>';
        foreach ($taxonomies as $taxonomy => $tax_options) {
            $selected = in_array($taxonomy, $grid->filter_taxonomies()) ? ' selected="selected"' : '';
            echo '<option value="' . esc_attr($taxonomy) . '"' . $selected . '>' . $tax_options->labels->name . '</option>';
        }
        echo '</select>';
        echo '</div>';
    }
}
?>
        </td>
        <td><?php 
_e('Taxonomy to be used for filtering the grid.', 'wp-ultimate-post-grid');
?>
Example #17
0
<?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')))));
Example #18
0
 /**
  * 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'];
     }
 }
 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 meta_box_pagination_style($post)
 {
     $grid = new WPUPG_Grid($post);
     include WPUltimatePostGrid::get()->coreDir . '/helpers/meta_boxes/meta_box_pagination_style.php';
 }
 private function enqueue_js($assets)
 {
     $i = 1;
     foreach ($assets as $asset) {
         $name = isset($asset['name']) ? $asset['name'] : 'wpupg_script' . $i;
         $deps = isset($asset['deps']) ? $asset['deps'] : '';
         $version = WPUltimatePostGrid::option('assets_use_cache', '1') == '1' ? WPUPG_VERSION : time();
         wp_enqueue_script($name, $asset['url'], $deps, $version, true);
         if (isset($asset['data']) && isset($asset['data']['name'])) {
             $data_name = $asset['data']['name'];
             unset($asset['data']['name']);
             wp_localize_script($name, $data_name, $asset['data']);
         }
         $i++;
     }
 }
Example #22
0
            </select>
        </td>
        <td><?php 
_e('Options for links surrounding the grid items.', 'wp-ultimate-post-grid');
?>
</td>
    </tr>
    <tr class="wpupg_divider">
        <td><label for="wpupg_template"><?php 
_e('Template', 'wp-ultimate-post-grid');
?>
</label></td>
        <td>
            <select name="wpupg_template" id="wpupg_template" class="wpupg-select2">
                <?php 
$templates = WPUltimatePostGrid::addon('custom-templates')->get_mapping();
$templates = apply_filters('wpupg_meta_box_grid_templates', $templates);
foreach ($templates as $index => $template) {
    $selected = $index == $grid->template_id() ? ' selected="selected"' : '';
    echo '<option value="' . esc_attr($index) . '"' . $selected . '>' . $template . '</option>';
}
?>
            </select>
        </td>
        <td><?php 
_e('Template to be used for grid items.', 'wp-ultimate-post-grid');
?>
</td>
    </tr>
    <tr>
        <td><label for="wpupg_layout_mode"><?php 
 protected function after_output($output, $post)
 {
     if (!$this->show_on_desktop || !$this->show_on_mobile) {
         $output .= '</div>';
     }
     // TODO Better way of doing this?
     if ($this->link_color) {
         if (WPUltimatePostGrid::option('grid_template_force_style', '1') == '1') {
             $important = ' !important';
         } else {
             $important = '';
         }
         preg_match_all("/<a [^><]*>/i", $output, $links);
         foreach ($links[0] as $link) {
             $new_link = preg_replace('/( style=")([^"]*")/i', '$1color: ' . $this->link_color . $important . ';$2', $link);
             if ($new_link == $link) {
                 $new_link = str_ireplace('<a ', '<a style="color: ' . $this->link_color . $important . ';" ', $link);
             }
             $output = str_ireplace($link, $new_link, $output);
         }
     }
     return apply_filters('wpupg_output_grid_block_' . $this->type, $output, $post);
 }
 public function add_support_tab()
 {
     include WPUltimatePostGrid::get()->coreDir . '/static/support_tab.html';
 }
<?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')))));
Example #26
0
 public function tinymce_plugin($plugin_array)
 {
     $plugin_array['wpupg_grid_shortcode'] = WPUltimatePostGrid::get()->coreUrl . '/js/tinymce_shortcode.js';
     return $plugin_array;
 }
}
?>
">
            What&#8217;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>
Example #28
0
 public function __construct()
 {
     add_filter('plugin_action_links_' . WPUltimatePostGrid::get()->corePath . '/wp-ultimate-post-grid.php', array($this, 'action_links'));
 }
 public function template()
 {
     return WPUltimatePostGrid::addon('custom-templates')->get_template($this->template_id());
 }
 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')));
 }