<?php

namespace Doctrine\CouchDB\HTTP;

/**
 * Base exception class for package Doctrine\ODM\CouchDB\HTTP
 *
 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
 * @link        www.doctrine-project.com
 * @since       1.0
 * @author      Kore Nordmann <kore@arbitracker.org>
 */
class HTTPException extends \Doctrine\CouchDB\CouchDBException
{
    public static function connectionFailure( $ip, $port, $errstr, $errno )
    {
        return new self( sprintf(
            "Could not connect to server at %s:%d: '%d: %s'",
            $ip,
            $port,
            $errno,
            $errstr
        ) );
    }

    public static function readFailure( $ip, $port, $errstr, $errno )
    {
        return new static( sprintf(
            "Could read from server at %s:%d: '%d: %s'",
            $ip,
            $port,
            $errno,
            $errstr
        ) );
    }

    /**
     * @param Response $response
     */
    public static function fromResponse($path, Response $response)
    {
        if (!isset($response->body['error'])) {
            $response->body['error'] = '';
        }

        return new self("HTTP Error with status " . $response->status . " occoured while ".
            "requesting " . $path . ". Error: " . $response->body['error'] . " " . $response->body['reason']);
    }
}

<?php

namespace Doctrine\CouchDB\HTTP;

/**
 * Base exception class for package Doctrine\ODM\CouchDB\HTTP
 *
 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
 * @link        www.doctrine-project.com
 * @since       1.0
 * @author      Kore Nordmann <kore@arbitracker.org>
 */
class HTTPException extends \Doctrine\CouchDB\CouchDBException
{
    public static function connectionFailure( $ip, $port, $errstr, $errno )
    {
        return new self( sprintf(
            "Could not connect to server at %s:%d: '%d: %s'",
            $ip,
            $port,
            $errno,
            $errstr
        ),
	$errno );
    }

    public static function readFailure( $ip, $port, $errstr, $errno )
    {
        return new static( sprintf(
            "Could read from server at %s:%d: '%d: %s'",
            $ip,
            $port,
            $errno,
            $errstr
        ),
	$errno );
    }

    /**
     * @param Response $response
     */
    public static function fromResponse($path, Response $response)
    {
        if (!isset($response->body['error'])) {
            $response->body['error'] = '';
        }

        return new self("HTTP Error with status " . $response->status . " occoured while ".
            "requesting " . $path . ". Error: " . $response->body['error'] . " " . $response->body['reason'],
		$response->status
	);
    }
}

Set exception code to status of HTTP response


<?php

namespace Transport\Entity\Schedule;

class Prognosis
{
    public $platform;
    public $arrival;
    public $departure;
    public $capacity1st;
    public $capacity2nd;

    static public function createFromXml(\SimpleXMLElement $xml, \DateTime $date, $isArrival, Prognosis $obj = null)
    {
        if (!$obj) {
            $obj = new Prognosis();
        }

        if ($isArrival) {

            if ($xml->Arr) {
                if ($xml->Arr->Platform) {
                    $obj->platform = (string) $xml->Arr->Platform->Text;
                }
                if ($xml->Arr->Time) {
                    $obj->arrival = Stop::calculateDateTime((string) $xml->Arr->Time, $date)->format(\DateTime::ISO8601);
                }
            }
        } else {

            if ($xml->Dep) {
                if ($xml->Dep->Platform) {
                    $obj->platform = (string) $xml->Dep->Platform->Text;
                }
            }
        }

        if ($xml->Dep) {
            if ($xml->Dep->Time) {
                $obj->departure = Stop::calculateDateTime((string) $xml->Dep->Time, $date)->format(\DateTime::ISO8601);
            }
        }

        if ($xml->Capacity1st) {
            $obj->capacity1st = (int) $xml->Capacity1st;
        }
        if ($xml->Capacity2nd) {
            $obj->capacity2nd = (int) $xml->Capacity2nd;
        }

        return $obj;
    }
}

<?php

namespace Transport\Entity\Schedule;

class Prognosis
{
    public $platform;
    public $arrival;
    public $departure;
    public $capacity1st;
    public $capacity2nd;

    static public function createFromXml(\SimpleXMLElement $xml, \DateTime $date, $isArrival, Prognosis $obj = null)
    {
        if (!$obj) {
            $obj = new Prognosis();
        }

        if ($isArrival) {
            if ($xml->Arr) {
                if ($xml->Arr->Platform) {
                    $obj->platform = (string) $xml->Arr->Platform->Text;
                }
            }
        } else {
            if ($xml->Dep) {
                if ($xml->Dep->Platform) {
                    $obj->platform = (string) $xml->Dep->Platform->Text;
                }
            }
        }

        if ($xml->Arr) {
            if ($xml->Arr->Time) {
                $obj->arrival = Stop::calculateDateTime((string) $xml->Arr->Time, $date)->format(\DateTime::ISO8601);
            }
        }

        if ($xml->Dep) {
            if ($xml->Dep->Time) {
                $obj->departure = Stop::calculateDateTime((string) $xml->Dep->Time, $date)->format(\DateTime::ISO8601);
            }
        }

        if ($xml->Capacity1st) {
            $obj->capacity1st = (int) $xml->Capacity1st;
        }
        if ($xml->Capacity2nd) {
            $obj->capacity2nd = (int) $xml->Capacity2nd;
        }

        return $obj;
    }
}

Unify handling of arrival and departure prognosis

In response to #113


<?php

namespace Kunstmaan\AdminBundle\EventListener;

use FOS\UserBundle\Event\FilterUserResponseEvent;
use FOS\UserBundle\Model\UserManager;

/**
 * Set password_changed property to 1 after changing the password
 */
class PasswordResettingListener
{
    /**
     * @var UserManager
     */
    private $userManager;

    /**
     * @param UserManager $userManager
     */
    function __construct(UserManager $userManager)
    {
        $this->userManager = $userManager;
    }

    /**
     * @param FilterUserResponseEvent $event
     */
    public function onPasswordResettingSuccess(FilterUserResponseEvent $event)
    {
        $user = $event->getUser();
        $user->setPasswordChanged(true);
        $this->userManager->updateUser($user);
    }
}

<?php

namespace Kunstmaan\AdminBundle\EventListener;

use FOS\UserBundle\Event\FilterUserResponseEvent;
use FOS\UserBundle\Model\UserManager;

