<?php
/**
 * @copyright Copyright (c)  netz98 GmbH (https://www.netz98.de)
 *
 * @see PROJECT_LICENSE.txt
 */

namespace N98\Guillotine\Exception;

use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Phrase;

/**
 * Exception in case of blocked requests
 *
 * @api
 */
class NotAllowedException extends LocalizedException
{
    const MSG_BLOCKED_DEFAULT = 'The requested page is blocked.';

    /**
     * @param Phrase|null $msg
     *
     * @return \N98\Guillotine\Exception\NotAllowedException
     */
    public static function notAllowed($msg = null)
    {
        return new self(new Phrase($msg ?: self::MSG_BLOCKED_DEFAULT));
    }
}

<?php
/**
 * @copyright Copyright (c)  netz98 GmbH (https://www.netz98.de)
 *
 * @see PROJECT_LICENSE.txt
 */

namespace N98\Guillotine\Exception;

use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Phrase;

/**
 * Exception in case of blocked requests
 *
 * @api
 */
class NotAllowedException extends LocalizedException
{
    const MSG_BLOCKED_DEFAULT = 'The requested page is blocked.';

    /**
     * @param Phrase|null $msg
     * @return \N98\Guillotine\Exception\NotAllowedException
     * phpcs:disable Magento2.Functions.StaticFunction
     */
    public static function notAllowed($msg = null)
    {
        return new self(new Phrase($msg ?: self::MSG_BLOCKED_DEFAULT));
    }
}

Allow static method in exception

Allow static method in exception


<?php
  get_header();

  use SandersForPresident\Wordpress\Services\News\NewsFeedService;

  $newsFeedService = new NewsFeedService();
  $news = $newsFeedService->getNewsFeed();
?>

Find out what's going on near you

News

    <?php foreach ($news as $item) : ?>

          <a href="<?php echo $item->getLink(); ?>">
            <?php if ($item->isRemote()) : ?>BERNIE POST:<?php endif; ?>
            <?php echo $item->getTitle(); ?>

<?php echo $item->getFormattedDate(); ?>

          <?php echo $item->getContent(); ?>

    <?php endforeach; ?>

<?php get_footer(); ?>

<?php
  get_header();

  use SandersForPresident\Wordpress\Services\News\NewsFeedService;

  $newsFeedService = new NewsFeedService();
  $news = $newsFeedService->getNewsFeed();
?>

Find out what's going on near you

News

    <?php foreach ($news as $item) : ?>
      <article<?php if ($item->isRemote()) : ?> class="official"<?php endif; ?>>

          <a href="<?php echo $item->getLink(); ?>">
            <?php echo $item->getTitle(); ?>

<?php echo $item->getFormattedDate(); ?>

          <?php echo $item->getContent(); ?>

    <?php endforeach; ?>

<?php get_footer(); ?>

Add 'Official' class to remote posts from berniesanders.com


<?php
error_reporting(E_ALL);

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

PHPUnit_Framework_Error_Notice::$enabled = true;

<?php
error_reporting(E_ALL);

$timezone_identifier = @date_default_timezone_get();
if(empty($timezone_identifier)) {
    $timezone_identifier = 'UTC';
}
date_default_timezone_set($timezone_identifier);
unset($timezone_identifier);

require_once dirname(__DIR__) . '/punic.php';

PHPUnit_Framework_Error_Notice::$enabled = true;

Remove composer requirements for phpunit


<?php

declare(strict_types=1);

$_ENV['TMP_DIR'] = __DIR__ . '/tmp';
$unlink = static function ($path) use (&$unlink) {
    foreach ((array) glob(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*') as $f) {
        $file = (string) $f;
        is_dir($file) ? $unlink($file) : unlink($file);
        @rmdir($file);
    }
};
$unlink($_ENV['TMP_DIR']);

<?php

declare(strict_types=1);

use Koriym\Attributes\AttributeReader;
use Ray\ServiceLocator\ServiceLocator;

$_ENV['TMP_DIR'] = __DIR__ . '/tmp';
$unlink = static function ($path) use (&$unlink) {
    foreach ((array) glob(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . '*') as $f) {
        $file = (string) $f;
        is_dir($file) ? $unlink($file) : unlink($file);
        @rmdir($file);
    }
};
$unlink($_ENV['TMP_DIR']);

// no annotation in PHP 8
if (PHP_MAJOR_VERSION >= 8) {
    ServiceLocator::setReader(new AttributeReader());
}

Test that all tests works without annotation reader in php8


#!/usr/bin/php
<?php
/*
 * list_buckets.php
 *
 * List S3 buckets.
 *
 * Copyright 2009-2010 Amazon.com, Inc. or its affiliates. All Rights
 * Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"). You
 * may not use this file except in compliance with the License. A copy
 * of the License is located at
 *
 *       http://aws.amazon.com/apache2.0/
 *
 * or in the "license.txt" file accompanying this file. This file is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the
 * License.
 */

error_reporting(E_ALL);

require_once('cloudfusion.class.php');

// Create the S3 access object
$s3 = new AmazonS3();

// Retrieve list of S3 buckets
$buckets = $s3->get_bucket_list();

// Display list of buckets
foreach ($buckets as $bucket)
{
  print($bucket . "\n");
}

exit(0);
?>

#!/usr/bin/php
<?php
/*
 * list_buckets.php
 *
 * List S3 buckets.
 *
 * Copyright 2009-2010 Amazon.com, Inc. or its affiliates. All Rights
 * Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"). You
 * may not use this file except in compliance with the License. A copy
 * of the License is located at
 *
 *       http://aws.amazon.com/apache2.0/
 *
 * or in the "license.txt" file accompanying this file. This file is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the
 * License.
 *
 * Modified by Jeffrey S. Haemer <jeffrey.haemer@gmail.com>
 */

error_reporting(E_ALL);

require_once('AWSSDKforPHP/sdk.class.php');

// Create the S3 access object
$s3 = new AmazonS3();

// Retrieve list of S3 buckets
$buckets = $s3->get_bucket_list();

// Display list of buckets
foreach ($buckets as $bucket)
{
  print($bucket . "\n");
}

exit(0);
?>

Modify to use right toolkit.

Modify to use right toolkit.

First blood!


<?php

class GalleryImage extends DataExtension {
    public static $db = array(
        'Sort'  => 'Int'
    );

    public static $belogs_many_many = array(
        'Gallery'   => 'GalleryPage'
    );

    public function updateCMSFields(FieldList $fields) {
        $fields->addFieldToTab('Root.Main', TextField::create('Sort', _t('ContactPage.PRIORITY')));
    }
}

<?php

class GalleryImage extends DataExtension {
    public static $db = array(
        'Sort'  => 'Int'
    );

    public static $belogs_many_many = array(
        'Gallery'   => 'GalleryPage'
    );

    public function updateCMSFields(FieldList $fields) {
        $fields->addFieldToTab('Root.Main', TextField::create('Sort', _t('GalleryPage.PRIORITY')));
    }
}

Correct typo in priority label

Correct typo in priority label


<?php
namespace Widmogrod\Functional;

use Widmogrod\FantasyLand\Monoid;

const mempty = 'Widmogrod\Functional\mempty';

function mempty(Monoid $a)
{
    return $a->getEmpty();
}

const mappend = 'Widmogrod\Functional\mappend';

function mappend(Monoid $a, Monoid $b)
{
    return $a->concat($b);
}

<?php
namespace Widmogrod\Functional;

use Widmogrod\FantasyLand\Monoid;
use Widmogrod\FantasyLand\Semigroup;

const mempty = 'Widmogrod\Functional\mempty';

/**
 * mempty :: a
 *
 * @param Monoid $a
 * @return Monoid
 */
function mempty(Monoid $a)
{
    return $a->getEmpty();
}

const mappend = 'Widmogrod\Functional\mappend';

/**
 * mappend :: a -> a -> a
 *
 * @param Semigroup $a
 * @param Semigroup $b
 * @return Semigroup
 */
function mappend(Semigroup $a, Semigroup $b)
{
    return $a->concat($b);
}

Add adnotations to mappend & mempty

Add adnotations to mappend & mempty


<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Migration_BusinessHoursField extends CI_Migration
{
	public function up()
	{

		$db = $this->load->database('default',true);
		$this->dbforge->modify_column('facility',
			array(
				'opening_hours' => array(
					'type' => 'TEXT',
					'default' => '[{"isActive":false,"timeFrom":null,"timeTill":null},
					                {"isActive":false,"timeFrom":null,"timeTill":null},
					                {"isActive":false,"timeFrom":null,"timeTill":null},
					                {"isActive":false,"timeFrom":null,"timeTill":null},
					                {"isActive":false,"timeFrom":null,"timeTill":null},
					                {"isActive":false,"timeFrom":null,"timeTill":null},
					                {"isActive":false,"timeFrom":null,"timeTill":null}]'
				)
			)
		);
		$db->query('update facility set opening_hours = \'[{"isActive":false,"timeFrom":null,"timeTill":null},{"isActive":false,"timeFrom":null,"timeTill":null},{"isActive":false,"timeFrom":null,"timeTill":null},{"isActive":false,"timeFrom":null,"timeTill":null},{"isActive":false,"timeFrom":null,"timeTill":null},{"isActive":false,"timeFrom":null,"timeTill":null},{"isActive":false,"timeFrom":null,"timeTill":null}]\';');

	}

	public function down()
	{
		// nobody cares...
	}

}

<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Migration_BusinessHoursField extends CI_Migration
{
	public function up()
	{

		$db = $this->load->database('default',true);
		$this->dbforge->modify_column('facility',
			array(
				'opening_hours' => array(
					'type' => 'TEXT',
					'default' => '',
				)
			)
		);
		$db->query('update facility set opening_hours = \'[{"isActive":false,"timeFrom":null,"timeTill":null},{"isActive":false,"timeFrom":null,"timeTill":null},{"isActive":false,"timeFrom":null,"timeTill":null},{"isActive":false,"timeFrom":null,"timeTill":null},{"isActive":false,"timeFrom":null,"timeTill":null},{"isActive":false,"timeFrom":null,"timeTill":null},{"isActive":false,"timeFrom":null,"timeTill":null}]\';');

	}

	public function down()
	{
		// nobody cares...
	}

}

Fix migration (remove default value for TEXT)


@extends('layouts.default')

@section('main')

MageHack Projects:

@{{ project.title }}

@{{ project.description }}

@stop

@extends('layouts.default')

@section('main')

MageHack Projects:

@{{ project.title }}

@{{ project.description }}

@if(Auth::check())

Submit Your Own Project:

{{ Form::open(array('action' => 'ProjectController@create')) }}
{{ Form::label('title', 'Title:'); }}
{{ Form::text('title','', array('class' => 'form-control')); }}
{{ Form::label('description', 'Description:'); }}
{{ Form::textarea('description','', array('class' => 'form-control')); }}
{{ Form::submit('Submit'); }}
{{ Form::close() }}

@endif

@stop

Update for project list display

Update for project list display


<?php
/**
* This file is part of the League.url library
*
* @license http://opensource.org/licenses/MIT
* @link https://github.com/thephpleague/url/
* @version 4.0.0
* @package League.url
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace League\Url;

use InvalidArgumentException;
use League\Url\Interfaces\Component;

/**
* A class to manipulate URL Port component
*
* @package League.url
* @since 1.0.0
*/
class Port extends AbstractComponent implements Component
{
    /**
     * {@inheritdoc}
     */
    protected function validate($data)
    {
        $data = filter_var($data, FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]);
        if (! $data) {
            throw new InvalidArgumentException('The submitted port is invalid');
        }

