Version Description
- Fix: If you're experiencing an issue with your Facebook feed not automatically updating successfully then please update the plugin and enable the following setting: Custom Facebook Feed > Customize > Misc > Misc Settings > Force cache to clear on interval. If you set this setting to 'Yes' then it should force your plugin cache to clear either every hour, 12 hours, or 24 hours, depending on how often you have the plugin set to check Facebook for new posts.
Download this release
Release Info
Developer | smashballoon |
Plugin | Custom Facebook Feed |
Version | 2.3.10 |
Comparing to | |
See all releases |
Code changes from version 2.3.9 to 2.3.10
- README.txt +5 -2
- custom-facebook-feed-admin.php +69 -0
- custom-facebook-feed.php +13 -6
- js/cff-scripts.js +102 -97
README.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: smashballoon
|
3 |
Tags: Facebook, Facebook feed, Facebook posts, Facebook wall, Facebook events, Facebook page, Facebook group, Facebook groups, Facebook fans, Facebook likes, Facebook followers, Facebooks, Face book, posts, Facebook postings, Facebook feeds, Facebook pages, Facebook Like Box, Facebook plugin, Facebook plug-in, Facebook walls, Facebook hashtag, Facebook embed, Customizable Facebook Feed, custom, customizable, seo, responsive, mobile, social media
|
4 |
Requires at least: 3.0
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 2.3.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -361,6 +361,9 @@ Credit iMarketing Factory - "The Importance of Facebook for Small Businesses"
|
|
361 |
9. It's super easy to display your Facebook feed in any page or post
|
362 |
|
363 |
== Changelog ==
|
|
|
|
|
|
|
364 |
= 2.3.9 =
|
365 |
* Fix: Fixed an issue caused by the recent Facebook API 2.5 update where the posts wouldn't display when using a brand new Access Token
|
366 |
|
2 |
Contributors: smashballoon
|
3 |
Tags: Facebook, Facebook feed, Facebook posts, Facebook wall, Facebook events, Facebook page, Facebook group, Facebook groups, Facebook fans, Facebook likes, Facebook followers, Facebooks, Face book, posts, Facebook postings, Facebook feeds, Facebook pages, Facebook Like Box, Facebook plugin, Facebook plug-in, Facebook walls, Facebook hashtag, Facebook embed, Customizable Facebook Feed, custom, customizable, seo, responsive, mobile, social media
|
4 |
Requires at least: 3.0
|
5 |
+
Tested up to: 4.4
|
6 |
+
Stable tag: 2.3.10
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
361 |
9. It's super easy to display your Facebook feed in any page or post
|
362 |
|
363 |
== Changelog ==
|
364 |
+
= 2.3.10 =
|
365 |
+
* Fix: If you're experiencing an issue with your Facebook feed not automatically updating successfully then please update the plugin and enable the following setting: Custom Facebook Feed > Customize > Misc > Misc Settings > Force cache to clear on interval. If you set this setting to 'Yes' then it should force your plugin cache to clear either every hour, 12 hours, or 24 hours, depending on how often you have the plugin set to check Facebook for new posts.
|
366 |
+
|
367 |
= 2.3.9 =
|
368 |
* Fix: Fixed an issue caused by the recent Facebook API 2.5 update where the posts wouldn't display when using a brand new Access Token
|
369 |
|
custom-facebook-feed-admin.php
CHANGED
@@ -679,6 +679,8 @@ function cff_style_page() {
|
|
679 |
'cff_show_author' => true,
|
680 |
'cff_class' => '',
|
681 |
'cff_open_links' => true,
|
|
|
|
|
682 |
//New
|
683 |
'cff_custom_css' => '',
|
684 |
'cff_custom_js' => '',
|
@@ -875,6 +877,8 @@ function cff_style_page() {
|
|
875 |
$cff_font_source = $options[ 'cff_font_source' ];
|
876 |
$cff_preserve_settings = 'cff_preserve_settings';
|
877 |
$cff_preserve_settings_val = get_option( $cff_preserve_settings );
|
|
|
|
|
878 |
|
879 |
//Page Header
|
880 |
$cff_show_header = $options[ 'cff_show_header' ];
|
@@ -1219,6 +1223,8 @@ function cff_style_page() {
|
|
1219 |
(isset($_POST[ 'cff_show_credit' ])) ? $cff_show_credit = $_POST[ 'cff_show_credit' ] : $cff_show_credit = '';
|
1220 |
(isset($_POST[ 'cff_font_source' ])) ? $cff_font_source = $_POST[ 'cff_font_source' ] : $cff_font_source = '';
|
1221 |
(isset($_POST[ $cff_preserve_settings ])) ? $cff_preserve_settings_val = $_POST[ 'cff_preserve_settings' ] : $cff_preserve_settings_val = '';
|
|
|
|
|
1222 |
|
1223 |
//Meta
|
1224 |
$options[ 'cff_icon_style' ] = $cff_icon_style;
|
@@ -1254,6 +1260,28 @@ function cff_style_page() {
|
|
1254 |
$options[ 'cff_show_credit' ] = $cff_show_credit;
|
1255 |
$options[ 'cff_font_source' ] = $cff_font_source;
|
1256 |
update_option( $cff_preserve_settings, $cff_preserve_settings_val );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1257 |
}
|
1258 |
//Update the Custom Text / Translate options
|
1259 |
if( isset($_POST[ $style_custom_text_hidden_field_name ]) && $_POST[ $style_custom_text_hidden_field_name ] == 'Y' ) {
|
@@ -2664,6 +2692,22 @@ function cff_style_page() {
|
|
2664 |
</select>
|
2665 |
</td>
|
2666 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2667 |
</tbody>
|
2668 |
</table>
|
2669 |
|
@@ -2855,4 +2899,29 @@ function cff_add_settings_link( $links, $file ) {
|
|
2855 |
|
2856 |
return $links;
|
2857 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2858 |
?>
|
679 |
'cff_show_author' => true,
|
680 |
'cff_class' => '',
|
681 |
'cff_open_links' => true,
|
682 |
+
'cff_cron' => 'unset',
|
683 |
+
|
684 |
//New
|
685 |
'cff_custom_css' => '',
|
686 |
'cff_custom_js' => '',
|
877 |
$cff_font_source = $options[ 'cff_font_source' ];
|
878 |
$cff_preserve_settings = 'cff_preserve_settings';
|
879 |
$cff_preserve_settings_val = get_option( $cff_preserve_settings );
|
880 |
+
$cff_cron = $options[ 'cff_cron' ];
|
881 |
+
|
882 |
|
883 |
//Page Header
|
884 |
$cff_show_header = $options[ 'cff_show_header' ];
|
1223 |
(isset($_POST[ 'cff_show_credit' ])) ? $cff_show_credit = $_POST[ 'cff_show_credit' ] : $cff_show_credit = '';
|
1224 |
(isset($_POST[ 'cff_font_source' ])) ? $cff_font_source = $_POST[ 'cff_font_source' ] : $cff_font_source = '';
|
1225 |
(isset($_POST[ $cff_preserve_settings ])) ? $cff_preserve_settings_val = $_POST[ 'cff_preserve_settings' ] : $cff_preserve_settings_val = '';
|
1226 |
+
if (isset($_POST[ 'cff_cron' ])) $cff_cron = $_POST[ 'cff_cron' ];
|
1227 |
+
|
1228 |
|
1229 |
//Meta
|
1230 |
$options[ 'cff_icon_style' ] = $cff_icon_style;
|
1260 |
$options[ 'cff_show_credit' ] = $cff_show_credit;
|
1261 |
$options[ 'cff_font_source' ] = $cff_font_source;
|
1262 |
update_option( $cff_preserve_settings, $cff_preserve_settings_val );
|
1263 |
+
|
1264 |
+
$options[ 'cff_cron' ] = $cff_cron;
|
1265 |
+
|
1266 |
+
|
1267 |
+
if( $cff_cron == 'no' ) wp_clear_scheduled_hook('cff_cron_job');
|
1268 |
+
|
1269 |
+
//Run cron when Misc settings are saved
|
1270 |
+
if( $cff_cron == 'yes' ){
|
1271 |
+
//Clear the existing cron event
|
1272 |
+
wp_clear_scheduled_hook('cff_cron_job');
|
1273 |
+
|
1274 |
+
$cff_cache_time = get_option( 'cff_cache_time' );
|
1275 |
+
$cff_cache_time_unit = get_option( 'cff_cache_time_unit' );
|
1276 |
+
|
1277 |
+
//Set the event schedule based on what the caching time is set to
|
1278 |
+
$cff_cron_schedule = 'hourly';
|
1279 |
+
if( $cff_cache_time_unit == 'hours' && $cff_cache_time > 5 ) $cff_cron_schedule = 'twicedaily';
|
1280 |
+
if( $cff_cache_time_unit == 'days' ) $cff_cron_schedule = 'daily';
|
1281 |
+
|
1282 |
+
wp_schedule_event(time(), $cff_cron_schedule, 'cff_cron_job');
|
1283 |
+
}
|
1284 |
+
|
1285 |
}
|
1286 |
//Update the Custom Text / Translate options
|
1287 |
if( isset($_POST[ $style_custom_text_hidden_field_name ]) && $_POST[ $style_custom_text_hidden_field_name ] == 'Y' ) {
|
2692 |
</select>
|
2693 |
</td>
|
2694 |
</tr>
|
2695 |
+
|
2696 |
+
<tr>
|
2697 |
+
<th class="bump-left">
|
2698 |
+
<label for="cff_cron" class="bump-left"><?php _e("Force cache to clear on interval"); ?></label>
|
2699 |
+
</th>
|
2700 |
+
<td>
|
2701 |
+
<select name="cff_cron">
|
2702 |
+
<option value="unset" <?php if($cff_cron == "unset") echo 'selected="selected"' ?> ><?php _e(' - '); ?></option>
|
2703 |
+
<option value="yes" <?php if($cff_cron == "yes") echo 'selected="selected"' ?> ><?php _e('Yes'); ?></option>
|
2704 |
+
<option value="no" <?php if($cff_cron == "no") echo 'selected="selected"' ?> ><?php _e('No'); ?></option>
|
2705 |
+
</select>
|
2706 |
+
|
2707 |
+
<a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e('What does this mean?'); ?></a>
|
2708 |
+
<p class="cff-tooltip cff-more-info"><?php _e("If you're experiencing an issue with the plugin not auto-updating then you can set this to 'Yes' to run a scheduled event behind the scenes which forces the plugin cache to clear on a regular basis and retrieve new data from Facebook."); ?></p>
|
2709 |
+
</td>
|
2710 |
+
</tr>
|
2711 |
</tbody>
|
2712 |
</table>
|
2713 |
|
2899 |
|
2900 |
return $links;
|
2901 |
}
|
2902 |
+
|
2903 |
+
|
2904 |
+
//Cron job to clear transients
|
2905 |
+
add_action('cff_cron_job', 'cff_cron_clear_cache');
|
2906 |
+
function cff_cron_clear_cache() {
|
2907 |
+
//Delete all transients
|
2908 |
+
global $wpdb;
|
2909 |
+
$table_name = $wpdb->prefix . "options";
|
2910 |
+
$wpdb->query( "
|
2911 |
+
DELETE
|
2912 |
+
FROM $table_name
|
2913 |
+
WHERE `option_name` LIKE ('%\_transient\_cff\_%')
|
2914 |
+
" );
|
2915 |
+
$wpdb->query( "
|
2916 |
+
DELETE
|
2917 |
+
FROM $table_name
|
2918 |
+
WHERE `option_name` LIKE ('%\_transient\_cff\_tle\_%')
|
2919 |
+
" );
|
2920 |
+
$wpdb->query( "
|
2921 |
+
DELETE
|
2922 |
+
FROM $table_name
|
2923 |
+
WHERE `option_name` LIKE ('%\_transient\_timeout\_cff\_%')
|
2924 |
+
" );
|
2925 |
+
}
|
2926 |
+
|
2927 |
?>
|
custom-facebook-feed.php
CHANGED
@@ -3,13 +3,13 @@
|
|
3 |
Plugin Name: Custom Facebook Feed
|
4 |
Plugin URI: http://smashballoon.com/custom-facebook-feed
|
5 |
Description: Add completely customizable Facebook feeds to your WordPress site
|
6 |
-
Version: 2.3.
|
7 |
Author: Smash Balloon
|
8 |
Author URI: http://smashballoon.com/
|
9 |
License: GPLv2 or later
|
10 |
*/
|
11 |
/*
|
12 |
-
Copyright
|
13 |
This program is free software; you can redistribute it and/or modify
|
14 |
it under the terms of the GNU General Public License as published by
|
15 |
the Free Software Foundation; either version 2 of the License, or
|
@@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
25 |
//Include admin
|
26 |
include dirname( __FILE__ ) .'/custom-facebook-feed-admin.php';
|
27 |
|
28 |
-
define('CFFVER', '2.3.
|
29 |
|
30 |
// Add shortcodes
|
31 |
add_shortcode('custom-facebook-feed', 'display_cff');
|
@@ -680,6 +680,7 @@ function display_cff($atts) {
|
|
680 |
} else {
|
681 |
$cff_post_limit = intval(intval($show_posts) + 7);
|
682 |
}
|
|
|
683 |
|
684 |
|
685 |
//Calculate the cache time in seconds
|
@@ -1968,8 +1969,17 @@ function cff_activate() {
|
|
1968 |
|
1969 |
get_option('cff_show_access_token');
|
1970 |
update_option( 'cff_show_access_token', false );
|
|
|
|
|
|
|
1971 |
}
|
1972 |
register_activation_hook( __FILE__, 'cff_activate' );
|
|
|
|
|
|
|
|
|
|
|
|
|
1973 |
//Uninstall
|
1974 |
function cff_uninstall()
|
1975 |
{
|
@@ -2367,7 +2377,4 @@ function cff_autolink_email($text, $tagfill=''){
|
|
2367 |
####################################################################
|
2368 |
|
2369 |
|
2370 |
-
//Comment out the lines below to view PHP notices and errors
|
2371 |
-
// ini_set('display_errors', 1);
|
2372 |
-
// error_reporting(~0);
|
2373 |
?>
|
3 |
Plugin Name: Custom Facebook Feed
|
4 |
Plugin URI: http://smashballoon.com/custom-facebook-feed
|
5 |
Description: Add completely customizable Facebook feeds to your WordPress site
|
6 |
+
Version: 2.3.10
|
7 |
Author: Smash Balloon
|
8 |
Author URI: http://smashballoon.com/
|
9 |
License: GPLv2 or later
|
10 |
*/
|
11 |
/*
|
12 |
+
Copyright 2015 Smash Balloon LLC (email : hey@smashballoon.com)
|
13 |
This program is free software; you can redistribute it and/or modify
|
14 |
it under the terms of the GNU General Public License as published by
|
15 |
the Free Software Foundation; either version 2 of the License, or
|
25 |
//Include admin
|
26 |
include dirname( __FILE__ ) .'/custom-facebook-feed-admin.php';
|
27 |
|
28 |
+
define('CFFVER', '2.3.10');
|
29 |
|
30 |
// Add shortcodes
|
31 |
add_shortcode('custom-facebook-feed', 'display_cff');
|
680 |
} else {
|
681 |
$cff_post_limit = intval(intval($show_posts) + 7);
|
682 |
}
|
683 |
+
if( $cff_post_limit >= 100 ) $cff_post_limit = 100;
|
684 |
|
685 |
|
686 |
//Calculate the cache time in seconds
|
1969 |
|
1970 |
get_option('cff_show_access_token');
|
1971 |
update_option( 'cff_show_access_token', false );
|
1972 |
+
|
1973 |
+
//Run cron twice daily when plugin is first activated for new users
|
1974 |
+
wp_schedule_event(time(), 'twicedaily', 'cff_cron_job');
|
1975 |
}
|
1976 |
register_activation_hook( __FILE__, 'cff_activate' );
|
1977 |
+
|
1978 |
+
function cff_deactivate() {
|
1979 |
+
wp_clear_scheduled_hook('cff_cron_job');
|
1980 |
+
}
|
1981 |
+
register_deactivation_hook(__FILE__, 'cff_deactivate');
|
1982 |
+
|
1983 |
//Uninstall
|
1984 |
function cff_uninstall()
|
1985 |
{
|
2377 |
####################################################################
|
2378 |
|
2379 |
|
|
|
|
|
|
|
2380 |
?>
|
js/cff-scripts.js
CHANGED
@@ -1,113 +1,118 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
jQuery('#cff .cff-item').each(function(){
|
4 |
-
var $self = jQuery(this);
|
5 |
|
6 |
-
|
7 |
-
if( $self.find('.cff-viewpost-facebook').parent('p').length ){
|
8 |
-
$self.find('.cff-viewpost-facebook').unwrap('p');
|
9 |
-
}
|
10 |
-
if( $self.find('.cff-author').parent('p').length ){
|
11 |
-
$self.find('.cff-author').eq(1).unwrap('p');
|
12 |
-
$self.find('.cff-author').eq(1).remove();
|
13 |
-
}
|
14 |
-
if( $self.find('#cff .cff-link').parent('p').length ){
|
15 |
-
$self.find('#cff .cff-link').unwrap('p');
|
16 |
-
}
|
17 |
-
|
18 |
-
//Expand post
|
19 |
-
var expanded = false,
|
20 |
-
$post_text = $self.find('.cff-post-text .cff-text'),
|
21 |
-
text_limit = $self.closest('#cff').attr('data-char');
|
22 |
-
if (typeof text_limit === 'undefined' || text_limit == '') text_limit = 99999;
|
23 |
-
|
24 |
-
//If the text is linked then use the text within the link
|
25 |
-
if ( $post_text.find('a.cff-post-text-link').length ) $post_text = $self.find('.cff-post-text .cff-text a');
|
26 |
-
var full_text = $post_text.html();
|
27 |
-
if(full_text == undefined) full_text = '';
|
28 |
-
var short_text = full_text.substring(0,text_limit);
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
e.preventDefault();
|
37 |
-
var $expand = jQuery(this),
|
38 |
-
$more = $expand.find('.cff-more'),
|
39 |
-
$less = $expand.find('.cff-less');
|
40 |
-
if (expanded == false){
|
41 |
-
$post_text.html( full_text );
|
42 |
-
expanded = true;
|
43 |
-
$more.hide();
|
44 |
-
$less.show();
|
45 |
-
} else {
|
46 |
-
$post_text.html( short_text );
|
47 |
-
expanded = false;
|
48 |
-
$more.show();
|
49 |
-
$less.hide();
|
50 |
}
|
51 |
-
|
52 |
-
|
53 |
-
'
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
});
|
56 |
-
cffLinkHashtags();
|
57 |
-
});
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
81 |
}
|
82 |
-
}
|
83 |
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
|
|
91 |
}
|
|
|
|
|
|
|
92 |
}
|
|
|
93 |
|
94 |
-
//
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
98 |
|
99 |
-
//Add target attr to post text links via JS so aren't included in char count
|
100 |
-
$self.find('.cff-text a').add( $self.find('.cff-post-desc a') ).attr({
|
101 |
-
'target' : '_blank',
|
102 |
-
'rel' : 'nofollow'
|
103 |
-
});
|
104 |
|
|
|
|
|
|
|
|
|
105 |
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
});
|
110 |
|
111 |
-
|
112 |
-
}); //End .cff-item each
|
113 |
-
});
|
1 |
+
var cff_js_exists = (typeof cff_js_exists !== 'undefined') ? true : false;
|
2 |
+
if(!cff_js_exists){
|
|
|
|
|
3 |
|
4 |
+
jQuery(document).ready(function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
jQuery('#cff .cff-item').each(function(){
|
7 |
+
var $self = jQuery(this);
|
8 |
+
|
9 |
+
//Wpautop fix
|
10 |
+
if( $self.find('.cff-viewpost-facebook').parent('p').length ){
|
11 |
+
$self.find('.cff-viewpost-facebook').unwrap('p');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
}
|
13 |
+
if( $self.find('.cff-author').parent('p').length ){
|
14 |
+
$self.find('.cff-author').eq(1).unwrap('p');
|
15 |
+
$self.find('.cff-author').eq(1).remove();
|
16 |
+
}
|
17 |
+
if( $self.find('#cff .cff-link').parent('p').length ){
|
18 |
+
$self.find('#cff .cff-link').unwrap('p');
|
19 |
+
}
|
20 |
+
|
21 |
+
//Expand post
|
22 |
+
var expanded = false,
|
23 |
+
$post_text = $self.find('.cff-post-text .cff-text'),
|
24 |
+
text_limit = $self.closest('#cff').attr('data-char');
|
25 |
+
if (typeof text_limit === 'undefined' || text_limit == '') text_limit = 99999;
|
26 |
+
|
27 |
+
//If the text is linked then use the text within the link
|
28 |
+
if ( $post_text.find('a.cff-post-text-link').length ) $post_text = $self.find('.cff-post-text .cff-text a');
|
29 |
+
var full_text = $post_text.html();
|
30 |
+
if(full_text == undefined) full_text = '';
|
31 |
+
var short_text = full_text.substring(0,text_limit);
|
32 |
+
|
33 |
+
//Cut the text based on limits set
|
34 |
+
$post_text.html( short_text );
|
35 |
+
//Show the 'See More' link if needed
|
36 |
+
if (full_text.length > text_limit) $self.find('.cff-expand').show();
|
37 |
+
//Click function
|
38 |
+
$self.find('.cff-expand a').unbind('click').bind('click', function(e){
|
39 |
+
e.preventDefault();
|
40 |
+
var $expand = jQuery(this),
|
41 |
+
$more = $expand.find('.cff-more'),
|
42 |
+
$less = $expand.find('.cff-less');
|
43 |
+
if (expanded == false){
|
44 |
+
$post_text.html( full_text );
|
45 |
+
expanded = true;
|
46 |
+
$more.hide();
|
47 |
+
$less.show();
|
48 |
+
} else {
|
49 |
+
$post_text.html( short_text );
|
50 |
+
expanded = false;
|
51 |
+
$more.show();
|
52 |
+
$less.hide();
|
53 |
+
}
|
54 |
+
//Add target attr to post text links via JS so aren't included in char count
|
55 |
+
$self.find('.cff-text a').add( $self.find('.cff-post-desc a') ).attr({
|
56 |
+
'target' : '_blank',
|
57 |
+
'rel' : 'nofollow'
|
58 |
+
});
|
59 |
+
cffLinkHashtags();
|
60 |
});
|
|
|
|
|
61 |
|
62 |
+
//Hide the shared link box if it's empty
|
63 |
+
$sharedLink = $self.find('.cff-shared-link');
|
64 |
+
if( $sharedLink.text() == '' ){
|
65 |
+
$sharedLink.remove();
|
66 |
+
}
|
67 |
|
68 |
+
function cffLinkHashtags(){
|
69 |
+
//Link hashtags
|
70 |
+
var cffTextStr = $self.find('.cff-text').html(),
|
71 |
+
cffDescStr = $self.find('.cff-post-desc').html(),
|
72 |
+
regex = /(^|\s)#(\w*[a-z\u00E0-\u00FC一-龠ぁ-ゔァ-ヴー]+\w*)/gi,
|
73 |
+
// regex = /#(\w*[a-z\u00E0-\u00FC一-龠ぁ-ゔァ-ヴー]+\w*)/gi,
|
74 |
+
linkcolor = $self.find('.cff-text').attr('data-color');
|
75 |
|
76 |
+
function replacer(hash){
|
77 |
+
//Remove white space at beginning of hash
|
78 |
+
var replacementString = jQuery.trim(hash);
|
79 |
+
//If the hash is a hex code then don't replace it with a link as it's likely in the style attr, eg: "color: #ff0000"
|
80 |
+
if ( /^#[0-9A-F]{6}$/i.test( replacementString ) ){
|
81 |
+
return replacementString;
|
82 |
+
} else {
|
83 |
+
return ' <a href="https://www.facebook.com/hashtag/'+ replacementString.substring(1) +'" target="_blank" rel="nofollow" style="color:#' + linkcolor + '">' + replacementString + '</a>';
|
84 |
+
}
|
85 |
}
|
|
|
86 |
|
87 |
+
if(cfflinkhashtags == 'true'){
|
88 |
+
//Replace hashtags in text
|
89 |
+
var $cffText = $self.find('.cff-text');
|
90 |
+
if($cffText.length > 0){
|
91 |
+
//Add a space after all <br> tags so that #hashtags immediately after them are also converted to hashtag links. Without the space they aren't captured by the regex.
|
92 |
+
cffTextStr = cffTextStr.replace(/<br>/g, "<br> ");
|
93 |
+
$cffText.html( cffTextStr.replace( regex , replacer ) );
|
94 |
+
}
|
95 |
}
|
96 |
+
|
97 |
+
//Replace hashtags in desc
|
98 |
+
if( $self.find('.cff-post-desc').length > 0 ) $self.find('.cff-post-desc').html( cffDescStr.replace( regex , replacer ) );
|
99 |
}
|
100 |
+
cffLinkHashtags();
|
101 |
|
102 |
+
//Add target attr to post text links via JS so aren't included in char count
|
103 |
+
$self.find('.cff-text a').add( $self.find('.cff-post-desc a') ).attr({
|
104 |
+
'target' : '_blank',
|
105 |
+
'rel' : 'nofollow'
|
106 |
+
});
|
107 |
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
+
//Share toolip function
|
110 |
+
$self.find('.cff-share-link').unbind().bind('click', function(){
|
111 |
+
$self.find('.cff-share-tooltip').toggle();
|
112 |
+
});
|
113 |
|
114 |
+
|
115 |
+
}); //End .cff-item each
|
116 |
+
});
|
|
|
117 |
|
118 |
+
} //End cff_js_exists check
|
|
|
|