Plugin Directory

Changeset 1805029


Ignore:
Timestamp:
01/18/2018 09:50:18 AM (7 years ago)
Author:
JorgeAmVF
Message:

brand new shortcodes, better code formatting, better-formed instructions, version alignment, minor fixes and update

Location:
autometa/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • autometa/trunk/autometa.php

    r1505578 r1805029  
    22/*
    33* Plugin Name: autometa
    4 * Description: It reproduces metadata information and it generates taxonomy clouds to publications simply via shortcodes.
    5 * Version: 1.1
     4* Description: It reproduces metadata information and it generates taxonomy clouds and comment and search forms to publications simply via shortcodes.
     5* Version: 2.2
    66* Author: JorgeAmVF
    77* Author URI: https://profiles.wordpress.org/jorgeamvf/
     
    2626*/
    2727
     28// [titul] = publication title
     29function autometa_publication_title() {
     30    $am_titul = '<span id="titul" class="autometa">' . get_the_title() . '</span>';
     31    return $am_titul;
     32}
     33add_shortcode( "titul", "autometa_publication_title" );
     34
     35// [titulink] = publication link
     36function autometa_publication_link() {
     37    $am_titulink = '<span id="titulink" class="autometa"><a href="' . get_permalink() . '">' . get_the_title() . '</a></span>';
     38    return $am_titulink;
     39}
     40add_shortcode( "titulink", "autometa_publication_link" );
     41
    2842// [autua] = author name
    29 function autometa_author_name(){
    30 $autometasauthorname= get_the_author();
    31  return $autometasauthorname;
    32 }
    33 add_shortcode("autua", "autometa_author_name");
    34 
    35 // [titul] = title
    36 function autometa_publication_title(){
    37 $autometaspublicationtitle= get_the_title();
    38  return $autometaspublicationtitle;
    39 }
    40 add_shortcode("titul", "autometa_publication_title");
    41 
    42 // [dated] = date
    43 function autometa_publication_date(){
    44 $autometaspublicationdate= get_the_date();
    45  return $autometaspublicationdate;
    46 }
    47 add_shortcode("dated","autometa_publication_date");
    48 
    49 // [sumus] = excerpt
    50 function autometa_excerpt() {
    51 $autometasexcerpt= get_the_excerpt();
    52  return $autometasexcerpt;
    53 }
    54 add_shortcode("sumus", "autometa_excerpt");
    55 
    56 // [urlug] = slug
    57 function autometa_slug(){
    58 $autometasslug= get_permalink();
    59  return $autometasslug;
    60 }
    61 add_shortcode("urlug", "autometa_slug");
    62 
    63 // [urlink] = permalink
    64 function autometa_permalink(){
    65 $autometaslink= get_post_permalink();
    66  return $autometaslink;
    67 }
    68 add_shortcode("urlink", "autometa_permalink");
    69 
    70 // [cats] = categories (post)
    71 function autometa_post_categories ( $atts, $content = null ) {
    72 global $post;
    73 $autometascategories = get_the_category_list( $separator = ' ', $post->ID );
    74  return '<div id="cats" class="autometa">' . $autometascategories . '</div>';
    75 }
    76 add_shortcode("cats", "autometa_post_categories");
    77 
    78 // [tags] = tags (post)
    79 function autometa_post_tags ( $atts, $content = null ) {
    80 global $post;
    81 $autometastags = get_the_term_list( $post->ID, 'post_tag', $separator = ' ' );
    82  return '<div id="tags" class="autometa">' . $autometastags . '</div>';
    83 }
    84 add_shortcode("tags", "autometa_post_tags");
    85 
    86 // [catag] = categories & tags (post)
    87 function autometa_post_taxonomy ( $echo = false ) {
    88  if (function_exists('wp_tag_cloud'))
    89   return wp_tag_cloud( array( 'number' => 999, 'orderby' => 'count', 'order' => 'RAND', 'taxonomy' => array( 'post_tag', 'category' ), ) );
    90 }
    91 add_shortcode("catag", "autometa_post_taxonomy");
    92 
    93 // [pfcats] = categories (portfolio)
    94 function autometa_portfolio_categories ( $atts, $content = null ) {
    95 global $post;
    96 $autometasportfoliocategories = get_the_term_list( $post->ID, 'project-categories', $separator = ' ' );
    97  return '<div id="pfcats" class="autometa">' . $autometasportfoliocategories . '</div>';
     43function autometa_author_name() {
     44    $am_autua = '<span id="autua" class="autometa">' . get_the_author() . '</span>';
     45    return $am_autua;
     46}
     47add_shortcode( "autua", "autometa_author_name" );
     48
     49// [autualink] = author link
     50function autometa_author_link() {
     51    $am_autualink = '<span id="autualink" class="autometa">' . get_the_author_link() . '</span>';
     52    return $am_autualink;
     53}
     54add_shortcode( "autualink", "autometa_author_link" );
     55
     56// [autuaguest] = guest link
     57function autometa_guest_link() {
     58    $am_autuaguest = '<span id="autuaguest" class="autometa">' . get_the_author_posts_link() . '</span>';
     59    return $am_autuaguest;
     60}
     61add_shortcode( "autuaguest", "autometa_guest_link" );
     62
     63// [dated] = publication date
     64function autometa_publication_date() {
     65    $am_dated = '<span id="dated" class="autometa">' . get_the_date() . '</span>';
     66    return $am_dated;
     67}
     68add_shortcode( "dated", "autometa_publication_date" );
     69
     70// [urlug] = URL slug
     71function autometa_url_slug() {
     72    $am_urlug = '<span id="urlug" class="autometa">' . get_permalink() . '</span>';
     73    return $am_urlug;
     74}
     75add_shortcode( "urlug", "autometa_url_slug" );
     76
     77// [urlink] = URL permalink
     78function autometa_url_permalink() {
     79    $am_urlink = '<span id="urlink" class="autometa">' . get_post_permalink() . '</span>';
     80    return $am_urlink;
     81}
     82add_shortcode( "urlink", "autometa_url_permalink" );
     83
     84// [urlinked] = URL link
     85function autometa_url_link() {
     86    $am_urlinked = '<span id="urlinked" class="autometa"><a href="' . get_permalink() . '">' . get_permalink() . '</a></span>';
     87    return $am_urlinked;
     88}
     89add_shortcode( "urlinked", "autometa_url_link" );
     90
     91// [thumb] = featured image
     92function autometa_featured_image() {
     93    $am_thumb = '<span id="thumb" class="autometa">' . get_the_post_thumbnail() . '</span>';
     94    return $am_thumb;
     95}
     96add_shortcode( "thumb", "autometa_featured_image" );
     97
     98// [sumus] = publication excerpt
     99function autometa_publication_excerpt() {
     100    $am_sumus = '<span id="sumus" class="autometa">' . get_the_excerpt() . '</span>';
     101    return $am_sumus;
     102}
     103add_shortcode( "sumus", "autometa_publication_excerpt" );
     104
     105// [cats] = (post) categories
     106function autometa_post_categories( $atts, $content = null ) {
     107    global $post;
     108    $am_cats = '<span id="cats" class="autometa">' .get_the_category_list( $separator = ' ', $post->ID ) . '</span>';
     109    return $am_cats;
     110}
     111add_shortcode( "cats", "autometa_post_categories" );
     112
     113// [tags] = (post) tags
     114function autometa_post_tags( $atts, $content = null ) {
     115    global $post;
     116    $am_tags = '<span id="tags" class="autometa">' . get_the_term_list( $post->ID, 'post_tag', $separator = ' ' ) . '</span>';
     117    return $am_tags;
     118}
     119add_shortcode( "tags", "autometa_post_tags" );
     120
     121// [catag] = (post) categories & tags
     122function autometa_post_taxonomies( $echo = false ) {
     123    if ( function_exists( 'wp_tag_cloud') )
     124        $am_catag  = '<span id="catag" class="autometa">' . wp_tag_cloud( array(
     125            'number' => 0,
     126            'orderby' => 'count',
     127            'order' => 'RAND',
     128            'taxonomy' => array(
     129                'post_tag',
     130                'category'
     131            ),
     132        ) ) . '</span>';
     133    return $am_catag;
     134}
     135add_shortcode( "catag", "autometa_post_taxonomies" );
     136
     137// [pfcats] = (portfolio) categories
     138function autometa_portfolio_categories( $atts, $content = null ) {
     139    global $post;
     140    $am_pfcats = '<span id="pfcats" class="autometa">' . get_the_term_list( $post->ID, 'project-type', $separator = ' ' ) . '</span>';
     141    return $am_pfcats;
    98142}
    99143add_shortcode( "pfcats", "autometa_portfolio_categories" );
    100144
    101 // [pfatts] = attributes (portfolio)
     145// [pfatts] = (portfolio) attributes
    102146function autometa_portfolio_attributes ( $atts, $content = null ) {
    103 global $post;
    104 $autometasportfolioattributes = get_the_term_list( $post->ID, 'project-attributes', $separator = ' ' );
    105  return '<div id="pfatts" class="autometa">' . $autometasportfolioattributes . '</div>';
     147    global $post;
     148    $am_pfatts = '<span id="pfatts" class="autometa">' . get_the_term_list( $post->ID, 'project-attributes', $separator = ' ' ) . '</span>';
     149    return $am_pfatts;
    106150}
    107151add_shortcode( "pfatts", "autometa_portfolio_attributes" );
    108152
    109 // [folio] = categories & tags
    110 function autometa_portfolio_taxonomy ( $echo = false ) {
    111  if (function_exists('wp_tag_cloud'))
    112   return wp_tag_cloud( array( 'number' => 0, 'orderby' => 'count', 'order' => 'RAND', 'taxonomy' => array( 'project-categories', 'project_attributes' ), ) );
    113 }
    114 add_shortcode("folio", "autometa_portfolio_taxonomy");
    115 
    116 // [woocats] = categories (product)
    117 function autometa_product_categories ( $atts, $content = null ) {
    118 global $post;
    119 $autometasproductcategories = get_the_term_list( $post->ID, 'product_cat', $separator = ' ' );
    120  return '<div id="woocats" class="autometa">' . $autometasproductcategories . '</div>';
     153// [folio] = (portfolio) categories & attributes
     154function autometa_portfolio_taxonomies ( $echo = false ) {
     155    if ( function_exists( 'wp_tag_cloud' ) )
     156        $am_folio = '<span id="folio" class="autometa">' . wp_tag_cloud( array(
     157            'number' => 0,
     158            'orderby' => 'count',
     159            'order' => 'RAND',
     160            'taxonomy' => array(
     161                'project-type',
     162                'project-attributes'
     163            ),
     164        ) ) . '</span>';
     165    return $am_folio;
     166}
     167add_shortcode( "folio", "autometa_portfolio_taxonomies" );
     168
     169// [woocats] = (product) categories
     170function autometa_product_categories( $atts, $content = null ) {
     171    global $post;
     172    $am_woocats = '<span id="woocats" class="autometa">' . get_the_term_list( $post->ID, 'product_cat', $separator = ' ' ) . '</span>';
     173    return $am_woocats;
    121174}
    122175add_shortcode( "woocats", "autometa_product_categories" );
    123176
    124 // [wootags] = tags (product)
    125 function autometa_product_tags ( $atts, $content = null ) {
    126 global $post;
    127 $autometasproducttags = get_the_term_list( $post->ID, 'product_tag', $separator = ' ' );
    128  return '<div id="wootags" class="autometa">' . $autometasproducttags . '</div>';
     177// [wootags] = (product) tags
     178function autometa_product_tags( $atts, $content = null ) {
     179    global $post;
     180    $am_wootags = '<span id="woocats" class="autometa">' . get_the_term_list( $post->ID, 'product_tag', $separator = ' ' ) . '</span>';
     181    return $am_wootags;
    129182}
    130183add_shortcode( "wootags", "autometa_product_tags" );
    131184
    132 // [woodo] = categories & tags (product)
    133 function autometa_product_taxonomy ( $echo = false ) {
    134  if (function_exists('wp_tag_cloud'))
    135   return wp_tag_cloud( array( 'number' => 0, 'orderby' => 'count', 'order' => 'RAND', 'taxonomy' => array( 'product_tag', 'product_cat' ), ) );
    136 }
    137 add_shortcode("woodo", "autometa_product_taxonomy");
     185// [woodo] = (product) categories & tags
     186function autometa_product_taxonomies( $echo = false ) {
     187    if ( function_exists( 'wp_tag_cloud' ) )
     188         $am_woodoo = '<span id="woodo" class="autometa">' . wp_tag_cloud( array(
     189            'number' => 0,
     190            'orderby' => 'count',
     191            'order' => 'RAND',
     192            'taxonomy' => array(
     193                'product_tag',
     194                'product_cat'
     195            ),
     196         ) ) . '</span>';
     197    return $am_woodo;
     198}
     199add_shortcode( "woodo", "autometa_product_taxonomies" );
     200
     201// [tagcloud] = categories & tags (post, product, portfolio)
     202function autometa_taxonomy_cloud( $echo = false ) {
     203    if ( function_exists( 'wp_tag_cloud' ) )
     204        $am_tagcloud = '<span id="tagcloud" class="autometa">' . wp_tag_cloud( array(
     205              'number' => 0,
     206              'orderby' => 'count',
     207              'order' => 'RAND',
     208              'taxonomy' => array(
     209                  'post_tag',
     210                  'category',
     211                  'project-type',
     212                  'project-attributes',
     213                  'product_tag',
     214                  'product_cat'
     215              ),
     216          ) ) . '</span>';
     217    return $am_tagcloud;
     218}
     219add_shortcode( "tagcloud", "autometa_taxonomy_cloud" );
     220
     221// [cloud] = categories & tags (post, product, portfolio)
     222function autometa_cloud( $echo = false ) {
     223    if ( function_exists( 'wp_tag_cloud' ) )
     224        $am_cloud = '<span id="cloud" class="autometa">' . wp_tag_cloud( array(
     225            'number' => 49,
     226            'orderby' => 'count',
     227            'order' => 'RAND',
     228            'taxonomy' => array(
     229                'post_tag',
     230                'category',
     231                'project-type',
     232                'project-attributes',
     233                'product_tag',
     234                'product_cat'
     235            ),
     236        ) ) . '</span>';
     237    return $am_cloud;
     238}
     239add_shortcode( "cloud", "autometa_cloud" );
     240
     241// [ments] = comment list
     242function autometa_comment_list( $args, $comments ) {
     243    $comments = get_comments( array(
     244        'order' => 'ASC',
     245        'status' => 'approve'
     246    ) );
     247    $am_ments = '<span id="ments" class="autometa">' . wp_list_comments( array(
     248        'walker' => new autometa_ments_Walker_Comment(),
     249        'echo' => 1,
     250        'per_page' => 0,
     251        'type' => 'comment'
     252    ),
     253        $comments
     254    ) . '</span>';
     255    return wp_list_comments();
     256}
     257add_shortcode( "ments", "autometa_comment_list" );
     258
     259// [recents] = recent list
     260function autometa_recent_list( $args, $comments ) {
     261    $comments = get_comments( array(
     262        'order' => 'DESC',
     263        'status' => 'approve'
     264    ) );
     265    $am_recents = '<span id="recents" class="autometa">' . wp_list_comments( array(
     266        'walker' => new autometa_ments_Walker_Comment(),
     267        'echo' => 1,
     268        'per_page' => 3,
     269        'reverse_top_level' => 0,
     270        'type' => 'comment'
     271    ),
     272         $comments
     273    ) . '</span>';
     274    return $am_recents;
     275}
     276add_shortcode( "recents", "autometa_recent_list" );
     277
     278/**
     279 * Comment API: Walker_Comment class
     280 *
     281 * @package WordPress
     282 * @subpackage Comments
     283 * @since 4.4.0
     284 */
     285
     286/**
     287 * Core walker class used to create an HTML list of comments.
     288 *
     289 * @since 2.7.0
     290 *
     291 * @see Walker
     292 */
     293class autometa_ments_Walker_Comment extends Walker {
     294
     295    /**
     296     * What the class handles.
     297     *
     298     * @since 2.7.0
     299     * @access public
     300     * @var string
     301     *
     302     * @see Walker::$tree_type
     303     */
     304    public $tree_type = 'comment';
     305
     306    /**
     307     * Database fields to use.
     308     *
     309     * @since 2.7.0
     310     * @access public
     311     * @var array
     312     *
     313     * @see Walker::$db_fields
     314     * @todo Decouple this
     315     */
     316    public $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID');
     317
     318    /**
     319     * Starts the list before the elements are added.
     320     *
     321     * @since 2.7.0
     322     * @access public
     323     *
     324     * @see Walker::start_lvl()
     325     * @global int $comment_depth
     326     *
     327     * @param string $output Passed by reference. Used to append additional content.
     328     * @param int    $depth  Optional. Depth of the current comment. Default 0.
     329     * @param array  $args   Optional. Uses 'style' argument for type of HTML list. Default empty array.
     330     */
     331    public function start_lvl( &$output, $depth = 0, $args = array() ) {
     332        $GLOBALS['comment_depth'] = $depth + 1;
     333
     334        switch ( $args['style'] ) {
     335            case 'div':
     336                break;
     337            case 'ol':
     338                $output .= '<ol class="children">' . "\n";
     339                break;
     340            case 'ul':
     341            default:
     342                $output .= '<ul class="children">' . "\n";
     343                break;
     344        }
     345    }
     346
     347    /**
     348     * Ends the list of items after the elements are added.
     349     *
     350     * @since 2.7.0
     351     * @access public
     352     *
     353     * @see Walker::end_lvl()
     354     * @global int $comment_depth
     355     *
     356     * @param string $output Passed by reference. Used to append additional content.
     357     * @param int    $depth  Optional. Depth of the current comment. Default 0.
     358     * @param array  $args   Optional. Will only append content if style argument value is 'ol' or 'ul'.
     359     *                       Default empty array.
     360     */
     361    public function end_lvl( &$output, $depth = 0, $args = array() ) {
     362        $GLOBALS['comment_depth'] = $depth + 1;
     363
     364        switch ( $args['style'] ) {
     365            case 'div':
     366                break;
     367            case 'ol':
     368                $output .= "</ol><!-- .children -->\n";
     369                break;
     370            case 'ul':
     371            default:
     372                $output .= "</ul><!-- .children -->\n";
     373                break;
     374        }
     375    }
     376
     377    /**
     378     * Traverses elements to create list from elements.
     379     *
     380     * This function is designed to enhance Walker::display_element() to
     381     * display children of higher nesting levels than selected inline on
     382     * the highest depth level displayed. This prevents them being orphaned
     383     * at the end of the comment list.
     384     *
     385     * Example: max_depth = 2, with 5 levels of nested content.
     386     *     1
     387     *      1.1
     388     *        1.1.1
     389     *        1.1.1.1
     390     *        1.1.1.1.1
     391     *        1.1.2
     392     *        1.1.2.1
     393     *     2
     394     *      2.2
     395     *
     396     * @since 2.7.0
     397     * @access public
     398     *
     399     * @see Walker::display_element()
     400     * @see wp_list_comments()
     401     *
     402     * @param WP_Comment $element           Comment data object.
     403     * @param array      $children_elements List of elements to continue traversing. Passed by reference.
     404     * @param int        $max_depth         Max depth to traverse.
     405     * @param int        $depth             Depth of the current element.
     406     * @param array      $args              An array of arguments.
     407     * @param string     $output            Used to append additional content. Passed by reference.
     408     */
     409    public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
     410        if ( !$element )
     411            return;
     412
     413        $id_field = $this->db_fields['id'];
     414        $id = $element->$id_field;
     415
     416        parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
     417
     418        /*
     419         * If at the max depth, and the current element still has children, loop over those
     420         * and display them at this level. This is to prevent them being orphaned to the end
     421         * of the list.
     422         */
     423        if ( $max_depth <= $depth + 1 && isset( $children_elements[$id]) ) {
     424            foreach ( $children_elements[ $id ] as $child )
     425                $this->display_element( $child, $children_elements, $max_depth, $depth, $args, $output );
     426
     427            unset( $children_elements[ $id ] );
     428        }
     429
     430    }
     431
     432    /**
     433     * Starts the element output.
     434     *
     435     * @since 2.7.0
     436     * @access public
     437     *
     438     * @see Walker::start_el()
     439     * @see wp_list_comments()
     440     * @global int        $comment_depth
     441     * @global WP_Comment $comment
     442     *
     443     * @param string     $output  Used to append additional content. Passed by reference.
     444     * @param WP_Comment $comment Comment data object.
     445     * @param int        $depth   Optional. Depth of the current comment in reference to parents. Default 0.
     446     * @param array      $args    Optional. An array of arguments. Default empty array.
     447     * @param int        $id      Optional. ID of the current comment. Default 0 (unused).
     448     */
     449    public function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) {
     450        $depth++;
     451        $GLOBALS['comment_depth'] = $depth;
     452        $GLOBALS['comment'] = $comment;
     453
     454        if ( !empty( $args['callback'] ) ) {
     455            ob_start();
     456            call_user_func( $args['callback'], $comment, $args, $depth );
     457            $output .= ob_get_clean();
     458            return;
     459        }
     460
     461        if ( ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) && $args['short_ping'] ) {
     462            ob_start();
     463            $this->ping( $comment, $depth, $args );
     464            $output .= ob_get_clean();
     465        } elseif ( 'html5' === $args['format'] ) {
     466            ob_start();
     467            $this->html5_comment( $comment, $depth, $args );
     468            $output .= ob_get_clean();
     469        } else {
     470            ob_start();
     471            $this->comment( $comment, $depth, $args );
     472            $output .= ob_get_clean();
     473        }
     474    }
     475
     476    /**
     477     * Ends the element output, if needed.
     478     *
     479     * @since 2.7.0
     480     * @access public
     481     *
     482     * @see Walker::end_el()
     483     * @see wp_list_comments()
     484     *
     485     * @param string     $output  Used to append additional content. Passed by reference.
     486     * @param WP_Comment $comment The current comment object. Default current comment.
     487     * @param int        $depth   Optional. Depth of the current comment. Default 0.
     488     * @param array      $args    Optional. An array of arguments. Default empty array.
     489     */
     490    public function end_el( &$output, $comment, $depth = 0, $args = array() ) {
     491        if ( !empty( $args['end-callback'] ) ) {
     492            ob_start();
     493            call_user_func( $args['end-callback'], $comment, $args, $depth );
     494            $output .= ob_get_clean();
     495            return;
     496        }
     497        if ( 'div' == $args['style'] )
     498            $output .= "</div><!-- #comment-## -->\n";
     499        else
     500            $output .= "</li><!-- #comment-## -->\n";
     501    }
     502
     503    /**
     504     * Outputs a pingback comment.
     505     *
     506     * @since 3.6.0
     507     * @access protected
     508     *
     509     * @see wp_list_comments()
     510     *
     511     * @param WP_Comment $comment The comment object.
     512     * @param int        $depth   Depth of the current comment.
     513     * @param array      $args    An array of arguments.
     514     */
     515    protected function ping( $comment, $depth, $args ) {
     516        $tag = ( 'div' == $args['style'] ) ? 'div' : 'li';
     517?>
     518        <<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( '', $comment ); ?>>
     519            <div class="comment-body">
     520                <?php _e( 'Pingback:' ); ?> <?php comment_author_link( $comment ); ?> <?php edit_comment_link( __( 'Edit' ), '<span class="edit-link">', '</span>' ); ?>
     521            </div>
     522<?php
     523    }
     524
     525    /**
     526     * Outputs a single comment.
     527     *
     528     * @since 3.6.0
     529     * @access protected
     530     *
     531     * @see wp_list_comments()
     532     *
     533     * @param WP_Comment $comment Comment to display.
     534     * @param int        $depth   Depth of the current comment.
     535     * @param array      $args    An array of arguments.
     536     */
     537    protected function comment( $comment, $depth, $args ) {
     538        if ( 'div' == $args['style'] ) {
     539            $tag = 'div';
     540            $add_below = 'comment';
     541        } else {
     542            $tag = 'li';
     543            $add_below = 'div-comment';
     544        }
     545?>
     546        <<?php echo $tag; ?> <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?> id="comment-<?php comment_ID(); ?>">
     547        <?php if ( 'div' != $args['style'] ) : ?>
     548        <div id="div-comment-<?php comment_ID(); ?>" class="comment-body">
     549        <?php endif; ?>
     550        <div class="comment-author vcard">
     551            <?php if ( 0 != $args['avatar_size'] ) echo get_avatar( $comment, $args['avatar_size'] ); ?>
     552            <?php
     553                /* translators: %1$s is type of comment, %2$s is link to the post */
     554                printf( __( '%1s on %2$s' ),
     555                    sprintf( '<cite class="fn"><b>%1s</b></cite>', get_comment_author_link( $comment ) ),
     556                    sprintf( '<a href="' . get_comment_link() . '"><b><i>%2s</i></b></a>', get_the_title( $comment->comment_post_ID ) )
     557                );
     558            ?>
     559        </div>
     560        <?php if ( '0' == $comment->comment_approved ) : ?>
     561        <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ) ?></em>
     562        <br />
     563        <?php endif; ?>
     564
     565        <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment, $args ) ); ?>">
     566            <?php
     567                /* translators: 1: comment date, 2: comment time */
     568                printf( __( '%1$s at %2$s' ), get_comment_date( '', $comment ),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)' ), '&nbsp;&nbsp;', '' );
     569            ?>
     570        </div>
     571
     572        <?php comment_text( $comment, array_merge( $args, array( 'add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
     573
     574        <?php
     575        comment_reply_link( array_merge( $args, array(
     576            'add_below' => $add_below,
     577            'depth'     => $depth,
     578            'max_depth' => $args['max_depth'],
     579            'before'    => '<div class="reply">',
     580            'after'     => '</div>'
     581        ) ) );
     582        ?>
     583
     584        <?php if ( 'div' != $args['style'] ) : ?>
     585        </div>
     586        <?php endif; ?>
     587<?php
     588    }
     589
     590    /**
     591     * Outputs a comment in the HTML5 format.
     592     *
     593     * @since 3.6.0
     594     * @access protected
     595     *
     596     * @see wp_list_comments()
     597     *
     598     * @param WP_Comment $comment Comment to display.
     599     * @param int        $depth   Depth of the current comment.
     600     * @param array      $args    An array of arguments.
     601     */
     602    protected function html5_comment( $comment, $depth, $args ) {
     603        $tag = ( 'div' === $args['style'] ) ? 'div' : 'li';
     604?>
     605        <<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?>>
     606            <article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
     607                <footer class="comment-meta">
     608                    <div class="comment-author vcard">
     609                        <?php if ( 0 != $args['avatar_size'] ) echo get_avatar( $comment, $args['avatar_size'] ); ?>
     610            <?php
     611                /* translators: %1$s is type of comment, %2$s is link to the post */
     612                printf( __( '%1s on %2$s' ),
     613                    sprintf( '<cite class="fn"><b>%1s</b></cite>', get_comment_author_link( $comment ) ),
     614                    sprintf( '<a href="' . get_comment_link() . '"><b><i>%2s</i>/<b></a>', get_the_title( $comment->comment_post_ID ) )
     615                );
     616            ?>
     617                    </div><!-- .comment-author -->
     618
     619                    <div class="comment-metadata">
     620                        <a href="<?php echo esc_url( get_comment_link( $comment, $args ) ); ?>">
     621                            <time datetime="<?php comment_time( 'c' ); ?>">
     622                                <?php
     623                                    /* translators: 1: comment date, 2: comment time */
     624                                    printf( __( '%1$s at %2$s' ), get_comment_date( '', $comment ), get_comment_time() );
     625                                ?>
     626                            </time>
     627                        </a>
     628                        <?php edit_comment_link( __( 'Edit' ), '<span class="edit-link">', '</span>' ); ?>
     629                    </div><!-- .comment-metadata -->
     630
     631                    <?php if ( '0' == $comment->comment_approved ) : ?>
     632                    <p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ); ?></p>
     633                    <?php endif; ?>
     634                </footer><!-- .comment-meta -->
     635
     636                <div class="comment-content">
     637                    <?php comment_text(); ?>
     638                </div><!-- .comment-content -->
     639
     640                <?php
     641                comment_reply_link( array_merge( $args, array(
     642                    'add_below' => 'div-comment',
     643                    'depth'     => $depth,
     644                    'max_depth' => $args['max_depth'],
     645                    'before'    => '<div class="reply">',
     646                    'after'     => '</div>'
     647                ) ) );
     648                ?>
     649            </article><!-- .comment-body -->
     650<?php
     651    }
     652}
     653
     654// [forma] = comment form
     655function autometa_comment_form( $args, $post_id ) {
     656    $post_id = get_the_ID();
     657    $am_forma = '<span id="forma" class="autometa">' . comment_form() . '</span>';
     658    return $am_forma;
     659}
     660add_shortcode( "forma", "autometa_comment_form" );
     661
     662// [loupe] = search form
     663function autometa_search_form() {
     664    $am_loupe = '<span id="loupe" class="autometa">' . get_search_form() . '</span>';   
     665    return $am_loupe;
     666}
     667add_shortcode( "loupe", "autometa_search_form" );
    138668
    139669// [nowon] = current time
    140 function autometa_current_time(){
    141 $autometascurrenttime = current_time('H:i:s');
    142  return $autometascurrenttime;
    143 }
    144 add_shortcode("nowon", "autometa_current_time");
     670function autometa_current_time() {
     671    $am_nowon = current_time( 'H:i:s' );
     672    return $am_nowon;
     673}
     674add_shortcode( "nowon", "autometa_current_time" );
    145675
    146676// [nowadays] = current date
    147 function autometa_current_date(){
    148 $autometascurrentdate = current_time('d M Y');
    149  return $autometascurrentdate;
    150 }
    151 add_shortcode("nowadays", "autometa_current_date");
     677function autometa_current_date() {
     678    $am_nowadays = current_time( 'd M Y' );
     679    return $am_nowadays;
     680}
     681add_shortcode( "nowadays", "autometa_current_date" );
    152682?>
  • autometa/trunk/readme.txt

    r1701009 r1805029  
    22Contributors: JorgeAmVF
    33Donate link: https://quaestio.org/
    4 Tags: shortcode, automation, metadata, taxonomy, cloud, author, title, date, excerpt, slug, permalink, category, tag, attribute, woocommerce, current-time, current-date
    5 Requires at least: 3.0.0
    6 Tested up to: 4.8
     4Tags: shortcode, automation, metadata, publication, author, url, date, thumbnail, taxonomy, comment, search, time
     5Requires at least: 4.4.0
     6Tested up to: 4.9.2
    77Stable Tag: trunk
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 It reproduces metadata information and it generates taxonomy clouds to publications simply via shortcodes.
     11It reproduces metadata information and it generates taxonomy clouds and comment and search forms to publications simply via shortcodes.
    1212== Description ==
    1313
    14 <strong>autometa</strong> is a simple plugin that uses the following shortcodes:
     14**autometa** is a complete plugin that uses the following shortcodes:
    1515
    16 * `[autua]`    = to reproduce the publication author;
    17 * `[titul]`    = to reproduce the publication title;
    18 * `[dated]`    = to reproduce the publication date;
    19 * `[sumus]`    = to reproduce the publication excerpt;
    20 * `[urlug]`    = to reproduce the publication slug;
    21 * `[urlink]`   = to reproduce the publication permalink;
    22 * `[cats]`     = to reproduce the categories of a post;
    23 * `[tags]`     = to reproduce the tags of a post;
    24 * `[catag]`    = to generate a taxonomy cloud mixing categories and tags of posts;
    25 * `[pfcats]`   = to reproduce the categories of a portfolio;
    26 * `[pfatts]`   = to reproduce the tags of a portfolio;
    27 * `[folio]`    = to generate a taxonomy cloud mixing categories and attributes of portfolios;
    28 * `[woocats]`  = to reproduce the categories of a product;
    29 * `[wootags]`  = to reproduce the tags of a product;
    30 * `[woodo]`    = to generate a taxonomy cloud mixing categories and tags of products;
    31 * `[nowon]`    = to generate the current time;
    32 * `[nowadays]` = to generate the current date.
     16* `[titul]` ........ to reproduce the publication title;
     17* `[tiitulink]` .... to reproduce the publication link;
     18* `[autua]` ........ to reproduce the author name;
     19* `[autualink]` .... to reproduce the author link;
     20* `[autuaguest]` ... to reproduce the guest link;
     21* `[dated]` ........ to reproduce the publication date;
     22* `[urlug]` ........ to reproduce the URL slug;
     23* `[urlink]` ....... to reproduce the URL permalink;
     24* `[urlinked]` ..... to reproduce the URL link;
     25* `[thumb]` ........ to reproduce the featured image;
     26* `[sumus]` ........ to reproduce the publication excerpt;
     27* `[cats]` ......... to reproduce post categories;
     28* `[tags]` ......... to reproduce post tags;
     29* `[catag]` ........ to generate a post taxonomies cloud;
     30* `[pfcats]` ....... to reproduce portfolio categories;
     31* `[pfatts]` ....... to reproduce portfolio attributes;
     32* `[folio]` ........ to generate a portfolio taxonomies cloud;
     33* `[woocats]` ...... to reproduce product categories;
     34* `[wootags]` ...... to reproduce product tags;
     35* `[woodo]` ........ to generate a product taxonomies cloud;
     36* `[tagcloud]` ..... to generate a full mixed taxonomies cloud;
     37* `[cloud]` ........ to generate a mixed taxonomies cloud;
     38* `[ments]` ........ to reproduce all comments;
     39* `[recents]` ...... to reproduce recents comments;
     40* `[forma]` ........ to generate a comment form;
     41* `[loupe]` ........ to generate a search form;
     42* `[nowon]` ........ to generate the current time;
     43* `[nowadays]` ..... to generate the current date.
    3344
    34 <strong>autometa</strong> is a plugin set composed by standalone elements: [AUTUA](https://wordpress.org/plugins/autua/), [TITUL](https://wordpress.org/plugins/titul/), [DATED](https://wordpress.org/plugins/dated/), [SUMUS](https://wordpress.org/plugins/sumus/), [URLUG](https://wordpress.org/plugins/urlug/), [CATAG](https://wordpress.org/plugins/catag/), [FOLIO](https://wordpress.org/plugins/folio/), [WOODO](https://wordpress.org/plugins/woodo/), [NOWON](https://wordpress.org/plugins/nowon/).
     45**autometa** is a shortcode pack composed by standalone components: **[TITUL](https://wordpress.org/plugins/titul/)**, **[AUTUA](https://wordpress.org/plugins/autua/)**, **[DATED](https://wordpress.org/plugins/dated/)**, **[URLUG](https://wordpress.org/plugins/urlug/)**, **[THUMB](https://wordpress.org/plugins/thumb/)**, **[SUMUS](https://wordpress.org/plugins/sumus/)**, **[CATAG](https://wordpress.org/plugins/catag/)**, **[FOLIO](https://wordpress.org/plugins/folio/)**, **[WOODO](https://wordpress.org/plugins/woodo/)**, **[MENTS](https://wordpress.org/plugins/ments/)**, **[FORMA](https://wordpress.org/plugins/forma/)**, **[NOWON](https://wordpress.org/plugins/nowon/)**.
    3546
    3647== Installation ==
    3748
    38 1. Download it or install it to your plugin folder;
    39 2. Activate it from the plugin tab inside your dashboard;
    40 3. Write the following shortcodes in text fields: `[autua]`, `[titul]`, `[dated]`, `[sumus]`, `[urlug]`, `[urlink]`, `[cats]`, `[tags]`, `[catag]`, `[pfcats]`, `[pfatts]`, `[folio]`, `[woocats]`, `[wootags]`, `[woodo]`, `[nowon]`, `[nowadays]`.
     491. Install it from *Dashboard*/*Plugins*/*Add Plugins* or download it to your plugin folder;
     502. Activate it from *Dashboard*/*Plugins*/*Installed Plugins*;
     513. Write the following shortcodes in text fields: `[titul]`, `[titulink]`, `[autua]`, `[autualink]`, `[autuaguest]`, `[dated]`, `[urlug]`, `[urlink]`, `[urlinked]`, `[thumb]`, `[sumus]`, `[cats]`, `[tags]`, `[catag]`, `[pfcats]`, `[pfatts]`, `[folio]`, `[woocats]`, `[wootags]`, `[woodo]`, `[tagcloud]`, `[cloud]`, `[ments]`, `[recents]`, `[forma]`, `[loupe]`, `[nowon]`, `[nowadays]`.
    4152
    4253== Frequently Asked Questions ==
    4354
    44 = How does autometa work? =
     55= Plugin Features =
    4556
    46 [autometa](https://wordpress.org/plugins/autometa/) reproduces metadata information automatically via shorcodes and it was developed to improve the automation of [Quaestio.org](https://quaestio.org/).
     57**[autometa](https://wordpress.org/plugins/autometa/)** reproduces metadata information automatically via shorcodes and it was developed to improve the automation of [Quaestio.org](https://quaestio.org/).
    4758
    48 = What is needed to use autometa? =
     59= How To =
    4960
    50 Just write one or more of the following shortcodes inside a text field and between brackets as usual: `[autua]` and/or `[titul]` and/or `[dated]` and/or `[sumus]` and/or `[urlug]` and/or `[urlink]` and/or `[cats]` and/or `[tags]` and/or `[catag]` and/or `[pfcats]` and/or `[pfatts]` and/or `[folio]` and/or `[woocats]` and/or `[wootags]` and/or `[woodo]` and/or `[nowon]` and/or `[nowadays]`.
     61Just write one or more of the following shortcodes inside a text field and between brackets as usual: `[titul]` and/or `[titulink]` and/or `[autua]` and/or `[autualink]` and/or `[autuaguest]` and/or `[dated]` and/or `[urlug]` and/or `[urlink]` and/or `[urlinked]` and/or `[thumb]` and/or `[sumus]` and/or `[cats]` and/or `[tags]` and/or `[catag]` and/or `[pfcats]` and/or `[pfatts]` and/or `[folio]` and/or `[woocats]` and/or `[wootags]` and/or `[woodo]` and/or `[tagcloud]` and/or `[cloud]` and/or `[ments]` and/or `[recents]` and/or `[forma]` and/or `[loupe]` and/or `[nowon]` and/or `[nowadays]`.
    5162
    52 = Which functions are used by autometa? =
     63= CSS Style Selectors =
    5364
    54 These: [add_shortcode](https://codex.wordpress.org/Function_Reference/add_shortcode) and [get_the_author](https://codex.wordpress.org/Function_Reference/get_the_author) and [get_the_title](https://developer.wordpress.org/reference/functions/get_the_title/) and [get_the_date](https://codex.wordpress.org/Function_Reference/get_the_date) and [get_the_excerpt](https://codex.wordpress.org/Function_Reference/get_the_excerpt) and [get_permalink](https://developer.wordpress.org/reference/functions/get_permalink/) and [get_post_permalink](https://developer.wordpress.org/reference/functions/get_post_permalink/) and [get_the_category_list](https://codex.wordpress.org/Function_Reference/get_the_category_list) and [get_the_term_list](https://codex.wordpress.org/Function_Reference/get_the_term_list) and [wp_tag_cloud](https://codex.wordpress.org/Function_Reference/wp_tag_cloud) and [current_time](https://codex.wordpress.org/Function_Reference/current_time).
     65* `#titul`      = `[titul]` ID;
     66* `#titulink`   = `[titulink]` ID;
     67* `#autua`      = `[autua]` ID;
     68* `#autualink`  = `[autualink]` ID;
     69* `#autuaguest` = `[autuahuest]` ID;
     70* `#dated`      = `[dated]` ID;
     71* `#urlug`      = `[urlug]` ID;
     72* `#urlink`     = `[urlink]` ID;
     73* `#urlinked`   = `[urlinked]` ID;
     74* `#thumb`      = `[thumb]` ID;
     75* `#sumus`      = `[sumus]` ID;
     76* `#cats`       = `[cats]` ID;
     77* `#tags`       = `[tags]` ID;
     78* `#catag`      = `[catag]` ID;
     79* `#pfcats`     = `[pfcats]` ID;
     80* `#pfatts`     = `[pfatts]` ID;
     81* `#folio`      = `[folio]` ID;
     82* `#woocats`    = `[woocats]` ID;
     83* `#wootags`    = `[wootags]` ID;
     84* `#woodo`      = `[woodo]` ID;
     85* `#tagcloud`   = `[tagcloud]` ID;
     86* `#cloud`      = `[cloud]` ID;
     87* `#ments`      = `[ments]` ID;
     88* `#recents`    = `[recents]` ID;
     89* `#forma`      = `[forma]` ID;
     90* `#loupe`      = `[loupe]` ID;
     91* `#nowon`      = `[nowon]` ID;
     92* `#nowadays`   = `[nowadays]` ID;
     93* `.autometa`   = **autometa** class.
     94
     95= PHP Functions Reference =
     96
     97* [`add_shortcode()`](https://developer.wordpress.org/reference/functions/add_shortcode/)
     98* [`comment_form()`](https://developer.wordpress.org/reference/functions/comment_form/)
     99* [`current_time()`](https://developer.wordpress.org/reference/functions/current_time/)
     100* [`get_comment_author_link()`](https://developer.wordpress.org/reference/functions/get_comment_author_link/)
     101* [`get_comment_link()`](https://developer.wordpress.org/reference/functions/get_comment_link/)
     102* [`get_comments()`](https://developer.wordpress.org/reference/functions/get_comments/)
     103* [`get_permalink()`](https://developer.wordpress.org/reference/functions/get_permalink/)
     104* [`get_post_permalink()`](https://developer.wordpress.org/reference/functions/get_post_permalink/)
     105* [`get_search_form()`](https://developer.wordpress.org/reference/functions/get_search_form/)
     106* [`get_the_author()`](https://developer.wordpress.org/reference/functions/get_the_author/)
     107* [`get_the_author_link()`](https://developer.wordpress.org/reference/functions/get_the_author_link/)
     108* [`get_the_author_posts_link()`](https://developer.wordpress.org/reference/functions/get_the_author_posts_link/)
     109* [`get_the_category_list()`](https://developer.wordpress.org/reference/functions/get_the_category_list/)
     110* [`get_the_date()`](https://developer.wordpress.org/reference/functions/get_the_date/)
     111* [`get_the_excerpt()`](https://developer.wordpress.org/reference/functions/get_the_excerpt/)
     112* [`get_the_post_thumbnail()`](https://developer.wordpress.org/reference/functions/get_the_post-thumbnail/)
     113* [`get_the_term_list()`](https://developer.wordpress.org/reference/functions/get_the_term_list/)
     114* [`get_the_title()`](https://developer.wordpress.org/reference/functions/get_the_title/)
     115* [`Walker`](https://developer.wordpress.org/reference/classes/walker/)
     116* [`wp_list_comments()`](https://developer.wordpress.org/reference/functions/wp_list_comments/)
     117* [`wp_tag_cloud()`](https://developer.wordpress.org/reference/functions/wp_tag_cloud/)
Note: See TracChangeset for help on using the changeset viewer.