<?php

use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;

$loader = require_once __DIR__.'/../app/bootstrap.php.cache';

if(extension_loaded('apc') && ini_get('apc.enabled')){
    // Use APC for autoloading to improve performance.
    // Change 'sf2' to a unique prefix in order to prevent cache key conflicts
    // with other applications also using APC.
    $apcLoader = new ApcClassLoader('sf2', $loader);
    $loader->unregister();
    $apcLoader->register(true);
}

require_once __DIR__.'/../app/AppKernel.php';

$kernel = new AppKernel('prod', false);

$kernel->loadClassCache();
if (!isset($_SERVER['HTTP_SURROGATE_CAPABILITY']) || false === strpos($_SERVER['HTTP_SURROGATE_CAPABILITY'], 'ESI/1.0')) {
    require_once __DIR__.'/../app/AppCache.php';
    $kernel = new AppCache($kernel);
}

// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
//Request::enableHttpMethodParameterOverride();
//Request::setTrustedProxies(array('127.0.0.1'));
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

<?php

use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;

$loader = require_once __DIR__.'/../app/bootstrap.php.cache';

if(extension_loaded('apc') && ini_get('apc.enabled')){
    // Use APC for autoloading to improve performance.
    // Change 'sf2' to a unique prefix in order to prevent cache key conflicts with other applications also using APC.
    // The Kunstmaan build system does this automatically.
    $apcLoader = new ApcClassLoader('sf2', $loader);
    $loader->unregister();
    $apcLoader->register(true);
}

require_once __DIR__.'/../app/AppKernel.php';

if (getenv('APP_ENV') === 'dev') {
    Debug::enable();
    $kernel = new AppKernel('dev', true);
} else {
    $kernel = new AppKernel('prod', false);
}

$kernel->loadClassCache();

if (getenv('APP_ENV') !== 'dev') {
    if (!isset($_SERVER['HTTP_SURROGATE_CAPABILITY']) || false === strpos($_SERVER['HTTP_SURROGATE_CAPABILITY'], 'ESI/1.0')) {
        require_once __DIR__.'/../app/AppCache.php';
        $kernel = new AppCache($kernel);
    }
}

Request::enableHttpMethodParameterOverride();
Request::setTrustedProxies(array('127.0.0.1'));
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

Use APP_ENV to determine if you use dev or not

Leaving app_dev.php to ease migration


<?php
/**
 * @author    Igor Nikolaev <igor.sv.n@gmail.com>
 * @copyright Copyright (c) 2015, Darvin Studio
 * @link      https://www.darvin-studio.ru
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Darvin\Utils\Twig\Extension;

use Darvin\Utils\NewObject\NewObjectCounterInterface;

/**
 * New object Twig extension
 */
class NewObjectExtension extends \Twig_Extension
{
    /**
     * @var \Darvin\Utils\NewObject\NewObjectCounterInterface
     */
    private $newObjectCounter;

    /**
     * @param \Darvin\Utils\NewObject\NewObjectCounterInterface $newObjectCounter New object counter
     */
    public function __construct(NewObjectCounterInterface $newObjectCounter)
    {
        $this->newObjectCounter = $newObjectCounter;
    }

    /**
     * {@inheritdoc}
     */
    public function getFunctions()
    {
        return [
            new \Twig_SimpleFunction('utils_count_new_objects', [$this->newObjectCounter, 'count']),
            new \Twig_SimpleFunction('utils_new_objects_countable', [$this->newObjectCounter, 'isCountable']),
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'darvin_utils_new_object_extension';
    }
}

<?php
/**
 * @author    Igor Nikolaev <igor.sv.n@gmail.com>
 * @copyright Copyright (c) 2015, Darvin Studio
 * @link      https://www.darvin-studio.ru
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Darvin\Utils\Twig\Extension;

use Darvin\Utils\NewObject\NewObjectCounterInterface;

/**
 * New object Twig extension
 */
class NewObjectExtension extends \Twig_Extension
{
    /**
     * @var \Darvin\Utils\NewObject\NewObjectCounterInterface
     */
    private $newObjectCounter;

    /**
     * @param \Darvin\Utils\NewObject\NewObjectCounterInterface $newObjectCounter New object counter
     */
    public function __construct(NewObjectCounterInterface $newObjectCounter)
    {
        $this->newObjectCounter = $newObjectCounter;
    }

    /**
     * {@inheritdoc}
     */
    public function getFunctions()
    {
        return [
            new \Twig_SimpleFunction('utils_count_new_objects', [$this->newObjectCounter, 'count']),
            new \Twig_SimpleFunction('utils_new_objects_countable', [$this->newObjectCounter, 'isCountable']),
        ];
    }
}

Replace deprecated "getName()" method from Twig extensions.


<?php

namespace App\Console\Commands\Bulk;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

class BulkAll extends BaseCommand
{

    protected $signature = 'bulk:all {skip?}';

    protected $description = "Reset database and import everything";

    public function handle()
    {
        $shouldSkipTo = $this->argument('skip') ?? false;

        // Import all bulkable resources from compliant data services
        foreach (config('resources.inbound') as $source => $endpoints) {
            foreach ($endpoints as $endpoint => $resource) {
                dump("$source >> $endpoint");

                if ($shouldSkipTo && $source !== $shouldSkipTo) {
                    dump("Skipping...");
                    continue;
                }

                $this->call('bulk:import', [
                    'source' => $source,
                    'endpoint' => $endpoint,
                ]);

                $shouldSkipTo = false;
            }
        }

        /*

        // TODO: Use bulking for import:images
        // TODO: Use upserts for import:analytics

        // Import non-standard data
        $this->call('import:mobile');
        $this->call('import:sites', ['--yes' => 'default']);
        $this->call('import:ulan');
        $this->call('import:analytics');

        // EventOccurrence is not included in import:web to avoid duplication
        $this->call('import:web-full', ['--yes' => 'default', 'endpoint' => 'event-occurrences']);

        */

    }

}

<?php

namespace App\Console\Commands\Bulk;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

class BulkAll extends BaseCommand
{

    protected $signature = 'bulk:all {skip?}';

    protected $description = "Reset database and import everything";

    public function handle()
    {
        $shouldSkipTo = $this->argument('skip') ?? false;

        // Import all bulkable resources from compliant data services
        foreach (config('resources.inbound') as $source => $endpoints) {
            foreach ($endpoints as $endpoint => $resource) {
                dump("$source >> $endpoint");

                if ($shouldSkipTo && $source !== $shouldSkipTo) {
                    dump("Skipping...");
                    continue;
                }

                $this->call('bulk:import', [
                    'source' => $source,
                    'endpoint' => $endpoint,
                ]);

                $shouldSkipTo = false;
            }
        }

        // EventOccurrence is not included in import:web to avoid duplication
        $this->call('import:web-full', ['--yes' => 'default', 'endpoint' => 'event-occurrences']);

        // Run scout now for faster uptime
        $this->call('scout:import-all');

        // Import non-standard data
        $this->call('import:mobile');
        $this->call('import:sites', ['--yes' => 'default']);
        $this->call('import:ulan');

        // TODO: Use upserts for import:analytics
        $this->call('import:analytics');

        // TODO: Use bulking for import:images
        $this->call('import:images');
    }

}

Enable non-standard imports and indexing in `bulk:all`


Togglable tabs

data-toggle="tab"

$(this).tab('show')

.table-content .tab-pane.active

.table-content .tab-pane

Events: show.bs.tab shown.bs.tab

Togglable tabs

                data-toggle="tab"

                $(this).tab('show')

.table-content .tab-pane.active

.table-content .tab-pane

Fade effect

            Tab #1

            Tab #2

.table-content .tab-pane.fade.in.active

.table-content .tab-pane.fade

Events: show.bs.tab shown.bs.tab

Add fade effect to togglable tabs section


<?php

namespace Application\View\Helper;

use Zend\View\Helper\AbstractHelper;

class GitHubRepositoryUrl extends AbstractHelper
{
    /**
     * @var string
     */
    protected $owner;

    /**
     * @var string
     */
    protected $name;

    /**
     * @var string
     */
    protected $url;

    /**
     * @param string $owner
     * @param string $name
     */
    public function __construct($owner, $name)
    {
        $this->owner = $owner;
        $this->name = $name;
    }

    /**
     * @return string
     */
    public function __invoke()
    {
        if ($this->url === null) {
            $this->url = sprintf('https://github.com/%s/%s', $this->owner, $this->name);
        }

        return $this->url;
    }
}

<?php

namespace Application\View\Helper;

use Zend\View\Helper\AbstractHelper;

class GitHubRepositoryUrl extends AbstractHelper
{
    /**
     * @var string
     */
    private $owner;

    /**
     * @var string
     */
    private $name;

    /**
     * @var string
     */
    private $url;

    /**
     * @param string $owner
     * @param string $name
     */
    public function __construct($owner, $name)
    {
        $this->owner = $owner;
        $this->name = $name;
    }

    /**
     * @return string
     */
    public function __invoke()
    {
        if ($this->url === null) {
            $this->url = sprintf('https://github.com/%s/%s', $this->owner, $this->name);
        }

        return $this->url;
    }
}

Reduce visibility of class members

Fix: Reduce visibility of class members


<?php

namespace Aurora\Http\Middleware;

use Closure;
use Illuminate\Contracts\Auth\Guard;

class CheckRole
{
    /**
     * The Guard implementation.
     *
     * @var Guard
     */
    protected $auth;

    /**
     * Create a new filter instance.
     *
     * @param  Guard  $auth
     */
    public function __construct(Guard $auth)
    {
        $this->auth = $auth;
    }

    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure $next
     * @param $roles
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $roles = array_slice(func_get_args(), 2);

        // If user is a guest (e.g. no role), or is missing the provided role... get out!
        if ($this->auth->guest() || ! $this->auth->user()->hasRole($roles)) {
            if ($request->ajax()) {
                return response('Unauthorized.', 401);
            } else {
                return view('auth.unauthorized');
            }
        }

        return $next($request);
    }
}

<?php

namespace Aurora\Http\Middleware;

use Closure;
use Illuminate\Contracts\Auth\Guard;

class CheckRole
{
    /**
     * The Guard implementation.
     *
     * @var Guard
     */
    protected $auth;

    /**
     * Create a new filter instance.
     *
     * @param  Guard  $auth
     */
    public function __construct(Guard $auth)
    {
        $this->auth = $auth;
    }

    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        // e.g. $this->middleware('role:admin,intern') => ['admin', 'intern']
        $roles = array_slice(func_get_args(), 2);

        // If user is a guest (e.g. no role), or is missing the provided role... get out!
        if ($this->auth->guest() || ! $this->auth->user()->hasRole($roles)) {
            if ($request->ajax()) {
                return response('Unauthorized.', 401);
            } else {
                return view('auth.unauthorized');
            }
        }

        return $next($request);
    }
}

Update docblock & add explanatory comment.


<?php

// Support Do Not Track header.
// http://donottrack.us/
function isDntEnabled() {
   return (isset($_SERVER['HTTP_DNT']) && $_SERVER['HTTP_DNT'] == 1);
}

if(isDntEnabled() && Settings::pluginGet("dnt"))
	echo "<!-- Disabling Google Analytics because you have Do Not Track set! We're awesome like that. -->";
