<?php

// PHP 5.3 minimum
if (version_compare(PHP_VERSION, '5.3.0', '<')) {

    die('This software require PHP 5.3.0 minimum');
}

// Short tags must be enabled for PHP < 5.4
if (version_compare(PHP_VERSION, '5.4.0', '<')) {

    if (! ini_get('short_open_tag')) {

        die('This software require to have short tags enabled, check your php.ini => "short_open_tag = On"');
    }
}

// Check XML functions
if (! function_exists('simplexml_load_string')) {

    die('PHP extension required: SimpleXML');
}

if (! function_exists('xml_parser_create')) {

    die('PHP extension required: XML Parser');
}

if (! function_exists('dom_import_simplexml')) {

    die('PHP extension required: DOM');
}

// Check PDO Sqlite
if (! extension_loaded('pdo_sqlite')) {

    die('PHP extension required: pdo_sqlite');
}

// Check if /data is writeable
if (! is_writable('data')) {

    die('The directory "data" must be writeable by your web server user');
}

<?php

// PHP 5.3 minimum
if (version_compare(PHP_VERSION, '5.3.0', '<')) {

    die('This software require PHP 5.3.0 minimum');
}

// Short tags must be enabled for PHP < 5.4
if (version_compare(PHP_VERSION, '5.4.0', '<')) {

    if (! ini_get('short_open_tag')) {

        die('This software require to have short tags enabled, check your php.ini => "short_open_tag = On"');
    }
}

// Check XML functions
if (! function_exists('simplexml_load_string')) {

    die('PHP extension required: SimpleXML');
}

if (! function_exists('xml_parser_create')) {

    die('PHP extension required: XML Parser');
}

if (! function_exists('dom_import_simplexml')) {

    die('PHP extension required: DOM');
}

// Check PDO Sqlite
if (! extension_loaded('pdo_sqlite')) {

    die('PHP extension required: pdo_sqlite');
}

// Check for curl
if (! function_exists('curl_init')) {

    die('PHP extension required: curl');
}

// Check if /data is writeable
if (! is_writable('data')) {

    die('The directory "data" must be writeable by your web server user');
}

Add check on curl extension

Add check on curl extension


<?php
namespace FrontendBridge\Lib;

trait FrontendBridgeTrait {

/**
 * jsonActionResponse
 *
 * @param \Cake\Network\Response $response the response
 * @return \FrontendBridge\Lib\ServiceResponse
 */
    protected function jsonActionResponse(\Cake\Network\Response $response) {
        // get the frontendData set by the Frontend plugin and remove unnecessary data
        $frontendData = $this->viewVars['frontendData'];
        unset($frontendData['Types']);
        $response = array(
            'code' => 'success',
            'data' => array(
                'frontendData' => $frontendData,
                'html' => $response->body()
            )
        );
        return new \FrontendBridge\Lib\ServiceResponse($response);
    }

/**
 * renderJsonAction
 *
 * @param string $view   the view to render
 * @param string $layout the layout to render
 * @return \FrontendBridge\Lib\ServiceResponse
 */
    public function renderJsonAction($view, $layout) {
        if ($layout === null) {
            $layout = 'FrontendBridge.json_action';
        }
        $response = parent::render($view, $layout);
        $this->getView()->subDir = null;
        return $this->jsonActionResponse($response);
    }

/**
 * Detect if the current request should be rendered as a JSON Action
 *
 * @return bool
 */
    protected function _isJsonActionRequest() {
        return
            (isset($this->request->params['jsonAction']) && $this->request->params['jsonAction'] === true)
            || $this->request->query('json_action') == 1;
    }
}

<?php
namespace FrontendBridge\Lib;

trait FrontendBridgeTrait
{

    /**
     * jsonActionResponse
     *
     * @param \Cake\Network\Response $response the response
     * @return \FrontendBridge\Lib\ServiceResponse
     */
    protected function jsonActionResponse(\Cake\Network\Response $response)
    {
        // get the frontendData set by the Frontend plugin and remove unnecessary data
        $frontendData = $this->viewVars['frontendData'];
        unset($frontendData['Types']);
        $response = array(
            'code' => 'success',
            'data' => array(
                'frontendData' => $frontendData,
                'html' => $response->body()
            )
        );
        return new \FrontendBridge\Lib\ServiceResponse($response);
    }

    /**
     * renderJsonAction
     *
     * @param string $view   the view to render
     * @param string $layout the layout to render
     * @return \FrontendBridge\Lib\ServiceResponse
     */
    public function renderJsonAction($view, $layout)
    {
        if ($layout === null) {
            $layout = 'FrontendBridge.json_action';
        }
        if ($this->RequestHandler) {
            $this->RequestHandler->renderAs($this, 'ajax');
        }
        $response = parent::render($view, $layout);
        return $this->jsonActionResponse($response);
    }

    /**
     * Detect if the current request should be rendered as a JSON Action
     *
     * @return bool
     */
    protected function _isJsonActionRequest()
    {
        return
            (isset($this->request->params['jsonAction']) && $this->request->params['jsonAction'] === true)
            || $this->request->query('json_action') == 1;
    }
}

Fix incompatibility between FrontendBridge/jsonAction with the inclusion of the RequestHandlerComponent. Make sure the "json" View subfolder is not used in this case.


TauDuluan.id

        Hot News |
        Now Playing |
        Artis |
        Wawancara

        Tentang Kami |
        Kontak

Remove a lot of <br>

Remove a lot of <br>


<?php

namespace Artesaos\Zenvia\Contracts;

interface SMSInterface
{
    /**
     * Send a SMS
     *
     * @param array $body
     * @param string $responseFormat The response format must be one of: array, json, string, stream, psr7
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function send(array $body, $responseFormat = 'json');
}

<?php

namespace Artesaos\Zenvia\Contracts;

interface SMSInterface
{
    /**
     * Send a SMS
     *
     * @param array $body
     * @param string $responseFormat The response format must be one of: array, json, string, stream, psr7, simple_xml
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function send(array $body, $responseFormat = 'json');
}

Add simple_xml response type to docblock


<?php get_header(); ?>

	<title>Not Found - <?php bloginfo('name'); ?></title>

Oopps!!, something goes wrong!

We can't found what you are looking for. <a href="<?php echo get_option('home');?>">Go Home? or Try Search

<?php get_search_form();?>

<?php get_footer(); ?>

Change footer to be sticker footer to avoid bad experience in mobile devices


<?php

namespace Laravel\Cashier\Tests;

use Stripe\Stripe;
use PHPUnit\Framework\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
    protected function setUp()
    {
        Stripe::setApiVersion('2018-11-08');
    }
}

<?php

namespace Laravel\Cashier\Tests;

use Stripe\Stripe;
use PHPUnit\Framework\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
    protected function setUp()
    {
        Stripe::setApiVersion('2019-02-19');
    }
}

Test latest Stripe API release

Test latest Stripe API release


<?php

return [
    'logger' => [
        'name' => 'OnlinePlayerStats',
        'path' => __DIR__ . '/../../../runtime/logs/app.log',
        'level' => \Monolog\Logger::DEBUG,
    ],

    'server' => [
        'address' => 'play.bbyaworld.com',
        'port' => 25565,
    ],

    'db' => (require(__DIR__ . '/../../settings-local.php'))['settings']['db'],

    'updateInterval' => 2, // Minutes
    'mojangApiUrl' => 'https://api.mojang.com/profiles/minecraft',
];

<?php

return [
    'logger' => [
        'name' => 'OnlinePlayerStats',
        'path' => __DIR__ . '/../../../runtime/logs/app.log',
        'level' => \Monolog\Logger::WARNING,
    ],

    'server' => [
        'address' => 'play.bbyaworld.com',
        'port' => 25565,
    ],

    'db' => (require(__DIR__ . '/../../settings-local.php'))['settings']['db'],

    'updateInterval' => 2, // Minutes
    'mojangApiUrl' => 'https://api.mojang.com/profiles/minecraft',
];

Set online stats update service logging level to `WARNING`


<?php

namespace App\Identifier;

use HyungJu\ReadableURL;

class WordlistIdentifier implements IdentifierContract
{
    public function generate(): string
    {
        return (new ReadableURL(true, rand(3, 5)))->generate();
    }
}

<?php

namespace App\Identifier;

use HyungJu\ReadableURL;

class WordlistIdentifier implements IdentifierContract
{
    public function generate(): string
    {
        return trim((new ReadableURL(true, rand(3, 5)))->generate());
    }
}

Fix new line being added to wordlist identifier generator

It looks like strings generated using the wordlist can sometimes be generated with a new line at the end of the string, this causes the file not not be stored correctly, and for the render controller to not be able to find the record in the database, this fixes this issue by trimming the result before it's returned, so the new line is removed.


<?php
/**
 * @title            Index File
 *
 * @author           Pierre-Henry Soria <hello@ph7cms.com>
 * @copyright        (c) 2012-2018, Pierre-Henry Soria. All Rights Reserved.
 * @license          GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
 * @link             http://ph7cms.com
 * @package          PH7 / Install
 * @version          1.3
 */

define('PH7', 1);

ob_start();

header('Content-Type: text/html; charset=utf-8');

require 'constants.php';

include PH7_ROOT_INSTALL . 'inc/log.inc.php';

require 'requirements.php';

include_once PH7_ROOT_INSTALL . 'inc/fns/misc.php';
require_once PH7_ROOT_INSTALL . 'library/Smarty/Smarty.class.php';
require_once PH7_ROOT_INSTALL . 'inc/loader.inc.php';

require PH7_ROOT_INSTALL . 'inc/init.inc.php';

ob_end_flush();

Remove extra new line at end of file

Remove extra new line at end of file


<?php

namespace AdminBundle\DataFixtures\ORM;

use AdminBundle\Entity\Admin;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;

class LoadAdminData implements FixtureInterface, ContainerAwareInterface
{
    private $container;

    public function setContainer(ContainerInterface $container = null)
    {
        $this->container = $container;
    }

    public function load(ObjectManager $manager)
    {
        $adminUser = new Admin();
        $adminUser->setEmail("admin@admin.com");
        $adminUser->setUsername("admin");
        $password = $this->container->get('security.password_encoder')->encodePassword($adminUser, "admin");
        $adminUser->setPassword($password);

        $manager->persist($adminUser);
        $manager->flush();
    }
}

<?php

namespace AdminBundle\DataFixtures\ORM;

use AdminBundle\Entity\Admin;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;

class LoadAdminData implements FixtureInterface, ContainerAwareInterface
{
    private $container;

    public function setContainer(ContainerInterface $container = null)
    {
        $this->container = $container;
    }

    public function load(ObjectManager $manager)
    {
        $adminUser = new Admin();
        $adminUser->setEmail("admin@admin.com");
        $adminUser->setUsername("admin");
        $password = $this->container->get('security.password_encoder')->encodePassword($adminUser, "admin");
        $adminUser->setPassword($password);
        $adminUser->setFirstname('David');
        $adminUser->setLastname('Kleiber');

        $manager->persist($adminUser);
        $manager->flush();
    }
}

UPDATE - fix datafixtures bug

UPDATE
- fix datafixtures bug


<?php
declare(strict_types=1);

namespace CondorcetPHP\Condorcet\Tests;

use CondorcetPHP\Condorcet\CondorcetUtil;
use CondorcetPHP\Condorcet\Vote;

use PHPUnit\Framework\TestCase;

class CondorcetUtilTest extends TestCase
{
    public function testFormatVote (): void
    {
        $vote = new Vote ('A>B>C');

        self::assertSame('A > B > C',CondorcetUtil::format($vote,true));
    }
}

<?php
declare(strict_types=1);

namespace CondorcetPHP\Condorcet\Tests;

use CondorcetPHP\Condorcet\CondorcetUtil;
use CondorcetPHP\Condorcet\Vote;

use PHPUnit\Framework\TestCase;

class CondorcetUtilTest extends TestCase
{
    public function testFormatVote (): void
    {
        $vote = new Vote ('A>B>C');

        $this->assertSame('A > B > C', CondorcetUtil::format($vote,true));
    }

    public function testDeleteComments(): void
    {
        $result = CondorcetUtil::prepareParse("A > B # This is a comment", false);

        $this->assertSame(['A > B'], $result);
    }
}

Add test to catch a mutant

Add test to catch a mutant


<?php

/* vim: set noexpandtab tabstop=4 shiftwidth=4 foldmethod=marker: */

@include_once 'PackageConfig.php';
if (class_exists('PackageConfig')) {
	PackageConfig::setWorkDirPosition(3);
	PackageConfig::addPackage('site');
	PackageConfig::addPackage('swat');
}

require_once 'Swat/SwatAutoloader.php';
SwatAutoloader::loadRules(dirname(__FILE__).'/../autoloader-rules.conf');
require_once '../include/DemoApplication.php';

$app = new DemoApplication('demo');
$app->run();

?>

<?php

/* vim: set noexpandtab tabstop=4 shiftwidth=4 foldmethod=marker: */

@include_once 'PackageConfig.php';
if (class_exists('PackageConfig')) {
	PackageConfig::setWorkDirPosition(3);
	PackageConfig::addPackage('site');
	PackageConfig::addPackage('swat');
}

require_once 'Swat/SwatAutoloader.php';
SwatAutoloader::loadRules(dirname(__FILE__).'/../autoloader-rules.conf');
require_once '../include/DemoApplication.php';

$app = new DemoApplication('demo');

try {
	$app->run();
}
catch (SwatException $exception) {
	$exception->process(false);
}

?>

Make exceptions display nicely in demo.

Make exceptions display nicely in demo.

svn commit r14903


<?php
require '../scat.php';

$q= "SELECT id, name FROM brand WHERE name != '' ORDER BY name";
$r= $db->query($q)
  or die_query($db, $q);

$brands= array();
while ($row= $r->fetch_row()) {
  $brands[$row[0]]= $row[1];
}
$brands['selected']= $_REQUEST['id'];

echo jsonp($brands);

<?php
require '../scat.php';

$verbose= (int)$_REQUEST['verbose'];

$q= "SELECT id, name FROM brand WHERE name != '' ORDER BY name";
$r= $db->query($q)
  or die_query($db, $q);

$brands= array();
while ($row= $r->fetch_row()) {
  if ($verbose) {
    $brands[]= array('id' => $row[0], 'name' => $row[1]);
  } else {
    $brands[$row[0]]= $row[1];
  }
}

if ($_REQUEST['id'])
  $brands['selected']= $_REQUEST['id'];

echo jsonp($brands);

Add 'verbose' mode for brand list to preserve item order


<?php

namespace PHPAST;

interface SymbolTable extends \ArrayAccess {}

interface LiteralFactory {
	public function create($mixed, $label = NULL);
}

class Identifier extends Node {
	protected $value;

	public function __construct($value, $label = NULL) {
		parent::__construct($label);
		$this->value = $value;
	}

	public function evaluate(SymbolTable $st) {
		return $this;
	}

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

class Literal extends Identifier {}

class Number extends Literal {}
class Integer extends Number {}
class Float extends Number {}
class Boolean extends Literal {
	public function repr() {
		return $this->value ? 'TRUE' : 'FALSE';
	}
}
class Null_ extends Literal {
	static protected $null_;

	public function repr() {
		return 'NULL';
	}

	static public function get() {
		if (!static::$null_) {
			static::$null_ = new static(NULL);
		}
		return static::$null_;
	}
}

class String extends Literal {
	public function repr() {
		return '"' . addcslashes($this->value, "\0..\37!@\177..\377") . '"';
	}
}

<?php

namespace PHPAST;

interface SymbolTable extends \ArrayAccess {}

interface LiteralFactory {
	public function create($mixed, $label = NULL);
}

class Identifier extends Node {
	protected $value;

	public function __construct($value, $label = NULL) {
		parent::__construct($label);
		$this->value = $value;
	}

	public function evaluate(SymbolTable $st) {
		return $this;
	}

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

class Literal extends Identifier {}

class Number extends Literal {}
class Integer extends Number {}
class Float extends Number {}

class Boolean extends Literal {
	public function repr() {
		return $this->value ? 'TRUE' : 'FALSE';
	}
}

class String extends Literal {
	public function repr() {
		return '"' . addcslashes($this->value,"\0..\37\42\134\177..\377") . '"';
	}
}

class Null_ extends Literal {
	static protected $null_;

	public function repr() {
		return 'NULL';
	}

	static public function get() {
		if (!static::$null_) {
			static::$null_ = new static(NULL);
		}
		return static::$null_;
	}
}

Fix String repr() wrong escaping

Fix String repr() wrong escaping


<?php

namespace Juy\ActiveMenu;

/**
 * Class Active
 *
 * @package Juy\Providers
 */
class Active
{
    /**
     * Current matched route
     *
     * @var Route
     */
    protected $currentRouteName;

    /**
     * Active constructor
     *
     * @param $currentRouteName
     */
    public function __construct($currentRouteName)
    {
        $this->currentRouteName = $currentRouteName;
    }

    /**
     * Active route name
     * If route matches given route (or array of routes) return active class
     *
     * @param $routePattern
     *
     * @return string
     */
    public function route($routePattern = null)
    {
        // Convert to array
        if (!is_array($routePattern) && $routePattern != null)
        {
            $routePattern = explode(' ', $routePattern);
        }

        // Check the current route name
        // https://laravel.com/docs/5.3/helpers#method-str-is
        foreach ((array) $routePattern as $i)
        {
            if (str_is($i, $this->currentRouteName))
            {
                return config('activemenu.class');
            }
        }
    }

}

<?php

namespace Juy\ActiveMenu;

/**
 * Class Active
 *
 * @package Juy\ActiveMenu
 */
class Active
{
    /**
     * Current matched route
     *
     * @var Route
     */
    protected $currentRouteName;

    /**
     * Active constructor
     *
     * @param $currentRouteName
     */
    public function __construct($currentRouteName)
    {
        $this->currentRouteName = $currentRouteName;
    }

    /**
     * Active route name
     * If route matches given route (or array of routes) return active class
     *
     * @param $routePattern
     *
     * @return string
     */
    public function route($routePattern = null)
    {
        // Convert to array
        if (!is_array($routePattern) && $routePattern != null)
        {
            $routePattern = explode(' ', $routePattern);
        }

        // Check the current route name
        // https://laravel.com/docs/5.3/helpers#method-str-is
        foreach ((array) $routePattern as $i)
        {
            if (str_is($i, $this->currentRouteName))
            {
                return config('activemenu.class');
            }
        }
    }

}

Fix package name on class title

Fix package name on class title


<?php

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

class GitHubTag extends GitHubObject
{
	/* (non-PHPdoc)
	 * @see GitHubObject::getAttributes()
	 */
	protected function getAttributes()
	{
		return array_merge(parent::getAttributes(), array(
			'name' => 'string',
			'zipball_url' => 'string',
			'tarball_url' => 'string',
		));
	}

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

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

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

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

	/**
	 * @return string
	 */
	public function getZipballUrl()
	{
		return $this->zipball_url;
	}

	/**
	 * @return string
	 */
	public function getTarballUrl()
	{
		return $this->tarball_url;
	}

}

<?php

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

class GitHubTag extends GitHubObject
{
	/* (non-PHPdoc)
	 * @see GitHubObject::getAttributes()
	 */
	protected function getAttributes()
	{
		return array_merge(parent::getAttributes(), array(
			'name' => 'string',
			'zipball_url' => 'string',
			'tarball_url' => 'string',
			'commit' => 'string',
		));
	}

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

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

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

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

	/**
	 * @return string
	 */
	public function getZipballUrl()
	{
		return $this->zipball_url;
	}

	/**
	 * @return string
	 */
	public function getTarballUrl()
	{
		return $this->tarball_url;
	}

