<?php
$pdo = new PDO('mysql:host=mysql.hostinger.co.uk;dbname=u897984522_immo', 'u897984522_asdev', 'RevoK2016I');

Update Commission System - Date : 02/11/2016


<?php
/**
 * Class made by pH7 (Pierre-Henry SORIA).
 */
namespace PFBC\Validation;

class Name extends \PFBC\Validation
{
    public function __construct()
    {
        parent::__construct();
        $this->message = t("Error: %element% must contain a valid name. The name entered doesn't seem correct.");
    }

    public function isValid($sValue)
    {
        return ($this->isNotApplicable($sValue) || $this->oValidate->name($sValue));
    }
}

<?php
/**
 * Class made by pH7 (Pierre-Henry SORIA).
 */
namespace PFBC\Validation;

class Name extends \PFBC\Validation
{
    public function __construct()
    {
        parent::__construct();
        $this->message = t("Error: %element% must be a valid name. The name entered doesn't seem correct.");
    }

    public function isValid($sValue)
    {
        return ($this->isNotApplicable($sValue) || $this->oValidate->name($sValue));
    }
}

Change error message if name is wrong

Change error message if name is wrong


<?php
namespace Gt\Fetch\Response;

class Text {
	/** @var string */
	protected $content;

	public function __construct(string $content) {
		$this->content = $content;
	}

	public function __toString():string {
		return $this->content;
	}
}

<?php
namespace Gt\Fetch\Response;

/**
 * This class represents a string response. The reason it wraps a string with an
 * object is to allow for the same code to construct any type of response, and
 * in turn means that the Gt\Fetch\Response namespace is a good reference for
 * the types of response possible.
 */
class Text {
	/** @var string */
	protected $content;

	public function __construct(string $content) {
		$this->content = $content;
	}

	public function __toString():string {
		return $this->content;
	}
}

Complete text response type with comment


<?php /* @var $this Controller */ ?>
<?php $this->beginContent('//layouts/main'); ?>

            <?php echo $content; ?>

        <?php
            $this->beginWidget('zii.widgets.CPortlet', array(
                'title'=>'Operations',
            ));
            $this->widget('bootstrap.widgets.TbMenu', array(
                'items'=>$this->menu,
                'htmlOptions'=>array('class'=>'operations'),
            ));
            $this->endWidget();
        ?>

<?php $this->endContent(); ?>

<?php /* @var $this Controller */ ?>
<?php $this->beginContent('//layouts/main'); ?>

        <?php
            $this->beginWidget('zii.widgets.CPortlet', array(
                'title'=>'Operations',
            ));
            $this->widget('bootstrap.widgets.TbMenu', array(
                'items'=>$this->menu,
                'htmlOptions'=>array('class'=>'operations'),
            ));
            $this->endWidget();
        ?>

            <?php echo $content; ?>

<?php $this->endContent(); ?>

Move sidebar to the left

Move sidebar to the left


<?php

namespace Pippin;

use Pippin\IPN;

final class IPNParser {

	public function parse($IPNString) {
		$IPNData = [];
		$pairs = explode('&', $IPNString);
		foreach ($pairs as $pair) {
			$keyValue = explode('=', $pair);
			if (count($keyValue) == 2) {
				$IPNData[urldecode($keyValue[0])] = urldecode($keyValue[1]);
			}
		}

		$transactions = TransactionFactory::transactionsFromIPNData($IPNData);

		return new IPN($transactions, $IPNData);
	}

}

<?php

namespace Pippin;

use Pippin\IPN;

final class IPNParser {

	public function parse($IPNString) {
		$IPNData = [];
		$pairs = explode('&', $IPNString);
		foreach ($pairs as $pair) {
			$keyValue = explode('=', $pair);
			if (count($keyValue) == 2) {
				$IPNData[urldecode($keyValue[0])] = urldecode($keyValue[1]);
			}
		}

		if (array_key_exists('charset', $IPNData) && is_string($IPNData['charset'])) {
			$charset = $IPNData['charset'];
			foreach ($IPNData as $key => $value) {
				$IPNData[$key] = mb_convert_encoding($value, 'utf-8', $charset);
			}
		}

		$transactions = TransactionFactory::transactionsFromIPNData($IPNData);

		return new IPN($transactions, $IPNData);
	}

}

Convert IPNs to UTF-8 when parsing.

Convert IPNs to UTF-8 when parsing.


<?php
	header('Content-Type: text/html; charset=utf-8');
	require_once 'db_config.php';
	require_once 'db_class.php';
	$db = new database($pdo);
?>
<html>
	<head>
        <meta charset="UTF-8">
		<title>MiniUploader</title>
	</head>
	<body>
	<?php
	//echo $_GET['id'];
	if (empty($_GET['id']))
	{
		echo "Request Error!";
	}
	else
	{
		$db->deleteuploadbyid($_GET['id']);
		header("Location: index.php");
		exit();
	}
	?>

	</body>
</html>

<?php
	header('Content-Type: text/html; charset=utf-8');
	require_once 'db_config.php';
	require_once 'db_class.php';
	$db = new database($pdo);

	session_start();
	session_regenerate_id();
?>
<html>
	<head>
        <meta charset="UTF-8">
		<title>MiniUploader</title>
	</head>
	<body>
	<?php
	//echo $_GET['id'];

	if(!isset($_SESSION['username']))
	{
		echo "Not logged in, cannot delete files!";
		exit();
	}
	$curuser=$db->getuser($_SESSION["username"]);
	if (!is_array($curuser))
	{
		echo "Not logged in, cannot delete files!";
		exit();
	}

	if (empty($_GET['id']))
	{
		echo "Request Error!";
	}
	else
	{
		$file=$db->selectuploadbyid($_GET['id']);
		if(!isset($file['filename']))
		{
			echo "Invalid file!";
			exit();
		}
		if(strcmp($file['uploader'], $curuser['id'])!=0)
		{
			echo "Cannot delete file of other users!";
			exit();
		}
		$db->deleteuploadbyid($_GET['id']);
		header("Location: index.php");
		exit();
	}
	?>

	</body>
</html>

Verify current user while deleting files.


<?php

/* @var $this yii\web\View */

use yii\helpers\Html;
use yii\bootstrap\Tabs;
use app\models\ProfileForm;

$this->title = 'Home';
?>

<title>Home</title> <!-- For Pjax's sake -->
<div class="site-index">
<?=
Tabs::widget([
    'items' => [
        [
            'label' => 'Profile',
            'content' => $this->render('profile', ['model' => new ProfileForm()]),
            'headerOptions' => ['id' => 'profile-tab'],
            'active' => true
        ],
        [
            'label' => 'Log Book',
            'content' => $this->render('logbook'),
            'headerOptions' => ['id' => 'logbook-tab'],
            'options' => ['id' => 'tab-logbook'],
        ],
        [
            'label' => 'Notifications',
            'content' => $this->render('notifications'),
            'headerOptions' => ['id' => 'notifications-tab'],
            'options' => ['id' => 'tab-notifications'],
        ],
    ],
]);
?>
</div>

<?php

/* @var $this yii\web\View */

use app\models\ProfileForm;
use yii\bootstrap\Tabs;

$this->title = 'Home';
?>

<title>Home</title>

    <?=
    Tabs::widget([
        'encodeLabels' => false,
        'items' => [
            [
                'label' => ' Profile',
                'content' => $this->render('profile', ['model' => new ProfileForm()]),
                'headerOptions' => ['id' => 'profile-tab'],
                'active' => true
            ],
            [
                'label' => ' Log Book',
                'content' => $this->render('logbook'),
                'headerOptions' => ['id' => 'logbook-tab'],
                'options' => ['id' => 'tab-logbook'],
            ],
            [
                'label' => ' Notifications',
                'content' => $this->render('notifications'),
                'headerOptions' => ['id' => 'notifications-tab'],
                'options' => ['id' => 'tab-notifications'],
            ],
        ],
    ]);
    ?>

Add glyph icons in tab widget headers

Add glyph icons in tab widget headers


<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use DB;

class CreatePostsTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('discussion_id')->unsigned();
            $table->integer('number')->unsigned()->nullable();

            $table->dateTime('time');
            $table->integer('user_id')->unsigned()->nullable();
            $table->string('type', 100)->nullable();
            $table->text('content')->nullable();
            $table->text('content_html')->nullable();

            $table->dateTime('edit_time')->nullable();
            $table->integer('edit_user_id')->unsigned()->nullable();
            $table->dateTime('hide_time')->nullable();
            $table->integer('hide_user_id')->unsigned()->nullable();

            $table->unique(['discussion_id', 'number']);
        });

        DB::statement('ALTER TABLE posts ADD FULLTEXT content (content)');
    }

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

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePostsTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('discussion_id')->unsigned();
            $table->integer('number')->unsigned()->nullable();

            $table->dateTime('time');
            $table->integer('user_id')->unsigned()->nullable();
            $table->string('type', 100)->nullable();
            $table->text('content')->nullable();
            $table->text('content_html')->nullable();

            $table->dateTime('edit_time')->nullable();
            $table->integer('edit_user_id')->unsigned()->nullable();
            $table->dateTime('hide_time')->nullable();
            $table->integer('hide_user_id')->unsigned()->nullable();

            $table->unique(['discussion_id', 'number']);

            $table->engine = 'MyISAM';
        });

        DB::statement('ALTER TABLE posts ADD FULLTEXT content (content)');
    }

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

Set table engine to MyISAM explicitly (for fulltext support)


<?php

/*
 * This file is part of the SncRedisBundle package.
 *
 * (c) Henrik Westphal <henrik.westphal@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Snc\RedisBundle\Client\Predis\Network;

use Predis\Commands\ICommand;
use Predis\ResponseError;
use Predis\Network\StreamConnection;
use Snc\RedisBundle\Logger\RedisLogger;

/**
 * LoggingStreamConnection
 */
class LoggingStreamConnection extends StreamConnection
{
    /**
     * @var RedisLogger
     */
    protected $logger;

    /**
     * Sets the logger
     *
     * @param RedisLogger $logger A RedisLogger instance
     */
    public function setLogger(RedisLogger $logger = null)
    {
        $this->logger = $logger;
    }

    /**
     * {@inheritdoc}
     */
    public function executeCommand(ICommand $command) {
        $startTime = microtime(true);
        $result = parent::executeCommand($command);
        $duration = (microtime(true) - $startTime) * 1000;
        if (null !== $this->logger) {
            $error = $result instanceof ResponseError ? (string) $result : false;
            $this->logger->logCommand((string) $command, $duration, $this->_params->alias, $error);
        }
        return $result;
    }
}

<?php

/*
 * This file is part of the SncRedisBundle package.
 *
 * (c) Henrik Westphal <henrik.westphal@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Snc\RedisBundle\Client\Predis\Network;

use Predis\Commands\ICommand;
use Predis\ResponseError;
use Predis\Network\StreamConnection;
use Snc\RedisBundle\Logger\RedisLogger;

/**
 * LoggingStreamConnection
 */
