Example #1
0
 * This file is part of the Pinocchio library.
 *
 * (c) José Nahuel Cuesta Luengo <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
/**
 * This file is mainly Composer's bootstrap file, with some slight editions
 * to better suit Pinocchio's needs.
 *
 * @link https://github.com/composer/composer/blob/master/src/bootstrap.php
 */
/**
 * Require a file, only if it exists.
 * Return a boolean value indicating the result of the operation.
 *
 * @param  string $file The path to the file to require.
 *
 * @return bool
 */
function requireIfExists($file)
{
    if ($success = file_exists($file)) {
        require_once $file;
    }
    return $success;
}
if (!requireIfExists(__DIR__ . '/../vendor/autoload.php') && !requireIfExists(__DIR__ . '/../../../autoload.php')) {
    die('You must set up the project dependencies, run the following commands:' . PHP_EOL . 'curl -s http://getcomposer.org/installer | php' . PHP_EOL . 'php composer.phar install' . PHP_EOL);
}
Example #2
0
requireIfExists('class-wp-tax-query.php');
require_once ABSPATH . WPINC . '/link-template.php';
require_once ABSPATH . WPINC . '/rewrite.php';
require_once ABSPATH . WPINC . '/author-template.php';
requireIfExists('class-wp-rewrite.php');
requireIfExists('rest-api.php');
require_once ABSPATH . WPINC . '/rewrite.php';
require_once ABSPATH . WPINC . '/kses.php';
require_once ABSPATH . WPINC . '/revision.php';
require_once ABSPATH . WPINC . '/capabilities.php';
requireIfExists('class-wp-roles.php');
requireIfExists('class-wp-role.php');
require_once ABSPATH . WPINC . '/pluggable.php';
require_once ABSPATH . WPINC . '/pluggable-deprecated.php';
requireIfExists('class-wp-user.php');
requireIfExists('class-wp-user-query.php');
$GLOBALS['wp_rewrite'] = new WP_Rewrite();
// NOTICE: hack for warning in plugin_basename() function:
$wp_plugin_paths = array();
wp_plugin_directory_constants();
wp_cookie_constants();
// removing images downloaded by the chat:
$wiseChatImagesService = WiseChatContainer::get('services/WiseChatImagesService');
add_action('delete_attachment', array($wiseChatImagesService, 'removeRelatedImages'));
$actionsMap = array('wise_chat_messages_endpoint' => 'messagesEndpoint', 'wise_chat_message_endpoint' => 'messageEndpoint', 'wise_chat_delete_message_endpoint' => 'messageDeleteEndpoint', 'wise_chat_user_ban_endpoint' => 'userBanEndpoint', 'wise_chat_maintenance_endpoint' => 'maintenanceEndpoint', 'wise_chat_settings_endpoint' => 'settingsEndpoint', 'wise_chat_prepare_image_endpoint' => 'prepareImageEndpoint');
$wiseChatEndpoints = WiseChatContainer::get('endpoints/WiseChatEndpoints');
$action = $_REQUEST['action'];
if (array_key_exists($action, $actionsMap)) {
    $method = $actionsMap[$action];
    $wiseChatEndpoints->{$method}();
} else {