	/**
	 * @return string
	 */
	public function getCommit()
	{
		return $this->commit;
	}

}

Add getCommit() function for tags

Add getCommit() function for tags


<?php

final class PhabricatorSubscriptionsListController
  extends PhabricatorController {

  private $phid;

  public function willProcessRequest(array $data) {
    $this->phid = idx($data, 'phid');
  }

  public function processRequest() {
    $request = $this->getRequest();

    $viewer = $request->getUser();
    $phid = $this->phid;

    $object = id(new PhabricatorObjectQuery())
      ->setViewer($viewer)
      ->withPHIDs(array($phid))
      ->executeOne();

    if ($object instanceof PhabricatorSubscribableInterface) {
      $subscriber_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID(
        $phid);
    }

    $handle_phids = $subscriber_phids;
    $handle_phids[] = $phid;

    $handles = id(new PhabricatorHandleQuery())
      ->setViewer($viewer)
      ->withPHIDs($handle_phids)
      ->execute();
    $object_handle = $handles[$phid];

    $dialog = id(new SubscriptionListDialogBuilder())
      ->setViewer($viewer)
      ->setTitle(pht('Subscribers'))
      ->setObjectPHID($phid)
      ->setHandles($handles)
      ->buildDialog();

    return id(new AphrontDialogResponse())->setDialog($dialog);
  }

}

<?php

final class PhabricatorSubscriptionsListController
  extends PhabricatorController {

  private $phid;

  public function willProcessRequest(array $data) {
    $this->phid = idx($data, 'phid');
  }

  public function shouldAllowPublic() {
    return true;
  }

  public function processRequest() {
    $request = $this->getRequest();

    $viewer = $request->getUser();
    $phid = $this->phid;

    $object = id(new PhabricatorObjectQuery())
      ->setViewer($viewer)
      ->withPHIDs(array($phid))
      ->executeOne();

    if ($object instanceof PhabricatorSubscribableInterface) {
      $subscriber_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID(
        $phid);
    }

    $handle_phids = $subscriber_phids;
    $handle_phids[] = $phid;

    $handles = id(new PhabricatorHandleQuery())
      ->setViewer($viewer)
      ->withPHIDs($handle_phids)
      ->execute();
    $object_handle = $handles[$phid];

    $dialog = id(new SubscriptionListDialogBuilder())
      ->setViewer($viewer)
      ->setTitle(pht('Subscribers'))
      ->setObjectPHID($phid)
      ->setHandles($handles)
      ->buildDialog();

    return id(new AphrontDialogResponse())->setDialog($dialog);
  }

}

Allow public on list of subscribers

Allow public on list of subscribers

Summary: Fixes T7317, allows public to be set on this list controller.

Test Plan: Tested a list of subscribers on a logged in and logged out Diff.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7317

Differential Revision: https://secure.phabricator.com/D11801


<?php

// Warning: pref names have a limit of 40 characters
// Please prefix with ta_ (short for tikiaddon) and your package vendor and name

function prefs_ta_synergiq_events_list()
{
	return array(
		'ta_synergiq_events_on' => array( // This main _on pref is mandatory
			'name' => tra('Activate Synergiq Event Calendar'),
			'description' => tra('Activate Synergiq Event Calendar Addon'),
			'type' => 'flag',
			'admin' => 'ta_synergiq_events',
			'tags' => array('basic'),
			'default' => 'y',
		),
		'ta_synergiq_events_map' => array(
			'name' => tra('Show map with events'),
			'description' => tra('Allow the showing of a map for events'),
			'type' => 'flag',
			'tags' => array('basic'),
			'default' => 'y',
		),
	);
}

<?php

// Warning: pref names have a limit of 40 characters
// Please prefix with ta_ (short for tikiaddon) and your package vendor and name

function prefs_ta_synergiq_events_list()
{
	return array(
		'ta_synergiq_events_on' => array( // This main _on pref is mandatory
			'name' => tra('Activate Synergiq Event Calendar'),
			'description' => tra('Activate Synergiq Event Calendar Addon'),
			'type' => 'flag',
			'admin' => 'ta_synergiq_events',
			'tags' => array('basic'),
			'default' => 'y',
		),
	);
}

Remove stuff that is for next version

[MOD] Remove stuff that is for next version


<?php

declare(strict_types=1);

namespace ProxyManager\ProxyGenerator\NullObject\MethodGenerator;

use ProxyManager\Generator\MethodGenerator;
use ProxyManager\ProxyGenerator\Util\Properties;
use ReflectionClass;
use ReflectionProperty;
use Zend\Code\Generator\Exception\InvalidArgumentException;
use function array_map;
use function implode;

/**
 * The `staticProxyConstructor` implementation for null object proxies
 *
 */
class StaticProxyConstructor extends MethodGenerator
{
    /**
     * Constructor
     *
     * @param ReflectionClass $originalClass Reflection of the class to proxy
     *
     * @throws InvalidArgumentException
     */
    public function __construct(ReflectionClass $originalClass)
    {
        parent::__construct('staticProxyConstructor', [], static::FLAG_PUBLIC | static::FLAG_STATIC);

        $nullableProperties = array_map(
            function (ReflectionProperty $publicProperty) : string {
                return '$instance->' . $publicProperty->getName() . ' = null;';
            },
            Properties::fromReflectionClass($originalClass)->getPublicProperties()
        );

        $this->setReturnType($originalClass->getName());
        $this->setDocBlock('Constructor for null object initialization');
        $this->setBody(
            'static $reflection;' . "\n\n"
            . '$reflection = $reflection ?? $reflection = new \ReflectionClass(__CLASS__);' . "\n"
            . '$instance = $reflection->newInstanceWithoutConstructor();' . "\n\n"
            . ($nullableProperties ? implode("\n", $nullableProperties) . "\n\n" : '')
            . 'return $instance;'
        );
    }
}

<?php

declare(strict_types=1);

namespace ProxyManager\ProxyGenerator\NullObject\MethodGenerator;

use ProxyManager\Generator\MethodGenerator;
use ProxyManager\ProxyGenerator\Util\Properties;
use ReflectionClass;
use ReflectionProperty;
use Zend\Code\Generator\Exception\InvalidArgumentException;
use function array_map;
use function implode;

/**
 * The `staticProxyConstructor` implementation for null object proxies
 *
 */
class StaticProxyConstructor extends MethodGenerator
{
    /**
     * Constructor
     *
     * @param ReflectionClass $originalClass Reflection of the class to proxy
     *
     * @throws InvalidArgumentException
     */
    public function __construct(ReflectionClass $originalClass)
    {
        parent::__construct('staticProxyConstructor', [], static::FLAG_PUBLIC | static::FLAG_STATIC);

        $nullableProperties = array_map(
            function (ReflectionProperty $publicProperty) : string {
                return '$instance->' . $publicProperty->getName() . ' = null;';
            },
            Properties::fromReflectionClass($originalClass)->getPublicProperties()
        );

        $this->setReturnType($this->getName());
        $this->setDocBlock('Constructor for null object initialization');
        $this->setBody(
            'static $reflection;' . "\n\n"
            . '$reflection = $reflection ?? $reflection = new \ReflectionClass(__CLASS__);' . "\n"
            . '$instance = $reflection->newInstanceWithoutConstructor();' . "\n\n"
            . ($nullableProperties ? implode("\n", $nullableProperties) . "\n\n" : '')
            . 'return $instance;'
        );
    }
}

Change return type hinting to reference the Proxy class


<?php

abstract class CM_Provision_Script_OptionBased extends CM_Provision_Script_Abstract implements CM_Typed {

    use CM_Provision_Script_IsLoadedTrait;

    /**
     * @param bool $loaded
     */
    protected function _setLoaded($loaded) {
        CM_Option::getInstance()->set($this->_getOptionName(), (bool) $loaded);
    }

    /**
     * @param CM_Service_Manager $manager
     * @return bool
     */
    protected function _isLoaded(CM_Service_Manager $manager) {
        try {
            return CM_Option::getInstance()->get($this->_getOptionName());
        } catch (CM_Db_Exception $e) {
            return false;
        }
    }

    /**
     * @return string
     */
    private function _getOptionName() {
        return 'SetupScript.' . $this->getType();
    }
}

<?php

abstract class CM_Provision_Script_OptionBased extends CM_Provision_Script_Abstract implements CM_Typed {

    use CM_Provision_Script_IsLoadedTrait;

    /**
     * @param bool $loaded
     */
    protected function _setLoaded($loaded) {
        CM_Option::getInstance()->set($this->_getOptionName(), (bool) $loaded);
    }

    /**
     * @param CM_Service_Manager $manager
     * @return bool
     */
    protected function _isLoaded(CM_Service_Manager $manager) {
        try {
            return CM_Option::getInstance()->get($this->_getOptionName());
        } catch (CM_Db_Exception $e) {
            return false;
        }
    }

    /**
     * @return string
     */
    private function _getOptionName() {
        return __CLASS__ . ':' . $this->getType();
    }
}

Use __CLASS__ for option name

Use __CLASS__ for option name


<?php

declare(strict_types=1);

/*
 * This file is part of Alt Three Segment.
 *
 * (c) Alt Three Services Limited
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

return [

    /*
    |--------------------------------------------------------------------------
    | Segment Write Key
    |--------------------------------------------------------------------------
    |
    | This option specifies key which enables you to write to Segment's API.
    |
    | Default: ''
    |
    */

    'write_key' => '',

];

<?php

declare(strict_types=1);

/*
 * This file is part of Alt Three Segment.
 *
 * (c) Alt Three Services Limited
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

return [

    /*
    |--------------------------------------------------------------------------
    | Segment Write Key
    |--------------------------------------------------------------------------
    |
    | This option specifies key which enables you to write to Segment's API.
    |
    | Default: ''
    |
    */

    'write_key' => '',
    'consumer' => null,
    'filename' => null,
];

Add environment variables for consumer and filename


<?php

namespace Annex\TenantBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class TenantController extends Controller
{
    /**
     * @Route("/tenant/list", name="tenant_list")
     */
    public function homeAction(Request $request)
    {
        $em = $this->getDoctrine()->getManager();
        /** @var \Annex\TenantBundle\Repository\TenantRepository $repo */
        $repo = $em->getRepository('AnnexTenantBundle:Tenant');
        $tenants = $repo->findAll();

        return $this->render('AnnexTenantBundle::tenant_admin/tenant_list.html.twig', [
            'appName' => $this->get('session')->get('appName'),
            'tenants' => $tenants
        ]);
    }
}

<?php

namespace Annex\TenantBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class TenantController extends Controller
{
    /**
     * @Route("/tenant/list", name="tenant_list")
     */
    public function tenantListAction()
    {
        if ($this->get('session')->get('tenantId')) {
            $this->addFlash('error', "Sorry, no can do.");
            return $this->redirectToRoute('homepage');
        }

        $em = $this->getDoctrine()->getManager();
        /** @var \Annex\TenantBundle\Repository\TenantRepository $repo */
        $repo = $em->getRepository('AnnexTenantBundle:Tenant');
        $tenants = $repo->findAll();

        return $this->render('AnnexTenantBundle::tenant_admin/tenant_list.html.twig', [
            'appName' => $this->get('session')->get('appName'),
            'tenants' => $tenants
        ]);
    }
}

Include tenant admin into main apps

Include tenant admin into main apps


<?php

/**
 * Status
 */
class CommentsStatus
{
  private $code;
  static private $domain_size = 100;
  static private $domains = array(
    'no_error'     => 0,
    'system_error' => 100,
    'dev_error'    => 200,
    'user_error'   => 300
  );
  private $exception;

  function __construct($code, $exception = null)
  {
    $this->code = $code;
    $this->exception = $exception;
  }

  public function getCode()
  {
    return $this->code;
  }

  public function getMessage()
  {
    if ($this->exception != null) {
      return $this->getException()->getMessage();
    }

    return "Status with code {$this->code}.";
  }

  public function getException()
  {
    return $this->exception;
  }

  public function isUserError()
  {
    $code = $this->code;
    $user_domain = CommentsStatus::$domains['user_error'];
    $size = CommentsStatus::$domain_size;

    return ($code >= $user_domain) && ($code < ($user_domain + $size));
  }
}

<?php

/**
 * Status
 */
class CommentsStatus
{
  private $code;
  static private $domain_size = 100;
  static private $domains = array(
    'no_error'     => 0,
    'system_error' => 100,
    'dev_error'    => 200,
    'user_error'   => 300
  );
  private $exception;

  function __construct($code, $exception = null)
  {
    $this->code = $code;
    $this->exception = $exception;
  }

  public function getCode()
  {
    return $this->code;
  }

  public function getMessage()
  {
    if ($this->exception != null) {
      return $this->getException()->getMessage();
    }

    return "Status with code {$this->code}.";
  }

  public function getException()
  {
    return $this->exception;
  }

  public function isUserError()
  {
    $code = $this->code;
    $user_domain = CommentsStatus::$domains['user_error'];
    $size = CommentsStatus::$domain_size;

    return ($code >= $user_domain) && ($code < ($user_domain + $size));
  }

  public function isError()
  {
    return $this->code >= CommentsStatus::$domain_size;
  }
}

Implement `isError` Method in CommentsStatus


<?php

namespace League\Tactician;

use League\Tactician\Exception\InvalidCommandException;
use League\Tactician\Exception\InvalidMiddlewareException;

/**
 * Receives a command and sends it through a chain of middleware for processing.
 *
 * @final
 */
class CommandBus
{
    /**
     * @var callable
     */
    private $middlewareChain;

    /**
     * @param Middleware[] $middleware
     */
    public function __construct(array $middleware)
    {
        $this->middlewareChain = $this->createExecutionChain($middleware);
    }

    /**
     * Executes the given command and optionally returns a value
     *
     * @param object $command
     *
     * @return mixed
     */
    public function handle($command)
    {
        if (!is_object($command)) {
            throw InvalidCommandException::forUnknownValue($command);
        }

        $middlewareChain = $this->middlewareChain;
        return $middlewareChain($command);
    }

    /**
     * @param Middleware[] $middlewareList
     *
     * @return callable
     */
    private function createExecutionChain($middlewareList)
    {
        $lastCallable = function ($command) {
            // the final callable is a no-op
        };

        while ($middleware = array_pop($middlewareList)) {
            if (! $middleware instanceof Middleware) {
                throw InvalidMiddlewareException::forMiddleware($middleware);
            }

            $lastCallable = function ($command) use ($middleware, $lastCallable) {
                return $middleware->execute($command, $lastCallable);
            };
        }

        return $lastCallable;
    }
}

<?php

namespace League\Tactician;

use League\Tactician\Exception\InvalidCommandException;
use League\Tactician\Exception\InvalidMiddlewareException;

/**
 * Receives a command and sends it through a chain of middleware for processing.
 *
 * @final
 */
class CommandBus
{
    /**
     * @var callable
     */
    private $middlewareChain;

