PluginProbe
WP Ultimate Post Grid / 3.8.0
WP Ultimate Post Grid v3.8.0
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
wp-ultimate-post-grid / includes / public / class-wpupg-template-shortcode.php

class-wpupg-template-shortcode.php in WP Ultimate Post Grid 3.8.0, at includes/public/class-wpupg-template-shortcode.php

46 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Parent class for the template shortcodes.
4 *
5 * @link https://bootstrapped.ventures
6 * @since 3.0.0
7 *
8 * @package WP_Ultimate_Post_Grid
9 * @subpackage WP_Ultimate_Post_Grid/includes/public
10 */
11
12 /**
13 * Parent class for the template shortcodes.
14 *
15 * @since 3.0.0
16 * @package WP_Ultimate_Post_Grid
17 * @subpackage WP_Ultimate_Post_Grid/includes/public
18 * @author Brecht Vandersmissen <brecht@bootstrapped.ventures>
19 */
20 class WPUPG_Template_Shortcode {
21 public static $attributes = array();
22 public static $shortcode = '';
23
24 public static function init() {
25 $shortcode = static::$shortcode;
26
27 if ( $shortcode ) {
28 // Register shortcode in WordPress.
29 add_shortcode( $shortcode, array( get_called_class(), 'shortcode' ) );
30
31 // Add to list of all shortcodes.
32 WPUPG_Template_Shortcodes::$shortcodes[ $shortcode ] = static::$attributes;
33 }
34 }
35
36 public static function get_hook() {
37 return str_replace( '-', '_', static::$shortcode ) . '_shortcode';
38 }
39
40 protected static function get_attributes( $atts ) {
41 $atts = shortcode_atts( WPUPG_Template_Shortcodes::get_defaults( static::$shortcode ), $atts, str_replace( '-', '_', static::$shortcode ) );
42
43 return $atts;
44 }
45 }
46