<?php

namespace Nelmio\SecurityBundle\ContentSecurityPolicy\Violation\Log;

use Nelmio\SecurityBundle\ContentSecurityPolicy\Violation\Report;
use Psr\Log\LoggerInterface;

class Logger
{
    private $logger;
    private $logFormatter;
    private $level;

    public function __construct(LoggerInterface $logger, LogFormatterInterface $logFormatter, $level)
    {
        $this->logger = $logger;
        $this->logFormatter = $logFormatter;
        $this->level = $level;
    }

    public function log(Report $report)
    {
        $this->logger->log($this->level, $this->logFormatter->format($report), array('csp-report' => $report->getData()));
    }

    public function getLogger()
    {
        return $this->logger;
    }
}

<?php

namespace Nelmio\SecurityBundle\ContentSecurityPolicy\Violation\Log;

use Nelmio\SecurityBundle\ContentSecurityPolicy\Violation\Report;
use Psr\Log\LoggerInterface;

class Logger
{
    private $logger;
    private $logFormatter;
    private $level;

    public function __construct(LoggerInterface $logger, LogFormatterInterface $logFormatter, $level)
    {
        $this->logger = $logger;
        $this->logFormatter = $logFormatter;
        $this->level = $level;
    }

    public function log(Report $report)
    {
        $this->logger->log($this->level, $this->logFormatter->format($report), array('csp-report' => $report->getData(), 'user-agent' => $report->getUserAgent()));
    }

    public function getLogger()
    {
        return $this->logger;
    }
}

Include user agent in logged CSP reports


<?php
namespace App\Test\TestCase\Feature;

use App\Feature\Factory;
use App\Feature\FeatureInterface;
use App\Feature\Type\BaseFeature;
use Cake\TestSuite\TestCase;

/**
 * App\Feature\Factory Test Case
 */
class FactoryTest extends TestCase
{
    /**
     * For now we just make sure the Factory can be initialized, no assertions are made.
     */
    public function testInit()
    {
        Factory::init();
    }

    public function testGet()
    {
        $feature = Factory::get('Foobar');
        $this->assertInstanceOf(FeatureInterface::class, $feature);
        $this->assertInstanceOf(BaseFeature::class, $feature);
    }
}

<?php
namespace App\Test\TestCase\Feature;

use App\Feature\Factory;
use App\Feature\FeatureInterface;
use App\Feature\Type\BaseFeature;
use Cake\TestSuite\TestCase;

/**
 * App\Feature\Factory Test Case
 */
class FactoryTest extends TestCase
{
    /**
     * For now we just make sure the Factory can be initialized, no assertions are made.
     */
    public function testInit()
    {
        Factory::init();
    }

    public function testGet()
    {
        $feature = Factory::get('Foobar');
        $this->assertInstanceOf(FeatureInterface::class, $feature);
        $this->assertInstanceOf(BaseFeature::class, $feature);

        $feature = Factory::get('Not Existing Feature');
        $this->assertInstanceOf(BaseFeature::class, $feature);
    }

    /**
     * @expectedException \InvalidArgumentException
     */
    public function testGetExceptionNotString()
    {
        $result = Factory::get(true);
    }
}

Add more tests for the Feature factory

Add more tests for the Feature factory


<?php

/**
 * @file
 * GET Apple News Article.
 */

namespace ChapterThree\AppleNews;

/**
 * Document me.
 */
class PushAPI_Get extends PushAPI_Base {

  protected function Debug($response) {
    print_r($response);exit;
  }

}

<?php

/**
 * @file
 * GET Apple News Article.
 */

namespace ChapterThree\AppleNews;

/**
 * Document me.
 */
class PushAPI_Get extends PushAPI_Base {

}

Remove debugging from GET method.

Remove debugging from GET method.


<?php
namespace MicroFW\Templates;

use MicroFW\Core\TemplateDoesNotExistException;

class Template
{
    /** @var string */
    private $templatePath;

    /** @var array */
    private $context;

    /** @var MicroFW\Core\IConfigurator */
    private static $configurator;

    /**
     * @param $templatePath string
     * @param $context array
     */
    public function __construct($templatePath, $context = [])
    {
        $this->templatePath = $templatePath;
        $this->context = $context;
    }

    /**
     * @param $configurator MicroFW\Core\IConfigurator
     * @return void
     */
    public static function init($configurator)
    {
        Template::$configurator = $configurator;
    }

    /**
     * Render template and return it.
     * @return string
     */
    public function render()
    {
        $templateDir = self::$configurator['TEMPLATE_DIR'];
        $fullPath = $templateDir . '/' . $this->templatePath;
        if (file_exists($fullPath)) {
            $content = file_get_contents($fullPath);
        } else {
            throw new TemplateDoesNotExistException(
                "$this->templatePath does not exist."
            );
        }

        return $content;
    }
}

<?php
namespace MicroFW\Templates;

use MicroFW\Core\TemplateDoesNotExistException;

class Template
{
    /** @var string */
    private $templatePath;

    /** @var array */
    private $context;

    /** @var MicroFW\Core\IConfigurator */
    private static $configurator;

    /**
     * @param $templatePath string
     * @param $context array
     */
    public function __construct($templatePath, $context = [])
    {
        $this->templatePath = $templatePath;
        $this->context = $context;
    }

    /**
     * @param $configurator MicroFW\Core\IConfigurator
     * @return void
     */
    public static function init($configurator)
    {
        self::$configurator = $configurator;
    }

    /**
     * Render template and return it.
     * @return string
     */
    public function render()
    {
        $templateDir = self::$configurator['TEMPLATE_DIR'];
        $fullPath = $templateDir . '/' . $this->templatePath;
        if (file_exists($fullPath)) {
            $content = file_get_contents($fullPath);
        } else {
            throw new TemplateDoesNotExistException(
                "$this->templatePath does not exist."
            );
        }

        return $content;
    }
}

Use self instead of class name

Use self instead of class name


<?php

namespace Solidifier\Visitors\Property;

use Solidifier\Visitors\AbstractClassVisitor;
use PhpParser\Node;
use PhpParser\Node\Stmt\Property;

class PublicAttributes extends AbstractClassVisitor
{
    public function enterNode(Node $node)
    {
        parent::enterNode($node);

        if($node instanceof Property)
        {
            if($node->isPublic())
            {
                foreach($node->props as $property)
                {
                    $this->dispatch(
                        new \Solidifier\Defects\PublicAttribute($this->currentClass, $property, $node)
                    );
                }
            }
        }
    }
}

<?php

namespace Solidifier\Visitors\Property;

use Solidifier\Visitors\AbstractClassVisitor;
use PhpParser\Node;
use PhpParser\Node\Stmt\Property;

class PublicAttributes extends AbstractClassVisitor
{
    public function enterNode(Node $node)
    {
        parent::enterNode($node);

        if($node instanceof Property)
        {
            if($node->isPublic())
            {
                foreach($node->props as $property)
                {
                    $this->dispatch(
                        new \Solidifier\Defects\PublicAttribute($this->currentClass, $property->name, $node)
                    );
                }
            }
        }
    }
}

FIX public attribute issue while creating defect


<?php

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\DB;

class TeamTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $teamsAsString = File::get(storage_path('data/teams'));
        foreach(explode("\n", $teamsAsString) as $team) {
            if (strlen($team) > 0) {
                DB::table('teams')->insert([
                    'name' => $team
                ]);
            }
        }
    }
}

<?php

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\DB;

class TeamTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        DB::table('teams')->delete();
        $teamsAsString = File::get(storage_path('data/teams'));
        foreach(explode("\n", $teamsAsString) as $team) {
            if (strlen($team) > 0) {
                DB::table('teams')->insert([
                    'name' => $team
                ]);
            }
        }
    }
}

Delete old teams before seeding

Delete old teams before seeding


<?php
/**
 * Jetpack Compatibility File
 * See: http://jetpack.me/
 *
 * @package: _s
 */

/**
 * Add theme support for Infinite Scroll.
 * See: http://jetpack.me/support/infinite-scroll/
 */
function _s_infinite_scroll_setup() {
	add_theme_support( 'infinite-scroll', array(
		'container' => 'content',
		'footer'    => 'page',
	) );
}
add_action( 'after_setup_theme', '_s_infinite_scroll_setup' );

<?php
/**
 * Jetpack Compatibility File
 * See: http://jetpack.me/
 *
 * @package _s
 */

/**
 * Add theme support for Infinite Scroll.
 * See: http://jetpack.me/support/infinite-scroll/
 */
function _s_infinite_scroll_setup() {
	add_theme_support( 'infinite-scroll', array(
		'container' => 'content',
		'footer'    => 'page',
	) );
}
add_action( 'after_setup_theme', '_s_infinite_scroll_setup' );

Remove colon from @package DocBlock

Remove colon from @package DocBlock


<?php
// Jivoo
// Copyright (c) 2015 Niels Sonnich Poulsen (http://nielssp.dk)
// Licensed under the MIT license.
// See the LICENSE file or http://opensource.org/licenses/MIT for more information.
namespace Jivoo\Core\Units;

use Jivoo\Core\UnitBase;
use Jivoo\Core\App;
use Jivoo\Core\Store\Document;
use Jivoo\Core\Cache\Cache;
use Jivoo\Models\Enum;
use Jivoo\Core\ModuleLoader;
use Jivoo\Core\LoadableModule;
use Jivoo\Helpers\Helpers;
use Jivoo\Models\Models;

/**
 * Initializes old modules.
 */
class LegacyModulesUnit extends UnitBase {
  /**
   * {@inheritdoc}
   */
  protected $requires = array('Request', 'AppLogic');

  /**
   * {@inheritdoc}
   */
  public function run(App $app, Document $config) {
    $modules = $this->app->manifest['modules'];
    $modules = array_intersect($modules, array(
      'AccessControl', 'Console', 'Content', 'Extensions', 'Jtk', 'Themes'
    ));
    foreach ($modules as $module) {
      $class = 'Jivoo\\' . $module . '\\' . $module;
      $this->m->$module = new $class($app);
      $this->m->$module->runInit();
    }
  }
}

<?php
// Jivoo
// Copyright (c) 2015 Niels Sonnich Poulsen (http://nielssp.dk)
// Licensed under the MIT license.
// See the LICENSE file or http://opensource.org/licenses/MIT for more information.
namespace Jivoo\Core\Units;

use Jivoo\Core\UnitBase;
use Jivoo\Core\App;
use Jivoo\Core\Store\Document;
use Jivoo\Core\Cache\Cache;
use Jivoo\Models\Enum;
use Jivoo\Core\ModuleLoader;
use Jivoo\Core\LoadableModule;
use Jivoo\Helpers\Helpers;
use Jivoo\Models\Models;

/**
 * Initializes old modules.
 */
class LegacyModulesUnit extends UnitBase {
  /**
   * {@inheritdoc}
   */
  protected $requires = array('Routing', 'AppLogic');