class LoggingStreamConnection extends StreamConnection
{
    /**
     * @var RedisLogger
     */
    protected $logger;

    /**
     * Sets the logger
     *
     * @param RedisLogger $logger A RedisLogger instance
     */
    public function setLogger(RedisLogger $logger = null)
    {
        $this->logger = $logger;
    }

    /**
     * {@inheritdoc}
     */
    public function executeCommand(ICommand $command) {
        $startTime = microtime(true);
        $result = parent::executeCommand($command);
        $duration = (microtime(true) - $startTime) * 1000;
        if (null !== $this->logger) {
            $error = $result instanceof ResponseError ? (string) $result : false;
            $this->logger->logCommand((string) $command, $duration, $this->parameters->alias, $error);
        }
        return $result;
    }
}

Fix the name of the protected field that holds connection parameters.

This has been recently changed in Predis (sorry for that), we won't modify
the names of public or protected fields anymore until v0.8.


<?php

namespace Oro\Bundle\IntegrationBundle\Datagrid;

use Oro\Bundle\DataGridBundle\Extension\Action\Actions\AjaxAction;

class ScheduleSyncAction extends AjaxAction
{
    /**
     * @return array
     */
    public function getOptions()
    {
        $options = parent::getOptions();
        $options['frontend_type'] = 'schedule-sync';

        return $options;
    }
}

CRM-1159: Add row action "Schedule sync" to channels grid
- fix code style


<?php

namespace Spark\Core\Command;

use Silex\Application;

use Spark\Core\ApplicationAware;

use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

use Monolog\Logger;
use Monolog\Handler\StreamHandler;

use Kue\Worker;
use Kue\Queue;

class QueueWorker extends \Kue\Command\Worker
{
    protected $silexApplication;

    function __construct(Queue $queue)
    {
        parent::__construct($queue);

        $this->log = new Logger('spark/queue:worker');
        $this->log->pushHandler(new StreamHandler(STDERR));
    }

    function setSilexApplication(Application $app)
    {
        $this->silexApplication = $app;
    }

    protected function configure()
    {
        parent::configure();

        $this->setName('queue:worker');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->silexApplication->boot();

        return parent::execute($input, $output);
    }

    protected function setupWorker(Worker $worker)
    {
        parent::setupWorker($worker);

        $app = $this->silexApplication;

        $worker->on('init', function($job) use ($app) {
            if ($job instanceof ApplicationAware) {
                $job->setApplication($app);
            }
        });
    }
}

<?php

namespace Spark\Core\Command;

use Silex\Application;

use Spark\Core\ApplicationAware;

use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

use Monolog\Logger;
use Monolog\Handler\StreamHandler;

use Kue\Worker;
use Kue\Queue;

class QueueWorker extends \Kue\Command\Worker
{
    protected $silexApplication;

    function setSilexApplication(Application $app)
    {
        $this->silexApplication = $app;
    }

    protected function configure()
    {
        parent::configure();

        $this->setName('queue:worker');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->silexApplication->boot();

        return parent::execute($input, $output);
    }

    protected function setupWorker(Worker $worker)
    {
        parent::setupWorker($worker);

        $app = $this->silexApplication;

        $worker->on('init', function($job) use ($app) {
            if ($job instanceof ApplicationAware) {
                $job->setApplication($app);
            }
        });
    }
}

Remove duplicate logger initialization, which caused error


<?php
namespace Projek\Slim\Database;

use Slim\PDO\Database as SlimDatabase;

abstract class Schema
{
    /**
     *  @var  string
     */
    protected $table = '';

    /**
     *  @var  mixed
     */
    protected $schema = '';

    /**
     *  @var  array
     */
    protected $params = '';

    /**
     *  @param  string $table
     *  @param  array|string $schema
     */
    public function __construct($table, $schema = null)
    {
        $this->table = $table;
        $this->schema = $schema;
    }

    /**
     *  Build schema
     *
     *  @param  SlimDatabase|null $database
     *  @return string
     */
    abstract public function build(SlimDatabase $database = null);

    /**
     * @return  array
     */
    public function params()
    {
        return $this->params;
    }
}

<?php
namespace Projek\Slim\Database;

use Slim\PDO\Database as SlimDatabase;

abstract class Schema
{
    /**
     *  @var  string
     */
    protected $table = '';

    /**
     *  @var  mixed
     */
    protected $schema = '';

    /**
     *  @var  array
     */
    protected $params = [];

    /**
     *  @param  string $table
     *  @param  array|string $schema
     */
    public function __construct($table, $schema = null)
    {
        $this->table = $table;
        $this->schema = $schema;
    }

    /**
     *  Build schema
     *
     *  @param  SlimDatabase|null $database
     *  @return string
     */
    abstract public function build(SlimDatabase $database = null);

    /**
     * @return  array
     */
    public function params()
    {
        return $this->params;
    }
}

Fix error on php 7.1

Fix error on php 7.1

Signed-off-by: Fery Wardiyanto <bd7846e81d12676baffd10ffe6daf3939680ab52@gmail.com>


<?php
/**
 * This file is part of the LdapTools package.
 *
 * (c) Chad Sikorra <Chad.Sikorra@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace LdapTools\Connection\AD;

use LdapTools\Connection\ADResponseCodes;
use LdapTools\Connection\LastErrorStrategy;

/**
 * Try to retrieve a more detailed error message based on the specific AD response code.
 *
 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
 */
class ADLastErrorStrategy extends LastErrorStrategy
{
    /**
     * {@inheritdoc}
     */
    public function getLastErrorMessage()
    {
        $extendedError = $this->getExtendedErrorNumber();

        if (array_key_exists($extendedError, ADResponseCodes::RESPONSE_MESSAGE)) {
            $message = ADResponseCodes::RESPONSE_MESSAGE[$extendedError];
        } else {
            $message = parent::getLastErrorMessage();
        }

        return $message;
    }

    /**
     * {@inheritdoc}
     */
    public function getExtendedErrorNumber()
    {
        ldap_get_option($this->connection, self::DIAGNOSTIC_MESSAGE_OPT, $extendedError);

        $errorNumber = 0;
        if (!empty($extendedError)) {
            $errorNumber = explode(',', $extendedError);
            if (!isset($errorNumber[2])) {
                return 0;
            };
            $errorNumber = explode(' ', $errorNumber[2]);
            if (!isset($errorNumber[2])) {
                return 0;
            };
            $errorNumber = hexdec(intval($errorNumber[2]));
        }

        return $errorNumber;
    }
}

<?php
/**
 * This file is part of the LdapTools package.
 *
 * (c) Chad Sikorra <Chad.Sikorra@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace LdapTools\Connection\AD;

use LdapTools\Connection\ADResponseCodes;
use LdapTools\Connection\LastErrorStrategy;

/**
 * Try to retrieve a more detailed error message based on the specific AD response code.
 *
 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
 */
class ADLastErrorStrategy extends LastErrorStrategy
{
    /**
     * {@inheritdoc}
     */
    public function getLastErrorMessage()
    {
        $extendedError = $this->getExtendedErrorNumber();

        if (array_key_exists($extendedError, ADResponseCodes::RESPONSE_MESSAGE)) {
            $message = ADResponseCodes::RESPONSE_MESSAGE[$extendedError];
        } else {
            $message = parent::getLastErrorMessage();
        }

        return $message;
    }

    /**
     * {@inheritdoc}
     */
    public function getExtendedErrorNumber()
    {
        $errorNumber = 0;
        $extendedError = $this->getDiagnosticMessage();

        if (!empty($extendedError) && preg_match('/, data (\d+),?/', $extendedError, $matches)) {
            $errorNumber = hexdec(intval($matches[1]));
        }

        return $errorNumber;
    }
}

Simplify extended error number parsing.

Simplify extended error number parsing.


© <?php the_time('Y'); ?> Trevan Hetzel  |  Built with WordPress, Twig & Backbone on Flywheel  |  Source code

  <?php wp_footer(); ?>

Add async attr to script because pagespeed insights is dumb


<?php

namespace tagadvance\gilligan\session;

use PHPUnit\Framework\TestCase;
use tagadvance\gilligan\cache\APC;

/**
 *
 * @author Tag <tagadvance+gilligan@gmail.com>
 */
class APCSessionHandlerTest extends TestCase {

    const SESSION_ID = 'CAFEBABE';

    /**
     *
     * @var APCSessionHandler
     */
    private $handler;

    function setUp() {
        apc_clear_cache();

        $timeToLive = get_cfg_var('session.gc_maxlifetime');
        $apc = new APC($timeToLive);
        $this->handler = new APCSessionHandler($apc);
    }

    function testReadAndWrite() {
        $writeData = 'foo';
        $this->handler->write(self::SESSION_ID, $writeData);

        $readData = $this->handler->read(self::SESSION_ID);

        $this->assertEquals($expected = $writeData, $actual = $readData);
    }

    function testDestroy() {
        $this->handler->write(self::SESSION_ID, 'foo');
        $this->handler->destroy(self::SESSION_ID);
        $actual = $this->handler->read(self::SESSION_ID);
        $this->assertEquals($expected = '', $actual);
    }

    function testGarbageCollection() {
        $this->handler->write(self::SESSION_ID, 'foo');
        $result = $this->handler->gc($maxLifetime = 0);
        $this->assertTrue($result);
    }

    function tearDown() {
        apc_clear_cache();
    }

}

<?php

namespace tagadvance\gilligan\session;

use PHPUnit\Framework\TestCase;
use tagadvance\gilligan\cache\APC;

/**
 *
 * @author Tag <tagadvance+gilligan@gmail.com>
 */
class APCSessionHandlerTest extends TestCase {

    const SESSION_ID = 'CAFEBABE';

    /**
     *
     * @var APCSessionHandler
     */
    private $handler;

    function setUp() {
        apcu_clear_cache();

        $timeToLive = get_cfg_var('session.gc_maxlifetime');
        $apc = new APC($timeToLive);
        $this->handler = new APCSessionHandler($apc);
    }

    function testReadAndWrite() {
        $writeData = 'foo';
        $this->handler->write(self::SESSION_ID, $writeData);

        $readData = $this->handler->read(self::SESSION_ID);

        $this->assertEquals($expected = $writeData, $actual = $readData);
    }

    function testDestroy() {
        $this->handler->write(self::SESSION_ID, 'foo');
        $this->handler->destroy(self::SESSION_ID);
        $actual = $this->handler->read(self::SESSION_ID);
        $this->assertEquals($expected = '', $actual);
    }

    function testGarbageCollection() {
        $this->handler->write(self::SESSION_ID, 'foo');
        $result = $this->handler->gc($maxLifetime = 0);
        $this->assertTrue($result);
    }

    function tearDown() {
        apcu_clear_cache();
    }

}

Error: Call to undefined function apc_clear_cache()


<?php

use App\User;