        return $data;
    }

    /**
     * {@inheritdoc}
     */
    public function getUriComponent()
    {
        $data = $this->__toString();
        if (empty($data)) {
            return $data;
        }
        return ':'.$data;
    }
}

<?php
/**
* This file is part of the League.url library
*
* @license http://opensource.org/licenses/MIT
* @link https://github.com/thephpleague/url/
* @version 4.0.0
* @package League.url
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace League\Url;

use InvalidArgumentException;
use League\Url\Interfaces\Component;

/**
* A class to manipulate URL Port component
*
* @package League.url
* @since 1.0.0
*/
class Port extends AbstractComponent implements Component
{
    /**
     * {@inheritdoc}
     */
    protected function validate($data)
    {
        if (! ctype_digit($data) || $data < 1) {
            throw new InvalidArgumentException('The submitted port is invalid');
        }

        return $data;
    }

    /**
     * {@inheritdoc}
     */
    public function getUriComponent()
    {
        $data = $this->__toString();
        if (empty($data)) {
            return $data;
        }
        return ':'.$data;
    }
}

Use ctype_digit to validate port

Use ctype_digit to validate port


<?php

namespace SilverStripe\ContentWidget;

use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\HTMLEditor\HTMLEditorField;
use SilverStripe\Widgets\Model\Widget;

/**
 * Content Widget
 */
class ContentWidget extends Widget
{
    private static $db = [
        "HTML" => "HTMLText",
    ];

    private static $title = "Content";

    private static $cmsTitle = "Content";

    private static $description = "Custom HTML content widget.";

    private static $table_name = 'ContentWidget';

    /**
     * @return FieldList
     */
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        $fields->push(TextField::create("Title"));
        $fields->push(HTMLEditorField::create("HTML", "Content"));

        return $fields;
    }
}

<?php

namespace SilverStripe\ContentWidget;

use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\HTMLEditor\HTMLEditorField;
use SilverStripe\Widgets\Model\Widget;

/**
 * Content Widget
 */
class ContentWidget extends Widget
{
    private static $db = [
        "HTML" => "HTMLText",
    ];

    private static $title = "Content";

    private static $cmsTitle = "Content";

    private static $description = "Custom rich content widget.";

    private static $table_name = 'ContentWidget';

    /**
     * @return FieldList
     */
    public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        $fields->push(TextField::create("Title"));
        $fields->push(HTMLEditorField::create("HTML", "Content"));

        return $fields;
    }
}

Update HTML to "rich" in description

Update HTML to "rich" in description


<?php
namespace COI\Social;

function getClassName($object) {
    if (!is_object($object) && !is_string($object)) {
        return false;
    }

    return trim(strrchr((is_string($object) ? $object : get_class($object)), '\\'), '\\');
}

function getCurrentUrl() {
    $pageURL = 'http';

    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
        $pageURL .= 's';
    }

    $pageURL .= '://';

    if ($_SERVER['SERVER_PORT'] != '80') {
        $pageURL .= $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI'];
    } else {
        $pageURL .= $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
    }
    return $pageURL;
}

<?php
namespace COI\Social;

function getClassName($object) {
    if (!is_object($object) && !is_string($object)) {
        return false;
    }

    return trim(strrchr((is_string($object) ? $object : get_class($object)), '\\'), '\\');
}

function getCurrentUrl() {
	if (!isset($_SERVER)) {
		return '';
	}
    $pageURL = 'http';

    if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
        $pageURL .= 's';
    }

    $pageURL .= '://';

    if ($_SERVER['SERVER_PORT'] != '80') {
        $pageURL .= $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI'];
    } else {
        $pageURL .= $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
    }
    return $pageURL;
}

Check for the presence of $_SERVER

Check for the presence of $_SERVER


<?php

if(php_sapi_name() != 'cli')
{
	die('Error: index.setup.php may only be invoked from the command-line');
}

define('INSTANCE_ROOT', realpath(getcwd()) . '/');

if(count($argv) == 1)
{
	$argv[] = 'install';
}

require(dirname(__FILE__) . '/platform.php');

$app->process($request);

<?php

if(php_sapi_name() != 'cli')
{
	die('Error: index.install.php may only be invoked from the command-line');
}

define('INSTANCE_ROOT', realpath(getcwd()) . '/');

if(file_exists(INSTANCE_ROOT . 'public') || !file_exists(INSTANCE_ROOT . 'index.pho'))
{
	define('PUBLIC_ROOT', INSTANCE_ROOT . 'public/');
}
else
{
	define('PUBLIC_ROOT', INSTANCE_ROOT);
}

if(count($argv) == 1)
{
	$argv[] = 'install';
}

require(dirname(__FILE__) . '/platform.php');

$app->process($request);

Set PUBLIC_ROOT to INSTANCE_ROOT/public if applicable


<?php
/**
 * @var $this \yii\web\View
 * @var $item \common\models\CatalogItem
 */

$this->title = $item->name
?>

        <?= $this->render('_images',['item'=>$item]); ?>

        <?= $this->render('_description',['item'=>$item]); ?>
        <?= $this->render('_attributes',['item'=>$item]); ?>

<?php
use yii\bootstrap\Tabs;
/**
 * @var $this \yii\web\View
 * @var $item \common\models\CatalogItem
 */

$this->title = $item->name
?>

        <?= $this->render('_images',['item'=>$item]); ?>

        <?= Tabs::widget([
            'items'=>[
                [
                    'label'=>'Description',
                    'content' => $this->render('_description',['item'=>$item]),
                    'active'=>true
                ],
                [
                    'label'=>'Details',
                    'content' => $this->render('_attributes',['item'=>$item]),
                    'active'=>false
                ]
            ]
        ])?>

Split item details to tabs

Split item details to tabs


<?PHP

namespace Firelit;

class ApiResponse extends Response {

	protected $response = array();
	protected $responseSent = false;
	protected $responseFormat = 'JSON';

	public function __construct($responseFormat = 'JSON', $ob = true, $charset = "UTF-8") {
		parent::__construct($ob, $charset);
		$this->responseFormat = strtoupper($responseFormat);
	}

	public function setTemplate($template) {
		$this->response = array_merge($this->response, $template);
	}

	public function set($response) {
		$this->response = array_merge($this->response, $response);
	}

	public function respond($response = array(), $end = true) {
		$this->set($response);

		if ($this->outputBuffering) {
			$this->cleanBuffer();
		}

		if ($this->responseFormat == 'JSON') {

			echo json_encode($this->response);

		} else {
			throw new Exception('Invalid response format: '. $this->responseFormat);
		}

		if ($this->outputBuffering) {
			$this->flushBuffer();
		}

		$this->responseSent = true;

		if ($end) exit;
	}

	public function hasResponded() {
		return $this->responseSent;
	}

	public function __destruct() {

		if (!$this->hasResponded()) {
			$this->respond(array(), false);
		}

	}
}

<?PHP

namespace Firelit;

class ApiResponse extends Response {

	protected $response = array();
	protected $responseSent = false;
	protected $responseFormat = 'JSON';

	public function __construct($responseFormat = 'JSON', $ob = true, $charset = "UTF-8") {
		parent::__construct($ob, $charset);

		if ($responseFormat == 'JSON')
			$this->contentType('application/json');

		$this->responseFormat = strtoupper($responseFormat);
	}

	public function setTemplate($template) {
		$this->response = array_merge($this->response, $template);
	}

	public function set($response) {
		$this->response = array_merge($this->response, $response);
	}

	public function respond($response = array(), $end = true) {
		$this->set($response);

		if ($this->outputBuffering) {
			$this->cleanBuffer();
		}

		if ($this->responseFormat == 'JSON') {

			echo json_encode($this->response);

		} else {
			throw new Exception('Invalid response format: '. $this->responseFormat);
		}

		if ($this->outputBuffering) {
			$this->flushBuffer();
		}

		$this->responseSent = true;

		if ($end) exit;
	}

	public function hasResponded() {
		return $this->responseSent;
	}

	public function __destruct() {

		if (!$this->hasResponded()) {
			$this->respond(array(), false);
		}

	}
}

Set content type for API response

Set content type for API response


<?php

namespace OpenDominion\Models;

class Realm extends AbstractModel
{
    public function councilThreads()
    {
        return $this->hasMany(Council\Thread::class);
    }

    public function dominions()
    {
        return $this->hasMany(Dominion::class);
    }

    public function infoOps()
    {
        return $this->hasMany(InfoOp::class, 'source_realm_id');
    }

    public function infoOpTargetDominions()
    {
        return $this->hasManyThrough(
            Dominion::class,
            InfoOp::class,
            'source_realm_id',
            'id',
            null,
            'target_dominion_id'
        );
    }

    public function monarch()
    {
//        return $this->hasOne(Dominion::class, 'id', 'monarch_dominion_id');
    }

    public function round()
    {
        return $this->belongsTo(Round::class);
    }

    public function hasInfoOp(Dominion $targetDominion, string $infoOp)
    {
        //
    }
}

<?php

namespace OpenDominion\Models;

class Realm extends AbstractModel
{
    public function councilThreads()
    {
        return $this->hasMany(Council\Thread::class);
    }

    public function dominions()
    {
        return $this->hasMany(Dominion::class);
    }

    public function infoOps()
    {
        return $this->hasMany(InfoOp::class, 'source_realm_id');
    }

    public function infoOpTargetDominions()
    {
        return $this->hasManyThrough(
            Dominion::class,
            InfoOp::class,
            'source_realm_id',
            'id',
            null,
            'target_dominion_id'
        )
            ->groupBy('target_dominion_id')
            ->orderBy('updated_at', 'desc');
    }

    public function monarch()
    {
//        return $this->hasOne(Dominion::class, 'id', 'monarch_dominion_id');
    }

    public function round()
    {
        return $this->belongsTo(Round::class);
    }

    public function hasInfoOp(Dominion $targetDominion, string $infoOp)
    {
        //
    }
}

Add group and order by to infoOpTargetDominions


<?php

namespace CL\Swiftmailer;

use Swift_Events_SendListener;
use Closure;

/**
 * @author    Ivan Kerin <ikerin@gmail.com>
 * @copyright 2015, Clippings Ltd.
 * @license   http://spdx.org/licenses/BSD-3-Clause
 */
class ModifyPlugin implements Swift_Events_SendListener
{
    private $modifier;

    function __construct(Closure $modifier)
    {
        $this->modifier = $modifier;
    }

    /**
     * Apply whitelist and blacklist to "to", "cc" and "bcc"
     *
     * @param Swift_Events_SendEvent $evt
     */
    public function beforeSendPerformed(\Swift_Events_SendEvent $evt)
    {
        $message = $evt->getMessage();

        $modifier = $this->modifier;

        $modifier($message);
    }

    /**
     * Do nothing
     *
     * @param Swift_Events_SendEvent $evt
     */
    public function sendPerformed(\Swift_Events_SendEvent $evt)
    {
        // Do Nothing
    }
}

<?php

namespace CL\Swiftmailer;

use Swift_Events_SendListener;
use Closure;

/**
 * @author    Ivan Kerin <ikerin@gmail.com>
 * @copyright 2015, Clippings Ltd.
 * @license   http://spdx.org/licenses/BSD-3-Clause
 */
class ModifyPlugin implements Swift_Events_SendListener
{
    private $modifier;

    function __construct(Closure $modifier)
    {
        $this->modifier = $modifier;
    }

    /**
     * Apply the modifier to the Swift_Message
     *
     * @param Swift_Events_SendEvent $evt
     */
    public function beforeSendPerformed(\Swift_Events_SendEvent $evt)
    {
        $message = $evt->getMessage();

        $modifier = $this->modifier;

        $modifier($message);
    }

