本文整理汇总了PHP中Url::createUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::createUrl方法的具体用法?PHP Url::createUrl怎么用?PHP Url::createUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Url
的用法示例。
在下文中一共展示了Url::createUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
protected function index()
{
$this->load->helper('widgets');
$widgets = new NecoWidget($this->registry, $this->Route);
foreach ($widgets->getWidgets('column_left') as $widget) {
$settings = (array) unserialize($widget['settings']);
if ($settings['asyn']) {
$url = Url::createUrl("{$settings['route']}", $settings['params']);
$scripts[$widget['name']] = array('id' => $widget['name'], 'method' => 'ready', 'script' => "\$(document.createElement('div'))\n .attr({\n id:'" . $widget['name'] . "'\n })\n .html(makeWaiting())\n .load('" . $url . "')\n .appendTo('" . $settings['target'] . "');");
} else {
if (isset($settings['route'])) {
if ($this->browser->isMobile() && $settings['showonmobile'] || !$this->browser->isMobile() && $settings['showondesktop']) {
if ($settings['autoload']) {
$this->data['widgets'][] = $widget['name'];
}
$this->children[$widget['name']] = $settings['route'];
$this->widget[$widget['name']] = $widget;
}
}
}
}
$this->id = 'column_left';
if ($this->data['widgets']) {
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/common/column_left.tpl')) {
$this->template = $this->config->get('config_template') . '/common/column_left.tpl';
} else {
$this->template = 'choroni/common/column_left.tpl';
}
$this->render();
}
}
示例2: index
protected function index($widget = null)
{
if (isset($widget)) {
$this->data['settings'] = $settings = (array) unserialize($widget['settings']);
$this->data['widget_hook'] = $this->data['widgetName'] = $widget['name'];
}
$this->language->load('module/manufacturer');
if (isset($settings['title'])) {
$this->data['heading_title'] = $settings['title'];
} else {
$this->data['heading_title'] = $this->language->get('heading_title');
}
if (isset($this->request->get['manufacturer_id'])) {
$this->data['manufacturer_id'] = $this->request->get['manufacturer_id'];
} else {
$this->data['manufacturer_id'] = 0;
}
$this->load->model('store/manufacturer');
$this->data['manufacturers'] = array();
$results = $this->modelManufacturer->getManufacturers();
foreach ($results as $result) {
$this->data['manufacturers'][] = array('manufacturer_id' => $result['manufacturer_id'], 'name' => $result['name'], 'href' => Url::createUrl("store/manufacturer", array("manufacturer_id" => $result['manufacturer_id'])));
}
$this->loadAssets();
if ($scripts) {
$this->scripts = array_merge($this->scripts, $scripts);
}
$this->id = 'manufacturer';
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/module/manufacturer.tpl')) {
$this->template = $this->config->get('config_template') . '/module/manufacturer.tpl';
} else {
$this->template = 'choroni/module/manufacturer.tpl';
}
$this->render();
}
示例3: getCategories
protected function getCategories($parent_id, $current_path = '')
{
$output = '';
$results = $this->modelCategory->getCategories($parent_id);
foreach ($results as $result) {
if (!$current_path) {
$new_path = $result['category_id'];
} else {
$new_path = $current_path . '_' . $result['category_id'];
}
$output .= '<url>';
$output .= '<loc>' . str_replace('&', '&', Url::createUrl("store/category", array("path" => $new_path))) . '</loc>';
$output .= '<changefreq>weekly</changefreq>';
$output .= '<priority>0.7</priority>';
$output .= '</url>';
$products = $this->modelProduct->getProductsByCategoryId($result['category_id']);
foreach ($products as $product) {
$output .= '<url>';
$output .= '<loc>' . str_replace('&', '&', Url::createUrl("store/product", array("path" => $new_path, "product_id" => $product['product_id']))) . '</loc>';
$output .= '<changefreq>weekly</changefreq>';
$output .= '<priority>1.0</priority>';
$output .= '</url>';
}
$output .= $this->getCategories($result['category_id'], $new_path);
}
return $output;
}
示例4: getCategories
protected function getCategories($parent_id = 0)
{
$output = '';
$results = $this->modelCategory->getCategories($parent_id);
if ($results) {
$output .= '<ul class="nt-dd2">';
foreach ($results as $result) {
$childrens = $this->modelCategory->getCategories($result['category_id']);
if ($childrens) {
$output .= '<li class="hasCategories">';
} else {
$output .= '<li>';
}
if ($this->category_id == $result['category_id']) {
$output .= '<a href="' . Url::createUrl("store/category", array("path" => $result['category_id'])) . '"><b>' . $result['name'] . '</b></a>';
} else {
$output .= '<a href="' . Url::createUrl("store/category", array("path" => $result['category_id'])) . '">' . $result['name'] . '</a>';
}
if ($childrens) {
$output .= '<ul>';
foreach ($childrens as $child) {
$output .= '<li><a href="' . Url::createUrl("store/category", array("path" => $result['category_id'] . '_' . $child['category_id'])) . '" title="' . $child['name'] . '">' . $child['name'] . '</a></li>';
}
$output .= '</ul>';
}
$output .= '</li>';
}
$output .= '</ul>';
}
return $output;
}
示例5: index
protected function index($widget = null)
{
if (isset($widget)) {
$this->data['settings'] = $settings = (array) unserialize($widget['settings']);
$this->data['widget_hook'] = $this->data['widgetName'] = $widget['name'];
}
$this->language->load('module/page');
if (isset($settings['title'])) {
$this->data['heading_title'] = $settings['title'];
} else {
$this->data['heading_title'] = $this->language->get('heading_title');
}
$this->load->model('content/page');
$this->data['pages'] = array();
foreach ($this->modelPage->getAll() as $result) {
$this->data['pages'][] = array('title' => $result['title'], 'href' => Url::createUrl("content/page", array("page_id" => $result['post_id'])));
}
$this->data['contact'] = Url::createUrl("page/contact");
$this->data['sitemap'] = Url::createUrl("page/sitemap");
$this->loadAssets();
if ($scripts) {
$this->scripts = array_merge($this->scripts, $scripts);
}
$this->id = 'page';
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/module/page.tpl')) {
$this->template = $this->config->get('config_template') . '/module/page.tpl';
} else {
$this->template = 'choroni/module/page.tpl';
}
$this->render();
}
示例6: redirect
/**
* 重定向.
*
* @access protected
* @param string $route 路由.
* @param array $params 参数, 默认 [].
*/
protected function redirect($route, array $params = [])
{
$url = Url::createUrl($route, $params);
if (!headers_sent()) {
header('Location: ' . $url);
exit;
}
exit('<meta http-equiv="refresh" content="0" url="' . $url . '" />');
}
示例7: loadWidgets
protected function loadWidgets()
{
$this->load->helper('widgets');
$widgets = new NecoWidget($this->registry, $this->Route);
foreach ($widgets->getWidgets('main') as $widget) {
$settings = (array) unserialize($widget['settings']);
if ($settings['asyn']) {
$url = Url::createUrl("{$settings['route']}", $settings['params']);
$scripts[$widget['name']] = array('id' => $widget['name'], 'method' => 'ready', 'script' => "\$(document.createElement('div'))\r\n .attr({\r\n id:'" . $widget['name'] . "'\r\n })\r\n .html(makeWaiting())\r\n .load('" . $url . "')\r\n .appendTo('" . $settings['target'] . "');");
} else {
if (isset($settings['route'])) {
if ($this->browser->isMobile() && $settings['showonmobile'] || !$this->browser->isMobile() && $settings['showondesktop']) {
if ($settings['autoload']) {
$this->data['widgets'][] = $widget['name'];
}
$this->children[$widget['name']] = $settings['route'];
$this->widget[$widget['name']] = $widget;
}
}
}
}
foreach ($widgets->getWidgets('featuredContent') as $widget) {
$settings = (array) unserialize($widget['settings']);
if ($settings['asyn']) {
$url = Url::createUrl("{$settings['route']}", $settings['params']);
$scripts[$widget['name']] = array('id' => $widget['name'], 'method' => 'ready', 'script' => "\$(document.createElement('div'))\r\n .attr({\r\n id:'" . $widget['name'] . "'\r\n })\r\n .html(makeWaiting())\r\n .load('" . $url . "')\r\n .appendTo('" . $settings['target'] . "');");
} else {
if (isset($settings['route'])) {
if ($this->browser->isMobile() && $settings['showonmobile'] || !$this->browser->isMobile() && $settings['showondesktop']) {
if ($settings['autoload']) {
$this->data['featuredWidgets'][] = $widget['name'];
}
$this->children[$widget['name']] = $settings['route'];
$this->widget[$widget['name']] = $widget;
}
}
}
}
foreach ($widgets->getWidgets('featuredFooter') as $widget) {
$settings = (array) unserialize($widget['settings']);
if ($settings['asyn']) {
$url = Url::createUrl("{$settings['route']}", $settings['params']);
$scripts[$widget['name']] = array('id' => $widget['name'], 'method' => 'ready', 'script' => "\$(document.createElement('div'))\r\n .attr({\r\n id:'" . $widget['name'] . "'\r\n })\r\n .html(makeWaiting())\r\n .load('" . $url . "')\r\n .appendTo('" . $settings['target'] . "');");
} else {
if (isset($settings['route'])) {
if ($this->browser->isMobile() && $settings['showonmobile'] || !$this->browser->isMobile() && $settings['showondesktop']) {
if ($settings['autoload']) {
$this->data['featuredFooterWidgets'][] = $widget['name'];
}
$this->children[$widget['name']] = $settings['route'];
$this->widget[$widget['name']] = $widget;
}
}
}
}
}
示例8: index
public function index()
{
$this->language->load('page/deprecated');
$this->document->title = $this->data['heading_title'] = $this->language->get('heading_title');
$this->document->breadcrumbs = array();
$this->document->breadcrumbs[] = array('href' => Url::createUrl("common/home"), 'text' => $this->language->get('text_home'), 'separator' => false);
$this->document->breadcrumbs[] = array('href' => Url::createUrl("page/deprecated"), 'text' => $this->language->get('heading_title'), 'separator' => $this->language->get('text_separator'));
$this->data['breadcrumbs'] = $this->document->breadcrumbs;
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/page/deprecated.tpl')) {
$this->template = $this->config->get('config_template') . '/page/deprecated.tpl';
} else {
$this->template = 'choroni/page/deprecated.tpl';
}
$this->children[] = 'common/header2';
$this->children[] = 'common/footer2';
$this->response->setOutput($this->render(true), $this->config->get('config_compression'));
}
示例9: index
public function index()
{
if ($this->customer->isLogged()) {
$this->redirect(Url::createUrl("account/account"));
}
if (!$this->customer->isLogged() && (!$this->config->get('social_twitter_consumer_key') || !$this->config->get('social_twitter_consumer_secret'))) {
$this->redirect(Url::createUrl("account/login", array("error" => "No se pudo iniciar sesion utilizando Twitter, por favor intente con otro servicio")));
}
$this->load->library('twitter_sdk/twitteroauth');
if ($this->session->has("oauth_token") && $this->session->has("oauth_token_secret") && $this->request->hasQuery("oauth_verifier")) {
$twitter = new TwitterOAuth($this->config->get('social_twitter_consumer_key'), $this->config->get('social_twitter_consumer_secret'), $this->session->get("oauth_token"), $this->session->get("oauth_token_secret"));
$access_token = $twitter->getAccessToken($this->request->getQuery("oauth_verifier"));
$user_info = $twitter->get('account/verify_credentials');
$data = array("oauth_id" => $user_info->id, "company" => $user_info->name, "oauth_provider" => 'twitter', "oauth_token" => $this->session->get("oauth_token"), "oauth_token_secret" => $this->session->get("oauth_token_secret"));
$result = $this->modelCustomer->getCustomerByTwitter($data);
if ($result) {
if ($this->customer->loginWithTwitter($data)) {
if (!$result['email']) {
$this->redirect(Url::createUrl("account/complete_profile"));
} elseif ($this->session->has('redirect')) {
$this->redirect(str_replace('&', '&', $this->session->get('redirect')));
} else {
$this->redirect(Url::createUrl("common/home"));
}
} else {
$this->redirect(Url::createUrl("account/login", array("error" => "No se pudo iniciar sesion utilizando Twitter, por favor intente con otro servicio")));
}
} elseif ($this->modelCustomer->addCustomerFromTwitter($data)) {
if ($this->customer->loginWithTwitter($data)) {
$this->redirect(Url::createUrl("account/complete_profile"));
} else {
$this->redirect(Url::createUrl("account/login", array("error" => "No se pudo iniciar sesion utilizando Twitter, por favor intente con otro servicio")));
}
}
} else {
$twitter = new TwitterOAuth($this->config->get('social_twitter_consumer_key'), $this->config->get('social_twitter_consumer_secret'));
$request_token = $twitter->getRequestToken(Url::createUrl("api/twitter"));
$this->session->set("oauth_token", $request_token['oauth_token']);
$this->session->set("oauth_token_secret", $request_token['oauth_token_secret']);
if ($twitter->http_code == '200') {
$this->redirect($twitter->getAuthorizeURL($request_token['oauth_token']));
} else {
$this->redirect(Url::createUrl("account/login", array("error" => "No se pudo iniciar sesion utilizando Twitter, por favor intente con otro servicio")));
}
}
}
示例10: index
/**
* ControllerCommonHeader::index()
*
* @return
*/
protected function index()
{
if ($this->request->hasQuery('hl')) {
$this->session->set('language', $this->request->getQuery('hl'));
if ($this->session->has('redirect')) {
$this->redirect($this->session->get('redirect'));
} else {
$this->redirect(Url::createAdminUrl('common/home'));
}
}
$this->load->language('common/header');
$this->data['title'] = $this->document->title . " | NecoTienda";
$this->data['breadcrumbs'] = $this->document->breadcrumbs;
$this->data['heading_title'] = $this->language->get('heading_title');
$this->load->library('browser');
$browser = new Browser();
if ($browser->getBrowser() == 'Internet Explorer' && $browser->getVersion() <= 8) {
$this->redirect(Url::createUrl("page/deprecated", null, 'NONSSL', HTTP_CATALOG));
}
if (!$this->user->validSession()) {
$this->data['logged'] = '';
$this->data['home'] = Url::createAdminUrl('common/login');
} else {
$this->data['logged'] = sprintf($this->language->get('text_logged'), $this->user->getUserName());
if ($this->session->has('success')) {
$this->data['success'] = $this->session->get('success');
$this->session->clear('success');
}
if ($this->session->has('error')) {
$this->data['error'] = $this->session->get('error');
$this->session->clear('error');
}
$this->load->auto("setting/store");
$this->data['stores'] = $this->modelStore->getAll();
}
$this->loadCss();
$this->id = 'header';
$this->template = 'common/header.tpl';
$this->render();
}
示例11: run
public function run()
{
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "stat s \r\n LEFT JOIN " . DB_PREFIX . "customer c ON (s.customer_id=c.customer_id) \r\n LEFT JOIN " . DB_PREFIX . "product p ON (s.object_id=p.product_id) \r\n LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id=pd.product_id) \r\n WHERE DAY(s.date_added) = '" . $this->db->escape(date('d')) . "' \r\n AND MONTH(s.date_added) = '" . $this->db->escape(date('m')) . "'\r\n AND YEAR(s.date_added) = '" . $this->db->escape(date('Y')) . "'\r\n AND s.object_type = 'product'\r\n AND s.status = 1\r\n AND s.customer_id <> 0\r\n AND pd.language_id = 1\r\n GROUP BY s.customer_id\r\n LIMIT 40");
if ($query->num_rows && (int) $this->config->get('marketing_email_recommended_products')) {
$this->load->library('tax');
$this->load->library('currency');
$this->load->library('image');
$this->load->library('url');
$this->tax = new Tax($this->registry);
$this->currency = new Currency($this->registry);
$products = array();
foreach ($query->rows as $product) {
$image = !empty($product['image']) ? $product['image'] : 'no_image.jpg';
$price = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')), '', '', false);
$products[] = array('product_id' => $product['product_id'], 'name' => $product['name'], 'image' => NTImage::resizeAndSave($image, 150, 150), 'model' => $product['model'], 'href' => Url::createUrl('store/product', array('product_id' => $product['product_id'])));
}
$params = array('job' => 'send_recommended_products', 'newsletter_id' => (int) $this->config->get('marketing_email_recommended_products'));
$this->load->library('task');
$task = new Task($this->registry);
$task->object_id = (int) $this->config->get('marketing_email_recommended_products');
$task->object_type = 'newsletter';
$task->task = 'recommended_products';
$task->type = 'send';
$task->time_exec = date('Y-m-d') . ' 08:00:00';
$task->params = $params;
$task->time_interval = "";
$task->time_last_exec = "";
$task->run_once = true;
$task->status = 1;
$task->date_start_exec = date('Y-m-d') . ' 08:00:00';
$task->date_end_exec = date('Y-m-d') . ' 23:00:00';
foreach ($query->rows as $customer) {
$params = array('customer_id' => $customer['customer_id'], 'fullname' => $customer['firstname'] . " " . $customer['lastname'], 'company' => $customer['company'], 'rif' => $customer['rif'], 'telephone' => $customer['telephone'], 'email' => $customer['email'], 'products' => $products);
$queue = array("params" => $params, "status" => 1, "time_exec" => date('Y-m-d') . ' 08:00:00');
$task->addQueue($queue);
$this->db->query("UPDATE " . DB_PREFIX . "stat SET status = 0 \r\n WHERE customer_id = '" . (int) $product['customer_id'] . "'\r\n AND DAY(date_added) = '" . $this->db->escape(date('d')) . "' \r\n AND MONTH(date_added) = '" . $this->db->escape(date('m')) . "'\r\n AND YEAR(date_added) = '" . $this->db->escape(date('Y')) . "'");
}
$task->createSendTask();
}
}
示例12: prepareTemplate
private function prepareTemplate($newsletter)
{
if (!$newsletter) {
return false;
}
$this->load->library('url');
$this->load->library('BarcodeQR');
$this->load->library('Barcode39');
$qr = new BarcodeQR();
$barcode = new Barcode39(C_CODE);
$qrStore = "cache/" . $this->escape($this->config->get('config_owner')) . '.png';
$eanStore = "cache/" . $this->escape($this->config->get('config_owner')) . "_barcode_39.gif";
if (!file_exists(DIR_IMAGE . $qrStore)) {
$qr->url(HTTP_HOME);
$qr->draw(150, DIR_IMAGE . $qrStore);
}
if (!file_exists(DIR_IMAGE . $eanStore)) {
$barcode->draw(DIR_IMAGE . $eanStore);
}
$newsletter = str_replace("%7B", "{", $newsletter);
$newsletter = str_replace("%7D", "}", $newsletter);
$newsletter = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $newsletter);
$newsletter = str_replace("{%store_url%}", HTTP_HOME, $newsletter);
$newsletter = str_replace("{%url_login%}", Url::createUrl("account/login"), $newsletter);
$newsletter = str_replace("{%store_owner%}", $this->config->get('config_owner'), $newsletter);
$newsletter = str_replace("{%store_name%}", $this->config->get('config_name'), $newsletter);
$newsletter = str_replace("{%store_rif%}", $this->config->get('config_rif'), $newsletter);
$newsletter = str_replace("{%store_email%}", $this->config->get('config_email'), $newsletter);
$newsletter = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $newsletter);
$newsletter = str_replace("{%store_address%}", $this->config->get('config_address'), $newsletter);
/*
$newsletter = str_replace("{%products%}",$product_html,$newsletter);
*/
$newsletter = str_replace("{%date_added%}", date('d-m-Y h:i A'), $newsletter);
$newsletter = str_replace("{%ip%}", $_SERVER['REMOTE_ADDR'], $newsletter);
$newsletter = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $newsletter);
$newsletter = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="NT Code" />', $newsletter);
$newsletter .= "<p style=\"text-align:center\">Powered By Necotienda® " . date('Y') . "</p>";
return html_entity_decode(htmlspecialchars_decode($newsletter));
}
示例13: index
protected function index()
{
$this->language->load('common/footer');
$this->load->library('user');
$this->data['config_js_security'] = $this->config->get('config_js_security');
$this->data['text_powered_by'] = sprintf($this->language->get('text_powered_by'), $this->config->get('config_name'));
$this->id = 'footer';
$this->load->helper('widgets');
$widgets = new NecoWidget($this->registry, $this->Route);
foreach ($widgets->getWidgets('footer') as $widget) {
$settings = (array) unserialize($widget['settings']);
if ($settings['asyn']) {
$url = Url::createUrl("{$settings['route']}", $settings['params']);
$scripts[$widget['name']] = array('id' => $widget['name'], 'method' => 'ready', 'script' => "\$(document.createElement('div'))\r\n .attr({\r\n id:'" . $widget['name'] . "'\r\n })\r\n .html(makeWaiting())\r\n .load('" . $url . "')\r\n .appendTo('" . $settings['target'] . "');");
} else {
if (isset($settings['route'])) {
if ($this->browser->isMobile() && $settings['showonmobile'] || !$this->browser->isMobile() && $settings['showondesktop']) {
if ($settings['autoload']) {
$this->data['widgets'][] = $widget['name'];
}
$this->children[$widget['name']] = $settings['route'];
$this->widget[$widget['name']] = $widget;
}
}
}
}
// SCRIPTS
if ($this->config->get('config_seo_url')) {
$urlBase = HTTP_HOME . 'buscar/';
} else {
$urlBase = HTTP_HOME . 'index.php?r=store/search&q=';
}
$scripts[] = array('id' => 'search', 'method' => 'function', 'script' => "function moduleSearch(keyword) {\r\n var url = '" . $urlBase . "';\r\n var form = \$(keyword).closest('form');\r\n var category = \$('#'+ \$(keyword).attr('id').replace('Keyword','Category')).val();\r\n var store = \$('#'+ \$(keyword).attr('id').replace('Keyword','Store')).val();\r\n var zone = \$('#'+ \$(keyword).attr('id').replace('Keyword','Zone')).val();\r\n \r\n url += \$(keyword).val()\r\n .replace(/_/g,'-')\r\n .replace('+','-')\r\n .replace(/\\s+/g,'-');\r\n \r\n if (typeof category != 'undefined') {\r\n url += '_Cat_'+ category\r\n .replace(/_/g,'-')\r\n .replace('+','-')\r\n .replace(/\\s+/g,'-');\r\n }\r\n \r\n if (typeof zone != 'undefined') {\r\n url += '_Estado_'+ zone\r\n .replace(/_/g,'-')\r\n .replace('+','-')\r\n .replace(/\\s+/g,'-');\r\n }\r\n \r\n if (typeof store != 'undefined') {\r\n url += '_Tienda_'+ store\r\n .replace(/_/g,'-')\r\n .replace('+','-')\r\n .replace(/\\s+/g,'-');\r\n }\r\n \r\n window.location = url;\r\n }");
$this->scripts = array_merge($this->scripts, $scripts);
$r_output = $w_output = $s_output = $f_output = "";
$script_keys = array();
foreach ($this->scripts as $k => $script) {
if (in_array($script['id'], $script_keys)) {
continue;
}
$script_keys[$k] = $script['id'];
switch ($script['method']) {
case 'ready':
default:
$r_output .= $script['script'];
break;
case 'window':
$w_output .= $script['script'];
break;
case 'function':
$f_output .= $script['script'];
break;
}
}
$jspath = defined("CDN") ? CDN_JS : HTTP_THEME_JS;
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/common/header.tpl')) {
$jspath = str_replace("%theme%", $this->config->get('config_template'), $jspath);
$jsFolder = str_replace("%theme%", $this->config->get('config_template'), DIR_THEME_JS);
} else {
$jspath = str_replace("%theme%", "choroni", $jspath);
$jsFolder = str_replace("%theme%", "choroni", DIR_THEME_JS);
}
if (file_exists($jsFolder . str_replace('/', '', strtolower($this->Route) . '.js'))) {
$javascripts[] = $jspath . str_replace('/', '', strtolower($this->Route) . '.js');
}
if (count($javascripts)) {
$this->javascripts = array_merge($this->javascripts, $javascripts);
}
foreach ($this->javascripts as $key => $js) {
$f_output .= file_get_contents($js);
unset($this->javascripts[$key]);
}
if (file_exists(str_replace('%theme%', $this->config->get('config_template'), DIR_THEME_JS) . 'theme.js')) {
$f_output .= file_get_contents(str_replace('%theme%', $this->config->get('config_template'), DIR_THEME_JS) . 'theme.js');
}
$this->data['scripts'] = $s_output;
$this->data['scripts'] .= $r_output ? "<script> \n \$(function(){" . $r_output . "}); </script>" : "";
$this->data['scripts'] .= $w_output ? "<script> \n (function(\$){ \$(window).load(function(){ " . $w_output . " }); })(jQuery);</script>" : "";
$this->data['scripts'] .= $f_output ? "<script> \n " . $f_output . " </script>" : "";
$jspath = defined("CDN_JS") ? CDN_JS : HTTP_JS;
// javascript files
if ($this->user->getId()) {
$javascripts[] = HTTP_ADMIN . "js/front/admin.js";
if ($this->request->hasQuery('theme_editor') && $this->request->hasQuery('theme_id') && (int) $this->request->getQuery('theme_id') > 0) {
$javascripts[] = $jspath . "vendor/jquery-ui.min.js";
$javascripts[] = $jspath . "necojs/neco.css.js";
$javascripts[] = $jspath . "necojs/neco.colorpicker.js";
$javascripts[] = HTTP_ADMIN . "js/front/theme_editor.js";
}
}
if ($javascripts) {
$this->data['javascripts'] = $this->javascripts = array_merge($this->javascripts, $javascripts);
}
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/common/footer.tpl')) {
$this->template = $this->config->get('config_template') . '/common/footer.tpl';
} else {
$this->template = 'choroni/common/footer.tpl';
}
$this->data['google_analytics_code'] = $this->config->get('google_analytics_code');
$this->data['live_client_id'] = $this->config->get('social_live_client_id');
//.........这里部分代码省略.........
示例14: index
protected function index()
{
$this->language->load('payment/pp_standard');
if (!$this->config->get('pp_standard_test')) {
$this->data['action'] = 'https://www.paypal.com/cgi-bin/webscr';
} else {
$this->data['action'] = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
}
$this->load->library('image');
$this->data['Image'] = new NTImage();
$this->load->model('checkout/order');
if ($this->request->hasQuery('order_id')) {
$order_id = $this->request->getQuery('order_id');
} elseif ($this->session->has('order_id')) {
$order_id = $this->session->get('order_id');
} else {
$order_id = 0;
}
$order_info = $this->modelOrder->getOrder($order_id);
$this->data['business'] = $this->config->get('pp_standard_email');
$this->data['item_name'] = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8');
$this->data['currency_code'] = $order_info['currency'];
$this->data['amount'] = $this->currency->format($order_info['total'], $order_info['currency'], $order_info['value'], FALSE);
$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['notify_url'] = Url::createUrl("payment/pp_standard/callback");
$this->data['email'] = $order_info['email'];
$this->data['invoice'] = $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->get('language');
$this->data['return'] = Url::createUrl("account/order");
$this->data['cancel_return'] = Url::createUrl("account/payment/register", array('order_id' => $order_id));
if (!$this->config->get('pp_standard_transaction')) {
$this->data['paymentaction'] = 'authorization';
} else {
$this->data['paymentaction'] = 'sale';
}
$this->load->library('encryption');
$encryption = new Encryption($this->config->get('config_encryption'));
$this->data['custom'] = $encryption->encrypt($order_id);
$this->data['button_pay'] = 'PayPal Standard';
$this->load->model("marketing/newsletter");
$result = $this->modelNewsletter->getById($this->config->get('pp_standard_newsletter_id'));
$this->data['instructions'] = html_entity_decode($result['htmlbody']);
// style files
$csspath = defined("CDN") ? CDN . CSS : HTTP_CSS;
$styles[] = array('media' => 'all', 'href' => $csspath . 'jquery-ui/jquery-ui.min.css');
$styles[] = array('media' => 'all', 'href' => $csspath . 'neco.form.css');
if (count($styles)) {
$this->data['styles'] = $this->styles = array_merge($this->styles, $styles);
}
$this->id = 'payment';
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/payment/pp_standard.tpl')) {
$this->template = $this->config->get('config_template') . '/payment/pp_standard.tpl';
} else {
$this->template = 'choroni/payment/pp_standard.tpl';
}
$this->render();
}
示例15: login
public function login($fb)
{
if ($this->customer->isLogged()) {
$this->redirect(Url::createUrl("account/account"));
}
if (!$this->customer->isLogged() && (!$this->config->get('social_facebook_app_id') || !$this->config->get('social_facebook_app_secret'))) {
$this->redirect(Url::createUrl("account/login", array("error" => "No se pudo iniciar sesion utilizando Facebook, por favor intente con otro servicio")));
}
echo __LINE__ . '<br />';
if ($fb) {
/**
$graphObject = object(Facebook\GraphObject) {
["backingData":protected] => array(12) {
["id"]=> string(10) "1518317082"
["birthday"]=> string(10) "12/20/1985"
["email"]=> string(23) "yosietserga@hotmail.com"
["first_name"]=> string(6) "Yosiet"
["gender"]=> string(4) "male"
["last_name"]=> string(5) "Serga"
["link"]=> string(34) "http://www.facebook.com/1518317082"
["locale"]=> string(5) "es_ES"
["name"]=> string(12) "Yosiet Serga"
["timezone"]=> float(-4.5)
["updated_time"]=> string(24) "2013-11-08T00:36:26+0000"
["verified"]=> bool(true)
}
}
* */
echo __LINE__ . '<br />';
$data = array('email' => $fb->getEmail(), 'company' => $fb->getName(), 'firstname' => $fb->getFirstName(), 'lastname' => $fb->getLastName(), 'oauth_provider' => 'facebook', 'oauth_id' => $fb->getId());
$this->load->auto('account/customer');
echo __LINE__ . '<br />';
$result = $this->modelCustomer->getCustomerByEmail($fb->getEmail());
echo __LINE__ . '<br />';
if ($result) {
echo __LINE__ . '<br />';
if ($this->customer->loginWithFacebook($data)) {
echo __LINE__ . '<br />';
if ($this->session->has('redirect')) {
$this->redirect(str_replace('&', '&', $this->session->get('redirect')));
} else {
$this->redirect(Url::createUrl("common/home"));
}
} else {
$this->redirect(Url::createUrl("account/login", array("error" => "No se pudo iniciar sesion utilizando Facebook, por favor intente con otro servicio")));
}
} elseif ($this->modelCustomer->addCustomer($data)) {
if ($this->customer->loginWithFacebook($data)) {
if ($this->session->has('redirect')) {
$this->redirect(str_replace('&', '&', $this->session->get('redirect')));
} else {
$this->redirect(Url::createUrl("common/home"));
}
} else {
$this->redirect(Url::createUrl("account/login", array("error" => "No se pudo iniciar sesion utilizando Facebook, por favor intente con otro servicio")));
}
}
} else {
}
}