Example #1
0
 function plgContentProcessRokboxImages(&$row, &$matches, $count, $regex, &$botParams)
 {
     global $mainframe;
     $thumb_ext = $botParams->def('thumb_ext', '_thumb');
     $thumb_class = $botParams->def('thumb_class', 'album');
     $thumb_width = $botParams->def('thumb_width', '100');
     $thumb_height = $botParams->def('thumb_height', '100');
     $thumb_quality = $botParams->def('thumb_quality', '90');
     $thumb_custom = $botParams->def('thumb_custom', 0);
     $thumb_dir = $botParams->def('thumb_dir');
     $compatibility = $botParams->def('compatibility', 'rokbox');
     /* thumbnail settings */
     $improve_thumbnails = false;
     // Auto Contrast, Unsharp Mask, Desaturate,  White Balance
     $thumb_quality = $thumb_quality;
     $width = $thumb_width;
     $height = $thumb_height;
     /* slimbox = lightbox mode */
     if ($compatibility == "slimbox") {
         $compatibility = "lightbox";
     }
     for ($i = 0; $i < $count; $i++) {
         $thealbum = '';
         $thetitle = '';
         $thethumb = '';
         $thetype = '';
         $thesize = '';
         $thetext = '';
         $thethumbcount = 999;
         if (@$matches[1][$i]) {
             $inline_params = $matches[1][$i];
             // get album
             $album_matches = array();
             preg_match("#album=\\|(.*?)\\|#s", $inline_params, $album_matches);
             if (isset($album_matches[1])) {
                 $thealbum = "(" . trim($album_matches[1]) . ")";
             }
             // get size
             $size_matches = array();
             preg_match("#size=\\|(.*?)\\|#s", $inline_params, $size_matches);
             if (isset($size_matches[1])) {
                 $thesize = "[" . trim($size_matches[1]) . "]";
             }
             // get title
             $title_matches = array();
             preg_match("#title=\\|(.*?)\\|#s", $inline_params, $title_matches);
             if (isset($title_matches[1])) {
                 $thetitle = $title_matches[1];
             }
             // get text
             $text_matches = array();
             preg_match("#text=\\|(.*?)\\|#s", $inline_params, $text_matches);
             if (isset($text_matches[1])) {
                 $thetext = $text_matches[1];
             }
             // force image
             $type_matches = array();
             preg_match("#type=\\|(.*?)\\|#s", $inline_params, $type_matches);
             if (isset($type_matches[1])) {
                 $thetype = $type_matches[1];
             }
             // get thumb
             $thumb_matches = array();
             preg_match("#thumb=\\|(.*?)\\|#s", $inline_params, $thumb_matches);
             if (isset($thumb_matches[1])) {
                 $thethumb = $thumb_matches[1];
             }
             // get thumb count
             $thumbcount_matches = array();
             preg_match("#thumbcount=\\|(.*?)\\|#s", $inline_params, $thumbcount_matches);
             if (isset($thumbcount_matches[1])) {
                 $thethumbcount = $thumbcount_matches[1];
             }
         }
         $onsite = 1;
         $text = '';
         $displaythumb = '';
         $tmp = glob(trim($matches[2][$i]));
         if (count($tmp) < 1) {
             $tmp = array(trim($matches[2][$i]));
             $onsite = 0;
         }
         foreach ($tmp as $link) {
             // Prevent thumbs of thumbs
             if (strpos($link, $thumb_ext) === false) {
                 if (strlen($thethumb)) {
                     $image_url = trim($thethumb);
                 } else {
                     $image_url = $link;
                 }
                 $extension = substr($image_url, strrpos($image_url, "."));
                 $image_name = substr($image_url, 0, strrpos($image_url, "."));
                 $just_name = substr($image_name, strrpos($image_name, DS) + 1);
                 $full_url = JURI::base() . $link;
                 $full_path = JPATH_ROOT . DS . $link;
                 $thumb_url_custom = JURI::base() . $thumb_dir . DS . $just_name . $thumb_ext . $extension;
                 $thumb_path_custom = JPATH_ROOT . DS . $thumb_dir . DS . $just_name . $thumb_ext . $extension;
                 $thumb_url = JURI::base() . $image_name . $thumb_ext . $extension;
                 $thumb_path = JPATH_ROOT . DS . $image_name . $thumb_ext . $extension;
                 $isimage = $extension == '.jpg' || $extension == '.jpeg' || $extension == '.bmp' || $extension == '.png' || $extension == '.gif';
                 if ($onsite) {
                     if (!isset($size_matches[1]) && $isimage) {
                         list($image_width, $image_height) = getimagesize($link);
                         $thesize = "[" . $image_width . " " . $image_height . "]";
                     }
                     $thethumbcount--;
                     if ($thethumbcount < 0) {
                         $displaythumb = '" style="display: none;';
                     }
                 }
                 if (!strlen($thethumb) && !strlen($thetype) && strlen($thetext) > 0) {
                     $text = $text . '<a href="' . $link . '" rel="' . $compatibility . $thesize . $thealbum . $displaythumb . '" title="' . $thetitle . '">' . $thetext . '</a>';
                 } else {
                     if (!strlen($thethumb) && !strlen($thetype) && !$isimage) {
                         $text = $text . '<a href="' . $link . '" rel="' . $compatibility . $thesize . $thealbum . $displaythumb . '" title="' . $thetitle . '">' . $thetitle . '</a>';
                     } else {
                         if (strlen($thethumb) > 0) {
                             $text = $text . '<a href="' . $link . '" rel="' . $compatibility . $thesize . $thealbum . $displaythumb . '" title="' . $thetitle . '"><img class="' . $thumb_class . '" src="' . $thethumb . '" alt="' . $thetitle . '" /></a>';
                         } elseif (!$thumb_custom && file_exists($thumb_path)) {
                             // thumbnail exists so can do lightbox with thumbnail
                             $text = $text . '<a href="' . $link . '" rel="' . $compatibility . $thesize . $thealbum . $displaythumb . '" title="' . $thetitle . '"><img class="' . $thumb_class . '" src="' . $thumb_url . '" alt="' . $thetitle . '" /></a>';
                         } elseif (file_exists($thumb_path_custom)) {
                             $text = $text . '<a href="' . $link . '" rel="' . $compatibility . $thesize . $thealbum . $displaythumb . '" title="' . $thetitle . '"><img class="' . $thumb_class . '" src="' . $thumb_url_custom . '" alt="' . $thetitle . '" /></a>';
                         } elseif ($isimage || $thetype == 'image') {
                             //try to generate thumbs
                             if ($thumb_custom) {
                                 $thumb_path = $thumb_path_custom;
                             }
                             $rd = new imgRedim(false, $improve_thumbnails, JPATH_CACHE);
                             $image_filename = $full_path;
                             // define source image here
                             $output_filename = $thumb_path;
                             // define destination image here
                             $rd->loadImage($image_filename);
                             $rd->redimToSize($width, $height, true);
                             $rd->saveImage($output_filename, $thumb_quality);
                             $text = $text . '<a href="' . $link . '" rel="' . $compatibility . $thesize . $thealbum . $displaythumb . '" title="' . $thetitle . '"><img class="' . $thumb_class . '" src="' . $thumb_url . '" alt="' . $thetitle . '" /></a>';
                         }
                     }
                 }
                 $text = $text . ' ';
             }
         }
         $row->text = str_replace($matches[0][$i], $text, $row->text);
     }
 }
