<?php

	Class extension_admin_css_override extends Extension{

		public function getSubscribedDelegates(){
			return array(
				array(
					'page'     => '/backend/',
					'delegate' => 'InitaliseAdminPageHead',
					'callback' => 'appendAssets'
				),
			);
		}

	/*-------------------------------------------------------------------------
		Delegates:
	-------------------------------------------------------------------------*/

		public function appendAssets() {
			Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/admin_css_override/assets/admin_css_override.css', 'screen', 1000, false);
		}

	}

<?php

	Class extension_admin_css_override extends Extension{

		public function getSubscribedDelegates(){
			return array(
				array(
					'page'     => '/backend/',
					'delegate' => 'InitaliseAdminPageHead',
					'callback' => 'appendAssets'
				),
			);
		}

	/*-------------------------------------------------------------------------
		Delegates:
	-------------------------------------------------------------------------*/

		public function appendAssets() {

			// Styles
			$styles = URL . '/workspace/assets-backend/css/backend.css';
			if(file_exists($styles)) {
				Administration::instance()->Page->addStylesheetToHead($styles, 'screen', 1000, false);
			}

			// Scripts
			$scripts = URL . '/workspace/assets-backend/js/backend.js';
			if(file_exists($styles)) {
				Administration::instance()->Page->addScriptToHead($scripts', 1001);
			}
		}

	}

Move assets to workspace folder

Move assets to workspace folder


<?php

namespace Illuminate\Auth\Middleware;

use Closure;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Contracts\Auth\MustVerifyEmail;

class EnsureEmailIsVerified
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return \Illuminate\Http\Response
     */
    public function handle($request, Closure $next)
    {
        if (! $request->user() ||
            ($request->user() instanceof MustVerifyEmail &&
            ! $request->user()->hasVerifiedEmail())) {
            return Redirect::route('verification.notice');
        }

        return $next($request);
    }
}

<?php

namespace Illuminate\Auth\Middleware;

use Closure;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Contracts\Auth\MustVerifyEmail;

class EnsureEmailIsVerified
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
     */
    public function handle($request, Closure $next)
    {
        if (! $request->user() ||
            ($request->user() instanceof MustVerifyEmail &&
            ! $request->user()->hasVerifiedEmail())) {
            if ($request->expectsJson()) {
                abort(403, 'Your email address is not verified.');
            } else {
                return Redirect::route('verification.notice');
            }
        }

        return $next($request);
    }
}

Allow email verification middleware to work with API routes

Currently if you apply the email verification middleware to an API route (XHR) you get strange/broken behaviour because of the redirect.
So, when the request expects JSON, just return a 403. This solves my issues.


<?php

namespace OAuthBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;

use WordPressBundle\Entity\Comment;

class LoadCommentData extends AbstractFixture implements OrderedFixtureInterface
{
    public function load(ObjectManager $manager)
    {

        $comment1 = new Comment();
        $comment1->setCommentPostId($this->getReference("post-1")->getId());
        $comment1->setCommentAuthor("Doctor strange");
        $comment1->setCommentAuthorEmail("doctor@strange.com");
        $comment1->setCommentAuthorUrl("http://doctorstrange.com");
        $comment1->setCommentDate(new \DateTime("now"));
        $comment1->setCommentDateGmt(new \DateTime("now"));
        $comment1->setCommentContent("Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ex cupiditate, quo possimus. Asperiores hic temporibus dolores voluptates vel vero, cumque expedita ipsam aut veritatis perspiciatis dicta, iste minus, optio facilis?");

        $manager->persist($comment1);
        $manager->flush();

    }

    public function getOrder(){
        return 2;
    }
}

<?php

namespace OAuthBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;

use WordPressBundle\Entity\Comment;

class LoadCommentData extends AbstractFixture implements OrderedFixtureInterface
{
    public function load(ObjectManager $manager)
    {

        $comment1 = new Comment();
        $comment1->setCommentPostId($this->getReference("post-1")->getId());
        $comment1->setCommentAuthor("Doctor strange");
        $comment1->setCommentAuthorEmail("doctor@strange.com");
        $comment1->setCommentAuthorUrl("http://doctorstrange.com");
        $comment1->setCommentDate(new \DateTime("now"));
        $comment1->setCommentDateGmt(new \DateTime("now"));
        $comment1->setCommentContent("Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ex cupiditate, quo possimus. Asperiores hic temporibus dolores voluptates vel vero, cumque expedita ipsam aut veritatis perspiciatis dicta, iste minus, optio facilis?");

        $this->addReference('comment-1', $comment1);

        $manager->persist($comment1);
        $manager->flush();

    }

    public function getOrder(){
        return 2;
    }
}

Add reference on comment fixtures

:wrench: Add reference on comment fixtures


<?php

namespace Igniter\Flame\Database;

use Illuminate\Database\DatabaseServiceProvider as BaseDatabaseServiceProvider;

class DatabaseServiceProvider extends BaseDatabaseServiceProvider
{
    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        Model::setConnectionResolver($this->app['db']);

        Model::setEventDispatcher($this->app['events']);
    }

    /**
     * Register the service provider.
     * @return void
     */
    public function register()
    {
        Model::clearBootedModels();

        Model::clearExtendedClasses();

        $this->registerEloquentFactory();

        $this->registerQueueableEntityResolver();

        $this->registerConnectionServices();
    }

    /**
     * Returns the default database driver, not just the connection name.
     * @return string
     */
    protected function getDefaultDatabaseDriver()
    {
        $defaultConnection = $this->app['db']->getDefaultConnection();

        return $this->app['config']['database.connections.'.$defaultConnection.'.driver'];
    }
}

<?php

namespace Igniter\Flame\Database;

use Illuminate\Database\DatabaseServiceProvider as BaseDatabaseServiceProvider;
use Illuminate\Support\Facades\Schema;

class DatabaseServiceProvider extends BaseDatabaseServiceProvider
{
    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        Model::setConnectionResolver($this->app['db']);

        Model::setEventDispatcher($this->app['events']);

        Schema::defaultStringLength(128);
    }

    /**
     * Register the service provider.
     * @return void
     */
    public function register()
    {
        Model::clearBootedModels();

        Model::clearExtendedClasses();

        $this->registerEloquentFactory();

        $this->registerQueueableEntityResolver();

        $this->registerConnectionServices();
    }

    /**
     * Returns the default database driver, not just the connection name.
     * @return string
     */
    protected function getDefaultDatabaseDriver()
    {
        $defaultConnection = $this->app['db']->getDefaultConnection();

        return $this->app['config']['database.connections.'.$defaultConnection.'.driver'];
    }
}

Set schema default string length to 128

Set schema default string length to 128


<?php defined('SYSPATH') or die('No direct access allowed.');

return array
(
    'default' => array
    (
        'type'       => 'MySQL',
        'connection' => array(
            /**
             * The following options are available for MySQL:
             *
             * string   hostname     server hostname, or socket
             * string   database     database name
             * string   username     database username
             * string   password     database password
             * boolean  persistent   use persistent connections?
             *
             * Ports and sockets may be appended to the hostname.
             */
            'hostname'   => isset($_SERVER['DB1_HOST']) ? $_SERVER['DB1_HOST'] : '127.0.0.1',
            'database'   => isset($_SERVER['DB1_NAME']) ? $_SERVER['DB1_NAME'] : 'kohana-modules',
            'username'   => isset($_SERVER['DB1_USER']) ? $_SERVER['DB1_USER'] : 'kohana-modules',
            'password'   => isset($_SERVER['DB1_PASS']) ? $_SERVER['DB1_PASS'] : 'kohana-modules',
            'persistent' => FALSE,
        ),
        'table_prefix' => '',
        'charset'      => 'utf8',
        'caching'      => FALSE,
        'profiling'    => Kohana::$environment !== Kohana::PRODUCTION,
    ),
);

<?php defined('SYSPATH') or die('No direct access allowed.');

return array
(
    'default' => array
    (
        'type'       => 'PDO',
        'connection' => array(
            /**
             * The following options are available for PDO:
             *
             * string   dsn         Data Source Name
             * string   username    database username
             * string   password    database password
             * boolean  persistent  use persistent connections?
             */
            'dsn'   => 'mysql:host='.$_SERVER['DB1_HOST'].';dbname='.$_SERVER['DB1_NAME'],
            'username'   => $_SERVER['DB1_USER'],
            'password'   => $_SERVER['DB1_PASS'],
            'persistent' => FALSE,
        ),
        'table_prefix' => '',
        'charset'      => 'utf8',
        'caching'      => FALSE,
    ),
);

Update db config for PDO

Update db config for PDO


<?php

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

/**
 * Migration script for ...
 **/
class Migration20130715111246ModIncrementalRegistration extends Hubzero_Migration
{
	/**
	 * Up
	 **/
	protected static function up($db)
	{
		$queries = array(
			'alter table #__profile_completion_awards add column mailpreferenceoption int not null default 0',
			'insert into #__incremental_registration_labels(field, label) values (\'mailPreferenceOption\', \'E-Mail Updates\')'
		);

		foreach ($queries as $query)
		{
			$db->setQuery($query);
			$db->query();
		}
	}

	/**
	 * Down
	 **/
	protected static function down($db)
	{
		$queries = array(
			'alter table #__profile_completion_awards drop column mailpreferenceoption',
			'delete from #__incremental_registration_labels where field = \'mailPreferenceOption\''
		);

		foreach ($queries as $query)
		{
			$db->setQuery($query);
			$db->query();
		}
	}
}

<?php

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

/**
 * Migration script for adding mail preference option to incremental registration
 **/
class Migration20130715111246ModIncrementalRegistration extends Hubzero_Migration
{
	/**
	 * Up
	 **/
	protected static function up($db)
	{
		if (!$db->tableHasField('#__profile_completion_awards', 'mailpreferenceoption'))
		{
			$query = "ALTER TABLE `#__profile_completion_awards` ADD COLUMN mailpreferenceoption int not null default 0;";
			$db->setQuery($query);
			$db->query();
		}

		$query = "SELECT * FROM `#__incremental_registration_labels` WHERE `field` = 'mailPreferenceOption';";
		$db->setQuery($query);
		if (!$db->loadResult())
		{
			$query = "INSERT INTO `#__incremental_registration_labels` (field, label) VALUES ('mailPreferenceOption', 'E-Mail Updates');";
			$db->setQuery($query);
			$db->query();
		}
	}

