Sync redux changes

This commit is contained in:
ultimatemember
2015-01-21 22:22:12 +02:00
parent 57a99c5c81
commit 8f5b1f3dc2
15 changed files with 0 additions and 920 deletions
-26
View File
@@ -1,26 +0,0 @@
# Editors
project.xml
project.properties
/nbproject/private/
.buildpath
.project
.settings*
sftp-config.json
codekit-config.json
.idea
# Grunt
md5
/docs/
/redux/
/output/
/node_modules/
/grunt-phplint/
/tmp-wp-dev/
npm-debug.log
# OS X metadata
.DS_Store
# Windows junk
Thumbs.db
-54
View File
@@ -1,54 +0,0 @@
language: php
php:
#- 5.2
- 5.3
#- 5.4
env:
global:
#secure: "HxNuZO2wWngETP4ZAJN/IA4SCG9C3yw8hV4laJOrb9xXRv8w1YI4xLKUTDEK8H1tg3f0Yh4943f22aDPoXUu8oG913yljbrjMPXM+30FkbxPLOu4rViepjV1ZPJ0+aw+fGvNfDWBfeNx32Ooi9BeK5cpGTKeLgzAJCeG2mROPpo="
#secure: "vLqv9UpmPontcizx0ncbiaV0CJ6C54sFcJw1g4Csnwz7q3DJyHtGtjZLysKzyUzbXLzcSGWZfkeqbYXIuI7fdtIfBTSb9Zw39tPDItVzq9T+wyzkCv98F+LI4Py2UJR+dQNOzB+2s0IrAQZt3vsKnJbELKwQ1LWVkNXOu7eCIOo="
#secure: "N1TGV9fQSoXhWD0AUMLF4PEWE99ZHA3ypjARJZX3fsycRD4YUbCcIdnKld5rM/4meeVN4kULDci5bcwAv3GrZY0l4lYNFpnInoyOU6B8PFG0795feacUtj8T8GBs9C4P/9ikLkK9BBXEacQ+i/E2Lvv50QJ17RDAbmvXB3gWDvc="
#secure: "qZjPMjuQN2a4H2fQ9SSSfgAYRIoRmSTOxMF06CjeTQfIgimwmCayQYVVSKrXQorxpzHPjjg4vEs92oFuBE2nXDN0J4fA8u/E3Qvm4Mr9qWFn/JoOX+/xsYurPw9+rIjr75lT/b8cK38tdgqm7TmMIfsNY4RxHtOhXjt6hWGhUlY="
secure: "aDIYEmgxoF/+2vwPdvmbxFKMoz8pA9vtvemehyLNvH3LF05RgFiwNNv+7Lvy127p4Fxp3VBK+ZLKUEEL1gdpevzgni9EigpK8YZbIVHXRL3U+1eP9rcnjuGF9pKuB4kB2ivzoprcalg1ZDI9PnRYRDE4YUTHJiEN2MmLys1QWdc="
cache:
directories:
- node_modules
matrix:
- WP_VERSION=latest WP_MULTISITE=0
- WP_VERSION=latest WP_MULTISITE=1
install:
- npm install -g grunt-cli
- npm install
- find ReduxCore -type f | sort -u | xargs cat | md5sum > md5
before_script: bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
script:
- phpunit
- grunt jshint
- grunt lintPHP
after_success:
# Install the Heroku gem (or the Heroku toolbelt)
- gem install heroku
# Add your Heroku git repo:
- git remote add heroku git@heroku.com:redux-premium.git
# Turn off warnings about SSH keys:
- echo "Host heroku.com" >> ~/.ssh/config
- echo " StrictHostKeyChecking no" >> ~/.ssh/config
- echo " CheckHostIP no" >> ~/.ssh/config
- echo " UserKnownHostsFile=/dev/null" >> ~/.ssh/config
# Clear your current Heroku SSH keys:
- heroku keys:clear
# Add a new SSH key to Heroku
- yes | heroku keys:add
after_script:
#- ./bin/commit-uncompressed-files.sh
- ./bin/update-mirrors-docs.sh
notifications:
email:
recipients:
- dovy@reduxframework.com
- kevin.provance@gmail.com
on_failure: always
branches:
except:
- gh-pages
- setup
-1
View File
@@ -1 +0,0 @@
codex.reduxframework.com
@@ -1,23 +0,0 @@
if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_JOB_NUMBER" == *.1 ]]; then
echo -e "Checking to make sure files are properly compressed.\n"
v1=`find ReduxCore -type f | sort -u | xargs cat | md5sum`
echo "$v1"
grunt compileCSS
grunt compileJS
v2=`find ReduxCore -type f | sort -u | xargs cat | md5sum`
echo "$v2"
if [ "$v1" == "$v2" ]; then
echo "All files are properly compressed."
else
echo "Files are not the same. Need to commit back to the repo."
#git config --global user.email "travis@travis-ci.org"
#git config --global user.name "Travis"
#git remote set-url origin "https://$GH_TOKEN@github.com/ReduxFramework/ReduxFramework.git"
#git status
#git commit -a "Committing compressed files back to repo."
#git push origin HEAD:$TRAVIS_BRANCH
fi
fi
@@ -1,91 +0,0 @@
#!/usr/bin/env bash
if [ $# -lt 3 ]; then
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version]"
exit 1
fi
DB_NAME=$1
DB_USER=$2
DB_PASS=$3
DB_HOST=${4-localhost}
WP_VERSION=${5-latest}
# set dir vars
DIR_WP_DEVELOP=tmp-wp-dev
WP_CORE_DIR=${DIR_WP_DEVELOP}/wordpress/
export WP_TESTS_DIR=${DIR_WP_DEVELOP}/wordpress-tests/
set -ex
# cleanup
rm -rf ${DIR_WP_DEVELOP}
mysql -e "DROP DATABASE IF EXISTS ${DB_NAME};" --user="${DB_USER}" --password="${DB_PASS}"
install_wp() {
mkdir -p ${WP_CORE_DIR}
local ARCHIVE_NAME
if [ ${WP_VERSION} == 'latest' ]; then
ARCHIVE_NAME='latest'
else
ARCHIVE_NAME="wordpress-$WP_VERSION"
fi
wget -nv -O ${DIR_WP_DEVELOP}/wordpress.tar.gz http://wordpress.org/${ARCHIVE_NAME}.tar.gz
tar --strip-components=1 -zxmf ${DIR_WP_DEVELOP}/wordpress.tar.gz -C ${WP_CORE_DIR}
rm -f ${DIR_WP_DEVELOP}/wordpress.tar.gz
# wget -nv -O ${WP_CORE_DIR}/wp-content/db.php https://raw.github.com/markoheijnen/wp-mysqli/master/db.php
}
install_test_suite() {
# portable in-place argument for both GNU sed and Mac OSX sed
local ioption
if [[ $(uname -s) == 'Darwin' ]]; then
ioption='-i ""'
else
ioption='-i'
fi
# set up testing suite
mkdir -p ${WP_TESTS_DIR}
cd ${WP_TESTS_DIR}
svn co --quiet http://develop.svn.wordpress.org/trunk/tests/phpunit/includes/ .
# setup tests config file
cd ..
wget -nv -O wp-tests-config.php http://develop.svn.wordpress.org/trunk/wp-tests-config-sample.php
sed ${ioption} "s:dirname( __FILE__ ) . '/src/':'${WP_CORE_DIR}':" wp-tests-config.php
sed ${ioption} "s/youremptytestdbnamehere/${DB_NAME}/" wp-tests-config.php
sed ${ioption} "s/yourusernamehere/${DB_USER}/" wp-tests-config.php
sed ${ioption} "s/yourpasswordhere/${DB_PASS}/" wp-tests-config.php
sed ${ioption} "s|localhost|${DB_HOST}|" wp-tests-config.php
}
install_db() {
# parse DB_HOST for port or socket references
# local PARTS=(${DB_HOST//\:/ })
# local DB_HOSTNAME=${PARTS[0]};
# local DB_SOCK_OR_PORT=${PARTS[1]};
# local EXTRA=""
#
# if ! [ -z ${DB_HOSTNAME} ] ; then
# if [[ "${DB_SOCK_OR_PORT}" =~ ^[0-9]+$ ]] ; then
# EXTRA=" --host=${DB_HOSTNAME} --port=${DB_SOCK_OR_PORT} --protocol=tcp"
# elif ! [ -z ${DB_SOCK_OR_PORT} ] ; then
# EXTRA=" --socket=${DB_SOCK_OR_PORT}"
# elif ! [ -z ${DB_HOSTNAME} ] ; then
# EXTRA=" --host=${DB_HOSTNAME} --protocol=tcp"
# fi
# fi
# create database
mysql -e "CREATE DATABASE IF NOT EXISTS ${DB_NAME};" --user="${DB_USER}" --password="${DB_PASS}"
# mysqladmin create ${DB_NAME} --user="$DB_USER" --password="$DB_PASS"$EXTRA
}
install_wp
install_test_suite
install_db
@@ -1,40 +0,0 @@
#!/usr/bin/env bash
if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_JOB_NUMBER" == *.1 ]]; then
# update the mirror repo for composer/packagist
echo -e "Pushing to composer mirror\n"
git push --mirror https://${GH_TOKEN}@github.com/redux-framework/redux-framework.git
# Re-Deploy the heroku demo app and pull the newest code
echo -e "Starting dev demo push to Heroku\n"
git clone git@heroku.com:redux-premium.git redux-premium
cd redux-premium
git remote add heroku git@heroku.com:redux-premium.git
git reset HEAD~; git push -f heroku master;
cd ..
rm -fr redux-premium
echo -e "Starting to update documentation\n"
# Make sure we don't have any old files
rm -fr $HOME/docs
# Install phpDocumentor
pear channel-discover pear.phpdoc.org
pear install phpdoc/phpDocumentor
pear install Image_GraphViz
phpenv rehash #Have to run this for travis
# Generate the docs
grunt phpdocumentor
# Copy the github CNAME file to the docs
cp bin/CNAME docs/
# Publish the docs to gh-pages
grunt gh-pages:travis
fi
@@ -1,42 +0,0 @@
#!/usr/bin/env bash
#&& "$TRAVIS_PHP_VERSION" >= 5.3
if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_JOB_NUMBER" == *.1 ]]; then
# Update the mirror repo for composer/packagist
git push --mirror https://${GH_TOKEN}@github.com/redux-framework/redux-framework.git
# Re-Deploy the heroku demo app and pull the newest code
git clone git@heroku.com:redux-premium.git
cd redux-premium
git reset HEAD~; git push -f heroku master;
cd ..
# cd ..
# rm -fr $HOME/redux-premium
echo -e "Starting to update documentation\n"
# Make sure we don't have any old files
rm -fr $HOME/docs
# Install phpDocumentor
pear channel-discover pear.phpdoc.org
pear install phpdoc/phpDocumentor
pear install Image_GraphViz
phpenv rehash #Have to run this for travis
# Generate the docs
grunt phpdocumentor
# Copy the github CNAME file to the docs
cp bin/CNAME docs/
# Publish the docs to gh-pages
grunt gh-pages:travis
# Clean out the docs directory
#git rm -fr $HOME/docs/
fi
@@ -1,28 +0,0 @@
<?php
/**
* Bootstrap the plugin unit testing environment. Customize 'active_plugins'
* setting below to point to your main plugin file.
*
* Requires WordPress Unit Tests (http://unit-test.svn.wordpress.org/trunk/).
*
* @package wordpress-plugin-tests
*/
// Add this plugin to WordPress for activation so it can be tested.
$GLOBALS['wp_tests_options'] = array(
'active_plugins' => array( "ReduxFramework/redux-framework.php" ),
);
/**
* If the wordpress-tests repo location has been customized (and specified
* with WP_TESTS_DIR), use that location. This will most commonly be the case
* when configured for use with Travis CI.
*
* Otherwise, we'll just assume that this plugin is installed in the WordPress
* SVN external checkout configured in the wordpress-tests repo.
*/
if( false !== getenv( 'WP_TESTS_DIR' ) ) {
require getenv( 'WP_TESTS_DIR' ) . '/bootstrap.php';
} else {
require dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ) . '/bootstrap.php';
}
-14
View File
@@ -1,14 +0,0 @@
<phpunit
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
>
<testsuites>
<testsuite>
<directory prefix="test-" suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
@@ -1,31 +0,0 @@
<?php
echo "Welcome to the TIVWP Test Suite" . PHP_EOL;
echo "Version: 1.0" . PHP_EOL . PHP_EOL;
$_tests_dir = getenv( 'WP_TESTS_DIR' );
if ( ! $_tests_dir ) {
$_tests_dir = realpath( dirname( __FILE__ ) . '/../tmp-wp-dev/wordpress-tests' ) . '/';
}
echo 'Tests folder: ' . $_tests_dir . PHP_EOL . PHP_EOL;
// load some helpful functions
require_once $_tests_dir . 'functions.php';
// Activates this plugin in WordPress so it can be tested.
function _manually_load_plugin() {
require dirname( __FILE__ ) . '/tivwp-dm.php';
}
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
$GLOBALS['wp_tests_options'] = array(
'active_plugins' => array( 'tivwp-dm/tivwp-dm.php' ),
);
// fire up test suite
require_once $_tests_dir . 'bootstrap.php';
// include unit test base class
//require_once dirname( __FILE__ ) . '/framework/class-wpseo-unit-test-case.php';
@@ -1,165 +0,0 @@
<?php
require_once 'class-tivwp-dm.php';
require_once 'class-tivwp-dm-notices.php';
/**
* Class TIVWP_DM_Controller
* @package TIVWP_DM
* @author tivnet
*/
class TIVWP_DM_Controller {
/**
* Constructor
*/
public static function construct() {
/**
* The auto-switch should always work
*/
self::_load_plugin_list();
self::_setup_automatic_switch();
/**
* The rest relies on user privileges, and therefore must wait until necessary WP functions are loaded
*/
if (!did_action('plugins_loaded')) {
_doing_it_wrong(__METHOD__, __('Must call in of after the "plugins_loaded" action.'), '14.03.19');
return;
}
/**
* Low-level users won't see anything
*/
if (!current_user_can(TIVWP_DM::MIN_CAPABILITY)) {
return;
}
/**
* The main actions happen in the admin area
*/
if (is_admin()) {
self::_setup_i18n();
self::_setup_plugin_composer();
self::_setup_admin_interface();
}
}
/**
* Initialize plugin list
* @see TIVWP_DM::load_plugin_list
*/
private static function _load_plugin_list() {
add_action('init', array(
'TIVWP_DM',
'load_plugin_list'
), 0);
}
/**
* Setup action call for internationalization
* @see TIVWP_DM::action_init_load_plugin_textdomain
*/
private static function _setup_i18n() {
add_action('init', array(
'TIVWP_DM',
'action_init_load_plugin_textdomain'
));
}
/**
* Prompt administrator to install and activate plugins
*/
private static function _setup_plugin_composer() {
if (!class_exists('TGM_Plugin_Activation')) {
/**
* @author Thomas Griffin <thomas@thomasgriffinmedia.com>
* @author Gary Jones <gamajo@gamajo.com>
* @link https://github.com/thomasgriffin/TGM-Plugin-Activation
*/
require_once dirname(__FILE__) . '/../vendor/class-tgm-plugin-activation.php';
}
/**
* This happens on
* @wp-hook init
* @see TGM_Plugin_Activation::init
* @see TIVWP_DM::action_tgmpa_register
*/
add_action('tgmpa_register', array(
'TIVWP_DM',
'action_tgmpa_register'
));
}
/**
* Setup admin area menus to bulk switch development plugins on/off
* @see TIVWP_DM::turn_output_buffering
* @see TIVWP_DM::action_admin_menu
*/
private static function _setup_admin_interface() {
add_action('admin_init', array(
'TIVWP_DM',
'turn_output_buffering'
));
add_action('admin_menu', array(
'TIVWP_DM',
'action_admin_menu'
));
}
/**
* Setup automatic plugins on/off switching depending on the defined TIVWP_DM_AUTO constant
* @see TIVWP_DM::activate_all_development_plugins
* @see TIVWP_DM::deactivate_all_development_plugins
*/
private static function _setup_automatic_switch() {
if (!defined('TIVWP_DM_AUTO')) {
return;
}
$action = TIVWP_DM_AUTO;
/**
* If there is no callable method corresponding to the TIVWP_DM_AUTO set,
* notify admin and set a fallback action
*/
if (!is_callable(array(
'TIVWP_DM',
"{$action}_all_development_plugins"
))
) {
TIVWP_DM_Notices::add(sprintf(__('Unknown action "%1$s" specified for %2$s', 'tivwp-dm'), $action, 'TIVWP_DM_AUTO'), TIVWP_DM_Notices::WITH_TRIGGER_ERROR
);
$action = TIVWP_DM::ACTION_DEACTIVATE;
TIVWP_DM_Notices::add(sprintf(__('The unknown action has been replaced with "%s"', 'tivwp-dm'), $action), TIVWP_DM_Notices::WITH_TRIGGER_ERROR);
}
/**
* Silently (de)activate all development plugins
* @todo admin bar on front is shown before this, so it will be updated only on the next screen refresh
*/
add_action('init', array(
'TIVWP_DM',
"{$action}_all_development_plugins"
), 20);
/**
* Enqueue admin notice about the action performed
*/
TIVWP_DM_Notices::add(sprintf(__('Automatic action performed: "%s"', 'tivwp-dm'), $action, TIVWP_DM_Notices::WITHOUT_TRIGGER_ERROR));
}
}
// class
# --- EOF
@@ -1,82 +0,0 @@
<?php
/**
* Class TIVWP_DM_Notices
* @package TIVWP_DM
* @author tivnet
*/
class TIVWP_DM_Notices {
const NOTICE_LABEL = 'TIVWP-DM';
const WITH_TRIGGER_ERROR = true;
const WITHOUT_TRIGGER_ERROR = false;
/**
* @var array $_notices Collect here all notices we need to display
*/
private static $_notices = array();
/**
* Add new notice
* @param string $notice Message to display
* @param bool $do_trigger_error [false] If true, issue trigger_error()
*/
public static function add($notice, $do_trigger_error = self::WITHOUT_TRIGGER_ERROR) {
/**
* If we are in the admin area, and the current user is capable to understand what we are talking about...
*/
if (is_admin() && current_user_can(TIVWP_DM::MIN_CAPABILITY)) {
/**
* Add new notice to the stack
*/
self::$_notices[] = $notice;
/**
* If that was the first notice, then hook our function
* @see display()
* to the admin_notices action
*/
if (sizeof(self::$_notices) === 1) {
add_action('admin_notices', array(
'TIVWP_DM_Notices',
'display'
));
}
}
/**
* ... and log the error immediately, whether we are in admin area or not, if requested
*/
if ($do_trigger_error === self::WITH_TRIGGER_ERROR) {
$notice = self::NOTICE_LABEL . ':' . $notice;
if (WP_DEBUG && WP_DEBUG_DISPLAY) {
trigger_error($notice); // out loud
} else {
error_log($notice); // silently
}
}
}
/**
* Display all collected notices in admin area
* @wp-hook admin_notices
*/
public static function display() {
echo '<div class="error"><p>';
echo self::NOTICE_LABEL . ':';
foreach (self::$_notices as $notice) {
echo '<br/>' . esc_html($notice);
}
echo '</p></div>';
}
}
//class
# --- EOF
@@ -1,234 +0,0 @@
<?php
/**
* Class TIVWP_DM
* @package TIVWP_DM
* @author tivnet
*/
class TIVWP_DM {
const MIN_CAPABILITY = 'activate_plugins';
const MENU_SLUG_ACTIVATE = 'tivwp-dm-activate';
const MENU_SLUG_DEACTIVATE = 'tivwp-dm-deactivate';
/**
* @important Do not change these constants. They are used to form WP function names.
*/
const ACTION_ACTIVATE = 'activate';
const ACTION_DEACTIVATE = 'deactivate';
/**
* @var array $development_plugins Initially empty. Loaded from $_default_development_plugins
* @see load_plugin_list
*/
private static $development_plugins = array();
/**
* Accessor method used in unit tests
* @return array
*/
public static function get_development_plugins() {
return self::$development_plugins;
}
/**
* @var array $_default_development_plugins Default list of plugins. Use 'tivwp_dm_plugin_list' to modify.
*/
private static $_default_development_plugins = array(
array(
'name' => 'Debug Bar',
'slug' => 'debug-bar',
'required' => false,
),
array(
'name' => 'Debug Bar Console',
'slug' => 'debug-bar-console',
'required' => false,
),
array(
'name' => 'Kint Debugger',
'slug' => 'kint-debugger',
'required' => false,
),
array(
'name' => 'Query Monitor',
'slug' => 'query-monitor',
'required' => false,
),
);
/**
* Load the default plugin list into the working one, with filter.
*/
public static function load_plugin_list() {
self::$development_plugins = apply_filters('tivwp_dm_plugin_list', self::$_default_development_plugins);
}
/**
* Hooked methods
*/
/**
* Load translations
*/
public static function action_init_load_plugin_textdomain() {
/**
* We are in the "includes" sub-folder. Therefore, need this "funny" construction to go up.
* @todo Save plugin folder somewhere else and use it here
*/
$folder_i18n = dirname(dirname(plugin_basename(__FILE__))) . '/languages';
load_plugin_textdomain('tivwp-dm', false, $folder_i18n);
}
/**
* Prompt to install required and recommended plugins
* @wp-hook tgmpa_register
*/
public static function action_tgmpa_register() {
tgmpa(self::$development_plugins);
}
/**
* Turn on output buffering for wp_redirect to work
* @wp-hook admin_init
*/
public static function turn_output_buffering() {
if (isset($GLOBALS['plugin_page']) && in_array($GLOBALS['plugin_page'], array(
self::MENU_SLUG_ACTIVATE,
self::MENU_SLUG_DEACTIVATE,
))
) {
ob_start();
}
}
/**
* Setup administrator menu options
* @wp-hook admin_menu
*/
public static function action_admin_menu() {
add_plugins_page(
'', __('Activate Development Plugins', 'tivwp-dm'), self::MIN_CAPABILITY, self::MENU_SLUG_ACTIVATE, array(
__CLASS__,
'menu_callback_activate'
)
);
add_plugins_page(
'', __('Deactivate Development Plugins', 'tivwp-dm'), self::MIN_CAPABILITY, self::MENU_SLUG_DEACTIVATE, array(
__CLASS__,
'menu_callback_deactivate'
)
);
}
/**
* Service method: protect from non-authorized users
*/
private static function _die_if_not_authorized() {
if (!current_user_can(self::MIN_CAPABILITY)) {
wp_die(__('You do not have sufficient permissions to access this page.', 'tivwp-dm'));
}
}
/**
* Activate all development plugins and redirect to the list of active plugins
* activate-multi=true is used to display the "Selected plugins activated" message
*/
public static function menu_callback_activate() {
self::_die_if_not_authorized();
self::activate_all_development_plugins();
wp_redirect(self_admin_url('plugins.php?plugin_status=active&activate-multi=true'));
exit;
}
/**
* Deactivate all development plugins and redirect to the list of inactive plugins
* deactivate-multi=true is used to display the "Selected plugins deactivated" message
*/
public static function menu_callback_deactivate() {
self::_die_if_not_authorized();
self::deactivate_all_development_plugins();
wp_redirect(self_admin_url('plugins.php?plugin_status=inactive&deactivate-multi=true'));
exit;
}
/**
* Public interface to the _switch_all_development_plugins method
*/
public static function activate_all_development_plugins() {
self::_switch_all_development_plugins(self::ACTION_ACTIVATE);
}
/**
* Public interface to the _switch_all_development_plugins method
*/
public static function deactivate_all_development_plugins() {
self::_switch_all_development_plugins(self::ACTION_DEACTIVATE);
}
/**
* The $development_plugins array has only plugin slugs, and not the path to the plugin file,
* needed by activation/deactivation methods.
* Therefore, we build a list of plugins in the form $slug => $plugin
* @example
* $all_plugins = array(
* 'query-monitor' => 'query-monitor/query-monitor.php',
* 'debug-bar' => 'debug-bar/debug-bar.php',
* 'woocommerce' => 'woocommerce/woocommerce.php'
* );
* and then we make the array of the values, keeping only those that are in the $development_plugins
* @example
* $plugins = array(
* 'query-monitor/query-monitor.php',
* 'debug-bar/debug-bar.php',
* );
* @return array
*/
private static function _get_plugins() {
/**
* When on front, the WordPress Plugin Administration API is not available by default
*/
if (!function_exists('get_plugins')) {
/** @noinspection PhpIncludeInspection */
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$all_plugins = array();
foreach (array_keys(get_plugins()) as $plugin) {
$all_plugins[dirname($plugin)] = $plugin;
}
$plugins = array();
foreach (self::$development_plugins as $plugin_info) {
if (!empty($all_plugins[$plugin_info['slug']])) {
$plugins[] = $all_plugins[$plugin_info['slug']];
}
}
return $plugins;
}
/**
* Pass the list of development plugins to the (de)activation function.
* @param string $action Activate or Deactivate
*/
private static function _switch_all_development_plugins($action = self::ACTION_ACTIVATE) {
$plugins = self::_get_plugins();
$redirect = '';
$network_wide = false;
$silent = false;
switch ($action) {
case self::ACTION_ACTIVATE:
activate_plugins($plugins, $redirect, $network_wide, $silent);
break;
case self::ACTION_DEACTIVATE:
deactivate_plugins($plugins, $silent, $network_wide);
break;
}
}
}
# --- EOF
@@ -1,10 +0,0 @@
<?php
class SampleTest extends WP_UnitTestCase {
function testSample() {
// replace this with some actual testing code
$this->assertTrue( true );
}
}
@@ -1,79 +0,0 @@
<?php
/**
* Plugin Name: TIVWP-DM Development Manager
* Plugin URI: https://github.com/TIVWP/tivwp-dm
* Description: Install and manage development plugins. (Single-site only, no Network Activation).
* Text Domain: tivwp-dm
* Domain Path: /languages/
* Version: 14.03.25
* Author: TIV.NET
* Author URI: http://www.tiv.net
* Network: false
* License: GPL2
*/
/* Copyright 2014 Gregory Karpinsky (tiv.net)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}
/**
* There is nothing in this plugin for WP AJAX calls,
* so we cut this off right away, even before loading our classes.
*/
if (defined('DOING_AJAX') && DOING_AJAX) {
return;
}
/**
* Disable network activation on multisite.
* @param bool $network_wide
*/
function tivwp_dm_disable_network_activation($network_wide) {
if ($network_wide) {
$silent = true;
deactivate_plugins(plugin_basename(__FILE__), $silent, $network_wide);
wp_redirect(network_admin_url('plugins.php?deactivate=true'));
exit;
}
}
/**
* There should be no reason to use this plugin network-wide.
* However, if anyone wants that, there is a constant that allows:
* <code>
* define( 'TIVWP_DM_NETWORK_ACTIVATION_ALLOWED', true );
* </code>
*/
if (!( defined('TIVWP_DM_NETWORK_ACTIVATION_ALLOWED') && TIVWP_DM_NETWORK_ACTIVATION_ALLOWED )) {
register_activation_hook(__FILE__, 'tivwp_dm_disable_network_activation');
}
/**
* Launch the Controller only after plugins_loaded, so we can do necessary validation
* @see TIVWP_DM_Controller::construct
*/
require_once dirname(__FILE__) . '/includes/class-tivwp-dm-controller.php';
add_action('plugins_loaded', array(
'TIVWP_DM_Controller',
'construct'
)
);
# --- EOF