Example #1
0
 function display_bottombar($is_shortcode = false, $shortcode_options = array(), $share_options = array())
 {
     $post_types = $this->general_options['display_in_types'];
     $is_valid = false;
     if ($is_shortcode) {
         $is_valid = true;
     } else {
         $is_valid = $this->check_applicability($post_types, 'bottombar');
     }
     $output = '';
     if ($is_valid) {
         $bottombar_content_area = ESSBOptionValuesHelper::options_bool_value($this->options, 'bottombar_contentarea');
         $bottombar_content_area_pos = ESSBOptionValuesHelper::options_value($this->options, 'bottombar_contentarea_pos');
         $bottombar_usercontent = ESSBOptionValuesHelper::options_value($this->options, 'bottombar_usercontent');
         $bottombar_buttons_align = ESSBOptionValuesHelper::options_value($this->options, 'bottombar_buttons_align', 'left');
         if ($is_shortcode) {
             if (!empty($shortcode_options['bottombar_contentarea'])) {
                 $bottombar_contentarea = ESSBOptionValuesHelper::unified_true($shortcode_options['bottombar_contentarea']);
             }
             if (!empty($shortcode_options['bottombar_contentarea_pos'])) {
                 $bottombar_contentarea_pos = $shortcode_options['bottombar_contentarea_pos'];
             }
             if (!empty($shortcode_options['bottombar_buttons_align'])) {
                 $bottombar_buttons_align = $shortcode_options['bottombar_buttons_align'];
             }
             if (!empty($shortcode_options['bottombar_usercontent'])) {
                 $bottombar_usercontent = $shortcode_options['bottombar_usercontent'];
             }
         }
         $bottombar_usercontent = stripslashes($bottombar_usercontent);
         $bottombar_usercontent = do_shortcode($bottombar_usercontent);
         if ($bottombar_usercontent != '') {
             $bottombar_usercontent = preg_replace(array('#%%title%%#', '#%%siteurl%%#', '#%%permalink%%#'), array(get_the_title(), get_site_url(), get_permalink()), $bottombar_usercontent);
             $bottombar_usercontent = ESSBCoreHelper::post_details_to_content($bottombar_usercontent);
         }
         if (!$is_shortcode) {
             $ssbuttons = $this->generate_share_buttons('bottombar');
         } else {
             $ssbuttons = $this->generate_share_buttons('bottombar', 'share', $share_options, true, $shortcode_options);
         }
         $output .= '<div class="essb_bottombar">';
         $output .= '<div class="essb_bottombar_inner">';
         if (!$bottombar_content_area) {
             $output .= sprintf('<div class="essb_bottombar_inner_buttons essb_bar_withoutcontent essb_bottombar_align_%1$s">', $bottombar_buttons_align);
             $output .= $ssbuttons;
             $output .= '</div>';
         } else {
             if ($bottombar_content_area_pos == "left") {
                 $output .= '<div class="essb_bottombar_inner_content">';
                 $output .= stripslashes($bottombar_usercontent);
                 $output .= '</div>';
                 $output .= sprintf('<div class="essb_bottombar_inner_buttons essb_bottombar_align_%1$s">', $bottombar_buttons_align);
                 $output .= $ssbuttons;
                 $output .= '</div>';
             } else {
                 $output .= sprintf('<div class="essb_bottombar_inner_buttons essb_bottombar_align_%1$s">', $bottombar_buttons_align);
                 $output .= $ssbuttons;
                 $output .= '</div>';
                 $output .= '<div class="essb_bottombar_inner_content">';
                 $output .= stripslashes($bottombar_usercontent);
                 $output .= '</div>';
             }
         }
         $output .= '</div>';
         $output .= '</div>';
         if (!$is_shortcode) {
             echo $output;
         }
         essb_resource_builder()->add_js(ESSBResourceBuilderSnippets::js_build_generate_bottombar_reveal_code(), true, 'essb-bottombar-code');
     }
     if ($is_shortcode) {
         return $output;
     }
 }