Changeset 1917953
- Timestamp:
- 08/01/2018 03:19:10 AM (7 years ago)
- Location:
- userdeck
- Files:
-
- 6 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
userdeck/trunk/readme.txt
r1873061 r1917953 4 4 Requires at least: 3.7 5 5 Tested up to: 4.9 6 Stable tag: 1.1. 56 Stable tag: 1.1.6 7 7 8 8 Easily integrate UserDeck's embedded support software into your WordPress website. … … 51 51 == Upgrade Notice == 52 52 53 = 1.1.6 = 54 Fixed bug with empty content when fetching guide seo content. 55 53 56 = 1.1.5 = 54 57 Fixed bug with registering sitemaps with seo plugin if guide is not setup. … … 84 87 85 88 == Changelog == 89 90 = 1.1.6 = 91 * Fixed bug with empty content when fetching guide seo content 86 92 87 93 = 1.1.5 = -
userdeck/trunk/userdeck.js
r1213874 r1917953 11 11 } 12 12 13 var iframe = jQuery('<iframe id="iframe-guides" src="https://app.userdeck.com/' + type + '?redir=' + start + '" width="400" height="600" frameborder="0" ALLOWTRANSPARENCY="true"></iframe>') 13 var iframe = jQuery('<iframe id="iframe-guides" src="https://app.userdeck.com/' + type + '?redir=' + start + '" width="400" height="600" frameborder="0" ALLOWTRANSPARENCY="true"></iframe>'); 14 14 15 15 wrapper.append(iframe); -
userdeck/trunk/userdeck.php
r1873061 r1917953 4 4 * Plugin URI: http://wordpress.org/plugins/userdeck 5 5 * Description: Embedded customer support from <a href="http://userdeck.com?utm_source=wordpress&utm_medium=link&utm_campaign=website">UserDeck</a> that embeds into your website. 6 * Version: 1.1. 56 * Version: 1.1.6 7 7 * Author: UserDeck 8 8 * Author URI: http://userdeck.com?utm_source=wordpress&utm_medium=link&utm_campaign=website … … 45 45 $this->add_actions(); 46 46 $this->add_filters(); 47 $this->add_shortcodes();48 47 49 48 } … … 92 91 add_filter( "plugin_action_links_$plugin", array( $this, 'add_action_links' ) ); 93 92 add_filter( 'plugin_row_meta', array( $this, 'add_plugin_meta_links' ), 10, 4 ); 94 }95 96 public function add_shortcodes() {97 98 add_shortcode( 'userdeck_guides', array( $this, 'output_guides_shortcode') );99 100 93 } 101 94 … … 200 193 } 201 194 202 public function has_guide_meta() { 203 204 global $post; 195 public function has_guide_meta( $post ) { 205 196 206 197 $guides_key = get_post_meta($post->ID, 'userdeck_guides_key', true); 207 198 208 199 if (!empty($guides_key)) { 209 return true;200 return $guides_key; 210 201 } 211 202 … … 255 246 $post = $this->guide_page; 256 247 257 if ( empty( $post ) ) { 248 $guides_key = $this->has_guide_meta( $post ); 249 250 if ( empty( $guides_key ) ) { 258 251 return ''; 259 252 } 260 253 261 $guides_key = get_post_meta($post->ID, 'userdeck_guides_key', true);262 263 254 $sitemap_url = 'https://userdeck.net/g/' . $guides_key . '/sitemap.xml'; 264 255 … … 288 279 $post = $this->guide_page; 289 280 290 if ( empty( $post ) ) { 281 $guides_key = $this->has_guide_meta( $post ); 282 283 if ( empty( $guides_key ) ) { 291 284 return; 292 285 } 293 294 $guides_key = get_post_meta($post->ID, 'userdeck_guides_key', true);295 286 296 287 $sitemap_url = 'https://userdeck.net/g/' . $guides_key . '/sitemap.xml'; … … 435 426 if ( isset( $post ) && is_page() ) { 436 427 437 $guides_key = get_post_meta($post->ID, 'userdeck_guides_key', true);428 $guides_key = $this->has_guide_meta( $post ); 438 429 439 430 if (!empty($guides_key)) { … … 447 438 } 448 439 449 public function output_guides_shortcode() {450 451 // retrieve the options452 $options = $this->get_settings();453 454 $guides_key = $options['guides_key'];455 456 return $this->output_guides_code($guides_key);457 458 }459 460 440 /** 461 441 * output the userdeck guides javascript install code … … 466 446 $content = ''; 467 447 468 if (isset( $_GET['_escaped_fragment_'] )) { 469 470 $path = ''; 471 472 if ( $_GET['_escaped_fragment_'] ) { 473 $path = $_GET['_escaped_fragment_'][0] == '/' ? substr( $_GET['_escaped_fragment_'], 1 ) : $_GET['_escaped_fragment_']; 474 } 448 if ( $this->is_escaped_fragment_request() ) { 449 450 $path = $this->escaped_fragment_path(); 475 451 476 452 $base_uri = 'https://userdeck.net/g/' . $guides_key . '/'; … … 481 457 482 458 $request = wp_remote_get( $base_uri . $path ); 483 459 $status = wp_remote_retrieve_response_code( $request ); 484 460 $content = ''; 485 486 if ( wp_remote_retrieve_response_code( $request ) == 200 ) { 461 $body = ''; 462 463 if ( $status == 200 ) { 487 464 $content = wp_remote_retrieve_body( $request ); 488 465 } 489 466 490 preg_match('/\<body\>(.*?)\<\/body\>/is', $content, $body); 491 $body = $body[1]; 467 if ( preg_match('/\<body\>(.*?)\<\/body\>/is', $content, $body ) ) { 468 $body = $body[1]; 469 } 470 else { 471 $body = $content; 472 } 492 473 493 474 $content = strstr($body, '<div class="content">'); 494 495 475 $content = str_replace('/g/'.$guides_key.'/', get_permalink().'#!', $content); 496 476 … … 507 487 } 508 488 509 public function generate_guides_shortcode($guides_key) { 510 511 return '[userdeck_guides key="'.$guides_key.'"]'; 489 public function is_escaped_fragment_request() { 490 491 return isset( $_GET['_escaped_fragment_'] ); 492 493 } 494 495 public function escaped_fragment_path() { 496 497 $path = ''; 498 499 if ( $_GET['_escaped_fragment_'] ) { 500 $path = $_GET['_escaped_fragment_'][0] == '/' ? substr( $_GET['_escaped_fragment_'], 1 ) : $_GET['_escaped_fragment_']; 501 } 502 503 return $path; 512 504 513 505 } … … 518 510 519 511 if ( isset( $post ) && is_page() ) { 520 if ( $this->has_guide_meta() || has_shortcode( $post->post_content, 'userdeck_guides' ))512 if ( $this->has_guide_meta( $post ) ) 521 513 ?> 522 514 <meta name="fragment" content="!">
Note: See TracChangeset
for help on using the changeset viewer.