Initial commit

This commit is contained in:
Felix Förtsch
2020-10-20 14:39:50 +02:00
commit 648ded8896
1225 changed files with 216511 additions and 0 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,14 @@
<?php
/**
*
*/
namespace WCFE\Modules\Editor\Controller;
# JSON Responder framework
use WPPFW\MVC\Service\JSONEncoder;
/**
*
*/
class JSONControllerResponder extends JSONEncoder {}

View File

@@ -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

View File

@@ -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

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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});";
}
}

View File

@@ -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';
}
}

View File

@@ -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';
}

View File

@@ -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();
}
}

View File

@@ -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';
}

View File

@@ -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';
}

View File

@@ -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}";
}
}

View File

@@ -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';
}

View File

@@ -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') . '/' );
}
}

View File

@@ -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 );
}
}

View File

@@ -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';
}

View File

@@ -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') . '/' );
}
}

View File

@@ -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';
}
}

View File

@@ -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';
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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;
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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;
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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';
}
}

View File

@@ -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';
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -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();
}
}

View File

@@ -0,0 +1,40 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class MultiSitePathCurrentSite extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Multi Site Current Root path'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'PATH_CURRENT_SITE';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class MultiSitePrimaryNetworkId extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Primary network site id'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'PRIMARY_NETWORK_ID';
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\NumericType();
}
}

View File

@@ -0,0 +1,48 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class MultiSiteSiteId extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Multi Site Current site Id'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'SITE_ID_CURRENT_SITE';
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\NumericType();
}
}

View File

@@ -0,0 +1,40 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class MultiSiteSubDomainInstall extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Use sub domains for network sites'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'SUBDOMAIN_INSTALL';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\BooleanType();
}
}

View File

@@ -0,0 +1,49 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class MultiSiteToolPluginLoader {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Load WCFE Plugin for Multi Sites Setup Tools'
);
/**
* put your comment there...
*
*/
public function & allReady()
{
return $this;
}
/**
* put your comment there...
*
*/
public function __toString()
{
ob_start();
require __DIR__ . DIRECTORY_SEPARATOR . 'MultiSiteToolPluginLoader.configcode.php';
return ob_get_clean();
}
}

View File

@@ -0,0 +1,21 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
# No direct access
defined('ABSPATH') or die( WCFE\NO_DIRECT_ACCESS_MESSAGE );
?>
///////////////////////////////// WCFE Plugin MULTI Sites Tools Plugin Loader Code Start /////////////////////////////////////
// Load Plugin
include_once WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'wp-config-file-editor' . DIRECTORY_SEPARATOR . 'wp-config-file-editor.php';
// Load Multi Sites Tools Services
\WCFE\Services\Editor\MultiSiteTools\Service::run();
///////////////////////////////// WCFE Plugin MULTI Sites Tools Plugin Loader Code End /////////////////////////////////////

View File

@@ -0,0 +1,30 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class NonceKey extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'NONCE_KEY';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,30 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class NonceSalt extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'NONCE_SALT';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,40 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class PostAutoSaveInterval extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Post Autosave Interval'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'AUTOSAVE_INTERVAL';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\NumericType();
}
}

View File

@@ -0,0 +1,41 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class PostEmptyTrashDays extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'this constant controls the number of days before WordPress permanently deletes
posts, pages, attachments, and comments, from the trash bin'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'EMPTY_TRASH_DAYS';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\NumericType();
}
}

View File

@@ -0,0 +1,69 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class PostRevisions extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Disable / Enable Post Revisions and specify revisions max count'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'WP_POST_REVISIONS';
/**
* put your comment there...
*
*/
public function & allReady()
{
parent::allReady();
$PostRevisionsMax = $this->getModel()->getField( 'PostRevisionsMax' );
$postRevisionMaxField = $PostRevisionsMax->getField();
$postRevisionsField = $this->getField();
# Suppress Post Rvisions Max if it has no value
if ( ! $postRevisionMaxField->getValue() || ! $postRevisionsField->getValue() )
{
$PostRevisionsMax->setSuppressOutputForce( true );
}
else
{
# Suppress Post Revisions if post revisions ON and post revisions Max has value
$this->setSuppressOutputForce( true );
}
return $this;
}
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\BooleanType();
}
}

