Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Comments Element
- * Adds a comment form to the page
- */
- // Don't load directly
- if ( !defined('ABSPATH') ) { die('-1'); }
- if ( !class_exists( 'avia_post_meta_info' ) )
- {
- class avia_post_meta_info extends aviaShortcodeTemplate{
- /**
- * Create the config array for the shortcode button
- */
- function shortcode_insert_button()
- {
- $this->config['name'] = __('Post Meta', 'avia_framework' );
- $this->config['tab'] = __('Content Elements', 'avia_framework' );
- $this->config['icon'] = AviaBuilder::$path['imagesURL']."sc-comments.png";
- $this->config['order'] = 28;
- $this->config['target'] = 'avia-target-insert';
- $this->config['shortcode'] = 'av_post_meta';
- $this->config['tinyMCE'] = array('disable' => "true");
- $this->config['tooltip'] = __('Add the post meta infos', 'avia_framework' );
- //$this->config['drag-level'] = 1;
- }
- /**
- * Editor Element - this function defines the visual appearance of an element on the AviaBuilder Canvas
- * Most common usage is to define some markup in the $params['innerHtml'] which is then inserted into the drag and drop container
- * Less often used: $params['data'] to add data attributes, $params['class'] to modify the className
- *
- *
- * @param array $params this array holds the default values for $content and $args.
- * @return $params the return array usually holds an innerHtml key that holds item specific markup.
- */
- function editor_element($params)
- {
- $params['innerHtml'] = "<img src='".$this->config['icon']."' title='".$this->config['name']."' />";
- $params['innerHtml'].= "<div class='avia-element-label'>".$this->config['name']."</div>";
- $params['content'] = NULL; //remove to allow content elements
- return $params;
- }
- /**
- * Frontend Shortcode Handler
- *
- * @param array $atts array of attributes
- * @param string $content text within enclosing form of shortcode element
- * @param string $shortcodename the shortcode found, when == callback name
- * @return string $output returns the modified html string
- */
- function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "")
- {
- $the_id = get_the_ID();
- $output = '<header class="entry-content-header">';
- $output .= "<span class='post-meta-infos'>";
- $markup = avia_markup_helper(array('context' => 'entry_time','echo'=>false));
- $output .= '<time class="date-container minor-meta updated" {$markup}>'.get_the_time(get_option('date_format'))."</time>";
- $output .= "<span class='text-sep text-sep-date'>/</span>";
- if ( get_comments_number() != "0" || comments_open() ){
- $output .= "<span class='comment-container minor-meta'>";
- ob_start();
- comments_popup_link( "0 ".__('Comments','avia_framework'),
- "1 ".__('Comment' ,'avia_framework'),
- "% ".__('Comments','avia_framework'),'comments-link',
- "".__('Comments Disabled','avia_framework'));
- $comment = ob_get_clean();
- $output .= $comment;
- $output .= "</span>";
- $output .= "<span class='text-sep text-sep-comment'>/</span>";
- }
- $taxonomies = get_object_taxonomies(get_post_type($the_id));
- $cats = '';
- $excluded_taxonomies = apply_filters('avf_exclude_taxonomies', array('post_tag','post_format'), get_post_type($the_id), $the_id);
- if(!empty($taxonomies))
- {
- foreach($taxonomies as $taxonomy)
- {
- if(!in_array($taxonomy, $excluded_taxonomies))
- {
- $cats .= get_the_term_list($the_id, $taxonomy, '', ', ','').' ';
- }
- }
- }
- if(!empty($cats))
- {
- $output .= '<span class="blog-categories minor-meta">'.__('in','avia_framework')." ";
- $output .= $cats;
- $output .= '</span><span class="text-sep text-sep-cat">/</span>';
- }
- $output .= '<span class="blog-author minor-meta">'.__('by','avia_framework')." ";
- $markup = avia_markup_helper(array('context' => 'author_name', 'echo'=>false));
- $output .= '<span class="entry-author-link" $markup>';
- $output .= '<span class="vcard author"><span class="fn">';
- ob_start();
- the_author_posts_link();
- $author = ob_get_clean();
- $output .= $author;
- $output .= '</span></span>';
- $output .= '</span>';
- $output .= '</span>';
- $output .= '</span>';
- $output .= '</header>';
- return $output;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement