• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP utf8_strrpos函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中utf8_strrpos函数的典型用法代码示例。如果您正苦于以下问题:PHP utf8_strrpos函数的具体用法?PHP utf8_strrpos怎么用?PHP utf8_strrpos使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了utf8_strrpos函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: resize

 public function resize($filename, $width, $height)
 {
     if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
         return;
     }
     $info = pathinfo($filename);
     $extension = $info['extension'];
     $old_image = $filename;
     $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
     if (!file_exists(DIR_IMAGE . $new_image) || filemtime(DIR_IMAGE . $old_image) > filemtime(DIR_IMAGE . $new_image)) {
         $path = '';
         $directories = explode('/', dirname(str_replace('../', '', $new_image)));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!file_exists(DIR_IMAGE . $path)) {
                 @mkdir(DIR_IMAGE . $path, 0777);
             }
         }
         $image = new Image(DIR_IMAGE . $old_image);
         $image->resize($width, $height);
         $image->save(DIR_IMAGE . $new_image);
     }
     if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1')) {
         return HTTPS_CATALOG . 'image/' . $new_image;
     } else {
         return HTTP_CATALOG . 'image/' . $new_image;
     }
 }
开发者ID:gittrue,项目名称:VIF,代码行数:28,代码来源:image.php


示例2: cart

 public function cart()
 {
     $this->load->model('tool/image');
     $this->data['products'] = array();
     foreach ($this->cart->getProducts() as $product) {
         if ($product['image']) {
             $image = $this->model_tool_image->resize($product['image'], $this->config->get('image_cart_width'), $this->config->get('image_cart_height'));
         } else {
             $image = '';
         }
         $option_data = array();
         foreach ($product['option'] as $option) {
             if ($option['type'] != 'file') {
                 $value = $option['option_value'];
             } else {
                 $filename = $this->encryption->decrypt($option['option_value']);
                 $value = utf8_substr($filename, 0, utf8_strrpos($filename, '.'));
             }
             $option_data[] = array('name' => $option['name'], 'value' => utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value, 'type' => $option['type']);
         }
         $this->data['products'][] = array('product_id' => $product['product_id'], 'key' => $product['key'], 'thumb' => $image, 'name' => $product['name'], 'model' => $product['model'], 'option' => $option_data, 'quantity' => $product['quantity'], 'price' => $product['price'], 'total' => $product['total'], 'tax' => $product['tax_percentage'], 'href' => $this->url->link('product/product', 'product_id=' . $product['product_id']));
     }
     // Gift Voucher
     if (!empty($this->session->data['vouchers'])) {
         foreach ($this->session->data['vouchers'] as $key => $voucher) {
             $this->data['products'][] = array('key' => $key, 'name' => $voucher['description'], 'price' => $voucher['amount'], 'amount' => 1, 'total' => $voucher['amount']);
         }
     }
     $this->template = 'cart.tpl';
     $this->response->setOutput($this->render());
 }
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:31,代码来源:index.php


示例3: resize

 public function resize($filename, $width, $height)
 {
     if (!is_file(DIR_IMAGE . $filename)) {
         return;
     }
     $extension = pathinfo($filename, PATHINFO_EXTENSION);
     $old_image = $filename;
     $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
     if (!is_file(DIR_IMAGE . $new_image) || filectime(DIR_IMAGE . $old_image) > filectime(DIR_IMAGE . $new_image)) {
         $path = '';
         $directories = explode('/', dirname(str_replace('../', '', $new_image)));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!is_dir(DIR_IMAGE . $path)) {
                 @mkdir(DIR_IMAGE . $path, 0777);
             }
         }
         list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image);
         if ($width_orig != $width || $height_orig != $height) {
             $image = new Image(DIR_IMAGE . $old_image);
             $image->resize($width, $height);
             $image->save(DIR_IMAGE . $new_image);
         } else {
             copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image);
         }
     }
     if ($this->request->server['HTTPS']) {
         return $this->config->get('config_ssl') . 'image/' . $new_image;
     } else {
         return $this->config->get('config_url') . 'image/' . $new_image;
     }
 }
开发者ID:sir-oga,项目名称:peterpan,代码行数:32,代码来源:image.php


示例4: resize

 public function resize($filename, $width, $height)
 {
     if (!is_file(DIR_IMAGE . $filename) || substr(str_replace('\\', '/', realpath(DIR_IMAGE . $filename)), 0, strlen(DIR_IMAGE)) != DIR_IMAGE) {
         return;
     }
     $extension = pathinfo($filename, PATHINFO_EXTENSION);
     $image_old = $filename;
     $image_new = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
     if (!is_file(DIR_IMAGE . $image_new) || filectime(DIR_IMAGE . $image_old) > filectime(DIR_IMAGE . $image_new)) {
         list($width_orig, $height_orig, $image_type) = getimagesize(DIR_IMAGE . $image_old);
         if (!in_array($image_type, array(IMAGETYPE_PNG, IMAGETYPE_JPEG, IMAGETYPE_GIF))) {
             return DIR_IMAGE . $image_old;
         }
         $path = '';
         $directories = explode('/', dirname($image_new));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!is_dir(DIR_IMAGE . $path)) {
                 @mkdir(DIR_IMAGE . $path, 0777);
             }
         }
         if ($width_orig != $width || $height_orig != $height) {
             $image = new Image(DIR_IMAGE . $image_old);
             $image->resize($width, $height);
             $image->save(DIR_IMAGE . $image_new);
         } else {
             copy(DIR_IMAGE . $image_old, DIR_IMAGE . $image_new);
         }
     }
     if ($this->request->server['HTTPS']) {
         return HTTPS_CATALOG . 'image/' . $image_new;
     } else {
         return HTTP_CATALOG . 'image/' . $image_new;
     }
 }
开发者ID:brunoxu,项目名称:mycncart,代码行数:35,代码来源:image.php


示例5: resize

 public function resize($filename, $width, $height)
 {
     if (!is_file(DIR_IMAGE . $filename) || substr(str_replace('\\', '/', realpath(DIR_IMAGE . $filename)), 0, strlen(DIR_IMAGE)) != DIR_IMAGE) {
         return;
     }
     $extension = pathinfo($filename, PATHINFO_EXTENSION);
     $old_image = $filename;
     $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . (int) $width . 'x' . (int) $height . '.' . $extension;
     if (!is_file(DIR_IMAGE . $new_image) || filectime(DIR_IMAGE . $old_image) > filectime(DIR_IMAGE . $new_image)) {
         $path = '';
         $directories = explode('/', dirname($new_image));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!is_dir(DIR_IMAGE . $path)) {
                 @mkdir(DIR_IMAGE . $path, 0777);
             }
         }
         list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image);
         if ($width_orig != $width || $height_orig != $height) {
             $image = new Image(DIR_IMAGE . $old_image);
             $image->resize($width, $height);
             $image->save(DIR_IMAGE . $new_image);
         } else {
             copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image);
         }
     }
     $new_image = str_replace(' ', '%20', $new_image);
     if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1') || $this->request->server['HTTPS'] == '443') {
         return $this->config->get('config_ssl') . 'image/' . $new_image;
     } elseif (isset($this->request->server['HTTP_X_FORWARDED_PROTO']) && $this->request->server['HTTP_X_FORWARDED_PROTO'] == 'https') {
         return $this->config->get('config_ssl') . 'image/' . $new_image;
     } else {
         return $this->config->get('config_url') . 'image/' . $new_image;
     }
 }
开发者ID:skyosev,项目名称:OpenCart-Overclocked,代码行数:35,代码来源:image.php


示例6: resize

 /**
  *	
  *	@param filename string
  *	@param width 
  *	@param height
  *	@param type char [default, w, h]
  *				default = scale with white space, 
  *				w = fill according to width, 
  *				h = fill according to height
  *	
  */
 public function resize($filename, $width, $height, $type = "")
 {
     if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
         return;
     }
     $info = pathinfo($filename);
     $extension = $info['extension'];
     $old_image = $filename;
     $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . $type . '.' . $extension;
     if (!file_exists(DIR_IMAGE . $new_image) || filemtime(DIR_IMAGE . $old_image) > filemtime(DIR_IMAGE . $new_image)) {
         $path = '';
         $directories = explode('/', dirname(str_replace('../', '', $new_image)));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!file_exists(DIR_IMAGE . $path)) {
                 @mkdir(DIR_IMAGE . $path, 0777);
             }
         }
         list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image);
         if ($width_orig != $width || $height_orig != $height) {
             $image = new Image(DIR_IMAGE . $old_image);
             $image->resize($width, $height, $type);
             $image->save(DIR_IMAGE . $new_image);
         } else {
             copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image);
         }
     }
     if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1')) {
         return (defined('HTTPS_STATIC_CDN') ? HTTPS_STATIC_CDN : $this->config->get('config_ssl')) . 'image/' . $new_image;
     } else {
         return (defined('HTTP_STATIC_CDN') ? HTTP_STATIC_CDN : $this->config->get('config_url')) . 'image/' . $new_image;
     }
 }
开发者ID:deepakdesai,项目名称:CressoyoWebApp,代码行数:44,代码来源:vq2-catalog_model_tool_image.php


示例7: utf8_strrpos

function utf8_strrpos($string, $needle, $offset = NULL) {
	if (is_null($offset)) {
		$data = explode($needle, $string);

		if (count($data) > 1) {
			array_pop($data);

			$string = join($needle, $data);

			return utf8_strlen($string);
		}

		return false;
	} else {
		if (!is_int($offset)) {
			trigger_error('utf8_strrpos expects parameter 3 to be long', E_USER_WARNING);

			return false;
		}

		$string = utf8_substr($string, $offset);

		if (false !== ($position = utf8_strrpos($string, $needle))) {
			return $position + $offset;
		}

		return false;
	}
}
开发者ID:halfhope,项目名称:ocStore,代码行数:29,代码来源:utf8.php


示例8: resize

 /**
  *	
  *	@param filename string
  *	@param width 
  *	@param height
  *	@param type char [default, w, h]
  *				default = scale with white space, 
  *				w = fill according to width, 
  *				h = fill according to height
  *	
  */
 public function resize($filename, $width, $height, $type = "")
 {
     if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
         return;
     }
     $info = pathinfo($filename);
     $extension = $info['extension'];
     $old_image = $filename;
     $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . $type . '.' . $extension;
     if (!file_exists(DIR_IMAGE . $new_image) || filemtime(DIR_IMAGE . $old_image) > filemtime(DIR_IMAGE . $new_image)) {
         $path = '';
         $directories = explode('/', dirname(str_replace('../', '', $new_image)));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!file_exists(DIR_IMAGE . $path)) {
                 @mkdir(DIR_IMAGE . $path, 0777);
             }
         }
         list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image);
         if ($width_orig != $width || $height_orig != $height) {
             $image = new Image(DIR_IMAGE . $old_image);
             $image->resize($width, $height, $type);
             $image->save(DIR_IMAGE . $new_image);
         } else {
             copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image);
         }
     }
     return $this->getImageUrl($new_image);
 }
开发者ID:xprocessorx,项目名称:ocStore,代码行数:40,代码来源:image.php


示例9: zula_strrpos

/**
 * Unicode: Returns the position of the last occurrence of needle in haystack
 *
 * @param string haystack
 * @param string needle
 * @param int offset
 * @return integer or false on failure
 */
function zula_strrpos($haystack, $needle, $offset = null)
{
    if (UNICODE_MBSTRING === true) {
        return $offset === null ? mb_strrpos($haystack, $needle) : mb_strrpos($haystack, $needle, $offset);
    } else {
        return $offset === null ? utf8_strrpos($haystack, $needle) : utf8_strrpos($haystack, $needle, $offset);
    }
}
开发者ID:jinshana,项目名称:tangocms,代码行数:16,代码来源:common.php


