<?php
/**
 * EnablementDateException.php
 *
 * @copyright 2014 George D. Cooksey, III
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
 */

namespace Veritas\Identity\Exception;

use DomainException;

/**
 * Builds custom domain exceptions for invalid ranges and missing dates
 *
 * @author George D. Cooksey, III
 */
class EnablementDateException extends DomainException
{
    /**
     * Build an invalid range exception
     *
     * @param  string $position preceed, follow, or equal
     * @return self
     */
    public static function invalidRange($position = 'preceed')
    {
        return new static("The start date must $position the end date");
    }

    /**
     * Build a missing date exception
     *
     * @param  string $type the date type
     * @return self
     */
    public static function missingDate($type)
    {
        return new static("The $type date must be provided");
    }
}

<?php
/**
 * EnablementDateException.php
 *
 * @copyright 2014 George D. Cooksey, III
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
 */

namespace Veritas\Identity\Exception;

use DomainException;

/**
 * Builds custom domain exceptions for invalid ranges and missing dates
 *
 * @author George D. Cooksey, III
 */
final class EnablementDateException extends DomainException
{
    /**#@+
     * @var string
     */
    const POSITION_EQUAL   = 'equal';
    const POSITION_FOLLOW  = 'follow';
    const POSITION_PRECEED = 'preceed';

    const TYPE_END         = 'end';
    const TYPE_START       = 'start';
    /**#@- */

    /**
     * @var string[]
     */
    private static $validPositions = [
        self::POSITION_EQUAL,
        self::POSITION_FOLLOW,
        self::POSITION_PRECEED,
    ];

    /**
     * @var string[]
     */
    private static $validTypes = [
        self::TYPE_END,
        self::TYPE_START,
    ];

    /**
     * Build an invalid range exception
     *
     * @param  string $position preceed, follow, or equal
     * @return self
     */
    public static function invalidRange($position = self::POSITION_PRECEED)
    {
        if (in_array($position, static::$validPositions)) {
            return new static("The start date must $position the end date");
        }
        return new static("Invalid start or end date(s)");
    }

    /**
     * Build a missing date exception
     *
     * @param  string $type the date type
     * @return self
     */
    public static function missingDate($type = self::TYPE_START)
    {
        if (in_array($type, static::$validTypes)) {
            return new static("The $type date must be provided");
        }
        return new static("Both start and end dates must be provided");
    }
}

Add position and type constants

Add position and type constants


<?php

namespace Defuse\Crypto;

final class DerivedKeys
{
    private $akey = null;
    private $ekey = null;

    /**
     * Returns the authentication key.
     */
    public function getAuthenticationKey()
    {
        return $this->akey;
    }

    /**
     * Returns the encryption key.
     */
    public function getEncryptionKey()
    {
        return $this->ekey;
    }

    /**
     * Constructor for DerivedKeys.
     */
    public function __construct($akey, $ekey)
    {
        $this->akey = $akey;
        $this->ekey = $ekey;
    }
}

<?php

namespace Defuse\Crypto;

final class DerivedKeys
{
    private $akey = null;
    private $ekey = null;

    /**
     * Returns the authentication key.
     */
    public function getAuthenticationKey()
    {
        return $this->akey;
    }

    /**
     * Returns the encryption key.
     */
    public function getEncryptionKey()
    {
        return $this->ekey;
    }

    /**
     * Constructor for DerivedKeys.
     *
     * @param string $akey
     * @param string $ekey
     */
    public function __construct($akey, $ekey)
    {
        $this->akey = $akey;
        $this->ekey = $ekey;
    }
}

Document the type of and

Document the type of  and


<?php

namespace {{ ns }};

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class {{ class }} extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {

    }

    public function configureOptions(OptionsResolver $resolver)
    {

    }

    public function getName()
    {
        return '{{ name }}';
    }
}

<?php

namespace {{ ns }};

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class {{ class }} extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {

    }

    public function configureOptions(OptionsResolver $resolver)
    {

    }

    public function getBlockPrefix()
    {
        return '{{ name }}';
    }
}

Use getBlockPrefix instaad of override deprecated getName


<?php defined('C5_EXECUTE') or die('Access denied.'); ?>

    <?=$form->label('apikey', t('Api Key'))?>

        <?=$form->text('apikey',$apikey)?>

    <?=$form->label('apisecret', t('Api Secret'))?>

        <?=$form->text('apisecret', $apisecret)?>

<?php defined('C5_EXECUTE') or die('Access denied.'); ?>

    <?=$form->label('apikey', t('Api Key'))?>

        <?=$form->text('apikey', $apikey)?>

    <?=$form->label('apisecret', t('Api Secret'))?>

        <?=$form->text('apisecret', $apisecret)?>

<?php echo t('Click here to obtain your access keys.', 'https://developers.facebook.com/apps/'); ?>

Add link to facebook apps page

Add link to facebook apps page


    DoSomething.org

        @if (Auth::user())

                        Campaign Overview

                        User Search

                        FAQ

                    Log Out

        @endif

    DoSomething.org

        @if (Auth::user())

                        Campaign Overview

                        User Search

                        Import CSV

                        FAQ

                    Log Out

        @endif

Add import option to nav

Add import option to nav


<?php
/**
 * An event location is an address where an event can be held, and also pulls
 * in capacity information to a calendar date time object.
 *
 * @package silverstripe-eventlocations
 */
class EventLocation extends DataObject {

	public static $db = array(
		'Title'    => 'Varchar(255)',
		'Capacity' => 'Int'
	);

	public static $extensions = array(
		'Addressable'
	);

	public static $summary_fields = array(
		'Title'       => 'Title',
		'Capacity'    => 'Capacity',
		'FullAddress' => 'Address'
	);

	public static $searchable_fields = array(
		'Title'
	);

}

<?php
/**
 * An event location is an address where an event can be held, and also pulls
 * in capacity information to a calendar date time object.
 *
 * @package silverstripe-eventlocations
 */
class EventLocation extends DataObject {

	public static $db = array(
		'Title'    => 'Varchar(255)',
		'Capacity' => 'Int'
	);

	public static $extensions = array(
		'Addressable'
	);

	public static $summary_fields = array(
		'Title'       => 'Title',
		'Capacity'    => 'Capacity',
		'FullAddress' => 'Address'
	);

	public static $searchable_fields = array(
		'Title'
	);

	/**
	 * @param Member $member
	 * @return boolean
	 */
	public function canView($member = null) {
		return Permission::check('CMS_ACCESS_EventLocationAdmin', 'any', $member);
	}

	/**
	 * @param Member $member
	 * @return boolean
	 */
	public function canEdit($member = null) {
		return Permission::check('CMS_ACCESS_EventLocationAdmin', 'any', $member);
	}

	/**
	 * @param Member $member
	 * @return boolean
	 */
	public function canDelete($member = null) {
		return Permission::check('CMS_ACCESS_EventLocationAdmin', 'any', $member);
	}

	/**
	 * @todo Should canCreate be a static method?
	 *
	 * @param Member $member
	 * @return boolean
	 */
	public function canCreate($member = null) {
		return Permission::check('CMS_ACCESS_EventLocationAdmin', 'any', $member);
	}
}

BUGFIX: Use a permission check on cms access to determine if people can work with event locations


<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    protected function schedule(Schedule $schedule)
    {
        // TODO: Re-add a cleanup command for outdated spec builds
        //$schedule->command(DeleteSpecificationBuildsCommand::class, ['build', 30])->daily();
    }

    protected function commands()
    {
        parent::commands();
        $this->load(__DIR__.'/Commands');
    }
}

<?php

namespace App\Console;

use App\Jobs\ResourcesUpdateJob;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    protected function schedule(Schedule $schedule)
    {
        // TODO: Re-add a cleanup command for outdated spec builds
        //$schedule->command(DeleteSpecificationBuildsCommand::class, ['build', 30])->daily();

        $schedule->command(ResourcesUpdateJob::class)->saturdays();
    }

    protected function commands()
    {
        parent::commands();
        $this->load(__DIR__.'/Commands');
    }
}

Add a weekly update job for the endpoint resources


<?php

namespace fennecweb\ajax\listing;

use \fennecweb\WebService as WebService;

class TraitsTest extends \PHPUnit_Framework_TestCase
{

    public function testExecute()
    {
        //Test for traits without search term or limit
        list($service) = WebService::factory('listing/Traits');
        $results = ($service->execute(array('dbversion' => DEFAULT_DBVERSION, 'search' => '')));
        $expected = array(
            array(
                "name" => "PlantHabit",
                "trait_type_id" => 1,
                "frequency" => 48916
            )
        );
        $this->assertEquals($expected, $results);
    }
}

<?php

namespace fennecweb\ajax\listing;

use \fennecweb\WebService as WebService;

class TraitsTest extends \PHPUnit_Framework_TestCase
{

    public function testExecute()
    {
        list($service) = WebService::factory('listing/Traits');
        $results = ($service->execute(array('dbversion' => DEFAULT_DBVERSION, 'search' => '')));
        $expected = array(
            array(
                "name" => "PlantHabit",
                "trait_type_id" => 1,
                "frequency" => 48916
            )
        );
        $this->assertEquals($expected, $results, 'Search without term and limit, result should be a list of all traits');

        $results = ($service->execute(array('dbversion' => DEFAULT_DBVERSION, 'search' => 'SomethingThatWillNeverBeATraitType')));
        $expected = array();
        $this->assertEquals($expected, $results, 'Search term does not hit, result should be an empty array');
    }
}

Add test case for search term without hits


<?php

namespace UserControlSkeleton;

class Requests
{
	public $data;

	public function __construct()
	{
		$this->data = $_POST;
	}
}

<?php

namespace UserControlSkeleton;

class Requests
{
	protected $data;

	public function __construct()
	{
		foreach ($_POST as $key => $value) {
			$this->data[$key] = $value;
		}
	}

	public function get($field)
	{
		return $this->data[$field];
	}
}

Update request handler to pass key value pairs of


<?php

class Project extends Eloquent {

	protected $fillable = ['title', 'slug'];

	/**
	 * @return \Illuminate\Database\Eloquent\Collection
	 */
	public function sprints()
	{
		return $this->hasMany('Sprint')->orderBy('sprint_start', 'desc');
	}

	public function currentSprint()
	{
		return $this->newestPastSprint() ?: $this->closestFutureSprint();
	}

	private function newestPastSprint()
	{
		return Sprint::where('sprint_start', '<=', date('Y-m-d'))
			->where('project_id', $this->id)
			->orderBy('sprint_start', 'desc')
			->first();
	}

	private function closestFutureSprint()
	{
		return Sprint::where('sprint_start', '>', date('Y-m-d'))
			->where('project_id', $this->id)
			->orderBy('sprint_start', 'asc')
			->first();
	}
}

<?php

class Project extends Eloquent {

	protected $fillable = ['title', 'slug'];

	/**
	 * @return \Illuminate\Database\Eloquent\Collection
	 */
	public function sprints()
	{
		return $this->hasMany('Sprint')->orderBy('sprint_start', 'desc');
	}

	/**
	 * @return \Illuminate\Validation\Validator
	 */
	public function validate()
	{
		return Validator::make(
			$this->getAttributes(),
			['title' => 'required|unique:projects']
		);
	}

	public function currentSprint()
	{
		return $this->newestPastSprint() ?: $this->closestFutureSprint();
	}

	private function newestPastSprint()
	{
		return Sprint::where('sprint_start', '<=', date('Y-m-d'))
			->where('project_id', $this->id)
			->orderBy('sprint_start', 'desc')
			->first();
	}

