Changeset 965282
- Timestamp:
- 08/13/2014 07:56:54 PM (11 years ago)
- Location:
- related-images/trunk
- Files:
-
- 10 added
- 3 edited
-
inc (added)
-
inc/class-backend.php (added)
-
inc/class-config.php (added)
-
inc/class-frontend.php (added)
-
inc/class-frontent.php (added)
-
inc/class-tpl.php (added)
-
js (added)
-
js/media.js (added)
-
readme.txt (modified) (1 diff)
-
related-images.class.php (modified) (5 diffs)
-
related-images.php (modified) (1 diff)
-
tpl (added)
-
tpl/meta-box.php (added)
Legend:
- Unmodified
- Added
- Removed
-
related-images/trunk/readme.txt
r456488 r965282 1 1 === Related Images === 2 Contributors: Johannes Fosseus2 Contributors: johannesfosseus 3 3 Tags: images, related images, cms 4 Requires at least: 3. 15 Tested up to: 3.4 beta24 Requires at least: 3.5 5 Tested up to: 4.0 beta3 6 6 7 7 The plugin creates a backend box where you can search your media archive and relate images to the current post to a given position. -
related-images/trunk/related-images.class.php
r456488 r965282 82 82 83 83 } 84 84 85 85 // returne the "default" post_id, not the revision 86 86 function get_correct_post_id($post_id){ 87 87 88 88 $post_id_parent = get_post($post_id)->post_parent; 89 89 … … 99 99 function save_related_images($post_id){ 100 100 global $wpdb; 101 101 102 102 // allways use the "default" post_id, not the revision one 103 103 $post_id = $this->get_correct_post_id($post_id); 104 104 105 105 // get saved positions 106 106 if($_POST['saved_img_position']){ … … 156 156 $class = " class=\"".$class."\""; 157 157 } 158 158 159 159 echo "<img src=\"".$image_data['img_url']."\" ".$image_data['img_h_w']."".$class.">"; // add h & w 160 160 … … 203 203 // add the url 204 204 $img['img_url'] = $image; 205 205 206 206 // get w/h 207 207 if ($data = @getimagesize($image)) { 208 208 $size = getimagesize($image); 209 $img['img_h_w'] = $size[3]; 209 $img['img_h_w'] = $size[3]; 210 210 } 211 211 … … 293 293 die(); 294 294 } 295 295 296 296 // get the search string 297 297 $img_id = $_POST['img_id']; 298 298 $post_ID = $_POST['post_ID']; 299 299 300 300 // get saved options 301 301 $related_images = get_option($post_ID."_related_images"); 302 302 303 303 // if there is only one saved, remove it all, or unset a specific image and then update the options 304 304 $len = sizeof($related_images); 305 305 306 306 if($related_images == 1){ 307 307 delete_option($post_ID."_related_images"); 308 } else { 308 } else { 309 309 unset($related_images[$img_id]); 310 310 update_option($post_ID."_related_images", $related_images); 311 311 } 312 313 die(); 314 315 } 316 317 312 313 die(); 314 315 } 316 317 318 318 // run the search 319 319 function do_image_search(){ -
related-images/trunk/related-images.php
r391641 r965282 3 3 Plugin Name: Related Images 4 4 Plugin URI: http://www.fosseus.se 5 Description: Relate one or more images to a post5 Description: Relate and position one or more images to a post. Ever wanted to relate images and display images och various positions to a post? This is the plugin for you. 6 6 Author: johannesfosseus 7 Version: 1.2.3 7 Author URI: http://profiles.wordpress.org/johannesfosseus/ 8 Version: 2.0 8 9 */ 9 10 10 // load the class 11 require_once dirname( __FILE__ ) . '/related-images.class.php'; 12 if (class_exists('RelatedImages')){ 13 $related_images = new RelatedImages(); 11 /** 12 * Constants 13 */ 14 define( 'RI_VERSION', '2' ); 15 define( 'RI_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 16 define( 'RI_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 17 define( 'RI_TPL_DIR', RI_PLUGIN_DIR.'tpl/' ); 18 19 20 /** 21 * Include required classes 22 */ 23 require( 'inc/class-config.php' ); 24 require( 'inc/class-tpl.php' ); 25 26 if( is_admin() ) { 27 require( 'inc/class-backend.php' ); 28 } else { 29 require( 'inc/class-frontend.php' ); 14 30 } 15 16 // backend stuff17 if(is_admin()){18 wp_enqueue_script('related_images_js', WP_PLUGIN_URL.'/related-images/related-images.js', array('jquery'));19 wp_enqueue_style('related_images_css', WP_PLUGIN_URL.'/related-images/style.css');20 add_action('wp_ajax_search_related_images', array($related_images, 'do_image_search')); // do the search21 add_action('wp_ajax_remove_related_images', array($related_images, 'remove_image')); // remove a image22 }23 24 // frontend template tag25 function related_image($position, $width, $height, $class = '', $crop = ''){26 global $related_images;27 echo $related_images->print_image($position, $width, $height, $class, $crop);28 }29 ?>
Note: See TracChangeset
for help on using the changeset viewer.