示例10: index

 protected function index()
 {
     $this->language->load('payment/mvd_pp_standard');
     $this->data['button_confirm'] = $this->language->get('button_confirm');
     //$this->data['action'] = 'https://www.paypal.com/cgi-bin/webscr';
     $this->data['action'] = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
     $this->load->model('checkout/order');
     $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
     if ($order_info) {
         $this->load->model('checkout/order');
         $mybankinfo = $this->model_checkout_order->PaymentGateway();
         $this->data['business'] = $mybankinfo['paypal_email'];
         $this->data['item_name'] = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8');
         $this->data['products'] = array();
         foreach ($this->cart->getProducts() as $product) {
             $option_data = array();
             foreach ($product['option'] as $option) {
                 if ($option['type'] != 'file') {
                     $value = $option['option_value'];
                 } else {
                     $filename = $this->encryption->decrypt($option['option_value']);
                     $value = utf8_substr($filename, 0, utf8_strrpos($filename, '.'));
                 }
                 $option_data[] = array('name' => $option['name'], 'value' => utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value);
             }
             $this->data['products'][] = array('name' => $product['name'], 'model' => $product['model'], 'price' => $this->currency->format($product['price'], $order_info['currency_code'], false, false), 'quantity' => $product['quantity'], 'option' => $option_data, 'weight' => $product['weight']);
         }
         $this->data['discount_amount_cart'] = 0;
         $total = $this->currency->format($order_info['total'] - $this->cart->getSubTotal(), $order_info['currency_code'], false, false);
         if ($total > 0) {
             $this->data['products'][] = array('name' => $this->language->get('text_total'), 'model' => '', 'price' => $total, 'quantity' => 1, 'option' => array(), 'weight' => 0);
         } else {
             $this->data['discount_amount_cart'] -= $total;
         }
         $this->data['currency_code'] = $order_info['currency_code'];
         $this->data['first_name'] = html_entity_decode($order_info['payment_firstname'], ENT_QUOTES, 'UTF-8');
         $this->data['last_name'] = html_entity_decode($order_info['payment_lastname'], ENT_QUOTES, 'UTF-8');
         $this->data['address1'] = html_entity_decode($order_info['payment_address_1'], ENT_QUOTES, 'UTF-8');
         $this->data['address2'] = html_entity_decode($order_info['payment_address_2'], ENT_QUOTES, 'UTF-8');
         $this->data['city'] = html_entity_decode($order_info['payment_city'], ENT_QUOTES, 'UTF-8');
         $this->data['zip'] = html_entity_decode($order_info['payment_postcode'], ENT_QUOTES, 'UTF-8');
         $this->data['country'] = $order_info['payment_iso_code_2'];
         $this->data['email'] = $order_info['email'];
         $this->data['invoice'] = $this->session->data['order_id'] . ' - ' . html_entity_decode($order_info['payment_firstname'], ENT_QUOTES, 'UTF-8') . ' ' . html_entity_decode($order_info['payment_lastname'], ENT_QUOTES, 'UTF-8');
         $this->data['lc'] = $this->session->data['language'];
         $this->data['return'] = $this->url->link('checkout/success');
         $this->data['notify_url'] = $this->url->link('payment/mvd_pp_standard/callback', '', 'SSL');
         $this->data['cancel_return'] = $this->url->link('checkout/checkout', '', 'SSL');
         $this->data['paymentaction'] = 'sale';
         $this->data['custom'] = $this->session->data['order_id'];
         if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/mvd_pp_standard.tpl')) {
             $this->template = $this->config->get('config_template') . '/template/payment/mvd_pp_standard.tpl';
         } else {
             $this->template = 'default/template/payment/mvd_pp_standard.tpl';
         }
         $this->render();
     }
 }
开发者ID:Vitronic,项目名称:kaufreund.de,代码行数:58,代码来源:mvd_pp_standard.php