    /**
     * Do nothing
     *
     * @param Swift_Events_SendEvent $evt
     */
    public function sendPerformed(\Swift_Events_SendEvent $evt)
    {
        // Do Nothing
    }
}

Fix PHPDoc description for beforeSendPerformed() method


<?php
/*
Plugin Name:        Soil
Plugin URI:         https://roots.io/plugins/soil/
Description:        Clean up WordPress markup, use relative URLs, nicer search URLs, and disable trackbacks
Version:            3.1.0
Author:             Roots
Author URI:         https://roots.io/

License:            MIT License
License URI:        http://opensource.org/licenses/MIT
*/

namespace Roots\Soil;

function load_modules() {
  foreach (glob(__DIR__ . '/modules/*.php') as $file) {
    if (current_theme_supports('soil-' . basename($file, '.php'))) {
      require_once $file;
    }
  }
}
add_action('after_setup_theme', __NAMESPACE__ . '\\load_modules');

<?php
/*
Plugin Name:        Soil
Plugin URI:         https://roots.io/plugins/soil/
Description:        Clean up WordPress markup, use relative URLs, nicer search URLs, and disable trackbacks
Version:            3.1.0
Author:             Roots
Author URI:         https://roots.io/

License:            MIT License
License URI:        http://opensource.org/licenses/MIT
*/

namespace Roots\Soil;

function load_modules() {
  global $_wp_theme_features;
  foreach (glob(__DIR__ . '/modules/*.php') as $file) {
    $feature = 'soil-' . basename($file, '.php');
    if (isset($_wp_theme_features[$feature])) {
      $options = (array) $_wp_theme_features[$feature];
      require_once $file;
    }
  }
}
add_action('after_setup_theme', __NAMESPACE__ . '\\load_modules');

Add ability to pass options to modules

Add ability to pass options to modules


<?php

system(sprintf('php %s', escapeshellarg(__DIR__.'/bin/vendors')));

require_once __DIR__.'/'.$_SERVER['SYMFONY'].'/Symfony/Component/ClassLoader/UniversalClassLoader.php';

use Symfony\Component\ClassLoader\UniversalClassLoader;

$loader = new UniversalClassLoader();
$loader->registerNamespaces(array(
    'Symfony' => array(
        __DIR__.'/'.$_SERVER['SYMFONY'],
        __DIR__.'/'.$_SERVER['SYMFONY'].'/../tests'
    ),
    'Ivory'   => __DIR__.'/../../..'
));
$loader->register();

<?php

system(sprintf('php %s', escapeshellarg(__DIR__.'/bin/vendors')));

require_once __DIR__.'/'.$_SERVER['SYMFONY'].'/Symfony/Component/ClassLoader/UniversalClassLoader.php';

use Symfony\Component\ClassLoader\UniversalClassLoader;

$loader = new UniversalClassLoader();
$loader->registerNamespaces(array(
    'Symfony' => array(
        __DIR__.'/'.$_SERVER['SYMFONY'],
        __DIR__.'/'.$_SERVER['SYMFONY'].'/../tests'
    )
));
$loader->register();

spl_autoload_register(function($class)
{
    if(strpos($class, 'Ivory\\CKEditorBundle\\') === 0)
    {
        $path = __DIR__.'/../'.implode('/', array_slice(explode('\\', $class), 2)).'.php';

        if(!stream_resolve_include_path($path))
            return false;

        require_once $path;
        return true;
    }
});

Update boostrap to allow running the test suite outside a dummy project


<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

<?php get_template_part('partials/entry-meta'); ?>

  <?php $full = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' ); ?>

      <a href="<?php echo $full[0]; ?>">
        <?php the_post_thumbnail(); ?>

  <?php the_content(); ?>

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

<?php get_template_part('partials/entry-meta'); ?>

  <?php if ( has_post_thumbnail() ) : ?>
    <?php $full = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' ); ?>

        <a href="<?php echo $full[0]; ?>">
          <?php the_post_thumbnail(); ?>

  <?php endif; ?>
  <?php the_content(); ?>

Add has_post_thumbnail check to standard posts


<?php
/** @var \WEEEOpen\Tarallo\Feature[] $features */
/** @var \WEEEOpen\Tarallo\Feature[] $product */
$groups = $this->getGroupedFeatures($this->getUltraFeatures($features));

if(count($features) > 0): ?>
	<?php foreach($groups as $groupTitle => $group): ?>

<?=$groupTitle?>

			<?php foreach($group as $feature): /** @var $feature \WEEEOpen\Tarallo\SSRv1\UltraFeature */ ?>

<?=$feature->pname /* The span is a  in edit mode, we need an element here in view mode for css to work */?>

                    <?php if(isset($product[$feature->name]) && $product[$feature->name]->value !== $feature->value): ?>

<?=$this->e(\WEEEOpen\Tarallo\SSRv1\FeaturePrinter::printableValue($product[$feature->name]))?> <?=$this->e($feature->pvalue)?>

                    <?php else: ?>

<?=$this->contentEditableWrap($this->e($feature->pvalue))?>

                    <?php endif ?>

			<?php endforeach; ?>

	<?php endforeach ?>
<?php endif; ?>

<?php
/** @var \WEEEOpen\Tarallo\Feature[] $features */
/** @var \WEEEOpen\Tarallo\Feature[] $product */
if(isset($features['variant']) && $features['variant']->value === \WEEEOpen\Tarallo\Product::DEFAULT_VARIANT) {
	unset($features['variant']);
}
$groups = $this->getGroupedFeatures($this->getUltraFeatures($features));

if(count($features) > 0): ?>
	<?php foreach($groups as $groupTitle => $group): ?>

<?=$groupTitle?>

			<?php foreach($group as $feature): /** @var $feature \WEEEOpen\Tarallo\SSRv1\UltraFeature */ ?>

<?=$feature->pname /* The span is a  in edit mode, we need an element here in view mode for css to work */?>

                    <?php if(isset($product[$feature->name]) && $product[$feature->name]->value !== $feature->value): ?>

<?=$this->e(\WEEEOpen\Tarallo\SSRv1\FeaturePrinter::printableValue($product[$feature->name]))?> <?=$this->e($feature->pvalue)?>

                    <?php else: ?>

<?=$this->contentEditableWrap($this->e($feature->pvalue))?>

                    <?php endif ?>

			<?php endforeach; ?>

	<?php endforeach ?>
<?php endif; ?>

Hide default variant when displaying items


<?php
namespace SmoothPhp\Test\CommandBus;

/**
 * Class CommandTest
 * @author Simon Bennett <simon.bennett@smoothphp.com>
 */
class CommandTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @test
     */
    public function build_command_test()
    {
        $command = new TestCommand();

        $this->assertContains('SmoothPhp\Test\CommandBus\TestCommand:', (string)$command);

        $this->assertRegExp("/^(\{)?[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}(?(1)\})$/i",$command->getCommandId());
    }
}

<?php
namespace SmoothPhp\Test\CommandBus;

/**
 * Class CommandTest
 * @author Simon Bennett <simon.bennett@smoothphp.com>
 */
class CommandTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @test
     */
    public function build_command_test()
    {
        $command = new TestCommand();

        $this->assertContains('SmoothPhp\Test\CommandBus\TestCommand:', (string)$command);

        $this->assertRegExp("/^(\{)?[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}(?(1)\})$/i",$command->getCommandId());
    }

    /**
     * @test
     */
    public function id_is_always_the_same_for_a_given_command()
    {
        $command = new TestCommand;
        $this->assertSame($command->getCommandId(), $command->getCommandId());

        $command2 = new TestCommand;
        $this->assertSame($command2->getCommandId(), $command2->getCommandId());

        $this->assertNotEquals($command->getCommandId(), $command2->getCommandId());
    }
}

Add tests for new ID mechanism

[Command] Add tests for new ID mechanism


<?php

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Aedart\Scaffold\Contracts\Tasks\ConsoleTask;
use Mockery as m;

/**
 * Console Test
 *
 * Provides a few helpers for CLI / Console related
 * testing
 *
 * @author Alin Eugen Deac <aedart@gmail.com>
 */
abstract class ConsoleTest extends BaseUnitTest
{
    /********************************************************
     * Helpers
     *******************************************************/

    /**
     * Returns a console task mock
     *
     * @param bool $withName [optional]
     * @param bool $withDesc [optional]
     *
     * @return ConsoleTask|m\MockInterface
     */
    public function makeTaskMock($withName = true, $withDesc = true)
    {
        $task = m::mock(ConsoleTask::class);

        if($withName){
            $task->shouldReceive('getName')
                ->andReturn($this->faker->unique()->word);
        }

        if($withDesc){
            $task->shouldReceive('getDescription')
                ->andReturn($this->faker->unique()->sentence);
        }

        return $task;
    }

    /**
     * Returns input mock
     *
     * @return m\MockInterface|InputInterface
     */
    public function makeInputMock()
    {
        return m::mock(InputInterface::class);
    }

    /**
     * Returns output mock
     *
     * @return m\MockInterface|OutputInterface
     */
    public function makeOutputMock()
    {
        return m::mock(OutputInterface::class);
    }
}

<?php

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Aedart\Scaffold\Contracts\Tasks\ConsoleTask;
use Mockery as m;

/**
 * Console Test
 *
 * Provides a few helpers for CLI / Console related
 * testing
 *
 * @author Alin Eugen Deac <aedart@gmail.com>
 */
abstract class ConsoleTest extends BaseUnitTest
{
    use TaskRunnerUtils;

    /********************************************************
     * Helpers
     *******************************************************/

    /**
     * Returns a console task mock
     *
     * @param bool $withName [optional]
     * @param bool $withDesc [optional]
     *
     * @return ConsoleTask|m\MockInterface
     */
    public function makeTaskMock($withName = true, $withDesc = true)
    {
        $task = m::mock(ConsoleTask::class);

        if($withName){
            $task->shouldReceive('getName')
                ->andReturn($this->faker->unique()->word);
        }

        if($withDesc){
            $task->shouldReceive('getDescription')
                ->andReturn($this->faker->unique()->sentence);
        }

        return $task;
    }

    /**
     * Returns input mock
     *
     * @return m\MockInterface|InputInterface
     */
    public function makeInputMock()
    {
        return m::mock(InputInterface::class);
    }

    /**
     * Returns output mock
     *
     * @return m\MockInterface|OutputInterface
     */
    public function makeOutputMock()
    {
        return m::mock(OutputInterface::class);
    }
}

Use task runner util in console tests

Use task runner util in console tests


<?php
/**
 * @file
 * Containt Drupal\AppConsole\Command\GeneratorFormBaseCommand.
 */

namespace Drupal\AppConsole\Command;

class GeneratorConfigFormBaseCommand extends GeneratorFormCommand {

  protected function getFormType ()
  {
   return 'ConfigFormBase';
  }

  protected function getCommandName ()
  {
    return 'generate:form:config';
  }

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

}

<?php
/**
 * @file
 * Containt Drupal\AppConsole\Command\GeneratorFormBaseCommand.
 */

namespace Drupal\AppConsole\Command;

class GeneratorConfigFormBaseCommand extends GeneratorFormCommand {

  protected function configure()
  {
    $this->setFormType('ConfigFormBase');
    $this->setCommandName('generate:form:config');
    parent::configure();
  }

}

Use new setter methods at parent class

Use new setter methods at parent class


<?php

declare(strict_types=1);

namespace Cortex\Foundation\Http\Middleware;

use Closure;
use Krucas\Notification\Middleware\NotificationMiddleware as Middleware;

