Menu Social Icons - Version 1.3.6

Version Description

  • New: Allow themes to override HTML output with msi-templates directory.
Download this release

Release Info

Developer pdclark
Plugin Icon Menu Social Icons
Version 1.3.6
Comparing to
See all releases

Code changes from version 1.3.5 to 1.3.6

classes/msi-frontend.php CHANGED
@@ -185,14 +185,7 @@ class MSI_Frontend {
185
  * Just 2 lines of stylesheet, so loading inline rather than adding another HTTP request.
186
  */
187
  public function wp_print_scripts() {
188
- ?>
189
- <style>
190
- /* Accessible for screen readers but hidden from view */
191
- .fa-hidden { position:absolute; left:-10000px; top:auto; width:1px; height:1px; overflow:hidden; }
192
- .rtl .fa-hidden { left:10000px; }
193
- .fa-showtext { margin-right: 5px; }
194
- </style>
195
- <?php
196
  }
197
 
198
  /**
@@ -207,7 +200,7 @@ class MSI_Frontend {
207
  $icon = $network[ $this->type ];
208
  $show_text = $this->hide_text ? '' : 'fa-showtext';
209
 
210
- return "<i class='$size $icon $show_text'></i>";
211
 
212
  }
213
 
@@ -229,7 +222,7 @@ class MSI_Frontend {
229
  $item->classes[] = $network['class'];
230
 
231
  if ( $this->hide_text ) {
232
- $item->title = '<span class="fa-hidden">' . $item->title . '</span>';
233
  }
234
 
235
  $item->title = $this->get_icon( $network ) . $item->title ;
@@ -260,6 +253,31 @@ class MSI_Frontend {
260
  return $networks;
261
  }
262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  /**
264
  * Test output of all FontAwesome icons
265
  */
185
  * Just 2 lines of stylesheet, so loading inline rather than adding another HTTP request.
186
  */
187
  public function wp_print_scripts() {
188
+ echo self::get_template( 'stylesheet' );
 
 
 
 
 
 
 
189
  }
190
 
191
  /**
200
  $icon = $network[ $this->type ];
201
  $show_text = $this->hide_text ? '' : 'fa-showtext';
202
 
203
+ return self::get_template( 'icon', compact( 'size', 'icon', 'show_text' ) );
204
 
205
  }
206
 
222
  $item->classes[] = $network['class'];
223
 
224
  if ( $this->hide_text ) {
225
+ $item->title = self::get_template( 'hide-text', array( 'title' => $item->title ) );
226
  }
227
 
228
  $item->title = $this->get_icon( $network ) . $item->title ;
253
  return $networks;
254
  }
255
 
256
+ /**
257
+ * Load HTML template from templates directory.
258
+ * Contents of $args are turned into variables for use in the template.
259
+ *
260
+ * For example, $args = array( 'foo' => 'bar' );
261
+ * becomes variable $foo with value 'bar'
262
+ */
263
+ static public function get_template( $file, $args = array() ) {
264
+ extract( $args );
265
+
266
+ $locations = array(
267
+ 'theme_file' => get_stylesheet_directory() . "/msi-templates/$file.php",
268
+ 'plugin_file' => dirname( dirname( __FILE__ ) ) . "/msi-templates/$file.php",
269
+ );
270
+
271
+ foreach ( $locations as $file ) {
272
+ if ( file_exists( $file ) ) {
273
+ ob_start();
274
+ include $file;
275
+ $output = ob_get_clean();
276
+ return $output;
277
+ }
278
+ }
279
+ }
280
+
281
  /**
282
  * Test output of all FontAwesome icons
283
  */
msi-templates/hide-text.php ADDED
@@ -0,0 +1 @@
 
1
+ <span class="fa-hidden"><?php echo $title ?></span>
msi-templates/icon.php ADDED
@@ -0,0 +1 @@
 
1
+ <i class="<?php echo $size . ' ' . $icon . ' ' . $show_text ?>"></i>
msi-templates/stylesheet.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <style>
2
+ /* Accessible for screen readers but hidden from view */
3
+ .fa-hidden { position:absolute; left:-10000px; top:auto; width:1px; height:1px; overflow:hidden; }
4
+ .rtl .fa-hidden { left:10000px; }
5
+ .fa-showtext { margin-right: 5px; }
6
+ </style>
plugin.php CHANGED
@@ -2,35 +2,15 @@
2
  /*
3
  Plugin Name: Menu Social Icons
4
  Description: Change menu links to social sites to icons automatically. Uses <a href="http://fortawesome.github.io/Font-Awesome/" target="_blank">FontAwesome</a> and supports: Bitbucket, Dribbble, Dropbox, Flickr, Foursquare, Gittip, Instagram, RenRen, Stack Overflow, Trello, Tumblr, VK, Weibo, Xing, and YouTube.
5
- Version: 1.3.5
6
  Author: Brainstorm Media
7
  Author URI: http://brainstormmedia.com
 
 
8
  */
9
 
10
- /**
11
- * Copyright (c) 2013 Brainstorm Media. All rights reserved.
12
- *
13
- * Released under the GPL license
14
- * http://www.opensource.org/licenses/gpl-license.php
15
- *
16
- * This is an add-on for WordPress
17
- * http://wordpress.org/
18
- *
19
- * **********************************************************************
20
- * This program is free software; you can redistribute it and/or modify
21
- * it under the terms of the GNU General Public License as published by
22
- * the Free Software Foundation; either version 2 of the License, or
23
- * (at your option) any later version.
24
- *
25
- * This program is distributed in the hope that it will be useful,
26
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28
- * GNU General Public License for more details.
29
- * **********************************************************************
30
- */
31
-
32
  define( 'MSI_PLUGIN_FILE', __FILE__ );
33
- define( 'MSI_VERSION', '1.3.4' );
34
 
35
  add_action( 'init', 'storm_menu_social_icons_init' );
36
 
2
  /*
3
  Plugin Name: Menu Social Icons
4
  Description: Change menu links to social sites to icons automatically. Uses <a href="http://fortawesome.github.io/Font-Awesome/" target="_blank">FontAwesome</a> and supports: Bitbucket, Dribbble, Dropbox, Flickr, Foursquare, Gittip, Instagram, RenRen, Stack Overflow, Trello, Tumblr, VK, Weibo, Xing, and YouTube.
5
+ Version: 1.3.6
6
  Author: Brainstorm Media
7
  Author URI: http://brainstormmedia.com
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  define( 'MSI_PLUGIN_FILE', __FILE__ );
13
+ define( 'MSI_VERSION', '1.3.6' );
14
 
15
  add_action( 'init', 'storm_menu_social_icons_init' );
16
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Author URI: http://brainstormmedia.com
5
  Tags: social, icons, menus, FontAwesome, social media, easy
6
  Requires at least: 3.4
7
  Tested up to: 3.7.1
8
- Stable tag: 1.3.5
9
  License: GPLv2
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -73,7 +73,7 @@ Add icons from [FontAwesome](http://fortawesome.github.io/Font-Awesome/) for oth
73
  function storm_social_icons_networks( $networks ) {
74
 
75
  $extra_icons = array (
76
- '/feed' => array( // Enable this icon for any URL containing this text
77
  'name' => 'RSS', // Default menu item label
78
  'class' => 'rss', // Custom class
79
  'icon' => 'icon-rss', // FontAwesome class
@@ -86,6 +86,11 @@ Add icons from [FontAwesome](http://fortawesome.github.io/Font-Awesome/) for oth
86
 
87
  }
88
 
 
 
 
 
 
89
 
90
  == Installation ==
91
 
@@ -124,38 +129,50 @@ We load FontAwesome onto your site using NetDNA's [Bootstrap CDN](http://www.boo
124
 
125
  == Changelog ==
126
 
 
 
 
 
127
  = 1.3.5 =
 
128
  * Fix: Horizontal scrollbar on RTL layouts. Thanks [@mascatu](http://wordpress.org/support/profile/mascatu) for the [bug report](http://wordpress.org/support/topic/rtl-issue-1).
129
 
130
  = 1.3.4 =
 
131
  * Fix: Work around compatibility issue with [Better WordPress Minify](http://wordpress.org/plugins/bwp-minify/) plugin.
132
 
133
  = 1.3.3 =
 
134
  * Fix: Work around bug in WP E-commerce that causes other plugins to not load properly on product pages. Thanks [@elfary](http://wordpress.org/support/topic/menu-with-e-commerce). See [bug report to WP E-commerce](http://wordpress.org/support/topic/other-plugins-blocked-from-loading-on-product-pages).
135
 
136
  = 1.3.2 =
 
137
  * Fix: Properly enqueue stylesheets
138
  * Fix: Set FontAwesome 4.0 to off by default
139
 
140
  = 1.3 =
 
141
  * New: Preview icons and shortcuts in the WordPress Menu Editor.
142
  * New: vimeo.com and stackexchange.com icons when FontAwesome 4.0 is turned on.
143
  * Notice: FontAwesome 4.0 removes support for IE7, so it is off by default. Use the filter `storm_social_icons_use_latest` shown in the readme to turn on FontAwesome 4.0.
144
 
145
  = 1.2 =
 
146
  * New: Filter for custom icons and URLs.
147
  * New: Icon for `mailto:` links.
148
  * [Thanks to mmcginnis](http://wordpress.org/support/topic/just-works-40) for both of these changes.
149
 
150
  = 1.1 =
 
151
  * New: Upgrade to FontAwesome 3.2.1
152
  * New: ots of new site icons: bitbucket.org, dribbble.com, dropbox.com, flickr.com, foursquare.com, gittip.com, instagram.com, renren.com, stackoverflow.com, trello.com, tumblr.com, vk.com, weibo.com, xing.com, youtube.com
153
 
154
  = 1.0 =
 
155
  * Initial public release.
156
 
157
  == Upgrade Notice ==
158
 
159
- = 1.3.5 =
160
 
161
- * Fix: Horizontal scrollbar on RTL layouts. Thanks [@mascatu](http://wordpress.org/support/profile/mascatu) for the [bug report](http://wordpress.org/support/topic/rtl-issue-1).
5
  Tags: social, icons, menus, FontAwesome, social media, easy
6
  Requires at least: 3.4
7
  Tested up to: 3.7.1
8
+ Stable tag: 1.3.6
9
  License: GPLv2
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
73
  function storm_social_icons_networks( $networks ) {
74
 
75
  $extra_icons = array (
76
+ '/feed' => array( // Enable this icon for any URL containing this text
77
  'name' => 'RSS', // Default menu item label
78
  'class' => 'rss', // Custom class
79
  'icon' => 'icon-rss', // FontAwesome class
86
 
87
  }
88
 
89
+ **Option: Change HTML Output**
90
+
91
+ Copy the folder `msi-templates` from `wp-content/plugins/menu-social-icons` to your theme directory. You can then edit the copies in your theme to change the HTML output by the plugin.
92
+
93
+ This is useful for developers using the plugin with custom icon sets. It also protects your changes from being overwritten by plugin updates.
94
 
95
  == Installation ==
96
 
129
 
130
  == Changelog ==
131
 
132
+ = 1.3.6 =
133
+
134
+ * New: Allow themes to override HTML output with msi-templates directory.
135
+
136
  = 1.3.5 =
137
+
138
  * Fix: Horizontal scrollbar on RTL layouts. Thanks [@mascatu](http://wordpress.org/support/profile/mascatu) for the [bug report](http://wordpress.org/support/topic/rtl-issue-1).
139
 
140
  = 1.3.4 =
141
+
142
  * Fix: Work around compatibility issue with [Better WordPress Minify](http://wordpress.org/plugins/bwp-minify/) plugin.
143
 
144
  = 1.3.3 =
145
+
146
  * Fix: Work around bug in WP E-commerce that causes other plugins to not load properly on product pages. Thanks [@elfary](http://wordpress.org/support/topic/menu-with-e-commerce). See [bug report to WP E-commerce](http://wordpress.org/support/topic/other-plugins-blocked-from-loading-on-product-pages).
147
 
148
  = 1.3.2 =
149
+
150
  * Fix: Properly enqueue stylesheets
151
  * Fix: Set FontAwesome 4.0 to off by default
152
 
153
  = 1.3 =
154
+
155
  * New: Preview icons and shortcuts in the WordPress Menu Editor.
156
  * New: vimeo.com and stackexchange.com icons when FontAwesome 4.0 is turned on.
157
  * Notice: FontAwesome 4.0 removes support for IE7, so it is off by default. Use the filter `storm_social_icons_use_latest` shown in the readme to turn on FontAwesome 4.0.
158
 
159
  = 1.2 =
160
+
161
  * New: Filter for custom icons and URLs.
162
  * New: Icon for `mailto:` links.
163
  * [Thanks to mmcginnis](http://wordpress.org/support/topic/just-works-40) for both of these changes.
164
 
165
  = 1.1 =
166
+
167
  * New: Upgrade to FontAwesome 3.2.1
168
  * New: ots of new site icons: bitbucket.org, dribbble.com, dropbox.com, flickr.com, foursquare.com, gittip.com, instagram.com, renren.com, stackoverflow.com, trello.com, tumblr.com, vk.com, weibo.com, xing.com, youtube.com
169
 
170
  = 1.0 =
171
+
172
  * Initial public release.
173
 
174
  == Upgrade Notice ==
175
 
176
+ = 1.3.6 =
177
 
178
+ * New: Allow themes to override HTML output with msi-templates directory.