This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
+68
View File
@@ -0,0 +1,68 @@
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Faqs
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Blog\Model\Config\Source;
use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection;
use Magento\Framework\Option\ArrayInterface;
use Mageplaza\Blog\Model\AuthorFactory;
/**
* Class Author
* @package Mageplaza\Faqs\Model\Config\Source
*/
class Author implements ArrayInterface
{
/**
* @var AuthorFactory
*/
public $_authorFactory;
public function __construct(
AuthorFactory $authorFactory
) {
$this->_authorFactory = $authorFactory;
}
/**
* @return array
*/
public function toOptionArray()
{
$options = [];
foreach ($this->getAuthors() as $value => $author) {
$options[] = [
'value' => $value,
'label' => $author->getName()
];
}
return $options;
}
/**
* @return AbstractCollection
*/
public function getAuthors()
{
return $this->_authorFactory->create()->getCollection()->addFieldToFilter('status', '1');
}
}
@@ -0,0 +1,66 @@
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Faqs
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Blog\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
/**
* Class AuthorStatus
* @package Mageplaza\Faqs\Model\Config\Source
*/
class AuthorStatus implements ArrayInterface
{
const PENDING = '0';
const APPROVED = '1';
const DISAPPROVED = '2';
/**
* @return array
*/
public function toOptionArray()
{
$options = [];
foreach ($this->toArray() as $value => $label) {
$options[] = [
'value' => $value,
'label' => $label
];
}
return $options;
}
/**
* Get options in "key-value" format
*
* @return array
*/
public function toArray()
{
return [
self::PENDING => __('Pending'),
self::APPROVED => __('Approved'),
self::DISAPPROVED => __('Disapproved')
];
}
}
+64
View File
@@ -0,0 +1,64 @@
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Faqs
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Blog\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
/**
* Class AuthorStatus
* @package Mageplaza\Faqs\Model\Config\Source
*/
class AuthorType implements ArrayInterface
{
const ADMIN = '0';
const CUSTOMER = '1';
/**
* @return array
*/
public function toOptionArray()
{
$options = [];
foreach ($this->toArray() as $value => $label) {
$options[] = [
'value' => $value,
'label' => $label
];
}
return $options;
}
/**
* Get options in "key-value" format
*
* @return array
*/
public function toArray()
{
return [
self::ADMIN => __('Created by Admin'),
self::CUSTOMER => __('Customer Register')
];
}
}
@@ -0,0 +1,68 @@
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Blog\Model\Config\Source\Comments\Facebook;
use Magento\Framework\Option\ArrayInterface;
/**
* Class Colorscheme
* @package Mageplaza\Blog\Model\Config\Source\Comments\Facebook
*/
class Colorscheme implements ArrayInterface
{
const LIGHT = 'light';
const DARK = 'dark';
/**
* @return array
*/
public function toOptionArray()
{
$options = [];
foreach ($this->toArray() as $value => $label) {
$options[] = [
'value' => $value,
'label' => $label
];
}
return $options;
}
/**
* Get options in "key-value" format
*
* @return array
*/
public function toArray()
{
return [self::LIGHT => __('Light'), self::DARK => __('Dark')];
}
/**
* @return array
*/
public function getAllOptions()
{
return $this->toOptionArray();
}
}
@@ -0,0 +1,69 @@
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Blog\Model\Config\Source\Comments\Facebook;
use Magento\Framework\Option\ArrayInterface;
/**
* Class Orderby
* @package Mageplaza\Blog\Model\Config\Source\Comments\Facebook
*/
class Orderby implements ArrayInterface
{
const SOCIAL = 'social';
const REVERSE_TIME = 'reverse_time';
const TIME = 'time';
/**
* @return array
*/
public function toOptionArray()
{
$options = [];
foreach ($this->toArray() as $value => $label) {
$options[] = [
'value' => $value,
'label' => $label
];
}
return $options;
}
/**
* Get options in "key-value" format
*
* @return array
*/
public function toArray()
{
return [self::SOCIAL => __('Social'), self::REVERSE_TIME => __('Reverse time'), self::TIME => __('Time')];
}
/**
* @return array
*/
public function getAllOptions()
{
return $this->toOptionArray();
}
}
@@ -0,0 +1,65 @@
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Blog\Model\Config\Source\Comments;
use Magento\Framework\Option\ArrayInterface;
/**
* Class Status
* @package Mageplaza\Blog\Model\Config\Source\Comments
*/
class Status implements ArrayInterface
{
const APPROVED = 1;
const SPAM = 2;
const PENDING = 3;
/**
* @return array
*/
public function toOptionArray()
{
$options = [];
foreach ($this->toArray() as $value => $label) {
$options[] = [
'value' => $value,
'label' => $label
];
}
return $options;
}
/**
* Get options in "key-value" format
*
* @return array
*/
public function toArray()
{
return [
self::APPROVED => __('Approved'),
self::PENDING => __('Pending'),
self::SPAM => __('Spam')
];
}
}
@@ -0,0 +1,67 @@
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Blog\Model\Config\Source\Comments;
use Magento\Framework\Option\ArrayInterface;
/**
* Class Type
* @package Mageplaza\Blog\Model\Config\Source\Comments
*/
class Type implements ArrayInterface
{
const DEFAULT_COMMENT = 1;
const FACEBOOK = 2;
const DISQUS = 3;
const DISABLE = 4;
/**
* @return array
*/
public function toOptionArray()
{
$options = [];
foreach ($this->toArray() as $value => $label) {
$options[] = [
'value' => $value,
'label' => $label
];
}
return $options;
}
/**
* Get options in "key-value" format
*
* @return array
*/
public function toArray()
{
return [
self::DEFAULT_COMMENT => __('Default Comment'),
self::DISQUS => __('Disqus Comment'),
self::FACEBOOK => __('Facebook Comment'),
self::DISABLE => __('Disable Completely')
];
}
}
@@ -0,0 +1,64 @@
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Blog\Model\Config\Source\DateFormat;
use Magento\Framework\Option\ArrayInterface;
/**
* Class Type
* @package Mageplaza\Blog\Model\Config\Source\DateFormat
*/
class Type implements ArrayInterface
{
/**
* Options getter
*
* @return array
*/
public function toOptionArray()
{
$dateArray = [];
$type = [
'F j, Y',
'Y-m-d',
'm/d/Y',
'd/m/Y',
'F j, Y g:i a',
'F j, Y g:i A',
'Y-m-d g:i a',
'Y-m-d g:i A',
'd/m/Y g:i a',
'd/m/Y g:i A',
'm/d/Y H:i',
'd/m/Y H:i',
];
foreach ($type as $item) {
$dateArray[] = [
'value' => $item,
'label' => $item . ' (' . date($item) . ')'
];
}
return $dateArray;
}
}
@@ -0,0 +1,50 @@
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Blog\Model\Config\Source\DateFormat;
use Magento\Framework\Option\ArrayInterface;
/**
* Class TypeMonth
* @package Mageplaza\Blog\Model\Config\Source\DateFormat
*/
class TypeMonth implements ArrayInterface
{
/**
* Options getter
*
* @return array
*/
public function toOptionArray()
{
$dateArray = [];
$type = ['F , Y', 'Y - m', 'm / Y', 'M Y'];
foreach ($type as $item) {
$dateArray [] = [
'value' => $item,
'label' => $item . ' (' . date($item) . ')'
];
}
return $dateArray;
}
}
@@ -0,0 +1,60 @@
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Blog\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
/**
* Class Display
* @package Mageplaza\Blog\Model\Config\Source\Blogview
*/
class DisplayType implements ArrayInterface
{
const LIST_VIEW = 1;
const GRID = 2;
/**
* @return array
*/
public function toOptionArray()
{
$options = [];
foreach ($this->toArray() as $value => $label) {
$options[] = [
'value' => $value,
'label' => $label
];
}
return $options;
}
/**
* Get options in "key-value" format
*
* @return array
*/
public function toArray()
{
return [self::LIST_VIEW => __('List View'), self::GRID => __('Grid View')];
}
}
@@ -0,0 +1,65 @@
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Blog\Model\Config\Source\Import;
use Magento\Framework\Option\ArrayInterface;
/**
* Class Behaviour
* @package Mageplaza\Blog\Model\Config\Source\Import
*/
class Behaviour implements ArrayInterface
{
const UPDATE = "update";
const REPLACE = "replace";
const DELETE = "delete";
/**
* @return array
*/
public function toOptionArray()
{
$options = [];
foreach ($this->toArray() as $value => $label) {
$options[] = [
'value' => $value,
'label' => $label
];
}
return $options;
}
/**
* Get options in "key-value" format
*
* @return array
*/
public function toArray()
{
return [
self::UPDATE => __('Add / Update'),
self::REPLACE => __('Replace'),
self::DELETE => __('Delete')
];
}
}
@@ -0,0 +1,66 @@
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Blog\Model\Config\Source\Import;
use Magento\Framework\Option\ArrayInterface;
/**
* Class Type
* @package Mageplaza\Blog\Model\Config\Source\Import
*/
class Type implements ArrayInterface
{
const WORDPRESS = "wordpress";
const AHEADWORK = "aheadworksm1";
const MAGEFAN = "magefan";
/**
* @return array
*/
public function toOptionArray()
{
$options = [];
foreach ($this->toArray() as $value => $label) {
$options[] = [
'value' => $value,
'label' => $label
];
}
return $options;
}
/**
* Get options in "key-value" format
*
* @return array
*/
public function toArray()
{
return [
"" => __('-- Please Select --'),
self::WORDPRESS => __('Wordpress'),
self::AHEADWORK => __('AheadWorks Blog [Magento 1]'),
self::MAGEFAN => __('MageFan Blog [Magento 2]')
];
}
}
@@ -0,0 +1,60 @@
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Blog\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
/**
* Class Display
* @package Mageplaza\Blog\Model\Config\Source
*/
class RelatedMode implements ArrayInterface
{
const SLIDER = 1;
const GRID = 2;
/**
* @return array
*/
public function toOptionArray()
{
$options = [];
foreach ($this->toArray() as $value => $label) {
$options[] = [
'value' => $value,
'label' => $label
];
}
return $options;
}
/**
* Get options in "key-value" format
*
* @return array
*/
public function toArray()
{
return [self::SLIDER => __('Slider'), self::GRID => __('Grid')];
}
}
+65
View File
@@ -0,0 +1,65 @@
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Blog\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
/**
* Class SideBarLR
* @package Mageplaza\Blog\Model\Config\Source
*/
class SideBarLR implements ArrayInterface
{
const LEFT = '2columns-left';
const RIGHT = '2columns-right';
/**
* Options getter
*
* @return array
*/
public function toOptionArray()
{
$options = [];
foreach ($this->toArray() as $value => $label) {
$options[] = [
'value' => $value,
'label' => $label
];
}
return $options;
}
/**
* Get options in "key-value" format
*
* @return array
*/
public function toArray()
{
return [
self::LEFT => __('Left'),
self::RIGHT => __('Right')
];
}
}
@@ -0,0 +1,65 @@
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Blog\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
use Mageplaza\Blog\Model\ResourceModel\Category\CollectionFactory;
/**
* Class WidgetCategory
* @package Mageplaza\Blog\Model\Config\Source\Widget
*/
class WidgetCategory implements ArrayInterface
{
/**
* @var CollectionFactory
*/
private $category;
/**
* WidgetCategory constructor.
*
* @param CollectionFactory $category
*/
public function __construct(
CollectionFactory $category
) {
$this->category = $category;
}
/**
* @return array
*/
public function toOptionArray()
{
$collection = $this->category->create();
$ar = [];
foreach ($collection->getItems() as $item) {
if ($item->getId() === '1') {
continue;
}
$ar[] = ['value' => $item->getId(), 'label' => $item->getName()];
}
return $ar;
}
}
@@ -0,0 +1,42 @@
<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Blog\Model\Config\Source;
use Magento\Framework\Option\ArrayInterface;
/**
* Class ShowType
* @package Mageplaza\Blog\Model\Config\Source\Widget
*/
class WidgetShowType implements ArrayInterface
{
/**
* @return array
*/
public function toOptionArray()
{
return [
['value' => 'new', 'label' => __('New')],
['value' => 'category', 'label' => __('Category')]
];
}
}