/**
 * Set password_changed property to 1 after changing the password
 */
class PasswordResettingListener
{
    /**
     * @var UserManager
     */
    private $userManager;

    /**
     * @param UserManager $userManager
     */
    public function __construct(UserManager $userManager)
    {
        $this->userManager = $userManager;
    }

    /**
     * @param FilterUserResponseEvent $event
     */
    public function onPasswordResettingSuccess(FilterUserResponseEvent $event)
    {
        $user = $event->getUser();
        $user->setPasswordChanged(true);
        $this->userManager->updateUser($user);
    }
}

Add public visibility to constructors

Add public visibility to constructors


<?php declare(strict_types=1);
namespace Tests\Router;

use Onion\Framework\Router\PrefixRoute;

class PrefixRouteTest extends \PHPUnit_Framework_TestCase
{
    private $route;
    public function setUp()
    {
        $this->route = new PrefixRoute('/foo');
    }

    public function testMatch()
    {
        $this->assertSame($this->route->getName(), '/foo/*');
        $this->assertSame($this->route->getPattern(), '/foo/*');
        $this->assertTrue($this->route->isMatch('/foo/test/some'));
    }
}

<?php declare(strict_types=1);
namespace Tests\Router;

use Onion\Framework\Router\PrefixRoute;
use Prophecy\Argument\Token\AnyValueToken;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\UriInterface;
use Psr\Http\Server\RequestHandlerInterface;

class PrefixRouteTest extends \PHPUnit_Framework_TestCase
{
    private $route;
    public function setUp()
    {
        $this->route = new PrefixRoute('/foo');
    }

    public function testMatch()
    {
        $this->assertSame($this->route->getName(), '/foo/*');
        $this->assertSame($this->route->getPattern(), '/foo/*');
        $this->assertTrue($this->route->isMatch('/foo/test/some'));
    }

    public function testMatchHandling()
    {
        $response = $this->prophesize(ResponseInterface::class);

        $uri = $this->prophesize(UriInterface::class);
        $uri->getPath()->willReturn('/foo/bar');
        $uri->withPath('/bar')->willReturn($uri->reveal())->shouldBeCalled();
        $uri->withPath('/bar')->shouldBeCalled();
        $uri->withPath('/foo/bar')->willReturn($uri->reveal());

        $request = $this->prophesize(ServerRequestInterface::class);
        $request->withUri(new AnyValueToken())->willReturn($request->reveal());
        $request->getMethod()->willReturn('get');
        $request->getUri()->willReturn($uri->reveal());

        $handler = $this->prophesize(RequestHandlerInterface::class);
        $handler->handle(new AnyValueToken())->willReturn($response->reveal());

        $route = $this->route->withRequestHandler($handler->reveal())
            ->withMethods(['GET']);
        $this->assertNotSame($this->route, $route);

        $route->handle($request->reveal());
    }
}

Add test for prefix handling

Add test for prefix handling


<?php

namespace Lawstands\Hermes;

/**
 * Created by BrainMaestro
 * Date: 28/1/2017
 * Time: 2:20 PM
 */
class Channel
{
    /**
     * @var array
     */
    private $receivers = [];

    /**
     * Channel constructor.
     *
     * @param array $receivers
     */
    public function __construct(array $receivers)
    {
        foreach ($receivers as $receiver) {
            if ($this->isValid($receiver)) {
                $this->receivers[] = $receiver;
            }
        }
    }

    /**
     * Get all receivers.
     *
     * @return array
     */
    public function getReceivers()
    {
        return $this->receivers;
    }

    /**
     * Validate receivers.
     *
     * @param $receiver
     * @return bool
     */
    private function isValid($receiver)
    {
        return file_exists($receiver);
    }
}

<?php

namespace Lawstands\Hermes;

/**
 * Created by BrainMaestro
 * Date: 28/1/2017
 * Time: 2:20 PM
 */
class Channel
{
    /**
     * format: extension => program
     * @var array
     */
    private static $types = [
            'rb' => 'ruby',
            'py' => 'python',
        ];

    /**
     * Validate channels.
     *
     * @param array $channels
     * @return array
     */
    public static function validate(array $channels)
    {
        // create an array of valid channels.
        // the array filter removes the null elements which are
        // the invalid channels.
        return array_filter(array_map(function ($channel) {
            $channel['type'] = self::getType($channel);

            return self::isValid($channel) ? $channel : null;
        }, $channels));
    }

    /**
     * Validate channels.
     *
     * @param $channel
     * @return bool
     */
    private static function isValid($channel)
    {
        return file_exists($channel['path']);
    }

    /**
     * Get a channel's type.
     *
     * @param $channel
     * @return void
     */
    private static function getType($channel)
    {
        if ($channel['type']) {
            return $channel['type'];
        }

        $extension = pathinfo($channel, PATHINFO_EXTENSION);
        // choose type if it was found in the types map
        // or use extension as the type.
        return array_key_exists($extension, self::$types) ? self::$types[$extension] : $extension;
    }
}

Update channel to use static functions

Update channel to use static functions


<?php

namespace eig\EloquentUUID\Tests;

use Apostle\PHPUnit\TestCase;
use eig\EloquentUUID\UUIDModel;

/**
 * Class EloquentUUIDTest
 * @package eig\EloquentUUID\Tests
 * @license MIT
 * @author James Johnson
 * @author Excellent InGenuity LLC
 */
class EloquentUUIDTest extends TestCase
{

    /**
     * testHasUUID
     */
    public function testHasUUID()
    {
        $model = new UUIDModel();
        $this->assertUuid($model->id);
    }
}

<?php

namespace eig\EloquentUUID\Tests;

use PHPUnit\Framework\TestCase;
use eig\EloquentUUID\UUIDModel;
use Apostle\PHPUnit\Constraint\String\IsUuid;

/**
 * Class EloquentUUIDTest
 * @package eig\EloquentUUID\Tests
 * @license MIT
 * @author James Johnson
 * @author Excellent InGenuity LLC
 */
class EloquentUUIDTest extends TestCase
{
    /**
     * testHasUUID
     */
    public function testHasUUID()
    {
        $model = new UUIDModel();
        $this->assertUuid($model->id);
    }