	private function closestFutureSprint()
	{
		return Sprint::where('sprint_start', '>', date('Y-m-d'))
			->where('project_id', $this->id)
			->orderBy('sprint_start', 'asc')
			->first();
	}
}

Add validation rules for project creation.


<?php

namespace Risan\OAuth1\Signature;

use Psr\Http\Message\UriInterface;

interface BaseStringBuilderInterface
{
    /**
     * Build the signature base string.
     *
     * @param string $httpMethod
     * @param \Psr\Http\Message\UriInterface|string $uri
     * @param array $parameters
     * @link https://tools.ietf.org/html/rfc5849#section-3.4.1
     * @return string
     */
    public function build($httpMethod, $uri, array $parameters = []);

    /**
     * Build the HTTP method component for base string.
     *
     * @param  string $httpMethod
     * @return string
     */
    public function buildMethodComponent($httpMethod);

    /**
     * Build the URI component for base string.
     *
     * @param  \Psr\Http\Message\UriInterface|string $uri
     * @link https://tools.ietf.org/html/rfc5849#section-3.4.1.2
     * @return string
     */
    public function buildUriComponent($uri);

    /**
     * Build the parameters component for base string.
     *
     * @param  array  $parameters
     * @link https://tools.ietf.org/html/rfc5849#section-3.4.1.3
     * @return string
     */
    public function buildParametersComponent(array $parameters);

    /**
     * Parse the given uri to PSR URIInterface.
     *
     * @param  \Psr\Http\Message\UriInterface|string $uri
     * @return Psr\Http\Message\UriInterface
     * @throws \InvalidArgumentException
     */
    public function parseToPsrUri($uri);
}

<?php

namespace Risan\OAuth1\Signature;

use Psr\Http\Message\UriInterface;

interface BaseStringBuilderInterface
{
    /**
     * Build the signature base string.
     *
     * @param string $httpMethod
     * @param \Psr\Http\Message\UriInterface|string $uri
     * @param array $parameters
     * @link https://tools.ietf.org/html/rfc5849#section-3.4.1
     * @return string
     */
    public function build($httpMethod, $uri, array $parameters = []);

    /**
     * Build the HTTP method component for base string.
     *
     * @param  string $httpMethod
     * @return string
     */
    public function buildMethodComponent($httpMethod);

    /**
     * Build the URI component for base string.
     *
     * @param  \Psr\Http\Message\UriInterface|string $uri
     * @link https://tools.ietf.org/html/rfc5849#section-3.4.1.2
     * @return string
     */
    public function buildUriComponent($uri);

    /**
     * Build the parameters component for base string.
     *
     * @param  array  $parameters
     * @link https://tools.ietf.org/html/rfc5849#section-3.4.1.3
     * @return string
     */
    public function buildParametersComponent(array $parameters);
}

:package: Remove the parseToPsrUri method from interface.


<?php

/*
 * This file is part of the league/commonmark package.
 *
 * (c) Colin O'Dell <colinodell@gmail.com>
 *
 * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js)
 *  - (c) John MacFarlane
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace League\CommonMark\Block\Parser;

use League\CommonMark\Block\Element\FencedCode;
use League\CommonMark\ContextInterface;
use League\CommonMark\Cursor;

class FencedCodeParser implements BlockParserInterface
{
    /**
     * @param ContextInterface $context
     * @param Cursor           $cursor
     *
     * @return bool
     */
    public function parse(ContextInterface $context, Cursor $cursor): bool
    {
        if ($cursor->isIndented()) {
            return false;
        }

        $indent = $cursor->getIndent();
        $fence = $cursor->match('/^[ \t]*(?:`{3,}(?!.*`)|^~{3,}(?!.*~))/');
        if ($fence === null) {
            return false;
        }

        // fenced code block
        $fence = \ltrim($fence, " \t");
        $fenceLength = \strlen($fence);
        $context->addBlock(new FencedCode($fenceLength, $fence[0], $indent));

        return true;
    }
}

<?php

/*
 * This file is part of the league/commonmark package.
 *
 * (c) Colin O'Dell <colinodell@gmail.com>
 *
 * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js)
 *  - (c) John MacFarlane
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace League\CommonMark\Block\Parser;

use League\CommonMark\Block\Element\FencedCode;
use League\CommonMark\ContextInterface;
use League\CommonMark\Cursor;

class FencedCodeParser implements BlockParserInterface
{
    /**
     * @param ContextInterface $context
     * @param Cursor           $cursor
     *
     * @return bool
     */
    public function parse(ContextInterface $context, Cursor $cursor): bool
    {
        if ($cursor->isIndented()) {
            return false;
        }

        $indent = $cursor->getIndent();
        $fence = $cursor->match('/^[ \t]*(?:`{3,}(?!.*`)|^~{3,})/');
        if ($fence === null) {
            return false;
        }

        // fenced code block
        $fence = \ltrim($fence, " \t");
        $fenceLength = \strlen($fence);
        $context->addBlock(new FencedCode($fenceLength, $fence[0], $indent));

        return true;
    }
}

Update fenced block parsing for spec change

See commonmark/commonmark.js@59980020


<?php
defined('C5_EXECUTE') or die(_("Access Denied."));

if (isset($error) && $error != '') {
	if ($error instanceof Exception) {
		$_error[] = $error->getMessage();
	} else if ($error instanceof ValidationErrorHelper) {
		$_error = $error->getList();
	} else if (is_array($error)) {
		$_error = $error;
	} else if (is_string($error)) {
		$_error[] = $error;
	}
	?>
	<? if ($format == 'block') { ?>

<button type="button" class="close" data-dismiss="alert">×</button>
	<?php foreach($_error as $e): ?>
		<?php echo $e?>

	<?php endforeach; ?>

	<? } else { ?>

	<?php foreach($_error as $e): ?>

<?php echo $e?>

	<?php endforeach; ?>

	<? } ?>

<?php } ?>

<?php
defined('C5_EXECUTE') or die(_("Access Denied."));

if (isset($error) && $error != '') {
	if ($error instanceof Exception) {
		$_error[] = $error->getMessage();
	} else if ($error instanceof ValidationErrorHelper) {
		$_error = $error->getList();
	} else if (is_array($error)) {
		$_error = $error;
	} else if (is_string($error)) {
		$_error[] = $error;
	}
	?>
	<? if($_error) { ?>
		<? if ($format == 'block') { ?>

<button type="button" class="close" data-dismiss="alert">×</button>
		<?php foreach($_error as $e): ?>
			<?php echo $e?>

		<?php endforeach; ?>

		<? } else { ?>

		<?php foreach($_error as $e): ?>

<?php echo $e?>

		<?php endforeach; ?>

		<? } ?>
	<? } ?>

<?php } ?>

Fix Attempting to Display Blank Errors

Fix Attempting to Display Blank Errors

Fix attempting to display blank errors in single pages

- This is particularly apparent with the newer `Controller::$error`
  property.


<?php

namespace Oro\Bundle\EmailBundle\Migrations\Schema\v1_28;

use Doctrine\DBAL\Schema\Schema;

use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;

class OroEmailBundle implements Migration
{
    /**
     * {@inheritdoc}
     */
    public function up(Schema $schema, QueryBag $queries)
    {
        static::oroEmailFolderChangeColumn($schema);
    }

    /**
     * @param Schema $schema
     */
    public static function oroEmailFolderChangeColumn(Schema $schema)
    {
        $table = $schema->getTable('oro_email_folder');
        if ($table->hasColumn('failed_count')) {
            $table->getColumn('failed_count')->setDefault("0");
        }
    }
}

Optimize email body cleanup process

BAP-11622: Optimize email body cleanup process


<?php
/**
 * This template file is for the icalendar and ics output formats.
 */
UNL_UCBCN::outputTemplate('UNL_UCBCN_Frontend_Day','Frontend_Day_icalendar');
ob_start();
UNL_UCBCN::displayRegion($this->output);
// Convert all line endings: line endings are windows-style, carriage-return, followed by a line feed
$out = ob_get_contents();
echo str_replace("\n","\r\n",$out);
?>

<?php
/**
 * This template file is for the icalendar and ics output formats.
 */
UNL_UCBCN::outputTemplate('UNL_UCBCN_Frontend_Day','Frontend_Day_icalendar');
ob_start();
UNL_UCBCN::displayRegion($this->output);
// Convert all line endings: line endings are windows-style, carriage-return, followed by a line feed
$out = ob_get_contents();
ob_clean();
echo str_replace("\n","\r\n",$out);
?>

Fix for icalendar output....... It was being sent twice before... one with \n and one with \r\n. Clear the buffer contents after you get the contents then send it out.


  protected function parsePayload($payload, $force = false)
  {
    if ($force || !isset($this->_payload_array))
    {
      $format = $this->getFormat();
      $serializer = $this->getSerializer();

      if ($serializer)
      {
        $payload_array = $serializer->unserialize($payload);
      }

      if (!isset($payload_array) || $payload_array === false)
      {
        throw new sfException(sprintf('Could not parse payload, obviously not a valid %s data!', $format));
      }

      $filter_params = <?php var_export(array_flip(array_merge(
        $this->configuration->getValue('get.global_additional_fields', array()),
        $this->configuration->getValue('get.object_additional_fields', array())
      ))) ?>;

      $this->_payload_array = array_diff_key($payload_array, $filter_params);
    }

    return $this->_payload_array;
  }

  protected function parsePayload($payload, $force = false)
  {
    if ($force || !isset($this->_payload_array))
    {
      $format = $this->getFormat();
      $serializer = $this->getSerializer();

      if ($serializer)
      {
        $payload_array = $serializer->unserialize($payload);
      }

      if (!isset($payload_array) || $payload_array === false)
      {
        throw new sfException(sprintf('Could not parse payload, not valid %s data', $format));
      }

      $filter_params = <?php var_export(array_flip(array_merge(
        $this->configuration->getValue('get.global_additional_fields', array()),
        $this->configuration->getValue('get.object_additional_fields', array())
      ))) ?>;

      $this->_payload_array = array_diff_key($payload_array, $filter_params);
    }

    return $this->_payload_array;
  }

Make unserialization error message more friendly


<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Budget extends Model {
    //
}

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Budget extends Model {
    public function tag() {
        return $this->belongsTo('App\Tag');
    }
}

Add tag relationship to budget model

Add tag relationship to budget model


<?php

/**
 * Extension for Content Controller that provide methods such as cart link and category list
 * to templates
 *
 * @author i-lateral (http://www.i-lateral.com)
 * @package checkout
 */
class CheckoutControllerExtension extends Extension {

    /**
     * Get the current shoppingcart
     *
     * @return ShoppingCart
     */
    public function getShoppingCart() {
        return ShoppingCart::get();
    }

    public function onBeforeInit() {
        // Set the default currency symbol for this site
        Currency::config()->currency_symbol = Checkout::config()->currency_symbol;
    }
}

<?php

/**
 * Extension for Content Controller that provide methods such as cart link and category list
 * to templates
 *
 * @author i-lateral (http://www.i-lateral.com)
 * @package checkout
 */
class CheckoutControllerExtension extends Extension {

    /**
     * Get the current shoppingcart
     *
     * @return ShoppingCart
     */
    public function getShoppingCart() {
        return ShoppingCart::get();
    }

    /**
     * Get the checkout config
     *
     * @return ShoppingCart
     */
    public function getCheckout() {
        return Checkout::create();
    }

    public function onBeforeInit() {
        // Set the default currency symbol for this site
        Currency::config()->currency_symbol = Checkout::config()->currency_symbol;
    }
}

Add checkout method to controller extension


          {{ title_case($name) }}
            <textarea class="textarea @if($errors->has($name)) is-danger @endif" rows="4" name="{{ $name }}">@if(empty($value)){{ old($name)}}@else{{ $value }}@endif</textarea>