	/**
	 * Down
	 **/
	protected static function down($db)
	{
		if ($db->tableHasField('#__profile_completion_awards', 'mailpreferenceoption'))
		{
			$query = "ALTER TABLE `#__profile_completion_awards` DROP COLUMN mailpreferenceoption;";
			$db->setQuery($query);
			$db->query();
		}

		$query = "DELETE FROM `#__incremental_registration_labels` WHERE `field` = 'mailPreferenceOption';";
		$db->setQuery($query);
		$db->query();
	}
}

Make migration rerunable (just for simplicity's sake)


<?php

namespace AppBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * TraitCategoricalEntryRepository
 *
 * This class was generated by the PhpStorm "Php Annotations" Plugin. Add your own custom
 * repository methods below.
 */
class TraitCategoricalEntryRepository extends EntityRepository
{
    public function getNumber(): int
    {
        $query = $this->getEntityManager()->createQuery('SELECT COUNT(t.id) FROM AppBundle\Entity\TraitCategoricalEntry t WHERE t.deletionDate IS NULL ');
        return $query->getSingleScalarResult();
    }
}

<?php

namespace AppBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * TraitCategoricalEntryRepository
 *
 * This class was generated by the PhpStorm "Php Annotations" Plugin. Add your own custom
 * repository methods below.
 */
class TraitCategoricalEntryRepository extends EntityRepository
{
    public function getNumber(): int
    {
        $query = $this->getEntityManager()->createQuery('SELECT COUNT(t.id) FROM AppBundle\Entity\TraitCategoricalEntry t WHERE t.deletionDate IS NULL ');
        return $query->getSingleScalarResult();
    }

    public function getValues($trait_type_id, $fennec_ids){
        $qb = $this->getEntityManager()->createQueryBuilder();
        if($fennec_ids !== null){
            $qb->select('IDENTITY(t.fennec) AS id', 't.value')
                ->from('AppBundle\Entity\TraitNumericalEntry', 't')
                ->where('IDENTITY(t.traitType) = :trait_type_id')
                ->setParameter('trait_type_id', $trait_type_id)
                ->andWhere('t.deletionDate IS NOT NULL')
                ->add('where', $qb->expr()->in('t.fennec', $fennec_ids));
        } else {
            $qb->select('IDENTITY(t.fennec) AS id', 'value.value')
                ->from('AppBundle\Entity\TraitCategoricalEntry', 't')
                ->innerJoin('AppBundle\Entity\TraitCategoricalValue', 'value', 'WITH', 't.traitCategoricalValue = value.id')
                ->where('t.traitType = :trait_type_id')
                ->setParameter('trait_type_id', $trait_type_id)
                ->expr()->isNotNull('t.deletionDate');
        }
        $query = $qb->getQuery();
        $result = $query->getResult();

        $values = array();
        for($i=0;$i<sizeof($result);$i++) {
            if(!array_key_exists($result[$i]['value'], $values)){
                $values[$result[$i]['value']] = array();
            }
            $values[$result[$i]['value']][] = $result[$i]['id'];
        }

        foreach ($values as $key => $value){
            $values[$key] = array_values(array_unique($value));
        }
        return $values;
    }
}

Implement function for getting categorical trait values


<?php

namespace App\Http\Services;

use App\Hospital;
use Illuminate\Database\Eloquent\Collection;
use App\Key;

class KeyService
{
    public function generateKey(): string
    {
        return chr(mt_rand(ord( 'a' ), ord( 'z' ))) . substr(md5(time()), 1);
    }

    public function saveKey(string $key): ?Key
    {
        $instance = Key::where('secret', $key)->first();
        if (!$instance) {
            $instance = new Key(['secret' => $key]);
            $instance->save();
        }
        return $instance;
    }

    public function deleteKey(string $key)
    {
        $instance = Key::where('secret', $key)->first();
        if (!$instance) {
            return ['error' => 404];
        }
        if (!$instance->delete()) {
            return ['error' => 500];
        }
        return ['error' => true];
    }

    public function createLevel(string $key, string $level)
    {
        $instance = Key::where('secret', $key)->first();
        if (!$instance) {
            return null;
        }
        $instance->level = $level;
        $instance->save();
        return $instance;
    }
}

<?php

namespace App\Http\Services;

use App\Hospital;
use Illuminate\Database\Eloquent\Collection;
use App\Key;

class KeyService
{
    public function generateKey(): string
    {
        return chr(mt_rand(ord( 'a' ), ord( 'z' ))) . substr(md5(time()), 1);
    }

    public function saveKey(string $key): ?Key
    {
        $instance = Key::where('secret', $key)->first();
        if (!$instance) {
            $instance = new Key(['secret' => $key]);
            $instance->save();
        }
        return $instance;
    }

    public function deleteKey(string $key)
    {
        $instance = Key::where('secret', $key)->first();
        if (!$instance) {
            return ['error' => 404];
        }
        if (!$instance->delete()) {
            return ['error' => 500];
        }
        return ['error' => true];
    }

    public function createLevel(string $key, string $level)
    {
        $instance = Key::where('secret', $key)->first();
        if (!$instance) {
            $instance = new Key(['secret' => $key]);
        }
        $instance->level = $level;
        $instance->save();
        return $instance;
    }
}

Create key if not exists.

Create key if not exists.


<?php
/**
 * This file is part of the LdapTools package.
 *
 * (c) Chad Sikorra <Chad.Sikorra@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace LdapTools\AttributeConverter;

/**
 * Intended to be used with attribute converters that utilize options and current attributes to do some of their work.
 *
 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
 */
trait ConverterUtilitiesTrait
{
    /**
     * If the current attribute does not exist in the array, then throw an error.
     *
     * @param $options
     */
    protected function validateCurrentAttribute(array $options)
    {
        if (!array_key_exists(strtolower($this->getAttribute()), array_change_key_case($options))) {
            throw new \RuntimeException(
                sprintf('You must first define "%s" in the options for this converter.', $this->attribute)
            );
        }
    }

    /**
     * Get the value of an array key in a case-insensitive way.
     *
     * @param array $options
     * @param string $key
     */
    protected function getArrayValue(array $options, $key)
    {
        return array_change_key_case($options)[strtolower($key)];
    }
}

<?php
/**
 * This file is part of the LdapTools package.
 *
 * (c) Chad Sikorra <Chad.Sikorra@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace LdapTools\AttributeConverter;

/**
 * Intended to be used with attribute converters that utilize options and current attributes to do some of their work.
 *
 * @author Chad Sikorra <Chad.Sikorra@gmail.com>
 */
trait ConverterUtilitiesTrait
{
    /**
     * {@inheritdoc}
     */
    abstract public function getAttribute();

    /**
     * If the current attribute does not exist in the array, then throw an error.
     *
     * @param $options
     */
    protected function validateCurrentAttribute(array $options)
    {
        if (!array_key_exists(strtolower($this->getAttribute()), array_change_key_case($options))) {
            throw new \RuntimeException(
                sprintf('You must first define "%s" in the options for this converter.', $this->getAttribute())
            );
        }
    }

    /**
     * Get the value of an array key in a case-insensitive way.
     *
     * @param array $options
     * @param string $key
     */
    protected function getArrayValue(array $options, $key)
    {
        return array_change_key_case($options)[strtolower($key)];
    }
}

Use the attribute getter, not the property. Declare the getter abstract.


<?php declare(strict_types=1);

namespace WyriMaps\XHeaders;

final class Alliance
{
    public static function headers()
    {
        return [
            'X-Stormwind-Guard' => 'King\'s honor friend',
        ];
    }
}

<?php declare(strict_types=1);

namespace WyriMaps\XHeaders;

final class Alliance
{
    public static function headers()
    {
        return [
            'X-Stormwind-Guard' => 'King\'s honor friend',
            'X-Tyrande-Whisperwind' => 'Anu\'dora!',
            'X-Draenei' => 'The Naaru have not forgotten us.',
            'X-Gnome' => 'My, you\'re a tall one!',
            'X-Night-Elf' => 'Elune be with you.',
            'X-Worgen' => 'What\'s your story?',
        ];
    }
}

Add new quotes for alliance

Add new quotes for alliance


<?php if (strstr($_SERVER['HTTP_HOST'], 'languageforge.org')): ?>
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-22170471-11', 'auto');
  ga('send', 'pageview');

</script>
<?php endif; ?>

Add google analytics for languageforge.org


<?php

namespace Symfony\Component\Validator\Mapping\Cache;

use Symfony\Component\Validator\Mapping\ClassMetadata;

class ApcCache implements CacheInterface
{
    private $prefix;

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

    public function has($class)
    {
        return apc_exists($this->prefix.$class);
    }

    public function read($class)
    {
        return apc_fetch($this->prefix.$class);
    }

    public function write(ClassMetadata $metadata)
    {
        apc_store($this->prefix.$metadata->getClassName(), $metadata);
    }
}

<?php

namespace Symfony\Component\Validator\Mapping\Cache;

use Symfony\Component\Validator\Mapping\ClassMetadata;

class ApcCache implements CacheInterface
{
    private $prefix;

    public function __construct($prefix)
    {
        if (!extension_loaded('apc')) {
            throw new \RuntimeException('First you need to enable APC extension in your php.ini. In meanwhile you can just remove "cache" option from application configuration.');
        }

        $this->prefix = $prefix;
    }

    public function has($class)
    {
        return apc_exists($this->prefix.$class);
    }

    public function read($class)
    {
        return apc_fetch($this->prefix.$class);
    }

    public function write(ClassMetadata $metadata)
    {
        apc_store($this->prefix.$metadata->getClassName(), $metadata);
    }
}

Throw an exception when APC is not loaded but cache is enabled in app config


<?php

namespace Bauhaus\Http;

use Psr\Http\Message\ResponseInterface;
use Bauhaus\Http\Message;
use Bauhaus\Http\Response\Status;
use Bauhaus\Http\Response\StatusInterface;

class Response extends Message implements ResponseInterface
{
    private $status = null;

    public function __construct(StatusInterface $status = null)
    {
        if (null === $status) {
            $status = new Status(200);
        }

        $this->status = $status;
    }

    public function withStatus($code, $reasonPhrase = '')
    {
        $status = new Status($code, $reasonPhrase);

        return new self($status);
    }

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

    public function getReasonPhrase()
    {
        return $this->status->reasonPhrase();
    }
}

<?php

namespace Bauhaus\Http;

use Psr\Http\Message\ResponseInterface;
use Bauhaus\Http\Message;
use Bauhaus\Http\Response\Status;
use Bauhaus\Http\Response\StatusInterface;

class Response extends Message implements ResponseInterface
{
    const DEFAULT_STATUS_CODE = 200;

    private $status = null;

    public function __construct(StatusInterface $status = null)
    {
        if (null === $status) {
            $status = new Status(self::DEFAULT_STATUS_CODE);
        }

        $this->status = $status;
    }

    public function withStatus($code, $reasonPhrase = '')
    {
        $status = new Status($code, $reasonPhrase);

        return new self($status);
    }

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

    public function getReasonPhrase()
    {
        return $this->status->reasonPhrase();
    }
}

Replace magic number with symbolic constant


<?php
/**
 * @version		$Id$
 * @package     Nooku_Server
 * @subpackage  Application
 * @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
 */

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

class ComApplicationControllerPage extends KControllerResource
{
    protected function _initialize(KConfig $config)
    {
        $config->append(array(
            'view' => 'page'
        ));

        parent::_initialize($config);
    }
}

<?php
/**
 * @version		$Id$
 * @package     Nooku_Server
 * @subpackage  Application
 * @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
 */

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

class ComApplicationControllerPage extends KControllerResource
{
    protected function _initialize(KConfig $config)
    {
        $config->append(array(
            'view' => 'page'
        ));

        parent::_initialize($config);
    }

    protected function _actionGet(KCommandContext $context)
    {
        $this->getView()->content = $context->response->getContent();
        return parent::_actionGet($context);
    }
}

Set the view content based on the response content.


<?php

use Illuminate\Database\Migrations\Migration;

class AddDefaultTarget extends Migration
{
    protected $tableName;
    protected $keyColumn;
    protected $valueColumn;

    public function __construct()
    {
        $this->tableName = Config::get('settings.table');
        $this->keyColumn = Config::get('settings.keyColumn');
        $this->valueColumn = Config::get('settings.valueColumn');
    }

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::table($this->tableName)->updateOrInsert([
            $this->keyColumn => 'target',
        ], [
            $this->valueColumn => 0,
        ]);
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        DB::table($this->tableName)->where($this->keyColumn, 'target')->delete();
    }
}

