Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed guide image links #92

Merged
merged 4 commits into from
Aug 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Block/GeoIp/GetAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function _toHtml()
{
if ($this->_config->isGeoIpEnabled()) {
# https ESIs are not supported so we need to turn them into http
return sprintf('<esi:include src="%s" />', preg_replace("/^https/", "http", $this->getUrl('fastlyCdn/geoip/getaction')));
return sprintf('<esi:include src=\'%s\' />', preg_replace("/^https/", "http", $this->getUrl('fastlyCdn/geoip/getaction')));
}
return parent::_toHtml();
}
Expand Down
112 changes: 112 additions & 0 deletions Block/System/Config/Form/Field/Auth.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?php

/**
* Fastly CDN for Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Fastly CDN for Magento End User License Agreement
* that is bundled with this package in the file LICENSE_FASTLY_CDN.txt.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Fastly CDN to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to http://www.magento.com for more information.
*
* @category Fastly
* @package Fastly_Cdn
* @copyright Copyright (c) 2016 Fastly, Inc. (http://www.fastly.com)
* @license BSD, see LICENSE_FASTLY_CDN.txt
*/
namespace Fastly\Cdn\Block\System\Config\Form\Field;

/**
* Backend system config array field renderer
*/
class Auth extends \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray
{
/**
* @var \Magento\Framework\Data\Form\Element\Factory
*/
protected $_elementFactory;

protected $_api;

/**
* Currently necessary for work around a missing feature in the M2 core.
*
* @var string
*/
protected $_template = 'Fastly_Cdn::system/config/form/field/auth.phtml';


public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Data\Form\Element\Factory $elementFactory,
\Fastly\Cdn\Model\Api $api,
array $data = []
) {
$this->_elementFactory = $elementFactory;
$this->_api = $api;
parent::__construct($context, $data);
}

/**
* Initialise form fields
*
* @return void
*/
protected function _construct()
{
$this->addColumn('backend_name', ['label' => __('User')]);
$this->_addAfter = false;
parent::_construct();
}

/**
* Render array cell for prototypeJS template
*
* @param string $columnName
* @return string
*/
public function renderCellTemplate($columnName)
{
if ($columnName == 'store_id' && isset($this->_columns[$columnName])) {
$options = $this->getOptions(__('-- Select Store --'));
$element = $this->_elementFactory->create('select');
$element->setForm(
$this->getForm()
)->setName(
$this->_getCellInputElementName($columnName)
)->setHtmlId(
$this->_getCellInputElementId('<%- _id %>', $columnName)
)->setValues(
$options
);
return str_replace("\n", '', $element->getElementHtml());
}

return parent::renderCellTemplate($columnName);
}

/**
* Get list of store views.
*
* @param bool|false $label
*
* @return array
*/
protected function getOptions($label = false)
{
$options = [];
foreach ($this->_storeManager->getStores() as $store)
{
$options[] = ['value' => $store->getId(), 'label' => $store->getName()];
}
if ($label) {
array_unshift($options, ['value' => '', 'label' => $label]);
}
return $options;
}
}
127 changes: 127 additions & 0 deletions Block/System/Config/Form/Field/EnableAuth.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?php

/**
* Fastly CDN for Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Fastly CDN for Magento End User License Agreement
* that is bundled with this package in the file LICENSE_FASTLY_CDN.txt.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Fastly CDN to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to http://www.magento.com for more information.
*
* @category Fastly
* @package Fastly_Cdn
* @copyright Copyright (c) 2016 Fastly, Inc. (http://www.fastly.com)
* @license BSD, see LICENSE_FASTLY_CDN.txt
*/
namespace Fastly\Cdn\Block\System\Config\Form\Field;

use \Fastly\Cdn\Model\Config;