    /**
     * functions added because of a lack of support for PHP 7
     * by the phpunit-validation package that checks the UUID
     * if support is added in the package these functions will not
     * be necessary.
     */
    public function assertUuid($value, $strict = false, array $versions = array(1, 2, 3, 4, 5), $message = '')
    {
        self::assertThat($value, self::isUuid($strict, $versions), $message);
    }

    public static function isUuid($strict = false, array $versions = array(1, 2, 3, 4, 5))
    {
        return new IsUuid($strict, $versions);
    }

}

Update of the test to support PHP 7

Update of the test to support PHP 7

Manually used some functions from the phpunit-validation package within
the test because full PHP 7 support is not available from the package
as it has some name conflicts with reserved words.


<?php

namespace duncan3dc\DomParser;

trait Element
{
    public function __get($key)
    {
        $value = $this->dom->$key;

        switch ($key) {

            case "parentNode":
                return $this->newElement($value);

            case "nodeValue":
                return trim($value);
        }

        return $value;
    }

    public function nodeValue($value)
    {
        $this->dom->nodeValue = "";

        $node = $this->dom->ownerDocument->createTextNode($value);

        $this->dom->appendChild($node);
    }

    public function getAttribute($name)
    {
        return $this->dom->getAttribute($name);
    }

    public function setAttribute($name, $value)
    {
        return $this->dom->setAttribute($name, $value);
    }

    public function getAttributes()
    {
        $attributes = [];
        foreach ($this->dom->attributes as $attr) {
            $attributes[$attr->name] = $attr->value;
        }
        return $attributes;
    }
}

<?php

namespace duncan3dc\DomParser;

trait Element
{
    public function __toString()
    {
        return $this->nodeValue;
    }

    public function __get($key)
    {
        $value = $this->dom->$key;

        switch ($key) {

            case "parentNode":
                return $this->newElement($value);

            case "nodeValue":
                return trim($value);
        }

        return $value;
    }

    public function nodeValue($value)
    {
        $this->dom->nodeValue = "";

        $node = $this->dom->ownerDocument->createTextNode($value);

        $this->dom->appendChild($node);
    }

    public function getAttribute($name)
    {
        return $this->dom->getAttribute($name);
    }

    public function setAttribute($name, $value)
    {
        return $this->dom->setAttribute($name, $value);
    }

    public function getAttributes()
    {
        $attributes = [];
        foreach ($this->dom->attributes as $attr) {
            $attributes[$attr->name] = $attr->value;
        }
        return $attributes;
    }
}

Allow elements to be cast to strings

Allow elements to be cast to strings

This returns their nodeValue, and is useful to avoid checking that an element exists
before attempting to get it's nodeValue


<?php

namespace App\Http\Controllers\Api;

use App\LaraBin\Helpers\UserCache;
use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

class UserController extends Controller
{
    public function __construct(UserCache $userCache)
    {
        $this->userCache = $userCache;
    }

    public function search(Request $request)
    {
        $query = $request->input('q');
        $users = $this->userCache->usernames();
        $found = array_filter($users, function($users) use ($query) {
            return ( strpos($users, $query) !== false );
        });
        $usernames = array_values($found);

        return response()->json($usernames, 200);
    }
}

<?php

namespace App\Http\Controllers\Api;

use App\LaraBin\Helpers\UserCache;
use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

class UserController extends Controller
{
    public function __construct(UserCache $userCache)
    {
        $this->userCache = $userCache;
    }

    public function search(Request $request)
    {
        $query = $request->input('q');
        $users = $this->userCache->usernames();
        $found = array_filter($users, function($users) use ($query) {
            return ( stripos($users, $query) !== false );
        });
        $usernames = array_values($found);

        return response()->json($usernames, 200);
    }
}

Make usertagging in comments case insensitive


<?php

class Bundler {

	private function sort( &$array ) {
		// We have to ignore the error here (use @usort)
		// otherwise this code fails when executed by unit tests
		// See: https://bugs.php.net/bug.php?id=50688

		// phpcs:ignore Generic.PHP.NoSilencedErrors
		@usort( $array, static function ( Bundleable $a, Bundleable $b ) {
			return strcmp( $b->getSortingKey(), $a->getSortingKey() );
		} );
	}

	/**
	 * Bundle bundleable elements that can be bundled by their bundling keys
	 *
	 * @param Bundleable[] $bundleables
	 * @return Bundleable[] Grouped notifications sorted by timestamp DESC
	 */
	public function bundle( array $bundleables ) {
		$groups = [];
		$bundled = [];

		/** @var Bundleable $element */
		foreach ( $bundleables as $element ) {
			if ( $element->canBeBundled() && $element->getBundlingKey() ) {
				$groups[ $element->getBundlingKey() ][] = $element;
			} else {
				$bundled[] = $element;
			}
		}

		foreach ( $groups as $bundlingKey => $group ) {
			$this->sort( $group );
			/** @var Bundleable $base */
			$base = array_shift( $group );
			$base->setBundledElements( $group );
			$bundled[] = $base;
		}

		$this->sort( $bundled );
		return $bundled;
	}

}

<?php

class Bundler {

	private function sort( &$array ) {
		usort( $array, static function ( Bundleable $a, Bundleable $b ) {
			return strcmp( $b->getSortingKey(), $a->getSortingKey() );
		} );
	}

	/**
	 * Bundle bundleable elements that can be bundled by their bundling keys
	 *
	 * @param Bundleable[] $bundleables
	 * @return Bundleable[] Grouped notifications sorted by timestamp DESC
	 */
	public function bundle( array $bundleables ) {
		$groups = [];
		$bundled = [];

		/** @var Bundleable $element */
		foreach ( $bundleables as $element ) {
			if ( $element->canBeBundled() && $element->getBundlingKey() ) {
				$groups[ $element->getBundlingKey() ][] = $element;
			} else {
				$bundled[] = $element;
			}
		}

		foreach ( $groups as $bundlingKey => $group ) {
			$this->sort( $group );
			/** @var Bundleable $base */
			$base = array_shift( $group );
			$base->setBundledElements( $group );
			$bundled[] = $base;
		}

		$this->sort( $bundled );
		return $bundled;
	}

}

Remove probably outdated error suppression

https://bugs.php.net/bug.php?id=50688 was closed as fixed
in 2017 when PHP 7.0 was only supported upstream.
We already require PHP 7.2.

Change-Id: Ie9801e38915da634e31c91ebdcb61226e0ae5712


