<?php

namespace Oro\Bundle\FormBundle\Form\Extension;

use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class RandomIdExtension extends AbstractTypeExtension
{
    /**
     * {@inheritdoc}
     */
    public function getExtendedType()
    {
        return 'form';
    }

    /**
     * {@inheritdoc}
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array('random_id' => false));
    }

    /**
     * {@inheritdoc}
     */
    public function finishView(FormView $view, FormInterface $form, array $options)
    {
        if (!empty($options['random_id']) && isset($view->vars['id'])) {
            $view->vars['id'] .= '_' . uniqid();
        }
    }
}

<?php

namespace Oro\Bundle\FormBundle\Form\Extension;

use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class RandomIdExtension extends AbstractTypeExtension
{
    /**
     * {@inheritdoc}
     */
    public function getExtendedType()
    {
        return 'form';
    }

    /**
     * {@inheritdoc}
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array('random_id' => true));
    }

    /**
     * {@inheritdoc}
     */
    public function finishView(FormView $view, FormInterface $form, array $options)
    {
        if (!empty($options['random_id']) && isset($view->vars['id'])) {
            $view->vars['id'] .= '_' . uniqid();
        }
    }
}

BAP-8152: Make random_id = true by default for all FormTypes


<?php

namespace Elfiggo\Brobdingnagian\Report;

use Elfiggo\Brobdingnagian\Exception\ClassSizeTooLarge;

class ExceptionHandler implements Handler
{
    public function act($message, $class)
    {
        switch($class) {
            case 'ClassSize': throw new ClassSizeTooLarge($message);break;
            default:break;
        }
    }
}

<?php

namespace Elfiggo\Brobdingnagian\Report;

use Elfiggo\Brobdingnagian\Exception\ClassSizeTooLarge;

class ExceptionHandler implements Handler
{
    public function act($message, $class)
    {
        switch($class) {
            case 'Elfiggo\Brobdingnagian\Detector\ClassSize':
                throw new ClassSizeTooLarge($message);
                break;
            default:break;
        }
    }
}

Update class name for exception handler

Update class name for exception handler


<?php namespace Illuminate\Database\Connectors;

class SQLiteConnector extends Connector implements ConnectorInterface {

	/**
	 * Establish a database connection.
	 *
	 * @param  array  $options
	 * @return PDO
	 */
	public function connect(array $config)
	{
		$options = $this->getOptions($config);

		// SQLite supports "in-memory" databases that only last as long as the owning
		// connection does. These are useful for tests or for short lifetime store
		// querying. In-memory databases may only have a single open connection.
		if ($config['database'] == ':memory:')
		{
			return $this->createConnection('sqlite::memory:', $config, $options);
		}

		$path = realpath($config['database']);

		return $this->createConnection("sqlite:{$path}", $config, $options);
	}

}

<?php namespace Illuminate\Database\Connectors;

class SQLiteConnector extends Connector implements ConnectorInterface {

	/**
	 * Establish a database connection.
	 *
	 * @param  array  $options
	 * @return PDO
	 */
	public function connect(array $config)
	{
		$options = $this->getOptions($config);

		// SQLite supports "in-memory" databases that only last as long as the owning
		// connection does. These are useful for tests or for short lifetime store
		// querying. In-memory databases may only have a single open connection.
		if ($config['database'] == ':memory:')
		{
			return $this->createConnection('sqlite::memory:', $config, $options);
		}

		$path = realpath($config['database']);

		// Here we'll verify that the SQLite database exists before we gooing further
		// as the developer probably wants to know if the database exists and this
		// SQLite driver will not throw any exception if it does not by default.
		if ($path === false)
		{
			throw new \InvalidArgumentException("Database does not exist.");
		}

		return $this->createConnection("sqlite:{$path}", $config, $options);
	}

}

Throw exception if SQLite database doesn't exist.


<?php
/**
 * www
 */
namespace Ojs\AnalyticsBundle\Updater;
use Documents\UserRepository;
use Ojs\JournalBundle\Entity\JournalRole;
class MemberCountUpdater extends Updater implements UpdaterInterface
{
    public function update()
    {
        // TODO: Implement update() method.
    }
    /**
     * @return array
     */
    public function count()
    {
        $readerRole = $this->em->getRepository("OjsUserBundle:Role")->findOneBy(['role' => 'ROLE_AUTHOR']);
        /** @var UserRepository $ue */
        $ue = $this->em->getRepository('Ojs\JournalBundle\Entity\JournalRole');
        $all = $ue->findBy(['roleId' => $readerRole->getId()]);
        $journalUsers = [];
        foreach ($all as $r) {
            /** @var JournalRole $r */
            if (isset($journalUsers[$r->getJournalId()])
                && in_array($r->getUserId(), $journalUsers[$r->getJournalId()])
            ) {
                continue;
            }
            $journalUsers[$r->getJournalId()][] = $r->getUserId();
        }
        return $journalUsers;
    }
    /**
     * @return string
     */
    public function getObject()
    {
        return 'Ojs\JournalBundle\Entity\Journal';
    }
}

Bring back the file which PhpStorm ate, see commit 5858e9a


<?php
include_once 'overcast.php';
include_once 'sonos.php';

switch ($_GET['method']) {
  case 'login':
    echo json_encode(login($_GET['email'], $_GET['password']));
    break;
  case 'fetchAccount':
    echo json_encode(fetchAccount($_GET['token']));
    break;
  case 'fetchPodcast':
    echo json_encode(fetchPodcast($_GET['id']));
    break;
  case 'fetchEpisode':
    echo json_encode(fetchEpisode($_GET['id']));
    break;
  default:
    http_response_code(400);
}
?>

<?php
include_once 'overcast.php';
include_once 'sonos.php';

switch ($_GET['method']) {
  case 'login':
    echo json_encode(login($_GET['email'], $_GET['password']));
    break;
  case 'fetchAccount':
    echo json_encode(fetchAccount($_GET['token']));
    break;
  case 'fetchPodcast':
    echo json_encode(fetchPodcast($_GET['id']));
    break;
  case 'fetchEpisode':
    echo json_encode(fetchEpisode($_GET['id']));
    break;
  case 'getLastUpdate':
    $params = new StdClass();
    $params->sessionId = $_GET['sessionId'];
    $sonos = new Sonos($params);
    $sonos->credentials($params);
    echo json_encode($sonos->getLastUpdate($params));
    break;
  case 'getMetadata':
    $params = new StdClass();
    $params->sessionId = $_GET['sessionId'];
    $params->count = intval($_GET['count']);
    $params->id = $_GET['id'];
    $params->index = intval($_GET['index']);
    $sonos = new Sonos($params);
    $sonos->credentials($params);
    echo json_encode($sonos->getMetadata($params));
    break;
  default:
    http_response_code(400);
}
?>

Add sonos soap response debugging

Add sonos soap response debugging


<?php
namespace Aura\Project_Kernel\_Config;

use Aura\Di\Config;
use Aura\Di\Container;

class Common extends Config
{
    public function define(Container $di)
    {
        $di->set('logger', $di->lazyNew('Psr\Log\NullLogger'));
    }
}

<?php
namespace Aura\Project_Kernel\_Config;

use Aura\Di\Config;
use Aura\Di\Container;

class Common extends Config
{
    public function define(Container $di)
    {
        $di->set('aura/project-kernel:logger', $di->lazyNew('Psr\Log\NullLogger'));
    }
}

Change to new service name

Change to new service name


<?php

require_once(__DIR__.'/../autoload.php');

// Create the validator for incoming requests.
$requestValidator = new \MessageBird\RequestValidator('YOUR_SIGNING_KEY');

// Set up the signed request from the PHP global variables.
$request = \MessageBird\Objects\SignedRequest::createFromGlobals();

if (!$requestValidator->verify($request)) {
    // The request was invalid, so respond accordingly.
    http_response_code(412);
}

<?php

require_once(__DIR__.'/../autoload.php');

// Create the validator for incoming requests.
$requestValidator = new \MessageBird\RequestValidator('YOUR_SIGNING_KEY');

// Set up the signed request from the PHP global variables.
try {
    $request = \MessageBird\Objects\SignedRequest::createFromGlobals();
} catch (\MessageBird\Exceptions\ValidationException $e) {
    // The request was missing expected values, so respond accordingly.
    http_response_code(412);
}

if (!$requestValidator->verify($request)) {
    // The request was invalid, so respond accordingly.
    http_response_code(412);
}

Update SignedRequest example to handle ValidationExceptions

If expected values are missing or invalid when calling createFromGlobals() an exception is thrown.
The example now demonstrates how an implementation can handle this and respond cleanly.


<?php

namespace Korobi\WebBundle\Extension;

class ExtensionTwigFunctions extends \Twig_Extension {

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

    public function getFunctions() {
        return [
            new \Twig_SimpleFunction('cahFullCard', [$this, 'cahFullCard']),
            new \Twig_SimpleFunction('cahPlays', [$this, 'cahPlays'], [
                'is_safe' => ['html']
            ]),
            new \Twig_SimpleFunction('gmdate', [$this, 'gmdate']),
        ];
    }

    public function cahFullCard($blackCard, $data) {
        foreach($data as $item) {
            $blackCard = preg_replace('/<BLANK>/', '' . $item . '', $blackCard, 1);
        }

        return $blackCard;
    }

    public function cahPlays($blackCard, $plays) {
        dump($plays);

        $result = '';

        foreach($plays as $play) {
            $result .= key($plays) . ': ';
            $result .= preg_replace('/<BLANK>/', '' . $play[0] . '', $blackCard, 1);;
            $result .= '

';
            next($plays);
        }

        return $result;
    }

    public function gmdate($format, $timestamp = null) {
        return gmdate($format, $timestamp);
    }
}

<?php

namespace Korobi\WebBundle\Extension;

class ExtensionTwigFunctions extends \Twig_Extension {

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

    public function getFunctions() {
        return [
            new \Twig_SimpleFunction('cahFullCard', [$this, 'cahFullCard']),
            new \Twig_SimpleFunction('cahPlays', [$this, 'cahPlays'], [
                'is_safe' => ['html']
            ]),
            new \Twig_SimpleFunction('gmdate', [$this, 'gmdate']),
        ];
    }

    public function cahFullCard($blackCard, $data) {
        foreach($data as $item) {
            $blackCard = preg_replace('/<BLANK>/', '' . $item . '', $blackCard, 1);
        }

        return $blackCard;
    }

    public function cahPlays($blackCard, $plays) {
        $result = '';

        foreach($plays as $play) {
            $result .= key($plays) . ': ';
            $result .= preg_replace('/<BLANK>/', '' . $play[0] . '', $blackCard, 1);;
            $result .= '

';
            next($plays);
        }

        return $result;
    }

    public function gmdate($format, $timestamp = null) {
        return gmdate($format, $timestamp);
    }
}

REMOVE DEBUG CODE FROM PRODUCTION *whistles innocently*


<?php
/**
 * Mailgun plugin for CakePHP 3
 * Copyright (c) Narendra Vaghela (http://www.narendravaghela.com)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.md
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Narendra Vaghela (http://www.narendravaghela.com)
 * @link          https://github.com/narendravaghela/cakephp-mailgun
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
namespace MailgunEmail\Mailer\Exception;

use Cake\Core\Exception\Exception;

/**
 * Missing Credentials exception - used when API Key or Domain is not set.
 */