  /**
   * {@inheritdoc}
   */
  public function run(App $app, Document $config) {
    $modules = $this->app->manifest['modules'];
    $modules = array_intersect(array(
      'Extensions', 'AccessControl', 'Console', 'Content', 'Jtk', 'Themes'
    ), $modules);
    foreach ($modules as $module) {
      $class = 'Jivoo\\' . $module . '\\' . $module;
      $this->m->$module = new $class($app);
      $this->m->$module->runInit();
    }
  }
}

Fix single user model and blog example.

Fix single user model and blog example.


<?php

namespace JWX\JWT\Parameter;

/**
 * Implements 'Content Type' parameter.
 *
 * @link https://tools.ietf.org/html/rfc7515#section-4.1.10
 */
class ContentTypeParameter extends RegisteredJWTParameter
{
	/**
	 * Constructor
	 *
	 * @param string $type
	 */
	public function __construct($type) {
		parent::__construct(self::PARAM_CONTENT_TYPE, (string) $type);
	}
}

<?php

namespace JWX\JWT\Parameter;

/**
 * Implements 'Content Type' parameter.
 *
 * @link https://tools.ietf.org/html/rfc7515#section-4.1.10
 */
class ContentTypeParameter extends RegisteredJWTParameter
{
	/**
	 * Content type for the nested JWT.
	 *
	 * @var string
	 */
	const TYPE_JWT = "JWT";

	/**
	 * Constructor
	 *
	 * @param string $type
	 */
	public function __construct($type) {
		parent::__construct(self::PARAM_CONTENT_TYPE, (string) $type);
	}
}

Add JWT content type constant

Add JWT content type constant


<?php

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

define('MANALIZE_DIR', __DIR__);
define('MANALIZE_TMP_ROOT_DIR', sys_get_temp_dir().'/Manala');
define('UPDATE_FIXTURES', filter_var(getenv('UPDATE_FIXTURES'), FILTER_VALIDATE_BOOLEAN));

/**
 * Creates a unique tmp dir.
 *
 * @param string $prefix
 *
 * @return string The path to the tmp dir created
 */
function manala_get_tmp_dir($prefix = '')
{
    if (!is_dir(MANALIZE_TMP_ROOT_DIR)) {
        @mkdir(MANALIZE_TMP_ROOT_DIR);
    }

    $tmp = @tempnam(MANALIZE_TMP_ROOT_DIR, $prefix);
    unlink($tmp);
    mkdir($tmp, 0777, true);

    return $tmp;
}

<?php

foreach (array(__DIR__.'/../../autoload.php', __DIR__.'/../vendor/autoload.php', __DIR__.'/vendor/autoload.php') as $autoload) {
    if (file_exists($autoload)) {
        require_once $autoload;

        break;
    }
}

define('MANALIZE_DIR', __DIR__);
define('MANALIZE_TMP_ROOT_DIR', sys_get_temp_dir().'/Manala');
define('UPDATE_FIXTURES', filter_var(getenv('UPDATE_FIXTURES'), FILTER_VALIDATE_BOOLEAN));

/**
 * Creates a unique tmp dir.
 *
 * @param string $prefix
 *
 * @return string The path to the tmp dir created
 */
function manala_get_tmp_dir($prefix = '')
{
    if (!is_dir(MANALIZE_TMP_ROOT_DIR)) {
        @mkdir(MANALIZE_TMP_ROOT_DIR);
    }

    $tmp = @tempnam(MANALIZE_TMP_ROOT_DIR, $prefix);
    unlink($tmp);
    mkdir($tmp, 0777, true);

    return $tmp;
}

Fix not found autoload on local install

Fix not found autoload on local install


<?php

namespace  Stock\Database\Seeds;

class AddUserTypeDatas extends \CodeIgniter\Database\Seeder
{
    public function run()
    {
        $data=[
            ['name'=>'Utilisateur','access_level'=>1],
            ['name'=>'Gestionnaire','access_level'=>2],
            ['name'=>'Administrateur','access_level'=>4],
        ];
        foreach($data as $row)
            $this->db->table('user_type')->insert($row);

    }
}

<?php

namespace  Stock\Database\Seeds;

class AddUserTypeDatas extends \CodeIgniter\Database\Seeder
{
    public function run()
    {
        $data=[
            ['name'=>'Invité','access_level'=>1],
            ['name'=>'Observation','access_level'=>2],
            ['name'=>'Formation','access_level'=>4],
            ['name'=>'MSP','access_level'=>8],
            ['name'=>'Administrateur','access_level'=>16]
        ];
        foreach($data as $row)
            $this->db->table('user_type')->insert($row);

    }
}

Fix problem in database seeds

Fix problem in database seeds


<?php

// Try to find the application root directory.
// Env Variable 'ApplicationPath' is set by the add_environment_variables.ps1
// script. The others are "default" paths of Azure that can be tried as
// fallback.
if (isset($_SERVER['ApplicationPath'])) {
    $appRoot = $_SERVER['ApplicationPath'] . '\app';
} else if ( file_exists("E:\approot\app")) {
    $appRoot = "E:\approot\app";
} else if ( file_exists("F:\approot\app")) {
    $appRoot = "F:\approot\app";
} else {
    exit(1);
}

require_once $appRoot . '\bootstrap.php.cache';
require_once $appRoot . '\AppKernel.php';
//require_once $appRoot . '\AppCache.php';

use Symfony\Component\HttpFoundation\Request;

$kernel = new AppKernel('azure', false);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();

<?php

// Try to find the application root directory.
// Env Variable 'ApplicationPath' is set by the add_environment_variables.ps1
// script. The others are "default" paths of Azure that can be tried as
// fallback.
if (isset($_SERVER['ApplicationPath'])) {
    $appRoot = $_SERVER['ApplicationPath'] . '\app';
} else if ( file_exists("E:\approot\app")) {
    $appRoot = "E:\approot\app";
} else if ( file_exists("F:\approot\app")) {
    $appRoot = "F:\approot\app";
} else {
    $appRoot = __DIR__ . '\..\..\approot\app';
}

require_once $appRoot . '\bootstrap.php.cache';
require_once $appRoot . '\AppKernel.php';
//require_once $appRoot . '\AppCache.php';

use Symfony\Component\HttpFoundation\Request;

$kernel = new AppKernel('azure', false);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();

Fix GH-3 - Fallback to relative finding (just a guess) instead of dying.


<?php
namespace intpp\yii\actions;

/**
 * Class JsonResponse
 *
 * @package intpp\yii\actions
 */
class JsonResponse extends Response
{

    public function prepare($data = [])
    {
        header('Content-type: application/json');

        return \CJSON::encode(array_merge(['code' => 0], $data));
    }
}

<?php
namespace intpp\yii\actions;

/**
 * Class JsonResponse
 *
 * @package intpp\yii\actions
 */
class JsonResponse extends Response
{

    public function prepare($data = [])
    {
        header('Content-type: application/json');

        return \CJSON::encode($data);
    }
}

Remove code form json response

Remove code form json response


<?php

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

declare(strict_types=1);

namespace ActiveCollab\Controller\ActionResultEncoder\ValueEncoder;

use Psr\Http\Message\StreamInterface;
use Slim\Http\Stream;

abstract class ValueEncoder implements ValueEncoderInterface
{
    /**
     * Create the message body.
     *
     * @param  string          $text
     * @return StreamInterface
     */
    protected function createBodyFromText(string $text): StreamInterface
    {
        $handle = fopen('php://temp', 'wb+');

        $body = new Stream($handle);
        $body->write($text);
        $body->rewind();

        return $body;
    }
}

<?php

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

declare(strict_types=1);

namespace ActiveCollab\Controller\ActionResultEncoder\ValueEncoder;

use Psr\Http\Message\StreamInterface;
use Slim\Http\Stream;

abstract class ValueEncoder implements ValueEncoderInterface
{
    public function __construct()
    {
    }

    /**
     * Create the message body.
     *
     * @param  string          $text
     * @return StreamInterface
     */
    protected function createBodyFromText(string $text): StreamInterface
    {
        $handle = fopen('php://temp', 'wb+');

        $body = new Stream($handle);
        $body->write($text);
        $body->rewind();

        return $body;
    }
}

Add constructor to value encoders

Add constructor to value encoders

We are adding this so we can extend constructors in subclasses, where needed


<?php

namespace Command;

use Database\Connect;
use Config\Config;

class getData
{
    /**
     * setData constructor.
     *
     * @param \Aura\Web\Request $request
     * @param \Aura\Web\Response $response
     * @param \Aura\View\View $view
     */
    public function __construct($request, $response, $view)
    {
        $status = 'success';
        $message = '';

        $secureToken = (new Config)->getConfig()['secure_token'];
        $retrievedSecureToken = $request->query->get('key', '');
        $host = $request->query->get('host', '');

        if ($secureToken !== $retrievedSecureToken) {
            $status = 'error';
            $message = 'Incorrect secure token.';
        } else {
            $post = $request->post;

        }

        $view->setData([
            'status' => $status,
            'message' => $message,
        ]);

        $response->content->set($view->__invoke());
    }

    protected function _getCommands($host)
    {
        $query = (new\Database\Query)
            ->select()
            ->from('commands')
            ->cols([
                'command_id',
                'command',
                'to_be_exec',
            ])
            ->where('executed = 0')
            ->where('consumed = 0')
            ->where("host = '$host'");

        return (new Connect)->query($query);
    }
}

<?php

namespace Command;

use Database\Connect;
use Config\Config;

class getData
{
    /**
     * setData constructor.
     *
     * @param \Aura\Web\Request $request
     * @param \Aura\Web\Response $response
     * @param \Aura\View\View $view
     */
    public function __construct($request, $response, $view)
    {
        $status = 'success';

        $secureToken = (new Config)->getConfig()['secure_token'];
        $retrievedSecureToken = $request->query->get('key', '');
        $host = $request->query->get('host', '');

        if ($secureToken !== $retrievedSecureToken) {
            $status = 'error';
            $message = 'Incorrect secure token.';
        } else {
            try {
                $message = json_encode($this->getCommands($host));
            } catch (\Exception $e) {
                $status = 'error';
                $message = $e->getMessage();
            }
        }

        $view->setData([
            'status' => $status,
            'message' => $message,
        ]);

        $response->content->set($view->__invoke());
    }

    /**
     * get all don't executed commands from database
     *
     * @param string $host
     * @return array
     * @throws \Exception
     */
    protected function getCommands($host)
    {
        $query = (new\Database\Query)
            ->select()
            ->from('commands')
            ->cols([
                'command_id',
                'command',
                'to_be_exec',
            ])
            ->where('executed = 0')
            ->where('consumed = 0')
            ->where("host = '$host'");

        return (new Connect)->query($query)->fetchAll(\PDO::FETCH_ASSOC);
    }
}

Return all don't executed commands

Return all don't executed commands


<?php

namespace Webup\LaravelForm\Elements;

class Select extends Base
{
    protected $type;
    protected $options = [];