<?php
/**
 * This file is part of the French Language Pack for Flarum.
 *
 * @author Maël Soucaze <https://www.maelsoucaze.com>
 * @license https://opensource.org/licenses/MIT MIT License
 *
 * For the full copyright and license information, please view the
 * LICENSE file that was distributed with this source code.
 */
use Flarum\Event\ConfigureLocales;
use Illuminate\Contracts\Events\Dispatcher;

return function (Dispatcher $events) {
    $events->listen(ConfigureLocales::class, function (ConfigureLocales $event) {
        $name = $title = basename(__DIR__);

        if (file_exists($manifest = __DIR__.'/composer.json')) {
            $json = json_decode(file_get_contents($manifest), true);

            if (empty($json)) {
                throw new RuntimeException("Error parsing composer.json in $name: ".json_last_error_msg());
            }

            $locale = array_get($json, 'extra.flarum-locale.code');
            $title = array_get($json, 'extra.flarum-locale.title', $title);
        }

        if (!isset($locale)) {
            throw new RuntimeException("Language pack $name must define \"extra.flarum-locale.code\" in composer.json");
        }

        $event->locales->addLocale($locale, $title);

        if (!is_dir($localeDir = __DIR__.'/locale')) {
            throw new RuntimeException("Language pack $name must have a \"locale\" subdirectory");
        }

        if (file_exists($file = $localeDir.'/config.js')) {
            $event->locales->addJsFile($locale, $file);
        }

        foreach (new DirectoryIterator($localeDir) as $file) {
            if ($file->isFile() && in_array($file->getExtension(), ['yml', 'yaml'])) {
                $event->locales->addTranslations($locale, $file->getPathname());
            }
        }
    });
};

<?php
/**
 * This file is part of the French Language Pack for Flarum.
 *
 * @author Maël Soucaze <https://www.maelsoucaze.com>
 * @license https://opensource.org/licenses/MIT MIT License
 *
 * For the full copyright and license information, please view the
 * LICENSE file that was distributed with this source code.
 */
use Flarum\Event\ConfigureLocales;
use Illuminate\Contracts\Events\Dispatcher;

return function (Dispatcher $events) {
    $events->listen(ConfigureLocales::class, function (ConfigureLocales $event) {
        $event->loadLanguagePackFrom(__DIR__);
    });
};

Use new language pack helper.

Use new language pack helper.


<?php

if ( is_category() || is_home() ) :

	$queried_object = get_queried_object();

	if ( get_field( 'header_image', $queried_object ) ) :

		get_template_part('templates/archive', 'hero');

	endif;

else : ?>

				<?php get_template_part('templates/page', 'header'); ?>

<?php endif; ?>

<?php if (!have_posts()) : ?>

    <?php _e('Sorry, no results were found.', 'sage'); ?>

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

<?php while (have_posts()) : the_post(); ?>

	<?php get_template_part('templates/content', get_post_type() != 'post' ? get_post_type() : get_post_format()); ?>

<?php endwhile; ?>

<?php the_posts_navigation(); ?>

<?php

if ( is_category() || is_home() ) :

	$queried_object = get_queried_object();

	if ( get_field( 'header_image', $queried_object ) ) :

		get_template_part('templates/archive', 'hero');

	endif;

else : ?>

				<?php get_template_part('templates/page', 'header'); ?>

<?php endif; ?>

				<?php echo(get_post_field('post_content',10)); ?>

<?php if (!have_posts()) : ?>

    <?php _e('Sorry, no results were found.', 'sage'); ?>

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

<?php while (have_posts()) : the_post(); ?>

	<?php get_template_part('templates/content', get_post_type() != 'post' ? get_post_type() : get_post_format()); ?>

<?php endwhile; ?>

<?php the_posts_navigation(); ?>

Make page content show on posts page with page ID


<?php include_stylesheets_for_form($form) ?>
<?php include_javascripts_for_form($form) ?>

<span id="sympal_content_slot_<?php echo $contentSlot->getId() ?>_editor_form" class="sympal_<?php echo sfInflector::tableize($contentSlot->getType()) ?>_content_slot_editor_form">
  <?php echo $form->renderHiddenFields() ?>

  <?php if ($contentSlot->getIsColumn()): ?>
    <?php if (sfSympalConfig::isI18nEnabled('sfSympalContentSlot') && !isset($form[$contentSlot->getName()])): ?>
      <?php echo $form[$sf_user->getCulture()][$contentSlot->getName()] ?>
    <?php else: ?>
      <?php echo $form[$contentSlot->getName()] ?>
    <?php endif; ?>
  <?php else: ?>
    <?php if (sfSympalConfig::isI18nEnabled('sfSympalContentSlot')): ?>
      <?php echo $form[$sf_user->getCulture()]['value'] ?>
    <?php else: ?>
      <?php echo $form['value'] ?>
    <?php endif; ?>
  <?php endif; ?>
</span>

<script type="text/javascript">
$('#sympal_content_slot_<?php echo $contentSlot->getId() ?>_editor_form textarea').markItUp(mySettings);
$('#sympal_content_slot_<?php echo $contentSlot->getId() ?>_editor_form').elastic();
</script>

<?php include_stylesheets_for_form($form) ?>
<?php include_javascripts_for_form($form) ?>

<span id="sympal_content_slot_<?php echo $contentSlot->getId() ?>_editor_form" class="sympal_<?php echo sfInflector::tableize($contentSlot->getType()) ?>_content_slot_editor_form">
  <?php echo $form->renderHiddenFields() ?>

  <?php if ($contentSlot->getIsColumn()): ?>
    <?php if (sfSympalConfig::isI18nEnabled('sfSympalContentSlot') && !isset($form[$contentSlot->getName()])): ?>
      <?php echo $form[$sf_user->getCulture()][$contentSlot->getName()] ?>
    <?php else: ?>
      <?php echo $form[$contentSlot->getName()] ?>
    <?php endif; ?>
  <?php else: ?>
    <?php if (sfSympalConfig::isI18nEnabled('sfSympalContentSlot')): ?>
      <?php echo $form[$sf_user->getCulture()]['value'] ?>
    <?php else: ?>
      <?php echo $form['value'] ?>
    <?php endif; ?>
  <?php endif; ?>
</span>

<script type="text/javascript">

<?php if ($contentSlot->getType() == 'Markdown'): ?>
$('#sympal_content_slot_<?php echo $contentSlot->getId() ?>_editor_form textarea').markItUp(mySettings);
<?php endif; ?>

$('#sympal_content_slot_<?php echo $contentSlot->getId() ?>_editor_form textarea').elastic();
</script>

[1.4][sfSympalPlugin][0.7] Fix so we only enable markdown editor for Markdown slot types

git-svn-id: a12887034337be3812df6d060455f26cce89a7aa@25946 ee427ae8-e902-0410-961c-c3ed070cd9f9


<?php

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

use Doctrine\Common\Annotations\AnnotationRegistry;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;

// Detect if we need to serialize deprecations to a file.
if ($file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
    DeprecationErrorHandler::collectDeprecations($file);

    return;
}

// Detect if we're loaded by an actual run of phpunit
if (!defined('PHPUNIT_COMPOSER_INSTALL') && !class_exists('PHPUnit\TextUI\Command', false)) {
    return;
}

// Enforce a consistent locale
setlocale(\LC_ALL, 'C');

if (!class_exists('Doctrine\Common\Annotations\AnnotationRegistry', false) && class_exists('Doctrine\Common\Annotations\AnnotationRegistry')) {
    if (method_exists('Doctrine\Common\Annotations\AnnotationRegistry', 'registerUniqueLoader')) {
        AnnotationRegistry::registerUniqueLoader('class_exists');
    } else {
        AnnotationRegistry::registerLoader('class_exists');
    }
}

if ('disabled' !== getenv('SYMFONY_DEPRECATIONS_HELPER')) {
    DeprecationErrorHandler::register(getenv('SYMFONY_DEPRECATIONS_HELPER'));
}

<?php

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

use Doctrine\Common\Annotations\AnnotationRegistry;
use Symfony\Bridge\PhpUnit\DeprecationErrorHandler;

// Detect if we need to serialize deprecations to a file.
if ($file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) {
    DeprecationErrorHandler::collectDeprecations($file);

    return;
}

// Detect if we're loaded by an actual run of phpunit
if (!defined('PHPUNIT_COMPOSER_INSTALL') && !class_exists(\PHPUnit\TextUI\Command::class, false)) {
    return;
}

// Enforce a consistent locale
setlocale(\LC_ALL, 'C');

if (!class_exists(AnnotationRegistry::class, false) && class_exists(AnnotationRegistry::class)) {
    if (method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
        AnnotationRegistry::registerUniqueLoader('class_exists');
    } else {
        AnnotationRegistry::registerLoader('class_exists');
    }
}

if ('disabled' !== getenv('SYMFONY_DEPRECATIONS_HELPER')) {
    DeprecationErrorHandler::register(getenv('SYMFONY_DEPRECATIONS_HELPER'));
}

Use ::class keyword when possible

Use ::class keyword when possible


<?php
namespace ProjectLint\ExpressionLanguage;

use Symfony\Component\ExpressionLanguage\ExpressionLanguage as BaseExpressionLanguage;

class ExpressionLanguage extends BaseExpressionLanguage
{
    protected function registerFunctions()
    {
        parent::registerFunctions();

        $this->register('lowercase', function ($str) {
                return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str);
            }, function ($arguments, $str) {
                if (!is_string($str)) {
                    return $str;
                }

                return strtolower($str);
            });
    }
}

Fix a coding style violation

Fix a coding style violation


<?php

namespace Dock\System\Environ;

use Dock\IO\ProcessRunner;
use Symfony\Component\Process\Process;

class BashEnvironManipulator implements EnvironManipulator
{
    /**
     * @var string
     */
    private $file;
    /**
     * @var ProcessRunner
     */
    private $processRunner;

    /**
     * @param string $file
     */
    public function __construct(ProcessRunner $processRunner, $file)
    {
        $this->file = $file;
        $this->processRunner = $processRunner;
    }

    /**
     * {@inheritdoc}
     */
    public function save(EnvironmentVariable $environmentVariable)
    {
        $command = 'echo "'.$environmentVariable->getName().'='.$environmentVariable->getValue().'" >> '.$this->file;
        $process = new Process($command);

        $this->processRunner->run($process);
    }

    /**
     * {@inheritdoc}
     */
    public function has(EnvironmentVariable $environmentVariable)
    {
        $process = $this->processRunner->run(
            new Process("grep {$environmentVariable->getName()} $this->file"),
            false
        );

        $result = $process->getOutput();

        return !empty($result);
    }
}

<?php

namespace Dock\System\Environ;

use Dock\IO\ProcessRunner;
use Symfony\Component\Process\Process;

class BashEnvironManipulator implements EnvironManipulator
{
    /**
     * @var string
     */
    private $file;
    /**
     * @var ProcessRunner
     */
    private $processRunner;

    /**
     * @param string $file
     */
    public function __construct(ProcessRunner $processRunner, $file)
    {
        $this->file = $file;
        $this->processRunner = $processRunner;
    }

    /**
     * {@inheritdoc}
     */
    public function save(EnvironmentVariable $environmentVariable)
    {
        $command = 'echo "' . $environmentVariable->getName() . '=' . $environmentVariable->getValue(
            ) . '" >> ' . $this->file;
        $process = new Process($command);

        $this->processRunner->run($process);
    }

    /**
     * {@inheritdoc}
     */
    public function has(EnvironmentVariable $environmentVariable)
    {
        $process = $this->processRunner->run(
            new Process(sprintf('grep %s %s', $environmentVariable->getName(), $this->file)),
            false
        );

        $result = $process->getOutput();

        return !empty($result);
    }
}

Use sprintf for string construction

Use sprintf for string construction


<?php
namespace CodeDay\Clear\Http\Controllers\Api;

use \CodeDay\Clear\Models;
use \CodeDay\Clear\ModelContracts;

class TokenController extends ApiController {
    public function getToken()
    {
    	$user = Models\User::fromToken(\Route::input('token'));

        if(isset($user)){
        	return json_encode(ModelContracts\Registration::Model($user, ["internal"]));
       	}else{
       		\App::abort(403);
       	}
    }
}

<?php
namespace CodeDay\Clear\Http\Controllers\Api;

use \CodeDay\Clear\Models;
use \CodeDay\Clear\ModelContracts;