else
{
	$loginstatus = $loguserid?"Yes":"No";

	echo <<<EOS
	<script type="text/javascript">

	  var _gaq = _gaq || [];
	  _gaq.push(['_setAccount', '<?php print trim(Settings::pluginGet("trackingid"));?>']);
	  _gaq.push(['_setCustomVar', 1, 'Logged in', '$loginstatus', 2]);
	  _gaq.push(['_trackPageview']);

	  (function() {
		var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	  })();

	</script>
EOS;

}

<?php

// Support Do Not Track header.
// http://donottrack.us/
function isDntEnabled() {
   return (isset($_SERVER['HTTP_DNT']) && $_SERVER['HTTP_DNT'] == 1);
}

if(isDntEnabled() && Settings::pluginGet("dnt"))
	echo "<!-- Disabling Google Analytics because you have Do Not Track set! We're awesome like that. -->";
else
{
	$loginstatus = json_encode($loguserid?"Yes":"No");
	$tracking_id = json_encode(trim(Settings::pluginGet("trackingid")));

	echo <<<EOS
	<script type="text/javascript">

	  var _gaq = _gaq || [];
	  _gaq.push(['_setAccount', $tracking_id]);
	  _gaq.push(['_setCustomVar', 1, 'Logged in', $loginstatus, 2]);
	  _gaq.push(['_trackPageview']);

	  (function() {
		var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	  })();

	</script>
EOS;

}

Fix Google Analytics plugin to actually work


<?php
/**
 * _s Theme Customizer
 *
 * @package _s
 * @since _s 1.2
 */

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 *
 * @since _s 1.2
 */
function _s_customize_register( $wp_customize ) {
	$wp_customize->get_setting( 'blogname' )->transport        = 'postMessage';
	$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
}
add_action( 'customize_register', '_s_customize_register' );

/**
 * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
 *
 * @since _s 1.2
*/
function _s_customize_preview_js() {
	wp_enqueue_script( '_s_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20120827', true );
}
add_action( 'customize_preview_init', '_s_customize_preview_js' );

Add a space to let it shine.

Add a space to let it shine.


<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Config;
use Orchestra\Story\Model\Content;

class OrchestraStoryMakeContentsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		$format = Config::get('orchestra/story::config.default_format', 'markdown');

		Schema::create('story_contents', function ($table) use ($format)
		{
			$table->increments('id');
			$table->integer('user_id')->unsigned();
			$table->string('slug');
			$table->string('title');
			$table->text('content');
			$table->string('format')->default($format);
			$table->string('type')->default(Content::POST);
			$table->string('status')->default(Content::STATUS_DRAFT);

			$table->timestamps();
			$table->datetime('published_at');
			$table->softDeletes();

			$table->index('user_id');
			$table->index('slug');
			$table->index('format');
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('story_contents');
	}

}

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Config;
use Orchestra\Story\Model\Content;

class OrchestraStoryMakeContentsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		$format = Config::get('orchestra/story::default_format', 'markdown');

		Schema::create('story_contents', function ($table) use ($format)
		{
			$table->increments('id');
			$table->integer('user_id')->unsigned();
			$table->string('slug');
			$table->string('title');
			$table->text('content');
			$table->string('format')->default($format);
			$table->string('type')->default(Content::POST);
			$table->string('status')->default(Content::STATUS_DRAFT);

			$table->timestamps();
			$table->datetime('published_at');
			$table->softDeletes();

			$table->index('user_id');
			$table->index('slug');
			$table->index('format');
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('story_contents');
	}

}

Remove config prefix as we are only using single file configuration

Signed-off-by: crynobone <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>


<?php

$config = SimpleSAML_Configuration::getInstance();
$sconfig = SimpleSAML_Configuration::getConfig('config-sanitycheck.php');

$info = array();
$errors = array();
$hookinfo = array(
	'info' => &$info,
	'errors' => &$errors,
);
SimpleSAML_Module::callHooks('sanitycheck', $hookinfo);

if (isset($_REQUEST['output']) && $_REQUEST['output'] == 'text') {

	if (count($errors) === 0) {
		echo 'OK';
	} else {
		echo 'FAIL';
	}
	exit;
}

$t = new SimpleSAML_XHTML_Template($config, 'sanitycheck:check-tpl.php');
$t->data['pageid'] = 'statistics';
$t->data['errors'] = $errors;
$t->data['info'] = $info;
$t->data['jquery'] = $jquery;
$t->show();

<?php

$config = SimpleSAML_Configuration::getInstance();
$sconfig = SimpleSAML_Configuration::getConfig('config-sanitycheck.php');

$info = array();
$errors = array();
$hookinfo = array(
	'info' => &$info,
	'errors' => &$errors,
);
SimpleSAML_Module::callHooks('sanitycheck', $hookinfo);

if (isset($_REQUEST['output']) && $_REQUEST['output'] == 'text') {

	if (count($errors) === 0) {
		echo 'OK';
	} else {
		echo 'FAIL';
	}
	exit;
}

$t = new SimpleSAML_XHTML_Template($config, 'sanitycheck:check-tpl.php');
$t->data['pageid'] = 'sanitycheck';
$t->data['errors'] = $errors;
$t->data['info'] = $info;
$t->data['jquery'] = $jquery;
$t->show();

Fix page ID for sanity check page...

Fix page ID for sanity check page...


<?php
/**
 * @package deployment
 * @subpackage falcon.roles_and_permissions
 *
 * Add permissions to caption asset
 */

$script = realpath(dirname(__FILE__) . '/../../../../') . '/alpha/scripts/utils/permissions/addPermissionsAndItems.php';
$config = realpath(dirname(__FILE__)) . '/../../../permissions/service.dropfolder.dropfolder.ini';
passthru("php $script $config");

<?php
/**
 * @package deployment
 * @subpackage falcon.roles_and_permissions
 *
 * Add permissions to caption asset
 */

$script = realpath(dirname(__FILE__) . '/../../../../') . '/alpha/scripts/utils/permissions/addPermissionsAndItems.php';
$config = realpath(dirname(__FILE__)) . '/../../../permissions/service.partner.ini';
passthru("php $script $config");

Fix script-> wrong .ini file passed

Fix script-> wrong .ini file passed


<?php

function checkVersion() {
	$current = explode("-", file_get_contents("version"));
	$latest = explode("-", file_get_contents("https://raw.github.com/VeoPVM/LinMon/master/version"));

	if ($current[0] != $latest[0]) {
		echo "A new version of the slave is available! \n
		Your version: ".$current[0]." \n
		Latest version: ".$latest[0]." \n";
	}
}

?>

<?php

function checkVersion() {
	$current = explode("-", file_get_contents("version"));
	$latest = explode("-", file_get_contents("https://raw.github.com/VeoPVM/LinMon/master/slave/version"));

	if ($current[0] != $latest[0]) {
		echo "A new version of the slave is available! \n
		Your version: ".$current[0]." \n
		Latest version: ".$latest[0]." \n";
	}
}

?>

Correct remote version checking location


<?php

namespace App\Repositories;

use App\Models\User;

class UserRepository
{
    /**
     * @param $userData
     * @return static
     */
    public function findOrCreate($userData)
    {
        $user = User::where('email', '=', $userData->email)->first();
        if ($user !== null) {
            return $user;
        }

        return User::create([
            'name'     => $userData->nickname,
            'email'    => $userData->email,
        ]);
    }
}

<?php

namespace App\Repositories;

use App\Models\User;

class UserRepository
{
    /**
     * @param $userData
     * @return static
     */
    public function findOrCreate($userData)
    {
        $user = User::where('email', '=', $userData->email)->first();
        if ($user !== null) {
            return $user;
        }

        return User::create([
            'username' => $userData->nickname,
            'name' => $userData->nickname,
            'email' => $userData->email,
        ]);
    }
}

Add the username to creation process

Add the username to creation process


<?php

/*
 * This file is part of the Sylius package.
 *
 * (c) Paweł Jędrzejewski
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace Sylius\Bundle\ApiBundle\Controller\Payment;

use Sylius\Bundle\ApiBundle\Provider\CompositePaymentConfigurationProviderInterface;
use Sylius\Component\Core\Model\PaymentInterface;
use Sylius\Component\Core\Repository\PaymentRepositoryInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Webmozart\Assert\Assert;

/** @experimental */
final class GetPaymentConfiguration
{
    public function __construct(
        private PaymentRepositoryInterface $paymentRepository,
        private CompositePaymentConfigurationProviderInterface $compositePaymentConfigurationProvider,
    ) {
    }

    public function __invoke(Request $request): JsonResponse
    {
        /** @var PaymentInterface|null $payment */
        $payment = $this->paymentRepository->findOneByOrderToken(
            $request->attributes->get('paymentId'),
            $request->attributes->get('id'),
        );

        Assert::notNull($payment);

        return new JsonResponse($this->compositePaymentConfigurationProvider->provide($payment));
    }
}

<?php

/*
 * This file is part of the Sylius package.
 *
 * (c) Paweł Jędrzejewski
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace Sylius\Bundle\ApiBundle\Controller\Payment;

use Sylius\Bundle\ApiBundle\Provider\CompositePaymentConfigurationProviderInterface;
use Sylius\Component\Core\Model\PaymentInterface;
use Sylius\Component\Core\Repository\PaymentRepositoryInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Webmozart\Assert\Assert;

/** @experimental */
final class GetPaymentConfiguration
{
    public function __construct(
        private PaymentRepositoryInterface $paymentRepository,
        private CompositePaymentConfigurationProviderInterface $compositePaymentConfigurationProvider,
    ) {
    }

    public function __invoke(Request $request): JsonResponse
    {
        /** @var PaymentInterface|null $payment */
        $payment = $this->paymentRepository->findOneByOrderToken(
            $request->attributes->get('paymentId'),
            $request->attributes->get('tokenValue'),
        );

        Assert::notNull($payment);

        return new JsonResponse($this->compositePaymentConfigurationProvider->provide($payment));
    }
}

Use tokenValue instead of id

Use tokenValue instead of id


<?php

namespace Delighted;

class Metrics extends Resource
{
    public static function retrieve($params = [])
    {
        $response = Client::get('metrics', $params);

        return new Metrics($response);
    }
}

<?php

namespace Delighted;

class Metrics extends Resource
{
    public static function retrieve($params = [], Client $client = null)
    {
        if (is_null($client)) {
            $client = Client::getInstance();
        }

        $response = $client->get('metrics', $params);

        return new Metrics($response);
    }
}

Update metrics class and allow passing Client instance


<?php

namespace Oro\Bundle\TestFrameworkBundle\Tests\Functional\Api\Rest;

use Oro\Bundle\TestFrameworkBundle\Test\WebTestCase;
use Oro\Bundle\UserBundle\Entity\User;

/**
 * @outputBuffering enabled
 * @dbIsolation
 */
class ActivityListRoleControllerTest extends WebTestCase
{
    protected function setUp()
    {
        $this->initClient([], $this->generateWsseAuthHeader(), true);
        $this->loadFixtures([
            'Oro\Bundle\ActivityListBundle\Tests\Functional\DataFixtures\LoadActivityData',
            'Oro\Bundle\ActivityListBundle\Tests\Functional\DataFixtures\LoadUserData'
        ]);
    }