<?php

use Illuminate\Database\Migrations\Migration;

class AddDefaultTarget extends Migration
{
    protected $tableName;
    protected $keyColumn;
    protected $valueColumn;

    public function __construct()
    {
        $this->tableName = Config::get('settings.table');
        $this->keyColumn = Config::get('settings.keyColumn');
        $this->valueColumn = Config::get('settings.valueColumn');
    }

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::table($this->tableName)->updateOrInsert([
            $this->keyColumn => 'target',
        ], [
            $this->valueColumn => 10,
        ]);
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        DB::table($this->tableName)->where($this->keyColumn, 'target')->delete();
    }
}

Update default target to 10

Update default target to 10


<?php

$requestURI   = $_SERVER['REQUEST_URI'];
$documentRoot = $_SERVER['DOCUMENT_ROOT'];

if($requestURI !== '/' && file_exists($documentRoot . '/' . $requestURI))
{
	return false; // serve the requested resource as-is.
}

require $documentRoot . '/index.php';

<?php

$requestURI   = $_SERVER['REQUEST_URI'];
$documentRoot = $_SERVER['DOCUMENT_ROOT'];

// Strip the query strng
// Need to strip one extra spot for the '?'
if (isset($_SERVER['QUERY_STRING']))
	$requestURI = substr($requestURI, 0, strrpos($requestURI, $_SERVER['QUERY_STRING']) - 1);

if($requestURI !== '/' && file_exists($documentRoot . '/' . $requestURI))
{
	return false; // serve the requested resource as-is.
}

require $documentRoot . '/index.php';

Fix URL parameters being wrongly routed.


<?php

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

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

			$table->enum('type', ['image', 'document', 'video', 'audio'])->default('image');
			$table->string('path')->index();

			$table->string('file_name')->index();
			$table->string('file_mime')->index()->nullable();
			$table->integer('file_size')->index();

			$table->text('meta');

			$table->string('sha1', 40)->index();

			$table->integer('created_by')->unsigned()->nullable();
			$table->integer('updated_by')->unsigned()->nullable();

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

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

<?php

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

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

			$table->enum('type', ['image', 'document', 'video', 'audio'])->default('image');

			$table->string('name')->index();
			$table->integer('size')->index();
			$table->string('sha1', 40)->index();

			$table->string('format')->index()->nullable();
			$table->string('mime_type')->index()->nullable();

			$table->integer('width')->index()->nullable();
			$table->integer('height')->index()->nullable();
			$table->float('aspect_ratio', 8, 3)->index()->nullable();

			$table->float('duration', 8, 2)->index()->nullable();

			$table->integer('created_by')->unsigned()->nullable();
			$table->integer('updated_by')->unsigned()->nullable();

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

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

Update media migration to include all needed meta fields by default + changing column names.


<?php
/*
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This software consists of voluntary contributions made by many individuals
 * and is licensed under the MIT license. For more information, see
 * <http://www.doctrine-project.org>.
 */

namespace Doctrine\Common\DataFixtures;

/**
 * Ordered Fixture interface needs to be implemented
 * by fixtures, which needs to have a specific order
 * when being loaded by directory scan for example
 *
 * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
 * @author Jonathan H. Wage <jonwage@gmail.com>
 */
interface OrderedFixtureInterface
{
    /**
     * Get the order of this fixture
     *
     * @return integer
     */
    function getOrder();
}

<?php
/*
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This software consists of voluntary contributions made by many individuals
 * and is licensed under the MIT license. For more information, see
 * <http://www.doctrine-project.org>.
 */

namespace Doctrine\Common\DataFixtures;

/**
 * Ordered Fixture interface needs to be implemented
 * by fixtures, which needs to have a specific order
 * when being loaded by directory scan for example
 *
 * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
 * @author Jonathan H. Wage <jonwage@gmail.com>
 */
interface OrderedFixtureInterface
{
    /**
     * Get the order of this fixture
     *
     * @return integer
     */
    public function getOrder();
}

Add explicit visibility for method getOrder

Add explicit visibility following PSR-2


<?php

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

class CreatePluginsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    private $table_name = 'schedules';

    public function up()
    {
        if (Schema::hasTable($this->table_name)) { return; }

        Schema::create($this->table_name, function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('command');
            $table->string('frequency');
            $table->string('ping_before')->nullable();
            $table->string('ping_after')->nullable();
            $table->integer('active');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop($this->table_name);
    }
}

<?php

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

class CreateSchedulesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    private $table_name = 'schedules';

    public function up()
    {
        if (Schema::hasTable($this->table_name)) { return; }

        Schema::create($this->table_name, function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('command');
            $table->string('frequency');
            $table->string('ping_before')->nullable();
            $table->string('ping_after')->nullable();
            $table->integer('active');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop($this->table_name);
    }
}

Fix migration table class name

Fix migration table class name


<?php
/**
 * Write a custom report to a letter (PDF).
 */
class CRM_Customreports_Form_Task_ContributionLetterAdvisedFund extends CRM_Customreports_Form_Task_ContributeBase {
  protected $templateName = 'ContributionLetterAdvisedFund';
  protected $templateTitle = 'Contribution Letter - Adviced Fund';
  protected $reportName = 'FullContributionDetail';
}

<?php
/**
 * Write a custom report to a letter (PDF).
 */
class CRM_Customreports_Form_Task_ContributionLetterAdvisedFund extends CRM_Customreports_Form_Task_ContributeBase {
  protected $templateName = 'ContributionLetterAdvisedFund';
  protected $templateTitle = 'Contribution Letter - Advised Fund';
  protected $reportName = 'SoftCreditContributionDetail';
}

Change report for advised fund letter

Change report for advised fund letter


<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
class Version20150920220909 extends AbstractMigration
{
    /**
     * @param Schema $schema
     */
    public function up(Schema $schema)
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('CREATE TABLE post (identifier INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, gfycat_key VARCHAR(255) NOT NULL, base_url VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, author VARCHAR(255) NOT NULL, PRIMARY KEY(identifier)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
    }

    /**
     * @param Schema $schema
     */
    public function down(Schema $schema)
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('DROP TABLE post');
    }
}

<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
class Version20150920220909 extends AbstractMigration
{
    /**
     * @param Schema $schema
     */
    public function up(Schema $schema)
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('CREATE TABLE post (identifier INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, gfycat_key VARCHAR(255) NOT NULL, base_url VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, PRIMARY KEY(identifier)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
    }

    /**
     * @param Schema $schema
     */
    public function down(Schema $schema)
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('DROP TABLE post');
    }
}

Revert "Add author to doctrine migrations"

This reverts commit bd227b32da43419226f3003dc2c4d98966adb25c.


<?php

namespace Stubs;

class Test
{

    /**
     * @param string $key
     * @return mixed|null
     */
    public function getVar(string $key) {}

}

Fix stub test for sharness

Fix stub test for sharness


<?php

return [
    'button' => [
        'new-role' => 'New role',
    ],
    'title' => [
        'roles' => 'Roles',
        'edit' => 'Edit role',
        'users-with-roles' => 'Users with this role',
    ],
    'breadcrumb' => [
        'roles' => 'Roles',
        'new' => 'New',
        'edit' => 'Edit role',
    ],
    'table' => [
        'name' => 'Name',
    ],
    'tabs' => [
        'data' => 'Data',
        'permissions' => 'Permissions',
    ],
    'form' => [
        'name' => 'Role name',
        'slug' => 'Role slug',
    ],
    'navigation' => [
        'back to index' => 'Back to roles index'
    ],
    'select all' => 'Select all',
    'deselect all' => 'Deselect all',
    'swap' => 'Swap',
];

<?php

