Changeset 1439021
- Timestamp:
- 06/18/2016 07:50:56 AM (10 years ago)
- Location:
- slimfaq/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (1 diff)
-
slimfaq-for-wordpress.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
slimfaq/trunk/readme.txt
r1439017 r1439021 16 16 17 17 This plugin is fully compatible with the [Official Intercom WordPress plugin](https://wordpress.org/plugins/intercom). 18 19 This plugin is based on the excellent work of [Simon Blackbourn's](https://lumpylemon.co.uk) [Intercom for WordPress](https://wordpress.org/plugins/intercom-for-wordpress) plugin.20 21 18 22 19 == Frequently Asked Questions == -
slimfaq/trunk/slimfaq-for-wordpress.php
r1439017 r1439021 10 10 11 11 12 -----------13 description14 -----------15 16 This plugin helps you integrate your FAQ from SlimFAQ into your WordPress page. Get started for free on slimfaq.com.17 18 -------19 license20 -------21 22 This is a plugin for WordPress (http://wordpress.org).23 24 Copyright Constantin Hofstetter ([email protected]), strongly influenced by Simon Blackbourn's ([email protected]) Intercom for WordPress plugin (https://wordpress.org/plugins/intercom-for-wordpress)25 26 Released under the GPL license: http://www.opensource.org/licenses/gpl-license.php27 28 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.29 30 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.12 ----------- 13 description 14 ----------- 15 16 This plugin helps you integrate your FAQ from SlimFAQ into your WordPress page. Get started for free on slimfaq.com. 17 18 ------- 19 license 20 ------- 21 22 This is a plugin for WordPress (http://wordpress.org). 23 24 Copyright Constantin Hofstetter ([email protected]), strongly influenced by Simon Blackbourn's ([email protected]) Intercom for WordPress plugin (https://wordpress.org/plugins/intercom-for-wordpress) 25 26 Released under the GPL license: http://www.opensource.org/licenses/gpl-license.php 27 28 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 29 30 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 31 31 32 32 … … 51 51 52 52 53 /**54 * class constructor55 * register the activation and de-activation hooks and hook into a bunch of actions56 */57 function __construct() {58 59 add_action( 'wp_footer', array( $this, 'output_install_code' ) );60 add_action( 'admin_menu', array( $this, 'create_options_page' ) );61 add_action( 'network_admin_menu', array( $this, 'create_options_page' ) );62 add_action( 'admin_init', array( $this, 'settings_init' ) );63 add_action( 'admin_notices', array( $this, 'notice' ) );64 add_action( 'network_admin_notices', array( $this, 'notice' ) );65 66 }67 68 /**69 * check if this plugin is activated network-wide70 * @return boolean71 */72 function is_network_active() {73 74 if ( ! function_exists( 'is_plugin_active_for_network' ) )75 require_once( ABSPATH . '/wp-admin/includes/plugin.php' );76 77 if ( is_plugin_active_for_network( plugin_basename( __FILE__ ) ) )78 return true;79 80 return false;81 82 }83 84 85 86 /**87 * retrieve the slimfaq options88 * @return array 'll-slimfaq' options89 */90 function get_settings() {91 92 if ( $this->is_network_active() )93 return get_site_option( 'll-slimfaq' );94 95 return get_option( 'll-slimfaq' );96 97 }98 99 100 101 /**102 * update the slimfaq options in the database103 * @param array $opts new options settings to save104 * @return null105 */106 function update_settings( $opts ) {107 108 if ( is_network_admin() ) {109 update_site_option( 'll-slimfaq', $opts );110 } else {111 update_option( 'll-slimfaq', $opts );112 }113 114 }115 116 117 118 /**119 * construct and output the intercom javascript snippet120 * @return null121 */122 function output_install_code() {123 124 // retrieve the options125 $opts = $this->get_settings();126 127 // don't do anything if:128 // the current user is hidden from slimfaq129 // or is not logged in and show-for-logged-out is disabled130 // or the ll_slimfaq_output_snippet filter returns false131 132 if ((!$opts['show-for-logged-out'] and !is_user_logged_in()) or !apply_filters( 'll_slimfaq_output_snippet', true ) )133 return;134 135 // don't do anything if the app id and secret key fields have not been set136 137 if ( !isset( $opts[ 'faq-id' ] ) or !$opts[ 'faq-id' ] )138 return;139 140 // generate and output the javascript141 142 $out = '<script>';143 $out .= ' !function(a,b,c,d,e,f){e=b.createElement("script"),e.type="text/javascript",e.async=!0,e.src="https://cdn.slimfaq.com/widget/widget.js",f=b.getElementsByTagName("script")[0],f.parentNode.insertBefore(e,f),e.onload=function(){Slimfaq.init(c,d)}}';144 145 if ( $opts['intercom-enabled'] ) {146 $out .= ' (window,document,"' . $opts[ 'faq-id' ] . '",{intercom:"enable",button:"Contact Support"});';147 } else {148 $out .= ' (window,document,"' . $opts[ 'faq-id' ] . '",{button:"Contact Support"});';149 }150 151 $out .= '</script>';152 $out .= '<noscript>';153 $out .= ' <a href="https://slimfaq.com/'. $opts[ 'faq-id' ] .'" target="_blank">FAQ on SlimFAQ</a>';154 $out .= '</noscript>';155 156 echo $out;157 }158 159 160 161 /**162 * show a 'settings saved' notice163 * and a friendly reminder if the SlimFAQ ID haven't been entered164 * @return null165 */166 function notice() {167 168 if ( isset( $_GET[ 'page' ] ) and ( 'slimfaq' == $_GET[ 'page' ] ) ) {169 170 if ( is_network_admin() and isset( $_GET[ 'updated' ] ) ) { ?>171 <div class="updated" id="ll-slimfaq-updated"><p><?php _e( 'Settings saved.' ); ?></p></div>172 <?php173 }174 175 }176 177 // show an slimfaq reminder to users who can update options178 179 if ( ! current_user_can( 'manage_options' ) )180 return;181 182 $opts = $this->get_settings();183 184 if ( !is_network_admin() and ( !isset( $opts[ 'faq-id' ] ) or !$opts[ 'faq-id' ] ) ) {185 echo '<div class="error" id="ll-slimfaq-notice"><p><strong>SlimFAQ needs some attention</strong>. ';186 if ( isset( $_GET[ 'page' ] ) and 'slimfaq' == $_GET[ 'page' ] ) {187 echo 'Please enter your SlimFAQ ID';188 } else {189 echo 'Please <a href="options-general.php?page=slimfaq">configure the SlimFAQ settings</a>';190 }191 echo ' to integrate your FAQ.</p></div>' . "\n";192 }193 194 }195 196 197 198 /**199 * create the relevant type of slimfaq options page200 * depending if we're single site or network active201 * @return null202 */203 function create_options_page() {204 205 // annoyingly multisite doesn't play nicely with the settings api206 // so we need to account for that by creating a special page207 208 if ( $this->is_network_active() ) {209 210 add_submenu_page(211 'settings.php',212 'SlimFAQ Settings',213 'SlimFAQ',214 'manage_network_options',215 'slimfaq',216 array( $this, 'render_options_page' )217 );218 219 } else {220 221 add_options_page(222 'SlimFAQ Settings',223 'SlimFAQ',224 'manage_options',225 'slimfaq',226 array( $this, 'render_options_page' )227 );228 229 }230 231 }232 233 234 235 /**236 * output the SlimFAQ options page237 * @return null238 */239 function render_options_page() {240 241 $opts = $this->get_settings();242 243 $action = is_network_admin() ? 'settings.php?page=slimfaq' : 'options.php';244 245 ?>246 247 <div class="wrap">248 249 <?php screen_icon( 'options-general' ); ?>250 <h2>SlimFAQ Configuration</h2>251 252 <div class="postbox-container" style="width:65%;">253 254 <form method="post" action="<?php echo $action; ?>">255 256 <?php settings_fields( 'slimfaq' ); ?>257 258 <table class="form-table">259 <tbody>260 261 <tr valign="top">262 <th scope="row">FAQ ID</th>263 <td>264 <input name="ll-slimfaq[faq-id]" type="text" value="<?php echo esc_attr( $opts[ 'faq-id' ] ); ?>">265 <p class="description" id="ll-slimfaq-faq-id-description">Please get this value from your <a href="https://slimfaq.com/account/settings">SlimFAQ settings page</a>.</p>266 </td>267 </tr>268 269 <tr valign="top">270 <th scope="row">Show for logged out users?</th>271 <td>272 <input name="ll-slimfaq[show-for-logged-out]" type="checkbox" value="1" <?php checked( $opts[ 'show-for-logged-out' ] ); ?>>273 <p class="description" id="ll-slimfaq-show-for-logged-out-description">Enable this setting to display the FAQ as a sidebar for visitors without an account.</p>274 </td>275 </tr>276 277 <tr valign="top">278 <th scope="row">Integrate with Intercom?</th>279 <td>280 <input name="ll-slimfaq[intercom-enabled]" type="checkbox" value="1" <?php checked( $opts[ 'intercom-enabled' ] ); ?>>281 <p class="description" id="ll-slimfaq-intercom-enabled">Enable this setting if you have <a href="https://intercom.io">Intercom</a> installed.</p>282 </td>283 </tr>284 </tbody>285 286 </table>287 288 <p class="submit">289 <input class="button-primary" name="ll-slimfaq-submit" type="submit" value="Save Settings">290 </p>291 292 </form>293 294 </div>295 296 <div class="postbox-container" style="width:20%;">297 298 <div class="metabox-holder">299 300 <div class="meta-box-sortables" style="min-height:0;">301 <div class="postbox ll-slimfaq-info" id="ll-slimfaq-support">302 <h3 class="hndle"><span>Need Help?</span></h3>303 <div class="inside">304 <p>Please see our <a href="https://slimfaq.com/faq/23-integration">FAQ on integrations</a> if you have any questions.</p>305 <p>Feel free to <a href="https://slimfaq.com">get in touch</a> if you need help integrating your FAQ.</p>306 </div>307 </div>308 </div>309 310 <div class="meta-box-sortables" style="min-height:0;">311 <div class="postbox ll-slimfaq-info" id="ll-slimfaq-suggest">312 <h3 class="hndle"><span>Like this Plugin?</span></h3>313 <div class="inside">314 <p>If this plugin has helped you improve your customer relationships, please consider supporting it:</p>315 <ul>316 <li><a href="https://wordpress.org/extend/plugins/slimfaq/">Rate it and let other people know it works</a>.</li>317 <li>Link to it or share it on Twitter or Facebook.</li>318 <li>Write a review on your website or blog.</li>319 </ul>320 </div>321 </div>322 </div>323 324 </div>325 326 </div>327 </div>328 <?php329 330 }331 332 333 334 /**335 * use the WordPress settings api to initiate the various intercom settings336 * and if it's a network settings page then validate & update any submitted settings337 * @return null338 */339 function settings_init() {340 341 register_setting( 'slimfaq', 'll-slimfaq', array( $this, 'validate' ) );342 if ( isset( $_REQUEST[ '_wpnonce' ] ) and wp_verify_nonce( $_REQUEST[ '_wpnonce' ], 'slimfaq-options' ) ) {343 344 $file = is_network_admin() ? 'settings.php' : 'options-general.php';345 346 if ( isset( $_POST[ 'll-slimfaq-submit' ] ) and is_network_admin() ) {347 $opts = $this->validate( $_POST[ 'll-slimfaq' ] );348 $this->update_settings( $opts );349 wp_redirect( add_query_arg( array(350 'page' => 'slimfaq',351 'updated' => true352 ), $file ) );353 die();354 }355 356 }357 358 }359 360 361 362 /**363 * make sure that no dodgy stuff is trying to sneak into the intercom settings364 * @param array $input options to validate365 * @return array validated options366 */367 function validate( $input ) {368 369 $new[ 'faq-id' ] = wp_kses( trim( $input[ 'faq-id' ] ), array() );370 $new[ 'show-for-logged-out' ] = absint( $input[ 'show-for-logged-out' ] );371 $new[ 'intercom-enabled' ] = absint( $input[ 'intercom-enabled' ] );372 373 return $new;374 375 }53 /** 54 * class constructor 55 * register the activation and de-activation hooks and hook into a bunch of actions 56 */ 57 function __construct() { 58 59 add_action( 'wp_footer', array( $this, 'output_install_code' ) ); 60 add_action( 'admin_menu', array( $this, 'create_options_page' ) ); 61 add_action( 'network_admin_menu', array( $this, 'create_options_page' ) ); 62 add_action( 'admin_init', array( $this, 'settings_init' ) ); 63 add_action( 'admin_notices', array( $this, 'notice' ) ); 64 add_action( 'network_admin_notices', array( $this, 'notice' ) ); 65 66 } 67 68 /** 69 * check if this plugin is activated network-wide 70 * @return boolean 71 */ 72 function is_network_active() { 73 74 if ( ! function_exists( 'is_plugin_active_for_network' ) ) 75 require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); 76 77 if ( is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) 78 return true; 79 80 return false; 81 82 } 83 84 85 86 /** 87 * retrieve the slimfaq options 88 * @return array 'll-slimfaq' options 89 */ 90 function get_settings() { 91 92 if ( $this->is_network_active() ) 93 return get_site_option( 'll-slimfaq' ); 94 95 return get_option( 'll-slimfaq' ); 96 97 } 98 99 100 101 /** 102 * update the slimfaq options in the database 103 * @param array $opts new options settings to save 104 * @return null 105 */ 106 function update_settings( $opts ) { 107 108 if ( is_network_admin() ) { 109 update_site_option( 'll-slimfaq', $opts ); 110 } else { 111 update_option( 'll-slimfaq', $opts ); 112 } 113 114 } 115 116 117 118 /** 119 * construct and output the intercom javascript snippet 120 * @return null 121 */ 122 function output_install_code() { 123 124 // retrieve the options 125 $opts = $this->get_settings(); 126 127 // don't do anything if: 128 // the current user is hidden from slimfaq 129 // or is not logged in and show-for-logged-out is disabled 130 // or the ll_slimfaq_output_snippet filter returns false 131 132 if ((!$opts['show-for-logged-out'] and !is_user_logged_in()) or !apply_filters( 'll_slimfaq_output_snippet', true ) ) 133 return; 134 135 // don't do anything if the app id and secret key fields have not been set 136 137 if ( !isset( $opts[ 'faq-id' ] ) or !$opts[ 'faq-id' ] ) 138 return; 139 140 // generate and output the javascript 141 142 $out = '<script>'; 143 $out .= ' !function(a,b,c,d,e,f){e=b.createElement("script"),e.type="text/javascript",e.async=!0,e.src="https://cdn.slimfaq.com/widget/widget.js",f=b.getElementsByTagName("script")[0],f.parentNode.insertBefore(e,f),e.onload=function(){Slimfaq.init(c,d)}}'; 144 145 if ( $opts['intercom-enabled'] ) { 146 $out .= ' (window,document,"' . $opts[ 'faq-id' ] . '",{intercom:"enable",button:"Contact Support"});'; 147 } else { 148 $out .= ' (window,document,"' . $opts[ 'faq-id' ] . '",{button:"Contact Support"});'; 149 } 150 151 $out .= '</script>'; 152 $out .= '<noscript>'; 153 $out .= ' <a href="https://slimfaq.com/'. $opts[ 'faq-id' ] .'" target="_blank">FAQ on SlimFAQ</a>'; 154 $out .= '</noscript>'; 155 156 echo $out; 157 } 158 159 160 161 /** 162 * show a 'settings saved' notice 163 * and a friendly reminder if the SlimFAQ ID haven't been entered 164 * @return null 165 */ 166 function notice() { 167 168 if ( isset( $_GET[ 'page' ] ) and ( 'slimfaq' == $_GET[ 'page' ] ) ) { 169 170 if ( is_network_admin() and isset( $_GET[ 'updated' ] ) ) { ?> 171 <div class="updated" id="ll-slimfaq-updated"><p><?php _e( 'Settings saved.' ); ?></p></div> 172 <?php 173 } 174 175 } 176 177 // show an slimfaq reminder to users who can update options 178 179 if ( ! current_user_can( 'manage_options' ) ) 180 return; 181 182 $opts = $this->get_settings(); 183 184 if ( !is_network_admin() and ( !isset( $opts[ 'faq-id' ] ) or !$opts[ 'faq-id' ] ) ) { 185 echo '<div class="error" id="ll-slimfaq-notice"><p><strong>SlimFAQ needs some attention</strong>. '; 186 if ( isset( $_GET[ 'page' ] ) and 'slimfaq' == $_GET[ 'page' ] ) { 187 echo 'Please enter your SlimFAQ ID'; 188 } else { 189 echo 'Please <a href="options-general.php?page=slimfaq">configure the SlimFAQ settings</a>'; 190 } 191 echo ' to integrate your FAQ.</p></div>' . "\n"; 192 } 193 194 } 195 196 197 198 /** 199 * create the relevant type of slimfaq options page 200 * depending if we're single site or network active 201 * @return null 202 */ 203 function create_options_page() { 204 205 // annoyingly multisite doesn't play nicely with the settings api 206 // so we need to account for that by creating a special page 207 208 if ( $this->is_network_active() ) { 209 210 add_submenu_page( 211 'settings.php', 212 'SlimFAQ Settings', 213 'SlimFAQ', 214 'manage_network_options', 215 'slimfaq', 216 array( $this, 'render_options_page' ) 217 ); 218 219 } else { 220 221 add_options_page( 222 'SlimFAQ Settings', 223 'SlimFAQ', 224 'manage_options', 225 'slimfaq', 226 array( $this, 'render_options_page' ) 227 ); 228 229 } 230 231 } 232 233 234 235 /** 236 * output the SlimFAQ options page 237 * @return null 238 */ 239 function render_options_page() { 240 241 $opts = $this->get_settings(); 242 243 $action = is_network_admin() ? 'settings.php?page=slimfaq' : 'options.php'; 244 245 ?> 246 247 <div class="wrap"> 248 249 <?php screen_icon( 'options-general' ); ?> 250 <h2>SlimFAQ Configuration</h2> 251 252 <div class="postbox-container" style="width:65%;"> 253 254 <form method="post" action="<?php echo $action; ?>"> 255 256 <?php settings_fields( 'slimfaq' ); ?> 257 258 <table class="form-table"> 259 <tbody> 260 261 <tr valign="top"> 262 <th scope="row">FAQ ID</th> 263 <td> 264 <input name="ll-slimfaq[faq-id]" type="text" value="<?php echo esc_attr( $opts[ 'faq-id' ] ); ?>"> 265 <p class="description" id="ll-slimfaq-faq-id-description">Please get this value from your <a href="https://slimfaq.com/account/settings">SlimFAQ settings page</a>.</p> 266 </td> 267 </tr> 268 269 <tr valign="top"> 270 <th scope="row">Show for logged out users?</th> 271 <td> 272 <input name="ll-slimfaq[show-for-logged-out]" type="checkbox" value="1" <?php checked( $opts[ 'show-for-logged-out' ] ); ?>> 273 <p class="description" id="ll-slimfaq-show-for-logged-out-description">Enable this setting to display the FAQ as a sidebar for visitors without an account.</p> 274 </td> 275 </tr> 276 277 <tr valign="top"> 278 <th scope="row">Integrate with Intercom?</th> 279 <td> 280 <input name="ll-slimfaq[intercom-enabled]" type="checkbox" value="1" <?php checked( $opts[ 'intercom-enabled' ] ); ?>> 281 <p class="description" id="ll-slimfaq-intercom-enabled">Enable this setting if you have <a href="https://intercom.io">Intercom</a> installed.</p> 282 </td> 283 </tr> 284 </tbody> 285 286 </table> 287 288 <p class="submit"> 289 <input class="button-primary" name="ll-slimfaq-submit" type="submit" value="Save Settings"> 290 </p> 291 292 </form> 293 294 </div> 295 296 <div class="postbox-container" style="width:20%;"> 297 298 <div class="metabox-holder"> 299 300 <div class="meta-box-sortables" style="min-height:0;"> 301 <div class="postbox ll-slimfaq-info" id="ll-slimfaq-support"> 302 <h3 class="hndle"><span>Need Help?</span></h3> 303 <div class="inside"> 304 <p>Please see our <a href="https://slimfaq.com/faq/23-integration">FAQ on integrations</a> if you have any questions.</p> 305 <p>Feel free to <a href="https://slimfaq.com">get in touch</a> if you need help integrating your FAQ.</p> 306 </div> 307 </div> 308 </div> 309 310 <div class="meta-box-sortables" style="min-height:0;"> 311 <div class="postbox ll-slimfaq-info" id="ll-slimfaq-suggest"> 312 <h3 class="hndle"><span>Like this Plugin?</span></h3> 313 <div class="inside"> 314 <p>If this plugin has helped you improve your customer relationships, please consider supporting it:</p> 315 <ul> 316 <li><a href="https://wordpress.org/extend/plugins/slimfaq/">Rate it and let other people know it works</a>.</li> 317 <li>Link to it or share it on Twitter or Facebook.</li> 318 <li>Write a review on your website or blog.</li> 319 </ul> 320 </div> 321 </div> 322 </div> 323 324 </div> 325 326 </div> 327 </div> 328 <?php 329 330 } 331 332 333 334 /** 335 * use the WordPress settings api to initiate the various intercom settings 336 * and if it's a network settings page then validate & update any submitted settings 337 * @return null 338 */ 339 function settings_init() { 340 341 register_setting( 'slimfaq', 'll-slimfaq', array( $this, 'validate' ) ); 342 if ( isset( $_REQUEST[ '_wpnonce' ] ) and wp_verify_nonce( $_REQUEST[ '_wpnonce' ], 'slimfaq-options' ) ) { 343 344 $file = is_network_admin() ? 'settings.php' : 'options-general.php'; 345 346 if ( isset( $_POST[ 'll-slimfaq-submit' ] ) and is_network_admin() ) { 347 $opts = $this->validate( $_POST[ 'll-slimfaq' ] ); 348 $this->update_settings( $opts ); 349 wp_redirect( add_query_arg( array( 350 'page' => 'slimfaq', 351 'updated' => true 352 ), $file ) ); 353 die(); 354 } 355 356 } 357 358 } 359 360 361 362 /** 363 * make sure that no dodgy stuff is trying to sneak into the intercom settings 364 * @param array $input options to validate 365 * @return array validated options 366 */ 367 function validate( $input ) { 368 369 $new[ 'faq-id' ] = wp_kses( trim( $input[ 'faq-id' ] ), array() ); 370 $new[ 'show-for-logged-out' ] = absint( $input[ 'show-for-logged-out' ] ); 371 $new[ 'intercom-enabled' ] = absint( $input[ 'intercom-enabled' ] ); 372 373 return $new; 374 375 } 376 376 377 377
Note: See TracChangeset
for help on using the changeset viewer.