public function content_filter($content)
 {
     global $essbis_options;
     $attributes = ' data-essbisPostContainer=""';
     $attributes .= ' data-essbisPostUrl="' . get_the_permalink() . '"';
     $attributes .= ' data-essbisPostTitle="' . wp_strip_all_tags(get_the_title(), true) . '"';
     $attributes .= ' data-essbisHoverContainer=""';
     $post_container = '<input type="hidden" value=""' . $attributes . '>';
     if ('1' == $essbis_options['buttonSettings']['generalDownloadImageDescription']) {
         $content = ESSBIS_Utils::add_description_attribute_to_images($content);
     }
     return $post_container . $content;
 }
Beispiel #2
0
 public static function get_image_attributes_from_post($content)
 {
     global $essbis_options;
     $img_title = $img_alt = $img_src = $img_description = '';
     $imgPattern = "/<img([^\\>]*?)>/i";
     if (preg_match($imgPattern, $content, $img_tag)) {
         $img_src = ESSBIS_Utils::get_attribute_from_html_tag($img_tag[0], 'src');
         $img_alt = ESSBIS_Utils::get_attribute_from_html_tag($img_tag[0], 'alt');
         $img_title = ESSBIS_Utils::get_attribute_from_html_tag($img_tag[0], 'title');
         if ('1' == $essbis_options['buttonSettings']['generalDownloadImageDescription']) {
             $classAttr = ESSBIS_Utils::get_attribute_from_html_tag($img_tag[0], 'class');
             $id = self::get_post_id_from_image_classes($classAttr);
             $img_description = self::get_image_description($id, $img_src);
         }
     }
     return array('title' => wp_strip_all_tags($img_title, true), 'alt' => wp_strip_all_tags($img_alt, true), 'src' => $img_src, 'description' => $img_description);
 }