function Get_Meta($key = Null, $default = False, $post_id = Null)
 {
     # Get the post id
     if ($post_id == Null && Is_Object($GLOBALS['post'])) {
         $post_id = $GLOBALS['post']->ID;
     } elseif ($post_id == Null && !Is_Object($GLOBALS['post'])) {
         return False;
     }
     # Read meta data
     $arr_meta = (array) Get_Post_Meta($post_id, '_wp_plugin_fancy_gallery', True);
     if (empty($arr_meta) || !Is_Array($arr_meta)) {
         $arr_meta = array();
     }
     # Clean Meta data
     foreach ($arr_meta as $k => $v) {
         if (!$v) {
             unset($arr_meta[$k]);
         }
     }
     # Load default Meta data
     $arr_meta = Array_Merge($this->Default_Meta(), $arr_meta);
     # Get the key value
     if ($key == Null) {
         return $arr_meta;
     } elseif (isset($arr_meta[$key]) && $arr_meta[$key]) {
         return $arr_meta[$key];
     } else {
         return $default;
     }
 }
 function Get_Meta($key = Null, $default = False, $post_id = Null)
 {
     # Get the post id
     if ($post_id == Null && Is_Object($GLOBALS['post'])) {
         $post_id = $GLOBALS['post']->ID;
     } elseif ($post_id == Null && !Is_Object($GLOBALS['post'])) {
         return False;
     }
     # Read meta data
     $arr_meta = Get_Post_Meta($post_id, '_wp_plugin_fancy_gallery', True);
     $arr_meta = Is_Array($arr_meta) ? $arr_meta : array();
     # Clean Meta data
     $arr_meta = Array_Filter($arr_meta);
     # Load default Meta data
     $arr_meta = Array_Merge($this->Default_Meta(), $arr_meta);
     # Get the key value
     if ($key == Null) {
         return $arr_meta;
     } elseif (isset($arr_meta[$key]) && $arr_meta[$key]) {
         return $arr_meta[$key];
     } else {
         return $default;
     }
 }
 function Get_Image_Title($attachment)
 {
     if (!Is_Object($attachment)) {
         return False;
     }
     // Image title
     $image_title = $attachment->post_title;
     // Alternative Text
     $alternative_text = Get_Post_Meta($attachment->ID, '_wp_attachment_image_alt', True);
     if (empty($alternative_text)) {
         $alternative_text = $image_title;
     }
     // Image caption
     $caption = $attachment->post_excerpt;
     if (empty($caption)) {
         $caption = $image_title;
     }
     // Image description
     $description = nl2br($attachment->post_content);
     $description = Str_Replace("\n", '', $description);
     $description = Str_Replace("\r", '', $description);
     if (empty($description)) {
         $description = $caption;
     }
     // return Title
     switch ($this->get_option('use_as_image_title')) {
         case 'none':
             return False;
         case 'alt_text':
             return $alternative_text;
         case 'caption':
             return $caption;
         case 'description':
             return $description;
         default:
             return $image_title;
     }
 }