<?php

get_header(); ?>

Katherine Anne Porter

			    correspondence

Over 5,000 pages of digitized materials granting unprecedented access
			       to the ideas, attitudes, and experiences of a distinguished
			       20th century American writer.

			     Read More

<?php get_footer(); ?>

<?php

get_header(); ?>

Katherine Anne Porter

			correspondence

The University of Maryland Libraries are pleased to be
					able to share over 5,000 pages of digitized materials granting
					unprecedented access to the ideas, attitudes, and experiences of a
					distinguished 20th century American writer.

		     Read More

<?php get_footer(); ?>

Reorganize front page markup to include a hero section


<?php
/**
 * Loops through all products and Categories, and sets their URL Segments, if
 * they do not already have one
 *
 * @package commerce
 * @subpackage tasks
 */
class CommerceWriteItemsTask extends BuildTask {

	protected $title = 'Write All Commerce Items';

	protected $description = 'Loop through all products and product categories and re-save them.';

	public function run($request) {
	    $products = 0;
	    $categories = 0;

	    // First load all products
		$items = CatalogueProduct::get();

		foreach($items as $item) {
		    // Just write product, on before write should deal with the rest
		    $item->write();
		    $products++;
		}

	    // Then all categories
		$items = CatalogueCategory::get();

		foreach($items as $item) {
		    // Just write category, on before write should deal with the rest
		    $item->write();
		    $categories++;
		}

		echo "Wrote $products products and $categories categories.\n";
	}

}

<?php
/**
 * Loops through all products and Categories, and sets their URL Segments, if
 * they do not already have one
 *
 * @package commerce
 * @subpackage tasks
 */
class CatalogueWriteAllItemsTask extends BuildTask {

	protected $title = 'Write All Products and Categories';

	protected $description = 'Loop through all products and product categories and re-save them.';

	public function run($request) {
	    $products = 0;
	    $categories = 0;

	    // First load all products
		$items = CatalogueProduct::get();

		foreach($items as $item) {
		    // Just write product, on before write should deal with the rest
		    $item->write();
		    $products++;
		}

	    // Then all categories
		$items = CatalogueCategory::get();

		foreach($items as $item) {
		    // Just write category, on before write should deal with the rest
		    $item->write();
		    $categories++;
		}

		echo "Wrote $products products and $categories categories.\n";
	}

}

Rename write all items class and description


<?php
namespace ZerobRSS\Dao;

use \Doctrine\DBAL\Connection as Db;

class Users
{
    /** @var Db */
    private $db;

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

    public function getUser($value, $column = 'id')
    {
        return $this->db->createQueryBuilder()
            ->select('*')
            ->from('users')
            ->where($column.' = :value')
            ->setParameter(':value', $value)
            ->execute();
    }

    public function update($id, $values)
    {
        // Prepare update query
        $query = $this->db->createQueryBuilder()
               ->update('users')
               ->where('id = :id')
               ->setParameter(':id', $id);

        // Append parameters to update to the query
        foreach ($values as $key => $value) {
            $query = $query->set($key, ':'.$key)->setParameter(':'.$key, $value);
        }

        return $query->execute();
    }

    public function create($values)
    {
        // Prepare insert query
        $query = $this->db->createQueryBuilder()
               ->insert('users');

        // Append parameters to insert to the query
        foreach ($values as $key => $value) {
            $query = $query->setValue($key, ':'.$key)->setParameter(':'.$key, $value);
        }

        return $query->execute();
    }
}

<?php
namespace ZerobRSS\Dao;

use \Doctrine\DBAL\Connection as Db;

class Users
{
    /** @var Db */
    private $db;

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

    public function getUser($value, $column = 'id')
    {
        return $this->db->createQueryBuilder()
            ->select('*')
            ->from('users')
            ->where($column.' = :value')
            ->setParameter(':value', $value)
            ->execute();
    }

    public function update($id, $values)
    {
        // Prepare update query
        $query = $this->db->createQueryBuilder()
               ->update('users')
               ->where('id = :id')
               ->setParameter(':id', $id);

        // Append parameters to update to the query
        foreach ($values as $key => $value) {
            $query = $query->set($key, ':'.$key)->setParameter(':'.$key, $value);
        }

        return $query->execute();
    }

    public function create($values)
    {
        // Prepare insert query
        $query = $this->db->createQueryBuilder()
               ->insert('users');

        // Append parameters to insert to the query
        foreach ($values as $key => $value) {
            $query = $query->setValue($key, ':'.$key)->setParameter(':'.$key, $value);
        }

        $query->execute();

        // @TODO: Check if this works in MariaDB
        return $this->db->lastInsertId('users_id_seq');
    }
}

Return lastInsertId of user creation

Return lastInsertId of user creation


<?php

namespace ApiTest;

use Zend\Json\Json;

class JsonFileIterator extends \GlobIterator
{

    /**
     * Override parent to force pattern for JSON file
     * @param string $path
     */
    public function __construct($path)
    {
        $path = $path . '/*.json';
        parent::__construct($path, \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO);
    }

    /**
     * Override pattern to return an array instead of FileInfo.
     * @return array [url parameters, expected json, optional message]
     */
    public function current()
    {
        $file = parent::current();

        @list($params, $message) = explode('#', str_replace('.json', '', $file->getFilename()));

        $fullpath = getcwd() . '/../data/logs/tests/' . $file->getPath() . '/';
        `rm -rf $fullpath`;
        @mkdir($fullpath, 0777, true);

        $json = file_get_contents($file->getPathname());
        $result = [
            $params,
            $json,
            $message,
            $fullpath . $file->getFilename(),
        ];

        return $result;
    }
}

<?php

namespace ApiTest;

use Zend\Json\Json;

class JsonFileIterator extends \GlobIterator
{

    /**
     * Override parent to force pattern for JSON file
     * @param string $path
     */
    public function __construct($path)
    {
        $path = $path . '/*.json';
        parent::__construct($path, \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO);
    }

    /**
     * Override pattern to return an array instead of FileInfo.
     * @return array [url parameters, expected json, optional message]
     */
    public function current()
    {
        $file = parent::current();

        @list($params, $message) = explode('#', str_replace('.json', '', $file->getFilename()));

        $fullpath = getcwd() . '/data/logs/' . $file->getPath() . '/';
        `rm -rf $fullpath`;
        @mkdir($fullpath, 0777, true);

        $json = file_get_contents($file->getPathname());
        $result = [
            $params,
            $json,
            $message,
            $fullpath . $file->getFilename(),
        ];

        return $result;
    }
}

Fix path for test logs

Fix path for test logs


<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Authorization Models
    |--------------------------------------------------------------------------
    */

    'models' => [
        /*
         * The class name of the permission model to be used.
         */
        'permission' => 'Spatie\Permission\Models\Permission',

        /*
         * The class name of the role model to be used.
         */
        'role' => 'Spatie\Permission\Models\Role',

        /*
         * The class name of the user model to be used.
         */
        'user' => 'App\User',
    ],

    /*
    |--------------------------------------------------------------------------
    | Authorization Tables
    |--------------------------------------------------------------------------
    */

    'tableNames' => [
        /*
         * The name of the "users" table to be used.
         */
        'users' => 'users',

        /*
         * The name of the "roles" table to be used.
         */
        'roles' => 'roles',

        /*
         * The name of the "permissions" table to be used.
         */
        'permissions' => 'permissions',

        /*
         * The name of the "user_has_permissions" table to be used.
         */
        'user_has_permissions' => 'user_has_permissions',

        /*
         * The name of the "user_has_roles" table to be used.
         */
        'user_has_roles' => 'user_has_roles',

        /*
         * The name of the "role_has_permissions" table to be used.
         */
        'role_has_permissions' => 'role_has_permissions',
    ],

];

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Authorization Models
    |--------------------------------------------------------------------------
    */

    'models' => [
        /*
         * The class name of the permission model to be used.
         */
        'permission' => Spatie\Permission\Models\Permission::class,

        /*
         * The class name of the role model to be used.
         */
        'role' => Spatie\Permission\Models\Role::class,

        /*
         * The class name of the user model to be used.
         */
        'user' => App\User::class,
    ],

    /*
    |--------------------------------------------------------------------------
    | Authorization Tables
    |--------------------------------------------------------------------------
    */

    'tableNames' => [
        /*
         * The name of the "users" table to be used.
         */
        'users' => 'users',

        /*
         * The name of the "roles" table to be used.
         */
        'roles' => 'roles',

        /*
         * The name of the "permissions" table to be used.
         */
        'permissions' => 'permissions',

        /*
         * The name of the "user_has_permissions" table to be used.
         */
        'user_has_permissions' => 'user_has_permissions',

        /*
         * The name of the "user_has_roles" table to be used.
         */
        'user_has_roles' => 'user_has_roles',

        /*
         * The name of the "role_has_permissions" table to be used.
         */
        'role_has_permissions' => 'role_has_permissions',
    ],

];

Use class notation in config

Use class notation in config


<?php

/*
 * In configuration file
 * ...
 * 'as AccessBehavior' => [
 *    'class' => '\app\components\AccessBehavior'
 * ]
 * ...
 * (c) Artem Voitko <r3verser@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace app\components;

use yii\base\Behavior;
use yii\console\Controller;
use yii\helpers\Url;

/**
 * Redirects all users to login page if not logged in
 *
 * Class AccessBehavior
 * @package app\components
 * @author  Artem Voitko <r3verser@gmail.com>
 */
class AccessBehavior extends Behavior
{
    /**
     * Subscribe for events
     * @return array
     */
    public function events()
    {
        return [
            Controller::EVENT_BEFORE_ACTION => 'beforeAction'
        ];
    }

    /**
     * On event callback
     */
    public function beforeAction()
    {
        if (\Yii::$app->getUser()->isGuest &&
            \Yii::$app->getRequest()->url !== Url::to(\Yii::$app->getUser()->loginUrl)
        ) {
            \Yii::$app->getResponse()->redirect(\Yii::$app->getUser()->loginUrl);
        }
    }

}

<?php

/*
 * In configuration file
 * ...
 * 'as AccessBehavior' => [
 *    'class' => '\app\components\AccessBehavior'
 * ]
 * ...
 * (c) Artem Voitko <r3verser@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace app\components;

use yii\base\Behavior;
use yii\console\Controller;
use yii\helpers\Url;

/**
 * Redirects all users to login page if not logged in
 *
 * Class AccessBehavior
 * @package app\components
 * @author  Artem Voitko <r3verser@gmail.com>
 */
class AccessBehavior extends Behavior
{
    /**
     * Subscribe for events
     * @return array
     */
    public function events()
    {
        return [
            Controller::EVENT_BEFORE_ACTION => 'beforeAction'
        ];
    }

    /**
     * On event callback
     */
    public function beforeAction()
    {
        // if (\Yii::$app->getUser()->isGuest &&
        //     \Yii::$app->getRequest()->url !== Url::to(\Yii::$app->getUser()->loginUrl)
        // ) {
        //     \Yii::$app->getResponse()->redirect(\Yii::$app->getUser()->loginUrl);
        // }
    }

}

Remove the code to filter user login.

Remove the code to filter user login.

:)


@extends( 'layouts.master' )

@section( 'title', 'Welcome' )

@section( 'heading', 'Welcome' )

@section( 'main' )

    @row

        @col( s12 )