    /**
     * @param Middleware[] $middleware
     */
    public function __construct(array $middleware)
    {
        $this->middlewareChain = $this->createExecutionChain($middleware);
    }

    /**
     * Executes the given command and optionally returns a value
     *
     * @param object $command
     *
     * @return mixed
     */
    public function handle($command)
    {
        if (!is_object($command)) {
            throw InvalidCommandException::forUnknownValue($command);
        }

        $middlewareChain = $this->middlewareChain;
        return $middlewareChain($command);
    }

    /**
     * @param Middleware[] $middlewareList
     *
     * @return callable
     */
    private function createExecutionChain($middlewareList)
    {
        $lastCallable = function () {
            // the final callable is a no-op
        };

        while ($middleware = array_pop($middlewareList)) {
            if (! $middleware instanceof Middleware) {
                throw InvalidMiddlewareException::forMiddleware($middleware);
            }

            $lastCallable = function ($command) use ($middleware, $lastCallable) {
                return $middleware->execute($command, $lastCallable);
            };
        }

        return $lastCallable;
    }
}

Remove unused parameter in no-op closure


<?php

require __DIR__.'/../vendor/autoload.php';

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class HelloController
{
    public function worldAction(Request $request)
    {
        return new Response("Hallo welt, got swag yo!\n");
    }
}

$container = Yolo\createContainer(
    [
        'debug' => true,
    ],
    [
        new Yolo\DependencyInjection\MonologExtension(),
        new Yolo\DependencyInjection\ServiceControllerExtension(),
        new Yolo\DependencyInjection\CallableExtension(
            'controller',
            function (array $config, ContainerBuilder $container) {
                $container->register('hello.controller', 'HelloController');
            }
        ),
    ]
);

$app = new Yolo\Application($container);

$app->get('/', 'hello.controller:worldAction');

$app->run();

<?php

require __DIR__.'/../vendor/autoload.php';

class HelloController
{
    public function worldAction($request)
    {
        return "Hallo welt, got swag yo!\n";
    }
}

$container = Yolo\createContainer(
    [
        'debug' => true,
    ],
    [
        new Yolo\DependencyInjection\MonologExtension(),
        new Yolo\DependencyInjection\ServiceControllerExtension(),
        new Yolo\DependencyInjection\CallableExtension(
            'controller',
            function ($configs, $container) {
                $container->register('hello.controller', 'HelloController');
            }
        ),
    ]
);

$app = new Yolo\Application($container);

$app->get('/', 'hello.controller:worldAction');

$app->run();

Remove type hints, rename $config => $configs


<?php
/**
 * @author Jean Silva <jeancsil@gmail.com>
 * @license MIT
 */
namespace Jeancsil\FlightSpy\Api\Flights;

use Jeancsil\FlightSpy\Api\DataTransfer\SessionParameters;
use Jeancsil\FlightSpy\Api\Http\TransportAwareTrait;

class LivePrice
{
    use TransportAwareTrait;

    public function getDeals(SessionParameters $parameters) {
        return $this->transport->findQuotes($parameters);
    }
}

<?php
/**
 * @author Jean Silva <jeancsil@gmail.com>
 * @license MIT
 */
namespace Jeancsil\FlightSpy\Api\Flights;

use Jeancsil\FlightSpy\Api\DataTransfer\SessionParameters;
use Jeancsil\FlightSpy\Api\Http\TransportAwareTrait;

class LivePrice
{
    use TransportAwareTrait;

    /**
     * @param SessionParameters $parameters
     * @return array
     */
    public function getDeals(SessionParameters $parameters) {
        return $this->transport->findQuotes($parameters);
    }

    /**
     * @param array $parameters
     * @return array
     */
    public function getMultiDeals(array $parameters) {
        $response = [];
        foreach ($parameters as $parameter) {
            if (!$parameter instanceof SessionParameters) {
                throw new \LogicException(sprintf('Instance of SessionParameters need. Given %s.', $parameter));
            }

            $response[] = $this->transport->findQuotes($parameter);
        }

        return $response;
    }
}

Create the multiProcess method to process more than one watching deal each time.


<?php

namespace APIJet;

class Response
{
    private function __construct() {}
    private function __clone() {}

    const CODE_404  = '';
    const CODE_200  = '';

    private static $code;

    public static function setCode($code) {
        // some validation for this code
        self::$code = $code;
    }

    public static function getCode() {
        return self::$code;
    }

    public static function render()
    {
        self::sendHeaders();
        self::sendBody();
    }

    private static function sendHeaders()
    {

    }

    private static function sendBody()
    {

    }

}

<?php

namespace APIJet;

class Response
{
    private function __construct() {}
    private function __clone() {}

    const CODE_404  = '';
    const CODE_200  = '';

    private static $code = 200;
    private static $body = [];
    private static $headers = [];

    public static function setCode($code)
    {
        self::$code = $code;
    }

    public static function getCode()
    {
        return self::$code;
    }

    public static function setBody($body)
    {
        self::$body = $body;
    }

    public static function render()
    {
        self::sendHeaders();
        self::sendBody();
    }

    private static function sendHeaders()
    {
        http_response_code(self::getCode());
        header('Content-type: application/json');
    }

    private static function sendBody()
    {
        echo json_encode(self::$body);
    }
}

Add send headers and body for response

Add send headers and body for response


<?php

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

namespace Symfony\Bundle\FrameworkBundle\DataCollector;

use Symfony\Bundle\FrameworkBundle\Controller\RedirectController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\DataCollector\RouterDataCollector as BaseRouterDataCollector;

/**
 * RouterDataCollector.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 *
 * @final since Symfony 4.4
 */
class RouterDataCollector extends BaseRouterDataCollector
{
    public function guessRoute(Request $request, $controller)
    {
        if (\is_array($controller)) {
            $controller = $controller[0];
        }

        if ($controller instanceof RedirectController) {
            return $request->attributes->get('_route');
        }

        return parent::guessRoute($request, $controller);
    }
}

<?php

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

namespace Symfony\Bundle\FrameworkBundle\DataCollector;

use Symfony\Bundle\FrameworkBundle\Controller\RedirectController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\DataCollector\RouterDataCollector as BaseRouterDataCollector;

/**
 * RouterDataCollector.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 *
 * @final
 */
class RouterDataCollector extends BaseRouterDataCollector
{
    public function guessRoute(Request $request, $controller)
    {
        if (\is_array($controller)) {
            $controller = $controller[0];
        }

        if ($controller instanceof RedirectController) {
            return $request->attributes->get('_route');
        }

        return parent::guessRoute($request, $controller);
    }
}

Remove \Throwable support deprecation layer


<?php

/*
 * This file is part of the ONGR package.
 *
 * (c) NFQ Technologies UAB <info@nfq.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace ONGR\ContentBundle\Tests\Unit\Document;

use ONGR\ContentBundle\Document\UrlObject;

/**
 * Provides tests for url object.
 */
class UrlObjectTest extends \PHPUnit_Framework_TestCase
{
    /**
     * Provides data for testUrlObject().
     *
     * @return array
     */
    public function urlObjectDataProvider()
    {
        $data = [
            [
                [
                    'url' => 'http://ongr.io',
                    'key' => 'key1',
                ],
            ],
            [
                [
                    'url' => 'http://ongr.io/use-case/',
                    'key' => 'key2',
                ],
            ],
        ];

        return $data;
    }

    /**
     * Tests url object.
     *
     * @param array $data
     *
     * @dataProvider urlObjectDataProvider()
     */
    public function testUrlObject(array $data)
    {
        /** @var UrlObject $url */
        $url = $this->getMock('ONGR\ContentBundle\Document\UrlObject', null);
        $url->setUrl($data['url']);
        $this->assertEquals($data['url'], $url->getUrl());

        $url->setUrlKey($data['key']);
        $this->assertEquals($data['key'], $url->getUrlKey());
    }
}

<?php

/*
 * This file is part of the ONGR package.
 *
 * (c) NFQ Technologies UAB <info@nfq.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace ONGR\ContentBundle\Tests\Unit\Document;

use ONGR\ContentBundle\Document\UrlObject;

/**
 * Provides tests for url object.
 */
class UrlObjectTest extends \PHPUnit_Framework_TestCase
{
    /**
     * Provides data for testUrlObject().
     *
     * @return array
     */
    public function urlObjectDataProvider()
    {
        $data = [
            [
                [
                    'url' => 'http://ongr.io',
                    'key' => 'key1',
                ],
            ],
            [
                [
                    'url' => 'http://ongr.io/use-case/',
                    'key' => 'key2',
                ],
            ],
        ];

        return $data;
    }

    /**
     * Tests url object.
     *
     * @param array $data
     *
     * @dataProvider urlObjectDataProvider()
     */
    public function testUrlObject(array $data)
    {
        /** @var UrlObject $url */
        $url = $this->getMock('ONGR\ContentBundle\Document\UrlObject', null);
        $url->setUrl($data['url']);
        $this->assertEquals($data['url'], $url->getUrl());

        $url->setKey($data['key']);
        $this->assertEquals($data['key'], $url->getKey());
    }
}

Test fixed for CategoryService Test updated for UrlObject after change


<?php

/**
 * Remove parent theme scripts so we can handle all the scripts that are included
 * @see de_grona_15_add_scripts()
 */

function dequeue_parent_theme_scripts() {
  wp_dequeue_script( 'modernizr' );
  wp_dequeue_script( 'foundation' );
}

add_action( 'wp_enqueue_scripts', 'dequeue_parent_theme_scripts', 9999 );

/**
* Remove parent theme widgets (because it's easier to handle all the sidebars in this theme)
*/
function remove_parent_theme_widgets(){

  unregister_sidebar( 'sidebar-widgets' );
  unregister_sidebar( 'footer-widgets' );

}

add_action( 'widgets_init', 'remove_parent_theme_widgets', 11 );

/**
* Unset parent theme page templates that we don't want to show
*/
function remove_parent_theme_page_templates( $templates ) {
    unset( $templates['kitchen-sink.php'] );
    unset( $templates['hero.php'] );
    return $templates;
}

add_filter( 'theme_page_templates', 'remove_parent_theme_page_templates' );

/**
* Remove some theme support
*/
function remove_parent_theme_support() {

  // This will remove support for custom header
  remove_theme_support( 'custom-header' );

}

add_action( 'after_setup_theme', 'remove_parent_theme_support', 11 );

<?php

/**
 * Remove parent theme scripts so we can handle all the scripts that are included
 * @see de_grona_15_add_scripts()
 */

function dequeue_parent_theme_scripts() {
  wp_dequeue_script( 'modernizr' );
}

add_action( 'wp_enqueue_scripts', 'dequeue_parent_theme_scripts', 9999 );

/**
* Remove parent theme widgets (because it's easier to handle all the sidebars in this theme)
*/
function remove_parent_theme_widgets(){

  unregister_sidebar( 'sidebar-widgets' );
  unregister_sidebar( 'footer-widgets' );

}

add_action( 'widgets_init', 'remove_parent_theme_widgets', 11 );

/**
* Unset parent theme page templates that we don't want to show
*/
function remove_parent_theme_page_templates( $templates ) {
    unset( $templates['kitchen-sink.php'] );
    unset( $templates['hero.php'] );
    return $templates;
}

add_filter( 'theme_page_templates', 'remove_parent_theme_page_templates' );

/**
* Remove some theme support
*/
function remove_parent_theme_support() {

  // This will remove support for custom header
  remove_theme_support( 'custom-header' );

}

add_action( 'after_setup_theme', 'remove_parent_theme_support', 11 );

Add foundation script so mobile menu works


<?php

namespace Per3evere\Preq;

use Illuminate\Foundation\Application as LaravelApplication;
use Laravel\Lumen\Application as LumenApplication;
use Illuminate\Support\ServiceProvider;

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