    /**
     * Test to verify access for user who does not have access to activity other user
     */
    public function testGetListForUserWithOutPermissions()
    {
        $this->markTestSkipped("Test skipped. User wssi do not work");
        $this->client->request(
            'GET',
            $this->getUrl(
                'oro_activity_list_api_get_list',
                [
                    'entityClass' => 'Oro_Bundle_TestFrameworkBundle_Entity_TestActivityTarget',
                    'entityId'    => $this->getReference('test_activity_target_1')->getId()
                ]
            )
        );
        $result = $this->getJsonResponseContent($this->client->getResponse(), 200);
        $this->assertCount(0, $result['data']);
        $this->assertEquals(0, $result['count']);
    }
}

<?php

namespace Oro\Bundle\TestFrameworkBundle\Tests\Functional\Api\Rest;

use Oro\Bundle\TestFrameworkBundle\Test\WebTestCase;
use Oro\Bundle\UserBundle\Entity\User;

/**
 * @outputBuffering enabled
 * @dbIsolation
 */
class ActivityListRoleControllerTest extends WebTestCase
{
    protected function setUp()
    {
        $this->initClient([], $this->generateWsseAuthHeader(), true);
        $this->loadFixtures([
            'Oro\Bundle\ActivityListBundle\Tests\Functional\DataFixtures\LoadActivityData',
            'Oro\Bundle\ActivityListBundle\Tests\Functional\DataFixtures\LoadUserData'
        ]);
    }

    /**
     * Test to verify access for user who does not have access to activity other user
     */
    public function testGetListForUserWithOutPermissions()
    {
        $this->markTestSkipped("Test skipped. User wssi do not work. Test entity ACL do not work.");
        $this->client->request(
            'GET',
            $this->getUrl(
                'oro_activity_list_api_get_list',
                [
                    'entityClass' => 'Oro_Bundle_TestFrameworkBundle_Entity_TestActivityTarget',
                    'entityId'    => $this->getReference('test_activity_target_1')->getId()
                ]
            )
        );
        $result = $this->getJsonResponseContent($this->client->getResponse(), 200);
        $this->assertCount(0, $result['data']);
        $this->assertEquals(0, $result['count']);
    }
}

CRM-2511: Access permissions for items in Activity List
- FT fixes


<?php

return [
	'database' => [
	    'host' => 'localhost',
		'db_name' => 'test',
		'user' => 'root',
		'password' => ''
	],
    'locale' => [
	    'timezone' => 'Europe/Rome',
		'default_language' => 'en'
	],
	'session' => [
		'id' => 'vela_id'
	]
];

Add new line at end

Add new line at end


<?php namespace GeneaLabs\LaravelGovernor\Listeners;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Schema;
use GeneaLabs\LaravelGovernor\Role;

class CreatedListener
{
    /**
     * @SuppressWarnings(PHPMD.StaticAccess)
     */
    public function handle(string $event, array $models)
    {
        if (str_contains($event, "Hyn\Tenancy\Models\Website")
            || str_contains($event, "Hyn\Tenancy\Models\Hostname")
        ) {
            return;
        }

        collect($models)
            ->filter(function ($model) {
                return $model instanceof Model
                    && get_class($model) === config('genealabs-laravel-governor.models.auth');
            })
            ->each(function ($model) {
                try {
                    $model->roles()->attach('Member');
                } catch (Exception $exception) {
                    $roleClass = config("genealabs-laravel-governor.models.role");
                    (new $roleClass)->firstOrCreate([
                        'name' => 'Member',
                        'description' => 'Represents the baseline registered user. Customize permissions as best suits your site.',
                    ]);
                    $model->roles()->attach('Member');
                }
            });
    }
}

<?php namespace GeneaLabs\LaravelGovernor\Listeners;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Schema;
use GeneaLabs\LaravelGovernor\Role;

class CreatedListener
{
    /**
     * @SuppressWarnings(PHPMD.StaticAccess)
     */
    public function handle(string $event, array $models)
    {
        if (str_contains($event, "Hyn\Tenancy\Models\Website")
            || str_contains($event, "Hyn\Tenancy\Models\Hostname")
        ) {
            return;
        }

        collect($models)
            ->filter(function ($model) {
                return $model instanceof Model
                    && get_class($model) === config('genealabs-laravel-governor.models.auth');
            })
            ->each(function ($model) {
                try {
                    $model->roles()->syncWithoutDetaching('Member');
                } catch (Exception $exception) {
                    $roleClass = config("genealabs-laravel-governor.models.role");
                    (new $roleClass)->firstOrCreate([
                        'name' => 'Member',
                        'description' => 'Represents the baseline registered user. Customize permissions as best suits your site.',
                    ]);
                    $model->roles()->attach('Member');
                }
            });
    }
}

Fix registration of new member

Fix registration of new member


<?php
class ShortenUrlEasily {
  public static $action_list = array(
    'creativecommons',
    'credits',
    'delete',
    'deletetrackback',
    'dublincore',
    'edit',
    'history',
    'info',
    'markpatrolled',
    'print',
    'protect',
    'purge',
    'raw',
    'render',
    'revert',
    'rollback',
    'submit',
    'unprotect',
    'unwatch',
    'varidate',
    'view',
    'viewsource',
    'watch',
  );

  public static function init($article = 'wiki', $action = 'w') {
    global $wgArticlePath, $wgActionPaths;
    $wgArticlePath = "/$article/$1";
    foreach(self::$action_list as $a) $wgActionPaths[$a] = "/$action/$a/$1";
  }
}

ShortenUrlEasily::init();

<?php
class ShortenUrlEasily {
  public static $action_list = array(
    'creativecommons',
    'credits',
    'delete',
    'deletetrackback',
    'dublincore',
    'edit',
    'history',
    'info',
    'markpatrolled',
    'print',
    'protect',
    'purge',
    'raw',
    'render',
    'revert',
    'rollback',
    'search',
    'submit',
    'unprotect',
    'unwatch',
    'varidate',
    'view',
    'viewsource',
    'watch',
  );

  public static function init($article = 'wiki', $action = 'w') {
    global $wgArticlePath, $wgActionPaths;
    $wgArticlePath = "/$article/$1";
    foreach(self::$action_list as $a) $wgActionPaths[$a] = "/$action/$a/$1";
  }
}

ShortenUrlEasily::init();

Add 'search' action to action_list

Add 'search' action to action_list


<?php namespace Orchestra\Support\Providers;

use Orchestra\Support\Providers\Traits\PackageProviderTrait;
use Illuminate\Support\ServiceProvider as BaseServiceProvider;

abstract class ServiceProvider extends BaseServiceProvider
{
    use PackageProviderTrait;
}

<?php namespace Orchestra\Support\Providers;

use Orchestra\Contracts\Config\PackageRepository;
use Orchestra\Support\Providers\Traits\PackageProviderTrait;
use Illuminate\Support\ServiceProvider as BaseServiceProvider;

abstract class ServiceProvider extends BaseServiceProvider
{
    use PackageProviderTrait;

    /**
     * Merge the given configuration with the existing configuration.
     *
     * @param  string  $path
     * @param  string  $key
     * @return void
     */
    protected function mergeConfigFrom($path, $key)
    {
        parent::mergeConfigFrom($path, $key);

        $config = $this->app['config'];

        if ($config instanceof PackageRepository) {
            $config->file($key);
        }
    }
}

Allow to push packages name/key to config repository.

Signed-off-by: crynobone <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>


<?php

namespace Pinq\Tests;

date_default_timezone_set('Australia/Melbourne');
error_reporting(-1);
set_time_limit(1000);
ini_set('display_errors', 'On');
$pinqAsProjectAutoLoaderPath = __DIR__ . '/../vendor/autoload.php';
$pinqAsDependencyAutoLoaderPath = __DIR__ . '/../../../../autoload.php';

if (file_exists($pinqAsProjectAutoLoaderPath)) {
    $composerAutoLoader = require $pinqAsProjectAutoLoaderPath;
} elseif (file_exists($pinqAsDependencyAutoLoaderPath)) {
    $composerAutoLoader = require $pinqAsDependencyAutoLoaderPath;
} else {
    throw new \Exception('Cannot load pinq tests: Pinq cannot be loaded, please load Pinq via composer');
}

$composerAutoLoader->addPsr4(__NAMESPACE__ . '\\', __DIR__);

<?php

namespace Pinq\Tests;

date_default_timezone_set('Australia/Melbourne');
error_reporting(-1);
set_time_limit(2000);
ini_set('display_errors', 'On');

register_shutdown_function(function () {
    $error = error_get_last();
    if(in_array($error['type'], [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR], true)) {
        echo "-- Error occurred in {$error['file']} on line {$error['line']} --";
    }
});

$pinqAsProjectAutoLoaderPath = __DIR__ . '/../vendor/autoload.php';
$pinqAsDependencyAutoLoaderPath = __DIR__ . '/../../../../autoload.php';

if (file_exists($pinqAsProjectAutoLoaderPath)) {
    $composerAutoLoader = require $pinqAsProjectAutoLoaderPath;
} elseif (file_exists($pinqAsDependencyAutoLoaderPath)) {
    $composerAutoLoader = require $pinqAsDependencyAutoLoaderPath;
} else {
    throw new \Exception('Cannot load pinq tests: Pinq cannot be loaded, please load Pinq via composer');
}

$composerAutoLoader->addPsr4(__NAMESPACE__ . '\\', __DIR__);

Increase test execution time limit and add fatal error debugger using register_shutdown_function


<?php

namespace TightenCo\Jigsaw\Scaffold;

class DefaultInstaller
{
    const ALWAYS_IGNORE = [
        'build_*',
        'init.php',
        'node_modules',
        'vendor',
    ];
    const DEFAULT_COMMANDS = [
        'composer install',
        'npm install',
        'npm run dev',
    ];
    protected $commands;
    protected $delete;
    protected $ignore;
    protected $builder;

    public function install(ScaffoldBuilder $builder, $settings = [])
    {
        $this->builder = $builder;
        $this->delete = array_get($settings, 'delete', []);
        $this->ignore = array_merge(self::ALWAYS_IGNORE, array_get($settings, 'ignore', []));
        $commands = array_get($settings, 'commands');
        $this->commands = $commands !== null ? $commands : self::DEFAULT_COMMANDS;
        $this->execute();
    }

    public function execute()
    {
        return $this->builder
            ->buildBasicScaffold()
            ->cacheComposerDotJson()
            ->deleteSiteFiles($this->delete)
            ->copyPresetFiles(null, $this->ignore)
            ->mergeComposerDotJson()
            ->runCommands($this->commands);
    }
}

<?php

namespace TightenCo\Jigsaw\Scaffold;

class DefaultInstaller
{
    const ALWAYS_IGNORE = [
        'build_*',
        'init.php',
        'node_modules',
        'vendor',
    ];
    const DEFAULT_COMMANDS = [
        'composer install',
        'npm install',
        'npm run local',
    ];
    protected $commands;
    protected $delete;
    protected $ignore;
    protected $builder;

