Custom Facebook Feed - Version 1.8.0

Version Description

  • New: Added a built-in color picker
  • New: Added class to posts based on the author so allow for independent styling
  • Tweak: Now loads the author avatar image in using JavaScript to help speed up load times
  • Tweak: Now automatically set the post limit based on the number of posts to be displayed
  • Tweak: Core improvements to the way posts are output
  • Tweak: Changed 'Layout & Style' page name to 'Customize'
  • Tweak: Moved the Support information to a tab on the Settings page
  • Tweak: Improved the 'Test connection to Facebook API' function
  • Fix: Encode URLs so that they pass HTML validation
  • Fix: Fixed an issue with post captions not displaying under some circumstances
  • Fix: More robust method for stripping the URL when user enters Facebook page URL instead of their Page ID
Download this release

Release Info

Developer smashballoon
Plugin Icon 128x128 Custom Facebook Feed
Version 1.8.0
Comparing to
See all releases

Code changes from version 1.7.2 to 1.8.0

README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: smashballoon
3
  Tags: Facebook, Facebook feed, Facebook posts, Facebook wall, Facebook events, Facebook page, Facebook group, custom, customizable, seo, responsive, mobile, social
4
  Requires at least: 3.0
5
  Tested up to: 3.8.1
6
- Stable tag: 1.7.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H5XFD33R3FHMG
@@ -131,6 +131,19 @@ You can embed your Facebook feed directly into a template file by using the Word
131
 
132
  == Changelog ==
133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  = 1.7.2 =
135
  * Tweak: Moved the 'Show post author' option from the General settings tab to the Post Layout tab
136
  * Tweak: Added the ability to show or hide the author to the 'include' shortcode option
3
  Tags: Facebook, Facebook feed, Facebook posts, Facebook wall, Facebook events, Facebook page, Facebook group, custom, customizable, seo, responsive, mobile, social
4
  Requires at least: 3.0
5
  Tested up to: 3.8.1
6
+ Stable tag: 1.8.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H5XFD33R3FHMG
131
 
132
  == Changelog ==
133
 
134
+ = 1.8.0 =
135
+ * New: Added a built-in color picker
136
+ * New: Added class to posts based on the author so allow for independent styling
137
+ * Tweak: Now loads the author avatar image in using JavaScript to help speed up load times
138
+ * Tweak: Now automatically set the post limit based on the number of posts to be displayed
139
+ * Tweak: Core improvements to the way posts are output
140
+ * Tweak: Changed 'Layout & Style' page name to 'Customize'
141
+ * Tweak: Moved the Support information to a tab on the Settings page
142
+ * Tweak: Improved the 'Test connection to Facebook API' function
143
+ * Fix: Encode URLs so that they pass HTML validation
144
+ * Fix: Fixed an issue with post captions not displaying under some circumstances
145
+ * Fix: More robust method for stripping the URL when user enters Facebook page URL instead of their Page ID
146
+
147
  = 1.7.2 =
148
  * Tweak: Moved the 'Show post author' option from the General settings tab to the Post Layout tab
149
  * Tweak: Added the ability to show or hide the author to the 'include' shortcode option
css/cff-admin-style.css CHANGED
@@ -149,4 +149,55 @@
149
  }
150
  #cff-admin .admin-notice b{
151
  font-size: 14px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  }
149
  }
150
  #cff-admin .admin-notice b{
151
  font-size: 14px;
152
+ }
153
+
154
+
155
+
156
+ /* Post Layouts */
157
+ #cff-admin .cff-layouts{
158
+ width: 100%;
159
+ clear: both;
160
+ overflow: hidden;
161
+ }
162
+ #cff-admin .cff-layout{
163
+ padding: 0;
164
+ float: left;
165
+ width: 25%;
166
+ padding: 1%;
167
+ margin-right: 1%;
168
+ background: #f6f6f6;
169
+ border: 1px solid #ddd;
170
+
171
+ -moz-border-radius: 5px;
172
+ -webkit-border-radius: 5px;
173
+ border-radius: 5px;
174
+ }
175
+ #cff-admin .cff-layout:hover,
176
+ #cff-admin .cff-layout:focus{
177
+ background: #fcfcfc;
178
+ cursor: pointer;
179
+ }
180
+ #cff-admin .cff-layout.cff-layout-selected{
181
+ background: #f7faf1;
182
+ border: 1px solid #7ad03a;
183
+ }
184
+ #cff-admin .cff-layout h3{
185
+ font-size: 15px;
186
+ margin-top: 0;
187
+ }
188
+ #cff-admin .cff-layout img{
189
+ width: 100%;
190
+ border: 1px solid #ddd;
191
+ }
192
+
193
+ /* Disabled */
194
+ #cff-admin .cff-disabled{
195
+ zoom: 1;
196
+ filter: alpha(opacity=60);
197
+ opacity: 0.6;
198
+ }
199
+ #cff-admin .cff-layout:hover,
200
+ #cff-admin .cff-layout:focus{
201
+ background: #f6f6f6;
202
+ cursor: default;
203
  }
css/cff-style.css CHANGED
@@ -44,6 +44,9 @@
44
  #cff a {
45
  text-decoration: underline;
46
  }
 
 
 
47
  /* Post titles and body text */
48
  #cff h3, #cff h4, #cff h5, #cff h6, #cff p{
49
  float: left;
44
  #cff a {
45
  text-decoration: underline;
46
  }
47
+ #cff .cff-post-text-link{
48
+ display: block;
49
+ }
50
  /* Post titles and body text */
51
  #cff h3, #cff h4, #cff h5, #cff h6, #cff p{
52
  float: left;