View File

@@ -0,0 +1,40 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class PostRevisionsMax extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Disable / Enable Post Revisions and specify revisions max count'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'WP_POST_REVISIONS';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\NumericType();
}
}

View File

@@ -0,0 +1,56 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class ProxyBypassHosts extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Will prevent the hosts in this list from going through the proxy'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'WP_PROXY_BYPASS_HOSTS';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
/**
* put your comment there...
*
*/
protected function getValue()
{
return implode( ',', $this->field->getValue() );
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class ProxyHost extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Enable proxy support and host for connecting'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'WP_PROXY_HOST';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class ProxyPassword extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Proxy password, if it requires authentication'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'WP_PROXY_PASSWORD';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class ProxyPort extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Proxy port for connection. No default, must be defined'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'WP_PROXY_PORT';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class ProxyUser extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Proxy username, if it requires authentication'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'WP_PROXY_USERNAME';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,50 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class SaveQueries extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'The SAVEQUERIES definition saves the database queries to an array and that array can
be displayed to help analyze those queries.
The constant defined as true causes each query to be saved,
how long that query took to execute, and what function called it.'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'SAVEQUERIES';
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\BooleanType();
}
}

View File

@@ -0,0 +1,42 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class ScriptDebug extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'For developers: WordPress Script Debugging
Force Wordpress to use unminified JavaScript files'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'SCRIPT_DEBUG';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\BooleanType();
}
}

View File

@@ -0,0 +1,30 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class SecureAuthKey extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'SECURE_AUTH_KEY';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,30 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class SecureAuthSalt extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'SECURE_AUTH_SALT';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,56 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class SecurityAccessibleHosts extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'The constant WP_ACCESSIBLE_HOSTS will allow additional hosts to go through for requests'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'WP_ACCESSIBLE_HOSTS';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
/**
* put your comment there...
*
*/
protected function getValue()
{
return implode( ',', $this->field->getValue() );
}
}

View File

@@ -0,0 +1,40 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class SecurityAllowUnfilteredUploads extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
''
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'ALLOW_UNFILTERED_UPLOADS';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\BooleanType();
}
}

View File

@@ -0,0 +1,63 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class SecurityBlockExternalUrl extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Block external URL requests by defining WP_HTTP_BLOCK_EXTERNAL as true and this will only allow localhost and your blog to make requests'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'WP_HTTP_BLOCK_EXTERNAL';
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
*/
public function & allReady()
{
parent::allReady();
# Suppress Accessible hosts if FALSE
$accessibleHosts = $this->getModel()->getField( 'SecurityAccessibleHosts' );
$accessibleHosts->setSuppressOutputForce( ! $this->getValue() );
return $this;
}
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\BooleanType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class SecurityDisablePluggablesEditor extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Disable Plugins and Themes file editor.'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'DISALLOW_FILE_EDIT';
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\BooleanType();
}
}

View File

@@ -0,0 +1,40 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class SecurityDisallowUnfilteredHTML extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'disallow unfiltered HTML for everyone, including administrators and super administrators. To disallow unfiltered HTML for all users, you can add this to wp-config.php:'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'DISALLOW_UNFILTERED_HTML';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\BooleanType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class SecurityForceSSLAdmin extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'when you want to secure logins and the admin area so that both passwords and cookies are never sent in the clear. This is the most secure option'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'FORCE_SSL_ADMIN';
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\BooleanType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class SecurityForceSSLLogin extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'when you want to secure logins so that passwords are not sent in the clear, but you still want to allow non-SSL admin sessions (since SSL can be slow).'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'FORCE_SSL_LOGIN';
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\BooleanType();
}
}

View File

@@ -0,0 +1,23 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields\Types;
/**
*
*/
class BooleanType implements Itype {
/**
* put your comment there...
*
* @param mixed $value
*/
public function prepareValue($value) {
return $value ? 'true' : 'false';
}
}

View File

@@ -0,0 +1,19 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields\Types;
/**
*
*/
interface Itype {
/**
*
*/
public function prepareValue($value);
}

View File

