Esempio n. 1
0
 private function processImages(&$row, PluginConfiguration $config, &$matchesInIntro, &$matchesInText, $screenres, $showIntro)
 {
     $introCount = count($matchesInIntro);
     $count = count($matchesInText);
     jimport('joomla.application.component.model');
     JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_mosimage/models');
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_mosimage/tables');
     $model = JModelLegacy::getInstance('Options', 'MosimageModel');
     $rowImage = $model->getItem($row->id);
     $jsonObjectsList = $this->convertJsonToObjectArray($rowImage->imageslist);
     $rowImageCount = count($jsonObjectsList);
     $introImages = array();
     for ($i = 0, $m = 0; $i < $introCount; $i++, $m++) {
         $param = $this->getMosimageParameter($matchesInIntro[$m]);
         if ($i < $rowImageCount) {
             $introImages[] = HtmlHelper::createImageAndBuildHtml($jsonObjectsList[$i], $config, $screenres, $param);
         } else {
             $intoImages[] = HtmlHelper::createHtmlForNoneIntroImage($i);
         }
     }
     if ($this->isTextContainIntroText($row) == true) {
         $start = $introCount;
     } else {
         $start = 0;
     }
     if (empty($row->fulltext) || $showIntro == true) {
         $start = 0;
     }
     $images = array();
     for ($i = $start, $m = 0; $m < $count; $i++, $m++) {
         $param = $this->getMosimageParameter($matchesInText[$m]);
         if ($i < $rowImageCount && $rowImageCount > 0) {
             $images[] = HtmlHelper::createImageAndBuildHtml($jsonObjectsList[$i], $config, $screenres, $param);
         } else {
             $images[] = HtmlHelper::createHtmlForNoneImage($i);
         }
     }
     $result = new stdClass();
     $result->introImages = $introImages;
     $result->images = $images;
     return $result;
 }