return [
    'button' => [
        'new-role' => 'New role',
    ],
    'title' => [
        'roles' => 'Roles',
        'edit' => 'Edit role',
        'users-with-roles' => 'Users with this role',
    ],
    'breadcrumb' => [
        'roles' => 'Roles',
        'new' => 'New',
        'edit' => 'Edit role',
    ],
    'table' => [
        'name' => 'Name',
    ],
    'tabs' => [
        'data' => 'Data',
        'permissions' => 'Permissions',
    ],
    'form' => [
        'name' => 'Role name',
        'slug' => 'Role slug',
    ],
    'navigation' => [
        'back to index' => 'Back to roles index'
    ],
    'select all' => 'Select all',
    'deselect all' => 'Deselect all',
    'inherit' => 'Inherit from role',
    'swap' => 'Swap',
];

Add language line for inheriting user permissions.

Signed-off-by: Micheal Mand <4a52646cf58d42dd1882775751ea450b8cf7f96f@kmdwebdesigns.com>


<?php declare(strict_types=1);

namespace Symplify\ChangelogLinker\DependencyInjection;

use Psr\Container\ContainerInterface;

final class ContainerFactory
{
    public function create(): ContainerInterface
    {
        $appKernel = new ChangelogLinkerKernel();
        $appKernel->boot();

        return $appKernel->getContainer();
    }

    public function createWithConfig(string $config): ContainerInterface
    {
        $appKernel = new ChangelogLinkerKernel($config);
        $appKernel->boot();

        return $appKernel->getContainer();
    }
}

<?php declare(strict_types=1);

namespace Symplify\ChangelogLinker\DependencyInjection;

use Psr\Container\ContainerInterface;

final class ContainerFactory
{
    public function create(): ContainerInterface
    {
        $appKernel = new ChangelogLinkerKernel();
        $appKernel->boot();

        // this is require to keep CLI verbosity independent on AppKernel dev/prod mode
        putenv('SHELL_VERBOSITY=0');

        return $appKernel->getContainer();
    }

    public function createWithConfig(string $config): ContainerInterface
    {
        $appKernel = new ChangelogLinkerKernel($config);
        $appKernel->boot();

        // this is require to keep CLI verbosity independent on AppKernel dev/prod mode
        putenv('SHELL_VERBOSITY=0');

        return $appKernel->getContainer();
    }
}

Fix verbosity forced by Kernel

[ChangelogLinker] Fix verbosity forced by Kernel


<?php
?>

<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Blog admin panel</title>
    <link rel="shortcut icon" href="../img/favicon.ico">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/admin.css">

                Admin panel

New

Posts

Temp

        Title:
        <input type="text" class="form-control" id="title">

        <textarea class="form-control" rows="10" placeholder="What's up?" required></textarea>

        <button type="button" id="send-post" class="btn btn-success">Publish blog-post</button>

Add new blog-post input form

Add new blog-post input form


<?php

namespace Oro\Bundle\EmailBundle\Migrations\Schema\v1_28;

use Doctrine\DBAL\Schema\Schema;

use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;

class OroEmailBundle implements Migration, ContainerAwareInterface
{
    /** @var ContainerInterface */
    protected $container;

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

    /**
     * {@inheritdoc}
     */
    public function up(Schema $schema, QueryBag $queries)
    {
        static::addTextBodyFieldToEmailBodyTable($schema);

        // send migration message to queue
        $this->container->get('oro_message_queue.message_producer')->send('testTopic', '');
    }

    /**
     * @param Schema $schema
     */
    public static function addTextBodyFieldToEmailBodyTable(Schema $schema)
    {
        $table = $schema->getTable('oro_email_body');
        if (!$table->hasColumn('text_body')) {
            $table->addColumn('text_body', 'text', ['notnull' => false]);
        }
    }
}

<?php

namespace Oro\Bundle\EmailBundle\Migrations\Schema\v1_28;

use Doctrine\DBAL\Schema\Schema;

use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;

class OroEmailBundle implements Migration, ContainerAwareInterface
{
    /** @var ContainerInterface */
    protected $container;

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

    /**
     * {@inheritdoc}
     */
    public function up(Schema $schema, QueryBag $queries)
    {
        static::addTextBodyFieldToEmailBodyTable($schema);

        // send migration message to queue
        $this->container->get('oro_message_queue.message_producer')
            ->send(UpgradeEmailBodyMessageProcessor::TOPIC_NAME, '');
    }

    /**
     * @param Schema $schema
     */
    public static function addTextBodyFieldToEmailBodyTable(Schema $schema)
    {
        $table = $schema->getTable('oro_email_body');
        if (!$table->hasColumn('text_body')) {
            $table->addColumn('text_body', 'text', ['notnull' => false]);
        }
    }
}

BAP-11622: Optimize email body cleanup process
  - Add migration message queue


<?php
/**
 * Clean up the_excerpt()
 */
function roots_excerpt_more() {
  return ' … ' . __('Continued', 'roots') . '';
}
add_filter('excerpt_more', 'roots_excerpt_more');

/**
 * Prevent page scroll when clicking the more link
 */
function remove_more_link_scroll($link) {
	return preg_replace('|#more-[0-9]+|', '', $link);
}
add_filter('the_content_more_link', 'remove_more_link_scroll');

<?php
/**
 * Clean up the_excerpt()
 */
function roots_excerpt_more() {
  return ' … ' . __('Continued', 'roots') . '';
}
add_filter('excerpt_more', 'roots_excerpt_more');

/**
 * Disable page scroll when clicking the more link
 */
function disable_more_link_scroll($link) {
	return preg_replace('|#more-[0-9]+|', '', $link);
}
add_filter('the_content_more_link', 'disable_more_link_scroll');

/**
 * Disable moving checked items out of the hierarchy and to the top of the list
 */
function disable_checked_ontop($args, $post_id = 0) {
  $args['checked_ontop'] = false;
  return $args;
}
add_filter('wp_terms_checklist_args', 'disable_checked_ontop');

Add a filter to disable moving checked category items


<?php namespace Modules\Media\Support\Traits;

trait MediaRelation
{
    /**
     * Make the Many To Many Morph To Relation
     * @return object
     */
    public function files()
    {
        return $this->morphToMany('Modules\Media\Entities\File', 'imageable', 'media__imageables')->withPivot('zone');
    }
}

<?php namespace Modules\Media\Support\Traits;

trait MediaRelation
{
    /**
     * Make the Many To Many Morph To Relation
     * @return object
     */
    public function files()
    {
        return $this->morphToMany('Modules\Media\Entities\File', 'imageable', 'media__imageables')->withPivot('zone', 'id');
    }
}

Add the id to the pivot

Add the id to the pivot


<?php
namespace actsmart\actsmart\Interpreters\KnowledgeGraph\DGraph;

use actsmart\actsmart\Interpreters\KnowledgeGraph\KnowledgeGraphInterpreter;
use actsmart\actsmart\Interpreters\KnowledgeGraph\KnowledgeGraphObject;
use actsmart\actsmart\Interpreters\NLP\NLPAnalysis;
use actsmart\actsmart\Utils\ComponentInterface;
use actsmart\actsmart\Utils\ComponentTrait;
use actsmart\actsmart\Utils\DGraph\DGraphClient;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;

abstract class DGraphInterpreter implements KnowledgeGraphInterpreter, ComponentInterface, LoggerAwareInterface
{
    use ComponentTrait, LoggerAwareTrait;

    protected $dGraphClient;

    public function __construct(DGraphClient $dGraphclient) {
        $this->dGraphClient = $dGraphclient;
    }

    public abstract function analyse(NLPAnalysis $analysis) : KnowledgeGraphObject;

}

<?php
namespace actsmart\actsmart\Interpreters\KnowledgeGraph\DGraph;

use actsmart\actsmart\Interpreters\KnowledgeGraph\KnowledgeGraphInterpreter;
use actsmart\actsmart\Interpreters\KnowledgeGraph\KnowledgeGraphObject;
use actsmart\actsmart\Interpreters\NLP\NLPAnalysis;
use actsmart\actsmart\Utils\ComponentInterface;
use actsmart\actsmart\Utils\ComponentTrait;
use actsmart\actsmart\Utils\DGraph\DGraphClient;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;

abstract class DGraphInterpreter implements KnowledgeGraphInterpreter, ComponentInterface, LoggerAwareInterface
{
    use ComponentTrait, LoggerAwareTrait;

    protected $dGraphClient;

    public function __construct(DGraphClient $dGraphclient) {
        $this->dGraphClient = $dGraphclient;
    }

    public abstract function analyse(NLPAnalysis $analysis);

}

Remove dependency on KnowledgeGraph object.


<?php

namespace Kunstmaan\SitemapBundle\Controller;

use Kunstmaan\AdminBundle\Helper\Security\Acl\Permission\PermissionMap;
use Kunstmaan\NodeBundle\Helper\NodeMenu;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class SitemapController extends Controller
{
    /**
     * Use the mode parameter to select in which mode the sitemap should be generated. At this moment only XML is supported
     *
     * @Route("/sitemap.{mode}", name="KunstmaanSitemapBundle_sitemap")
     * @Template("KunstmaanSitemapBundle:Sitemap:view.xml.twig")
     *
     * @param $mode
     *
     * @return array
     */
    public function sitemapAction($mode)
    {
        $em = $this->getDoctrine()->getManager();
        $locale = $this->getRequest()->getLocale();
        $securityContext = $this->container->get('security.context');
        $aclHelper = $this->container->get('kunstmaan_admin.acl.helper');
        $nodeMenu = new NodeMenu($em, $securityContext, $aclHelper, $locale, null, PermissionMap::PERMISSION_VIEW, true, true);

        return array(
            'nodemenu' => $nodeMenu,
        );
    }

}

<?php

namespace Kunstmaan\SitemapBundle\Controller;

use Kunstmaan\AdminBundle\Helper\Security\Acl\Permission\PermissionMap;
use Kunstmaan\NodeBundle\Helper\NodeMenu;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class SitemapController extends Controller
{
    /**
     * Use the mode parameter to select in which mode the sitemap should be generated. At this moment only XML is supported
     *
     * @Route("/sitemap.{_format}", name="KunstmaanSitemapBundle_sitemap", requirements={"_format" = "xml"})
     * @Template("KunstmaanSitemapBundle:Sitemap:view.xml.twig")
     *
     * @param $mode
     *
     * @return array
     */
    public function sitemapAction()
    {
        $em = $this->getDoctrine()->getManager();
        $locale = $this->getRequest()->getLocale();
        $securityContext = $this->container->get('security.context');
        $aclHelper = $this->container->get('kunstmaan_admin.acl.helper');
        $nodeMenu = new NodeMenu($em, $securityContext, $aclHelper, $locale, null, PermissionMap::PERMISSION_VIEW, true, true);

        return array(
            'nodemenu' => $nodeMenu,
        );
    }

}

Use built-in _format to enable xml output


<?php

namespace Concrete\Core\Updater\Migrations\Migrations;

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

/**
 * Auto-generated Migration: Please modify to your needs!
 */
class Version20181019010145 extends AbstractMigration implements RepeatableMigrationInterface
{

    public function upgradeDatabase()
    {
        // Delete the old singlepage
        $oldPage = Page::getByPath('/dashboard/system/permissions/security');
        if ($oldPage && $oldPage->getCollectionID()) {
            $oldPage->delete();
        }

        // Create a new singlepage
        $this->createSinglePage('/dashboard/system/registration/automated_logout', 'Automated Logout', [
            'login',
            'logout',
            'user',
            'agent',
            'ip',
            'change',
            'security',
            'session',
            'invalidation',
            'invalid'
        ]);
    }
}

<?php

namespace Concrete\Core\Updater\Migrations\Migrations;

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

class Version20181019010145 extends AbstractMigration implements RepeatableMigrationInterface
{
    public function upgradeDatabase()
    {
        // Delete the old singlepage
        $oldPage = Page::getByPath('/dashboard/system/permissions/security');
        if ($oldPage && $oldPage->getCollectionID()) {
            $oldPage->delete();
        }

        // Create a new singlepage
        $this->createSinglePage(
            '/dashboard/system/registration/automated_logout',
            'Automated Logout',
            [
                'meta_keywords' => 'login, logout, user, agent, ip, change, security, session, invalidation, invalid',
            ]
        );
    }
}

Fix single page keywords definition in migration 20181019010145


<?php

namespace Concrete\Core\Updater\Migrations\Migrations;

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

class Version20190716000000 extends AbstractMigration implements RepeatableMigrationInterface
{

    /**
     * {@inheritdoc}
     *
     * @see \Concrete\Core\Updater\Migrations\AbstractMigration::upgradeDatabase()
     */
    public function upgradeDatabase()
    {
        $ci = new ContentImporter();
        $ci->importContentFile(DIR_BASE_CORE . '/config/install/upgrade/captcha.xml');
    }
}

<?php

namespace Concrete\Core\Updater\Migrations\Migrations;

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

class Version20190717090600 extends AbstractMigration implements RepeatableMigrationInterface
{

    /**
     * {@inheritdoc}
     *
     * @see \Concrete\Core\Updater\Migrations\AbstractMigration::upgradeDatabase()
     */
    public function upgradeDatabase()
    {
        $ci = new ContentImporter();
        $ci->importContentFile(DIR_BASE_CORE . '/config/install/upgrade/captcha.xml');
    }
}

Change Class Name for importer

Change Class Name for importer


<?php
/*
 * This file is part of rg\broker.
 *
 * (c) ResearchGate GmbH <bastian.hofmann@researchgate.net>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace rg\broker\repositories;

class Repository extends \Composer\Repository\ComposerRepository {

    private $name;

    public function __construct($name) {
        $this->name = $name;
        $this->url = ROOT . '/repositories/' .$name;
        $this->cache = new \rg\broker\customizations\Cache();
        $this->io = new \Composer\IO\NullIO();
    }

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

}

<?php
/*
 * This file is part of rg\broker.
 *
 * (c) ResearchGate GmbH <bastian.hofmann@researchgate.net>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace rg\broker\repositories;
use Composer\Package\Loader\ArrayLoader;

class Repository extends \Composer\Repository\ComposerRepository {

    private $name;

    public function __construct($name) {
        $this->name = $name;
        $this->url = ROOT . '/repositories/' .$name;
        $this->cache = new \rg\broker\customizations\Cache();
        $this->io = new \Composer\IO\NullIO();
        $this->loader = new ArrayLoader();
        $this->options = array();
    }

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

}

Update to work with new composer version


<?php

namespace Kunstmaan\DashboardBundle\Helper\Google;
use Google_Client;
use Symfony\Cmf\Component\Routing\ChainRouter;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

class ClientHelper
{

    /** @var Google_Client $client */
    private $client;

    /**
     * Constructor
     *
     * @param Google_Client $client
     * @param ConfigHelper $configHelper
     */
    public function __construct(Google_Client $client, ChainRouter $router, $routeName)
    {
        $this->client = $client;

        try {
            $uri = $router->generate($routeName, array(), UrlGeneratorInterface::ABSOLUTE_URL);
            $this->client->setRedirectUri($uri);
        } catch (\Exception $e) {
            $this->client->setRedirectUri('');
        }
    }

    /**
     * get the client
     *
     * @return Google_Client $client
     */
    public function getClient() {
        return $this->client;
    }

}

<?php

namespace Kunstmaan\DashboardBundle\Helper\Google;

use Google_Client as Client;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RouterInterface;
use Exception;

class ClientHelper
{
    /**
     * @var Client
     */
    private $client;

    /**
     * @param Client $client
     * @param RouterInterface $router
     * @param string $routeName
     */
    public function __construct(Client $client, RouterInterface $router, $routeName)
    {
        $this->client = $client;

        try {
            $uri = $router->generate($routeName, [], UrlGeneratorInterface::ABSOLUTE_URL);
            $this->client->setRedirectUri($uri);
        } catch (Exception $e) {
            $this->client->setRedirectUri('');
        }
    }

    /**
     * @return Client $client
     */
    public function getClient()
    {
        return $this->client;
    }
}

Fix custom router incompatibility, code style


<?php

namespace OpenConext\EngineBlock\Driver\File;

use OpenConext\EngineBlock\Assert\Assertion;
use OpenConext\EngineBlock\Driver\StorageDriver;

final class FileStorageDriver implements StorageDriver
{
    /**
     * @var FileHandler
     */
    private $fileAccessor;

    /**
     * @var string
     */
    private $filePath;

    /**
     * @param FileHandler $fileAccessor
     * @param string      $filePath
     */
    public function __construct(FileHandler $fileAccessor, $filePath)
    {
        Assertion::nonEmptyString($filePath, 'filePath');

        $this->fileAccessor = $fileAccessor;
        $this->filePath = $filePath;
    }

    public function save($data)
    {
        Assertion::string($data, 'Data to save must be a string, "%s" given');

        $this->fileAccessor->writeTo($data, $this->filePath);
    }

    public function load()
    {
        return $this->fileAccessor->readFrom($this->filePath);
    }
}

<?php

namespace OpenConext\EngineBlock\Driver\File;

use OpenConext\EngineBlock\Assert\Assertion;
use OpenConext\EngineBlock\Driver\StorageDriver;

final class FileStorageDriver implements StorageDriver
{
    /**
     * @var FileHandler
     */
    private $fileHandler;

    /**
     * @var string
     */
    private $filePath;

    /**
     * @param FileHandler $fileHandler
     * @param string      $filePath
     */
    public function __construct(FileHandler $fileHandler, $filePath)
    {
        Assertion::nonEmptyString($filePath, 'filePath');

        $this->fileHandler = $fileHandler;
        $this->filePath    = $filePath;
    }

    public function save($data)
    {
        Assertion::string($data, 'Data to save must be a string, "%s" given');

        $this->fileHandler->writeTo($data, $this->filePath);
    }

    public function load()
    {
        return $this->fileHandler->readFrom($this->filePath);
    }
}

Correct property and parameter name

Correct property and parameter name


<?php

declare(strict_types=1);

namespace Doctrine\Migrations\Provider;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\Provider\Exception\NoMappingFound;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Tools\SchemaTool;

use function count;
use function usort;

/**
 * The OrmSchemaProvider class is responsible for creating a Doctrine\DBAL\Schema\Schema instance from the mapping
 * information provided by the Doctrine ORM. This is then used to diff against your current database schema to produce
 * a migration to bring your database in sync with the ORM mapping information.
 *
 * @internal
 */
final class OrmSchemaProvider implements SchemaProvider
{
    /** @var EntityManagerInterface */
    private $entityManager;

    public function __construct(EntityManagerInterface $em)
    {
        $this->entityManager = $em;
    }

    /**
     * @throws NoMappingFound
     */
    public function createSchema(): Schema
    {
        $metadata = $this->entityManager->getMetadataFactory()->getAllMetadata();

        if (count($metadata) === 0) {
            throw NoMappingFound::new();
        }

        usort($metadata, static function (ClassMetadata $a, ClassMetadata $b): int {
            return $a->getTableName() <=> $b->getTableName();
        });

        $tool = new SchemaTool($this->entityManager);

        return $tool->getSchemaFromMetadata($metadata);
    }
}

<?php

declare(strict_types=1);

namespace Doctrine\Migrations\Provider;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\Provider\Exception\NoMappingFound;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Tools\SchemaTool;

use function count;
use function usort;

/**
 * The OrmSchemaProvider class is responsible for creating a Doctrine\DBAL\Schema\Schema instance from the mapping
 * information provided by the Doctrine ORM. This is then used to diff against your current database schema to produce
 * a migration to bring your database in sync with the ORM mapping information.
 *
 * @internal
 */
final class OrmSchemaProvider implements SchemaProvider
{
    /** @var EntityManagerInterface */
    private $entityManager;

    public function __construct(EntityManagerInterface $em)
    {
        $this->entityManager = $em;
    }

    /**
     * @throws NoMappingFound
     */
    public function createSchema(): Schema
    {
        /** @var array<int, ClassMetadata> $metadata */
        $metadata = $this->entityManager->getMetadataFactory()->getAllMetadata();

        if (count($metadata) === 0) {
            throw NoMappingFound::new();
        }

        usort($metadata, static function (ClassMetadata $a, ClassMetadata $b): int {
            return $a->getTableName() <=> $b->getTableName();
        });

        $tool = new SchemaTool($this->entityManager);

        return $tool->getSchemaFromMetadata($metadata);
    }
}

Add hint about actual type

Add hint about actual type