@@ -0,0 +1,23 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields\Types;
/**
*
*/
class NumericType implements Itype {
/**
* put your comment there...
*
* @param mixed $value
*/
public function prepareValue($value) {
return $value;
}
}

View File

@@ -0,0 +1,26 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields\Types;
/**
*
*/
class StringType implements Itype {
/**
* put your comment there...
*
* @param mixed $value
*/
public function prepareValue($value) {
# Escape any ' found in the value
$value = addcslashes($value, '\\\'');
# Wrap as string and returns
return "'{$value}'";
}
}

View File

@@ -0,0 +1,84 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class UpgradeAutoCore extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
private $value;
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'The easiest way to manipulate core updates is with the WP_AUTO_UPDATE_CORE constant'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'WP_AUTO_UPDATE_CORE';
/**
* put your comment there...
*
*/
public function & allReady()
{
parent::allReady();
# Based on the value create either BOOLEAN or STRING type
# and set the value
$stringValue = $this->field->getValue();
if ( $stringValue != 'minor' ) // It means either true/false
{
$this->type = new Types\BooleanType();
$this->value = $stringValue == 'true' ? true : false;
}
else
{
$this->type = new Types\StringType();
$this->value = $stringValue;
}
return $this;
}
/**
* put your comment there...
*
*/
protected function getValue()
{
return $this->value;
}
/**
* put your comment there...
*
*/
protected function getType()
{
return $this->type;
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class UpgradeAutoDisable extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Disable all automatic updates'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'AUTOMATIC_UPDATER_DISABLED';
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\BooleanType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class UpgradeDisablePluggables extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'his will block users being able to use the plugin and theme installation/update functionality from the WordPress admin area. Setting this constant also disables the Plugin and Theme editor (i.e. you don\'t need to set DISALLOW_FILE_MODS and DISALLOW_FILE_EDIT, as on its own DISALLOW_FILE_MODS will have the same effect).'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'DISALLOW_FILE_MODS';
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\BooleanType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class UpgradeFSMethod extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'forces the filesystem method'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'FS_METHOD';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class UpgradeFTPBase extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
' full path to the "base"(ABSPATH) folder of the WordPress installation.'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'FTP_BASE';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class UpgradeFTPContentDir extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'full path to the wp-content folder of the WordPress installation'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'FTP_CONTENT_DIR';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class UpgradeFTPHost extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'the hostname:port combination for your SSH/FTP server. The default FTP port is 21 and the default SSH port is 22. These do not need to be mentioned.'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'FTP_HOST';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class UpgradeFTPPassword extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'he password for the username entered for FTP_USER. If you are using SSH public key authentication this can be omitted'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'FTP_PASS';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class UpgradeFTPPluginDir extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'the full path to the plugins folder of the WordPress installation'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'FTP_PLUGIN_DIR';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class UpgradeFTPPriKey extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'the full path to your SSH private ke'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'FTP_PRIKEY';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class UpgradeFTPPubKey extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'the full path to your SSH public key'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'FTP_PUBKEY';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class UpgradeFTPSSL extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'RUE for SSL-connection if supported by the underlying transport (not available on all servers). This is for "Secure FTP" not for SSH SFTP'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'FTP_SSL';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\BooleanType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class UpgradeFTPUser extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'either user FTP or SSH username. Most likely these are the same, but use the appropriate one for the type of update you wish to do.'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'FTP_USER';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
abstract class Variable extends Field {
/**
* put your comment there...
*
*/
protected function getDefString()
{
# Prepare Value
$value = $this->type->prepareValue( $this->getValue() );
# Final statment
return "\${$this->getName()} = {$value};";
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class WPCache extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Wordpress Cache!!'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'WP_CACHE';
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\BooleanType();
}
}

View File

@@ -0,0 +1,44 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class WPDebug extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'For developers: WordPress debugging mode.
Change this to true to enable the display of notices during development.
It is strongly recommended that plugin and theme developers use WP_DEBUG
in their development environments.'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'WP_DEBUG';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\BooleanType();
}
}

View File

@@ -0,0 +1,30 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class WPDebugDisplay extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'WP_DEBUG_DISPLAY';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\BooleanType();
}
}

View File