class UserTest extends TestCase
{
    /**
     * Test that the getAvatarUrl function returns the correct Gravatar URL for a specific email.
     */
    public function testGeneratedGravatarUrlIsCorrect()
    {
        $user = new User();
        $user->email = 'me@mitchfizz05.net';

        $this->assertEquals(
            '//www.gravatar.com/avatar/4083e548052988dbd2b4c47e39efa7ce?s=150&d=monsterid',
            $user->getAvatarUrl(150)
        );
    }
}

<?php

use App\User;

class UserTest extends TestCase
{
    /**
     * Test that the getAvatarUrl function returns the correct Gravatar URL for a specific email.
     */
    public function testGeneratedGravatarUrlIsCorrect()
    {
        $user = new User();
        $user->email = 'me@mitchfizz05.net';

        $this->assertEquals(
            '//www.gravatar.com/avatar/4083e548052988dbd2b4c47e39efa7ce?s=150&d=monsterid',
            $user->getAvatarUrl(150)
        );
    }

    /**
     * Test that profile links are being generated correctly.
     */
    public function testGeneratedProfileLink()
    {
        $user = new User();
        $user->id = 1;
        $user->email = 'me@mitchfizz05.net';
        $user->name = 'Mitchfizz05';

        $this->assertEquals(
            url('/profile/1-Mitchfizz05'),
            $user->getProfileUrl()
        );
    }
}

Add user profile url generator test.

Add user profile url generator test.


<?php

class Cookbooks
{
    public function get()
    {
        $cookbooks = Cache::remember(
            'cookbooks',
            60, //60 minutes
            function () {
                $cookbooks = Chef::get('/cookbooks');
                if (empty($cookbooks)) {
                    return [];
                }
                $cookbooks = (array) $cookbooks;
                ksort($cookbooks);
                return $cookbooks;
            }
        );
        return $cookbooks;
    }

    public function create($name, $version)
    {
        $cookbook = new StdClass();
        $cookbook->name = $name;
        $cookbook->version = $version;
        Chef::put("/cookbooks/$name/$version", $cookbook);
    }
}

<?php

class Cookbooks
{
    public static function get()
    {
        $cookbooks = Cache::remember(
            'cookbooks',
            60, //60 minutes
            function () {
                $cookbooks = Chef::get('/cookbooks');
                if (empty($cookbooks)) {
                    return [];
                }
                $cookbooks = (array) $cookbooks;
                ksort($cookbooks);
                return $cookbooks;
            }
        );
        return $cookbooks;
    }

    public static function create($name, $version)
    {
        $cookbook = new StdClass();
        $cookbook->name = $name;
        $cookbook->version = $version;
        Chef::put("/cookbooks/$name/$version", $cookbook);
    }
}

Fix php by making methods static

Fix php by making methods static


<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\RateLimiter\Storage;

use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\RateLimiter\LimiterStateInterface;

/**
 * @author Wouter de Jong <wouter@wouterj.nl>
 *
 * @experimental in 5.2
 */
class CacheStorage implements StorageInterface
{
    private $pool;

    public function __construct(CacheItemPoolInterface $pool)
    {
        $this->pool = $pool;
    }

    public function save(LimiterStateInterface $limiterState): void
    {
        $cacheItem = $this->pool->getItem(sha1($limiterState->getId()));
        $cacheItem->set($limiterState);
        if (null !== ($expireAfter = $limiterState->getExpirationTime())) {
            $cacheItem->expiresAfter($expireAfter);
        }

        $this->pool->save($cacheItem);
    }

    public function fetch(string $limiterStateId): ?LimiterStateInterface
    {
        $cacheItem = $this->pool->getItem(sha1($limiterStateId));
        $value = $cacheItem->get();
        if ($value instanceof LimiterStateInterface) {
            return $value;
        }

        return null;
    }

    public function delete(string $limiterStateId): void
    {
        $this->pool->deleteItem($limiterStateId);
    }
}

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\RateLimiter\Storage;

use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\RateLimiter\LimiterStateInterface;

/**
 * @author Wouter de Jong <wouter@wouterj.nl>
 *
 * @experimental in 5.2
 */
class CacheStorage implements StorageInterface
{
    private $pool;

    public function __construct(CacheItemPoolInterface $pool)
    {
        $this->pool = $pool;
    }

    public function save(LimiterStateInterface $limiterState): void
    {
        $cacheItem = $this->pool->getItem(sha1($limiterState->getId()));
        $cacheItem->set($limiterState);
        if (null !== ($expireAfter = $limiterState->getExpirationTime())) {
            $cacheItem->expiresAfter($expireAfter);
        }

        $this->pool->save($cacheItem);
    }

    public function fetch(string $limiterStateId): ?LimiterStateInterface
    {
        $cacheItem = $this->pool->getItem(sha1($limiterStateId));
        $value = $cacheItem->get();
        if ($value instanceof LimiterStateInterface) {
            return $value;
        }

        return null;
    }

    public function delete(string $limiterStateId): void
    {
        $this->pool->deleteItem(sha1($limiterStateId));
    }
}

Fix delete method on RateLimiter's cache storage