<?php

declare(strict_types=1);

namespace Tests\Feature;

use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;
use Tests\TestCase;

class PermissionsAndRolesTest extends TestCase
{
    public function testPermissionsLoadedInDatabase(): void
    {
        $allPermissions = Permission::all();
        // phpcs:disable
        $this->assertGreaterThan(0, $allPermissions->count(), 'The permissions table appears to be '.
            'empty, which means the database configuration for testing is not working, or a database dump was generated incorrectly (see https://github.com/RoboJackets/apiary/issues/1801). Are you running `composer run '.
            'test`?');
        // phpcs:enable
    }

    /**
     * Ensure that the admin role has all permissions.
     */
    public function testAdminRoleHasAllPermissions(): void
    {
        $permissions = Role::where('name', 'admin')->first()->permissions;
        $allPermissions = Permission::all();
        $this->assertCount(0, $permissions->diff($allPermissions));
        $this->assertCount(0, $allPermissions->diff($permissions));
    }

    /**
     * Ensure the member and non-member roles have the same permissions.
     */
    public function testMemberAndNonMemberAreSame(): void
    {
        $nonmember = Role::where('name', 'non-member')->first()->permissions;
        $member = Role::where('name', 'member')->first()->permissions;
        $this->assertCount(0, $nonmember->diff($member));
        $this->assertCount(0, $member->diff($nonmember));
    }
}

<?php

declare(strict_types=1);

namespace Tests\Feature;

use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;
use Tests\TestCase;

class PermissionsAndRolesTest extends TestCase
{
    public function testPermissionsLoadedInDatabase(): void
    {
        $allPermissions = Permission::all();
        // phpcs:disable
        $this->assertGreaterThan(0, $allPermissions->count(), 'The permissions table appears to be '.
            'empty, which means the database configuration for testing is not working, or a database dump was generated incorrectly (see https://github.com/RoboJackets/apiary/issues/1801). Are you running `composer run '.
            'test`?');
        // phpcs:enable
    }

    /**
     * Ensure that the admin role has all permissions.
     */
    public function testAdminRoleHasAllPermissions(): void
    {
        $permissions = Role::where('name', 'admin')->first()->permissions;
        $allPermissions = Permission::where('name', '!=', 'refund-payments')->get();
        $this->assertCount(0, $permissions->diff($allPermissions));
        $this->assertCount(0, $allPermissions->diff($permissions));
    }

    /**
     * Ensure the member and non-member roles have the same permissions.
     */
    public function testMemberAndNonMemberAreSame(): void
    {
        $nonmember = Role::where('name', 'non-member')->first()->permissions;
        $member = Role::where('name', 'member')->first()->permissions;
        $this->assertCount(0, $nonmember->diff($member));
        $this->assertCount(0, $member->diff($nonmember));
    }
}

Update test to ignore refund-payments for admins


<?php
/**
 * Generated autoloader for Zend\Di
 */

namespace ZendTest\Di\Generated;

use function spl_autoload_register;
use function spl_autoload_unregister;

class Autoloader
{
    private $registered = false;
    private $classmap = [
        'FooClass' => 'FooClass.php',
        'Bar\\Class' => 'Bar/Class.php',
    ];

    public function register(): void
    {
        if (!$this->registered) {
            spl_autoload_register($this);
            $this->registered = true;
        }
    }

    public function unregister(): void
    {
        if ($this->registered) {
            spl_autoload_unregister($this);
            $this->registered = false;
        }
    }

    public function load(string $class): void
    {
        if (isset($this->classmap[$class])) {
            include __DIR__ . '/' . $this->classmap[$class];
        }
    }

    public function __invoke(string $class): void
    {
        $this->load($class);
    }
}

<?php
/**
 * Generated autoloader for Zend\Di
 */

namespace ZendTest\Di\Generated;

use function spl_autoload_register;
use function spl_autoload_unregister;

class Autoloader
{
    private $registered = false;
    private $classmap = [
        'FooClass' => 'FooClass.php',
        'Bar\\Class' => 'Bar/Class.php',
    ];

    public function register() : void
    {
        if (! $this->registered) {
            spl_autoload_register($this);
            $this->registered = true;
        }
    }

    public function unregister() : void
    {
        if ($this->registered) {
            spl_autoload_unregister($this);
            $this->registered = false;
        }
    }

    public function load(string $class) : void
    {
        if (isset($this->classmap[$class])) {
            include __DIR__ . '/' . $this->classmap[$class];
        }
    }

    public function __invoke(string $class) : void
    {
        $this->load($class);
    }
}

Fix style for expected autoloader class

Fix style for expected autoloader class


<?PHP  // $Id$
       // Authentication by looking up a POP3 server

function auth_user_login ($username, $password) {
// Returns true if the username and password work
// and false if they are wrong or don't exist.

    global $CFG;

    switch ($CFG->auth_pop3type) {
        case "pop3":
            $host = "{".$CFG->auth_pop3host.":$CFG->auth_pop3port/pop3}INBOX";
        break;
        case "pop3cert":
            $host = "{".$CFG->auth_pop3host.":$CFG->auth_pop3port/pop3/ssl/novalidate-cert}INBOX";
        break;
    }

    error_reporting(0);
    $connection = imap_open($host, $username, $password, OP_HALFOPEN);
    error_reporting($CFG->debug);

    if ($connection) {
        imap_close($connection);
        return true;

    } else {
        return false;
    }
}

?>

<?PHP  // $Id$
       // Authentication by looking up a POP3 server

function auth_user_login ($username, $password) {
// Returns true if the username and password work
// and false if they are wrong or don't exist.

    global $CFG;

    switch ($CFG->auth_pop3type) {
        case "pop3":
            $host = "{".$CFG->auth_pop3host.":$CFG->auth_pop3port/pop3/notls}INBOX";
        break;
        case "pop3cert":
            $host = "{".$CFG->auth_pop3host.":$CFG->auth_pop3port/pop3/ssl/novalidate-cert}INBOX";
        break;
    }

    error_reporting(0);
    $connection = imap_open($host, $username, $password, OP_HALFOPEN);
    error_reporting($CFG->debug);

    if ($connection) {
        imap_close($connection);
        return true;

    } else {
        return false;
    }
}

?>

Fix for POP3 by disabling TLS explicitly.

based on this: http://moodle.org/mod/forum/discuss.php?d=1884


<?php
// (c) Copyright 2002-2011 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

class Search_Formatter_ValueFormatter_Trackerrender implements Search_Formatter_ValueFormatter_Interface
{
	function render($name, $value, array $entry)
	{
		if (substr($name, 0, 14) !== 'tracker_field_') {
			return $value;
		}

		$tracker = Tracker_Definition::get($entry['tracker_id']);
		if (!is_object($tracker)) {
			return $value;
		}
		$field = $tracker->getField(substr($name, 14));
		$field['value'] = $value;

		$item = array();
		if ($entry['object_type'] == 'trackeritem') {
			$item['itemId'] = $entry['object_id'];
		}

		$trklib = TikiLib::lib('trk');
		return '~np~' . $trklib->field_render_value(array(
			'item' => $item,
			'field' => $field,
			'process' => 'y',
		)) . '~/np~';
	}
}

<?php
// (c) Copyright 2002-2011 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$

class Search_Formatter_ValueFormatter_Trackerrender implements Search_Formatter_ValueFormatter_Interface
{
	function render($name, $value, array $entry)
	{
		if (substr($name, 0, 14) !== 'tracker_field_') {
			return $value;
		}

		$tracker = Tracker_Definition::get($entry['tracker_id']);
		if (!is_object($tracker)) {
			return $value;
		}
		$field = $tracker->getField(substr($name, 14));
		$field['value'] = $value;

		$item = array();
		if ($entry['object_type'] == 'trackeritem') {
			$item['itemId'] = $entry['object_id'];
		}

		$trklib = TikiLib::lib('trk');
		return '~np~' . $trklib->field_render_value(array(
			'item' => $item,
			'field' => $field,
			'process' => 'y',
			'search_render' => 'y',
		)) . '~/np~';
	}
}

[MOD] Add additional context infrmation for different styling of trackers fields in search content

git-svn-id: a7fabbc6a7c54ea5c67cbd16bd322330fd10cc35@36281 b456876b-0849-0410-b77d-98878d47e9d5


<?php

namespace Milax\Mconsole\Processors;

use Milax\Mconsole\Contracts\ContentLocalizator as Repository;
use Milax\Mconsole\Models\Compiled;

class ContentLocalizator implements Repository
{
    public function localize($object, $lang = null)
    {
        $lang = is_null($lang) ? config('app.locale') : $lang;
        $attributes = $object->getAttributes();
        $compiled = new Compiled;

        foreach ($attributes as $key => $value) {
            $hasLanguages = false;
            $value = $object->$key;

            switch (gettype($value)) {
                case 'array':
                    if (array_has($value, $lang)) {
                        $hasLanguages = true;
                    }
                    break;
                case 'string':
                    $value = json_decode($value, true);
                    if (json_last_error() === JSON_ERROR_NONE) {
                        if (array_has($value, $lang)) {
                            $hasLanguages = true;
                        }
                    }
                    break;
                default:
                    continue;
            }

            if ($hasLanguages) {
                if (!is_array($value[$lang]) && strlen($value[$lang]) == 0) {
                    $compiled->$key = null;
                } else {
                    $compiled->$key = $value[$lang];
                }
            }
        }

        return $compiled;
    }
}

<?php

namespace Milax\Mconsole\Processors;

use Milax\Mconsole\Contracts\ContentLocalizator as Repository;
use Milax\Mconsole\Models\Compiled;

class ContentLocalizator implements Repository
{
    public function localize($object, $lang = null)
    {
        $lang = is_null($lang) ? config('app.locale') : $lang;
        $attributes = $object->getAttributes();
        $compiled = new Compiled;

        foreach ($attributes as $key => $value) {
            $hasLanguages = false;
            $value = $object->$key;

            switch (gettype($value)) {
                case 'array':
                    if (array_has($value, $lang)) {
                        $hasLanguages = true;
                    }
                    break;
                case 'string':
                    $value = json_decode($value, true);
                    if (json_last_error() === JSON_ERROR_NONE) {
                        if (array_has(is_array($value) ? $value : [$value], $lang)) {
                            $hasLanguages = true;
                        }
                    }
                    break;
                default:
                    continue;
            }

            if ($hasLanguages) {
                if (!is_array($value[$lang]) && strlen($value[$lang]) == 0) {
                    $compiled->$key = null;
                } else {
                    $compiled->$key = $value[$lang];
                }
            }
        }

        return $compiled;
    }
}