class NotificationMiddleware extends Middleware
{
    /**
     * Handle an incoming request.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Closure                 $next
     *
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $containers = $this->session->get($this->key, []);

        if (count($containers) > 0) {
            foreach ($containers as $name => $messages) {
                /** @var \Krucas\Notification\Message $message */
                foreach ($messages as $message) {
                    $this->notification->container($name)->add($message->getType(), $message, false);
                }
            }
        }

        foreach (config('notification.default_types') as $type) {
            if ($request->session()->has($type)) {
                $message = $request->session()->get($type);
                $this->notification->container(null)->add($type, $message, false);
            }
        }

        $this->session->forget($this->key);

        return $next($request);
    }
}

<?php

declare(strict_types=1);

namespace Cortex\Foundation\Http\Middleware;

use Closure;
use Illuminate\Support\ViewErrorBag;
use Krucas\Notification\Middleware\NotificationMiddleware as Middleware;

class NotificationMiddleware extends Middleware
{
    /**
     * Handle an incoming request.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Closure                 $next
     *
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $containers = $this->session->get($this->key, []);

        if (count($containers) > 0) {
            foreach ($containers as $name => $messages) {
                /** @var \Krucas\Notification\Message $message */
                foreach ($messages as $message) {
                    $this->notification->container($name)->add($message->getType(), $message, false);
                }
            }
        }

        foreach (config('notification.default_types') as $type) {
            if ($request->session()->has($type)) {
                $message = $request->session()->get($type);

                if ($message instanceof ViewErrorBag) {
                    foreach ($message->messages() as $key => $values) {
                        $message = $values[0];
                    }
                }

                $this->notification->container(null)->add($type, $message, false);
            }
        }

        $this->session->forget($this->key);

        return $next($request);
    }
}

Handle error bags as well as single messaged errors


<?php namespace Illuminate\Events;

use Illuminate\Support\ServiceProvider;

class EventServiceProvider extends ServiceProvider {

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

}

<?php namespace Illuminate\Events;

use Illuminate\Support\ServiceProvider;

class EventServiceProvider extends ServiceProvider {

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

}

Use singleton method for binding shared instance.


<?php declare(strict_types=1);

namespace CultuurNet\UDB3\Organizer\Events;

use CultuurNet\UDB3\Offer\Events\AbstractGeoCoordinatesUpdated;

class GeoCoordinatesUpdated extends AbstractGeoCoordinatesUpdated
{

}

<?php declare(strict_types=1);

namespace CultuurNet\UDB3\Organizer\Events;

use CultuurNet\Geocoding\Coordinate\Coordinates;
use CultuurNet\Geocoding\Coordinate\Latitude;
use CultuurNet\Geocoding\Coordinate\Longitude;

class GeoCoordinatesUpdated extends OrganizerEvent
{
    /**
     * @var Coordinates
     */
    private $coordinates;

    public function __construct(string $organizerId, Coordinates $coordinates)
    {
        parent::__construct($organizerId);
        $this->coordinates = $coordinates;
    }

    /**
     * @return Coordinates
     */
    public function coordinates(): Coordinates
    {
        return $this->coordinates;
    }

    /**
     * @return array
     */
    public function serialize()
    {
        return parent::serialize() + [
                'coordinates' => [
                    'lat' => $this->coordinates->getLatitude()->toDouble(),
                    'long' => $this->coordinates->getLongitude()->toDouble(),
                ],
            ];
    }

    /**
     * @param array $data
     * @return static
     */
    public static function deserialize(array $data)
    {
        return new static(
            $data['item_id'],
            new Coordinates(
                new Latitude($data['coordinates']['lat']),
                new Longitude($data['coordinates']['long'])
            )
        );
    }
}

Fix inheritence structure on (Organizer) GeoCordinatesUpdated event