class TokenController extends ApiController {
    public function getToken()
    {
    	$user = Models\User::fromToken(\Input::get('token'));

        if(isset($user)){
        	return json_encode(ModelContracts\Registration::Model($user, ["internal"]));
       	}else{
       		\App::abort(403);
       	}
    }
}

Change route param to GET or POST param

Change route param to GET or POST param


<?php namespace Pixiu\Commerce\Classes;

use Pixiu\Commerce\Models\CommerceSettings;

class CurrencyHandler
{
    public $currencySymbol;
    public $decimalSymbol;
    public $format;

    /**
     * CurrencyHandler constructor.
     * @param $currencySymbol
     * @param $decimalSymbol
     * @param $format
     */
    public function __construct()
    {
        $this->currencySymbol = CommerceSettings::get('currency');
        $this->decimalSymbol = CommerceSettings::get('decimalSymbol');
        $this->format = "%n %s";
    }

    public function getValueFromInput($input) : int
    {
        return (int) str_replace(' ', '', str_replace($this->decimalSymbol, '', substr($input, 0, -3)));
    }

    public function getValueForInput($value) : float
    {
        return ($value / 100);
    }

}

<?php namespace Pixiu\Commerce\Classes;

use Pixiu\Commerce\Models\CommerceSettings;

class CurrencyHandler
{
    public $currencySymbol;
    public $decimalSymbol;
    public $format;

    /**
     * CurrencyHandler constructor.
     * @param $currencySymbol
     * @param $decimalSymbol
     * @param $format
     */
    public function __construct()
    {
        $this->currencySymbol = CommerceSettings::get('currency');
        $this->decimalSymbol = CommerceSettings::get('decimalSymbol');
        $this->format = "%n %s";
    }

    public function getValueFromInput($input) : int
    {

        return (int) str_replace(' ', '', str_replace($this->decimalSymbol, '', substr($input, 0, -(strlen($this->currencySymbol)+1))));
    }

    public function getValueForInput($value) : float
    {
        return ($value / 100);
    }

}

Fix bug with currency symbol

Fix bug with currency symbol


<?php $formattedDate = $context->getDateTime()->format('l, F jS'); ?>

    <?php echo $formattedDate ?>
    <a class="permalink" href="<?php echo $context->getURL(); ?>" title="permalink">
    <a title="ics format for events on <?php echo $formattedDate ?>" href="<?php echo $context->getURL() ?>.ics">

    <a class="url prev" href="<?php echo $context->getPreviousDay()->getURL(); ?>">Previous Day
    <a class="url next" href="<?php echo $context->getNextDay()->getURL(); ?>">Next Day

<?php echo $savvy->render($context, 'EventListing.tpl.php'); ?>

<?php $formattedDate = $context->getDateTime()->format('l, F j'); ?>
<h1 class="day-heading" data-datetime="<?php echo $context->getDateTime()->format('c') ?>">
    <?php echo $formattedDate ?>
    <a class="permalink" href="<?php echo $context->getURL(); ?>" title="permalink">
    <a title="ics format for events on <?php echo $formattedDate ?>" href="<?php echo $context->getURL() ?>.ics">

    <a class="url prev" href="<?php echo $context->getPreviousDay()->getURL(); ?>">Previous Day
    <a class="url next" href="<?php echo $context->getNextDay()->getURL(); ?>">Next Day

<?php echo $savvy->render($context, 'EventListing.tpl.php'); ?>

Remove the day suffix from day heading

Remove the day suffix from day heading

Closes #78


@component('mail::message')

# Hi Name!

Thanks for using [Product Name]. This is an invoice for your recent purchase.

@component('mail::invoice.attributes', ['total' => $total, 'dueDate' => $dueDate])
Amout Due: ${{ $total }}
Due By: {{ $dueDate }}
@endcomponent

@component('mail::button', ['url' => 'http://laravel.com', 'color' => 'green'])
Pay this invoice
@endcomponent

@endcomponent

@component('mail::message')

# Hi {{ $name }}!

Thanks for using {{ config('app.name') }}. This is an invoice for your recent purchase.

@component('mail::invoice.attributes', ['total' => $total, 'dueDate' => $dueDate])

@endcomponent

@component('mail::button', ['url' => 'http://laravel.com', 'color' => 'green'])
Pay this invoice
@endcomponent

@component('mail::invoice.table', ['data' => $tableData])

@endcomponent

@endcomponent

Add the table to the template

Add the table to the template


</div>
<!-- /.login-box -->

<!-- jQuery 2.2.3 -->
<script src="plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- iCheck -->
<script src="plugins/iCheck/icheck.min.js"></script>
<script>
  $(function () {
    $('input').iCheck({
      checkboxClass: 'icheckbox_square-blue',
      radioClass: 'iradio_square-blue',
      increaseArea: '20%' // optional
    });
  });
</script>
</body>
</html>

</div>
<!-- /.login-box -->

<!-- jQuery 2.2.3 -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- iCheck -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/iCheck/1.0.2/icheck.min.js"></script>
<script>
  $(function () {
    $('input').iCheck({
      checkboxClass: 'icheckbox_square-blue',
      radioClass: 'iradio_square-blue',
      increaseArea: '20%' // optional
    });
  });
</script>
</body>
</html>

Move iCheck and jQuery libs to CDN

Move iCheck and jQuery libs to CDN


<?php

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

namespace App\Console\Commands;

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

abstract class SilentEnabledCommand extends Command
{
    public function info($string)
    {
        if (!$this->option('silent')) {
            parent::info($string);
        }
    }

    public function comment($string)
    {
        if (!$this->option('silent')) {
            parent::comment($string);
        }
    }

    public function getOptions()
    {
        return [
            ['silent', null, InputOption::VALUE_NONE, 'Silence the output from the function', null],
        ];
    }
}

<?php

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

namespace App\Console\Commands;

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

abstract class SilentEnabledCommand extends Command
{
    public function info($string, $verbosity = null)
    {
        if (!$this->option('silent')) {
            parent::info($string);
        }
    }

    public function comment($string, $verbosity = null)
    {
        if (!$this->option('silent')) {
            parent::comment($string);
        }
    }

    public function getOptions()
    {
        return [
            ['silent', null, InputOption::VALUE_NONE, 'Silence the output from the function', null],
        ];
    }
}

Fix incorrect override function signatures


<?php

declare(strict_types=1);

namespace Cortex\Foundation\Http\Controllers;