    public function __construct($type)
    {
        parent::__construct();
        $this->type = $type;
    }

    public function render()
    {
        return view(
        'form::select', [
            'placeholder' => $this->placeholder,
            'value' => $this->value,
            'label' => $this->label,
            'required' => $this->required,
            'name' => $this->name,
            'errors' => $this->errors,
            'type' => $this->type,
            'attr' => $this->attr,
            'options' => $this->options,
            'wrapperClass' => $this->wrapperClass,
        ])->render();
    }

    public function addOption($value = null, $label = null)
    {
        $this->options[] = [
            'value' => $value,
            'label' => $label,
        ];

        return $this;
    }

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

<?php

namespace Webup\LaravelForm\Elements;

class Select extends Base
{
    protected $type;
    protected $options = [];

    public function __construct($type)
    {
        parent::__construct();
        $this->type = $type;
    }

    public function render()
    {
        return view(
        'form::select', [
            'placeholder' => $this->placeholder,
            'value' => $this->value,
            'label' => $this->label,
            'required' => $this->required,
            'name' => $this->name,
            'errors' => $this->errors,
            'type' => $this->type,
            'attr' => $this->attr,
            'options' => $this->options,
            'wrapperClass' => $this->wrapperClass,
        ])->render();
    }

    public function addOptions(array $options)
    {
        foreach ($options as $value => $label) {
            $this->options[] = [
                'value' => $value,
                'label' => $label,
            ];
        }

        return $this;
    }

    public function addOption($value = null, $label = null)
    {
        $this->options[] = [
            'value' => $value,
            'label' => $label,
        ];

        return $this;
    }

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

Add options to select field.

Add options to select field.


<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
            new Leg\GoogleChartsBundle\LegGoogleChartsBundle(),
        );

        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
        }

        return $bundles;
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
    }
}

<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Leg\GoogleChartsBundle\LegGoogleChartsBundle(),
        );

        if (in_array($this->getEnvironment(), array('dev', 'test'))) {
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
        }

        return $bundles;
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
    }
}

Remove the DoctrineBundle from the testing embeded kernel.


@extends('admin.layouts.master')

@section('main_content')
  {{-- @TODO: likely a better way to split this out in Blade! --}}
  @include('admin.layouts.partials.subnav-settings')

Settings

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolorem quam, voluptate, vero odio hic eum minima excepturi, accusantium delectus quasi veniam saepe quod vitae qui repudiandae quae aperiam rerum soluta.

          {!! link_to_route('admin.scholarship.create', 'Create new scholarship »', null, ['class' => 'btn btn-default', 'role'=> 'button']) !!}

          {!! link_to_route('admin.scholarship.edit', 'Edit current scholarship »', $scholarship_id, ['class' => 'btn btn-default', 'role'=> 'button']) !!}

@stop

@extends('admin.layouts.master')

@section('main_content')
  {{-- @TODO: likely a better way to split this out in Blade! --}}
  @include('admin.layouts.partials.subnav-settings')

Settings

Click below to create a new scholarship or edit the current one, or select another option from the sidebar.

          {!! link_to_route('admin.scholarship.create', 'Create new scholarship »', null, ['class' => 'btn btn-default', 'role'=> 'button']) !!}

          {!! link_to_route('admin.scholarship.edit', 'Edit current scholarship »', $scholarship_id, ['class' => 'btn btn-default', 'role'=> 'button']) !!}

@stop

Remove Latin so Chrome stops trying to translate


<?php

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

namespace Sylius\Component\Resource\Model;

/**
 * @author Grzegorz Sadowski <grzegorz.sadowski@lakion.com>
 */
interface VersionedInterface
{
    /**
     * @return int
     */
    public function getVersion();
}

<?php

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

namespace Sylius\Component\Resource\Model;

/**
 * @author Grzegorz Sadowski <grzegorz.sadowski@lakion.com>
 */
interface VersionedInterface
{
    /**
     * @return int
     */
    public function getVersion();

    /**
     * @param int $version
     */
    public function setVersion($version);
}

Add getter for version property

[OrderSequence][ProductVariant] Add getter for version property


<?php

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

class AddOaiId extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('documents', function (Blueprint $table) {
            $table->text('oai_id')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('documents', function (Blueprint $table) {
            $table->dropColumn('oai_id');
        });
    }
}

<?php

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

class AddOaiId extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('documents', function (Blueprint $table) {
            $table->text('oai_id')->nullable()->unique();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('documents', function (Blueprint $table) {
            $table->dropColumn('oai_id');
        });
    }
}

Add index to oai_id column

Add index to oai_id column


<?php

namespace Victoire\Bundle\WidgetBundle\Repository;

use Doctrine\ORM\EntityRepository;

/**
 * The widget Repository.
 */
class WidgetRepository extends EntityRepository
{
    /**
     * Get all the widget within a list of ids.
     *
     * @param array $widgetIds
     *
     * @return \Doctrine\ORM\QueryBuilder
     */
    public function getAllIn(array $widgetIds)
    {
        return $this->createQueryBuilder('widget')
            ->where('widget.id IN (:map)')
            ->setParameter('map', $widgetIds);
    }

    /**
     * Find all the widgets in a list of ids.
     *
     * @param array $widgetIds
     *
     * @return multitype:
     */
    public function findAllIn(array $widgetIds)
    {
        $qb = $this->getAllIn($widgetIds);

        return $qb->getQuery()->getResult();
    }
}

<?php

namespace Victoire\Bundle\WidgetBundle\Repository;

use Doctrine\ORM\EntityRepository;
use Victoire\Bundle\CoreBundle\Entity\View;

/**
 * The widget Repository.
 */
class WidgetRepository extends EntityRepository
{
    /**
     * Get all the widget within a list of ids.
     *
     * @param array $widgetIds
     *
     * @return \Doctrine\ORM\QueryBuilder
     */
    public function getAllIn(array $widgetIds)
    {
        return $this->createQueryBuilder('widget')
            ->where('widget.id IN (:map)')
            ->setParameter('map', $widgetIds);
    }

    /**
     * Find all the widgets in a list of ids.
     *
     * @param array $widgetIds
     *
     * @return multitype:
     */
    public function findAllIn(array $widgetIds)
    {
        $qb = $this->getAllIn($widgetIds);

        return $qb->getQuery()->getResult();
    }

    /**
     * Find all widgets for a given View.
     *
     * @param View $view
     * @return multitype
     */
    public function findAllWidgetsForView(View $view)
    {
        return $this->findAllIn($view->getWidgetsIds());
    }
}

Add new ViewRepository method to get all Widgets for a given Wiew


<?php
/**
 * Copyright (c) 2016 Ruben Schmidmeister <ruben.schmidmeister@icloud.com>
 *
 * This program is free software. It comes without any warranty, to
 * the extent permitted by applicable law. You can redistribute it
 * and/or modify it under the terms of the GNU Affero General Public License,
 * version 3, as published by the Free Software Foundation.
 */
namespace Timetabio\Frontend\Models\Page
{
    use Timetabio\Frontend\Models\PageModel;

    class ResetPasswordPageModel extends PageModel
    {
        /**
         * @var string
         */
        private $token;

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

        public function getToken(): string
        {
            return $this->token;
        }
    }
}

<?php
/**
 * Copyright (c) 2016 Ruben Schmidmeister <ruben.schmidmeister@icloud.com>
 *
 * This program is free software. It comes without any warranty, to
 * the extent permitted by applicable law. You can redistribute it
 * and/or modify it under the terms of the GNU Affero General Public License,
 * version 3, as published by the Free Software Foundation.
 */
namespace Timetabio\Frontend\Models\Page
{
    use Timetabio\Frontend\Models\PageModel;

    class ResetPasswordPageModel extends PageModel
    {
        /**
         * @var string
         */
        private $token;

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

        public function getToken(): string
        {
            return $this->token;
        }

        public function getTitle(): string
        {
            return 'Password Reset';
        }
    }
}

Add title for reset page

Add title for reset page


<?php
include __DIR__ . '/../vendor/autoload.php'; // composer autoload

$kernel = \AspectMock\Kernel::getInstance();
$kernel->init([
    'debug' => true,
    'cacheDir' => sys_get_temp_dir(),
    'includePaths' => [__DIR__ . '/../src']
]);

<?php
// @codingStandardsIgnoreFile

include __DIR__ . '/../vendor/autoload.php'; // composer autoload

if (!function_exists('uuid_create')) {
    // Create stub of method so AspectMock can mock this function
    // if it doesn't exist in PHP.
    function uuid_create() {}
}

if (!function_exists('uuid_parse')) {
    // Create stub of method so AspectMock can mock this function
    // if it doesn't exist in PHP.
    function uuid_parse() {}
}

if (!defined('UUID_TYPE_TIME')) {
    define('UUID_TYPE_TIME', 1);
}

if (!defined('UUID_TYPE_RANDOM')) {
    define('UUID_TYPE_RANDOM', 4);
}

$kernel = \AspectMock\Kernel::getInstance();
$kernel->init([
    'debug' => true,
    'cacheDir' => sys_get_temp_dir(),
    'includePaths' => [__DIR__ . '/../src']
]);

Create stubs for testing uuid_* methods for environments without pecl/uuid


<?php

/*
 * This file is part of the PredisServiceProvider package.
 *
 * (c) Daniele Alessandri <suppakilla@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

require_once __DIR__.'/../vendor/.composer/autoload.php';
require_once __DIR__.'/../vendor/pimple/pimple/lib/Pimple.php';
require_once __DIR__.'/../lib/Predis/Silex/PredisServiceProvider.php';

<?php

/*
 * This file is part of the PredisServiceProvider package.
 *
 * (c) Daniele Alessandri <suppakilla@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

require_once __DIR__.'/../vendor/.composer/autoload.php';
require_once __DIR__.'/../lib/Predis/Silex/PredisServiceProvider.php';

Revert previous fix for Pimple.

Revert previous fix for Pimple.

Now Pimple's composer.json uses the autoloading directive.


<?php

use Behat\Behat\Context\Context;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Tests\TestCase;
use Zeropingheroes\Lanager\Console\Kernel;
use Zeropingheroes\Lanager\User;
use Zeropingheroes\Lanager\UserOAuthAccount;

/**
 * Defines application features from the specific context.
 */
class FeatureContext extends TestCase implements Context
{
    use DatabaseMigrations;

    /**
     * @var Session
     */
    private $session;

    /**
     * Initializes context.
     *
     * Every scenario gets its own context instance.
     * You can also pass arbitrary arguments to the
     * context constructor through behat.yml.
     */
    public function __construct()
    {
        parent::setUp();
    }

    /** @BeforeScenario */
    public function before(BeforeScenarioScope $scope)
    {
        $this->artisan('db:seed');
        $this->app[Kernel::class]->setArtisan(null);
    }