<?php
function brewtah_theme_support() {
    // Add language support
    load_theme_textdomain('brewtah', get_template_directory() . '/languages');

    // Add menu support
    add_theme_support('menus');

    // Add post thumbnail support: http://codex.wordpress.org/Post_Thumbnails
    add_theme_support('post-thumbnails');

	set_post_thumbnail_size(150, 150, false);

    // rss thingy
    add_theme_support('automatic-feed-links');

    // Add post formarts support: http://codex.wordpress.org/Post_Formats
    add_theme_support('post-formats', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat'));

	// Add image sizes
	add_image_size( 'beer-image', 100, 100, true );

	add_image_size( 'beer-sidebar-image', 50, 50, true );

}

add_action('after_setup_theme', 'brewtah_theme_support');
?>

<?php
function brewtah_theme_support() {
    // Add language support
    load_theme_textdomain('brewtah', get_template_directory() . '/languages');

    // Add menu support
    add_theme_support('menus');

    // Add post thumbnail support: http://codex.wordpress.org/Post_Thumbnails
    add_theme_support('post-thumbnails');

	set_post_thumbnail_size(150, 150, false);

    // rss thingy
    add_theme_support('automatic-feed-links');

    // Add post formarts support: http://codex.wordpress.org/Post_Formats
    add_theme_support('post-formats', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat'));

	// Add image sizes
	add_image_size( 'archive-image', 100, 100, true );

	add_image_size( 'sidebar-image', 50, 50, true );

	add_image_size( 'store-image', 250, 188, true );

}

add_action('after_setup_theme', 'brewtah_theme_support');
?>

Rename image sizes, add store image size.


<?php
/*
 * Template Name: Accueil
 */

get_header_once();
?>

<?php
get_template_part('template-features');
?>

<?php
//  PROGRAMMATION ------> ID 4
include_page_part(4);
?>

<?php
//  COORDONNEES ------> ID 43
include_page_part(43);
?>

<?php
//  BLOGUE ------> ID 7
include_page_part(7);
?>

<?php
//  PARTENAIRES ------> ID 47
include_page_part(47);
?>

<?php
//  WAQ 2015 ------> ID 45
include_page_part(45);
?>

<?php
get_footer_once();
?>

<?php
/*
 * Template Name: Accueil
 */

get_header_once();
?>

<?php
get_template_part('template-features');
?>

<?php
//  PROGRAMMATION ------> ID 4
include_page_part(4);
?>

<?php
//  COORDONNEES ------> ID 43
include_page_part(43);
?>

<?php
//  BLOGUE ------> ID 7
include_page_part(7);
?>

<?php
//  PARTENAIRES ------> ID 47
include_page_part(47);
?>

<?php
//  WAQ 2015 ------> ID 45
include_page_part(45);
?>

<?php
get_footer();
?>

Add footer to the homepage

Add footer to the homepage


<?php
namespace spec\Nats;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class ConnectionSpec extends ObjectBehavior
{
    function it_is_initializable()
    {
        $this->shouldHaveType('Nats\Connection');
    }

    function it_has_ping_count_to_zero()
    {
        $this->pingsCount()->shouldBe(0);
    }

    function it_has_pubs_count_to_zero()
    {
        $this->pubsCount()->shouldBe(0);
    }

    function it_has_reconnects_count_to_zero()
    {
        $this->reconnectsCount()->shouldBe(0);
    }

    function it_has_subscriptions_count_to_zero()
    {
        $this->subscriptionsCount()->shouldBe(0);
    }

    function it_subscriptions_array_is_empty()
    {
        $this->getSubscriptions()->shouldHaveCount(0);
    }
}

<?php
namespace spec\Nats;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class ConnectionSpec extends ObjectBehavior
{
    function it_is_initializable()
    {
        $this->shouldHaveType('Nats\Connection');
    }

    function it_has_ping_count_to_zero()
    {
        $this->pingsCount()->shouldBe(0);
    }

    function it_has_pubs_count_to_zero()
    {
        $this->pubsCount()->shouldBe(0);
    }

    function it_has_reconnects_count_to_zero()
    {
        $this->reconnectsCount()->shouldBe(0);
    }

    function it_has_subscriptions_count_to_zero()
    {
        $this->subscriptionsCount()->shouldBe(0);
    }

    function it_subscriptions_array_is_empty()
    {
        $this->getSubscriptions()->shouldHaveCount(0);
    }

    function it_is_disconnected()
    {
        $this->isConnected()->shouldBe(false);
    }
}

Check if it is disconnected by default

Check if it is disconnected by default


<?php

class TEMPLATE_SYSTEM {

    private $dsn = "mysql:host=localhost;dbname=test1";
    private $user = "testuser";
    private $pass = "testpassword";

    public function getConnections() {
        // return an array of PDO connections
        throw new \Exception("The system TEMPLATE_SYSTEM has not been set up");
    }

    public function check(PDO $conn) {
        // return true if $conn is valid
        return false;
    }

}

<?php

class TEMPLATE_SYSTEM {

    private $dsn = "mysql:host=localhost;dbname=test1";
    private $user = "testuser";
    private $pass = "testpassword";

	/**
	 * Build and return an array of PDO connections
	 * @return array
	 */
    public function getConnections() {
        // return an array of PDO connections
        throw new \Exception("The system TEMPLATE_SYSTEM has not been set up");
		$db = new PDO($this->dsn, $this->user, $this->pass);
		return array($db);
    }

    public function check(PDO $conn) {
        // return true if $conn is valid
        return false;
    }

}

Update System tempalte to make it clear you must return an array of Connections


<?php
/*
 * Assetrinc source code
 *
 * Copyright Matt Light <matt.light@lightdatasys.com>
 *
 * For copyright and licensing information, please view the LICENSE
 * that is distributed with this source code.
 */

namespace Assetrinc;

class ContentTypeManager
{
    private $content_types = array(
        ''       => 'text/text',
        'css'    => 'text/css',
        'gif'    => 'image/gif',
        'ico'    => 'image/vnd.microsoft.icon',
        'jpg'    => 'image/jpeg',
        'js'     => 'text/javascript',
        'png'    => 'image/png',
    );

    public function getContentTypeForFileName($name)
    {
        $extensions = explode('.', basename($name));
        $extension  = null;
        foreach ($extensions as $ext) {
            if (isset($this->content_types[$ext])) {
                $extension = $ext;
                break;
            }
        }

        return $this->content_types["{$extension}"];
    }
}

<?php
/*
 * Assetrinc source code
 *
 * Copyright Matt Light <matt.light@lightdatasys.com>
 *
 * For copyright and licensing information, please view the LICENSE
 * that is distributed with this source code.
 */

namespace Assetrinc;

class ContentTypeManager
{
    private $content_types = array(
        ''       => 'text/text',
        'css'    => 'text/css',
        'gif'    => 'image/gif',
        'ico'    => 'image/vnd.microsoft.icon',
        'jpg'    => 'image/jpeg',
        'js'     => 'text/javascript',
        'png'    => 'image/png',
    );

    public function getContentTypeForFileName($name)
    {
        $extensions = explode('.', basename($name));
        $extension  = null;
        foreach ($extensions as $ext) {
            if (isset($this->content_types[$ext])) {
                $extension = $ext;
                break;
            }
        }

        return $this->content_types["{$extension}"];
    }

    public function setContentTypeForExtension($extension, $content_type)
    {
        $this->content_types[$extension] = $content_type;
    }
}

Add the ability to set a content-type for an extension


<?php

namespace Drupal\sermepa_payment\Controller;

use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\Request;

class SermepaController extends ControllerBase {

  /**
   * Checks access for a specific request.
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   Run access checks for this account.
   */
  public function access(AccountInterface $account) {
    return AccessResult::allowedIf(true);
  }

  /**
    * Action process Sermepa response
    *
    * @param Request $request
    *   Request data, including the step variable tat indicates current step.
    */
  public function callback(Request $request) {
    // Do something magic.
    return [];
  }
}

<?php

namespace Drupal\sermepa_payment\Controller;

use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\Request;
use Drupal\payment\Entity\Payment;
use Drupal\sermepa_payment\Plugin\Payment\Method\Sermepa as SermepaMethod;

class SermepaController extends ControllerBase {

  /**
   * Checks access for a specific request.
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   Run access checks for this account.
   */
  public function access(AccountInterface $account) {
    $tempstore = \Drupal::service('user.private_tempstore')->get('sermepa_payment');

    $storedPaymentId = $tempstore->get("payment_id");
    $receivedPaymentId = \Drupal::request()->get('payment_id');

    // Try to load payment and the payment_method from database
    $payment = Payment::load($receivedPaymentId);
    $payment_method = is_null($payment) ? null : $payment->getPaymentMethod();

    // Allow access of payment IDs match, the paymet can be loaded and the
    // method used is Sermepa
    return AccessResult::allowedIf(
      ($storedPaymentId == $receivedPaymentId) &&
      !is_null($payment) &&
      !is_null($payment_method) &&
      ($payment_method instanceof SermepaMethod)
    );
  }

  /**
    * Action process Sermepa response
    *
    * @param Request $request
    *   Request data, including the step variable tat indicates current step.
    */
  public function callback(Request $request) {
    // Do something magic.
    return [];
  }
}

Check parameters and session before checking sermepa result.


<?php

namespace Asmaster\EquipTwig\Exception;

use InvalidArgumentException;
use Twig_ExtensionInterface;

class ExtensionException extends InvalidArgumentException
{
    /**
     * @param mixed $extension
     *
     * @return static
     */
    public static function invalidExtension($extension)
    {
        if (is_object($extension)) {
            $extension = get_class($extension);
        }

        return new static(sprintf(
            'Twig extension `%s` must implement `%s`',
            $extension,
            Twig_ExtensionInterface::class
        ));
    }
}

<?php

namespace Asmaster\EquipTwig\Exception;

use InvalidArgumentException;
use Twig_ExtensionInterface as TwigExtensionInterface;

class ExtensionException extends InvalidArgumentException
{
    /**
     * @param mixed $extension
     *
     * @return static
     */
    public static function invalidExtension($extension)
    {
        if (is_object($extension)) {
            $extension = get_class($extension);
        }

        return new static(sprintf(
            'Twig extension `%s` must implement `%s`',
            $extension,
            TwigExtensionInterface::class
        ));
    }
}

Add alias for "Twig_ExtensionInterface" to be PSR compliant


<?php

namespace Lstr\Sprintf\Middleware;

abstract class AbstractInvokable
{
    /**
     * @var AbstractInvokable|null
     */
    private $invokable;

    /**
     * @param AbstractInvokable|null $invokable
     */
    public function __construct(AbstractInvokable $invokable = null)
    {
        $this->invokable = $invokable;
    }

    /**
     * @param string $name
     * @param callable $values
     * @param array $options
     * @return mixed
     */
    public function __invoke($name, callable $values, array $options)
    {
        $params = new InvokableParams($name, $values, $options);

        $this->invokeProcess($params);
        $values_callback = $params->getValuesCallback();

        return $values_callback($params->getName());
    }

    /**
     * @param InvokableParams $params
     */
    abstract protected function process(InvokableParams $params);

    /**
     * @param InvokableParams $params
     */
    private function invokeProcess(InvokableParams $params)
    {
        if ($this->invokable) {
            call_user_func([$this->invokable, 'invokeProcess'], $params);
        }

        $this->process($params);
    }
}

<?php

namespace Lstr\Sprintf\Middleware;

abstract class AbstractInvokable
{
    /**
     * @var AbstractInvokable|null
     */
    private $invokable;

    /**
     * @param AbstractInvokable|null $invokable
     */
    public function __construct(AbstractInvokable $invokable = null)
    {
        $this->invokable = $invokable;
    }

    /**
     * @param string $name
     * @param callable $values
     * @param array $options
     * @return mixed
     */
    public function __invoke($name, callable $values, array $options)
    {
        $params = new InvokableParams($name, $values, $options);

        $this->invokeProcess($params);
        $values_callback = $params->getValuesCallback();

        return $values_callback($params->getName());
    }

    /**
     * @param InvokableParams $params
     */
    abstract protected function process(InvokableParams $params);

    /**
     * @param InvokableParams $params
     */
    protected function invokeProcess(InvokableParams $params)
    {
        if ($this->invokable) {
            call_user_func([$this->invokable, 'invokeProcess'], $params);
        }

        $this->process($params);
    }
}

Make invokeProcess() available to children

AbstractInvokable Middleware will be able to more easily use
composition of middleware within their process() methods if
we allow invokeProcess() to be ran.


<?php

namespace Kevinrob\GuzzleCache\Storage;

use Doctrine\Common\Cache\Cache;
use Kevinrob\GuzzleCache\CacheEntry;

class DoctrineCacheWrapper implements CacheStorageInterface
{

    /**
     * @var Cache
     */
    protected $cache;

    /**
     * @param Cache $cache
     */
    public function __construct(Cache $cache)
    {
        $this->cache = $cache;
    }

    /**
     * @inheritdoc
     */
    public function fetch($key)
    {
        try {
            $cache = unserialize($this->cache->fetch($key));
            if ($cache instanceof CacheEntry) {
                return $cache;
            }
        } catch (\Exception $ignored) {
            return null;
        }

        return null;
    }

    /**
     * @inheritdoc
     */
    public function save($key, CacheEntry $data)
    {
        try {
            $lifeTime = $data->getTTL();
            if ($lifeTime >= 0) {
                return $this->cache->save(
                    $key,
                    serialize($data),
                    $lifeTime
                );
            }
        } catch (\Exception $ignored) { }

        return false;
    }

}

<?php

namespace Kevinrob\GuzzleCache\Storage;

use Doctrine\Common\Cache\Cache;
use Kevinrob\GuzzleCache\CacheEntry;

class DoctrineCacheWrapper implements CacheStorageInterface
{

    /**
     * @var Cache
     */
    protected $cache;

    /**
     * @param Cache $cache
     */
    public function __construct(Cache $cache)
    {
        $this->cache = $cache;
    }

    /**
     * @inheritdoc
     */
    public function fetch($key)
    {
        try {
            $cache = unserialize($this->cache->fetch($key));
            if ($cache instanceof CacheEntry) {
                return $cache;
            }
        } catch (\Exception $ignored) {
            return null;
        }

        return null;
    }

    /**
     * @inheritdoc
     */
    public function save($key, CacheEntry $data)
    {
        try {
            $lifeTime = $data->getTTL();
            if ($lifeTime >= 0) {
                return $this->cache->save(
                    $key,
                    serialize($data),
                    $lifeTime
                );
            }
        } catch (\Exception $ignored) {
            // No fail if we can't save it the storage
        }

        return false;
    }

}

Add comment for empty catch

Add comment for empty catch


<?php

namespace Laravel\Lumen\Testing;

trait DatabaseTransactions
{
    /**
     * Begin a database transaction.
     *
     * @return void
     */
    public function beginDatabaseTransaction()
    {
        $this->app->make('db')->beginTransaction();

        $this->beforeApplicationDestroyed(function () {
            $this->app->make('db')->rollBack();
        });
    }
}

<?php

namespace Laravel\Lumen\Testing;

trait DatabaseTransactions
{
    /**
     * Handle database transactions on the specified connections.
     *
     * @return void
     */
    public function beginDatabaseTransaction()
    {
        $database = $this->app->make('db');

        foreach ($this->connectionsToTransact() as $name) {
            $database->connection($name)->beginTransaction();
        }

        $this->beforeApplicationDestroyed(function () use ($database) {
            foreach ($this->connectionsToTransact() as $name) {
                $database->connection($name)->rollBack();
            }
        });
    }

    /**
     * The database connections that should have transactions.
     *
     * @return array
     */
    protected function connectionsToTransact()
    {
        return property_exists($this, 'connectionsToTransact')
            ? $this->connectionsToTransact : [null];
    }
}

Support connectionsToTransact feature in Lumen


<?php

namespace Laravel\Scout;

use Illuminate\Support\ServiceProvider;
use Laravel\Scout\Console\FlushCommand;
use Laravel\Scout\Console\ImportCommand;
use MeiliSearch\Client as MeiliSearch;

class ScoutServiceProvider extends ServiceProvider
{
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->mergeConfigFrom(__DIR__.'/../config/scout.php', 'scout');

        $this->app->singleton(EngineManager::class, function ($app) {
            return new EngineManager($app);
        });

        if ($this->app->runningInConsole()) {
            $this->commands([
                ImportCommand::class,
                FlushCommand::class,
            ]);

            $this->publishes([
                __DIR__.'/../config/scout.php' => $this->app['path.config'].DIRECTORY_SEPARATOR.'scout.php',
            ]);
        }

        if (class_exists(MeiliSearch::class)) {
            $this->app->singleton(MeiliSearch::class, function () {
                return new MeiliSearch(config('meilisearch.host'), config('meilisearch.key'));
            });
        }
    }
}

<?php

namespace Laravel\Scout;

use Illuminate\Support\ServiceProvider;
use Laravel\Scout\Console\FlushCommand;
use Laravel\Scout\Console\ImportCommand;
use MeiliSearch\Client as MeiliSearch;

class ScoutServiceProvider extends ServiceProvider
{
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->mergeConfigFrom(__DIR__.'/../config/scout.php', 'scout');

        if (class_exists(MeiliSearch::class)) {
            $this->app->singleton(MeiliSearch::class, function () {
                return new MeiliSearch(config('meilisearch.host'), config('meilisearch.key'));
            });
        }

        $this->app->singleton(EngineManager::class, function ($app) {
            return new EngineManager($app);
        });

        if ($this->app->runningInConsole()) {
            $this->commands([
                ImportCommand::class,
                FlushCommand::class,
            ]);

            $this->publishes([
                __DIR__.'/../config/scout.php' => $this->app['path.config'].DIRECTORY_SEPARATOR.'scout.php',
            ]);
        }
    }
}