    public function install(ScaffoldBuilder $builder, $settings = [])
    {
        $this->builder = $builder;
        $this->delete = array_get($settings, 'delete', []);
        $this->ignore = array_merge(self::ALWAYS_IGNORE, array_get($settings, 'ignore', []));
        $commands = array_get($settings, 'commands');
        $this->commands = $commands !== null ? $commands : self::DEFAULT_COMMANDS;
        $this->execute();
    }

    public function execute()
    {
        return $this->builder
            ->buildBasicScaffold()
            ->cacheComposerDotJson()
            ->deleteSiteFiles($this->delete)
            ->copyPresetFiles(null, $this->ignore)
            ->mergeComposerDotJson()
            ->runCommands($this->commands);
    }
}

Change `npm run dev` to `npm run local`

Change `npm run dev` to `npm run local`


<?php

namespace BNETDocs\Controllers;

use \BNETDocs\Models\RedirectSoft as RedirectSoftModel;
use \CarlBennett\MVC\Libraries\Controller;
use \CarlBennett\MVC\Libraries\Router;
use \CarlBennett\MVC\Libraries\View;

class RedirectSoft extends Controller {

  public function &run(Router &$router, View &$view, array &$args) {

    $model = new RedirectSoftModel();
    $model->location = array_shift($args);

    $view->render($model);

    $model->_responseCode                    = 302;
    $model->_responseHeaders["Content-Type"] = $view->getMimeType();
    $model->_responseHeaders["Location"]     = $model->location;
    $model->_responseTTL                     = 0;

    return $model;

  }

}

<?php

namespace BNETDocs\Controllers;

use \BNETDocs\Models\RedirectSoft as RedirectSoftModel;
use \CarlBennett\MVC\Libraries\Common;
use \CarlBennett\MVC\Libraries\Controller;
use \CarlBennett\MVC\Libraries\Router;
use \CarlBennett\MVC\Libraries\View;

class RedirectSoft extends Controller {

  public function &run(Router &$router, View &$view, array &$args) {

    $model = new RedirectSoftModel();
    $model->location = Common::relativeUrlToAbsolute(array_shift($args));

    $view->render($model);

    $model->_responseCode                    = 302;
    $model->_responseHeaders["Content-Type"] = $view->getMimeType();
    $model->_responseHeaders["Location"]     = $model->location;
    $model->_responseTTL                     = 0;

    return $model;

  }

}

Convert arg to absolute url in SoftRedirect


<?php

/*
 * This file is part of Flarum.
 *
 * (c) Toby Zerner <toby.zerner@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Flarum\Emoji\Listener;

use Flarum\Event\ConfigureFormatter;
use Illuminate\Contracts\Events\Dispatcher;

class FormatEmoticons
{
    /**
     * @param Dispatcher $events
     */
    public function subscribe(Dispatcher $events)
    {
        $events->listen(ConfigureFormatter::class, [$this, 'addEmoticons']);
    }

    /**
     * @param ConfigureFormatter $event
     */
    public function addEmoticons(ConfigureFormatter $event)
    {
        $event->configurator->Emoji->useEmojiOne();
        $event->configurator->Emoji->useSVG();

        $event->configurator->Emoji->addAlias(':)', '🙂');
        $event->configurator->Emoji->addAlias(':D', '😃');
        $event->configurator->Emoji->addAlias(':P', '😛');
        $event->configurator->Emoji->addAlias(':(', '🙁');
        $event->configurator->Emoji->addAlias(':|', '😐');
        $event->configurator->Emoji->addAlias(';)', '😉');
        $event->configurator->Emoji->addAlias(':\'(', '😢');
        $event->configurator->Emoji->addAlias(':O', '😮');
        $event->configurator->Emoji->addAlias('>:(', '😡');
    }
}

<?php

/*
 * This file is part of Flarum.
 *
 * (c) Toby Zerner <toby.zerner@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Flarum\Emoji\Listener;

use Flarum\Event\ConfigureFormatter;
use Illuminate\Contracts\Events\Dispatcher;

class FormatEmoticons
{
    /**
     * @param Dispatcher $events
     */
    public function subscribe(Dispatcher $events)
    {
        $events->listen(ConfigureFormatter::class, [$this, 'addEmoticons']);
    }

    /**
     * @param ConfigureFormatter $event
     */
    public function addEmoticons(ConfigureFormatter $event)
    {
        $event->configurator->Emoji->useEmojiOne();
        $event->configurator->Emoji->omitImageSize();
        $event->configurator->Emoji->useSVG();

        $event->configurator->Emoji->addAlias(':)', '🙂');
        $event->configurator->Emoji->addAlias(':D', '😃');
        $event->configurator->Emoji->addAlias(':P', '😛');
        $event->configurator->Emoji->addAlias(':(', '🙁');
        $event->configurator->Emoji->addAlias(':|', '😐');
        $event->configurator->Emoji->addAlias(';)', '😉');
        $event->configurator->Emoji->addAlias(':\'(', '😢');
        $event->configurator->Emoji->addAlias(':O', '😮');
        $event->configurator->Emoji->addAlias('>:(', '😡');
    }
}

Revert omission of image size

Revert omission of image size

Turns out this is still required in SVG mode :D


<?php

/**
 * @license MIT
 * @copyright 2017 Tim Gunter
 */

namespace Kaecyra\AppCommon\Log\Tagged;

/**
 * Tagged log trait
 *
 * @author Tim Gunter <tim@vanillaforums.com>
 * @package app-common
 */
trait TaggedLogTrait {

    /**
     * Log tag
     * @var string|Callable
     */
    protected $logTag = null;

    /**
     * Log tagged message
     *
     * @param string $level
     * @param string $message
     * @param array $context
     */
    public function tLog(string $level, string $message, array $context) {
        $logtag = $this->getLogTag();
        if (is_array($message) || is_object($message)) {
            $message = print_r($message, true);
        }
        $this->log($level, "[{$logtag}] ".$message, $context);
    }

    /**
     * Get log tag
     *
     * @return string
     */
    protected function getLogTag() {
        return is_callable($this->logTag) ? $this->logtag() : $this->logTag;
    }

    /**
     * Set log tag
     *
     * @param string|Callable $logTag
     */
    protected function setLogTag($logTag) {
        $this->logTag = $logTag;
    }

    /**
     * Set default logtag callback
     *
     *
     */
    public function setDefaultLogCallback() {
        $this->setLogTag(function(){
            return (new \ReflectionClass($this))->getShortName();
        });
    }

}

<?php

/**
 * @license MIT
 * @copyright 2017 Tim Gunter
 */

namespace Kaecyra\AppCommon\Log\Tagged;

/**
 * Tagged log trait
 *
 * @author Tim Gunter <tim@vanillaforums.com>
 * @package app-common
 */
trait TaggedLogTrait {

    /**
     * Log tag
     * @var string|Callable
     */
    protected $logTag = null;

    /**
     * Log tagged message
     *
     * @param string $level
     * @param string $message
     * @param array $context
     */
    public function tLog(string $level, string $message, array $context) {
        $logtag = $this->getLogTag();
        if (is_array($message) || is_object($message)) {
            $message = print_r($message, true);
        }
        $this->log($level, "[{$logtag}] ".$message, $context);
    }

    /**
     * Get log tag
     *
     * @return string
     */
    protected function getLogTag() {
        return is_callable($this->logTag) ? $this->logtag() : $this->logTag;
    }

    /**
     * Set log tag
     *
     * @param string|Callable $logTag
     */
    public function setLogTag($logTag) {
        $this->logTag = $logTag;
    }

    /**
     * Set default logtag callback
     *
     *
     */
    public function setDefaultLogCallback() {
        $this->setLogTag(function(){
            return (new \ReflectionClass($this))->getShortName();
        });
    }

}

Fix access level for setLogTag

Fix access level for setLogTag


<?php namespace Anomaly\PagesModule\Page\Form;

use Anomaly\PagesModule\Page\Contract\PageInterface;
use Anomaly\PreferencesModule\Preference\Contract\PreferenceRepositoryInterface;
use Illuminate\Foundation\Bus\DispatchesJobs;

class PageFormFields
{

    use DispatchesJobs;

    /**
     * Handle the page fields.
     *
     * @param PageFormBuilder $builder
     * @param PreferenceRepositoryInterface $preferences
     */
    public function handle(PageFormBuilder $builder, PreferenceRepositoryInterface $preferences)
    {
        $parent = $builder->getParent();

        /* @var PageInterface $entry */
        if (!$parent && $entry = $builder->getFormEntry()) {
            $parent = $entry->getParent();
        }

        $translations = $parent->getTranslations();

        $slugs = $translations->map(
            function ($translation) {

                return [
                    'field'        => 'slug',
                    'locale'       => $translation->locale,
                    'config'       => [
                        'prefix' => $translation->path,
                    ],
                ];
            }
        )->all();

        $builder->setFields(
            array_merge([
                '*',
                'parent'     => [
                    'config' => [
                        'mode'          => 'lookup',
                        'default_value' => $parent ? $parent->getId() : null,
                    ],
                ],
                'publish_at' => [
                    'config' => [
                        'default_value' => 'now',
                        'timezone'      => config('app.timezone'),
                    ],
                ],
            ], $slugs)
        );
    }
}

<?php namespace Anomaly\PagesModule\Page\Form;

use Anomaly\PagesModule\Page\Contract\PageInterface;
use Anomaly\PreferencesModule\Preference\Contract\PreferenceRepositoryInterface;
use Illuminate\Foundation\Bus\DispatchesJobs;

class PageFormFields
{

    use DispatchesJobs;

    /**
     * Handle the page fields.
     *
     * @param PageFormBuilder $builder
     * @param PreferenceRepositoryInterface $preferences
     */
    public function handle(PageFormBuilder $builder, PreferenceRepositoryInterface $preferences)
    {
        $parent = $builder->getParent();

        /* @var PageInterface $entry */
        if (!$parent && $entry = $builder->getFormEntry()) {
            $parent = $entry->getParent();
        }

        $builder->setFields(
            [
                '*',
                'parent'     => [
                    'config' => [
                        'mode'          => 'lookup',
                        'default_value' => $parent ? $parent->getId() : null,
                    ],
                ],
                'publish_at' => [
                    'config' => [
                        'default_value' => 'now',
                        'timezone'      => config('app.timezone'),
                    ],
                ],
            ]
        );

        if ($parent && $translations = $parent->getTranslations()) {
            $builder->setFields(
                array_merge(
                    $builder->getFields(),
                    $translations->map(
                        function ($translation) {

                            return [
                                'field'  => 'slug',
                                'locale' => $translation->locale,
                                'config' => [
                                    'prefix' => $translation->path,
                                ],
                            ];
                        }
                    )->all()
                )
            );
        }
    }
}

Fix issue for root pages

Fix issue for root pages


<?php

namespace Incenteev\TranslationCheckerBundle\DependencyInjection;

use Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class IncenteevTranslationCheckerExtension extends ConfigurableExtension
{
    public function loadInternal(array $config, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('services.xml');

        $dirs = array();
        $overridePath = '%%kernel.root_dir%%/Resources/%s/views';
        $registeredBundles = $container->getParameter('kernel.bundles');

        foreach ($config['extraction']['bundles'] as $bundle) {
            if (!isset($registeredBundles[$bundle])) {
                throw new \InvalidArgumentException(sprintf('The bundle %s is not registered in the kernel.', $bundle));
            }

            $reflection = new \ReflectionClass($registeredBundles[$bundle]);
            $dirs[] = dirname($reflection->getFilename()).'/Resources/views';
            $dirs[] = sprintf($overridePath, $bundle);
        }
        $dirs[] = '%kernel.root_dir%/Resources/views';

        $container->setParameter('incenteev_translation_checker.extractor.symfony.paths', $dirs);
    }
}