    /**
     * @Given an admin with username :username exists
     */
    public function anAdminWithUsernameExists($username)
    {
        $user = factory(User::class)->create(
            [
                'username' => $username,
            ]
        )->each(
            function ($user) {
                $user->accounts()->save(factory(UserOAuthAccount::class)->make());
            }
        );

        // Currently not required as UserObserver::class assigns super admin role when first user created
        // $role = Role::where('name', 'super-admin')->first();
        // $user->roles()->attach($role->id, ['assigned_by' => $user->id]);
    }

}

<?php

use Behat\Behat\Context\Context;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Tests\TestCase;
use Zeropingheroes\Lanager\Console\Kernel;
use Zeropingheroes\Lanager\User;
use Zeropingheroes\Lanager\UserOAuthAccount;

/**
 * Defines application features from the specific context.
 */
class FeatureContext extends TestCase implements Context
{
    use DatabaseMigrations;

    /**
     * Initializes context.
     *
     * Every scenario gets its own context instance.
     * You can also pass arbitrary arguments to the
     * context constructor through behat.yml.
     */
    public function __construct()
    {
        parent::setUp();
        $this->artisan('db:seed');
        $this->app[Kernel::class]->setArtisan(null);
    }

    /**
     * @Given an admin with username :username exists
     */
    public function anAdminWithUsernameExists($username)
    {
        $user = factory(User::class)->create(
            [
                'username' => $username,
            ]
        )->each(
            function ($user) {
                $user->accounts()->save(factory(UserOAuthAccount::class)->make());
            }
        );

        // Currently not required as UserObserver::class assigns super admin role when first user created
        // $role = Role::where('name', 'super-admin')->first();
        // $user->roles()->attach($role->id, ['assigned_by' => $user->id]);
    }
}

Clean up main context class

Clean up main context class


<?php
namespace wcf\system\search\acp;
use wcf\data\box\BoxList;
use wcf\system\request\LinkHandler;
use wcf\system\WCF;

/**
 * ACP search result provider implementation for cms boxes.
 *
 * @author	Marcel Werk
 * @copyright	2001-2016 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	WoltLabSuite\Core\System\Search\Acp
 */
class BoxACPSearchResultProvider implements IACPSearchResultProvider {
	/**
	 * @inheritDoc
	 */
	public function search($query) {
		if (!WCF::getSession()->getPermission('admin.content.cms.canManageBox')) {
			return [];
		}

		$results = [];

		$boxList = new BoxList();
		$boxList->getConditionBuilder()->add('box.name LIKE ?', ['%'.$query.'%']);
		$boxList->sqlLimit = 10;
		$boxList->sqlOrderBy = 'box.name';
		$boxList->readObjects();
		foreach ($boxList as $box) {
			$results[] = new ACPSearchResult($box->name, LinkHandler::getInstance()->getLink('BoxEdit', [
				'id' => $box->boxID
			]));
		}

		return $results;
	}
}

<?php
namespace wcf\system\search\acp;
use wcf\data\box\BoxList;
use wcf\system\request\LinkHandler;
use wcf\system\WCF;

/**
 * ACP search result provider implementation for cms boxes.
 *
 * @author	Marcel Werk
 * @copyright	2001-2016 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	WoltLabSuite\Core\System\Search\Acp
 */
class BoxACPSearchResultProvider implements IACPSearchResultProvider {
	/**
	 * @inheritDoc
	 */
	public function search($query) {
		if (!WCF::getSession()->getPermission('admin.content.cms.canManageBox')) {
			return [];
		}

		$results = [];

		$boxList = new BoxList();
		$boxList->getConditionBuilder()->add('box.boxType <> ?', ['menu']);
		$boxList->getConditionBuilder()->add('box.name LIKE ?', ['%'.$query.'%']);
		$boxList->sqlLimit = 10;
		$boxList->sqlOrderBy = 'box.name';
		$boxList->readObjects();
		foreach ($boxList as $box) {
			$results[] = new ACPSearchResult($box->name, LinkHandler::getInstance()->getLink('BoxEdit', [
				'id' => $box->boxID
			]));
		}

		return $results;
	}
}

Exclude menu boxes in box search

Exclude menu boxes in box search


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

              <?php the_post_thumbnail('thumbnail', array('class' => 'img-circle img-shadow')); ?>

<?php the_title(); ?>

            <?php the_content(); ?>

    <?php endwhile; ?>

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

              <?php the_post_thumbnail('thumbnail', array('class' => 'img-circle img-shadow')); ?>
              http://www.rodereisen.de<?php echo wp_get_attachment_url( get_post_thumbnail_id() ); ?>

                <a class="btn btn-danger btn-lg btn-block" href="<?php echo $kontakt_url; ?>">Informationen anfordern

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

<?php the_title(); ?>

              <?php the_content(); ?>

    <?php endwhile; ?>

Update Single Post View with Meta Data

Update Single Post View with Meta Data


<?php

declare(strict_types=1);

namespace Shlinkio\Shlink\Core\Service;

use Shlinkio\Shlink\Core\Entity\ShortUrl;
use Shlinkio\Shlink\Core\Exception\ShortUrlNotFoundException;
use Shlinkio\Shlink\Core\Model\ShortUrlMeta;
use Zend\Paginator\Paginator;

interface ShortUrlServiceInterface
{
    /**
     * @param string[] $tags
     * @param array|string|null $orderBy
     * @return ShortUrl[]|Paginator
     */
    public function listShortUrls(int $page = 1, ?string $searchQuery = null, array $tags = [], $orderBy = null);

    /**
     * @param string[] $tags
     * @throws ShortUrlNotFoundException
     */
    public function setTagsByShortCode(string $shortCode, array $tags = []): ShortUrl;

    /**
     * @throws ShortUrlNotFoundException
     */
    public function updateMetadataByShortCode(string $shortCode, ShortUrlMeta $shortUrlMeta): ShortUrl;
}

<?php

declare(strict_types=1);

namespace Shlinkio\Shlink\Core\Service;

use Shlinkio\Shlink\Common\Util\DateRange;
use Shlinkio\Shlink\Core\Entity\ShortUrl;
use Shlinkio\Shlink\Core\Exception\ShortUrlNotFoundException;
use Shlinkio\Shlink\Core\Model\ShortUrlMeta;
use Zend\Paginator\Paginator;

interface ShortUrlServiceInterface
{
    /**
     * @param int $page
     * @param string|null $searchQuery
     * @param string[] $tags
     * @param array|string|null $orderBy
     * @return ShortUrl[]|Paginator
     * @param DateRange|null $dateRange
     *
     * @return ShortUrl[]|Paginator
     */
    public function listShortUrls(int $page = 1, ?string $searchQuery = null, array $tags = [], $orderBy = null, ?DateRange $dateRange = null);

    /**
     * @param string[] $tags
     * @throws ShortUrlNotFoundException
     */
    public function setTagsByShortCode(string $shortCode, array $tags = []): ShortUrl;

    /**
     * @throws ShortUrlNotFoundException
     */
    public function updateMetadataByShortCode(string $shortCode, ShortUrlMeta $shortUrlMeta): ShortUrl;
}

Add date range filter to short url service interface


<?php
declare (strict_types = 1);

namespace GrottoPress\Jentil\Utilities\ThemeMods;

use GrottoPress\Jentil\IdentityTrait;

class AbstractThemeMod
{
    use IdentityTrait;

    /**
     * @var mixed
     */
    protected $default;

    protected function getDefault()
    {
        return $this->default;
    }

    public function get()
    {
        if (!$this->id) {
            \settype($value, \gettype($this->default));

            return $value;
        }

        return \get_theme_mod($this->id, $this->default);
    }

    public function update($newValue): bool
    {
        if (!$this->id) {
            return false;
        }

        return \set_theme_mod($this->id, $newValue);
    }

    public function delete()
    {
        if (!$this->id) {
            return;
        }

        \remove_theme_mod($this->id);
    }
}

<?php
declare (strict_types = 1);

namespace GrottoPress\Jentil\Utilities\ThemeMods;

use GrottoPress\Jentil\IdentityTrait;

class AbstractThemeMod
{
    use IdentityTrait;

    /**
     * @var mixed
     */
    protected $default;

    protected function getDefault()
    {
        return $this->default;
    }

    public function get()
    {
        if (!$this->id) {
            \settype($value, \gettype($this->default));

            return $value;
        }

        return \get_theme_mod($this->id, $this->default);
    }

    public function update($new_value): bool
    {
        if (!$this->id) {
            return false;
        }

        return \set_theme_mod($this->id, $new_value);
    }

    public function delete()
    {
        if (!$this->id) {
            return;
        }

        \remove_theme_mod($this->id);
    }
}

Change camel-cased local variable to snake-cased


<?php
class NzbHandler_Factory
{
	public static function build($settings)
	{
		# automatically determine classname based on configured action
		$nzbhandling = $settings->get('nzbhandling');

		$action = strtolower($nzbhandling['action']);

		# for backward compatibility we introduce a mapping
		# Nieuwe handlers voegen we alsnog expliciet toe omdat we anders
		# niet weten wat we includen in combinate met __autoload()
		switch ($action)
		{
			case 'disable'			: $handler = new NzbHandler_Disable($settings); break;
			case 'save	'	  		: $handler = new NzbHandler_Save($settings); break;
			case 'runcommand'		: $handler = new NzbHandler_Runcommand($settings); break;
			case 'push-sabnzbd' 	: $handler = new NzbHandler_Pushsabnzbd($settings); break;
			case 'client-sabnzbd' 	: $handler = new NzbHandler_Pushsabnzbd($settings); break;
			default					: $handler = new NzbHandler_Display($settings); break;
		} # switch

		return $handler;
	} # build()
} # class NzbHandler_Factory

<?php
class NzbHandler_Factory
{
	public static function build($settings)
	{
		# automatically determine classname based on configured action
		$nzbhandling = $settings->get('nzbhandling');

		$action = strtolower($nzbhandling['action']);

		# for backward compatibility we introduce a mapping
		# Nieuwe handlers voegen we alsnog expliciet toe omdat we anders
		# niet weten wat we includen in combinate met __autoload()
		switch ($action)
		{
			case 'disable'			: $handler = new NzbHandler_Disable($settings); break;
			case 'save	'	  		: $handler = new NzbHandler_Save($settings); break;
			case 'runcommand'		: $handler = new NzbHandler_Runcommand($settings); break;
			case 'push-sabnzbd' 	: $handler = new NzbHandler_Pushsabnzbd($settings); break;
			case 'client-sabnzbd' 	: $handler = new NzbHandler_Pushsabnzbd($settings); break;
			case 'nzbget'			: $handler = new NzbHandler_Nzbget($settings); break;
			default					: $handler = new NzbHandler_Display($settings); break;
		} # switch

		return $handler;
	} # build()
} # class NzbHandler_Factory

Fix voor issue geintroduceerd door mij

Fix voor issue geintroduceerd door mij


<?php
namespace wcf\system\form\builder\field;

/**
 * Implementation of a radio buttons form field for selecting a single value.
 *
 * @author	Matthias Schmidt
 * @copyright	2001-2018 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	WoltLabSuite\Core\System\Form\Builder\Field
 * @since	3.2
 */