You are logged in.

        @endcol

    @endrow

    @row
        @col( s12 )
            @foreach ( $clients as $client )
                @if ( $client->init_oauth_uri )
                    init_oauth_uri }}">
                        https
                        Go to {{ $client->title ?: $client->id }}

                @elseif ( $client->home_uri )
                    home_uri }}">
                        submit
                        Go to {{ $client->title ?: $client->id }}

                @endif
            @endforeach
        @endcol
    @endrow

@endsection

@extends( 'layouts.master' )

@section( 'title', 'Welcome' )

@section( 'heading', 'Welcome' )

@section( 'main' )

    @row

        @col( s12 )

You are logged in.

        @endcol

    @endrow

    @row
        @col( s12 )
            @foreach ( $clients as $client )
                @if ( $client->init_oauth_uri )
                    init_oauth_uri }}">
                        https
                        Go to {{ $client->title ?: $client->client_id }}

                @elseif ( $client->home_uri )
                    home_uri }}">
                        submit
                        Go to {{ $client->title ?: $client->client_id }}

                @endif
            @endforeach
        @endcol
    @endrow

@endsection

Fix caption of quick link in dashboard

Fix caption of quick link in dashboard


<?php
namespace Aedart\Scaffold\Cache;

use Aedart\Scaffold\Containers\IoC;
use Aedart\Scaffold\Contracts\Builders\IndexBuilder;
use Illuminate\Contracts\Cache\Repository;

/**
 * Cache Helper
 *
 * @author Alin Eugen Deac <aedart@gmail.com>
 * @package Aedart\Scaffold\Cache
 */
class CacheHelper
{
    /**
     * Default cache directory
     */
    const DEFAULT_CACHE_DIRECTORY = IndexBuilder::DEFAULT_SCAFFOLD_INDEX_DIRECTORY . 'cache/';

    /**
     * @var Repository
     */
    static protected $cache;

    /**
     * Register the cache directory
     *
     * @param string $directory
     */
    static public function setCacheDirectory($directory)
    {
        $ioc = IoC::getInstance();

        $config = $ioc->make('config');
        $config->set('cacheDir', $directory);

        $ioc->container()['config'] = $config;
    }

    /**
     * Returns a cache repository instance
     *
     * @return Repository
     */
    static public function make()
    {
        if(!isset(self::$cache)){
            $ioc = IoC::getInstance();
            $repository = $ioc->make(Repository::class);
            self::$cache = $repository;
        }

        return self::$cache;
    }

    /**
     * Destroy the cache instance inside this helper
     */
    static public function destroy()
    {
        self::$cache = null;
    }
}

<?php
namespace Aedart\Scaffold\Cache;

use Aedart\Scaffold\Containers\IoC;
use Aedart\Scaffold\Contracts\Builders\IndexBuilder;
use Illuminate\Contracts\Cache\Repository;

/**
 * Cache Helper
 *
 * @author Alin Eugen Deac <aedart@gmail.com>
 * @package Aedart\Scaffold\Cache
 */
class CacheHelper
{
    /**
     * Default cache directory
     */
    const DEFAULT_CACHE_DIRECTORY = '.scaffold/cache/';

    /**
     * @var Repository
     */
    static protected $cache;

    /**
     * Register the cache directory
     *
     * @param string $directory
     */
    static public function setCacheDirectory($directory)
    {
        $ioc = IoC::getInstance();

        $config = $ioc->make('config');
        $config->set('cacheDir', $directory);

        $ioc->container()['config'] = $config;
    }

    /**
     * Returns a cache repository instance
     *
     * @return Repository
     */
    static public function make()
    {
        if(!isset(self::$cache)){
            $ioc = IoC::getInstance();
            $repository = $ioc->make(Repository::class);
            self::$cache = $repository;
        }

        return self::$cache;
    }

    /**
     * Destroy the cache instance inside this helper
     */
    static public function destroy()
    {
        self::$cache = null;
    }
}

Fix Fatal error: Can't use function return value


<?php
namespace Loct\Pinger\Notifier;

/**
 * Notifier Interface
 *
 * @author herloct
 */
interface NotifierInterface
{
    /**
     * Notify all recipients
     *
     * @param array $pingResults Ping results
     */
    function notify($pingResults);
}

<?php
namespace Loct\Pinger\Notifier;

/**
 * Notifier Interface
 *
 * @author herloct
 */
interface NotifierInterface
{
    /**
     * Notify all recipients
     *
     * @param array $pingResults Ping results
     */
    public function notify($pingResults);
}

Add newline at the end of file

Add newline at the end of file


<?php

/*
 * This file is part of the FOSUserBundle package.
 *
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Payum\Core\Security\Util;

/**
 * This is adopted version ot TokenGenerator class from FOSUserBundle
 *
 * @link https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Util/TokenGenerator.php
 */
class Random
{
    public static function generateToken()
    {
        return rtrim(strtr(base64_encode(self::getRandomNumber()), '+/', '-_'), '=');
    }

    private static function getRandomNumber()
    {
        // determine whether to use OpenSSL
        if (defined('PHP_WINDOWS_VERSION_BUILD') && version_compare(PHP_VERSION, '5.3.4', '<')) {
            $useOpenSsl = false;
        } elseif (!function_exists('openssl_random_pseudo_bytes')) {
            $useOpenSsl = false;
        } else {
            $useOpenSsl = true;
        }

        $nbBytes = 32;

        if ($useOpenSsl) {
            $bytes = openssl_random_pseudo_bytes($nbBytes, $strong);

            if (false !== $bytes && true === $strong) {
                return $bytes;
            }
        }

        return hash('sha256', uniqid(mt_rand(), true), true);
    }
}

<?php

/*
 * This file is part of the FOSUserBundle package.
 *
 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Payum\Core\Security\Util;

/**
 * This is adopted version ot TokenGenerator class from FOSUserBundle
 *
 * @link https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Util/TokenGenerator.php
 */
class Random
{
    public static function generateToken()
    {
        return rtrim(strtr(base64_encode(self::getRandomNumber()), '+/', '-_'), '=');
    }

    private static function getRandomNumber()
    {
        return random_bytes(32);
    }
}

Use the CSPRNG provided by PHP 7

Use the CSPRNG provided by PHP 7

For PHP 5 support, see: https://github.com/paragonie/random_compat


<?php namespace Orchestra\Config\Bootstrap;

use Orchestra\Config\FileLoader;
use Orchestra\Config\Repository;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Contracts\Foundation\Application;

class LoadConfiguration
{
    /**
     * Bootstrap the given application.
     *
     * @param  \Illuminate\Contracts\Foundation\Application  $app
     * @return void
     */
    public function bootstrap(Application $app)
    {
        $loader = new FileLoader(new Filesystem, $app['path.config']);

        $app->instance('config', $config = new Repository($loader, $app->environment()));

        // First we will see if we have a cache configuration file. If we do, we'll load
        // the configuration items from that file so that it is very quick. Otherwise
        // we will need to spin through every configuration file and load them all.
        if (file_exists($cached = $app->getCachedConfigPath()) && ! $app->runningInConsole()) {
            $items = require $cached;

            $config->set($items);
        }

        date_default_timezone_set($config['app.timezone']);
    }
}

<?php namespace Orchestra\Config\Bootstrap;

use Orchestra\Config\FileLoader;
use Orchestra\Config\Repository;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Contracts\Foundation\Application;

class LoadConfiguration
{
    /**
     * Bootstrap the given application.
     *
     * @param  \Illuminate\Contracts\Foundation\Application  $app
     * @return void
     */
    public function bootstrap(Application $app)
    {
        $loader = new FileLoader(new Filesystem, $app['path.config']);

        $app->instance('config', $config = new Repository($loader, $app->environment()));

        // First we will see if we have a cache configuration file. If we do, we'll load
        // the configuration items from that file so that it is very quick. Otherwise
        // we will need to spin through every configuration file and load them all.
        if (file_exists($cached = $app->getCachedConfigPath()) && ! $app->runningInConsole()) {
            $items = require $cached;

            $config->set($items);
        }

        date_default_timezone_set($config['app.timezone']);

        mb_internal_encoding('UTF-8');
    }
}

Set the internal encoding of mastering.

Set the internal encoding of mastering.

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


<?php

namespace Kunstmaan\ArticleBundle\Tests\DependencyInjection;

use Kunstmaan\ArticleBundle\DependencyInjection\Configuration;
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
use PHPUnit\Framework\TestCase;

class ConfigurationTest extends TestCase
{
    use ConfigurationTestCaseTrait;

    /**
     * @return \Symfony\Component\Config\Definition\ConfigurationInterface
     */
    protected function getConfiguration()
    {
        return new Configuration();
    }

    public function testProcessedValueContainsRequiredValue()
    {
        $array = [];

        $this->assertProcessedConfigurationEquals([$array], $array);
    }
}

<?php

namespace Kunstmaan\ArticleBundle\Tests\DependencyInjection;

use Kunstmaan\ArticleBundle\DependencyInjection\Configuration;
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Definition\ConfigurationInterface;

class ConfigurationTest extends TestCase
{
    use ConfigurationTestCaseTrait;

    /**
     * @return ConfigurationInterface
     */
    protected function getConfiguration(): ConfigurationInterface
    {
        return new Configuration();
    }

    public function testProcessedValueContainsRequiredValue()
    {
        $array = [];

        $this->assertProcessedConfigurationEquals([$array], $array);
    }
}

Add return type declarations to "safe" methods


<?php

namespace allejo\stakx\Engines;

use Highlight\Highlighter;

class MarkdownEngine extends \Parsedown
{
    protected $highlighter;

    public function __construct ()
    {
        $this->highlighter = new Highlighter();
    }

    protected function blockHeader($line)
    {
        $Block = parent::blockHeader($line);

        // Create our unique ids by sanitizing the header content
        $id = strtolower($Block['element']['text']);
        $id = str_replace(' ', '-', $id);
        $id = preg_replace('/[^0-9a-zA-Z-_]/', '', $id);
        $id = preg_replace('/-+/', '-', $id);

        $Block['element']['attributes']['id'] = $id;

        return $Block;
    }

    public function blockFencedCodeComplete ($block)
    {
        // The class has a `language-` prefix, remove this to get the language
        if (isset($block['element']['text']['attributes']))
        {
            $language = substr($block['element']['text']['attributes']['class'], 9);

            try
            {
                $highlighted = $this->highlighter->highlight($language, $block['element']['text']['text']);
                $block['element']['text']['text'] = $highlighted->value;

                // Only return the block if Highlighter knew the language and how to handle it.
                return $block;
            }
            // Exception thrown when language not supported, so just catch it and ignore it.
            catch (\DomainException $exception) {}
        }

        return parent::blockFencedCodeComplete($block);
    }
}

<?php

namespace allejo\stakx\Engines;

use Highlight\Highlighter;

class MarkdownEngine extends \ParsedownExtra
{
    protected $highlighter;

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