{{ $errors->first($name) }}

          {{ title_case($name) }}
            <textarea id="{{ $name }}" class="textarea @if($errors->has($name)) is-danger @endif" rows="4" name="{{ $name }}">@if(empty($value)){{ old($name)}}@else{{ $value }}@endif</textarea>

{{ $errors->first($name) }}

Modify id of textarea with label

Modify id of textarea with label


<?php

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

namespace Sylius\Bundle\ThemeBundle\Tests\Functional;

use Symfony\Bundle\FrameworkBundle\Client;

/**
 * @author Kamil Kokot <kamil.kokot@lakion.com>
 */
class ThemeBundleTestCase extends WebTestCase
{
    const TEST_CASE = 'DefaultTestCase';

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

        $this->deleteTmpDir(self::TEST_CASE);
    }

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

        $this->deleteTmpDir(self::TEST_CASE);
    }

    /**
     * @return Client
     */
    protected function getClient()
    {
        $client = $this->createClient(['test_case' => self::TEST_CASE, 'root_config' => 'config.yml']);
        try {
            $client->insulate();
        } catch (\RuntimeException $e) {
            // Don't insulate requests if not possible to do so.
        }

        return $client;
    }
}

<?php

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

namespace Sylius\Bundle\ThemeBundle\Tests\Functional;

use Symfony\Bundle\FrameworkBundle\Client;

/**
 * @author Kamil Kokot <kamil.kokot@lakion.com>
 */
class ThemeBundleTestCase extends WebTestCase
{
    const TEST_CASE = 'DefaultTestCase';

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

        $this->deleteTmpDir(self::TEST_CASE);
    }

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

        $this->deleteTmpDir(self::TEST_CASE);
    }

    /**
     * @return Client
     */
    protected function getClient()
    {
        return $this->createClient(['test_case' => self::TEST_CASE, 'root_config' => 'config.yml']);
    }
}

[Theme] Make debugging easier by not isolating test client


<?php

use Anomaly\Streams\Platform\Database\Migration\Migration;

/**
 * Class AnomalyModuleFilesCreateDisksStream
 *
 * @link          http://pyrocms.com/
 * @author        PyroCMS, Inc. <support@pyrocms.com>
 * @author        Ryan Thompson <ryan@pyrocms.com>
 */
class AnomalyModuleFilesCreateDisksStream extends Migration
{

    /**
     * The stream definition.
     *
     * @var array
     */
    protected $stream = [
        'slug'         => 'disks',
        'title_column' => 'name',
        'translatable' => true
    ];

    /**
     * The stream assignments.
     *
     * @var array
     */
    protected $assignments = [
        'name'    => [
            'required' => true,
            'unique'   => true
        ],
        'slug'    => [
            'required' => true,
            'unique'   => true
        ],
        'adapter' => [
            'required' => true
        ],
        'description'
    ];

}

<?php

use Anomaly\Streams\Platform\Database\Migration\Migration;

/**
 * Class AnomalyModuleFilesCreateDisksStream
 *
 * @link          http://pyrocms.com/
 * @author        PyroCMS, Inc. <support@pyrocms.com>
 * @author        Ryan Thompson <ryan@pyrocms.com>
 */
class AnomalyModuleFilesCreateDisksStream extends Migration
{

    /**
     * The stream definition.
     *
     * @var array
     */
    protected $stream = [
        'slug'         => 'disks',
        'title_column' => 'name',
        'translatable' => true
    ];

    /**
     * The stream assignments.
     *
     * @var array
     */
    protected $assignments = [
        'name'        => [
            'translatable' => true,
            'required'     => true,
            'unique'       => true
        ],
        'slug'        => [
            'required' => true,
            'unique'   => true
        ],
        'adapter'     => [
            'required' => true
        ],
        'description' => [
            'translatable' => true
        ]
    ];

}

Fix issue where disk translatables were not translatable!


<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

if(!function_exists('bs_icon'))
{
	function bs_icon($sIcon = FALSE)
	{
		return '';
	}
}

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

// "$this" works under light testing, but experience shows that it won't
// necessarily work in every context, so let's use a $CI variable
$CI =& get_instance();

 // we use the CI form helper's _attributes_to_string()
$CI->load->helper('form');

if(!function_exists('bs_icon'))
{
	function bs_icon($sIcon = FALSE)
	{
		$aAttr = array(
			'class' => 'glyphicon glyphicon-' . $sIcon,
			'aria-hidden' => 'true',
		);
		return '<span' . _attributes_to_string($aAttr) . '></span>';
	}
}

Load and use form_helper's _attributes_to_string


<?php
use Cake\Event\EventManager;

EventManager::instance()->on('Controller.initialize', function (Cake\Event\Event $event) {
  $controller = $event->subject();
  if ($controller->components()->has('RequestHandler')) {
    $controller->RequestHandler->config('viewClassMap.csv', 'CsvView.Csv');
  }
});

<?php
use Cake\Event\EventManager;
use Cake\Network\Request;

EventManager::instance()->on('Controller.initialize', function (Cake\Event\Event $event) {
  $controller = $event->subject();
  if ($controller->components()->has('RequestHandler')) {
    $controller->RequestHandler->config('viewClassMap.csv', 'CsvView.Csv');
  }
});

Request::addDetector('csv', ['accept' => ['text/csv'], 'param' => '_ext', 'value' => 'csv']);

Implement the csv request detector

Implement the csv request detector


<?php

declare(strict_types=1);

use Cake\Core\Plugin;

// The function `parse_ini_file` may be disabled
$assets = parse_ini_string(file_get_contents(dirname(__FILE__) . '/asset_compress.ini'), true);

// Fix the CrudView local.css file for use Html::css()
foreach ($assets['crudview.css']['files'] as $i => $file) {
    if ($file === 'plugin:CrudView:css/local.css') {
        $assets['crudview.css']['files'][$i] = 'CrudView.local';
        break;
    }
}

// Fix the CrudView local.css file for use Html::css()
foreach ($assets['crudview.js']['files'] as $i => $file) {
    if ($file === 'plugin:CrudView:js/local.js') {
        $assets['crudview.js']['files'][$i] = 'CrudView.local';
        break;
    }
}

return [
    'CrudView' => [
        'siteTitle' => 'Crud View',
        'css' => $assets['crudview.css']['files'],
        'js' => [
            'headjs' => $assets['crudview_head.js']['files'],
            'script' => $assets['crudview.js']['files'],
        ],
        'datetimePicker' => false,
        'useAssetCompress' => Plugin::isLoaded('AssetCompress'),
        'tablesBlacklist' => [
            'phinxlog',
        ],
    ],
];

<?php
declare(strict_types=1);

use Cake\Core\Plugin;

// The function `parse_ini_file` may be disabled
$assets = parse_ini_string(
    file_get_contents(dirname(__FILE__) . '/asset_compress.ini'),
    true,
    INI_SCANNER_RAW
);

// Fix the CrudView local.css file for use Html::css()
foreach ($assets['crudview.css']['files'] as $i => $file) {
    if ($file === 'plugin:CrudView:css/local.css') {
        $assets['crudview.css']['files'][$i] = 'CrudView.local';
        break;
    }
}

// Fix the CrudView local.css file for use Html::css()
foreach ($assets['crudview.js']['files'] as $i => $file) {
    if ($file === 'plugin:CrudView:js/local.js') {
        $assets['crudview.js']['files'][$i] = 'CrudView.local';
        break;
    }
}

return [
    'CrudView' => [
        'siteTitle' => 'Crud View',
        'css' => $assets['crudview.css']['files'],
        'js' => [
            'headjs' => $assets['crudview_head.js']['files'],
            'script' => $assets['crudview.js']['files'],
        ],
        'datetimePicker' => false,
        'useAssetCompress' => Plugin::isLoaded('AssetCompress'),
        'tablesBlacklist' => [
            'phinxlog',
        ],
    ],
];

Use raw parsing mode for asset_compress.ini

This will avoid parsing issues due to special characters like "^" in URLs.


<?php

namespace Emergence\CMS;

class Page extends AbstractContent
{
    // ActiveRecord configuration
    public static $defaultClass = __CLASS__;
    public static $singularNoun = 'page';
    public static $pluralNoun = 'pages';
    public static $collectionRoute = '/pages';

    public static $fields = array(
        'LayoutClass' => array(
            'type' => 'enum'
            ,'values' => array('OneColumn')
            ,'default' => 'OneColumn'
        )
        ,'LayoutConfig'  => 'json'
    );

    public static function getAllPublishedByContextObject(ActiveRecord $Context, $options = array())
    {
        $options = array_merge(array(
            'conditions' => array()
        ), $options);

        $options['conditions']['Class'] = __CLASS__;

        return parent::getAllPublishedByContextObject($Context, $options);
    }
}

<?php

namespace Emergence\CMS;

use ActiveRecord;

class Page extends AbstractContent
{
    // ActiveRecord configuration
    public static $defaultClass = __CLASS__;
    public static $singularNoun = 'page';
    public static $pluralNoun = 'pages';
    public static $collectionRoute = '/pages';

    public static $fields = array(
        'LayoutClass' => array(
            'type' => 'enum'
            ,'values' => array('OneColumn')
            ,'default' => 'OneColumn'
        )
        ,'LayoutConfig'  => 'json'
    );

    public static function getAllPublishedByContextObject(ActiveRecord $Context, $options = array())
    {
        $options = array_merge(array(
            'conditions' => array()
        ), $options);

        $options['conditions']['Class'] = __CLASS__;

        return parent::getAllPublishedByContextObject($Context, $options);
    }
}

Use ActiveRecord from root namespace for param typehint


<?php

namespace Asana;

use Asana\Test\AsanaTest;
use Asana\Test\MockRequest;

use Asana\Dispatcher\OAuthDispatcher;

// Extend dispatcher to expose protected methods for testing.
class FakeOauthDispatcher extends OAuthDispatcher {
  public function authenticate($request) {
    return parent::authenticate($request);
  }
};

class OAuthDispatcherTest extends \PHPUnit_Framework_TestCase
{
    protected function setUp()
    {
        $this->dispatcher = new FakeOAuthDispatcher(array());
    }

    /**
     * @expectedException Exception
     * @expectedExceptionMessageRegExp #access token not set#
     */
    public function testAuthenticateNoToken()
    {
        $request = new MockRequest($this->dispatcher);
        $this->dispatcher->authenticate($request);
    }

    public function testAuthenticateUsesToken()
    {
        $this->dispatcher->accessToken = 'fake_token';
        $request = new MockRequest($this->dispatcher);
        $this->dispatcher->authenticate($request);
        $this->assertEquals(
            $request->headers, array('Authorization' => 'Bearer fake_token'));
    }
}

<?php

namespace Asana;

use Asana\Test\AsanaTest;
use Asana\Test\MockRequest;

use Asana\Dispatcher\OAuthDispatcher;

// Extend dispatcher to expose protected methods for testing.
class FakeOauthDispatcher extends OAuthDispatcher {
  public function authenticate($request) {
    return parent::authenticate($request);
  }
};

class OAuthDispatcherTest extends \PHPUnit_Framework_TestCase
{
    protected function setUp()
    {
        $this->dispatcher = new FakeOAuthDispatcher(array(
            'client_id' => 'fake_client_id'));
    }

    /**
     * @expectedException Exception
     * @expectedExceptionMessageRegExp #access token not set#
     */
    public function testAuthenticateNoToken()
    {
        $request = new MockRequest($this->dispatcher);
        $this->dispatcher->authenticate($request);
    }

    public function testAuthenticateUsesToken()
    {
        $this->dispatcher->accessToken = 'fake_token';
        $request = new MockRequest($this->dispatcher);
        $this->dispatcher->authenticate($request);
        $this->assertEquals(
            $request->headers, array('Authorization' => 'Bearer fake_token'));
    }
}

Fix more broken-ness travis catches but local build does not


@if($errors->any())

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

{{ $error }}

        @endforeach

@endif

@if ($errors->any())

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

{{ $error }}

        @endforeach

@endif

Remove the extra wrapper which was messing with the alignment


<?php

Route::get('@admin/theme/', 'Theme\Admin\Theme::index', 'theme_index');
Route::get('@admin/theme/activate/{alpha:name}/', 'Theme\Admin\Theme::activate', 'theme_activate');
Route::get('@admin/theme/delete/{alpha:name}/', 'Theme\Admin\Theme::delete', 'theme_delete');
Route::add('@admin/theme/upload/', 'Theme\Admin\Theme::upload', 'theme_upload');

Route::get('@admin/theme/editor/', 'Theme\Admin\Editor::index', 'theme_editor');
Route::add('@admin/theme/editor/edit/{alpha:ext}/{alpha:file}', 'Theme\Admin\Editor::edit', 'editor_edit');

Change theme activate route's rule

Change theme activate route's rule


<?php

/*
 * This file is part of Laravel Commentable.
 *
 * (c) Brian Faust <hello@brianfaust.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

/*
 * This file is part of Laravel Commentable.
 *
 * (c) Brian Faust <hello@brianfaust.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace BrianFaust\Commentable;

use BrianFaust\ServiceProvider\ServiceProvider;

class CommentableServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     */
    public function boot(): void
    {
        $this->publishMigrations();

        $this->publishConfig();
    }

    /**
     * Register the application services.
     */
    public function register(): void
    {
        parent::register();

        $this->mergeConfig();
    }

    /**
     * Get the default package name.
     *
     * @return string
     */
    public function getPackageName(): string
    {
        return 'commentable';
    }
}

<?php

/*
 * This file is part of Laravel Commentable.
 *
 * (c) Brian Faust <hello@brianfaust.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

/*
 * This file is part of Laravel Commentable.
 *
 * (c) Brian Faust <hello@brianfaust.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace BrianFaust\Commentable;

use BrianFaust\ServiceProvider\AbstractServiceProvider;

class CommentableServiceProvider extends AbstractServiceProvider
{
    /**
     * Bootstrap the application services.
     */
    public function boot(): void
    {
        $this->publishMigrations();

        $this->publishConfig();
    }

    /**
     * Register the application services.
     */
    public function register(): void
    {
        parent::register();

        $this->mergeConfig();
    }

    /**
     * Get the default package name.
     *
     * @return string
     */
    public function getPackageName(): string
    {
        return 'commentable';
    }
}

Fix extending service provider name

Fix extending service provider name


<?php

class ArraysTest extends \PHPUnit\Framework\TestCase
{
    public function testFlatten()
    {
        $this->assertEquals(
            ['a', 'b', 'c', 'd'],
            Missing\Arrays::flatten([
                ['a', 'b'],
                'c',
                [[['d']]],
            ])
        );
    }

    public function testSortByInt()
    {
        $this->assertEquals(
            ['a', 'a', 'ab', 'abc', 'abcd'],
            Missing\Arrays::sortBy(
                ['abcd', 'ab', 'a', 'abc', 'a'],
                function ($a) {
                    return strlen($a);
                }
            )
        );
    }

    public function testSortByString()
    {
        $this->assertEquals(
            ['a333', 'b22', 'c1', 'd55555'],
            Missing\Arrays::sortBy(
                ['d55555', 'b22', 'a333', 'c1'],
                function ($a) {
                    return $a;
                }
            )
        );
    }

    public function testSortByArray()
    {
        $this->assertEquals(
            [[2, 'b'], [2, 'c'], [19, 'a']],
            Missing\Arrays::sortBy(
                [[19, 'a'], [2, 'c'], [2, 'b']],
                function ($a) {
                    return $a;
                }
            )
        );
    }

    public function testSortByTriggersError()
    {
        $this->expectException(\PHPUnit\Framework\Error\Error::class);
        Missing\Arrays::sortBy(function () {
        }, []);
    }
}

<?php

class ArraysTest extends \PHPUnit\Framework\TestCase
{
    public function testFlatten()
    {
        $this->assertEquals(
            ['a', 'b', 'c', 'd'],
            Missing\Arrays::flatten([
                ['a', 'b'],
                'c',
                [[['d']]],
            ])
        );
    }

    public function testSortByInt()
    {
        $this->assertEquals(
            ['a', 'a', 'ab', 'abc', 'abcd'],
            Missing\Arrays::sortBy(
                ['abcd', 'ab', 'a', 'abc', 'a'],
                function ($a) {
                    return strlen($a);
                }
            )
        );
    }

    public function testSortByString()
    {
        $this->assertEquals(
            ['a333', 'b22', 'c1', 'd55555'],
            Missing\Arrays::sortBy(
                ['d55555', 'b22', 'a333', 'c1'],
                function ($a) {
                    return $a;
                }
            )
        );
    }

    public function testSortByArray()
    {
        $this->assertEquals(
            [[2, 'b'], [2, 'c'], [19, 'a']],
            Missing\Arrays::sortBy(
                [[19, 'a'], [2, 'c'], [2, 'b']],
                function ($a) {
                    return $a;
                }
            )
        );
    }

    public function testSortByTriggersError()
    {
        $this->expectException(\TypeError::class);
        Missing\Arrays::sortBy(function () {
        }, []);
    }
}

Check for the specific error being thrown


<?php
/**
 * vt Smarty Extension Demo
 * Copyright (C) 2013  Marat Bedoev
 *
 *    This file is part of TOXID Module for OXID eShop CE/PE/EE.
 *
 *    TOXID is free software: you can redistribute it and/or modify
 *    it under the terms of the MIT License.
 *
 *
 * @link      https://github.com/vanilla-thunder/vt-smartyext
 * @link      http://toxid.org
 * @package   core
 */

class toxid_curl_oxutilsview extends toxid_curl_oxutilsview_parent
{
    public function _fillCommonSmartyProperties($oSmarty)
    {
        parent::_fillCommonSmartyProperties($oSmarty);

        $cfg = oxRegistry::getConfig();

        $aPluginsDir = $oSmarty->plugins_dir;
        $aPluginsDir[] = $cfg->getModulesDir()."/toxid_curl/smarty/plugins/";

        $oSmarty->plugins_dir = $aPluginsDir;
    }
}

<?php
/**
 * vt Smarty Extension Demo
 * Copyright (C) 2013  Marat Bedoev
 *
 *    This file is part of TOXID Module for OXID eShop CE/PE/EE.
 *
 *    TOXID is free software: you can redistribute it and/or modify
 *    it under the terms of the MIT License.
 *
 *
 * @link      https://github.com/vanilla-thunder/vt-smartyext
 * @link      http://toxid.org
 * @package   core
 */

class toxid_curl_oxutilsview extends toxid_curl_oxutilsview_parent
{
    protected function _fillCommonSmartyProperties($oSmarty)
    {
        parent::_fillCommonSmartyProperties($oSmarty);

        $cfg = oxRegistry::getConfig();

        $aPluginsDir = $oSmarty->plugins_dir;
        $aPluginsDir[] = $cfg->getModulesDir()."/toxid_curl/smarty/plugins/";

        $oSmarty->plugins_dir = $aPluginsDir;
    }
}

Change visibility from public to protected

Fix problem if this core class is overloaded multiple times (d3config for example)


<?php

class Store_check_ext
{
    public $name = 'Store Check Payments';
    public $version = '0.0.1';
    public $description = 'Example custom payment gateway for Expresso Store';
    public $settings_exist = 'n';
    public $docs_url = 'https://exp-resso.com/docs';

    public function activate_extension()
    {
        $data = array(
            'class'     => __CLASS__,
            'method'    => 'store_payment_gateways',
            'hook'      => 'store_payment_gateways',
            'priority'  => 10,
            'settings'  => '',
            'version'   => $this->version,
            'enabled'   => 'y'
        );

        ee()->db->insert('extensions', $data);
    }

    /**
     * This hook is called when Store is searching for available payment gateways
     * We will use it to tell Store about our custom gateway
     */
    public function store_payment_gateways($gateways)
    {
        // tell Store about our new payment gateway
        // (this must match the name of your gateway in the Omnipay directory)
        $gateways[] = 'Check';

        // tell PHP where to find the gateway classes
        // Store will automatically include your files when they are needed
        $composer = require(PATH_THIRD.'store/autoload.php');
        $composer->add('Omnipay', __DIR__);

        return $gateways;
    }
}

<?php

class Store_check_ext
{
    public $name = 'Store Check Payments';
    public $version = '1.0.0';
    public $description = 'Example custom payment gateway for Expresso Store';
    public $settings_exist = 'n';
    public $docs_url = 'https://exp-resso.com/docs';

    public function activate_extension()
    {
        $data = array(
            'class'     => __CLASS__,
            'method'    => 'store_payment_gateways',
            'hook'      => 'store_payment_gateways',
            'priority'  => 10,
            'settings'  => '',
            'version'   => $this->version,
            'enabled'   => 'y'
        );

        ee()->db->insert('extensions', $data);
    }

    /**
     * This hook is called when Store is searching for available payment gateways
     * We will use it to tell Store about our custom gateway
     */
    public function store_payment_gateways($gateways)
    {
        // allow multiple extensions to use this hook
        // see: http://ellislab.com/expressionengine/user-guide/development/extensions.html#multiple-extensions-same-hook
        if (ee()->extensions->last_call) {
            $gateways = ee()->extensions->last_call;
        }

        // tell Store about our new payment gateway
        // (this must match the name of your gateway in the Omnipay directory)
        $gateways[] = 'Check';

        // tell PHP where to find the gateway classes
        // Store will automatically include your files when they are needed
        $composer = require(PATH_THIRD.'store/autoload.php');
        $composer->add('Omnipay', __DIR__);

        return $gateways;
    }
}

Fix issue with multiple extensions using same hoook


<!DOCTYPE html>
<html lang="<?= LANG ?>">
<head>
  <title><?= PageTitle() ?></title>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
  <meta name="copyright" content="<?= T('copyright') ?>">
  <meta name="description" content="<?= PageDescription() ?>">
  <meta name="keywords" content="<?= PageKeywords() ?>">

  <link rel="icon" type="image/x-icon" href="<?= URL('favicon.ico') ?>?">
  <link rel="stylesheet" type="text/css" href="<?= URL('css/style.css') ?>">
  <!-- TODO: Generate hreflang links for every language. -->
  <?php /* $langSites = [
      'https://www.vibrobox.com/' => ['x-default', 'en'],
      'https://www.vibrobox.ru/' => ['ru', 'uk', 'kk'],
      'https://www.vibrobox.by/' => ['be'],
    ];
  ?>
  <?php foreach ($langSites as $url => $langs) : foreach ($langs as $lang) : ?>
  <link href="<?= $url ?>" hreflang="<?= $lang ?>" rel="alternate">
  <?php endforeach; endforeach; */?>

  <?php foreach (PageCSS() as $url) : ?>
  <link rel="stylesheet" type="text/css" href="<?= $url ?>">
  <?php endforeach; ?>

  <!-- TODO: Move JS scripts to the footer. -->
  <?php foreach (PageJS() as $url) : ?>
  <script defer type="text/javascript" src="<?= $url ?>">
  <?php endforeach; ?>