class RadioButtonFormField extends AbstractFormField implements ISelectionFormField {
	use TSelectionFormField;

	/**
	 * @inheritDoc
	 */
	protected $templateName = '__radioButtonFormField';

	/**
	 * @inheritDoc
	 */
	protected static function supportsNestedOptions(): bool {
		return false;
	}
}

<?php
namespace wcf\system\form\builder\field;

/**
 * Implementation of a radio buttons form field for selecting a single value.
 *
 * @author	Matthias Schmidt
 * @copyright	2001-2018 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	WoltLabSuite\Core\System\Form\Builder\Field
 * @since	3.2
 */
class RadioButtonFormField extends AbstractFormField implements ISelectionFormField {
	use TSelectionFormField;

	/**
	 * @inheritDoc
	 */
	protected $templateName = '__radioButtonFormField';

	/**
	 * @inheritDoc
	 */
	public function readValue(): IFormField {
		if ($this->getDocument()->hasRequestData($this->getPrefixedId())) {
			$value = $this->getDocument()->getRequestData($this->getPrefixedId());

			if (is_string($value)) {
				$this->__value = $value;
			}
		}

		return $this;
	}

	/**
	 * @inheritDoc
	 */
	public function supportsNestedOptions(): bool {
		return false;
	}
}

Add missing method in `RadioButtonFormField`

See 89f146f98c612e7924de77816920cf9553ef626a
See #2509


<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class File extends Model
{
    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'files';

    /**
     * Create hash
     *
     * @return string $hash
     */
    public static function hash()
    {
        return substr(bin2hex(openssl_random_pseudo_bytes(8)), 0, 8);
    }
}

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class File extends Model
{
    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'files';

    /**
     * Create hash.
     *
     * Create a new hash for a newly uploaded file. This function is recursive
     * if it creates a hash that is currently in use. Although it's pretty
     * difficult to create an exact same hash, it can happen.
     *
     * @return string $hash
     */
    public static function hash()
    {
        $hash = substr(bin2hex(openssl_random_pseudo_bytes(8)), 0, 8);
        if (is_null(self::where('hash', '=', $hash)->first())) {
            return $hash;
        } else return self::hash();
    }
}

Make sure we're not using duplicate hashes.


<?php

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

class CreateSettingsTable extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('laravel_settings', function (Blueprint $table) {
            $table->string('id', 191);
            $table->text('value');
        });
    }

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

}

<?php

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

class CreateSettingsTable extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('laravel_settings', function (Blueprint $table) {
            $table->string('id', 191);
            $table->text('value')->nullable();
        });
    }

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

}

Allow database settings to have null values


<?PHP // $Id$

////////////////////////////////////////////////////////////////////////////////
//  Code fragment to define the version of quiz
//  This fragment is called by moodle_needs_upgrading() and /admin/index.php
////////////////////////////////////////////////////////////////////////////////

$module->version  = 2004070700;   // The (date) version of this module
$module->requires = 2004060200;   // Requires this Moodle version
$module->cron     = 0;            // How often should cron check this module (seconds)?

?>

<?PHP // $Id$

////////////////////////////////////////////////////////////////////////////////
//  Code fragment to define the version of quiz
//  This fragment is called by moodle_needs_upgrading() and /admin/index.php
////////////////////////////////////////////////////////////////////////////////

$module->version  = 2004070800;   // The (date) version of this module
$module->requires = 2004070800;   // Requires this Moodle version
$module->cron     = 0;            // How often should cron check this module (seconds)?

?>

Update requirement for address_in_subnet function in moodlelib.php


<?php

namespace App\Services;

use Illuminate\Http\Request;

abstract class Authentication
{
    /**
     * Retrieves array of currently configured clients.
     *
     * @return array
     */
    abstract public function getSupportedClientKeys();

    /**
     * Engage in login flow.
     *
     * @param  string   $provider
     * @param  Request  $request
     *
     * @return RedirectResponse|Identity
     * @throws Exception
     */
    abstract public function login($provider, Request $request);

    /**
     * Get value from session by key.
     *
     * @param  string   $key
     * @param  mixed    $value
     *
     * @return boolean
     */
    protected function addToSession($key, $value)
    {
        $success = session([$key => $value]);
        session()->save();

        return $success;
    }

    /**
     * Get value from session by key.
     *
     * @param  string   $key
     * @param  boolean  $remove Optional
     *
     * @return mixed|null
     */
    protected function getFromSession($key, $remove = true)
    {
        if ($remove) {
            $value = session()->pull($key);
        } else {
            $value = session($key);
        }

        session()->save();

        return $value;
    }
}

<?php

namespace App\Services;

use Illuminate\Http\Request;

abstract class Authentication
{
    /**
     * Retrieves array of currently configured clients.
     *
     * @return array
     */
    abstract public function getSupportedClientKeys();

    /**
     * Engage in login flow.
     *
     * @param  string   $provider
     * @param  Request  $request
     *
     * @return RedirectResponse|Identity
     * @throws Exception
     */
    abstract public function login($provider, Request $request);

    /**
     * Get value from session by key.
     *
     * @param  string   $key
     * @param  mixed    $value
     *
     * @return boolean
     */
    protected function addToSession($key, $value)
    {
        $success = session([$key => $value]);
        session()->save();

        return $success;
    }

    /**
     * Get value from session by key.
     *
     * @param  string   $key
     * @param  boolean  $remove Optional
     *
     * @return mixed|null
     */
    protected function getFromSession($key, $remove = true)
    {
        if ($remove) {
            $value = session()->pull($key);
        } else {
            $value = session($key);
        }

        session()->save();

        if (is_array($value)) {
            $value = array_filter($value);
        }

        return $value;
    }
}

Remove empty values when fetching credentials from session


<?php

/**
 * Generates info bar footer.
 **/
?>

<?php if (isset($zendesk_form) || isset($formatted_partners)): ?>

    <?php if (isset($zendesk_form)): ?>
      <?php print t('Questions?'); ?> <?php print t('Contact Us'); ?>

<?php print t('Contact Us'); ?>

<?php print $zendesk_form_header; ?>

          <?php print render($zendesk_form); ?>

    <?php endif; ?>

    <?php if (isset($formatted_partners)): ?>

      <?php print t("In partnership with"); ?> <?php print $formatted_partners; ?>

    <?php endif; ?>

<?php endif; ?>

<?php

/**
 * Generates info bar footer.
 **/
?>

<?php if (isset($zendesk_form) || isset($formatted_partners)): ?>

    <?php if (isset($formatted_partners)): ?>
      <?php print t("In partnership with"); ?> <?php print $formatted_partners; ?>
    <?php endif; ?>

    <?php if (isset($zendesk_form)): ?>

        <?php print t('Questions?'); ?> <?php print t('Contact Us'); ?>

<?php print t('Contact Us'); ?>

<?php print $zendesk_form_header; ?>

            <?php print render($zendesk_form); ?>

    <?php endif; ?>

<?php endif; ?>

Swap positions of "contact us" and partner text in Info Bar.


<?php

require_once 'test_helper.php';

class AttributesTest extends PHPUnit_Framework_TestCase
{
  protected $compiler = null;

  public function __construct()
  {
    $this->compiler = new Compiler();
  }

  public function testAttributes()
  {
    $actual = $this->compiler->parseFile(template('filters.haml'));
    $this->assertEquals(contents('filters_expected.html'), $actual);
  }
}

<?php

require_once 'test_helper.php';

class FilterTest extends PHPUnit_Framework_TestCase
{
  protected $compiler = null;

  public function __construct()
  {
    $this->compiler = new Compiler();
  }

  public function testAttributes()
  {
    $actual = $this->compiler->parseFile(template('filters.haml'));
    $this->assertEquals(contents('filters_expected.html'), $actual);
  }
}

Remove duplicated attribute test class

Remove duplicated attribute test class


<?php
namespace Rudolf\Modules\Pages;

use Rudolf\Modules\A_front\FController;
use Rudolf\Component\Http\HttpErrorException;

class Controller extends FController
{
    public function page($sAddress)
    {
        $addressArray = explode('/', trim($sAddress, '/'));

        $model = new Model();
        $pagesList = $model->getPagesList();
        $pageId = $model->getPageIdByPath($addressArray, $pagesList);

        if (false === $pageId) {
            throw new HttpErrorException('No page found (error 404)', 404);
        }

        $pageData = $model->getPageById($pageId);

        $view = new View();
        $view->page($pageData);
        $aAddress = explode('/', $sAddress);
        $view->setFrontData($this->frontData, $aAddress[0]);
        $view->setBreadcrumbsData($pagesList, $aAddress);

        return $view->render();
    }
}

<?php
namespace Rudolf\Modules\Pages;

use Rudolf\Modules\A_front\FController;
use Rudolf\Component\Http\HttpErrorException;

class Controller extends FController
{
    public function page($sAddress)
    {
        $addressArray = explode('/', trim($sAddress, '/'));

        $model = new Model();
        $pagesList = $model->getPagesList();
        $pageId = $model->getPageIdByPath($addressArray, $pagesList);

        if (false === $pageId) {
            throw new HttpErrorException('No page found (error 404)', 404);
        }

        $pageData = $model->getPageById($pageId);

        $view = new View();
        $view->page($pageData);
        $aAddress = explode('/', $sAddress);

        $temp = '';
        foreach ($aAddress as $key => $value) {
            $active[] = ltrim($temp = $temp . '/' . $value, '/');
        }

        $view->setFrontData($this->frontData, $active);
        $view->setBreadcrumbsData($pagesList, $aAddress);

        return $view->render();
    }
}

Add more info about active page

Add more info about active page


<?php

namespace Vinkla\Tests\Pusher;

use GrahamCampbell\TestBench\Traits\ServiceProviderTestCaseTrait;

class ServiceProviderTest extends AbstractTestCase
{

    use ServiceProviderTestCaseTrait;

    public function PusherFactoryIsInjectable()
    {
        $this->assertIsInjectable('Vinkla\Pusher\Factories\PusherFactory');
    }

    public function PusherManagerIsInjectable()
    {
        $this->assertIsInjectable('Vinkla\Pusher\PusherManager');
    }
}

<?php

namespace Vinkla\Tests\Pusher;

use GrahamCampbell\TestBench\Traits\ServiceProviderTestCaseTrait;

class ServiceProviderTest extends AbstractTestCase
{
    use ServiceProviderTestCaseTrait;

    public function testPusherFactoryIsInjectable()
    {
        $this->assertIsInjectable('Vinkla\Pusher\Factories\PusherFactory');
    }

    public function testPusherManagerIsInjectable()
    {
        $this->assertIsInjectable('Vinkla\Pusher\PusherManager');
    }
}

Fix service provider test names.

Fix service provider test names.


<?php
/**
* @copyright Copyright © Saranga Abeykoon, nterms.com, 2014
*
* @version 1.0.0
*/
namespace nterms\mediaelement;