class MissingCredentialsException extends Exception
{

    /**
     * {@inheritDoc}
     */
    protected $_messageTemplate = 'Mailgun %s is not set.';

    /**
     * {@inheritDoc}
     */
//    public function __construct($message, $code = 404)
//    {
//        parent::__construct($message, $code);
//    }
}

<?php

/**
 * Mailgun plugin for CakePHP 3
 * Copyright (c) Narendra Vaghela (http://www.narendravaghela.com)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.md
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Narendra Vaghela (http://www.narendravaghela.com)
 * @link          https://github.com/narendravaghela/cakephp-mailgun
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */

namespace MailgunEmail\Mailer\Exception;

use Cake\Core\Exception\Exception;

/**
 * Missing Credentials exception - used when API Key or Domain is not set.
 */
class MissingCredentialsException extends Exception
{

    /**
     * {@inheritDoc}
     */
    protected $_messageTemplate = 'Mailgun %s is not set.';

}

Remove commented code from exception

Remove commented code from exception


<?php

namespace Oro\Component\Layout\Extension\Core;

use Oro\Component\Layout\Block\Type;
use Oro\Component\Layout\Extension\AbstractExtension;

class CoreExtension extends AbstractExtension
{
    protected function loadTypes()
    {
        return [
            new Type\BaseType(),
            new Type\ContainerType()
        ];
    }
}

<?php

namespace Oro\Component\Layout\Extension\Core;

use Oro\Component\Layout\Block\Type;
use Oro\Component\Layout\Extension\AbstractExtension;

class CoreExtension extends AbstractExtension
{
    /**
     * {@inheritdoc}
     */
    protected function loadTypes()
    {
        return [
            new Type\BaseType(),
            new Type\ContainerType()
        ];
    }
}

BAP-7367: Implement an engine to allow add extensions to the layout engine. Add missed inheritdoc


<?php

namespace App\Http\Controllers\Api\Doc;

/**
 * @OA\Info(title="Hammer CRM API", version="1.0")
 */
class DocGeneratorController
{
    /**
     * @OA\Get(
     *     path="/resource.json",
     *     @OA\Response(response="200", description="An example resource")
     * )
     */
    public function render()
    {
        $app_path = base_path();
        $openapi = OpenApi\Generator::scan([
            $app_path.DIRECTORY_SEPARATOR.'Http'.DIRECTORY_SEPARATOR.'Controllers'.DIRECTORY_SEPARATOR.'Api',
        ]);

        return response()->json($openapi->toJson());
    }
}

<?php

namespace App\Http\Controllers\Api\Doc;

use Illuminate\Http\JsonResponse;

/**
 * @OA\Info(title="Hammer CRM API", version="1.0")
 */
class DocGeneratorController
{
    /**
     * @OA\Get(
     *     path="/resource.json",
     *     @OA\Response(response="200", description="API JSON Specification OpenAPI format")
     * )
     */
    public function render() : JsonResponse
    {
        $app_path = app_path();
        $openapi = \OpenApi\Generator::scan([
            $app_path.DIRECTORY_SEPARATOR.'Http'.DIRECTORY_SEPARATOR.'Controllers'.DIRECTORY_SEPARATOR.'Api',
        ]);
        return response()->json($openapi->toJson());
    }
}

Fix API Doc json generator

Fix API Doc json generator


<?php

namespace Nascom\TeamleaderApiClient\Request\Creditnote;

use Nascom\TeamleaderApiClient\Request\AbstractPostRequest;

/**
 * Class RetrieveCreditnoteRequest
 *
 * @package Nascom\TeamleaderApiClient\Request\Creditnote
 */
class RetrieveCreditnoteRequest extends AbstractPostRequest
{
    /**
     * RetrieveCreditnoteRequest constructor.
     *
     * @param $credit_id
     * @param array $options
     */
    public function __construct($credit_id, array $options = [])
    {
        $this->options = $options;
        $this->setCreditnoteId($credit_id);
    }

    /**
     * @param $credit_id
     */
    public function setCreditnoteId($credit_id)
    {
        $this->options['credit_id'] = $credit_id;
    }

    /**
     * @return string
     */
    public function getUri()
    {
        return 'getCreditnote.php';
    }
}

<?php

namespace Nascom\TeamleaderApiClient\Request\Creditnote;

use Nascom\TeamleaderApiClient\Request\AbstractPostRequest;

/**
 * Class RetrieveCreditnoteRequest
 *
 * @package Nascom\TeamleaderApiClient\Request\Creditnote
 */
class RetrieveCreditnoteRequest extends AbstractPostRequest
{
    /**
     * RetrieveCreditnoteRequest constructor.
     *
     * @param $credit_id
     * @param array $options
     */
    public function __construct($credit_id, array $options = [])
    {
        $this->options = $options;
        $this->setCreditnoteId($credit_id);
    }

    /**
     * @param $credit_id
     */
    public function setCreditnoteId($credit_id)
    {
        $this->options['creditnote_id'] = $credit_id;
    }

    /**
     * @return string
     */
    public function getUri()
    {
        return 'getCreditnote.php';
    }
}

Fix bad request when retrieving creditnote detail

When retrieving a creditnote detail, the Teamleader API threw an error
400 (bad request) because the required option "creditnote_id" was
missing.

The RetrieveCreditnoteRequest class was using the "credit_id" option
intead of "creditnote_id".
Fixed!


<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link           http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright      Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license        http://framework.zend.com/license/new-bsd New BSD License
 */
namespace Zend\Stdlib\Hydrator\Filter;

use InvalidArgumentException;
use ReflectionException;
use ReflectionMethod;
use ReflectionParameter;

/**
 * Filter that includes methods which have no parameters or only optional parameters
 */
class OptionalParametersFilter implements FilterInterface
{
    /**
     * Map of methods already analyzed
     * by {@see \Zend\Stdlib\Hydrator\Filter\OptionalParametersFilter::filter()},
     * cached for performance reasons
     *
     * @var bool[]
     */
    private static $propertiesCache = array();

    /**
     * {@inheritDoc}
     */
    public function filter($property)
    {
        if (isset(static::$propertiesCache[$property])) {
            return static::$propertiesCache[$property];
        }

        try {
            $reflectionMethod = new ReflectionMethod($property);
        } catch (ReflectionException $exception) {
            throw new InvalidArgumentException(sprintf('Method %s doesn\'t exist', $property));
        }

        $mandatoryParameters = array_filter(
            $reflectionMethod->getParameters(),
            function (ReflectionParameter $parameter) {
                return ! $parameter->isOptional();
            }
        );

        return static::$propertiesCache[$property] = empty($mandatoryParameters);
    }
}

<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link           http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright      Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license        http://framework.zend.com/license/new-bsd New BSD License
 */
namespace Zend\Stdlib\Hydrator\Filter;

use InvalidArgumentException;
use ReflectionException;
use ReflectionMethod;
use ReflectionParameter;

/**
 * Filter that includes methods which have no parameters or only optional parameters
 */
class OptionalParametersFilter implements FilterInterface
{
    /**
     * Map of methods already analyzed
     * by {@see \Zend\Stdlib\Hydrator\Filter\OptionalParametersFilter::filter()},
     * cached for performance reasons
     *
     * @var bool[]
     */
    protected static $propertiesCache = array();

    /**
     * {@inheritDoc}
     */
    public function filter($property)
    {
        if (isset(static::$propertiesCache[$property])) {
            return static::$propertiesCache[$property];
        }

        try {
            $reflectionMethod = new ReflectionMethod($property);
        } catch (ReflectionException $exception) {
            throw new InvalidArgumentException(sprintf('Method %s doesn\'t exist', $property));
        }

        $mandatoryParameters = array_filter(
            $reflectionMethod->getParameters(),
            function (ReflectionParameter $parameter) {
                return ! $parameter->isOptional();
            }
        );

        return static::$propertiesCache[$property] = empty($mandatoryParameters);
    }
}

Fix possible undefined methods in inherited classes


<?php

namespace actsmart\actsmart\Actuators\WebChat;

class WebChatImageMessage extends WebChatMessage
{
    private $imgSrc = null;

    private $imgLink = null;

    /**
     * @param $imgSrc
     * @return $this
     */
    public function setImgSrc($imgSrc)
    {
        $this->imgSrc = $imgSrc;
        return $this;
    }

    /**
     * @param $imgLink
     * @return $this
     */
    public function setImgLink($imgLink)
    {
        $this->imgLink = $imgLink;
        return $this;
    }

    /**
     * @return null|string
     */
    public function getImgSrc()
    {
        return $this->imgSrc;
    }

    /**
     * @return null|string
     */
    public function getImgLink()
    {
        return $this->imgLink;
    }

    public function getMessageToPost()
    {
        return [
            'author' => 'them',
            'type' => 'image',
            'data' => [
                'img_src' => $this->getImgSrc(),
                'img_link' => $this->getImgLink()
            ]
        ];
    }
}

<?php

namespace actsmart\actsmart\Actuators\WebChat;

class WebChatImageMessage extends WebChatMessage
{
    private $imgSrc = null;

    private $imgLink = null;

    private $linkNewTab = true;

    /**
     * @param $imgSrc
     * @return $this
     */
    public function setImgSrc($imgSrc)
    {
        $this->imgSrc = $imgSrc;
        return $this;
    }

    /**
     * @param $imgLink
     * @return $this
     */
    public function setImgLink($imgLink)
    {
        $this->imgLink = $imgLink;
        return $this;
    }

    /**
     * @param $linkNewTab
     * @return $this
     */
    public function setLinkNewTab($linkNewTab)
    {
        $this->linkNewTab = $linkNewTab;
        return $this;
    }

    /**
     * @return null|string
     */
    public function getImgSrc()
    {
        return $this->imgSrc;
    }

    /**
     * @return null|string
     */
    public function getImgLink()
    {
        return $this->imgLink;
    }

    /**
     * @return bool
     */
    public function getLinkNewTab()
    {
        return $this->linkNewTab;
    }

    public function getMessageToPost()
    {
        return [
            'author' => 'them',
            'type' => 'image',
            'data' => [
                'img_src' => $this->getImgSrc(),
                'img_link' => $this->getImgLink(),
                'link_new_tab' => $this->getLinkNewTab()
            ]
        ];
    }
}

Add option to images links to open in parent tab or new tab


<?php

namespace Ilios\WebBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;

/**
 * Class DirectoryController
 * @package Ilios\WebBundle\Controller
 */
class DirectoryController extends Controller
{
    public function searchAction(Request $request)
    {
        $user = $this->get('security.token_storage')->getToken()->getUser();
        if (!$user->hasRole(['Developer'])) {
            throw new AccessDeniedException();
        }
        $results = [];

        if ($request->query->has('searchTerms')) {
            $searchTerms = explode(' ', $request->query->get('searchTerms'));

            $directory = $this->container->get('ilioscore.directory');
            $searchResults = $directory->find($searchTerms);

            if (is_array($searchResults)) {
                $results = $searchResults;
            }

        }

        return new JsonResponse(array('results' => $results));
    }
}

