Ejemplo n.º 1
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 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'));
 }
 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++;
     }
 }
Ejemplo n.º 4
0
 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);
 }