Skip to content

Commit

Permalink
Merge pull request #43 from kimcoleman/dev
Browse files Browse the repository at this point in the history
1.3.8 version ready for release; font awesome shortcode attributes ro…
  • Loading branch information
kimcoleman authored Jun 13, 2023
2 parents 0eac7f5 + b573697 commit 6679129
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 38 deletions.
4 changes: 2 additions & 2 deletions memberlite-shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Memberlite Shortcodes
Plugin URI: https://memberlitetheme.com/memberlite-shortcodes/
Description: Shortcodes designed to work with the Memberlite Theme and Memberlite Child Themes.
Version: 1.3.7
Version: 1.3.8
Author: Stranger Studios
Author URI: https://memberlitetheme.com
Text Domain: memberlite-shortcodes
Expand All @@ -12,7 +12,7 @@

define( 'MEMBERLITESC_DIR', dirname( __FILE__ ) );
define( 'MEMBERLITESC_URL', plugins_url( '', __FILE__ ) );
define( 'MEMBERLITESC_VERSION', '1.3.7' );
define( 'MEMBERLITESC_VERSION', '1.3.8' );

/**
* Load text domain
Expand Down
9 changes: 7 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Contributors: kimannwall, strangerstudios
Tags: theme, shortcodes, memberlite, membership, pmpro, paid memberships pro
Requires at least: 5.3
Tested up to: 6.2
Stable tag: 1.3.7
Tested up to: 6.2.2
Stable tag: 1.3.8
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -80,6 +80,11 @@ Some of the shortcodes in this plugin will work with any theme, but we cannot gu

== Changelog ==

= 1.3.8 - 2023-06-13 =
* ENHANCEMENT: Now supporting Font Awesome shortcode attributes for rotate, flip, and animate.
* ENHANCEMENT: Updated to Font Awesome version 6.4.
* ENHANCEMENT: Tested up to WordPress 6.2.2.

= 1.3.7 - 2022-09-11 =
* ENHANCEMENT: Added `show_children_depth` attribute to subpagelist shortcode to limit depth of children shown.
* ENHANCEMENT: Updated to Font Awesome version 6.2.
Expand Down
85 changes: 51 additions & 34 deletions shortcodes/font-awesome.php
Original file line number Diff line number Diff line change
@@ -1,48 +1,65 @@
<?php
function memberlitesc_fa_shortcode($atts, $content = null) {
// $atts ::= array of attributes
// $atts ::= array of attributes
// $content ::= text within enclosing form of shortcode element
// examples: [fa icon="comment" color="primary" type="solid" size="3x"]

extract(shortcode_atts(array(
'color' => '',
extract(shortcode_atts(array(
'color' => null,
'icon' => '',
'size' => '',
'type' => '',
), $atts));
$r = '<i class="';

$font_awesome_icons_brands = memberlite_shortcodes_get_font_awesome_icons( 'brand' );

// Check if the icon is a "brand" icon and set the type attribute.
if ( in_array( $icon, $font_awesome_icons_brands ) ) {
$type = 'brand';
}

if ( ! empty( $type ) ) {
if ( $type === 'regular' ) {
$r .= 'far';
} elseif ( $type === 'solid' ) {
$r .= 'fas';
} elseif ( $type === 'brand' ) {
$r .= 'fab';
}
'size' => null,
'type' => null,
'rotate' => null,
'flip' => null,
'animate' => null,
), $atts));
$r = '<i class="';

$font_awesome_icons_brands = memberlite_shortcodes_get_font_awesome_icons( 'brand' );

// Check if the icon is a "brand" icon and set the type attribute.
if ( in_array( $icon, $font_awesome_icons_brands ) ) {
$type = 'brand';
}

if ( ! empty( $type ) ) {
if ( $type === 'regular' ) {
$classes[] = 'far';
} elseif ( $type === 'solid' ) {
$classes[] = 'fas';
} elseif ( $type === 'brand' ) {
$classes[] = 'fab';
}
} else {
$r .= 'fa';
}
$classes[] = 'fa';
}

$r .= ' fa-' . $icon;
$classes[] = ' fa-' . $icon;

if(!empty($color))
{
$r .= ' ' . $color;
if ( ! empty( $color ) ) {
$classes[] = ' ' . $color;
}
if(!empty($size))
{
$r .= ' fa-' . $size;

if ( ! empty($size ) ) {
$classes[] = ' fa-' . $size;
}
$r .= '"></i>';
return $r;

if ( ! empty( $rotate ) ) {
$classes[] = 'fa-rotate-' . $rotate;
}

if ( ! empty( $flip ) ) {
$classes[] = 'fa-flip-' . $flip;
}

if ( ! empty( $animate ) ) {
$classes[] = 'fa-' . $animate;
}

return sprintf(
'<i class="%1$s"></i>',
esc_attr( implode( ' ', $classes ) )
);
}
remove_shortcode('fa'); //replace shortcode bundled with Memberlite 2.0 and prior or anywhere else
add_shortcode('fa', 'memberlitesc_fa_shortcode');

0 comments on commit 6679129

Please sign in to comment.