Example #2
0
 function plgContentProcessRokboxImages(&$row, &$matches, $count, $regex, &$botParams)
 {
     $thumb_ext = $botParams->def('thumb_ext', '_thumb');
     $thumb_class = $botParams->def('thumb_class', 'album');
     $thumb_width = $botParams->def('thumb_width', '100');
     $thumb_height = $botParams->def('thumb_height', '100');
     $thumb_quality = $botParams->def('thumb_quality', '90');
     $thumb_custom = $botParams->def('thumb_custom', 0);
     $thumb_dir = $botParams->def('thumb_dir');
     $compatibility = $botParams->def('compatibility', 'rokbox');
     /* thumbnail settings */
     $improve_thumbnails = false;
     // Auto Contrast, Unsharp Mask, Desaturate,  White Balance
     $thumb_quality = $thumb_quality;
     $width = $thumb_size_width = $thumb_width;
     $height = $thumb_size_height = $thumb_height;
     /* slimbox = lightbox mode */
     if ($compatibility == "slimbox") {
         $compatibility = "lightbox";
     }
     for ($i = 0; $i < $count; $i++) {
         $thealbum = '';
         $thetitle = '';
         $thethumb = '';
         $thetype = '';
         $thesize = '';
         $thetext = '';
         $themodule = '';
         $thethumbsize = '';
         $thethumbcount = 999;
         if (@$matches[1][$i]) {
             $inline_params = $matches[1][$i];
             // get album
             $album_matches = array();
             preg_match("# album=\\|(.*?)\\|#s", $inline_params, $album_matches);
             if (isset($album_matches[1])) {
                 $thealbum = "(" . trim($album_matches[1]) . ")";
             }
             // get size
             $size_matches = array();
             preg_match("# size=\\|(.*?)\\|#s", $inline_params, $size_matches);
             if (isset($size_matches[1])) {
                 $thesize = "[" . trim($size_matches[1]) . "]";
             }
             // get title
             $title_matches = array();
             preg_match("# title=\\|(.*?)\\|#s", $inline_params, $title_matches);
             if (isset($title_matches[1])) {
                 $thetitle = $title_matches[1];
             }
             // get text
             $text_matches = array();
             preg_match("# text=\\|(.*?)\\|#s", $inline_params, $text_matches);
             if (isset($text_matches[1])) {
                 $thetext = $text_matches[1];
             }
             // force image
             $type_matches = array();
             preg_match("# type=\\|(.*?)\\|#s", $inline_params, $type_matches);
             if (isset($type_matches[1])) {
                 $thetype = $type_matches[1];
             }
             // get module
             $module_matches = array();
             preg_match("# module=\\|(.*?)\\|#s", $inline_params, $module_matches);
             if (isset($module_matches[1])) {
                 $themodule = "[module=" . $module_matches[1] . "]";
             }
             // get thumb
             $thumb_matches = array();
             preg_match("# thumb=\\|(.*?)\\|#s", $inline_params, $thumb_matches);
             if (isset($thumb_matches[1])) {
                 $thethumb = $thumb_matches[1];
             }
             // get thumb sizes
             $thumbsize_matches = array();
             preg_match("# thumbsize=\\|(.*?)\\|#s", $inline_params, $thumbsize_matches);
             $thumb_size_width = $thumb_width;
             $thumb_size_height = $thumb_height;
             if (isset($thumbsize_matches[1])) {
                 $thethumbsize = $thumbsize_matches[1];
                 $tsize = explode(" ", $thethumbsize);
                 if (count($tsize) == 1) {
                     $thumb_size_width = $thumb_size_height = $tsize[0];
                 } elseif (count($tsize) == 2) {
                     $thumb_size_width = $tsize[0];
                     $thumb_size_height = $tsize[1];
                 }
             }
             // get thumb count
             $thumbcount_matches = array();
             preg_match("# thumbcount=\\|(.*?)\\|#s", $inline_params, $thumbcount_matches);
             if (isset($thumbcount_matches[1])) {
                 $thethumbcount = $thumbcount_matches[1];
             }
         }
         $onsite = 1;
         $text = '';
         $displaythumb = '';
         $tmp = @glob(trim($matches[2][$i]));
         if (count($tmp) < 1) {
             $tmp = array(trim($matches[2][$i]));
             $onsite = 0;
         }
         if (!is_array($tmp)) {
             $tmp = array(trim($matches[2][$i]));
         }
         if (count($tmp) > 1) {
             $text .= '<div class="rokbox-album-wrapper">';
             $text .= '<div class="rokbox-album-top"><div class="rokbox-album-top2"><div class="rokbox-album-top3"></div></div></div>';
             $text .= '<div class="rokbox-album-inner">';
         }
         foreach ($tmp as $link) {
             if (count($tmp) > 1) {
                 // Check for files only
                 if (!is_file($link)) {
                     continue;
                 }
                 // Check for images only
                 $last3 = strtolower(substr($link, -3));
                 $last4 = strtolower(substr($link, -4));
                 if ($last3 != "jpg" && $last3 != "png" && $last3 != "bmp" && $last3 != "gif" && $last4 != "jpeg") {
                     continue;
                 }
             }
             // Prevent thumbs of thumbs
             if (strpos($link, $thumb_ext) === false) {
                 if (strlen($thethumb)) {
                     $image_url = trim($thethumb);
                 } else {
                     $image_url = $link;
                 }
                 $extension = substr($image_url, strrpos($image_url, "."));
                 $image_name = substr($image_url, 0, strrpos($image_url, "."));
                 $just_name = substr($image_name, strrpos($image_name, DS));
                 $full_url = JURI::base() . $link;
                 $full_path = JPATH_ROOT . DS . $link;
                 $thumb_url_custom = JURI::base() . $thumb_dir . DS . $just_name . $thumb_ext . $extension;
                 $thumb_path_custom = JPATH_ROOT . DS . $thumb_dir . DS . $just_name . $thumb_ext . $extension;
                 $thumb_url = JURI::base() . $image_name . $thumb_ext . $extension;
                 $thumb_path = JPATH_ROOT . DS . $image_name . $thumb_ext . $extension;
                 $isimage = $extension == '.jpg' || $extension == '.jpeg' || $extension == '.bmp' || $extension == '.png' || $extension == '.gif' || $extension == '.JPG' || $extension == '.JPEG' || $extension == '.BMP' || $extension == '.PNG' || $extension == '.GIF';
                 if ($onsite) {
                     if (!isset($size_matches[1]) && $isimage) {
                         list($image_width, $image_height) = getimagesize($link);
                         $thesize = "[" . $image_width . " " . $image_height . "]";
                     }
                     $thethumbcount--;
                     if ($thethumbcount < 0) {
                         $displaythumb = '" style="display: none;';
                     }
                 } else {
                     if ($isimage && !isset($size_matches[1]) && $botParams->get('remote_sizes', 0)) {
                         $remoteSize = @getimagesize($link);
                         if ($remoteSize) {
                             list($image_width, $image_height) = $remoteSize;
                             $thesize = "[" . $image_width . " " . $image_height . "]";
                         }
                     }
                 }
                 if (!strlen($thethumb) && !strlen($thetype) && strlen($thetext) > 0) {
                     if (strlen($themodule)) {
                         $text = $text . '<a href="' . $link . '" rel="' . $compatibility . $thesize . $thealbum . $displaythumb . $themodule . '" title="' . $thetitle . '">' . $thetext . '</a>';
                     } else {
                         $text = $text . '<a href="' . $link . '" rel="' . $compatibility . $thesize . $thealbum . $displaythumb . '" title="' . $thetitle . '">' . $thetext . '</a>';
                     }
                 } else {
                     if (!strlen($thethumb) && !strlen($thetype) && !$isimage) {
                         if (strlen($themodule)) {
                             $text = $text . '<a href="' . $link . '" rel="' . $compatibility . $thesize . $thealbum . $displaythumb . $themodule . '" title="' . $thetitle . '">' . $thetitle . '</a>';
                         } else {
                             $text = $text . '<a href="' . $link . '" rel="' . $compatibility . $thesize . $thealbum . $displaythumb . '" title="' . $thetitle . '">' . $thetitle . '</a>';
                         }
                     } else {
                         if (strlen($thethumb) > 0) {
                             if (strlen($themodule)) {
                                 $text = $text . '<a href="' . $link . '" rel="' . $compatibility . $thesize . $thealbum . $displaythumb . $themodule . '" title="' . $thetitle . '"><img class="' . $thumb_class . '" src="' . $thethumb . '" alt="' . $thetitle . '" width="' . $thumb_size_width . '" height="' . $thumb_size_height . '" /></a>';
                             } else {
                                 $text = $text . '<a href="' . $link . '" rel="' . $compatibility . $thesize . $thealbum . $displaythumb . '" title="' . $thetitle . '"><img class="' . $thumb_class . '" src="' . $thethumb . '" alt="' . $thetitle . '" width="' . $thumb_size_width . '" height="' . $thumb_size_height . '" /></a>';
                             }
                         } elseif (!$thumb_custom && file_exists($thumb_path)) {
                             // thumbnail exists so can do lightbox with thumbnail
                             if (strlen($themodule)) {
                                 $text = $text . '<a href="' . $link . '" rel="' . $compatibility . $thesize . $thealbum . $displaythumb . $themodule . '" title="' . $thetitle . '"><img class="' . $thumb_class . '" src="' . $thumb_url . '" alt="' . $thetitle . '" width="' . $thumb_size_width . '" height="' . $thumb_size_height . '" /></a>';
                             } else {
                                 $text = $text . '<a href="' . $link . '" rel="' . $compatibility . $thesize . $thealbum . $displaythumb . '" title="' . $thetitle . '"><img class="' . $thumb_class . '" src="' . $thumb_url . '" alt="' . $thetitle . '" width="' . $thumb_size_width . '" height="' . $thumb_size_height . '" /></a>';
                             }
                         } elseif (file_exists($thumb_path_custom)) {
                             if (strlen($themodule)) {
                                 $text = $text . '<a href="' . $link . '" rel="' . $compatibility . $thesize . $thealbum . $displaythumb . $themodule . '" title="' . $thetitle . '"><img class="' . $thumb_class . '" src="' . $thumb_url_custom . '" alt="' . $thetitle . '" width="' . $thumb_size_width . '" height="' . $thumb_size_height . '" /></a>';
                             } else {
                                 $text = $text . '<a href="' . $link . '" rel="' . $compatibility . $thesize . $thealbum . $displaythumb . '" title="' . $thetitle . '"><img class="' . $thumb_class . '" src="' . $thumb_url_custom . '" alt="' . $thetitle . '" width="' . $thumb_size_width . '" height="' . $thumb_size_height . '" /></a>';
                             }
                         } elseif ($isimage || $thetype == 'image') {
                             //try to generate thumbs
                             if ($thumb_custom) {
                                 $thumb_path = $thumb_path_custom;
                             }
                             $rd = new imgRedim(false, $improve_thumbnails, JPATH_CACHE);
                             $image_filename = $full_path;
                             // define source image here
                             $output_filename = $thumb_path;
                             // define destination image here
                             $image_size = @getimagesize($image_filename);
                             $rd->loadImage($image_filename);
                             if ($image_size[0] < $width) {
                                 $width = $thumb_size_width = $image_size[0];
                             }
                             if ($image_size[1] < $height) {
                                 $height = $thumb_size_height = $image_size[1];
                             }
                             $rd->redimToSize($width, $height, true);
                             $rd->saveImage($output_filename, $thumb_quality);
                             $text = $text . '<a href="' . $link . '" rel="' . $compatibility . $thesize . $thealbum . $displaythumb . '" title="' . $thetitle . '"><img class="' . $thumb_class . '" src="' . $thumb_url . '" alt="' . $thetitle . '" width="' . $thumb_size_width . '" height="' . $thumb_size_height . '" /></a>';
                         }
                     }
                 }
                 $text = $text . ' ';
             }
         }
         if (count($tmp) > 1) {
             $text .= '</div>';
             $text .= '<div class="rokbox-album-bottom"><div class="rokbox-album-bottom2"><div class="rokbox-album-bottom3"></div></div></div>';
             $text .= '</div>';
         }
         $row->text = str_replace($matches[0][$i], $text, $row->text);
     }
 }