<?php
// Check for empty fields
if(empty($_POST['name'])      ||
   empty($_POST['email'])     ||
   empty($_POST['phone'])     ||
   empty($_POST['message'])   ||
   !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
   {
   echo "No arguments Provided!";
   return false;
   }

$name = strip_tags(htmlspecialchars($_POST['name']));
$email_address = strip_tags(htmlspecialchars($_POST['email']));
$phone = strip_tags(htmlspecialchars($_POST['phone']));
$message = strip_tags(htmlspecialchars($_POST['message']));

// Create the email and send the message
$to = 'yourname@yourdomain.com'; // Add your email address inbetween the '' replacing yourname@yourdomain.com - This is where the form will send a message to.
$email_subject = "Website Contact Form:  $name";
$email_body = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $email_address\n\nPhone: $phone\n\nMessage:\n$message";
$headers = "From: noreply@yourdomain.com\n"; // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com.
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
return true;
?>

<?php
// Check for empty fields
if(empty($_POST['name'])      ||
   empty($_POST['email'])     ||
   empty($_POST['phone'])     ||
   empty($_POST['message'])   ||
   !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
   {
   echo "No arguments Provided!";
   return false;
   }

$name = strip_tags(htmlspecialchars($_POST['name']));
$email_address = strip_tags(htmlspecialchars($_POST['email']));
$phone = strip_tags(htmlspecialchars($_POST['phone']));
$message = strip_tags(htmlspecialchars($_POST['message']));

// Create the email and send the message
$to = 'tejas.sathe@gmail.com'; // Add your email address inbetween the '' replacing yourname@yourdomain.com - This is where the form will send a message to.
$email_subject = "Website Contact Form:  $name";
$email_body = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $email_address\n\nPhone: $phone\n\nMessage:\n$message";
$headers = "From: noreply@yourdomain.com\n"; // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com.
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
return true;
?>

Put Tejas email in contact form

Put Tejas email in contact form


<?php

namespace Katsana\Sdk\One;

class Vehicles extends Request
{
    /**
     * List all vehicles available for the user.
     *
     * @return \Laravie\Codex\Response
     */
    public function index()
    {
        return $this->send('GET', 'vehicles', $this->getApiHeaders());
    }

    /**
     * Show single vehicle.
     *
     * @param  int  $id
     *
     * @return \Laravie\Codex\Response
     */
    public function show($id)
    {
        return $this->send('GET', "vehicles/{$id}", $this->getApiHeaders());
    }

    /**
     * Get vehicle current location.
     *
     * @param  int  $id
     *
     * @return \Laravie\Codex\Response
     */
    public function location($id)
    {
        return $this->send('GET', "vehicles/{$id}/location", $this->getApiHeaders());
    }
}

<?php

namespace Katsana\Sdk\One;

class Vehicles extends Request
{
    /**
     * List all vehicles available for the user.
     *
     * @return \Laravie\Codex\Response
     */
    public function index()
    {
        return $this->send('GET', 'vehicles', $this->getApiHeaders());
    }

    /**
     * Show single vehicle.
     *
     * @param  int  $id
     *
     * @return \Laravie\Codex\Response
     */
    public function show($id)
    {
        return $this->send('GET', "vehicles/{$id}", $this->getApiHeaders());
    }

    /**
     * Get vehicle current location.
     *
     * @param  int  $id
     *
     * @return \Laravie\Codex\Response
     */
    public function location($id)
    {
        return $this->send('GET', "vehicles/{$id}/location", $this->getApiHeaders());
    }

    /**
     * Upload profile avatar.
     *
     * @param  int  $id
     * @param  mixed  $file
     *
     * @return \Laravie\Codex\Response
     */
    public function uploadAvatar($id, $file)
    {
        list($headers, $stream) = $this->prepareMultipartRequestPayloads(
            $this->getApiHeaders(),
            $this->getApiBody(),
            compact('file')
        );

        return $this->send('POST', "vehicles/{$id}/avatar", $headers, $stream);
    }
}

Allow to upload avatar for vehicle.

Allow to upload avatar for vehicle.

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


<?php namespace Modules\Translation\ValueObjects;

use Illuminate\Support\Collection;

class TranslationGroup
{
    /**
     * @var Collection
     */
    private $translations;

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

    /**
     * @param array $translationsRaw
     * @return Collection
     */
    private function reArrangeTranslations(array $translationsRaw)
    {
        $translations = [];

        foreach ($translationsRaw as $locale => $translationGroup) {
            foreach ($translationGroup as $key => $translation) {
                $translations[$key][$locale] = $translation;
            }
        }

        return new Collection($translations);
    }

    /**
     * Return the translations
     * @return Collection
     */
    public function all()
    {
        return $this->translations;
    }
}

<?php namespace Modules\Translation\ValueObjects;

use Illuminate\Support\Collection;

class TranslationGroup
{
    /**
     * @var array
     */
    private $translations;

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

    /**
     * @param array $translationsRaw
     * @return Collection
     */
    private function reArrangeTranslations(array $translationsRaw)
    {
        $translations = [];

        foreach ($translationsRaw as $locale => $translationGroup) {
            foreach ($translationGroup as $key => $translation) {
                $translations[$key][$locale] = $translation;
            }
        }

        return new Collection($translations);
    }

    /**
     * Return the translations
     * @return Collection
     */
    public function all()
    {
        return $this->reArrangeTranslations($this->translations);;
    }

    /**
     * Return the raw translations
     * @return array
     */
    public function allRaw()
    {
        return $this->translations;
    }
}

Allow return of raw translations

Allow return of raw translations


<?php

// You can adjust this following constants if necessary.

// The APP constant is where your application folder located.
define('APP', dirname(__FILE__) . '/');

// The INDEX_FILE constant is this defailt file name.
define('INDEX_FILE', basename(__FILE__));

// And the GEAR constant is where panada folder located.
define('GEAR', '../panada/');

require_once GEAR.'Gear.php';

// http://www.php.net/error_reporting
new Gear;

<?php

// You can adjust this following constants if necessary.

// The APP constant is where your application folder located.
define('APP', dirname(__FILE__) . '/');

// The INDEX_FILE constant is this defailt file name.
define('INDEX_FILE', basename(__FILE__));

// And the GEAR constant is where panada folder located.
define('GEAR', '../panada/');

require_once GEAR.'Gear.php';

// To sets which PHP errors are reported just like documented in this page
// http://php.net/manual/en/function.error-reporting.php
// You can pass a parameter into the Gear class.

// Turn off all errors reporting - production use.
// new Gear(0);

// By default all errors will displayed - development use.
new Gear;

Add litle doc to disable/enable error display


<?php

namespace Illuminate\Database\Console\Migrations;

use Illuminate\Console\Command;

class BaseCommand extends Command
{
    /**
     * Get the path to the migration directory.
     *
     * @return string
     */
    protected function getMigrationPath()
    {
        return $this->laravel->databasePath().DIRECTORY_SEPARATOR.'migrations';
    }

    /**
     * Get all of the migration paths.
     *
     * @return array
     */
    protected function getMigrationPaths()
    {
        // Here, we will check to see if a path option has been defined. If it has
        // we will use the path relative to the root of this installation folder
        // so that migrations may be run for any path within the applications.
        if ($this->input->hasOption('path') && $this->option('path')) {
            return [$this->laravel->basePath().'/'.$this->option('path')];
        }

        return array_merge(
            [$this->getMigrationPath()], $this->migrator->paths()
        );
    }
}

<?php

namespace Illuminate\Database\Console\Migrations;

use Illuminate\Console\Command;

class BaseCommand extends Command
{
    /**
     * Get all of the migration paths.
     *
     * @return array
     */
    protected function getMigrationPaths()
    {
        // Here, we will check to see if a path option has been defined. If it has we will
        // use the path relative to the root of the installation folder so our database
        // migrations may be run for any customized path from within the application.
        if ($this->input->hasOption('path') && $this->option('path')) {
            return [$this->laravel->basePath().'/'.$this->option('path')];
        }

        return array_merge(
            [$this->getMigrationPath()], $this->migrator->paths()
        );
    }

    /**
     * Get the path to the migration directory.
     *
     * @return string
     */
    protected function getMigrationPath()
    {
        return $this->laravel->databasePath().DIRECTORY_SEPARATOR.'migrations';
    }
}

Work on base migration command.

Work on base migration command.


<?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.
 */

use Symfony\Polyfill\Php70 as p;

if (PHP_VERSION_ID < 70000) {
    if (!defined('PHP_INT_MIN')) {
        define('PHP_INT_MIN', ~PHP_INT_MAX);
    }
    if (!function_exists('intdiv')) {
        function intdiv($dividend, $divisor) { return p\Php70::intdiv($dividend, $divisor); }
    }
    if (!function_exists('preg_replace_callback_array')) {
        function preg_replace_callback_array(array $patterns, $subject, $limit = -1, &$count = 0) { return p\Php70::preg_replace_callback_array($patterns, $subject, $limit, $count); }
    }
    if (!function_exists('error_clear_last')) {
        function error_clear_last() { return p\Php70::error_clear_last(); }
    }
}

<?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.
 */

use Symfony\Polyfill\Php70 as p;

if (PHP_VERSION_ID >= 70000) {
    return;
}

if (!defined('PHP_INT_MIN')) {
    define('PHP_INT_MIN', ~PHP_INT_MAX);
}

if (!function_exists('intdiv')) {
    function intdiv($dividend, $divisor) { return p\Php70::intdiv($dividend, $divisor); }
}
if (!function_exists('preg_replace_callback_array')) {
    function preg_replace_callback_array(array $patterns, $subject, $limit = -1, &$count = 0) { return p\Php70::preg_replace_callback_array($patterns, $subject, $limit, $count); }
}
if (!function_exists('error_clear_last')) {
    function error_clear_last() { return p\Php70::error_clear_last(); }
}

Fix declaring extra constants when `intl` is loaded


<?php
namespace OCA\Passwords\Db;

use OCP\IDb;
use OCP\AppFramework\Db\Mapper;

class PasswordMapper extends Mapper {

	public function __construct(IDb $db) {
		parent::__construct($db, 'passwords', '\OCA\Passwords\Db\Password');
	}

	public function find($id, $userId) {
		$sql = 'SELECT * FROM *PREFIX*passwords WHERE id = ? AND user_id = ?';
		return $this->findEntity($sql, [$id, $userId]);
	}

	public function findAll($userId) {
		$sql = 'SELECT * FROM *PREFIX*passwords WHERE user_id = ? ORDER BY LOWER(website) COLLATE utf8_general_ci ASC';
		return $this->findEntities($sql, [$userId]);
	}
}

<?php
namespace OCA\Passwords\Db;

use OCP\IDb;
use OCP\AppFramework\Db\Mapper;

class PasswordMapper extends Mapper {

	public function __construct(IDb $db) {
		parent::__construct($db, 'passwords', '\OCA\Passwords\Db\Password');
	}

	public function find($id, $userId) {
		$sql = 'SELECT * FROM *PREFIX*passwords WHERE id = ? AND user_id = ?';
		return $this->findEntity($sql, [$id, $userId]);
	}

	public function findAll($userId) {
		$dbtype = \OC_Config::getValue('dbtype', '');
		if ($dbtype == 'mysql') {
			$sql = 'SELECT * FROM *PREFIX*passwords WHERE user_id = ? ORDER BY LOWER(website) COLLATE utf8_general_ci ASC';
		} else if ($dbtype == 'sqlite') {
			$sql = 'SELECT * FROM *PREFIX*passwords WHERE user_id = ? ORDER BY website COLLATE NOCASE';
		} else {
			$sql = 'SELECT * FROM *PREFIX*passwords WHERE user_id = ? ORDER BY LOWER(website) ASC';
		}
		return $this->findEntities($sql, [$userId]);
	}
}

Fix for SQLite3 and PostgreSQL databases


<?php

namespace App\Http\Controllers;

use Illuminate\Support\Facades\Config;
use App\Providers\ElasticSearch;
use Illuminate\Support\Facades\Input;

Use Utils;
use Request;

class StudyController extends Controller {

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct() {
        $this->middleware('guest');
    }

    public function index() {
        return view('study.index');
    }

    public function view($type, $id) {
        $study = ElasticSearch::get($id, 'study', $type);
        //dd($study);
        return view('study.view')
                ->with('study', $study);
    }
}

<?php

namespace App\Http\Controllers;

use Illuminate\Support\Facades\Config;
use App\Providers\ElasticSearch;
use Illuminate\Support\Facades\Input;

Use Utils;
use Request;

class StudyController extends Controller {

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct() {
        $this->middleware('guest');
    }

    public function index() {
        return view('study.index');
    }

    public function view($type, $id) {
        $study = ElasticSearch::get($id, env('ES_STUDY_UNIT_INDEX'), $type);
        //dd($study);
        return view('study.view')
                ->with('study', $study);
    }
}

Fix the hard-coded Elasticsearch index

Fix the hard-coded Elasticsearch index


<?php

namespace App\Listeners;

use App\User;
use App\Product;
use App\Mail\ProductStockLow;
use App\Mail\ProductOutOfStock;
use App\Events\ProductStockChanged;
use Illuminate\Contracts\Queue\ShouldQueue;

class EmailStockNotification implements ShouldQueue
{
    /**
     * Handle the event.
     *
     * @param ProductStockChanged $event
     *
     * @return void
     */
    public function handle(ProductStockChanged $event)
    {
        if ($this->isLowInStock($event->product)) {
            $mailable = $this->getStockMailable($event->product);
            foreach (User::shopAdmins()->get() as $admin) {
                \Mail::to($admin)->send($mailable);
            }
        }
    }

    protected function isLowInStock(Product $product)
    {
        return $product->stock_qty <= config('shop.low_stock_qty');
    }

    protected function getStockMailable(Product $product)
    {
        if ($product->stock_qty == 0) {
            return new ProductOutOfStock($product);
        }

        return new ProductStockLow($product);
    }
}

<?php

namespace App\Listeners;

use App\User;
use App\Product;
use App\Mail\ProductStockLow;
use App\Mail\ProductOutOfStock;
use App\Events\ProductStockChanged;
use Illuminate\Contracts\Queue\ShouldQueue;

class EmailStockNotification implements ShouldQueue
{
    /**
     * Handle the event.
     *
     * @param ProductStockChanged $event
     *
     * @return void
     */
    public function handle(ProductStockChanged $event)
    {
        $product = $event->product->fresh();
        if ($this->isLowInStock($product)) {
            $mailable = $this->getStockMailable($product);
            foreach (User::shopAdmins()->get() as $admin) {
                \Mail::to($admin)->send($mailable);
            }
        }
    }

    protected function isLowInStock(Product $product)
    {
        return $product->stock_qty <= config('shop.low_stock_qty');
    }

    protected function getStockMailable(Product $product)
    {
        if ($product->stock_qty == 0) {
            return new ProductOutOfStock($product);
        }

        return new ProductStockLow($product);
    }
}

Refresh product before checking stock

Refresh product before checking stock


<?php

namespace Http\Message\Encoding;

/**
 * Decorate a stream which is chunked.
 *
 * Allow to decode a chunked stream
 *
 * @author Joel Wurtz <joel.wurtz@gmail.com>
 */
class DechunkStream extends FilteredStream
{
    /**
     * {@inheritdoc}
     */
    public function getReadFilter()
    {
        return 'dechunk';
    }

    /**
     * {@inheritdoc}
     */
    public function getWriteFilter()
    {
        if (!array_key_exists('chunk', stream_get_filters())) {
            stream_filter_register('chunk', 'Http\Encoding\Filter\Chunk');
        }

        return 'chunk';
    }
}

<?php

namespace Http\Message\Encoding;

/**
 * Decorate a stream which is chunked.
 *
 * Allow to decode a chunked stream
 *
 * @author Joel Wurtz <joel.wurtz@gmail.com>
 */
class DechunkStream extends FilteredStream
{
    /**
     * {@inheritdoc}
     */
    public function getReadFilter()
    {
        return 'dechunk';
    }

    /**
     * {@inheritdoc}
     */
    public function getWriteFilter()
    {
        if (!array_key_exists('chunk', stream_get_filters())) {
            stream_filter_register('chunk', 'Http\Message\Encoding\Filter\Chunk');
        }

        return 'chunk';
    }
}

Fix namespace of chunk filter

Fix namespace of chunk filter


<?php
namespace WebOfTalent\Links;
use SilverStripe\ORM\DataExtension;

/**
 * Get a handle on a links folder for rendering purposes
 *
 * Class LinksExtension
 * @package WebOfTalent\Links
 */
class GetLinksFolderExtension extends DataExtension
{
    /**
     * @param $slug the slug of the links folder in question, e.g. header, footer, quicklinks
     */
   public function getLinksFolder($slug)
   {
       $folder = LinksFolder::get()->filter(['Slug' => $slug])->first();
       return $folder->Links();
   }

}

<?php
namespace WebOfTalent\Links;
use SilverStripe\ORM\DataExtension;

/**
 * Get a handle on a links folder for rendering purposes
 *
 * Class LinksExtension
 * @package WebOfTalent\Links
 */
class GetLinksFolderExtension extends DataExtension
{
    /**
     * @param $slug the slug of the links folder in question, e.g. header, footer, quicklinks
     */
   public function getLinksFolder($slug)
   {
       $folder = LinksFolder::get()->filter(['Slug' => $slug])->first();
       if (!empty($folder)) {
           return $folder->Links();
       }

   }

}

Deal with the folder missing case

FIX: Deal with the folder missing case


<?php

return array(

	/*
	|--------------------------------------------------------------------------
	| Application Path
	|--------------------------------------------------------------------------
	|
	| Here we just defined the path to the application directory. Most likely
	| you will never need to change this value as the default setup should
	| work perfectly fine for the vast majority of all our applications.
	|
	*/

	'app' => __DIR__.'/../app',

	/*
	|--------------------------------------------------------------------------
	| Public Path
	|--------------------------------------------------------------------------
	|
	| The public path contains the assets for your web application, such as
	| your JavaScript and CSS files, and also contains the primary entry
	| point for web requests into these applications from the outside.
	|
	*/

	'public' => __DIR__.'/../public',

	/*
	|--------------------------------------------------------------------------
	| Base Path
	|--------------------------------------------------------------------------
	|
	| The base path is the root of the Laravel installation. Most likely you
	| will not need to change this value. But, if for some wild reason it
	| is necessary you will do so here, just proceed with some caution.
	|
	*/

	'base' => __DIR__.'/..',

	/*
	|--------------------------------------------------------------------------
	| Storage Path
	|--------------------------------------------------------------------------
	|
	| The storage path is used by Laravel to store cached Blade views, logs
	| and other pieces of information. You may modify the path here when
	| you want to change the location of this directory for your apps.
	|
	*/

	'storage' => __DIR__.'/../app/storage',

);

<?php

return array(

	/*
	|--------------------------------------------------------------------------
	| Application Path
	|--------------------------------------------------------------------------
	|
	| Here we just defined the path to the application directory. Most likely
	| you will never need to change this value as the default setup should
	| work perfectly fine for the vast majority of all our applications.
	|
	*/

	'app' => __DIR__.'/../app',

	/*
	|--------------------------------------------------------------------------
	| Public Path
	|--------------------------------------------------------------------------
	|
	| The public path contains the assets for your web application, such as
	| your JavaScript and CSS files, and also contains the primary entry
	| point for web requests into these applications from the outside.
	|
	*/

	'public' => __DIR__.'/../public',

	/*
	|--------------------------------------------------------------------------
	| Base Path
	|--------------------------------------------------------------------------
	|
	| The base path is the root of the Laravel installation. Most likely you
	| will not need to change this value. But, if for some wild reason it
	| is necessary you will do so here, just proceed with some caution.
	|
	*/

	'base' => __DIR__.'/..',

	/*
	|--------------------------------------------------------------------------
	| Storage Path
	|--------------------------------------------------------------------------
	|
	| The storage path is used by Laravel to store cached Blade views, logs
	| and other pieces of information. You may modify the path here when
	| you want to change the location of this directory for your apps.
	|
	*/

	//'storage' => __DIR__.'/../app/storage',
	'storage' => '/var/billett',

);

Put Laravel storage outside source tree

Put Laravel storage outside source tree


<?
require_once('config.inc.php');

function crash($string){
	ob_end_clean();
	die($string);
}

$db_connection = mysqli_connect($db_host,$db_user,$db_passwd, $db_name) or die('Could not connect to database');

unset($db_host, $db_name, $db_user, $db_passwd);

mysqli_query($db_connection, "SET NAMES 'utf8'") or crash(mysqli_error($db_connection));
mysqli_query($db_connection, "SET CHARACTER SET 'utf8'") or crash(mysqli_error($db_connection));
?>

<?
require_once('config.inc.php');

function crash($string){
	ob_end_clean();
	die($string);
}

$db_connection = mysqli_connect($db_host,$db_user,$db_passwd, $db_name) or die('Could not connect to database');

unset($db_host, $db_name, $db_user, $db_passwd);

mysqli_set_charset($db_connection, 'utf8') or crash(mysqli_error($db_connection));
?>

Fix encoding issue that was converting UTF-8 characters to question marks


<!doctype html>
<html>
<head>
	<title><?php wp_title("|", true, "right"); bloginfo("name");?></title>
	<meta charset="utf-8" />
	<!-- Load up the Ubuntu fonts -->
	<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700,400italic" type="text/css">

	<!-- Main stylesheet -->
	<link rel="stylesheet" href="<?php bloginfo("stylesheet_url");?>" />

	<meta name="viewport" content="width=device-width, initial-scale=1.0" />

	<?php do_action( 'bp_head' ); ?>
	<?php wp_head(); ?>
</head>

<!doctype html>
<html>
<head>
	<title><?php wp_title("|", true, "right"); bloginfo("name");?></title>
	<meta charset="utf-8" />
	<!-- Load up the Ubuntu fonts -->
	<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700,400italic" type="text/css">

	<!-- Main stylesheet -->
	<link rel="stylesheet" href="<?php bloginfo("stylesheet_url");?>" />

	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<?php wp_head(); ?>
</head>

Remove Buddypress hook from <head>

Remove Buddypress hook from <head>


<?php

class Tree
{
	public $species;
	public $latitude;
	public $longitude;

	function __construct($spe, $lat, $lon)
	{
		$species = $spe;
		$latitude = $lat;
		$longitude = $lon;
	}
}

?>

<?php

class Tree
{
	public $species;
	public $latitude;
	public $longitude;

	function __construct($spe, $lat, $lon)
	{
		$this->species = $spe;
		$this->latitude = $lat;
		$this->longitude = $lon;
	}
}

?>

Update self reference in constructor

Update self reference in constructor


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

namespace Zend\Http\Header;

/**
 * @throws Exception\InvalidArgumentException
 * @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19
 */
class Etag implements HeaderInterface
{

    public static function fromString($headerLine)
    {
        $header = new static();

        list($name, $value) = explode(': ', $headerLine, 2);

        // check to ensure proper header type for this factory
        if (strtolower($name) !== 'etag') {
            throw new Exception\InvalidArgumentException('Invalid header line for Etag string: "' . $name . '"');
        }

        // @todo implementation details
        $header->value = $value;

        return $header;
    }

    public function getFieldName()
    {
        return 'Etag';
    }

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

    public function toString()
    {
        return 'Etag: ' . $this->getFieldValue();
    }
}

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

namespace Zend\Http\Header;

/**
 * @throws Exception\InvalidArgumentException
 * @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19
 */
class Etag implements HeaderInterface
{

    public static function fromString($headerLine)
    {
        $header = new static();

        list($name, $value) = GenericHeader::splitHeaderLine($headerLine);

        // check to ensure proper header type for this factory
        if (strtolower($name) !== 'etag') {
            throw new Exception\InvalidArgumentException('Invalid header line for Etag string: "' . $name . '"');
        }

        // @todo implementation details
        $header->value = $value;

        return $header;
    }

    public function getFieldName()
    {
        return 'Etag';
    }

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

    public function toString()
    {
        return 'Etag: ' . $this->getFieldValue();
    }
}

Unify criteria for split name

[http] Unify criteria for split name

Add missing Etag from zendframework/zf2#5302 c22ec11bf67f7d3f36edcd824ecdb26960c789d5


<?php

/*

Plugin Name: Castlegate IT WP Postcard
Plugin URI: http://github.com/castlegateit/cgit-wp-postcard
Description: Quick and easy pre-defined templates for Postman.
Version: 2.6
Author: Castlegate IT
Author URI: http://www.castlegateit.co.uk/
License: MIT

*/

if (!defined('ABSPATH')) {
    wp_die('Access denied');
}

define('CGIT_POSTCARD_PLUGIN', __FILE__);

add_action('cgit_postman_loaded', function () {
    require_once __DIR__ . '/classes/autoload.php';
    require_once __DIR__ . '/functions.php';

    $plugin = new \Cgit\Postcard\Plugin();

    do_action('cgit_postcard_loaded');
});

<?php

/*

Plugin Name: Castlegate IT WP Postcard
Plugin URI: http://github.com/castlegateit/cgit-wp-postcard
Description: Quick and easy pre-defined templates for Postman.
Version: 2.6
Author: Castlegate IT
Author URI: http://www.castlegateit.co.uk/
License: AGPL

*/

if (!defined('ABSPATH')) {
    wp_die('Access denied');
}

define('CGIT_POSTCARD_PLUGIN', __FILE__);

add_action('cgit_postman_loaded', function () {
    require_once __DIR__ . '/classes/autoload.php';
    require_once __DIR__ . '/functions.php';

    $plugin = new \Cgit\Postcard\Plugin();

    do_action('cgit_postcard_loaded');
});

Switch license from MIT to AGPL in plugin file


<a href="<?=$relRoot;?>">Home

<a href="<?=$relRoot;?>?p=resume">Resume

<a href="<?=$relRoot;?>?p=projects">Projects

@StrangePan

<a href="<?=$relRoot;?>">Home

<a href="<?=$relRoot;?>?p=resume">Resume

<a href="<?=$relRoot;?>?p=projects">Projects

Twitter

Rename '@StrangePan' in header to 'Twitter'. Simplifies header menu.


<?php
namespace Craft;

class AuditLogVariable {

    public function log()
    {

        return craft()->auditLog->log();

    }

    public function view($id)
    {

        return craft()->auditLog->view($id);

    }

}

<?php
namespace Craft;

class AuditLogVariable {

    public function log($criteria)
    {

        return craft()->auditLog->log((object)$criteria);

    }

    public function view($id)
    {

        return craft()->auditLog->view($id);

    }

}

Allow criteria via log variable

Allow criteria via log variable


<?php
require_once('phpunit-config.php');

// Get MarkLogic version for skipping tests
$serverConfig = $mlphp->getServerConfig();
$mlphp->config['mlversion'] =  $serverConfig['version'];

// Create REST API for tests
$api = $mlphp->getAPI()->create()->setProperty('debug', 'true');

function phpunitTeardown($api)
{
    // Delete REST API
    if ($api->exists()) {
        $api->delete();
    }
}

// Run after all tests complete
register_shutdown_function('phpunitTeardown', $api);

?>

<?php
/**
 * Bootstrap script for PHPUnit testing.
 * @see phpunit.xml
 */
require_once('phpunit-config.php');

// Get MarkLogic version
$serverConfig = $mlphp->getServerConfig();
$mlphp->config['mlversion'] =  $serverConfig['version'];

// Create REST API for tests
$api = $mlphp->getAPI()->create()->setProperty('debug', 'true');

function phpunitTeardown($api)
{
    // Delete REST API
    if ($api->exists()) {
        $api->delete();
    }
}

// Run after all tests complete
register_shutdown_function('phpunitTeardown', $api);

Comment updates for test bootstrap file.


<?php namespace CL\Atlas;

/**
 * @author     Ivan Kerin
 * @copyright  (c) 2014 Clippings Ltd.
 * @license    http://www.opensource.org/licenses/isc-license.txt
 */
interface Parametrised
{

    public function parameters();

}

Remove extra blank lines before class closing brace


<?php
class Kwc_Errors_Component extends Kwc_Abstract
{
    public static function getSettings($param = null)
    {
        $ret = parent::getSettings($param);
        $ret['contentSender'] = 'Kwc_Errors_ContentSender';
        $ret['generators']['accessDenied'] = array(
            'class' => 'Kwf_Component_Generator_Page_Static',
            'component' => 'Kwc_Errors_AccessDenied_Component'
        );
        $ret['generators']['notFound'] = array(
            'class' => 'Kwf_Component_Generator_Page_Static',
            'component' => 'Kwc_Errors_NotFound_Component'
        );
        $ret['flags']['noIndex'] = true;
        $ret['flags']['skipFulltextRecursive'] = true;
        return $ret;
    }
}

<?php
class Kwc_Errors_Component extends Kwc_Abstract
{
    public static function getSettings($param = null)
    {
        $ret = parent::getSettings($param);
        $ret['contentSender'] = 'Kwc_Errors_ContentSender';
        $ret['generators']['accessDenied'] = array(
            'class' => 'Kwf_Component_Generator_Page_Static',
            'component' => 'Kwc_Errors_AccessDenied_Component',
            'name' => trlKwfStatic('Access denied'),
        );
        $ret['generators']['notFound'] = array(
            'class' => 'Kwf_Component_Generator_Page_Static',
            'component' => 'Kwc_Errors_NotFound_Component',
            'name' => trlKwfStatic('Not found'),
        );
        $ret['flags']['noIndex'] = true;
        $ret['flags']['skipFulltextRecursive'] = true;
        return $ret;
    }
}

Set name for not-found and access-denies pages

This name will be shown in the page title and breadcrumbs instead of the component-key.


<?php
    require_once('simpletest/unit_tester.php');
    require_once('simpletest/reporter.php');

    require_once(dirname(__FILE__).'/acceptance_test.php');
    require_once(dirname(__FILE__).'/annotation_test.php');
    require_once(dirname(__FILE__).'/constrained_annotation_test.php');
    require_once(dirname(__FILE__).'/annotation_parser_test.php');
    require_once(dirname(__FILE__).'/doc_comment_test.php');

    class AllTests extends GroupTest {
          function __construct($title = false) {
              parent::__construct($title);
              $this->addTestClass('TestOfAnnotations');
              $this->addTestClass('TestOfPerformanceFeatures');
              $this->addTestClass('TestOfSupportingFeatures');
              $this->addTestClass('TestOfAnnotation');
              $this->addTestClass('TestOfConstrainedAnnotation');
              $this->addTestClass('TestOfMatchers');
              $this->addTestClass('TestOfAnnotationMatchers');
              $this->addTestClass('TestOfDocComment');

          }
      }

    Addendum::setRawMode(false);
    $test = new AllTests('All tests in reflection mode');
    $test->run(new HtmlReporter());

    Addendum::setRawMode(true);
    $test = new AllTests('All tests in raw mode');
    $test->run(new HtmlReporter());
?>

<?php
    require_once('simpletest/unit_tester.php');
    require_once('simpletest/reporter.php');

    require_once(dirname(__FILE__).'/acceptance_test.php');
    require_once(dirname(__FILE__).'/annotation_test.php');
    require_once(dirname(__FILE__).'/constrained_annotation_test.php');
    require_once(dirname(__FILE__).'/annotation_parser_test.php');
    require_once(dirname(__FILE__).'/doc_comment_test.php');

    class AllTests extends GroupTest {
          function __construct($title = false) {
              parent::__construct($title);
              $this->addTestClass('TestOfAnnotations');
              $this->addTestClass('TestOfPerformanceFeatures');
              $this->addTestClass('TestOfSupportingFeatures');
              $this->addTestClass('TestOfAnnotation');
              $this->addTestClass('TestOfConstrainedAnnotation');
              $this->addTestClass('TestOfMatchers');
              $this->addTestClass('TestOfAnnotationMatchers');
              $this->addTestClass('TestOfDocComment');

          }
      }
    $reporter = TextReporter::inCli() ? new TextReporter() : new HtmlReporter();

    Addendum::setRawMode(false);
    $test = new AllTests('All tests in reflection mode');
    $test->run($reporter);

    Addendum::setRawMode(true);
    $test = new AllTests('All tests in raw mode');
    $test->run($reporter);
?>

Use TextReporter when in cli mode.

Use TextReporter when in cli mode.


<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once('class.TicketAdminPage.php');
require_once('class.FlipsideTicketDB.php');
$page = new TicketAdminPage('Burning Flipside - Tickets');

$page->add_js(JS_DATATABLE);
$page->add_css(CSS_DATATABLE);
$page->add_js_from_src('js/sold_tickets.js');

$db = new FlipsideTicketDB();
$ticket_count = $db->getTicketCount();

if($ticket_count == 0 || $ticket_count === FALSE)
{
    $page->add_notification('There are currently no tickets created! Click here to generate tickets.');
}

    $page->body .= '

Sold Tickets

                        Short Code
                        First Name
                        Last Name
                        Type

';

$page->print_page();
// vim: set tabstop=4 shiftwidth=4 expandtab:
?>

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once('class.TicketAdminPage.php');
require_once('class.FlipsideTicketDB.php');
$page = new TicketAdminPage('Burning Flipside - Tickets');

$page->add_js(JS_DATATABLE);
$page->add_css(CSS_DATATABLE);
$page->add_js_from_src('js/sold_tickets.js');

$page->body .= '

Sold Tickets

                        Short Code
                        First Name
                        Last Name
                        Type

';

$page->print_page();
// vim: set tabstop=4 shiftwidth=4 expandtab:
?>

Remove reference to deprecated TicketDB class


<?php

/*
	Copyright (c) 2012 Colin Rotherham, http://colinr.com
	https://github.com/colinrotherham
*/

	namespace CRD\Core;

	class App
	{
		public static $name = '';
		public static $path = '';

		public static $templates = array();
		public static $partials = array();

		public static $cache_enabled = true;
		public static $cache_length = 3600;

		public static $credentials;
		public static $queries;

		public static $debug = false;

		public static function init()
		{
			self::$credentials = (object) array();
			self::$queries = (object) array();
		}
	}

<?php

/*
	Copyright (c) 2012 Colin Rotherham, http://colinr.com
	https://github.com/colinrotherham
*/

	namespace CRD\Core;

	class App
	{
		public static $version = '';

		public static $name = '';
		public static $path = '';

		public static $templates = array();
		public static $partials = array();

		public static $cache_enabled = true;
		public static $cache_length = 3600;

		public static $credentials;
		public static $queries;

		public static $debug = false;

		public static function init()
		{
			self::$credentials = (object) array();
			self::$queries = (object) array();
		}
	}

Add version string to app class

Add version string to app class


@extends('fluxbb::layout.main')

@section('main')

{{-- TODO: Escape all the variables!!! --}}

@foreach ($categories as $cat_info)
<?php $category = $cat_info['category']; ?>

		{{ $category->cat_name }}

@foreach ($cat_info['forums'] as $forum)

				id)) }}">{{ $forum->forum_name }}
				{{ $forum->forum_desc }}