Change order of client registration

Change order of client registration


<?php

namespace Http\Factory\Diactoros;

use Psr\Http\Factory\ServerRequestFactoryInterface;
use Zend\Diactoros\ServerRequest;
use Zend\Diactoros\ServerRequestFactory as Factory;

class ServerRequestFactory implements ServerRequestFactoryInterface
{
    public function createServerRequest($method, $uri)
    {
        if (is_string($uri)) {
            return new ServerRequest([], [], $uri, $method);
        }

        return (new ServerRequest([], [], null, $method))
            ->withUri($uri);
    }

    public function createServerRequestFromGlobals()
    {
        return Factory::fromGlobals();
    }
}

<?php

namespace Http\Factory\Diactoros;

use Psr\Http\Factory\ServerRequestFactoryInterface;
use Zend\Diactoros\ServerRequest;
use Zend\Diactoros\ServerRequestFactory as Factory;

class ServerRequestFactory implements ServerRequestFactoryInterface
{
    public function createServerRequest($method, $uri)
    {
        return new ServerRequest([], [], $uri, $method);
    }

    public function createServerRequestFromGlobals()
    {
        return Factory::fromGlobals();
    }
}

Remove extra logic if $uri is UriInterface


<?php
/*
Section: global
Language: French Français
*/

$translations = array(
    'sitetitle1' => 'db4free.net',

    'sitetitle2' => 'Base de données MySQL gratuite',

    'topnav1' => 'Bienvenue',

    'topnav2' => 'Base de données',

    'topnav3' => 'Twitter',

    'topnav4' => 'Blog mpopp.net',

    'topnav5' => 'phpMyAdmin',

    'sidebar_1_2' => 'Dons',

    'sidebar_1_3' => 'Traductions',

    'sidebar_1_4' => 'Changelog',

    'sidebar_1_5' => 'Mentions',

    'sidebar_2_1' => 'A propos de db4free.net',

    'sidebar_2_2' => 'Conditions d\'utilisation',

    'sidebar_2_3' => 'Se connecter',

    'sidebar_2_4' => 'Modifier votre mot de passe',

    'sidebar_2_5' => 'Supprimer votre compte',

    'sidebar_2_6' => 'Mot de passe oublié ?',

    'pmalogin' => 'phpMyAdmin Login',

    'username' => 'Nom d\'utilisateur',

    'password' => 'Mot de passe',

    'login' => 'Login',
);
?>

<?php
/*
Section: global
Language: French Français
*/

$translations = array(
    'sitetitle1' => 'db4free.net',

    'sitetitle2' => 'Base de données MySQL gratuite',

    'topnav1' => 'Bienvenue',

    'topnav2' => 'Base de données',

    'topnav3' => 'Twitter',

    'topnav4' => 'Blog mpopp.net',

    'topnav5' => 'phpMyAdmin',

    'sidebar_1_2' => 'Dons',

    'sidebar_1_3' => 'Traductions',

    'sidebar_1_4' => 'Changelog',

    'sidebar_1_5' => 'Mentions',

    'sidebar_2_1' => 'A propos de db4free.net',

    'sidebar_2_2' => 'Conditions d\'utilisation',

    'sidebar_2_3' => 'Se connecter',

    'sidebar_2_4' => 'Modifier votre mot de passe',

    'sidebar_2_5' => 'Supprimer votre compte',

    'sidebar_2_6' => 'Mot de passe oublié ?',

    'pmalogin' => 'phpMyAdmin Login',

    'username' => 'Nom d\'utilisateur',

    'password' => 'Mot de passe',

    'login' => 'Login',

    'switch_language' => 'Changez la langue',
);
?>

Add fr translation for "Switch language"


<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Type extends Model
{
    public function categories()
    {
        return $this->hasMany('App\Category');
    }
    public function shop()
    {
        retrun $this->belongTo('App\Shop')
    }
}

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Type extends Model
{
    protected $fillable = [
        'name',

    public function categories()
    {
        return $this->hasMany('App\Category');
    }
    public function shops()
    {
        retrun $this->hasMany('App\Shop')
    }
}

Create relationship for types table

feat(type): Create relationship for types table

Create relationship for types table

see #137


<?php
include __DIR__ . '/../vendor/autoload.php'; // composer autoload

date_default_timezone_set('Europe/Bratislava');

Configure default timezone prior running the tests


{{--
    Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
    See the LICENCE file in the repository root for full licence text.
--}}
{{--
    we're explicitly avoiding NoCaptcha::renderJs here in order to use recaptcha.net instead of google.com (as the latter is blocked in mainland china)
    see: https://developers.google.com/recaptcha/docs/faq#can-i-use-recaptcha-globally
--}}
<script>
    osuCore.turbolinksReload.load('https://www.recaptcha.net/recaptcha/api.js?render=explicit&onload=initCaptcha&hl={{Lang::getLocale()}}');
    function initCaptcha() { captcha.init('{{config('captcha.sitekey')}}', {{captcha_triggered() ? 'true' : 'false'}}); }
</script>

{{--
    Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
    See the LICENCE file in the repository root for full licence text.
--}}
{{--
    we're explicitly avoiding NoCaptcha::renderJs here in order to use recaptcha.net instead of google.com (as the latter is blocked in mainland china)
    see: https://developers.google.com/recaptcha/docs/faq#can-i-use-recaptcha-globally
--}}
<script>
    osuCore.turbolinksReload.load('https://www.recaptcha.net/recaptcha/api.js?render=explicit&onload=initCaptcha&hl={{Lang::getLocale()}}');
    function initCaptcha() { osuCore.captcha.init('{{config('captcha.sitekey')}}', {{captcha_triggered() ? 'true' : 'false'}}); }
</script>

Fix access to captcha instance

Fix access to captcha instance


<?

defined('C5_EXECUTE') or die("Access Denied.");
class ConcreteUpgradeVersion5622Helper {

	public function run() {

		// add user export users task permission
		$pk = PermissionKey::getByHandle('access_user_search_export');
		if (!$pk instanceof PermissionKey) {
			$adminGroupEntity = GroupPermissionAccessEntity::getOrCreate(Group::getByID(ADMIN_GROUP_ID));
			$pk = PermissionKey::add('user', 'access_user_search_export', tc('PermissionKeyName', 'Export Site Users'), tc('PermissionKeyDescription', 'Controls whether a user can export site users or not'), false, false);
			$pa = $pk->getPermissionAccessObject();
			if (!is_object($pa)) {
				$pa = PermissionAccess::create($pk);
			}
			$pa->addListItem($adminGroupEntity);
			$pt = $pk->getPermissionAssignmentObject();
			$pt->assignPermissionAccess($pa);
		}

	}

}

<?

defined('C5_EXECUTE') or die("Access Denied.");
class ConcreteUpgradeVersion5622Helper {

	public function run() {

		// add user export users task permission
		$pk = PermissionKey::getByHandle('access_user_search_export');
		if (!$pk instanceof PermissionKey) {
			$pk = PermissionKey::add('user', 'access_user_search_export', tc('PermissionKeyName', 'Export Site Users'), tc('PermissionKeyDescription', 'Controls whether a user can export site users or not'), false, false);
			$pa = $pk->getPermissionAccessObject();
			if (!is_object($pa)) {
				$pa = PermissionAccess::create($pk);
			}
			$adminGroup = Group::getByID(ADMIN_GROUP_ID);
			//Make sure "Adminstrators" group still exists
			if ($adminGroup) {
				$adminGroupEntity = GroupPermissionAccessEntity::getOrCreate($adminGroup);
				$pa->addListItem($adminGroupEntity);
				$pt = $pk->getPermissionAssignmentObject();
				$pt->assignPermissionAccess($pa);
			}
		}

	}

}

Fix Upgrade Error with no Administrators Group

Fix Upgrade Error with no Administrators Group

Upgrade fails if Administrators group has been deleted.

- Check for Administrato(via ADMIN_GROUP_ID) and if it does not exist do
  not add it to permissions list


<?php
/**
 * User: boshurik
 * Date: 25.04.16
 * Time: 15:45
 */

namespace BoShurik\TelegramBotBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

class CommandCompilerPass implements CompilerPassInterface
{
    /**
     * @inheritDoc
     */
    public function process(ContainerBuilder $container)
    {
        $pool = $container->getDefinition('bo_shurik_telegram_bot.command_pool');

        foreach ($container->findTaggedServiceIds('bo_shurik_telegram_bot.command') as $id => $tags) {
            foreach ($tags as $tag) {
                $pool->addMethodCall('addCommand', array(
                    new Reference($id),
                ));
            }
        }
    }
}

<?php
/**
 * User: boshurik
 * Date: 25.04.16
 * Time: 15:45
 */

namespace BoShurik\TelegramBotBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

class CommandCompilerPass implements CompilerPassInterface
{
    /**
     * @inheritDoc
     */
    public function process(ContainerBuilder $container)
    {
        $pool = $container->getDefinition('bo_shurik_telegram_bot.command_pool');

        $commands = $this->findAndSortTaggedServices('bo_shurik_telegram_bot.command', $container);
        foreach ($commands as $command) {
            $pool->addMethodCall('addCommand', array(
                $command,
            ));
        }
    }

    /**
     * From PriorityTaggedServiceTrait as we support symfony >= 2.7
     *
     * @param string $tagName
     * @param ContainerBuilder $container
     * @return array|mixed
     */
    private function findAndSortTaggedServices($tagName, ContainerBuilder $container)
    {
        $services = array();

        foreach ($container->findTaggedServiceIds($tagName) as $serviceId => $tags) {
            foreach ($tags as $attributes) {
                $priority = isset($attributes['priority']) ? $attributes['priority'] : 0;
                $services[$priority][] = new Reference($serviceId);
            }
        }

        if ($services) {
            krsort($services);
            $services = call_user_func_array('array_merge', $services);
        }

        return $services;
    }
}

Add priority attribute for command tag

Add priority attribute for command tag


<?php

namespace LAG\AdminBundle\Resource\Loader;

use Exception;
use Symfony\Component\Filesystem\Exception\FileNotFoundException;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Yaml\Yaml;

class ResourceLoader
{
    /**
     * Load admins configuration in the yaml files found in the given resource path. An exception will be thrown if the
     * path is invalid.
     *
     * @throws Exception
     */
    public function load(string $resourcesPath): array
    {
        $fileSystem = new Filesystem();

        if (!$fileSystem->exists($resourcesPath)) {
            throw new FileNotFoundException(null, 0, null, $resourcesPath);
        }

        if (!is_dir($resourcesPath)) {
            throw new Exception(sprintf('The resources path %s should be a directory', $resourcesPath));
        }
        $finder = new Finder();
        $finder
            ->files()
            ->name('*.yaml')
            ->in($resourcesPath)
        ;
        $data = [];

        foreach ($finder as $fileInfo) {
            $yaml = Yaml::parse(file_get_contents($fileInfo->getRealPath()));

            if (!is_array($yaml)) {
                continue;
            }

            foreach ($yaml as $name => $admin) {
                $data[$name] = $admin;
            }
        }

        return $data;
    }
}

<?php

namespace LAG\AdminBundle\Resource\Loader;

use Exception;
use Symfony\Component\Filesystem\Exception\FileNotFoundException;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Yaml\Yaml;

class ResourceLoader
{
    /**
     * Load admins configuration in the yaml files found in the given resource path. An exception will be thrown if the
     * path is invalid.
     *
     * @throws Exception
     */
    public function load(string $resourcesPath): array
    {
        $fileSystem = new Filesystem();

        if (!$fileSystem->exists($resourcesPath)) {
            throw new FileNotFoundException(null, 0, null, $resourcesPath);
        }

        if (!is_dir($resourcesPath)) {
            throw new Exception(sprintf('The resources path %s should be a directory', $resourcesPath));
        }
        $finder = new Finder();
        $finder
            ->files()
            ->name('*.yaml')
            ->in($resourcesPath)
        ;
        $data = [];

        foreach ($finder as $fileInfo) {
            $yaml = Yaml::parse(file_get_contents($fileInfo->getRealPath()), Yaml::PARSE_CUSTOM_TAGS);

            if (!is_array($yaml)) {
                continue;
            }

            foreach ($yaml as $name => $admin) {
                $data[$name] = $admin;
            }
        }

        return $data;
    }
}

Add a flag on the yaml resources loader to parse custom tags


<?php
/**
 * @file
 */

namespace CultuurNet\UDB3\UsedKeywordsMemory;

use CultuurNet\UDB3\Keyword;

class KeywordUsed extends Event
{

    /**
     * @var Keyword
     */
    protected $keyword;

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

    /**
     * @return Keyword
     */
    public function getKeyword()
    {
        return $this->keyword;
    }

    /**
     * @param string $userId
     * @param Keyword $keyword
     */
    public function __construct($userId, Keyword $keyword)
    {
        $this->userId = $userId;
        $this->keyword = $keyword;
    }

    public static function deserialize(array $data)
    {
        return new static($data['user_id'], unserialize($data['keyword']));
    }

    public function serialize()
    {
        return parent::serialize() + array(
            'keyword' => serialize($this->keyword),
        );
    }
}

<?php
/**
 * @file
 */

namespace CultuurNet\UDB3\UsedKeywordsMemory;

use CultuurNet\UDB3\Keyword;

class KeywordUsed extends Event
{

    /**
     * @var Keyword
     */
    protected $keyword;

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

    /**
     * @return Keyword
     */
    public function getKeyword()
    {
        return $this->keyword;
    }

    /**
     * @param string $userId
     * @param Keyword $keyword
     */
    public function __construct($userId, Keyword $keyword)
    {
        $this->userId = $userId;
        $this->keyword = $keyword;
    }

    public static function deserialize(array $data)
    {
        $keyword = @unserialize($data['keyword']);
        // @todo Remove this temporary BC layer.
        // compatibility layer start
        if (false === $keyword) {
            $keyword = new Keyword($data['keyword']);
        }
        // compatibility layer end
        return new static($data['user_id'], $keyword);
    }

    public function serialize()
    {
        return parent::serialize() + array(
            'keyword' => serialize($this->keyword),
        );
    }
}

iii-66: Add temporary compatibility layer for older events where keyword is not an object yet


<?php
    $form = new Form( 'testrun', 'create' );
    $form->output( function( $self ) {
        $self->createLabel( 'name', 'Which test do you want to run?' );
        $self->createInput( 'text', 'name', 'name' );
        $self->createInput( 'submit', '', '', 'Test' );
    } );
?>

<?php
    include 'views/header.php';
    $form = new Form( 'testrun', 'create' );
    $form->output( function( $self ) {
        $self->createLabel( 'name', 'Which test do you want to run?' );
        $self->createInput( 'text', 'name', 'name' );
        $self->createInput( 'submit', '', '', 'Test' );
    } );
    include 'views/footer.php';
?>

Include header and footer on testrun view


<?php

$config = json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'local.json'), true);

