Initial commit
3
wordpress_plugins/wp-config-file-editor/.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "vendor/xptrdev/WPPluginFramework"]
|
||||
path = vendor/xptrdev/WPPluginFramework
|
||||
url = https://github.com/xptrdev/WPPluginFramework.git
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
if ( ! function_exists( 'get_main_network_id' ) )
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the main network ID.
|
||||
*
|
||||
* @since 4.3.0
|
||||
*
|
||||
* @global wpdb $wpdb WordPress database abstraction object.
|
||||
*
|
||||
* @return int The ID of the main network.
|
||||
*/
|
||||
function get_main_network_id() {
|
||||
global $wpdb;
|
||||
|
||||
if ( ! is_multisite() ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( defined( 'PRIMARY_NETWORK_ID' ) ) {
|
||||
$main_network_id = PRIMARY_NETWORK_ID;
|
||||
} elseif ( 1 === (int) get_current_site()->id ) {
|
||||
// If the current network has an ID of 1, assume it is the main network.
|
||||
$main_network_id = 1;
|
||||
} else {
|
||||
$main_network_id = wp_cache_get( 'primary_network_id', 'site-options' );
|
||||
|
||||
if ( false === $main_network_id ) {
|
||||
$main_network_id = (int) $wpdb->get_var( "SELECT id FROM {$wpdb->site} ORDER BY id LIMIT 1" );
|
||||
wp_cache_add( 'primary_network_id', $main_network_id, 'site-options' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the main network ID.
|
||||
*
|
||||
* @since 4.3.0
|
||||
*
|
||||
* @param int $main_network_id The ID of the main network.
|
||||
*/
|
||||
return (int) apply_filters( 'get_main_network_id', $main_network_id );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace WCFE;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CompatibleWordpress
|
||||
{
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
private $checkPoints = array
|
||||
(
|
||||
'4.3.0',
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
private $versionBase;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param mixed $versionBase
|
||||
* @return CompatibleWordpress
|
||||
*/
|
||||
private function __construct( $versionBase )
|
||||
{
|
||||
$this->versionBase =& $versionBase;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function load()
|
||||
{
|
||||
|
||||
foreach ( $this->checkPoints as $chkPointVersion )
|
||||
{
|
||||
|
||||
// Include all versions that are newer than current version
|
||||
if ( version_compare( $this->versionBase, $chkPointVersion ) == -1 )
|
||||
{
|
||||
|
||||
$versionFile = __DIR__ . DIRECTORY_SEPARATOR . "{$chkPointVersion}.php";
|
||||
|
||||
if ( file_exists( $versionFile ) )
|
||||
{
|
||||
require $versionFile;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param mixed $versionBase
|
||||
* @return CompatibleWordpress
|
||||
*/
|
||||
public static function loadCompatibilityLayers( $versionBase )
|
||||
{
|
||||
if ( ! self::$instance )
|
||||
{
|
||||
|
||||
self::$instance = new CompatibleWordpress( $versionBase );
|
||||
|
||||
// Load layers
|
||||
self::$instance->load();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin.class.php
|
||||
* @author AHMeD SAiD
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Config;
|
||||
|
||||
# Imports
|
||||
use WPPFW\Plugin\PluginConfig;
|
||||
|
||||
/**
|
||||
* Plugin configuration class
|
||||
*
|
||||
* @author AHMeD SAiD
|
||||
*/
|
||||
class Plugin extends PluginConfig {
|
||||
|
||||
/**
|
||||
* Load Plugin configuration from configuration XML file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
# Load plugin.xml file relative to this class
|
||||
parent::__construct(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'plugin.xml'));
|
||||
}
|
||||
|
||||
}
|
||||
223
wordpress_plugins/wp-config-file-editor/Config/plugin.xml
Normal file
@@ -0,0 +1,223 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<plugin xmlns="http://www.xptdev.com/frameworks/wordpress/plugin"
|
||||
namespace="WCFE">
|
||||
<parameters>
|
||||
<factoryClass>WCFE\Factory</factoryClass>
|
||||
<factoryNamespace>Factory</factoryNamespace>
|
||||
<dbVersion>0.5</dbVersion>
|
||||
<localizationDir>Languages</localizationDir>
|
||||
<serviceModules>
|
||||
<classId>Module</classId>
|
||||
</serviceModules>
|
||||
</parameters>
|
||||
<mvc>
|
||||
<objects namespace="WPPFW\MVC">
|
||||
<object class="MVCStructure">
|
||||
<param name="module" value="Modules" />
|
||||
<param name="controller" value="Controller" />
|
||||
<param name="controllerClassId" value="Controller" />
|
||||
<param name="model" value="Model" />
|
||||
<param name="modelClassId" value="Model" />
|
||||
<object class="MVCViewStructure">
|
||||
<param name="view" value="View" />
|
||||
<param name="viewClassId" value="View" />
|
||||
</object>
|
||||
</object>
|
||||
<object class="MVCNames">
|
||||
<param name="module" value="module" />
|
||||
<param name="controller" value="controller" />
|
||||
<param name="action" value="action" />
|
||||
<param name="format" value="format" />
|
||||
<object class="MVCViewNames">
|
||||
<param name="view" value="view" />
|
||||
<param name="layout" value="layout" />
|
||||
</object>
|
||||
</object>
|
||||
<object class="MVCParams">
|
||||
<param name="action" value="Index" />
|
||||
<param name="format" value="JSON" />
|
||||
<param name="controller" value="" />
|
||||
<object class="MVCViewParams">
|
||||
<param name="format" value="HTML" />
|
||||
<param name="view" value="" />
|
||||
<param name="layout" value="" />
|
||||
</object>
|
||||
</object>
|
||||
</objects>
|
||||
<types>
|
||||
<type name="Service">
|
||||
<params>WPPFW\MVC\MVCParams</params>
|
||||
<names>WPPFW\MVC\MVCNames</names>
|
||||
<structure>WPPFW\MVC\MVCStructure</structure>
|
||||
</type>
|
||||
<type name="View">
|
||||
<params>WPPFW\MVC\MVCViewParams</params>
|
||||
<names>WPPFW\MVC\MVCViewNames</names>
|
||||
<structure>WPPFW\MVC\MVCViewStructure</structure>
|
||||
</type>
|
||||
</types>
|
||||
</mvc>
|
||||
|
||||
<services namespace="WCFE\Services">
|
||||
|
||||
<!-- Editor Module -->
|
||||
<service serviceObjectClass="Editor\MenuPages\Editor\Page"
|
||||
serviceFront="Editor"
|
||||
routerClass="WPPFW\Plugin\ServiceObjectViewRouter"
|
||||
homeProxy="WPPFW\Services\Dashboard\Menu\Proxy">
|
||||
<proxy typeName="View" namespace="WPPFW\MVC" class="WPPFW\Services\Dashboard\Menu\Proxy" frontClass="WPPFW\Plugin\MVCViewRequestInputFrontProxy">
|
||||
<object class="MVCViewParams">
|
||||
<param name="module" value="Editor" />
|
||||
<param name="view" value="Editor" />
|
||||
</object>
|
||||
</proxy>
|
||||
</service>
|
||||
|
||||
<service serviceObjectClass="Editor\MenuPages\Editor\RawEdit"
|
||||
serviceFront="Editor"
|
||||
routerClass="WPPFW\Plugin\ServiceObjectViewRouter"
|
||||
homeProxy="WPPFW\Services\Dashboard\Menu\Proxy">
|
||||
<proxy typeName="View" namespace="WPPFW\MVC" class="WPPFW\Services\Dashboard\Menu\Proxy" frontClass="WPPFW\Plugin\MVCViewRequestInputFrontProxy">
|
||||
<object class="MVCViewParams">
|
||||
<param name="module" value="Editor" />
|
||||
<param name="action" value="RawEdit" />
|
||||
<param name="layout" value="Preview" />
|
||||
<param name="view" value="Editor" />
|
||||
</object>
|
||||
</proxy>
|
||||
</service>
|
||||
|
||||
<service serviceObjectClass="Editor\Services\Editor\Ajax"
|
||||
serviceFront="Service"
|
||||
routerClass="WPPFW\Plugin\ServiceObjectRouter"
|
||||
homeProxy="WPPFW\Services\Dashboard\Ajax\Proxy">
|
||||
<proxy typeName="Service" namespace="WPPFW\MVC" class="WPPFW\Services\Dashboard\Ajax\Proxy" frontClass="WPPFW\Plugin\MVCRequestInputFrontProxy">
|
||||
<object class="MVCParams">
|
||||
<param name="module" value="Editor" />
|
||||
<param name="controller" value="EditorService" />
|
||||
</object>
|
||||
</proxy>
|
||||
</service>
|
||||
|
||||
|
||||
<service serviceObjectClass="Editor\Services\Editor\AjaxViews"
|
||||
serviceFront="Service"
|
||||
routerClass="WPPFW\Plugin\ServiceObjectViewRouter"
|
||||
homeProxy="WPPFW\Services\Dashboard\Ajax\Proxy">
|
||||
<proxy typeName="View" namespace="WPPFW\MVC" class="WPPFW\Services\Dashboard\Ajax\Proxy" frontClass="WPPFW\Plugin\MVCViewRequestInputFrontProxy">
|
||||
<object class="MVCViewParams">
|
||||
<param name="module" value="Editor" />
|
||||
<param name="controller" value="MultiSiteTools" />
|
||||
<param name="view" value="MultiSiteTools" />
|
||||
<param name="action" value="Setup" />
|
||||
</object>
|
||||
</proxy>
|
||||
</service>
|
||||
|
||||
|
||||
<!-- PROFILES Module -->
|
||||
<service serviceObjectClass="Profiles\Services\Profiles\Ajax"
|
||||
serviceFront="Service"
|
||||
routerClass="WPPFW\Plugin\ServiceObjectRouter"
|
||||
homeProxy="WPPFW\Services\Dashboard\Ajax\Proxy">
|
||||
<proxy typeName="Service" namespace="WPPFW\MVC" class="WPPFW\Services\Dashboard\Ajax\Proxy" frontClass="WPPFW\Plugin\MVCRequestInputFrontProxy">
|
||||
<object class="MVCParams">
|
||||
<param name="module" value="Profiles" />
|
||||
<param name="controller" value="ProfilesService" />
|
||||
</object>
|
||||
</proxy>
|
||||
</service>
|
||||
|
||||
<service serviceObjectClass="Profiles\Services\Profiles\AjaxView"
|
||||
serviceFront="Service"
|
||||
routerClass="WPPFW\Plugin\ServiceObjectViewRouter"
|
||||
homeProxy="WPPFW\Services\Dashboard\Ajax\Proxy">
|
||||
<proxy typeName="View" namespace="WPPFW\MVC" class="WPPFW\Services\Dashboard\Ajax\Proxy" frontClass="WPPFW\Plugin\MVCViewRequestInputFrontProxy">
|
||||
<object class="MVCViewParams">
|
||||
<param name="module" value="Profiles" />
|
||||
<param name="controller" value="Profiles" />
|
||||
<param name="view" value="Profiles" />
|
||||
<param name="action" value="List" />
|
||||
</object>
|
||||
</proxy>
|
||||
</service>
|
||||
|
||||
<service serviceObjectClass="Editor\MultiSiteTools\MultiSiteNetworkPageTools"
|
||||
serviceFront="ServiceFront"
|
||||
routerClass="WPPFW\Plugin\ServiceObjectViewRouter"
|
||||
homeProxy="WCFE\Services\Editor\MultiSiteTools\Proxy">
|
||||
<proxy typeName="View" namespace="WPPFW\MVC" class="WCFE\Services\Editor\MultiSiteTools\Proxy" frontClass="WPPFW\Plugin\MVCViewRequestInputFrontProxy">
|
||||
<object class="MVCViewParams">
|
||||
<param name="module" value="Editor" />
|
||||
<param name="controller" value="MultiSiteTools" />
|
||||
<param name="view" value="MultiSiteTools" />
|
||||
<param name="action" value="SetupNetwork" />
|
||||
</object>
|
||||
</proxy>
|
||||
</service>
|
||||
|
||||
<!-- Sys FIlters Module -->
|
||||
<service serviceObjectClass="SysFilters\Dashboard\Page"
|
||||
serviceFront="Dashboard"
|
||||
routerClass="WPPFW\Plugin\ServiceObjectViewRouter"
|
||||
homeProxy="WPPFW\Services\Dashboard\Menu\Proxy">
|
||||
<proxy typeName="View" namespace="WPPFW\MVC" class="WPPFW\Services\Dashboard\Menu\Proxy" frontClass="WPPFW\Plugin\MVCViewRequestInputFrontProxy">
|
||||
<object class="MVCViewParams">
|
||||
<param name="module" value="SysFilters" />
|
||||
<param name="controller" value="SysFiltersDashboard" />
|
||||
<param name="view" value="SysFiltersDashboard" />
|
||||
<param name="action" value="Index" />
|
||||
</object>
|
||||
</proxy>
|
||||
</service>
|
||||
|
||||
<service serviceObjectClass="Profiles\Services\SysFilters\Ajax"
|
||||
serviceFront="Service"
|
||||
routerClass="WPPFW\Plugin\ServiceObjectRouter"
|
||||
homeProxy="WPPFW\Services\Dashboard\Ajax\Proxy">
|
||||
<proxy typeName="Service" namespace="WPPFW\MVC" class="WPPFW\Services\Dashboard\Ajax\Proxy" frontClass="WPPFW\Plugin\MVCRequestInputFrontProxy">
|
||||
<object class="MVCParams">
|
||||
<param name="module" value="SysFilters" />
|
||||
<param name="controller" value="SysFiltersServices" />
|
||||
</object>
|
||||
</proxy>
|
||||
</service>
|
||||
|
||||
<service serviceObjectClass="Profiles\Services\SysFilters\AjaxView"
|
||||
serviceFront="Service"
|
||||
routerClass="WPPFW\Plugin\ServiceObjectViewRouter"
|
||||
homeProxy="WPPFW\Services\Dashboard\Ajax\Proxy">
|
||||
<proxy typeName="View" namespace="WPPFW\MVC" class="WPPFW\Services\Dashboard\Ajax\Proxy" frontClass="WPPFW\Plugin\MVCViewRequestInputFrontProxy">
|
||||
<object class="MVCViewParams">
|
||||
<param name="module" value="SysFilters" />
|
||||
<param name="controller" value="SysFiltersDashboard" />
|
||||
</object>
|
||||
</proxy>
|
||||
</service>
|
||||
|
||||
<models>
|
||||
|
||||
<model id="WCFE\Modules\Editor\Model\EditorModel">
|
||||
<stateType>WPPFW\MVC\Model\State\GlobalWPOptionsModelState</stateType>
|
||||
</model>
|
||||
|
||||
<model id="WCFE\Modules\Editor\Model\MultiSiteToolsModel">
|
||||
<stateType>WPPFW\MVC\Model\State\GlobalWPOptionsModelState</stateType>
|
||||
</model>
|
||||
|
||||
<model id="WCFE\Modules\Editor\Model\SystemCheckToolsModel">
|
||||
<stateType>WPPFW\MVC\Model\State\GlobalWPOptionsModelState</stateType>
|
||||
</model>
|
||||
|
||||
<model id="WCFE\Modules\Profiles\Model\ProfilesModel">
|
||||
<stateType>WPPFW\MVC\Model\State\GlobalWPOptionsModelState</stateType>
|
||||
</model>
|
||||
|
||||
<model id="WCFE\Modules\SysFilters\Model\SysFiltersDashboardModel">
|
||||
<stateType>WPPFW\MVC\Model\State\GlobalWPOptionsModelState</stateType>
|
||||
</model>
|
||||
</models>
|
||||
|
||||
</services>
|
||||
|
||||
</plugin>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Factory.class.php
|
||||
*/
|
||||
|
||||
# Define Namespace
|
||||
namespace WCFE;
|
||||
|
||||
# Imports
|
||||
use WPPFW\Plugin\PluginFactory;
|
||||
|
||||
/**
|
||||
* WCFE Plugin base and currently the only object factory
|
||||
*
|
||||
* The class is to provide objects factory and objects storage
|
||||
* Its used for interconnectios between different comonents and between
|
||||
* Plugins and Plugins Framework
|
||||
*
|
||||
* @author AHMeD SAiD
|
||||
*/
|
||||
class Factory extends PluginFactory {
|
||||
|
||||
/**
|
||||
* CReate class maps for Framework class to
|
||||
* be constructed through WCFE Plugin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function createMap() {
|
||||
# Create Map.
|
||||
$this->addClassMap('WPPFW\Database\Wordpress\WordpressOptions', 'WordpressOptions');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* WordpressOptions.class.php
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Factory;
|
||||
|
||||
# Imports
|
||||
use WPPFW\Obj;
|
||||
|
||||
# Original object
|
||||
use WPPFW\Database\Wordpress;
|
||||
|
||||
/**
|
||||
* Factoring Wordpress Database Options Table
|
||||
*
|
||||
* @author AHMeD SAiD
|
||||
*/
|
||||
class WordpressOptions {
|
||||
|
||||
/**
|
||||
* Creating new WPPFW\Database\Wordpress\WordpressOptions object
|
||||
* configued for WCFE Plugin
|
||||
*
|
||||
* @param Obj\Factory $factory
|
||||
* @return Wordpress\WordpressOptions
|
||||
*/
|
||||
public function getInstance( Obj\Factory & $factory )
|
||||
{
|
||||
# Getting Plugin instance.
|
||||
$plugin =& $factory->get( 'WPPFW\Plugin\PluginBase' );
|
||||
# Return Wordpress options object instance
|
||||
return new Wordpress\WordpressOptions( strtolower( $plugin->getNamespace()->getNamespace() . '-' ) );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace WCFE\Includes\Mail;
|
||||
|
||||
// No Direct Access
|
||||
defined('ABSPATH') or die(-1);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class EmergencyRestoreMail
|
||||
{
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $to;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
// Get Current Logged in user email to send mail to
|
||||
$user = get_userdata(get_current_user_id());
|
||||
$this->to = $user->user_email;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param mixed $backupLink
|
||||
* @return boolean
|
||||
*/
|
||||
public function send($restoreLink)
|
||||
{
|
||||
|
||||
$blogname = get_bloginfo('name');
|
||||
$blogdomain = parse_url(home_url(), PHP_URL_HOST);
|
||||
|
||||
// Subject
|
||||
$subject = 'WP Config File Editor - Emergency Restore Link';
|
||||
|
||||
// Generic Headers
|
||||
$headers[] = 'Content-Type: text/plain';
|
||||
|
||||
// Set From as web site address
|
||||
$headers[] = "From: {$blogname} <noreply@{$blogdomain}>";
|
||||
|
||||
// Message
|
||||
$message[] = 'Here is a link to help you Restore your latest wp-config.php file';
|
||||
$message[] = 'Please use it only if you\'ve problem accessing your site after the last save operation';
|
||||
$message[] = $restoreLink;
|
||||
|
||||
// Formatting Headers
|
||||
$headers = join("\r\n", $headers);
|
||||
|
||||
// Formattig message
|
||||
$message = join("\n", $message);
|
||||
|
||||
// Send mail
|
||||
$status = wp_mail(
|
||||
$this->to,
|
||||
$subject,
|
||||
$message,
|
||||
$headers
|
||||
);
|
||||
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace WCFE\Installer;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Factory extends \WPPFW\Plugin\PluginFactory
|
||||
{
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function createMap()
|
||||
{
|
||||
$this->addClassMap( 'WPPFW\Database\Wordpress\WordpressOptions', 'WordpressOptions' );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,300 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace WCFE\Installer;
|
||||
|
||||
use \WCFE\Modules\SysFilters\Model\SysFiltersDashboardModel;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Installer extends \WCFE\Libraries\InstallerService {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $_upgraders = array
|
||||
(
|
||||
|
||||
'0.5.0', /* This version never returned from $this->getInstalledVersion()
|
||||
however installer will run this as installer is always start at index 0 */
|
||||
|
||||
'1.4.0',
|
||||
|
||||
|
||||
'1.5.0', // No upgrader
|
||||
|
||||
|
||||
'1.5.1',
|
||||
|
||||
|
||||
'1.5.2',
|
||||
|
||||
|
||||
'1.6.0',
|
||||
|
||||
|
||||
'1.6.1',
|
||||
|
||||
|
||||
'1.6.2',
|
||||
|
||||
|
||||
'1.6.3',
|
||||
|
||||
|
||||
'1.6.4',
|
||||
|
||||
|
||||
'1.6.5',
|
||||
|
||||
|
||||
'1.6.6',
|
||||
|
||||
|
||||
'1.6.7',
|
||||
|
||||
|
||||
'1.7.0',
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function _getCurrentVersion()
|
||||
{
|
||||
return end( $this->_upgraders );
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function getInstalledVersion()
|
||||
{
|
||||
global $wpdb;
|
||||
|
||||
# Backward comptability for version for version 1.4
|
||||
|
||||
# Return 1.4.0 if sys filters parameters option var exists
|
||||
|
||||
if ( ! $installedVersion = parent::getInstalledVersion() )
|
||||
{
|
||||
|
||||
$hasSysFilters = SysFiltersDashboardModel::getDataArray();
|
||||
|
||||
if ( $hasSysFilters )
|
||||
{
|
||||
|
||||
# Sys filter data will be exists if only system parameters
|
||||
# page has been visited however it will be empty if never saved!
|
||||
# We only need to do upgrade if its saved before so we avoid
|
||||
# overriding saved data, otherwise do fresh install
|
||||
|
||||
if ( isset( $hasSysFilters[ 'sysFiltersData' ][ 'http' ] ) )
|
||||
{
|
||||
$installedVersion = '1.4.0';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $installedVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public static function run( )
|
||||
{
|
||||
|
||||
$result = null;
|
||||
|
||||
if ( ! self::$instance )
|
||||
{
|
||||
# Create new installer
|
||||
$factory = new Factory( __NAMESPACE__ );
|
||||
|
||||
self::$instance = new Installer( $factory );
|
||||
|
||||
# Install or upgrade
|
||||
$state = self::$instance->getState();
|
||||
|
||||
switch ( $state )
|
||||
{
|
||||
|
||||
case self::STATE_FRESH_INSTALL:
|
||||
|
||||
$result = self::$instance->install();
|
||||
|
||||
break;
|
||||
|
||||
case self::STATE_UPGRADE:
|
||||
|
||||
$result = self::$instance->upgrade();
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
// Installed
|
||||
$result = true;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade all version < 1.4.0
|
||||
*
|
||||
* Add default Sys Filter Parameters when as it initially added
|
||||
* in version 1.4.0
|
||||
*
|
||||
*/
|
||||
public function upgrade_050()
|
||||
{
|
||||
|
||||
# Sys filters parameters for all version < 1.4.0
|
||||
$sysFilterOpts = SysFiltersDashboardModel::getDataArray();
|
||||
$defaultData = SysFiltersDashboardModel::getDefaults();
|
||||
|
||||
# Default Sys filters parameters added in version 1.5.0
|
||||
$parameters = array
|
||||
(
|
||||
'http' => array
|
||||
(
|
||||
'timeOut',
|
||||
'redirectCount',
|
||||
'version',
|
||||
'userAgent',
|
||||
'rejectUnsafeUrls',
|
||||
'proxyBlockLocalRequests',
|
||||
'localSSLVerify',
|
||||
'sslVerify',
|
||||
'useSteamTransport',
|
||||
'useCurlTransport',
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
foreach ( $parameters as $moduleName => $moduleParams )
|
||||
{
|
||||
|
||||
foreach ( $moduleParams as $paramName )
|
||||
{
|
||||
$sysFilterOpts[ 'sysFiltersData' ][ $moduleName ][ $paramName ] = $defaultData[ $moduleName ][ $paramName ];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# Save sys filter parameters
|
||||
SysFiltersDashboardModel::setDataArray( $sysFilterOpts );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade 1.4.0 to 1.5.0
|
||||
*
|
||||
* Add default Sysfilter parameters added in version 1.5.0
|
||||
*/
|
||||
public function upgrade_140()
|
||||
{
|
||||
|
||||
$sysFilterOpts = SysFiltersDashboardModel::getDataArray();
|
||||
$defaultData = SysFiltersDashboardModel::getDefaults();
|
||||
|
||||
# Default Sys filters Modules
|
||||
$modules = array
|
||||
(
|
||||
'misc',
|
||||
'editor',
|
||||
'kses',
|
||||
);
|
||||
|
||||
foreach ( $modules as $moduleName )
|
||||
{
|
||||
$sysFilterOpts[ 'sysFiltersData' ][ $moduleName ] = $defaultData[ $moduleName ];
|
||||
}
|
||||
|
||||
# Default Sys filters parameters
|
||||
$parameters = array
|
||||
(
|
||||
'http' => array
|
||||
(
|
||||
'stream',
|
||||
'blocking',
|
||||
'compress',
|
||||
'decompress',
|
||||
'responseSizeLimit',
|
||||
'allowLocalHost',
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
foreach ( $parameters as $moduleName => $moduleParams )
|
||||
{
|
||||
|
||||
foreach ( $moduleParams as $paramName )
|
||||
{
|
||||
$sysFilterOpts[ 'sysFiltersData' ][ $moduleName ][ $paramName ] = $defaultData[ $moduleName ][ $paramName ];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# Save sys filter parameters
|
||||
SysFiltersDashboardModel::setDataArray( $sysFilterOpts );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Upgrade 1.5.1
|
||||
*
|
||||
* Disable all HTTP Request Parameters as it break Wordpress
|
||||
* Upgrades!!!!
|
||||
*
|
||||
*/
|
||||
public function upgrade_151()
|
||||
{
|
||||
|
||||
$sysFilterOpts = SysFiltersDashboardModel::getDataArray();
|
||||
$defaultData = SysFiltersDashboardModel::getDefaults();
|
||||
|
||||
# Disable all parameters
|
||||
foreach ( $sysFilterOpts[ 'sysFiltersData' ] as $moduleName => & $moduleParams )
|
||||
{
|
||||
|
||||
foreach ( $moduleParams as $paramsName => & $param )
|
||||
{
|
||||
|
||||
$param[ 'options' ][ 'disabled' ] = true;
|
||||
}
|
||||
}
|
||||
|
||||
# Save sys filter parameters
|
||||
SysFiltersDashboardModel::setDataArray( $sysFilterOpts );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* WordpressOptions.class.php
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Installer;
|
||||
|
||||
# Imports
|
||||
use WPPFW\Obj;
|
||||
|
||||
# Original object
|
||||
use WPPFW\Database\Wordpress;
|
||||
|
||||
/**
|
||||
* Factoring Wordpress Database Options Table
|
||||
*
|
||||
* @author AHMeD SAiD
|
||||
*/
|
||||
class WordpressOptions {
|
||||
|
||||
/**
|
||||
* Creating new WPPFW\Database\Wordpress\WordpressOptions object
|
||||
* configued for WCFE Plugin
|
||||
*
|
||||
* @param Obj\Factory $factory
|
||||
* @return Wordpress\WordpressOptions
|
||||
*/
|
||||
public function getInstance( Obj\Factory & $factory )
|
||||
{
|
||||
|
||||
$plugin =& \WCFE\Plugin::me();
|
||||
|
||||
$prefix = strtolower( $plugin->getNamespace()->getNamespace() . '-' );
|
||||
|
||||
$wpOptionsObj = is_multisite() ?
|
||||
new Wordpress\MUWordpressOptions( $prefix, get_main_network_id() ) :
|
||||
new Wordpress\WordpressOptions( $prefix );
|
||||
|
||||
return $wpOptionsObj;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
namespace WCFE\Libraries\CSS\jQuery\Theme;
|
||||
|
||||
# Script resource
|
||||
use WPPFW\Services\Queue\StyleResource;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Theme extends StyleResource {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $fileName = 'jquery-ui.min.css';
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 212 B |
|
After Width: | Height: | Size: 208 B |
|
After Width: | Height: | Size: 335 B |
|
After Width: | Height: | Size: 207 B |
|
After Width: | Height: | Size: 262 B |
|
After Width: | Height: | Size: 262 B |
|
After Width: | Height: | Size: 332 B |
|
After Width: | Height: | Size: 280 B |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
7
wordpress_plugins/wp-config-file-editor/Libraries/CSS/jQuery/Theme/jquery-ui.min.css
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace WCFE\Libraries\Forms\Rules;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class RequiredField extends \WPPFW\Forms\Rules\RequiredField
|
||||
{
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param mixed $message
|
||||
*/
|
||||
protected function getMessageString( $message )
|
||||
{
|
||||
|
||||
switch ( $message )
|
||||
{
|
||||
case self::MSG_CANNOT_EMPTY:
|
||||
|
||||
return \WCFE\Plugin::__( 'Field Cannot be empty' );
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
$string = false;
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace WCFE\Libraries;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class InstallerService extends \WCFE\Libraries\PersistObject {
|
||||
|
||||
const STATE_FRESH_INSTALL = 2;
|
||||
const STATE_INSTALLED = 0;
|
||||
const STATE_UPGRADE = -1;
|
||||
const STATE_DOWNGRADE = 1;
|
||||
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
private $currentVersion;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $installedVersion;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $_upgraders = array();
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param \WPPFW\Obj\IFactory $factory
|
||||
* @param mixed $currentVersion
|
||||
* @return InstallerService
|
||||
*/
|
||||
public function __construct( \WPPFW\Obj\IFactory & $factory )
|
||||
{
|
||||
|
||||
$stateAdapter = new \WPPFW\MVC\Model\State\GlobalWPOptionsModelState( $factory, get_class( $this ) );
|
||||
|
||||
parent::__construct( $stateAdapter );
|
||||
|
||||
$this->currentVersion = $this->_getCurrentVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected abstract function _getCurrentVersion();
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function getInstalledVersion()
|
||||
{
|
||||
return $this->installedVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function getState()
|
||||
{
|
||||
|
||||
$installedVersion = $this->getInstalledVersion();
|
||||
|
||||
return ( ! $installedVersion ) ?
|
||||
self::STATE_FRESH_INSTALL :
|
||||
version_compare( $installedVersion, $this->currentVersion );
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public final function install()
|
||||
{
|
||||
return $this->processUpgraders( 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param mixed $startIndex
|
||||
*/
|
||||
protected function processUpgraders( $startIndex )
|
||||
{
|
||||
|
||||
# Run all upgraders, stop on error
|
||||
for ( $currentIndex = $startIndex; $currentIndex < count( $this->_upgraders ) ; $currentIndex++ )
|
||||
{
|
||||
|
||||
$upgraderName = str_replace( array( '.', '-' ), array( '', '_' ), $this->_upgraders[ $currentIndex ] );
|
||||
|
||||
$upgraderMethodName = "upgrade_{$upgraderName}";
|
||||
|
||||
if ( method_exists( $this, $upgraderMethodName ) )
|
||||
{
|
||||
|
||||
if ( ! $this->$upgraderMethodName() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# Set version number
|
||||
$this->installedVersion = $this->currentVersion;
|
||||
|
||||
# Save state
|
||||
$this->writeState();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function uninstall() { }
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public final function upgrade()
|
||||
{
|
||||
|
||||
$result = false;
|
||||
|
||||
$installedVersion = $this->getInstalledVersion();
|
||||
|
||||
$installedVersionUIdx = array_search( $installedVersion, $this->_upgraders );
|
||||
|
||||
if ( $installedVersionUIdx !== FALSE )
|
||||
{
|
||||
$result = $this->processUpgraders( $installedVersionUIdx );
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
namespace WCFE\Libraries\JavaScript\AceEditor;
|
||||
|
||||
# Script resource
|
||||
use WPPFW\Services\Queue\ScriptResource;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Theme extends ScriptResource {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $fileName = 'theme-xcode.js';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
namespace WCFE\Libraries\JavaScript\AceEditor;
|
||||
|
||||
# Script resource
|
||||
use WPPFW\Services\Queue\ScriptResource;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ACEditor extends ScriptResource {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $fileName = 'ace.js';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
namespace WCFE\Libraries\JavaScript\AceEditor;
|
||||
|
||||
# Script resource
|
||||
use WPPFW\Services\Queue\ScriptResource;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ACEExtLanguageTools extends ScriptResource {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $fileName = 'ext-language_tools.js';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
namespace WCFE\Libraries\JavaScript\AceEditor;
|
||||
|
||||
# Script resource
|
||||
use WPPFW\Services\Queue\ScriptResource;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ACEExtSearchBox extends ScriptResource {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $fileName = 'ext-searchbox.js';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
namespace WCFE\Libraries\JavaScript\AceEditor;
|
||||
|
||||
# Script resource
|
||||
use WPPFW\Services\Queue\ScriptResource;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ACEModePHP extends ScriptResource {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $fileName = 'mode-php.js';
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
define("ace/theme/xcode",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!1,t.cssClass="ace-xcode",t.cssText=".ace-xcode .ace_gutter {background: #e8e8e8;color: #333}.ace-xcode .ace_print-margin {width: 1px;background: #e8e8e8}.ace-xcode {background-color: #FFFFFF;color: #000000}.ace-xcode .ace_cursor {color: #000000}.ace-xcode .ace_marker-layer .ace_selection {background: #B5D5FF}.ace-xcode.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #FFFFFF;}.ace-xcode .ace_marker-layer .ace_step {background: rgb(198, 219, 174)}.ace-xcode .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #BFBFBF}.ace-xcode .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.071)}.ace-xcode .ace_gutter-active-line {background-color: rgba(0, 0, 0, 0.071)}.ace-xcode .ace_marker-layer .ace_selected-word {border: 1px solid #B5D5FF}.ace-xcode .ace_constant.ace_language,.ace-xcode .ace_keyword,.ace-xcode .ace_meta,.ace-xcode .ace_variable.ace_language {color: #C800A4}.ace-xcode .ace_invisible {color: #BFBFBF}.ace-xcode .ace_constant.ace_character,.ace-xcode .ace_constant.ace_other {color: #275A5E}.ace-xcode .ace_constant.ace_numeric {color: #3A00DC}.ace-xcode .ace_entity.ace_other.ace_attribute-name,.ace-xcode .ace_support.ace_constant,.ace-xcode .ace_support.ace_function {color: #450084}.ace-xcode .ace_fold {background-color: #C800A4;border-color: #000000}.ace-xcode .ace_entity.ace_name.ace_tag,.ace-xcode .ace_support.ace_class,.ace-xcode .ace_support.ace_type {color: #790EAD}.ace-xcode .ace_storage {color: #C900A4}.ace-xcode .ace_string {color: #DF0002}.ace-xcode .ace_comment {color: #008E00}.ace-xcode .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==) right repeat-y}";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)})
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
namespace WCFE\Libraries\JavaScript;
|
||||
|
||||
# Script resource
|
||||
use WPPFW\Services\Queue\ScriptResource;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ChechboxList extends ScriptResource {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $fileName = 'checkbox-list.js';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
namespace WCFE\Libraries\JavaScript;
|
||||
|
||||
# Script resource
|
||||
use WPPFW\Services\Queue\ScriptResource;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ErrorsDialog extends ScriptResource {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $fileName = 'ErrorsDialog.js';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
|
||||
( function( $ )
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
WCFEErrorsDialog = new function()
|
||||
{
|
||||
|
||||
this.show = function( errorsList )
|
||||
{
|
||||
|
||||
// Create errors list
|
||||
var errorsListEle = $( '#wcfe-errors-dialog-errors-list' ).empty();
|
||||
|
||||
for ( var errIndex = 0; errIndex < errorsList.length; errIndex ++ )
|
||||
{
|
||||
errorsListEle.append( '<li>' + errorsList[ errIndex ] + '</li>' );
|
||||
}
|
||||
|
||||
// Show Popup
|
||||
tb_show( WCFEErrorsDialogL10N.title , '#TB_inline?inlineId=wcfe-errors-dialog&width=500px&height=400px' )
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
} ) ( jQuery );
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
return array
|
||||
(
|
||||
'title' => $this->__( 'Config File Editor Errors' ),
|
||||
);
|
||||
@@ -0,0 +1,437 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
( function( $ )
|
||||
{
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
var editInput, childListToggler, addNewChildEle;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
var _onediting = function( event )
|
||||
{
|
||||
|
||||
if ( event.keyCode == 13 )
|
||||
{
|
||||
|
||||
// End Edit
|
||||
endEdit( 'save' );
|
||||
|
||||
// Dont submit
|
||||
return false;
|
||||
}
|
||||
else if ( event.keyCode == 27 )
|
||||
{
|
||||
endEdit();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
var _oninlineadd = function( event )
|
||||
{
|
||||
var link = $( this );
|
||||
|
||||
// Get parent checkbox name
|
||||
var li = link.parent().parent();
|
||||
var parentName = li.find( '>input[type="checkbox"]' ).prop( 'name' );
|
||||
|
||||
// Create new checkbox item from parent checkbox
|
||||
var newLi = li.clone()
|
||||
newLi.find( '>ul' ).remove();
|
||||
newLi.find( '>span' ).text( '' );
|
||||
|
||||
newLi.find( 'input[type="checkbox"]' ).prop( 'name', parentName );
|
||||
|
||||
li.find( '>ul' ).prepend( newLi );
|
||||
|
||||
_onedit( { target : newLi.find( '>span' ).get( 0 ) } );
|
||||
|
||||
link.hide();
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
var _oninputaddnew = function( event )
|
||||
{
|
||||
switch ( event.keyCode )
|
||||
{
|
||||
case 13:
|
||||
|
||||
var input = $( event.target );
|
||||
|
||||
// Add to checkbox list when pressing enter
|
||||
var list = input.prev();
|
||||
var listItem = $( '<li></li>' ).appendTo( list );
|
||||
var itemName = input.prop( 'id' ) + '[]';
|
||||
var textEle;
|
||||
var options = list.data( 'WCFECheckboxList' ).options;
|
||||
|
||||
$( '<input type="checkbox" name="' + itemName + '" value="' + input.val() + '" checked="checked" />' )
|
||||
|
||||
.appendTo( listItem )
|
||||
|
||||
.after( textEle = $( '<span>' + input.val() + '</span>' ) );
|
||||
|
||||
if ( options.allowEdit )
|
||||
{
|
||||
textEle.click( _onedit );
|
||||
}
|
||||
|
||||
// Clear input
|
||||
input.val( '' );
|
||||
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
var _onedit = function( event )
|
||||
{
|
||||
var li = $( event.target.parentNode );
|
||||
var textEle = $( event.target );
|
||||
|
||||
// Expand list
|
||||
li.parent().addClass( 'expanded' ).show();
|
||||
|
||||
textEle.hide();
|
||||
|
||||
// Show input with checkbox value
|
||||
editInput.insertBefore( textEle )
|
||||
.css( { width : '40%' } )
|
||||
.val( textEle.text() )
|
||||
.show()
|
||||
.focus();
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
var _onunchecked = function( event )
|
||||
{
|
||||
deleteItem( event.target );
|
||||
};
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param checkbox
|
||||
*/
|
||||
var deleteItem = function( checkbox )
|
||||
{
|
||||
editInput.detach();
|
||||
childListToggler.detach();
|
||||
|
||||
if ( addNewChildEle )
|
||||
{
|
||||
addNewChildEle.detach();
|
||||
}
|
||||
|
||||
$( checkbox ).parent().remove();
|
||||
};
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
var endEdit = function( action )
|
||||
{
|
||||
|
||||
var li = editInput.parent();
|
||||
var checkbox = li.find( 'input[type="checkbox"]' );
|
||||
var textEle = li.find( '>span' );
|
||||
value = editInput.val();
|
||||
|
||||
if ( editInput.css( 'display' ) == 'none' )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// hide edit input element
|
||||
editInput.hide();
|
||||
|
||||
textEle.show();
|
||||
|
||||
// Remove if new and no value specified
|
||||
if ( ! value || action == undefined )
|
||||
{
|
||||
|
||||
if ( ! textEle.text() )
|
||||
{
|
||||
|
||||
deleteItem( checkbox );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Save edit
|
||||
textEle.text( value );
|
||||
|
||||
// Setting name
|
||||
var checkboxName = checkbox.prop( 'name' );
|
||||
var newCheckboxName = checkboxName.replace( /\[[^\]]*\]$/, '[' + value + ']' );
|
||||
|
||||
// Add [] if current level is container (can has childs)
|
||||
/// TEMP SOLUTION TO CHECK 0
|
||||
if ( li.parent().data( 'wcfe-ui-hierarchical-component-level' ) == 0 )
|
||||
{
|
||||
newCheckboxName += '[]';
|
||||
}
|
||||
|
||||
checkbox.prop( 'name', newCheckboxName );
|
||||
};
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param list
|
||||
*/
|
||||
var inlineAddNew = function( list )
|
||||
{
|
||||
var checkbox = $( '<input type="checkbox" value="1" checked="checked" />' );
|
||||
var textEle = $( '<span></span>' );
|
||||
var li = $( '<li></li>' );
|
||||
var childList = $( '<ul class="checkbox-row wcfe-ui-hierarchical-component-level_1"></ul>' );
|
||||
var args = list.data( 'WCFECheckboxList' ).options;
|
||||
var baseName = list.parent().find( '#' + list.prop( 'id' ) + '-baseName' ).val() + '[]';
|
||||
|
||||
checkbox.prop( 'name', baseName );
|
||||
|
||||
li.append( checkbox ).append( textEle ).append( childList );
|
||||
|
||||
list.prepend( li );
|
||||
|
||||
_onedit( { target : textEle.get( 0 ) } );
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param list
|
||||
*/
|
||||
var setListLevels = function( list, level )
|
||||
{
|
||||
|
||||
var nextLevel = level + 1;
|
||||
|
||||
// Set list level
|
||||
list.addClass( 'wcfe-ui-hierarchical-component-level_' + level );
|
||||
list.data( 'wcfe-ui-hierarchical-component-level', level );
|
||||
|
||||
// Find child lists
|
||||
list.find( '>li' ).each(
|
||||
|
||||
function()
|
||||
{
|
||||
var childList = $( this ).find( '>ul' );
|
||||
|
||||
childList.each(
|
||||
|
||||
function()
|
||||
{
|
||||
setListLevels( $( this ), nextLevel );
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
$.fn.WCFECheckboxList = function( options )
|
||||
{
|
||||
|
||||
var args = $.extend(
|
||||
{
|
||||
allowNew : true,
|
||||
addNewMode : 'input',
|
||||
allowEdit : false,
|
||||
newPlaceholder : null,
|
||||
addMaxLevels : -1
|
||||
}, options );
|
||||
|
||||
// Add new item
|
||||
if ( args.allowNew )
|
||||
{
|
||||
switch ( args.addNewMode )
|
||||
{
|
||||
|
||||
case 'inline':
|
||||
|
||||
var checkboxListElement = this;
|
||||
|
||||
$( '<a href="#"></a>' ).prependTo( this )
|
||||
.addClass( 'inline-add-button' )
|
||||
.text( args.levels[ 0 ].addText )
|
||||
.click(
|
||||
|
||||
function()
|
||||
{
|
||||
|
||||
inlineAddNew( $( event.target ).next() );
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
// Allow adding child items to the max specified level
|
||||
addNewChildEle = $( '<a href="#" class="add-new-child"></a>' ).click( _oninlineadd );
|
||||
|
||||
this.delegate( 'li>span', 'mouseenter',
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function()
|
||||
{
|
||||
|
||||
var itemEle = $( this );
|
||||
var currentLevel = itemEle.parent().parent().data( 'wcfe-ui-hierarchical-component-level' );
|
||||
|
||||
if ( currentLevel < args.addMaxLevels )
|
||||
{
|
||||
itemEle.append( addNewChildEle.show().text( args.levels[ currentLevel + 1 ].addText ) );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
this.delegate( 'li>span', 'mouseleave',
|
||||
|
||||
function( event )
|
||||
{
|
||||
|
||||
addNewChildEle.hide();
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
this.find( '.checkbox-list-input' ).keydown( _oninputaddnew ).attr( 'placeholder', args.newPlaceholder );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Delete
|
||||
this.delegate( 'input:checkbox', 'change', _onunchecked );
|
||||
|
||||
// Edit
|
||||
if ( args.allowEdit )
|
||||
{
|
||||
this.find( 'li>span' ).click( _onedit );
|
||||
}
|
||||
|
||||
// Set list levels
|
||||
var rootList = this.find( '>ul' );
|
||||
setListLevels( rootList, 0 );
|
||||
|
||||
editInput = $( '<input type="text" />' ).hide().keydown( _onediting ).blur( endEdit );
|
||||
childListToggler = $( '<a class="child-items-toggler" href="#"></a>' ).hide().click(
|
||||
|
||||
function()
|
||||
{
|
||||
|
||||
var childList = childListToggler.parent().next().toggle().toggleClass( 'expanded' );
|
||||
|
||||
if ( childList.hasClass( 'expanded' ) )
|
||||
{
|
||||
childListToggler.addClass( 'expanded' );
|
||||
}
|
||||
else
|
||||
{
|
||||
childListToggler.removeClass( 'expanded' );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
// Child lists toggler
|
||||
$( this ).delegate( '>ul li', 'mouseover',
|
||||
|
||||
function()
|
||||
{
|
||||
|
||||
var itemEle = $( this );
|
||||
var list = itemEle.parent();
|
||||
var childList = itemEle.find( '>ul' );
|
||||
var currentLevel = list.data( 'wcfe-ui-hierarchical-component-level' );
|
||||
|
||||
if ( currentLevel < args.addMaxLevels )
|
||||
{
|
||||
childListToggler.prependTo( itemEle.find( '>span' ) );
|
||||
|
||||
if ( childList.hasClass( 'expanded' ) )
|
||||
{
|
||||
childListToggler.addClass( 'expanded' );
|
||||
}
|
||||
else
|
||||
{
|
||||
childListToggler.removeClass( 'expanded' );
|
||||
}
|
||||
|
||||
childListToggler.show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
$( this ).delegate( '>ul li', 'mouseleave',
|
||||
|
||||
function()
|
||||
{
|
||||
childListToggler.detach();
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
// Hold supplied instances vars for later reference
|
||||
rootList.each(
|
||||
function()
|
||||
{
|
||||
$( this ).data( 'WCFECheckboxList', { options : args } );
|
||||
}
|
||||
);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
} ( jQuery ) );
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
namespace WCFE\Libraries\JavaScript;
|
||||
|
||||
# Script resource
|
||||
use WPPFW\Services\Queue\ScriptResource;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class jQueryCookies extends ScriptResource {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $fileName = 'jquery.cookie.js';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
namespace WCFE\Libraries\JavaScript;
|
||||
|
||||
# Script resource
|
||||
use WPPFW\Services\Queue\ScriptResource;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class jQueryMenu extends ScriptResource {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $fileName = 'jquery-menu-ui.min.js';
|
||||
|
||||
}
|
||||
6
wordpress_plugins/wp-config-file-editor/Libraries/JavaScript/jquery-menu-ui.min.js
vendored
Normal file
7
wordpress_plugins/wp-config-file-editor/Libraries/JavaScript/jquery-ui.min.css
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
/*!
|
||||
* jQuery Cookie Plugin v1.4.1
|
||||
* https://github.com/carhartl/jquery-cookie
|
||||
*
|
||||
* Copyright 2013 Klaus Hartl
|
||||
* Released under the MIT license
|
||||
*/
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// CommonJS
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
|
||||
var pluses = /\+/g;
|
||||
|
||||
function encode(s) {
|
||||
return config.raw ? s : encodeURIComponent(s);
|
||||
}
|
||||
|
||||
function decode(s) {
|
||||
return config.raw ? s : decodeURIComponent(s);
|
||||
}
|
||||
|
||||
function stringifyCookieValue(value) {
|
||||
return encode(config.json ? JSON.stringify(value) : String(value));
|
||||
}
|
||||
|
||||
function parseCookieValue(s) {
|
||||
if (s.indexOf('"') === 0) {
|
||||
// This is a quoted cookie as according to RFC2068, unescape...
|
||||
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
||||
}
|
||||
|
||||
try {
|
||||
// Replace server-side written pluses with spaces.
|
||||
// If we can't decode the cookie, ignore it, it's unusable.
|
||||
// If we can't parse the cookie, ignore it, it's unusable.
|
||||
s = decodeURIComponent(s.replace(pluses, ' '));
|
||||
return config.json ? JSON.parse(s) : s;
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
function read(s, converter) {
|
||||
var value = config.raw ? s : parseCookieValue(s);
|
||||
return $.isFunction(converter) ? converter(value) : value;
|
||||
}
|
||||
|
||||
var config = $.cookie = function (key, value, options) {
|
||||
|
||||
// Write
|
||||
|
||||
if (value !== undefined && !$.isFunction(value)) {
|
||||
options = $.extend({}, config.defaults, options);
|
||||
|
||||
if (typeof options.expires === 'number') {
|
||||
var days = options.expires, t = options.expires = new Date();
|
||||
t.setTime(+t + days * 864e+5);
|
||||
}
|
||||
|
||||
return (document.cookie = [
|
||||
encode(key), '=', stringifyCookieValue(value),
|
||||
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
||||
options.path ? '; path=' + options.path : '',
|
||||
options.domain ? '; domain=' + options.domain : '',
|
||||
options.secure ? '; secure' : ''
|
||||
].join(''));
|
||||
}
|
||||
|
||||
// Read
|
||||
|
||||
var result = key ? undefined : {};
|
||||
|
||||
// To prevent the for loop in the first place assign an empty array
|
||||
// in case there are no cookies at all. Also prevents odd result when
|
||||
// calling $.cookie().
|
||||
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||
|
||||
for (var i = 0, l = cookies.length; i < l; i++) {
|
||||
var parts = cookies[i].split('=');
|
||||
var name = decode(parts.shift());
|
||||
var cookie = parts.join('=');
|
||||
|
||||
if (key && key === name) {
|
||||
// If second argument (value) is a function it's a converter...
|
||||
result = read(cookie, value);
|
||||
break;
|
||||
}
|
||||
|
||||
// Prevent storing a cookie that we couldn't decode.
|
||||
if (!key && (cookie = read(cookie)) !== undefined) {
|
||||
result[name] = cookie;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
config.defaults = {};
|
||||
|
||||
$.removeCookie = function (key, options) {
|
||||
if ($.cookie(key) === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Must not alter options, thus extending a fresh object...
|
||||
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
|
||||
return !$.cookie(key);
|
||||
};
|
||||
|
||||
}));
|
||||
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace WCFE\Libraries;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ParseString
|
||||
{
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $data = array();
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param mixed $string
|
||||
* @return WCFEParserString
|
||||
*/
|
||||
public function __construct( $string )
|
||||
{
|
||||
$this->parse( $string );
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function & getData()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param mixed $string
|
||||
*/
|
||||
protected function parse( $rawData )
|
||||
{
|
||||
|
||||
# Split into vars
|
||||
$vars = explode( '&', $rawData );
|
||||
|
||||
# FOr each var get name and valie operands
|
||||
foreach ( $vars as $name )
|
||||
{
|
||||
|
||||
# Get name value pairs
|
||||
$operands = explode( '=', $name );
|
||||
|
||||
# Decode name and value
|
||||
$varName = urldecode( $operands[ 0 ] );
|
||||
$varValue = urldecode( $operands[ 1 ] );
|
||||
|
||||
# Pretend that var name as child of DUMMY POST array
|
||||
preg_match( '/([a-zA-Z0-9-_]+)/', $varName, $varBaseName );
|
||||
$varBaseName = $varBaseName[ 0 ];
|
||||
|
||||
# Get array names
|
||||
preg_match_all( '/\[([^\]]*)\]/', $varName, $arrayNames, PREG_SET_ORDER );
|
||||
|
||||
array_unshift( $arrayNames, array( "[{$varBaseName}]", $varBaseName ) );
|
||||
|
||||
# Last element is the value element
|
||||
$valueElementName = array_pop( $arrayNames );
|
||||
$valueElementName = $valueElementName[ 1 ];
|
||||
|
||||
# Move inside until reaching the target element parent
|
||||
$pointer =& $this->data;
|
||||
|
||||
foreach ( $arrayNames as $arrayName )
|
||||
{
|
||||
$elementName = $arrayName[ 1 ];
|
||||
|
||||
if ( ! isset( $pointer[ $elementName ] ) )
|
||||
{
|
||||
$pointer[ $elementName ] = array();
|
||||
}
|
||||
|
||||
$pointer =& $pointer[ $elementName ];
|
||||
}
|
||||
|
||||
# Set element value
|
||||
if ( trim( $valueElementName ) )
|
||||
{
|
||||
$pointer[ $valueElementName ] = $varValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pointer[ ] = $varValue;
|
||||
}
|
||||
|
||||
# Get outside to the root and repeat!
|
||||
$pointer =& $this->data;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param mixed $string
|
||||
* @return WCFEPostRequestRawParser
|
||||
*/
|
||||
public static function & parseString( $string )
|
||||
{
|
||||
$instance = new ParseString( $string );
|
||||
|
||||
return $instance->getData();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace WCFE\Libraries;
|
||||
|
||||
|
||||
use WPPFW\MVC\Model\State\IModelStateAdapter;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class PersistObject
|
||||
{
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
private $stateAdapter;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param IModelStateAdapter $adapter
|
||||
* @return {PersistObject|IModelStateAdapter}
|
||||
*/
|
||||
public function __construct( IModelStateAdapter & $adapter )
|
||||
{
|
||||
|
||||
$this->stateAdapter = $adapter;
|
||||
|
||||
// Read state
|
||||
$this->readState();
|
||||
|
||||
$this->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function & getStateAdapter()
|
||||
{
|
||||
return $this->stateAdapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function init() { }
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function & readState()
|
||||
{
|
||||
|
||||
$stateAdapter =& $this->getStateAdapter();
|
||||
|
||||
foreach ( $stateAdapter->read() as $propName => $value )
|
||||
{
|
||||
|
||||
$this->$propName = $value;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function & writeState()
|
||||
{
|
||||
|
||||
$stateVars = array();
|
||||
$stateAdapter =& $this->getStateAdapter();
|
||||
$moduleClassReflection = new \ReflectionClass( $this );
|
||||
|
||||
# Copy all protected properties
|
||||
$statePropperties = $moduleClassReflection->getProperties( \ReflectionProperty::IS_PROTECTED );
|
||||
|
||||
foreach ( $statePropperties as $property )
|
||||
{
|
||||
|
||||
$propertyName = $property->getName();
|
||||
|
||||
if ( strpos( $propertyName, '_' ) === 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$stateVars[ $propertyName ] =& $this->$propertyName;
|
||||
}
|
||||
|
||||
$stateAdapter->write( $stateVars );
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace WCFE\Libraries;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ResStorage {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
private $basePath;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
private $baseUrl;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param mixed $baseUrl
|
||||
* @param mixed $basePath
|
||||
* @return ResStorage
|
||||
*/
|
||||
public function __construct( $baseUrl, $basePath )
|
||||
{
|
||||
$this->baseUrl = $baseUrl;
|
||||
$this->basePath = $basePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function getBasePath()
|
||||
{
|
||||
return $this->basePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function getBaseUrl()
|
||||
{
|
||||
return $this->baseUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param mixed $name
|
||||
*/
|
||||
public function & getRes( $class )
|
||||
{
|
||||
|
||||
# Get url for the requested class
|
||||
$url = $this->baseUrl;
|
||||
$path = $this->basePath;
|
||||
|
||||
$resClassEntities = explode( '\\', $class );
|
||||
|
||||
# Remove base namespace as it represnt baseUrl!
|
||||
array_shift( $resClassEntities );
|
||||
|
||||
# Remove class name
|
||||
array_pop( $resClassEntities );
|
||||
|
||||
$urlPathToRes = implode( '/', $resClassEntities );
|
||||
$filePathToRes = implode( DIRECTORY_SEPARATOR, $resClassEntities );
|
||||
|
||||
$resUrl = "{$url}/{$urlPathToRes}";
|
||||
$resPath = "{$path}/{$filePathToRes}";
|
||||
|
||||
# Generate unique name for the rquested resource
|
||||
$queueName = implode( '-', explode( '\\', strtolower( $class ) ) );
|
||||
|
||||
# Create res class
|
||||
$resObject = new $class( $queueName, $resUrl, $resPath );
|
||||
|
||||
return $resObject;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,334 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace WCFE\Modules\Editor\Controller\Editor;
|
||||
|
||||
# Imoprts
|
||||
use WPPFW\MVC\Controller\Controller;
|
||||
|
||||
# Config Form
|
||||
use WCFE\Modules\Editor\Model\Forms;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class EditorController extends Controller {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function systemCheckToolsAction()
|
||||
{
|
||||
|
||||
if ( ! is_super_admin() )
|
||||
{
|
||||
|
||||
die( $this->__( 'Access denied' ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Process tasks
|
||||
if ( isset( $_GET[ 'wcfe-tool' ] ) )
|
||||
{
|
||||
|
||||
if ( ( ! isset( $_GET[ 'securityNonce' ] ) ) ||
|
||||
( ! $_GET[ 'securityNonce' ] ) ||
|
||||
( ! wp_verify_nonce( $_GET[ 'securityNonce' ] ) ) )
|
||||
{
|
||||
|
||||
die( $this->__( 'Access Denied' ) );
|
||||
}
|
||||
|
||||
$model =& $this->getModel( 'SystemCheckTools' );
|
||||
|
||||
switch ( $_GET[ 'wcfe-tool' ] )
|
||||
{
|
||||
|
||||
case 'config-file':
|
||||
|
||||
$model->turnConfig( ( $_GET[ 'wcfe-task' ] == 'on' ) ? true : false );
|
||||
|
||||
break;
|
||||
|
||||
case 'htaccess-file':
|
||||
|
||||
$model->turnHTAccess( ( $_GET[ 'wcfe-task' ] == 'on' ) ? true : false );
|
||||
|
||||
break;
|
||||
|
||||
case 'emergency-backup':
|
||||
|
||||
# We've only delete here
|
||||
$editorModel =& $this->getModel();
|
||||
|
||||
$editorModel->deleteEmergencyBackup();
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
# Remove tasks query streing parameters (redirect)
|
||||
$selfActionUrl = $this->router()->route
|
||||
(
|
||||
new \WPPFW\MVC\MVCViewParams
|
||||
(
|
||||
null,
|
||||
'Editor',
|
||||
'SystemCheckTools',
|
||||
null,
|
||||
'SystemCheckTools'
|
||||
)
|
||||
);
|
||||
|
||||
$this->redirect( $selfActionUrl );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
# Check system requirements
|
||||
$model =& $this->getModel( 'SystemCheckTools' );
|
||||
|
||||
$model->checkAll();
|
||||
|
||||
return array( 'model' => & $model, 'securityNonce' => wp_create_nonce() );
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
|
||||
if ( ! is_super_admin() )
|
||||
{
|
||||
|
||||
die( $this->__( 'Access denied' ) );
|
||||
|
||||
}
|
||||
|
||||
# Initialize
|
||||
$model =& $this->getModel();
|
||||
$input =& $this->input();
|
||||
$router =& $this->router();
|
||||
$form =& $model->getForm();
|
||||
$flags = array();
|
||||
$activeProfile = false;
|
||||
|
||||
# If not posted it then one ofthf following:
|
||||
# 1. Returned from View Action with invalidated form data
|
||||
# 2. Just opening the page
|
||||
|
||||
if ( ! $input->isPost() )
|
||||
{
|
||||
|
||||
# Read flag
|
||||
if ( isset( $_GET[ 'flags' ] ) )
|
||||
{
|
||||
|
||||
$flags = explode( ',', $_GET[ 'flags'] );
|
||||
|
||||
}
|
||||
|
||||
// Set or clear active profile
|
||||
if ( isset( $_GET[ 'activeProfile' ] ) )
|
||||
{
|
||||
$model->setActiveProfile( $_GET[ 'activeProfile' ] );
|
||||
|
||||
$this->redirect( $router->routeAction() );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( in_array( 'unsetActiveProfile', $flags ) )
|
||||
{
|
||||
$model->unsetActiveProfile();
|
||||
|
||||
$this->redirect( $router->routeAction() );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# Load Active profile
|
||||
if ( $model->hasActiveProfile() )
|
||||
{
|
||||
|
||||
$profilesModel =& $this->getModel( 'Profiles', 'Profiles' );
|
||||
$activeProfile = $profilesModel->getProfile( $model->getActiveProfileId() );
|
||||
|
||||
# Its important to don't crash the Config Form base
|
||||
# in case active profile is not there for ANY reason!
|
||||
if ( ! $activeProfile ) // FALLBACK
|
||||
{
|
||||
|
||||
// Clea profile and refresh to display normal config file
|
||||
$model->unsetActiveProfile();
|
||||
|
||||
$model->AddError( $this->__( 'Unhandled Catchable Error!!! Active Profile doesnt exists!!! Config Form reseted back to wp-config file values!!' ) );
|
||||
|
||||
$this->redirect( $router->routeAction() );
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
# We here process to #2
|
||||
if ( $model->isBackForChange() )
|
||||
{
|
||||
|
||||
# Fill form from model state.
|
||||
$model->loadFromSaveState()
|
||||
|
||||
# Clear state
|
||||
->clearState();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ( $model->hasActiveProfile() )
|
||||
{
|
||||
$model->loadForm( $activeProfile->vars );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
# Force form to read data from Wordpress config file
|
||||
$model->loadFromConfigFile();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
# Fill form with submitted values (Raw Values without any ' " escapes!)
|
||||
$formValues = array
|
||||
(
|
||||
$form->getName() => filter_input( INPUT_POST, $form->getName(), FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY )
|
||||
);
|
||||
|
||||
$form->setValue( $formValues );
|
||||
|
||||
# Authorize
|
||||
if ( $form->isAuthorized() )
|
||||
{
|
||||
|
||||
# Validate
|
||||
if ( $model->validate() )
|
||||
{
|
||||
|
||||
# Version 1.0 moved save action to editor service controlle
|
||||
# Now this will always only preview action!
|
||||
$task = $form->get( 'Task' )->getValue();
|
||||
|
||||
if ( $task == Forms\ConfigFileForm::TASK_PREVIEW )
|
||||
{
|
||||
|
||||
# generate config file from the given values
|
||||
$model->generateConfigFile( $configGenerator )
|
||||
->setConfigFileContent( ( string ) $configGenerator )
|
||||
|
||||
# Save submitted vars to be used if
|
||||
# get back from preview to the form again.
|
||||
->saveSubmittedVars();
|
||||
|
||||
# Go to preview action
|
||||
$this->redirect( $router->routeAction( 'Preview' ) );
|
||||
|
||||
}
|
||||
else if ( $task == Forms\ConfigFileForm::TASK_VALIDATE )
|
||||
{
|
||||
# Nothing here, its already validated by $model->validate above!!
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
# Not authorized
|
||||
$model->addError( $this->__( 'Not authorized to take such action!! Please refrehs the page if you think this is wrong.' ) );
|
||||
}
|
||||
}
|
||||
|
||||
# Form security token
|
||||
$form->getSecurityToken()->setValue( $this->createSecurityToken() );
|
||||
|
||||
$result = array
|
||||
(
|
||||
'model' => & $model,
|
||||
'activeProfile' => $activeProfile,
|
||||
'info' => $model->getInfo(),
|
||||
);
|
||||
|
||||
# Return model to view
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function previewAction()
|
||||
{
|
||||
|
||||
if ( ! is_super_admin() )
|
||||
{
|
||||
die( $this->__( 'Access denied' ) );
|
||||
}
|
||||
|
||||
# Get model
|
||||
$model =& $this->getModel();
|
||||
$form = new Forms\RawConfigFileForm();
|
||||
|
||||
# Form security token
|
||||
$form->getSecurityToken()->setValue( $this->createSecurityToken() );
|
||||
|
||||
# Push model to view
|
||||
return array( 'model' => $model, 'form' => $form );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function rawEditAction()
|
||||
{
|
||||
|
||||
if ( ! is_super_admin() )
|
||||
{
|
||||
die( $this->__( 'Access denied' ) );
|
||||
}
|
||||
|
||||
# Get model
|
||||
$model =& $this->getModel();
|
||||
$form = new Forms\RawConfigFileForm();
|
||||
|
||||
# Form security token
|
||||
$form->getSecurityToken()->setValue( $this->createSecurityToken() );
|
||||
|
||||
# output wp-config.php file
|
||||
$model->setConfigFileContent( $model->readWPConfigFileContent() );
|
||||
|
||||
# Push model to view
|
||||
return array
|
||||
(
|
||||
'model' => $model,
|
||||
'form' => $form,
|
||||
'options' => array( 'backButton' => false )
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
} # End class
|
||||
@@ -0,0 +1,317 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace WCFE\Modules\Editor\Controller\EditorService;
|
||||
|
||||
# Imoprts
|
||||
use WPPFW\MVC\Controller\ServiceController;
|
||||
use WCFE\Modules\Editor\Model\Forms;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class EditorServiceController extends ServiceController {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
private function _checkPermission()
|
||||
{
|
||||
|
||||
# Check if permitted to take such action
|
||||
if (
|
||||
( ! isset( $_POST[ 'securityToken' ] ) ) ||
|
||||
|
||||
( ! $_POST[ 'securityToken' ] ) ||
|
||||
|
||||
( ! wp_verify_nonce( $_POST[ 'securityToken' ] ) ) ||
|
||||
|
||||
( ! is_super_admin() ) )
|
||||
{
|
||||
|
||||
header( 'HTTP/1.0 4.3 Forbidden' );
|
||||
|
||||
die( $this->__( 'Access Denied' ) );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function postUpdateAction()
|
||||
{
|
||||
|
||||
# Check permission
|
||||
if ( ! $this->_checkPermission() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/* Deprecating Delete Backup, Nothing to do for now!!!*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function preUpdateAction()
|
||||
{
|
||||
|
||||
# Check permission
|
||||
if ( ! $this->_checkPermission() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$result = array( 'restoreUrl' => '' );
|
||||
|
||||
# Create backup and get Restore Url back
|
||||
|
||||
/** @var \WCFE\Modules\Editor\Model\EditorModel */
|
||||
$model =& $this->getModel( 'Editor' );
|
||||
$isBackupCreated = $model->createBackup( $result[ 'restoreUrl' ] );
|
||||
|
||||
// Send Backup link to admin mail
|
||||
if ($isBackupCreated)
|
||||
{
|
||||
|
||||
$mailer = new \WCFE\Includes\Mail\EmergencyRestoreMail();
|
||||
|
||||
$mailStatus = $mailer->send($result[ 'restoreUrl' ]);
|
||||
}
|
||||
|
||||
# Return errors
|
||||
else if (!$isBackupCreated)
|
||||
{
|
||||
|
||||
$result[ 'errors' ] = $model->getErrors();
|
||||
|
||||
# avoid displayed error when redirected by making normal requetss
|
||||
$model->clearErrors();
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function createSecureKeyAction()
|
||||
{
|
||||
|
||||
# Check permission
|
||||
if ( ! $this->_checkPermission() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$count = $_POST[ 'count' ];
|
||||
$list = array();
|
||||
|
||||
while ( $count )
|
||||
{
|
||||
$list[ ] = wp_generate_password( 64, true, true );
|
||||
|
||||
$count --;
|
||||
}
|
||||
|
||||
# Generate Secure key
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function generateCookieHashAction()
|
||||
{
|
||||
|
||||
if ( ! $this->_checkPermission() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
return md5( uniqid() );
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function getSystemPathAction()
|
||||
{
|
||||
|
||||
# Check permission
|
||||
if ( ! $this->_checkPermission() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
# Get dirs list for current
|
||||
|
||||
$dirsList = glob( "{$_POST[ 'path' ]}*", GLOB_ONLYDIR );
|
||||
|
||||
return array( 'list' => $dirsList );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function setActiveProfileAction()
|
||||
{
|
||||
|
||||
# Check permission
|
||||
if ( ! $this->_checkPermission() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$model =& $this->getModel( 'Editor' );
|
||||
|
||||
$model->setActiveProfile( $_POST[ 'activeProfile' ] );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function updateConfigFileAction()
|
||||
{
|
||||
|
||||
# Check access
|
||||
if ( ! $this->_checkPermission() )
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
# Initialize
|
||||
$model =& $this->getModel( 'Editor' );
|
||||
$form =& $model->getForm();
|
||||
$result = array();
|
||||
|
||||
# Fill form with submitted values (Raw Values without any ' " escapes!)
|
||||
$formValues = array
|
||||
(
|
||||
$form->getName() => filter_input( INPUT_POST, $form->getName(), FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY )
|
||||
);
|
||||
|
||||
$form->setValue( $formValues );
|
||||
|
||||
if ( $model->validate() )
|
||||
{
|
||||
|
||||
# Generate config file from submitted fields
|
||||
$model->generateConfigFile( $configGenerator );
|
||||
$model->setConfigFileContent( (string) $configGenerator );
|
||||
|
||||
# If failr return errors back
|
||||
if ( ! $model->saveConfigFile() )
|
||||
{
|
||||
|
||||
$result[ 'errors' ] = $model->getErrors();
|
||||
|
||||
# avoid displayed error when redirected by making normal requetss
|
||||
$model->clearErrors();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function updateRawConfigFileAction()
|
||||
{
|
||||
|
||||
# Check access
|
||||
if ( ! $this->_checkPermission() )
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
# Get model
|
||||
$model =& $this->getModel( 'Editor' );
|
||||
$form = new Forms\RawConfigFileForm();
|
||||
$result = array();
|
||||
|
||||
# Fill form with value
|
||||
$formValues = array
|
||||
(
|
||||
'rawConfigFile' => filter_input( INPUT_POST, 'rawConfigFile', FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY )
|
||||
);
|
||||
|
||||
$form->setValue( $formValues );
|
||||
|
||||
# Load submitted raw config file
|
||||
$model->setConfigFileContent( $form->get( 'configFileContent' )->getValue() );
|
||||
|
||||
# Save
|
||||
if ( ! $model->saveConfigFile() )
|
||||
{
|
||||
|
||||
$result[ 'errors' ] = $model->getErrors();
|
||||
|
||||
# avoid displayed error when redirected by making normal requetss
|
||||
$model->clearErrors();
|
||||
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function validateFormAction()
|
||||
{
|
||||
|
||||
# Check permission
|
||||
if ( ! $this->_checkPermission() )
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# Initialize
|
||||
$model =& $this->getModel( 'Editor' );
|
||||
$form =& $model->getForm();
|
||||
|
||||
# Fill form with submitted values (Raw Values without any ' " escapes!)
|
||||
$formValues = array
|
||||
(
|
||||
$form->getName() => filter_input( INPUT_POST, $form->getName(), FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY )
|
||||
);
|
||||
|
||||
$form->setValue( $formValues );
|
||||
|
||||
$isValid = $model->validate();
|
||||
|
||||
# Error messages will be duplicated when redirected and revalidated
|
||||
$model->clearErrors();
|
||||
|
||||
return $isValid;
|
||||
}
|
||||
|
||||
} # End class
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace WCFE\Modules\Editor\Controller;
|
||||
|
||||
# JSON Responder framework
|
||||
use WPPFW\MVC\Service\JSONEncoder;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class JSONControllerResponder extends JSONEncoder {}
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace WCFE\Modules\Editor\Controller\MultiSiteToolsService;
|
||||
|
||||
# Imoprts
|
||||
use WPPFW\MVC\Controller\ServiceController;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class MultiSiteToolsServiceController extends ServiceController {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
private function _checkPermission()
|
||||
{
|
||||
|
||||
# Check if permitted to take such action
|
||||
if (
|
||||
( ! isset( $_POST[ 'securityToken' ] ) ) ||
|
||||
|
||||
( ! $_POST[ 'securityToken' ] ) ||
|
||||
|
||||
( ! wp_verify_nonce( $_POST[ 'securityToken' ] ) ) ||
|
||||
|
||||
( ! is_super_admin() ) )
|
||||
{
|
||||
|
||||
header( 'HTTP/1.0 4.3 Forbidden' );
|
||||
|
||||
die( $this->__( 'Access Denied' ) );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function setupNetworkAction()
|
||||
{
|
||||
if ( ! $this->_checkPermission() )
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$model =& $this->getModel( 'MultiSiteTools' );
|
||||
$result = array( 'error' => true );
|
||||
|
||||
# Read raw inputs
|
||||
$configConsts = filter_input( INPUT_POST, 'configConsts', FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY );
|
||||
$htaccessCode = filter_input( INPUT_POST, 'htaccessCode', FILTER_UNSAFE_RAW );
|
||||
|
||||
# Write config file
|
||||
$editorModel =& $this->getModel( 'Editor' );
|
||||
|
||||
if ( ! $model->writeMSConfigFileConstants( $editorModel, $configConsts ) )
|
||||
{
|
||||
|
||||
$result[ 'errorMessages' ] = $model->getErrors();
|
||||
|
||||
$model->clearErrors();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
# Reactivate plugins
|
||||
$model->reactivatePlugins();
|
||||
|
||||
# Write htaccess file
|
||||
if ( ! $model->writeMSHtAccessFile( $htaccessCode ) )
|
||||
{
|
||||
|
||||
$result[ 'errorMessages' ] = $model->getErrors();
|
||||
|
||||
$model->clearErrors();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
$result[ 'redirectTo' ] = home_url( 'wp-login.php' );
|
||||
$result[ 'error' ] = false;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
} # End class
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
namespace WCFE\Modules\Editor\Controller\MultiSiteTools;
|
||||
|
||||
# Imoprts
|
||||
use WPPFW\MVC\Controller\Controller;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class MultiSiteToolsController extends Controller {
|
||||
|
||||
/**.
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function SetupAction()
|
||||
{
|
||||
if ( ! is_super_admin() )
|
||||
{
|
||||
|
||||
die( $this->__( 'Access Denied' ) );
|
||||
}
|
||||
|
||||
$view = array();
|
||||
|
||||
$view[ 'securityNonce' ] = wp_create_nonce();
|
||||
|
||||
# Check if Multi site is enabled
|
||||
$view[ 'isMultiSite' ] = is_multisite();
|
||||
|
||||
if ( $_SERVER[ 'REQUEST_METHOD' ] != 'POST' )
|
||||
{
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
# Security Token
|
||||
if ( ! isset( $_POST[ 'securityNonce' ] ) ||
|
||||
! $_POST[ 'securityNonce' ] ||
|
||||
! wp_verify_nonce( $_POST[ 'securityNonce' ] ) )
|
||||
{
|
||||
|
||||
die( $this->__( 'Access Denied' ) );
|
||||
}
|
||||
|
||||
$model =& $this->getModel();
|
||||
|
||||
# Write Config File WP_ALLOW_MULTISITE and Load Line!!
|
||||
$editorModel =& $this->getModel( 'Editor' );
|
||||
|
||||
# Create Backup
|
||||
if ( ! $editorModel->createBackup( $view[ 'restoreBackupUrl' ] ) )
|
||||
{
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
# Save config file
|
||||
$view[ 'isSuccessed' ] = $model->writeConfigFileMSInitCode( $editorModel );
|
||||
|
||||
# Deactivate all Plugins
|
||||
$model->deactivatePlugins();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function SetupNetworkAction()
|
||||
{
|
||||
|
||||
if ( ! is_super_admin() )
|
||||
{
|
||||
|
||||
die( $this->__( 'Access Denied' ) );
|
||||
}
|
||||
|
||||
$model =& $this->getModel();
|
||||
|
||||
return array
|
||||
(
|
||||
'htaccessCode' => $model->getHtAccessFileContent(),
|
||||
'securityNonce' => wp_create_nonce(),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
} # End class
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class AuthKey extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Authentication Unique Keys and Salts.
|
||||
|
||||
Change these to different unique phrases!
|
||||
You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
|
||||
You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
|
||||
|
||||
@since 2.6.0'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'AUTH_KEY';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class AuthSalt extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'AUTH_SALT';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ConcatenateJavaScript extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutput = true;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Enable/ Disable JavaScript Concatenation'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'CONCATENATE_SCRIPTS';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\BooleanType();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class Constant extends Field {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getDefString()
|
||||
{
|
||||
# Prepare Value
|
||||
$value = $this->type->prepareValue( $this->getValue() );
|
||||
# Final statment
|
||||
return "define('{$this->getName()}', {$value});";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CookieAdminPath extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutput = true;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Admin cookies path'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'ADMIN_COOKIE_PATH';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getSuppressionValue()
|
||||
{
|
||||
return SITECOOKIEPATH . 'wp-admin';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CookieAuth extends CookieNamedBase {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $cookiePrefix = 'wordpress_';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
''
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'AUTH_COOKIE';
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CookieDomain extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutput = true;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Cookies Hash'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'COOKIE_DOMAIN';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CookieHash extends CookieNamedBase {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Cookies Hash'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'COOKIEHASH';
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CookieLoggedIn extends CookieNamedBase {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $cookiePrefix = 'wordpress_logged_in_';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Logged In Cookie'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'LOGGED_IN_COOKIE';
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class CookieNamedBase extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $cookiePrefix;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutput = true;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getSuppressionValue()
|
||||
{
|
||||
|
||||
# Generate cookie hash exactly as wordpress do
|
||||
$siteUrl = get_site_option( 'siteurl' );
|
||||
$cookieHash = md5( $siteUrl ? $siteUrl : '' );
|
||||
|
||||
return "{$this->cookiePrefix}{$cookieHash}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CookiePass extends CookieNamedBase {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $cookiePrefix = 'wordpresspass_';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Pass Cookie'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'PASS_COOKIE';
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CookiePath extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutput = true;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Path cookie'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'COOKIEPATH';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getSuppressionValue()
|
||||
{
|
||||
return preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CookiePluginsPath extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutput = true;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Plugins path cookie'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'PLUGINS_COOKIE_PATH';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getSuppressionValue()
|
||||
{
|
||||
return preg_replace( '|https?://[^/]+|i', '', WP_PLUGIN_URL );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CookieSecureAuth extends CookieNamedBase {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $cookiePrefix = 'wordpress_sec_';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Where to load language\'s file'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'SECURE_AUTH_COOKIE';
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CookieSitePath extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutput = true;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Site path cookie'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'SITECOOKIEPATH';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getSuppressionValue()
|
||||
{
|
||||
return preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CookieTest extends CookieNamedBase {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Test Cookie'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'TEST_COOKIE';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getSuppressionValue()
|
||||
{
|
||||
return 'wordpress_test_cookie';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CookieUser extends CookieNamedBase {
|
||||
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $cookiePrefix = 'wordpressuser_';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'User cookie'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'USER_COOKIE';
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Cron extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Disable the cron entirely by setting DISABLE_WP_CRON to true.'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'DISABLE_WP_CRON';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutput = true;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\BooleanType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CronAlternate extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Use this, for example, if scheduled posts are not getting published.
|
||||
|
||||
According to Otto\'s forum explanation, "this alternate method uses a redirection approach,
|
||||
which makes the users browser get a redirect when the cron needs to run,
|
||||
so that they come back to the site immediately while cron continues to run in the connection they just dropped.
|
||||
This method is a bit iffy sometimes, which is why it\'s not the default."'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'ALTERNATE_WP_CRON';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutput = true;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\BooleanType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class CronLockTimeOut extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Make sure a cron process cannot run more than once every WP_CRON_LOCK_TIMEOUT seconds'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'WP_CRON_LOCK_TIMEOUT';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\NumericType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class DbAllowRepair extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'automatic database optimization support.'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'WP_ALLOW_REPAIR';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutput = true;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\BooleanType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class DbCharSet extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Database Charset to use in creating database tables.'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'DB_CHARSET';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class DbCollate extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'The Database Collate type. Don\'t change this if in doubt.'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'DB_COLLATE';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class DbDontUpgradeGlobalTables extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'A DO_NOT_UPGRADE_GLOBAL_TABLES define prevents dbDelta() and the upgrade functions from doing expensive queries against global tables'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'DO_NOT_UPGRADE_GLOBAL_TABLES';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutput = true;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\BooleanType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class DbHost extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'MySQL hostname'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'DB_HOST';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
|
||||
$value = parent::getValue();
|
||||
|
||||
if ( $port = $this->form->get( 'DbPort' )->getValue() )
|
||||
{
|
||||
$value .= ":{$port}";
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class DbPassword extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'MySQL database username'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'DB_PASSWORD';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class DbPort extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Database connection port'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'DB_HOST';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutputForce = true;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class DbTablePrefix extends Variable {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'WordPress Database Table prefix.
|
||||
|
||||
You can have multiple installations in one database if you give each a unique
|
||||
prefix. Only numbers, letters, and underscores please!'
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'table_prefix';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class DbUser extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'MySQL database username'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'DB_USER';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
use WCFE\Modules\Editor\Model\ConfigFile\Templates\Master\Master;
|
||||
|
||||
# Form Framework
|
||||
use WPPFW\Forms\Form;
|
||||
use WPPFW\Forms\Fields\IField;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class Field {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array();
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $field;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $form;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
private $model;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutput = false;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutputDeps = array();
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutputForce = false;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param mixed $model
|
||||
* @param Form $form
|
||||
* @param {Form|IField} $field
|
||||
* @return {Field|Form|IField}
|
||||
*/
|
||||
public function __construct(Master & $model = null, Form & $form = null, IField & $field = null )
|
||||
{
|
||||
# Initialize
|
||||
$this->model =& $model;
|
||||
$this->form =& $form;
|
||||
$this->field =& $field;
|
||||
# Get type
|
||||
$this->type = $this->getType();
|
||||
# Initialize child
|
||||
$this->initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
|
||||
# Got out if to suppress output
|
||||
if ( $this->suppressOutputForce )
|
||||
{
|
||||
# Return no contents
|
||||
return '';
|
||||
}
|
||||
|
||||
# Initialize
|
||||
$string = "\n";
|
||||
|
||||
# List comments
|
||||
foreach ( $this->comments as $comment )
|
||||
{
|
||||
$string .= "\n/**\n* " . preg_replace( "/\n\s+/", "\n* ", $comment ) . "\n*/\n";
|
||||
}
|
||||
|
||||
# Get model definition string
|
||||
$string .= $this->getDefString();
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function & allReady()
|
||||
{
|
||||
|
||||
$value = $this->getValue();
|
||||
|
||||
# Got out if to suppress output
|
||||
if ( $this->suppressOutput && ( ! $value || ( $this->getValue() == $this->getSuppressionValue() ) ) )
|
||||
{
|
||||
|
||||
$this->setSuppressOutputForce( true );
|
||||
|
||||
# Force all deps fields to not output as well
|
||||
foreach ( $this->suppressOutputDeps as $fieldName )
|
||||
{
|
||||
$this->getModel()->getField( $fieldName )->setSuppressOutputForce( true );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected abstract function getDefString();
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function & getField()
|
||||
{
|
||||
return $this->field;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function & getModel()
|
||||
{
|
||||
return $this->model;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getSuppressionValue()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected abstract function getType();
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getValue()
|
||||
{
|
||||
return $this->field->getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function initialize() {}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function & setSuppressOutputForce( $value)
|
||||
{
|
||||
|
||||
$this->suppressOutputForce = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class LoggedInKey extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'LOGGED_IN_KEY';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class LoggedInSalt extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'LOGGED_IN_SALT';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class MaxMemoryLimit extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Max Memory Limit'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'WP_MAX_MEMORY_LIMIT';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutput = true;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getSuppressionValue()
|
||||
{
|
||||
return '256M';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class MemoryLimit extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Memory Limit'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'WP_MEMORY_LIMIT';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutput = true;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getSuppressionValue()
|
||||
{
|
||||
return '40M';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class MultiSite extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutput = true;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutputDeps = array
|
||||
(
|
||||
'MultiSite',
|
||||
'MultiSiteSubDomainInstall',
|
||||
'MultiSiteDomainCurrentSite',
|
||||
'MultiSitePathCurrentSite',
|
||||
'MultiSiteSiteId',
|
||||
'MultiSiteBlogId',
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Enable Multisite for current Wordpress installation'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
public function & allReady()
|
||||
{
|
||||
|
||||
parent::allReady();
|
||||
|
||||
# Stop WP_ALLOW_MULTISITE if I'm true
|
||||
$this->getModel()->getField( 'MultiSiteAllow' )->setSuppressOutputForce( $this->getValue() );
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'MULTISITE';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\BooleanType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class MultiSiteAllow extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Setup Multi site'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutput = true;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'WP_ALLOW_MULTISITE';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\BooleanType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class MultiSiteBlogId extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Multi Site current Blog Id'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'BLOG_ID_CURRENT_SITE';
|
||||
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $suppressOutput = true;
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\NumericType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
# Define namespace
|
||||
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class MultiSiteDomainCurrentSite extends Constant {
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $comments = array
|
||||
(
|
||||
'Multi Site Domain'
|
||||
);
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $name = 'DOMAIN_CURRENT_SITE';
|
||||
|
||||
/**
|
||||
* put your comment there...
|
||||
*
|
||||
*/
|
||||
protected function getType() {
|
||||
return new Types\StringType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||