diff --git a/alienship-shortcodes.php b/alienship-shortcodes.php index 40d93b1..f6b3f6d 100755 --- a/alienship-shortcodes.php +++ b/alienship-shortcodes.php @@ -2,8 +2,8 @@ /* Plugin Name: Alien Ship Shortcodes Plugin URI: http://www.johnparris.com/wordpress-plugins/alienship-shortcodes/ -Description: Shortcodes for displaying Bootstrap elements in the Alien Ship theme -Version: 1.0.6 +Description: Shortcodes for displaying Bootstrap elements in the Alien Ship theme. It will work in other themes. It does not load the Bootstrap libraries. It assumes they're already provided by other means. +Version: 1.0.7 Author: John Parris Author URI: http://www.johnparris.com License: GPL2 @@ -11,9 +11,10 @@ /* Copyright 2012 John Parris */ -/* Prevent direct access */ -if ( ! defined( 'ABSPATH' ) ) - die ( 'What\'chu talkin\' \'bout, Willis?' ); +// Exit if accessed directly. +if ( ! defined( 'ABSPATH' ) ) { + die ( "What'chu talkin' 'bout, Willis?" ); +} if ( ! class_exists( 'AlienShip_Shortcodes' ) ): @@ -44,6 +45,8 @@ function add_shortcodes() { add_shortcode( 'loginform', array( $this, 'alienship_login_form' ) ); add_shortcode( 'panel', array( $this, 'alienship_panel' ) ); add_shortcode( 'well', array( $this, 'alienship_well' ) ); + add_shortcode( 'col', array( $this, 'alienship_column' ) ); + add_shortcode( 'row', array( $this, 'alienship_row' ) ); } @@ -51,26 +54,25 @@ function add_shortcodes() { * Alerts * * @since 1.0 - * Types are 'info', 'error', 'success'. If type is not specified, a default color is displayed. Specify a heading text. See example. + * Types are 'success', 'info', 'warning', 'danger'. If type is not specified, a default color is displayed. * Example: [alert type="success" heading="Congrats!"]You won the lottery![/alert] */ function alienship_alert( $atts, $content = null ) { - extract( shortcode_atts( array( - 'type' => 'success', - 'heading' => '', - 'close' => false, - ), - $atts ) - ); + $atts = shortcode_atts( array( + 'type' => 'success', + 'heading' => false, + 'close' => false, + ), + $atts, 'alienship_alert' ); - $output = '
' . do_shortcode( $content ) . '
'; @@ -81,8 +83,6 @@ function alienship_alert( $atts, $content = null ) { } - - /** * Badges * @@ -92,13 +92,10 @@ function alienship_alert( $atts, $content = null ) { */ function alienship_badge( $atts, $content = null ) { - extract( shortcode_atts( array( 'type' => 'badge' ), $atts ) ); return '' . do_shortcode( $content ) . ''; } - - /** * Buttons * @@ -109,23 +106,22 @@ function alienship_badge( $atts, $content = null ) { */ function alienship_button( $atts, $content = null ) { - extract( shortcode_atts( array( - 'link' => '#', - 'type' => 'default', - 'size' => '' - ), $atts ) - ); + $atts = shortcode_atts( array( + 'link' => '#', + 'type' => 'default', + 'size' => false, + ), + $atts, 'alienship_button' ); // Button size - if ( $size ) - $size = ' btn-' . $size; + $size = ''; + if ( $atts['size'] ) + $size = ' btn-' . $atts['size']; - return '' . do_shortcode( $content ) . ''; + return '' . do_shortcode( $content ) . ''; } - - /** * Featured Posts Carousel * @@ -136,30 +132,32 @@ function alienship_button( $atts, $content = null ) { function alienship_featured_posts_shortcode( $atts, $content = null ) { /* Do nothing if we're doing an RSS feed */ - if( is_feed() ) return; - - extract( shortcode_atts( array( - 'tag' => 'featured', - 'max' => '3', - 'width' => '850', - 'height' => '350', - 'indicators' => 'true', - 'captions' => 'true', - ), $atts ) - ); - - $featuredquery = 'posts_per_page=' . absint( $max ) . '&tag=' . $tag; + if( is_feed() ) { + return; + } + + $atts = shortcode_atts( array( + 'tag' => 'featured', + 'max' => '3', + 'width' => '850', + 'height' => '350', + 'indicators' => 'true', + 'captions' => 'true', + ), + $atts, 'alienship_featured_posts_shortcode' ); + + $featuredquery = 'posts_per_page=' . absint( $atts['max'] ) . '&tag=' . $atts['tag']; $featured_query_shortcode = new WP_Query( $featuredquery ); if ( $featured_query_shortcode->have_posts() ) { ?> -