Changeset 412200
- Timestamp:
- 07/19/2011 09:10:54 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
prophoto2-compatibility-patches/trunk/p2-wp-compatibility.php
r248279 r412200 5 5 Description: Only for users of version 2 of the ProPhoto theme. Contains patches required for compatibility with WordPress 3.0+ 6 6 Author: ProPhotoBlogs 7 Version: 1. 07 Version: 1.1 8 8 */ 9 9 10 10 11 add_action( 'wp_loaded', 'p2_update_img_protection_opts' ); 12 add_action( 'wp_loaded', 'p2_update_img_protection_js' ); 13 14 15 function p2_update_img_protection_opts() { 16 global $p2; 17 $storeNew = false; 18 19 20 if ( p2_test( 'no_right_click', ' ondragstart="return false" onselectstart="return false"') ) { 21 $p2['options']['settings']['no_right_click'] = ' ondragstart="return false" onselectstart="return false" id="wp-pp"'; 22 $p2['options']['settings']['updated_no_right_click'] = 'true'; 23 $storeNew = true; 24 } 25 26 if ( p2_test( 'no_left_click', 'on' ) ) { 27 $p2['options']['settings']['no_left_click'] = 'off'; 28 $p2['options']['settings']['updated_no_left_click'] = 'true'; 29 $storeNew = true; 30 } 31 32 if ( $storeNew ) { 33 p2_store_options(); 34 } 35 } 36 37 function p2_update_img_protection_js() { 38 $newJS = null; 39 40 if ( p2_test( 'updated_no_right_click', 'true' ) ) { 41 $newJS = "jQuery('.alignnone, .aligncenter, .alignright, .alignleft, .gallery img, a[href$=\".jpg\"], a[href$=\".gif\"], a[href$=\".png\"], a[href$=\".JPG\"], a[href$=\".GIF\"], a[href$=\".PNG\"]')"; 42 } 43 44 if ( $newJS && p2_test( 'updated_no_left_click', 'true' ) ) { 45 $newJS .= ".css('cursor', 'default').click(function(){return false;})"; 46 } 47 48 if ( $newJS ) { 49 $newJS .= ".bind('contextmenu', function(){return false;});"; 50 } 51 52 if ( $newJS ) { 53 $newJS = addslashes( 'jQuery(document).ready(function($){ ' . $newJS . ' });' ); 54 add_action( 'wp_head', create_function( '', "echo '<script> $newJS </script>';" ) ); 55 } 56 } 57 11 58 12 59 if ( !function_exists( 'p2_insert_upload_fields' ) ) { 13 60 61 14 62 /* get custom P2 fields inside of upload form */ 15 63 function p2_insert_upload_fields() { … … 49 97 50 98 /* add actions */ 51 if ( get_option( 'template' ) == 'prophoto2' ) { 99 if ( get_option( 'template' ) == 'prophoto2' ) { 52 100 if ( !is_admin() ) add_action( 'wp_head', 'p2_compat_doctor_mark' ); 53 101 if ( $pagenow == 'popup.php' ) add_action( 'pre-upload-ui', 'p2_insert_upload_fields' ); … … 62 110 63 111 64 ?>
Note: See TracChangeset
for help on using the changeset viewer.