    /**
     * Bootstrap the configuration
     *
     * @return void
     */
    public function boot()
    {
        $source = realpath(__DIR__ . '/../config/preq.php');

        if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
            $this->publishes([$source => config_path('preq.php')]);
        } elseif ($this->app insteadof LumenApplication) {
            $this->app->configure('preq');
        }

        $this->mergeConfigFrom($source, 'preq');
    }

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

            return new CommandFactory($config);
        });
    }

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

<?php

namespace Per3evere\Preq;

use Illuminate\Foundation\Application as LaravelApplication;
use Laravel\Lumen\Application as LumenApplication;
use Illuminate\Support\ServiceProvider;

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

    /**
     * Bootstrap the configuration
     *
     * @return void
     */
    public function boot()
    {
        $source = realpath(__DIR__ . '/../config/preq.php');

        if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
            $this->publishes([$source => config_path('preq.php')]);
        } elseif ($this->app instanceof LumenApplication) {
            $this->app->configure('preq');
        }

        $this->mergeConfigFrom($source, 'preq');
    }

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

            return new CommandFactory($config);
        });
    }

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

Fix syntax error, unexpected 'insteadof'.


<?php

namespace Harp\Timestamps;

use Harp\Harp\AbstractModel;

/**
 * @author    Ivan Kerin <ikerin@gmail.com>
 * @copyright 2014, Clippings Ltd.
 * @license   http://spdx.org/licenses/BSD-3-Clause
 */
trait TimestampsRepoTrait
{
    public function getCurrentDate()
    {
        return date('Y-m-d H:i:s');
    }

    public function initializeTimestamps()
    {
        $self = $this;

        $this
            ->addEventBeforeSave(function (AbstractModel $model) use ($self) {
                $model->updatedAt = $self->getCurrentDate();
            })
            ->addEventBeforeInsert(function (AbstractModel $model) use ($self) {
                $model->createdAt = $self->getCurrentDate();
            });
    }
}

<?php

namespace Harp\Timestamps;

use Harp\Harp\AbstractModel;

/**
 * @author    Ivan Kerin <ikerin@gmail.com>
 * @copyright 2014, Clippings Ltd.
 * @license   http://spdx.org/licenses/BSD-3-Clause
 */
trait TimestampsRepoTrait
{
    public function getCurrentDate()
    {
        return date('Y-m-d H:i:s');
    }

    public function initializeTimestamps()
    {
        $self = $this;

        return $this
            ->addEventBeforeSave(function (AbstractModel $model) use ($self) {
                $model->updatedAt = $self->getCurrentDate();
            })
            ->addEventBeforeInsert(function (AbstractModel $model) use ($self) {
                $model->createdAt = $self->getCurrentDate();
            });
    }
}

Fix chaining of initialise method

:bug: Fix chaining of initialise method


<?php

class Scrivener {

	private static $_instance;

	/**
	 * Setup singleton Scrivener instance
	 *
	 * @since 0.1.0
	 * @uses add_filter
	 * @return void
	 */
	private function __construct() {
		add_filter( 'preview_post_link', array( $this, 'filter_preview_post_link' ) );
	}

	/**
	 * Filter preview post link
	 *
	 * @param string $link
	 * @since 0.1.0
	 * @uses admin_url
	 * @return string
	 */
	public function filter_preview_post_link( $link ) {
		global $post;
		return admin_url( 'admin-post.php?action=weiverp&p=' . $post->ID );
	}

	/**
	 * Initialize class and return an instance of it
	 *
	 * @since 0.1.0
	 * @return Scrivener
	 */
	public function init() {
		if ( ! isset( self::$_instance ) ) {
			self::$_instance = new Scrivener;
		}

		return self::$_instance;
	}

}

Scrivener::init();

<?php

class Scrivener {

	private static $_instance;

	/**
	 * Setup singleton Scrivener instance
	 *
	 * @since 0.1.0
	 * @uses add_filter, add_action
	 * @return void
	 */
	private function __construct() {
		add_filter( 'preview_post_link', array( $this, 'filter_preview_post_link' ) );
		add_action( 'admin_enqueue_scripts', array( $this, 'action_admin_enqueue_scripts' ) );
	}

	/**
	 * Enqueue admin scripts for plugin
	 *
	 * @param string $hook
	 * @since 0.1.0
	 * @uses wp_enqueue_script
	 * @return void
	 */
	public function action_admin_enqueue_scripts( $hook ) {
		if ( 'post.php' != $hook && 'post-new.php' != $hook )
			return;

		//wp_enqueue_script();
	}

	/**
	 * Filter preview post link
	 *
	 * @param string $link
	 * @since 0.1.0
	 * @uses admin_url
	 * @return string
	 */
	public function filter_preview_post_link( $link ) {
		global $post;
		return admin_url( 'admin-post.php?action=weiverp&p=' . $post->ID );
	}

	/**
	 * Initialize class and return an instance of it
	 *
	 * @since 0.1.0
	 * @return Scrivener
	 */
	public function init() {
		if ( ! isset( self::$_instance ) ) {
			self::$_instance = new Scrivener;
		}

		return self::$_instance;
	}

}

Scrivener::init();

Add skeleton for enqueuing scripts

Add skeleton for enqueuing scripts


<?php
$i = 0;
$callouts = get_field("callouts");
?>

<?php if ($callouts): ?>
    <?php while (have_rows("callouts")): ?>
        <?php the_row(); ?>

        <?php
        $title = get_sub_field("title");
        $content = get_sub_field("content");
        ?>

        <?php if ($title || $content): ?>
            <?php $i++; ?>

            <?php if ($i === 1 || ($i - 1) % 3 === 0): ?>

            <?php endif; ?>

                    <?php if ($title): ?>

<?php echo $title; ?>

                    <?php endif; ?>
                    <?php if ($content): ?>

<?php echo $content; ?>

                    <?php endif;?>

            <?php if ($i === count($callouts) || $i % 3 === 0): ?>

            <?php endif;?>
        <?php endif; // if ($titile || $content) ?>
    <?php endwhile; // while (have_rows("callouts")) ?>
<?php endif; // if ($callouts) ?>

Remove flex helper from fromt page callouts


<?php

// PHP 5.3 minimum
if (version_compare(PHP_VERSION, '5.3.3', '<')) {
    die('This software require PHP 5.3.3 minimum');
}

// Short tags must be enabled for PHP < 5.4
if (version_compare(PHP_VERSION, '5.4.0', '<')) {

    if (! ini_get('short_open_tag')) {
        die('This software require to have short tags enabled, check your php.ini => "short_open_tag = On"');
    }
}

// Check extension: PDO Sqlite
if (! extension_loaded('pdo_sqlite')) {
    die('PHP extension required: pdo_sqlite');
}

// Check extension: mbstring
if (! extension_loaded('mbstring')) {
    die('PHP extension required: mbstring');
}

// Check if /data is writeable
if (! is_writable('data')) {
    die('The directory "data" must be writeable by your web server user');
}

// Include password_compat for PHP < 5.5
if (version_compare(PHP_VERSION, '5.5.0', '<')) {
    require __DIR__.'/vendor/password.php';
}

<?php

// PHP 5.3.3 minimum
if (version_compare(PHP_VERSION, '5.3.3', '<')) {
    die('This software require PHP 5.3.3 minimum');
}

// Checks for PHP < 5.4
if (version_compare(PHP_VERSION, '5.4.0', '<')) {

    // Short tags must be enabled for PHP < 5.4
    if (! ini_get('short_open_tag')) {
        die('This software require to have short tags enabled if you have PHP < 5.4 ("short_open_tag = On")');
    }

    // Magic quotes are deprecated since PHP 5.4
    if (get_magic_quotes_gpc()) {
        die('This software require to have "Magic quotes" disabled, it\'s deprecated since PHP 5.4 ("magic_quotes_gpc = Off")');
    }
}

// Check extension: PDO Sqlite
if (! extension_loaded('pdo_sqlite')) {
    die('PHP extension required: pdo_sqlite');
}

// Check extension: mbstring
if (! extension_loaded('mbstring')) {
    die('PHP extension required: mbstring');
}

// Check if /data is writeable
if (! is_writable('data')) {
    die('The directory "data" must be writeable by your web server user');
}

// Include password_compat for PHP < 5.5
if (version_compare(PHP_VERSION, '5.5.0', '<')) {
    require __DIR__.'/vendor/password.php';
}

Make sure that magic quotes are disabled for PHP < 5.4


<?php
/**
 * Interface for the file system models.
 *
 * This defines the interface for any model that wants to interact with a remote file system.
 * @author Jaisen Mathai <jaisen@jmathai.com>
 */
interface FileSystemInterface
{
  public function deletePhoto($id);
  public function getPhoto($filename);
  public function putPhoto($localFile, $remoteFile);
  public function putPhotos($files);
  public function getHost();
  public function initialize();
}

/**
  * The public interface for instantiating a file system obect.
  * This returns the appropriate type of object by reading the config.
  * Accepts a set of params that must include a type and targetType
  *
  * @param string $type Optional type parameter which defines the type of file system.
  * @return object A file system object that implements FileSystemInterface
  */
function getFs(/*$type*/)
{
  static $filesystem, $type;
  if($filesystem)
    return $filesystem;

  if(func_num_args() == 1)
    $type = func_get_arg(0);

  // load configs only once
  if(!$type)
    $type = getConfig()->get('systems')->fileSystem;

  switch($type)
  {
    case 'S3':
      $filesystem = new FileSystemS3();
      break;
    case 'localfs':
      $filesystem = new FileSystemLocal();
      break;
  }

  if($filesystem)
    return $filesystem;

  throw new Exception("FileSystem Provider {$type} does not exist", 404);
}

<?php
/**
 * Interface for the file system models.
 *
 * This defines the interface for any model that wants to interact with a remote file system.
 * @author Jaisen Mathai <jaisen@jmathai.com>
 */
interface FileSystemInterface
{
  public function deletePhoto($id);
  public function getPhoto($filename);
  public function putPhoto($localFile, $remoteFile);
  public function putPhotos($files);
  public function getHost();
  public function initialize();
}

/**
  * The public interface for instantiating a file system obect.
  * This returns the appropriate type of object by reading the config.
  * Accepts a set of params that must include a type and targetType
  *
  * @param string $type Optional type parameter which defines the type of file system.
  * @return object A file system object that implements FileSystemInterface
  */
function getFs(/*$type*/)
{
  static $filesystem, $type;
  if($filesystem)
    return $filesystem;

  if(func_num_args() == 1)
    $type = func_get_arg(0);

  // load configs only once
  if(!$type)
    $type = getConfig()->get('systems')->fileSystem;

  switch($type)
  {
    case 'S3':
      $filesystem = new FileSystemS3();
      break;
    case 'LocalFs':
      $filesystem = new FileSystemLocal();
      break;
  }

  if($filesystem)
    return $filesystem;

  throw new Exception("FileSystem Provider {$type} does not exist", 404);
}