use yii\web\AssetBundle;

/**
 * @author Saranga Abeykoon <amisaranga@gmail.com>
 */
class MediaElementAsset extends AssetBundle
{
    public $sourcePath = '@bower/mediaelement';
    public $js = [
        'mediaelement-and-player.min.js',
    ];
    public $css = [
        'mediaelementplayer.css',
    ];
    public $depends = [
        'yii\web\JqueryAsset',
        'yii\web\YiiAsset',
    ];
}

<?php
/**
* @copyright Copyright © Saranga Abeykoon, nterms.com, 2014
*
* @version 1.0.0
*/
namespace nterms\mediaelement;

use yii\web\AssetBundle;

/**
 * @author Saranga Abeykoon <amisaranga@gmail.com>
 */
class MediaElementAsset extends AssetBundle
{
    public $sourcePath = '@bower/mediaelement/build';
    public $js = [
        'mediaelement-and-player.min.js',
    ];
    public $css = [
        'mediaelementplayer.css',
    ];
    public $depends = [
        'yii\web\JqueryAsset',
        'yii\web\YiiAsset',
    ];
}

Modify script sourcePath to match bower.json


<?php

abstract class Dao_Factory {
	abstract public function setConnection($conn);
	abstract public function getConnection();

	abstract public function getSpotDao();
	abstract public function getSpotSearchDao();
	abstract public function getUserDao();
	abstract public function getCacheDao();
	abstract public function getAuditDao();
	abstract public function getUserFilterDao();
	abstract public function getSessionDao();
	abstract public function getBlackWhiteListDao();
	abstract public function getNotificationDao();
	abstract public function getCommentDao();
	abstract public function getSpotReportDao();
	abstract public function getSettingDao();

	/*
	 * Factory class which instantiates the specified DAO factory object
	 */
	public static function getDAOFactory($which) {
		switch($which) {
			case 'postgresql'			: return new PostgresqlDaoFactory(); break;
			case 'mysql'				: return new MysqlDaoFactory(); break;
			case 'sqlite'				: return new SqliteDaoFactory(); break;

			default						: throw new Exception("Unknown DAO factory specified");
		} // switch
	} # getDayFactory()

} // Dao_Factory

<?php

abstract class Dao_Factory {
	abstract public function setConnection($conn);
	abstract public function getConnection();

	abstract public function getSpotDao();
	abstract public function getSpotSearchDao();
	abstract public function getUserDao();
	abstract public function getCacheDao();
	abstract public function getAuditDao();
	abstract public function getUserFilterDao();
	abstract public function getSessionDao();
	abstract public function getBlackWhiteListDao();
	abstract public function getNotificationDao();
	abstract public function getCommentDao();
	abstract public function getSpotReportDao();
	abstract public function getSettingDao();

	/*
	 * Factory class which instantiates the specified DAO factory object
	 */
	public static function getDAOFactory($which) {
		switch($which) {
			case 'postgresql'			: return new Dao_Postgresql_Factory(); break;
			case 'mysql'				: return new Dao_Mysql_Factory(); break;
			case 'sqlite'				: return new Dao_Sqlite_actory(); break;

			default						: throw new Exception("Unknown DAO factory specified");
		} // switch
	} # getDayFactory()

} // Dao_Factory

Add correct clases to factory

Add correct clases to factory


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

use Cake\Core\InstanceConfigTrait;
use Cake\Network\Request;

/**
 * Memory based non-persistent storage for authenticated user record.
 */
class MemoryStorage implements StorageInterface
{
    /**
     * User record.
     *
     * @var array
     */
    protected $_user;

    /**
     * {@inheritDoc}
     */
    public function get()
    {
        return $this->_user;
    }

    /**
     * {@inheritDoc}
     */
    public function set(array $user)
    {
        $this->_user = $user;
    }

    /**
     * {@inheritDoc}
     */
    public function remove()
    {
        unset($this->_user);
    }
}

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

use Cake\Core\InstanceConfigTrait;
use Cake\Network\Request;

/**
 * Memory based non-persistent storage for authenticated user record.
 */
class MemoryStorage implements StorageInterface
{
    /**
     * User record.
     *
     * @var array
     */
    protected $_user;

    /**
     * {@inheritDoc}
     */
    public function get()
    {
        return $this->_user;
    }

    /**
     * {@inheritDoc}
     */
    public function set(array $user)
    {
        $this->_user = $user;
    }

    /**
     * {@inheritDoc}
     */
    public function remove()
    {
        $this->_user = null;
    }
}

Set to null instead of unsetting

Set to null instead of unsetting


<?php

namespace Concise\Matcher;

class UrlHasPart extends AbstractMatcher
{
    public function supportedSyntaxes()
    {
        return array(
            'url ?:string has scheme ?:string' => 'URL has scheme.',
            'url ?:string has host ?:string' => 'URL has host.',
            'url ?:string has port ?:int' => 'URL has port.',
            'url ?:string has user ?:string' => 'URL has user.',
            'url ?:string has password ?:string' => 'URL has password.',
            'url ?:string has path ?:string' => 'URL has path.',
            'url ?:string has query ?:string' => 'URL has query.',
            'url ?:string has fragment ?:string' => 'URL has fragment.',
        );
    }

    public function match($syntax, array $data = array())
    {
        $parts = [
            'port' => PHP_URL_PORT,
            'host' => PHP_URL_HOST,
            'user' => PHP_URL_USER,
            'password' => PHP_URL_PASS,
            'path' => PHP_URL_PATH,
            'query' => PHP_URL_QUERY,
            'fragment' => PHP_URL_FRAGMENT,
        ];
        $url = parse_url($data[0]);
        foreach ($parts as $kw => $part) {
            if (strpos($syntax, $kw)) {
                return parse_url($data[0], $part) == $data[1];
            }
        }

        return parse_url($data[0], PHP_URL_SCHEME) == $data[1];
    }

    public function getTags()
    {
        return array(Tag::URLS);
    }
}

<?php

namespace Concise\Matcher;

class UrlHasPart extends AbstractMatcher
{
    public function supportedSyntaxes()
    {
        return array(
            'url ?:string has scheme ?:string' => 'URL has scheme.',
            'url ?:string has host ?:string' => 'URL has host.',
            'url ?:string has port ?:int' => 'URL has port.',
            'url ?:string has user ?:string' => 'URL has user.',
            'url ?:string has password ?:string' => 'URL has password.',
            'url ?:string has path ?:string' => 'URL has path.',
            'url ?:string has query ?:string' => 'URL has query.',
            'url ?:string has fragment ?:string' => 'URL has fragment.',
        );
    }

    public function match($syntax, array $data = array())
    {
        $parts = array(
            'port' => PHP_URL_PORT,
            'host' => PHP_URL_HOST,
            'user' => PHP_URL_USER,
            'password' => PHP_URL_PASS,
            'path' => PHP_URL_PATH,
            'query' => PHP_URL_QUERY,
            'fragment' => PHP_URL_FRAGMENT,
        );
        $url = parse_url($data[0]);
        foreach ($parts as $kw => $part) {
            if (strpos($syntax, $kw)) {
                return parse_url($data[0], $part) == $data[1];
            }
        }

        return parse_url($data[0], PHP_URL_SCHEME) == $data[1];
    }

    public function getTags()
    {
        return array(Tag::URLS);
    }
}

Fix syntax error in PHP 5.3

Fix syntax error in PHP 5.3


<?php

namespace Risan\OAuth1\Request;

use Risan\OAuth1\Credentials\TemporaryCredentials;

interface RequestConfigInterface
{
    /**
     * Get the ConfigInterface instance.
     *
     * @return \Risan\OAuth1\ConfigInterface
     */
    public function getConfig();

    /**
     * Get the SignerInterface instance.
     *
     * @return \Risan\OAuth1\Signature\SignerInterface
     */
    public function getSigner();

    /**
     * Get the NonceGeneratorInterface instance.
     *
     * @return \Risan\OAuth1\Request\NonceGeneratorInterface
     */
    public function getNonceGenerator();

    /**
     * Get current timestamp in seconds since Unix Epoch.
     *
     * @return int
     */
    public function getCurrentTimestamp();

    /**
     * Get url for obtaining temporary credentials.
     *
     * @return string
     */
    public function getTemporaryCredentialsUrl();

    /**
     * Get authorization header for obtaining temporary credentials.
     *
     * @return string
     */
    public function getTemporaryCredentialsAuthorizationHeader();

    /**
     * Build the authorization URL.
     *
     * @param  Risan\OAuth1\Credentials\TemporaryCredentials $temporaryCredentials
     * @return string
     */
    public function buildAuthorizationUrl(TemporaryCredentials $temporaryCredentials);
}

<?php

namespace Risan\OAuth1\Request;

use Risan\OAuth1\Credentials\TemporaryCredentials;

interface RequestConfigInterface
{
    /**
     * Get the ConfigInterface instance.
     *
     * @return \Risan\OAuth1\ConfigInterface
     */
    public function getConfig();

    /**
     * Get the SignerInterface instance.
     *
     * @return \Risan\OAuth1\Signature\SignerInterface
     */
    public function getSigner();

    /**
     * Get the NonceGeneratorInterface instance.
     *
     * @return \Risan\OAuth1\Request\NonceGeneratorInterface
     */
    public function getNonceGenerator();

    /**
     * Get current timestamp in seconds since Unix Epoch.
     *
     * @return int
     */
    public function getCurrentTimestamp();

    /**
     * Get URL for obtaining temporary credentials.
     *
     * @return string
     */
    public function getTemporaryCredentialsUrl();

    /**
     * Get authorization header for obtaining temporary credentials.
     *
     * @return string
     */
    public function getTemporaryCredentialsAuthorizationHeader();

    /**
     * Build the authorization URL.
     *
     * @param  Risan\OAuth1\Credentials\TemporaryCredentials $temporaryCredentials
     * @return string
     */
    public function buildAuthorizationUrl(TemporaryCredentials $temporaryCredentials);

    /**
     * Get URL for obtaining token credentials.
     *
     * @return string
     */
    public function getTokenCredentialsUrl();

    /**
     * Get authorization header for obtaining token credentials.
     *
     * @return string
     */
    public function getTokenCredentialsAuthorizationHeader();
}

:sparkles: Add token credentials related method to RequestConfig interface.


<?php

namespace EGALL\Transformer;

use Illuminate\Support\ServiceProvider;
use EGALL\Transformer\Contracts\Transformer as TransformerContract;
use EGALL\Transformer\Contracts\TransformableCollection as TransformableCollectionContract;

/**
 * Transformer service provider.
 *
 * @package EGALL\Transformer
 * @author Erik Galloway <erik@mybarnapp.com>
 */
class TransformerServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind(TransformerContract::class, Transformer::class);
        $this->app->bind(TransformerCollectionContract::class, TransformableCollection::class);
    }
}

<?php

namespace EGALL\Transformer;