示例11: getTableData

 public function getTableData()
 {
     $colMap = array('customer_name' => 'firstname', 'date_created' => 'o.date_added');
     $sorts = array('order_id', 'customer_name', 'date_created', 'total_amount');
     $filters = array_merge($sorts, array('products'));
     list($sortCol, $sortDir) = $this->MsLoader->MsHelper->getSortParams($sorts, $colMap);
     $filterParams = $this->MsLoader->MsHelper->getFilterParams($filters, $colMap);
     $seller_id = $this->customer->getId();
     $this->load->model('account/order');
     $orders = $this->MsLoader->MsOrderData->getOrders(array('seller_id' => $seller_id, 'order_status' => $this->config->get('msconf_credit_order_statuses')), array('order_by' => $sortCol, 'order_way' => $sortDir, 'offset' => $this->request->get['iDisplayStart'], 'limit' => $this->request->get['iDisplayLength'], 'filters' => $filterParams), array('total_amount' => 1, 'products' => 1));
     $total_orders = isset($orders[0]) ? $orders[0]['total_rows'] : 0;
     $columns = array();
     foreach ($orders as $order) {
         $order_products = $this->MsLoader->MsOrderData->getOrderProducts(array('order_id' => $order['order_id'], 'seller_id' => $seller_id));
         if ($this->config->get('msconf_hide_customer_email')) {
             $customer_name = "{$order['firstname']} {$order['lastname']}";
         } else {
             $customer_name = "{$order['firstname']} {$order['lastname']} ({$order['email']})";
         }
         $products = "";
         foreach ($order_products as $p) {
             $products .= "<p style='text-align:left'>";
             $products .= "<span class='name'>" . ($p['quantity'] > 1 ? "{$p['quantity']} x " : "") . "<a href='" . $this->url->link('product/product', 'product_id=' . $p['product_id'], 'SSL') . "'>{$p['name']}</a></span>";
             $options = $this->model_account_order->getOrderOptions($order['order_id'], $p['order_product_id']);
             foreach ($options as $option) {
                 if ($option['type'] != 'file') {
                     $value = $option['value'];
                 } else {
                     $value = utf8_substr($option['value'], 0, utf8_strrpos($option['value'], '.'));
                 }
                 $option['value'] = utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value;
                 $products .= "<br />";
                 $products .= "<small> - {$option['name']} : {$option['value']} </small>";
             }
             $products .= "<span class='total'>" . $this->currency->format($p['seller_net_amt'], $this->config->get('config_currency')) . "</span>";
             $products .= "</p>";
         }
         $this->load->model('localisation/order_status');
         $order_statuses = $this->model_localisation_order_status->getOrderStatuses();
         $order_status_id = $this->model_localisation_order_status->getSuborderStatusId($order['order_id'], $this->customer->getId());
         $order_status_name = '';
         foreach ($order_statuses as $order_status) {
             if ($order_status['order_status_id'] == $order_status_id) {
                 $order_status_name = $order_status['name'];
             }
         }
         $columns[] = array_merge($order, array('order_id' => $order['order_id'], 'customer_name' => $customer_name, 'products' => $products, 'suborder_status' => $order_status_name, 'date_created' => date($this->language->get('date_format_short'), strtotime($order['date_added'])), 'total_amount' => $this->currency->format($order['total_amount'], $this->config->get('config_currency')), 'view_order' => '<a href="' . $this->url->link('seller/account-order/viewOrder', 'order_id=' . $order['order_id']) . '" class="ms-button ms-button-view"></a>'));
     }
     $this->response->setOutput(json_encode(array('iTotalRecords' => $total_orders, 'iTotalDisplayRecords' => $total_orders, 'aaData' => $columns)));
 }
开发者ID:bizfindyou,项目名称:web,代码行数:50,代码来源:account-order.php


示例12: utf8_pathinfo

/**
 * Returns information about a file path
 *
 * @author Lars Knickrehm <[email protected]>
 * @category Library
 * @copyright Copyright © 2009 Lars Knickrehm
 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License
 * @link http://php.net/manual/function.pathinfo.php
 * @package UTF-8
 * @param string $path The path being checked.
 * @return array The following associative array elements are returned: dirname, basename, extension (if any), and filename.
 * @since Version 0.5.0
 * @version 0.5.0
 */
function utf8_pathinfo($path)
{
    $return['dirname'] = dirname($path);
    $return['basename'] = utf8_basename($path);
    $position = utf8_strrpos($return['basename'], '.');
    if ($position !== false) {
        $return['extension'] = utf8_substr($return['basename'], $position + 1);
        $return['filename'] = $return['basename'];
        $return['filename'] = utf8_substr($return['filename'], 0, $position);
    } else {
        $return['filename'] = $return['basename'];
    }
    return $return;
}
开发者ID:DavidGarciaCat,项目名称:eyeos,代码行数:28,代码来源:pathinfo.php