@@ -0,0 +1,30 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class WPDebugLog extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'WP_DEBUG_LOG';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\BooleanType();
}
}

View File

@@ -0,0 +1,45 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class WPLang extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'WordPress Localized Language, defaults to English.
Change this to localize WordPress. A corresponding MO file for the chosen
language must be installed to wp-content/languages. For example, install
de_DE.mo to wp-content/languages and set WPLANG to \'de_DE\' to enable German
language support.'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'WPLANG';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class WPLangDir extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $suppressOutput = true;
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'Where to load language\'s file'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'WPLANG_DIR';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,19 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\Forms\Fields;
/**
*
*/
interface IWPConfigFileField {
/**
*
*/
public function read();
}

View File

@@ -0,0 +1,40 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Fields;
/**
*
*/
class DbName extends Constant {
/**
* put your comment there...
*
* @var mixed
*/
protected $comments = array
(
'The name of the database for WordPress'
);
/**
* put your comment there...
*
* @var mixed
*/
protected $name = 'DB_NAME';
/**
* put your comment there...
*
*/
protected function getType() {
return new Types\StringType();
}
}

View File

@@ -0,0 +1,146 @@
<?php
/**
*
*/
# Define namespace
namespace WCFE\Modules\Editor\Model\ConfigFile\Templates\Master;
# Forms Framework
use WPPFW\Forms\Form;
use WCFE\Modules\Editor\Model\EditorModel;
/**
*
*/
class Master {
/**
* put your comment there...
*
* @var mixed
*/
protected $fields;
/**
* put your comment there...
*
* @var mixed
*/
protected $form;
/**
* put your comment there...
*
* @var mixed
*/
protected $specialFields;
/**
* put your comment there...
*
* @var mixed
*/
private $templateName = 'wp-config.php';
/**
* put your comment there...
*
* @param Form $form
* @param mixed $fields
* @return Master
*/
public function __construct( Form & $form, $fields ) {
# initialize
$this->form =& $form;
# Create all fieldsw
foreach ( $fields as $fieldClass => $fieldName )
{
$this->fields[ $fieldName ] = new $fieldClass( $this, $form, $form->get( $fieldName ) );
}
# Allow fields to interact and to Controler each others
# by making second iteration after constructions!!
foreach ( $this->fields as $field )
{
$field->allReady();
}
}
/**
* put your comment there...
*
*/
public function __toString()
{
ob_start();
require $this->templateName;
return ob_get_clean();
}
/**
* put your comment there...
*
* @param mixed $name
*/
public function & getField( $name )
{
return $this->fields[ $name ];
}
/**
* put your comment there...
*
*/
public function getFields()
{
return $this->fields;
}
/**
* put your comment there...
*
*/
public function & getForm() {
return $this->form;
}
/**
* put your comment there...
*
* @param mixed $specialFiels
*/
public function & processSpecialFields( $specialFields )
{
$this->specialFields = array();
$this->templateName = 'wp-config-special-fields.php';
# Remove special fields
foreach ( $specialFields as $specialFieldName )
{
if ( isset( $this->fields[ $specialFieldName ] ) )
{
$this->specialFields[ $specialFieldName ] =& $this->fields[ $specialFieldName ];
unset( $this->fields[ $specialFieldName ] );
}
}
return $this;
}
}

View File

@@ -0,0 +1,19 @@
<?php
# No direct access
defined( 'ABSPATH' ) or die( 'Access Denied!!!!!' );
# Use default config template
require __DIR__ . DIRECTORY_SEPARATOR . 'wp-config.php';
?>
/* WCFE Plugin Multi Sites Tools Plugin Bootstrap */
<?php
# Add special fields
foreach ( $this->specialFields as $field )
{
echo $field;
}

View File

@@ -0,0 +1,39 @@
<?php
# No direct access
defined( 'ABSPATH' ) or die( 'Access Denied!!!!!' );
echo "<?php\n";
?>
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information
* by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the
* installation. You don't have to use the web site, you can just copy this file
* to "wp-config.php" and fill in the values.
*
* @package WordPress
*/
// ** MySQL settings - You can get this info from your web host ** //
<?php
foreach ( $this->getFields() as $field )
{
echo $field;
}
?>
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

Some files were not shown because too many files have changed in this diff Show More