<?php

namespace Incenteev\TranslationCheckerBundle\DependencyInjection;

use Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class IncenteevTranslationCheckerExtension extends ConfigurableExtension
{
    public function loadInternal(array $config, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('services.xml');

        // supports autoconfiguration of extractors in Symfony 3.3+
        if (method_exists($container, 'registerForAutoconfiguration')) {
            $container->registerForAutoconfiguration('Incenteev\TranslationCheckerBundle\Translator\Extractor\ExtractorInterface')
                ->addTag('incenteev_translation_checker.extractor');
        }

        $dirs = array();
        $overridePath = '%%kernel.root_dir%%/Resources/%s/views';
        $registeredBundles = $container->getParameter('kernel.bundles');

        foreach ($config['extraction']['bundles'] as $bundle) {
            if (!isset($registeredBundles[$bundle])) {
                throw new \InvalidArgumentException(sprintf('The bundle %s is not registered in the kernel.', $bundle));
            }

            $reflection = new \ReflectionClass($registeredBundles[$bundle]);
            $dirs[] = dirname($reflection->getFilename()).'/Resources/views';
            $dirs[] = sprintf($overridePath, $bundle);
        }
        $dirs[] = '%kernel.root_dir%/Resources/views';

        $container->setParameter('incenteev_translation_checker.extractor.symfony.paths', $dirs);
    }
}

Add support for autoconfiguration of extractors in Symfony 3.3+


<?php

namespace wcf\system\cache\command;

use wcf\data\package\update\server\PackageUpdateServer;
use wcf\system\cache\CacheHandler;
use wcf\system\cache\event\CacheCleared;
use wcf\system\event\EventHandler;
use wcf\system\language\LanguageFactory;
use wcf\system\style\StyleHandler;

/**
 * Performs a full cache clear.
 *
 * @author  Tim Duesterhus
 * @copyright   2001-2021 WoltLab GmbH
 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package WoltLabSuite\Core\System\Cache\Event
 * @since   6.0
 */
final class ClearCache
{
    private EventHandler $eventHandler;

    public function __construct()
    {
        $this->eventHandler = EventHandler::getInstance();
    }

    public function __invoke()
    {
        // reset stylesheets
        StyleHandler::resetStylesheets();

        // delete language cache and compiled templates as well
        LanguageFactory::getInstance()->deleteLanguageCache();

        // get package dirs
        CacheHandler::getInstance()->flushAll();

        // reset package update servers and the package cache
        PackageUpdateServer::resetAll();

        $this->eventHandler->fire(
            new CacheCleared()
        );
    }
}

<?php

namespace wcf\system\cache\command;

use wcf\data\option\OptionEditor;
use wcf\data\package\update\server\PackageUpdateServer;
use wcf\system\cache\CacheHandler;
use wcf\system\cache\event\CacheCleared;
use wcf\system\event\EventHandler;
use wcf\system\language\LanguageFactory;
use wcf\system\style\StyleHandler;
use wcf\system\user\storage\UserStorageHandler;

/**
 * Performs a full cache clear.
 *
 * @author  Tim Duesterhus
 * @copyright   2001-2021 WoltLab GmbH
 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package WoltLabSuite\Core\System\Cache\Event
 * @since   6.0
 */
final class ClearCache
{
    private EventHandler $eventHandler;

    public function __construct()
    {
        $this->eventHandler = EventHandler::getInstance();
    }

    public function __invoke()
    {
        OptionEditor::resetCache();

        UserStorageHandler::getInstance()->clear();

        StyleHandler::resetStylesheets();

        LanguageFactory::getInstance()->deleteLanguageCache();

        CacheHandler::getInstance()->flushAll();

        PackageUpdateServer::resetAll();

        $this->eventHandler->fire(
            new CacheCleared()
        );
    }
}

Add cleanup of UserStorage and options cache to ClearCacheCommand


<?php
/**
 * This file is part of the Zimbra API in PHP library.
 *
 * © Nguyen Van Nguyen <nguyennv1981@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Zimbra\Mail\Request;

use Zimbra\Soap\Request;

/**
 * Base mail request class
 *
 * @package    Zimbra
 * @subpackage Mail
 * @category   Request
 * @author     Nguyen Van Nguyen - nguyennv1981@gmail.com
 * @copyright  Copyright © 2013 by Nguyen Van Nguyen.
 */
abstract class Base extends Request
{
    /**
     * Constructor method for base request
     * @param  string $value
     * @return self
     */
    public function __construct($value = null)
    {
        parent::__construct($value);
        $this->requestNamespace('urn:zimbraMail');
    }
}

<?php
/**
 * This file is part of the Zimbra API in PHP library.
 *
 * © Nguyen Van Nguyen <nguyennv1981@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Zimbra\Mail\Request;

use Zimbra\Soap\Request;

/**
 * Base mail request class
 *
 * @package    Zimbra
 * @subpackage Mail
 * @category   Request
 * @author     Nguyen Van Nguyen - nguyennv1981@gmail.com
 * @copyright  Copyright © 2013 by Nguyen Van Nguyen.
 */
abstract class Base extends Request
{
    /**
     * Constructor method for base request
     * @param  string $value
     * @return self
     */
    public function __construct($value = null)
    {
        parent::__construct($value);
        $this->xmlNamespace('urn:zimbraMail');
    }
}

Replace requestNamespace by xmlNamespace method


<!DOCTYPE html>

  <title>get GNU/Linux!</title>
  <link rel="stylesheet" type="text/css" href="/style/main-ltr.css" media="all" />

get GNU/Linux!

Almost there! Please follow these steps.

Open a terminal and change to the root folder;

Run `make config' to create the settings.php file (or manually copy it from include/templates/settings.php);

Open settings.php in a text editor and change the settings where necessary;

Make sure that Apache module mod_rewrite is enabled.

Finally, reload this page.

<!DOCTYPE html>

  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  <title>get GNU/Linux!</title>
  <link rel="stylesheet" type="text/css" href="/style/main-ltr.css" media="all" />

get GNU/Linux!

Almost there! Please follow these steps.

Open a terminal and change to the root folder;

Run `make config' to create the settings.php file (or manually copy it from include/templates/settings.php);

Open settings.php in a text editor and change the settings where necessary;

Make sure that Apache module mod_rewrite is enabled.

Finally, reload this page.

Declare the character encoding in the setup page


<?php

class SV_TrendingContentTags_XenForo_DataWriter_Tag extends XFCP_SV_TrendingContentTags_XenForo_DataWriter_Tag
{
    protected function _delete()
    {
        parent::_delete();

        $this->_getDb()->query('
            delete into xf_sv_tag_trending where tag_id = ?
        ', $this->get('tag_id'));
    }

    public function delete()
    {
        parent::_delete();

        if ($cacheObject = XenForo_Application::getCache())
        {
            $cacheObject->remove(SV_TrendingContentTags_Globals::sv_trendingTag_cacheId);
        }
    }
}

<?php

class SV_TrendingContentTags_XenForo_DataWriter_Tag extends XFCP_SV_TrendingContentTags_XenForo_DataWriter_Tag
{
    protected function _delete()
    {
        parent::_delete();

        $this->_getDb()->query('
            delete into xf_sv_tag_trending where tag_id = ?
        ', $this->get('tag_id'));
    }

    public function delete()
    {
        parent::delete();

        if ($cacheObject = XenForo_Application::getCache())
        {
            $cacheObject->remove(SV_TrendingContentTags_Globals::sv_trendingTag_cacheId);
        }
    }
}

Fix add-on compatibility when deleting a tag


<?php
namespace Neos\Flow\Tests\Unit\Http\Helper;

use GuzzleHttp\Psr7\ServerRequest;
use Neos\Flow\Http\Helper\RequestInformationHelper;
use Neos\Flow\Tests\UnitTestCase;

/**
 * Tests for the RequestInformationHelper
 */
class RequestInformationHelperTest extends UnitTestCase
{
    /**
     * @test
     */
    public function renderRequestHeadersWillNotDiscloseAuthorizationCredentials()
    {
        $request = ServerRequest::fromGlobals()
            ->withAddedHeader('Authorization', 'Basic SomeUser:SomePassword')
            ->withAddedHeader('Authorization', 'Bearer SomeToken');

        $renderedHeaders = RequestInformationHelper::renderRequestHeaders($request);
        self::assertNotContains('SomePassword', $renderedHeaders);
        self::assertNotContains('SomeToken', $renderedHeaders);
    }
}

<?php
namespace Neos\Flow\Tests\Unit\Http\Helper;

use GuzzleHttp\Psr7\ServerRequest;
use Neos\Flow\Http\Helper\RequestInformationHelper;
use Neos\Flow\Tests\UnitTestCase;

/**
 * Tests for the RequestInformationHelper
 */
class RequestInformationHelperTest extends UnitTestCase
{
    /**
     * @test
     */
    public function renderRequestHeadersWillNotDiscloseAuthorizationCredentials()
    {
        $request = ServerRequest::fromGlobals()
            ->withAddedHeader('Authorization', 'Basic SomeUser:SomePassword')
            ->withAddedHeader('Authorization', 'Bearer SomeToken');

        $renderedHeaders = RequestInformationHelper::renderRequestHeaders($request);
        self::assertStringContainsString('SomePassword', $renderedHeaders);
        self::assertStringContainsString('SomeToken', $renderedHeaders);
    }
}

Adjust test assertions to PHPUnit 8

TASK: Adjust test assertions to PHPUnit 8


<?php

namespace Air\Routing\Dispatcher;

use Air\Routing\ResolvedRequest\ResolvedRequestInterface;
use Interop\Container\ContainerInterface;

class Dispatcher implements DispatcherInterface
{
    /**
     * @var ContainerInterface $container The DI container.
     */
    private $container;

    /**
     * @param ContainerInterface $container The DI container.
     */
    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
    }

    /**
     * Dispatch a route.
     *
     * @param ResolvedRequestInterface $resolvedRequest A resolved request.
     * @return string The response.
     */
    public function dispatch(ResolvedRequestInterface $resolvedRequest)
    {
        $route = $resolvedRequest->getRoute();
        $request = $resolvedRequest->getRequest();
        $controller = $this->container->get($route->getController());

        // Call the before hook, if defined.
        if (method_exists($controller, 'before')) {
            $controller->before();
        }

        // Call the action.
        $response = call_user_func_array(
            [$controller, 'action' . $route->getAction()],
            [
                $resolvedRequest->getUriParameters(),
                [
                    'params' => $request->getQueryParameters()
                ]
            ]
        );

        // Call the after hook, if defined.
        if (method_exists($controller, 'after')) {
            $controller->after();
        }

        return $response;
    }
}

<?php

namespace Air\Routing\Dispatcher;

use Air\Routing\ResolvedRequest\ResolvedRequestInterface;
use Interop\Container\ContainerInterface;

class Dispatcher implements DispatcherInterface
{
    /**
     * @var ContainerInterface $container The DI container.
     */
    private $container;