示例13: resizeme

 public function resizeme($filename, $width, $height, $type = true, $copy = true)
 {
     if (!class_exists('PhpThumbFactory')) {
         require_once DIR_SYSTEM . 'library/image/ThumbLib.php';
     }
     $ok = false;
     if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
         return $ok;
     }
     $info = pathinfo($filename);
     $extension = $info['extension'];
     $old_image = $filename;
     $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
     if (!file_exists(DIR_IMAGE . $new_image) || filemtime(DIR_IMAGE . $old_image) > filemtime(DIR_IMAGE . $new_image)) {
         $path = '';
         $directories = explode('/', dirname(str_replace('../', '', $new_image)));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!file_exists(DIR_IMAGE . $path)) {
                 @mkdir(DIR_IMAGE . $path, 0777);
             }
         }
         list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image);
         if ($width_orig != $width || $height_orig != $height || !$copy) {
             //********* code *************
             $thumb = PhpThumbFactory::create(DIR_IMAGE . $old_image, array('resizeUp' => true));
             if ($type) {
                 $ok = $thumb->adaptiveResize($width, $height)->save(DIR_IMAGE . $new_image);
             } else {
                 //$ok = $thumb->resize($width, $height)->save(DIR_IMAGE . $new_image);
                 // opencart standart
                 $image = new Image(DIR_IMAGE . $old_image);
                 $image->resize($width, $height);
                 $image->save(DIR_IMAGE . $new_image);
                 $ok = true;
             }
             //********* code *************
         } else {
             $ok = copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image);
         }
         if ($ok) {
             return $this->getHttpImage() . $new_image;
         } else {
             return '';
         }
     } else {
         return $this->getHttpImage() . $new_image;
     }
 }
开发者ID:BulatSa,项目名称:Ctex,代码行数:49,代码来源:image.php


示例14: utf8_basename

/**
 * Returns filename component of path
 *
 * @author Lars Knickrehm <[email protected]>
 * @category Library
 * @copyright Copyright © 2009 Lars Knickrehm
 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License
 * @link http://php.net/manual/function.basename.php
 * @package UTF-8
 * @param string $path A path. Both slash (/) and backslash (\) are used as directory separator character.
 * @param string $suffix If the filename ends in suffix  this will also be cut off.
 * @return string Base name of the given path
 * @since Version 0.5.0
 * @version 0.5.0
 */
function utf8_basename($path, $suffix = '')
{
    // Change backslash (\) to slash (/)
    $path = utf8_trim(strtr($path, array('\\' => '/')), '/');
    // Get basename
    $i = utf8_strrpos($path, '/');
    if ($i !== false) {
        $path = utf8_substr($path, $i + 1);
    }
    // Handle suffix
    if ($suffix !== '') {
        $position = utf8_strrpos($path, $suffix);
        if ($position !== false) {
            $path = utf8_substr($path, 0, $position);
        }
    }
    return $path;
}
开发者ID:DavidGarciaCat,项目名称:eyeos,代码行数:33,代码来源:basename.php


示例15: resize

 /**
  *
  *    @param filename string
  *    @param width
  *    @param height
  *    @param type char [default, w, h]
  *        default = scale with white space,
  *        w = fill according to width,
  *        h = fill according to height
  *
  */
 public function resize($filename, $width, $height, $type = "h")
 {
     if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
         return;
     }
     if (!$width) {
         $width = 1;
     }
     if (!$height) {
         $height = 1;
     }
     $info = pathinfo($filename);
     $extension = $info['extension'];
     $old_image = $filename;
     $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . $type . '.' . $extension;
     if (!file_exists(DIR_IMAGE . $new_image) || filemtime(DIR_IMAGE . $old_image) > filemtime(DIR_IMAGE . $new_image)) {
         $path = '';
         $directories = explode('/', dirname(str_replace('../', '', $new_image)));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!file_exists(DIR_IMAGE . $path)) {
                 @mkdir(DIR_IMAGE . $path, 0777);
             }
         }
         list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image);
         if ($width_orig != $width || $height_orig != $height) {
             $image = new Image(DIR_IMAGE . $old_image);
             $image->resize($width, $height, $type);
             if ($width >= 500 || $height >= 500) {
                 $quality = 90;
             } else {
                 $quality = 75;
             }
             $image->save(DIR_IMAGE . $new_image, $quality);
         } else {
             copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image);
         }
     }
     // Prevent cache-anti-refresh which could show old images
     return $this->url->link('image/' . $new_image, filemtime(DIR_IMAGE . $new_image));
 }
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:52,代码来源:image.php


