Changeset 3431131
- Timestamp:
- 01/02/2026 04:30:56 PM (7 weeks ago)
- Location:
- facebook-pagelike-widget
- Files:
-
- 20 added
- 5 edited
-
tags/6.5 (added)
-
tags/6.5/FacebookLocales.json (added)
-
tags/6.5/admin (added)
-
tags/6.5/admin/assets (added)
-
tags/6.5/admin/assets/css (added)
-
tags/6.5/admin/assets/css/add-review.css (added)
-
tags/6.5/admin/assets/js (added)
-
tags/6.5/admin/assets/js/custom.js (added)
-
tags/6.5/admin/includes (added)
-
tags/6.5/admin/includes/add-review.php (added)
-
tags/6.5/facebook_widget.php (added)
-
tags/6.5/facebook_widget.po (added)
-
tags/6.5/fb.js (added)
-
tags/6.5/fb_class.php (added)
-
tags/6.5/loader.gif (added)
-
tags/6.5/readme.txt (added)
-
tags/6.5/screenshot-1.png (added)
-
tags/6.5/screenshot-2.png (added)
-
tags/6.5/screenshot-3.png (added)
-
tags/6.5/short_code.php (added)
-
trunk/facebook_widget.php (modified) (3 diffs)
-
trunk/fb.js (modified) (1 diff)
-
trunk/fb_class.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/short_code.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
facebook-pagelike-widget/trunk/facebook_widget.php
r3256447 r3431131 2 2 /** 3 3 * @package Widget for Social Page Feeds 4 * @version 6. 4.24 * @version 6.5 5 5 */ 6 6 /* … … 9 9 Description: This widget adds a Simple Facebook Page Like Widget into your WordPress website sidebar within few minutes. 10 10 Author: Milap Patel 11 Version: 6. 4.211 Version: 6.5 12 12 Author URI: https://patelmilap.wordpress.com/ 13 13 Text Domain: facebook-pagelike-widget 14 14 */ 15 if( !class_exists( 'Facebook_Pagelike_widget' ) ) { 15 16 // Prevent direct access for security 17 if ( ! defined( 'ABSPATH' ) ) { 18 exit; 19 } 20 21 if( ! class_exists( 'Facebook_Pagelike_widget' ) ) { 16 22 17 23 class Facebook_Pagelike_widget { 18 24 25 /** 26 * Plugin version 27 */ 28 const VERSION = '6.5'; 29 19 30 public function __construct() { 20 31 21 if( !defined( 'FB_WIDGET_PLUGIN_URL' ) ) 32 // Define constants for URLs and Paths 33 if( ! defined( 'FB_WIDGET_PLUGIN_URL' ) ) { 22 34 define( 'FB_WIDGET_PLUGIN_URL' , plugin_dir_url( __FILE__ ) ); 35 } 23 36 24 if( !defined( 'FB_WIDGET_PLUGIN_BASE_URL' ) ) 25 define( 'FB_WIDGET_PLUGIN_BASE_URL' , dirname( __FILE__ ) ); 37 if( ! defined( 'FB_WIDGET_PLUGIN_BASE_URL' ) ) { 38 define( 'FB_WIDGET_PLUGIN_BASE_URL' , plugin_dir_path( __FILE__ ) ); 39 } 26 40 41 // Initialization 27 42 $this->includes(); 28 43 44 // Hooks 29 45 register_activation_hook( __FILE__ , array( $this, 'fb_widget_activate' ) ); 30 46 register_deactivation_hook( __FILE__ , array( $this, 'fb_widget_deactivate' ) ); … … 32 48 add_action( 'plugins_loaded', array( $this, 'LoadFbtextDomain' ) ); 33 49 add_action( 'activated_plugin', array( $this, 'fb_widget_redirect' ) ); 34 35 50 } 36 51 37 public function fb_widget_activate() {} 52 public function fb_widget_activate() { 53 // Set a transient to handle the redirect after activation 54 set_transient( 'fb_widget_do_activation_redirect', true, 30 ); 55 } 38 56 39 public function fb_widget_deactivate() {} 57 public function fb_widget_deactivate() { 58 // Clean up if necessary 59 delete_transient( 'fb_widget_do_activation_redirect' ); 60 } 40 61 41 public function fb_widget_redirect() {} 62 /** 63 * Redirects to the settings or welcome page upon activation 64 */ 65 public function fb_widget_redirect( $plugin ) { 66 if ( $plugin == plugin_basename( __FILE__ ) && get_transient( 'fb_widget_do_activation_redirect' ) ) { 67 delete_transient( 'fb_widget_do_activation_redirect' ); 68 // Replace 'options-general.php' with your actual settings page slug 69 wp_safe_redirect( admin_url( 'widgets.php' ) ); 70 exit; 71 } 72 } 42 73 43 74 public function LoadFbtextDomain() { 44 45 load_plugin_textdomain( 'facebook-pagelike-widget',false, basename( dirname( __FILE__ ) ) ); 46 75 load_plugin_textdomain( 'facebook-pagelike-widget', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); 47 76 } 48 77 49 78 public function includes() { 50 51 require FB_WIDGET_PLUGIN_BASE_URL . '/fb_class.php'; 52 require FB_WIDGET_PLUGIN_BASE_URL . '/short_code.php'; 53 include FB_WIDGET_PLUGIN_BASE_URL . '/admin/includes/add-review.php'; 54 79 require_once FB_WIDGET_PLUGIN_BASE_URL . 'fb_class.php'; 80 require_once FB_WIDGET_PLUGIN_BASE_URL . 'short_code.php'; 81 82 if ( is_admin() ) { 83 include_once FB_WIDGET_PLUGIN_BASE_URL . 'admin/includes/add-review.php'; 84 } 55 85 } 56 57 86 } 58 87 } 88 89 // Initialize the plugin 59 90 new Facebook_Pagelike_widget(); 60 ?> -
facebook-pagelike-widget/trunk/fb.js
r3021420 r3431131 1 jQuery(window).bind('load', function() { 2 jQuery('.fb_loader').hide(); 3 }); 1 (function($) { 2 "use strict"; 3 4 // Use .on() for modern jQuery compatibility 5 $(window).on('load', function() { 6 // Find and hide the loader with a slight fade for better UX 7 $('.fb_loader').fadeOut('fast'); 8 }); 9 10 /** 11 * Optional: Fallback safety. 12 * If the window load takes more than 5 seconds (e.g. slow FB servers), 13 * hide the loader anyway so the user doesn't see a stuck spinner. 14 */ 15 setTimeout(function() { 16 if ($('.fb_loader').is(':visible')) { 17 $('.fb_loader').hide(); 18 } 19 }, 5000); 20 21 })(jQuery); -
facebook-pagelike-widget/trunk/fb_class.php
r3392137 r3431131 21 21 } 22 22 23 /** @see WP_Widget::widget */ 24 function widget( $args , $instance ) { 25 26 global $select_lng; 27 extract( $args ); 28 29 $title = apply_filters( 'widget_title' , $instance['title'] ); 30 $fb_url = $instance['fb_url']; 31 $width = $instance['width']; 32 $height = $instance['height']; 33 $data_small_header = isset( $instance['data_small_header'] ) && $instance['data_small_header'] != '' ? 'true' : 'false'; 34 $data_adapt_container_width = isset( $instance['data_adapt_container_width'] ) && $instance['data_adapt_container_width'] != '' ? 'true' : 'false'; 35 $data_hide_cover = isset( $instance['data_hide_cover']) && $instance['data_hide_cover'] != '' ? 'true' : 'false'; 36 $data_show_facepile = isset( $instance['data_show_facepile']) && $instance['data_show_facepile'] != '' ? 'true' : 'false'; 37 $select_lng = $instance['select_lng']; 38 $data_tabs = 'timeline'; 39 $data_lazy = isset( $instance['data_lazy'] ) && $instance['data_lazy'] != '' ? 'true' : 'false'; 40 41 if (is_array($instance['data_tabs']) && array_key_exists('data_tabs', $instance) && $instance['data_tabs'] !== '') { 42 $data_tabs = implode(",", $instance['data_tabs']); 23 public function widget( $args, $instance ) { 24 // 1. Initialize variables safely using the null coalescing operator 25 $title = ! empty( $instance['title'] ) ? apply_filters( 'widget_title', $instance['title'] ) : ''; 26 $fb_url = $instance['fb_url'] ?? 'https://www.facebook.com/WordPress'; 27 $width = $instance['width'] ?? '300'; 28 $height = $instance['height'] ?? '500'; 29 $lang = $instance['select_lng'] ?? 'en_US'; 30 31 // Convert array back to a comma-separated string for the data attribute 32 $data_tabs_array = ! empty( $instance['data_tabs'] ) ? (array) $instance['data_tabs'] : array( 'timeline' ); 33 $data_tabs_string = implode( ',', $data_tabs_array ); 34 35 // Boolean attributes (Check if they are the string 'true') 36 $data_small_header = ( isset( $instance['data_small_header'] ) && $instance['data_small_header'] === 'true' ) ? 'true' : 'false'; 37 $data_adapt_container_width = ( isset( $instance['data_adapt_container_width'] ) && $instance['data_adapt_container_width'] === 'true' ) ? 'true' : 'false'; 38 $data_hide_cover = ( isset( $instance['data_hide_cover'] ) && $instance['data_hide_cover'] === 'true' ) ? 'true' : 'false'; 39 $data_show_facepile = ( isset( $instance['data_show_facepile'] ) && $instance['data_show_facepile'] === 'true' ) ? 'true' : 'false'; 40 $data_lazy = ( isset( $instance['data_lazy'] ) && $instance['data_lazy'] === 'true' ) ? 'true' : 'false'; 41 42 // Output Widget 43 echo $args['before_widget']; 44 45 if ( $title ) { 46 echo $args['before_title'] . $title . $args['after_title']; 43 47 } 44 48 45 echo $before_widget; 46 if ( $title ) echo $before_title . $title . $after_title; 47 48 wp_register_script( 'scfbwidgetscript' , FB_WIDGET_PLUGIN_URL . 'fb.js', array( 'jquery' ), '1.0' ); 49 wp_enqueue_script( 'scfbwidgetscript' ); 50 51 wp_register_script( 'scfbexternalscript', 'https://connect.facebook.net/'.$select_lng.'/sdk.js#xfbml=1&version=v18.0', "", '2.0', true ); 52 wp_enqueue_script( 'scfbexternalscript' ); 53 54 echo '<div class="fb_loader" style="text-align: center !important;"><img src="' . plugins_url() . '/facebook-pagelike-widget/loader.gif" alt="Facebook Pagelike Widget" /></div>'; 55 echo '<div id="fb-root"></div> 56 <div class="fb-page" data-href="' . $fb_url . '" data-width="' . $width . '" data-height="' . $height . '" data-small-header="' . $data_small_header . '" data-adapt-container-width="' . $data_adapt_container_width . '" data-hide-cover="' . $data_hide_cover . '" data-show-facepile="' . $data_show_facepile . '" hide_cta="false" data-tabs="'. $data_tabs .'" data-lazy="'.$data_lazy.'"></div>'; 57 echo $after_widget; ?> 58 <!-- A WordPress plugin developed by Milap Patel --> 59 <?php } 60 61 /** @see WP_Widget::update */ 62 function update( $new_instance, $old_instance ) { 63 64 $instance = $old_instance; 65 $instance = array( 'data_small_header' => 'false', 'data_adapt_container_width' => 'true', 'data_hide_cover' => 'false', 'data_show_facepile' => 'false', 'data_tabs' => 'timeline' ); 66 67 foreach ( $instance as $field => $val ) { 68 if ( isset( $new_instance[$field] ) ) 69 $instance[$field] = 'true'; 49 // Scripts 50 wp_enqueue_script( 'scfbwidgetscript', FB_WIDGET_PLUGIN_URL . 'fb.js', array( 'jquery' ), '1.0' ); 51 wp_enqueue_script( 'scfbexternalscript', 'https://connect.facebook.net/' . $lang . '/sdk.js#xfbml=1&version=v18.0', array(), '2.0', true ); 52 53 // Loader and Plugin Div 54 printf( 55 '<div class="fb_loader" style="text-align: center !important;"><img src="%s" alt="Loading..." /></div>', 56 esc_url( plugins_url( '/facebook-pagelike-widget/loader.gif' ) ) 57 ); 58 59 printf( 60 '<div id="fb-root"></div> 61 <div class="fb-page" 62 data-href="%s" 63 data-width="%s" 64 data-height="%s" 65 data-small-header="%s" 66 data-adapt-container-width="%s" 67 data-hide-cover="%s" 68 data-show-facepile="%s" 69 data-tabs="%s" 70 data-lazy="%s" 71 data-xfbml-parse-ignore="false"> 72 </div>', 73 esc_url( $fb_url ), 74 esc_attr( $width ), 75 esc_attr( $height ), 76 $data_small_header, 77 $data_adapt_container_width, 78 $data_hide_cover, 79 $data_show_facepile, 80 esc_attr( $data_tabs_string ), // Fixed: Use the string version here 81 $data_lazy 82 ); 83 84 echo $args['after_widget']; 85 } 86 87 /** 88 * @see WP_Widget::update Update widget options. 89 */ 90 public function update( $new_instance, $old_instance ) { 91 $instance = array(); 92 93 $instance['title'] = !empty( $new_instance['title'] ) ? sanitize_text_field( $new_instance['title'] ) : ''; 94 $instance['fb_url'] = !empty( $new_instance['fb_url'] ) ? esc_url_raw( $new_instance['fb_url'] ) : ''; 95 $instance['width'] = !empty( $new_instance['width'] ) ? sanitize_text_field( $new_instance['width'] ) : ''; 96 $instance['height'] = !empty( $new_instance['height'] ) ? sanitize_text_field( $new_instance['height'] ) : ''; 97 $instance['select_lng'] = !empty( $new_instance['select_lng'] ) ? sanitize_text_field( $new_instance['select_lng'] ) : 'en_US'; 98 99 // Handle Multiple Select for data_tabs 100 if ( ! empty( $new_instance['data_tabs'] ) && is_array( $new_instance['data_tabs'] ) ) { 101 $instance['data_tabs'] = array_map( 'sanitize_text_field', $new_instance['data_tabs'] ); 102 } else { 103 $instance['data_tabs'] = array( 'timeline' ); 70 104 } 71 72 $instance['title'] = strip_tags( $new_instance['title'] ); 73 $instance['fb_url'] = sanitize_url( filter_var($new_instance['fb_url'], FILTER_SANITIZE_URL) ); 74 $instance['width'] = strip_tags( $new_instance['width'] ); 75 $instance['height'] = strip_tags( $new_instance['height'] ); 76 $instance['data_small_header'] = strip_tags( $new_instance['data_small_header'] ); 77 $instance['data_adapt_container_width'] = strip_tags( $new_instance['data_adapt_container_width'] ); 78 $instance['data_hide_cover'] = strip_tags( $new_instance['data_hide_cover'] ); 79 $instance['data_show_facepile'] = strip_tags( $new_instance['data_show_facepile'] ); 80 $instance['select_lng'] = strip_tags( $new_instance['select_lng'] ); 81 $instance['data_tabs'] = esc_sql( $new_instance['data_tabs'] ); 82 $instance['data_lazy'] = strip_tags( $new_instance['data_lazy'] ); 83 105 106 // Booleans/Checkboxes 107 $instance['data_small_header'] = !empty( $new_instance['data_small_header'] ) ? 'true' : 'false'; 108 $instance['data_adapt_container_width'] = !empty( $new_instance['data_adapt_container_width'] ) ? 'true' : 'false'; 109 $instance['data_hide_cover'] = !empty( $new_instance['data_hide_cover'] ) ? 'true' : 'false'; 110 $instance['data_show_facepile'] = !empty( $new_instance['data_show_facepile'] ) ? 'true' : 'false'; 111 $instance['data_lazy'] = !empty( $new_instance['data_lazy'] ) ? 'true' : 'false'; 112 84 113 return $instance; 85 86 } 87 88 /** @see WP_Widget::form */ 114 } 115 89 116 function form( $instance ) { 90 91 /** 92 * Set Default Value for widget form 93 */ 94 $defaults = array( 'title' => 'Like Us On Facebook', 'fb_url' => 'https://www.facebook.com/WordPress', 'width' => '300', 'height' => '500', 'data_small_header' => 'false', 'select_lng' => 'en_US', 'data_adapt_container_width' => 'on', 'data_hide_cover' => 'false', 'data_show_facepile' => 'on', 'data_tabs' => 'timeline', 'data_lazy'=> 'false'); 95 96 $instance = wp_parse_args( ( array ) $instance, $defaults ); 97 $title = esc_attr( $instance['title'] ); 98 $fb_url = isset( $instance['fb_url'] ) ? esc_attr( $instance['fb_url'] ) : "http://www.facebook.com/WordPress"; 99 $width = esc_attr( $instance['width'] ); 100 $height = esc_attr( $instance['height'] ); 101 $data_tabs = isset( $instance['data_tabs'] ) ? ( $instance['data_tabs'] ) : "timeline"; 117 $defaults = array( 118 'title' => 'Like Us On Facebook', 119 'fb_url' => 'https://www.facebook.com/WordPress', 120 'width' => '300', 121 'height' => '500', 122 'data_small_header' => 'false', 123 'select_lng' => 'en_US', 124 'data_adapt_container_width' => 'true', 125 'data_hide_cover' => 'false', 126 'data_show_facepile' => 'true', 127 'data_tabs' => array('timeline'), 128 'data_lazy' => 'false' 129 ); 130 131 $instance = wp_parse_args( (array) $instance, $defaults ); 132 133 $title = esc_attr( $instance['title'] ); 134 $fb_url = esc_attr( $instance['fb_url'] ); 135 $width = esc_attr( $instance['width'] ); 136 $height = esc_attr( $instance['height'] ); 137 $data_tabs = $instance['data_tabs']; 138 139 // Correctly handle tabs as an array 140 $selected_tabs = is_array( $data_tabs ) ? $data_tabs : explode( ',', $data_tabs ); 102 141 ?> 103 142 … … 106 145 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /> 107 146 </p> 147 108 148 <p> 109 149 <label for="<?php echo $this->get_field_id( 'fb_url' ); ?>"><?php _e( 'Facebook Page Url:', 'facebook-pagelike-widget' ); ?></label> 110 150 <input class="widefat" id="<?php echo $this->get_field_id( 'fb_url' ); ?>" name="<?php echo $this->get_field_name( 'fb_url' ); ?>" type="text" value="<?php echo $fb_url; ?>" /> 111 <small style="font-size: 0.6em;">112 <?php _e( 'Works with only' ); ?> 113 <a href="http://www.facebook.com/help/?faq=174987089221178" target="_blank">114 <?php _e( 'Valid Facebook Pages!' ); ?>115 </a>116 </small>117 </p>118 <p>119 <?php120 if( $instance ) {121 $select = $instance['data_tabs'];151 </p> 152 153 <p> 154 <label for="<?php echo $this->get_field_id( 'data_tabs' ); ?>"><?php _e( 'Tabs (Hold Ctrl/Cmd to select multiple):', 'facebook-pagelike-widget' ); ?></label> 155 <select class="widefat" multiple="multiple" name="<?php echo $this->get_field_name('data_tabs'); ?>[]" id="<?php echo $this->get_field_id('data_tabs'); ?>" style="height: 80px;"> 156 <?php 157 $available_tabs = array( 'timeline', 'events', 'messages' ); 158 foreach ( $available_tabs as $tab ) { 159 // Variable name fixed to $selected_tabs 160 $selected = in_array( $tab, $selected_tabs ) ? 'selected="selected"' : ''; 161 echo '<option value="' . esc_attr( $tab ) . '" ' . $selected . '>' . ucfirst( $tab ) . '</option>'; 122 162 } 123 else { 124 $select = "timeline"; 125 } 126 if(is_string($select)) { 127 $select = array($select); 128 } 129 ?> 130 <label for="<?php echo $this->get_field_id( 'data_tabs' ); ?>"><?php _e( 'Tabs:', 'facebook-pagelike-widget' ); ?></label> 131 <?php 132 133 printf( 134 '<select multiple="multiple" name="%s[]" id="%s">', 135 $this->get_field_name('data_tabs'), 136 $this->get_field_id('data_tabs') 137 ); 138 $tabs = array( 'timeline','events','messages' ); 139 140 foreach( $tabs as $tab ) 141 { 142 printf( 143 '<option value="%s" class="hot-topic" %s style="margin-bottom:3px;">%s</option>', 144 $tab, 145 in_array( $tab, $select) ? 'selected="selected"' : '', 146 $tab 147 ); 148 } 149 echo '</select>'; 150 ?> 151 </p> 152 <p> 153 <input class="checkbox" type="checkbox" <?php checked( $instance['data_hide_cover'], "on" ) ?> id="<?php echo $this->get_field_id( 'data_hide_cover' ); ?>" name="<?php echo $this->get_field_name( 'data_hide_cover' ); ?>" /> 154 <label for="<?php echo $this->get_field_id( 'data_hide_cover' ); ?>" title="Hide the cover photo in the header"><?php _e( 'Hide Cover Photo', 'facebook-pagelike-widget' ); ?></label> 155 </p> 156 <p> 157 <input class="checkbox" type="checkbox" <?php checked( $instance['data_show_facepile'], "on" ) ?> id="<?php echo $this->get_field_id( 'data_show_facepile' ); ?>" name="<?php echo $this->get_field_name( 'data_show_facepile' ); ?>" /> 158 <label for="<?php echo $this->get_field_id( 'data_show_facepile' ); ?>" title="Show profile photos when friends like this"><?php _e( "Show Friend's Faces", 'facebook-pagelike-widget' ); ?></label> 159 </p> 160 <p> 161 <input class="checkbox" type="checkbox" <?php checked( $instance['data_small_header'], "on" ) ?> id="<?php echo $this->get_field_id( 'data_small_header' ); ?>" name="<?php echo $this->get_field_name( 'data_small_header' ); ?>" /> 162 <label for="<?php echo $this->get_field_id( 'data_small_header' ); ?>" title="Uses a smaller version of the page header"><?php _e( 'Show Small Header', 'facebook-pagelike-widget' ); ?></label> 163 </p> 164 <p> 165 <input onclick="showWidth();" class="checkbox" type="checkbox" <?php checked( $instance['data_adapt_container_width'], "on" ) ?> id="<?php echo $this->get_field_id( 'data_adapt_container_width' ); ?>" name="<?php echo $this->get_field_name( 'data_adapt_container_width' ); ?>" /> 166 <label for="<?php echo $this->get_field_id( 'data_adapt_container_width' ); ?>" title="Plugin will try to fit inside the container"><?php _e( 'Adapt To Plugin Container Width', 'facebook-pagelike-widget' ); ?></label> 167 </p> 168 <p class="width_option <?php echo $instance['data_adapt_container_width'] == 'on' ? 'hideme' : ''; ?>"> 163 ?> 164 </select> 165 </p> 166 167 <p> 168 <input class="checkbox" type="checkbox" <?php checked( $instance['data_hide_cover'], 'true' ) ?> id="<?php echo $this->get_field_id( 'data_hide_cover' ); ?>" name="<?php echo $this->get_field_name( 'data_hide_cover' ); ?>" /> 169 <label for="<?php echo $this->get_field_id( 'data_hide_cover' ); ?>"><?php _e( 'Hide Cover Photo', 'facebook-pagelike-widget' ); ?></label> 170 </p> 171 172 <p> 173 <input class="checkbox" type="checkbox" <?php checked( $instance['data_show_facepile'], 'true' ) ?> id="<?php echo $this->get_field_id( 'data_show_facepile' ); ?>" name="<?php echo $this->get_field_name( 'data_show_facepile' ); ?>" /> 174 <label for="<?php echo $this->get_field_id( 'data_show_facepile' ); ?>"><?php _e( "Show Friend's Faces", 'facebook-pagelike-widget' ); ?></label> 175 </p> 176 177 <p> 178 <input class="checkbox" type="checkbox" <?php checked( $instance['data_small_header'], 'true' ) ?> id="<?php echo $this->get_field_id( 'data_small_header' ); ?>" name="<?php echo $this->get_field_name( 'data_small_header' ); ?>" /> 179 <label for="<?php echo $this->get_field_id( 'data_small_header' ); ?>"><?php _e( 'Show Small Header', 'facebook-pagelike-widget' ); ?></label> 180 </p> 181 182 <p> 183 <input class="checkbox adapt-click" type="checkbox" <?php checked( $instance['data_adapt_container_width'], 'true' ) ?> id="<?php echo $this->get_field_id( 'data_adapt_container_width' ); ?>" name="<?php echo $this->get_field_name( 'data_adapt_container_width' ); ?>" /> 184 <label for="<?php echo $this->get_field_id( 'data_adapt_container_width' ); ?>"><?php _e( 'Adapt To Container Width', 'facebook-pagelike-widget' ); ?></label> 185 </p> 186 187 <p class="width_option" style="<?php echo ( $instance['data_adapt_container_width'] === 'true' ) ? 'display:none;' : ''; ?>"> 169 188 <label for="<?php echo $this->get_field_id( 'width' ); ?>"><?php _e( 'Set Width:', 'facebook-pagelike-widget' ); ?></label> 170 <input size="19" id="<?php echo $this->get_field_id( 'width' ); ?>" name="<?php echo $this->get_field_name( 'width' ); ?>" type="text" value="<?php echo $width; ?>" placeholder="Min. 180 to Max. 500" /> 171 </p> 172 <p> 173 <input class="checkbox" type="checkbox" <?php checked( $instance['data_lazy'], "on" ) ?> id="<?php echo $this->get_field_id( 'data_lazy' ); ?>" name="<?php echo $this->get_field_name( 'data_lazy' ); ?>" /> 174 <label for="<?php echo $this->get_field_id( 'data_lazy' ); ?>" title="true means use the browser's lazy-loading mechanism by setting the loading=lazy iframe attribute. The effect is that the browser does not render the plugin if it's not close to the viewport and might never be seen."><?php _e( 'Enable Lazy Loading', 'facebook-pagelike-widget' ); ?></label> 175 </p> 189 <input class="widefat" id="<?php echo $this->get_field_id( 'width' ); ?>" name="<?php echo $this->get_field_name( 'width' ); ?>" type="text" value="<?php echo $width; ?>" /> 190 </p> 191 192 <p> 193 <input class="checkbox" type="checkbox" <?php checked( $instance['data_lazy'], 'true' ) ?> id="<?php echo $this->get_field_id( 'data_lazy' ); ?>" name="<?php echo $this->get_field_name( 'data_lazy' ); ?>" /> 194 <label for="<?php echo $this->get_field_id( 'data_lazy' ); ?>"><?php _e( 'Enable Lazy Loading', 'facebook-pagelike-widget' ); ?></label> 195 </p> 196 176 197 <p> 177 198 <label for="<?php echo $this->get_field_id( 'height' ); ?>"><?php _e( 'Set Height:', 'facebook-pagelike-widget' ); ?></label> 178 <input size="19" id="<?php echo $this->get_field_id( 'height' ); ?>" name="<?php echo $this->get_field_name( 'height' ); ?>" type="text" value="<?php echo $height; ?>" placeholder="Min. 70" />179 </p> 180 199 <input class="widefat" id="<?php echo $this->get_field_id( 'height' ); ?>" name="<?php echo $this->get_field_name( 'height' ); ?>" type="text" value="<?php echo $height; ?>" /> 200 </p> 201 181 202 <?php 182 203 $filename = __DIR__.'/FacebookLocales.json'; 183 if (ini_get( 'allow_url_fopen') ) { 184 if(file_exists( $filename) ) { 185 $langs = file_get_contents( $filename ); 186 $jsoncont = json_decode( $langs ); 187 ?> 204 if ( file_exists( $filename ) ) { 205 $langs = file_get_contents( $filename ); 206 $jsoncont = json_decode( $langs, true ); 207 if ( ! empty( $jsoncont ) ) { ?> 188 208 <p> 189 209 <label for="<?php echo $this->get_field_id( 'select_lng' ); ?>"><?php _e( 'Language:', 'facebook-pagelike-widget' ); ?></label> 190 <select name="<?php echo $this->get_field_name( 'select_lng' ); ?>" id="<?php echo $this->get_field_id( 'select_lng' ); ?>"> 191 <?php 192 if ( !empty( $jsoncont ) ) { 193 foreach ( $jsoncont as $languages => $short_name ) { ?> 194 <option value="<?php echo $short_name; ?>"<?php selected( $instance['select_lng'], $short_name ); ?>><?php _e( $languages ); ?></option> 195 <?php 196 } 197 } 198 ?> 210 <select class="widefat" name="<?php echo $this->get_field_name( 'select_lng' ); ?>" id="<?php echo $this->get_field_id( 'select_lng' ); ?>"> 211 <?php foreach ( $jsoncont as $lang_name => $short_name ) : ?> 212 <option value="<?php echo esc_attr( $short_name ); ?>" <?php selected( $instance['select_lng'], $short_name ); ?>> 213 <?php echo esc_html( $lang_name ); ?> 214 </option> 215 <?php endforeach; ?> 199 216 </select> 200 217 </p> 201 <?php 202 } 203 } else { 204 ?> 205 <p>Your PHP configuration does not allow to read <a href="<?php echo plugin_dir_url( __FILE__ ).'FacebookLocales.json';?>" target="_blank">this</a> file. 206 To unable language option, enable <a href="http://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen" target="_blank"><b>allow_url_fopen</b></a> in your server configuration. 207 </p> 208 <?php 218 <?php } 209 219 } 210 220 ?> 221 211 222 <script type="text/javascript"> 212 function showWidth() { 213 if (jQuery( ".width_option" ).hasClass( 'hideme' ) ) 214 jQuery( ".width_option" ).removeClass( 'hideme' ); 215 else 216 jQuery( ".width_option" ).addClass( 'hideme' ); 217 } 223 jQuery(document).ready(function($) { 224 $('.adapt-click').off('click').on('click', function() { 225 $(this).closest('form').find('.width_option').toggle(!this.checked); 226 }); 227 }); 218 228 </script> 219 220 <style type="text/css">.hideme {display: none;}</style>221 229 <?php 222 230 } … … 226 234 return register_widget( "facebook_widget" ); 227 235 }); 228 229 ?> -
facebook-pagelike-widget/trunk/readme.txt
r3387453 r3431131 4 4 Donate link: https://www.paypal.me/MilapPatel 5 5 Requires at least: 3.0.1 6 Tested up to: 6. 8.37 Stable tag: 6. 4.26 Tested up to: 6.9 7 Stable tag: 6.5 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 17 17 > Did you find this plugin helpful? Please consider [leaving a 5-star review](https://wordpress.org/support/plugin/facebook-pagelike-widget/reviews/?filter=5#new-post). 18 18 19 > Did this plugin made your life easy? Please consider [donating](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business= neetap179@gmail.com&lc=US&item_name=Providing+Excellent+WordPress+plugin+support&no_note=0&no_shipping=2&curency_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted).19 > Did this plugin made your life easy? Please consider [donating](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=cemilap.88@gmail.com&lc=US&item_name=Providing+Excellent+WordPress+plugin+support&no_note=0&no_shipping=2&curency_code=USD&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted). 20 20 21 21 One of the most popular & lightweight plugin for Facebook page feeds widget with over 1.6 Million downloads and 50,000+ active installs. 22 22 23 How to use latest version 6. 4:23 How to use latest version 6.5: 24 24 25 25 https://www.youtube.com/watch?v=qayeaqlmofA … … 114 114 115 115 == Changelog == 116 117 = Version 6.5 = 118 * Fixed PHP version 8.2 warnings and notices. 119 * Improved code readability. 116 120 117 121 = Version 6.4.2 = -
facebook-pagelike-widget/trunk/short_code.php
r3033718 r3431131 1 1 <?php 2 function fb_plugin_shortcode($atts) { 2 /** 3 * Facebook Page Plugin Shortcode 4 * Usage: [fb_widget fb_url="https://facebook.com/yourpage" data_tabs="timeline,events"] 5 */ 6 function fb_plugin_shortcode( $atts ) { 3 7 4 $atts = shortcode_atts(array('fb_url' => 'http://facebook.com/WordPress', 'width' => '400', 'height' => '500', 'data_small_header' => 'false', 'data_small_header' => 'false', 'data_adapt_container_width' => 'true', 'data_hide_cover' => 'false', 'data_show_facepile' => 'true', 'data_tabs' => 'timeline', 'data_lazy'=> 'false'), $atts, 'fb_widget'); 5 6 $feeds = '<iframe src="https://www.facebook.com/plugins/page.php?href='.esc_html($atts['fb_url']).'&tabs='.esc_html($atts['data_tabs']).'&width='.esc_html($atts['width']).'&height='.esc_html($atts['height']).'&small_header='.esc_html($atts['data_small_header']).'&adapt_container_width='.esc_html($atts['data_adapt_container_width']).'&hide_cover='.esc_html($atts['data_hide_cover']).'&show_facepile='.esc_html($atts['data_show_facepile']).'&data_lazy='.esc_html($atts['data_lazy']).'" width="'.esc_html($atts['width']).'" height="'.esc_html($atts['height']).'" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"></iframe>'; 8 // 1. Define defaults and merge with user attributes 9 $atts = shortcode_atts( array( 10 'fb_url' => 'https://www.facebook.com/WordPress', 11 'width' => '400', 12 'height' => '500', 13 'data_tabs' => 'timeline', 14 'data_small_header' => 'false', 15 'data_adapt_container_width' => 'true', 16 'data_hide_cover' => 'false', 17 'data_show_facepile' => 'true', 18 'data_lazy' => 'false' 19 ), $atts, 'fb_widget' ); 7 20 8 return $feeds; 21 // 2. Prepare the Facebook URL with properly encoded queries 22 // We use add_query_arg to build the URL cleanly 23 $fb_iframe_url = add_query_arg( array( 24 'href' => rawurlencode( $atts['fb_url'] ), 25 'tabs' => sanitize_text_field( $atts['data_tabs'] ), 26 'width' => absint( $atts['width'] ), 27 'height' => absint( $atts['height'] ), 28 'small_header' => ( $atts['data_small_header'] === 'true' ) ? 'true' : 'false', 29 'adapt_container_width' => ( $atts['data_adapt_container_width'] === 'true' ) ? 'true' : 'false', 30 'hide_cover' => ( $atts['data_hide_cover'] === 'true' ) ? 'true' : 'false', 31 'show_facepile' => ( $atts['data_show_facepile'] === 'true' ) ? 'true' : 'false', 32 'lazy' => ( $atts['data_lazy'] === 'true' ) ? 'true' : 'false', 33 'appId' => '', // Optional: Add if you have a Facebook App ID 34 ), 'https://www.facebook.com/plugins/page.php' ); 35 36 // 3. Build the Iframe Output 37 // Use esc_url for the src and absint for dimensions to ensure security 38 $output = sprintf( 39 '<div class="fb-shortcode-container"> 40 <iframe src="%1$s" width="%2$d" height="%3$d" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"></iframe> 41 </div>', 42 esc_url( $fb_iframe_url ), 43 absint( $atts['width'] ), 44 absint( $atts['height'] ) 45 ); 46 47 return $output; 9 48 } 10 49 11 add_shortcode('fb_widget', 'fb_plugin_shortcode'); 12 13 14 ?> 50 add_shortcode( 'fb_widget', 'fb_plugin_shortcode' );
Note: See TracChangeset
for help on using the changeset viewer.