本文整理汇总了PHP中JUDirectoryHelper::getListingImage方法的典型用法代码示例。如果您正苦于以下问题:PHP JUDirectoryHelper::getListingImage方法的具体用法?PHP JUDirectoryHelper::getListingImage怎么用?PHP JUDirectoryHelper::getListingImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUDirectoryHelper
的用法示例。
在下文中一共展示了JUDirectoryHelper::getListingImage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareDocument
protected function _prepareDocument()
{
$document = JFactory::getDocument();
$uri = clone JUri::getInstance();
$domain = $uri->toString(array('scheme', 'host', 'port'));
$canonicalLink = $domain . JRoute::_(JUDirectoryHelperRoute::getListingRoute($this->item->id, $this->_layout), false);
JUDirectoryFrontHelper::setCanonical($canonicalLink);
$document->addCustomTag('<meta property="og:title" content="' . htmlspecialchars(strip_tags($this->item->title), ENT_COMPAT, 'UTF-8') . '" />');
$document->addCustomTag('<meta property="og:type" content="website" />');
$listingImage = JUDirectoryHelper::getListingImage($this->item->image);
if ($listingImage) {
$document->addCustomTag('<meta property="og:image" content="' . $listingImage . '" />');
}
$document->addCustomTag('<meta property="og:url" content="' . $canonicalLink . '" />');
$document->addCustomTag('<meta property="og:description" content="' . htmlspecialchars(strip_tags($this->item->description), ENT_COMPAT, 'UTF-8') . '" />');
$conf = JFactory::getConfig();
if (JUDirectoryHelper::isJoomla3x()) {
$siteName = $conf->get('sitename');
} else {
$siteName = $conf->getValue('config.sitename');
}
$document->addCustomTag('<meta property="og:site_name" content="' . htmlspecialchars(strip_tags($siteName), ENT_COMPAT, 'UTF-8') . '" />');
JUDirectoryFrontHelperSeo::seo($this);
}
示例2: getLocations
public static function getLocations($listings)
{
$locations = array();
$listingIds = array();
if ($listings) {
foreach ($listings as $listing) {
$listingIds[] = $listing->id;
}
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('location.*, listing.image AS listing_image, listing.title')->from('#__judirectory_locations AS location')->join('', '#__judirectory_listings AS listing ON listing.id = location.listing_id')->where('listing.id IN (' . implode(',', $listingIds) . ')');
$db->setQuery($query);
$locations = $db->loadObjectList();
$locationIconUrl = JUri::root(true) . '/media/com_judirectory/images/location/';
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_judirectory/tables');
$addressTable = JTable::getInstance('Address', 'JUDirectoryTable');
foreach ($locations as $location) {
if ($location->image) {
$location->image = $locationIconUrl . $location->listing_id . '/' . $location->image;
} else {
$location->image = JUDirectoryHelper::getListingImage($location->listing_image);
}
$addresses = self::getAddresses($addressTable, $location->address_id);
$addresses[] = $location->address;
$location->address = implode(', ', array_reverse($addresses));
$location->link = JRoute::_(JUDirectoryHelperRoute::getListingRoute($location->listing_id));
$location->description = nl2br($location->description);
}
}
return $locations;
}
示例3: getOutput
public function getOutput($options = array())
{
if (!$this->isPublished()) {
return "";
}
if (!$this->value) {
return "";
}
$image_src = JUDirectoryHelper::getListingImage($this->value);
if (!$this->listing_id || !$image_src) {
return '';
}
$isDetailsView = $this->isDetailsView($options);
$this->setVariable('image_src', $image_src);
$this->setVariable('isDetailsView', $isDetailsView);
return $this->fetch('output.php', __CLASS__);
}
示例4: getRelatedListings
public function getRelatedListings()
{
$app = JFactory::getApplication();
$listing_id = $app->input->getInt('id', 0);
$relatedListingIds = $app->getUserState("com_judirectory.edit.listing.related_listings", array());
$related_listings = array();
if ($relatedListingIds) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('listing.id, listing.title, listing.image');
$query->from('#__judirectory_listings AS listing');
$query->where('listing.id IN (' . implode(',', $relatedListingIds) . ')');
$db->setQuery($query);
$related_listings = $db->loadObjectList();
} elseif ($listing_id) {
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('listing.id, listing.title, listing.image');
$query->from('#__judirectory_listings_relations AS listingrel');
$query->join('INNER', '#__judirectory_listings AS listing ON listingrel.listing_id_related = listing.id');
$query->where('listingrel.listing_id = ' . $listing_id);
$query->order('listingrel.ordering ASC');
$db->setQuery($query);
$related_listings = $db->loadObjectList();
}
if ($related_listings) {
foreach ($related_listings as $listing) {
$listing->image_src = JUDirectoryHelper::getListingImage($listing->image);
}
}
return $related_listings;
}