示例16: resize

 public function resize($filename, $width, $height)
 {
     if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
         return;
     }
     $info = pathinfo($filename);
     $extension = $info['extension'];
     $old_image = $filename;
     $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
     if (!file_exists(DIR_IMAGE . $new_image) || filemtime(DIR_IMAGE . $old_image) > filemtime(DIR_IMAGE . $new_image)) {
         $path = '';
         $directories = explode('/', dirname(str_replace('../', '', $new_image)));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!file_exists(DIR_IMAGE . $path)) {
                 @mkdir(DIR_IMAGE . $path, 0777);
             }
         }
         list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image);
         if ($width_orig != $width || $height_orig != $height) {
             $image = new Image(DIR_IMAGE . $old_image);
             $image->resize($width, $height);
             // tokoonline
             $watermark_path = str_replace("\\", '/', DIR_IMAGE) . 'watermark.png';
             if ($width > 100 || $height > 100 and strpos($old_image, 'banner') === false and file_exists($watermark_path)) {
                 $image->watermark($watermark_path, 'center');
             }
             $image->save(DIR_IMAGE . $new_image);
         } else {
             copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image);
         }
     }
     if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1')) {
         return HTTPS_IMAGE . $new_image;
     } else {
         return HTTP_IMAGE . $new_image;
     }
 }
开发者ID:ekachandrasetiawan,项目名称:SuprabaktiShop,代码行数:38,代码来源:image.php


示例17: utf8_strrpos

/**
* UTF-8 aware alternative to strrpos
* Find position of last occurrence of a char in a string
* Note: This will get alot slower if offset is used
* Note: requires utf8_substr and utf8_strlen to be loaded
* @param string haystack
* @param string needle (you should validate this with utf8_is_valid)
* @param integer (optional) offset (from left)
* @return mixed integer position or FALSE on failure
* @see http://www.php.net/strrpos
* @see utf8_substr
* @see utf8_strlen
* @package utf8
* @subpackage strings
*/
function utf8_strrpos($str, $needle, $offset = NULL)
{
    if (is_null($offset)) {
        $ar = explode($needle, $str);
        if (count($ar) > 1) {
            // Pop off the end of the string where the last match was made
            array_pop($ar);
            $str = join($needle, $ar);
            return utf8_strlen($str);
        }
        return FALSE;
    } else {
        if (!is_int($offset)) {
            trigger_error('utf8_strrpos expects parameter 3 to be long', E_USER_WARNING);
            return FALSE;
        }
        $str = utf8_substr($str, $offset);
        if (FALSE !== ($pos = utf8_strrpos($str, $needle))) {
            return $pos + $offset;
        }
        return FALSE;
    }
}
开发者ID:kwizera05,项目名称:police,代码行数:38,代码来源:core.php


示例18: resize

 public function resize($filename, $width, $height)
 {
     if (!is_file(DIR_IMAGE . $filename) || substr(str_replace('\\', '/', realpath(DIR_IMAGE . $filename)), 0, strlen(DIR_IMAGE)) != str_replace('\\', '/', DIR_IMAGE)) {
         return;
     }
     $extension = pathinfo($filename, PATHINFO_EXTENSION);
     $image_old = $filename;
     $image_new = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . (int) $width . 'x' . (int) $height . '.' . $extension;
     if (!is_file(DIR_IMAGE . $image_new) || filectime(DIR_IMAGE . $image_old) > filectime(DIR_IMAGE . $image_new)) {
         list($width_orig, $height_orig, $image_type) = getimagesize(DIR_IMAGE . $image_old);
         if (!in_array($image_type, array(IMAGETYPE_PNG, IMAGETYPE_JPEG, IMAGETYPE_GIF))) {
             return DIR_IMAGE . $image_old;
         }
         $path = '';
         $directories = explode('/', dirname($image_new));
         foreach ($directories as $directory) {
             $path = $path . '/' . $directory;
             if (!is_dir(DIR_IMAGE . $path)) {
                 @mkdir(DIR_IMAGE . $path, 0777);
             }
         }
         if ($width_orig != $width || $height_orig != $height) {
             $image = new Image(DIR_IMAGE . $image_old);
             $image->resize($width, $height);
             $image->save(DIR_IMAGE . $image_new);
         } else {
             copy(DIR_IMAGE . $image_old, DIR_IMAGE . $image_new);
         }
     }
     $image_new = str_replace(' ', '%20', $image_new);
     // fix bug when attach image on email (gmail.com). it is automatic changing space " " to +
     if ($this->request->server['HTTPS']) {
         return $this->config->get('config_ssl') . 'image/' . $image_new;
     } else {
         return $this->config->get('config_url') . 'image/' . $image_new;
     }
 }