custom-facebook-feed-admin.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  function cff_menu() {
3
  add_menu_page(
4
  '',
@@ -21,14 +22,15 @@ add_action('admin_menu', 'cff_menu');
21
  function cff_styling_menu() {
22
  add_submenu_page(
23
  'cff-top',
24
- 'Layout &amp; Style',
25
- 'Layout &amp; Style',
26
  'manage_options',
27
  'cff-style',
28
  'cff_style_page'
29
  );
30
  }
31
  add_action('admin_menu', 'cff_styling_menu');
 
32
  //Create Settings page
33
  function cff_settings_page() {
34
  //Declare variables for fields
@@ -104,9 +106,19 @@ function cff_settings_page() {
104
 
105
  <div id="cff-admin" class="wrap">
106
  <div id="header">
107
- <h1><?php _e('Custom Facebook Feed Settings'); ?></h1>
108
  </div>
109
 
 
 
 
 
 
 
 
 
 
 
110
  <form name="form1" method="post" action="">
111
  <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
112
  <br />
@@ -169,7 +181,7 @@ function cff_settings_page() {
169
  <option value="onlyothers" <?php if($cff_show_others_val == 'onlyothers') echo 'selected="selected"' ?> ><?php _e('Only other people'); ?></option>
170
  </select>
171
 
172
- <p id="cff-others-only" style="font-size: 12px;"><b>Note:</b> Only displaying posts by other people works by retrieving your posts from Facebook and then filtering out the posts by the page owner. If this option doesn't display many posts then you can retrieve more by setting the post limit option (below) to a higher number.</p>
173
 
174
  </td>
175
  </tr>
@@ -292,48 +304,59 @@ function cff_settings_page() {
292
  </tbody>
293
  </table>
294
  <?php submit_button(); ?>
 
295
  </form>
296
-
297
- <p class="admin-notice"><a href="http://smashballoon.com/custom-facebook-feed/" target="_blank">Users of this free plugin can now get <b><u>10% off</u></b> The Custom Facebook Feed Pro. Just use the coupon code <b><u>FREEUSER</u></b></a></p>
298
-
299
  <hr />
300
  <h3><?php _e('Displaying your Feed'); ?></h3>
301
- <p><?php _e('Copy and paste this shortcode directly into the page, post or widget where you\'d like the feed to show up:'); ?></p>
302
- <input type="text" value="[custom-facebook-feed]" size="22" readonly="readonly" onclick="this.focus();this.select()" id="system-info-textarea" name="edd-sysinfo" title="<?php _e('To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac).'); ?>" />
303
  <hr />
304
  <h3><?php _e('Customizing your Feed'); ?></h3>
305
- <p><?php _e("Use the <a href='admin.php?page=cff-style'>Layout &amp; Style</a> page to customize your feed. If you're displaying multiple feeds then you can override your settings directly in the shortcode like so:"); ?></p>
306
  <p>[custom-facebook-feed <b><span style='color: green;'>id=some-other-page-id num=3 height=500px</span></b>]</p>
307
  <p><a href="http://smashballoon.com/custom-facebook-feed/docs/shortcodes/" target="_blank"><?php _e('See a full list of shortcode options'); ?></a></p>
308
- <hr />
309
- <h3><?php _e('Plugin Support'); ?></h3>
 
 
 
 
 
 
310
  <p>Having trouble getting the plugin to work? Try the links below:</p>
311
  <ul>
312
  <li>- <?php _e('<a href="http://smashballoon.com/custom-facebook-feed/faq/general/" target="_blank">General Questions</a>'); ?></li>
313
  <li>- <?php _e('<a href="http://smashballoon.com/custom-facebook-feed/faq/setup/" target="_blank">Setting Up &amp; Displaying your Feed</a>'); ?></li>
314
  <li>- <?php _e('<a href="http://smashballoon.com/custom-facebook-feed/faq/troubleshooting/" target="_blank">Troubleshooting &amp; Common Support Questions</a>'); ?></li>
315
  </ul>
 
 
 
 
 
 
 
 
316
 
 
317
  <p><?php _e('Still need help? <a href="http://smashballoon.com/custom-facebook-feed/support/" target="_blank">Request support</a>.'); ?></p>
318
- <p>Smash Balloon is committed to making this plugin better. Please let us know if you have had any issues when using this plugin so that we can continue to improve it!</p>
319
-
320
- <hr />
321
- <a href="http://smashballoon.com/custom-facebook-feed/demo" target="_blank"><img src="<?php echo plugins_url( 'img/pro.png' , __FILE__ ) ?>" /></a>
322
- <hr />
323
 
324
- <h4><?php _e('<u>System Info:</u>'); ?></h4>
 
325
  <p>PHP Version: <b><?php echo PHP_VERSION . "\n"; ?></b></p>
326
  <p>Web Server Info: <b><?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?></b></p>
327
  <p>PHP allow_url_fopen: <b><?php echo ini_get( 'allow_url_fopen' ) ? "<span style='color: green;'>Yes</span>" : "<span style='color: red;'>No</span>"; ?></b></p>
328
  <p>PHP cURL: <b><?php echo is_callable('curl_init') ? "<span style='color: green;'>Yes</span>" : "<span style='color: red;'>No</span>" ?></b></p>
329
  <p>JSON: <b><?php echo function_exists("json_decode") ? "<span style='color: green;'>Yes</span>" : "<span style='color: red;'>No</span>" ?></b></p>
330
-
331
  <button class="button secondary-button" id="cff-api-test">Test connection to Facebook API</button>
332
 
333
  <div id="cff-api-test-result">
334
- <div class="cff-loader"></div>
335
- <textarea readonly="readonly" onclick="this.focus();this.select()" title="To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)."></textarea>
336
  </div>
 
 
337
 
338
 
339
  <?php
@@ -991,9 +1014,7 @@ function cff_style_page() {
991
  <tr valign="top">
992
  <th class="bump-left" scope="row"><label><?php _e('Feed Background Color'); ?></label></th>
993
  <td>
994
- <label for="cff_bg_color">#</label>
995
- <input name="cff_bg_color" type="text" value="<?php esc_attr_e( $cff_bg_color ); ?>" size="10" placeholder="Eg. ED9A00" />
996
- <span><a href="http://www.colorpicker.com/" target="_blank"><?php _e('Color Picker'); ?></a></span>
997
  </td>
998
  </tr>
999
  <tr valign="top">
@@ -1047,38 +1068,36 @@ function cff_style_page() {
1047
  <br />
1048
  <h3><?php _e('Post Layout'); ?></h3>
1049
  <table class="form-table">
 
1050
  <tbody>
1051
  <tr>
1052
- <td><p><?php _e('Choose a layout from the 3 below:'); ?></p></td>
1053
  <td>
1054
- <select name="cff_preset_layout" disabled>
1055
- <option value="thumb"><?php _e('Thumbnail'); ?></option>
1056
- <option value="half"><?php _e('Half-width'); ?></option>
1057
- <option value="full"><?php _e('Full-width'); ?></option>
1058
- </select>
1059
  <i style="color: #666; font-size: 11px; margin-left: 5px;"><a href="http://smashballoon.com/custom-facebook-feed/" target="_blank"><?php _e('Upgrade to Pro to enable post layouts'); ?></a></i>
1060
- </td>
1061
- </tr>
1062
- <tr valign="top">
1063
- <th scope="row"><?php _e('Thumbnail:'); ?></th>
1064
- <td>
1065
- <img src="<?php echo plugins_url( 'img/layout-thumb.png' , __FILE__ ) ?>" alt="Thumbnail Layout" width="400px" style="border: 1px solid #ccc;" />
1066
- </td>
1067
- </tr>
1068
- <tr valign="top">
1069
- <th scope="row"><?php _e('Half-width:'); ?></th>
1070
- <td>
1071
- <img src="<?php echo plugins_url( 'img/layout-half.png' , __FILE__ ) ?>" alt="Half Width Layout" width="400px" style="border: 1px solid #ccc;" />
1072
- </td>
1073
- </tr>
1074
- <tr valign="top">
1075
- <th scope="row"><?php _e('Full-width:'); ?></th>
1076
- <td>
1077
- <img src="<?php echo plugins_url( 'img/layout-full.png' , __FILE__ ) ?>" alt="Full Width Layout" width="400px" style="border: 1px solid #ccc;" />
1078
  </td>
1079
  </tr>
1080
  </tbody>
1081
  </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1082
  <hr />
1083
  <h3><?php _e('Show/Hide'); ?></h3>
1084
  <table class="form-table">
@@ -1218,8 +1237,7 @@ function cff_style_page() {
1218
  <tr>
1219
  <th><label for="cff_title_color" class="bump-left"><?php _e('Text Color'); ?></label></th>
1220
  <td>
1221
- #<input name="cff_title_color" type="text" value="<?php esc_attr_e( $cff_title_color ); ?>" size="10" placeholder="Eg. ED9A00" />
1222
- <span><a href="http://www.colorpicker.com/" target="_blank"><?php _e('Color Picker'); ?></a></span>
1223
  </td>
1224
  </tr>
1225
  <tr>
@@ -1275,8 +1293,7 @@ function cff_style_page() {
1275
  <th><label for="cff_body_color" class="bump-left"><?php _e('Text Color'); ?></label></th>
1276
 
1277
  <td>
1278
- #<input name="cff_body_color" type="text" value="<?php esc_attr_e( $cff_body_color ); ?>" size="10" placeholder="Eg. ED9A00" />
1279
- <a href="http://www.colorpicker.com/" target="_blank"><?php _e('Color Picker'); ?></a>
1280
  </td>
1281
  </tr>
1282
  </tbody>
@@ -1337,8 +1354,7 @@ function cff_style_page() {
1337
  <tr>
1338
  <th><label for="cff_date_color" class="bump-left"><?php _e('Text Color'); ?></label></th>
1339
  <td>
1340
- #<input name="cff_date_color" type="text" value="<?php esc_attr_e( $cff_date_color ); ?>" size="10" placeholder="Eg. ED9A00" />
1341
- <a href="http://www.colorpicker.com/" target="_blank">Color Picker</a>
1342
  </td>
1343
  </tr>
1344
 
@@ -1362,7 +1378,7 @@ function cff_style_page() {
1362
  <option value="13" <?php if($cff_date_formatting == "13") echo 'selected="selected"' ?> ><?php echo date('d/m/y', $original); ?></option>
1363
  </select>
1364
 
1365
- <a class="cff-tooltip-link" href="JavaScript:void(0);" id="cff-translate-date"><?php _e('Translate this'); ?></a>
1366
  <div class="cff-tooltip">
1367
  <div class="cff-tooltip-table">
1368
  <p style="margin-bottom: 15px;"><?php _e('Translate the text below into the language you would like to use:'); ?></p>
@@ -1520,7 +1536,7 @@ function cff_style_page() {
1520
  <th><label for="cff_date_custom" class="bump-left"><?php _e('Custom format'); ?></label></th>
1521
  <td>
1522
  <input name="cff_date_custom" type="text" value="<?php esc_attr_e( $cff_date_custom ); ?>" size="10" placeholder="Eg. F j, Y" />
1523
- <a href="http://smashballoon.com/custom-facebook-feed/docs/date/" target="_blank"><?php _e('Examples'); ?></a>
1524
  </td>
1525
  </tr>
1526
  <tr>
@@ -1591,8 +1607,7 @@ function cff_style_page() {
1591
  <tr>
1592
  <th><label for="cff_event_title_color" class="bump-left"><?php _e('Text Color'); ?></label></th>
1593
  <td>
1594
- <input name="cff_event_title_color" type="text" value="<?php esc_attr_e( $cff_event_title_color ); ?>" size="10" placeholder="Eg. ED9A00" />
1595
- <a href="http://www.colorpicker.com/" target="_blank"><?php _e('Color Picker'); ?></a>
1596
  </td>
1597
  </tr>
1598
  <tr>
@@ -1649,8 +1664,7 @@ function cff_style_page() {
1649
  <tr>
1650
  <th><label for="cff_event_date_color" class="bump-left"><?php _e('Text Color'); ?></label></th>
1651
  <td>
1652
- #<input name="cff_event_date_color" type="text" value="<?php esc_attr_e( $cff_event_date_color ); ?>" size="10" placeholder="Eg. ED9A00" />
1653
- <a href="http://www.colorpicker.com/" target="_blank"><?php _e('Color Picker'); ?></a>
1654
  </td>
1655
  </tr>
1656
  <tr valign="top">
@@ -1687,7 +1701,7 @@ function cff_style_page() {
1687
  <th><label for="cff_event_date_custom" class="bump-left"><?php _e('Custom event date format'); ?></label></th>
1688
  <td>
1689
  <input name="cff_event_date_custom" type="text" value="<?php esc_attr_e( $cff_event_date_custom ); ?>" size="10" placeholder="Eg. F j, Y - g:ia" />
1690
- <a href="http://smashballoon.com/custom-facebook-feed/docs/date/" target="_blank"><?php _e('Examples'); ?></a>
1691
  </td>
1692
  </tr>
1693
  </tbody>
@@ -1737,8 +1751,7 @@ function cff_style_page() {
1737
  <tr>
1738
  <th><label for="cff_event_details_color" class="bump-left"><?php _e('Text Color'); ?></label></th>
1739
  <td>
1740
- #<input name="cff_event_details_color" type="text" value="<?php esc_attr_e( $cff_event_details_color ); ?>" size="10" placeholder="Eg. ED9A00" />
1741
- <a href="http://www.colorpicker.com/" target="_blank"><?php _e('Color Picker'); ?></a>
1742
  </td>
1743
  </tr>
1744
  </tbody>
@@ -1788,8 +1801,7 @@ function cff_style_page() {
1788
  <tr>
1789
  <th><label for="cff_link_color" class="bump-left"><?php _e('Text Color'); ?></label></th>
1790
  <td>
1791
- <input name="cff_link_color" type="text" value="<?php esc_attr_e( $cff_link_color ); ?>" size="10" placeholder="Eg. ED9A00" />
1792
- <a href="http://www.colorpicker.com/" target="_blank"><?php _e('Color Picker'); ?></a>
1793
  </td>
1794
  </tr>
1795
  <tr>
@@ -1824,6 +1836,7 @@ function cff_style_page() {
1824
  <tr valign="top">
1825
  <td>
1826
  <?php _e('Enter your own custom CSS in the box below'); ?>
 
1827
  </td>
1828
  </tr>
1829
  <tr valign="top">
@@ -1839,6 +1852,7 @@ function cff_style_page() {
1839
  <tr valign="top">
1840
  <td>
1841
  <?php _e('Enter your own custom JavaScript/jQuery in the box below'); ?>
 
1842
  </td>
1843
  </tr>
1844
  <tr valign="top">
@@ -1856,31 +1870,31 @@ function cff_style_page() {
1856
  <tr valign="top">
1857
  <th class="bump-left" scope="row"><label><?php _e('Show the Like Box'); ?></label></th>
1858
  <td>
1859
- <input type="checkbox" name="cff_show_like_box" id="cff_show_like_box" <?php if($cff_show_like_box == true) echo 'checked="checked"' ?> />
 
 
1860
  </td>
1861
  </tr>
1862
  <tr valign="top">
1863
- <th class="bump-left" scope="row"><label><?php _e('Like Box Position'); ?></label></th>
1864
  <td>
1865
  <select name="cff_like_box_position">
1866
- <option value="bottom" <?php if($cff_like_box_position == "bottom") echo 'selected="selected"' ?> ><?php _e('Bottom'); ?></option>
1867
- <option value="top" <?php if($cff_like_box_position == "top") echo 'selected="selected"' ?> ><?php _e('Top'); ?></option>
1868
  </select>
1869
  </td>
1870
  </tr>
1871
  <tr valign="top">
1872
  <th class="bump-left" scope="row"><label><?php _e('Display outside the scrollable area'); ?></label></th>
1873
  <td>
1874
- <input type="checkbox" name="cff_like_box_outside" id="cff_like_box_outside" <?php if($cff_like_box_outside == true) echo 'checked="checked"' ?> />
1875
  <i style="color: #666; font-size: 11px; margin-left: 5px;"><?php _e('(Only applicable if you have set a height on the feed)'); ?></i>
1876
  </td>
1877
  </tr>
1878
  <tr valign="top">
1879
- <th class="bump-left" scope="row"><label><?php _e('Like Box Background Color'); ?></label></th>
1880
  <td>
1881
- <label for="cff_likebox_bg_color">#</label>
1882
- <input name="cff_likebox_bg_color" type="text" value="<?php esc_attr_e( $cff_likebox_bg_color ); ?>" size="10" />
1883
- <span>Eg. ED9A00</span>&nbsp;&nbsp;<a href="http://www.colorpicker.com/" target="_blank"><?php _e('Color Picker'); ?></a>
1884
  </td>
1885
  </tr>
1886
  <tr valign="top">
@@ -1890,7 +1904,7 @@ function cff_style_page() {
1890
  <option value="blue" <?php if($cff_like_box_text_color == "blue") echo 'selected="selected"' ?> ><?php _e('Blue'); ?></option>
1891
  <option value="white" <?php if($cff_like_box_text_color == "white") echo 'selected="selected"' ?> ><?php _e('White'); ?></option>
1892
  </select>
1893
- <a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e('Why only these 2 colors?'); ?></a>
1894
  <p class="cff-tooltip"><?php _e("The styling of the Facebook Like box widget is restricted by Facebook. This means that the only two text colors available are blue and white, intended for either a light of dark color scheme respectively."); ?></p>
1895
  </td>
1896
  </tr>
@@ -1904,14 +1918,14 @@ function cff_style_page() {
1904
  <tr valign="top">
1905
  <th class="bump-left" scope="row"><label><?php _e('Show faces of fans'); ?></label></th>
1906
  <td>
1907
- <input type="checkbox" name="cff_like_box_faces" id="cff_like_box_faces" <?php if($cff_like_box_faces == true) echo 'checked="checked"' ?> />
1908
  <i style="color: #666; font-size: 11px; margin-left: 5px;"><?php _e('Show thumbnail photos of fans who like your page'); ?></i>
1909
  </td>
1910
  </tr>
1911
  <tr valign="top">
1912
  <th class="bump-left" scope="row"><label><?php _e('Show the Like Box border'); ?></label></th>
1913
  <td>
1914
- <input type="checkbox" name="cff_like_box_border" id="cff_like_box_outside" <?php if($cff_like_box_border == true) echo 'checked="checked"' ?> />
1915
  <i style="color: #666; font-size: 11px; margin-left: 5px;"><?php _e('Only applicable if you are showing faces of fans'); ?></i>
1916
  </td>
1917
  </tr>
@@ -1947,9 +1961,7 @@ function cff_style_page() {
1947
  <tr valign="top">
1948
  <th class="bump-left" scope="row"><label><?php _e('Background Color'); ?></label></th>
1949
  <td>
1950
- <label for="cff_header_bg_color">#</label>
1951
- <input name="cff_header_bg_color" type="text" value="<?php esc_attr_e( $cff_header_bg_color ); ?>" size="10" />
1952
- <span>Eg. ED9A00</span>&nbsp;&nbsp;<a href="http://www.colorpicker.com/" target="_blank"><?php _e('Color Picker'); ?></a>
1953
  </td>
1954
  </tr>
1955
  </tr>
@@ -1995,8 +2007,7 @@ function cff_style_page() {
1995
  <tr>
1996
  <th class="bump-left" scope="row"><label><?php _e('Text Color'); ?></label></th>
1997
  <td>
1998
- #<input name="cff_header_text_color" type="text" value="<?php esc_attr_e( $cff_header_text_color ); ?>" size="10" placeholder="Eg. ED9A00" />
1999
- <span><a href="http://www.colorpicker.com/" target="_blank"><?php _e('Color Picker'); ?></a></span>
2000
  </td>
2001
  </tr>
2002
  <tr>
@@ -2030,8 +2041,7 @@ function cff_style_page() {
2030
  <tr>
2031
  <th class="bump-left" scope="row"><label><?php _e('Icon Color'); ?></label></th>
2032
  <td>
2033
- #<input name="cff_header_icon_color" id="cff-header-icon-color" type="text" value="<?php esc_attr_e( $cff_header_icon_color ); ?>" size="10" placeholder="Eg. ED9A00" />
2034
- <span><a href="http://www.colorpicker.com/" target="_blank"><?php _e('Color Picker'); ?></a></span>
2035
  </td>
2036
  </tr>
2037
  <tr>
@@ -2068,9 +2078,7 @@ function cff_style_page() {
2068
  <tr valign="top">
2069
  <th class="bump-left" scope="row"><label><?php _e('Separating Line Color'); ?></label></th>
2070
  <td>
2071
- <label for="cff_sep_color">#</label>
2072
- <input name="cff_sep_color" type="text" value="<?php esc_attr_e( $cff_sep_color ); ?>" size="10" />
2073
- <span>Eg. ED9A00</span>&nbsp;&nbsp;<a href="http://www.colorpicker.com/" target="_blank"><?php _e('Color Picker'); ?></a>
2074
  </td>
2075
  </tr>
2076
  <tr valign="top">
@@ -2086,7 +2094,7 @@ function cff_style_page() {
2086
  <?php } //End Misc tab ?>
2087
 
2088
 
2089
- <?php if( $active_tab == 'custom_text' ) { //Start Post Layout tab ?>
2090
  <input type="hidden" name="<?php echo $style_custom_text_hidden_field_name; ?>" value="Y">
2091
  <br />
2092
  <h3><?php _e('Custom Text / Translate'); ?></h3>
@@ -2186,21 +2194,22 @@ function cff_style_page() {
2186
  </table>
2187
 
2188
  <?php submit_button(); ?>
2189
- <?php } //End Post Layout tab ?>
2190
 
2191
  </form>
2192
  <?php
2193
  } //End Style_Page
2194
  //Enqueue admin styles
2195
  function cff_admin_style() {
2196
- wp_register_style( 'custom_wp_admin_css', plugin_dir_url( __FILE__ ) . 'css/cff-admin-style.css', false, '1.0.0' );
2197
  wp_enqueue_style( 'custom_wp_admin_css' );
2198
  wp_enqueue_style( 'cff-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css', array(), '4.0.3' );
 
2199
  }
2200
  add_action( 'admin_enqueue_scripts', 'cff_admin_style' );
2201
  //Enqueue admin scripts
2202
  function cff_admin_scripts() {
2203
- wp_enqueue_script( 'cff_admin_script', plugin_dir_url( __FILE__ ) . 'js/cff-admin-scripts.js' );
2204
  if( !wp_script_is('jquery-ui-draggable') ) {
2205
  wp_enqueue_script(
2206
  array(
@@ -2210,7 +2219,12 @@ function cff_admin_scripts() {
2210
  )
2211
  );
2212
  }
2213
- wp_enqueue_script( 'hoverIntent' );
 
 
 
 
 
2214
  }
2215
  add_action( 'admin_enqueue_scripts', 'cff_admin_scripts' );
2216
  ?>
1
  <?php
2
+
3
  function cff_menu() {
4
  add_menu_page(
5
  '',
22
  function cff_styling_menu() {
23
  add_submenu_page(
24
  'cff-top',
25
+ 'Customize',
26
+ 'Customize',
27
  'manage_options',
28
  'cff-style',
29
  'cff_style_page'
30
  );
31
  }
32
  add_action('admin_menu', 'cff_styling_menu');
33
+
34
  //Create Settings page
35
  function cff_settings_page() {
36
  //Declare variables for fields
106
 
107
  <div id="cff-admin" class="wrap">
108
  <div id="header">
109
+ <h2><?php _e('Custom Facebook Feed Settings'); ?></h2>
110
  </div>
111
 
112
+ <?php
113
+ $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'configuration';
114
+ ?>
115
+ <h2 class="nav-tab-wrapper">
116
+ <a href="?page=cff-top&amp;tab=configuration" class="nav-tab <?php echo $active_tab == 'configuration' ? 'nav-tab-active' : ''; ?>"><?php _e('Configuration'); ?></a>
117
+ <a href="?page=cff-top&amp;tab=support" class="nav-tab <?php echo $active_tab == 'support' ? 'nav-tab-active' : ''; ?>"><?php _e('Support'); ?></a>
118
+ </h2>
119
+
120
+ <?php if( $active_tab == 'configuration' ) { //Start Extensions tab ?>
121
+
122
  <form name="form1" method="post" action="">
123
  <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
124
  <br />
181
  <option value="onlyothers" <?php if($cff_show_others_val == 'onlyothers') echo 'selected="selected"' ?> ><?php _e('Only other people'); ?></option>
182
  </select>
183
 
184
+ <p id="cff-others-only" style="font-size: 12px;"><b>Note:</b> Only displaying posts by other people works by retrieving your posts from Facebook and then filtering out the posts by the page owner. If this option doesn't display many posts then you can retrieve more by setting the post limit option (below) to a higher number (a number 15-20 greater than the number of posts you want to display).</p>
185
 
186
  </td>
187
  </tr>
304
  </tbody>
305
  </table>
306
  <?php submit_button(); ?>
307
+ <p>Having trouble using the plugin? Check out the <a href='admin.php?page=cff-top&amp;tab=support'>Support</a> tab.</p>
308
  </form>
 
 
 
309
  <hr />
310
  <h3><?php _e('Displaying your Feed'); ?></h3>
311
+ <p><?php _e("Copy and paste this shortcode directly into the page, post or widget where you'd like the feed to show up:"); ?></p>
312
+ <input type="text" value="[custom-facebook-feed]" size="22" readonly="readonly" onclick="this.focus();this.select()" title="<?php _e('To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac).'); ?>" />
313
  <hr />
314
  <h3><?php _e('Customizing your Feed'); ?></h3>
315
+ <p><?php _e("Use the <a href='admin.php?page=cff-style'>Customize</a> page to customize your feed. If you're displaying multiple feeds then you can override your settings directly in the shortcode like so:"); ?></p>
316
  <p>[custom-facebook-feed <b><span style='color: green;'>id=some-other-page-id num=3 height=500px</span></b>]</p>
317
  <p><a href="http://smashballoon.com/custom-facebook-feed/docs/shortcodes/" target="_blank"><?php _e('See a full list of shortcode options'); ?></a></p>
318
+
319
+ <?php } //End config tab ?>
320
+
321
+
322
+ <?php if( $active_tab == 'support' ) { //Start Support tab ?>
323
+
324
+ <br />
325
+ <h3><?php _e('FAQs and Troubleshooting'); ?></h3>
326
  <p>Having trouble getting the plugin to work? Try the links below:</p>
327
  <ul>
328
  <li>- <?php _e('<a href="http://smashballoon.com/custom-facebook-feed/faq/general/" target="_blank">General Questions</a>'); ?></li>
329
  <li>- <?php _e('<a href="http://smashballoon.com/custom-facebook-feed/faq/setup/" target="_blank">Setting Up &amp; Displaying your Feed</a>'); ?></li>
330
  <li>- <?php _e('<a href="http://smashballoon.com/custom-facebook-feed/faq/troubleshooting/" target="_blank">Troubleshooting &amp; Common Support Questions</a>'); ?></li>
331
  </ul>
332
+ <br />
333
+ <h3>Documentation</h3>
334
+ <p>Need help setting up, configuring or customizing the plugin? Check out the links below:</p>
335
+ <ul>
336
+ <li>- <?php _e('<a href="http://smashballoon.com/custom-facebook-feed/docs/wordpress/" target="_blank">Installation and Configuration</a>'); ?></li>
337
+ <li>- <?php _e('<a href="http://smashballoon.com/custom-facebook-feed/docs/shortcodes/" target="_blank">Shortcode Reference</a>'); ?></li>
338
+ <li>- <?php _e('<a href="http://smashballoon.com/custom-facebook-feed/docs/snippets/" target="_blank">Custom CSS and JavaScript Snippets</a>'); ?></li>
339
+ </ul>
340
 
341
+ <br />
342
  <p><?php _e('Still need help? <a href="http://smashballoon.com/custom-facebook-feed/support/" target="_blank">Request support</a>.'); ?></p>
 
 
 
 
 
343
 
344
+ <br />
345
+ <h3><?php _e('System Info'); ?></h3>
346
  <p>PHP Version: <b><?php echo PHP_VERSION . "\n"; ?></b></p>
347
  <p>Web Server Info: <b><?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?></b></p>
348
  <p>PHP allow_url_fopen: <b><?php echo ini_get( 'allow_url_fopen' ) ? "<span style='color: green;'>Yes</span>" : "<span style='color: red;'>No</span>"; ?></b></p>
349
  <p>PHP cURL: <b><?php echo is_callable('curl_init') ? "<span style='color: green;'>Yes</span>" : "<span style='color: red;'>No</span>" ?></b></p>
350
  <p>JSON: <b><?php echo function_exists("json_decode") ? "<span style='color: green;'>Yes</span>" : "<span style='color: red;'>No</span>" ?></b></p>
351
+
352
  <button class="button secondary-button" id="cff-api-test">Test connection to Facebook API</button>
353
 
354
  <div id="cff-api-test-result">
355
+ <?php $posts_json = cff_fetchUrl("https://graph.facebook.com/".get_option( $page_id )."/feed?access_token=".get_option( $access_token )."&limit=1"); ?>
356
+ <textarea readonly="readonly" onclick="this.focus();this.select()" title="To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)."><?php echo $posts_json; ?></textarea>
357
  </div>
358
+
359
+ <?php } ?>
360
 
361
 
362
  <?php
1014
  <tr valign="top">
1015
  <th class="bump-left" scope="row"><label><?php _e('Feed Background Color'); ?></label></th>
1016
  <td>
1017
+ <input name="cff_bg_color" value="#<?php esc_attr_e( str_replace('#', '', $cff_bg_color) ); ?>" class="cff-colorpicker" />
 
 
1018
  </td>
1019
  </tr>
1020
  <tr valign="top">
1068
  <br />
1069
  <h3><?php _e('Post Layout'); ?></h3>
1070
  <table class="form-table">
1071
+
1072
  <tbody>
1073
  <tr>
 
1074
  <td>
1075
+ <p><?php _e("Choose a layout from the 3 below."); ?>
 
 
 
 
1076
  <i style="color: #666; font-size: 11px; margin-left: 5px;"><a href="http://smashballoon.com/custom-facebook-feed/" target="_blank"><?php _e('Upgrade to Pro to enable post layouts'); ?></a></i>
1077
+ </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1078
  </td>
1079
  </tr>
1080
  </tbody>
1081
  </table>
1082
+
1083
+ <div class="cff-layouts cff-disabled">
1084
+ <div class="cff-layout">
1085
+ <h3><input type="radio" name="cff_preset_layout" id="cff_preset_layout" value="thumb" />&nbsp;<?php _e('Thumbnail'); ?></h3>
1086
+ <img src="<?php echo plugins_url( 'img/layout-thumb.png' , __FILE__ ) ?>" alt="Thumbnail Layout" />
1087
+
1088
+ </div>
1089
+ <div class="cff-layout">
1090
+ <h3><input type="radio" name="cff_preset_layout" id="cff_preset_layout" value="half" />&nbsp;<?php _e('Half-width'); ?></h3>
1091
+ <img src="<?php echo plugins_url( 'img/layout-half.png' , __FILE__ ) ?>" alt="Half Width Layout" />
1092
+
1093
+ </div>
1094
+ <div class="cff-layout">
1095
+ <h3><input type="radio" name="cff_preset_layout" id="cff_preset_layout" value="full" />&nbsp;<?php _e('Full-width'); ?></h3>
1096
+ <img src="<?php echo plugins_url( 'img/layout-full.png' , __FILE__ ) ?>" alt="Full Width Layout" />
1097
+
1098
+ </div>
1099
+ </div>
1100
+
1101
  <hr />
1102
  <h3><?php _e('Show/Hide'); ?></h3>
1103
  <table class="form-table">
1237
  <tr>
1238
  <th><label for="cff_title_color" class="bump-left"><?php _e('Text Color'); ?></label></th>
1239
  <td>
1240
+ <input name="cff_title_color" value="#<?php esc_attr_e( str_replace('#', '', $cff_title_color) ); ?>" class="cff-colorpicker" />
 
1241
  </td>
1242
  </tr>
1243
  <tr>
1293
  <th><label for="cff_body_color" class="bump-left"><?php _e('Text Color'); ?></label></th>
1294
 
1295
  <td>
1296
+ <input name="cff_body_color" value="#<?php esc_attr_e( str_replace('#', '', $cff_body_color) ); ?>" class="cff-colorpicker" />
 
1297
  </td>
1298
  </tr>
1299
  </tbody>
1354
  <tr>
1355
  <th><label for="cff_date_color" class="bump-left"><?php _e('Text Color'); ?></label></th>
1356
  <td>
1357
+ <input name="cff_date_color" value="#<?php esc_attr_e( str_replace('#', '', $cff_date_color) ); ?>" class="cff-colorpicker" />
 
1358
  </td>
1359
  </tr>
1360
 
1378
  <option value="13" <?php if($cff_date_formatting == "13") echo 'selected="selected"' ?> ><?php echo date('d/m/y', $original); ?></option>
1379
  </select>
1380
 
1381
+ <i style="margin-left: 5px; font-size: 11px;"><a class="cff-tooltip-link" href="JavaScript:void(0);" id="cff-translate-date"><?php _e('Translate this'); ?></a></i>
1382
  <div class="cff-tooltip">
1383
  <div class="cff-tooltip-table">
1384
  <p style="margin-bottom: 15px;"><?php _e('Translate the text below into the language you would like to use:'); ?></p>
1536
  <th><label for="cff_date_custom" class="bump-left"><?php _e('Custom format'); ?></label></th>
1537
  <td>
1538
  <input name="cff_date_custom" type="text" value="<?php esc_attr_e( $cff_date_custom ); ?>" size="10" placeholder="Eg. F j, Y" />
1539
+ <i style="margin-left: 5px; font-size: 11px;"><a href="http://smashballoon.com/custom-facebook-feed/docs/date/" target="_blank"><?php _e('Examples'); ?></a></i>
1540
  </td>
1541
  </tr>
1542
  <tr>
1607
  <tr>
1608
  <th><label for="cff_event_title_color" class="bump-left"><?php _e('Text Color'); ?></label></th>
1609
  <td>
1610
+ <input name="cff_event_title_color" value="#<?php esc_attr_e( str_replace('#', '', $cff_event_title_color) ); ?>" class="cff-colorpicker" />
 
1611
  </td>
1612
  </tr>
1613
  <tr>
1664
  <tr>
1665
  <th><label for="cff_event_date_color" class="bump-left"><?php _e('Text Color'); ?></label></th>
1666
  <td>
1667
+ <input name="cff_event_date_color" value="#<?php esc_attr_e( str_replace('#', '', $cff_event_date_color) ); ?>" class="cff-colorpicker" />
 
1668
  </td>
1669
  </tr>
1670
  <tr valign="top">
1701
  <th><label for="cff_event_date_custom" class="bump-left"><?php _e('Custom event date format'); ?></label></th>
1702
  <td>
1703
  <input name="cff_event_date_custom" type="text" value="<?php esc_attr_e( $cff_event_date_custom ); ?>" size="10" placeholder="Eg. F j, Y - g:ia" />
1704
+ <i style="margin-left: 5px; font-size: 11px;"><a href="http://smashballoon.com/custom-facebook-feed/docs/date/" target="_blank"><?php _e('Examples'); ?></a></i>
1705
  </td>
1706
  </tr>
1707
  </tbody>
1751
  <tr>
1752
  <th><label for="cff_event_details_color" class="bump-left"><?php _e('Text Color'); ?></label></th>
1753
  <td>
1754
+ <input name="cff_event_details_color" value="#<?php esc_attr_e( str_replace('#', '', $cff_event_details_color) ); ?>" class="cff-colorpicker" />
 
1755
  </td>
1756
  </tr>
1757
  </tbody>
1801
  <tr>
1802
  <th><label for="cff_link_color" class="bump-left"><?php _e('Text Color'); ?></label></th>
1803
  <td>
1804
+ <input name="cff_link_color" value="#<?php esc_attr_e( str_replace('#', '', $cff_link_color) ); ?>" class="cff-colorpicker" />
 
1805
  </td>
1806
  </tr>
1807
  <tr>
1836
  <tr valign="top">
1837
  <td>
1838
  <?php _e('Enter your own custom CSS in the box below'); ?>
1839
+ <i style="margin-left: 5px; font-size: 11px;"><a href="http://smashballoon.com/custom-facebook-feed/docs/snippets/" target="_blank"><?php _e('See some examples'); ?></a></i>
1840
  </td>
1841
  </tr>
1842
  <tr valign="top">
1852
  <tr valign="top">
1853
  <td>
1854
  <?php _e('Enter your own custom JavaScript/jQuery in the box below'); ?>
1855
+ <i style="margin-left: 5px; font-size: 11px;"><a href="http://smashballoon.com/custom-facebook-feed/docs/snippets/" target="_blank"><?php _e('See some examples'); ?></a></i>
1856
  </td>
1857
  </tr>
1858
  <tr valign="top">
1870
  <tr valign="top">
1871
  <th class="bump-left" scope="row"><label><?php _e('Show the Like Box'); ?></label></th>
1872
  <td>
1873
+ <input type="checkbox" name="cff_show_like_box" id="cff_show_like_box" <?php if($cff_show_like_box == true) echo 'checked="checked"' ?> />&nbsp;<?php _e('Yes'); ?>
1874
+ <i style="margin-left: 5px; font-size: 11px;"><a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e("Why isn't the Like Box showing up?"); ?></a></i>
1875
+ <p class="cff-tooltip"><?php _e("The most common reason is that you may have an extension installed in your web browser which is blocking the plugin from loading the Like Box from Facebook."); ?></p>
1876
  </td>
1877
  </tr>
1878
  <tr valign="top">
1879
+ <th class="bump-left" scope="row"><label><?php _e('Position'); ?></label></th>
1880
  <td>
1881
  <select name="cff_like_box_position">
1882
+ <option value="bottom" <?php if($cff_like_box_position == "bottom") echo 'selected="selected"' ?> ><?php _e('Above posts'); ?></option>
1883
+ <option value="top" <?php if($cff_like_box_position == "top") echo 'selected="selected"' ?> ><?php _e('Below posts'); ?></option>
1884
  </select>
1885
  </td>
1886
  </tr>
1887
  <tr valign="top">
1888
  <th class="bump-left" scope="row"><label><?php _e('Display outside the scrollable area'); ?></label></th>
1889
  <td>
1890
+ <input type="checkbox" name="cff_like_box_outside" id="cff_like_box_outside" <?php if($cff_like_box_outside == true) echo 'checked="checked"' ?> />&nbsp;<?php _e('Yes'); ?>
1891
  <i style="color: #666; font-size: 11px; margin-left: 5px;"><?php _e('(Only applicable if you have set a height on the feed)'); ?></i>
1892
  </td>
1893
  </tr>
1894
  <tr valign="top">
1895
+ <th class="bump-left" scope="row"><label><?php _e('Background Color'); ?></label></th>
1896
  <td>
1897
+ <input name="cff_likebox_bg_color" value="#<?php esc_attr_e( str_replace('#', '', $cff_likebox_bg_color) ); ?>" class="cff-colorpicker" />
 
 
1898
  </td>
1899
  </tr>
1900
  <tr valign="top">
1904
  <option value="blue" <?php if($cff_like_box_text_color == "blue") echo 'selected="selected"' ?> ><?php _e('Blue'); ?></option>
1905
  <option value="white" <?php if($cff_like_box_text_color == "white") echo 'selected="selected"' ?> ><?php _e('White'); ?></option>
1906
  </select>
1907
+ <i style="margin-left: 5px; font-size: 11px;"><a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e('Why only these 2 colors?'); ?></a></i>
1908
  <p class="cff-tooltip"><?php _e("The styling of the Facebook Like box widget is restricted by Facebook. This means that the only two text colors available are blue and white, intended for either a light of dark color scheme respectively."); ?></p>
1909
  </td>
1910
  </tr>
1918
  <tr valign="top">
1919
  <th class="bump-left" scope="row"><label><?php _e('Show faces of fans'); ?></label></th>
1920
  <td>
1921
+ <input type="checkbox" name="cff_like_box_faces" id="cff_like_box_faces" <?php if($cff_like_box_faces == true) echo 'checked="checked"' ?> />&nbsp;<?php _e('Yes'); ?>
1922
  <i style="color: #666; font-size: 11px; margin-left: 5px;"><?php _e('Show thumbnail photos of fans who like your page'); ?></i>
1923
  </td>
1924
  </tr>
1925
  <tr valign="top">
1926
  <th class="bump-left" scope="row"><label><?php _e('Show the Like Box border'); ?></label></th>
1927
  <td>
1928
+ <input type="checkbox" name="cff_like_box_border" id="cff_like_box_outside" <?php if($cff_like_box_border == true) echo 'checked="checked"' ?> />&nbsp;<?php _e('Yes'); ?>
1929
  <i style="color: #666; font-size: 11px; margin-left: 5px;"><?php _e('Only applicable if you are showing faces of fans'); ?></i>
1930
  </td>
1931
  </tr>
1961
  <tr valign="top">
1962
  <th class="bump-left" scope="row"><label><?php _e('Background Color'); ?></label></th>
1963
  <td>
1964
+ <input name="cff_header_bg_color" value="#<?php esc_attr_e( str_replace('#', '', $cff_header_bg_color) ); ?>" class="cff-colorpicker" />
 
 
1965
  </td>
1966
  </tr>
1967
  </tr>
2007
  <tr>
2008
  <th class="bump-left" scope="row"><label><?php _e('Text Color'); ?></label></th>
2009
  <td>
2010
+ <input name="cff_header_text_color" value="#<?php esc_attr_e( str_replace('#', '', $cff_header_text_color) ); ?>" class="cff-colorpicker" />
 
2011
  </td>
2012
  </tr>
2013
  <tr>
2041
  <tr>
2042
  <th class="bump-left" scope="row"><label><?php _e('Icon Color'); ?></label></th>
2043
  <td>
2044
+ <input name="cff_header_icon_color" value="#<?php esc_attr_e( str_replace('#', '', $cff_header_icon_color) ); ?>" class="cff-colorpicker" />
 
2045
  </td>
2046
  </tr>
2047
  <tr>
2078
  <tr valign="top">
2079
  <th class="bump-left" scope="row"><label><?php _e('Separating Line Color'); ?></label></th>
2080
  <td>
2081
+ <input name="cff_sep_color" value="#<?php esc_attr_e( str_replace('#', '', $cff_sep_color) ); ?>" class="cff-colorpicker" />
 
 
2082
  </td>
2083
  </tr>
2084
  <tr valign="top">
2094
  <?php } //End Misc tab ?>
2095
 
2096
 
2097
+ <?php if( $active_tab == 'custom_text' ) { //Start Custom Text tab ?>
2098
  <input type="hidden" name="<?php echo $style_custom_text_hidden_field_name; ?>" value="Y">
2099
  <br />
2100
  <h3><?php _e('Custom Text / Translate'); ?></h3>
2194
  </table>
2195
 
2196
  <?php submit_button(); ?>
2197
+ <?php } //End Custom Text tab ?>
2198
 
2199
  </form>
2200
  <?php
2201
  } //End Style_Page
2202
  //Enqueue admin styles
2203
  function cff_admin_style() {
2204
+ wp_register_style( 'custom_wp_admin_css', plugin_dir_url( __FILE__ ) . 'css/cff-admin-style.css?2', false, '1.0.0' );
2205
  wp_enqueue_style( 'custom_wp_admin_css' );
2206
  wp_enqueue_style( 'cff-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css', array(), '4.0.3' );
2207
+ wp_enqueue_style( 'wp-color-picker' );
2208
  }
2209
  add_action( 'admin_enqueue_scripts', 'cff_admin_style' );
2210
  //Enqueue admin scripts
2211
  function cff_admin_scripts() {
2212
+ wp_enqueue_script( 'cff_admin_script', plugin_dir_url( __FILE__ ) . 'js/cff-admin-scripts.js?2' );
2213
  if( !wp_script_is('jquery-ui-draggable') ) {
2214
  wp_enqueue_script(
2215
  array(
2219
  )
2220
  );
2221
  }
2222
+ wp_enqueue_script(
2223
+ array(
2224
+ 'hoverIntent',
2225
+ 'wp-color-picker'
2226
+ )
2227
+ );
2228
  }
2229
  add_action( 'admin_enqueue_scripts', 'cff_admin_scripts' );
2230
  ?>
custom-facebook-feed.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Custom Facebook Feed
4
  Plugin URI: http://smashballoon.com/custom-facebook-feed
5
  Description: Add a completely customizable Facebook feed to your WordPress site
6
- Version: 1.7.2
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
@@ -47,6 +47,7 @@ function display_cff($atts) {
47
  //Pass in shortcode attrbutes
48
  $atts = shortcode_atts(
49
  array(
 
50
  'id' => get_option('cff_page_id'),
51
  'pagetype' => get_option('cff_page_type'),
52
  'num' => get_option('cff_num_show'),
@@ -149,8 +150,6 @@ function display_cff($atts) {
149
  $cff_page_type = $atts[ 'pagetype' ];
150
  ($cff_page_type == 'group') ? $cff_is_group = true : $cff_is_group = false;
151
 
152
- $cff_post_limit = $atts[ 'limit' ];
153
-
154
  $cff_feed_width = $atts['width'];
155
  $cff_feed_height = $atts[ 'height' ];
156
  $cff_feed_padding = $atts[ 'padding' ];
@@ -167,7 +166,7 @@ function display_cff($atts) {
167
  if ( !empty($cff_feed_width) ) $cff_feed_styles .= 'width:' . $cff_feed_width . '; ';
168
  if ( !empty($cff_feed_height) ) $cff_feed_styles .= 'height:' . $cff_feed_height . '; ';
169
  if ( !empty($cff_feed_padding) ) $cff_feed_styles .= 'padding:' . $cff_feed_padding . '; ';
170
- if ( !empty($cff_bg_color) ) $cff_feed_styles .= 'background-color:#' . $cff_bg_color . '; ';
171
  $cff_feed_styles .= '"';
172
  //Like box
173
  $cff_like_box_position = $atts[ 'likeboxpos' ];
@@ -222,8 +221,8 @@ function display_cff($atts) {
222
  $cff_meta_text_color = $atts[ 'socialtextcolor' ];
223
  $cff_meta_bg_color = $atts[ 'socialbgcolor' ];
224
  $cff_meta_styles = 'style="';
225
- if ( !empty($cff_meta_text_color) ) $cff_meta_styles .= 'color:#' . $cff_meta_text_color . ';';
226
- if ( !empty($cff_meta_bg_color) ) $cff_meta_styles .= 'background-color:#' . $cff_meta_bg_color . ';';
227
  $cff_meta_styles .= '"';
228
  $cff_nocomments_text = isset($options[ 'cff_nocomments_text' ]) ? $options[ 'cff_nocomments_text' ] : '';
229
  $cff_hide_comments = isset($options[ 'cff_hide_comments' ]) ? $options[ 'cff_hide_comments' ] : '';
@@ -242,7 +241,7 @@ function display_cff($atts) {
242
  $cff_title_styles = 'style="';
243
  if ( !empty($cff_title_size) && $cff_title_size != 'inherit' ) $cff_title_styles .= 'font-size:' . $cff_title_size . 'px; ';
244
  if ( !empty($cff_title_weight) && $cff_title_weight != 'inherit' ) $cff_title_styles .= 'font-weight:' . $cff_title_weight . '; ';
245
- if ( !empty($cff_title_color) ) $cff_title_styles .= 'color:#' . $cff_title_color . ';';
246
  $cff_title_styles .= '"';
247
  $cff_title_link = $atts[ 'textlink' ];
248
  //Description
@@ -252,7 +251,7 @@ function display_cff($atts) {
252
  $cff_body_styles = 'style="';
253
  if ( !empty($cff_body_size) && $cff_body_size != 'inherit' ) $cff_body_styles .= 'font-size:' . $cff_body_size . 'px; ';
254
  if ( !empty($cff_body_weight) && $cff_body_weight != 'inherit' ) $cff_body_styles .= 'font-weight:' . $cff_body_weight . '; ';
255
- if ( !empty($cff_body_color) ) $cff_body_styles .= 'color:#' . $cff_body_color . ';';
256
  $cff_body_styles .= '"';
257
  //Event Title
258
  $cff_event_title_format = $atts[ 'eventtitleformat' ];
@@ -263,7 +262,7 @@ function display_cff($atts) {
263
  $cff_event_title_styles = 'style="';
264
  if ( !empty($cff_event_title_size) && $cff_event_title_size != 'inherit' ) $cff_event_title_styles .= 'font-size:' . $cff_event_title_size . 'px; ';
265
  if ( !empty($cff_event_title_weight) && $cff_event_title_weight != 'inherit' ) $cff_event_title_styles .= 'font-weight:' . $cff_event_title_weight . '; ';
266
- if ( !empty($cff_event_title_color) ) $cff_event_title_styles .= 'color:#' . $cff_event_title_color . ';';
267
  $cff_event_title_styles .= '"';
268
  $cff_event_title_link = $atts[ 'eventtitlelink' ];
269
  //Event Date
@@ -276,7 +275,7 @@ function display_cff($atts) {
276
  $cff_event_date_styles = 'style="';
277
  if ( !empty($cff_event_date_size) && $cff_event_date_size != 'inherit' ) $cff_event_date_styles .= 'font-size:' . $cff_event_date_size . 'px; ';
278
  if ( !empty($cff_event_date_weight) && $cff_event_date_weight != 'inherit' ) $cff_event_date_styles .= 'font-weight:' . $cff_event_date_weight . '; ';
279
- if ( !empty($cff_event_date_color) ) $cff_event_date_styles .= 'color:#' . $cff_event_date_color . ';';
280
  $cff_event_date_styles .= '"';
281
  //Event Details
282
  $cff_event_details_size = $atts[ 'eventdetailssize' ];
@@ -285,7 +284,7 @@ function display_cff($atts) {
285
  $cff_event_details_styles = 'style="';
286
  if ( !empty($cff_event_details_size) && $cff_event_details_size != 'inherit' ) $cff_event_details_styles .= 'font-size:' . $cff_event_details_size . 'px; ';
287
  if ( !empty($cff_event_details_weight) && $cff_event_details_weight != 'inherit' ) $cff_event_details_styles .= 'font-weight:' . $cff_event_details_weight . '; ';
288
- if ( !empty($cff_event_details_color) ) $cff_event_details_styles .= 'color:#' . $cff_event_details_color . ';';
289
  $cff_event_details_styles .= '"';
290
  //Date
291
  $cff_date_position = $atts[ 'datepos' ];
@@ -296,7 +295,7 @@ function display_cff($atts) {
296
  $cff_date_styles = 'style="';
297
  if ( !empty($cff_date_size) && $cff_date_size != 'inherit' ) $cff_date_styles .= 'font-size:' . $cff_date_size . 'px; ';
298
  if ( !empty($cff_date_weight) && $cff_date_weight != 'inherit' ) $cff_date_styles .= 'font-weight:' . $cff_date_weight . '; ';
299
- if ( !empty($cff_date_color) ) $cff_date_styles .= 'color:#' . $cff_date_color . ';';
300
  $cff_date_styles .= '"';
301
  $cff_date_before = isset($options[ 'cff_date_before' ]) ? $options[ 'cff_date_before' ] : '';
302
  $cff_date_after = isset($options[ 'cff_date_after' ]) ? $options[ 'cff_date_after' ] : '';
@@ -310,7 +309,7 @@ function display_cff($atts) {
310
  $cff_link_styles = 'style="';
311
  if ( !empty($cff_link_size) && $cff_link_size != 'inherit' ) $cff_link_styles .= 'font-size:' . $cff_link_size . 'px; ';
312
  if ( !empty($cff_link_weight) && $cff_link_weight != 'inherit' ) $cff_link_styles .= 'font-weight:' . $cff_link_weight . '; ';
313
- if ( !empty($cff_link_color) ) $cff_link_styles .= 'color:#' . $cff_link_color . ';';
314
  $cff_link_styles .= '"';
315
  $cff_facebook_link_text = $atts[ 'facebooklinktext' ];
316
  $cff_view_link_text = $atts[ 'viewlinktext' ];
@@ -324,7 +323,7 @@ function display_cff($atts) {
324
  if ($cff_like_box_text_color == 'white') $cff_like_box_colorscheme = 'dark';
325
 
326
  $cff_likebox_styles = 'style="';
327
- if ( !empty($cff_likebox_bg_color) ) $cff_likebox_styles .= 'background-color:#' . $cff_likebox_bg_color . '; margin-left: 0; ';
328
 
329
  $cff_likebox_width = $atts[ 'likeboxwidth' ];
330
  if ( !isset($cff_likebox_width) || empty($cff_likebox_width) || $cff_likebox_width == '' ) $cff_likebox_width = '100%';
@@ -339,7 +338,7 @@ function display_cff($atts) {
339
 
340
  //Compile Like box styles
341
  $cff_likebox_styles = 'style="width: ' . $cff_likebox_width . ';';
342
- if ( !empty($cff_likebox_bg_color) ) $cff_likebox_styles .= 'background-color: #' . $cff_likebox_bg_color . ';';
343
  if ( empty($cff_likebox_bg_color) && $cff_like_box_faces == 'false' ) $cff_likebox_styles .= ' margin-left: -10px;';
344
  $cff_likebox_styles .= '"';
345
 
@@ -352,11 +351,11 @@ function display_cff($atts) {
352
 
353
  //Compile feed header styles
354
  $cff_header_styles = 'style="';
355
- if ( !empty($cff_header_bg_color) ) $cff_header_styles .= 'background-color: #' . $cff_header_bg_color . ';';
356
  if ( !empty($cff_header_padding) ) $cff_header_styles .= ' padding: ' . $cff_header_padding . ';';
357
  if ( !empty($cff_header_text_size) ) $cff_header_styles .= ' font-size: ' . $cff_header_text_size . 'px;';
358
  if ( !empty($cff_header_text_weight) ) $cff_header_styles .= ' font-weight: ' . $cff_header_text_weight . ';';
359
- if ( !empty($cff_header_text_color) ) $cff_header_styles .= ' color: #' . $cff_header_text_color . ';';
360
  $cff_header_styles .= '"';
361
 
362
  //Video
@@ -373,7 +372,7 @@ function display_cff($atts) {
373
  if (empty($cff_sep_size)) $cff_sep_size = 0;
374
  //CFF item styles
375
  $cff_item_styles = 'style="';
376
- $cff_item_styles .= 'border-bottom: ' . $cff_sep_size . 'px solid #' . $cff_sep_color . '; ';
377
  $cff_item_styles .= '"';
378
 
379
  //Text limits
@@ -381,10 +380,10 @@ function display_cff($atts) {
381
  if (!isset($title_limit)) $title_limit = 9999;
382
  $body_limit = $atts['desclength'];
383
  //Assign the Access Token and Page ID variables
384
- $access_token = trim( get_option('cff_access_token') );
385
  $page_id = trim( $atts['id'] );
386
 
387
- //If user is retarded and pastes their full URL into the Page ID field then strip it out
388
  $cff_facebook_string = 'facebook.com';
389
  $cff_page_id_url_check = stripos($page_id, $cff_facebook_string);
390
 
@@ -448,6 +447,14 @@ function display_cff($atts) {
448
  }
449
 
450
 
 
 
 
 
 
 
 
 
451
  //Calculate the cache time in seconds
452
  if($cff_cache_time_unit == 'minutes') $cff_cache_time_unit = 60;
453
  if($cff_cache_time_unit == 'hours') $cff_cache_time_unit = 60*60;
@@ -516,7 +523,9 @@ function display_cff($atts) {
516
  if ($cff_like_box_position == 'top' && $cff_show_like_box && !$cff_like_box_outside) $cff_content .= $like_box;
517
  //Limit var
518
  $i = 0;
519
-
 
 
520
 
521
  //ALL POSTS
522
  if (!$cff_events_only){
@@ -617,7 +626,7 @@ function display_cff($atts) {
617
  //***COMPILE SECTION VARIABLES***//
618
  //********************************//
619
  //Set the post link
620
- isset($news->link) ? $link = $news->link : $link = '';
621
  //Is it a shared album?
622
  $shared_album_string = 'shared an album:';
623
  isset($news->story) ? $story = $news->story : $story = '';
@@ -657,7 +666,13 @@ function display_cff($atts) {
657
 
658
  //POST AUTHOR
659
  $cff_author = '<a class="cff-author" href="https://facebook.com/' . $news->from->id . '" '.$target.' title="'.$news->from->name.' on Facebook">';
660
- $cff_author .= '<img src="https://graph.facebook.com/' . $news->from->id . '/picture" width=50 height=50>';
 
 
 
 
 
 
661
  $cff_author .= '<span class="cff-page-name">'.$news->from->name.'</span>';
662
  $cff_author .= '</a>';
663
 
@@ -669,7 +684,8 @@ function display_cff($atts) {
669
  // if ($news->type == 'photo' && !empty($news->story) ) $cff_post_text .= '<span class="cff-byline" '.$cff_body_styles.'>' . $news->story . '</span>';
670
  // $cff_post_text = '<div class="cff-post-text" ' . $cff_title_styles . '>';
671
  $cff_post_text .= '<span class="cff-text">';
672
- if ($cff_title_link == 'true') $cff_post_text .= '<a class="cff-post-text-link" href="'.$link.'" '.$target.'>';
 
673
  if (!empty($news->story)) $post_text = $news->story;
674
  if (!empty($news->message)) $post_text = $news->message;
675
  if (!empty($news->name) && empty($news->story) && empty($news->message)) $post_text = $news->name;
@@ -699,8 +715,12 @@ function display_cff($atts) {
699
  //Use the description if it's available and the post type isn't set to offer (offer description isn't useful)
700
  if ( ( !empty($news->description) || !empty($news->caption) ) && $cff_post_type != 'offer') {
701
 
702
- isset($news->description) ? $description_text = $news->description : $description_text = '';
703
- if (!isset($description_text)) $description_text = $news->caption;
 
 
 
 
704
 
705
  if (!empty($body_limit)) {
706
  if (strlen($description_text) > $body_limit) $description_text = substr($description_text, 0, $body_limit) . '...';
@@ -734,7 +754,9 @@ function display_cff($atts) {
734
  //DATE
735
  $cff_date_formatting = $atts[ 'dateformat' ];
736
  $cff_date_custom = $atts[ 'datecustom' ];
737
- $cff_date = '<p class="cff-date" '.$cff_date_styles.'>'. $cff_date_before . ' ' . cff_getdate(strtotime($news->created_time), $cff_date_formatting, $cff_date_custom) . ' ' . $cff_date_after . '</p>';
 
 
738
  //EVENT
739
  $cff_event = '';
740
  if ($cff_show_event_title || $cff_show_event_details) {
@@ -822,36 +844,40 @@ function display_cff($atts) {
822
  //***CREATE THE POST HTML***//
823
  //**************************//
824
  //Start the container
825
- $cff_content .= '<div class="cff-item ';
826
- if ($cff_post_type == 'link') $cff_content .= 'cff-link-item';
827
- if ($cff_post_type == 'event') $cff_content .= 'cff-timeline-event';
828
- if ($cff_post_type == 'photo') $cff_content .= 'cff-photo-post';
829
- if ($cff_post_type == 'video') $cff_content .= 'cff-video-post';
830
- if ($cff_post_type == 'swf') $cff_content .= 'cff-swf-post';
831
- if ($cff_post_type == 'status') $cff_content .= 'cff-status-post';
832
- if ($cff_post_type == 'offer') $cff_content .= 'cff-offer-post';
833
- if ($cff_album) $cff_content .= ' cff-album';
834
- $cff_content .= '" id="'. $news->id .'" ' . $cff_item_styles . '>';
835
 
836
  //POST AUTHOR
837
- if($cff_show_author) $cff_content .= $cff_author;
838
  //DATE ABOVE
839
- if ($cff_show_date && $cff_date_position == 'above') $cff_content .= $cff_date;
840
  //POST TEXT
841
- if($cff_show_text) $cff_content .= $cff_post_text;
842
  //DESCRIPTION
843
- if($cff_show_desc && $cff_post_type != 'offer' && $cff_post_type != 'link') $cff_content .= $cff_description;
844
  //LINK
845
- if($cff_show_shared_links) $cff_content .= $cff_shared_link;
846
  //DATE BELOW
847
- if ($cff_show_date && $cff_date_position == 'below') $cff_content .= $cff_date;
848
  //EVENT
849
- if($cff_show_event_title || $cff_show_event_details) $cff_content .= $cff_event;
850
  //VIEW ON FACEBOOK LINK
851
- if($cff_show_link) $cff_content .= $cff_link;
852
 
853
  //End the post item
854
- $cff_content .= '</div><div class="cff-clear"></div>';
 
 
 
 
855
  } // End post type check
856
 
857
  if (isset($news->message)) $prev_post_message = $news->message;
@@ -859,9 +885,21 @@ function display_cff($atts) {
859
  if (isset($news->description)) $prev_post_description = $news->description;
860
 
861
  } // End the loop
 
 
 
 
862
  } // End ALL POSTS
863
- //Load more posts
864
- // $cff_content .= '<button class="loadmore">Load More Posts</button>';
 
 
 
 
 
 
 
 
865
  //Add the Like Box inside
866
  if ($cff_like_box_position == 'bottom' && $cff_show_like_box && !$cff_like_box_outside) $cff_content .= $like_box;
867
  //End the feed
@@ -1238,6 +1276,16 @@ if(!is_callable('stripos')){
1238
  }
1239
  }
1240
 
 
 
 
 
 
 
 
 
 
 
1241
  // remove_filter( 'the_content', 'wpautop' );
1242
  // add_filter( 'the_content', 'wpautop', 99 );
1243
 
3
  Plugin Name: Custom Facebook Feed
4
  Plugin URI: http://smashballoon.com/custom-facebook-feed
5
  Description: Add a completely customizable Facebook feed to your WordPress site
6
+ Version: 1.8.0
7
  Author: Smash Balloon
8
  Author URI: http://smashballoon.com/
9
  License: GPLv2 or later
47
  //Pass in shortcode attrbutes
48
  $atts = shortcode_atts(
49
  array(
50
+ 'accesstoken' => trim( get_option('cff_access_token') ),
51
  'id' => get_option('cff_page_id'),
52
  'pagetype' => get_option('cff_page_type'),
53
  'num' => get_option('cff_num_show'),
150
  $cff_page_type = $atts[ 'pagetype' ];
151
  ($cff_page_type == 'group') ? $cff_is_group = true : $cff_is_group = false;
152
 
 
 
153
  $cff_feed_width = $atts['width'];
154
  $cff_feed_height = $atts[ 'height' ];
155
  $cff_feed_padding = $atts[ 'padding' ];
166
  if ( !empty($cff_feed_width) ) $cff_feed_styles .= 'width:' . $cff_feed_width . '; ';
167
  if ( !empty($cff_feed_height) ) $cff_feed_styles .= 'height:' . $cff_feed_height . '; ';
168
  if ( !empty($cff_feed_padding) ) $cff_feed_styles .= 'padding:' . $cff_feed_padding . '; ';
169
+ if ( !empty($cff_bg_color) ) $cff_feed_styles .= 'background-color:#' . str_replace('#', '', $cff_bg_color) . '; ';
170
  $cff_feed_styles .= '"';
171
  //Like box
172
  $cff_like_box_position = $atts[ 'likeboxpos' ];
221
  $cff_meta_text_color = $atts[ 'socialtextcolor' ];
222
  $cff_meta_bg_color = $atts[ 'socialbgcolor' ];
223
  $cff_meta_styles = 'style="';
224
+ if ( !empty($cff_meta_text_color) ) $cff_meta_styles .= 'color:#' . str_replace('#', '', $cff_meta_text_color) . ';';
225
+ if ( !empty($cff_meta_bg_color) ) $cff_meta_styles .= 'background-color:#' . str_replace('#', '', $cff_meta_bg_color) . ';';
226
  $cff_meta_styles .= '"';
227
  $cff_nocomments_text = isset($options[ 'cff_nocomments_text' ]) ? $options[ 'cff_nocomments_text' ] : '';
228
  $cff_hide_comments = isset($options[ 'cff_hide_comments' ]) ? $options[ 'cff_hide_comments' ] : '';
241
  $cff_title_styles = 'style="';
242
  if ( !empty($cff_title_size) && $cff_title_size != 'inherit' ) $cff_title_styles .= 'font-size:' . $cff_title_size . 'px; ';
243
  if ( !empty($cff_title_weight) && $cff_title_weight != 'inherit' ) $cff_title_styles .= 'font-weight:' . $cff_title_weight . '; ';
244
+ if ( !empty($cff_title_color) ) $cff_title_styles .= 'color:#' . str_replace('#', '', $cff_title_color) . ';';
245
  $cff_title_styles .= '"';
246
  $cff_title_link = $atts[ 'textlink' ];
247
  //Description
251
  $cff_body_styles = 'style="';
252
  if ( !empty($cff_body_size) && $cff_body_size != 'inherit' ) $cff_body_styles .= 'font-size:' . $cff_body_size . 'px; ';
253
  if ( !empty($cff_body_weight) && $cff_body_weight != 'inherit' ) $cff_body_styles .= 'font-weight:' . $cff_body_weight . '; ';
254
+ if ( !empty($cff_body_color) ) $cff_body_styles .= 'color:#' . str_replace('#', '', $cff_body_color) . ';';
255
  $cff_body_styles .= '"';
256
  //Event Title
257
  $cff_event_title_format = $atts[ 'eventtitleformat' ];
262
  $cff_event_title_styles = 'style="';
263
  if ( !empty($cff_event_title_size) && $cff_event_title_size != 'inherit' ) $cff_event_title_styles .= 'font-size:' . $cff_event_title_size . 'px; ';
264
  if ( !empty($cff_event_title_weight) && $cff_event_title_weight != 'inherit' ) $cff_event_title_styles .= 'font-weight:' . $cff_event_title_weight . '; ';
265
+ if ( !empty($cff_event_title_color) ) $cff_event_title_styles .= 'color:#' . str_replace('#', '', $cff_event_title_color) . ';';
266
  $cff_event_title_styles .= '"';
267
  $cff_event_title_link = $atts[ 'eventtitlelink' ];
268
  //Event Date
275
  $cff_event_date_styles = 'style="';
276
  if ( !empty($cff_event_date_size) && $cff_event_date_size != 'inherit' ) $cff_event_date_styles .= 'font-size:' . $cff_event_date_size . 'px; ';
277
  if ( !empty($cff_event_date_weight) && $cff_event_date_weight != 'inherit' ) $cff_event_date_styles .= 'font-weight:' . $cff_event_date_weight . '; ';
278
+ if ( !empty($cff_event_date_color) ) $cff_event_date_styles .= 'color:#' . str_replace('#', '', $cff_event_date_color) . ';';
279
  $cff_event_date_styles .= '"';
280
  //Event Details
281
  $cff_event_details_size = $atts[ 'eventdetailssize' ];
284
  $cff_event_details_styles = 'style="';
285
  if ( !empty($cff_event_details_size) && $cff_event_details_size != 'inherit' ) $cff_event_details_styles .= 'font-size:' . $cff_event_details_size . 'px; ';
286
  if ( !empty($cff_event_details_weight) && $cff_event_details_weight != 'inherit' ) $cff_event_details_styles .= 'font-weight:' . $cff_event_details_weight . '; ';
287
+ if ( !empty($cff_event_details_color) ) $cff_event_details_styles .= 'color:#' . str_replace('#', '', $cff_event_details_color) . ';';
288
  $cff_event_details_styles .= '"';
289
  //Date
290
  $cff_date_position = $atts[ 'datepos' ];
295
  $cff_date_styles = 'style="';
296
  if ( !empty($cff_date_size) && $cff_date_size != 'inherit' ) $cff_date_styles .= 'font-size:' . $cff_date_size . 'px; ';
297
  if ( !empty($cff_date_weight) && $cff_date_weight != 'inherit' ) $cff_date_styles .= 'font-weight:' . $cff_date_weight . '; ';
298
+ if ( !empty($cff_date_color) ) $cff_date_styles .= 'color:#' . str_replace('#', '', $cff_date_color) . ';';
299
  $cff_date_styles .= '"';
300
  $cff_date_before = isset($options[ 'cff_date_before' ]) ? $options[ 'cff_date_before' ] : '';
301
  $cff_date_after = isset($options[ 'cff_date_after' ]) ? $options[ 'cff_date_after' ] : '';
309
  $cff_link_styles = 'style="';
310
  if ( !empty($cff_link_size) && $cff_link_size != 'inherit' ) $cff_link_styles .= 'font-size:' . $cff_link_size . 'px; ';
311
  if ( !empty($cff_link_weight) && $cff_link_weight != 'inherit' ) $cff_link_styles .= 'font-weight:' . $cff_link_weight . '; ';
312
+ if ( !empty($cff_link_color) ) $cff_link_styles .= 'color:#' . str_replace('#', '', $cff_link_color) . ';';
313
  $cff_link_styles .= '"';
314
  $cff_facebook_link_text = $atts[ 'facebooklinktext' ];
315
  $cff_view_link_text = $atts[ 'viewlinktext' ];
323
  if ($cff_like_box_text_color == 'white') $cff_like_box_colorscheme = 'dark';
324
 
325
  $cff_likebox_styles = 'style="';
326
+ if ( !empty($cff_likebox_bg_color) ) $cff_likebox_styles .= 'background-color:#' . str_replace('#', '', $cff_likebox_bg_color) . '; margin-left: 0; ';
327
 
328
  $cff_likebox_width = $atts[ 'likeboxwidth' ];
329
  if ( !isset($cff_likebox_width) || empty($cff_likebox_width) || $cff_likebox_width == '' ) $cff_likebox_width = '100%';
338
 
339
  //Compile Like box styles
340
  $cff_likebox_styles = 'style="width: ' . $cff_likebox_width . ';';
341
+ if ( !empty($cff_likebox_bg_color) ) $cff_likebox_styles .= 'background-color: #' . str_replace('#', '', $cff_likebox_bg_color) . ';';
342
  if ( empty($cff_likebox_bg_color) && $cff_like_box_faces == 'false' ) $cff_likebox_styles .= ' margin-left: -10px;';
343
  $cff_likebox_styles .= '"';
344
 
351
 
352
  //Compile feed header styles
353
  $cff_header_styles = 'style="';
354
+ if ( !empty($cff_header_bg_color) ) $cff_header_styles .= 'background-color: #' . str_replace('#', '', $cff_header_bg_color) . ';';
355
  if ( !empty($cff_header_padding) ) $cff_header_styles .= ' padding: ' . $cff_header_padding . ';';
356
  if ( !empty($cff_header_text_size) ) $cff_header_styles .= ' font-size: ' . $cff_header_text_size . 'px;';
357
  if ( !empty($cff_header_text_weight) ) $cff_header_styles .= ' font-weight: ' . $cff_header_text_weight . ';';
358
+ if ( !empty($cff_header_text_color) ) $cff_header_styles .= ' color: #' . str_replace('#', '', $cff_header_text_color) . ';';
359
  $cff_header_styles .= '"';
360
 
361
  //Video
372
  if (empty($cff_sep_size)) $cff_sep_size = 0;
373
  //CFF item styles
374
  $cff_item_styles = 'style="';
375
+ $cff_item_styles .= 'border-bottom: ' . $cff_sep_size . 'px solid #' . str_replace('#', '', $cff_sep_color) . '; ';
376
  $cff_item_styles .= '"';
377
 
378
  //Text limits
380
  if (!isset($title_limit)) $title_limit = 9999;
381
  $body_limit = $atts['desclength'];
382
  //Assign the Access Token and Page ID variables
383
+ $access_token = $atts['accesstoken'];
384
  $page_id = trim( $atts['id'] );
385
 
386
+ //If user pastes their full URL into the Page ID field then strip it out
387
  $cff_facebook_string = 'facebook.com';
388
  $cff_page_id_url_check = stripos($page_id, $cff_facebook_string);
389
 
447
  }
448
 
449
 
450
+ //If the limit isn't set then set it to be 5 more than the number of posts defined
451
+ if ( isset($atts['limit']) && $atts['limit'] !== '' ) {
452
+ $cff_post_limit = $atts['limit'];
453
+ } else {
454
+ $cff_post_limit = intval(intval($show_posts) + 7);
455
+ }
456
+
457
+
458
  //Calculate the cache time in seconds
459
  if($cff_cache_time_unit == 'minutes') $cff_cache_time_unit = 60;
460
  if($cff_cache_time_unit == 'hours') $cff_cache_time_unit = 60*60;
523
  if ($cff_like_box_position == 'top' && $cff_show_like_box && !$cff_like_box_outside) $cff_content .= $like_box;
524
  //Limit var
525
  $i = 0;
526
+
527
+ //Define array for post items
528
+ $cff_posts_array = array();
529
 
530
  //ALL POSTS
531
  if (!$cff_events_only){
626
  //***COMPILE SECTION VARIABLES***//
627
  //********************************//
628
  //Set the post link
629
+ isset($news->link) ? $link = htmlspecialchars($news->link) : $link = '';
630
  //Is it a shared album?
631
  $shared_album_string = 'shared an album:';
632
  isset($news->story) ? $story = $news->story : $story = '';
666
 
667
  //POST AUTHOR
668
  $cff_author = '<a class="cff-author" href="https://facebook.com/' . $news->from->id . '" '.$target.' title="'.$news->from->name.' on Facebook">';
669
+
670
+ //Set the author image as a variable. If it already exists then don't query the api for it again.
671
+ $cff_author_img_var = '$cff_author_img_' . $news->from->id;
672
+ if ( !isset($$cff_author_img_var) ) $$cff_author_img_var = 'https://graph.facebook.com/' . $news->from->id . '/picture?type=square';
673
+
674
+ //Set image url as rel and then switch it using jQuery
675
+ $cff_author .= '<img src="" width=50 height=50 rel="'.$$cff_author_img_var.'">';
676
  $cff_author .= '<span class="cff-page-name">'.$news->from->name.'</span>';
677
  $cff_author .= '</a>';
678
 
684
  // if ($news->type == 'photo' && !empty($news->story) ) $cff_post_text .= '<span class="cff-byline" '.$cff_body_styles.'>' . $news->story . '</span>';
685
  // $cff_post_text = '<div class="cff-post-text" ' . $cff_title_styles . '>';
686
  $cff_post_text .= '<span class="cff-text">';
687
+
688
+ if ($cff_title_link == 'true' || $cff_title_link == 'on') $cff_post_text .= '<a class="cff-post-text-link" href="'.$link.'" '.$target.'>';
689
  if (!empty($news->story)) $post_text = $news->story;
690
  if (!empty($news->message)) $post_text = $news->message;
691
  if (!empty($news->name) && empty($news->story) && empty($news->message)) $post_text = $news->name;
715
  //Use the description if it's available and the post type isn't set to offer (offer description isn't useful)
716
  if ( ( !empty($news->description) || !empty($news->caption) ) && $cff_post_type != 'offer') {
717
 
718
+ $description_text = '';
719
+ if ( !empty($news->description) ) {
720
+ $description_text = $news->description;
721
+ } else {
722
+ $description_text = $news->caption;
723
+ }
724
 
725
  if (!empty($body_limit)) {
726
  if (strlen($description_text) > $body_limit) $description_text = substr($description_text, 0, $body_limit) . '...';
754
  //DATE
755
  $cff_date_formatting = $atts[ 'dateformat' ];
756
  $cff_date_custom = $atts[ 'datecustom' ];
757
+
758
+ $post_time = $news->created_time;
759
+ $cff_date = '<p class="cff-date" '.$cff_date_styles.'>'. $cff_date_before . ' ' . cff_getdate(strtotime($post_time), $cff_date_formatting, $cff_date_custom) . ' ' . $cff_date_after . '</p>';
760
  //EVENT
761
  $cff_event = '';
762
  if ($cff_show_event_title || $cff_show_event_details) {
844
  //***CREATE THE POST HTML***//
845
  //**************************//
846
  //Start the container
847
+ $cff_post_item = '<div class="cff-item ';
848
+ if ($cff_post_type == 'link') $cff_post_item .= 'cff-link-item';
849
+ if ($cff_post_type == 'event') $cff_post_item .= 'cff-timeline-event';
850
+ if ($cff_post_type == 'photo') $cff_post_item .= 'cff-photo-post';
851
+ if ($cff_post_type == 'video') $cff_post_item .= 'cff-video-post';
852
+ if ($cff_post_type == 'swf') $cff_post_item .= 'cff-swf-post';
853
+ if ($cff_post_type == 'status') $cff_post_item .= 'cff-status-post';
854
+ if ($cff_post_type == 'offer') $cff_post_item .= 'cff-offer-post';
855
+ if ($cff_album) $cff_post_item .= ' cff-album';
856
+ $cff_post_item .= ' author-'. to_slug($news->from->name) .'" id="'. $news->id .'" ' . $cff_item_styles . '>';
857
 
858
  //POST AUTHOR
859
+ if($cff_show_author) $cff_post_item .= $cff_author;
860
  //DATE ABOVE
861
+ if ($cff_show_date && $cff_date_position == 'above') $cff_post_item .= $cff_date;
862
  //POST TEXT
863
+ if($cff_show_text) $cff_post_item .= $cff_post_text;
864
  //DESCRIPTION
865
+ if($cff_show_desc && $cff_post_type != 'offer' && $cff_post_type != 'link') $cff_post_item .= $cff_description;
866
  //LINK
867
+ if($cff_show_shared_links) $cff_post_item .= $cff_shared_link;
868
  //DATE BELOW
869
+ if ($cff_show_date && $cff_date_position == 'below') $cff_post_item .= $cff_date;
870
  //EVENT
871
+ if($cff_show_event_title || $cff_show_event_details) $cff_post_item .= $cff_event;
872
  //VIEW ON FACEBOOK LINK
873
+ if($cff_show_link) $cff_post_item .= $cff_link;
874
 
875
  //End the post item
876
+ $cff_post_item .= '</div><div class="cff-clear"></div>';
877
+
878
+ //PUSH TO ARRAY
879
+ $cff_posts_array = array_push_assoc($cff_posts_array, strtotime($post_time), $cff_post_item);
880
+
881
  } // End post type check
882
 
883
  if (isset($news->message)) $prev_post_message = $news->message;
885
  if (isset($news->description)) $prev_post_description = $news->description;
886
 
887
  } // End the loop
888
+
889
+ //Sort the array in reverse order (newest first)
890
+ krsort($cff_posts_array);
891
+
892
  } // End ALL POSTS
893
+
894
+
895
+ //Output the posts array
896
+ $p = 0;
897
+ foreach ($cff_posts_array as $post ) {
898
+ if ( $p == $show_posts ) break;
899
+ $cff_content .= $post;
900
+ $p++;
901
+ }
902
+
903
  //Add the Like Box inside
904
  if ($cff_like_box_position == 'bottom' && $cff_show_like_box && !$cff_like_box_outside) $cff_content .= $like_box;
905
  //End the feed
1276
  }
1277
  }
1278
 
1279
+ //Push to assoc array
1280
+ function array_push_assoc($array, $key, $value){
1281
+ $array[$key] = $value;
1282
+ return $array;
1283
+ }
1284
+ //Convert string to slug
1285
+ function to_slug($string){
1286
+ return strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $string)));
1287
+ }
1288
+
1289
  // remove_filter( 'the_content', 'wpautop' );
1290
  // add_filter( 'the_content', 'wpautop', 99 );
1291
 
img/pro.png CHANGED
Binary file
js/cff-admin-scripts.js CHANGED
@@ -72,25 +72,8 @@ jQuery(document).ready(function() {
72
  //Test Facebook API connection button
73
  jQuery('#cff-api-test').click(function(e){
74
  e.preventDefault();
75
- var cff_page_id = jQuery('#cff_page_id').val(),
76
- cff_access_token = jQuery('#cff_access_token').val(),
77
- response = 'https://graph.facebook.com/' + cff_page_id + '/posts' + '?access_token=' + cff_access_token;
78
-
79
- //Show the loader
80
- jQuery('.cff-loader').show();
81
-
82
- //Load the response into the text box
83
- jQuery('#cff-api-test-result textarea').css('display', 'block').load(response, function( response, status, xhr ) {
84
- //Check for an error
85
- if ( status == "error" ) {
86
- var msg = "Error: ";
87
- jQuery( "#cff-api-test-result textarea" ).html( msg + xhr.status + " " + xhr.statusText + ". Could not connect to Facebook API." ).removeClass().addClass('cff-error');
88
- } else {
89
- jQuery('#cff-api-test-result textarea').removeClass().addClass('cff-success');
90
- }
91
- //Hide the loader
92
- jQuery('.cff-loader').hide();
93
- });
94
  });
95
 
96
 
@@ -121,6 +104,7 @@ jQuery(document).ready(function() {
121
  }
122
  });
123
 
124
-
 
125
 
126
  });
72
  //Test Facebook API connection button
73
  jQuery('#cff-api-test').click(function(e){
74
  e.preventDefault();
75
+ //Show the JSON
76
+ jQuery('#cff-api-test-result textarea').css('display', 'block');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  });
78
 
79
 
104
  }
105
  });
106
 
107
+ //Add the color picker
108
+ if( jQuery('.cff-colorpicker').length > 0 ) jQuery('.cff-colorpicker').wpColorPicker();
109
 
110
  });
js/cff-scripts.js CHANGED
@@ -49,5 +49,10 @@ jQuery(document).ready(function() {
49
  $less.hide();
50
  }
51
  });
 
 
 
 
 
52
  });
53
  });
49
  $less.hide();
50
  }
51
  });
52
+
53
+ //Load in author image after the page load to prevent slowing down page load by hitting the API
54
+ var $authorImg = $self.find('.cff-author img');
55
+ $authorImg.attr('src', $authorImg.attr('rel') ).removeAttr('rel');
56
+
57
  });
58
  });