{{ $forum->numTopics() }} topics

{{ $forum->numPosts() }} posts

@endforeach

@endforeach

@stop

@extends('fluxbb::layout.main')

@section('main')

{{-- TODO: Escape all the variables!!! --}}

@foreach ($categories as $cat_info)
<?php $category = $cat_info['category']; ?>

		{{ $category->cat_name }}

@foreach ($cat_info['forums'] as $forum)

				 $forum->id)) }}">{{ $forum->forum_name }}
				{{ $forum->forum_desc }}

{{ $forum->numTopics() }} topics

{{ $forum->numPosts() }} posts

@endforeach

@endforeach

@stop

Fix link on index view.

Fix link on index view.


<?php
return array(
    'view_manager' => array(
        'template_map' => array(
            'layout/layouttwb'      => __DIR__ . '/../view/layout/layouttwb.phtml',
        ),
        'template_path_stack' => array(
            'dluTwBootstrap'        => __DIR__ . '/../view',
        ),
    ),
    'service_manager'   => array(
        'invokables'       => array(
            'dlu_twb_gen_util'                      => 'DluTwBootstrap\GenUtil',
            'dlu_twb_form_util'                     => 'DluTwBootstrap\Form\FormUtil',
            'dlu_twb_nav_view_helper_configurator'  => 'DluTwBootstrap\View\Helper\Navigation\PluginConfigurator',
         ),
    ),
    'dlu_tw_bootstrap'  => array(
        'sup_ver_zf2'       => '2.0.0rc3 - 116 (commit d959262b1c)',
        'sup_ver_twb'       => '2.0.4',
    ),
);

