ltsecurityinc安防产品在线商城代码
This commit is contained in:
+62
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* Plumrocket Inc.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the End-user License Agreement
|
||||
* that is available through the world-wide-web at this URL:
|
||||
* http://wiki.plumrocket.net/wiki/EULA
|
||||
* If you are unable to obtain it through the world-wide-web, please
|
||||
* send an email to support@plumrocket.com so we can send you a copy immediately.
|
||||
*
|
||||
* @package Plumrocket_GeoIPLookup
|
||||
* @copyright Copyright (c) 2018 Plumrocket Inc. (http://www.plumrocket.com)
|
||||
* @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
|
||||
*/
|
||||
|
||||
namespace Plumrocket\GeoIPLookup\Helper;
|
||||
|
||||
use Magento\Framework\App\Helper\AbstractHelper;
|
||||
|
||||
/**
|
||||
* Class Data Helper
|
||||
*/
|
||||
class Data extends AbstractHelper
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface
|
||||
*/
|
||||
private $timezone;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\App\Helper\Context $context
|
||||
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\App\Helper\Context $context,
|
||||
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone
|
||||
) {
|
||||
parent::__construct($context);
|
||||
$this->timezone = $timezone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $elementId
|
||||
* @return mixed
|
||||
*/
|
||||
public function getModelNameByElementId($elementId, $upercase = true, $penultimate = false)
|
||||
{
|
||||
if ($penultimate) {
|
||||
$elementId = mb_substr($elementId, 0, mb_strrpos($elementId, "_"));
|
||||
}
|
||||
$elements = explode('_', $elementId);
|
||||
$modelName = end($elements);
|
||||
if ($upercase) {
|
||||
$modelName = ucfirst($modelName);
|
||||
}
|
||||
|
||||
return $modelName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user