<?php

namespace Ilios\WebBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;

/**
 * Class DirectoryController
 * @package Ilios\WebBundle\Controller
 */
class DirectoryController extends Controller
{
    public function searchAction(Request $request)
    {
        $user = $this->get('security.token_storage')->getToken()->getUser();
        if (!$user->hasRole(['Developer'])) {
            throw new AccessDeniedException();
        }
        $results = [];

        if ($request->query->has('searchTerms')) {
            $searchTerms = explode(' ', $request->query->get('searchTerms'));

            $directory = $this->container->get('ilioscore.directory');
            $searchResults = $directory->find($searchTerms);

            if (is_array($searchResults)) {
                $results = $searchResults;
            }

        }
        $offset = $request->query->has('offset')?$request->query->get('offset'):0;
        $limit = $request->query->has('limit')?$request->query->get('limit'):count($results);
        $results = array_slice($results, $offset, $limit);

        return new JsonResponse(array('results' => $results));
    }
}

Add limit and offset options to directory search


<?php

namespace Omnipay\Mollie\Message;

/**
 * Mollie Fetch Transaction Request
 *
 * @method \Omnipay\Mollie\Message\FetchTransactionResponse send()
 */
class FetchTransactionRequest extends AbstractRequest
{
    public function getTransactionReference()
    {
        return $this->getParameter('transactionReference');
    }

    public function setTransactionReference($value)
    {
        return $this->setParameter('transactionReference', $value);
    }

    public function getData()
    {
        $this->validate('apiKey', 'transactionReference');

        $data = array();
        $data['id'] = $this->getTransactionReference();

        return $data;
    }

    public function sendData($data)
    {
        $httpResponse = $this->sendRequest('GET', '/payments/' . $data['id']);

        return $this->response = new FetchTransactionResponse($this, $httpResponse->json());
    }
}

<?php

namespace Omnipay\Mollie\Message;

/**
 * Mollie Fetch Transaction Request
 *
 * @method \Omnipay\Mollie\Message\FetchTransactionResponse send()
 */
class FetchTransactionRequest extends AbstractRequest
{
    public function getData()
    {
        $this->validate('apiKey', 'transactionReference');

        $data = array();
        $data['id'] = $this->getTransactionReference();

        return $data;
    }

    public function sendData($data)
    {
        $httpResponse = $this->sendRequest('GET', '/payments/' . $data['id']);

        return $this->response = new FetchTransactionResponse($this, $httpResponse->json());
    }
}

Remove get/setTransactionReference() as they are already defined in AbstractRequest


So OpenAustralia.org.au helped you find the facts - what next?

If you have a problem

... with a public body or organisation

The Ombudsman Association can help you find the right organisation to take your complaint to:

http://www.anzoa.com.au/for-complaints.html

... with how your MP is representing you

You can contact your MP using the details on their page at OpenAustralia.

Find your MP by entering your postcode.

If you want to know more

... about how how MPs vote

You can search votes and see how your MP has voted on the policies that matter to you at They Vote For You:

https://theyvoteforyou.org.au

... from a public authority

You can ask for information from public authorities using Right To Know. You can also view requests made by other people, and see the responses that they received:

https://www.righttoknow.org.au/

Add whitespace to make markup clearer (whitespace only)


    {{ trans('manager.vacancies.table.th.date') }}
    @foreach ($services as $service)
    {{ $service->name }}
    @endforeach

@foreach ($dates as $date => $vacancies)

        formatLocalized('%A %d %B') }}">{{ $date }}
    @foreach ($services as $service)
        @if(count($vacancies) > 0 && array_key_exists($service->slug, $vacancies))
             {!! Form::text("vacancy[$date][$service->id]", $vacancies[$service->slug]->capacity, array('class'=>'form-control', 'type' => 'numeric', 'step' => '1', 'placeholder'=> "$date {$service->name} ({$vacancies[$service->slug]->capacity})" )) !!}
        @else
             {!! Form::text("vacancy[$date][$service->id]", null, array('class'=>'form-control', 'placeholder'=> "$date {$service->name}" )) !!}
        @endif
    @endforeach

@endforeach

        {!! Button::primary(trans('manager.businesses.btn.update'))->submit() !!}
        {!! Button::normal(trans('manager.businesses.btn.return'))->asLinkTo(URL::previous()) !!}

    {{ trans('manager.vacancies.table.th.date') }}
    @foreach ($services as $service)
    {{ $service->name }}
    @endforeach

@foreach ($dates as $date => $vacancies)

        formatLocalized('%A %d %B') }}">{{ $date }}
    @foreach ($services as $service)
        @if(count($vacancies) > 0 && array_key_exists($service->slug, $vacancies))
             {!! Form::text("vacancy[$date][$service->id]", $vacancies[$service->slug]->capacity, array('class'=>'form-control', 'type' => 'numeric', 'step' => '1', 'placeholder'=> "$date {$service->name} ({$vacancies[$service->slug]->capacity})" )) !!}
        @else
             {!! Form::text("vacancy[$date][$service->id]", null, array('class'=>'form-control', 'placeholder'=> "$date {$service->name}" )) !!}
        @endif
    @endforeach

@endforeach

        {!! Button::primary(trans('manager.businesses.btn.update'))->block()->large()->submit() !!}

Remove incorrect return button, enhance submit


<?php
/**
 * Kodekit Platform - http://www.timble.net/kodekit
 *
 * @copyright	Copyright (C) 2011 - 2016 Johan Janssens and Timble CVBA. (http://www.timble.net)
 * @license		MPL v2.0 <https://www.mozilla.org/en-US/MPL/2.0>
 * @link		https://github.com/timble/kodekit-platform for the canonical source repository
 */

return array(

    'aliases'  => array(
        'application'       => 'com:application.dispatcher',
        'application.sites' => 'com:application.model.composite.sites',
        'translator'        => 'com:application.translator',

        'lib:dispatcher.router.route' => 'com:application.dispatcher.router.route',
    ),

    'identifiers' => array(

        'dispatcher' => array(
            'behaviors' => array('com:application.dispatcher.behavior.documentable')
        ),
    )
);

<?php
/**
 * Kodekit Platform - http://www.timble.net/kodekit
 *
 * @copyright	Copyright (C) 2011 - 2016 Johan Janssens and Timble CVBA. (http://www.timble.net)
 * @license		MPL v2.0 <https://www.mozilla.org/en-US/MPL/2.0>
 * @link		https://github.com/timble/kodekit-platform for the canonical source repository
 */

use Kodekit\Library;

return array(

    'priority' => Library\ObjectBootstrapperInterface::PRIORITY_LOW,
    'aliases'  => array(
        'application'       => 'com:application.dispatcher',
        'application.sites' => 'com:application.model.composite.sites',
        'translator'        => 'com:application.translator',

        'lib:dispatcher.router.route' => 'com:application.dispatcher.router.route',
    ),

    'identifiers' => array(

        'dispatcher' => array(
            'behaviors'=> array('decoratable' => array('decorators' => 'com:application.controller.document')),
        )
    )
);

Add the decoratable behavior to the dispatcher and add the document controller as decorator


<?php

namespace Illuminate\Encryption;

use RuntimeException;
use Illuminate\Support\Str;
use Illuminate\Support\ServiceProvider;

class EncryptionServiceProvider extends ServiceProvider
{
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton('encrypter', function ($app) {
            $config = $app->make('config')->get('app');

            // If the key starts with "base64:", we will need to decode the key before handing
            // it off to the encrypter. Keys may be base-64 encoded for presentation and we
            // want to make sure to convert them back to the raw bytes before encrypting.
            if (Str::startsWith($key = $config['key'], 'base64:')) {
                $key = base64_decode(substr($key, 7));
            }

            if (is_null($key) || $key === '') {
                throw new RuntimeException(
                    'The application encryption key is missing. Run php artisan key:generate to generate it.'
                );
            }

            return new Encrypter($key, $config['cipher']);
        });
    }
}

<?php

namespace Illuminate\Encryption;

use RuntimeException;
use Illuminate\Support\Str;
use Illuminate\Support\ServiceProvider;

class EncryptionServiceProvider extends ServiceProvider
{
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton('encrypter', function ($app) {
            $config = $app->make('config')->get('app');

            $key = $config['key'];

            if (is_null($key) || $key === '') {
                throw new RuntimeException(
                    'The application encryption key is missing. Run php artisan key:generate to generate it.'
                );
            }

            // If the key starts with "base64:", we will need to decode the key before handing
            // it off to the encrypter. Keys may be base-64 encoded for presentation and we
            // want to make sure to convert them back to the raw bytes before encrypting.
            if (Str::startsWith($key, 'base64:')) {
                $key = base64_decode(substr($key, 7));
            }

            return new Encrypter($key, $config['cipher']);
        });
    }
}

Move empty key detection above starts_with check


<?php

namespace CachetHQ\Segment;

use Illuminate\Support\ServiceProvider;
use Segment;