Example #3
0
 function plgContentProcessSnippets(&$row, &$matches, $count, $regex, &$botParams)
 {
     $snippets = $matches[0];
     $snippets_settings = $matches[1];
     $snippets_links = $matches[2];
     $text = $row->text;
     foreach ($snippets as $index => $snippet) {
         $settings = isset($snippets_settings[$index]) ? trim($snippets_settings[$index]) : '';
         $href = isset($snippets_links[$index]) ? trim($snippets_links[$index]) : '#';
         $prefix = 'data-rokbox-';
         $content = '';
         $options = $link = array();
         preg_match_all("#([a-z]{1,})=\\|(.*?)\\|#si", $settings, $data);
         // let's clean the data from unnecessary stuff
         //if ($needle = array_search('size', $data[1])) { unset($data[0][$needle]); unset($data[1][$needle]); unset($data[2][$needle]); }
         // logic for wildcards scan
         $items = @glob(ltrim($href, '/'));
         if (!preg_match("/\\.(jpe?g|png|gif|bmp|tiff?)\$/", $href)) {
             $items = array();
         }
         if (count($items)) {
             if (!array_search('thumb', $data[1]) && count($items) > 1) {
                 array_push($data[1], 'thumb');
             } elseif (!array_search('thumb', $data[1]) && !array_search('text', $data[1])) {
                 array_push($data[1], 'thumb');
             }
             if (array_search('thumb', $data[1]) && ($needle = array_search('text', $data[1]))) {
                 unset($data[0][$needle]);
                 unset($data[1][$needle]);
                 unset($data[2][$needle]);
             }
             $wildcards = array();
         }
         if (!count($items)) {
             if (($needle = array_search('text', $data[1])) === false) {
                 $content = $data[2][$needle];
             } elseif (($needle = array_search('title', $data[1])) === false) {
                 $content = $data[2][$needle];
             } else {
                 $content = 'Image not found';
             }
             if (!array_search('thumb', $data[1]) || is_dir(dirname($href)) && !is_file($href)) {
                 array_push($items, $href);
             }
         }
         foreach ($data[1] as $key_index => $key) {
             $value = isset($data[2][$key_index]) ? $data[2][$key_index] : null;
             //$key = $options[$key];
             switch ($key) {
                 case 'text':
                     $content = $value;
                     break;
                 case 'thumb':
                 case 'thumbnail':
                     if (!count($items) || !$value) {
                         array_push($items, $value);
                     }
                     foreach ($items as $value) {
                         if (!preg_match("/\\.(jpe?g|png|gif|bmp|tiff?)\$/", $value, $extension) || !is_file($value)) {
                             break;
                         }
                         if (substr($value, -10) != '_thumb.jpg' && substr($value, -10) != '-thumb.jpg') {
                             @(require_once dirname(__FILE__) . '/libs/imagehandler.php');
                             $extension = $extension[0];
                             $basename = substr($value, 0, -strlen($extension));
                             $input = JPATH_ROOT . '/' . $basename . $extension;
                             $output = JPATH_ROOT . '/' . $basename . '_thumb.jpg';
                             $sizeSettings = array('width' => $botParams->get('thumb_width', 150), 'height' => $botParams->get('thumb_height', 100));
                             $imageSize = @getimagesize($input);
                             if ($imageSize[0] < $sizeSettings['width']) {
                                 $sizeSettings['width'] = $imageSize[0];
                             }
                             if ($imageSize[1] < $sizeSettings['height']) {
                                 $sizeSettings['height'] = $imageSize[1];
                             }
                             $thumb = new imgRedim(false, false, JPATH_CACHE);
                             $thumb->loadImage($input);
                             $thumb->redimToSize($sizeSettings['width'], $sizeSettings['height'], true);
                             $thumb->saveImage($output, $botParams->get('thumb_quality', 90));
                             $img = '<img class="rokbox-thumb" src="' . $basename . '_thumb.jpg" style="max-width:' . $sizeSettings['width'] . 'px;max-height:' . $sizeSettings['height'] . 'px;" />';
                         } else {
                             $imageSize = @getimagesize($value);
                             $img = '<img class="rokbox-thumb" src="' . $value . '" style="max-width:' . $imageSize[0] . 'px;max-height:' . $imageSize[1] . 'px;" />';
                         }
                         if (count($items) == 1) {
                             $content = $img;
                         } else {
                             $wildcards[$value] = $img;
                         }
                     }
                     break;
                 default:
                     if ($key == 'title') {
                         $key = 'caption';
                     }
                     $value = htmlentities($value, ENT_QUOTES);
                     array_push($link, $prefix . $key . '="' . $value . '"');
                     break;
             }
         }
         $dataset = implode(' ', $link);
         if (count($items) == 1) {
             $link = '<a data-rokbox class="rokbox-link" href="' . $href . '" ' . $dataset . '>' . $content . '</a>';
         } else {
             $link = '';
             if (isset($wildcards) && count($wildcards)) {
                 if (count($wildcards) > 1) {
                     $link = array('<div class="rokbox-album-wrapper">', '<div class="rokbox-album-top">', '<div class="rokbox-album-top2">', '<div class="rokbox-album-top3"></div>', '</div>', '</div>', '<div class="rokbox-album-inner">');
                     foreach ($wildcards as $href => $content) {
                         array_push($link, '<a data-rokbox class="rokbox-link" href="' . $href . '" ' . $dataset . '>' . $content . '</a>');
                     }
                     array_push($link, '</div><div class="rokbox-album-bottom"><div class="rokbox-album-bottom2"><div class="rokbox-album-bottom3"></div></div></div></div>');
                 } else {
                     $link = array();
                     foreach ($wildcards as $href => $content) {
                         array_push($link, '<a data-rokbox class="rokbox-link" href="' . $href . '" ' . $dataset . '>' . $content . '</a>');
                     }
                 }
                 $link = implode("\n", $link);
             }
         }
         $text = str_replace($snippet, $link, $text);
     }
     $row->text = $text;
 }