Changeset 597682
- Timestamp:
- 09/11/2012 07:27:44 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
contextly-related-links/trunk/contextly-linker.php
r580150 r597682 1 1 <?php 2 /** 3 * @package Contextly_Linker 4 * @version 1.0.65 5 */ 2 6 3 /* 7 4 Plugin Name: Contextly Linker … … 9 6 Description: Adds the Contextly related links tool to your blog. Contextly lets you create related links that helps your readers find more to read, increases your page views and shows off your best content. 10 7 Author: Contextly 11 Version: 1.0. 658 Version: 1.0.70 12 9 */ 13 10 11 define( "CONTEXTLY_PLUGIN_VERSION", "1.0.70" ); 12 define( "CONTEXTLY_MAIN_SERVER_URL", "https://contextly.com/" ); 13 14 14 function contextly_get_plugin_url() { 15 return "http ://contextlysiteimages.contextly.com/_plugin/1.0.65/js/linker-plugin.js";15 return "https://c713421.ssl.cf2.rackcdn.com/_plugin/" . CONTEXTLY_PLUGIN_VERSION . "/js/linker-plugin.js"; 16 16 } 17 17 … … 55 55 56 56 function contextly_addbuttons() { 57 wp_enqueue_script('jquery');58 59 57 // Don't bother doing this stuff if the current user lacks permissions 60 58 if (! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) return; … … 104 102 if (!class_exists("ContextlyActivate")) { 105 103 class ContextlyActivate { 106 var $server_url= "https://contextly.com/";104 var $server_url= CONTEXTLY_MAIN_SERVER_URL; 107 105 var $general_settings_key = 'contextly_options_general'; 108 106 var $advanced_settings_key = 'contextly_options_advanced'; … … 201 199 <script type="text/javascript"> 202 200 function open_contextly_settings() { 203 window.open("<?php echo $this->server_url ?>redirect .php?type=settings&blog_url=<?php echo site_url(); ?>");201 window.open("<?php echo $this->server_url ?>redirect/?type=settings&blog_url=<?php echo site_url(); ?>"); 204 202 } 205 203 </script> … … 244 242 $post_data["post_date"] = $post->post_date; 245 243 $post_data["post_status"] = $post->post_status; 244 $post_data["post_type"] = $post->post_type; 246 245 return $post_data; 247 246 } … … 265 264 return $advanced_option; 266 265 } 266 267 function getAuthorInfo( $post ) { 268 return array( 269 "id" => $post->post_author, 270 "firstname" => get_the_author_meta( "first_name", $post->post_author ), 271 "lastname" => get_the_author_meta( "last_name", $post->post_author ), 272 "display_name" => get_the_author_meta( "display_name", $post->post_author ) 273 ); 274 } 267 275 268 276 // Add main js stuff for contextly api calls 269 277 function buildJsData($admin_mode = false) { 270 278 global $post; 271 ?> 279 280 ?> 272 281 <script data-cfasync="false" type="text/javascript"> 273 282 var contextly_post_object = { … … 277 286 blog_title: "<?php echo get_bloginfo("name"); ?>", 278 287 page_permalink: "<?php echo get_permalink($post->ID); ?>", 279 author: <?php echo json_encode( array("id" => $post->post_author, "firstname" => get_the_author_meta("first_name", $post->post_author), "lastname" => get_the_author_meta("last_name", $post->post_author))) ?>,288 author: <?php echo json_encode( $this->getAuthorInfo( $post ) ) ?>, 280 289 admin: <?php echo (int)$admin_mode; ?>, 281 version: '1.0.65'290 version: "<?php echo CONTEXTLY_PLUGIN_VERSION ?>" 282 291 }; 283 292 284 293 var contextly_settings = <?php echo json_encode($this->get_options()); ?>; 285 286 (function() {287 var src = document.createElement('script');288 src.async = true;289 src.src = "<?php echo contextly_get_plugin_url(); ?>";290 if (contextly_post_object.admin) {291 if (src.readyState) { // IE292 } else { //Others293 src.onerror = function () {294 jQuery("#linker_widget").html("Error loading data from <a target='_blank' href='http://contextly.com'>contextly.com</a>. Please <a target='_blank' href='http://contextly.com'>contact us</a> so we can help resolve the problem.");295 };296 }297 }298 document.getElementsByTagName('head')[0].appendChild(src);299 }());300 294 </script> 301 295 <?php 302 } 296 297 wp_enqueue_script( 'jquery' ); 298 wp_enqueue_script( 'contextly', contextly_get_plugin_url(), 'jquery', CONTEXTLY_PLUGIN_VERSION, false ); 299 } 303 300 304 301 // Admin header … … 308 305 // Check if this is admin edit page action 309 306 if ($pagenow == "post.php" || $pagenow == "post-new.php") { 310 ?>311 <script type="text/javascript" src=" //contextlysitescripts.contextly.com/js/easyXDM.min.js"></script>312 <script type="text/javascript" src=" //contextlysitescripts.contextly.com/js/jquery.xdomainajax.js"></script>307 ?> 308 <script type="text/javascript" src="https://c714015.ssl.cf2.rackcdn.com/js/easyXDM.min.js"></script> 309 <script type="text/javascript" src="https://c714015.ssl.cf2.rackcdn.com/js/jquery.xdomainajax.js"></script> 313 310 <?php echo $this->buildJsData(true); ?> 314 311 <?php … … 319 316 function head() { 320 317 if (is_single()) { 321 $this->buildJsData();318 $this->buildJsData(); 322 319 } 323 320 } … … 395 392 add_action('admin_init', 'contextly_add_see_also_meta_box', 1); 396 393 } 397 ?>
Note: See TracChangeset
for help on using the changeset viewer.