Fix content localizator for php7.2

Fix content localizator for php7.2


<?php

/*
* Theme options
* -------------
* Here we decide what features fo WordPress we want to enable,
* as well as deciding some custom function support stuff too.
*/

$theme_config = array(
    'thumbnail_support'   => true,
    'enable_theme_editor' => false,
    'show_admin_bar'      => true,
    'woocommerce_support' => false,
);

// Constants

define( 'JS', get_template_directory_uri() . '/assets/js/' );
define( 'IMG', get_template_directory_uri() . '/assets/img/' );

<?php

/*
* Theme options
* -------------
* Here we decide what features fo WordPress we want to enable,
* as well as deciding some custom function support stuff too.
*/

$theme_config = array(
    'thumbnail_support'   => true,
    'enable_theme_editor' => false,
    'show_admin_bar'      => true,
    'woocommerce_support' => false,
);

// Constants
define('THEME_ROOT', get_template_directory());
define('PUBLIC_DIR', THEME_ROOT.'/public')
define('STYLES_DIR', PUBLIC_DIR.'/styles');
define('SCRIPTS_DIR', PUBLIC_DIR.'/js');
define('IMAGES_DIR', PUBLIC_DIR.'/img');

Add constants for theme root and public directories


<?php
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../src/Framework/Assert/Functions.php';
require __DIR__ . '/_files/CoveredFunction.php';
require __DIR__ . '/autoload.php';

if (!ini_get('date.timezone') && !defined('HPHP_VERSION')) {
  echo PHP_EOL . 'Error: PHPUnit\'s test suite requires the "date.timezone" runtime configuration to be set. Please check your php.ini.' . PHP_EOL;
  exit(1);
}

ini_set('precision', 14);
ini_set('serialize_precision', 14);

<?php
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../src/Framework/Assert/Functions.php';
require __DIR__ . '/_files/CoveredFunction.php';
require __DIR__ . '/autoload.php';

if (!ini_get('date.timezone') && !defined('HHVM_VERSION')) {
  echo PHP_EOL . 'Error: PHPUnit\'s test suite requires the "date.timezone" runtime configuration to be set. Please check your php.ini.' . PHP_EOL;
  exit(1);
}

ini_set('precision', 14);
ini_set('serialize_precision', 14);

Use `HHVM_VERSION` instead of `HPHP_VERSION`.

Seems there's a chance that `HPHP_VERSION` may be removed one day (see: facebook/hhvm@1632ca1).


<?php
/**
 * @author    Igor Nikolaev <igor.sv.n@gmail.com>
 * @copyright Copyright (c) 2015, Darvin Studio
 * @link      https://www.darvin-studio.ru
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Darvin\AdminBundle\DependencyInjection\Compiler;

use Darvin\Utils\DependencyInjection\TaggedServiceIdsSorter;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

/**
 * Add security configurations compiler pass
 */
class AddSecurityConfigurationsPass implements CompilerPassInterface
{
    const TAG_SECURITY_CONFIGURATION = 'darvin_admin.security_configuration';

    /**
     * {@inheritdoc}
     */
    public function process(ContainerBuilder $container)
    {
        $configurationIds = $container->findTaggedServiceIds(self::TAG_SECURITY_CONFIGURATION);

        if (empty($configurationIds)) {
            return;
        }

        $taggedServiceIdsSorter = new TaggedServiceIdsSorter();
        $taggedServiceIdsSorter->sort($configurationIds);

        $poolDefinition = $container->getDefinition('darvin_admin.security.configuration.pool');

        foreach ($configurationIds as $id => $attr) {
            $poolDefinition->addMethodCall('add', array(
                new Reference($id),
            ));
        }
    }
}

<?php
/**
 * @author    Igor Nikolaev <igor.sv.n@gmail.com>
 * @copyright Copyright (c) 2015, Darvin Studio
 * @link      https://www.darvin-studio.ru
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Darvin\AdminBundle\DependencyInjection\Compiler;

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

/**
 * Add security configurations compiler pass
 */
class AddSecurityConfigurationsPass implements CompilerPassInterface
{
    const TAG_SECURITY_CONFIGURATION = 'darvin_admin.security_configuration';

    /**
     * {@inheritdoc}
     */
    public function process(ContainerBuilder $container)
    {
        $configurationIds = $container->findTaggedServiceIds(self::TAG_SECURITY_CONFIGURATION);

        if (empty($configurationIds)) {
            return;
        }

        $poolDefinition = $container->getDefinition('darvin_admin.security.configuration.pool');

        foreach ($configurationIds as $id => $attr) {
            $poolDefinition->addMethodCall('add', array(
                new Reference($id),
            ));
        }
    }
}

Disable security configuration service IDs sorting.


<?php

/**
 * Skeleton subclass for representing a row from the 'vendor_catalog_item' table.
 *
 *
 *
 * You should add additional methods to this class to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 *ac
 * @package plugins.reach
 * @subpackage model
 */
class VendorAlignmentCatalogItem extends VendorCatalogItem
{
	public function applyDefaultValues()
	{
		$this->setServiceFeature(VendorServiceFeature::ALIGNMENT);
	}

	public function getTaskVersion($entryId, $jobData = null)
	{
		$taskVersion = parent::getTaskVersion($entryId, $jobData);

		if(!$jobData || !($jobData instanceof KalturaVendorTaskData))
			return $taskVersion;

		/* @var $jobData kAlignmentVendorTaskData */
		$attachmentAsset = assetPeer::retrieveById($jobData->getTextTranscriptAssetId());
		if(!$attachmentAsset)
			return $taskVersion;

		return $taskVersion * $attachmentAsset->getVersion();
	}

} // VendorCaptionsCatalogItem

<?php

/**
 * Skeleton subclass for representing a row from the 'vendor_catalog_item' table.
 *
 *
 *
 * You should add additional methods to this class to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 *ac
 * @package plugins.reach
 * @subpackage model
 */
class VendorAlignmentCatalogItem extends VendorCatalogItem
{
	public function applyDefaultValues()
	{
		$this->setServiceFeature(VendorServiceFeature::ALIGNMENT);
	}

	public function getTaskVersion($entryId, $jobData = null)
	{
		$taskVersion = parent::getTaskVersion($entryId, $jobData);

		if(!$jobData || !($jobData instanceof kAlignmentVendorTaskData))
			return $taskVersion;

		/* @var $jobData kAlignmentVendorTaskData */
		$attachmentAsset = assetPeer::retrieveById($jobData->getTextTranscriptAssetId());
		if(!$attachmentAsset)
			return $taskVersion;

		return $taskVersion * $attachmentAsset->getVersion();
	}

} // VendorCaptionsCatalogItem

Use core object type when checking instanceof


@layout('layouts/front-end')

@section('content')

 Vragen:

@endsection

@layout('layouts/front-end')

@section('content')

 Vragen:

                                #
                                Categorie:
                                Vraag:
                                Geopend op:	 {{-- Colspan 2 needed because the functions are embedded. --}}

                            @foreach($questions as $question)

                                    #{{ $question->id }}

                                        @foreach($question->category as $tag)
                                             {{ $tag->category }}
                                        @endforeach

                                     {{ $question->title }}
                                     {{ $question->created_at }}

                                    {{-- Functions --}}

                                            Bekijken

                                                Sluiten

                                    {{-- /Functions --}}

                            @endforeach

@endsection

Work on user specific issues

Work on user specific issues


<?php

namespace Kunstmaan\PagePartBundle\Tests\PagePartConfigurationReader;

use Kunstmaan\PagePartBundle\PageTemplate\PageTemplate;
use Kunstmaan\PagePartBundle\PageTemplate\PageTemplateConfigurationParser;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpKernel\KernelInterface;

class PageTemplateConfigurationParserTest extends TestCase
{
    public function testParseSymfony4Flow()
    {
        $kernel = $this->createMock(KernelInterface::class);
        $pageTemplateConfigurationParser = new PageTemplateConfigurationParser($kernel, [
            'contentpage' => [
                'name' => 'Content page',
                'rows' => [
                    ['regions' => [['name' => 'main', 'span' => 12]]],
                ],
                'template' => 'Pages\\ContentPage\\pagetemplate.html.twig',
            ],
        ]);

        $result = $pageTemplateConfigurationParser->parse('contentpage');
        $this->assertInstanceOf(PageTemplate::class, $result);
        $this->assertEquals('Content page', $result->getName());
    }

    public function testParseSymfony3Flow()
    {
        $kernel = $this->createMock(KernelInterface::class);
        $kernel->method('locateResource')->willReturn(__DIR__ . '/Resources/config/pagetemplates/test.yml');

        $pageTemplateConfigurationParser = new PageTemplateConfigurationParser($kernel, []);

        $result = $pageTemplateConfigurationParser->parse('MyWebsiteBundle:test');
        $this->assertInstanceOf(PageTemplate::class, $result);
        $this->assertEquals('Test page', $result->getName());
    }
}

<?php

namespace Kunstmaan\PagePartBundle\Tests\PageTemplate;

use Kunstmaan\PagePartBundle\PageTemplate\PageTemplate;
use Kunstmaan\PagePartBundle\PageTemplate\PageTemplateConfigurationParser;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpKernel\KernelInterface;

class PageTemplateConfigurationParserTest extends TestCase
{
    public function testParseSymfony4Flow()
    {
        $kernel = $this->createMock(KernelInterface::class);
        $pageTemplateConfigurationParser = new PageTemplateConfigurationParser($kernel, [
            'contentpage' => [
                'name' => 'Content page',
                'rows' => [
                    ['regions' => [['name' => 'main', 'span' => 12]]],
                ],
                'template' => 'Pages\\ContentPage\\pagetemplate.html.twig',
            ],
        ]);

        $result = $pageTemplateConfigurationParser->parse('contentpage');
        $this->assertInstanceOf(PageTemplate::class, $result);
        $this->assertEquals('Content page', $result->getName());
    }