        $this->highlighter = new Highlighter();
    }

    protected function blockHeader($line)
    {
        $Block = parent::blockHeader($line);

        // Create our unique ids by sanitizing the header content
        $id = strtolower($Block['element']['text']);
        $id = str_replace(' ', '-', $id);
        $id = preg_replace('/[^0-9a-zA-Z-_]/', '', $id);
        $id = preg_replace('/-+/', '-', $id);

        $Block['element']['attributes']['id'] = $id;

        return $Block;
    }

    public function blockFencedCodeComplete ($block)
    {
        // The class has a `language-` prefix, remove this to get the language
        if (isset($block['element']['text']['attributes']))
        {
            $language = substr($block['element']['text']['attributes']['class'], 9);

            try
            {
                $highlighted = $this->highlighter->highlight($language, $block['element']['text']['text']);
                $block['element']['text']['text'] = $highlighted->value;

                // Only return the block if Highlighter knew the language and how to handle it.
                return $block;
            }
            // Exception thrown when language not supported, so just catch it and ignore it.
            catch (\DomainException $exception) {}
        }

        return parent::blockFencedCodeComplete($block);
    }
}

Add support for Parsedown Extra

Add support for Parsedown Extra


<?php
namespace Respect\Foundation\InfoProviders;

use DirectoryIterator;

class PackageName extends AbstractProvider
{
    public function providerPackageIni()
    {
        $iniPath = realpath($this->projectFolder.'/package.ini');

        if (!file_exists($iniPath))
            return '';

        $ini = parse_ini_file($iniPath, true);
        return $ini['package']['name'];
    }

    public function providerFolderStructure()
    {
        $vendorFolder  = new LibraryFolder($this->projectFolder);
        if (file_exists($vendorFolder .= DIRECTORY_SEPARATOR . new VendorName($this->projectFolder)))
            foreach (new DirectoryIterator((string) $vendorFolder) as $vendor)
                if (!$vendor->isDot() && $vendor->isDir())
                    return $vendor->getFileName();
    }
}

<?php
namespace Respect\Foundation\InfoProviders;

use DirectoryIterator;

class PackageName extends AbstractProvider
{
    public function providerPackageIni()
    {
        $iniPath = realpath($this->projectFolder.'/package.ini');

        if (!file_exists($iniPath))
            return '';

        $ini = parse_ini_file($iniPath, true);
        return $ini['package']['name'];
    }

    public function providerFolderStructure()
    {
        $vendorFolder  = new LibraryFolder($this->projectFolder);
        if (file_exists($vendorFolder .= DIRECTORY_SEPARATOR . new VendorName($this->projectFolder)))
            foreach (new DirectoryIterator((string) $vendorFolder) as $vendor)
                if (!$vendor->isDot() && $vendor->isDir())
                    return $vendor->getFileName();
    }

    public function providerDefault()
    {
        return ucfirst(preg_replace('#^.*'.DIRECTORY_SEPARATOR.'(?=\w$)#U', '', $this->projectFolder));
    }
}

Add default value for package name.

Add default value for package name.

If all else fails assume the name of the current folder is the packoge name.


<?php

namespace Romans\Filter;

use Romans\Grammar\Grammar;
use Romans\Grammar\GrammarAwareTrait;

/**
 * Int to Roman
 */
class IntToRoman
{
    use GrammarAwareTrait;

    /**
     * Default Constructor
     *
     * @param Grammar $grammar Grammar Object
     */
    public function __construct(Grammar $grammar = null)
    {
        if (! isset($grammar)) {
            $grammar = new Grammar();
        }

        $this->setGrammar($grammar);
    }

    /**
     * Filter Integer to Roman Number
     *
     * @param  int    Integer
     * @return string Roman Number Result
     */
    public function filter(int $value) : string
    {
        if ($value <= 0) {
            throw new Exception(sprintf('Invalid integer: %d', $value));
        }

        $tokens = $this->getGrammar()->getTokens();
        $values = array_reverse($this->getGrammar()->getValues());

        $result = '';

        foreach ($values as $token => $current) {
            while ($value >= $current) {
                $value  = $value - $current;
                $result = $result . $tokens[$token];
            }
        }

        return $result;
    }
}

<?php

namespace Romans\Filter;

use Romans\Grammar\Grammar;
use Romans\Grammar\GrammarAwareTrait;

/**
 * Int to Roman
 */
class IntToRoman
{
    use GrammarAwareTrait;

    /**
     * Default Constructor
     *
     * @param Grammar $grammar Grammar Object
     */
    public function __construct(Grammar $grammar = null)
    {
        if (! isset($grammar)) {
            $grammar = new Grammar();
        }

        $this->setGrammar($grammar);
    }

    /**
     * Filter Integer to Roman Number
     *
     * @param  int    Integer
     * @return string Roman Number Result
     */
    public function filter(int $value) : string
    {
        if ($value <= 0) {
            throw new Exception(sprintf('Invalid integer: %d', $value));
        }

        $tokens = $this->getGrammar()->getTokens();
        $values = array_reverse($this->getGrammar()->getValues());

        $result = '';

        foreach ($values as $token => $current) {
            while ($current > 0 && $value >= $current) {
                $value  = $value - $current;
                $result = $result . $tokens[$token];
            }
        }

        return $result;
    }
}

Fix infinite loop for filter

Fix infinite loop for filter


<?php
class Kwc_Mail_Editable_ComponentsModel extends Kwf_Model_Data_Abstract
{
    public function __construct(array $config = array())
    {
        $data = array();
        $components = Kwf_Component_Data_Root::getInstance()
            ->getComponentsByClass(array('Kwc_Mail_Editable_Component', 'Kwc_Mail_Editable_Trl_Component'));
        foreach ($components as $c) {
            $a = Kwc_Admin::getInstance($c->componentClass);
            $data[] = array(
                'id' => $c->dbId,
                'name' => Kwf_Trl::getInstance()->trlStaticExecute($c->getComponent()->getNameForEdit()),
                'settings_controller_url' => $a->getControllerUrl(),
                'content_component_class' => $c->getChildComponent('-content')->componentClass,
            );
        }
        $this->_data = $data;
        parent::__construct($config);
    }

}

<?php
class Kwc_Mail_Editable_ComponentsModel extends Kwf_Model_Data_Abstract
{
    public function __construct(array $config = array())
    {
        $data = array();
        $components = Kwf_Component_Data_Root::getInstance()
            ->getComponentsByClass(array('Kwc_Mail_Editable_Component', 'Kwc_Mail_Editable_Trl_Component'));
        $user = Kwf_Registry::get('userModel')->getAuthedUser();
        foreach ($components as $c) {
            if (Kwf_Registry::get('acl')->getComponentAcl()->isAllowed($user, $c)) {
                $a = Kwc_Admin::getInstance($c->componentClass);
                $data[] = array(
                    'id' => $c->dbId,
                    'name' => Kwf_Trl::getInstance()->trlStaticExecute($c->getComponent()->getNameForEdit()),
                    'settings_controller_url' => $a->getControllerUrl(),
                    'content_component_class' => $c->getChildComponent('-content')->componentClass,
                );
            }
        }
        $this->_data = $data;
        parent::__construct($config);
    }

}

Add filter for mail-editable to show only allowed components

The listing of kwc_mail_components is done this way and not with menuconfig sameclass
because we would get a menu-button for every kwc_mail_component in a web.


<?php

namespace M6Web\Bundle\AmqpBundle\Event;

use AMQPEnvelope;
use Symfony\Component\EventDispatcher\Event as SymfonyEvent;

/**
 * Pre retrieve message event
 */
class PreRetrieveEvent extends SymfonyEvent
{
    const NAME = 'amqp.pre_retrieve';

    /**
     * @var AMQPEnvelope
     */
    private $envelope;

    /**
     * Constructor.
     *
     * @param AMQPEnvelope|null $envelope
     */
    public function __construct(AMQPEnvelope $envelope = null)
    {
        $this->envelope = $envelope;
    }

    /**
     * @return AMQPEnvelope
     */
    public function getEnvelope()
    {
        return $this->envelope;
    }

    /**
     * @param AMQPEnvelope $envelope
     */
    public function setEnvelope($envelope)
    {
        $this->envelope = $envelope;
    }
}

<?php

namespace M6Web\Bundle\AmqpBundle\Event;

use AMQPEnvelope;
use Symfony\Component\EventDispatcher\Event as SymfonyEvent;

/**
 * Pre retrieve message event
 */
class PreRetrieveEvent extends SymfonyEvent
{
    const NAME = 'amqp.pre_retrieve';

    /**
     * @var AMQPEnvelope|bool
     */
    private $envelope;

    /**
     * Constructor.
     *
     * @param AMQPEnvelope|bool $envelope
     */
    public function __construct($envelope)
    {
        $this->envelope = $envelope;
    }

    /**
     * @return AMQPEnvelope|bool
     */
    public function getEnvelope()
    {
        return $this->envelope;
    }

    /**
     * @param AMQPEnvelope|bool $envelope
     */
    public function setEnvelope($envelope)
    {
        $this->envelope = $envelope;
    }
}

Allow booleans for the envelope

Allow booleans for the envelope


<?php

namespace Kilik\TableBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
 * This is the class that validates and merges configuration from your app/config files.
 *
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
 */
class Configuration implements ConfigurationInterface
{
    /**
     * {@inheritdoc}
     */
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder('kilik_table');
        $rootNode = $treeBuilder->getRootNode();

        // Here you should define the parameters that are allowed to
        // configure your bundle. See the documentation linked above for
        // more information on that topic.

        return $treeBuilder;
    }
}

<?php

namespace Kilik\TableBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
 * This is the class that validates and merges configuration from your app/config files.
 *
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
 */
class Configuration implements ConfigurationInterface
{
    /**
     * {@inheritdoc}
     */
    public function getConfigTreeBuilder() : TreeBuilder
    {
        $treeBuilder = new TreeBuilder('kilik_table');
        $rootNode = $treeBuilder->getRootNode();

        // Here you should define the parameters that are allowed to
        // configure your bundle. See the documentation linked above for
        // more information on that topic.

        return $treeBuilder;
    }
}

Fix kilikTable for Symfony 5.4

Fix kilikTable for Symfony 5.4


<?php

require_once __DIR__ . '/../vendor/PopPHPFramework/src/Pop/Loader/Autoloader.php';
use Pop\Loader\Autoloader;

// Instantiate the autoloader object.
$autoloader = Autoloader::factory();
$autoloader->splAutoloadRegister();

/*
 * Add any optional custom loader features here, such as,
 * registering a vendor library namespace prefix with the autoloader,
 * or, loading a class map file
 *
 */
// $autoloader->register('YourApp', __DIR__ . '/../module/YourApp/src');
// $autoloader->loadClassMap('/../module/YourApp/classmap.php');

<?php

require_once __DIR__ . '/../vendor/PopPHPFramework/src/Pop/Loader/Autoloader.php';
use Pop\Loader\Autoloader;

// Instantiate the autoloader object.
$autoloader = Autoloader::factory();
$autoloader->splAutoloadRegister();

/*
 * Add any optional custom loader features here, such as,
 * registering a vendor library namespace prefix with the autoloader,
 * or, loading a class map file
 *
 */
// $autoloader->register('YourApp', __DIR__ . '/../module/YourApp/src');
// $autoloader->loadClassMap('../module/YourApp/classmap.php');

Work on the CLI scripts

Work on the CLI scripts


<?php

namespace Becklyn\SearchBundle\Search\Result;

class SearchResultBuilder
{
    /**
     * @var SearchHit[][]
     */
    private $classMapping = [];

    public function addHit (SearchHit $hit)
    {
        $entity = $hit->getEntity();
        $id = $entity->getId();
        $entityClass = get_class($entity);

        if (isset($this->classMapping[$entityClass][$id]))
        {
            $this->classMapping[$entityClass][$id]->mergeHit($hit);
        }
        else
        {
            $this->classMapping[$entityClass][$id] = $hit;
        }
    }

    /**
     * Builds the search result
     *
     * @return SearchResult The list of all search hits, grouped by actual entity
     */
    public function getSearchResult () : SearchResult
    {
        $entitySearchHits = [];

        foreach ($this->classMapping as $fqcn => $hits)
        {
            $entitySearchHits[] = new EntitySearchHits($fqcn, $hits);
        }

        return new SearchResult($entitySearchHits);
    }
}

<?php

namespace Becklyn\SearchBundle\Search\Result;

use Doctrine\Common\Util\ClassUtils;

class SearchResultBuilder
{
    /**
     * @var SearchHit[][]
     */
    private $classMapping = [];

    public function addHit (SearchHit $hit)
    {
        $entity = $hit->getEntity();
        $id = $entity->getId();
        $entityClass = ClassUtils::getRealClass(get_class($entity));

        if (isset($this->classMapping[$entityClass][$id]))
        {
            $this->classMapping[$entityClass][$id]->mergeHit($hit);
        }
        else
        {
            $this->classMapping[$entityClass][$id] = $hit;
        }
    }

    /**
     * Builds the search result
     *
     * @return SearchResult The list of all search hits, grouped by actual entity
     */
    public function getSearchResult () : SearchResult
    {
        $entitySearchHits = [];

        foreach ($this->classMapping as $fqcn => $hits)
        {
            $entitySearchHits[] = new EntitySearchHits($fqcn, $hits);
        }

        return new SearchResult($entitySearchHits);
    }
}

Use ClassUtils to display RealClass

Use ClassUtils to display RealClass

When we build a classMapping, we want to use the real class instead of any class proxies from lazy loaded entities


<?php

namespace ScnSocialAuth\Mapper;

use ZfcBase\Mapper\AbstractDbMapper;
use Zend\Stdlib\Hydrator\HydratorInterface;

class UserProvider extends AbstractDbMapper implements UserProviderInterface
{
    protected $tableName  = 'user_provider';

    public function findUserByProviderId($providerId, $provider)
    {
        $select = $this
            ->getSelect()
            ->from($this->tableName)
            ->where(
                array(
                    'provider_id' => $providerId,
                    'provider' => $provider,
                )
            );

        $entity = $this->select($select)->current();
        $this->getEventManager()->trigger('find', $this, array('entity' => $entity));

        return $entity;
    }

    public function insert($entity, $tableName = null, HydratorInterface $hydrator = null)
    {
        return parent::insert($entity, $tableName, $hydrator);
    }
}

<?php

namespace ScnSocialAuth\Mapper;

use ZfcBase\Mapper\AbstractDbMapper;
use Zend\Stdlib\Hydrator\HydratorInterface;

class UserProvider extends AbstractDbMapper implements UserProviderInterface
{
    protected $tableName  = 'user_provider';

    public function findUserByProviderId($providerId, $provider)
    {
        $sql    = $this->getSql();
        $select = $sql->select();
        $select->from($this->tableName)
               ->where(array(
                   'provider_id' => $providerId,
                   'provider'    => $provider,
               ));

        $entity = $this->select($select)->current();
        $this->getEventManager()->trigger('find', $this, array('entity' => $entity));

        return $entity;
    }

    public function insert($entity, $tableName = null, HydratorInterface $hydrator = null)
    {
        return parent::insert($entity, $tableName, $hydrator);
    }
}

Fix issue with "readonly" table

Fix issue with "readonly" table

- Using getSelect() was leading to an issue against current ZF2 master whereby
  the table was being marked as readonly; this meant that later calling from()
  led to an exception. This patch fixes that issue by pulling the select() from
  a Sql object and then calling setTable().


<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('/resource', function () {
    $authentication = false;
    if ($authentication){
    return view('resource');
    }else {
        return view('login');
    }
});

Modify Resource for function login true or false


<?php

/**
 * Validates a value part of a pre-defined list.
 *
 * @param array $list List of values the validated value should belong to
 * @param bool $ignore_case If true, the case will be ignored for searching through the array
 */

namespace Validation;

class InArray extends \Validator\Validation_Abstract
{
	protected $_list;
	protected $_ignore_case;

	public function __construct(array $list, $ignore_case = false)
	{
		$this->_list	=	$ignore_case ? array_map('strtolower', $list) : $list;;
	}

	public function check($value)
	{
		if($this->_ignore_case)
			$value	=	strtolower($value);

		if( ! in_array($value, $this->_list))
			throw new \Exception(\Validator\i18n::get('error_in_array'));
	}
}

<?php

/**
 * Validates a value part of a pre-defined list.
 *
 * @param array $list List of values the validated value should belong to
 * @param bool $ignore_case If true, the case will be ignored for searching through the array
 */

namespace Validation;

class InArray extends \Validator\Validation_Abstract
{
	protected $_list;
	protected $_ignore_case;

	public function __construct(array $list, $ignore_case = false)
	{
		$this->_ignore_case	=	$ignore_case;
		$this->_list		=	$ignore_case ? array_map('strtolower', $list) : $list;
	}

	public function check($value)
	{
		if($this->_ignore_case)
			$value	=	strtolower($value);

		if( ! in_array($value, $this->_list))
			throw new \Exception(\Validator\i18n::get('error_in_array'));
	}
}

Fix case insensitivity parameter for inArray


<?php
namespace Repositories;

class ItemCache extends Item
{
  const CACHE_KEY = "itemSearch";
  public function where($text)
  {
    $key = self::CACHE_KEY.":".str_replace(" ", "_", $text);
    $expiration = \Config::get("cataclysm.searchCacheExpiration");
    $items = \Cache::remember($key, $expiration, function () use ($text) {
      return array_map(function ($item) {
        return $item->id;
      }, parent::where($text));
      return $result;
    });

    return array_map(function ($item) {
      return $this->find($item);
    }, $items);

  }
}

<?php
namespace Repositories;

class ItemCache extends Item
{
  const CACHE_KEY = "itemSearch";
  public function where($text)
  {
    $text = str_replace("_", " ", $text);
    $key = self::CACHE_KEY.":".str_replace(" ", "_", $text);
    $expiration = \Config::get("cataclysm.searchCacheExpiration");
    $items = \Cache::remember($key, $expiration, function () use ($text) {
      return array_map(function ($item) {
        return $item->id;
      }, parent::where($text));
      return $result;
    });

    return array_map(function ($item) {
      return $this->find($item);
    }, $items);

  }
}

Replace underscores to spaces to avoid clobbering searches. Otherwise, searching for "wooden_arrow" would store an empty result, which will be returned when searching for "wooden arrow"


<?php
namespace AssetCompress\Test\TestCase\Filter;

use AssetCompress\Filter\ClosureJs;
use Cake\TestSuite\TestCase;

class ClosureJsTest extends TestCase
{

    public function testCommand()
    {
        $Filter = $this->getMock('AssetCompress\Filter\ClosureJs', array('_findExecutable', '_runCmd'));

        $Filter->expects($this->at(0))
        ->method('_findExecutable')
        ->will($this->returnValue('closure/compiler.jar'));
        $Filter->expects($this->at(1))
        ->method('_runCmd')
        ->with($this->matchesRegularExpression('/java -jar "closure\/compiler\.jar" --js=(.*)\/CLOSURE(.*) --warning_level=QUIET/'));
        $Filter->output('file.js', 'var a = 1;');

        $Filter->expects($this->at(0))
        ->method('_findExecutable')
        ->will($this->returnValue('closure/compiler.jar'));
        $Filter->expects($this->at(1))
        ->method('_runCmd')
        ->with($this->matchesRegularExpression('/java -jar "closure\/compiler\.jar" --js=(.*)\/CLOSURE(.*) --warning_level=QUIET --language_in=ECMASCRIPT5/'));
        $Filter->settings(array('language_in' => 'ECMASCRIPT5'));
        $Filter->output('file.js', 'var a = 1;');
    }
}

<?php
namespace AssetCompress\Test\TestCase\Filter;

use AssetCompress\Filter\ClosureJs;
use Cake\TestSuite\TestCase;

class ClosureJsTest extends TestCase
{

    public function testCommand()
    {
        $Filter = $this->getMock('AssetCompress\Filter\ClosureJs', array('_findExecutable', '_runCmd'));

        $Filter->expects($this->at(0))
        ->method('_findExecutable')
        ->will($this->returnValue('closure/compiler.jar'));
        $Filter->expects($this->at(1))
        ->method('_runCmd')
        ->with($this->matchesRegularExpression('/java -jar "closure\/compiler\.jar" --js=(.*)\/CLOSURE(.*) --warning_level="QUIET"/'));
        $Filter->output('file.js', 'var a = 1;');

        $Filter->expects($this->at(0))
        ->method('_findExecutable')
        ->will($this->returnValue('closure/compiler.jar'));
        $Filter->expects($this->at(1))
        ->method('_runCmd')
        ->with($this->matchesRegularExpression('/java -jar "closure\/compiler\.jar" --js=(.*)\/CLOSURE(.*) --warning_level="QUIET" --language_in="ECMASCRIPT5"/'));
        $Filter->settings(array('language_in' => 'ECMASCRIPT5'));
        $Filter->output('file.js', 'var a = 1;');
    }
}

Fix errors in ClosureJs filter.

Fix errors in ClosureJs filter.

Fixes #250


@push('js')

@endpush

@component('core::admin._buttons-form', ['model' => $model])
@endcomponent

<file-manager related-table="{{ $model->getTable() }}" :related-id="{{ $model->id ?? 0 }}"></file-manager>
<file-field type="image" field="image_id" data="{{ $model->image }}"></file-field>

        {!! BootForm::text(__('Url'), 'url')->type('url')->placeholder('https://') !!}

{!! BootForm::select(__('Page'), 'page_id', Pages::allForSelect()) !!}

    {!! TranslatableBootForm::hidden('status')->value(0) !!}
    {!! TranslatableBootForm::checkbox(__('Published'), 'status') !!}

{!! TranslatableBootForm::textarea(__('Body'), 'body')->addClass('ckeditor-full') !!}

@push('js')

@endpush

@component('core::admin._buttons-form', ['model' => $model])
@endcomponent

{!! BootForm::hidden('id') !!}

<file-manager related-table="{{ $model->getTable() }}" :related-id="{{ $model->id ?? 0 }}"></file-manager>
<file-field type="image" field="image_id" data="{{ $model->image }}"></file-field>

        {!! BootForm::text(__('Url'), 'url')->type('url')->placeholder('https://') !!}

{!! BootForm::select(__('Page'), 'page_id', Pages::allForSelect()) !!}

    {!! TranslatableBootForm::hidden('status')->value(0) !!}
    {!! TranslatableBootForm::checkbox(__('Published'), 'status') !!}

{!! TranslatableBootForm::textarea(__('Body'), 'body')->addClass('ckeditor-full') !!}

Revert "id removed from the form"

Revert "id removed from the form"

This reverts commit deacaaa17285ee642a8888c4a0dad824ade72017.


<?php
class Kwf_Assets_Provider_KwfUtils extends Kwf_Assets_Provider_Abstract
{
    public function getDependenciesForDependency(Kwf_Assets_Dependency_Abstract $dependency)
    {
        if ($dependency instanceof Kwf_Assets_Dependency_File_Js) {
            $deps = array();
            $c = $dependency->getContents('en');
            if (preg_match('#^\s*Kwf\.Utils\.ResponsiveEl\(#m', $c)) {
                $deps[] = 'KwfResponsiveEl';
            }
            if (preg_match('#^\s*Kwf\.on(Element|Content)Ready\(#m', $c)) {
                $deps[] = 'KwfOnReady';
            }
            if (preg_match('#^\s*Kwf\.onJElementReady\(#m', $c)) {
                $deps[] = 'KwfOnReadyJQuery';
            }
            $ret = array();
            foreach ($deps as $i) {
                $d = $this->_providerList->findDependency($i);
                if (!$d) throw new Kwf_Exception("Can't find dependency '$i'");
                $ret[] = $d;
            }
            return array(
                Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_REQUIRES => $ret
            );
        }
        return array();
    }

    public function getDependency($dependencyName)
    {
        return null;
    }
}

<?php
class Kwf_Assets_Provider_KwfUtils extends Kwf_Assets_Provider_Abstract
{
    public function getDependenciesForDependency(Kwf_Assets_Dependency_Abstract $dependency)
    {
        if ($dependency instanceof Kwf_Assets_Dependency_File_Js) {
            $deps = array();
            $c = $dependency->getContents('en');
            if (preg_match('#^\s*Kwf\.Utils\.ResponsiveEl\(#m', $c)) {
                $deps[] = 'KwfResponsiveEl';
            }
            if (preg_match('#^\s*Kwf\.on(Element|Content)(Ready|Show|Hide|WidthChange)\(#m', $c)) {
                $deps[] = 'KwfOnReady';
            }
            if (preg_match('#^\s*Kwf\.onJElement(Ready|Show|Hide|WidthChange)\(#m', $c)) {
                $deps[] = 'KwfOnReadyJQuery';
            }
            $ret = array();
            foreach ($deps as $i) {
                $d = $this->_providerList->findDependency($i);
                if (!$d) throw new Kwf_Exception("Can't find dependency '$i'");
                $ret[] = $d;
            }
            return array(
                Kwf_Assets_Dependency_Abstract::DEPENDENCY_TYPE_REQUIRES => $ret
            );
        }
        return array();
    }

    public function getDependency($dependencyName)
    {
        return null;
    }
}

Improve finding onElementReady Dependencies autmatically


<?php

namespace Swis\LaravelFulltext\Tests;

use Swis\LaravelFulltext\TermBuilder;

class TermBuilderTest extends AbstractTestCase
{
    public function test_termbuilder_builds_terms_array()
    {
        global $configReturn;
        $configReturn= false;

        $termsResult = ['hi', 'im', 'a', 'few', 'terms'];
        $terms = TermBuilder::terms(implode(' ', $termsResult));
        $diff = $terms->diff($termsResult);
        $this->assertCount(0, $diff);
    }

    public function test_termbuilder_builds_terms_array_with_wildcard()
    {
        global $configReturn;
        $configReturn = true;

        $termsResult = ['hi', 'im', 'a', 'few', 'terms'];
        $terms = TermBuilder::terms(implode(' ', $termsResult));
        $termsResultWithWildcard = ['hi*', 'im*', 'a*', 'few*', 'terms*'];
        $diff = $terms->diff($termsResultWithWildcard);
        $this->assertCount(0, $diff);
    }
}

namespace Swis\LaravelFulltext;

function config($arg)
{
    global $configReturn;
    return $configReturn;
}

<?php

namespace Swis\LaravelFulltext\Tests;

use Swis\LaravelFulltext\TermBuilder;

class TermBuilderTest extends AbstractTestCase
{
    public function test_termbuilder_builds_terms_array()
    {
        global $configReturn;
        $configReturn= false;

        $termsResult = ['hi', 'im', 'a', 'few', 'terms'];
        $terms = TermBuilder::terms(implode(' ', $termsResult));
        $diff = $terms->diff($termsResult);
        $this->assertCount(0, $diff);
    }

    public function test_termbuilder_does_not_build_empty_terms()
    {
        global $configReturn;
        $configReturn = false;

        $termsResult = ['<hi', 'im', 'a', 'few', 'terms>'];
        $terms = TermBuilder::terms(implode(' ', $termsResult));
        $termsResultWithoutSpecialChars = ['hi', 'im', 'a', 'few', 'terms'];
        $diff = $terms->diff($termsResultWithoutSpecialChars);
        $this->assertCount(0, $diff);
    }

    public function test_termbuilder_builds_terms_array_with_wildcard()
    {
        global $configReturn;
        $configReturn = true;

        $termsResult = ['hi', 'im', 'a', 'few', 'terms'];
        $terms = TermBuilder::terms(implode(' ', $termsResult));
        $termsResultWithWildcard = ['hi*', 'im*', 'a*', 'few*', 'terms*'];
        $diff = $terms->diff($termsResultWithWildcard);
        $this->assertCount(0, $diff);
    }
}

namespace Swis\LaravelFulltext;

function config($arg)
{
    global $configReturn;
    return $configReturn;
}

Add test to assert TermBuilder does not build empty terms


<?php

namespace App\Modules\Networkdata\Traits;

trait NetworkDataAccount
{
    /**
     * Fetch all ATC Sessions.
     *
     * @return \Illuminate\Database\Eloquent\Relations\hasMany
     */
    public function networkDataAtc()
    {
        return $this->hasMany(\App\Modules\NetworkData\Models\Atc::class, 'account_id', 'id');
    }

    /*
     * Fetch all Pilot Sessions
     *
     * @return \Illuminate\Database\Eloquent\Relations\hasMany
     */
//    public function networkDataPilot()
//    {
//        return $this->hasMany(\App\Modules\NetworkData\Models\Pilot::class, "account_id", "id");
//    }
}

<?php

namespace App\Modules\Networkdata\Traits;

trait NetworkDataAccount
{
    /**
     * Fetch all ATC Sessions.
     *
     * @return \Illuminate\Database\Eloquent\Relations\hasMany
     */
    public function networkDataAtc()
    {
        return $this->hasMany(\App\Modules\NetworkData\Models\Atc::class, 'account_id', 'id');
    }

    /**
     * Get the member's current ATC session, if connected.
     *
     * @return \App\Modules\NetworkData\Models\Atc
     */
    public function networkDataAtcCurrent()
    {
        return $this->hasOne(\App\Modules\NetworkData\Models\Atc::class, 'account_id', 'id')
            ->whereNull('disconnected_at')
            ->limit(1);
    }

    /**
     * Determine if the user is on the network.
     *
     * @return bool
     */
    public function getIsOnNetworkAttribute()
    {
        return $this->networkDataAtcCurrent->exists;
    }

    /*
     * Fetch all Pilot Sessions
     *
     * @return \Illuminate\Database\Eloquent\Relations\hasMany
     */
//    public function networkDataPilot()
//    {
//        return $this->hasMany(\App\Modules\NetworkData\Models\Pilot::class, "account_id", "id");
//    }
}

Add new functions to the network data trait


@if ($this->previewMode)

{!! $value !!}

@else

        <textarea
            name="{{ $name }}"
            id="{{ $this->getId('textarea') }}"
            rows="20"
            class="form-control"
        >{!! trim($value) !!}</textarea>

@endif

@if ($this->previewMode)

{!! $value !!}

@else

        <textarea
            name="{{ $name }}"
            id="{{ $this->getId('textarea') }}"
            rows="20"
            class="form-control"
        >{{ trim($value) }}</textarea>

@endif

Fix <\textarea> in codeeditor breaks out of the editors textarea


<?php

	if( defined("DEBUG") && DEBUG == true )
		ini_set('display_errors', 1);

	/** classe de autoload */
	require "help/auto_load.class.php";

	use Core\Controller\Controller,
		Core\Help\AutoLoad;

	// Definindo caminho root para o autoload
	AutoLoad::setRootDir( DIR_BASE );
	// Registrando o auto load
	spl_autoload_register( array( 'Core\Help\AutoLoad', 'registerLoad' ) );

	require DIR_BASE."/app-include/app-menu.php";

	$front = new Controller();
	$front->run();

<?php

	if( defined("DEBUG") && DEBUG == true )
		ini_set('display_errors', 1);

	/** classe de autoload */
	require "help/auto_load.class.php";

	use Core\Controller\Controller,
		Core\Help\AutoLoad;

	// Definindo caminho root para o autoload
	AutoLoad::setRootDir( DIR_BASE );
	// Registrando o auto load
	spl_autoload_register( array( 'Core\Help\AutoLoad', 'registerLoad' ) );

	require DIR_BASE."/app-include/app-menu.php";

	require DIR_BASE."/app-include/app-functions.php";

	$front = new Controller();
	$front->run();

Include de funções genéricas do App

Include de funções genéricas do App


<?php
    # Database variables
    $dbhost = 'localhost:3036';
    $dbuser = 'c0smic_tyro';
    $dbpass = '2$M*k^4!?oDm';

    # Read GET variables
    $stime = $_POST['stime'];
    $etime = $_POST['etime'];
    $moves = $_POST['moves'];

    # Create output string
    $str = "$stime, $etime, \"$moves\"";

    $conn = mysql_connect($dbhost, $dbuser, $dbpass);
    if(! $conn )
    {
        die('Could not connect: ' . mysql_error());
    }

    mysql_select_db('c0smic_maze-game');

    $sql= "INSERT INTO data (stime, etime, moves)
    VALUES
    ('$stime','$etime','$moves')";

    $retval = mysql_query( $sql, $conn );
    if(! $retval )
    {
        die('Could not enter data: ' . mysql_error());
    }

    mysql_close($conn);
    echo $str;

?>

<?php

    include("/secure/data_db_settings.php");

    # Read GET variables
    $stime = $_POST['stime'];
    $etime = $_POST['etime'];
    $moves = $_POST['moves'];

    $conn = mysql_connect('localhost:3036', $dbuser, $dbpass);
    if(! $conn )
    {
        die('Could not connect: ' . mysql_error());
    }
    unset($dbuser, $dbpass);

    mysql_select_db('c0smic_maze-game');

    $sql= "INSERT INTO data (stime, etime, moves)
    VALUES
    ('$stime','$etime','$moves')";

    $retval = mysql_query( $sql, $conn );
    if(! $retval )
    {
        die('Could not enter data: ' . mysql_error());
    }

    mysql_close($conn);
    echo $str;

?>

Remove db password from source control

Remove db password from source control


<?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;

class CatsSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {

        DB::table('categories')->insert([
          'catName' => 'Sample',
          'description' => 'A sample description',
          'options' => json_encode(array
          (
            'public' => 1,
            'allow_new_contributors' => 1,
            )
          ),
        ]);
    }
}

 ?>

<?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;

class CatsSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {

        DB::table('categories')->insert([
          'catName' => 'Sample1',
          'description' => 'A sample description',
          'options' => json_encode(array
          (
            'public' => 1,
            'allow_new_contributors' => 1,
            )
          ),
        ]);

        DB::table('categories')->insert([
          'catName' => 'Sample2',
          'description' => 'A 2nd sample description',
          'options' => json_encode(array
          (
            'public' => 1,
            'allow_new_contributors' => 1,
            )
          ),
        ]);

        DB::table('categories')->insert([
          'catName' => 'Sample3',
          'description' => 'A 3rd sample description',
          'options' => json_encode(array
          (
            'public' => 1,
            'allow_new_contributors' => 1,
            )
          ),
        ]);

        DB::table('categories')->insert([
          'catName' => 'Sample4',
          'description' => 'A 4th sample description',
          'options' => json_encode(array
          (
            'public' => 1,
            'allow_new_contributors' => 1,
            )
          ),
        ]);

        DB::table('categories')->insert([
          'catName' => 'Sample5',
          'description' => 'A 5th sample description',
          'options' => json_encode(array
          (
            'public' => 1,
            'allow_new_contributors' => 1,
            )
          ),
        ]);

        DB::table('categories')->insert([
          'catName' => 'Sample6',
          'description' => 'A 6th sample description',
          'options' => json_encode(array
          (
            'public' => 1,
            'allow_new_contributors' => 1,
            )
          ),
        ]);
    }
}

 ?>

Make more cat seeds and reseed

Make more cat seeds and reseed


<?php

namespace PhpWorkshop\PhpWorkshopTest\Exercise;

use PHPUnit_Framework_TestCase;
use PhpWorkshop\PhpWorkshop\Exercise\BabySteps;

/**
 * Class BabyStepsTest
 * @package PhpWorkshop\PhpWorkshopTest\Exercise
 * @author Aydin Hassan <aydin@hotmail.co.uk>
 */
class BabyStepsTest extends PHPUnit_Framework_TestCase
{
    public function testHelloWorldExercise()
    {
        $e = new BabySteps;
        $this->assertEquals('Baby Steps', $e->getName());
        $this->assertEquals('Simple Addition', $e->getDescription());

        $args = $e->getArgs();

        foreach ($args as $arg) {
            $this->assertInternalType('int', $arg);
        }

        $this->assertFileExists(realpath($e->getSolution()));
        $this->assertFileExists(realpath($e->getProblem()));
        $this->assertNull($e->tearDown());
    }
}

<?php

namespace PhpWorkshop\PhpWorkshopTest\Exercise;

use PHPUnit_Framework_TestCase;
use PhpWorkshop\PhpWorkshop\Exercise\BabySteps;

/**
 * Class BabyStepsTest
 * @package PhpWorkshop\PhpWorkshopTest\Exercise
 * @author Aydin Hassan <aydin@hotmail.co.uk>
 */
class BabyStepsTest extends PHPUnit_Framework_TestCase
{
    public function testHelloWorldExercise()
    {
        $e = new BabySteps;
        $this->assertEquals('Baby Steps', $e->getName());
        $this->assertEquals('Simple Addition', $e->getDescription());

        //sometime we don't get any args as number of args is random
        //we need some args for code-coverage, so just try again
        do {
            $args = $e->getArgs();
        } while (empty($args));

        foreach ($args as $arg) {
            $this->assertInternalType('int', $arg);
        }

        $this->assertFileExists(realpath($e->getSolution()));
        $this->assertFileExists(realpath($e->getProblem()));
        $this->assertNull($e->tearDown());
    }
}

Fix random code coverage decreases

Fix random code coverage decreases


<?php

namespace Page;

/**
 * Class TasksPage
 * @package Page
 */
class ApiPage
{
    const URL = 'http://localhost:8000/task';
    /**
     *
     * @param \AcceptanceTester $I Codeception variable
     */
    public function __construct(\AcceptanceTester $I)
    {
        $this->tester = $I;
    }

    /**
     * Function used to create new task
     *
     * @param string $task task description
     * @return array
     */
    public function newTask($task)
    {
        $I=$this->tester;
        $I->sendPOST(static::URL, ['name' => $task]);
    }
}

Add Test case with delete Feature

Add Test case with delete Feature


<?php
/**
 * Here you can initialize variables that will be available to your tests.
 */

use Codeception\Util\Fixtures;

// Define a complete, valid configuration identical to that configured in the functional suite.
$mockValidModuleConfig = array(
    "create" => true,
    "delete" => true,
    "users" => array(
        "administrator" => array(
            "name" => "test.administrator",
            "email" => "test.administrator@example.com",
            "pass" => "foo",
            "roles" => array("administrator", "editor"),
            "root" => true,
        ),
        "editor" => array(
            "name" => "test.editor",
            "email" => "test.editor@example.com",
            "pass" => "foo",
            "roles" => array("editor", "moderator"),
        ),
        "moderator" => array(
            "name" => "test.moderator",
            "email" => "test.moderator@example.com",
            "pass" => "foo",
            "roles" => array("moderator"),
        ),
    ),
    "drush-alias" => "@d7.local",
);

// Define a complete, valid configuration with email addresses for some roles.
//
// NOTE: don't use admin@example.com for the administrator test user, as the
// site we're testing against has uid 1 pre-configured with this address, and
// the test user is not created.
$mockValidModuleConfigWithEmails = array_merge(
    array("emails" => array("administrator" => "administrator@example.com", "editor" => "editor@example.com")),
    $mockValidModuleConfig
);

Fixtures::add("validModuleConfig", $mockValidModuleConfig);
Fixtures::add("validModuleConfigWithEmails", $mockValidModuleConfigWithEmails);

<?php
/**
 * Here you can initialize variables that will be available to your tests.
 */

use Codeception\Util\Fixtures;

// Define a complete, valid configuration identical to that configured in the functional suite.
$mockValidModuleConfig = array(
    "create" => true,
    "delete" => true,
    "users" => array(
        "administrator" => array(
            "name" => "test.administrator",
            "email" => "test.administrator@example.com",
            "pass" => "foo",
            "roles" => array("administrator", "editor"),
            "root" => true,
        ),
        "editor" => array(
            "name" => "test.editor",
            "email" => "test.editor@example.com",
            "pass" => "foo",
            "roles" => array("editor", "moderator"),
        ),
        "moderator" => array(
            "name" => "test.moderator",
            "email" => "test.moderator@example.com",
            "pass" => "foo",
            "roles" => array("moderator"),
        ),
    ),
    "drush-alias" => "@d7.local",
);
Fixtures::add("validModuleConfig", $mockValidModuleConfig);

Remove module config with emails fixture


<?php

namespace Knplabs\TimeBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class TimeExtension extends Extension
{

    public function configLoad(array $configs, ContainerBuilder $container)
    {
        foreach ($configs as $config) {
            $this->doConfigLoad($config, $container);
        }
    }

    public function doConfigLoad(array $config, ContainerBuilder $container)
    {
        if(!$container->hasDefinition('time.templating.helper.time')) {
            $loader = new XmlFileLoader($container, __DIR__.'/../Resources/config');
            $loader->load('templating.xml');
            $loader->load('twig.xml');
        }
    }

    /**
     * Returns the base path for the XSD files.
     *
     * @return string The XSD base path
     */
    public function getXsdValidationBasePath()
    {
        return null;
    }

    public function getNamespace()
    {
        return 'http://www.symfony-project.org/schema/dic/symfony';
    }

    public function getAlias()
    {
        return 'time';
    }

}

<?php

namespace Knplabs\TimeBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\FileLocator;

class TimeExtension extends Extension
{

    public function configLoad(array $configs, ContainerBuilder $container)
    {
        foreach ($configs as $config) {
            $this->doConfigLoad($config, $container);
        }
    }

    public function doConfigLoad(array $config, ContainerBuilder $container)
    {
        if(!$container->hasDefinition('time.templating.helper.time')) {
            $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
            $loader->load('templating.xml');
            $loader->load('twig.xml');
        }
    }

    /**
     * Returns the base path for the XSD files.
     *
     * @return string The XSD base path
     */
    public function getXsdValidationBasePath()
    {
        return null;
    }

    public function getNamespace()
    {
        return 'http://www.symfony-project.org/schema/dic/symfony';
    }

    public function getAlias()
    {
        return 'time';
    }

}

Update dependency injection extension to make use of FileLocator


<?php defined('SYSPATH') or die('No direct script access.');
// Notify module view for Twitter Bootstrap 2.0
foreach ($msgs as $msg_type => $msgs_of_type):
    $class = NULL;
    if (in_array($msg_type, array('success', 'warning', 'info', 'error')))
    {
        $class = ' alert-' . $msg_type;
    }?>
<div class="alert alert-block fade in<?php echo $class ?>">
    ×
    <?php echo count($msgs_of_type) ? implode("
\n", $msgs_of_type) : $msgs_of_type?>

<? endforeach ?>

<?php defined('SYSPATH') or die('No direct script access.');
// Notify module view for Twitter Bootstrap 2.0
foreach ($msgs as $msg_type => $msgs_of_type):
    $class = '';
    if (in_array($msg_type, array('success', 'warning', 'info', 'error')))
    {
        $class = ' alert-' . $msg_type;
    }
    ?>
    <div class="alert alert-block fade in <?php echo $class ?>">
        ×
        <?php echo count($msgs_of_type) ? implode("
\n", $msgs_of_type) : $msgs_of_type?>

<?php endforeach ?>

Fix tags and $class treated as string instead of null


<?php
/**
 * mbp-logging-reports.php
 *
 * A producer to create reports based on logged data in mb-logging-api.
 */

use DoSomething\MBP_LoggingReports\MBP_LoggingReports_Users;

date_default_timezone_set('America/New_York');
define('CONFIG_PATH',  __DIR__ . '/messagebroker-config');

// Load up the Composer autoload magic
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/mbp-logging-reports.config.inc';

if (isset($_GET['source'])) {
  $sources[0] = $_GET['source'];
}
elseif (isset($argv[1])) {
  $sources[0] = $argv[1];
}
// all
else {
  $sources = [
    'niche',
    'afterschool'
  ];
}

echo '------- mbp-logging-reports START: ' . date('D M j G:i:s T Y') . ' -------', PHP_EOL;

try {

  // Kick off
  $mbpLoggingReport = new MBP_LoggingReports_Users();

  // Gather digest message mailing list
  $mbpLoggingReport->report('runningMonth', $sources);
}
catch(Exception $e) {
  echo $e->getMessage(), PHP_EOL;
}

echo '------- mbp-logging-reports END: ' . date('D M j G:i:s T Y') . ' -------', PHP_EOL;

<?php
/**
 * mbp-logging-reports.php
 *
 * A producer to create reports based on logged data in mb-logging-api.
 */

use DoSomething\MBP_LoggingReports\MBP_LoggingReports_Users;

date_default_timezone_set('America/New_York');
define('CONFIG_PATH',  __DIR__ . '/messagebroker-config');

// Load up the Composer autoload magic
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/mbp-logging-reports.config.inc';

if (isset($_GET['source'])) {
  $sources[0] = $_GET['source'];
}
elseif (isset($argv[1])) {
  $sources[0] = $argv[1];
}

if ($sources[0] == 'all') {
  $sources = [
    'niche',
    'afterschool'
  ];
}

echo '------- mbp-logging-reports START: ' . date('D M j G:i:s T Y') . ' -------', PHP_EOL;

try {

  // Kick off
  $mbpLoggingReport = new MBP_LoggingReports_Users();

  // Gather digest message mailing list
  $mbpLoggingReport->report('runningMonth', $sources);
}
catch(Exception $e) {
  echo $e->getMessage(), PHP_EOL;
}

echo '------- mbp-logging-reports END: ' . date('D M j G:i:s T Y') . ' -------', PHP_EOL;

Build sources for all flag

Build sources for all flag


<?php

/**
 * Hoa Framework
 *
 *
 * @license
 *
 * GNU General Public License
 *
 * This file is part of Hoa Open Accessibility.
 * Copyright (c) 2007, 2008 Ivan ENDERLIN. All rights reserved.
 *
 * HOA Open Accessibility is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * HOA Open Accessibility is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with HOA Open Accessibility; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *
 * @category    Framework
 * @package     Hoa_Tokenizer
 * @subpackage  Hoa_Tokenizer_Token_Whitespace
 *
 */

/**
 * Hoa_Framework
 */
require_once 'Framework.php';

/**
 * Hoa_Tokenizer_Token_Util_Exception
 */
import('Tokenizer.Token.Util.Exception');

/**
 * Hoa_Tokenizer_Token_Util_Interface
 */
import('Tokenizer.Token.Util.Interface');

/**
 * Hoa_Tokenizer
 */
import('Tokenizer.~');

/**
 * Class Hoa_Tokenizer_Token_Whitespace.
 *
 * Represent a whitespace.
 *
 * @author      Ivan ENDERLIN <ivan.enderlin@hoa-project.net>
 * @copyright   Copyright (c) 2007, 2008 Ivan ENDERLIN.
 * @license     http://gnu.org/licenses/gpl.txt GNU GPL
 * @since       PHP 5
 * @version     0.1
 * @package     Hoa_Tokenizer
 * @subpackage  Hoa_Tokenizer_Token_Whitespace
 */

class Hoa_Tokenizer_Token_Whitespace implements Hoa_Tokenizer_Token_Util_Interface {

    /**
     * Transform token to “tokenizer array”.
     *
     * @access  public
     * @param   int     $context    Context.
     * @return  array
     */
    public function toArray ( $context = Hoa_Tokenizer::CONTEXT_STANDARD ) {

        return array(array(

        ));
    }
}

Write the whitespace structure (it's a pretext for testing SVN hooks).


<?php
class Kwc_List_ChildPages_Teaser_Component extends Kwc_Abstract
{
    public static function getSettings()
    {
        $ret = parent::getSettings();

        $ret['generators']['child'] = array(
            'class' => 'Kwc_List_ChildPages_Teaser_Generator',
            'component' => 'Kwc_List_ChildPages_Teaser_TeaserImage_Component'
        );
        $ret['childModel'] = 'Kwc_List_ChildPages_Teaser_Model';

        $ret['componentName'] = trlKwfStatic('List child pages');
        $ret['cssClass'] = 'webStandard';
        $ret['assetsAdmin']['dep'][] = 'KwfProxyPanel';
        $ret['assetsAdmin']['files'][] = 'kwf/Kwc/Abstract/List/List.js';

        $ret['extConfig'] = 'Kwc_List_ChildPages_Teaser_ExtConfig';
        return $ret;
    }

    public function getTemplateVars()
    {
        $ret = parent::getTemplateVars();
        $ret['children'] = $this->getData()->getChildComponents(array('generator' => 'child'));
        return $ret;
    }
}

<?php
class Kwc_List_ChildPages_Teaser_Component extends Kwc_Abstract
{
    public static function getSettings()
    {
        $ret = parent::getSettings();

        $ret['generators']['child'] = array(
            'class' => 'Kwc_List_ChildPages_Teaser_Generator',
            'component' => 'Kwc_List_ChildPages_Teaser_TeaserImage_Component'
        );
        $ret['childModel'] = 'Kwc_List_ChildPages_Teaser_Model';

        $ret['componentName'] = trlKwfStatic('List child pages');
        $ret['cssClass'] = 'webStandard';
        $ret['assetsAdmin']['dep'][] = 'KwfProxyPanel';
        $ret['assetsAdmin']['files'][] = 'kwf/Kwc/Abstract/List/List.js';

        $ret['extConfig'] = 'Kwc_List_ChildPages_Teaser_ExtConfig';
        return $ret;
    }

    public function getTemplateVars()
    {
        $ret = parent::getTemplateVars();

        /*
        Now the following line look unneded but I can tell you it is needed if you run koala
        on a 100 year old webserver with php 5.2.4 (WTF!) that crashes (yes, segfault) if the stack (or whatever?)
        is too large. Stupid PHP, Stupid POI. (Stupid is as stupid does.)
        */
        $this->getData()->getPage()->getChildPages();

        $ret['children'] = $this->getData()->getChildComponents(array('generator' => 'child'));
        return $ret;
    }
}

Fix (or, more workaround) php 5.2 segfault

many hours wasted in debugging this shit


<?php
namespace Oro\Bundle\SegmentBundle\Tests\Functional\Entity\Repository;

use Doctrine\Bundle\DoctrineBundle\Registry;

use Oro\Bundle\SegmentBundle\Entity\Repository\SegmentRepository;
use Oro\Bundle\SegmentBundle\Tests\Functional\DataFixtures\LoadSegmentData;
use Oro\Bundle\TestFrameworkBundle\Test\WebTestCase;

class SegmentSnapshotRepositoryTest extends WebTestCase
{
    protected function setUp()
    {
        $this->initClient();
        $this->loadFixtures([LoadSegmentData::class]);
    }

    public function testFindByEntity()
    {
        /** @var Registry $registry */
        $registry = $this->getContainer()->get('doctrine');
        /** @var SegmentRepository $segmentRepository */
        $segmentRepository = $registry->getRepository('OroSegmentBundle:Segment');

        $result = $segmentRepository->findByEntity('Oro\Bundle\TestFrameworkBundle\Entity\WorkflowAwareEntity');

        $this->assertCount(50, $result);
        foreach ($result as $segment) {
            $this->assertStringStartsWith('segment_', $segment);
        }
    }
}

BB-7975: Add to configuration select with segment lists
- cs fix


<?php
/*
 * WellCommerce Open-Source E-Commerce Platform
 *
 * This file is part of the WellCommerce package.
 *
 * (c) Adam Piotrowski <adam@wellcommerce.org>
 *
 * For the full copyright and license information,
 * please view the LICENSE file that was distributed with this source code.
 */

namespace WellCommerce\Bundle\CurrencyBundle\Tests\Manager;

use WellCommerce\Bundle\CoreBundle\Test\Manager\AbstractManagerTestCase;

/**
 * Class CurrencyManagerTest
 *
 * @author  Adam Piotrowski <adam@wellcommerce.org>
 */
class CurrencyManagerTest extends AbstractManagerTestCase
{
    protected function get()
    {
        return $this->container->get('currency.manager');
    }
}

<?php
/*
 * WellCommerce Open-Source E-Commerce Platform
 *
 * This file is part of the WellCommerce package.
 *
 * (c) Adam Piotrowski <adam@wellcommerce.org>
 *
 * For the full copyright and license information,
 * please view the LICENSE file that was distributed with this source code.
 */

namespace WellCommerce\Bundle\CurrencyBundle\Tests\Manager;

use WellCommerce\Bundle\CoreBundle\Test\Manager\AbstractManagerTestCase;
use WellCommerce\Bundle\DoctrineBundle\Manager\ManagerInterface;

/**
 * Class CurrencyManagerTest
 *
 * @author  Adam Piotrowski <adam@wellcommerce.org>
 */
class CurrencyManagerTest extends AbstractManagerTestCase
{
    protected function get() : ManagerInterface
    {
        return $this->container->get('currency.manager');
    }
}

Return types in manager tests

Return types in manager tests


<?php

namespace App\Repositories;

use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;

interface RepositoryInterface
{
	/**
	 * Fetches all entities from the storage.
	 *
	 * @param array $columns
	 *
	 * @return Collection
	 */
	public function getAll(array $columns = ['*']);

	/**
	 * Fetches the specified entity from the storage.
	 *
	 * @param int   $id
	 * @param array $columns
	 *
	 * @return Model
	 */
	public function getById($id, array $columns = ['*']);

	/**
	 * Deletes the specified entity from the storage.
	 *
	 * @param int $id
	 *
	 * @return Model
	 */
	public function deleteById($id);
}

<?php

namespace App\Repositories;

use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\ModelNotFoundException;

interface RepositoryInterface
{
	/**
	 * Fetches all entities from the storage.
	 *
	 * @param array $columns
	 *
	 * @return Collection
	 */
	public function getAll(array $columns = ['*']);

	/**
	 * Fetches the specified entity from the storage.
	 *
	 * @param int   $id
	 * @param array $columns
	 *
	 * @return Model
	 * @throws ModelNotFoundException
	 */
	public function getById($id, array $columns = ['*']);

	/**
	 * Deletes the specified entity from the storage.
	 *
	 * @param int $id
	 *
	 * @return Model
	 * @throws ModelNotFoundException
	 */
	public function deleteById($id);
}

Add @throws declarations to method comments.


<?php

/*
 * This file is part of the Assetic package, an OpenSky project.
 *
 * (c) 2010-2013 OpenSky Project Inc
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Assetic\Filter;

use Assetic\Factory\AssetFactory;

/**
 * Like CallablesFilter, but it is also a DependencyExtractor
 *
 * @author Matthias Pigulla <mp@webfactory.de>
 */
class CallablesDependencyExtractor extends CallablesFilter implements DependencyExtractorInterface
{

    protected $extractor;

    public function __construct($loader = null, $dumper = null, $extractor = null)
    {
        parent::__construct($loader, $dumper);
        $this->extractor = $extractor;
    }

    public function getChildren(AssetFactory $factory, $content, $loadPath = null)
    {
        return $this->extractor($factory, $content, $loadPath);
    }

}

<?php

/*
 * This file is part of the Assetic package, an OpenSky project.
 *
 * (c) 2010-2013 OpenSky Project Inc
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Assetic\Filter;

use Assetic\Factory\AssetFactory;

/**
 * Like CallablesFilter, but it is also a DependencyExtractor
 *
 * @author Matthias Pigulla <mp@webfactory.de>
 */
class CallablesDependencyExtractor extends CallablesFilter implements DependencyExtractorInterface
{

    protected $extractor;

    public function __construct($loader = null, $dumper = null, $extractor = null)
    {
        parent::__construct($loader, $dumper);
        $this->extractor = $extractor;
    }

    public function getChildren(AssetFactory $factory, $content, $loadPath = null)
    {
        if (null !== $callable = $this->extractor) {
            return $callable($factory, $content, $loadPath);
        }
    }

}

Fix totally screwed code >:-)

Fix totally screwed code >:-)

Better run once before push.


<?php

use Heyday\CacheInclude\Container;

/**
 * Class CacheIncludeController
 */
class CacheIncludeController extends CliController
{
    /**
     * Ensure clear actions can only be run from the command line
     */
    public function init()
    {
        parent::init();
        if (!Director::is_cli() && !Permission::check('ADMIN')) {
            return Security::permissionFailure();
        }
    }
    /**
     *
     */
    public function clearAll()
    {
        $dic = $this->getContainer();
        $dic['cacheinclude']->flushAll();
    }
    /**
     *
     */
    public function clearTemplate()
    {
        if (isset($_GET['args'][0])) {
            $dic = $this->getContainer();
            $dic['cacheinclude']->flushByName($_GET['args'][0]);
        }
    }
    /**
     * @return Container
     */
    protected function getContainer()
    {
        return Container::getInstance();
    }
}

<?php

use Heyday\CacheInclude\Container;

/**
 * Class CacheIncludeController
 */
class CacheIncludeController extends \CliController
{
    static $allowed_actions = array(
        'index',
        'clearAll',
        'clearTemplate'
    );
    /**
     * Holds the dependency injection container
     * @var
     */
    protected $container;
    /**
     *
     */
    public function __construct()
    {
        $this->container = Container::getInstance();
        parent::__construct();
    }
    /**
     * Ensure clear actions can only be run from the command line
     */
    public function init()
    {
        parent::init();
        if (!Director::is_cli() && !Permission::check('ADMIN')) {
            return Security::permissionFailure();
        }
    }
    /**
     *
     */
    public function index()
    {
        return <<<INFO
Usage:
sake cache-include #help
sake cache-include/clearAll #clear all templates
sake cache-include/clearTemplate/TemplateName #clear specific template

INFO;
    }
    /**
     * Clears all caches
     */
    public function clearAll()
    {
        $this->getService('cacheinclude')->flushAll();
        return 'Done' . PHP_EOL;
    }
    /**
     *
     */
    public function clearTemplate()
    {
        if ($this->request->param('ID')) {
            $this->getService('cacheinclude')->flushByName($this->request->param('ID'));
            return 'Done' . PHP_EOL;
        } else {
            return 'You must specify a template:' . PHP_EOL . $this->index();
        }
    }
    protected function getService($name)
    {
        return $this->container[$name];
    }
}

UPDATE: Improve cacheing cli controller for clear cache actions


            @if($model->$field)

                {!! $model->present()->thumb(150, 150, ['resize'], $field) !!}
                getTable() }}" data-id="{{ $model->id }}" data-field="{{ $field }}">Supprimer

            @endif

                {!! BootForm::file(trans('validation.attributes.'.$field), $field) !!}

            @if($model->$field)

                {!! $model->present()->thumb(150, 150, ['resize'], $field) !!}
                getTable() }}" data-id="{{ $model->id }}" data-field="{{ $field }}">@lang('global.Delete')

            @endif

                {!! BootForm::file(trans('validation.attributes.'.$field), $field) !!}

