Advertisement
Guest User

post_meta_infos.php

a guest
Sep 24th, 2015
1,098
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.24 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Comments Element
  4.  * Adds a comment form to the page
  5.  */
  6.  
  7. // Don't load directly
  8. if ( !defined('ABSPATH') ) { die('-1'); }
  9.  
  10.  
  11.  
  12. if ( !class_exists( 'avia_post_meta_info' ) )
  13. {
  14.     class avia_post_meta_info extends aviaShortcodeTemplate{
  15.            
  16.             /**
  17.              * Create the config array for the shortcode button
  18.              */
  19.             function shortcode_insert_button()
  20.             {
  21.                 $this->config['name']       = __('Post Meta', 'avia_framework' );
  22.                 $this->config['tab']        = __('Content Elements', 'avia_framework' );
  23.                 $this->config['icon']       = AviaBuilder::$path['imagesURL']."sc-comments.png";
  24.                 $this->config['order']      = 28;
  25.                 $this->config['target']     = 'avia-target-insert';
  26.                 $this->config['shortcode']  = 'av_post_meta';
  27.                 $this->config['tinyMCE']    = array('disable' => "true");
  28.                 $this->config['tooltip']    = __('Add the post meta infos', 'avia_framework' );
  29.                 //$this->config['drag-level'] = 1;
  30.             }
  31.            
  32.  
  33.              
  34.             /**
  35.              * Editor Element - this function defines the visual appearance of an element on the AviaBuilder Canvas
  36.              * Most common usage is to define some markup in the $params['innerHtml'] which is then inserted into the drag and drop container
  37.              * Less often used: $params['data'] to add data attributes, $params['class'] to modify the className
  38.              *
  39.              *
  40.              * @param array $params this array holds the default values for $content and $args.
  41.              * @return $params the return array usually holds an innerHtml key that holds item specific markup.
  42.              */
  43.             function editor_element($params)
  44.             {
  45.                 $params['innerHtml'] = "<img src='".$this->config['icon']."' title='".$this->config['name']."' />";
  46.                 $params['innerHtml'].= "<div class='avia-element-label'>".$this->config['name']."</div>";
  47.                 $params['content']   = NULL; //remove to allow content elements
  48.                 return $params;
  49.             }
  50.            
  51.             /**
  52.              * Frontend Shortcode Handler
  53.              *
  54.              * @param array $atts array of attributes
  55.              * @param string $content text within enclosing form of shortcode element
  56.              * @param string $shortcodename the shortcode found, when == callback name
  57.              * @return string $output returns the modified html string
  58.              */
  59.             function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "")
  60.             {
  61.                 $the_id = get_the_ID();
  62.                
  63.                 $output  = '<header class="entry-content-header">';
  64.                 $output .= "<span class='post-meta-infos'>";
  65.                 $markup  = avia_markup_helper(array('context' => 'entry_time','echo'=>false));
  66.                 $output .= '<time class="date-container minor-meta updated" {$markup}>'.get_the_time(get_option('date_format'))."</time>";
  67.                 $output .= "<span class='text-sep text-sep-date'>/</span>";
  68.  
  69.  
  70.  
  71.                     if ( get_comments_number() != "0" || comments_open() ){
  72.  
  73.                     $output .= "<span class='comment-container minor-meta'>";
  74.                     ob_start();
  75.                     comments_popup_link(  "0 ".__('Comments','avia_framework'),
  76.                                           "1 ".__('Comment' ,'avia_framework'),
  77.                                           "% ".__('Comments','avia_framework'),'comments-link',
  78.                                           "".__('Comments Disabled','avia_framework'));
  79.                                           $comment = ob_get_clean();
  80.                                           $output .= $comment;
  81.                     $output .= "</span>";
  82.                     $output .= "<span class='text-sep text-sep-comment'>/</span>";
  83.                     }
  84.  
  85.  
  86.                     $taxonomies  = get_object_taxonomies(get_post_type($the_id));
  87.                     $cats = '';
  88.                     $excluded_taxonomies =  apply_filters('avf_exclude_taxonomies', array('post_tag','post_format'), get_post_type($the_id), $the_id);
  89.  
  90.                     if(!empty($taxonomies))
  91.                     {
  92.                         foreach($taxonomies as $taxonomy)
  93.                         {
  94.                             if(!in_array($taxonomy, $excluded_taxonomies))
  95.                             {
  96.                                 $cats .= get_the_term_list($the_id, $taxonomy, '', ', ','').' ';
  97.                             }
  98.                         }
  99.                     }
  100.  
  101.                     if(!empty($cats))
  102.                     {
  103.                         $output .= '<span class="blog-categories minor-meta">'.__('in','avia_framework')." ";
  104.                         $output .= $cats;
  105.                         $output .= '</span><span class="text-sep text-sep-cat">/</span>';
  106.                     }
  107.  
  108.  
  109.                     $output .= '<span class="blog-author minor-meta">'.__('by','avia_framework')." ";
  110.                     $markup  = avia_markup_helper(array('context' => 'author_name', 'echo'=>false));
  111.                     $output .= '<span class="entry-author-link" $markup>';
  112.                     $output .= '<span class="vcard author"><span class="fn">';
  113.                     ob_start();
  114.                     the_author_posts_link();
  115.                     $author  = ob_get_clean();
  116.                     $output .= $author;
  117.                     $output .= '</span></span>';
  118.                     $output .= '</span>';
  119.                     $output .= '</span>';
  120.                 $output .= '</span>';
  121.                 $output .= '</header>';
  122.                
  123.                
  124.                 return $output;
  125.             }      
  126.            
  127.     }
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement