#!/usr/bin/env php
<?php
chdir(__DIR__);

$returnStatus = null;
passthru('composer install --dev --no-interaction --prefer-source', $returnStatus);
if ($returnStatus !== 0) {
    exit(1);
}

passthru('./vendor/bin/phpcs --standard=' . __DIR__ . '/DWS --extensions=php -n tests DWS *.php', $returnStatus);
if ($returnStatus !== 0) {
    exit(1);
}

passthru('./vendor/bin/phpunit --coverage-clover clover.xml tests/DWS', $returnStatus);
if ($returnStatus !== 0) {
    exit(1);
}

$xml = new SimpleXMLElement(file_get_contents('clover.xml'));
foreach ($xml->xpath('//file/metrics') as $metric) {
    if ((int)$metric['elements'] !== (int)$metric['coveredelements']) {
        file_put_contents('php://stderr', "Code coverage was NOT 100%\n");
        exit(1);
    }
}

echo "Code coverage was 100%\n";

#!/usr/bin/env php
<?php
chdir(__DIR__);

$returnStatus = null;
passthru('composer install --dev', $returnStatus);
if ($returnStatus !== 0) {
    exit(1);
}

passthru('./vendor/bin/phpcs --standard=' . __DIR__ . '/DWS --extensions=php -n tests DWS *.php', $returnStatus);
if ($returnStatus !== 0) {
    exit(1);
}

passthru('./vendor/bin/phpunit --coverage-clover clover.xml tests/DWS', $returnStatus);
if ($returnStatus !== 0) {
    exit(1);
}

$xml = new SimpleXMLElement(file_get_contents('clover.xml'));
foreach ($xml->xpath('//file/metrics') as $metric) {
    if ((int)$metric['elements'] !== (int)$metric['coveredelements']) {
        file_put_contents('php://stderr', "Code coverage was NOT 100%\n");
        exit(1);
    }
}

echo "Code coverage was 100%\n";

Remove unnecessary arguments to composer install.

We don't set these elsewhere and don't need to set them here.


<?php

require_once("iCalendar.php");

  header("Content-type: text/plain");

  $sql = "SELECT caldav_data.caldav_type AS type, calendar_item.uid, calendar_item.rrule ";
  $sql .= ", to_char(dtstart at time zone 'UTC',".iCalendar::SqlUTCFormat().") AS dtstart ";
  $sql .= ", to_char(dtend at time zone 'UTC',".iCalendar::SqlUTCFormat().") AS dtend ";
  $sql .= ", to_char(due at time zone 'UTC',".iCalendar::SqlUTCFormat().") AS due ";
  $sql .= ", to_char(dtstamp,".iCalendar::SqlUTCFormat().")  AS dtstamp ";
  $sql .= ", to_char(last_modified,".iCalendar::SqlUTCFormat().")  AS \"last-modified\" ";
  $sql .= " FROM caldav_data INNER JOIN calendar_item USING(user_no, dav_name)";
  $sql .= " WHERE caldav_data.dav_name ~ ".qpg("^".$request_path)." ";
  $qry = new PgQuery( $sql );

  echo iCalendar::iCalHeader();

  $freebusy_properties = array( "uid", "dtstamp", "dtstart", "duration", "last-modified", "rrule" );

  if ( $qry->Exec("freebusy",__LINE__,__FILE__) && $qry->rows > 0 ) {
    while( $calendar_item = $qry->Fetch() ) {
      $event = new iCalendar( $calendar_item );
      echo $event->Render( false, 'VFREEBUSY', $freebusy_properties );
    }
  }
  echo iCalendar::iCalFooter();
?>

<?php
require_once("iCalendar.php");

  $sql = 'SELECT caldav_data.caldav_type AS type, calendar_item.uid, calendar_item.rrule ';
  $sql .= ', to_ical_utc(dtstart)  AS dtstart ';
  $sql .= ', to_ical_utc(dtend)    AS dtend ';
  $sql .= ', to_ical_utc(due)      AS due ';
  $sql .= ', to_ical_utc(dtstamp)  AS dtstamp ';
  $sql .= ', to_ical_utc(last_modified)  AS "last-modified" ';
  $sql .= ' FROM caldav_data INNER JOIN calendar_item USING(user_no, dav_name) ';
  $sql .= ' WHERE caldav_data.dav_name ~ '.qpg("^".$request_path);
  $qry = new PgQuery( $sql );

  header("Content-type: text/calendar");

  echo iCalendar::iCalHeader();

  $freebusy_properties = array( "uid", "dtstamp", "dtstart", "duration", "last-modified", "rrule" );

  if ( $qry->Exec("freebusy",__LINE__,__FILE__) && $qry->rows > 0 ) {
    while( $calendar_item = $qry->Fetch() ) {
      $event = new iCalendar( $calendar_item );
      echo $event->Render( false, 'VFREEBUSY', $freebusy_properties );
    }
  }
  echo iCalendar::iCalFooter();

?>

Switch to use new function for date presentation.


<?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 = 'c.woodside@thedifferenceengine.io'; // 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: c.woodside@thedifferenceengine.io\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 = 'c.woodside@thedifferenceengine.io'; // 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@thedifferenceengine.io\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;
?>

Change from email address in Contact

Change from email address in Contact


    <input type="text" id="name"
                class="form-control input-lg"
                name="name"
                placeholder="Enter Page Title"
                value="{{ old('name', $page->name) }}">

                Link:

            {{ url() }}/

        <input type="text" class="form-control" name="slug" value="{{ old('slug', $page->slug) }}" readonly>

                Edit

        @if ($page->link && !$page->trashed())

            link) }}" class="btn btn-default btn-flat">
                View Page

        @endif

    <input type="text" id="name"
                class="form-control input-lg"
                name="name"
                placeholder="Enter Page Title"
                value="{{ old('name', $page->name) }}">

                Link:

            {{ url() }}/

        <input type="text" class="form-control" name="slug" value="{{ old('slug', $page->slug) }}" id="slug-modify-field" readonly>

                Edit

        @if ($page->link && !$page->trashed())

            link) }}" class="btn btn-default btn-flat">
                View Page

        @endif

@section('enqueued-js')

@append

Allow Edit and Set of Slug Field

Allow Edit and Set of Slug Field


<?php
/**
 *
 * This file is part of Relay for PHP.
 *
 * @license http://opensource.org/licenses/MIT MIT
 *
 * @copyright 2015-2018, Paul M. Jones
 *
 */
namespace Relay;

use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\MiddlewareInterface;

/**
 *
 * A PSR-15 request handler.
 *
 * @package relay/relay
 *
 */
class Runner extends RequestHandler
{
    /**
     * @inheritdoc
     */
    public function handle(ServerRequestInterface $request) : ResponseInterface
    {
        $entry = current($this->queue);
        $middleware = call_user_func($this->resolver, $entry);
        next($this->queue);

        if ($middleware instanceof MiddlewareInterface) {
            return $middleware->process($request, $this);
        }

        return $middleware($request, $this);
    }
}

<?php
/**
 *
 * This file is part of Relay for PHP.
 *
 * @license http://opensource.org/licenses/MIT MIT
 *
 * @copyright 2015-2018, Paul M. Jones
 *
 */
namespace Relay;

use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;

/**
 *
 * A PSR-15 request handler.
 *
 * @package relay/relay
 *
 */
class Runner extends RequestHandler
{
    /**
     * @inheritdoc
     */
    public function handle(ServerRequestInterface $request) : ResponseInterface
    {
        $entry = current($this->queue);
        $middleware = call_user_func($this->resolver, $entry);
        next($this->queue);

        if ($middleware instanceof MiddlewareInterface) {
            return $middleware->process($request, $this);
        }

        if ($middleware instanceof RequestHandlerInterface) {
            return $middleware->handle($request);
        }

        return $middleware($request, $this);
    }
}

Support for PSR-15 RequestHandlerInterface for queue items

Problem/details/solution noted here:
https://github.com/relayphp/Relay.Relay/issues/47


<?php
namespace Craft;

class Wistia_CacheRecord extends BaseRecord
{
	public function getTableName()
	{
		return 'wistia_cache';
	}

	protected function defineAttributes()
	{
		return array(
			'id' => array(
				AttributeType::Number,
				'column' => ColumnType::PK
			),
			'hashedId' => AttributeType::String,
			'type' => array(
				AttributeType::Enum,
				'values' => 'data, stats'
			),
			'data' => array(
				AttributeType::String,
				'column' => ColumnType::Text
			)
		);
	}

	public function defineIndexes()
	{
		return array(
			array(
				'columns' => 'hashedId'
			),
			array(
				'columns' => 'type'
			)
		);
	}
}

<?php
namespace Craft;

class Wistia_CacheRecord extends BaseRecord
{
	public function getTableName()
	{
		return 'wistia_cache';
	}

	protected function defineAttributes()
	{
		return [
			'id' => [
				AttributeType::Number,
				'column' => ColumnType::PK
			],
			'hashedId' => AttributeType::String,
			'type' => [
				AttributeType::Enum,
				'values' => 'data, stats'
			],
			'data' => [
				AttributeType::String,
				'column' => ColumnType::Text
			]
		];
	}

	public function defineIndexes()
	{
		return [
			[
				'columns' => 'hashedId'
			],
			[
				'columns' => 'type'
			]
		];
	}
}

Use array shorthand for cache table

Use array shorthand for cache table


<?php

namespace AppBundle\Controller;

use AppBundle\AppBundle;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;

class APIController extends Controller
{
    /**
     * @param Request $request
     * @return \Symfony\Component\HttpFoundation\JsonResponse
     * @Route("/api/listing/overview", name="listing_overview")
     */
    public function overviewAction(Request $request)
    {
        $overview = $this->get('app.api.listing.overview');
        $db_version = $request->query->get('dbversion');
        $result = $overview->execute($db_version, $request->getSession());
        return $this->json($result);
    }
}

<?php

namespace AppBundle\Controller;

use AppBundle\AppBundle;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;

class APIController extends Controller
{
    /**
     * @param Request $request
     * @return \Symfony\Component\HttpFoundation\JsonResponse
     * @Route("/api/listing/overview", name="listing_overview")
     */
    public function overviewAction(Request $request)
    {
        $overview = $this->get('app.api.listing.overview');
        $db_version = $request->query->get('dbversion');
        $result = $overview->execute($db_version, $request->getSession());
        return $this->json($result);
    }

    /**
     * @Route("/api/listing/organism", name="organism_listing")
     */
    public function organismListingAction(){

    }

    /**
     * @Route("/api/result/organism", name="organism_result")
     */
    public function organismResultAction(){

    }
}

Add dummy routes for API calls from organism search


<?php

/**
 * Adds some image size functions to the Image DataObject.
 */
class Product_Image extends DataExtension {

	public function getThumbnail() {
		return $this->owner->SetSize(
			self::config()->thumbnail_width,
			self::config()->thumbnail_height
		);
	}

	public function getContentImage() {
		return $this->owner->SetWidth(
			self::config()->content_image_width
		);
	}

	public function getLargeImage() {
		return $this->owner->SetWidth(
			self::config()->large_image_width
		);
	}