</head>

<!DOCTYPE html>
<html lang="<?= LANG ?>">
<head>
  <title><?= PageTitle() ?></title>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="copyright" content="<?= T('copyright') ?>">
  <meta name="description" content="<?= PageDescription() ?>">
  <meta name="keywords" content="<?= PageKeywords() ?>">

  <link rel="icon" type="image/x-icon" href="<?= URL('favicon.ico') ?>?">
  <link rel="stylesheet" type="text/css" href="<?= URL('css/style.css') ?>">
  <!-- TODO: Generate hreflang links for every language. -->
  <?php /* $langSites = [
      'https://www.vibrobox.com/' => ['x-default', 'en'],
      'https://www.vibrobox.ru/' => ['ru', 'uk', 'kk'],
      'https://www.vibrobox.by/' => ['be'],
    ];
  ?>
  <?php foreach ($langSites as $url => $langs) : foreach ($langs as $lang) : ?>
  <link href="<?= $url ?>" hreflang="<?= $lang ?>" rel="alternate">
  <?php endforeach; endforeach; */?>

  <?php foreach (PageCSS() as $url) : ?>
  <link rel="stylesheet" type="text/css" href="<?= $url ?>">
  <?php endforeach; ?>

  <!-- TODO: Move JS scripts to the footer. -->
  <?php foreach (PageJS() as $url) : ?>
  <script defer type="text/javascript" src="<?= $url ?>">
  <?php endforeach; ?>
</head>

Allow users to manually zoom in on mobile devices.


<?php
/**
 * This file is part of CaptainHook.
 *
 * (c) Sebastian Feldmann <sf@sebastian.feldmann.info>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace sebastianfeldmann\CaptainHook\Hook\Message\Rule;

/**
 * Class UseImperativeMood
 *
 * @package CaptainHook
 * @author  Sebastian Feldmann <sf@sebastian-feldmann.info>
 * @link    https://github.com/sebastianfeldmann/captainhook
 * @since   Class available since Release 0.9.0
 */
class UseImperativeMood extends Blacklist
{
    /**
     * Constructor.
     */
    public function __construct()
    {
        $this->hint = 'Subject should be written in imperative mood';
        $this->setSubjectBlacklist(
            [
                'uploaded',
                'updated',
                'added',
                'created',
            ]
        );
    }
}

<?php
/**
 * This file is part of CaptainHook.
 *
 * (c) Sebastian Feldmann <sf@sebastian.feldmann.info>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace sebastianfeldmann\CaptainHook\Hook\Message\Rule;

/**
 * Class UseImperativeMood
 *
 * @package CaptainHook
 * @author  Sebastian Feldmann <sf@sebastian-feldmann.info>
 * @link    https://github.com/sebastianfeldmann/captainhook
 * @since   Class available since Release 0.9.0
 */
class UseImperativeMood extends Blacklist
{
    /**
     * Constructor.
     */
    public function __construct()
    {
        $this->hint = 'Subject should be written in imperative mood';
        $this->setSubjectBlacklist(
            [
                'uploaded',
                'updated',
                'added',
                'created',
                'removed'
            ]
        );
    }
}

Add 'removed' to imperative blacklist

Add 'removed' to imperative blacklist


<?php

namespace CultuurNet\UDB3\Media\Properties;

use InvalidArgumentException;
use ValueObjects\String\String;

class MIMEType extends String
{
    protected static $supportedSubtypes = [
        'jpeg' => 'image'
    ];

    /**
     * @param string $subtypeString
     *
     * @return MIMEType
     */
    public static function fromSubtype($subtypeString)
    {
        $type = self::$supportedSubtypes[$subtypeString];

        if (!$type) {
            throw new InvalidArgumentException($subtypeString . ' is not supported!');
        }

        return new static($type . '/' . $subtypeString);
    }
}

<?php

namespace CultuurNet\UDB3\Media\Properties;

use InvalidArgumentException;
use ValueObjects\String\String;

class MIMEType extends String
{
    protected static $supportedSubtypes = [
        'jpeg' => 'image',
        'png' => 'image',
        'gif' => 'image'
    ];

    /**
     * @param string $subtypeString
     *
     * @return MIMEType
     */
    public static function fromSubtype($subtypeString)
    {
        $type = self::$supportedSubtypes[$subtypeString];

        if (!$type) {
            throw new InvalidArgumentException($subtypeString . ' is not supported!');
        }

        return new static($type . '/' . $subtypeString);
    }
}

Add support for GIF and PNG image types

III-1642: Add support for GIF and PNG image types


<?php

namespace Api\Model\Languageforge\Lexicon;

use Api\Model\Shared\Mapper\ObjectForEncoding;

class LexCommentReply extends ObjectForEncoding
{
    public function __construct($content = '')
    {
        $this->content = $content;
        $this->id = uniqid();
        $this->authorInfo = new LexAuthorInfo();
        $this->isDeleted = false;
    }

    /** @var LexAuthorInfo */
    public $authorInfo;

    /** @var string */
    public $content;

    /** @var string */
    public $id;

    /** @var boolean */
    public $isDeleted;
}

<?php

namespace Api\Model\Languageforge\Lexicon;

use Api\Model\Shared\Mapper\ObjectForEncoding;

class LexCommentReply extends ObjectForEncoding
{
    public function __construct($content = '')
    {
        $this->content = $content;
        $this->id = uniqid();
        $this->authorInfo = new LexAuthorInfo();
        $this->isDeleted = false;
    }

    /** @var LexAuthorInfo */
    public $authorInfo;

    /** @var string */
    public $content;

    /** @var string */
    public $id;

    /** @var string */
    public $guid;

    /** @var boolean */
    public $isDeleted;
}

Fix comment replies being duplicated during S/R

Turns out it was quite simple: the reply GUIDs weren't being tracked by
PHP and sent to the Javascript frontend, so when the frontend created a
new reply and updated the entire list of replies, it sent a list with no
GUIDs in it. Simply keeping track of the reply GUIDs in PHP is enough to
get rid of this bug.


<?php
/** @var $this yii\web\View */
/** @var $section common\models\Section */

use yii\helpers\Html;

$this->title = $section->parent === null ? $section->title : $section->parent->title . ' → ' . $section->title;
?>

<?= Html::encode($this->title) ?>

<?php
/** @var $this yii\web\View */
/** @var $section common\models\Section */

use yii\helpers\Html;

if ($section->parent === null) {
    $this->title = $section->title;
    $this->params['breadcrumbs'][] = $section->title;
} else {
    $this->title = $section->parent->title . ' → ' . $section->title;
    $this->params['breadcrumbs'][] = ['label' => $section->parent->title, 'url' => $section->parent->getUrl()];
    $this->params['breadcrumbs'][] = $section->title;
}
?>

<?= Html::encode($this->title) ?>

Add breadcrumbs support at the section page.


<?php
///////////////////////////////////////
// Config.

$config["info"] = array(
    "debug" => FALSE,
    "version" => "1.0",
    "title" => "The OpenGL vs Mesa matrix",
    "description" => "Show Mesa progress for the OpenGL implementation into an easy to read HTML page.",
    "git_url" => "http://cgit.freedesktop.org/mesa/mesa",
    "gl3_file" => "src/gl3.txt",
    "log_file" => "src/gl3_log.txt",
);

$config["auto_fetch"] = array(
    "enabled" => TRUE,
    "timeout" => 3600,
    "url" => "http://cgit.freedesktop.org/mesa/mesa/plain/docs/GL3.txt",
);

$config["flattr"] = array(
    "enabled" => FALSE,
    "id" => "your_flattr_id",
    "language" => "en_US",
    "tags" => "mesa,opengl",
);

///////////////////////////////////////
// Common code for all pages.

date_default_timezone_set('UTC');

if($config["info"]["debug"])
{
    ini_set('display_errors', 1);
    ini_set('error_reporting', E_ALL);
}

function debug_print($line)
{
    if($config["info"]["debug"])
    {
        print("DEBUG: ".$line."<br />\n");
    }
}
?>

<?php
///////////////////////////////////////
// Config.

$config["info"] = array(
    "debug" => FALSE,
    "version" => "1.0",
    "title" => "The OpenGL vs Mesa matrix",
    "description" => "Show Mesa progress for the OpenGL implementation into an easy to read HTML page.",
    "git_url" => "http://cgit.freedesktop.org/mesa/mesa",
    "gl3_file" => "src/gl3.txt",
    "log_file" => "src/gl3_log.txt",
);

$config["auto_fetch"] = array(
    "enabled" => FALSE,
    "timeout" => 3600,
    "url" => "http://cgit.freedesktop.org/mesa/mesa/plain/docs/GL3.txt",
);

$config["flattr"] = array(
    "enabled" => FALSE,
    "id" => "your_flattr_id",
    "language" => "en_US",
    "tags" => "mesa,opengl",
);

///////////////////////////////////////
// Common code for all pages.

date_default_timezone_set('UTC');

if($config["info"]["debug"])
{
    ini_set('display_errors', 1);
    ini_set('error_reporting', E_ALL);
}

function debug_print($line)
{
    if($config["info"]["debug"])
    {
        print("DEBUG: ".$line."<br />\n");
    }
}
?>

Disable auto fetch by default

Disable auto fetch by default


<?php
require_once("conexao/conexao.php");

$titulo    = addslashes(trim($_POST['titulo']   ));
$categoria = addslashes(trim($_POST['categoria']));
$descricao = addslashes(trim($_POST['descricao']));
$longitude = addslashes(trim($_POST['longitude']));
$latitude  = addslashes(trim($_POST['latitude'] ));

$addsinal = $conexao -> prepare("INSERT sinalizacao (titulo, latitude, longitude, categoria, descricao) values(:titulo, :latitude, :longitude, :categoria, :descricao)");
$addsinal->bindValue(":titulo"    , $titulo   );
$addsinal->bindValue(":latitude"  , $latitude );
$addsinal->bindValue(":longitude" , $longitude);
$addsinal->bindValue(":categoria" , $categoria);
$addsinal->bindValue(":descricao" , $descricao);
$addsinal->execute();

if($addsinal) {
  echo "sinal add com sucesso";
  echo var_dump($addsinal);
}else {
  echo "faio";
}

 ?>

<?php
require_once("conexao/conexao.php");
$conexao = conectar();
//REQUISIÇÕES VINDAS DA PÁGINA SINAL_FORMULARIO.PHP
$titulo      = addslashes(trim($_POST['titulo'     ]));
$categoria   = addslashes(trim($_POST['categoria'  ]));
$descricao   = addslashes(trim($_POST['descricao'  ]));
$longitude   = addslashes(trim($_POST['longitude'  ]));
$latitude    = addslashes(trim($_POST['latitude'   ]));
$data_public = addslashes(trim($_POST['data_public']));

$addsinal = $conexao -> prepare("INSERT INTO sinalizacao (titulo, descricao, latitude, longitude, categoria, data_public) values(:titulo, :descricao, :latitude, :longitude, :categoria, :data_public)");
$addsinal->bindValue(":titulo"      , $titulo      );
$addsinal->bindValue(":descricao"   , $descricao   );
$addsinal->bindValue(":latitude"    , $latitude    );
$addsinal->bindValue(":longitude"   , $longitude   );
$addsinal->bindValue(":categoria"   , $categoria   );
$addsinal->bindValue(":data_public" , $data_public );
$addsinal->execute();

if($addsinal) {
  echo "sinal add com sucesso";
}else {
  echo "faio";
}

 ?>

ADD campo data_public e reorganização do código


<?php

namespace Bolt\Tests\Provider;

use Bolt\Tests\BoltUnitTest;
use Bolt\Twig\Extension\BoltExtension;
use Bolt\Twig\SafeEnvironment;
use Twig_Environment as Environment;

/**
 * @covers \Bolt\Provider\TwigServiceProvider
 *
 * @author Ross Riley <riley.ross@gmail.com>
 * @author Carson Full <carsonfull@gmail.com>
 *
 * @covers \Bolt\Provider\TwigServiceProvider
 */
class TwigServiceProviderTest extends BoltUnitTest
{
    public function testProvider()
    {
        $app = $this->getApp();

        $this->assertNotEmpty($app['twig.options']['cache'], 'Cache path was not set');
        $this->assertInstanceOf(Environment::class, $app['twig']);
        $this->assertTrue($app['twig']->hasExtension(BoltExtension::class), 'Bolt\Twig\Extension\BoltExtension was not added to twig environment');
        $this->assertContains('bolt', $app['twig.loader.bolt_filesystem']->getNamespaces(), 'bolt namespace was not added to filesystem loader');
    }

    public function testLegacyProvider()
    {
        $app = $this->getApp();

        $this->assertInstanceOf(SafeEnvironment::class, $app['safe_twig']);
    }

    public function testConfigCacheDisabled()
    {
        $app = $this->getApp(false);
        $app['config']->set('general/caching/templates', false);
        $this->assertArrayNotHasKey('cache', $app['twig.options']);
    }
}

<?php

namespace Bolt\Tests\Provider;

use Bolt\Tests\BoltUnitTest;
use Bolt\Twig\Extension\BoltExtension;
use Twig_Environment as Environment;

/**
 * @covers \Bolt\Provider\TwigServiceProvider
 *
 * @author Ross Riley <riley.ross@gmail.com>
 * @author Carson Full <carsonfull@gmail.com>
 *
 * @covers \Bolt\Provider\TwigServiceProvider
 */
class TwigServiceProviderTest extends BoltUnitTest
{
    public function testProvider()
    {
        $app = $this->getApp();

        $this->assertNotEmpty($app['twig.options']['cache'], 'Cache path was not set');
        $this->assertInstanceOf(Environment::class, $app['twig']);
        $this->assertTrue($app['twig']->hasExtension(BoltExtension::class), 'Bolt\Twig\Extension\BoltExtension was not added to twig environment');
        $this->assertContains('bolt', $app['twig.loader.bolt_filesystem']->getNamespaces(), 'bolt namespace was not added to filesystem loader');
    }

    public function testConfigCacheDisabled()
    {
        $app = $this->getApp(false);
        $app['config']->set('general/caching/templates', false);
        $this->assertArrayNotHasKey('cache', $app['twig.options']);
    }
}

Remove safe_twig test missed in rebase

[Tests] Remove safe_twig test missed in rebase


<?php

namespace Leezy\PheanstalkBundle;

use Pheanstalk_Pheanstalk;

class ConnectionLocator
{
    private $connections;
    private $info;
    private $default;

    public function __construct()
    {
        $this->connections = array();
    }

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

    /**
     * @param string $name
     *
     * @return \Pheanstalk_Connection $connection
     */
    public function getConnection($name = null) {
        $name = null !== $name ?: $this->default;

        if (array_key_exists($name, $this->connections)) {
            return $this->connections[$name];
        }

        return null;
    }

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

    /**
     * @param string $name
     * @param Pheanstalk_Pheanstalk $connection
     * @param array $info
     */
    public function addConnection($name, Pheanstalk_Pheanstalk $connection, array $info)
    {
        $this->connections[$name] = $connection;
        $this->info[$name] = array_merge($info, array('resource' => $connection));

        if (true === $info['default']) {
            $this->default = $name;
        }
    }
}

<?php

namespace Leezy\PheanstalkBundle;

use Pheanstalk_Pheanstalk;

class ConnectionLocator
{
    private $connections;
    private $info;
    private $default;

    public function __construct()
    {
        $this->connections = array();
    }

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

    /**
     * @param string $name
     *
     * @return \Pheanstalk_Connection $connection
     */
    public function getConnection($name = null) {
        $name = null !== $name ?: $this->default;

        if (array_key_exists($name, $this->connections)) {
            return $this->connections[$name];
        }

        return null;
    }

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

    /**
     * @param string $name
     * @param Pheanstalk_Pheanstalk $connection
     * @param array $info
     */
    public function addConnection($name, Pheanstalk_Pheanstalk $connection, array $info = array())
    {
        $this->connections[$name] = $connection;

        // Gather connection information
        $this->info[$name] = array(
            'host' => isset($info['host']) ? $info['host'] : null,
            'port' => isset($info['port']) ? $info['port'] : null,
            'timeout' => isset($info['timeout']) ? $info['timeout'] : null,
            'default' => isset($info['default']) ? $info['default'] : false,
            'resource' => $connection,
        );

        // Set the default connection name
        if (true === $this->info[$name]['default']) {
            $this->default = $name;
        }
    }
}

Set some default connection information to maintain consistency for the dataCollector


<?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\Bridge\Twig\Form;

use Symfony\Component\Form\FormRenderer;
use Symfony\Component\Security\Csrf\CsrfTokenGeneratorInterface;

/**
 * @author Bernhard Schussek <bschussek@gmail.com>
 */
class TwigRenderer extends FormRenderer implements TwigRendererInterface
{
    /**
     * @var TwigRendererEngineInterface
     */
    private $engine;

    public function __construct(TwigRendererEngineInterface $engine, CsrfTokenGeneratorInterface $csrfTokenGenerator = null)
    {
        parent::__construct($engine, $csrfTokenGenerator);

        $this->engine = $engine;
    }

    /**
     * {@inheritdoc}
     */
    public function setEnvironment(\Twig_Environment $environment)
    {
        $this->engine->setEnvironment($environment);
    }
}

<?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\Bridge\Twig\Form;

use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderAdapter;
use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface;
use Symfony\Component\Form\FormRenderer;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;

/**
 * @author Bernhard Schussek <bschussek@gmail.com>
 */
class TwigRenderer extends FormRenderer implements TwigRendererInterface
{
    /**
     * @var TwigRendererEngineInterface
     */
    private $engine;

    public function __construct(TwigRendererEngineInterface $engine, $csrfTokenManager = null)
    {
        if ($csrfTokenManager instanceof CsrfProviderInterface) {
            $csrfTokenManager = new CsrfProviderAdapter($csrfTokenManager);
        } elseif (null !== $csrfTokenManager && !$csrfTokenManager instanceof CsrfTokenManagerInterface) {
            throw new UnexpectedTypeException($csrfTokenManager, 'CsrfProviderInterface or CsrfTokenManagerInterface');
        }

        parent::__construct($engine, $csrfTokenManager);

        $this->engine = $engine;
    }

    /**
     * {@inheritdoc}
     */
    public function setEnvironment(\Twig_Environment $environment)
    {
        $this->engine->setEnvironment($environment);
    }
}

[Security\Csrf] Split CsrfTokenGenerator into CsrfTokenManager and TokenGenerator


<?php
namespace GeoTools\Model;

final class Point2D
{
    /**
     * @var double
     */
    public $x;

    /**
     * @var double
     */
    public $y;

    /**
     * @param double $x
     * @param double $y
     */
    public function __construct($x, $y)
    {
        $this->x = $x;
        $this->y = $y;
    }

    /**
     * @param Point2D[] $points
     * @return BoundingBox2D
     */
    public static function calculateBoundingBoxForPoints(array $points) {
        if (!$points) {
            return new BoundingBox2D(0, 0, 0, 0);
        }

        $xmin = null;
        $xmax = null;
        $ymin = null;
        $ymax = null;

        foreach ($points as $point) {
            if ($xmin === null || $point->x < $xmin) {
                $xmin = $point->x;
            }
            if ($xmax === null || $point->x > $xmax) {
                $xmax = $point->x;
            }
            if ($ymin === null || $point->y < $ymin) {
                $ymin = $point->y;
            }
            if ($ymax === null || $point->y > $ymax) {
                $ymax = $point->y;
            }
        }

        return new BoundingBox2D($xmin, $xmax, $ymin, $ymax);
    }
}

<?php
namespace GeoTools\Model;

final class Point2D
{
    /**
     * @var double
     */
    public $x;

    /**
     * @var double
     */
    public $y;

    /**
     * @param double $x
     * @param double $y
     */
    public function __construct($x, $y)
    {
        $this->x = $x;
        $this->y = $y;
    }

    /**
     * @param Point2D $point
     * @return double
     */
    public function distanceToPoint(Point2D $point) {
        return sqrt($this->squareDistanceToPoint($point));
    }

    /**
     * @param Point2D $point
     * @return double
     */
    public function squareDistanceToPoint(Point2D $point) {
        return pow($point->x - $this->x, 2) + pow($point->y - $this->y, 2);
    }

    /**
     * @param Point2D[] $points
     * @return BoundingBox2D
     */
    public static function calculateBoundingBoxForPoints(array $points) {
        if (!$points) {
            return new BoundingBox2D(0, 0, 0, 0);
        }

        $xmin = null;
        $xmax = null;
        $ymin = null;
        $ymax = null;

        foreach ($points as $point) {
            if ($xmin === null || $point->x < $xmin) {
                $xmin = $point->x;
            }
            if ($xmax === null || $point->x > $xmax) {
                $xmax = $point->x;
            }
            if ($ymin === null || $point->y < $ymin) {
                $ymin = $point->y;
            }
            if ($ymax === null || $point->y > $ymax) {
                $ymax = $point->y;
            }
        }

        return new BoundingBox2D($xmin, $xmax, $ymin, $ymax);
    }
}

Add function to calculate distance between points


<?php
require_once "../../classes/Validators/ArrValueExists.php";

class ArrValueExistsTest extends PHPUnit_Framework_TestCase {
    public function setUp() {
        $this->validator = new Validators_ArrValueExists();
    }

    public function testEmptyValue() {
        $arr = array("");
        $this->assertEquals(0, $this->validator->validate($arr, 0));
    }

    public function testValidValue() {
        $arr = array("Exists");
        $this->assertEquals(1, $this->validator->validate($arr, 0));
    }
}

<?php
require_once "../ArrValueExists.php";

class ArrValueExistsTest extends PHPUnit_Framework_TestCase {
    public function setUp() {
        $this->validator = new Validators_ArrValueExists();
    }

    public function testEmptyValue() {
        $arr = array("");
        $this->assertEquals(0, $this->validator->validate($arr, 0));
    }

    public function testValidValue() {
        $arr = array("Exists");
        $this->assertEquals(1, $this->validator->validate($arr, 0));
    }
}

Fix file path for test

Fix file path for test


<?php
include "database_operations.php";
$db = new Database_operations(); // create the "request object"

// output headers so that the file is downloaded rather than displayed
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=lectures.csv');

// create a file pointer connected to the output stream
$output = fopen('php://output', 'w');

// output the column headings
fputcsv($output, array('Année du baguage', 'Date du baguage', 'Bague métal',
					   'Numéro', 'Couleur', 'Sexe', 'Âge au baguage', 'Date de lecture',
					   'Nom du lecteur', 'Ville de lecture', 'Département de lecture',
					   'Lieu-dit de lecture'));

$data_observations = $db->csv_save();
foreach ($data_observations as $row) {
	fputcsv($output, $row);
}

?>

<?php
include "database_operations.php";
$db = new Database_operations(); // create the "request object"

// output headers so that the file is downloaded rather than displayed
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=lectures.csv');

// create a file pointer connected to the output stream
$output = fopen('php://output', 'w');

// output the column headings
fputcsv($output, array('Année du baguage', 'Date du baguage', 'Bague métal',
					   'Numéro', 'Couleur', 'Sexe', 'Âge au baguage', 'Date de lecture',
					   'Nom du lecteur', 'Ville de lecture', 'Département de lecture',
					   'Lieu-dit de lecture', 'Coordonnée X', 'Coordonnée Y', 'Commentaires'));

$data_observations = $db->csv_save();
foreach ($data_observations as $row) {
	fputcsv($output, $row);
}

?>

Add columns title for the export

Add columns title for the export


<?php
class Kwf_Assets_CommonJs_Underscore_TemplateProvider extends Kwf_Assets_Provider_Abstract
{
    public function getDependency($dependencyName)
    {
        if (substr($dependencyName, -15) == '.underscore.tpl') {
            $ret = new Kwf_Assets_CommonJs_Underscore_TemplateDependency($this->_providerList, $dependencyName);
            $ret->addDependency(
                Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_COMMONJS,
                $this->_providerList->findDependency('underscore'),
                'underscore'
            );

            if (file_exists(substr($ret->getAbsoluteFileName(), 0, -15) . '.scss')) {
                $ret->addDependency(
                    Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_REQUIRES,
                    new Kwf_Assets_Dependency_File_Scss($this->_providerList, substr($dependencyName, 0, -15) . '.scss')
                );
            }
            return $ret;
        }
        return null;
    }
}

<?php
class Kwf_Assets_CommonJs_Underscore_TemplateProvider extends Kwf_Assets_Provider_Abstract
{
    public function getDependency($dependencyName)
    {
        if (substr($dependencyName, -15) == '.underscore.tpl') {
            $ret = new Kwf_Assets_CommonJs_Underscore_TemplateDependency($this->_providerList, $dependencyName);
            $ret->addDependency(
                Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_COMMONJS,
                $this->_providerList->findDependency('underscore'),
                'underscore'
            );

            if (file_exists(substr($ret->getAbsoluteFileName(), 0, -15) . '.scss') && substr($ret->getFileNameWithType(), 0, 13) != 'web/commonjs/') {
                $ret->addDependency(
                    Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_REQUIRES,
                    new Kwf_Assets_Dependency_File_Scss($this->_providerList, substr($dependencyName, 0, -15) . '.scss')
                );
            }
            return $ret;
        }
        return null;
    }
}

Fix scss files getting included twice in commonjs when using underscore.tpl


<?php namespace Destiny;

// TODO: Make all tests work offline (Guzzle mocking, Response forging)

class TestCase extends \PHPUnit_Framework_TestCase {

    /**
     * A client instance to use in tests.
     *
     * @var \Destiny\Client
     */
    public $destiny;

    /**
     * A player to test on.
     *
     * @var \Destiny\Game\Player
     */
    public $player;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->destiny = new Client;

        $this->player = $this->destiny->fetchPlayer('aFreshMelon', 1);
    }

}

<?php namespace Destiny;

class TestCase extends \PHPUnit_Framework_TestCase {

    /**
     * A client instance to use in tests.
     *
     * @var \Destiny\Client
     */

    // TODO: Make all tests work offline (Guzzle mocking, Response forging)
    public $destiny;

    /**
     * A player to test on.
     *
     * @var \Destiny\Game\Player
     */
    public $player;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->destiny = new Client;

        $this->player = $this->destiny->fetchPlayer('aFreshMelon', 1);
    }

}

Move the TODO to the location where it should applied


<?php

use Mdd\QueryBuilder\Type;
use Mdd\QueryBuilder\Types;
use Mdd\QueryBuilder\Conditions;
use Mdd\QueryBuilder\Tests\Escapers\SimpleEscaper;

class DifferentTest extends PHPUnit_Framework_TestCase
{
    protected
        $escaper;

    protected function setUp()
    {
        $this->escaper = new SimpleEscaper();
    }

    /**
     * @dataProvider providerTestDifferent
     */
    public function testDifferent($expected, $column, Type $type)
    {
        $condition = new Conditions\Different($column, $type);

        $this->assertSame($expected, $condition->toString($this->escaper));
    }

    public function providerTestDifferent()
    {
        return array(
            'simple string' => array("name != 'poney'", 'name', new Types\String('poney')),
            'empty string' => array("name != ''", 'name', new Types\String('')),

            'simple int' => array("id != 42", 'id', new Types\Integer(42)),
            'empty int' => array("id != 0", 'id', new Types\Integer('')),

            'empty column name' => array('', '', new Types\Integer(42)),
        );
    }
}

<?php

use Mdd\QueryBuilder\Type;
use Mdd\QueryBuilder\Types;
use Mdd\QueryBuilder\Conditions;
use Mdd\QueryBuilder\Tests\Escapers\SimpleEscaper;

class DifferentTest extends PHPUnit_Framework_TestCase
{
    protected
        $escaper;

    protected function setUp()
    {
        $this->escaper = new SimpleEscaper();
    }

    /**
     * @dataProvider providerTestDifferent
     */
    public function testDifferent($expected, $column, Type $type)
    {
        $condition = new Conditions\Different($column, $type);

        $this->assertSame($expected, $condition->toString($this->escaper));
    }

    public function providerTestDifferent()
    {
        return array(
            'simple string' => array("name != 'poney'", 'name', new Types\String('poney')),
            'empty string' => array("name != ''", 'name', new Types\String('')),

            'simple int' => array("id != 42", 'id', new Types\Integer(42)),
            'empty int' => array("id != 0", 'id', new Types\Integer('')),

            'simple datetime' => array("date != '2014-12-01 13:37:42'", 'date', new Types\Datetime('2014-12-01 13:37:42')),
            'empty datetime' => array("date != ''", 'date', new Types\Datetime('')),

            'empty column name' => array('', '', new Types\Integer(42)),
        );
    }
}

Add Condition\Different test for type Datetime


    /**
     * Creates a new {{ entity }}
     *
{% if 'annotation' == format %}
     * @Route("/", name="{{ route_name_prefix }}_create")
     * @Method("POST")
{% endif %}
     *
     * @Hydra\Operation(expect = "{{ namespace }}\Entity\{{ entity }}")
     *
     * @return {{ namespace }}\Entity\{{ entity }}
     */
    public function collectionPostAction(Request $request)
    {
        $entity = $this->deserialize($request->getContent(), '{{ namespace }}\Entity\{{ entity }}');

        if (false !== ($errors = $this->validate($entity))) {
            return $errors;
        }

        $em = $this->getDoctrine()->getManager();
        $em->persist($entity);
        $em->flush();

{% if 'entity_get' in actions %}
        $iri = $this->generateUrl('{{ route_name_prefix }}_retrieve', array('id' => $entity->getId()), true);

        $response = new JsonLdResponse(
            $this->serialize($entity),
            201,
            array('Content-Location' => $iri)
        );
{% else %}
        return new JsonLdResponse('', 201);
{% endif %}
    }

    /**
     * Creates a new {{ entity }}
     *
{% if 'annotation' == format %}
     * @Route("/", name="{{ route_name_prefix }}_create")
     * @Method("POST")
{% endif %}
     *
     * @Hydra\Operation(expect = "{{ namespace }}\Entity\{{ entity }}")
     *
     * @return {{ namespace }}\Entity\{{ entity }}
     */
    public function collectionPostAction(Request $request)
    {
        $entity = $this->deserialize($request->getContent(), '{{ namespace }}\Entity\{{ entity }}');

        if (false !== ($errors = $this->validate($entity))) {
            return $errors;
        }

        $em = $this->getDoctrine()->getManager();
        $em->persist($entity);
        $em->flush();

{% if 'entity_get' in actions %}
        $iri = $this->generateUrl('{{ route_name_prefix }}_retrieve', array('id' => $entity->getId()), true);

        $response = new JsonLdResponse(
            $this->serialize($entity),
            201,
            array('Content-Location' => $iri)
        );

        return $response;
{% else %}
        return new JsonLdResponse('', 201);
{% endif %}
    }

Bugfix: Add missing return statement in collectionPostAction skeleton


<?php
	add_action( 'wp_ajax_form_to_disk', 'form_to_disk' );
	add_action( 'wp_ajax_nopriv_form_to_disk', 'form_to_disk' );

	$f2d_option = get_option( 'f2d_options', '' );

	function form_to_disk() {

		global $f2d_option;
		date_default_timezone_set('America/Los_Angeles');

		if ( isset( $_POST[ 'marker' ] ) && 'sweepstakes' == $_POST[ 'marker' ] ) {
			$protected_dir = ABSPATH . trailingslashit( $f2d_option[ 'path' ] );
			$form_data	   = trim( $_POST[ 'firstName' ] ) . ',';
			$form_data    .= trim( $_POST[ 'lastName' ] ) . ',';
			$form_data    .= trim( $_POST[ 'email' ] );
			$entries       = fopen( $protected_dir . $f2d_option[ 'filename' ], 'a' )
				or die( 'Unable to process that request' );
			$txt           = date( 'Ymd' );
			$txt          .= ',';
			$txt          .= $form_data;
			fwrite( $entries, $txt . PHP_EOL );
			fclose( $entries );
			die();
		}
	}

<?php
	add_action( 'wp_ajax_form_to_disk', 'form_to_disk' );
	add_action( 'wp_ajax_nopriv_form_to_disk', 'form_to_disk' );

	$f2d_option = get_option( 'f2d_options', '' );

	function form_to_disk() {

		global $f2d_option;
		date_default_timezone_set( 'America/Los_Angeles' );

		if ( isset( $_POST[ 'marker' ] ) && 'sweepstakes' == $_POST[ 'marker' ] ) {
			$protected_dir = ABSPATH . trailingslashit( $f2d_option[ 'path' ] );
			$form_data	   = trim( $_POST[ 'firstName' ] ) . ',';
			$form_data    .= trim( $_POST[ 'lastName' ] ) . ',';
			$form_data    .= trim( $_POST[ 'email' ] ) . ',';
			$form_data    .= trim( $_POST[ 'pageId' ] );
			$entries       = fopen( $protected_dir . $f2d_option[ 'filename' ], 'a' )
				or die( 'Unable to process that request' );
			$txt           = date( 'Ymd' );
			$txt          .= ',';
			$txt          .= $form_data;
			fwrite( $entries, $txt . PHP_EOL );
			fclose( $entries );
			die();
		}
	}

Include marker for form type

Include marker for form type


<?php
namespace Concrete\Core\Permission\Response;
use Page;
use User;
use Group;
use PermissionKey;
use Permissions;
class GroupTreeNodeResponse extends TreeNodeResponse {

	public function canEditTreeNodePermissions() {
		return $this->validate('edit_group_permissions');
	}

	public function canViewTreeNode() {
		$c = Page::getByPath('/dashboard/users/groups');
		$cp = new Permissions($c);
		return $cp->canViewPage();
	}

	public function canDuplicateTreeNode() {
		return false;
	}

	public function canEditTreeNode() {
		return $this->validate('edit_group');
	}

	public function canAddTreeSubNode() {
		return $this->validate('add_sub_group');
	}

	public function canDeleteTreeNode() {
		return false;
	}

}

<?php
namespace Concrete\Core\Permission\Response;
use User;
use Group;
use PermissionKey;
use TaskPermission;
class GroupTreeNodeResponse extends TreeNodeResponse {

	public function canEditTreeNodePermissions() {
		return $this->validate('edit_group_permissions');
	}

	public function canViewTreeNode() {
		$tp = new TaskPermission();
		return $tp->canAccessGroupSearch();
	}

	public function canDuplicateTreeNode() {
		return false;
	}

	public function canEditTreeNode() {
		return $this->validate('edit_group');
	}

	public function canAddTreeSubNode() {
		return $this->validate('add_sub_group');
	}

	public function canDeleteTreeNode() {
		return false;
	}

}

Check task permission it the user can view group tree


                    <div id="<?php echo $id ?>_content" class="<?php echo $group ? 'smallbox' : 'stuffbox' ?>">

                            <label for="<?php echo $id ?>"><?php echo $title ?>

                                <input type="text" name="<?php echo $id ?>" id="<?php echo $id ?>" value="<?php echo $val ?>" readonly="readonly" />
                                <?php if (current_user_can('upload_files')) : ?>
                                <div id="wp-<?php echo $id ?>-editor-tools" class="wp-editor-tools hide-if-no-js">
                                    <?php do_action('media_buttons', $id) ?>

                                <?php else: ?>
                                    <?php _e('It seems you are not able to upload files.') ?>
                                <?php endif ?>

                            <?php if (!empty($val)): ?>

                                    <a href="<?php echo $val ?>" target="_blank">
                                        <img src="<?php echo $val ?>" alt="" />

                                    <a href="<?php echo $val ?>" target="_blank">
                                        <?php _e('See image in its real sizes.') ?>

                            <?php endif ?>

<?php echo $description ?>

                    <div id="<?php echo $id ?>_content" class="<?php echo $group ? 'smallbox' : 'stuffbox' ?>">

                            <label for="<?php echo $id ?>"><?php echo $title ?>

                                <input type="text" name="<?php echo $id ?>" id="<?php echo $id ?>" value="<?php echo $val ?>" readonly="readonly" />
                                <?php if (current_user_can('upload_files')) : ?>
                                <div id="wp-<?php echo $id ?>-editor-tools" class="wp-editor-tools customized hide-if-no-js">
                                    <?php do_action('media_buttons', $id) ?>

                                <?php else: ?>
                                    <?php _e('It seems you are not able to upload files.') ?>
                                <?php endif ?>

                            <?php if (!empty($val)): ?>

                                    <a href="<?php echo $val ?>" target="_blank">
                                        <img src="<?php echo $val ?>" alt="" />

                                    <a href="<?php echo $val ?>" target="_blank">
                                        <?php _e('See image in its real sizes.') ?>

                            <?php endif ?>

<?php echo $description ?>

Add new css class to new WP 3.5 controls


<?php

use Illuminate\Database\Seeder;

class ForumSeeder extends Seeder
{
    public function run()
    {
		$faker = Faker\Factory::create();

        for ($t = 1; $t <= 10; $t++) {
            factory('App\Data\Topic')->create();
        }

		for ($d = 1; $d <= 50; $d++) {
			$discussion = factory('App\Data\Discussion')->create([
				'user_id' => $faker->numberBetween(1, 102),
                'topic_id' => $faker->numberBetween(1, 10),
			]);

			for ($r = 0; $r <= $faker->numberBetween(0, 10); $r++) {
				factory('App\Data\Reply')->create([
					'discussion_id' => $discussion->id,
					'user_id' => $faker->numberBetween(1, 102),
				]);
			}
		}
    }
}

<?php

use Illuminate\Database\Seeder;

class ForumSeeder extends Seeder
{
    public function run()
    {
		$faker = Faker\Factory::create();

        for ($t = 1; $t <= 10; $t++) {
            factory('App\Data\Topic')->create();
        }

		for ($d = 1; $d <= 50; $d++) {
			$discussion = factory('App\Data\Discussion')->create([
				'user_id' => $faker->numberBetween(1, 100),
                'topic_id' => $faker->numberBetween(1, 10),
			]);

			for ($r = 0; $r <= $faker->numberBetween(0, 10); $r++) {
				factory('App\Data\Reply')->create([
					'discussion_id' => $discussion->id,
					'user_id' => $faker->numberBetween(1, 100),
				]);
			}
		}
    }
}

Fix a STUPID issue with the forum seeder


<?php
# Copyright © 2012 Martin Ueding <dev@martin-ueding.de>

class BookmarkHelper extends AppHelper {
	var $helpers = array('Html');

	function print_bookmark($that, $bookmark) {
		if (Configure::read('favicon.show')) {
			echo '<img width="16" height="16" src="data:image/ico;base64,'
				.$this->requestAction('/bookmarks/favicon/'.$bookmark['id'])
				.'" />';
			echo ' ';
		}

		echo $that->Html->link($bookmark['title'],
			array('controller' => 'bookmarks', 'action' => 'visit', $bookmark['id']),
			array('class' => 'bookmark_link', 'title' => $bookmark['url']));
		echo ' ';

		echo $that->Html->link(__('View', true),
			array('controller' => 'bookmarks', 'action' => 'view', $bookmark['id']),
			array('class' => 'edit_option'));
		echo ' ';
	}
}

<?php
# Copyright © 2012 Martin Ueding <dev@martin-ueding.de>

class BookmarkHelper extends AppHelper {
	var $helpers = array('Html');

	function print_bookmark($that, $bookmark) {
		echo $that->favicon($bookmark);

		echo $that->Html->link($bookmark['title'],
			array('controller' => 'bookmarks', 'action' => 'visit', $bookmark['id']),
			array('class' => 'bookmark_link', 'title' => $bookmark['url']));
		echo ' ';

		echo $that->Html->link(__('View', true),
			array('controller' => 'bookmarks', 'action' => 'view', $bookmark['id']),
			array('class' => 'edit_option'));
		echo ' ';
	}

	function favicon($bookmark) {
		$html = '';

		if (Configure::read('favicon.show')) {
			$html .= '<img width="16" height="16" src="data:image/ico;base64,'
				.$this->requestAction('/bookmarks/favicon/'.$bookmark['id'])
				.'" />';
			$html .= ' ';
		}

		return $html;
	}
}

Put favicon into separate function

Put favicon into separate function


<?php

namespace Stencil;

class Post {
  public $title;
  public $layout;
  public $content;
  public $date;

  function __construct($title = '', $date = '', $layout = '', $content = '')
  {
    $this->title = $title;
    $this->layout = $layout;
    $this->content = $content;
    $this->date = time($date);
  }

  public function parse($content) {
    $meta = $this->getYamlData($content);
    return $meta;
  }

  private function getYamlData($content) {
    preg_match('/-{3}\n([\S\s]+)\n-{3}\n/', $content, $match);
    return $match[1];
  }
}

<?php

namespace Stencil;

class Post {
  public $title;
  public $layout;
  public $content;
  public $date;

  function __construct($title = '', $date = '', $layout = '', $content = '')
  {
    $this->title = $title;
    $this->layout = $layout;
    $this->content = $content;
    $this->date = time($date);
  }

  public function parse($content) {
    $meta = $this->_getYamlData($content);
    return $meta;
  }

  private function _getYamlData($content) {
    preg_match('/-{3}\n([\S\s]+)\n-{3}\n/', $content, $match);
    return $match[1];
  }
}

Change naming for code style

Change naming for code style
[skip ci]


<?php

namespace Zeropingheroes\Lanager\Http\Controllers\Api;

use Illuminate\Http\Request;
use Zeropingheroes\Lanager\Http\Controllers\Controller;
use Zeropingheroes\Lanager\Http\Resources\Event as EventResource;
use Zeropingheroes\Lanager\Event;

class EventController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @param Request $request
     * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
     */
    public function index(Request $request)
    {
        $events = Event::where('published', 1);

        if ($request->filled('after')) {
            $events->where('start', '>', $request->after);
            $events->orWhere('end', '>', $request->after);
        }

        if ($request->filled('limit')) {
            $events->limit($request->limit);
        }

        $events = $events->orderBy('start')->get();

        return EventResource::collection($events);
    }

    /**
     * Display the specified resource.
     *
     * @param  \Zeropingheroes\Lanager\Event $event
     * @return EventResource
     */
    public function show(Event $event)
    {
        $event->load('lan');
        return new EventResource($event);
    }
}

<?php

namespace Zeropingheroes\Lanager\Http\Controllers\Api;

use Illuminate\Http\Request;
use Zeropingheroes\Lanager\Http\Controllers\Controller;
use Zeropingheroes\Lanager\Http\Resources\Event as EventResource;
use Zeropingheroes\Lanager\Event;

class EventController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @param Request $request
     * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
     */
    public function index(Request $request)
    {
        $events = Event::where('published', true);

        if ($request->filled('after')) {
            $events->where(function ($query) use ($request) {
                $query->where('start', '>', $request->after)
                      ->orWhere('end', '>', $request->after);
            });
        }

        if ($request->filled('limit')) {
            $events->limit($request->limit);
        }

        $events = $events->orderBy('start')->get();

        return EventResource::collection($events);
    }

    /**
     * Display the specified resource.
     *
     * @param  \Zeropingheroes\Lanager\Event $event
     * @return EventResource
     */
    public function show(Event $event)
    {
        $event->load('lan');
        return new EventResource($event);
    }
}

Fix unpublished events showing when querying for events after a given time


<?php

use React\HttpClient\ConnectionManager;
use React\Dns\Resolver\Resolver;
use React\EventLoop\LoopInterface;

class Factory
{
    public function __construct(LoopInterface $loop, Resolver $resolver)
    {
        $this->loop = $loop;
        $this->resolver = $resolver;
    }

    public function createClient($socksHost, $socksPort)
    {
//         $connector = new ConnectionManager($this->loop, $this->resolver);
        $connector = new ConnectionManagerFsockopen($this->loop);
        return new Client($this->loop, $connector, $this->resolver, $socksHost, $socksPort);
    }
}

<?php

use React\HttpClient\ConnectionManager;
use React\Dns\Resolver\Resolver;
use React\EventLoop\LoopInterface;

class Factory
{
    public function __construct(LoopInterface $loop, Resolver $resolver)
    {
        $this->loop = $loop;
        $this->resolver = $resolver;
    }

    public function createClient($socksHost, $socksPort)
    {
        $connector = new ConnectionManager($this->loop, $this->resolver);
//         $connector = new ConnectionManagerFsockopen($this->loop);
        return new Client($this->loop, $connector, $this->resolver, $socksHost, $socksPort);
    }
}

Use async connection manager from react/http-client


<?php
	namespace Service\Auth;

	use Model\User;
	use Psr\Container\ContainerInterface;

	interface AuthInterface {
		/**
		 * @param \Psr\Container\ContainerInterface $container
		 */
		public function __construct(ContainerInterface $container);

		/**
		 * @return null|\Model\User
		 */
		public function user(): User;

		/**
		 * @return bool
		 */
		public function check(): bool;

		/**
		 * @return bool
		 */
		public function isAdmin(): bool;

		/**
		 * @param string $username
		 * @param string $password
		 * @param bool $rememberMe
		 *
		 * @return bool
		 */
		public function attempt(string $username, string $password, bool $rememberMe = false): bool;

		/**
		 * @return void
		 */
		public function logout(): void;
	}
?>

<?php
	namespace Service\Auth;

	use Model\User;
	use Psr\Container\ContainerInterface;

	interface AuthInterface {
		/**
		 * @param \Psr\Container\ContainerInterface $container
		 */
		public function __construct(ContainerInterface $container);

		/**
		 * @return null|\Model\User
		 */
		public function user(): ?User;

		/**
		 * @return bool
		 */
		public function check(): bool;

		/**
		 * @return bool
		 */
		public function isAdmin(): bool;

		/**
		 * @param string $username
		 * @param string $password
		 * @param bool $rememberMe
		 *
		 * @return bool
		 */
		public function attempt(string $username, string $password, bool $rememberMe = false): bool;

		/**
		 * @return void
		 */
		public function logout(): void;
	}
?>

Add missing return type nullable

Add missing return type nullable