use Illuminate\Routing\Controller;
use Rinvex\Fort\Traits\GetsMiddleware;
use Illuminate\Foundation\Bus\DispatchesJobs;

abstract class AbstractController extends Controller
{
    use GetsMiddleware;
    use DispatchesJobs;

    /**
     * The browsing area.
     *
     * @var string
     */
    protected $browsingArea;

    /**
     * Whitelisted methods.
     * Array of whitelisted methods which do not need to go through middleware.
     *
     * @var array
     */
    protected $middlewareWhitelist = [];

    /**
     * The broker name.
     *
     * @var string
     */
    protected $broker;

    /**
     * Create a new abstract controller instance.
     */
    public function __construct()
    {
        $this->browsingArea = request()->route() ? mb_strstr(request()->route()->getName(), '.', true) : 'frontend';
    }

    /**
     * Get the broker to be used.
     *
     * @return string
     */
    protected function getBroker()
    {
        return $this->broker;
    }
}

<?php

declare(strict_types=1);

namespace Cortex\Foundation\Http\Controllers;

use Illuminate\Routing\Controller;
use Rinvex\Fort\Traits\GetsMiddleware;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

abstract class AbstractController extends Controller
{
    use GetsMiddleware;
    use DispatchesJobs;
    use ValidatesRequests;
    use AuthorizesRequests;

    /**
     * The browsing area.
     *
     * @var string
     */
    protected $browsingArea;

    /**
     * Whitelisted methods.
     * Array of whitelisted methods which do not need to go through middleware.
     *
     * @var array
     */
    protected $middlewareWhitelist = [];

    /**
     * The broker name.
     *
     * @var string
     */
    protected $broker;

    /**
     * Create a new abstract controller instance.
     */
    public function __construct()
    {
        $this->browsingArea = request()->route() ? mb_strstr(request()->route()->getName(), '.', true) : 'frontend';
    }

    /**
     * Get the broker to be used.
     *
     * @return string
     */
    protected function getBroker()
    {
        return $this->broker;
    }
}

Add request validation and authorization functionality for controllers


<?php
/*
 * Copyright 2013 Pierre Schmitz <pierre@archlinux.de>
 *
 * Licensed under AGPLv3
 * (see COPYING for full license text)
 *
 */

abstract class Ddownload_Driver extends CI_Driver {

	abstract public function serveFile($file, $filename, $type);
}

class Ddownload extends CI_Driver_Library {

	protected $_adapter = null;

	protected $valid_drivers = array(
		'ddownload_php', 'ddownload_nginx', 'ddownload_lighttpd'
	);

	function __construct()
	{
		$CI =& get_instance();

		$this->_adapter = $CI->config->item('download_driver');
	}

	public function serveFile($file, $filename, $type)
	{
		$this->{$this->_adapter}->serveFile($file, $filename, $type);
	}
}

<?php
/*
 * Copyright 2013 Pierre Schmitz <pierre@archlinux.de>
 *
 * Licensed under AGPLv3
 * (see COPYING for full license text)
 *
 */

abstract class Ddownload_Driver extends CI_Driver {

	abstract public function serveFile($file, $filename, $type);
}

class Ddownload extends CI_Driver_Library {

	protected $_adapter = null;

	protected $valid_drivers = array(
		'php', 'nginx', 'lighttpd'
	);

	function __construct()
	{
		$CI =& get_instance();

		$this->_adapter = $CI->config->item('download_driver');
	}

	public function serveFile($file, $filename, $type)
	{
		$this->{$this->_adapter}->serveFile($file, $filename, $type);
	}
}

Fix download driver for CI3

Fix download driver for CI3

Signed-off-by: Florian Pritz <753f544d2d01592750fb4bd29251b78abcfc8ecd@xinu.at>


<?php
namespace Ob_Ivan\DropboxProxy;

use Ob_Ivan\DropboxProxy\ResourceProvider\DropboxResourceProvider;
use Ob_Ivan\ResourceContainer\ResourceContainer;

class ToolboxFactory
{
    /**
     * TODO: Replace $storagePath argument with a substitution array.
     *
     *  @param  string  $configPath
     *  @param  string  $storagePath    null
     *  @return ResourceContainer
    **/
    public static function getToolbox($configPath, $storagePath = null)
    {
        $config = json_decode(file_get_contents($configPath), true);
        $container = new ResourceContainer();
        $container->importProvider(new DropboxResourceProvider());
        $container->importValues($config);
        if ($storagePath) {
            $container['filesystem.storage'] = $storagePath;
        }
        return $container;
    }
}

<?php
namespace Ob_Ivan\DropboxProxy;

use Ob_Ivan\DropboxProxy\ResourceProvider\CacheResourceProvider;
use Ob_Ivan\DropboxProxy\ResourceProvider\DropboxResourceProvider;
use Ob_Ivan\ResourceContainer\ResourceContainer;

class ToolboxFactory
{
    /**
     * TODO: Replace $storagePath argument with a substitution array.
     *
     *  @param  string  $configPath
     *  @param  string  $storagePath    null
     *  @return ResourceContainer
    **/
    public static function getToolbox($configPath, $storagePath = null)
    {
        $config = json_decode(file_get_contents($configPath), true);
        $container = new ResourceContainer();
        $container->importProvider(new CacheResourceProvider());
        $container->importProvider(new DropboxResourceProvider());
        $container->importValues($config);
        if ($storagePath) {
            $container['filesystem.storage'] = $storagePath;
        }
        return $container;
    }
}

Add cache resource provider to toolbox

Add cache resource provider to toolbox


<?php

namespace ZfcTwig\Service;

use ZfcTwig\View\Renderer;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\View\Resolver\TemplatePathStack;

class ViewRendererFactory implements FactoryInterface
{
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('Configuration');
        $config = $config['zfctwig'];

        $pathResolver = $serviceLocator->get('ViewTemplatePathStack');
        $pathResolver->setDefaultSuffix($config['suffix']);
        $resolver = $serviceLocator->get('ViewResolver');

        $renderer = new Renderer();
        $renderer->setEngine($serviceLocator->get('TwigEnvironment'));
        $renderer->setResolver($resolver);

        return $renderer;
    }
}

<?php

namespace ZfcTwig\Service;

use ZfcTwig\View\Renderer;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\View\Resolver\TemplatePathStack;