    public function testParseSymfony3Flow()
    {
        $kernel = $this->createMock(KernelInterface::class);
        $kernel->method('locateResource')->willReturn(__DIR__ . '/Resources/config/pagetemplates/test.yml');

        $pageTemplateConfigurationParser = new PageTemplateConfigurationParser($kernel, []);

        $result = $pageTemplateConfigurationParser->parse('MyWebsiteBundle:test');
        $this->assertInstanceOf(PageTemplate::class, $result);
        $this->assertEquals('Test page', $result->getName());
    }
}

[AllBundles] Fix incorrect namespaces in test classes


<?php

/**
 * Fuel is a fast, lightweight, community driven PHP5 framework.
 *
 * @package    Fuel
 * @version    1.0
 * @author     Fuel Development Team
 * @license    MIT License
 * @copyright  2010 - 2011 Fuel Development Team
 * @link       http://fuelphp.com
 */

namespace Hybrid;

/**
 * Hybrid
 *
 * A set of class that extends the functionality of FuelPHP without
 * affecting the standard workflow when the application doesn't actually
 * utilize Hybrid feature.
 *
 * @package     Fuel
 * @subpackage  Hybrid
 * @category    Uri
 * @author      Mior Muhammad Zaki <crynobone@gmail.com>
 */

class Uri extends \Fuel\Core\Uri
{
    /**
     * Build query string
     *
     * @static
     * @access  public
     * @param   mixed   $values
     * @param   string  $start_with     Default string set to ?
     * @return  string
     */
    public static function build_get_query($values, $start_with = '?')
    {
        $dataset = array ();

        $check_get_input = function($value, & $dataset)
        {
            $data = Input::get($value);

            if (null === $data)
            {
                return false;
            }
            else
            {
                array_push($dataset, sprintf('%s=%s', $value, $data));
                return;
            }
        };

        if (is_array($values))
        {
            foreach ($values as $value)
            {
                $check_get_input($value, $dataset);
            }
        }
        else
        {
            $check_get_input($values, $dataset);
        }

        return $start_with.implode('&', $dataset);
    }

}

<?php

/**
 * Fuel is a fast, lightweight, community driven PHP5 framework.
 *
 * @package    Fuel
 * @version    1.0
 * @author     Fuel Development Team
 * @license    MIT License
 * @copyright  2010 - 2011 Fuel Development Team
 * @link       http://fuelphp.com
 */

namespace Hybrid;

/**
 * Hybrid
 *
 * A set of class that extends the functionality of FuelPHP without
 * affecting the standard workflow when the application doesn't actually
 * utilize Hybrid feature.
 *
 * @package     Fuel
 * @subpackage  Hybrid
 * @category    Uri
 * @author      Mior Muhammad Zaki <crynobone@gmail.com>
 */

class Uri extends \Fuel\Core\Uri
{
    /**
     * Build query string
     *
     * @static
     * @access  public
     * @param   mixed   $data
     * @param   string  $start_with     Default string set to ?
     * @return  string
     */
    public static function build_get_query($data, $start_with = '?')
    {
        if (is_string($data))
        {
            $data = array($data);
        }

        if (null === $data or ! is_array($data))
        {
            return '';
        }

        return $start_with.http_build_query($data);
    }

}

Update Uri::build_get_query to utilize http_build_query()


<?php
namespace Atarashii\APIBundle\Controller;

use FOS\RestBundle\Controller\FOSRestController;
use FOS\RestBundle\Controller\Annotations as Rest;
use Atarashii\APIBundle\Parser\AnimeParser;

//Temporary for offline testing
use Symfony\Component\Finder\Finder;

class AnimeController extends FOSRestController
{
    /**
     * Anime get action
     * @var integer $id Id of the anime
     * @return array
     *
     * @Rest\View()
     */
	public function getAction($id)
	{
		#http://myanimelist.net/anime/#{id}

		$downloader = $this->get('atarashii_api.downloader');
		$animedetails = $downloader->fetch('/anime/' . $id);

 		$anime = AnimeParser::parse($animedetails);

 		return $anime;
	}
}

<?php
namespace Atarashii\APIBundle\Controller;

use FOS\RestBundle\Controller\FOSRestController;
use FOS\RestBundle\Controller\Annotations as Rest;
use Atarashii\APIBundle\Parser\AnimeParser;

//Temporary for offline testing
use Symfony\Component\Finder\Finder;

class AnimeController extends FOSRestController
{
    /**
     * Anime get action
     * @var integer $id Id of the anime
     * @return array
     *
     * @Rest\View()
     */
	public function getAction($id)
	{
		#http://myanimelist.net/anime/#{id}

		$downloader = $this->get('atarashii_api.communicator');
		$animedetails = $downloader->fetch('/anime/' . $id);

 		$anime = AnimeParser::parse($animedetails);

 		return $anime;
	}
}

Update Anime to Use New Communicator

Update Anime to Use New Communicator

Change the Anime details controller to use the renamed communicator
service.


<?php
/*
 * This file is part of the Witti Project Utils package.
 *
 * (c) Greg Payne
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Witti\Project\Builder\Files;

class BuilderFiles extends \FilterIterator {
  protected $root;
  protected $stats = array(
    'added' => 0,
    'updated' => 0,
    'skipped' => 0,
  );
  public function __construct($root, $ext = 'php|inc') {
    $this->root = $root;
    $it = new \RecursiveDirectoryIterator($root, \FilesystemIterator::SKIP_DOTS);
    $it = new \RecursiveIteratorIterator($it);
    $it = new \RegexIterator($it, "@\.(?:$ext)$@s");
    $regex = '';
    parent::__construct($it);
  }

  public function accept() {
    $test = substr($this->current(), strlen($this->root));
    if (preg_match("@(?:/\.git|/\.svn/|^/vendor/)@s", $test) || !is_file($this->current())) {
      return FALSE;
    }
    return TRUE;
  }

}

<?php
/*
 * This file is part of the Witti Project Utils package.
 *
 * (c) Greg Payne
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Witti\Project\Builder\Files;

class BuilderFiles extends \FilterIterator {
  protected $root;
  protected $stats = array(
    'added' => 0,
    'updated' => 0,
    'skipped' => 0,
  );
  public function __construct($root, $ext = 'php|inc') {
    $this->root = $root;
    $it = new \RecursiveDirectoryIterator($root, \FilesystemIterator::SKIP_DOTS);
    $it = new \RecursiveIteratorIterator($it);
    if (!empty($ext)) {
      $it = new \RegexIterator($it, "@\.(?:$ext)$@s");
    }
    parent::__construct($it);
  }

  public function accept() {
    $test = substr($this->current(), strlen($this->root));
    if (preg_match("@(?:/\.git|/\.svn/|^/vendor/)@s", $test) || !is_file($this->current())) {
      return FALSE;
    }
    return TRUE;
  }

}

Allow suppression of the file extension option.


<?php

/*
 * This file is part of the Active Collab Authentication project.
 *
 * (c) A51 doo <info@activecollab.com>. All rights reserved.
 */

namespace ActiveCollab\Authentication\Authorizer\ExceptionAware;

use Exception;
use Throwable;

/**
 * @package ActiveCollab\Authentication\Authorizer\ExceptionAware
 */
interface ExceptionAwareInterface
{
    /**
     * @param  Throwable|Exception $error_or_exception
     * @return void|mixed
     */
    public function handleException($error_or_exception);
}

<?php

/*
 * This file is part of the Active Collab Authentication project.
 *
 * (c) A51 doo <info@activecollab.com>. All rights reserved.
 */

namespace ActiveCollab\Authentication\Authorizer\ExceptionAware;

use Exception;
use Throwable;

/**
 * @package ActiveCollab\Authentication\Authorizer\ExceptionAware
 */
interface ExceptionAwareInterface
{
    /**
     * @param  array               $credentials
     * @param  Throwable|Exception $error_or_exception
     * @return void|mixed
     */
    public function handleException(array $credentials, $error_or_exception);
}

Make credentials required when handling exceptions


<?php

namespace Tests\Feature;

use App\User;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;
use Illuminate\Foundation\Testing\DatabaseTransactions;

class CategoryTest extends TestCase
{
	private function createUser()
	{
		// Creating an temporal user
		return User::create( [
			'name' => 'Temporal',
			'email' => 'temporal@gmail.com',
			'password' => bcrypt('secret'),
		] );
	}

	/**
	 * A basic test example.
	 *
	 * @depends testCreateUser
	 *
	 * @param User $user
	 *
	 * @return void
	 */
    public function testCreateCategory(User $user)
    {
        $temporal_category = [
            'user_id' => $user->id,
            'name' => 'Temporal Category',
        ];

        $category =  $this->post('api/categories', $temporal_category);
        $category->assertStatus(201);
        $this->assertDatabaseHas('categories', $temporal_category);
    }
}

<?php

namespace Tests\Feature;

use App\User;
use Tests\TestCase;
use Illuminate\Foundation\Testing\DatabaseTransactions;

class CategoryTest extends TestCase
{
    use DatabaseTransactions;

    /**
	 * A basic test example.
	 *
	 * @return void
	 */
    public function testCreateCategory()
    {
        //$faker = Faker\Factory::create();
        $user = factory(User::class)->create();
        $category = array(
            'user_id' => $user->id,
            'name' => 'Category Temporal'
        );

        $response = $this->post('api/categories', $category);
        $response->assertStatus(201);
        $this->assertDatabaseHas('categories', $category);
    }
}

Add a change to test

Add a change to test


<?php

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

class CreateRepliesTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('replies', function(Blueprint $table)
		{
			$table->increments('id');
			$table->text('body');
			$table->integer('user_id')->index();
			$table->integer('topic_id')->index();
			$table->integer('vote_count')->default(0)-index();
			$table->boolean('blocked')->default(false)->index();
			$table->timestamps();
		});
	}

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

}

<?php

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

class CreateRepliesTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('replies', function(Blueprint $table)
		{
			$table->increments('id');
			$table->text('body');
			$table->text('body_original');
			$table->integer('user_id')->index();
			$table->integer('topic_id')->index();
			$table->integer('vote_count')->default(0)-index();
			$table->boolean('blocked')->default(false)->index();
			$table->timestamps();
		});
	}

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

}

Add the original body field to the replies table.