    /**
     * @param ContainerInterface $container The DI container.
     */
    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
    }

    /**
     * Dispatch a route.
     *
     * @param ResolvedRequestInterface $resolvedRequest A resolved request.
     * @return string The response.
     */
    public function dispatch(ResolvedRequestInterface $resolvedRequest)
    {
        $route = $resolvedRequest->getRoute();
        $request = $resolvedRequest->getRequest();
        $controller = $this->container->get($route->getController());

        // Call the before hook, if defined.
        if (method_exists($controller, 'before')) {
            $controller->before();
        }

        // Call the action.
        $response = call_user_func_array(
            [$controller, 'action' . $route->getAction()],
            [
                $resolvedRequest->getUriParameters(),
                [
                    'post' => $request->getPostData(),
                    'get' => $request->getQueryParameters()
                ]
            ]
        );

        // Call the after hook, if defined.
        if (method_exists($controller, 'after')) {
            $controller->after();
        }

        return $response;
    }
}

Split array data sent to actions into GET and SET.


<?php namespace Orchestra\Database;

use Orchestra\Database\Console\Migrations\MigrateCommand;
use Illuminate\Database\MigrationServiceProvider as ServiceProvider;

class MigrationServiceProvider extends ServiceProvider
{
    /**
     * Register the "migrate" migration command.
     *
     * @return void
     */
    protected function registerMigrateCommand()
    {
        $this->app->singleton('command.migrate', function ($app) {
            $packagePath = $app['path.base'].'/vendor';

            return new MigrateCommand($app['migrator'], $packagePath);
        });
    }
}

<?php namespace Orchestra\Database;

use Orchestra\Database\Console\Migrations\MigrateCommand;
use Illuminate\Database\MigrationServiceProvider as ServiceProvider;

class MigrationServiceProvider extends ServiceProvider
{
    /**
     * Register the "migrate" migration command.
     *
     * @return void
     */
    protected function registerMigrateCommand()
    {
        $this->app->singleton('command.migrate', function ($app) {
            $packagePath = $app['path.base'].'/vendor';

            $command = new MigrateCommand($app['migrator']);

            return $command->setPackagePath($packagePath);
        });
    }
}

Handle setting up package path.

Handle setting up package path.

Signed-off-by: crynobone <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>


<?php

namespace HeyUpdate\EmojiBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

class Configuration implements ConfigurationInterface
{
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('hey_update_emoji');

        $rootNode
            ->children()
                ->scalarNode('image_html_template')
                    ->defaultValue('https://twemoji.maxcdn.com/36x36/%s.png')
                ->end()
            ->end();

        return $treeBuilder;
    }
}

<?php

namespace HeyUpdate\EmojiBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

class Configuration implements ConfigurationInterface
{
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('hey_update_emoji');

        $rootNode
            ->children()
                ->scalarNode('image_html_template')
                    ->defaultValue('<img alt=":{{name}}:" class="emoji" src="https://twemoji.maxcdn.com/36x36/{{unicode}}.png">')
                ->end()
            ->end();

        return $treeBuilder;
    }
}

Correct the default image template value.


<?php namespace GeneaLabs\LaravelModelCaching\Tests\Browser;

use GeneaLabs\LaravelModelCaching\Tests\FeatureTestCase;
use GeneaLabs\LaravelModelCaching\Tests\Fixtures\Book;

