Ejemplo n.º 1
0
 /**
  * Generator button
  */
 public static function button($args = array())
 {
     // Check access
     if (!self::access_check()) {
         return;
     }
     // Prepare button target
     $target = is_string($args) ? $args : 'content';
     // Prepare args
     $args = wp_parse_args($args, array('target' => $target, 'text' => __('MN Shortcodes', 'framework'), 'class' => 'button', 'icon' => MOM_URI . '/framework/shortcodes/editor/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="mom-su-generator-button ' . $args['class'] . '" title="' . $args['text'] . '" data-target="' . $args['target'] . '" data-mfp-src="#mom-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();
     mom_su_query_asset('css', array('simpleslider', 'farbtastic', 'magnific-popup', 'font-awesome', 'mom-su-generator'));
     mom_su_query_asset('js', array('jquery', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse', 'simpleslider', 'farbtastic', 'magnific-popup', 'mom-su-generator'));
     // Print/return result
     if ($args['echo']) {
         echo $button;
     }
     return $button;
 }
Ejemplo n.º 2
0
 public static function addons($field, $config)
 {
     $output = array();
     $addons = array(array('name' => __('New Shortcodes', 'theme'), 'desc' => __('Parallax sections, responsive content slider, pricing tables, vector icons, testimonials, progress bars and even more', 'theme'), 'url' => 'http://gndev.info/mom-shortcodes-ultimate/extra/', 'image' => plugins_url('assets/images/banners/extra.png', mom_su_PLUGIN_FILE)), array('name' => __('Maker', 'theme'), 'desc' => __('This add-on allows you to create custom shortcodes. You can easily create any shortcode with different parameters or even override default shortcodes', 'theme'), 'url' => 'http://gndev.info/mom-shortcodes-ultimate/maker/', 'image' => plugins_url('assets/images/banners/maker.png', mom_su_PLUGIN_FILE)), array('name' => __('Skins', 'theme'), 'desc' => __('Set of additional skins for Shortcodes Ultimate. It includes skins for accordeons/spoilers, tabs and some other shortcodes', 'theme'), 'url' => 'http://gndev.info/mom-shortcodes-ultimate/skins/', 'image' => plugins_url('assets/images/banners/skins.png', mom_su_PLUGIN_FILE)), array('name' => __('Add-ons bundle', 'theme'), 'desc' => __('Get all three add-ons with huge discount!', 'theme'), 'url' => 'http://gndev.info/mom-shortcodes-ultimate/add-ons-bundle/', 'image' => plugins_url('assets/images/banners/bundle.png', mom_su_PLUGIN_FILE)));
     $plugins = array();
     $output[] = '<h2>' . __('Shortcodes Ultimate Add-ons', 'theme') . '</h2>';
     $output[] = '<div class="mom-su-addons-loop mom-su-clearfix">';
     foreach ($addons as $addon) {
         $output[] = '<div class="mom-su-addons-item" style="visibility:hidden" data-url="' . $addon['url'] . '"><img src="' . $addon['image'] . '" alt="' . $addon['image'] . '" /><div class="mom-su-addons-item-content"><h4>' . $addon['name'] . '</h4><p>' . $addon['desc'] . '</p><div class="mom-su-addons-item-button"><a href="' . $addon['url'] . '" class="button button-primary" target="_blank">' . __('Learn more', 'theme') . '</a></div></div></div>';
     }
     $output[] = '</div>';
     if (count($plugins)) {
         $output[] = '<h2>' . __('Other WordPress Plugins', 'theme') . '</h2>';
         $output[] = '<div class="mom-su-addons-loop mom-su-clearfix">';
         foreach ($plugins as $plugin) {
             $output[] = '<div class="mom-su-addons-item" style="visibility:hidden" data-url="' . $plugin['url'] . '"><img src="' . $plugin['image'] . '" alt="' . $plugin['image'] . '" /><div class="mom-su-addons-item-content"><h4>' . $plugin['name'] . '</h4><p>' . $plugin['desc'] . '</p>' . mom_su_Shortcodes::button(array('url' => $plugin['url'], 'target' => 'blank', 'style' => 'flat', 'background' => '#FF7654', 'wide' => 'yes', 'radius' => '0'), __('Learn more', 'theme')) . '</div></div>';
         }
         $output[] = '</div>';
     }
     mom_su_query_asset('css', array('animate', 'mom-su-options-page'));
     mom_su_query_asset('js', array('jquery', 'mom-su-options-page'));
     return '<div id="mom-su-addons-screen">' . implode('', $output) . '</div>';
 }
Ejemplo n.º 3
0
function mom_members($atts = null, $content = null)
{
    $atts = shortcode_atts(array('message' => __('This content is for registered users only. Please %login%.', 'framework'), 'color' => '#ffcc00', 'style' => null, 'login_text' => __('login', 'theme'), 'login_url' => wp_login_url(), 'login' => null, 'class' => ''), $atts, 'members');
    if ($atts['style'] !== null) {
        $atts['color'] = str_replace(array('0', '1', '2'), array('#fff', '#FFFF29', '#1F9AFF'), $atts['style']);
    }
    // Check feed
    if (is_feed()) {
        return;
    }
    // Check authorization
    if (!is_user_logged_in()) {
        if ($atts['login'] !== null && $atts['login'] == '0') {
            return;
        }
        // 3.x
        // Prepare login link
        $login = '******' . esc_attr($atts['login_url']) . '">' . $atts['login_text'] . '</a>';
        mom_su_query_asset('css', 'mom-su-other-shortcodes');
        return '<div class="mom-members" style="background-color:' . mom_su_hex_shift($atts['color'], 'lighter', 50) . ';border-color:' . mom_su_hex_shift($atts['color'], 'darker', 20) . ';color:' . mom_su_hex_shift($atts['color'], 'darker', 60) . '">' . str_replace('%login%', $login, mom_su_scattr($atts['message'])) . '</div>';
    } else {
        return do_shortcode($content);
    }
}
Ejemplo n.º 4
0
 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
         mom_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;
 }