Fix a typo that make the setup fail for localfs


<?php

namespace Nocks\SDK\Addon;

use GuzzleHttp\Client;

/**
 * Class Rate
 * @package Nocks\SDK\Addon
 */
class Rate
{
    public function __construct()
    {
        $this->client = new Client();
    }

    function getCurrentRate($currencyCode)
    {
        $rate = 0;

        if(in_array($currencyCode, array('USD', 'GBP', 'EUR')))
        {
            // Powered by CoinDesk
            $response = $this->client->get('https://api.coindesk.com/v1/bpi/currentprice.json');
            $response = json_decode($response->getBody()->getContents(), true);

            if(isset($response['bpi'][$currencyCode]['rate']))
            {
                $rate = $response['bpi'][$currencyCode]['rate'];
            }
        }
        elseif(in_array($currencyCode, array('BTC', 'NLG')))
        {
            // Powered by Bittrex
            $response = $this->client->get('https://bittrex.com/api/v1.1/public/getticker?market=BTC-NLG');
            $response = json_decode($response->getBody()->getContents(), true);

            if(isset($response['result']['Last']))
            {
                $rate = $response['result']['Last'];
            }
        }

        return str_replace(',', '', $rate);
    }
}

<?php

namespace Nocks\SDK\Addon;

use GuzzleHttp\Client;

/**
 * Class Rate
 * @package Nocks\SDK\Addon
 */
class Rate
{
    public function __construct()
    {
        $this->client = new Client();
    }

    function getCurrentRate($currencyCode)
    {
        $rate = 0;

        if(in_array($currencyCode, array('USD', 'GBP', 'EUR')))
        {
            // Powered by CoinDesk
            $response = $this->client->get('https://api.coindesk.com/v1/bpi/currentprice.json');
            $response = json_decode($response->getBody()->getContents(), true);

            if(isset($response['bpi'][$currencyCode]['rate']))
            {
                $rate = $response['bpi'][$currencyCode]['rate'];
            }
        }
        elseif(in_array($currencyCode, array('BTC', 'NLG')))
        {
            $btc_eur = $this->getCurrentRate('EUR');

            $response = $this->client->get('http://nocks.co/api/market?call=nlg', [
                'headers' => [
                    'Accept' => '*/*'
                ]
            ]);
            $response = json_decode($response->getBody()->getContents(), true);

            if(isset($response['last']))
            {
                $rate = number_format($response['last'] / $btc_eur, 8);
            }
        }

        return str_replace(',', '', $rate);
    }
}

Call Nocks API instead of Bittrex directly


<?php
class Infusionsoft_DataServiceBase extends Infusionsoft_Service{

}

<?php
class Infusionsoft_DataServiceBase extends Infusionsoft_Service{

    public static function authenticateUser($username, $passwordHash, Infusionsoft_App $app = null){
        $params = array(
            $username,
            $passwordHash
        );
        return parent::send($app, "DataService.authenticateUser", $params);
    }

}

Put AuthenticateUser method back into DataService Base


<?php if (!defined('CLYDEPHP')) die("Direct access not allowed") ;?>
<?php

	$cacheTimeout=10; //timeout in seconds

	if (is_writable(getDataDir())) {
		EventManager::getInstance()->getEvent("processRequest")->subscribe("cacheRequest");
		EventManager::getInstance()->getEvent("processResponse")->subscribe("cacheResponse");
	}

	function cacheRequest($req) {

		$db = Database::getDatabase("cache");

		$cacheid = $req->getHeader("REQUEST-URI");
		if (file_exists($db->table(true))) {
			if ($db->lock()) {
				if ($row = $db->getRow($cacheid,false)) {
					//is valid
					if ($row[$cacheid]['expiration']>time()) {
						$resp = $row[$cacheid]['data'];
						$resp->send();
						$db->release();
						exit();
					}
				}
				$db->release();
			}
		}
	}

	function cacheResponse($req,$resp) {

		global $cacheTimeout;

		$db = Database::getDatabase("cache");
		$cacheid = $req->getHeader("REQUEST-URI");
		if ($db->lock()) {
			$db->insertRow(array($cacheid=>array("data"=>$resp,"expiration"=>time()+$cacheTimeout)),false);
			$db->release();
		}
	}

<?php if (!defined('CLYDEPHP')) die("Direct access not allowed") ;?>
<?php

	$cacheTimeout=60; //timeout in seconds

	if (is_writable(getDataDir())) {
		EventManager::getInstance()->getEvent("processRequest")->subscribe("cacheRequest");
		EventManager::getInstance()->getEvent("processResponse")->subscribe("cacheResponse");
	}

	function cacheRequest($req) {

		$db = Database::getDatabase("cache");

		$cacheid = $req->getHeader("REQUEST-URI");
		if (file_exists($db->table(true))) {
			if (File::lock($db->table(true),null,null)) {
				if ($row = $db->getRow($cacheid,false)) {
					//is valid
					if ($row[$cacheid]['expiration']>time()) {
						$resp = $row[$cacheid]['data'];
						$resp->send();
						File::release($db->table(true));
						exit();
					}
				}
				File::release($db->table(true));
			}
		}
	}

	function cacheResponse($req,$resp) {

		global $cacheTimeout;

		$db = Database::getDatabase("cache");
		$cacheid = $req->getHeader("REQUEST-URI");

		if (File::lock($db->table(true),null,null)) {
			$db->insertRow(array($cacheid=>array("data"=>$resp,"expiration"=>time()+$cacheTimeout)),false);
			File::release($db->table(true));
		}
	}

Use clydephp lock functions instead of db lock mechanism to avoid polling


<?php

namespace HotfixBundle\DependencyInjection\Compiler;

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

class ViewListenerPriorityPass implements CompilerPassInterface
{
    /**
     * {@inheritdoc}
     */
    public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition('oro_ui.view.listener')) {
            return;
        }

        $definition = $container->getDefinition('oro_ui.view.listener');
        $tags = $definition->getTags();

        if (array_key_exists('kernel.event_listener', $tags)) {
            foreach ($tags['kernel.event_listener'] as &$tag) {
                if (array_key_exists('event', $tag) && 'kernel.view' === $tag['event']) {
                    $tag['priority'] = 50;
                }
            }

            $definition->setTags($tags);
        }
    }
}

<?php

namespace HotfixBundle\DependencyInjection\Compiler;

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

class ViewListenerPriorityPass implements CompilerPassInterface
{
    /**
     * {@inheritdoc}
     */
    public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition('oro_ui.view.listener')) {
            return;
        }

        $definition = $container->getDefinition('oro_ui.view.listener');
        $tags = $definition->getTags();

        if (array_key_exists('kernel.event_listener', $tags)) {
            foreach ($tags['kernel.event_listener'] as &$tag) {
                if (array_key_exists('event', $tag) && 'kernel.view' === $tag['event']) {
                    $tag['priority'] = 255; // 50 does not always seem to be enough
                }
            }

            $definition->setTags($tags);
        }
    }
}

Make UI view listener priority higher

Make UI view listener priority higher


<?php

namespace Avanzu\AdminThemeBundle\Controller;

use Avanzu\AdminThemeBundle\Form\FormDemoModelType;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

/**
 * Class DefaultController
 *
 * @package Avanzu\AdminThemeBundle\Controller
 */
class DefaultController extends Controller
{
    /**
     * @Template()
     */
    public function indexAction()
    {
        return [];
    }

    /**
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function dashboardAction() {
        return $this->render('AvanzuAdminThemeBundle:Default:index.html.twig');
    }

    /**
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function uiGeneralAction() {
        return $this->render('AvanzuAdminThemeBundle:Default:index.html.twig');
    }

    public function uiIconsAction() {
        return $this->render('AvanzuAdminThemeBundle:Default:index.html.twig');
    }

    public function formAction() {
        $form = $this->createForm(FormDemoModelType::class);

        return $this->render('AvanzuAdminThemeBundle:Default:form.html.twig', [
                'form' => $form->createView(),
            ]);
    }

    public function loginAction() {
        return $this->render('AvanzuAdminThemeBundle:Default:login.html.twig');
    }
}

<?php

namespace Avanzu\AdminThemeBundle\Controller;

use Avanzu\AdminThemeBundle\Form\FormDemoModelType;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

/**
 * Class DefaultController
 *
 * @package Avanzu\AdminThemeBundle\Controller
 */
class DefaultController extends Controller
{
    /**
     * @Template()
     */
    public function indexAction()
    {
        return $this->render('AvanzuAdminThemeBundle:Default:index.html.twig');
    }

    /**
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function dashboardAction() {
        return $this->render('AvanzuAdminThemeBundle:Default:index.html.twig');
    }

    /**
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function uiGeneralAction() {
        return $this->render('AvanzuAdminThemeBundle:Default:index.html.twig');
    }

    public function uiIconsAction() {
        return $this->render('AvanzuAdminThemeBundle:Default:index.html.twig');
    }

    public function formAction() {
        $form = $this->createForm(FormDemoModelType::class);

        return $this->render('AvanzuAdminThemeBundle:Default:form.html.twig', [
                'form' => $form->createView(),
            ]);
    }

    public function loginAction() {
        return $this->render('AvanzuAdminThemeBundle:Default:login.html.twig');
    }
}

Fix default render file page

Fix default render file page


<?php $unique_id = esc_attr(uniqid('search-form-')); ?>

<form role="search" method="get" class="search-form" action="<?php echo esc_url(home_url('/')); ?>">
    <label class="sr-only" for="<?php echo $unique_id; ?>"><?php echo _x('Search for:', 'label', 'keitaro'); ?>

        <input type="search" id="<?php echo $unique_id; ?>" class="form-control search-field" placeholder="<?php echo esc_attr_x('Search …', 'placeholder', 'keitaro'); ?>" value="<?php echo get_search_query(); ?>" name="s" />

            <button type="submit" class="btn btn-default"></button>

</form>

<?php $unique_id = esc_attr(uniqid('search-form-')); ?>

<form role="search" method="get" class="search-form" action="<?php echo esc_url(home_url('/')); ?>">
    <label class="sr-only" for="<?php echo $unique_id; ?>"><?php echo _x('Search for:', 'label', 'keitaro'); ?>

        <input type="search" id="<?php echo $unique_id; ?>" class="form-control search-field" placeholder="<?php echo esc_attr_x('Search …', 'placeholder', 'keitaro'); ?>" required="required" value="<?php echo get_search_query(); ?>" name="s" />

            <button type="submit" class="btn btn-default"></button>

</form>

Make search field input required

Make search field input required


@if($errors->any())

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

{{ $error }}

        @endforeach

@endif

@if ($errors->any())

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

{{ $error }}

        @endforeach

@endif

Remove the extra wrapper which was messing with the alignment


<?php declare(strict_types=1);
/*
 * This file is part of PHPUnit.
 *
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace PHPUnit\Framework\MockObject;

use PHPUnit\Framework\MockObject\Builder\InvocationMocker as BuilderInvocationMocker;
use PHPUnit\Framework\MockObject\Matcher\Invocation;

/**
 * @method InvocationMocker method($constraint)
 */
interface MockObject /*extends Verifiable*/
{
    public function __phpunit_setOriginalObject($originalObject): void;

    public function __phpunit_getInvocationMocker(): InvocationMocker;