class SegmentServiceProvider extends ServiceProvider
{
    /**
     * Boot the service provider.
     *
     * @return void
     */
    public function boot()
    {
        $this->package('cachethq/segment');

        /**
         * Load the Segment.io configuration.
         */
        $writeKey = $this->app->config->get('segment::config.write_key');
        Segment::init($writeKey);
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        //
    }

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

<?php

namespace CachetHQ\Segment;

use Illuminate\Support\ServiceProvider;
use Segment;

class SegmentServiceProvider extends ServiceProvider
{
    /**
     * Boot the service provider.
     *
     * @return void
     */
    public function boot()
    {
        $this->package('cachethq/segment');
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app['segment'] = $this->app->share(function(app) {
            /**
             * Load the Segment.io configuration.
             */
            $writeKey = $this->app->config->get('segment::config.write_key');
            return Segment::init($writeKey);
        });
    }

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

Load Segment in register method

Load Segment in register method


<?php

/**
 * ProTalk
 *
 * Copyright (c) 2012-2013, ProTalk
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Protalk\MediaBundle\Form\Media;

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

class ContributeMedia extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('name', 'text');
        $builder->add('email', 'email');
        $builder->add('hostUrl', 'url');
        $builder->add('hostName', 'text');
        $builder->add('title', 'text');
        $builder->add('slidesUrl', 'url', array('required' => false));
        $builder->add('speaker', 'text', array('required' => false));
        $builder->add('tags', 'text', array('required' => false));
        $builder->add('description', 'textarea', array('required' => false));
        $builder->add(
            'category',
            'entity',
            array('class' => 'ProtalkMediaBundle:Category',
                'property' => 'name',
                'empty_value' => 'Choose a category'
            )
        );
        $builder->add(
            'recaptcha',
            'ewz_recaptcha',
            array(
                'attr' => array(
                    'options' => array(
                        'theme' => 'clean'
                    )
                )
            )
        );
    }

    public function getDefaultOptions(array $options)
    {
        return array(
            'data_class' => 'Protalk\MediaBundle\Entity\Contribution',
        );
    }

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

<?php

/**
 * ProTalk
 *
 * Copyright (c) 2012-2013, ProTalk
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Protalk\MediaBundle\Form\Media;

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

class ContributeMedia extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('name', 'text');
        $builder->add('email', 'email');
        $builder->add('hostUrl', 'url', array('label'  => 'Where can we find it?'));
        $builder->add('title', 'text');
        $builder->add('tags', 'text', array('required' => false));
        $builder->add(
            'recaptcha',
            'ewz_recaptcha',
            array(
                'attr' => array(
                    'options' => array(
                        'theme' => 'clean'
                    )
                )
            )
        );
    }

    public function getDefaultOptions(array $options)
    {
        return array(
            'data_class' => 'Protalk\MediaBundle\Entity\Contribution',
        );
    }

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

Modify public contribute form definition


<?php

require_once __DIR__ . '/Zigra/Core.php';
/**
 * This class only exists for backwards compatability. All code was moved to
 * Zigra_Core and this class extends Zigra_Core
 *
 * @package Zigra
 * @author  Manuel Dalla Lana <endelwar@aregar.it>
 * @license Proprietary
 * @since   0.1.0
 */
class Zigra extends Zigra_Core
{
    const VERSION = '0.7.2';
}

<?php

require_once __DIR__ . '/Zigra/Core.php';
/**
 * This class only exists for backwards compatability. All code was moved to
 * Zigra_Core and this class extends Zigra_Core
 *
 * @package Zigra
 * @author  Manuel Dalla Lana <endelwar@aregar.it>
 * @license Proprietary
 * @since   0.1.0
 */
class Zigra extends Zigra_Core
{
    const VERSION = '0.7.4';
}

Set release version to 0.7.4

Set release version to 0.7.4


<?php
/**
 * This file is part of the PHPOrchestra\CMSBundle.
 *
 * @author Noël Gilain <noel.gilain@businessdecision.com>
 */

namespace PHPOrchestra\CMSBundle\Classes;

class DocumentLoader
{
    /**
    * Get a MongoDB document giving its type and search citerias
    *
    * @param string $documentType
    * @param array $criteria
    * @param Mandango $mandangoService
    */
    static function getDocument($documentType, array $criteria, $mandangoService)
    {
        $repository = $mandangoService->getRepository(self::getDocumentNamespace($documentType));
        $query = $repository->createQuery();
        $query->criteria($criteria);
        return $query->one();
    }

    /**
     * Get documentType model namespace
     *
     * @param string $documentType
     */
    private static function getDocumentNamespace($documentType)
    {
    	$documentNamespace = '';
    	switch($documentType)
    	{
    		case 'Node':
    			$documentNamespace = 'Model\PHPOrchestraCMSBundle\Node';
    			break;
    		default:
    			break;
    	}
    	return $documentNamespace;
    }
}

<?php
/**
 * This file is part of the PHPOrchestra\CMSBundle.
 *
 * @author Noël Gilain <noel.gilain@businessdecision.com>
 */

namespace PHPOrchestra\CMSBundle\Classes;

class DocumentLoader
{
    /**
    * Get a MongoDB document giving its type and search citerias
    *
    * @param string $documentType
    * @param array $criteria
    * @param Mandango $mandangoService
    */
    static function getDocument($documentType, array $criteria, $mandangoService)
    {
        $repository = $mandangoService->getRepository(self::getDocumentNamespace($documentType));
        $query = $repository->createQuery();
        $query->criteria($criteria);
        return $query->one();
    }

    /**
     * Get documentType model namespace
     *
     * @param string $documentType
     */
    private static function getDocumentNamespace($documentType)
    {
    	$documentNamespace = '';
    	switch($documentType)
    	{
            case 'Node':
                $documentNamespace = 'Model\PHPOrchestraCMSBundle\Node';
                break;
          case 'Template':
                $documentNamespace = 'Model\PHPOrchestraCMSBundle\Template';
                break;
          default:
    			break;
    	}
    	return $documentNamespace;
    }
}

Add template model to documentLoader

Add template model to documentLoader


<?php

namespace wcf\system\event\listener;

use wcf\data\user\UserAction;
use wcf\system\user\authentication\event\UserLoggedIn;

/**
 * Cancels lost password requests if the user successfully logs in.
 *
 * @author  Tim Duesterhus
 * @copyright   2001-2021 WoltLab GmbH
 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package WoltLabSuite\Core\System\Event\Listener
 * @since   5.5
 */
final class UserLoginCancelLostPasswordListener
{
    public function __invoke(UserLoggedIn $event)
    {
        $user = $event->getUser();
        if (!$user->lostPasswordKey) {
            return;
        }

        (new UserAction([$user], 'cancelLostPasswordRequest'))->executeAction();
    }
}

<?php

namespace wcf\system\event\listener;

use wcf\data\user\UserAction;
use wcf\system\user\authentication\event\UserLoggedIn;

/**
 * Cancels lost password requests if the user successfully logs in.
 *
 * @author  Tim Duesterhus
 * @copyright   2001-2021 WoltLab GmbH
 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package WoltLabSuite\Core\System\Event\Listener
 * @since   5.5
 */
final class UserLoginCancelLostPasswordListener
{
    public function __invoke(UserLoggedIn $event): void
    {
        $user = $event->getUser();
        if (!$user->lostPasswordKey) {
            return;
        }

        (new UserAction([$user], 'cancelLostPasswordRequest'))->executeAction();
    }
}

Add explicit `void` return type to UserLoginCancelLostPasswordListener::__invoke()


<?php namespace Laravel\Lumen\Routing;

use Illuminate\Http\Request;

abstract class Controller
{
    use DispatchesCommands, ValidatesRequests;

    /**
     * The middleware defined on the controller.
     *
     * @var array
     */
    protected $middleware = [];

    /**
     * Define a middleware on the controller.
     *
     * @param  string  $middleware
     * @param  array  $options
     * @return void
     */
    public function middleware($middleware, array $options = array())
    {
        $this->middleware[$middleware] = $options;
    }

    /**
     * Get the middleware for a given method.
     *
     * @param  Request  $request
     * @param  string  $method
     * @return array
     */
    public function getMiddlewareForMethod(Request $request, $method)
    {
        $middleware = [];

        foreach ($this->middleware as $name => $options) {
            if (isset($options['only']) && ! in_array($method, (array) $options['only'])) {
                continue;
            }

            if (isset($options['except']) && in_array($method, (array) $options['except'])) {
                continue;
            }

            $middleware[] = $name;
        }

        return $middleware;
    }
}

<?php namespace Laravel\Lumen\Routing;

use Illuminate\Http\Request;

abstract class Controller
{
    use DispatchesJobs, ValidatesRequests;

    /**
     * The middleware defined on the controller.
     *
     * @var array
     */
    protected $middleware = [];

    /**
     * Define a middleware on the controller.
     *
     * @param  string  $middleware
     * @param  array  $options
     * @return void
     */
    public function middleware($middleware, array $options = array())
    {
        $this->middleware[$middleware] = $options;
    }

    /**
     * Get the middleware for a given method.
     *
     * @param  Request  $request
     * @param  string  $method
     * @return array
     */
    public function getMiddlewareForMethod(Request $request, $method)
    {
        $middleware = [];

        foreach ($this->middleware as $name => $options) {
            if (isset($options['only']) && ! in_array($method, (array) $options['only'])) {
                continue;
            }

            if (isset($options['except']) && in_array($method, (array) $options['except'])) {
                continue;
            }

            $middleware[] = $name;
        }

        return $middleware;
    }
}

Fix for fatal error with renamned DispatchesCommands trait


<?php

namespace Orchestra\Translation;

use Illuminate\Translation\FileLoader as BaseFileLoader;

class FileLoader extends BaseFileLoader
{
    /**
     * {@inheritdoc}
     */
    protected function loadNamespaceOverrides(array $lines, $locale, $group, $namespace)
    {
        $files = [
            "{$this->path}/packages/{$namespace}/{$locale}/{$group}.php",
            "{$this->path}/vendor/{$locale}/{$namespace}/{$group}.php",
        ];

        foreach ($files as $file) {
            $lines = $this->mergeEnvironments($lines, $file);
        }

        return $lines;
    }

    /**
     * Merge the items in the given file into the items.
     *
     * @param  array  $lines
     * @param  string  $file
     *
     * @return array
     */
    public function mergeEnvironments(array $lines, string $file): array
    {
        if ($this->files->exists($file)) {
            $lines = array_replace_recursive($lines, $this->files->getRequire($file));
        }

        return $lines;
    }
}

<?php

namespace Orchestra\Translation;

use Illuminate\Translation\FileLoader as BaseFileLoader;

class FileLoader extends BaseFileLoader
{
    /**
     * {@inheritdoc}
     */
    protected function loadNamespaceOverrides(array $lines, $locale, $group, $namespace)
    {
        $files = [
            "{$this->path}/packages/{$namespace}/{$locale}/{$group}.php",
            "{$this->path}/vendor/{$locale}/{$namespace}/{$group}.php",
        ];

        foreach ($files as $file) {
            $lines = $this->mergeEnvironments($lines, $file);
        }

        return $lines;
    }

    /**
     * Merge the items in the given file into the items.
     *
     * @param  array  $lines
     * @param  string  $file
     *
     * @return array
     */
    public function mergeEnvironments(array $lines, string $file): array
    {
        if ($this->files->exists($file)) {
            $lines = \array_replace_recursive($lines, $this->files->getRequire($file));
        }

        return $lines;
    }
}

Improve performance by prefixing all global functions calls with \ to
skip the look up and resolve process and go straight to the global
function

Signed-off-by: Mior Muhammad Zaki <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>


<?php
/**
 * MinTotalQty observer model
 *
 * @category Jvs
 * @package  Jvs_MinTotalQty
 * @author   Javier Villanueva <javiervd@gmail.com>
 */
class Jvs_MinTotalQty_Model_Observer extends Mage_CatalogInventory_Helper_Minsaleqty
{
    public function checkTotalQtyBeforeCheckout(Varien_Event_Observer $observer)
    {
        $quote    = $observer->getDataObject();
        $customer = Mage::helper('customer')->getCustomer();

        // If the minimun total quantity is not met
        // redirect to cart page with error message
        if ($minQty = Mage::helper('jvs_mintotalqty')->minimunOrderQty($quote, $customer)) {
            Mage::getSingleton('checkout/session')->addUniqueMessages(
                Mage::getSingleton('core/message')
                    ->error(
                        Mage::helper('cataloginventory')
                            ->__(
                                'The minimum quantity allowed for purchase is %s.',
                                $minQty
                            )
                    )
            );

            // Check if we are not already on the cart page
            if (!Mage::helper('jvs_mintotalqty')->isCartPage()) {
                Mage::app()->getFrontController()->getResponse()
                    ->setRedirect(Mage::getUrl('checkout/cart'));

                Mage::app()->getRequest()->setDispatched(true);
            }
        }
    }
}

<?php
/**
 * MinTotalQty observer model
 *
 * @category Jvs
 * @package  Jvs_MinTotalQty
 * @author   Javier Villanueva <javiervd@gmail.com>
 */
class Jvs_MinTotalQty_Model_Observer extends Mage_CatalogInventory_Helper_Minsaleqty
{
    /**
     * Check minimun order totals
     *
     * @param  Varien_Event_Observer $observer
     * @return void
     */
    public function checkTotalQtyBeforeCheckout(Varien_Event_Observer $observer)
    {
        $quote    = $observer->getDataObject();
        $customer = Mage::helper('customer')->getCustomer();

        // If the minimun total quantity is not met
        // redirect to cart page with error message
        if ($minQty = Mage::helper('jvs_mintotalqty')->minimunOrderQty($quote, $customer)) {
            Mage::getSingleton('checkout/session')->addUniqueMessages(
                Mage::getSingleton('core/message')
                    ->error(
                        Mage::helper('cataloginventory')
                            ->__(
                                'The minimum quantity allowed for purchase is %s.',
                                $minQty
                            )
                    )
            );

            // Check if we are not already on the cart page
            if (!Mage::helper('jvs_mintotalqty')->isCartPage()) {
                Mage::app()->getFrontController()->getResponse()
                    ->setRedirect(Mage::getUrl('checkout/cart'));

                Mage::app()->getRequest()->setDispatched(true);
            }
        }
    }
}

Add docblocks to observer function

Add docblocks to observer function


<?php

namespace UoMCS\OpenBadges\Backend;

class Earner extends Base
{
  public $data = array(
    'id' => null,
    'identity' => null,
    'hashed' => null,
    'type' => null,
  );

