本文整理汇总了PHP中Varien_Object::getUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Object::getUrl方法的具体用法?PHP Varien_Object::getUrl怎么用?PHP Varien_Object::getUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Object
的用法示例。
在下文中一共展示了Varien_Object::getUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postAction
/**
* Post a comment action
*/
public function postAction()
{
$challenge = $this->getRequest()->getPost('recaptcha_challenge_field');
$field = $this->getRequest()->getPost('recaptcha_response_field');
$post = $this->getPost();
$data = new Varien_Object($this->getRequest()->getPost());
try {
Mage::getSingleton('wordpress/session')->setPostCommentData($post, $data->getAuthor(), $data->getEmail(), $data->getUrl(), $data->getComment());
if (Mage::helper('wordpress/recaptcha')->isEnabled()) {
if (!Mage::helper('wordpress/recaptcha')->isValidValue($challenge, $field, true)) {
throw new Exception($this->getCaptchaErrorMessage());
}
}
$comment = $post->postComment($data->getAuthor(), $data->getEmail(), $data->getUrl(), $data->getComment());
if (!$comment) {
throw new Exception($this->getCommentErrorMessage());
}
Mage::getSingleton('wordpress/session')->removePostCommentData($post);
Mage::getSingleton('core/session')->addSuccess($this->__($this->getCommentSuccessMessage()));
}
catch (Exception $e) {
Mage::getSingleton('core/session')->addError($this->__($e->getMessage()));
}
$this->_redirectUrl($post->getPermalink());
}
示例2: render
/**
* Renders grid column
*
* @param Varien_Object $row
* @return string
*/
public function render(Varien_Object $row)
{
$readDetailsHtml = $row->getUrl() ? '<a target="_blank" href="' . $row->getUrl() . '">' . Mage::helper('Mage_AdminNotification_Helper_Data')->__('Read Details') . '</a> | ' : '';
$markAsReadHtml = !$row->getIsRead() ? '<a href="' . $this->getUrl('*/*/markAsRead/', array('_current' => true, 'id' => $row->getId())) . '">' . Mage::helper('Mage_AdminNotification_Helper_Data')->__('Mark as Read') . '</a> | ' : '';
$encodedUrl = $this->helper('Mage_Core_Helper_Url')->getEncodedUrl();
return sprintf('%s%s<a href="%s" onClick="deleteConfirm(\'%s\', this.href); return false;">%s</a>', $readDetailsHtml, $markAsReadHtml, $this->getUrl('*/*/remove/', array('_current' => true, 'id' => $row->getId(), Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $encodedUrl)), Mage::helper('Mage_AdminNotification_Helper_Data')->__('Are you sure?'), Mage::helper('Mage_AdminNotification_Helper_Data')->__('Remove'));
}
示例3: render
/**
* Renders grid column
*
* @param Varien_Object $row
* @return string
*/
public function render(Varien_Object $row)
{
if (!$row->getIsRead()) {
return sprintf('<a target="_blank" href="%s">%s</a> | <a href="%s">%s</a> | <a href="%s" onClick="deleteConfirm(\'%s\',this.href); return false;">%s</a>', $row->getUrl(), AO::helper('adminnotification')->__('Read Details'), $this->getUrl('*/*/markAsRead/', array('_current' => true, 'id' => $row->getId())), AO::helper('adminnotification')->__('Mark as Read'), $this->getUrl('*/*/remove/', array('_current' => true, 'id' => $row->getId())), AO::helper('adminnotification')->__('Are you sure?'), AO::helper('adminnotification')->__('Remove'));
} else {
return sprintf('<a target="_blank" href="%s">%s</a> | <a href="%s" onClick="deleteConfirm(\'%s\',this.href); return false;">%s</a>', $row->getUrl(), AO::helper('adminnotification')->__('Read Details'), $this->getUrl('*/*/remove/', array('_current' => true, 'id' => $row->getId())), AO::helper('adminnotification')->__('Are you sure?'), AO::helper('adminnotification')->__('Remove'));
}
}
示例4: _prepareForm
protected function _prepareForm()
{
$form = new Varien_Data_Form();
if (Mage::registry('gomage_feed')) {
$item = Mage::registry('gomage_feed');
} else {
$item = new Varien_Object();
}
$this->setForm($form);
$fieldset = $form->addFieldset('main_fieldset', array('legend' => $this->__('Item information')));
$headerBar = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array('label' => Mage::helper('catalog')->__('Feed Pro Help'), 'class' => 'go', 'id' => 'feed_pro_help', 'onclick' => 'window.open(\'http://www.gomage.com/faq/extensions/feed-pro\')'));
$fieldset->setHeaderBar($headerBar->toHtml());
$fieldset->addField('type', 'hidden', array('name' => 'type'));
$fieldset->addField('name', 'text', array('name' => 'name', 'label' => $this->__('Name'), 'title' => $this->__('Name'), 'required' => true, 'note' => $this->__('e.g. "Google Base", "Yahoo! Store"...')));
if ($item->getId() && ($url = $item->getUrl())) {
$fieldset->addField('comments', 'note', array('label' => $this->__('Access Url'), 'title' => $this->__('Access Url'), 'text' => '<a href="' . $url . '" target="_blank">' . $url . '</a>'));
}
$fieldset->addField('filename', 'text', array('name' => 'filename', 'label' => $this->__('Filename'), 'title' => $this->__('Filename'), 'required' => false, 'note' => $this->__('e.g. "productfeed.csv", "productfeed.xml"...')));
$fieldset->addField('store_id', 'select', array('label' => $this->__('Store View'), 'required' => true, 'name' => 'store_id', 'values' => Mage::getModel('gomage_feed/adminhtml_system_config_source_store')->getStoreValuesForForm()));
if (!$item->getType() && $this->getRequest()->getParam('type')) {
$item->setType($this->getRequest()->getParam('type'));
}
$form->setValues($item->getData());
return parent::_prepareForm();
}
示例5: render
public function render(Varien_Object $row)
{
$url = $row->getUrl();
if ($url) {
return '<a href="' . $url . '" target="_blank">' . $row->getFilenameWithExt() . '</a>';
}
return $row->getFilenameWithExt();
}
示例6: logoutRedirect
/**
* Redirects to custom url after logout if set in system > configuration > customer > startup
*
* @param Varien_Event_Observer $observer
* @return $this
*/
public function logoutRedirect(Varien_Event_Observer $observer)
{
if (!Mage::getStoreConfigFlag('customer/startup/redirect_logout')) {
return $this;
}
$transportObj = new Varien_Object(array('url' => Mage::getStoreConfig('customer/startup/redirect_logout_url'), 'code' => 302));
Mage::dispatchEvent('ambimax_logoutredirect', array('data' => $transportObj));
/** @var Mage_Customer_AccountController $controller */
$controller = $observer->getControllerAction();
$controller->getResponse()->setRedirect($transportObj->getUrl(), $transportObj->getCode());
}
示例7: render
/**
* Render information about menu item
*
* @param Varien_Object $row
* @return string
*/
public function render(Varien_Object $row)
{
$helper = Mage::helper('menu');
switch ($row->getType()) {
case VF_CustomMenu_Model_Resource_Menu_Attribute_Source_Type::LINK_INTERNAL:
return '<strong>' . $helper->__('Path') . ':</strong> ' . $row->getUrl();
break;
case VF_CustomMenu_Model_Resource_Menu_Attribute_Source_Type::LINK_EXTERNAL:
return '<strong>' . $helper->__('Link') . ':</strong> ' . $row->getUrl();
break;
case VF_CustomMenu_Model_Resource_Menu_Attribute_Source_Type::CATEGORY:
return '<strong>' . $helper->__('Category') . ':</strong> ' . Mage::getModel('catalog/category')->load($row->getDefaultCategory(), array('name'))->getName() . ' <strong>' . $helper->__('Show Children') . ':</strong> ' . ($row->getShowChildren() ? $helper->__('Yes') : $helper->__('No')) . ($row->getUrl() ? ' <strong>' . $helper->__('Path') . ':</strong> ' . $row->getUrl() : '');
break;
case VF_CustomMenu_Model_Resource_Menu_Attribute_Source_Type::ATTRIBUTE:
return '<strong>' . $helper->__('Attribute code') . ':</strong> ' . $row->getSourceAttribute() . ' <strong>' . $helper->__('Category') . ':</strong> ' . Mage::getModel('catalog/category')->load($row->getDefaultCategory(), array('name'))->getName();
break;
default:
return '';
}
}
示例8: download
public function download(Varien_Object $connectionInfo, $target)
{
$url = $connectionInfo->getUrl();
if (!$url) {
Mage::throwException($this->_getLog()->__("No valid URL given: %s", $url));
}
$this->_log($this->_getLog()->__("Downloading file %s from %s, to %s", basename($url), $url, $target));
$targetInfo = pathinfo($target);
$filename = isset($targetInfo['extension']) ? basename($target) : basename(parse_url($url, PHP_URL_PATH));
$path = $this->_getTargetPath(dirname($target), $filename);
$fp = fopen($path, 'w+');
//This is the file where we save the information
$cookie = tempnam(Mage::getBaseDir('tmp'), "CURLCOOKIE");
$ch = curl_init($url);
//Here is the file we are downloading, replace spaces with %20
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.7.3) Gecko/20041001 Firefox/0.10.1");
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_ENCODING, "");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_exec($ch);
$response = curl_getinfo($ch);
curl_close($ch);
fclose($fp);
if ($response['http_code'] == 301 || $response['http_code'] == 302) {
if ($headers = get_headers($response['url'])) {
foreach ($headers as $value) {
if (substr(strtolower($value), 0, 9) == "location:") {
$connectionInfo->setUrl(trim(substr($value, 9, strlen($value))));
Mage::throwException($this->_getLog()->__("Retrying with forwarded URL: %s", $connectionInfo->getUrl()));
return $this->download($connectionInfo, $target);
}
}
}
}
return null;
}
示例9: render
public function render(Varien_Object $row)
{
if (!Mage::getModel('magenotification/magenotification')->is_existedUrl($row->getUrl())) {
return parent::render($row);
}
$read_url = $this->getUrl('magenotification/adminhtml_magenotification/readdetail', array('id' => $row->getId()));
if (!$row->getIsRead()) {
return sprintf('<a target="_blank" href="%s">%s</a> | <a href="%s">%s</a> | <a href="%s" onClick="deleteConfirm(\'%s\',this.href); return false;">%s</a>', $read_url, Mage::helper('adminnotification')->__('Read Details'), $this->getUrl('*/*/markAsRead/', array('_current' => true, 'id' => $row->getId())), Mage::helper('adminnotification')->__('Mark as Read'), $this->getUrl('*/*/remove/', array('_current' => true, 'id' => $row->getId())), Mage::helper('adminnotification')->__('Are you sure?'), Mage::helper('adminnotification')->__('Remove'));
} else {
return sprintf('<a target="_blank" href="%s">%s</a> | <a href="%s" onClick="deleteConfirm(\'%s\',this.href); return false;">%s</a>', $read_url, Mage::helper('adminnotification')->__('Read Details'), $this->getUrl('*/*/remove/', array('_current' => true, 'id' => $row->getId())), Mage::helper('adminnotification')->__('Are you sure?'), Mage::helper('adminnotification')->__('Remove'));
}
}
示例10: setRedirect
/**
* Additionally check for session messages in several domains case
*
* @param string $url
* @param int $code
* @return Mage_Core_Controller_Response_Http
*/
public function setRedirect($url, $code = 302)
{
/**
* Use single transport object instance
*/
if (self::$_transportObject === null) {
self::$_transportObject = new Varien_Object();
}
self::$_transportObject->setUrl($url);
self::$_transportObject->setCode($code);
Mage::dispatchEvent('controller_response_redirect', array('response' => $this, 'transport' => self::$_transportObject));
return parent::setRedirect(self::$_transportObject->getUrl(), self::$_transportObject->getCode());
}
示例11: saveAction
public function saveAction()
{
$data = $this->getRequest()->getParams();
$uploader = new Mage_Core_Model_File_Uploader('file');
$uploader->setAllowedExtensions(array('csv'));
$uploader->setAllowRenameFiles(true);
$path = Mage::getBaseDir('var') . DS . 'import';
if (!file_exists($path)) {
mkdir($path, 0777);
}
try {
$result = $uploader->save($path);
$fullPath = $result['path'] . DS . $result['file'];
$csv = new Varien_File_Csv();
$data = $csv->getData($fullPath);
$items = array();
if (count($data) > 1) {
for ($i = 1; $i < count($data); $i++) {
$item = array();
for ($j = 0; $j < count($data[0]); $j++) {
if (isset($data[$i][$j]) && trim($data[$i][$j]) != '') {
$item[strtolower($data[0][$j])] = $data[$i][$j];
}
}
$items[] = $item;
}
}
$resource = Mage::getSingleton('core/resource');
$writeConnection = $resource->getConnection('core_write');
$table = $resource->getTableName('seoautolink/link');
$table2 = $resource->getTableName('seoautolink/link_store');
$i = 0;
foreach ($items as $item) {
if (!isset($item['keyword'])) {
continue;
}
$item = new Varien_Object($item);
$query = "REPLACE {$table} SET\n keyword = '" . addslashes($item->getKeyword()) . "',\n url = '" . addslashes($item->getUrl()) . "',\n url_title = '" . addslashes($item->getUrlTitle()) . "',\n url_target = '" . addslashes($item->getUrlTarget()) . "',\n is_nofollow = '" . (int) $item->getIsNofollow() . "',\n max_replacements = '" . (int) $item->getMaxReplacements() . "',\n sort_order = '" . (int) $item->getSortOrder() . "',\n occurence = '" . (int) $item->getOccurence() . "',\n is_active = '" . (int) $item->getIsActive() . "',\n created_at = '" . now() . "',\n updated_at = '" . now() . "';\n REPLACE {$table2} SET\n store_id = '" . (int) $item->getStoreId() . "',\n link_id = LAST_INSERT_ID();\n ";
$writeConnection->query($query);
$i++;
}
Mage::getSingleton('adminhtml/session')->addSuccess('' . $i . ' records were inserted or updated');
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
}
$this->_redirect('*/*/');
}
示例12: render
public function render(Varien_Object $feed)
{
$html = '';
$state = $feed->getGenerator()->getState();
if ($feed->getIsActive()) {
if ($state->isReady()) {
if ($feed->getUrl()) {
$html = $this->getStatusHtml('notice', 'Ready');
} else {
$html = $this->getStatusHtml('critical', 'Not generated');
}
} elseif ($state->isError()) {
$html = $this->getStatusHtml('critical', 'Error');
} elseif ($state->isProcessing()) {
$html = $this->getStatusHtml('major', 'Processing', $state->toHtml());
}
} else {
$html = $this->getStatusHtml('minor', 'Disabled');
}
return $html;
}
示例13: _prepareForm
protected function _prepareForm()
{
$form = new Varien_Data_Form();
if (Mage::registry('ranvi_feed')) {
$item = Mage::registry('ranvi_feed');
} else {
$item = new Varien_Object();
}
$this->setForm($form);
$fieldset = $form->addFieldset('main_fieldset', array('legend' => $this->__('Item information')));
$fieldset->addField('type', 'hidden', array('name' => 'type'));
$fieldset->addField('name', 'text', array('name' => 'name', 'label' => $this->__('Name'), 'title' => $this->__('Name'), 'required' => true));
if ($item->getId() && ($url = $item->getUrl())) {
$fieldset->addField('comments', 'note', array('label' => $this->__('Access Url'), 'title' => $this->__('Access Url'), 'text' => '<a href="' . $url . '" target="_blank">' . $url . '</a>'));
}
$fieldset->addField('filename', 'text', array('name' => 'filename', 'label' => $this->__('Filename'), 'title' => $this->__('Filename'), 'required' => false));
$fieldset->addField('store_id', 'select', array('label' => $this->__('Store View'), 'required' => true, 'name' => 'store_id', 'values' => Mage::getModel('ranvi_feed/adminhtml_system_config_source_store')->getStoreValuesForForm()));
if (!$item->getType() && $this->getRequest()->getParam('type')) {
$item->setType($this->getRequest()->getParam('type'));
}
$form->setValues($item->getData());
return parent::_prepareForm();
}
示例14: processRouteWordpressPostTagView
/**
* Tag page
*
* @param Varien_Object $tag
*/
public function processRouteWordpressPostTagView($tag)
{
$meta = new Varien_Object(array('title' => $this->getTitleTaxPostTag(), 'description' => $this->getMetadescTaxPostTag(), 'keywords' => $this->getMetakeyTaxPostTag(), 'robots' => $this->getNoindexTaxPostTag() ? 'noindex,follow' : ''));
$this->_applyMeta($meta->getData());
$this->_applyOpenGraph(array('type' => 'object', 'url' => $tag->getUrl(), 'title' => $this->_rewriteString($meta->getTitle())));
return $this;
}
示例15: getItemUrl
/**
* Get item URL
*
* In most cases should be overriden in descendant blocks
*
* @param Varien_Object $item
* @return string
*/
public function getItemUrl($item)
{
return $item->getUrl();
}