本文整理汇总了PHP中Citruscart::getUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Citruscart::getUrl方法的具体用法?PHP Citruscart::getUrl怎么用?PHP Citruscart::getUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Citruscart
的用法示例。
在下文中一共展示了Citruscart::getUrl方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getImage
public static function getImage($id, $by = 'id', $alt = '', $type = 'thumb', $url = false)
{
switch ($type) {
case "full":
$path = 'manufacturers_images';
break;
case "thumb":
default:
$path = 'manufacturers_thumbs';
break;
}
$tmpl = "";
if (strpos($id, '.')) {
// then this is a filename, return the full img tag if file exists, otherwise use a default image
$src = JFile::exists(Citruscart::getPath($path) . '/' . $id) ? Citruscart::getUrl($path) . $id : 'media/citruscart/images/noimage.png';
// if url is true, just return the url of the file and not the whole img tag
$tmpl = $url ? $src : "<img src='" . $src . "' alt='" . JText::_($alt) . "' title='" . JText::_($alt) . "' name='" . JText::_($alt) . "' align='center' border='0' >";
} else {
if (!empty($id)) {
// load the item, get the filename, create tmpl
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/tables');
$row = JTable::getInstance('Manufacturers', 'CitruscartTable');
$row->load((int) $id);
$id = $row->manufacturer_image;
$src = JFile::exists(Citruscart::getPath($path) . '/' . $row->manufacturer_image) ? Citruscart::getUrl($path) . $id : 'media/citruscart/images/noimage.png';
// if url is true, just return the url of the file and not the whole img tag
$tmpl = $url ? $src : "<img src='" . $src . "' alt='" . JText::_($alt) . "' title='" . JText::_($alt) . "' name='" . JText::_($alt) . "' align='center' border='0' >";
}
}
return $tmpl;
}
示例2:
<?php
}
?>
<div class="reset marginbot"></div>
<div class="citruscart-expanded" id="comments-pane">
<div class="contentheading">
<?php
echo JText::_('COM_CITRUSCART_ORDER_COMMENTS');
?>
<?php
if ($enable_tooltips) {
?>
<a class="img_tooltip" href="" >
<img src="<?php
echo Citruscart::getUrl('images') . $image;
?>
" alt='<?php
echo JText::_('COM_CITRUSCART_HELP');
?>
' />
<span>
<?php
echo JText::_('COM_CITRUSCART_USE_THIS_AREA_FOR_SPECIAL_INSTRUCTIONS_OR_QUESTIONS_REGARDING_YOUR_ORDER');
?>
</span>
</a>
<?php
}
?>
</div>
示例3:
case "button":
?>
<input onclick="<?php
echo $onclick;
?>
" value="<?php
echo JText::_('COM_CITRUSCART_ADD_TO_CART');
?>
" type="button" class="btn" />
<?php
break;
case "image":
default:
?>
<img class='addcart' src='<?php
echo Citruscart::getUrl('images') . "addcart.png";
?>
' alt='<?php
echo JText::_('COM_CITRUSCART_ADD_TO_CART');
?>
' onclick="<?php
echo $onclick;
?>
" />
<?php
break;
}
}
?>
</div>
示例4: validationMessage
/**
* Generates a validation message
*
* @param unknown_type $text
* @param unknown_type $type
* @return unknown_type
*/
public static function validationMessage($text, $type = 'fail')
{
switch (strtolower($type)) {
case "success":
$src = Citruscart::getUrl('images') . 'accept_16.png';
$html = "<div class='citruscart_validation'><img src='{$src}' alt='" . JText::_('COM_CITRUSCART_SUCCESS') . "'><span class='validation-success'>" . JText::_($text) . "</span></div>";
break;
default:
$src = Citruscart::getUrl('images') . 'remove_16.png';
$html = "<div class='citruscart_validation'><img src='{$src}' alt='" . JText::_('COM_CITRUSCART_ERROR') . "'><span class='validation-fail'>" . JText::_($text) . "</span></div>";
break;
}
return $html;
}
示例5:
case "button":
?>
<input onclick="<?php
echo $onclick;
?>
" value="<?php
echo JText::_('COM_CITRUSCART_ADD_TO_CART');
?>
" type="button" class="btn btn-primary btn-addtocart" />
<?php
break;
case "image":
default:
?>
<img class='addcart' src='<?php
echo Citruscart::getUrl('images') . $image_addtocart;
?>
' alt='<?php
echo JText::_('COM_CITRUSCART_ADD_TO_CART');
?>
' onclick="<?php
echo $onclick;
?>
" />
<?php
break;
}
}
?>
</div>
示例6: getImage
/**
* Gets a category's image
*
* @param $id
* @param $by
* @param $alt
* @param $type
* @param $url
* @return unknown_type
*/
public static function getImage($id, $by = 'id', $alt = '', $type = 'thumb', $url = false)
{
$app = JFactory::getApplication();
switch ($type) {
case "full":
$path = 'categories_images';
break;
case "thumb":
default:
if ($app->isSite()) {
$path = "categories_images";
} else {
$path = 'categories_thumbs';
}
break;
}
$tmpl = "";
if (!empty($id) && is_numeric($id) && strpos($id, '.') === false) {
$model = Citruscart::getClass('CitruscartModelCategories', 'models.categories');
$item = $model->getItem((int) $id);
$full_image = !empty($item->category_full_image) ? $item->category_full_image : null;
if (filter_var($full_image, FILTER_VALIDATE_URL) !== false) {
// $full_image contains a valid URL
$src = $full_image;
} elseif (JFile::exists(Citruscart::getPath($path) . "/" . $full_image)) {
$src = Citruscart::getUrl($path) . $full_image;
} else {
$src = JURI::root(true) . '/media/citruscart/images/placeholder_239.gif';
}
if ($url) {
return $src;
} elseif (!empty($src)) {
$tmpl = "<img src='" . $src . "' alt='" . JText::_($alt) . "' title='" . JText::_($alt) . "'/>";
}
return $tmpl;
}
if (strpos($id, '.')) {
// then this is a filename, return the full img tag if file exists, otherwise use a default image
$src = JFile::exists(Citruscart::getPath($path) . '/' . $id) ? Citruscart::getUrl($path) . $id : JURI::root(true) . '/media/citruscart/images/placeholder_239.gif';
// if url is true, just return the url of the file and not the whole img tag
$tmpl = $url ? $src : "<img src='" . $src . "' alt='" . JText::_($alt) . "' title='" . JText::_($alt) . "' />";
}
return $tmpl;
}
示例7: getImageUrl
/**
* Get the URL to the path to images
* @return unknown_type
*/
function getImageUrl()
{
// Check where we should upload the file
// This is the default one
$dir = Citruscart::getPath('products_images');
$url = Citruscart::getUrl('products_images');
$helper = CitruscartHelperBase::getInstance();
// is the image path overridden?
if (!empty($this->product_images_path) && $helper->checkDirectory($this->product_images_path, false)) {
$url = str_replace(JPATH_SITE . DIRECTORY_SEPARATOR, JURI::root(), $this->product_images_path);
} else {
// try with the SKU
if (Citruscart::getInstance()->get('sha1_images', '0')) {
if (!empty($this->product_sku)) {
$subdirs = $this->getSha1Subfolders($this->product_sku, '/');
$image_dir = $url . $subdirs . $this->product_sku . '/';
}
} else {
$image_dir = $url . $this->product_sku . '/';
}
// try with the SKU
if (!empty($this->product_sku)) {
$url = $image_dir;
} else {
if (Citruscart::getInstance()->get('sha1_images', '0')) {
$subdirs = $this->getSha1Subfolders($this->product_id, '/');
$image_dir = $url . $subdirs . $this->product_id . '/';
} else {
$image_dir = $url . $this->product_id . '/';
}
$url = $image_dir;
}
}
return $url;
}
示例8: getImage
/**
*
* @param $id
* @param $by
* @param $alt
* @param $type
* @param $url
* @return unknown_type
*/
public static function getImage($id, $by = 'id', $alt = '', $type = 'thumb', $url = false, $resize = false, $options = array(), $main_product = false)
{
$app = JFactory::getApplication();
$style = "";
$height_style = "";
$width_style = "";
$dimensions = "";
if (!empty($options['width'])) {
$dimensions .= "width=\"" . $options['width'] . "\" ";
}
if (!empty($options['height'])) {
$dimensions .= "height=\"" . $options['height'] . "\" ";
}
if (!empty($options['height'])) {
$height_style = "max-height: " . $options['height'] . "px;";
}
if (!empty($options['width'])) {
$width_style = "max-width: " . $options['width'] . "px;";
}
if (!empty($height_style) || !empty($width_style)) {
$style = "style='{$height_style} {$width_style}'";
}
switch ($type) {
case "full":
$path = 'products_images';
$p_id = "citruscart_main_image" . $id;
break;
case "thumb":
default:
$path = 'products_images';
$p_id = "citruscart_thumb_image" . $id;
break;
}
$tmpl = "";
if (strpos($id, '.')) {
// then this is a filename, return the full img tag if file exists, otherwise use a default image
$src = JFile::exists(Citruscart::getPath($path) . '/' . $id) ? Citruscart::getUrl($path) . $id : JURI::root(true) . '/media/citruscart/images/placeholder_239.gif';
// if url is true, just return the url of the file and not the whole img tag
$tmpl = $url ? $src : "<img " . $dimensions . " src='" . $src . "' alt='" . JText::_($alt) . "' title='" . JText::_($alt) . "' align='middle' border='0' " . $style . " />";
} else {
if (!empty($id)) {
if (isset($this) && is_a($this, 'CitruscartHelperProduct')) {
$helper = $this;
} else {
$helper = CitruscartHelperBase::getInstance('Product');
}
$model = Citruscart::getClass('CitruscartModelProducts', 'models.products');
$model->setId((int) $id);
$item = $model->getItem();
$full_image = !empty($item->product_full_image) ? $item->product_full_image : null;
$thumb_image = !empty($item->product_thumb_image) ? $item->product_thumb_image : $full_image;
switch ($type) {
case "full":
$image_ref = $full_image;
$p_id = "citruscart_main_image" . $id;
break;
case "thumb":
default:
$image_ref = $thumb_image;
$p_id = "citruscart_thumb_image" . $id;
break;
}
if (filter_var($image_ref, FILTER_VALIDATE_URL) !== false) {
// $full_image contains a valid URL
$src = $image_ref;
if ($url) {
return $src;
} elseif (!empty($src)) {
$tmpl = "<img src='" . $src . "' alt='" . JText::_($alt) . "' title='" . JText::_($alt) . "' />";
return $tmpl;
}
}
$row = $helper->load((int) $id, true, false);
// load the item, get the filename, create tmpl
$urli = $row->getImageUrl();
$dir = $row->getImagePath();
if ($path == 'products_thumbs') {
$dir .= 'thumbs';
$urli .= 'thumbs/';
}
if ($main_product) {
$app->triggerEvent('onGetProductMainImage', array($row->product_id, &$full_image, $options));
}
$dirname = dirname($image_ref);
if (!empty($dirname) && $dirname !== ".") {
$dir = JPath::clean(JPATH_SITE . "/" . dirname($image_ref));
$urli = JURI::root(true) . '/' . dirname($image_ref) . '/';
$file = JPath::clean(JPATH_SITE . "/" . $image_ref);
$id = JURI::root(true) . '/' . $image_ref;
} else {
$file = $dir . $image_ref;
//.........这里部分代码省略.........