<?php
return array(
    'view_manager' => array(
        'template_map' => array(
            'layout/layouttwb'      => __DIR__ . '/../view/layout/layouttwb.phtml',
        ),
        'template_path_stack' => array(
            'dluTwBootstrap'        => __DIR__ . '/../view',
        ),
    ),
    'service_manager'   => array(
        'invokables'       => array(
            'dlu_twb_gen_util'                      => 'DluTwBootstrap\GenUtil',
            'dlu_twb_form_util'                     => 'DluTwBootstrap\Form\FormUtil',
            'dlu_twb_nav_view_helper_configurator'  => 'DluTwBootstrap\View\Helper\Navigation\PluginConfigurator',
         ),
    ),
    'dlu_tw_bootstrap'  => array(
        'sup_ver_zf2'       => '2.0.0rc3 - 170 (commit 2f42641400)',
        'sup_ver_twb'       => '2.0.4',
    ),
);

Update ZF2 supported version info

Update ZF2 supported version info


<?php
$account_name = BackendAccount::getName();
$Comment = new CommentObj($comment['id']);
if ($Comment->array):
	$comment = $Comment->array;
	if (filter_var($comment[$account_name]['username'], FILTER_VALIDATE_EMAIL) && !$comment[$account_name]['confirmed']) {
		$posted_by = $comment[$account_name]['name'];
		if (!empty($comment[$account_name]['website'])) {
			$posted_by = '' . $posted_by . '';
		}
	} else {
		$posted_by = $comment[$account_name]['username'];
		if ($comment[$account_name]['confirmed']) {
			$posted_by = '' . $posted_by . '';
		}
	}
?>

		<img src="<?php echo BackendAccount::getGravatar($comment[$account_name]['email'], 30) ?>" style="float: left; margin-right: 5px;" width="30px" height="30px">

			posted by <?php echo $posted_by ?> <span title="<?php echo $comment['added'] ?>"><?php echo time_elapsed($comment['added']) ?>

			<?php echo $comment['content'] ?>

<?php endif; ?>

<?php
$account_name = BackendAccount::getName();
$Comment = new CommentObj($comment['id']);
if ($Comment->array):
	$comment = $Comment->array;
	if (filter_var($comment[$account_name]['username'], FILTER_VALIDATE_EMAIL) && !$comment[$account_name]['confirmed']) {
		$posted_by = $comment[$account_name]['name'];
		if (!empty($comment[$account_name]['website'])) {
			$posted_by = '' . $posted_by . '';
		}
	} else {
		$posted_by = $comment[$account_name]['username'];
		if ($comment[$account_name]['confirmed']) {
			$posted_by = '' . $posted_by . '';
		}
	}
?>
	<div id="comment_<?php echo $comment['id'] ?>">
		<img src="<?php echo BackendAccount::getGravatar($comment[$account_name]['email'], 30) ?>" style="float: left; margin-right: 5px;" width="30px" height="30px">

			posted by <?php echo $posted_by ?> <span title="<?php echo $comment['added'] ?>"><?php echo time_elapsed($comment['added']) ?>

			<?php echo $comment['content'] ?>

<?php endif; ?>

Add a comment id to template

Add a comment id to template


<?php

namespace Weak;

use Exception;

class NotifierException extends Exception
{
    private $exceptions = [];

    /**
     * Get exceptions thrown from notifiers
     *
     * @return array
     */
    public function getExceptions() : array
    {
        return $this->exceptions;
    }
}

<?php

/*
 * This file is part of the pinepain/php-weak PHP extension.
 *
 * Copyright (c) 2016 Bogdan Padalko <zaq178miami@gmail.com>
 *
 * Licensed under the MIT license: http://opensource.org/licenses/MIT
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code or visit http://opensource.org/licenses/MIT
 */

namespace Weak;

use Exception;

class NotifierException extends Exception
{
    private $exceptions = [];

    /**
     * Get exceptions thrown from notifiers
     *
     * @return array
     */
    public function getExceptions() : array
    {
        return $this->exceptions;
    }
}

Add missed license note to stubs

Add missed license note to stubs [skip ci]


<?php

namespace Tests\Concerns;

use PHPUnit\Framework\Assert;

class ArtisanResult
{
    private $output;
    private $status;
    private $parameters;

    public function __construct($parameters, $output, $status)
    {
        $this->output = $output;
        $this->status = $status;
        $this->parameters = $parameters;
    }

    public function assertStatus($expected)
    {
        Assert::assertEquals($expected, $this->status);
    }

    public function assertStepOutput($expectedLines)
    {
        foreach ($this->stepLines() as $index => $actualLine) {
            Assert::assertEquals($expectedLines[$index], $actualLine);
        }
    }

    public function dump()
    {
        return tap($this, function () {
            dump("Status: {$this->status}");
            dump("Output:\n{$this->output}");
        });
    }

    public function dumpIfFailed()
    {
        return $this->status === 0 ? $this : $this->dump();
    }

    private function stepLines()
    {
        foreach (explode("\n", $this->output) as $index => $actualLine) {
            if ($actualLine === "" || substr($actualLine, 0, 7) === "PHPUnit") {
                break;
            }

            yield $index => $actualLine;
        }
    }
}

<?php

namespace Tests\Concerns;

use PHPUnit\Framework\Assert;

class ArtisanResult
{
    private $output;
    private $status;
    private $parameters;

    public function __construct($parameters, $output, $status)
    {
        $this->output = $output;
        $this->status = $status;
        $this->parameters = $parameters;
    }

    public function assertStatus($expected)
    {
        Assert::assertEquals($expected, $this->status);
    }

    public function assertStepOutput($expectedLines)
    {
        foreach ($this->stepLines() as $index => $actualLine) {
            Assert::assertEquals($expectedLines[$index], $actualLine);
        }
    }

    public function dump()
    {
        return tap($this, function () {
            dump("Status: {$this->status}");
            dump("Output:\n{$this->output}");
        });
    }