return [
    'driver' => 'smtp',
    'host' => 'smtp.sendgrid.net',
    'port' => 587,
    'from' => ['name' => null, 'address' => null],
    'username' => $config['sendgrid']['username'],
    'password' => $config['sesdgrid']['password'],
    'pretend' => false
];

<?php

$config = json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'local.json'), true);

return [
    'driver' => 'smtp',
    'host' => 'smtp.sendgrid.net',
    'port' => 587,
    'from' => ['name' => null, 'address' => null],
    'username' => $config['sendgrid']['username'],
    'password' => $config['sendgrid']['password'],
    'pretend' => false
];

Fix 'sesdgrid' typo in config

Fix 'sesdgrid' typo in config


<?php

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

namespace App\Http\Controllers\InterOp;

use App\Http\Controllers\Controller;
use Artisan;

class ArtistTracksController extends Controller
{
    public function reindexAll()
    {
        Artisan::call('es:index-documents', [
            '--inplace' => get_bool(request('inplace')) ?? true,
            '--types' => 'artist_tracks',
            '--yes' => true,
        ]);

        return response()->noContent();
    }
}

<?php

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

namespace App\Http\Controllers\InterOp;

use App\Http\Controllers\Controller;
use Artisan;

class ArtistTracksController extends Controller
{
    public function reindexAll()
    {
        Artisan::call('es:index-documents', [
            '--cleanup' => get_bool(request('cleanup')) ?? true,
            '--inplace' => get_bool(request('inplace')) ?? true,
            '--types' => 'artist_tracks',
            '--yes' => true,
        ]);

        return response()->noContent();
    }
}

Remove old index by default (for non-inplace reindex)


<?php namespace k98kurz\Pdf;

use Illuminate\Support\ServiceProvider;

class PdfServiceProvider extends ServiceProvider {

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

	/**
	 * Register the service provider.
	 *
	 * @return void
	 */
	public function register()
	{
		$this->app['pdf'] = $this->app->share(function($app)
		{
			return new Pdf;
		});
	}

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

}

<?php namespace k98kurz\Pdf;

use Illuminate\Support\ServiceProvider;

class PdfServiceProvider extends ServiceProvider {

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

	/**
	 * Register the service provider.
	 *
	 * @return void
	 */
	public function register()
	{
		$this->app->singleton('pdf', function($app)
		{
			return new Pdf;
		});
	}

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

}

Update for Lumen >= 5.4.*

Update for Lumen >= 5.4.*

Hi there,
app->share() method is deprecated in Lumen >= 5.4.*, can you tag a new version with the app->singleton() method to make it compatible with new versions of Lumen ?

thanks!


<?php

namespace SlmQueue\Queue;

use SlmQueue\Job\JobPluginManager;

/**
 * AbstractQueue
 */
abstract class AbstractQueue implements QueueInterface
{
    /**
     * @var JobPluginManager
     */
    protected $jobPluginManager;

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

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

    /**
     * {@inheritDoc}
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * {@inheritDoc}
     */
    public function getJobPluginManager()
    {
        return $this->jobPluginManager;
    }

    /**
     * Create a job from the serialized data extracted from the queue. The metadata (id...) is then injected to the
     * job. Note that this follow the way a \SlmQueue\Job\AbstractJob is serialized. If you do fancy stuff, you may
     * need to override the queue too so that the job is created the right way
     *
     * @param  string $jsonData
     * @param  array  $metadata
     * @return \SlmQueue\Job\JobInterface
     */
    protected function createJob($jsonData, array $metadata = array())
    {
        $data = json_decode($jsonData, true);

        /** @var $job \SlmQueue\Job\JobInterface */
        $job = $this->jobPluginManager->create($data['class']);
        $job->setMetadata($metadata)
            ->setContent($data['content']);

        return $job;
    }
}

<?php

namespace SlmQueue\Queue;

use SlmQueue\Job\JobPluginManager;

/**
 * AbstractQueue
 */
abstract class AbstractQueue implements QueueInterface
{
    /**
     * @var JobPluginManager
     */
    protected $jobPluginManager;

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

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

    /**
     * {@inheritDoc}
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * {@inheritDoc}
     */
    public function getJobPluginManager()
    {
        return $this->jobPluginManager;
    }

    /**
     * Create a job from the serialized data extracted from the queue. The metadata (id...) is then injected to the
     * job. Note that this follow the way a \SlmQueue\Job\AbstractJob is serialized. If you do fancy stuff, you may
     * need to override the queue too so that the job is created the right way
     *
     * @param  string $jsonData
     * @param  array  $metadata
     * @return \SlmQueue\Job\JobInterface
     */
    protected function createJob($jsonData, array $metadata = array())
    {
        $data = json_decode($jsonData, true);

        /** @var $job \SlmQueue\Job\JobInterface */
        $job = $this->jobPluginManager->get($data['class']);
        $job->setMetadata($metadata)
            ->setContent($data['content']);

        return $job;
    }
}

Modify to get to allow autoinvokables

Modify to get to allow autoinvokables


<?php

namespace Platformsh\Cli\Command;

trait HasExamplesTrait
{
    /** @var array */
    protected $examples;

    /**
     * @param string $description
     * @param string $arguments
     *
     * @return self
     */
    protected function addExample($description, $arguments = '')
    {
        $this->examples[$arguments] = $description;

        return $this;
    }
}

<?php

namespace Platformsh\Cli\Command;

trait HasExamplesTrait
{
    /** @var array */
    protected $examples = array();

    /**
     * @param string $description
     * @param string $arguments
     *
     * @return self
     */
    protected function addExample($description, $arguments = '')
    {
        $this->examples[$arguments] = $description;

        return $this;
    }
}

Fix invalid argument supplied for foreach()


<?php
namespace FormKit\Widget;

class TextInput extends BaseWidget
{
    public $class = array('formkit-widget','formkit-text');
    public $type = 'text';

    public function render()
    {
        return '<input'
            . $this->_renderAttributes(array(
                'class','id','type',
                'name','value','size','maxlength','minlength'))
                . '/>'
                . $this->renderHint();
    }
}

<?php
namespace FormKit\Widget;

class TextInput extends BaseWidget
{
    public $class = array('formkit-widget','formkit-text');
    public $type = 'text';

    public function render()
    {
        return '<input'
            . $this->_renderAttributes(array(
                'class','id','type',
                'name','value','size','maxlength',
                'minlength','align','src','alt','accept',
                'readonly','style'))
                . '/>'
                . $this->renderHint();
    }
}