	public static function config(){
		return new Config_ForClass("Product_Image");
	}

}

<?php

/**
 * Adds some image size functions to the Image DataObject.
 *
 * @package shop
 */
class Product_Image extends DataExtension {

	public function getThumbnail() {
		$width = self::config()->thumbnail_width;
		$height = self::config()->thumbnail_height;

		return $this->getImageAt($width, $height);
	}

	public function getContentImage() {
		$width = self::config()->content_image_width;
		$height = self::config()->content_image_height;

		return $this->getImageAt($width, $height);
	}

	public function getLargeImage() {
		$width = self::config()->large_image_width;
		$height = self::config()->large_image_height;

		return $this->getImageAt($width, $height);
	}

	public function getImageAt($width = null, $height = null) {
		if($width && $height) {
			return $this->owner->SetSize($width, $height);
		} else if($width) {
			return $this->owner->SetWidth($width);
		} else {
			return $this->owner->SetHeight($height);
		}
	}

	public static function config(){
		return new Config_ForClass("Product_Image");
	}

}

Allow setsize for product images

Allow setsize for product images


<?php

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

use Cvuorinen\Raspicam\Raspistill;

$camera = new Raspistill();

$filename = date('Y-m-d_H:i:s') . '.jpg';

try {
    $camera->takePicture($filename);

    echo 'Saved picture to ' . $filename . "\n";

} catch (\Exception $e) {
    echo 'ERROR: ' . $e->getMessage() . "\n";
}

<?php

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

use Cvuorinen\Raspicam\Raspistill;

$camera = new Raspistill();

$filename = date('Y-m-d_H:i:s') . '.jpg';

try {
    $camera->takePicture($filename);

    echo 'Saved picture to ' . $filename . "\n";

} catch (\Exception $e) {
    echo 'ERROR: ' . $e->getMessage() . "\n";
}

Fix require statement in example code

Fix require statement in example code


<?php
/**
 * Config.php
 *
 * Created by Keyur Ajmera.
 * User: Keyur Ajmera
 * Date: 10/12/2015
 * Time: 5:09 PM
 *
 * Read .config file and load all variables
 */

namespace Ajmerainfo;

class Config
{
    public function Test(){
        echo "Hello from first Package";
    }

    public function TestGet(){
        echo "Rut test 2 for test package";
    }
}

<?php
/**
 * Config.php
 *
 * Created by Keyur Ajmera.
 * User: Keyur Ajmera
 * Date: 10/12/2015
 * Time: 5:09 PM
 *
 * Read .config file and load all variables
 */

namespace Ajmerainfo;

class Config
{
    public function Test(){
        echo "Hello from first Package";
    }

    public function TestGet(){
        echo "Rut test 2 for test package";
    }

    public function TestThree(){
        echo "Rut test 3 for test package";
    }
}

Add new third function for test

Add new third function for test


@extends('settings/settings')

@section('settings_content')

Benutzer

@if (Auth::user()->isAdmin())

   Benutzer hinzufügen

@endif

                Benutzername
                Administrator
                Aktionen

            @foreach ($users as $u)

                    {!! link_to_route('settings.user/show', $u->username, array('user' => $u->username)) !!}

                    @if ($u->isAdmin())

                    @else
                    -
                    @endif

                    {!! link_to_route('settings.users/edit', 'bearbeiten',
                                array('username' => $u->username)) !!}
                    @if($u->username != Auth::user()->username)
                        | {!! link_to_route('settings.users/delete', 'löschen', array('user' => $u->username)) !!}
                    @endif

            @endforeach

@stop

@extends('settings/settings')

@section('settings_content')

Benutzer

@if (Auth::user()->isAdmin())

   Benutzer hinzufügen

@endif

                Benutzername
                Administrator
                Aktionen

            @foreach ($users as $u)

                    {!! link_to_route('settings.user/show', $u->username, array('user' => $u->username)) !!}

                    @if ($u->isAdmin())

                    @else
                    -
                    @endif

                    {!! link_to_route('settings.users/edit', 'bearbeiten',
                                array('user' => $u)) !!}
                    @if($u->username != Auth::user()->username)
                        | {!! link_to_route('settings.users/delete', 'löschen', array('user' => $u->username)) !!}
                    @endif

            @endforeach

@stop

Fix edit user route param

Fix edit user route param

Signed-off-by: Christoph Wurst <7abde52c298496fa169fb750f91f213a282142af@winzerhof-wurst.at>


<?php

declare(strict_types=1);

return [

    'already_authenticated' => 'You are already authenticated!',
    'import_complete' => 'Congrats! Import process completed.',
    'resource_saved' => 'Congrats! Requested :resource [:identifier] saved successfully.',
    'resource_deleted' => 'Done! Requested :resource [:identifier] deleted successfully.',
    'resource_not_found' => 'Sorry! Requested :resource [:identifier] not found!',
    'delete_confirmation_title' => 'Delete Confirmation',
    'delete_confirmation_body' => 'Are you sure you want to delete :resource [:identifier]?',
    'session_required' => 'You must login first!',
    'token_mismatch' => 'The page has expired due to inactivity. Please refresh and try again.',
    'invalid_phone' => 'Invalid phone number!',
    'invalid_indexing_rule' => 'An indexing rule needs to return a boolean or a string.',
    'no_records_selected' => 'No selected records!',
    'records_deleted' => 'Records deleted!',

];

<?php

declare(strict_types=1);

return [

    'already_authenticated' => 'You are already authenticated!',
    'import_complete' => 'Congrats! Import process completed.',
    'resource_saved' => 'Congrats! Requested :resource [:identifier] saved successfully.',
    'resource_deleted' => 'Done! Requested :resource [:identifier] deleted successfully.',
    'resource_not_found' => 'Sorry! Requested :resource [:identifier] not found!',
    'delete_confirmation_title' => 'Delete Confirmation',
    'delete_confirmation_body' => 'Are you sure you want to delete :resource [:identifier]?',
    'session_required' => 'You must login first!',
    'token_mismatch' => 'The page has expired due to inactivity. Please refresh and try again.',
    'invalid_phone' => 'Invalid phone number!',
    'invalid_indexing_rule' => 'An indexing rule needs to return a boolean or a string.',
    'no_records_selected' => 'No selected records!',
    'records_deleted' => 'Records deleted!',
    'records_activated' => 'Records activated!',
    'records_deactivated' => 'Records deactivated!',

];

Add missing phrases for datatables bulk actions


<?php
/**
 * @package api
 * @subpackage objects
 */
class KalturaConversionProfileAssetParams extends KalturaObject implements IFilterable
{
	/**
	 * The id of the conversion profile
	 *
	 * @var int
	 * @readonly
	 * @filter eq,in
	 */
	public $conversionProfileId;

	/**
	 * The id of the asset params
	 *
	 * @var int
	 * @readonly
	 * @filter eq,in
	 */
	public $assetParamsId;

	/**
	 * @var int
	 * @readonly
	 */
	public $partnerId;

	/**
	 * The ingestion origin of the asset params
	 *
	 * @var KalturaFlavorReadyBehaviorType
	 * @filter eq,in
	 */
	public $readyBehavior;

	/**
	 * The ingestion origin of the asset params
	 *
	 * @var KalturaAssetParamsOrigin
	 * @filter eq,in
	 */
	public $origin;

	private static $map_between_objects = array
	(
		'conversionProfileId',
		'assetParamsId',
		'partnerId',
		'readyBehavior',
		'origin',
	);

	public function getMapBetweenObjects ( )
	{
		return array_merge ( parent::getMapBetweenObjects() , self::$map_between_objects );
	}

	public function getExtraFilters()
	{
		return array();
	}

	public function getFilterDocs()
	{
		return array();
	}
}

<?php
/**
 * @package api
 * @subpackage objects
 */
class KalturaConversionProfileAssetParams extends KalturaObject implements IFilterable
{
	/**
	 * The id of the conversion profile
	 *
	 * @var int
	 * @readonly
	 * @filter eq,in
	 */
	public $conversionProfileId;

	/**
	 * The id of the asset params
	 *
	 * @var int
	 * @readonly
	 * @filter eq,in
	 */
	public $assetParamsId;

	/**
	 * The ingestion origin of the asset params
	 *
	 * @var KalturaFlavorReadyBehaviorType
	 * @filter eq,in
	 */
	public $readyBehavior;

	/**
	 * The ingestion origin of the asset params
	 *
	 * @var KalturaAssetParamsOrigin
	 * @filter eq,in
	 */
	public $origin;

	private static $map_between_objects = array
	(
		'conversionProfileId',
		'assetParamsId' => 'flavorParamsId',
		'readyBehavior',
		'origin',
	);

	public function getMapBetweenObjects ( )
	{
		return array_merge ( parent::getMapBetweenObjects() , self::$map_between_objects );
	}

	public function getExtraFilters()
	{
		return array();
	}

	public function getFilterDocs()
	{
		return array();
	}
}

Support conversion profile flavor params control

git-svn-id: 8a2ccb88241e16c78017770bc38d91d6d5396a5a@59577 6b8eccd3-e8c5-4e7d-8186-e12b5326b719


<?php
  $defaults = array(
    'preview' => false,
    'testimonials' => false
  );

  $settings = array();

  foreach ($_REQUEST as $key => $value) {
    $settings[$key] = ($value === 'true');
  }

  $config = array_merge($defaults, $settings);

<?php
  $defaults = array(
    'preview' => false,
    'testimonials' => true
  );

  $settings = array();

  foreach ($_REQUEST as $key => $value) {
    $settings[$key] = ($value === 'true');
  }

  $config = array_merge($defaults, $settings);

Use testimonials on home page

Use testimonials on home page


<?php

namespace Oro\Bundle\CurrencyBundle\Provider;

interface CurrencyProviderInterface
{
    /**
     * Returns list of unique currency codes
     *
     * @return string[] list of currencies ISO codes
     */
    public function getCurrencyList();
}

<?php

namespace Oro\Bundle\CurrencyBundle\Provider;

interface CurrencyProviderInterface
{
    /**
     * Returns list of currencies which available in system
     *
     * @return string[] list of currencies ISO codes
     */
    public function getCurrencyList();
}

OEE-1164: Add multi-curency validator to available currency form
- Revert changes


<?php

namespace Retrinko\CottonTail\Message\Payloads;

use Retrinko\CottonTail\Exceptions\PayloadException;

class RpcRequestPayload extends DefaultPayload
{
    const KEY_PARAMS    = 'params';
    const KEY_PROCEDURE = 'procedure';

    /**
     * @var array
     */
    protected $requiredFields = [self::KEY_PROCEDURE, self::KEY_PARAMS];

    /**
     * @param string $procedure
     * @param array $params
     *
     * @return RpcRequestPayload
     * @throws PayloadException
     */
    public static function create($procedure, $params = [])
    {
        if (empty($procedure))
        {
            throw PayloadException::emptyProcedute();
        }
        $data = [self::KEY_PROCEDURE => $procedure,
                 self::KEY_PARAMS => $params];

        return new self($data);
    }

    /**
     * @return array
     */
    public function getParams()
    {
        return $this->data[self::KEY_PARAMS];
    }

    /**
     * @return string
     */
    public function getProcedure()
    {
        return $this->data[self::KEY_PROCEDURE];
    }

}

<?php

namespace Retrinko\CottonTail\Message\Payloads;

use Retrinko\CottonTail\Exceptions\PayloadException;

class RpcRequestPayload extends DefaultPayload
{
    const KEY_PARAMS    = 'params';
    const KEY_PROCEDURE = 'procedure';

    /**
     * @var array
     */
    protected $requiredFields = [self::KEY_PROCEDURE, self::KEY_PARAMS];

    /**
     * @param string $procedure
     * @param array $params
     *
     * @return RpcRequestPayload
     * @throws PayloadException
     */
    public static function create($procedure, $params = [])
    {
        if (empty($procedure))
        {
            throw PayloadException::emptyProcedure();
        }
        $data = [self::KEY_PROCEDURE => $procedure,
                 self::KEY_PARAMS => $params];

        return new self($data);
    }

    /**
     * @return array
     */
    public function getParams()
    {
        return $this->data[self::KEY_PARAMS];
    }

    /**
     * @return string
     */
    public function getProcedure()
    {
        return $this->data[self::KEY_PROCEDURE];
    }

}

Fix type: emptyProcedute -> emptyProcedure


<?php

namespace ElasticSearcher\Traits;

use ArrayHelpers\Arr;

/**
 * A body can be an entire query or just a chunk of query (fragment).
 * Any entity (query, fragment, index, ...) that builds request body's should
 * use this trait.
 *
 * @package ElasticSearcher\Traits
 */
trait BodyTrait
{
	/**
	 * Body of the query to execute.
	 *
	 * @var array
	 */
	public $body = [];

	/**
	 * @param array $body
	 */
	public function setBody(array $body)
	{
		$this->body = $body;
	}

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

	/**
	 * Set a value in the body using the dotted notation.
	 *
	 * @param string $key
	 * @param mixed $value
	 *
	 * @return $this
	 */
	public function set($key, $value)
	{
		Arr::set($this->body, $key, $value);

		return $this;
	}

	/**
	 * Get a value in the body using the dotted notation.
	 *
	 * @param string $key
	 * @param mixed $default
	 *
	 * @return $this
	 */
	public function get($key, $default = null)
	{
		return Arr::get($this->body, $key, $default);
	}
}

<?php

namespace ElasticSearcher\Traits;

use ArrayHelpers\Arr;

/**
 * A body can be an entire query or just a chunk of query (fragment).
 * Any entity (query, fragment, index, ...) that builds request body's should
 * use this trait.
 *
 * @package ElasticSearcher\Traits
 */
trait BodyTrait
{
	/**
	 * Body of the query to execute.
	 *
	 * @var array
	 */
	public $body = [];

	/**
	 * @param array $body
	 */
	public function setBody(array $body)
	{
		$this->body = $body;
	}

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

	/**
	 * Set a value in the body using the dotted notation.
	 *
	 * @param string $key
	 * @param mixed $value
	 *
	 * @return $this
	 */
	public function set($key, $value)
	{
		Arr::set($this->body, $key, $value);

		return $this;
	}

	/**
	 * Get a value in the body using the dotted notation.
	 *
	 * @param string $key
	 * @param mixed $default
	 *
	 * @return $this
	 */
	public function get($key, $default = null)
	{
		return Arr::get($this->getBody(), $key, $default);
	}
}

Use getBody() method instead of body property directly


<?php if ( !defined( 'HABARI_PATH' ) ) { die('No direct access'); } ?>

<div id="page-selector">
	<?php echo $theme->prev_page_link(); ?> <?php echo $theme->page_selector( null, array( 'leftSide' => 2, 'rightSide' => 2, 'hideIfSinglePage' => true ) ); ?> <?php echo $theme->next_page_link(); ?>
</div>

<?php if ( !defined( 'HABARI_PATH' ) ) { die('No direct access'); } ?>

<div id="page-selector" class="span-17 last">
	<?php echo $theme->prev_page_link(); ?> <?php echo $theme->page_selector( null, array( 'leftSide' => 2, 'rightSide' => 2, 'hideIfSinglePage' => true ) ); ?> <?php echo $theme->next_page_link(); ?>
</div>

Make the page navigation fit the entire width of the content box so it doesn't try to float up beside something else.


<form name="loginform" action="<?php echo wp_login_url($_SERVER['REQUEST_URI']);?>" method="post">
	<input type="hidden" name="redirect_to" value="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" />
	<input type="hidden" name="user-cookie" value="1" />

	<input type="text" name="log" placeholder="E-postadress eller nick"
		<?php if(isset($_POST['user_email'])) echo 'value="'. $_POST['user_email'] .'" autofocus' ?>
		 />

	<input type="password" name="pwd" placeholder="Lösenord" />

		<input type="checkbox" id="rememberme" name="rememberme" value="forever" checked="checked" />
		Håll mig inloggad

		<input type="submit" name="submit" class="small" value="Logga in" />

</form>

<form name="loginform" action="<?php echo wp_login_url($_SERVER['REQUEST_URI']);?>" method="post">
	<input type="hidden" name="redirect_to" value="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" />
	<input type="hidden" name="user-cookie" value="1" />

	<input type="text" name="log" placeholder="CID eller e-postadress"
		<?php if(isset($_POST['user_email'])) echo 'value="'. $_POST['user_email'] .'" autofocus' ?>
		 />

	<input type="password" name="pwd" placeholder="Lösenord" />

		<input type="checkbox" id="rememberme" name="rememberme" value="forever" checked="checked" />
		Håll mig inloggad

		<input type="submit" name="submit" class="small" value="Logga in" />

</form>

Change placeholder text in sign in form

Change placeholder text in sign in form


<?php

/*
 * This file is part of Twig.
 *
 * (c) Fabien Potencier
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Twig;

/**
 * Marks a content as safe.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class Markup implements \Countable, \JsonSerializable
{
    private $content;
    private $charset;

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

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

    /**
     * @return int
     */
    public function count()
    {
        return mb_strlen($this->content, $this->charset);
    }

    public function jsonSerialize()
    {
        return $this->content;
    }
}

class_alias('Twig\Markup', 'Twig_Markup');

<?php

/*
 * This file is part of Twig.
 *
 * (c) Fabien Potencier
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Twig;

/**
 * Marks a content as safe.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class Markup implements \Countable, \JsonSerializable
{
    private $content;
    private $charset;

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

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

    /**
     * @return int
     */
    public function count()
    {
        return mb_strlen($this->content, $this->charset);
    }

    #[\ReturnTypeWillChange]
    public function jsonSerialize()
    {
        return $this->content;
    }
}

class_alias('Twig\Markup', 'Twig_Markup');

Add ReturnTypeWillChange to JsonSerializable implementation

Signed-off-by: Alexander M. Turek <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@derrabus.de>


<?php

class Eval_Command extends WP_CLI_Command {

	/**
	 * Execute arbitrary PHP code.
	 *
	 * ## OPTIONS
	 *
	 * <php-code>
	 * : The code to execute, as a string.
	 *
	 * [--skip-wordpress]
	 * : Execute code without loading WordPress.
	 *
	 * @when before_wp_load
	 *
	 * ## EXAMPLES
	 *
	 *     $ wp eval 'echo WP_CONTENT_DIR;'
	 *     /var/www/wordpress/wp-content
	 *
	 *     $ wp eval 'echo rand();' --skip-wordpress
	 *     479620423
	 */
	public function __invoke( $args, $assoc_args ) {

		if ( null === \WP_CLI\Utils\get_flag_value( $assoc_args, 'skip-wordpress' ) ) {
			WP_CLI::get_runner()->load_wordpress();
		}

		eval( $args[0] );
	}
}

WP_CLI::add_command( 'eval', 'Eval_Command' );

<?php

/**
 * Execute arbitrary PHP code.
 *
 * ## EXAMPLES
 *
 *     # Display WordPress content directory.
 *     $ wp eval 'echo WP_CONTENT_DIR;'
 *     /var/www/wordpress/wp-content
 *
 *     # Generate a random number.
 *     $ wp eval 'echo rand();' --skip-wordpress
 *     479620423
 */
class Eval_Command extends WP_CLI_Command {

	/**
	 * Execute arbitrary PHP code.
	 *
	 * ## OPTIONS
	 *
	 * <php-code>
	 * : The code to execute, as a string.
	 *
	 * [--skip-wordpress]
	 * : Execute code without loading WordPress.
	 *
	 * ## EXAMPLES
	 *
	 *     # Display WordPress content directory.
	 *     $ wp eval 'echo WP_CONTENT_DIR;'
	 *     /var/www/wordpress/wp-content
	 *
	 *     # Generate a random number.
	 *     $ wp eval 'echo rand();' --skip-wordpress
	 *     479620423
	 *
	 * @when before_wp_load
	 */
	public function __invoke( $args, $assoc_args ) {

		if ( null === \WP_CLI\Utils\get_flag_value( $assoc_args, 'skip-wordpress' ) ) {
			WP_CLI::get_runner()->load_wordpress();
		}

		eval( $args[0] );
	}
}

WP_CLI::add_command( 'eval', 'Eval_Command' );

Add example in Eval class

Add example in Eval class


<?

$_meta['hide_breadcrumb'] = true;

if( !$shutup ) :
?>

Home Page Content

<?

endif;

<?

$_meta['hide_breadcrumb'] = true;
$_meta['sitemap']         = false;

if( !$shutup ) :
?>

Home Page Content

<?

endif;

Clean up demo site map a little

Clean up demo site map a little


<?php

/**
 * Register routes for each available item types
 */
foreach ($app->getContainer()['item_types'] as $item_type) {
    $app->group('/' . $item_type, function () use ($item_type) {
        // List all items
        $this->get('', 'WalletLogger\\' . ucfirst($item_type) . 'Controller:listItems');

        // Get item's data
        $this->get('/{id:[0-9]+}', 'WalletLogger\\' . ucfirst($item_type) . 'Controller:getItem');

        // Create a new item
        $this->post('', 'WalletLogger\\' . ucfirst($item_type) . 'Controller:createItem');

        // Update an item
        $this->patch('/{id:[0-9]+}', 'WalletLogger\\' . ucfirst($item_type) . 'Controller:updateItem');

        // Delete an item
        $this->delete('/{id:[0-9]+}', 'WalletLogger\\' . ucfirst($item_type) . 'Controller:deleteItem');
    });
}

/**
 * Generic fallback route
 */
$app->any('[/{path:.*}]', function ($request, $response, $args) {
    return $response->withStatus(400)->withJson(['message' => 'Bad request']);
});

<?php

/**
 * Register routes for each available item types
 */
foreach ($app->getContainer()['item_types'] as $item_type) {
    $app->group('/' . $item_type, function () use ($item_type) {
        // List all items
        $this->get('', 'WalletLogger\\' . ucfirst($item_type) . 'Controller:listItems');

        // Get item's data
        $this->get('/{id:[0-9]+}', 'WalletLogger\\' . ucfirst($item_type) . 'Controller:getItem');

        // Create a new item
        $this->post('', 'WalletLogger\\' . ucfirst($item_type) . 'Controller:createItem');

        // Update an item
        // Should be more correct use PATCH verb but Slim seems to have problems with getParsedBody method :(
        $this->post('/{id:[0-9]+}', 'WalletLogger\\' . ucfirst($item_type) . 'Controller:updateItem');

        // Delete an item
        $this->delete('/{id:[0-9]+}', 'WalletLogger\\' . ucfirst($item_type) . 'Controller:deleteItem');
    });
}

/**
 * Generic fallback route
 */
$app->any('[/{path:.*}]', function ($request, $response, $args) {
    return $response->withStatus(400)->withJson([
        'status' => 400,
        'message' => 'Bad request',
    ]);
});

Change PATCH verb in POST, Slim seems to have problems using getParsedBody method :(


<?php namespace App\Providers;

use Permission;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;

class AuthServiceProvider extends ServiceProvider
{
	protected $policies = [
		'App\Data\Discussion' => 'App\Policies\DiscussionPolicy',
		'App\Data\Topic' => 'App\Policies\TopicPolicy',
	];

	public function boot()
	{
		$this->registerPolicies();

		// Grab all of the permissions, loop through them, and define the abilities
		$this->getPermissions()->each(function ($permission) {
			Gate::define($permission->name, function ($user) use ($permission) {
				return $user->hasRole($permission->roles->all());
			});
		});

		// Allow admins to do whatever they want
		Gate::before(function ($user) {
			if ($user->hasRole('Forums Administrator')) {
				return true;
			}
		});
	}

	protected function getPermissions()
	{
		return Permission::with('roles')->get();
	}
}

<?php namespace App\Providers;

use Permission;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;

class AuthServiceProvider extends ServiceProvider
{
	protected $policies = [
		'App\Data\Discussion' => 'App\Policies\DiscussionPolicy',
		'App\Data\Topic' => 'App\Policies\TopicPolicy',
	];

	public function boot()
	{
		$this->registerPolicies();

		// Grab all of the permissions, loop through them, and define the abilities
		$this->getPermissions()->each(function ($permission) {
			Gate::define($permission->name, function ($user) use ($permission) {
				return $user->hasRole($permission->roles->all());
			});
		});

		// Allow admins to do whatever they want
		Gate::before(function ($user) {
			if ($user->hasRole('Forum Administrator')) {
				return true;
			}
		});
	}

	protected function getPermissions()
	{
		return Permission::with('roles')->get();
	}
}

Update the admin role name

Update the admin role name


<?php

namespace ProcessWire\GraphQL\Field\Debug;

use Youshido\GraphQL\Field\AbstractField;
use Youshido\GraphQL\Type\Scalar\IntType;
use Youshido\GraphQL\Execution\ResolveInfo;

class DBQueryCountField extends AbstractField {

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

  public function getType()
  {
    return new IntType();
  }

  public function resolve($value, array $args, ResolveInfo $info)
  {
    return count(\ProcessWire\Database::getQueryLog());
  }

}

<?php

namespace ProcessWire\GraphQL\Field\Debug;

use Youshido\GraphQL\Field\AbstractField;
use Youshido\GraphQL\Type\NonNullType;
use Youshido\GraphQL\Type\Scalar\IntType;
use Youshido\GraphQL\Execution\ResolveInfo;

class DBQueryCountField extends AbstractField {

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

  public function getDescription()
  {
    return 'The total number of queries to database made to fulfill this request.';
  }

  public function getType()
  {
    return new NonNullType(new IntType());
  }

  public function resolve($value, array $args, ResolveInfo $info)
  {
    return count(\ProcessWire\Database::getQueryLog());
  }

}

Add descriptiotn to dbQueryCount & make it non-null.


<?php

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

namespace Sylius\Bundle\TaxonomiesBundle\Doctrine\ORM;

use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
use Sylius\Bundle\TaxonomiesBundle\Model\TaxonomyInterface;
use Sylius\Bundle\TaxonomiesBundle\Repository\TaxonRepositoryInterface;

/**
 * Base taxon repository.
 *
 * @author Saša Stamenković <umpirsky@gmail.com>
 */
class TaxonRepository extends EntityRepository implements TaxonRepositoryInterface
{
    public function getTaxonsAsList(TaxonomyInterface $taxonomy)
    {
        return $this->getQueryBuilder()
            ->where('o.taxonomy = :taxonomy')
            ->andWhere('o.parent IS NOT NULL')
            ->setParameter('taxonomy', $taxonomy)
            ->getQuery()
            ->getResult()
        ;
    }
}

<?php

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

namespace Sylius\Bundle\TaxonomiesBundle\Doctrine\ORM;

use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
use Sylius\Bundle\TaxonomiesBundle\Model\TaxonomyInterface;
use Sylius\Bundle\TaxonomiesBundle\Repository\TaxonRepositoryInterface;

/**
 * Base taxon repository.
 *
 * @author Saša Stamenković <umpirsky@gmail.com>
 */
class TaxonRepository extends EntityRepository implements TaxonRepositoryInterface
{
    public function getTaxonsAsList(TaxonomyInterface $taxonomy)
    {
        return $this->getQueryBuilder()
            ->where('o.taxonomy = :taxonomy')
            ->andWhere('o.parent IS NOT NULL')
            ->setParameter('taxonomy', $taxonomy)
            ->orderBy('o.left')
            ->getQuery()
            ->getResult()
        ;
    }
}

Order taxons with hierarchy in mind.

Order taxons with hierarchy in mind.


<?php
/**
 * AppShell file
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @since         CakePHP(tm) v 2.0
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */

App::uses('Shell', 'Console');

/**
 * Application Shell
 *
 * Add your application-wide methods in the class below, your shells
 * will inherit them.
 *
 * @package       app.Console.Command
 */
class AppShell extends Shell {
    protected function batchOperation($model, $operation, $options) {
        $batchSize = 1000;
        $proceeded = 0;
        $options = array_merge(
            array(
                'contain' => array(),
                'limit' => $batchSize,
                'offset' => 0,
            ),
            $options
        );

        do {
            $data = $this->{$model}->find('all', $options);
            $proceeded += $this->{$operation}($data, $model);
            echo ".";
            $options['offset'] += $batchSize;
        } while ($data);
        return $proceeded;
    }
}

<?php
/**
 * AppShell file
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @since         CakePHP(tm) v 2.0
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */

App::uses('Shell', 'Console');

/**
 * Application Shell
 *
 * Add your application-wide methods in the class below, your shells
 * will inherit them.
 *
 * @package       app.Console.Command
 */
class AppShell extends Shell {
    public $batchOperationSize = 1000;

    protected function batchOperation($model, $operation, $options) {
        $proceeded = 0;
        $options = array_merge(
            array(
                'contain' => array(),
                'limit' => $this->batchOperationSize,
                'offset' => 0,
            ),
            $options
        );

        do {
            $data = $this->{$model}->find('all', $options);
            $proceeded += $this->{$operation}($data, $model);
            echo ".";
            $options['offset'] += $this->batchOperationSize;
        } while ($data);
        return $proceeded;
    }
}

Allow to modify the size of batchOperation


<?php _e( 'WP Brightcove Shortcode Plugin', 'wp-brightcove-shortcode' ); ?>

				MAIN OPTIONS AWW YISS

					SIDEBAR AWW YISS

<?php _e( 'WP Brightcove Shortcode Plugin', 'wp-brightcove-shortcode' ); ?>

				MAIN OPTIONS AWW YISS
				<?php echo do_shortcode( '[brightcove id="3961559501001"]' ); ?>

					SIDEBAR AWW YISS

Add sample shortcode render to options page.


<?php
/**
 * @version     $Id: default.php 3314 2012-02-10 02:14:52Z johanjanssens $
 * @package     Nooku_Server
 * @subpackage  Settings
 * @copyright   Copyright (C) 2011 - 2012 Timble CVBA and Contributors. (http://www.timble.net).
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */

/**
 * Setting Controller Class
 *
 * @author      Johan Janssens <http://nooku.assembla.com/profile/johanjanssens>
 * @package     Nooku_Server
 * @subpackage  Settings
 */

class ComExtensionsControllerSetting extends ComDefaultControllerDefault
{
    protected function _initialize(KConfig $config)
    {
        $config->append(array(
            'request' => array('view' => 'settings')
        ));

        parent::_initialize($config);
    }

    protected function _actionRead(KCommandContext $context)
    {
        $name = ucfirst($this->getView()->getName());

        if(!$this->getModel()->getState()->isUnique()) {
            $context->setError(new KControllerException($name.' Not Found', KHttpResponse::NOT_FOUND));
        }

        return parent::_actionRead($context);
    }
}

<?php
/**
 * @version     $Id: default.php 3314 2012-02-10 02:14:52Z johanjanssens $
 * @package     Nooku_Server
 * @subpackage  Settings
 * @copyright   Copyright (C) 2011 - 2012 Timble CVBA and Contributors. (http://www.timble.net).
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */

/**
 * Setting Controller Class
 *
 * @author      Johan Janssens <http://nooku.assembla.com/profile/johanjanssens>
 * @package     Nooku_Server
 * @subpackage  Settings
 */

class ComExtensionsControllerSetting extends ComDefaultControllerDefault
{
    protected function _initialize(KConfig $config)
    {
        $config->append(array(
            'request' => array('view' => 'settings')
        ));

        parent::_initialize($config);
    }

    protected function _actionRead(KCommandContext $context)
    {
        $name = ucfirst($this->getView()->getName());

        if(!$this->getModel()->getState()->isUnique()) {
            $context->response->setStatus(KHttpResponse::NOT_FOUND, $name.' Not Found');
        }

        return parent::_actionRead($context);
    }
}

Set the status code through $context->response.


<?php

namespace Concrete\Core\Updater\Migrations\Migrations;

use Concrete\Core\Database\Connection\Connection;
use Concrete\Core\Updater\Migrations\AbstractMigration;
use Concrete\Core\Updater\Migrations\RepeatableMigrationInterface;
use Doctrine\DBAL\Schema\Schema;

class Version20180621222449 extends AbstractMigration implements RepeatableMigrationInterface
{

    public function upgradeDatabase()
    {
        $db = $this->connection;
        if ($db->tableExists('atPageSelector')) {
            // This is the name of the page selector attribute table in some implementations of the page selector attribute
            // We need to take this data and place it into atNumber.
            $r = $db->executeQuery('select * from atPageSelector');
            while ($row = $r->fetch()) {
                $db->transactional(function($db) use ($row) {
                    /** @var $db Connection */
                    $avID = $db->fetchColumn('select avID from atNumber where avID = ?', [$row['avID']]);
                    if (!$avID) {
                        $db->insert('atNumber', ['avID' => $row['avID'], 'value' => $row['value']]);
                    }
                });
            }
        }
    }

}

<?php

namespace Concrete\Core\Updater\Migrations\Migrations;

use Concrete\Core\Updater\Migrations\AbstractMigration;
use Concrete\Core\Updater\Migrations\RepeatableMigrationInterface;

class Version20180621222449 extends AbstractMigration implements RepeatableMigrationInterface
{
    public function upgradeDatabase()
    {
        $db = $this->connection;
        if ($db->tableExists('atPageSelector')) {
            // This is the name of the page selector attribute table in some implementations of the page selector attribute
            // We need to take this data and place it into atNumber.
            $db->query(<<<EOT
insert into atNumber (avID, value)
    select
        atPageSelector.avID, atPageSelector.value
    from
        atPageSelector
    inner join
        AttributeValues on atPageSelector.avID = AttributeValues.avID
    left join
        atNumber on atPageSelector.avID = atNumber.avID
    where
        atNumber.avID is null
EOT
            );
        }
    }
}

Fix migration of data in atPageSelector table


<?php

namespace SimplyTestable\WorkerBundle\Tests\Command\Task\Perform;

class SuccessTest extends PerformCommandTest {

    /**
     * @var int
     */
    private $commandReturnCode;

    /**
     * @var int
     */
    private $taskId;

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

        $this->container->get('simplytestable.services.htmlValidatorWrapperService')->loadFixturesFromPath(
            $this->getFixturesDataPath('/HtmlValidatorResponses')
        );

        $task = $this->createTask('http://example.com/', 'HTML validation');
        $this->taskId = $task->id;

        $this->commandReturnCode = $this->executeCommand('simplytestable:task:perform', array(
            'id' => $this->taskId
        ));
    }

    /**
     * @group standard
     */
    public function testReturnsStatusCode() {
        $this->assertEquals(0, $this->commandReturnCode);
    }

    public function testResqueTaskReportCompletionJobIsCreated() {
        $this->assertTrue($this->getRequeQueueService()->contains(
            'task-report-completion', ['id' => $this->taskId]
        ));
    }

}

<?php

namespace SimplyTestable\WorkerBundle\Tests\Command\Task\Perform;

class SuccessTest extends PerformCommandTest {

    /**
     * @var int
     */
    private $commandReturnCode;

    /**
     * @var int
     */
    private $taskId;

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

        $this->container->get('simplytestable.services.htmlValidatorWrapperService')->loadFixturesFromPath(
            $this->getFixturesDataPath('/HtmlValidatorResponses')
        );

        $task = $this->createTask('http://example.com/', 'HTML validation');
        $this->taskId = $task->id;

        $this->clearRedis();

        $this->commandReturnCode = $this->executeCommand('simplytestable:task:perform', array(
            'id' => $this->taskId
        ));
    }

    /**
     * @group standard
     */
    public function testReturnsStatusCode() {
        $this->assertEquals(0, $this->commandReturnCode);
    }

    public function testResqueTaskReportCompletionJobIsCreated() {
        $this->assertTrue($this->getRequeQueueService()->contains(
            'task-report-completion', ['id' => $this->taskId]
        ));
    }

    public function testResqueTasksRequestJobIsCreated() {
        $this->assertTrue($this->getRequeQueueService()->contains(
            'tasks-request'
        ));
    }

}

Verify tasks-request job is created after successful perform


<?php namespace Spec\Sauce;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class WorkerSpec extends ObjectBehavior {

    function it_is_initializable()
    {
        $this->shouldHaveType('Sauce\Worker');
    }

}

<?php namespace Spec\Sauce;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

class WorkerSpec extends ObjectBehavior {

    function it_is_initializable()
    {
        $this->shouldHaveType('Sauce\Worker');
    }

    function it_receives_the_input_path()
    {
        $this->in('something')->shouldReturnItself();
    }

    /**
     * Get the inline matchers
     *
     * @return array
     */
    public function getMatchers()
    {
        return [
            'returnItself' => function($subject)
            {
                return ($subject instanceof \Sauce\Worker);
            },
        ];
    }

}

Add a test for Worker::in

Add a test for Worker::in


<?php
namespace CodeGen\Frameworks\Apache2;

class BaseDirectiveGroup
{
    protected $tag;

    protected $dynamicDirectives = [];

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

    public function __call($method, $args)
    {
        $directiveName = ucfirst(str_replace('set', '', $method));
        $value = $args[0];
        $this->dynamicDirectives[] = "{$directiveName} {$value}";
        return $this;
    }

    protected function buildDynamicDirectives(array &$out)
    {
        foreach ($this->dynamicDirectives as $directive) {
            $out[] = $directive;
        }
    }

}

<?php
namespace CodeGen\Frameworks\Apache2;

class BaseDirectiveGroup
{
    protected $tag;

    protected $dynamicDirectives = [];

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

    public function __call($method, $args)
    {
        $directiveName = ucfirst(str_replace('set', '', $method));
        $value = $args[0];
        $this->dynamicDirectives[] = "{$directiveName} {$value}";
        return $this;
    }

    public function addDirective($directive)
    {
        $this->dynamicDirectives[] = $directive;
    }

    protected function buildDynamicDirectives(array &$out)
    {
        foreach ($this->dynamicDirectives as $directive) {
            $out[] = $directive;
        }
    }

}

Add addDirective method to add directive


<?php

namespace Platformsh\Cli\Local\Toolstack;

use Platformsh\Cli\Exception\DependencyMissingException;

class NodeJs extends ToolstackBase
{
    public function getKey()
    {
        return 'nodejs:default';
    }

    public function detect($appRoot)
    {
        // Refuse to detect automatically.
        return false;
    }

    public function build()
    {
        $this->buildInPlace = true;

        $buildDir = $this->getBuildDir();

        if ($this->copy) {
            if (!file_exists($this->appRoot . '/' . $this->documentRoot)) {
                $buildDir = $this->getWebRoot();
            }
            $this->fsHelper->copyAll($this->appRoot, $buildDir);
        }

        if (file_exists($buildDir . '/package.json')) {
            $this->output->writeln("Found a package.json file, installing dependencies");

            if (!$this->shellHelper->commandExists('npm')) {
                throw new DependencyMissingException('npm is not installed');
            }

            $npm = $this->shellHelper->resolveCommand('npm');

            $this->shellHelper->execute([$npm, 'prune'], $buildDir, true, false);
            $this->shellHelper->execute([$npm, 'install'], $buildDir, true, false);
        }

        $this->processSpecialDestinations();
    }

    public function install()
    {
        $this->copyGitIgnore('gitignore-nodejs');
    }
}

<?php

namespace Platformsh\Cli\Local\Toolstack;

use Platformsh\Cli\Exception\DependencyMissingException;
use Symfony\Component\Console\Output\OutputInterface;

class NodeJs extends ToolstackBase
{
    public function getKey()
    {
        return 'nodejs:default';
    }

    public function detect($appRoot)
    {
        // Refuse to detect automatically.
        return false;
    }

    public function build()
    {
        $this->buildInPlace = true;

        $buildDir = $this->getBuildDir();

        if ($this->copy) {
            if (!file_exists($this->appRoot . '/' . $this->documentRoot)) {
                $buildDir = $this->getWebRoot();
            }
            $this->fsHelper->copyAll($this->appRoot, $buildDir);
        }

        if (file_exists($buildDir . '/package.json')) {
            $this->output->writeln("Found a package.json file, installing dependencies");

            if (!$this->shellHelper->commandExists('npm')) {
                throw new DependencyMissingException('npm is not installed');
            }

            $npm = $this->shellHelper->resolveCommand('npm');
            $npmArgs = [$npm];
            if (!empty($this->settings['verbosity']) && $this->settings['verbosity'] >= OutputInterface::VERBOSITY_VERY_VERBOSE) {
                $npmArgs[] = '--loglevel=verbose';
            }

            $pruneArgs = $npmArgs;
            $pruneArgs[] = 'prune';
            $this->shellHelper->execute($pruneArgs, $buildDir, true, false);

            $installArgs = $npmArgs;
            $installArgs[] = 'install';
            $this->shellHelper->execute($installArgs, $buildDir, true, false);
        }

        $this->processSpecialDestinations();
    }

    public function install()
    {
        $this->copyGitIgnore('gitignore-nodejs');
    }
}

Make npm verbose during 'platform build -vv'


<?php

namespace Installer;

use Composer\Plugin\Capability\CommandProvider;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Composer\Command\BaseCommand;

class CommandProvider implements CommandProvider
{
    public function __construct(array $args)
    {
        if (!$args['composer'] instanceof \Composer\Composer) {
            throw new \RuntimeException('Expected a "composer" key');
        }
        if (!$args['io'] instanceof \Composer\IO\IOInterface) {
            throw new \RuntimeException('Expected an "io" key');
        }
        if (!$args['plugin'] instanceof Plugin8) {
            throw new \RuntimeException('Expected a "plugin" key with my own plugin');
        }
    }

    public function getCommands()
    {
        return array(new Command);
    }
}

class Command extends BaseCommand
{
    protected function configure()
    {
        $this->setName('custom-plugin-command');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln('Executing');

        return 5;
    }
}

<?php

namespace Installer;

use Composer\Plugin\Capability\CommandProvider as CommandProviderCapability;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Composer\Command\BaseCommand;

class CommandProvider implements CommandProviderCapability
{
    public function __construct(array $args)
    {
        if (!$args['composer'] instanceof \Composer\Composer) {
            throw new \RuntimeException('Expected a "composer" key');
        }
        if (!$args['io'] instanceof \Composer\IO\IOInterface) {
            throw new \RuntimeException('Expected an "io" key');
        }
        if (!$args['plugin'] instanceof Plugin8) {
            throw new \RuntimeException('Expected a "plugin" key with my own plugin');
        }
    }

    public function getCommands()
    {
        return array(new Command);
    }
}

class Command extends BaseCommand
{
    protected function configure()
    {
        $this->setName('custom-plugin-command');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln('Executing');

        return 5;
    }
}

Fix test suite on <7

Fix test suite on <7


<?php
/**
 * @version		$Id$
 * @category	Nooku
 * @package     Nooku_Server
 * @subpackage  Weblinks
 * @copyright	Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		http://www.nooku.org
 */

/**
 * Weblinks Toolbar Class
 *
 * @author    	Jeremy Wilken <http://nooku.assembla.com/profile/gnomeontherun>
 * @category 	Nooku
 * @package     Nooku_Server
 * @subpackage  Weblinks
 */
class ComWeblinksControllerToolbarWeblinks extends ComDefaultControllerToolbarDefault
{
    public function getCommands()
    {
        $this->addSeperator()
			 ->addEnable()
			 ->addDisable()
			 ->addSeperator()
			 ->addPreferences();

	    return parent::getCommands();
    }
}

<?php
/**
 * @version		$Id$
 * @category	Nooku
 * @package     Nooku_Server
 * @subpackage  Weblinks
 * @copyright	Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		http://www.nooku.org
 */

/**
 * Weblinks Toolbar Class
 *
 * @author    	Jeremy Wilken <http://nooku.assembla.com/profile/gnomeontherun>
 * @category 	Nooku
 * @package     Nooku_Server
 * @subpackage  Weblinks
 */