    public function dumpIfFailed()
    {
        return $this->status === 0 ? $this : $this->dump();
    }

    private function stepLines()
    {
        foreach (explode("\n", $this->output) as $index => $actualLine) {
            if (substr($actualLine, 0, 1) !== "[") {
                break;
            }

            yield $index => $actualLine;
        }
    }
}

Fix problem with detecting step lines with failed steps


<?php

namespace ATP\Reducer;

class Concatenate
{
	private $_sep = "";

	public function __construct($sep = "")
	{
		$this->_sep = $sep;
	}

	public function __invoke($reduced, $item)
	{
		return empty($reduced) ? $item : $reduced . $this->_sep . $item;
	}
}

<?php

namespace ATP\Reducer;

class Concatenate
{
	private $_sep = "";

	public function __construct($sep = "")
	{
		$this->_sep = $sep;
	}

	public function __invoke($reduced, $item)
	{
		return ($reduced === "" || is_null($reduced)) ? $item : $reduced . $this->_sep . $item;
	}
}

Fix bug where string containing only a zero weren't concatenating correctly


<?php
$filename = 'gitstatus.log';
$file = fopen($filename, 'r+b');
if ( fread($file, filesize($filename)) === 'NewCommit' )
{
        ftruncate($file, 0);
        exec('git pull --quiet && make NIGHTLY_OUTPUT=latest nightly >> /dev/null 2>&1');
		exec('./refreshCDN');
}

<?php
$filename = 'gitstatus.log';
$file = fopen($filename, 'r+b');
if ( fread($file, filesize($filename)) === 'NewCommit' )
{
        ftruncate($file, 0);
        exec('git pull --quiet && make NIGHTLY_OUTPUT=latest nightly >> /dev/null 2>&1');
		exec('./refreshCDN >> /dev/null 2>&1');
}

Update the CDN but dont output messages

Update the CDN but dont output messages


<?php

use GeneaLabs\LaravelCaffeine\Http\Controllers\LaravelCaffeineController;

Route::group(['middleware' => ['web']], function () {
    Route::get('genealabs/laravel-caffeine/drip', LaravelCaffeineController::class . '@drip');
});

<?php

use GeneaLabs\LaravelCaffeine\Http\Controllers\LaravelCaffeineController;

if (isset(Route::getMiddleware()['web'])) {
    Route::group(['middleware' => ['web']], function () {
        Route::get('genealabs/laravel-caffeine/drip', LaravelCaffeineController::class . '@drip');
    });
} else {
    Route::get('genealabs/laravel-caffeine/drip', LaravelCaffeineController::class . '@drip');
}

Check if web middleware is being used

Check if web middleware is being used


<?php
namespace Icecave\Dialekt\AST;

/**
 * An AST node that represents an empty expression.
 */
class EmptyExpression extends AbstractExpression
    /**
     * Pass this node to the appropriate method on the given visitor.
     *
     * @param VisitorInterface $visitor The visitor to dispatch to.
     *
     * @return mixed The visitation result.
     */
    public function accept(VisitorInterface $visitor)
    {
        return $visitor->visitEmptyExpression($this);
    }
}

<?php
namespace Icecave\Dialekt\AST;

/**
 * An AST node that represents an empty expression.
 */
class EmptyExpression extends AbstractExpression
{
    /**
     * Pass this node to the appropriate method on the given visitor.
     *
     * @param VisitorInterface $visitor The visitor to dispatch to.
     *
     * @return mixed The visitation result.
     */
    public function accept(VisitorInterface $visitor)
    {
        return $visitor->visitEmptyExpression($this);
    }
}

Remove implements ExpressionInterface (fix error)


<?php
/**
 * Created by PhpStorm.
 * User: Marco Bunge
 * Date: 26.11.2015
 * Time: 15:40
 */

namespace Blast\Db\Orm;

use Blast\Db\Entity\CollectionInterface;
use Blast\Db\Entity\EntityInterface;
use Blast\Db\Factory;
use Doctrine\DBAL\Query\QueryBuilder;

interface MapperInterface
{
    /**
     * @return \Doctrine\DBAL\Connection
     */
    public function getConnection();

    /**
     * @return Factory
     */
    public function getFactory();

    /**
     * @return EntityInterface
     */
    public function getEntity();

    /**
     * @return QueryBuilder
     */
    public function createQuery();

    /**
     *
     * @param $value
     * @return CollectionInterface|EntityInterface|Query
     */
    public function find($value);

    /**
     * @param CollectionInterface|EntityInterface|array $entity
     * @return int
     */
    public function create($entity);

    /**
     * @param CollectionInterface|EntityInterface|array $entity
     * @return int
     */
    public function update($entity);

    /**
     * @param CollectionInterface|EntityInterface|array $entity
     * @return int
     */
    public function delete($entity);

    /**
     * @param CollectionInterface|EntityInterface|array $entity
     * @return int
     */
    public function save($entity);

}

<?php
/**
 * Created by PhpStorm.
 * User: Marco Bunge
 * Date: 26.11.2015
 * Time: 15:40
 */

namespace Blast\Db\Orm;

use Blast\Db\Entity\CollectionInterface;
use Blast\Db\Entity\EntityInterface;
use Blast\Db\Factory;
use Blast\Db\Query;
use Doctrine\DBAL\Query\QueryBuilder;

interface MapperInterface
{
    /**
     * @return \Doctrine\DBAL\Connection
     */
    public function getConnection();

    /**
     * @return Factory
     */
    public function getFactory();

    /**
     * @return EntityInterface
     */
    public function getEntity();

    /**
     * @return QueryBuilder
     */
    public function createQuery();

    /**
     *
     * @param $value
     * @return EntityInterface
     */
    public function find($value);

    /**
     * Get a collection of all entities
     *
     * @return array|CollectionInterface
     */
    public function all();

    /**
     * Get a statement and build a query. Table is already selected
     * @param array $selects
     * @return Query
     */
    public function select($selects = ['*']);

    /**
     * @param CollectionInterface|EntityInterface|array $entity
     * @return int
     */
    public function create($entity);

    /**
     * @param CollectionInterface|EntityInterface|array $entity
     * @return int
     */
    public function update($entity);

    /**
     * @param CollectionInterface|EntityInterface|array $entity
     * @return int
     */
    public function delete($entity);

    /**
     * @param CollectionInterface|EntityInterface|array $entity
     * @return int
     */
    public function save($entity);

}

Add select and all to mapper interface

Add select and all to mapper interface


<?php

/**
 * VisualEditor
 */
require_once "/usr/src/mediawiki/extensions/VisualEditor/VisualEditor.php";
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgHiddenPrefs[] = 'visualeditor-enable';
#$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;
$wgVirtualRestConfig['modules']['restbase'] = array(
	'url' => 'http://localhost:7231',
	'domain' => 'localhost',
	'forwardCookies' => true,
	'parsoidCompat' => false
);

/**
 * Math
 */
$wgDefaultUserOptions['math'] = 'mathml';
$wgMathFullRestbaseURL = 'http://localhost:7231/localhost/';
wfLoadExtension( 'Math' );

?>

<?php

/**
 * VisualEditor
 */
require_once "/usr/src/mediawiki/extensions/VisualEditor/VisualEditor.php";
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgHiddenPrefs[] = 'visualeditor-enable';
#$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;
$wgVirtualRestConfig['modules']['parsoid'] = array(
	// URL to the Parsoid instance
	// Use port 8142 if you use the Debian package
	'url' => 'http://mediawiki-node-services.docker:8142',
	// Parsoid "domain", see below (optional)
	'domain' => 'localhost',
	// Parsoid "prefix", see below (optional)
	'prefix' => 'localhost'
);

Reset on-disk config to old master state

The Kubernetes setup does not use this on-disk config file any more, so
there is no reason to update it any more. This is also the only
difference from master, so resetting this to the state expected by
master lets us merge the k8s branch to master without breaking existing
users.


<?php

namespace RIPS\Connector\Requests;

class UserRequests extends BaseRequest
{
    // @var string
    protected $uri = '/users';

    /**
     * Get all users
     *
     * @return array
     */
    public function getAll()
    {
        $response = $this->client->get($this->uri);

        return $this->handleResponse($response);
    }

    /**
     * Get a user by user ID
     *
     * @param int $userId
     * @return array
     */
    public function getById(int $userId)
    {
        $response = $this->client->get("{$this->uri}/{$userId}");

        return $this->handleResponse($response);
    }

    /**
     * Invite a new user
     *
     * @param array $input
     * @return array
     */
    public function invite(array $input)
    {
        $response = $this->client->post("{$this->uri}/invite/ui", [
            'form_params' => ['user' => $input],
        ]);

        return $this->handleResponse($response);
    }
}

<?php

namespace RIPS\Connector\Requests;

class UserRequests extends BaseRequest
{
    // @var string
    protected $uri = '/users';

    /**
     * Get all users
     *
     * @param array $queryParams
     * @return array
     */
    public function getAll(array $queryParams)
    {
        $response = $this->client->get($this->uri, [
            'query' => $queryParams,
        ]);

        return $this->handleResponse($response);
    }

    /**
     * Get a user by user ID
     *
     * @param int $userId
     * @return array
     */
    public function getById(int $userId)
    {
        $response = $this->client->get("{$this->uri}/{$userId}");

        return $this->handleResponse($response);
    }

    /**
     * Invite a new user
     *
     * @param array $input
     * @return array
     */
    public function invite(array $input)
    {
        $response = $this->client->post("{$this->uri}/invite/ui", [
            'form_params' => ['user' => $input],
        ]);

        return $this->handleResponse($response);
    }
}

Add query param support for getAll users request


<?php
 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

$suitecrm_version      = '7.2.3';
$suitecrm_timestamp    = '2015-08-06 17:00pm';

<?php
 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

$suitecrm_version      = '7.2.4';
$suitecrm_timestamp    = '2015-08-20 17:00pm';

Update SuiteCRM Version to SuiteCRM 7.2.4.


<?php
class Kwf_Component_Plugin_Login_Component extends Kwf_Component_Plugin_LoginAbstract_Component
{
    public static function getSettings()
    {
        $ret = parent::getSettings();
        $ret['generators']['loginForm']['component'] = 'Kwc_User_Login_Component';
        $ret['validUserRoles'] = null;
        return $ret;
    }

    public function isLoggedIn()
    {
        if (!Zend_Session::sessionExists() && !Kwf_Config::getValue('autologin')) return false;
        $user = Zend_Registry::get('userModel')->getAuthedUser();
        if (is_null($user)) return false;
        if (!$this->_getSetting('validUserRoles')) return true;
        if (in_array($user->role, $this->_getSetting('validUserRoles'))) {
            return true;
        }
        return false;
    }

    public function skipProcessInput()
    {
        return false;
    }
}

<?php
class Kwf_Component_Plugin_Login_Component extends Kwf_Component_Plugin_LoginAbstract_Component
{
    public static function getSettings()
    {
        $ret = parent::getSettings();
        $ret['generators']['loginForm']['component'] = 'Kwc_User_Login_Component';
        $ret['validUserRoles'] = null;
        return $ret;
    }

    public function isLoggedIn()
    {
        if (Kwf_Setup::hasAuthedUser()) {
            if (!$this->_getSetting('validUserRoles')) return true;
            $user = Zend_Registry::get('userModel')->getAuthedUser();
            if (in_array($user->role, $this->_getSetting('validUserRoles'))) {
                return true;
            }
        }
        return false;
    }

    public function skipProcessInput()
    {
        return false;
    }
}

Remove last direct call of Zend_Session::sessionExists