Add more attributes for text input

Add more attributes for text input


<?php
use Chalk\App as Chalk;
if (!isset($filters)) {
	$filters = [
		Chalk::info($md['entity'])->name => true,
	];
}
?>
<div class="input-content" data-params="<?= $this->escape(http_build_query(['filters' => $filters])) ?>">

		Remove
		Browse

		<?php if (isset($value)) { ?>
			<?php
			$content = $this->em('Chalk\Core\Content')->id($value);
			?>
			<?php if ($content) { ?>
				<?= $this->inner('/content/card', [
					'content' => $content
				]) ?>
			<?php } else { ?>
				Nothing Selected
			<?php } ?>
		<?php } else { ?>
			Nothing Selected
		<?php } ?>

	<?= $this->inner('input', [
		'type'		=> 'hidden',
		'value'		=> $value,
	]) ?>

<?php
use Chalk\App as Chalk;
if (!isset($filters)) {
	$filters = [
		Chalk::info($md['entity'])->name => true,
	];
}
$value = isset($value)
	? $value
	: null;
?>
<div class="input-content" data-params="<?= $this->escape(http_build_query(['filters' => $filters])) ?>">

		Remove
		Browse

		<?php
		$content = isset($value)
			? $this->em('Chalk\Core\Content')->id($value)
			: null;
		?>
		<?php if ($content) { ?>
			<?= $this->inner('/content/card', [
				'content' => $content
			]) ?>
		<?php } else { ?>
			Nothing Selected
		<?php } ?>

	<?= $this->inner('input', [
		'type'		=> 'hidden',
		'value'		=> $value,
	]) ?>

Fix input content value variable.

Fix input content value variable.


<?php
/*
 * WellCommerce Open-Source E-Commerce Platform
 *
 * This file is part of the WellCommerce package.
 *
 * (c) Adam Piotrowski <adam@wellcommerce.org>
 *
 * For the full copyright and license information,
 * please view the LICENSE file that was distributed with this source code.
 */

namespace WellCommerce\Bundle\PageBundle\Entity;

use WellCommerce\Bundle\RoutingBundle\Entity\Route;
use WellCommerce\Bundle\RoutingBundle\Entity\RouteInterface;

/**
 * Class PageRoute
 *
 * @author  Adam Piotrowski <adam@wellcommerce.org>
 */
class PageRoute extends Route implements RouteInterface
{
    /**
     * @var PageInterface
     */
    protected $identifier;

    public function getType()
    {
        return 'page';
    }
}

<?php
/*
 * WellCommerce Open-Source E-Commerce Platform
 *
 * This file is part of the WellCommerce package.
 *
 * (c) Adam Piotrowski <adam@wellcommerce.org>
 *
 * For the full copyright and license information,
 * please view the LICENSE file that was distributed with this source code.
 */

namespace WellCommerce\Bundle\PageBundle\Entity;

use WellCommerce\Bundle\RoutingBundle\Entity\Route;
use WellCommerce\Bundle\RoutingBundle\Entity\RouteInterface;

/**
 * Class PageRoute
 *
 * @author  Adam Piotrowski <adam@wellcommerce.org>
 */
class PageRoute extends Route implements RouteInterface
{
    /**
     * @var PageInterface
     */
    protected $identifier;

    public function getType() : string
    {
        return 'page';
    }
}

Return types in routing and news bundle

Return types in routing and news bundle


<?php

namespace Avalanche\Bundle\ImagineBundle\Imagine;

use Avalanche\Bundle\ImagineBundle\Imagine\Filter\FilterManager;

class CacheReloader
{
    private $sourceRoot;
    private $cacheManager;
    private $filterManager;

    public function __construct($sourceRoot, CacheManager $cacheManager, FilterManager $filterManager)
    {
        $this->sourceRoot    = $sourceRoot;
        $this->cacheManager  = $cacheManager;
        $this->filterManager = $filterManager;
    }

    public function reloadFor($file, $force = false)
    {
        $paths = [];

        foreach ($this->filterManager->getFilterNames() as $filter) {
            $prefix = $this->filterManager->getOption($filter, 'source_root', $this->sourceRoot);
            stream_is_local($prefix) && ($prefix = realpath($prefix));
            stream_is_local($file) && ($file = realpath($file));

            if (0 !== strpos($file, $prefix)) {
                continue;
            }

            $paths[$filter] = $this->cacheManager->cacheImage('', substr($file, strlen($prefix)), $filter, $force);
        }

        return $paths;
    }
}

<?php

namespace Avalanche\Bundle\ImagineBundle\Imagine;

use Avalanche\Bundle\ImagineBundle\Imagine\Filter\FilterManager;

class CacheReloader
{
    private $sourceRoot;
    private $cacheManager;
    private $filterManager;

    public function __construct($sourceRoot, CacheManager $cacheManager, FilterManager $filterManager)
    {
        $this->sourceRoot    = $sourceRoot;
        $this->cacheManager  = $cacheManager;
        $this->filterManager = $filterManager;
    }

    public function reloadFor($file, $force = false)
    {
        $paths = [];

        stream_is_local($file) && ($file = realpath($file));

        foreach ($this->filterManager->getFilterNames() as $filter) {
            $prefix = $this->filterManager->getOption($filter, 'source_root', $this->sourceRoot);
            stream_is_local($prefix) && ($prefix = realpath($prefix));

            if (0 !== strpos($file, $prefix)) {
                continue;
            }

            $paths[$filter] = $this->cacheManager->cacheImage('', substr($file, strlen($prefix)), $filter, $force);
        }

        return $paths;
    }
}

Move stream check outside the loop

Move stream check outside the loop


<?php

defined('C5_EXECUTE') or die("Access Denied.");

/**
 * @var $grade \Concrete\Core\Health\Grade\PassFailGrade
 */

if ($grade->hasPassed()) {
    $textClass = 'text-success';
    $title = t('PASS');
    $icon = 'fa fa-thumbs-up';
} else {
    $textClass = 'text-danger';
    $title = t('FAIL');
    $icon = 'fa fa-exclamation-triangle';
}
?>

    <h1 class="display-1 <?=$textClass?>"><i class="<?=$icon?>">

    <h5 class="display-5 <?=$textClass?>"><?=$title?>

<?php

defined('C5_EXECUTE') or die("Access Denied.");

/**
 * @var $grade \Concrete\Core\Health\Grade\PassFailGrade
 */

if ($grade->hasPassed()) {
    $textClass = 'text-success';
    $title = tc('CheckResult', 'PASS');
    $icon = 'fa fa-thumbs-up';
} else {
    $textClass = 'text-danger';
    $title = tc('CheckResult', 'FAIL');
    $icon = 'fa fa-exclamation-triangle';
}
?>

    <h1 class="display-1 <?=$textClass?>"><i class="<?=$icon?>">

    <h5 class="display-5 <?=$textClass?>"><?=$title?>

Add translation context to PASS/FAIL

Add translation context to PASS/FAIL

Translating PASS alone is impossible, since it has many different meanings depending on the context.


<?php
namespace trejeraos;

use \DOMDocument;
use \DOMXpath;
use Symfony\Component\CssSelector\CssSelectorConverter;

/**
 * DOMSelector makes selecting XML elements easy by using CSS like selectors
 *
 * @author   Jeremie Jarosh <jeremie@jarosh.org>
 * @version  0.3.0
 */
class DOMSelector extends DOMXpath
{

    /**
     * @var \Symfony\Component\CssSelector\CssSelectorConverter
     */
    protected $converter;

    public function __construct(DOMDocument $doc)
    {
        parent::__construct($doc);

        $this->converter = new CssSelectorConverter(false);
    }

    /**
     * Returns a list of the elements within the document that match the specified group of selectors.
     *
     * @param string  $filename  CSS Selector
     *
     * @return DOMNodeList
     */
    public function querySelectorAll($cssSelectors)
    {
        $xpathQuery = $this->converter->toXPath($cssSelectors);
        return $this->query($xpathQuery);
    }

    /**
     * Returns the first element within the document that matches the specified group of selectors.
     *
     * @param string  $filename  CSS Selector
     *
     * @return DOMNode
     */
    public function querySelector($cssSelectors)
    {
        return $this->querySelectorAll($cssSelectors)->item(0);
    }
}

<?php
namespace trejeraos;

use \DOMDocument;
use \DOMXpath;
use Symfony\Component\CssSelector\CssSelectorConverter;

/**
 * DOMSelector makes selecting XML elements easy by using CSS like selectors
 *
 * @author   Jeremie Jarosh <jeremie@jarosh.org>
 * @version  0.3.0
 */
class DOMSelector extends DOMXpath
{

    /**
     * @var \Symfony\Component\CssSelector\CssSelectorConverter
     */
    protected $converter;

    /**
     * Creates a new DOMSelector object
     *
     * @param DOMDocument $doc   The DOMDocument associated with the DOMSelector.
     * @param bool        $html  Whether HTML support should be enabled. Disable it for XML documents.
     */
    public function __construct(DOMDocument $doc, $html = true)
    {
        parent::__construct($doc);

        $this->converter = new CssSelectorConverter($html);
    }

    /**
     * Returns a list of the elements within the document that match the specified group of selectors.
     *
     * @param string  $filename  CSS Selector
     *
     * @return DOMNodeList
     */
    public function querySelectorAll($cssSelectors)
    {
        $xpathQuery = $this->converter->toXPath($cssSelectors);
        return $this->query($xpathQuery);
    }

    /**
     * Returns the first element within the document that matches the specified group of selectors.
     *
     * @param string  $filename  CSS Selector
     *
     * @return DOMNode
     */
    public function querySelector($cssSelectors)
    {
        return $this->querySelectorAll($cssSelectors)->item(0);
    }
}

Support Both XML and HTML Documents (HTML is Default)


<?php

class Lang_test extends CI_TestCase {

	protected $lang;

	public function set_up()
	{
		$loader_cls = $this->ci_core_class('load');
		$this->ci_instance_var('load', new $loader_cls);

		$cls = $this->ci_core_class('lang');
		$this->lang = new $cls;
	}

	// --------------------------------------------------------------------

	public function test_load()
	{
		$this->assertTrue($this->lang->load('profiler', 'english'));
	}

	// --------------------------------------------------------------------

	public function test_line()
	{
		$this->assertTrue($this->lang->load('profiler', 'english'));
		$this->assertEquals('URI STRING', $this->lang->line('profiler_uri_string'));
	}

}

<?php

class Lang_test extends CI_TestCase {

	protected $lang;

	public function set_up()
	{
		$loader_cls = $this->ci_core_class('load');
		$this->ci_instance_var('load', new $loader_cls);

		$cls = $this->ci_core_class('lang');
		$this->lang = new $cls;
	}

	// --------------------------------------------------------------------

	public function test_load()
	{
		$this->assertTrue($this->lang->load('profiler', 'english'));
		$this->_test_line();
	}

	// --------------------------------------------------------------------