    public function __phpunit_verify(bool $unsetInvocationMocker = true): void;

    public function __phpunit_hasMatchers(): bool;

    public function __phpunit_setReturnValueGeneration(bool $returnValueGeneration): void;

    public function expects(Invocation $matcher): BuilderInvocationMocker;
}

<?php declare(strict_types=1);
/*
 * This file is part of PHPUnit.
 *
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace PHPUnit\Framework\MockObject;

use PHPUnit\Framework\MockObject\Builder\InvocationMocker as BuilderInvocationMocker;
use PHPUnit\Framework\MockObject\Matcher\Invocation;

/**
 * @method BuilderInvocationMocker method($constraint)
 */
interface MockObject /*extends Verifiable*/
{
    public function __phpunit_setOriginalObject($originalObject): void;

    public function __phpunit_getInvocationMocker(): InvocationMocker;

    public function __phpunit_verify(bool $unsetInvocationMocker = true): void;

    public function __phpunit_hasMatchers(): bool;

    public function __phpunit_setReturnValueGeneration(bool $returnValueGeneration): void;

    public function expects(Invocation $matcher): BuilderInvocationMocker;
}

Fix class name in doc block

Fix class name in doc block

When putting the annotation back we forgot to use the aliased name. This
fixes it, making static analysers and IDEs work as expected.

More info: 31df2e805fe0cf184bdfcb528a696dc1daae40c3


<?php
/**
 * @version		$Id$
 * @category	Koowa
 * @package		Koowa_Pattern
 * @subpackage	Observer
 * @copyright	Copyright (C) 2007 - 2010 Johan Janssens and Mathias Verraes. All rights reserved.
 * @license		GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
 * @link     	http://www.koowa.org
 */

/**
 * Abstract observer class to implement the observer design pattern
 *
 * @author		Johan Janssens <johan@koowa.org>
 * @category	Koowa
 * @package     Koowa_Pattern
 * @subpackage  Observer
 */
interface KPatternObserver
{
	/**
	 * Event received in case the observables states has changed
	 *
	 * @param	object	An associative array of arguments
	 * @return mixed
	 */
	public function update(ArrayObject $args);

	/**
	 * This function returns an unique identifier for the object. This id can be used as
	 * a hash key for storing objects or for identifying an object
	 *
	 * @return string A string that is unique
	 */
	public function getHandle();
}

<?php
/**
 * @version		$Id$
 * @category	Koowa
 * @package		Koowa_Pattern
 * @subpackage	Observer
 * @copyright	Copyright (C) 2007 - 2010 Johan Janssens and Mathias Verraes. All rights reserved.
 * @license		GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
 * @link     	http://www.koowa.org
 */

/**
 * Abstract observer class to implement the observer design pattern
 *
 * @author		Johan Janssens <johan@koowa.org>
 * @category	Koowa
 * @package     Koowa_Pattern
 * @subpackage  Observer
 */
interface KPatternObserver
{
	/**
	 * Event received in case the observables states has changed
	 *
	 * @param	object	An associative array of arguments
	 * @return mixed
	 */
	public function update(KConfig $args);

	/**
	 * This function returns an unique identifier for the object. This id can be used as
	 * a hash key for storing objects or for identifying an object
	 *
	 * @return string A string that is unique
	 */
	public function getHandle();
}

Update method should use KConfig instead of ArrayObject as parameter.


<?php

namespace AM2Studio\Laravel\Exporter;

trait Exporter
{
    public function exportOneSheet($collection, array $columns, $title, $filename, $format = 'xls', $creator = '', $company = '')
    {
        $rows = [];
        $rows[] = array_values($columns);
        foreach ($collection as $item) {
            $row = [];
            foreach ($columns as $attribute => $title) {
                $pos = strpos($attribute, '.');
                if ($pos !== false) {
                    $right = $attribute;
                    while ($pos !== false) {
                        $left = substr($right, 0, $pos);
                        $right = substr($right, ($pos + 1));

                        $pos = strpos($right, '.');
                        $relation = $item->$left;
                    }
                    $row[] = $relation->$right;
                } else {
                    $row[] = $item->$attribute;
                }
            }
            $rows[] = $row;
        };

        return \Maatwebsite\Excel\Facades\Excel::create($filename, function ($excel) use ($rows, $title, $creator, $company) {
            $excel->setTitle($title);
            $excel->setCreator($creator)->setCompany($company);
            $excel->sheet($title, function ($sheet) use ($rows) {
                $sheet->fromArray($rows, null, 'A1', false, false);
            });
        })->download($format);
    }

    public function exportMoreSheets($headings, $model, $config)
    {
        exit('not implemented');
    }
}

<?php

namespace AM2Studio\Laravel\Exporter;

trait Exporter
{
    public function exportOneSheet($collection, array $columns, $title, $filename, $format = 'xls', $creator = '', $company = '')
    {
        $rows = [];
        $rows[] = array_values($columns);
        foreach ($collection as $item) {
            $row = [];
            foreach ($columns as $attribute => $title) {
                $pos = strpos($attribute, '.');
                if ($pos !== false) {
                    $right = $attribute;
                    while ($pos !== false) {
                        $left = substr($right, 0, $pos);
                        $right = substr($right, ($pos + 1));

                        $pos = strpos($right, '.');
                        $relation = $item->$left;
                    }
                    $row[] = $relation->$right;
                } else {
                    $row[] = $item->$attribute;
                }
            }
            $rows[] = $row;
        };

        return \Maatwebsite\Excel\Facades\Excel::create($filename, function ($excel) use ($rows, $title, $creator, $company) {
            $excel->setTitle($title);
            $excel->setCreator($creator)->setCompany($company);
            $excel->sheet($title, function ($sheet) use ($rows) {
                $sheet->fromArray($rows, null, 'A1', true, false);
            });
        })->download($format);
    }

    public function exportMoreSheets($headings, $model, $config)
    {
        exit('not implemented');
    }
}

Fix 0 coming out as empty cell

Fix 0 coming out as empty cell


<?php
return [
    'block' => [
        'top' => 'Top Area',
        'main' => 'Main Area',
        'content' => 'Main Content',
        'teaser' => 'Teaser Area',
        'sidebar' => 'Sidebar',
        'bottom' => 'Bottom Area',
    ],
    'bool' => ['No', 'Yes'],
    'status' => [
        'draft' => 'Draft',
        'pending' => 'Pending',
        'published' => 'Published',
        'archived' => 'Archived',
    ],
 ];

<?php
return [
    'block' => [
        'top' => 'Top Area',
        'main' => 'Main Area',
        'content' => 'Main Content',
        'teaser' => 'Teaser Area',
        'sidebar' => 'Sidebar',
        'bottom' => 'Bottom Area',
    ],
    'bool' => ['No', 'Yes'],
    'media' => [
        'file_audio' => 'Audios',
        'file_image' => 'Images',
        'file_video' => 'Videos',
    ],
    'status' => [
        'draft' => 'Draft',
        'pending' => 'Pending',
        'published' => 'Published',
        'archived' => 'Archived',
    ],
 ];

Adjust entity_id filter for file_media

Adjust entity_id filter for file_media


<?php

declare(strict_types=1);

namespace Mihaeu\PhpDependencies\Cli;

use Symfony\Component\Console\Input\Input;
use Symfony\Component\Console\Output\Output;

/**
 * @covers Mihaeu\PhpDependencies\Cli\Application
 */
class ApplicationTest extends \PHPUnit_Framework_TestCase
{
    public function testSetMemoryLimit()
    {
        $app = new Application();
        $input = $this->createMock(Input::class);
        $input->method('hasOption')->willReturn(true);
        $input->method('getOption')->willReturn('1234M');
        $output = $this->createMock(Output::class);
        $app->doRun($input, $output);
        $this->assertEquals('1234M', ini_get('memory_limit'));
    }

    public function testWarningIfXDebugEnabled()
    {
        $app = new Application();
        $input = $this->createMock(Input::class);
        $output = $this->createMock(Output::class);
        $output->expects($this->once())->method('writeln');
        $app->doRun($input, $output);
    }
}

<?php

declare(strict_types=1);

namespace Mihaeu\PhpDependencies\Cli;

use Symfony\Component\Console\Input\Input;
use Symfony\Component\Console\Output\Output;

/**
 * @covers Mihaeu\PhpDependencies\Cli\Application
 */
class ApplicationTest extends \PHPUnit_Framework_TestCase
{
    public function testSetMemoryLimit()
    {
        $app = new Application();
        $input = $this->createMock(Input::class);
        $input->method('hasOption')->willReturn(true);
        $input->method('getOption')->willReturn('1234M');
        $output = $this->createMock(Output::class);
        $app->doRun($input, $output);
        $this->assertEquals('1234M', ini_get('memory_limit'));
    }

    public function testWarningIfXDebugEnabled()
    {
        $app = new Application();
        $input = $this->createMock(Input::class);
        $output = $this->createMock(Output::class);

        // not sure how to mock this, so we test only one case
        if (!extension_loaded('xdebug')) {
            $output->expects($this->never())->method('writeln');
        } else {
            $output->expects($this->once())->method('writeln');
        }
        $app->doRun($input, $output);
    }
}

Add condition if XDebug is not loaded

Add condition if XDebug is not loaded


<?php

/*
	Partial for showing RSS feeds
*/

	$feeds = array(
		"Nyheter" => get_bloginfo('rss2_url'),
		"Kommentarer" => get_bloginfo('comments_rss2_url')
	);

?>

	<?php foreach($feeds as $title => $url) : ?>

		<a href="<?php echo $url;?>"><?php echo $title;?>
		<?php echo $url;?>

	<?php endforeach;?>

<?php

/*
	Partial for showing RSS feeds
*/

	$feeds = array(
		"Nyheter" => get_bloginfo('rss2_url'),
		"Kommentarer" => get_bloginfo('comments_rss2_url')
	);

?>

	<?php foreach($feeds as $title => $url) : ?>

		<a href="<?php echo $url;?>"><?php echo $title;?>

	<?php endforeach;?>

Change list style for RSS feeds

Change list style for RSS feeds


<?php

namespace Orbt\ResourceManager;

use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Guzzle\Common\Collection;
use Guzzle\Http\Client;

/**
 * A generic resource manager.
 *
 * A resource manager takes care of fetching resources and processing them by dispatching event using the Symfony Event
 * Dispatcher component.
 */
class ResourceManager
{
    /**
     * Event dispatcher.
     * @var EventDispatcherInterface
     */
    private $dispatcher;

    /**
     * Backend server base.
     * @var string
     */
    private $backendBaseUrl;

    /**
     * Guzzle client.
     * @var Client
     */
    private $client;

    /**
     * Creates a resource manager for a backend server.
     *
     * @param EventDispatcherInterface $dispatcher
     *   Event dispatcher.
     * @param string $backendBaseUrl
     *   Backend server base URL.
     * @param array|Collection $clientConfig
     *   Backend Guzzle client options.
     */
    public function __construct(EventDispatcherInterface $dispatcher, $backendBaseUrl, $clientConfig = NULL)
    {
        $this->dispatcher = $dispatcher;
        $this->backendBaseUrl = $backendBaseUrl;
        $this->client = new Client($backendBaseUrl, $clientConfig);
    }