class PaginationTest extends FeatureTestCase
{
    public function testPaginationProvidesDifferentLinksOnDifferentPages()
    {
        $book = (new Book)
            ->take(11)
            ->get()
            ->last();
        $page1 = $this->visit("pagination-test");

        $this->assertTrue(str_contains($page1->response->getContent(), '
1
'));

        $page2 = $page1->click("2");

        $this->assertTrue(str_contains($page2->response->getContent(), '
2
'));
        $page2->see($book->title);
    }
}

<?php namespace GeneaLabs\LaravelModelCaching\Tests\Browser;

use GeneaLabs\LaravelModelCaching\Tests\FeatureTestCase;
use GeneaLabs\LaravelModelCaching\Tests\Fixtures\Book;

class PaginationTest extends FeatureTestCase
{
    public function testPaginationProvidesDifferentLinksOnDifferentPages()
    {
        $page1ActiveLink = starts_with(app()->version(), "5.5")
            ? '
1
'
            : '
1
';
        $page2ActiveLink = starts_with(app()->version(), "5.5")
            ? '
2
'
            : '
2
';

        $book = (new Book)
            ->take(11)
            ->get()
            ->last();
        $page1 = $this->visit("pagination-test");

        $page1->see($page1ActiveLink);
        $page2 = $page1->click("2");
        $page2->see($page2ActiveLink);
        $page2->see($book->title);
    }
}

Update pagination test to work with Laravel 5.5


<?php

namespace Hicoria\Xpay;

use Nette\Object;

class XpaySmsDispatcher extends Object {

    /**
     * @var IMessageProcessor[]
     */
    private $processors;

    public function register($regex, IMessageProcessor $processor) {
        $this->processors[$regex] = $processor;
    }

    public function process(XpayMessageEntity $paymentEntity) {
        foreach($this->getProcessors() as $regexp => $processor) {
            $success = preg_match_all("~" . preg_replace("/~/", "\\~", $regexp) . "~", $paymentEntity->getModified(), $matches);

            // matched string is not required
            $matches = $matches[1];

            // continue for both, error and no match
            if(!$success)
                return $success;

            $processor->process($paymentEntity, $matches);
            $processor->getResponse()->sendResponse();
            break;
        }

        return true;
    }

    /**
     * @return \Hicoria\Xpay\IMessageProcessor[]
     */
    public function getProcessors()
    {
        return $this->processors;
    }
}

<?php

namespace Hicoria\Xpay;

use Nette\Object;

class XpaySmsDispatcher extends Object {

    /**
     * @var IMessageProcessor[]
     */
    private $processors;

    public function register($regex, IMessageProcessor $processor) {
        $this->processors[$regex] = $processor;
    }

    public function process(XpayMessageEntity $paymentEntity) {
        foreach($this->getProcessors() as $regexp => $processor) {
            $success = preg_match_all(
                "~" . preg_replace("/~/", "\\~", $regexp) . "~",
                trim($paymentEntity->getModified()),
                $matches);

            // matched string is not required
            $matches = $matches[1];

            // continue for both, error and no match
            if(!$success)
                return $success;

            $processor->process($paymentEntity, $matches);
            $processor->getResponse()->sendResponse();
            break;
        }

        return true;
    }

    /**
     * @return \Hicoria\Xpay\IMessageProcessor[]
     */
    public function getProcessors()
    {
        return $this->processors;
    }
}

Trim SMS Message text input

Trim SMS Message text input


<?php

namespace Orchestra\Http;

use Hashids\Hashids;
use Illuminate\Contracts\Foundation\Application;
use Orchestra\Support\Providers\ServiceProvider;

class HashIdServiceProvider extends ServiceProvider
{
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = true;

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton('orchestra.hashid', function (Application $app) {
            return new Hashids($app->make('config')->get('app.key'));
        });
    }

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides()
    {
        return ['orchestra.hashid'];
    }
}

<?php

namespace Orchestra\Http;

use Hashids\Hashids;
use Illuminate\Contracts\Foundation\Application;
use Orchestra\Support\Providers\ServiceProvider;

class HashIdServiceProvider extends ServiceProvider
{
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = true;

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton('orchestra.hashid', function (Application $app) {
            return new Hashids(md5($app->make('config')->get('app.key')));
        });
    }

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides()
    {
        return ['orchestra.hashid'];
    }
}

Normalize the app.key in case app is using base64 encoded key.

Signed-off-by: crynobone <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>


<?php

namespace Ofelix03\Transformer;

/**
 * @author Felix Otoo <ofelix03@gmail.com>
 * @license MIT Check the license file associated with this package for detials of
 *          	the copyright agreements.
 */

class TypeCaster {

	const CAST_TYPES = [
		'integer' => 'int',
		'string' => 'string',
		'float' => 'float',
		'bool' => 'bool',
		'array' => 'array',
	];

	static function cast($value, string $type) {
		if (is_null($value)) {
			throw new \InvalidArgumentException('A value is need for casting. First arugment should be a value to be casted');
		}

		if (is_null($type)) {
			throw new \InvalidArgumentException('A type to cast the value to is needed, none given');
		}

		if (static::CAST_TYPES['integer'] === $type) {
			return (int) $value;
		} else if (static::CAST_TYPES['string'] === $type) {
			return (string) $value;
		} else if (static::CAST_TYPES['bool'] === $type) {
			return (bool) $value;
		} else if (static::CAST_TYPES['array'] === $type) {
			return (array) $value;
		}
	}
}

<?php

namespace Ofelix03\Transformer;

/**
 * @author Felix Otoo <ofelix03@gmail.com>
 * @license MIT Check the license file associated with this package for detials of
 *          	the copyright agreements.
 */

class TypeCaster {

	const CAST_TYPES = [
		'integer' => 'int',
		'string' => 'string',
		'float' => 'float',
		'bool' => 'bool',
		'array' => 'array',
	];

	static function cast($value, $type = "") {
		if (is_null($value)) {
			throw new \InvalidArgumentException('A value is need for casting. First arugment should be a value to be casted');
		}

		if (is_null($type)) {
			throw new \InvalidArgumentException('A type to cast the value to is needed, none given');
		}

		if (static::CAST_TYPES['integer'] === $type) {
			return (int) $value;
		} else if (static::CAST_TYPES['string'] === $type) {
			return (string) $value;
		} else if (static::CAST_TYPES['bool'] === $type) {
			return (bool) $value;
		} else if (static::CAST_TYPES['array'] === $type) {
			return (array) $value;
		}
	}
}

Remove type hint from a method argument

Remove type hint from a method argument


<?php
namespace CodeGen\Statement;

use CodeGen\Renderable;

class RequireOnceStatement extends Statement implements Renderable
{
    public function render(array $args = array())
    {
        if ($this->expr instanceof Renderable) {
            return 'require_once ' . $this->expr->render($args) . ';';
        } else {
            return 'require_once ' . var_export($this->expr, true) . ';';
        }
    }
}

<?php
namespace CodeGen\Statement;

use CodeGen\Renderable;

class RequireOnceStatement extends RequireStatement implements Renderable
{
    public function render(array $args = array())
    {
        if ($this->expr instanceof Renderable) {
            return 'require_once ' . $this->expr->render($args) . ';';
        } else {
            return 'require_once ' . var_export($this->expr, true) . ';';
        }
    }
}

Fix require once statement class

Fix require once statement class


<?php
/**
 * Created by PhpStorm.
 * User: thomas
 * Date: 15/11/14
 * Time: 05:15
 */

namespace Bitcoin;

class TransactionTest extends \PHPUnit_Framework_TestCase
{
    protected $network = null;
    protected $transaction = null;

    public function __construct()
    {
        $this->network = new Network('00', '05', '80');
    }

    public function setUp()
    {
        $this->transaction = new Transaction($this->network);
    }

    public function testGetNetwork()
    {
        $this->assertSame($this->transaction->getNetwork(), $this->network);
    }

    public function testGetVersionEmpty()
    {
        $this->assertNull($this->transaction->getVersion());
    }

    /**
     * @depends testGetVersionEmpty
     */
    public function testSetVersion()
    {
        $this->transaction->setVersion('1');
        $this->assertSame($this->transaction->getVersion(), '1');
    }
}

<?php
/**
 * Created by PhpStorm.
 * User: thomas
 * Date: 15/11/14
 * Time: 05:15
 */

namespace Bitcoin;

class TransactionTest extends \PHPUnit_Framework_TestCase
{
    protected $network = null;
    protected $transaction = null;

    public function __construct()
    {
        $this->network = new Network('00', '05', '80');
    }

    public function setUp()
    {
        $this->transaction = new Transaction();
    }

    public function testGetNetworkEmpty()
    {
        $this->assertNull($this->transaction->getNetwork());
    }

    public function testSetNetwork()
    {
        $this->transaction->setNetwork($this->network);
        $this->assertSame($this->transaction->getNetwork(), $this->network);
    }

    public function testNewTransactionWithNetwork()
    {
        $transaction = new Transaction($this->network);
        $this->assertSame($this->transaction->getNetwork(), $this->network)
    }

    public function testGetVersionEmpty()
    {
        $this->assertNull($this->transaction->getVersion());
    }

    /**
     * @depends testGetVersionEmpty
     */
    public function testSetVersion()
    {
        $this->transaction->setVersion('1');
        $this->assertSame($this->transaction->getVersion(), '1');
    }

}

Test new transaction class with network

Test new transaction class with network


<?php
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
$results = $db->query('SELECT `link`,`change_freq`,`priority` FROM `pages`;');
foreach($results as $row){
  echo '<url>';
  echo '<loc>'.$instance->href($row['link']).'</loc>';
  // get lastmod if file exists
  $row['link'] = 'pages/'.substr_replace($row['link'], 'php', strrpos($row['link'], '.') +1);
  if(file_exists($row['link'])){
    echo '<lastmod>'.date('c', filemtime($row['link'])).'</lastmod>';
  }
  echo '<changefreq>'.$row['change_freq'].'</changefreq>';
  echo '<priority>'.$row['priority'].'</priority>';
  echo '</url>';
}
echo '</urlset>';
?>

<?php
header("Content-type: text/xml");

echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
$results = $db->query('SELECT `link`,`change_freq`,`priority` FROM `pages`;');
foreach($results as $row){
  echo '<url>';
  echo '<loc>'.$instance->href($row['link']).'</loc>';
  // get lastmod if file exists
  $row['link'] = 'pages/'.substr_replace($row['link'], 'php', strrpos($row['link'], '.') +1);
  if(file_exists($row['link'])){
    echo '<lastmod>'.date('c', filemtime($row['link'])).'</lastmod>';
  }
  echo '<changefreq>'.$row['change_freq'].'</changefreq>';
  echo '<priority>'.$row['priority'].'</priority>';
  echo '</url>';
}
echo '</urlset>';
?>

Add header to process XML correctly

Add header to process XML correctly


<?php

namespace wcf\system\language\preload;

use wcf\data\language\Language;
use wcf\system\language\preload\command\CachePreloadPhrases;
use wcf\system\WCF;

/**
 * Provides the URL to the preload cache for
 * phrases and creates it if it is missing.
 *
 * @author Alexander Ebert
 * @copyright 2001-2022 WoltLab GmbH
 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package WoltLabSuite\Core\System\Language\Preload
 * @since 6.0
 */
final class PhrasePreloader
{
    /**
     * Returns the URL to the preload cache. Will implicitly
     * create the cache if it does not exist.
     */
    public function getUrl(Language $language): string
    {
        if (!$this->needsRebuild($language)) {
            $this->rebuild($language);
        }

        return \sprintf(
            '%s%s?v=%d',
            WCF::getPath(),
            $language->getPreloadCacheFilename(),
            \LAST_UPDATE_TIME
        );
    }

    private function needsRebuild(Language $language): bool
    {
        return \file_exists(\WCF_DIR . $language->getPreloadCacheFilename());
    }

    private function rebuild(Language $language): void
    {
        $command = new CachePreloadPhrases($language);
        $command();
    }
}

<?php

namespace wcf\system\language\preload;

use wcf\data\language\Language;
use wcf\system\language\preload\command\CachePreloadPhrases;
use wcf\system\WCF;

/**
 * Provides the URL to the preload cache for
 * phrases and creates it if it is missing.
 *
 * @author Alexander Ebert
 * @copyright 2001-2022 WoltLab GmbH
 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package WoltLabSuite\Core\System\Language\Preload
 * @since 6.0
 */
final class PhrasePreloader
{
    /**
     * Returns the URL to the preload cache. Will implicitly
     * create the cache if it does not exist.
     */
    public function getUrl(Language $language): string
    {
        if ($this->needsRebuild($language)) {
            $this->rebuild($language);
        }

        return \sprintf(
            '%s%s?v=%d',
            WCF::getPath(),
            $language->getPreloadCacheFilename(),
            \LAST_UPDATE_TIME
        );
    }

    private function needsRebuild(Language $language): bool
    {
        return !\file_exists(\WCF_DIR . $language->getPreloadCacheFilename());
    }

    private function rebuild(Language $language): void
    {
        $command = new CachePreloadPhrases($language);
        $command();
    }
}

Fix the logic of the check for the phrase preload rebuild


<?php
namespace Neos\Flow\Security\Authentication\Token;

/*
 * This file is part of the Neos.Flow package.
 *
 * (c) Contributors of the Neos Project - www.neos.io
 *
 * This package is Open Source Software. For the full copyright and license
 * information, please view the LICENSE file which was distributed with this
 * source code.
 */

use Neos\Flow\Mvc\ActionRequest;

/**
 * Marker interface for authentication tokens which don't need a session.
 */
interface UsernamePasswordInterface
{
    public function getUsername(): string;

    public function getPassword(): string;
}

<?php
namespace Neos\Flow\Security\Authentication\Token;

/*
 * This file is part of the Neos.Flow package.
 *
 * (c) Contributors of the Neos Project - www.neos.io
 *
 * This package is Open Source Software. For the full copyright and license
 * information, please view the LICENSE file which was distributed with this
 * source code.
 */

/**
 * Marker interface for authentication tokens which hold a username and password
 */
interface UsernamePasswordInterface
{
    public function getUsername(): string;

    public function getPassword(): string;
}

Correct style and interface description

Correct style and interface description


<?php
/**
 * Default template for displaying post content
 *
 * @package ZnWP Bootstrap Theme
 */

global $znwp_theme;
?>

            <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

                <?php if (is_single()): ?>
                  <?php the_title(); ?>
                <?php else: ?>
                  <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                <?php endif; ?>

              <time> <?php the_date(); ?></time>

              <?php if (is_single()): ?>
                <?php the_content(); ?>

                  <?php
                  previous_post_link(
                      '
%link
',
                      ' %title'
                  );
                  next_post_link(
                      '
%link
',
                      '%title '
                  );
                  ?>

              <?php else: ?>
                <?php the_excerpt(); ?>
              <?php endif; ?>

<?php
/**
 * Default template for displaying post content
 *
 * @package ZnWP Bootstrap Theme
 */

global $znwp_theme;
?>

            <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

                <?php if (is_single()): ?>
                  <?php the_title(); ?>
                <?php else: ?>
                  <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                <?php endif; ?>

              <time> <?php the_date(); ?></time>

              <?php if (is_single()): ?>
                <?php
                the_content();
                get_template_part('postlinks');
                ?>
              <?php else: ?>
                <?php the_excerpt(); ?>
              <?php endif; ?>

Use template for postlinks to allow easy changes


<?php

namespace Forex\Bundle\EmailBundle\Command;

use Forex\Bundle\EmailBundle\Entity\EmailMessage;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class SendPendingEmailsCommand extends ContainerAwareCommand
{
    protected $em;
    protected $sender;

    protected function configure()
    {
        $this
            ->setName('email:send-pending-emails')
            ->setDescription('Sends all pending emails')
        ;
    }

    protected function initialize(InputInterface $input, OutputInterface $output)
    {
        $container = $this->getContainer();
        $this->em = $container->get('doctrine.orm.default_entity_manager');
        $this->sender = $container->get('forex.email_sender');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $progress = $this->getHelperSet()->get('progress');

        $pendingMessages = $this->em->getRepository('ForexEmailBundle:EmailMessage')->findPendingEmails();

        $progress->start($output, count($pendingMessages));

        foreach ($pendingMessages as $message) {
            $this->sender->send($message);
            $progress->advance();
        }

        $progress->finish();
        $this->em->flush();
    }
}

<?php

namespace Forex\Bundle\EmailBundle\Command;

use Forex\Bundle\EmailBundle\Entity\EmailMessage;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\HttpFoundation\Request;

class SendPendingEmailsCommand extends ContainerAwareCommand
{
    protected $em;
    protected $sender;

    protected function configure()
    {
        $this
            ->setName('email:send-pending-emails')
            ->setDescription('Sends all pending emails')
        ;
    }

    protected function initialize(InputInterface $input, OutputInterface $output)
    {
        $container = $this->getContainer();
        $request = new Request();
        $container->set('request', $request);
        $container->enterScope('request');

        $this->em = $container->get('doctrine.orm.default_entity_manager');
        $this->sender = $container->get('forex.email_sender');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $progress = $this->getHelperSet()->get('progress');

        $pendingMessages = $this->em->getRepository('ForexEmailBundle:EmailMessage')->findPendingEmails();

        $progress->start($output, count($pendingMessages));

        foreach ($pendingMessages as $message) {
            $this->sender->send($message);
            $progress->advance();
        }

        $progress->finish();
        $this->em->flush();
    }
}

Put the console command in the request scope


<?php

final class PhutilDefaultSyntaxHighlighterEnginePygmentsFuture
  extends FutureProxy {

  private $source;
  private $scrub;

  public function __construct(Future $proxied, $source, $scrub = false) {
    parent::__construct($proxied);
    $this->source = $source;
    $this->scrub = $scrub;
  }

  protected function didReceiveResult($result) {
    list($status, $body, $headers) = $result;

    if (!$status->isError() && strlen($body)) {
      // Strip off fluff Pygments adds.
      $body = preg_replace(
        '@^

(.*)

\s*$@s',
        '\1',
        $body);
      if ($this->scrub) {
        $body = preg_replace('/^.*\n/', '', $body);
      }
      return phutil_safe_html($body);
    }

    // TODO(csilvers): remove this `return`, and go back to the throw,
    // once epriestley has resolved https://admin.phacility.com/PHI1764
    return id(new PhutilDefaultSyntaxHighlighter())->getHighlightFuture($this->source)->resolve();
    // throw new PhutilSyntaxHighlighterException($body, $status->getStatusCode());
  }

}

<?php

final class PhutilDefaultSyntaxHighlighterEnginePygmentsFuture
  extends FutureProxy {

  private $source;
  private $scrub;

  public function __construct(Future $proxied, $source, $scrub = false) {
    parent::__construct($proxied);
    $this->source = $source;
    $this->scrub = $scrub;
  }

  protected function didReceiveResult($result) {
    list($status, $body, $headers) = $result;

    if (!$status->isError() && strlen($body)) {
      // Strip off fluff Pygments adds.
      $body = preg_replace(
        '@^

(.*)

\s*$@s',
        '\1',
        $body);
      if ($this->scrub) {
        $body = preg_replace('/^.*\n/', '', $body);
      }
      return phutil_safe_html($body);
    }

    throw new PhutilSyntaxHighlighterException($body, $status->getStatusCode());
  }

}

Revert "Don't throw an exception when pygments fails to highlight."

This reverts commit 32def91d2c9b5b25418ca59884b4f00ff3849b9d.

epriestley's fix is live!


<form method="POST" action="{{ action('SettingsController@update') }}">
    @if($errors->count())

            <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>

                @foreach($errors->all() as $error)

                        {{ $error }}

                @endforeach

    @endif

    <input type="hidden" name="_method" value="PATCH"/>
    {!! csrf_field() !!}

    @if(version_compare($version, '5.3.0') < 0)
        @include('geniusts_preferences::settings_5_2')
    @else
        @include('geniusts_preferences::settings_5_3')
    @endif

            <button type="submit" class="btn btn-primary">
                Save
            </button>

</form>

<form method="POST" action="{{ action('SettingsController@update', $domain ? [$domain->key] : []) }}">
    @if($errors->count())

            <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>

                @foreach($errors->all() as $error)

                        {{ $error }}

                @endforeach

    @endif

    <input type="hidden" name="_method" value="PATCH"/>
    {!! csrf_field() !!}

    @if($domain)

            {!! $domain->view->render() !!}

    @else
        @if(version_compare($version, '5.3.0') < 0)
            @include('geniusts_preferences::settings_5_2')
        @else
            @include('geniusts_preferences::settings_5_3')
        @endif
    @endif

            <button type="submit" class="btn btn-primary">
                Save
            </button>

</form>

Update views to support single domain form


<?php namespace Alexsoft\LaravelHashids;

use Hashids\Hashids;
use Illuminate\Support\ServiceProvider;

class LaravelHashidsServiceProvider extends ServiceProvider {

	/**
	 * Indicates if loading of the provider is deferred.
	 *
	 * @var bool
	 */
	protected $defer = true;

	/**
	 * Bootstrap the application events.
	 *
	 * @return void
	 */
	public function boot()
	{
		$this->package('alexsoft/laravel-hashids');
	}

	/**
	 * Register the service provider.
	 *
	 * @return void
	 */
	public function register()
	{
		$this->app->bind('Hashids\HashGenerator', function($app) {
			return new Hashids(
				$app['config']['app.key'],
				$app['config']['laravel-hashids::length'],
				$app['config']['laravel-hashids::alphabet']
			);
		});
	}

	/**
	 * Get the services provided by the provider.
	 *
	 * @return array
	 */
	public function provides()
	{
		return ['laravel-hashids'];
	}

}

<?php namespace Alexsoft\LaravelHashids;

use Hashids\Hashids;
use Illuminate\Support\ServiceProvider;

class LaravelHashidsServiceProvider extends ServiceProvider {

	/**
	 * Indicates if loading of the provider is deferred.
	 *
	 * @var bool
	 */
	protected $defer = true;

	/**
	 * Bootstrap the application events.
	 *
	 * @return void
	 */
	public function boot()
	{
		$this->package('alexsoft/laravel-hashids');
	}

	/**
	 * Register the service provider.
	 *
	 * @return void
	 */
	public function register()
	{
		$this->app->bind('Hashids\HashGenerator', function($app) {
			return new Hashids(
				$app['config']['app.key'],
				$app['config']['laravel-hashids::length'],
				$app['config']['laravel-hashids::alphabet']
			);
		});

		$this->mergeConfigFrom('laravel-hashids', __DIR__.'/config/config.php');
	}

	/**
	 * Get the services provided by the provider.
	 *
	 * @return array
	 */
	public function provides()
	{
		return ['laravel-hashids'];
	}

}

Add config merging for laravel 5

Add config merging for laravel 5


<?php

namespace Intercom;

use Guzzle\Tests\GuzzleTestCase;

class IntercomTestCase extends GuzzleTestCase
{
    protected $client;

    public function setUp()
    {
        $this->client = IntercomBasicAuthClient::factory([
            'api_key' => '1234',
            'app_id' => 'my-app'
        ]);
    }

}

?>

<?php

namespace Intercom;

use Guzzle\Tests\GuzzleTestCase;

class IntercomTestCase extends GuzzleTestCase
{
    protected $client;

    public function setUp()
    {
        $this->client = IntercomBasicAuthClient::factory([
            'api_key' => '1234',
            'app_id' => 'my-app'
        ]);
    }

    protected function getOnlyMockedRequest($method = null, $path = null)
    {
        $requests = $this->getMockedRequests();
        $count = count($requests);

        if ($count != 1)
        {
            $this->fail("Expected 1 HTTP request, got $count!");
        }

        $request = $requests[0];

        if ($method && $path)
        {
            $this->assertRequest($method, $path, $request);
        }
        else if ($method || $path)
        {
            $this->fail('$method and $path must both be present or null.');
        }

        return $request;
    }

    protected function assertRequest($method, $path, $request = null)
    {
        if (!$request)
        {
            $request = $this->getOnlyMockedRequest();
        }

        $this->assertEquals($method, $request->getMethod());
        $this->assertEquals($path, $request->getResource());
    }

    protected function assertBasicAuth($username, $password, $request = null)
    {
        if (!$request)
        {
            $request = $this->getOnlyMockedRequest();
        }

        $header = $request->getHeader('Authorization');

        if (!$header)
        {
            $this->fail("Missing Authorization header.");
        }

        $this->assertEquals(
            'Basic ' . base64_encode("$username:$password"),
            $header->__toString()
        );
    }

    protected function assertRequestJson($object, $request = null)
    {
        if (!$request)
        {
            $request = $this->getOnlyMockedRequest();
        }

        $body = $request->getBody();
        if (!$body)
        {
            $this->fail('Missing request entity body.');

        }

        $this->assertEquals(
            json_encode($object),
            $body->__toString()
        );
    }
}

?>

Update Intercom TestCase to include helper methods for requests and responses


<?php

namespace com\realexpayments\remote\sdk\domain\payment;

use com\realexpayments\remote\sdk\EnumBase;

/**
 * Class ReasonCode
 * Enumeration for the Reason type.
 * @package com\realexpayments\remote\sdk\domain\payment
 */
class ReasonCode extends EnumBase {
	const __default = self::NOT_GIVEN;

	const FRAUD = "FRAUD";
	const OUT_OF_STOCK = "OUTOFSTOCK";
	const OTHER = "OTHER";
	const FALSE_POSITIVE = "FALSEPOSITIVE";
	const IN_STOCK = "INSTOCK";
	const NOT_GIVEN = "NOTGIVEN";
	const HOLD = "HOLD";
	const RELEASE = "RELEASE";

	/**
	 * @var string The payment type String value
	 */
	private $type;

	/**
	 * @param string $type
	 */
	public function __construct( $type ) {
		parent::__construct( $type );
		$this->type = $type;
	}

	/**
	 * Get the string value of the payment type
	 *
	 * @return string
	 */
	public function getType() {
		return $this->type;
	}

}

<?php

namespace com\realexpayments\remote\sdk\domain\payment;

use com\realexpayments\remote\sdk\EnumBase;

/**
 * Class ReasonCode
 * Enumeration for the Reason type.
 * @package com\realexpayments\remote\sdk\domain\payment
 */
class ReasonCode extends EnumBase {
	const __default = self::NOT_GIVEN;

	const FRAUD = "FRAUD";
	const OUT_OF_STOCK = "OUTOFSTOCK";
	const OTHER = "OTHER";
	const FALSE_POSITIVE = "FALSEPOSITIVE";
	const IN_STOCK = "INSTOCK";
	const NOT_GIVEN = "NOTGIVEN";

	/**
	 * @var string The payment type String value
	 */
	private $type;

	/**
	 * @param string $type
	 */
	public function __construct( $type ) {
		parent::__construct( $type );
		$this->type = $type;
	}

	/**
	 * Get the string value of the payment type
	 *
	 * @return string
	 */
	public function getType() {
		return $this->type;
	}

}

Remove Hold And Release options

PHPSDK&REMOTECS007: Remove Hold And Release options


<!DOCTYPE html>
<html class="no-js" <?php language_attributes(); ?>>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title><?php wp_title('|', true, 'right'); ?></title>
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <?php wp_head(); ?>

  <link rel="alternate" type="application/rss+xml" title="<?php echo get_bloginfo('name'); ?> Feed" href="<?php echo esc_url(get_feed_link()); ?>">
</head>

<!DOCTYPE html>
<html class="no-js" <?php language_attributes(); ?>>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title><?php wp_title('|', true, 'right'); ?></title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="format-detection" content="telephone=no">

  <?php wp_head(); ?>

  <link rel="alternate" type="application/rss+xml" title="<?php echo get_bloginfo('name'); ?> Feed" href="<?php echo esc_url(get_feed_link()); ?>">
</head>

Remove auto formatting of telephone

Remove auto formatting of telephone

Using a meta tag to remove formatting of the telephone.


<?php

use yii\helpers\Html;

/**
 * @var \yii\web\View $this
 * @var \hipanel\modules\finance\widgets\FormulaInput $widget
 */

$widget = $this->context;
?>

    <?= Html::activeTextarea($widget->model, $widget->attribute, [
        'class' => 'form-control formula-input',
        'rows' => $widget->formulaLinesCount(),
    ]); ?>

        <?= Html::button('', [
            'class' =>        'fa fa-question-circle text-info formula-help-modal',
            'data-toggle' => 'modal',
            'data-target' => $widget->getHelpModalSelector(),
        ]) ?>

<?php

use yii\helpers\Html;

/**
 * @var \yii\web\View $this
 * @var \hipanel\modules\finance\widgets\FormulaInput $widget
 */

$widget = $this->context;
?>

    <?= Html::activeTextarea($widget->model, $widget->attribute, [
        'class' => 'form-control formula-input',
        'rows' => $widget->formulaLinesCount(),
    ]); ?>

        <?= Html::button('', [
            'class' =>        'fa fa-question-circle text-info formula-help-modal',
            'data-toggle' => 'modal',
            'data-target' => $widget->getHelpModalSelector(),
            'tabindex' => -1
        ]) ?>

Exclude Formula helper modal from tab-index


<?php namespace Schickling\Backup;

use Symfony\Component\Process\Process;

class Console
{
	public function run($command)
	{
		$process = new Process($command);
		$process->run();

		if ($process->isSuccessful()) {
			return true;
		} else {
			return $process->getErrorOutput();
		}
	}
}

<?php namespace Schickling\Backup;

use Symfony\Component\Process\Process;
use Schickling\Backup\ConsoleColors;

class Console
{
	public function run($command)
	{
		// Create new Colors class
		$colors = new ConsoleColors();

		$process = new Process($command);
		$process->run();
		echo $colors->getColoredString("\n"."Executed command : ".$command, "brown")."\n";
		if ($process->isSuccessful()) {
			return true;
		} else {
			return $process->getErrorOutput();
		}
	}
}

Add color to terminal and \n

Add color to terminal and \n