	public function test_load_with_unspecified_language()
	{
		$this->assertTrue($this->lang->load('profiler'));
		$this->_test_line();
	}

	// --------------------------------------------------------------------

	private function _test_line()
	{
		$this->assertEquals('URI STRING', $this->lang->line('profiler_uri_string'));
	}

}

Add test when loading language file and not using the second parameter (language)


<?php
/**
 * @author      Guidance Magento Team <magento@guidance.com>
 * @category    Guidance
 * @package     Simplepage
 * @copyright   Copyright (c) 2015 Guidance Solutions (http://www.guidance.com)
 */

/**
 * Class Guidance_Simplepage_Block_ContentType
 *
 * @method float getContentType()
 * @method Guidance_Simplepage_Block_ContentType setContentType(string $value)
 */
class Guidance_Simplepage_Block_ContentType extends Mage_Core_Block_Abstract
{
    protected function _beforeToHtml()
    {
        $contentType = $this->getContentType();
        if (!is_null($this->getContentType())) {
            $this->getAction()->getResponse()->setHeader('Content-type', $contentType, true);
        }
        return $this;
    }
}

<?php
/**
 * @author      Guidance Magento Team <magento@guidance.com>
 * @category    Guidance
 * @package     Simplepage
 * @copyright   Copyright (c) 2015 Guidance Solutions (http://www.guidance.com)
 */

/**
 * Class Guidance_Simplepage_Block_ContentType
 *
 * @method string getContentType()
 * @method Guidance_Simplepage_Block_ContentType setContentType(string $value)
 */
class Guidance_Simplepage_Block_ContentType extends Mage_Core_Block_Abstract
{
    protected function _beforeToHtml()
    {
        $contentType = $this->getContentType();
        if (!is_null($this->getContentType())) {
            $this->getAction()->getResponse()->setHeader('Content-type', $contentType, true);
        }
        return $this;
    }
}

Revise return hint of method signature

Revise return hint of method signature


<?php

namespace FluxBB;

use Illuminate\Support\Facades\Facade;

class Core extends Facade
{
    protected static function getFacadeAccessor()
    {
        return static::$app;
    }

    public static function isInstalled()
    {
        return static::$app['config']->hasGroup('fluxbb');
    }

    public static function version()
    {
        return '2.0.0-alpha1';
    }
}

<?php

namespace FluxBB;

use Illuminate\Support\Facades\Facade;

class Core extends Facade
{
    protected static function getFacadeAccessor()
    {
        return static::$app;
    }

    public static function isInstalled()
    {
        return static::$app->make('config')->hasGroup('fluxbb');
    }

    public static function version()
    {
        return '2.0.0-alpha1';
    }
}

Use interface for accessing container.

Use interface for accessing container.


<?php

namespace SimplePHPEasyPlus\Number;

use SimplePHPEasyPlus\Collection\CollectionInterface;

/**
 * Represents a number collection
 */
class NumberCollection implements CollectionInterface
{
    /**
     * @var ArrayObject  An array of NumberValue items
     */
    protected $numbers;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->numbers = new \ArrayObject();
    }

    /**
     * Adds a number to the collection
     *
     * @param  Number $number
     */
    public function add(Number $number)
    {
        $this->numbers->append($number);
    }

}

<?php

namespace SimplePHPEasyPlus\Number;

use SimplePHPEasyPlus\Collection\CollectionInterface;
use SimplePHPEasyPlus\Collection\CollectionItemInterface;

/**
 * Represents a number collection
 */
class NumberCollection implements CollectionInterface
{
    /**
     * @var ArrayObject  An array of NumberValue items
     */
    protected $numbers;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->numbers = new \ArrayObject();
    }

    /**
     * Adds a number to the collection
     *
     * @param  CollectionItemInterface $number
     */
    public function add(CollectionItemInterface $number)
    {
        $this->numbers->append($number);
    }

}

Fix typo in number collection

Fix typo in number collection


<?php
namespace Swis\LaravelFulltext;

class TermBuilder {

    public static function terms($search){
        $wildcards = config('laravel-fulltext.enable_wildcards');

        // Remove every boolean operator (+, -, > <, ( ), ~, *, ", @distance) from the search query
        // else we will break the MySQL query.
        $search = preg_replace('/[+\-><\(\)~*\"@]+/', ' ', $search);

        $terms = collect(preg_split('/[\s,]+/', $search));

        if($wildcards === true){
            $terms->transform(function($term){
                return $term. '*';
            });
        }

        return $terms;
    }

}

<?php
namespace Swis\LaravelFulltext;

class TermBuilder {

    public static function terms($search){
        $wildcards = config('laravel-fulltext.enable_wildcards');

        // Remove every boolean operator (+, -, > <, ( ), ~, *, ", @distance) from the search query
        // else we will break the MySQL query.
        $search = preg_replace('/[+\-><\(\)~*\"@]+/', '', $search);

        $terms = collect(preg_split('/[\s,]+/', $search));

        if($wildcards === true){
            $terms->transform(function($term){
                return $term. '*';
            });
        }

        return $terms;
    }

}

Remove space character from the replace function


<?php namespace Gitlab\Model;

use Gitlab\Client;

/**
 * Class Note
 *
 * @property-read User $author
 * @property-read string $body
 * @property-read string $created_at
 * @property-read string $updated_at
 * @property-read string $parent_type
 * @property-read Issue|MergeRequest $parent
 * @property-read string $attachment
 */
class Note extends AbstractModel
{
    /**
     * @var array
     */
    protected static $properties = array(
        'author',
        'body',
        'created_at',
        'updated_at',
        'parent_type',
        'parent',
        'attachment'
    );

    /**
     * @param Client $client
     * @param Noteable $type
     * @param array $data
     * @return mixed
     */
    public static function fromArray(Client $client, Noteable $type, array $data)
    {
        $comment = new static($type, $client);

        if (isset($data['author'])) {
            $data['author'] = User::fromArray($client, $data['author']);
        }

        return $comment->hydrate($data);
    }

    /**
     * @param Noteable $type
     * @param Client $client
     */
    public function __construct(Noteable $type, Client $client = null)
    {
        $this->setClient($client);
        $this->setData('parent_type', get_class($type));
        $this->setData('parent', $type);
    }
}

<?php namespace Gitlab\Model;

use Gitlab\Client;

/**
 * Class Note
 *
 * @property-read User $author
 * @property-read string $body
 * @property-read string $created_at
 * @property-read string $updated_at
 * @property-read string $parent_type
 * @property-read Issue|MergeRequest $parent
 * @property-read string $attachment
 */
class Note extends AbstractModel
{
    /**
     * @var array
     */
    protected static $properties = array(
        'id',
        'author',
        'body',
        'created_at',
        'updated_at',
        'parent_type',
        'parent',
        'attachment'
    );

    /**
     * @param Client $client
     * @param Noteable $type
     * @param array $data
     * @return mixed
     */
    public static function fromArray(Client $client, Noteable $type, array $data)
    {
        $comment = new static($type, $client);

        if (isset($data['author'])) {
            $data['author'] = User::fromArray($client, $data['author']);
        }

        return $comment->hydrate($data);
    }

    /**
     * @param Noteable $type
     * @param Client $client
     */
    public function __construct(Noteable $type, Client $client = null)
    {
        $this->setClient($client);
        $this->setData('parent_type', get_class($type));
        $this->setData('parent', $type);
    }
}

Allow to access id through

Allow to access  id through


<?php

/*
 * This file is part of the PostmanGeneratorBundle package.
 *
 * (c) Vincent Chalamon <vincentchalamon@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace PostmanGeneratorBundle\DependencyInjection\CompilerPass;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

class RequestParserCompilerPass implements CompilerPassInterface
{
    /**
     * {@inheritdoc}
     */
    public function process(ContainerBuilder $container)
    {
        $registryDefinition = $container->getDefinition('postman.request_parser.chain');

        $requestParsers = [];
        foreach ($container->findTaggedServiceIds('postman.request_parser') as $serviceId => $tags) {
            $attributes = $container->getDefinition($serviceId)->getTag('postman.request_parser');
            $priority = isset($attributes['priority']) ? $attributes['priority'] : 0;
            $requestParsers[$priority][] = new Reference($serviceId);
        }
        krsort($requestParsers);

        $registryDefinition->replaceArgument(0, call_user_func_array('array_merge', $requestParsers));
    }
}

<?php

/*
 * This file is part of the PostmanGeneratorBundle package.
 *
 * (c) Vincent Chalamon <vincentchalamon@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace PostmanGeneratorBundle\DependencyInjection\CompilerPass;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

class RequestParserCompilerPass implements CompilerPassInterface
{
    /**
     * {@inheritdoc}
     */
    public function process(ContainerBuilder $container)
    {
        $registryDefinition = $container->getDefinition('postman.request_parser.chain');

        $requestParsers = [];
        foreach ($container->findTaggedServiceIds('postman.request_parser') as $serviceId => $tags) {
            $attributes = $container->getDefinition($serviceId)->getTag('postman.request_parser');
            $priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
            $requestParsers[$priority][] = new Reference($serviceId);
        }
        krsort($requestParsers);

        $registryDefinition->replaceArgument(0, call_user_func_array('array_merge', $requestParsers));
    }
}

Fix request_parser services priority compiler pass


<?php
/**
 * Proxy das standard-mäßig ein Db-Model mit tabellennamen _table
 * erstellt.
 *
 * @package Model
 */
class Kwf_Model_Db_Proxy extends Kwf_Model_Proxy
{
    protected $_table;
    public function __construct(array $config = array())
    {
        if (!isset($config['proxyModel'])) {
            if (isset($config['table'])) {
                $table = $config['table'];
            } else {
                $table = $this->_table;
            }
            if (!$table) {
                throw new Kwf_Exception('You must specify a table (protected _table or config table) or a proxyModel');
            }
            $config['proxyModel'] = new Kwf_Model_Db(
                array(
                    'table' => $table,
                )
            );
        }
        parent::__construct($config);
    }

    public function getAdapter()
    {
        return $this->getProxyModel()->getAdapter();
    }
}

<?php
/**
 * Proxy das standard-mäßig ein Db-Model mit tabellennamen _table
 * erstellt.
 *
 * @package Model
 */
class Kwf_Model_Db_Proxy extends Kwf_Model_Proxy
{
    protected $_table;
    public function __construct(array $config = array())
    {
        if (!isset($config['proxyModel'])) {
            if (isset($config['table'])) {
                $table = $config['table'];
            } else {
                $table = $this->_table;
            }
            if (!$table) {
                throw new Kwf_Exception('You must specify a table (protected _table or config table) or a proxyModel');
            }
            $config['proxyModel'] = new Kwf_Model_Db(
                array(
                    'table' => $table,
                    'hasDeletedFlag' => $this->_hasDeletedFlag
                )
            );
        }
        parent::__construct($config);
    }

    public function getAdapter()
    {
        return $this->getProxyModel()->getAdapter();
    }
}

Use deletedFlag also for proxied model

Use deletedFlag also for proxied model