    /**
     * Returns the HTTP client for this manager.
     */
    public function getClient()
    {
        return $this->client;
    }
}

<?php

namespace Orbt\ResourceManager;

use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Guzzle\Common\Collection;
use Guzzle\Http\Client;

/**
 * A generic resource manager.
 *
 * A resource manager takes care of fetching resources and processing them by dispatching event using the Symfony Event
 * Dispatcher component.
 */
class ResourceManager
{
    /**
     * Event dispatcher.
     * @var EventDispatcherInterface
     */
    private $dispatcher;

    /**
     * Backend server base.
     * @var string
     */
    private $backendBaseUrl;

    /**
     * Guzzle backend client.
     * @var Client
     */
    private $client;

    /**
     * Creates a resource manager for a backend server.
     *
     * @param EventDispatcherInterface $dispatcher
     *   Event dispatcher.
     * @param string $backendBaseUrl
     *   Backend server base URL.
     * @param array|Collection $clientConfig
     *   Backend Guzzle client options.
     */
    public function __construct(EventDispatcherInterface $dispatcher, $backendBaseUrl, $clientConfig = NULL)
    {
        $this->dispatcher = $dispatcher;
        $this->backendBaseUrl = $backendBaseUrl;
        $this->client = new Client($backendBaseUrl, $clientConfig);
    }

    /**
     * Returns the backend client for this manager.
     */
    public function getClient()
    {
        return $this->client;
    }
}

Change comment to reference backend as such.


<?php

namespace Orchestra\Testbench\Concerns;

use Illuminate\Database\Eloquent\Factory as ModelFactory;

trait WithFactories
{
    /**
     * Load model factories from path.
     *
     * @param  string  $path
     *
     * @return $this
     */
    protected function withFactories($path)
    {
        $this->app->make(ModelFactory::class)->load($path);

        return $this;
    }
}

<?php

namespace Orchestra\Testbench\Concerns;

use Illuminate\Database\Eloquent\Factory as ModelFactory;

trait WithFactories
{
    /**
     * Load model factories from path.
     *
     * @param  string  $path
     *
     * @return $this
     */
    protected function withFactories($path)
    {
        return $this->loadFactoriesUsing($this->app, $path);
    }

    /**
     * Load model factories from path using Application.
     *
     * @param  \Illuminate\Contracts\Foundation\Application  $app
     * @param  string  $path
     *
     * @return $this
     */
    protected function loadFactoriesUsing($app, string $path)
    {
        $app->make(ModelFactory::class)->load($path);

        return $this;
    }
}

Allow to attach factories during app loading.

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


<?php
/**
 * OAuth
 *
 * @package OAuth
 * @author Andy Smith
 * @author Gary Jones <gary@garyjones.co.uk>
 * @license https://raw.github.com/GaryJones/OAuth/master/LICENSE MIT
 * @link https://github.com/GaryJones/OAuth
 */

namespace GaryJones\OAuth;

/**
 * Client holds the properties of a single client / consumer.
 *
 * @package OAuth
 * @author Gary Jones <gary@garyjones.co.uk>
 */
class Client extends Credential
{
    /**
     * Constructs a new client object and populates the required parameters.
     *
     * @param string $key          Client key / identifier.
     * @param string $secret       Client shared-secret.
     * @param string $callback_url URL to which authorized request will redirect to.
     */
    public function __construct($key, $secret, $callback_url = null)
    {
        $this->setKey($key);
        $this->setSecret($secret);
        $this->callback_url = $callback_url;
    }
}

<?php
/**
 * OAuth
 *
 * @package OAuth
 * @author Andy Smith
 * @author Gary Jones <gary@garyjones.co.uk>
 * @license https://raw.github.com/GaryJones/OAuth/master/LICENSE MIT
 * @link https://github.com/GaryJones/OAuth
 */

namespace GaryJones\OAuth;

/**
 * Client holds the properties of a single client / consumer.
 *
 * @package OAuth
 * @author Gary Jones <gary@garyjones.co.uk>
 */
class Client extends Credential
{
    /**
     * URL to which authorized requests will redirect to.
     *
     * @var string
     */
    protected $callback_url;

    /**
     * Constructs a new client object and populates the required parameters.
     *
     * @param string $key          Client key / identifier.
     * @param string $secret       Client shared-secret.
     * @param string $callback_url URL to which authorized request will redirect to.
     */
    public function __construct($key, $secret, $callback_url = null)
    {
        $this->setKey($key);
        $this->setSecret($secret);
        $this->setCallbackUrl($callback_url);
    }

    /**
     * Get the callback URL.
     *
     * @return string
     */
    public function getCallbackUrl()
    {
        return $this->callback_url;
    }

    /**
     * Set the callbackURL
     *
     * @param string $callback_url
     */
    public function setCallbackUrl($callback_url)
    {
        $this->callback_url = $callback_url;
    }
}

Make callback_url property protected, and add get/set methods.


<?php

namespace UoMCS\OpenBadges\Backend;

class SQLite
{
  private static $instance = null;

  public static function getInstance()
  {
    if (self::$instance === null)
    {
      self::$instance = new \PDO(OPEN_BADGES_DB_DSN);
      self::$instance->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
      self::$instance->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_OBJ);
    }

    return self::$instance;
  }
}

<?php

namespace UoMCS\OpenBadges\Backend;

class SQLite
{
  private static $instance = null;

  public static function getInstance()
  {
    if (self::$instance === null)
    {
      self::$instance = new \PDO(OPEN_BADGES_DB_DSN);
      self::$instance->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
      self::$instance->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC);
    }

    return self::$instance;
  }
}

Set fetch mode to associative array by default


<?php

namespace Lykegenes\TableView\Criteria;

use Prettus\Repository\Contracts\CriteriaInterface;
use Prettus\Repository\Contracts\RepositoryInterface;

class SearchCriteria implements CriteriaInterface
{
    private $field;
    private $search;

    public function __construct($field, $search) {
        $this->field = $field;
        $this->search = '%' . $search . '%';
    }

    public function apply($model, RepositoryInterface $repository)
    {
        return $model->where($this->field, 'like', $this->search);
    }
}

<?php

namespace Lykegenes\TableView\Criteria;

use Prettus\Repository\Contracts\CriteriaInterface;
use Prettus\Repository\Contracts\RepositoryInterface;

class SearchCriteria implements CriteriaInterface
{
    private $fields;
    private $search;

    public function __construct($fields, $search)
    {
        $this->fields = $fields;
        $this->search = '%'.$search.'%';
    }

    public function apply($model, RepositoryInterface $repository)
    {
        if (is_array($this->fields)) {
            return $model->where(function ($query) {
                foreach ($this->fields as $field) {
                    $query->orWhere($field, 'like', $this->search);
                }
            });
        }

        return $model->where($this->fields, 'like', $this->search);
    }
}

Allow searching over multiple columns

Allow searching over multiple columns


<?php
namespace Tests;

use Illuminate\Contracts\Console\Kernel;
use Illuminate\Foundation\Testing\TestCase as LaravelTestCase;
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;

abstract class TestCase extends LaravelTestCase
{
    use MockeryPHPUnitIntegration; // Increments assertion count

    /**
     * The base URL to use while testing the application.
     *
     * @var string
     */
    protected $baseUrl = 'http://localhost';

    /**
     * Creates the application.
     *
     * @return \Illuminate\Foundation\Application
     */
    public function createApplication()
    {
        $app = require __DIR__.'/../example/bootstrap/app.php';

        $app->make(Kernel::class)->bootstrap();

        return $app;
    }
}

<?php
namespace Tests;

use Illuminate\Contracts\Console\Kernel;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Foundation\Testing\TestCase as LaravelTestCase;
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;

abstract class TestCase extends LaravelTestCase
{
    use DatabaseTransactions,
        MockeryPHPUnitIntegration; // Increments assertion count

    /**
     * The base URL to use while testing the application.
     *
     * @var string
     */
    protected $baseUrl = 'http://localhost';

    /**
     * Creates the application.
     *
     * @return \Illuminate\Foundation\Application
     */
    public function createApplication()
    {
        $app = require __DIR__.'/../example/bootstrap/app.php';

        $app->make(Kernel::class)->bootstrap();

        return $app;
    }
}

Rollback database changes for all tests

Rollback database changes for all tests


<?php

namespace Ivory\GoogleMapBundle\Entity;

use Ivory\GoogleMapBundle\Model\Event as BaseEvent;

/**
 * Event entity which describes a google map event
 *
 * @author GeLo <geloen.eric@gmail.com>
 */
class Event extends BaseEvent
{
    /**
     * Create an event
     */
    public function __construct()
    {
        parent::__construct();
    }
}

<?php

namespace Ivory\GoogleMapBundle\Entity;

use Ivory\GoogleMapBundle\Model\Event as BaseEvent;

/**
 * Event entity which describes a google map event
 *
 * @author GeLo <geloen.eric@gmail.com>
 */
class Event extends BaseEvent
{
    /**
     * Create an event
     */
    public function __construct($instance, $eventName, $handle, $capture = false)
    {
        parent::__construct($instance, $eventName, $handle, $capture);
    }
}

Standardize the event constructor between model & entity


<?php namespace Modules\Blog\Entities;

use Dimsav\Translatable\Translatable;
use Illuminate\Database\Eloquent\Model;
use Laracasts\Presenter\PresentableTrait;
use Modules\Media\Support\Traits\MediaRelation;

class Post extends Model
{
    use Translatable, MediaRelation, PresentableTrait;

    public $translatedAttributes = ['title', 'slug', 'content'];
    protected $fillable = ['category_id', 'title', 'slug', 'content'];
    protected $table = 'blog__posts';
    protected $presenter = 'Modules\Blog\Presenters\PostPresenter';

    public function category()
    {
        return $this->hasOne('Modules\Blog\Entities\Category');
    }

    public function tags()
    {
        return $this->belongsToMany('Modules\Blog\Entities\Tag', 'blog__post_tag');
    }
}

<?php namespace Modules\Blog\Entities;

use Dimsav\Translatable\Translatable;
use Illuminate\Database\Eloquent\Model;
use Laracasts\Presenter\PresentableTrait;
use Modules\Media\Support\Traits\MediaRelation;

class Post extends Model
{
    use Translatable, MediaRelation, PresentableTrait;

    public $translatedAttributes = ['title', 'slug', 'content'];
    protected $fillable = ['category_id', 'status', 'title', 'slug', 'content'];
    protected $table = 'blog__posts';
    protected $presenter = 'Modules\Blog\Presenters\PostPresenter';

    public function category()
    {
        return $this->hasOne('Modules\Blog\Entities\Category');
    }

    public function tags()
    {
        return $this->belongsToMany('Modules\Blog\Entities\Tag', 'blog__post_tag');
    }
}

Add the status as fillable attribute

Add the status as fillable attribute


<?php
	require("lib/common.php");

	session_start();
	$_SESSION = array();

	colonyHTMLStart();
?>

You are now logged out. Thanks for playing!

<?php
	colonyHTMLEnd();
?>

<?php
	require("lib/common.php");

	session_start();
	$_SESSION = array();

	colonyHTMLHeader();
?>

You are now logged out. Thanks for playing!

<?php
	colonyHTMLFooter();
?>

Replace HTMLStart and HTMLEnd with HTMLHeader and HTMLFooter when logging out.

HTMLStart requires the user to be logged in to show the HTML content, which caught the user in a redirect loop logging out and back in.


<?php
  // Display a suitable column layout depending on whether sidebar exists
  if ( is_active_sidebar( 'sidebar-widgets' ) ) :
    echo '
';

  else :
    echo '
';
  endif;
?>

Remove unnecessary column for medium

Remove unnecessary column for medium