Make translatable text "Supprimier" in image fieldset template


<!DOCTYPE html>

    <?php include("include/common.html"); ?>
    <meta charset="utf-8">
    <title>About</title>

      <?php include("include/header.html"); ?>

About GAMR

			  GAMR was written as a team project for the WildHacks 2015 hackathon. It was conceptualized as a way for people who wish to find a party with which to play a multi-player game to find one another and play together. As team member Murphy Angelo said,

I think that it's disappointing how there are a lot of cool games that people don't really play online, and that you can't really find anyone to play with locally. I wish there was an easier way to find people to play with.

			Fellow team members Elana Stettin and Ryan Hodin agreed with this sentiment, and thus GAMR was born.
      <?php include("include/footer.html"); ?>

<!DOCTYPE html>

    <?php include("include/common.html"); ?>
    <meta charset="utf-8">
    <title>About</title>

      <?php include("include/header.html"); ?>

About GAMR

			  GAMR was written as a team project for the WildHacks 2015 hackathon. It was conceptualized as a way for people who wish to find a party with which to play a multi-player game to find one another and play together. As team member Murphy Angelo said,

I think that it's disappointing how there are a lot of cool games that people don't really play online, and that you can't really find anyone to play with locally. I wish there was an easier way to find people to play with.

			Fellow team members Elana Stettin and Ryan Hodin agreed with this sentiment, and thus GAMR was born.

			GAMR continues to this day to be funded entirely by donations. If you like it, please consider clicking the button below to donate.
      <?php include("include/footer.html"); ?>

Add shameless pleading for funds.

Add shameless pleading for funds.

We're college students. Our pride is not worth as much as money.


<?php
  function get_the_posts_navigation( $args = array() ) {
    $navigation = '';

    // Don't print empty markup if there's only one page.
    if ( $GLOBALS['wp_query']->max_num_pages > 1 ) {
      $args = wp_parse_args( $args, array(
        'prev_text'          => __( '← Older posts' ),
        'next_text'          => __( 'Newer posts →' ),
        'screen_reader_text' => __( 'Posts navigation' ),
      ) );

      $next_link = get_previous_posts_link( $args['next_text'] );
      $prev_link = get_next_posts_link( $args['prev_text'] );

      if ( $prev_link ) {
        $navigation .= '
' . $prev_link . '
';
      }

      if ( $next_link ) {
        $navigation .= '
' . $next_link . '
';
      }

      $navigation = _navigation_markup( $navigation, 'posts-navigation', $args['screen_reader_text'] );
    }

    return $navigation;
  }
?>

<?php the_posts_pagination( array( 'mid_size' => 2 ) ); ?>

Revert "Works on customizing next/prev page links for posts"

This reverts commit 15be4239cfd24dba4e82fd3d0a13bcc1fe8198ab.


<?php
$home = drush_server_home();
// Solve the key file to use
$path = explode('/', dirname(__FILE__));
array_pop($path);
$path[] = '/../.vagrant';
$path = implode('/', $path);
$key = shell_exec('find ' . $path . ' -iname private_key');
if (!$key) {
  $key = $home . '/.vagrant.d/insecure_private_key';
}
$key = rtrim($key);

$aliases['local'] = array(
  'parent' => '@parent',
  'site' => 'ansibleref',
  'env' => 'vagrant',
  'root' => '/vagrant/drupal/current/web',
  'remote-host' => 'local.ansibleref.com',
  'remote-user' => 'vagrant',
  'ssh-options' => '-i ' . $key,
);

<?php
$home = drush_server_home();
// Solve the key file to use
$path = explode('/', dirname(__FILE__));
array_pop($path);
$path[] = '/../.vagrant';
$path = implode('/', $path);
$key = shell_exec('find ' . $path . ' -iname private_key');
if (!$key) {
  $key = $home . '/.vagrant.d/insecure_private_key';
}
$key = rtrim($key);

$aliases['local'] = array(
  'uri' => 'https://local.ansibleref.com',
  'parent' => '@parent',
  'site' => 'ansibleref',
  'env' => 'vagrant',
  'root' => '/vagrant/drupal/current/web',
  'remote-host' => 'local.ansibleref.com',
  'remote-user' => 'vagrant',
  'ssh-options' => '-i ' . $key,
);

Add uri setting to aliases example alias as required by Drush 8.


<?php

namespace Omnipay\Fasapay\Message;

use Omnipay\Common\Message\AbstractResponse;
use Omnipay\Common\Message\RedirectResponseInterface;

/**
 * Dummy Response
 */
class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface
{
    protected $endpoint;

    public function __construct($purchaseRequest, $data, $endpoint)
    {
        parent::__construct($purchaseRequest, $data);
        $this->endpoint = $endpoint;
    }

    /**
     * Gets the redirect target url.
     */
    public function getRedirectUrl()
    {
        return $this->endpoint;
    }

    /**
     * Get the required redirect method (either GET or POST).
     */
    public function getRedirectMethod()
    {
        return OAUTH_HTTP_METHOD_POST;
    }

    /**
     * Gets the redirect form data array, if the redirect method is POST.
     */
    public function getRedirectData()
    {
        $data = $this->getData();
        foreach ($data as $key => $value) {
            if(empty($value))
            {
                unset($data[$key]);
            }
        }
        return $data;
    }

    /**
     * Is the response successful?
     *
     * @return boolean
     */
    public function isSuccessful()
    {
        return true;
    }

    public function isRedirect()
    {
        return true;
    }
}

<?php

namespace Omnipay\Fasapay\Message;

use Omnipay\Common\Message\AbstractResponse;
use Omnipay\Common\Message\RedirectResponseInterface;

/**
 * Dummy Response
 */
class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface
{
    protected $endpoint;

    public function __construct($purchaseRequest, $data, $endpoint)
    {
        parent::__construct($purchaseRequest, $data);
        $this->endpoint = $endpoint;
    }

    /**
     * Gets the redirect target url.
     */
    public function getRedirectUrl()
    {
        return $this->endpoint;
    }

    /**
     * Get the required redirect method (either GET or POST).
     */
    public function getRedirectMethod()
    {
        return 'post';
    }

    /**
     * Gets the redirect form data array, if the redirect method is POST.
     */
    public function getRedirectData()
    {
        $data = $this->getData();
        foreach ($data as $key => $value) {
            if(empty($value))
            {
                unset($data[$key]);
            }
        }
        return $data;
    }

    /**
     * Is the response successful?
     *
     * @return boolean
     */
    public function isSuccessful()
    {
        return true;
    }

    public function isRedirect()
    {
        return true;
    }
}

Use string post instead of constant

Use string post instead of constant


<?php

namespace WireMock\Client;

class HttpWait
{
    public function waitForServerToGive200($url, $timeoutSecs = 5)
    {
        $startTime = microtime(true);
        $serverStarted = false;
        while (microtime(true) - $startTime < $timeoutSecs) {
            try {
                $headers = @get_headers($url, 1);
            } catch (\Exception $e) {
                continue;
            }
            if (isset($headers) && isset($headers[0]) && $headers[0] === 'HTTP/1.1 200 OK') {
                $serverStarted = true;
                break;
            }
        }
        return $serverStarted;
    }

    public function waitForServerToFailToRespond($url, $timeoutSecs = 5)
    {
        $startTime = microtime(true);
        $serverFailedToRespond = false;
        while (microtime(true) - $startTime < $timeoutSecs) {
            if (@get_headers($url, 1) === false) {
                $serverFailedToRespond = true;
                break;
            }
        }
        return $serverFailedToRespond;
    }
}

<?php

namespace WireMock\Client;

class HttpWait
{
    public function waitForServerToGive200($url, $timeoutSecs = 10)
    {
        $debugTrace = array();
        $startTime = microtime(true);
        $serverStarted = false;
        while (microtime(true) - $startTime < $timeoutSecs) {
            try {
                $headers = @get_headers($url, 1);
            } catch (\Exception $e) {
                $debugTrace[] = "$url not yet up. Error getting headers: " . $e->getMessage();
                continue;
            }
            if (isset($headers) && isset($headers[0]) && $headers[0] === 'HTTP/1.1 200 OK') {
                $serverStarted = true;
                break;
            } else {
                if (!isset($headers)) {
                    $debugTrace[] = "$url not yet up. \$headers not set";
                } else if (!isset($headers[0])) {
                    $debugTrace[] = "$url not yet up. \$headers[0] not set";
                } else {
                    $debugTrace[] = "$url not yet up. \$headers[0] was ${headers[0]}";
                }
            }
            usleep(100000);
        }
        if (!$serverStarted) {
            $time = microtime(true) - $startTime;
            $debugTrace[] = "$url failed to come up after $time seconds";
            echo implode("\n", $debugTrace) ."\n";
        }
        return $serverStarted;
    }

    public function waitForServerToFailToRespond($url, $timeoutSecs = 5)
    {
        $startTime = microtime(true);
        $serverFailedToRespond = false;
        while (microtime(true) - $startTime < $timeoutSecs) {
            if (@get_headers($url, 1) === false) {
                $serverFailedToRespond = true;
                break;
            }
        }
        return $serverFailedToRespond;
    }
}

Increase waitForServerToGive200 timeout to 10s & add debug trace