class ViewRendererFactory implements FactoryInterface
{
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('Configuration');
        $config = $config['zfctwig'];

        $pathResolver = $serviceLocator->get('ViewTemplatePathStack');
        $pathResolver->setDefaultSuffix($config['suffix']);
        $resolver = $serviceLocator->get('ViewResolver');

        $renderer = new Renderer();

        $engine = $serviceLocator->get('TwigEnvironment');
        $engine->manager()->setRenderer($renderer);

        $renderer->setEngine($engine);
        $renderer->setResolver($resolver);

        return $renderer;
    }
}

Set the Renderer in the View Helper Manager

This would have been done in the EngineFactory - however - that creates
a circular dependency.


<?php

namespace RCatlin\Blog\Test\Integration\Controller\Api;

use League\FactoryMuffin\Facade as FactoryMuffin;
use RCatlin\Blog\Entity;
use RCatlin\Blog\Test\CreatesGuzzleStream;
use RCatlin\Blog\Test\HasFaker;
use RCatlin\Blog\Test\Integration\AbstractIntegrationTest;
use RCatlin\Blog\Test\LoadsFactoryMuffinFactories;
use RCatlin\Blog\Test\ReadsResponseContent;

class ArticleControllerGetMostRecentTest extends AbstractIntegrationTest
{
    use CreatesGuzzleStream;
    use HasFaker;
    use LoadsFactoryMuffinFactories;
    use ReadsResponseContent;

    public function testGetMostRecent()
    {
        /** @var Entity\Article $article0 */
        $article0 = FactoryMuffin::create(Entity\Article::class, [
            'active' => true,
            'createdAt' => 'dateTimeBetween|-3 days;-2 days',
            'tagCount' => 0,
        ]);

        /** @var Entity\Article $article1 */
        $article1 = FactoryMuffin::create(Entity\Article::class, [
            'active' => true,
            'createdAt' => 'dateTimeBetween|-1 day;now',
            'tagCount' => 0,
        ]);

        $response = $this->client->get('/api/articles/mostrecent');

        $this->assertSame(200, $response->getStatusCode());

        $content = json_decode($this->readResponse($response), true);

        $this->assertSame($article1->getId(), $content['result']['data']['id']);
    }
}

<?php

namespace RCatlin\Blog\Test\Integration\Controller\Api;

use League\FactoryMuffin\Facade as FactoryMuffin;
use RCatlin\Blog\Entity;
use RCatlin\Blog\Test\Integration\AbstractIntegrationTest;
use RCatlin\Blog\Test\LoadsFactoryMuffinFactories;
use RCatlin\Blog\Test\ReadsResponseContent;

class ArticleControllerGetMostRecentTest extends AbstractIntegrationTest
{
    use LoadsFactoryMuffinFactories;
    use ReadsResponseContent;

    public function testGetMostRecent()
    {
        /** @var Entity\Article $article0 */
        $article0 = FactoryMuffin::create(Entity\Article::class, [
            'active' => true,
            'createdAt' => 'dateTimeBetween|-3 days;-2 days',
            'tagCount' => 0,
        ]);

        /** @var Entity\Article $article1 */
        $article1 = FactoryMuffin::create(Entity\Article::class, [
            'active' => true,
            'createdAt' => 'dateTimeBetween|-1 day;now',
            'tagCount' => 0,
        ]);

        $response = $this->client->get('/api/articles/mostrecent');

        $this->assertSame(200, $response->getStatusCode());

        $content = json_decode($this->readResponse($response), true);

        $this->assertSame($article1->getId(), $content['result']['data']['id']);
    }
}

Remove unused traits in Article Get Most Recent Integration Test


@if (count($breadcrumbs))

        @foreach ($breadcrumbs as $breadcrumb)

            @if ($breadcrumb->url && ! $loop->last)

url }}">{{ $breadcrumb->title }}

            @else

{{ $breadcrumb->title }}

            @endif

        @endforeach

@endif

@if (count($breadcrumbs))

        @foreach ($breadcrumbs as $breadcrumb)

            @if ($breadcrumb->url && ! $loop->last)

url }}">{!! $breadcrumb->title !!}

            @else

{!! $breadcrumb->title !!}

            @endif

        @endforeach

@endif

Revert back breadcrumbs escaping, this is handled individually as we may pass HTML intentionally


<?php namespace Anomaly\RelationshipFieldType\Handler;

use Anomaly\RelationshipFieldType\RelationshipFieldType;

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

    /**
     * Handle the options.
     *
     * @param  RelationshipFieldType $fieldType
     * @return array
     */
    public function handle(RelationshipFieldType $fieldType)
    {
        $model = $fieldType->getRelatedModel();

        $query = $model->newQuery();

        $fieldType->setOptions(
            $query->get()->pluck(
                $model->getTitleName(),
                $model->getKeyName()
            )->all()
        );
    }
}

<?php namespace Anomaly\RelationshipFieldType\Handler;

use Anomaly\RelationshipFieldType\RelationshipFieldType;

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

    /**
     * Handle the options.
     *
     * @param  RelationshipFieldType $fieldType
     * @return array
     */
    public function handle(RelationshipFieldType $fieldType)
    {
        $model = $fieldType->getRelatedModel();

        $query = $model->newQuery();

        $fieldType->setOptions(
            $query->get()->pluck(
                $fieldType->config('title_name', $model->getTitleName()),
                $fieldType->config('key_name', $model->getKeyName())
            )->all()
        );
    }
}

Add support for key/title value back in.


<?php

/*
|--------------------------------------------------------------------------
| Register Namespaces And Routes
|--------------------------------------------------------------------------
|
| When a module starting, this file will executed automatically. This helps
| to register some namespaces like translator or view. Also this file
| will load the routes file for each module. You may also modify
| this file as you want.
|
*/

require __DIR__ . '/middlewares.php';

require __DIR__ . '/helpers.php';

require __DIR__ . '/menus.php';

require __DIR__ . '/Http/routes.php';

Event::listen('modules.settings.boot', function ()
{
	$menu = Menu::instance('sidebar');

	$menu->whereTitle('Settings', function ($sub)
	{
		if (!is_null($sub)) {
			$sub->url('administrator/settings/modules', 'Modules', 3, ['icon' => 'fa fa-circle-o']);
		}
	});
});

Add modules menu to Settings menu after settings module booted