class ComWeblinksControllerToolbarWeblinks extends ComDefaultControllerToolbarDefault
{
    public function getCommands()
    {
        $this->addSeperator()
			 ->addEnable()
			 ->addDisable()
			 ->addSeperator()
			 ->addModal(array(
			    'label' => 'Preferences',
			 	'href' => 'index.php?option=com_config&controller=component&component=com_weblinks')
			 );

	    return parent::getCommands();
    }
}

Use the default modal command. Set title and href.


<?php

namespace Tests\AppBundle\API\Listing;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\ParameterBag;
use Tests\AppBundle\API\WebserviceTestCase;

class TraitsTest extends WebserviceTestCase
{

    public function testExecute()
    {
        $default_db = $client->getContainer()->getParameter('default_db');
        $service = $client->getContainer()->get('app.api.webservice')->factory('listing', 'traits');
        $results = $service->execute(
            new ParameterBag(array('dbversion' => $default_db, 'search' => '')),
            null
        );
        $expected = array(
            array(
                "name" => "PlantHabit",
                "trait_type_id" => 1,
                "frequency" => 48916
            )
        );
        $this->assertEquals($expected, $results, 'Search without term and limit, result should be a list of all traits');

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

<?php

namespace Tests\AppBundle\API\Listing;

use Symfony\Component\HttpFoundation\ParameterBag;
use Tests\AppBundle\API\WebserviceTestCase;

class TraitsTest extends WebserviceTestCase
{

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

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

Use WebserviceTestCase as parent for listing traits test


<?php
/**
 * @author Mamaev Yuriy (eXeCUT)
 * @link https://github.com/execut
 * @copyright Copyright (c) 2020 Mamaev Yuriy (eXeCUT)
 * @license http://www.apache.org/licenses/LICENSE-2.0
 */
namespace execut\crudFields\fields\detailViewField;

use execut\crudFields\fields\DetailViewField;
use execut\yii2kcfinder\CKEditor;
use kartik\detail\DetailView;

/**
 * DetailViewField for WYSIWYG HTML editor widget
 * @package execut\crudFields\fields\detailViewField
 */
class Editor extends DetailViewField
{
    /**
     * {@inheritdoc}
     */
    public function getConfig($model = null)
    {
        return array_merge(parent::getConfig($model), [
            'type' => DetailView::INPUT_WIDGET,
            'format' => 'html',
            'widgetOptions' => [
                'class' => CKEditor::class,
                'preset' => 'full',
                'clientOptions' => [
                    'language' => \yii::$app ? \yii::$app->language : null,
                    'allowedContent' => true,
                ],
            ],
        ]);
    }
}

<?php
/**
 * @author Mamaev Yuriy (eXeCUT)
 * @link https://github.com/execut
 * @copyright Copyright (c) 2020 Mamaev Yuriy (eXeCUT)
 * @license http://www.apache.org/licenses/LICENSE-2.0
 */
namespace execut\crudFields\fields\detailViewField;

use execut\crudFields\fields\DetailViewField;
use iutbay\yii2kcfinder\CKEditor;
use kartik\detail\DetailView;

/**
 * DetailViewField for WYSIWYG HTML editor widget
 * @package execut\crudFields\fields\detailViewField
 */
class Editor extends DetailViewField
{
    /**
     * {@inheritdoc}
     */
    public function getConfig($model = null)
    {
        return array_merge(parent::getConfig($model), [
            'type' => DetailView::INPUT_WIDGET,
            'format' => 'html',
            'widgetOptions' => [
                'class' => CKEditor::class,
                'preset' => 'full',
                'clientOptions' => [
                    'language' => \yii::$app ? \yii::$app->language : null,
                    'allowedContent' => true,
                ],
            ],
        ]);
    }
}

Revert "switched to execut ckfinder"

Revert "switched to execut ckfinder"

This reverts commit a9657b395a551b96211ca18f60258ec6bfb533bb.


<?php

namespace Laravel\Passport\Console;

use Illuminate\Console\Command;

class InstallCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'passport:install
                            {--force : Overwrite keys they already exist}
                            {--length=4096 : The length of the private key}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Run the commands necessary to prepare Passport for use';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->call('passport:keys', ['--force' => $this->option('force'), '--length' => $this->option('length')]);
        $this->call('passport:client', ['--personal' => true, '--name' => config('app.name').' Personal Access Client']);
        $this->call('passport:client', ['--password' => true, '--name' => config('app.name').' Password Grant Client']);
    }
}

<?php

namespace Laravel\Passport\Console;

use Illuminate\Console\Command;

class InstallCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'passport:install
                            {--force : Overwrite keys they already exist}
                            {--length=4096 : The length of the private key}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Run the commands necessary to prepare Passport for use';

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle()
    {
        $this->call('passport:keys', ['--force' => $this->option('force'), '--length' => $this->option('length')]);
        $this->call('passport:client', ['--personal' => true, '--name' => config('app.name').' Personal Access Client']);
        $this->call('passport:client', ['--password' => true, '--name' => config('app.name').' Password Grant Client']);
    }
}

Use proper return type in command

Use proper return type in command


<?php
namespace App\Entity\Fixture;

use App\Radio\Adapters;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use App\Entity;

class Station extends AbstractFixture
{
    public function load(ObjectManager $em)
    {
        $station = new Entity\Station;
        $station->setName('AzuraTest Radio');
        $station->setDescription('A test radio station.');
        $station->setFrontendType(Adapters::FRONTEND_ICECAST);
        $station->setBackendType(Adapters::BACKEND_LIQUIDSOAP);
        $station->setRadioBaseDir('/var/azuracast/stations/azuratest_radio');

        $station_quota = getenv('INIT_STATION_QUOTA');
        if (!empty($station_quota)) {
            $station->setStorageQuota($station_quota);
        }

        $em->persist($station);
        $em->flush();

        $this->addReference('station', $station);
    }
}

<?php
namespace App\Entity\Fixture;

use App\Radio\Adapters;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use App\Entity;

class Station extends AbstractFixture
{
    public function load(ObjectManager $em)
    {
        $station = new Entity\Station;
        $station->setName('AzuraTest Radio');
        $station->setDescription('A test radio station.');
        $station->setFrontendType(Adapters::FRONTEND_ICECAST);
        $station->setBackendType(Adapters::BACKEND_LIQUIDSOAP);
        $station->setRadioBaseDir('/var/azuracast/stations/azuratest_radio');

        // Ensure all directories exist.
        $radio_dirs = [
            $station->getRadioBaseDir(),
            $station->getRadioMediaDir(),
            $station->getRadioAlbumArtDir(),
            $station->getRadioPlaylistsDir(),
            $station->getRadioConfigDir(),
            $station->getRadioTempDir(),
        ];
        foreach ($radio_dirs as $radio_dir) {
            if (!file_exists($radio_dir) && !mkdir($radio_dir, 0777) && !is_dir($radio_dir)) {
                throw new \RuntimeException(sprintf('Directory "%s" was not created', $radio_dir));
            }
        }

        $station_quota = getenv('INIT_STATION_QUOTA');
        if (!empty($station_quota)) {
            $station->setStorageQuota($station_quota);
        }

        $em->persist($station);
        $em->flush();

        $this->addReference('station', $station);
    }
}

Create directories when loading fixtures.


<?php if ($valid_token) { ?>
	<?=heading('Hartelijk dank voor het invullen van deze vragenlijst.', 2); ?>

<?//=$test_name; ?>
		Uw antwoorden zijn opgeslagen en worden met de grootste zorg behandeld.

		Als u verder nog vragen heeft over de vragenlijst, neem dan contact op met het Babylab Utrecht via <?=mailto(BABYLAB_MANAGER_EMAIL); ?>.

		U kunt het scherm nu afsluiten of doorklikken naar onze website:
		<?=anchor('https://babylab.wp.hum.uu.nl', 'https://babylab.wp.hum.uu.nl'); ?>.

<?php
}
else
{
	show_404();
}
?>

<?php if ($valid_token) { ?>
	<?=heading('Hartelijk dank voor het invullen van deze vragenlijst.', 2); ?>

		Hartelijk dank voor het invullen van de vragenlijst <?=$test_name; ?>.
		Uw antwoorden zijn opgeslagen en worden met de grootste zorg behandeld.

		Als u verder nog vragen heeft over de vragenlijst, neem dan contact op met het Babylab Utrecht via <?=mailto(BABYLAB_MANAGER_EMAIL); ?>.

		U kunt het scherm nu afsluiten of doorklikken naar onze website:
		<?=anchor('https://babylab.wp.hum.uu.nl', 'https://babylab.wp.hum.uu.nl'); ?>.

<?php
}
else
{
	show_404();
}
?>

Revert "Temporarily removed the first line from the survey-complete page"

This reverts commit 803aa203


<?php

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

class AddEmailViewPermission extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::table('mship_permission')->insert([
            ['name' => 'adm/mship/account/email/view', 'display_name' => 'Admin / Mship / Account / Email / View', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],
        ]);

        Schema::table('sys_notification_read', function($table){
            $table->dropUnique('sys_notification_read_notification_id_account_id_unique');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        DB::table('mship_permission')->where('name', 'adm/mship/account/email/view')->delete();

        Schema::table('sys_notification_read', function($table){
            $table->unique(['notification_id', 'account_id']);
        });
    }
}

<?php

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

class AddEmailViewPermission extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::table('mship_permission')->insert([
            ['name' => 'adm/mship/account/email/view', 'display_name' => 'Admin / Mship / Account / Email / View', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()],
        ]);
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        DB::table('mship_permission')->where('name', 'adm/mship/account/email/view')->delete();
    }
}

Remove dropping unique from sys_notification_read


<?php
/**
 * Created by Pierre-Henry Soria
 */

namespace PFBC\Validation;

use PH7\Framework\Date\CDateTime;
use PH7\Framework\Mvc\Model\DbConfig;

class BirthDate extends \PFBC\Validation
{
    /** @var int */
    protected $iMin;

    /** @var int */
    protected $iMax;

    public function __construct()
    {
        parent::__construct();

        $this->iMin = DbConfig::getSetting('minAgeRegistration');
        $this->iMax = DbConfig::getSetting('maxAgeRegistration');
        $this->message = t('You must be from %0% to %1% years old to join the service.', $this->iMin, $this->iMax);
    }

    /**
     * @param string $sDate
     *
     * @return bool
     */
    public function isValid($sDate)
    {
        if ($this->isNotApplicable($sDate)) {
            return true;
        }

        $sDate = (new CDateTime)->get($sDate)->date('m/d/Y');

        return $this->oValidate->birthDate($sDate, $this->iMin, $this->iMax);
    }
}

<?php
/**
 * Created by Pierre-Henry Soria
 */

namespace PFBC\Validation;

use PH7\Framework\Date\CDateTime;
use PH7\Framework\Mvc\Model\DbConfig;

class BirthDate extends \PFBC\Validation
{
    const DATE_PATTERN = 'm/d/Y';

    /** @var int */
    protected $iMin;

    /** @var int */
    protected $iMax;

    public function __construct()
    {
        parent::__construct();

        $this->iMin = DbConfig::getSetting('minAgeRegistration');
        $this->iMax = DbConfig::getSetting('maxAgeRegistration');
        $this->message = t('You must be from %0% to %1% years old to join the service.', $this->iMin, $this->iMax);
    }

    /**
     * @param string $sDate
     *
     * @return bool
     */
    public function isValid($sDate)
    {
        if ($this->isNotApplicable($sDate)) {
            return true;
        }

        $sDate = (new CDateTime)->get($sDate)->date(self::DATE_PATTERN);

        return $this->oValidate->birthDate($sDate, $this->iMin, $this->iMax);
    }
}

Store date format into a constant

Store date format into a constant


<!DOCTYPE html>

	<title>Conceptual-Model</title>

Entities and Attributes

User Profile

Pet Profile

Favorite

Relations

One Profile favorites products - (m to n)

<!DOCTYPE html>

	<title>Conceptual-Model</title>

Entities and Attributes

Profile

profileId

profileAtHandle

profileEmail

profilePhone

Pet Profile

petId

petProfileId

petDescription

petType

petBreed

PetLocation

images

petProfileImage

Relations

One Profile favorites products - (m to n)

Use Case for persona b (pet seeker)

Use Case for persona b (pet seeker)


<?php #YOLO

namespace yolo;

function yolisp($swag, array $env = []) {
    if (!is_array($swag)) {
        if (isset($env[$swag])) {
            return $env[$swag];
        } else if (function_exists($swag)) {
            return $swag;
        } else {
            throw new \Exception("Could not find $swag in environment");
        }
    }

    $command = $swag[0];
    $args = array_slice($swag, 1);
    switch ($command) {
        case 'quote':
            return $args[0];
        case 'lambda':
            list($arg_names, $body) = $args;
            return function (...$args) use ($arg_names, $body, $env) {
                foreach ($arg_names as $i => $arg_name) {
                    $env[$arg_name] = $args[$i];
                }
                return yolisp($body, $env);
            };
        case 'new':
            list($class_name, $constructor_args) = $args;
            $evaluated_args = array_map('yolo\yolisp', $constructor_args);
            return new $class_name(...$evaluated_args);
        default:
            $func = yolisp($command);
            $evaluated_args = array_map('yolo\yolisp', $args);
            return $func(...$evaluated_args);
    }
}

<?php #YOLO

namespace yolo;

function yolisp($swag, array $env = []) {
    if (!is_array($swag)) {
        if (isset($env[$swag])) {
            return $env[$swag];
        } else if (function_exists($swag)) {
            return $swag;
        } else {
            throw new \Exception("Could not find $swag in environment");
        }
    }

    $eval = function ($swag) use ($env) {
        return yolisp($swag, $env);
    };

    $command = $swag[0];
    $args = array_slice($swag, 1);
    switch ($command) {
        case 'quote':
            return $args[0];
        case 'lambda':
            list($arg_names, $body) = $args;
            return function (...$args) use ($arg_names, $body, $env) {
                foreach ($arg_names as $i => $arg_name) {
                    $env[$arg_name] = $args[$i];
                }
                return yolisp($body, $env);
            };
        case 'new':
            list($class_name, $constructor_args) = $args;
            $evaluated_args = array_map($eval, $constructor_args);
            return new $class_name(...$evaluated_args);
        default:
            $func = $eval($command);
            $evaluated_args = array_map($eval, $args);
            return $func(...$evaluated_args);
    }
}

Use $eval to maintain state

Use $eval to maintain state


<?php

namespace OpenDominion\Http\Middleware;

use Closure;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use OpenDominion\Services\Dominion\SelectorService;

class ShareSelectedDominion
{
    /** @var SelectorService */
    protected $dominionSelectorService;

    /**
     * ShareSelectedDominion constructor.
     *
     * @param SelectorService $dominionSelectorService
     */
    public function __construct(SelectorService $dominionSelectorService)
    {
        $this->dominionSelectorService = $dominionSelectorService;
    }

    public function handle($request, Closure $next)
    {
        if (starts_with($request->path(), 'nova')) {
            return $next($request);
        }

        if ($this->dominionSelectorService->hasUserSelectedDominion()) {
            try {
                $dominion = $this->dominionSelectorService->getUserSelectedDominion();

            } catch (ModelNotFoundException $e) {
                $this->dominionSelectorService->unsetUserSelectedDominion();

                $request->session()->flash('alert-danger', 'The database has been reset for development purposes since your last visit. Please re-register a new account. You can use the same credentials you\'ve used before.');

                return redirect()->route('home');
            }

            view()->share('selectedDominion', $dominion);
        }

        return $next($request);
    }
}

<?php

namespace OpenDominion\Http\Middleware;

use Bugsnag;
use Closure;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use OpenDominion\Services\Dominion\SelectorService;

class ShareSelectedDominion
{
    /** @var SelectorService */
    protected $dominionSelectorService;

    /**
     * ShareSelectedDominion constructor.
     *
     * @param SelectorService $dominionSelectorService
     */
    public function __construct(SelectorService $dominionSelectorService)
    {
        $this->dominionSelectorService = $dominionSelectorService;
    }

    public function handle($request, Closure $next)
    {
        if (starts_with($request->path(), 'nova')) {
            return $next($request);
        }

        if ($this->dominionSelectorService->hasUserSelectedDominion()) {
            try {
                $dominion = $this->dominionSelectorService->getUserSelectedDominion();

            } catch (ModelNotFoundException $e) {
                $this->dominionSelectorService->unsetUserSelectedDominion();

                $request->session()->flash('alert-danger', 'The database has been reset for development purposes since your last visit. Please re-register a new account. You can use the same credentials you\'ve used before.');

                return redirect()->route('home');
            }

            // Add dominion context to Bugsnag
            Bugsnag::registerCallback(function (Bugsnag\Report $report) use ($dominion) {
                /** @noinspection NullPointerExceptionInspection */
                $report->setMetaData([
                    'dominion' => array_except($dominion->toArray(), ['race', 'realm']),
                ]);
            });

            view()->share('selectedDominion', $dominion);
        }

        return $next($request);
    }
}

Add dominion state metadata to Bugsnag

Add dominion state metadata to Bugsnag


<?php

namespace SuperCMS\Leaves\Site\Product;

use Rhubarb\Leaf\Crud\Leaves\ModelBoundModel;
use SuperCMS\Leaves\Site\Search\SearchLeaf;

class ProductCollection extends SearchLeaf
{
    protected function getViewClass()
    {
        return ProductCollectionView::class;
    }

    protected function createModel()
    {
        return new ModelBoundModel();
    }
}

<?php

namespace SuperCMS\Leaves\Site\Product;

use SuperCMS\Leaves\Site\Search\SearchLeaf;

class ProductCollection extends SearchLeaf
{
    protected function getViewClass()
    {
        return ProductCollectionView::class;
    }
}

Make sure SearchLeaf gets given a SearchModel for correct functions


<?php namespace Pingpong\Modules\Commands;

use Illuminate\Console\Command;

class ListCommand extends Command {

    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'module:list';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Show list of all modules.';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function fire()
    {
        $this->table(['Name', 'Status', 'Priority', 'Path'], $this->getRows());
    }

    /**
     * Get table rows.
     *
     * @return array
     */
    public function getRows()
    {
        $rows = [];

        foreach ($this->laravel['modules']->getOrdered() as $module)
        {
            $rows[] = [
                $module->getStudlyName(),
                $module->enabled() ? 'Enabled' : 'Disabled',
                $module->get('priority'),
                $module->getPath(),
            ];
        }

        return $rows;
    }

}

<?php namespace Pingpong\Modules\Commands;

use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;

class ListCommand extends Command {

    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'module:list';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Show list of all modules.';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function fire()
    {
        $this->table(['Name', 'Status', 'Order', 'Path'], $this->getRows());
    }

    /**
     * Get table rows.
     *
     * @return array
     */
    public function getRows()
    {
        $rows = [];

        foreach ($this->getModules() as $module)
        {
            $rows[] = [
                $module->getStudlyName(),
                $module->enabled() ? 'Enabled' : 'Disabled',
                $module->get('order'),
                $module->getPath(),
            ];
        }

        return $rows;
    }

    public function getModules()
    {
        switch ($this->option('only')) {
            case 'enabled':
                return $this->laravel['modules']->getByStatus(1);
                break;

            case 'disabled':
                return $this->laravel['modules']->getByStatus(0);
                break;

            case 'ordered':
                return $this->laravel['modules']->getOrdered($this->option('direction'));
                break;

            default:
                return $this->laravel['modules']->all();
                break;
        }
    }

    /**
     * Get the console command options.
     *
     * @return array
     */
    protected function getOptions()
    {
        return array(
            array('only', null, InputOption::VALUE_OPTIONAL, 'Types of modules will be displayed.', null),
            array('direction', 'd', InputOption::VALUE_OPTIONAL, 'The direction of ordering.', 'asc'),
        );
    }

}

Add new option --only & --direction flags


<?php

namespace Shoptet\Spayd\Utilities;

use Shoptet\Spayd\Exceptions;

class IbanUtilities {

	public static function computeIBANFromCzechBankAccount(\Shoptet\Spayd\Model\CzechAccount $czechAccount) {
		if ($czechAccount->isValid()) {
			$prefix = sprintf('%06d', $czechAccount->getPrefix());
			$accountNumber = sprintf('%010d', $czechAccount->getAccountNumber());
			$bankCode = sprintf('%04d', $czechAccount->getBankCode());
		}

		$accountBuffer = $bankCode . $prefix . $accountNumber . $czechAccount->getNumericLanguageCode();
		$checksum = sprintf('%02d', (98 - bcmod($accountBuffer, 97)));

		// build the IBAN number
		return 'CZ' . $checksum . $bankCode . $prefix . $accountNumber;
	}
}

<?php

namespace Shoptet\Spayd\Utilities;

use Shoptet\Spayd\Exceptions;

class IbanUtilities {

	public static function computeIBANFromCzechBankAccount(\Shoptet\Spayd\Model\CzechAccount $czechAccount) {
		if ($czechAccount->isValid()) {
			$prefix = sprintf('%06d', $czechAccount->getPrefix());
			$accountNumber = sprintf('%010d', $czechAccount->getAccountNumber());
			$bankCode = sprintf('%04d', $czechAccount->getBankCode());

			$accountBuffer = $bankCode . $prefix . $accountNumber . $czechAccount->getNumericLanguageCode();
			$checksum = sprintf('%02d', (98 - bcmod($accountBuffer, 97)));

			// build the IBAN number
			return 'CZ' . $checksum . $bankCode . $prefix . $accountNumber;
		} else {
			return FALSE;
		}
	}
}

Return FALSE when account is not valid

Return FALSE when account is not valid


<?php

namespace Rhubarb\Scaffolds\Communications\Leaves\CommunicationItem;

use Rhubarb\Leaf\Controls\Common\Checkbox\CheckboxView;

