当前位置: 首页>>代码示例>>PHP>>正文


PHP Model\UrlInterface类代码示例

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


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

示例1: _validateSecretKey

 /**
  * Validate Secret Key
  *
  * @return bool
  */
 protected function _validateSecretKey()
 {
     if (is_array($this->_publicActions) && in_array($this->getRequest()->getActionName(), $this->_publicActions)) {
         return true;
     }
     $secretKey = $this->getRequest()->getParam(\Magento\Backend\Model\UrlInterface::SECRET_KEY_PARAM_NAME, null);
     if (!$secretKey || $secretKey != $this->_backendUrl->getSecretKey()) {
         return false;
     }
     return true;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:AbstractAction.php

示例2: testUseSecretKey

 public function testUseSecretKey()
 {
     $this->_model->setNoSecret(true);
     $this->assertFalse($this->_model->useSecretKey());
     $this->_model->setNoSecret(false);
     $this->assertTrue($this->_model->useSecretKey());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:7,代码来源:UrlTest.php

示例3: create

 /**
  * Declare headers and content file in response for file download
  *
  * @param string $fileName
  * @param string|array $content set to null to avoid starting output, $contentLength should be set explicitly in
  * that case
  * @param string $baseDir
  * @param string $contentType
  * @param int $contentLength    explicit content length, if strlen($content) isn't applicable
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function create($fileName, $content, $baseDir = DirectoryList::ROOT, $contentType = 'application/octet-stream', $contentLength = null)
 {
     if ($this->_auth->getAuthStorage()->isFirstPageAfterLogin()) {
         return $this->_redirect($this->_backendUrl->getStartupPageUrl());
     }
     return parent::create($fileName, $content, $baseDir, $contentType, $contentLength);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:18,代码来源:FileFactory.php

示例4: getUrl

 /**
  * Create url for passed item using passed url model
  *
  * @param \Magento\Framework\Object $item
  * @return string
  */
 public function getUrl($item)
 {
     if (!empty($this->_path)) {
         $params = $this->_prepareParameters($item);
         return $this->_urlModel->getUrl($this->_path, $params);
     }
     return '';
 }
开发者ID:aiesh,项目名称:magento2,代码行数:14,代码来源:UrlGenerator.php

示例5: getElementHtml

 public function getElementHtml()
 {
     $buttonBlock = $this->getForm()->getParent()->getLayout()->createBlock('Magento\\Backend\\Block\\Widget\\Button');
     $params = ['website' => $buttonBlock->getRequest()->getParam('website')];
     $url = $this->_backendUrl->getUrl("*/*/exportmatrixrate", $params);
     $data = ['label' => __('Export CSV'), 'onclick' => "setLocation('" . $url . "conditionName/' + \$('carriers_matrixrate_condition_name').value + '/matrixrate.csv' )", 'class' => ''];
     $html = $buttonBlock->setData($data)->toHtml();
     return $html;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:9,代码来源:Exportmatrix.php

示例6: testGetConfig

 /**
  * @covers \Magento\Cms\Model\Wysiwyg\Config::getConfig
  * @param array $data
  * @param boolean $isAuthorizationAllowed
  * @param array $expectedResults
  *
  * @dataProvider getConfigDataProvider
  */
 public function testGetConfig($data, $isAuthorizationAllowed, $expectedResults)
 {
     $wysiwygPluginSettings = ['wysiwygPluginSettings' => 'wysiwyg is here'];
     $pluginSettings = ['pluginSettings' => 'plugins are here'];
     $this->backendUrlMock->expects($this->atLeastOnce())->method('getUrl')->withConsecutive(['cms/wysiwyg/directive'], ['cms/wysiwyg_images/index']);
     $this->assetRepoMock->expects($this->atLeastOnce())->method('getUrl')->withConsecutive(['mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css'], ['mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css']);
     $this->authorizationMock->expects($this->atLeastOnce())->method('isAllowed')->with('Magento_Cms::media_gallery')->willReturn($isAuthorizationAllowed);
     $this->variableConfigMock->expects($this->any())->method('getWysiwygPluginSettings')->willReturn($wysiwygPluginSettings);
     $this->widgetConfigMock->expects($this->any())->method('getPluginSettings')->willReturn($pluginSettings);
     $config = $this->wysiwygConfig->getConfig($data);
     $this->assertInstanceOf('Magento\\Framework\\Object', $config);
     $this->assertEquals($expectedResults[0], $config->getData('someData'));
     $this->assertEquals($expectedResults[1], $config->getData('wysiwygPluginSettings'));
     $this->assertEquals($expectedResults[2], $config->getData('pluginSettings'));
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:23,代码来源:ConfigTest.php

示例7: execute

 /**
  * Force admin to change password
  *
  * @param EventObserver $observer
  * @return void
  */
 public function execute(EventObserver $observer)
 {
     if (!$this->observerConfig->isPasswordChangeForced()) {
         return;
     }
     if (!$this->authSession->isLoggedIn()) {
         return;
     }
     $actionList = ['adminhtml_system_account_index', 'adminhtml_system_account_save', 'adminhtml_auth_logout'];
     /** @var \Magento\Framework\App\Action\Action $controller */
     $controller = $observer->getEvent()->getControllerAction();
     /** @var \Magento\Framework\App\RequestInterface $request */
     $request = $observer->getEvent()->getRequest();
     if ($this->authSession->getPciAdminUserIsPasswordExpired()) {
         if (!in_array($request->getFullActionName(), $actionList)) {
             if ($this->authorization->isAllowed('Magento_Backend::myaccount')) {
                 $controller->getResponse()->setRedirect($this->url->getUrl('adminhtml/system_account/'));
                 $this->actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
                 $this->actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_POST_DISPATCH, true);
             } else {
                 /*
                  * if admin password is expired and access to 'My Account' page is denied
                  * than we need to do force logout with error message
                  */
                 $this->authSession->clearStorage();
                 $this->session->clearStorage();
                 $this->messageManager->addErrorMessage(__('Your password has expired; please contact your administrator.'));
                 $controller->getRequest()->setDispatched(false);
             }
         }
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:38,代码来源:ForceAdminPasswordChangeObserver.php

示例8: eavAttributeChange

 /**
  * Update all attribute-dependant index
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return \Magento\CatalogSearch\Model\Fulltext\Observer
  */
 public function eavAttributeChange(\Magento\Framework\Event\Observer $observer)
 {
     $attribute = $observer->getEvent()->getAttribute();
     /* @var $attribute \Magento\Eav\Model\Entity\Attribute */
     $entityType = $this->_eavConfig->getEntityType(\Magento\Catalog\Model\Product::ENTITY);
     /* @var $entityType \Magento\Eav\Model\Entity\Type */
     if ($attribute->getEntityTypeId() != $entityType->getId()) {
         return $this;
     }
     $delete = $observer->getEventName() == 'eav_entity_attribute_delete_after';
     if (!$delete && !$attribute->dataHasChangedFor('is_searchable')) {
         return $this;
     }
     $showNotice = false;
     if ($delete) {
         if ($attribute->getIsSearchable()) {
             $showNotice = true;
         }
     } elseif ($attribute->dataHasChangedFor('is_searchable')) {
         $showNotice = true;
     }
     if ($showNotice) {
         $url = $this->_backendUrl->getUrl('adminhtml/system_cache');
         $this->messageManager->addNotice(__('Attribute setting change related with Search Index. Please run <a href="%1">Rebuild Search Index</a> process.', $url));
     }
     return $this;
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:33,代码来源:Observer.php

示例9: getWidgetWindowUrl

 /**
  * Return Widgets Insertion Plugin Window URL
  *
  * @param \Magento\Framework\DataObject $config Editor element config
  * @return string
  */
 public function getWidgetWindowUrl($config)
 {
     $params = [];
     $skipped = is_array($config->getData('skip_widgets')) ? $config->getData('skip_widgets') : [];
     if ($config->hasData('widget_filters')) {
         $all = $this->_widgetFactory->create()->getWidgets();
         $filtered = $this->_widgetFactory->create()->getWidgets($config->getData('widget_filters'));
         foreach ($all as $code => $widget) {
             if (!isset($filtered[$code])) {
                 $skipped[] = $widget['@']['type'];
             }
         }
     }
     if (count($skipped) > 0) {
         $params['skip_widgets'] = $this->encodeWidgetsToQuery($skipped);
     }
     return $this->_backendUrl->getUrl('adminhtml/widget/index', $params);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:24,代码来源:Config.php

示例10: checkNativeTaxRules

 /**
  * Check to see if there are any native tax rules created that may affect AvaTax
  *
  * @return array
  */
 public function checkNativeTaxRules()
 {
     $errors = [];
     if ($this->avaTaxConfig->isModuleEnabled() && $this->avaTaxConfig->getTaxMode($this->storeManager->getDefaultStoreView()) != Config::TAX_MODE_NO_ESTIMATE_OR_SUBMIT && !$this->avaTaxConfig->isNativeTaxRulesIgnored()) {
         $taxRules = $this->taxRuleRepository->getList($this->searchCriteriaBuilder->create());
         if (count($taxRules->getItems())) {
             $errors[] = __('You have %1 native Magento Tax Rule(s) configured. ' . 'Please <a href="%2">review the tax rule(s)</a> and delete any that you do not specifically want enabled. ' . 'You should only have rules setup if you want to use them as backup rules in case of AvaTax ' . 'errors (see <a href="#row_tax_avatax_error_handling_header">Error Action setting</a>) ' . 'or if you need to support VAT tax. ' . '<a href="%3">Ignore this notification</a>.', count($taxRules->getItems()), $this->backendUrl->getUrl('tax/rule'), $this->backendUrl->getUrl('avatax/tax/ignoreTaxRuleNotification'));
         }
     }
     return $errors;
 }
开发者ID:classyllama,项目名称:ClassyLlama_AvaTax,代码行数:16,代码来源:ModuleChecks.php

示例11: processLogin

 /**
  * Process of configuring of current auth storage when login was performed
  *
  * @return \Magento\Backend\Model\Auth\Session
  */
 public function processLogin()
 {
     if ($this->getUser()) {
         $this->regenerateId();
         if ($this->_backendUrl->useSecretKey()) {
             $this->_backendUrl->renewSecretUrls();
         }
         $this->setIsFirstPageAfterLogin(true);
         $this->setAcl($this->_aclBuilder->getAcl());
         $this->setUpdatedAt(time());
     }
     return $this;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:18,代码来源:Session.php

示例12: getProductSorterLoadUrl

 /**
  * Retrieve the category product sorter load URL.
  *
  * @param Category $category Category.
  *
  * @return string
  */
 private function getProductSorterLoadUrl(Category $category)
 {
     $storeId = $category->getStoreId();
     if ($storeId === 0) {
         $defaultStoreId = $this->storeManager->getDefaultStoreView()->getId();
         $storeId = current(array_filter($category->getStoreIds()));
         if (in_array($defaultStoreId, $category->getStoreIds())) {
             $storeId = $defaultStoreId;
         }
     }
     $urlParams = ['ajax' => true, 'store' => $storeId];
     return $this->urlBuilder->getUrl('virtualcategory/category_virtual/preview', $urlParams);
 }
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:20,代码来源:DataProviderPlugin.php

示例13: _redirectIfNeededAfterLogin

 /**
  * Checks, whether Magento requires redirection after successful admin login, and redirects user, if needed
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return bool
  */
 protected function _redirectIfNeededAfterLogin(\Magento\Framework\App\RequestInterface $request)
 {
     $requestUri = null;
     // Checks, whether secret key is required for admin access or request uri is explicitly set
     if ($this->_url->useSecretKey()) {
         $requestUri = $this->_url->getUrl('*/*/*', ['_current' => true]);
     } elseif ($request) {
         $requestUri = $request->getRequestUri();
     }
     if (!$requestUri) {
         return false;
     }
     $this->_response->setRedirect($requestUri);
     $this->_actionFlag->set('', \Magento\Framework\App\ActionInterface::FLAG_NO_DISPATCH, true);
     return true;
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:22,代码来源:Authentication.php

示例14: _checkExpiredPassword

 /**
  * Check whether the latest password is expired
  * Side-effect can be when passwords were changed with different lifetime configuration settings
  *
  * @param array $latestPassword
  * @return void
  */
 private function _checkExpiredPassword($latestPassword)
 {
     if ($latestPassword && $this->observerConfig->_isLatestPasswordExpired($latestPassword)) {
         if ($this->observerConfig->isPasswordChangeForced()) {
             $message = __('It\'s time to change your password.');
         } else {
             $myAccountUrl = $this->url->getUrl('adminhtml/system_account/');
             $message = __('It\'s time to <a href="%1">change your password</a>.', $myAccountUrl);
         }
         $this->messageManager->addNoticeMessage($message);
         $message = $this->messageManager->getMessages()->getLastAddedMessage();
         if ($message) {
             $message->setIdentifier('magento_user_password_expired')->setIsSticky(true);
             $this->authSession->setPciAdminUserIsPasswordExpired(true);
         }
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:24,代码来源:AuthObserver.php

示例15: getConfigSectionsArray

 /**
  * Iterate over all config tabs, extract sections and its subsections
  * @param string $itemsSeparator
  * @param string $itemPrefix
  * @return array
  */
 public function getConfigSectionsArray($itemsSeparator = ' ', $itemPrefix = '')
 {
     $sections = array();
     foreach ($this->_configStructure->getTabs() as $tab) {
         /** @var $tab \Magento\Config\Model\Config\Structure\Element\Tab */
         foreach ($tab->getChildren() as $section) {
             /** @var $section \Magento\Config\Model\Config\Structure\Element\Section */
             // We need the label & url again for the sub sections
             $sectionLabel = $itemPrefix . $tab->getLabel() . $itemsSeparator . $section->getLabel();
             $sectionUrl = $this->_url->getUrl('adminhtml/system_config/edit', array('section' => $section->getId()));
             // First add global section to the launcher items...
             $sections[] = ['label' => $sectionLabel, 'value' => $sectionUrl];
             foreach ($section->getChildren() as $subSection) {
                 /** @var $subSection \Magento\Config\Model\Config\Structure\Element\Section */
                 // ...then add all sub sections
                 $sections[] = ['label' => $sectionLabel . $itemsSeparator . $subSection->getLabel(), 'value' => $sectionUrl . '#' . $section->getId() . '_' . $subSection->getId() . '-link'];
             }
         }
     }
     return $sections;
 }
开发者ID:swnsma,项目名称:magento2,代码行数:27,代码来源:Data.php


注:本文中的Magento\Backend\Model\UrlInterface类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。