/** * Generator button */ public static function button($args = array()) { // Check access if (!self::access_check()) { return; } // Prepare args $args = wp_parse_args($args, array('target' => 'content', 'text' => __('Insert shortcode', 'su'), 'class' => 'button', 'icon' => get_template_directory_uri() . '/functions/sc_generator/assets/images/icon.png', 'echo' => true, 'shortcode' => false)); // Prepare icon if ($args['icon']) { $args['icon'] = '<img src="' . $args['icon'] . '" /> '; } // Print button $button = '<a href="javascript:void(0);" class="su-generator-button ' . $args['class'] . '" title="' . $args['text'] . '" data-target="' . $args['target'] . '" data-mfp-src="#su-generator" data-shortcode="' . (string) $args['shortcode'] . '">' . $args['icon'] . $args['text'] . '</a>'; // Show generator popup add_action('wp_footer', array(__CLASS__, 'popup')); add_action('admin_footer', array(__CLASS__, 'popup')); // Request assets wp_enqueue_media(); su_query_asset('css', array('simpleslider', 'farbtastic', 'magnific-popup', 'font-awesome', 'su-generator')); su_query_asset('js', array('jquery', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse', 'simpleslider', 'farbtastic', 'magnific-popup', 'su-generator')); // Print/return result if ($args['echo']) { echo $button; } return $button; }
public static function qrcode($atts = null, $content = null) { $atts = shortcode_atts(array('data' => '', 'title' => '', 'size' => 200, 'margin' => 0, 'align' => 'none', 'link' => '', 'target' => 'blank', 'color' => '#000000', 'background' => '#ffffff', 'class' => ''), $atts, 'qrcode'); // Check the data if (!$atts['data']) { return 'QR code: ' . __('please specify the data', 'su'); } // Prepare link $href = $atts['link'] ? ' href="' . $atts['link'] . '"' : ''; // Prepare clickable class if ($atts['link']) { $atts['class'] .= ' su-qrcode-clickable'; } // Prepare title $atts['title'] = esc_attr($atts['title']); // Query assets su_query_asset('css', 'su-content-shortcodes'); // Return result return '<span class="su-qrcode su-qrcode-align-' . $atts['align'] . su_ecssc($atts) . '"><a' . $href . ' target="_' . $atts['target'] . '" title="' . $atts['title'] . '"><img src="https://api.qrserver.com/v1/create-qr-code/?data=' . urlencode($atts['data']) . '&size=' . $atts['size'] . 'x' . $atts['size'] . '&format=png&margin=' . $atts['margin'] . '&color=' . su_hex2rgb($atts['color']) . '&bgcolor=' . su_hex2rgb($atts['background']) . '" alt="' . $atts['title'] . '" /></a></span>'; }
public static function addons($field, $config) { $output = array(); $addons = array(array('name' => __('New Shortcodes', 'shortcodes-ultimate'), 'desc' => __('Parallax sections, responsive content slider, pricing tables, vector icons, testimonials, progress bars and even more', 'shortcodes-ultimate'), 'url' => 'http://gndev.info/shortcodes-ultimate/extra/', 'image' => plugins_url('assets/images/banners/extra.png', SU_PLUGIN_FILE)), array('name' => __('Maker', 'shortcodes-ultimate'), 'desc' => __('This add-on allows you to create custom shortcodes. You can easily create any shortcode with different parameters or even override default shortcodes', 'shortcodes-ultimate'), 'url' => 'http://gndev.info/shortcodes-ultimate/maker/', 'image' => plugins_url('assets/images/banners/maker.png', SU_PLUGIN_FILE)), array('name' => __('Skins', 'shortcodes-ultimate'), 'desc' => __('Set of additional skins for Shortcodes Ultimate. It includes skins for accordeons/spoilers, tabs and some other shortcodes', 'shortcodes-ultimate'), 'url' => 'http://gndev.info/shortcodes-ultimate/skins/', 'image' => plugins_url('assets/images/banners/skins.png', SU_PLUGIN_FILE)), array('name' => __('Add-ons bundle', 'shortcodes-ultimate'), 'desc' => __('Get all three add-ons with huge discount!', 'shortcodes-ultimate'), 'url' => 'http://gndev.info/shortcodes-ultimate/add-ons-bundle/', 'image' => plugins_url('assets/images/banners/bundle.png', SU_PLUGIN_FILE))); $plugins = array(); $output[] = '<h2>' . __('Shortcodes Ultimate Add-ons', 'shortcodes-ultimate') . '</h2>'; $output[] = '<div class="su-addons-loop su-clearfix">'; foreach ($addons as $addon) { $output[] = '<div class="su-addons-item" style="visibility:hidden" data-url="' . $addon['url'] . '"><img src="' . $addon['image'] . '" alt="' . $addon['image'] . '" /><div class="su-addons-item-content"><h4>' . $addon['name'] . '</h4><p>' . $addon['desc'] . '</p><div class="su-addons-item-button"><a href="' . $addon['url'] . '" class="button button-primary" target="_blank">' . __('Learn more', 'shortcodes-ultimate') . '</a></div></div></div>'; } $output[] = '</div>'; if (count($plugins)) { $output[] = '<h2>' . __('Other WordPress Plugins', 'shortcodes-ultimate') . '</h2>'; $output[] = '<div class="su-addons-loop su-clearfix">'; foreach ($plugins as $plugin) { $output[] = '<div class="su-addons-item" style="visibility:hidden" data-url="' . $plugin['url'] . '"><img src="' . $plugin['image'] . '" alt="' . $plugin['image'] . '" /><div class="su-addons-item-content"><h4>' . $plugin['name'] . '</h4><p>' . $plugin['desc'] . '</p>' . Su_Shortcodes::button(array('url' => $plugin['url'], 'target' => 'blank', 'style' => 'flat', 'background' => '#FF7654', 'wide' => 'yes', 'radius' => '0'), __('Learn more', 'shortcodes-ultimate')) . '</div></div>'; } $output[] = '</div>'; } su_query_asset('css', array('animate', 'su-options-page')); su_query_asset('js', array('jquery', 'su-options-page')); return '<div id="su-addons-screen">' . implode('', $output) . '</div>'; }
public static function get_icon($args) { $args = wp_parse_args($args, array('icon' => '', 'size' => '', 'color' => '', 'style' => '')); // Check for icon param if (!$args['icon']) { return; } // Add trailing ; to the style param if ($args['style']) { $args['style'] = rtrim($args['style'], ';') . ';'; } // Font Awesome icon if (strpos($args['icon'], 'icon:') !== false) { // Add size if ($args['size']) { $args['style'] .= 'font-size:' . $args['size'] . 'px;'; } // Add color if ($args['color']) { $args['style'] .= 'color:' . $args['color'] . ';'; } // Query font-awesome stylesheet su_query_asset('css', 'font-awesome'); // Return icon return '<i class="fa fa-' . trim(str_replace('icon:', '', $args['icon'])) . '" style="' . $args['style'] . '"></i>'; } elseif (strpos($args['icon'], '/') !== false) { // Add size if ($args['size']) { $args['style'] .= 'width:' . $args['size'] . 'px;height:' . $args['size'] . 'px;'; } // Return icon return '<img src="' . $args['icon'] . '" alt="" style="' . $args['style'] . '" />'; } // Icon is not detected return false; }
public static function flex_sliders($atts = null, $content = null) { $atts = shortcode_atts(array('paging' => 'yes', 'nav' => 'yes', 'class' => ''), $atts, 'flex_sliders'); if ($atts['nav'] == 'no') { $atts['class'] .= ' nosidearrows'; } if ($atts['paging'] == 'no') { $atts['class'] .= ' nosidepaging'; } $content = str_replace(array('] ', "]<br />"), array(']', ']'), $content); $return = '<div class="slider ' . $atts['class'] . '"><div class="flexslider carousel"><ul class="slides">'; $return .= do_shortcode($content); $return .= '</ul></div></div>'; su_query_asset('js', 'jquery'); su_query_asset('js', 'king-flex-slider'); su_query_asset('css', 'king-flex-slider-css'); return $return; }