class CommunicationItemCollectionCheckboxView extends CheckboxView
{
    protected function printViewContent()
    {
        ?>

            <?php
            $attributes = $this->getNameValueClassAndAttributeString(false);
            $attributes .= $this->model->value ? ' checked="checked"' : '';

            $presence = $this->getPresenceInputName();
            print "<input type='hidden' name='{$presence}' value='0'><input type='checkbox' {$attributes}/>";
            ?>

        <?php
    }

    /**
     * @return string
     */
    private function getPresenceInputName()
    {
        return "set_{$this->model->leafPath}_";
    }
}

<?php

namespace Rhubarb\Scaffolds\Communications\Leaves\CommunicationItem;

use Rhubarb\Leaf\Controls\Common\Checkbox\CheckboxView;

class CommunicationItemCollectionCheckboxView extends CheckboxView
{
    protected function printViewContent()
    {
        ?>

            <?php
            $attributes = $this->getNameValueClassAndAttributeString(false);
            $attributes .= $this->model->value ? ' checked="checked"' : '';

            $presence = $this->getPresenceInputName();
            print "<input type='hidden' name='{$presence}' value='0'><input type='checkbox' {$attributes}/>";
            ?>

        <?php
    }

    /**
     * @return string
     */
    protected function getPresenceInputName()
    {
        return "set_{$this->model->leafPath}_";
    }
}

Fix for issue with presence input name

Fix for issue with presence input name


<?php namespace Ritey\LibPhoneNumberLaravel;
/**
* Libphonenumber-for-php service provider package for Laravel by David Wright.
*
* NOTICE OF LICENSE
*
* Licensed under the terms from David Wright
*
* @package LibPhoneNumberLaravel
* @version 1.0.0
* @author @ritey
* @license MIT
* @copyright (c) 2015, David Wright
* @link http://twitter.com/ritey
*/

use Illuminate\Support\ServiceProvider;
use libphonenumber\PhoneNumberUtil;

class LibPhoneNumberLaravelServiceProvider extends ServiceProvider {

	/**
	 * Boot the service provider.
	 *
	 * @return void
	 */
	public function boot()
	{

	}

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

		$this->app->alias('libphonenumber', 'libphonenumber\PhoneNumberUtil');
	}

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

<?php namespace Ritey\LibPhoneNumberLaravel;
/**
* Libphonenumber-for-php service provider package for Laravel by David Wright.
*
* NOTICE OF LICENSE
*
* Licensed under the terms from David Wright
*
* @package LibPhoneNumberLaravel
* @version 1.0.0
* @author @ritey
* @license MIT
* @copyright (c) 2015, David Wright
* @link http://twitter.com/ritey
*/

use Illuminate\Support\ServiceProvider;
use libphonenumber\PhoneNumberUtil;

class LibPhoneNumberLaravelServiceProvider extends ServiceProvider {

	/**
	 * Boot the service provider.
	 *
	 * @return void
	 */
	public function boot()
	{

	}

	/**
	 * Register the service provider.
	 *
	 * @return void
	 */
	public function register()
	{
		$this->app->singleton('libphonenumber', function ($app)
		{
			return PhoneNumberUtil::getInstance();
		});

		$this->app->alias('libphonenumber', 'libphonenumber\PhoneNumberUtil');
	}

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

Switch to singleton on register

Switch to singleton on register


<?php

namespace Test;

use App\User;
use App\Company;

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

class CompanyLicenceManagementTest extends TestCase
{
    use DatabaseTransactions;

    public function test_set_and_get_licence_expiration_date()
    {
        $company = factory(Company::class)->create();
        $this->seeInDatabase('companies', ['id' => $company->id, 'licence_expire_at' => null]);

        $date = Carbon::now();
        $company->licence_expire_at = $date;
        $company->save();
        $this->seeInDatabase('companies', ['id' => $company->id, 'licence_expire_at' => $date->toDateString()]);
        $companyAgain = Company::find($company->id);
        $this->assertEquals($date->toDateString(), $companyAgain->licence_expire_at);
    }

}

<?php

namespace Test;

use App\User;
use App\Company;

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

class CompanyLicenceManagementTest extends TestCase
{
    use DatabaseTransactions;

    public function test_set_and_get_licence_expiration_date()
    {
        $company = factory(Company::class)->create();
        $this->seeInDatabase('companies', ['id' => $company->id, 'licence_expire_at' => null]);

        $date = Carbon::now();
        $company->licence_expire_at = $date;
        $company->save();
        $this->seeInDatabase('companies', ['id' => $company->id, 'licence_expire_at' => $date->toDateString()]);
        $companyAgain = Company::find($company->id);
        $this->assertEquals($date->toDateString(), $companyAgain->licence_expire_at);
    }

    public function test_new_company_is_suspended()
    {
        $company = factory(Company::class)->create();
        $this->seeInDatabase('companies', ['id' => $company->id, 'is_suspended' => true]);

        $company->is_suspended = false;
        $company->save();

        $this->seeInDatabase('companies', ['id' => $company->id, 'is_suspended' => false]);

        $companyAgain = Company::find($company->id);
        $this->assertEquals(false, $companyAgain->is_suspended);
    }

}

Add test new company suspended

Add test new company suspended


<?php
    /**
     * @desc Bootstrap base engine classes
     * @package M2 Micro Framework
     * @subpackage Main
     * @author Alexander Chaika
     */

    // start session
    if (isset($_COOKIE['PHPSESSID'])) {
        session_id($_COOKIE['PHPSESSID']);
    }
    session_start();

    // set working mode
    date_default_timezone_set('Europe/Minsk');
    ini_set('display_errors', 1);
    ini_set('error_reporting', 'E_ALL & ~E_NOTICE & ~E_DEPRECATED');

    // Simple ACL hook
    define('M2_MICRO', 1);

    // define globals
    define('NL', chr(13).chr(10));
    define('DS', DIRECTORY_SEPARATOR);
    define('ROOT_PATH', __DIR__);
    define('LIB_PATH', ROOT_PATH . DS . 'includes');

    // errors & messages levels
    define('ERROR',   1);
    define('WARNING', 2);
    define('NOTICE',  6);
    define('MESSAGE', 8);

    // system classes
    require_once LIB_PATH . DS . '_function.php';
    require_once LIB_PATH . DS . '_autoload.php';

<?php
    /**
     * @desc Bootstrap base engine classes
     * @package M2 Micro Framework
     * @subpackage Main
     * @author Alexander Chaika
     */

    // start session
    if (isset($_COOKIE['PHPSESSID'])) {
        session_id($_COOKIE['PHPSESSID']);
    }
    session_start();

    // set working mode
    date_default_timezone_set('Europe/Minsk');
    ini_set('display_errors', 1);

    // Simple ACL hook
    define('M2_MICRO', 1);

    // define globals
    define('NL', chr(13).chr(10));
    define('DS', DIRECTORY_SEPARATOR);
    define('ROOT_PATH', __DIR__);
    define('LIB_PATH', ROOT_PATH . DS . 'includes');

    // errors & messages levels
    define('ERROR',   1);
    define('WARNING', 2);
    define('NOTICE',  6);
    define('MESSAGE', 8);

    // system classes
    require_once LIB_PATH . DS . '_function.php';
    require_once LIB_PATH . DS . '_autoload.php';

Remove error levels for PHP

Remove error levels for PHP


<?php

class Purity5Test extends PHPUnit_Framework_TestCase
{
	// Tests

	public function test_SimpleParse() {
		$html = '

				<title>Welcome</title>

Heading

Welcome to Purity5!

		';

		$func = SkylarK\Purity5\Purity5::parse($html);
		//$this->assertEquals("Welcome", $func("title"));
		//$this->assertEquals("Welcome", $func("head title"));
		//$this->assertEquals("Welcome", $func("head")->title);
		//$this->assertEquals("Welcome to Purity5!", $func("html> body >p"));
		//$this->assertEquals("Welcome to Purity5!", $func("html")->body->p);
	}
}

<?php

class Purity5Test extends PHPUnit_Framework_TestCase
{
	// Tests

	public function test_SimpleParse() {
		$html = '

				<title>Welcome</title>

Heading

Welcome to Purity5!

		';

		$func = SkylarK\Purity5\Purity5::parse($html);
		$this->assertEquals("Welcome", $func("title"));
		$this->assertEquals("Welcome", $func("head title"));
		$this->assertEquals("Welcome", $func("head")->title);
		$this->assertEquals("Welcome to Purity5!", $func("html> body >p"));
		$this->assertEquals("Welcome to Purity5!", $func("html")->body->p);
	}
}

Add more tests back in

Add more tests back in


<?php
namespace DMS\Bundle\TwigExtensionBundle\Twig\Date;

/**
 * Adds support for Padding a String in Twig
 */
class PadStringExtension extends \Twig_Extension
{
    /**
     * Name of Extension
     *
     * @return string
     */
    public function getName()
    {
        return 'PadStringExtension';
    }

    /**
     * Available filters
     *
     * @return array
     */
    public function getFilters()
    {
        return array(
            'padString' => new \Twig_Filter_Method($this, 'padStringFilter'),
        );
    }

    /**
     * Pads string on right or left with given padCharacter until string
     * reaches maxLength
     *
     * @param $value
     * @param $padCharacter
     * @param $maxLength
     * @param bool $padLeft
     * @return string
     */
    public function padStringFilter($value, $padCharacter, $maxLength, $padLeft = true)
    {
        if (function_exists('mb_strlen')) {
            $padLength = $maxLength - mb_strlen($value);
        } else {
            $padLength = $maxLength - strlen($value);
        }

        if ($padLength <= 0) {
            return $value;
        }

        $padString = str_repeat($padCharacter, $padLength);

        if ($padLeft) {
            return $padString . $value;
        }

        return $value . $padString;
    }
}

<?php
namespace DMS\Bundle\TwigExtensionBundle\Twig\Date;

/**
 * Adds support for Padding a String in Twig
 */
class PadStringExtension extends \Twig_Extension
{
    /**
     * Name of Extension
     *
     * @return string
     */
    public function getName()
    {
        return 'PadStringExtension';
    }

    /**
     * Available filters
     *
     * @return array
     */
    public function getFilters()
    {
        return array(
            'padString' => new \Twig_Filter_Method($this, 'padStringFilter'),
        );
    }

    /**
     * Pads string on right or left with given padCharacter until string
     * reaches maxLength
     *
     * @param $value
     * @param $padCharacter
     * @param $maxLength
     * @param bool $padLeft
     * @return string
     */
    public function padStringFilter($value, $padCharacter, $maxLength, $padLeft = true)
    {
        if ( ! is_int($maxLength) ) {
            throw new \InvalidArgumentException('Pad String Filter expects its second argument to be an integer');
        }

        if (function_exists('mb_strlen')) {
            $padLength = $maxLength - mb_strlen($value);
        } else {
            $padLength = $maxLength - strlen($value);
        }

        if ($padLength <= 0) {
            return $value;
        }

        $padString = str_repeat($padCharacter, $padLength);

        if ($padLeft) {
            return $padString . $value;
        }

        return $value . $padString;
    }
}

Add check to ensure second argument is an integer