Plugin Directory

Changeset 1159681


Ignore:
Timestamp:
05/13/2015 02:17:00 PM (11 years ago)
Author:
tormorten
Message:

fixes fatal error

Location:
foogallery-captions/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • foogallery-captions/trunk/README.txt

    r1152687 r1159681  
    55Requires at least: 4.0
    66Tested up to: 4.2.1
    7 Stable tag: 1.0
     7Stable tag: trunk
    88License: GPLv2 or later
    99
     
    3333== Changelog ==
    3434
     35= 1.0.1 =
     36* Fixes the stupidest fatal error ever!
     37
    3538= 1.0.0 =
    3639* Initial plugin
  • foogallery-captions/trunk/foogallery-individual-captions.php

    r1152687 r1159681  
    3030*/
    3131
    32 if ( is_plugin_active( 'foogallery/foogallery.php' ) ) {
     32
    3333
    3434    /**
     
    4242         */
    4343        public static function init() {
     44
     45            if(!class_exists('FooGallery_Plugin')) {
     46                return;
     47            }
    4448
    4549            add_action( 'admin_enqueue_scripts',        array( 'FooGalleryCaptions', 'scripts' ) );
     
    109113                $captions = get_post_meta( $post->ID, 'foogallery_captions', true );
    110114
    111                 foreach($captions as $attachment => $caption) {
    112                     foreach($caption as $key => $value) {
    113                         echo '<input type="hidden" id="foogallery-captions-'. $attachment .'-'. $key .'" name="foogallery_captions['. $attachment .']['. $key .']" value="'. $value .'" />';
     115                if($captions) {
     116                    foreach($captions as $attachment => $caption) {
     117                        foreach($caption as $key => $value) {
     118                            echo '<input type="hidden" id="foogallery-captions-'. $attachment .'-'. $key .'" name="foogallery_captions['. $attachment .']['. $key .']" value="'. $value .'" />';
     119                        }
    114120                    }
    115121                }
     
    182188         */
    183189        public static function get_captions($post, $attachment) {
     190           
     191            $post = apply_filters('foogallery_captions_post_id', $post);
     192            $attachment = apply_filters('foogallery_captions_attachment_id', $attachment, $post);
     193           
    184194            $captions = get_post_meta( $post, 'foogallery_captions', true );
    185195
     
    223233                $caption = self::get_captions($current_foogallery->ID, $obj->ID);
    224234
    225                 $attr['data-caption-title'] = $caption['title'];
     235                $attr['data-caption-title'] = $caption['caption'];
    226236                $attr['data-caption-desc'] = $caption['description'];
    227237            }
     
    233243    add_action( 'plugins_loaded', array( 'FooGalleryCaptions', 'init' ) );
    234244
    235 }
     245
Note: See TracChangeset for help on using the changeset viewer.