use Illuminate\Support\ServiceProvider;
use EGALL\Transformer\Contracts\Transformer as TransformerContract;
use EGALL\Transformer\Contracts\TransformableCollection as TransformableCollectionContract;

/**
 * Transformer service provider.
 *
 * @package EGALL\Transformer
 * @author Erik Galloway <erik@mybarnapp.com>
 */
class TransformerServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind(TransformerContract::class, Transformer::class);
        $this->app->bind(TransformableCollectionContract::class, TransformableCollection::class);
    }
}

Fix transformer collection contract class name in service provider


<?php
/**
 * Whoops - php errors for cool kids
 * @author Filipe Dobreira <http://github.com/filp>
 */

namespace ByJG\RestServer\Whoops;

use Whoops\Exception\Formatter;
use Whoops\Handler\Handler;
use Whoops\Handler\JsonResponseHandler as OriginalJsonHandler;
use Whoops\Util\Misc;

/**
 * Catches an exception and converts it to a JSON
 * response. Additionally can also return exception
 * frames for consumption by an API.
 */
class JsonResponseHandler extends OriginalJsonHandler
{

    use WhoopsDebugTrait;
    use WhoopsHeaderTrait;

    /**
     * @return int
     */
    public function handle()
    {
        if ($this->onlyForAjaxRequests() && !$this->isAjaxRequest()) {
            return Handler::DONE;
        }

        $response = array(
            'error' => Formatter::formatExceptionAsDataArray(
                $this->getInspector(),
                $this->addTraceToOutput()
            ),
        );

        $debug = $this->getDataTable();
        if (count($debug) > 0) {
            $response["debug"] = $debug;
        }

        if (Misc::canSendHeaders()) {
            header('Content-Type: application/json');
        }

        $this->setProperHeader($this->getException());
        echo json_encode($response);
        return Handler::QUIT;
    }

    public function isAjaxRequest() {
        return (
            !empty($_SERVER['HTTP_X_REQUESTED_WITH'])
            && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');

    }

}

<?php
/**
 * Whoops - php errors for cool kids
 * @author Filipe Dobreira <http://github.com/filp>
 */

namespace ByJG\RestServer\Whoops;

use Whoops\Exception\Formatter;
use Whoops\Handler\Handler;
use Whoops\Handler\JsonResponseHandler as OriginalJsonHandler;
use Whoops\Util\Misc;

/**
 * Catches an exception and converts it to a JSON
 * response. Additionally can also return exception
 * frames for consumption by an API.
 */
class JsonResponseHandler extends OriginalJsonHandler
{

    use WhoopsDebugTrait;
    use WhoopsHeaderTrait;

    /**
     * @return int
     */
    public function handle()
    {
        $response = array(
            'error' => Formatter::formatExceptionAsDataArray(
                $this->getInspector(),
                $this->addTraceToOutput()
            ),
        );

        $debug = $this->getDataTable();
        if (count($debug) > 0) {
            $response["debug"] = $debug;
        }

        echo json_encode($response, defined('JSON_PARTIAL_OUTPUT_ON_ERROR') ? JSON_PARTIAL_OUTPUT_ON_ERROR : 0);

        return Handler::QUIT;
    }

}

Fix error on new Whoops version

Fix error on new Whoops version


<?php

namespace SLLH\HybridAuthBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

use SLLH\HybridAuthBundle\DependencyInjection\SLLHHybridAuthExtension;

class SLLHHybridAuthBundle extends Bundle
{
    /**
     * {@inheritdoc}
     */
    public function getContainerExtension()
    {
        // for get sllh_hybridauth instead of sllh_hybrid_auth
        if (null === $this->extension) {
            return new SLLHHybridAuthExtension;
        }

        return $this->extension;
    }
}

<?php

namespace SLLH\HybridAuthBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle,
    Symfony\Component\DependencyInjection\ContainerBuilder,
    Symfony\Component\HttpKernel\Kernel;

use SLLH\HybridAuthBundle\DependencyInjection\SLLHHybridAuthExtension,
    SLLH\HybridAuthBundle\DependencyInjection\Security\Factory\HybridAuthFactory;

class SLLHHybridAuthBundle extends Bundle
{
    /**
     * {@inheritDoc}
     */
    public function build(ContainerBuilder $container)
    {
        parent::build($container);

        //  For 2.0 versions :
        //     factories:
        //             - "%kernel.root_dir%/../../../vendor/bundles/SLLH/HybridAuthBundle/Resources/config/security_factory.xml"
        if (version_compare(Kernel::VERSION, '2.1-DEV', '>=')) {
            $extension = $container->getExtension('security');
            $extension->addSecurityListenerFactory(new HybridAuthFactory());
        }
    }

    /**
     * {@inheritdoc}
     */
    public function getContainerExtension()
    {
        // for get sllh_hybridauth instead of sllh_hybrid_auth
        if (null === $this->extension) {
            return new SLLHHybridAuthExtension;
        }

        return $this->extension;
    }
}

Load factory form >= 2.1 versions

Load factory form >= 2.1 versions


<?php

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

class CreateBookmarksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('bookmarks', function (Blueprint $table) {
            $table->increments('id');
            $table->string('url');
            $table->string('name')->nullable();
            $table->text('content')->nullable();
            $table->uuid('screenshot')->nullable();
            $table->timestamps();
        });
    }

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

<?php

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

class CreateBookmarksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('bookmarks', function (Blueprint $table) {
            $table->increments('id');
            $table->string('url');
            $table->string('name')->nullable();
            $table->text('content')->nullable();
            $table->uuid('screenshot')->nullable();
            $table->string('archve')->nullable();
            $table->timestamps();
        });
    }

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

Add a column for archive link

Add a column for archive link


<?php
/**
 * Finance module for HiPanel
 *
 * @link      https://github.com/hiqdev/hipanel-module-finance
 * @package   hipanel-module-finance
 * @license   BSD-3-Clause
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
 */

namespace hipanel\modules\finance\logic\bill;

use Yii;

/**
 * Class SupportTimeQuantity.
 *
 * @author Dmytro Naumenko <d.naumenko.a@gmail.com>
 */
class SupportTimeQuantity extends DefaultQuantityFormatter
{
    public function format(): string
    {
        return Yii::t('hipanel:finance', '{quantity}', [
            'quantity' => Yii::$app->formatter->asDuration(ceil($this->getQuantity()->getQuantity() * 3600))
        ]);
    }
}

<?php
/**
 * Finance module for HiPanel
 *
 * @link      https://github.com/hiqdev/hipanel-module-finance
 * @package   hipanel-module-finance
 * @license   BSD-3-Clause
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
 */

namespace hipanel\modules\finance\logic\bill;

use Yii;

/**
 * Class SupportTimeQuantity.
 *
 * @author Dmytro Naumenko <d.naumenko.a@gmail.com>
 */
class SupportTimeQuantity extends DefaultQuantityFormatter
{
    public function format(): string
    {
        $qty = $this->getQuantity()->getQuantity();

        return Yii::t('hipanel:finance', '{qty}', [
            'qty' => sprintf('%02d:%02d', (int)$qty, fmod($qty, 1) * 60),
        ]);
    }
}

Format support time like `hh:mm`, HP-575


<?php
/**
 * @package Swat
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @copyright silverorange 2004
 */
require_once('Swat/SwatControl.php');
require_once('Swat/SwatHtmlTag.php');
require_once('Swat/SwatException.php');

/**
 * A multi-line text entry widget.
 */
class SwatTextarea extends SwatControl {

	public $text = '';

	/**
	 * @var int Number of rows for the HTML textarea tag.
	 */
	public $rows = 10;

	/**
	 * @var int Number of columns for the HTML textarea tag.
	 */
	public $cols = 50;

	function display() {
		$textareatag = new SwatHtmlTag('textarea');
		$textareatag->name = $this->name;
		$textareatag->id = $this->name;
		// Attributes rows and cols are required in a textarea for XHTML strict.
		$textareatag->rows = $this->rows;
		$textareatag->cols = $this->cols;

		$textareatag->open();
		echo $this->text;
		$textareatag->close();
	}

	function process() {
		$this->text = $_POST[$this->name];

		if ($this->required && !strlen($this->text))
			$this->addErrorMessage(_S("The %s field is required."));
	}
}

?>

<?php
/**
 * @package Swat
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @copyright silverorange 2004
 */
require_once('Swat/SwatControl.php');
require_once('Swat/SwatHtmlTag.php');
require_once('Swat/SwatException.php');

/**
 * A multi-line text entry widget.
 */
class SwatTextarea extends SwatControl {

	/**
	 * @var string Text content of the widget.
	 * @todo Possibly rename this to $value.
	 */
	public $text = '';

	/**
	 * @var int Number of rows for the HTML textarea tag.
	 */
	public $rows = 10;

	/**
	 * @var int Number of columns for the HTML textarea tag.
	 */
	public $cols = 50;

	function display() {
		$textareatag = new SwatHtmlTag('textarea');
		$textareatag->name = $this->name;
		$textareatag->id = $this->name;
		// Attributes rows and cols are required in a textarea for XHTML strict.
		$textareatag->rows = $this->rows;
		$textareatag->cols = $this->cols;

		$textareatag->open();
		echo $this->text;
		$textareatag->close();
	}

	function process() {
		$this->text = $_POST[$this->name];

		if ($this->required && !strlen($this->text))
			$this->addErrorMessage(_S("The %s field is required."));
	}
}

?>

Add a missing docblock.
Try a @todo tag.

svn commit r54


<?php
require_once('./lib/Stripe.php');
// for MASTER
// require_once('./config.php');
// for Branches
require_once('../../../backend/config.php');

Stripe::setApiKey($config['stripe_sk']);

if (isset($_POST['token'])) {
    $token  = $_POST['token'];
    $amount = $_POST['amount'];
    $email = $_POST['email'];

    // Create the charge on Stripe's servers - this will charge the user's card
    try {
        $charge = Stripe_Charge::create(array(
            'amount' => $amount,
            'currency' => 'usd',
            'card' => $token,
            'description' => 'elementary OS download',
            'receipt_email' => $email,
        ));
        // Set an insecure, HTTP only cookie for 10 years in the future.
        setcookie('has_paid_freya', $amount, time() + 315360000, '/', '.elementary.io', 0, 1);
        echo 'OK';
    } catch(Stripe_CardError $e) {
        echo 'error';
    }
} else {
    echo $config['stripe_pk'];
}

<?php
require_once('./lib/Stripe.php');
// for MASTER
require_once('./config.php');
// for Branches
// require_once('../../../backend/config.php');

Stripe::setApiKey($config['stripe_sk']);

if (isset($_POST['token'])) {
    $token  = $_POST['token'];
    $amount = $_POST['amount'];
    $email = $_POST['email'];

    // Create the charge on Stripe's servers - this will charge the user's card
    try {
        $charge = Stripe_Charge::create(array(
            'amount' => $amount,
            'currency' => 'usd',
            'card' => $token,
            'description' => 'elementary OS download',
            'receipt_email' => $email,
        ));
        // Set an insecure, HTTP only cookie for 10 years in the future.
        setcookie('has_paid_freya', $amount, time() + 315360000, '/', '.elementary.io', 0, 1);
        echo 'OK';
    } catch(Stripe_CardError $e) {
        echo 'error';
    }
} else {
    echo $config['stripe_pk'];
}

Set for master while branch auto-updating is down.


<?php

namespace ajax\details;

use \PDO as PDO;

/**
 * Web Service.
 * Returns Organisms with given ids
 */
class Organisms extends \WebService {

    /**
     * @param $querydata[type_cvterm_id] array of trait type_cvterm_id
     * @returns array of organisms accoring to a specific trait type
     */
    public function execute($querydata) {
        global $db;

    }

}

?>

<?php

namespace ajax\details;

use \PDO as PDO;

/**
 * Web Service.
 * Returns Organisms with given ids
 */
class Organisms_to_traits extends \WebService {

    /**
     * @param $querydata[type_cvterm_id] array of trait type_cvterm_id
     * @returns array of organisms accoring to a specific trait type
     */
    public function execute($querydata) {
        global $db;

    }

}

?>

Rename class of new webservice

Rename class of new webservice


<?php

namespace Sven\FlexEnv\Commands;

use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Collection;
use Sven\FileConfig\Drivers\Env;
use Symfony\Component\Console\Input\InputArgument;

class EnvExampleCommand extends EnvCommand
{
    /** @var string */
    protected $name = 'env:example';

    /** @var string */
    protected $description = 'Generate an environment file for distribution';

    public function handle(Filesystem $files): int
    {
        $config = $this->config();

        $values = Collection::make($config->all())
            ->mapWithKeys(function ($value, $key) {
                if (is_numeric($key) && $value === '') {
                    return [$key => $value];
                }

                return [$key => ''];
            })
            ->toArray();

        $contents = (new Env())->export($values);
        $file = $this->laravel->environmentPath().DIRECTORY_SEPARATOR.$this->argument('name');

        $files->put($file, $contents);
    }

    public function getArguments()
    {
        return [
            ['name', InputArgument::OPTIONAL, 'The name of the "distribution" file to generate.', '.env.example'],
        ];
    }
}

<?php

namespace Sven\FlexEnv\Commands;

use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Collection;
use Sven\FileConfig\Drivers\Env;
use Symfony\Component\Console\Input\InputArgument;

class EnvExampleCommand extends EnvCommand
{
    /** @var string */
    protected $name = 'env:example';

    /** @var string */
    protected $description = 'Generate an environment file for distribution';

    public function handle(Filesystem $files): int
    {
        $config = $this->config();

        $values = Collection::make($config->all())
            ->mapWithKeys(function ($value, $key) {
                if (is_numeric($key) && $value === '') {
                    return [$key => $value];
                }

                return [$key => ''];
            })
            ->toArray();

        $contents = (new Env())->export($values);
        $file = $this->laravel->environmentPath().DIRECTORY_SEPARATOR.$this->argument('name');

        $files->put($file, $contents);

        return 0;
    }

    public function getArguments()
    {
        return [
            ['name', InputArgument::OPTIONAL, 'The name of the "distribution" file to generate.', '.env.example'],
        ];
    }
}

Return exit code in example command

Return exit code in example command


<?php

namespace RulerZ\Compiler;

use RulerZ\Model\Rule;

interface CompilationTarget
{
    const MODE_FILTER       = 'filter';
    const MODE_APPLY_FILTER = 'apply_filter';
    const MODE_SATISFIES    = 'satisfies';

    /**
     * Compiles the given rule.
     *
     * @param Rule $rule The rule.
     * @param Context $compilationContext The compilation context.
     *
     * @return \RulerZ\Model\Executor
     */
    public function compile(Rule $rule, Context $compilationContext);

    /**
     * Indicates whether the given target is supported or not.
     *
     * @param mixed  $target The target to test.
     * @param string $mode The execution mode (MODE_FILTER or MODE_SATISFIES).
     *
     * @return boolean
     */
    public function supports($target, $mode);

    /**
     * Create a compilation context from a sample target.
     *
     * @param mixed $target The target.
     *
     * @return Context
     */
    public function createCompilationContext($target);

    public function defineOperator($name, callable $transformer);
    public function defineInlineOperator($name, callable $transformer);

    /**
     * @return \RulerZ\Target\Operators\Definitions
     */
    public function getOperators();
}

<?php

namespace RulerZ\Compiler;

use RulerZ\Model\Rule;

interface CompilationTarget
{
    const MODE_FILTER       = 'filter';
    const MODE_APPLY_FILTER = 'apply_filter';
    const MODE_SATISFIES    = 'satisfies';

    /**
     * Compiles the given rule.
     *
     * @param Rule $rule The rule.
     * @param Context $compilationContext The compilation context.
     *
     * @return \RulerZ\Model\Executor
     */
    public function compile(Rule $rule, Context $compilationContext);

    /**
     * Indicates whether the given target is supported or not.
     *
     * @param mixed  $target The target to test.
     * @param string $mode The execution mode (MODE_FILTER or MODE_SATISFIES).
     *
     * @return boolean
     */
    public function supports($target, $mode);

    /**
     * Create a compilation context from a sample target.
     *
     * @param mixed $target The target.
     *
     * @return Context
     */
    public function createCompilationContext($target);

    /**
     * Define a runtime operator.
     *
     * @param string $name The operator name.
     * @param callable $transformer The operator implementation (will be called at runtime when the operator is used).
     */
    public function defineOperator($name, callable $transformer);

    /**
     * Define a compile-time operator.
     *
     * @param string $name The operator name.
     * @param callable $transformer The operator implementation (will be called at compile-time when the operator is used).
     */
    public function defineInlineOperator($name, callable $transformer);

    /**
     * @return \RulerZ\Target\Operators\Definitions
     */
    public function getOperators();
}

Add a few missing docblocks

Add a few missing docblocks


<?php

/*
 * This file is part of the Access to Memory (AtoM) software.
 *
 * Access to Memory (AtoM) is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Access to Memory (AtoM) 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 Access to Memory (AtoM).  If not, see <http://www.gnu.org/licenses/>.
 */

class QubitMeta extends sfFilter
{
  public function execute($filterChain)
  {
    $context = $this->getContext();

    $context->response->addMeta('title', sfConfig::get('app_siteTitle'));
    $context->response->addMeta('description', sfConfig::get('app_siteDescription'));

    foreach (array('actor_template', 'informationobject_template', 'repository_template') as $name)
    {
      if (isset($context->request[$name]))
      {
        $context->routing->setDefaultParameter($name, $context->request[$name]);
      }
      else
      {
        $context->routing->setDefaultParameter($name, sfConfig::get('app_default_template_'.substr($name, 0, -9)));
      }
    }

    $filterChain->execute();
  }
}

<?php

/*
 * This file is part of the Access to Memory (AtoM) software.
 *
 * Access to Memory (AtoM) is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Access to Memory (AtoM) 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 Access to Memory (AtoM).  If not, see <http://www.gnu.org/licenses/>.
 */

class QubitMeta extends sfFilter
{
  public function execute($filterChain)
  {
    $context = $this->getContext();

    $context->response->addMeta('title', sfConfig::get('app_siteTitle'));
    $context->response->addMeta('description', sfConfig::get('app_siteDescription'));

    $filterChain->execute();
  }
}

Stop setting routing param in sfRequest

Stop setting routing param in sfRequest


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

namespace Flarum\Events;

use Flarum\Locale\LocaleManager;

class RegisterLocales
{
    /**
     * @var LocaleManager
     */
    public $manager;

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

    public function addTranslations($locale, $file)
    {
        $this->manager->addTranslations($locale, $file);
    }
}

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

namespace Flarum\Events;

use Flarum\Locale\LocaleManager;

class RegisterLocales
{
    /**
     * @var LocaleManager
     */
    public $manager;

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

    public function addLocale($locale, $name)
    {
        $this->manager->addLocale($locale, $name);
    }

    public function addTranslations($locale, $file)
    {
        $this->manager->addTranslations($locale, $file);
    }

    public function addJsFile($locale, $file)
    {
        $this->manager->addJsFile($locale, $file);
    }

    public function addConfig($locale, $file)
    {
        $this->manager->addConfig($locale, $file);
    }
}

Add more locale registration APIs

API: Add more locale registration APIs


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

  var_dump($_POST);

  $token  = $_POST['stripeToken'];
  $email  = $_POST['stripeEmail'];
  $amount = $_POST['amount'];
  $recurring = $_POST['recurring'];

  // validate the amount

  if ( !empty($recurring) ) {

    try {

      $plan = Stripe_Plan::retrieve("monthly{$amount}");

    } catch (Stripe_InvalidRequestError $error) {

      $plan = Stripe_Plan::create(array(
         "amount" => $amount * 100,
        "interval" => "month",
        "name" => "Monthly {$amount}",
        "currency" => "usd",
        "id" => "monthly{$amount}")
      );
    }

      $customer = Stripe_Customer::create(array(
        'email' => $email,
        'card'  => $token,
        'plan' => "monthly{$amount}"
      ));

    echo "
Successful subscription for {$amount}/month!
";

  } else {

    $customer = Stripe_Customer::create(array(
        'email' => $email,
        'card'  => $token
    ));

    $charge = Stripe_Charge::create(array(
        'customer' => $customer->id,
        'amount'   => $amount * 100,
        'currency' => 'usd',
        'description' => 'donation, amount supplied by customer'
    ));

  echo "
Successfully charged {$amount}!zz
";

  }

?>

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

  var_dump($_POST);

  $token  = $_POST['stripeToken'];
  $email  = $_POST['stripeEmail'];
  $amount = $_POST['amount'];
  $recurring = $_POST['recurring'];

  // validate the amount

  $plan_id = "monthly{$amount}";
  $plan_name = "Monthly {$amount}";

  if ( !empty($recurring) ) {

    try {

      $plan = Stripe_Plan::retrieve("monthly{$amount}");

    } catch (Stripe_InvalidRequestError $error) {

      $plan = Stripe_Plan::create(array(
        "amount" => $amount * 100,
        "interval" => "month",
        "name" => $plan_name,
        "currency" => "usd",
        "id" => $plan_id)
      );
    }

      $customer = Stripe_Customer::create(array(
        'email' => $email,
        'card'  => $token,
        'plan' => $plan_id
      ));

    echo "
Successful subscription for {$amount}/month!
";

  } else {

    $customer = Stripe_Customer::create(array(
        'email' => $email,
        'card'  => $token
    ));

    $charge = Stripe_Charge::create(array(
        'customer' => $customer->id,
        'amount'   => $amount * 100,
        'currency' => 'usd',
        'description' => 'donation, amount supplied by customer'
    ));

  echo "
Successfully charged {$amount}!
";

  }

?>

Introduce variable for plan id. formatting.