  protected static $table_name = 'earners';

  public function toJson()
  {
    $data = $this->data;

    $data['hashed'] = (bool) $data['hashed'];

    return json_encode($data, true);
  }
}

<?php

namespace UoMCS\OpenBadges\Backend;

class Earner extends Base
{
  public $data = array(
    'id' => null,
    'identity' => null,
    'hashed' => null,
    'type' => null,
  );

  protected static $table_name = 'earners';

  public function toJson()
  {
    $data = $this->data;

    // Remove unnecessary elements
    unset($data['id']);

    $data['hashed'] = (bool) $data['hashed'];

    return json_encode($data, true);
  }
}

Remove fields not in spec from JSON

Remove fields not in spec from JSON


<?php

namespace Oro\Bundle\AddressBundle\Model;

class ExtendCountry
{
public function __construct()
    {
    }
}

<?php

namespace Oro\Bundle\AddressBundle\Model;

class ExtendCountry
{
    /**
     * Constructor
     *
     * The real implementation of this method is auto generated.
     *
     * IMPORTANT: If the derived class has own constructor it must call parent constructor.
     */
    public function __construct()
    {
    }
}

Add spaces for indent the method declaration


<?php

namespace League\CLImate\TerminalObject\Dynamic;

use function strtolower;
use function substr;

class Confirm extends Input
{
    /**
     * Let us know if the user confirmed.
     *
     * @return bool
     */
    public function confirmed()
    {
        $this->prompt .= " [y/N]";
        $this->default = "n";

        $this->accept(['y', 'yes', 'n', 'no'], false);

        $response = strtolower($this->prompt());

        return (substr($response, 0, 1) === 'y');
    }
}

<?php

namespace League\CLImate\TerminalObject\Dynamic;

use League\CLImate\Util\Reader\ReaderInterface;
use function in_array;
use function strtolower;
use function substr;

class Confirm extends Input
{

    /**
     * @inheritdoc
     */
    public function __construct($prompt, ReaderInterface $reader = null)
    {
        parent::__construct($prompt, $reader);

        $this->default = "n";
    }

    /**
     * Let us know if the user confirmed.
     *
     * @return bool
     */
    public function confirmed()
    {
        if (in_array($this->default, ["y", "yes"], true)) {
            $this->prompt .= " [Y/n]";
        } else {
            $this->prompt .= " [y/N]";
        }

        $this->accept(['y', 'yes', 'n', 'no'], false);

        $response = strtolower($this->prompt());

        return (substr($response, 0, 1) === 'y');
    }
}

Allow the confirm default to be overridden


<?php defined('SYSPATH') OR die('No direct script access.');
/**
* @package	BoomCMS
* @category	Chunks
* @author	Rob Taylor
* @copyright	Hoop Associates
*
*/
class Boom_Chunk_Linkset extends Chunk
{
	protected $_default_template = 'quicklinks';

	protected $_type = 'linkset';

	protected function _show()
	{
		if ( ! Editor::instance()->state_is(Editor::DISABLED))
		{
			// Editor is enabled, show all the links.
			$links = $this->_chunks->links();
		}
		else
		{
			// Editor is disabled - only show links where the target page is visible
			$links = array();

			foreach ($this->_chunk->links() as $link)
			{
				if ($link->is_external() OR $link->target->is_visible())
				{
					$links[] = $link;
				}
			}
		}

		return View::factory("site/slots/linkset/$this->_template", array(
			'title'		=>	$this->_chunk->title,
			'links'	=>	$links,
		));
	}

	public function _show_default()
	{
		return View::factory("site/slots/default/linkset/$this->_template");
	}

	public function has_content()
	{
		return count($this->_chunk->links()) > 0;
	}
}

<?php defined('SYSPATH') OR die('No direct script access.');
/**
* @package	BoomCMS
* @category	Chunks
* @author	Rob Taylor
* @copyright	Hoop Associates
*
*/
class Boom_Chunk_Linkset extends Chunk
{
	protected $_default_template = 'quicklinks';

	protected $_type = 'linkset';

	protected function _show()
	{
		if ( ! Editor::instance()->state_is(Editor::DISABLED))
		{
			// Editor is enabled, show all the links.
			$links = $this->_chunk->links();
		}
		else
		{
			// Editor is disabled - only show links where the target page is visible
			$links = array();

			foreach ($this->_chunk->links() as $link)
			{
				if ($link->is_external() OR $link->target->is_visible())
				{
					$links[] = $link;
				}
			}
		}

		return View::factory("site/slots/linkset/$this->_template", array(
			'title'		=>	$this->_chunk->title,
			'links'	=>	$links,
		));
	}

	public function _show_default()
	{
		return View::factory("site/slots/default/linkset/$this->_template");
	}

	public function has_content()
	{
		return count($this->_chunk->links()) > 0;
	}
}

Fix typo in chunk linkset

Fix typo in chunk linkset


<?php

require_once 'Swat/Swat.php';
require_once 'Swat/SwatError.php';
require_once 'Swat/exceptions/SwatException.php';

/**
 * The base object type
 *
 * @package   Swat
 * @copyright 2004-2006 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 */
class SwatObject
{
	// {{{ public function __toString()

	/**
	 * Gets this object as a string
	 *
	 * This is a magic method that is called by PHP when this object is used
	 * in string context. For example:
	 *
	 * <code>
	 * echo (SwatObject)$my_object;
	 * </code>
	 *
	 * @return string this object represented as a string.
	 */
	public function __toString()
	{
		ob_start();
		Swat::printObject($this);
		return ob_get_clean();
	}

	// }}}
}

?>

<?php

require_once 'Swat/Swat.php';
require_once 'Swat/SwatError.php';
require_once 'Swat/exceptions/SwatException.php';

/**
 * The base object type
 *
 * @package   Swat
 * @copyright 2004-2006 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 */
class SwatObject
{
	// {{{ public function __toString()

	/**
	 * Gets this object as a string
	 *
	 * This is a magic method that is called by PHP when this object is used
	 * in string context. For example:
	 *
	 * <code>
	 * $my_object = new SwatMessage('Hello, World!');
	 * echo $my_object;
	 * </code>
	 *
	 * @return string this object represented as a string.
	 */
	public function __toString()
	{
		ob_start();
		Swat::printObject($this);
		return ob_get_clean();
	}

	// }}}
}

?>

Fix documentation. PHP does not allow arbitrary class casting.

svn commit r12147


{{ $appointment->statusLabel }}

{{ $appointment->comments }}

{!! Icon::calendar() !!} {{ $appointment->date }}

{!! Icon::time() !!} {{ $appointment->time }}

{!! Icon::hourglass() !!} {{ $appointment->finishTime }}

{!! Icon::barcode() !!} {{ $appointment->code }}

{{ trans('appointment.status.'.$appointment->statusLabel) }}

{{ $appointment->comments }}

{!! Icon::calendar() !!} {{ $appointment->date }}

{!! Icon::time() !!} {{ $appointment->time }}

{!! Icon::hourglass() !!} {{ $appointment->finishTime }}

{!! Icon::barcode() !!} {{ $appointment->code }}

Move trans() for appointment status from Model to View


<?php
/*
Plugin Name: Comment Timeout
Plugin URI: http://bitbucket.org/jammycakes/comment-timeout/
Description: Automatically closes comments on blog entries after a user-configurable period of time. It has options which allow you to keep the discussion open for longer on older posts which have had recent comments accepted, or to place a fixed limit on the total number of comments in the discussion. Activate the plugin and go to Options >> Comment Timeout to configure.
Version: 2.1.1
Author: James McKay
Author URI: http://jamesmckay.net/
*/

define('COMMENT_TIMEOUT_VERSION', '2.1.1');

if (version_compare(phpversion(), '5.0', '<')) {
	add_action('admin_notices', create_function('', 'echo \'

Comment Timeout no longer supports PHP 4. Please upgrade your server to PHP 5.2 or later.

\';'));
}
else {
	require_once(dirname(__FILE__) . '/comment-timeout/class.core.php');
}

<?php
/*
Plugin Name: Comment Timeout
Plugin URI: http://bitbucket.org/jammycakes/comment-timeout/
Description: Automatically closes comments on blog entries after a user-configurable period of time. It has options which allow you to keep the discussion open for longer on older posts which have had recent comments accepted, or to place a fixed limit on the total number of comments in the discussion. Activate the plugin and go to Options >> Comment Timeout to configure.
Version: 2.1.1
Author: James McKay
Author URI: http://jamesmckay.net/
*/

define('COMMENT_TIMEOUT_VERSION', '2.1.1');

if (version_compare(phpversion(), '5.0', '<')) {
	add_action('admin_notices',
		create_function('',
			'echo \'
' +
			'
Comment Timeout no longer supports PHP 4. ' +
			'Please upgrade your server to PHP 5.2 or later.

\';'
		)
	);
}
else {
	require_once(dirname(__FILE__) . '/comment-timeout/class.core.php');
}

Tidy up the PHP version message

Tidy up the PHP version message


has($name) ? 'has-error' : '' }}">
	{{ $label }}

		<select id="{{ $name }}" name="{{ $name }}[]" class="form-control input-select" multiple="multiple">
			@foreach ($options as $optionValue => $optionLabel)
				<option value="{{ $optionValue }}" {!! isset($value) && in_array($optionValue, $value) ? 'selected="selected"' : '' !!}>{{ $optionLabel }}</option>
			@endforeach
		</select>

	@include(AdminTemplate::getTemplateViewPath('form.element.errors'))

has($name) ? 'has-error' : '' }}">
	{{ $label }}

		<select id="{{ $name }}" name="{{ $name }}" class="form-control input-select" multiple="multiple">
			@foreach ($options as $optionValue => $optionLabel)
				<option value="{{ $optionValue }}" {!! isset($value) && in_array($optionValue, $value) ? 'selected="selected"' : '' !!}>{{ $optionLabel }}</option>
			@endforeach
		</select>

	@include(AdminTemplate::getTemplateViewPath('form.element.errors'))

Fix multiselect form input name

Fix multiselect form input name


<?php

return [
    'create' => 'Creëer',
    'edit' => 'Bewerk',
    'save' => 'Opslaan',
    'delete' => 'Verwijderen',

    'verify' => 'Controleer',

    'yes' => 'Ja',
    'no' => 'Nee'
];

<?php

return [
    'create' => 'Creeëer',
    'edit' => 'Bewerk',
    'save' => 'Opslaan',
    'delete' => 'Verwijderen',

    'verify' => 'Controleer',

    'yes' => 'Ja',
    'no' => 'Nee'
];

Stop encoding of special characters in translations


<?php

use BoomCMS\Database\Models\Chunk\Text;
use Illuminate\Database\Migrations\Migration;

class UpdateAssetLinks extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $chunks = Text::where('text', 'like', '%/asset/%')
            ->get();

        foreach ($chunks as $chunk) {
            $chunk->text = preg_replace('|(/asset/)([a-z]+)/([/0-9]+)|', '$1$3/$2', $chunk->text);
            $chunk->text = preg_replace('|(/asset/)([/0-9]+)/view|', '$1$2', $chunk->text);
            $chunk->save();
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
    }
}

<?php

use BoomCMS\Database\Models\Chunk\Text;
use Illuminate\Database\Migrations\Migration;

class UpdateAssetLinks extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $chunks = Text::where('text', 'like', '%/asset/%')
            ->get();

        foreach ($chunks as $chunk) {
            $chunk->text = preg_replace('|(/asset/)([a-z]+)/(\d+)|', '$1$3/$2', $chunk->text);
            $chunk->text = preg_replace('|(/asset/)([\d]+)/view([^/])|', '$1$2$3', $chunk->text);
            $chunk->save();
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
    }
}

Fix bug in migration to update asset links


<?php

namespace Kibo\Phast\Factories\Diagnostics\LogDrivers;

use Kibo\Phast\HTTP\Request;

class LogWritersFactory {

    public function make(array $config, Request $request) {
        $class = $config['class'];
        $factoryClass = str_replace('Kibo\Phast\\', 'Kibo\Phast\Factories\\', $class) . 'Factory';
        // TODO: set the logging level on the filter before we return it
        return (new $factoryClass())->make($config, $request);
    }

}

<?php

namespace Kibo\Phast\Factories\Diagnostics\LogDrivers;

use Kibo\Phast\HTTP\Request;

class LogWritersFactory {

    public function make(array $config, Request $request) {
        $class = $config['class'];
        $factoryClass = str_replace('Kibo\Phast\\', 'Kibo\Phast\Factories\\', $class) . 'Factory';
        $writer = (new $factoryClass())->make($config, $request);
        if (isset ($config['levelMask'])) {
            $writer->setLevelMask($config['levelMask']);
        }
        return $writer;
    }

}

Set logging level to writers before returning them from factory


<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Entities\Accounts\Models\Account;
use App\Entities\Groups\Models\Group;
use Illuminate\Support\Facades\DB;

final class RepairMissingGroupsCOmmand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'groups:assign';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Finds any accounts without a group assigned, and assigns them to the default groups';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $accountsWithoutGroups = Account::doesntHave('groups')->get();
        $defaultGroupIds = Group::where('is_default', 1)->get()->pluck('group_id');

        $progressBar = $this->output->createProgressBar(count($accountsWithoutGroups));
        $progressBar->start();

        DB::transaction(function() use($accountsWithoutGroups, $defaultGroupIds, &$progressBar) {
            foreach ($accountsWithoutGroups as $account) {
                $account->groups()->attach($defaultGroupIds);
                $progressBar->advance();
            }
        });

        $this->info(count($accountsWithoutGroups) . ' accounts assigned to a default group');

        $progressBar->finish();
    }
}

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Entities\Accounts\Models\Account;
use App\Entities\Groups\Models\Group;
use Illuminate\Support\Facades\DB;

final class RepairMissingGroupsCOmmand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'groups:assign';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Finds any accounts without a group assigned, and assigns them to the default groups';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $accountsWithoutGroups = Account::doesntHave('groups')->get();

        if (count($accountsWithoutGroups) === 0) {
            $this->info('No accounts need to be assigned a group');
            return;
        }

        $defaultGroupIds = Group::where('is_default', 1)->get()->pluck('group_id');

        $progressBar = $this->output->createProgressBar(count($accountsWithoutGroups));
        $progressBar->start();

        DB::transaction(function() use($accountsWithoutGroups, $defaultGroupIds, &$progressBar) {
            foreach ($accountsWithoutGroups as $account) {
                $account->groups()->attach($defaultGroupIds);
                $progressBar->advance();
            }
        });

        $this->info(count($accountsWithoutGroups) . ' accounts assigned to a default group');

        $progressBar->finish();
    }
}

Exit if no accounts need to be repaired

Exit if no accounts need to be repaired


<?php namespace GeneaLabs\LaravelSparkInstaller\Providers;

use GeneaLabs\LaravelSparkInstaller\Console\Commands\SparkDowngrade;
use GeneaLabs\LaravelSparkInstaller\Console\Commands\SparkUpgrade;
use Illuminate\Support\ServiceProvider;

class LaravelSparkInstallerServiceProvider extends ServiceProvider
{
    protected $commands = [
        SparkUpgrade::class,
//        SparkDowngrade::class,
    ];

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        if (! defined('SPARK_PATH')) {
            define('SPARK_PATH', base_path('vendor/laravel/spark/'));
        }

        if (! class_exists('Spark')) {
            class_alias('Laravel\Spark\Spark', 'Spark');
        }

        $this->commands($this->commands);
    }
}

<?php namespace GeneaLabs\LaravelSparkInstaller\Providers;

use GeneaLabs\LaravelSparkInstaller\Console\Commands\SparkDowngrade;
use GeneaLabs\LaravelSparkInstaller\Console\Commands\SparkUpgrade;
use Illuminate\Support\ServiceProvider;

class LaravelSparkInstallerServiceProvider extends ServiceProvider
{
    protected $commands = [
        SparkUpgrade::class,
//        SparkDowngrade::class,
    ];

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->commands($this->commands);
    }
}

Remove unnecessary references in service provider


<?php namespace Orchestra\Testbench\Http;

use Exception;

class Kernel extends \Illuminate\Foundation\Http\Kernel
{
    /**
     * The bootstrap classes for the application.
     *
     * @return void
     */
    protected $bootstrappers = [];

    /**
     * Report the exception to the exception handler.
     *
     * @param  \Exception  $e
     *
     * @return void
     *
     * @throws \Exception
     */
    protected function reportException(Exception $e)
    {
        throw $e;
    }
}

<?php namespace Orchestra\Testbench\Http;

use Exception;

class Kernel extends \Illuminate\Foundation\Http\Kernel
{
    /**
     * The bootstrap classes for the application.
     *
     * @return void
     */
    protected $bootstrappers = [];

    /**
     * The application's middleware stack.
     *
     * @var array
     */
    protected $middleware = [
        \Illuminate\Session\Middleware\StartSession::class,
        \Illuminate\View\Middleware\ShareErrorsFromSession::class,
    ];

    /**
     * Report the exception to the exception handler.
     *
     * @param  \Exception  $e
     *
     * @return void
     *
     * @throws \Exception
     */
    protected function reportException(Exception $e)
    {
        throw $e;
    }
}

Add StartSession and ShareErrorsFromSession by default.

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


<?php
/**
 * @author         Pierre-Henry Soria <hi@ph7.me>
 * @copyright      (c) 2018, Pierre-Henry Soria. All Rights Reserved.
 * @license        GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
 * @package        PH7 / App / System / Core / Class
 */

namespace PH7;

class UserMilestoneCore
{
    const NUMBER_USERS = [
        500,
        1000,
        5000,
        10000,
        25000,
        50000,
        100000,
        500000,
        1000000 // Congrats!
    ];

    /** @var UserCoreModel */
    private $oUserModel;

    public function __construct(UserCoreModel $oUserModel)
    {
        $this->oUserModel = $oUserModel;
    }

    /**
     * @return bool
     */
    public function isTotalUserReached()
    {
        return in_array($this->oUserModel->total(), self::NUMBER_USERS, true);
    }
}

<?php
/**
 * @author         Pierre-Henry Soria <hi@ph7.me>
 * @copyright      (c) 2018, Pierre-Henry Soria. All Rights Reserved.
 * @license        GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
 * @package        PH7 / App / System / Core / Class
 */

namespace PH7;

class UserMilestoneCore
{
    const NUMBER_USERS = [
        100,
        500,
        1000,
        2500,
        5000,
        7500,
        10000,
        25000,
        50000,
        100000,
        250000,
        500000,
        1000000 // Congrats!
    ];

    /** @var UserCoreModel */
    private $oUserModel;

    public function __construct(UserCoreModel $oUserModel)
    {
        $this->oUserModel = $oUserModel;
    }

    /**
     * @return bool
     */
    public function isTotalUserReached()
    {
        return in_array($this->oUserModel->total(), self::NUMBER_USERS, true);
    }
}

Add more user milestones!! :tada:

Add more user milestones!! :tada:


		{!! Form::label( trans('manager.businesses.form.name.label') ) !!}
		{!! Form::text('name', null,
			array('required',
				  'id'=>'name',
				  'class'=>'form-control',
				  'placeholder'=> trans('manager.businesses.form.name.placeholder') )) !!}

		{!! Form::label( trans('manager.businesses.form.slug.label') ) !!}
		{!! Form::text('slug', null,
			array('required',
				  'disabled'=>'true',
				  'id'=>'slug',
				  'class'=>'form-control',
				  'placeholder'=> trans('manager.businesses.form.slug.placeholder') )) !!}

		{!! Form::label( trans('manager.businesses.form.description.label') ) !!}
		{!! Form::textarea('description', null,
			array('required',
				  'class'=>'form-control',
				  'placeholder'=> trans('manager.businesses.form.description.placeholder') )) !!}

@section('scripts')

@endsection

		{!! Form::label( trans('manager.businesses.form.name.label') ) !!}
		{!! Form::text('name', null,
			array('required',
				  'id'=>'name',
				  'class'=>'form-control',
				  'placeholder'=> trans('manager.businesses.form.name.placeholder') )) !!}

		{!! Form::label( trans('manager.businesses.form.slug.label') ) !!}
		{!! Form::text('slug', null,
			array('required',
				  'readonly'=>'true',
				  'id'=>'slug',
				  'class'=>'form-control',
				  'placeholder'=> trans('manager.businesses.form.slug.placeholder') )) !!}

		{!! Form::label( trans('manager.businesses.form.description.label') ) !!}
		{!! Form::textarea('description', null,
			array('required',
				  'class'=>'form-control',
				  'placeholder'=> trans('manager.businesses.form.description.placeholder') )) !!}

@section('scripts')

@endsection

Bugfix: Correct slug input attribute for readonly


<!doctype html>
<?php
/*
 * fileopen.php
 * To be used with ext-server_opensave.js for SVG-edit
 *
 * Licensed under the MIT License
 *
 * Copyright(c) 2010 Alexis Deveria
 *
 */
	// Very minimal PHP file, all we do is Base64 encode the uploaded file and
	// return it to the editor

	$file = $_FILES['svg_file']['tmp_name'];

	$output = file_get_contents($file);

	$type = $_REQUEST['type'];

	$prefix = '';

	// Make Data URL prefix for import image
	if($type == 'import_img') {
		$info = getimagesize($file);
		$prefix = 'data:' . $info['mime'] . ';base64,';
	}
?>
<script>
window.top.window.svgEditor.processFile("<?php echo $prefix . base64_encode($output); ?>", "<?php echo htmlentities($type); ?>");
</script>

<!DOCTYPE html>
<?php
/*
 * fileopen.php
 * To be used with ext-server_opensave.js for SVG-edit
 *
 * Licensed under the MIT License
 *
 * Copyright(c) 2010 Alexis Deveria
 *
 */
	// Very minimal PHP file, all we do is Base64 encode the uploaded file and
	// return it to the editor

	$file = $_FILES['svg_file']['tmp_name'];

	$output = file_get_contents($file);

	$type = $_REQUEST['type'];

	$prefix = '';

	// Make Data URL prefix for import image
	if($type == 'import_img') {
		$info = getimagesize($file);
		$prefix = 'data:' . $info['mime'] . ';base64,';
	}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<script>
window.top.window.svgEditor.processFile("<?php echo $prefix . base64_encode($output); ?>", "<?php echo htmlentities($type); ?>");
</script>
</head><body></body>
</html>

Add charset to HTML5 doc (and make more XHTML friendly)

git-svn-id: e52e7dec99011c9686d89c3d3c01e7ff0d333eee@2609 eee81c28-f429-11dd-99c0-75d572ba1ddd


<?php

require_once 'vendor/autoload.php';
require_once 'ElasticSearch.php';

//Get the search manager
$sm = ElasticSearch::get();

//Execute a direct Elastica term search
$query = new Elastica\Filter\Term(array('username' => 'timmyl'));
$users = $sm->getRepository('Entities\User')->search($query);

foreach($users as $user)
{
	print_r($user);
}

//Execute a single term lookup, modify and persist
$user = $sm->getRepository('Entities\User')->findOneBy(array('username' => 'mrhash'));
print_r($user);
$user->setName('New name');
$sm->persist($user);
$sm->flush();

//Execute a single lookup with no results
try
{
	$user = $sm->find('Entities\User', 'unknownid');
}
catch(Doctrine\Search\Exception\NoResultException $exception)
{
	print_r($exception->getMessage());
}

//Search for comments with parent user
$query = new Elastica\Filter\HasParent(
	new Elastica\Filter\Term(array('username' => 'mrhash')),
	'users'
);
$comments = $sm->getRepository('Entities\Comment')->search($query);

foreach($comments as $comment)
{
	print_r($comment);
}

<?php

require_once 'vendor/autoload.php';
require_once 'ElasticSearch.php';

//Get the search manager
$sm = ElasticSearch::get();

//Execute a direct Elastica term search
$query = new Elastica\Filter\Term(array('username' => 'timmyl'));
$users = $sm->getRepository('Entities\User')->search($query);

foreach($users as $user)
{
	print_r($user);
}

//Execute a single term lookup, modify and persist
$user = $sm->getRepository('Entities\User')->findOneBy(array('username' => 'mrhash'));
print_r($user);
$user->setName('New name');
$sm->persist($user);
$sm->flush();

//Execute a single lookup with no results
try
{
	$user = $sm->find('Entities\User', 'unknownid');
}
catch(Doctrine\Search\Exception\NoResultException $exception)
{
	print_r($exception->getMessage());
}

//Search for comments with parent user. Because of the way ES returns
//results, you have to explicitly ask for the _parent or _routing field if required.
//On single document query e.g. find() the _parent field is returned by ES anyway.
$query = new Elastica\Query();
$query->setFilter(new Elastica\Filter\HasParent(
	new Elastica\Filter\Term(array('username' => 'mrhash')),
	'users'
));
$query->setFields(array('_source', '_parent'));
$comments = $sm->getRepository('Entities\Comment')->search($query);

foreach($comments as $comment)
{
	print_r($comment);
}

Update demo for _parent field issue

Update demo for _parent field issue


<?php

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

class CreateTopicsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('topics', function(Blueprint $table)
		{
			$table->increments('id');
			$table->string('title')->index();
			$table->text('body');
			$table->integer('user_id')->index();
			$table->integer('node_id')->index();
			$table->boolean('excellent')->default(false)->index();
			$table->boolean('blocked')->default(false)->index();
			$table->integer('reply_count')->default(0)->index();
			$table->integer('view_count')->default(0)->index();
			$table->integer('favorite_count')->default(0)->index();
			$table->integer('vote_count')->default(0)->index();
			$table->integer('last_reply_user_id')->default(0)->index();
			$table->softDeletes();
			$table->timestamps();
		});
	}

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

}

<?php

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

class CreateTopicsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('topics', function(Blueprint $table)
		{
			$table->increments('id');
			$table->string('title')->index();
			$table->text('body');
			$table->text('body_orginal');
			$table->text('excerpt')->nullable();
			$table->integer('user_id')->index();
			$table->integer('node_id')->index();
			$table->boolean('excellent')->default(false)->index();
			$table->boolean('blocked')->default(false)->index();
			$table->integer('reply_count')->default(0)->index();
			$table->integer('view_count')->default(0)->index();
			$table->integer('favorite_count')->default(0)->index();
			$table->integer('vote_count')->default(0)->index();
			$table->integer('last_reply_user_id')->default(0)->index();
			$table->integer('order')->default(0)->index();
			$table->softDeletes();
			$table->timestamps();
		});
	}

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

}

Add some fields to the topics model.

Add some fields to the topics model.


<?php

use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;

/*
 * Functional tests for the forgot password screen
 */
class ForgotPasswordFunctionalTest extends TestCase
{
	/**
	 * Checks that the user is given an easy, explicit route back to the login page
	 */
	public function checkRememberedPasswordAfterAll()
	{

	}

	/**
	 * Checks that the submission of an empty email address results in an error
	 */
	public function testSubmitEmptyEmail()
	{

	}

	/**
	 * Test that the submission of an invalid email results in an error
	 *
	 * Valid means "contains exactly one @ symbol, and at least one dot in the domain part"
	 */
	public function testInvalidEmail()
	{

	}

	/**
	 * Test that the submission of a valid email results in a success message
	 *
	 * Note there is no distinction between addresses that exist and those that do not.
	 *
	 * In test mode, no actual email should be sent, though we cannot test for this.
	 */
	public function testValidEmail()
	{

	}
}

<?php

use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;

/*
 * Functional tests for the forgot password screen
 */
class ForgotPasswordFunctionalTest extends TestCase
{
	/**
	 * Checks that viewing the forgot password screen is not possible if logged in
	 */
	public function checkRedirectAndErrorIfLoggedIn()
	{

	}

	/**
	 * Checks that the user is given an easy, explicit route back to the login page
	 */
	public function checkRememberedPasswordAfterAllLinkExists()
	{

	}

	/**
	 * Checks that the submission of an empty email address results in an error
	 */
	public function testSubmitEmptyEmail()
	{

	}

	/**
	 * Test that the submission of an invalid email results in an error
	 *
	 * Valid means "contains exactly one @ symbol, and at least one dot in the domain part"
	 */
	public function testInvalidEmail()
	{

	}

	/**
	 * Test that the submission of a valid email results in a success message
	 *
	 * Note there is no distinction between addresses that exist and those that do not.
	 *
	 * In test mode, no actual email should be sent, though we cannot test for this.
	 */
	public function testValidEmail()
	{

	}
}

Add another test method skeleton

Add another test method skeleton


Remove unnecessary ENT_HTML5 constant, which broke PHP 5.3 compatibility


<!DOCTYPE html>

    {{Asset::css()}}
    <link rel="stylesheet" href="/themes/admin-lte/css/AdminLTE.min.css">
    <link rel="stylesheet" href="/themes/admin-lte/css/skins/skin-{{config('site.admin_theme')}}.css">

                @yield('content')

<!DOCTYPE html>

    @include('system.meta')
    <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
    {{ Asset::css() }}
    <link rel="stylesheet" href="{{asset('themes/admin-lte/css/AdminLTE.min.css')}}">
    <link rel="stylesheet" href="{{asset('themes/admin-lte/css/skins/skin-'.config('site.admin_theme').'.css')}}">

            @yield('content')

Fix admin error page styles.

Fix admin error page styles.


<?
defined('C5_EXECUTE') or die("Access Denied.");
abstract class PermissionKey extends Concrete5_Model_PermissionKey {}

<?
defined('C5_EXECUTE') or die("Access Denied.");
class PermissionKey extends Concrete5_Model_PermissionKey {}

Fix upgrade fatal error due to PermissionKey defined as abstract class.

This fix eliminates a fatal error on line 77 of "concrete/core/models/permission/key.php" when upgrading from 5.2.x to 5.6.x due to attempt to instantiate an abstract class.

Former-commit-id: bbe7d48c8e42c3c38bfc378bb8688fb4b5bc08fa


<?php
/**
 * PHP-DI
 *
 * @link      http://php-di.org/
 * @copyright Matthieu Napoli (http://mnapoli.fr/)
 * @license   http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
 */

namespace DI\Test\IntegrationTest\Definitions;

use DI\ContainerBuilder;

/**
 * Test object definitions
 *
 * TODO add more tests
 *
 * @coversNothing
 */
class ObjectDefinitionTest extends \PHPUnit_Framework_TestCase
{
    public function test_object_without_autowiring()
    {
        $builder = new ContainerBuilder();
        $builder->useAutowiring(false);
        $builder->useAnnotations(false);
        $builder->addDefinitions(array(
            // with the same name
            'stdClass' => \DI\object('stdClass'),
            // with a different name
            'object' => \DI\object('DateTime')
                ->constructor('now', null),
        ));
        $container = $builder->build();

        $this->assertInstanceOf('stdClass', $container->get('stdClass'));
        $this->assertInstanceOf('DateTime', $container->get('object'));
    }
}

<?php
/**
 * PHP-DI
 *
 * @link      http://php-di.org/
 * @copyright Matthieu Napoli (http://mnapoli.fr/)
 * @license   http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file)
 */

namespace DI\Test\IntegrationTest\Definitions;

use DI\ContainerBuilder;

/**
 * Test object definitions
 *
 * TODO add more tests
 *
 * @coversNothing
 */
class ObjectDefinitionTest extends \PHPUnit_Framework_TestCase
{
    public function test_object_without_autowiring()
    {
        $builder = new ContainerBuilder();
        $builder->useAutowiring(false);
        $builder->useAnnotations(false);
        $builder->addDefinitions(array(
            // with the same name
            'stdClass' => \DI\object('stdClass'),
            // with a different name
            'object' => \DI\object('ArrayObject')
                ->constructor(array()),
        ));
        $container = $builder->build();

        $this->assertInstanceOf('stdClass', $container->get('stdClass'));
        $this->assertInstanceOf('ArrayObject', $container->get('object'));
    }
}

Fix test for PHP 5.3.3

Fix test for PHP 5.3.3


<?php

namespace TddWizard\Fixtures\Sales;

use Magento\Sales\Api\Data\ShipmentInterface;

class ShipmentFixture
{
    /**
     * @var ShipmentInterface
     */
    private $shipment;

    public function __construct(ShipmentInterface $shipment)
    {
        $this->shipment = $shipment;
    }

    public function getId(): int
    {
        return (int) $this->shipment->getEntityId();
    }

    public function getTracks(): array
    {
        return $this->shipment->getTracks();
    }

    public function getShippingLabel(): string
    {
        return (string) $this->shipment->getShippingLabel();
    }
}

<?php

namespace TddWizard\Fixtures\Sales;

use Magento\Sales\Api\Data\ShipmentInterface;

class ShipmentFixture
{
    /**
     * @var ShipmentInterface
     */
    private $shipment;

    public function __construct(ShipmentInterface $shipment)
    {
        $this->shipment = $shipment;
    }

    public function getId(): int
    {
        return (int) $this->shipment->getEntityId();
    }

    /**
     * @return \Magento\Sales\Api\Data\ShipmentTrackInterface[]
     */
    public function getTracks(): array
    {
        return $this->shipment->getTracks();
    }

    public function getShippingLabel(): string
    {
        return (string) $this->shipment->getShippingLabel();
    }
}

Add types to sales fixtures

Add types to sales fixtures


<?php

namespace Parsley\ServerBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller ;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Form\FormRegistryInterface ;

class ValidationController extends Controller
{
    public function validationAction($form_service_name, $field_to_compare)
    {

        list($field, $errors) = $this->get('parsley_server_form_generator')->validateField($form_service_name, $field_to_compare);

        if(count($errors) == 0){
            $response = new Response(1);
            return $response;
        } else {
            $message = "";
            foreach($errors as $error){
                $message .= $error;
            }
            $response = new JsonResponse();
            $response->setData(array(
                'error' => $message
            ));
            return $response;
        }
    }
}

<?php

namespace Parsley\ServerBundle\Controller ;

use Symfony\Bundle\FrameworkBundle\Controller\Controller ;
use Symfony\Component\HttpFoundation\JsonResponse ;
use Symfony\Component\Form\FormRegistryInterface ;

class ValidationController extends Controller
{
    public function validationAction ( $form_service_name , $field_to_compare )
    {

        list ( $field , $errors ) = $this -> get ( 'parsley_server_form_generator' ) -> validateField ( $form_service_name , $field_to_compare ) ;

        $response = new JsonResponse ( ) ;

        if ( count ( $errors ) == 0 )
        {
            $response -> setData ( array (
                'success' => ''
            ) ) ;
        }
        else
        {
            $message = '' ;
            foreach ( $errors as $error )
            {
                $message .= $error ;
            }
            $response -> setData ( array (
                'error' => $message
            ) ) ;
        }
        return $response ;

    }
}

Clean controller and add JsonResponse for success callback.

On branch master
	modified:   Parsley/ServerBundle/Controller/ValidationController.php


<?php

namespace filsh\yii2\oauth2server\filters\auth;

use \Yii;

class CompositeAuth extends \yii\filters\auth\CompositeAuth
{
    /**
     * @inheritdoc
     */
    public function beforeAction($action)
    {
        $oauthServer = Yii::$app->getModule('oauth2')->getServer();
        $oauthRequest = Yii::$app->getModule('oauth2')->getRequest();
        $oauthServer->verifyResourceRequest($oauthRequest);

        return parent::beforeAction($action);
    }
}

<?php

namespace filsh\yii2\oauth2server\filters\auth;

use \Yii;

class CompositeAuth extends \yii\filters\auth\CompositeAuth
{
    /**
     * @inheritdoc
     */
    public function beforeAction($action)
    {
        //We call this before calling Yii::$app->getModule('oauth2')->getRequest(); because this method
        //cleans the request body
        $body = Yii::$app->getRequest()->getBodyParams();

        $oauthServer = Yii::$app->getModule('oauth2')->getServer();
        $oauthRequest = Yii::$app->getModule('oauth2')->getRequest();
        $oauthServer->verifyResourceRequest($oauthRequest);

        return parent::beforeAction($action);
    }
}

Fix problems with POST and PUT methods having blank body


<?php

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

class CreateInfoTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        Schema::create('info',function(Blueprint $table)
        {
            $table->increments('infoID');
            $table->hstore('info');

            $table->softDeletes();
            $table->timestamps();

        });
    }

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

<?php

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

class CreateInfoTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        Schema::create('info',function(Blueprint $table)
        {
            $table->increments('infoID');
            $table->jsonb('info');

            $table->softDeletes();
            $table->timestamps();

        });
    }

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

Switch from hstore to jsonb

Switch from hstore to jsonb


<?php
Class Violation{
   public $name;
   public $path;
   public $startLine;
   public $startColumn;
   public $endLine;
   public $endColumn;
   public $rule;
   public $priority;
   public $message;
   public $link;

   public $module;

   public function deserialize($dict) {
      global $config;

      $path = $dict["path"];
      $this->path = str_replace($config["ROOT"], "", $path);
      $this->name = basename($path);

      $this->startLine = $dict["startLine"];
      $this->startColumn = $dict["startColumn"];
      $this->endLine = $dict["endLine"];
      $this->endColumn = $dict["endColumn"];
      $this->rule = $dict["rule"];
      $this->priority = $dict["priority"];
      $this->message = $dict["message"];

      $path = $this->path;
      $gitHubRoot = $config["GITHUB_ROOT"];
      if (array_key_exists($this->module->name, $config["GITHUB_ROOTS"])) {
         $gitHubRoot = $config["GITHUB_ROOTS"][$this->module->name];
         $pathPrefixToRemove = $config["COCOAPODS_PREFIX"].$this->module->name;
         $path = str_replace($pathPrefixToRemove, "", $path);
      }

      $this->link = $gitHubRoot . $path . "#L" . $this->startLine . "-" . $this->endLine;
   }
};
?>

<?php

Class Violation{
   public $name;
   public $path;
   public $startLine;
   public $startColumn;
   public $endLine;
   public $endColumn;
   public $rule;
   public $priority;
   public $message;
   public $link;

   public $module;

   public function deserialize($dict) {
      global $config;

      $path = $dict["path"];
      if (array_key_exists("ROOTS", $config)) {
         $this->path = str_replace($config["ROOT"], "", $path);
      } else {
         $this->path = substr($path, strpos($path, $this->module->name) + strlen($this->module->name) + 1);
      }

      $this->name = basename($path);

      $this->startLine = $dict["startLine"];
      $this->startColumn = $dict["startColumn"];
      $this->endLine = $dict["endLine"];
      $this->endColumn = $dict["endColumn"];
      $this->rule = $dict["rule"];
      $this->priority = $dict["priority"];
      $this->message = $dict["message"];

      $path = $this->path;
      $gitHubRoot = $config["GITHUB_ROOT"];
      if (array_key_exists($this->module->name, $config["GITHUB_ROOTS"])) {
         $gitHubRoot = $config["GITHUB_ROOTS"][$this->module->name];
         $pathPrefixToRemove = $config["COCOAPODS_PREFIX"].$this->module->name;
         $path = str_replace($pathPrefixToRemove, "", $path);
      }

      $this->link = $gitHubRoot . $path . "#L" . $this->startLine . "-" . $this->endLine;
   }
};
?>

Add code to handle a file which comes from a temporary directory.


<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Lang;

class LocalizationMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure                 $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $locale = get_locale();
        app()->setLocale($locale);
        $response = $next($request);

        $uri = $request->route() ? $request->route()->uri : '';
        $file = config('locale.route_to_file.' . $uri);

        if (!is_null($file)) {
            $localeData = array_merge(Lang::get('navbar', [], $locale), Lang::get($file, [], $locale));
        } else {
            $localeData = Lang::get('navbar', [], $locale);
        }
        $localeString = json_encode($localeData);
        $content = str_replace_first('', "\n", $response->content());
        $response->setContent($content);

        return $response;
    }
}

<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Lang;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

class LocalizationMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure                 $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $locale = get_locale();
        app()->setLocale($locale);
        $response = $next($request);

        $uri = $request->route() ? $request->route()->uri : '';
        $file = config('locale.route_to_file.' . $uri);

        if (!is_null($file)) {
            $localeData = array_merge(Lang::get('navbar', [], $locale), Lang::get($file, [], $locale));
            $localeString = json_encode($localeData);
            $content = str_replace_first('', "\n", $response->content());
            $response->setContent($content);
        } elseif ($response->exception instanceof NotFoundHttpException) {
            $localeData = Lang::get('navbar', [], $locale);
            $localeString = json_encode($localeData);
            $content = str_replace_first('', "\n", $response->content());
            $response->setContent($content);
        }

        return $response;
    }
}

Update localization middleware to fix 404 page


<?php

/*
Plugin Name: Fortytwo - Two Factor Authentication plugin
Plugin URI: https://www.fortytwo.com
Description: Implement the fortytwo Two Factor Authentication service for login and register on wordpress.
Version: 1.0.0-RC11
Author: Sebastien Lemarinel <sebastien.lemarinel@fortytwo.com>
Author URI: https://www.fortytwo.com
License: GPL2
*/

// Load the composer autoload
require dirname(__FILE__) . '/vendor/autoload.php';

// Workaround for the Doctrine annotation
Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace(
    'JMS\Serializer\Annotation',
    dirname(__FILE__) . "/vendor/jms/serializer/src"
);

new Fortytwo\Wordpress\Plugin\TwoFactorAuthentication\Controller\Login();
new Fortytwo\Wordpress\Plugin\TwoFactorAuthentication\Controller\Admin();
new Fortytwo\Wordpress\Plugin\TwoFactorAuthentication\Controller\UserProfile();
new Fortytwo\Wordpress\Plugin\TwoFactorAuthentication\Controller\Register();

<?php

/*
Plugin Name: Fortytwo - Two Factor Authentication plugin
Plugin URI: https://www.fortytwo.com
Description: Implement the fortytwo Two Factor Authentication service for login and register on wordpress.
Version: 1.0.0-RC11
Author: Sebastien Lemarinel <sebastien.lemarinel@fortytwo.com>
Author URI: https://www.fortytwo.com
License: MIT
*/

// Load the composer autoload
require dirname(__FILE__) . '/vendor/autoload.php';

// Workaround for the Doctrine annotation
Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace(
    'JMS\Serializer\Annotation',
    dirname(__FILE__) . "/vendor/jms/serializer/src"
);

new Fortytwo\Wordpress\Plugin\TwoFactorAuthentication\Controller\Login();
new Fortytwo\Wordpress\Plugin\TwoFactorAuthentication\Controller\Admin();
new Fortytwo\Wordpress\Plugin\TwoFactorAuthentication\Controller\UserProfile();
new Fortytwo\Wordpress\Plugin\TwoFactorAuthentication\Controller\Register();

Fix typo in licence header.

Fix typo in licence header.