/**
* Backend system config array field renderer
*/
class EnableAuth extends \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray
{
/**
* @var \Magento\Framework\Data\Form\Element\Factory
*/
protected $_elementFactory;

protected $_api;

protected $config;

/**
* Currently necessary for work around a missing feature in the M2 core.
*
* @var string
*/
protected $_template = 'Fastly_Cdn::system/config/form/field/enableAuth.phtml';


public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Data\Form\Element\Factory $elementFactory,
\Fastly\Cdn\Model\Api $api,
Config $config,
array $data = []
) {
$this->_elementFactory = $elementFactory;
$this->_api = $api;
$this->config = $config;
parent::__construct($context, $data);
}

/**
* Initialise form fields
*
* @return void
*/
protected function _construct()
{
$this->addColumn('backend_name', ['label' => __('User')]);
$this->_addAfter = false;
parent::_construct();
}

/**
* Render array cell for prototypeJS template
*
* @param string $columnName
* @return string
*/
public function renderCellTemplate($columnName)
{
if ($columnName == 'store_id' && isset($this->_columns[$columnName])) {
$options = $this->getOptions(__('-- Select Store --'));
$element = $this->_elementFactory->create('select');
$element->setForm(
$this->getForm()
)->setName(
$this->_getCellInputElementName($columnName)
)->setHtmlId(
$this->_getCellInputElementId('<%- _id %>', $columnName)
)->setValues(
$options
);
return str_replace("\n", '', $element->getElementHtml());
}

return parent::renderCellTemplate($columnName);
}

/**
* Get list of store views.
*
* @param bool|false $label
*
* @return array
*/
protected function getOptions($label = false)
{
$options = [];
foreach ($this->_storeManager->getStores() as $store)
{
$options[] = ['value' => $store->getId(), 'label' => $store->getName()];
}
if ($label) {
array_unshift($options, ['value' => '', 'label' => $label]);
}
return $options;
}

/**
* Check if Basic Authentication is enabled
* @return int
*/
public function isAuthEnabled()
{
return $this->config->getBasicAuthenticationStatus();
}
}
3 changes: 2 additions & 1 deletion Controller/Adminhtml/FastlyCdn/Edge/Acl/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ public function __construct(
*/
public function execute()
{
$result = $this->resultJson->create();

try {
$result = $this->resultJson->create();
$activeVersion = $this->getRequest()->getParam('active_version');
$activateVcl = $this->getRequest()->getParam('activate_flag');
$aclName = $this->getRequest()->getParam('acl_name');
Expand Down
3 changes: 2 additions & 1 deletion Controller/Adminhtml/FastlyCdn/Edge/Acl/Item/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ public function __construct(
*/
public function execute()
{
$result = $this->resultJson->create();

try {
$result = $this->resultJson->create();
$aclId = $this->getRequest()->getParam('acl_id');
$value = $this->getRequest()->getParam('item_value');
$negated = $this->getRequest()->getParam('negated_field');
Expand Down
3 changes: 2 additions & 1 deletion Controller/Adminhtml/FastlyCdn/Edge/Acl/Item/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ public function __construct(
*/
public function execute()
{
$result = $this->resultJson->create();

try {
$result = $this->resultJson->create();
$aclId = $this->getRequest()->getParam('acl_id');
$aclItemId = $this->getRequest()->getParam('acl_item_id');

Expand Down
3 changes: 2 additions & 1 deletion Controller/Adminhtml/FastlyCdn/Edge/Acl/Item/ListAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ public function __construct(
*/
public function execute()
{
$result = $this->resultJson->create();

try {
$result = $this->resultJson->create();
$aclId = $this->getRequest()->getParam('acl_id');
$aclItems = $this->api->aclItemsList($aclId);

Expand Down
3 changes: 2 additions & 1 deletion Controller/Adminhtml/FastlyCdn/Edge/Acl/ListAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ public function __construct(
*/
public function execute()
{
$result = $this->resultJson->create();

try {
$result = $this->resultJson->create();
$activeVersion = $this->getRequest()->getParam('active_version');
$acls = $this->api->getAcls($activeVersion);

Expand Down
Loading