Пример #1
0
 public static function get_styles()
 {
     $style_ids = self::get_style_ids();
     $output = "";
     $r = "";
     foreach ($style_ids as $k => $v) {
         $classes = WPiDesButCommon::get_button_style_class($k);
         $output .= "<div class='wpi_style_holder'><div id='wpi_db_sty_" . $k . "' class='wpi_style wpi_designer_button {$classes}' >Button <span class='wpi_id'>" . $k . "</span></div></div>";
         $r .= print_r($classes, true);
     }
     //$r=print_r($style_ids,true);
     return $output;
     //return $r;
 }
 public function dashboard_widget_help()
 {
     $help_args = array("notes" => array("First create button style before creating Buttons/Share Buttons/Call-To-Action Buttons", "To create Button first create the style from menu wpi > styles > new style", "To create CTA Button first create the style from menu wpi > styles > new style", "To create Share Button first create the style from menu wpi > styles > new style"));
     $help = WPiDesButCommon::get_help_tab($help_args);
     return $help;
 }
Пример #3
0
 public function help()
 {
     $help_args = array("notes" => array("If you are a new user to this plugin then its best practice to start with Style Presets.", "Select button style from above style presets tab.", "Please enter Text Size in pixels like 24px.", "Enter color values like #ff33ff. It should contains total 7 characters including # symbol.", "If you don't know about color values then, You can copy color values from above color palette tab."));
     $help = WPiDesButCommon::get_help_tab($help_args);
     return $help;
 }
 public function designer_button($atts, $content = "")
 {
     $defaults = array("id" => "", "style_id" => "", "slide_id" => "", "share_id" => "", 'link' => '#', 'text' => 'button', "target" => "", "icon" => "", "display" => false, "icon_position" => "left");
     $atts = shortcode_atts($defaults, $atts, "wpi_designer_button");
     $button = "";
     $output = "";
     if ($atts['slide_id'] != "") {
         $post = get_post($atts['slide_id']);
         $vars = array("slide_heading", "slide_heading_2", "slide_heading_3", "slide_text", "background_color", "background_image", "button_text", "button_link", "target", "slide_footer_text", "icon", "style_id");
         $slide_data = WPiData::get_post_meta($atts['slide_id'], $vars);
         $atts = array_merge($atts, $slide_data);
         $atts['link'] = $atts['button_link'];
         $atts['text'] = $atts['button_text'];
         $slide_class = "wpi_slide_" . $atts['slide_id'];
         //$output.=print_r($atts,true);
     } else {
         if ($atts['id'] != "") {
             $post = get_post($atts['id']);
             $atts['text'] = get_post_meta($atts['id'], "text", true);
             $atts['link'] = get_post_meta($atts['id'], "link", true);
             $atts['target'] = get_post_meta($atts['id'], "target", true);
             $atts['icon'] = get_post_meta($atts['id'], "icon", true);
             $atts['icon_position'] = get_post_meta($atts['id'], "icon_position", true);
             $atts['style_id'] = get_post_meta($atts['id'], "style_id", true);
         }
     }
     $classes = WPiDesButCommon::get_button_style_class($atts['style_id']);
     if ($atts['icon_position'] == "right") {
         $left_icon = "";
         $right_icon = "<i class=''></i>";
         $icon_position = "wpi_icon_right";
     } else {
         $left_icon = "<i class=''></i>";
         $right_icon = "";
         $icon_position = "wpi_icon_left";
     }
     if ($atts['icon'] != "") {
         $icon_class = "wpi_icon wpi_icon_" . $atts['icon'] . " " . $icon_position;
     } else {
         $icon_class = "";
     }
     if ($atts['display'] == true) {
         $display_class = "wpi_display";
     } else {
         $display_class = "";
     }
     if (trim($atts['text']) == "") {
         $no_text_class = "wpi_no_text";
     } else {
         $no_text_class = "";
     }
     $target = strtolower(trim($atts['target']));
     if ($target == "new window" || $target == "newwindow" || $target == "_blank") {
         $atts['target'] = $target;
     } else {
         $atts['target'] = "";
     }
     $button .= "<a href='" . $atts['link'] . "' class='wpi_designer_button {$classes} {$icon_class} {$display_class} {$no_text_class}' target='" . $atts['target'] . "' >" . $left_icon . "<span class='wpi_text'>" . $atts['text'] . "</span>" . $right_icon . "</a>";
     if ($atts['slide_id'] != "") {
         $output .= "<div class='wpi_slide {$slide_class}'>";
         $output .= "<div class='wpi_slide_image'></div>";
         $output .= "<div id='wpi_slide_content' >";
         $output .= "<div class='wpi_slide_heading'>";
         if ($atts['slide_heading'] != "") {
             $output .= "<div><span>" . $atts['slide_heading'] . "</span></div>";
         }
         if ($atts['slide_heading_2'] != "") {
             $output .= "<div><span style='display:none'>" . $atts['slide_heading_2'] . "</span></div>";
         }
         if ($atts['slide_heading_3'] != "") {
             $output .= "<div><span style='display:none'>" . $atts['slide_heading_3'] . "</span></div>";
         }
         $output .= "</div>";
         $output .= "<div class='wpi_slide_text'>" . $atts['slide_text'] . "</div>";
         if ($atts['text'] != "") {
             $output .= $button;
         }
         $output .= "</div>";
         $output .= "<div class='wpi_slide_footer' >" . $atts['slide_footer_text'] . "</div>";
         $output .= "</div>";
     } else {
         if ($atts['share_id'] != "") {
             $style_id = get_post_meta($atts['share_id'], "style_id", true);
             $link = urlencode(self::current_page_url());
             $title = the_title_attribute('echo=0');
             $fromurl = "";
             $desc = "";
             $imagelink = "";
             $buttons_data = array("facebook" => array("link" => "https://www.facebook.com/sharer/sharer.php?u=" . $link, "icon" => "facebook-alt", "color" => "", "title" => "Share on  Facebook"), "twitter" => array("link" => "https://twitter.com/intent/tweet?source=" . $link . "&text=" . $title . "&via=" . $fromurl, "icon" => "twitter", "color" => "", "title" => "Tweet"), "googleplus" => array("link" => "https://plus.google.com/share?url=" . $link, "icon" => "googleplus-alt", "color" => "", "title" => "Share on Google+"), "linkedin" => array("link" => "http://www.linkedin.com/shareArticle?mini=true&url=" . $link . "&title=" . $title . "&summary=" . $desc . "&source=" . $fromurl, "icon" => "linkedin", "color" => "", "title" => "Share on LinkedIn"), "pinterest" => array("link" => "http://pinterest.com/pin/create/button/?url=" . $link . "&media=" . $imagelink . "&description=" . $desc, "icon" => "pinterest", "color" => "", "title" => "Pin it"), "tumblr" => array("link" => "http://www.tumblr.com/share?v=3&u=" . $link . "&t=" . $title . "&s=", "icon" => "tumblr", "color" => "", "title" => "Post on Tumblr"), "stumbleupon" => array("link" => "http://www.stumbleupon.com/submit?url=" . $link, "icon" => "stumbleupon", "color" => "", "title" => "Share on  Stumbleupon"), "reddit" => array("link" => "http://www.reddit.com/submit?url=" . $link . "&title=" . $title, "icon" => "reddit", "color" => "", "title" => "Submit to Reddit"), "wordpress" => array("link" => "http://wordpress.com/press-this.php?u=" . $link . "&t=" . $title . "&s=" . $desc . "&i=" . $imagelink, "icon" => "wordpress", "color" => "", "title" => "Publish on WordPress"), "email" => array("link" => "mailto:?subject=" . $title . "&body=" . $desc . ":" . $link, "icon" => "mail", "color" => "", "title" => "Email"));
             $share_buttons = "<div class='wpi_share_buttons wpi_share_buttons_" . $atts['share_id'] . "'>\n\t\t\t\t<div id='wpi_sb_text' class='wpi_sb_text'>Share on :</div><ul>";
             foreach ($buttons_data as $k => $v) {
                 $state = get_post_meta($atts['share_id'], $k, true);
                 if ($state == 1) {
                     $display = "";
                 } else {
                     $display = "wpi_none";
                 }
                 $share_buttons .= "<li class='wpi_sb_" . $k . " " . $display . "'><a href='" . $v['link'] . "' target='_blank' title='Share on  Facebook' class='wpi_designer_button wpi_designer_button_{$style_id} wpi_no_text wpi_icon wpi_icon_" . $v['icon'] . "' href='#'><i></i></a></li>";
             }
             $share_buttons .= "</ul></div>";
             $output .= $share_buttons;
         } else {
             $output .= $button . $atts['slide_id'];
         }
     }
     return $output;
 }
Пример #5
0
 public function help()
 {
     $help_args = array("notes" => array("To add icon to the button select icon from above 'Icons' tab", "To apply style to button select your created style from 'Styles' tab.", "Copy generated shortcode from left panel and paste it in any post/page."));
     $help = WPiDesButCommon::get_help_tab($help_args);
     return $help;
 }