开发者ID:brunoxu,项目名称:mycncart,代码行数:37,代码来源:image.php


示例19: expressConfirm


//.........这里部分代码省略.........
         $this->data['voucher'] = '';
     }
     $this->data['reward_status'] = $points && $points_total && $this->config->get('reward_status');
     if (isset($this->request->post['reward'])) {
         $this->data['reward'] = $this->request->post['reward'];
     } elseif (isset($this->session->data['reward'])) {
         $this->data['reward'] = $this->session->data['reward'];
     } else {
         $this->data['reward'] = '';
     }
     $this->data['action'] = $this->url->link('payment/pp_express/expressConfirm', '', 'SSL');
     $products = $this->cart->getProducts();
     foreach ($products as $product) {
         $product_total = 0;
         foreach ($products as $product_2) {
             if ($product_2['product_id'] == $product['product_id']) {
                 $product_total += $product_2['quantity'];
             }
         }
         if ($product['minimum'] > $product_total) {
             $this->data['error_warning'] = sprintf($this->language->get('error_minimum'), $product['name'], $product['minimum']);
         }
         if ($product['image']) {
             $image = $this->model_tool_image->resize($product['image'], $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height'));
         } else {
             $image = '';
         }
         $option_data = array();
         foreach ($product['option'] as $option) {
             if ($option['type'] != 'file') {
                 $value = $option['option_value'];
             } else {
                 $filename = $this->encryption->decrypt($option['option_value']);
                 $value = utf8_substr($filename, 0, utf8_strrpos($filename, '.'));
             }
             $option_data[] = array('name' => $option['name'], 'value' => utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value);
         }
         // Display prices
         if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
             $price = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')));
         } else {
             $price = false;
         }
         // Display prices
         if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
             $total = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')) * $product['quantity']);
         } else {
             $total = false;
         }
         $profile_description = '';
         if ($product['recurring']) {
             $frequencies = array('day' => $this->language->get('text_day'), 'week' => $this->language->get('text_week'), 'semi_month' => $this->language->get('text_semi_month'), 'month' => $this->language->get('text_month'), 'year' => $this->language->get('text_year'));
             if ($product['recurring_trial']) {
                 $recurring_price = $this->currency->format($this->tax->calculate($product['recurring_trial_price'] * $product['quantity'], $product['tax_class_id'], $this->config->get('config_tax')));
                 $profile_description = sprintf($this->language->get('text_trial_description'), $recurring_price, $product['recurring_trial_cycle'], $frequencies[$product['recurring_trial_frequency']], $product['recurring_trial_duration']) . ' ';
             }
             $recurring_price = $this->currency->format($this->tax->calculate($product['recurring_price'] * $product['quantity'], $product['tax_class_id'], $this->config->get('config_tax')));
             if ($product['recurring_duration']) {
                 $profile_description .= sprintf($this->language->get('text_payment_description'), $recurring_price, $product['recurring_cycle'], $frequencies[$product['recurring_frequency']], $product['recurring_duration']);
             } else {
                 $profile_description .= sprintf($this->language->get('text_payment_until_canceled_description'), $recurring_price, $product['recurring_cycle'], $frequencies[$product['recurring_frequency']], $product['recurring_duration']);
             }
         }
         $this->data['products'][] = array('key' => $product['key'], 'thumb' => $image, 'name' => $product['name'], 'model' => $product['model'], 'option' => $option_data, 'quantity' => $product['quantity'], 'stock' => $product['stock'] ? true : !(!$this->config->get('config_stock_checkout') || $this->config->get('config_stock_warning')), 'reward' => $product['reward'] ? sprintf($this->language->get('text_points'), $product['reward']) : '', 'price' => $price, 'total' => $total, 'href' => $this->url->link('product/product', 'product_id=' . $product['product_id']), 'remove' => $this->url->link('checkout/cart', 'remove=' . $product['key']), 'recurring' => $prod 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP utf8_strspn函数代码示例发布时间:2022-05-23
下一篇:
PHP utf8_strrev函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap