<?php

namespace DvK\Laravel\Vat;

use Illuminate\Contracts\Container\Container;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Validator as RequestValidator;

class VatServiceProvider extends ServiceProvider
{
    /**
     * Boot the service provider.
     *
     * @return void
     */
    public function boot()
    {
        RequestValidator::extend('vat_number', function($attribute, $value, $parameters, $validator ) {
            $vatValidator = new Validator();
            $data = $validator->getData();
            $country = isset( $data['country'] ) ? $data['country'] : '';
            return $vatValidator->check( $value, $country );
        });
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton( Validator::class, function (Container $app) {
           return new Validator();
        });

        $this->app->singleton( Rates::class, function (Container $app) {
            $defaultCacheDriver = $app['cache']->getDefaultDriver();
            $cacheDriver = $app['cache']->driver( $defaultCacheDriver );
            return new Rates( $cacheDriver );
        });
    }

    /**
     * Get the services provided by the provider.
     *
     * @return string[]
     */
    public function provides()
    {
        return [
            'DvK\Laravel\Vat\Validator',
            'DvK\Laravel\Vat\Rates',
        ];
    }
}

<?php

namespace DvK\Laravel\Vat;

use Illuminate\Contracts\Container\Container;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Validator as RequestValidator;

use DvK\Laravel\Vat\Facades\Validator as ValidatorFacade;

class VatServiceProvider extends ServiceProvider
{
    /**
     * Boot the service provider.
     *
     * @return void
     */
    public function boot()
    {
        RequestValidator::extend('vat_number', function($attribute, $value, $parameters, $validator ) {
            return ValidatorFacade::validate( $value );
        });
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton( Validator::class, function (Container $app) {
           return new Validator();
        });

        $this->app->singleton( Rates::class, function (Container $app) {
            $defaultCacheDriver = $app['cache']->getDefaultDriver();
            $cacheDriver = $app['cache']->driver( $defaultCacheDriver );
            return new Rates( $cacheDriver );
        });
    }

    /**
     * Get the services provided by the provider.
     *
     * @return string[]
     */
    public function provides()
    {
        return [
            'DvK\Laravel\Vat\Validator',
            'DvK\Laravel\Vat\Rates',
        ];
    }
}

Use Facade to access method instead of creating a new instance.


<?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\Forum\Controller;

use DateTime;
use Flarum\Core\Exception\InvalidConfirmationTokenException;
use Flarum\Core\PasswordToken;
use Flarum\Http\Controller\AbstractHtmlController;
use Illuminate\Contracts\View\Factory;
use Psr\Http\Message\ServerRequestInterface as Request;

class ResetPasswordController extends AbstractHtmlController
{
    /**
     * @var Factory
     */
    protected $view;

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

    /**
     * @param Request $request
     * @return \Illuminate\Contracts\View\View
     * @throws InvalidConfirmationTokenException
     */
    public function render(Request $request)
    {
        $token = array_get($request->getQueryParams(), 'token');

        $token = PasswordToken::findOrFail($token);

        if ($token->created_at < new DateTime('-1 day')) {
            throw new InvalidConfirmationTokenException;
        }

        return $this->view->make('flarum::reset')
            ->with('passwordToken', $token->id)
            ->with('csrfToken', $request->getAttribute('session')->get('csrf_token'));
    }
}

<?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\Forum\Controller;

use DateTime;
use Flarum\Core\Exception\InvalidConfirmationTokenException;
use Flarum\Core\PasswordToken;
use Flarum\Http\Controller\AbstractHtmlController;
use Illuminate\Contracts\View\Factory;
use Psr\Http\Message\ServerRequestInterface as Request;
use Symfony\Component\Translation\TranslatorInterface;

class ResetPasswordController extends AbstractHtmlController
{
    /**
     * @var Factory
     */
    protected $view;

    /**
     * @var TranslatorInterface
     */
    protected $translator;

    /**
     * @param Factory $view
     */
    public function __construct(Factory $view, TranslatorInterface $translator)
    {
        $this->view = $view;
        $this->translator = $translator;
    }

    /**
     * @param Request $request
     * @return \Illuminate\Contracts\View\View
     * @throws InvalidConfirmationTokenException
     */
    public function render(Request $request)
    {
        $token = array_get($request->getQueryParams(), 'token');

        $token = PasswordToken::findOrFail($token);

        if ($token->created_at < new DateTime('-1 day')) {
            throw new InvalidConfirmationTokenException;
        }

        return $this->view->make('flarum::reset')
            ->with('translator', $this->translator)
            ->with('passwordToken', $token->id)
            ->with('csrfToken', $request->getAttribute('session')->get('csrf_token'));
    }
}

Fix crash on reset password page

Fix crash on reset password page


<?php
	//Main controller class of the admin panel: all controllers of the admin panel should inherit from it
	abstract class Controller_admin_main extends Controller_main
	{
		public function __init()
		{
			parent::__init();
			if(!$this->_current_member->load('user_group')->equals(Model_UsersGroups::getById(Model_UsersGroups::ADMINS_ID)))
			{
				$this->response->error(Library_i18n::get('admin.forbidden_access'), 403);
				return;
			}
		}
	}

<?php
	//Main controller class of the admin panel: all controllers of the admin panel should inherit from it
	abstract class Controller_admin_main extends Controller_main
	{
		public function __init()
		{
			parent::__init();
			if(!$this->_current_member->can_access_admin_panel)
			{
				$this->response->error(Library_i18n::get('admin.forbidden_access'), 403);
				return;
			}
		}
	}

Use of the permission instead of group's ID


<?php

namespace Phunkie\Functions\applicative;

use Phunkie\Cats\Applicative;
use Phunkie\Cats\Apply;
use function Phunkie\Functions\currying\applyPartially;
use Phunkie\Types\Kind;

/**
 * F<A -> B> -> F<A> -> F<B>
 */
const ap = "\\Phunkie\\Functions\\applicative\\ap";
function ap(Kind $f)
{
    return applyPartially([$f],func_get_args(),function(Applicative $applicative) use ($f) {
        return $applicative->apply($f);
    });
}

const pure = "\\Phunkie\\Functions\\applicative\\pure";
function pure($context)
{
    return applyPartially([$context],func_get_args(),function($a) use ($context) {
        if ($fa = $context($a) instanceof Applicative) {
            return $fa;
        }
        throw new \Error("$context is not an applicative context");
    });
}

const map2 = "\\Phunkie\\Functions\\applicative\\map2";
function map2(callable $f)
{
    return applyPartially([$f],func_get_args(), function(Apply $fa) use ($f) {
        return function(Apply $fb) use ($fa, $f) {
            return $fa->map2($fb, $f);
        };
    });
}

<?php

namespace Phunkie\Functions\applicative;

use Phunkie\Cats\Applicative;
use Phunkie\Cats\Apply;
use function Phunkie\Functions\currying\applyPartially;
use Phunkie\Types\Kind;

/**
 * F<A -> B> -> F<A> -> F<B>
 */
const ap = "\\Phunkie\\Functions\\applicative\\ap";
function ap(Kind $f)
{
    return applyPartially([$f],func_get_args(),function(Applicative $applicative) use ($f) {
        return $applicative->apply($f);
    });
}

const pure = "\\Phunkie\\Functions\\applicative\\pure";
function pure($context)
{
    return applyPartially([$context],func_get_args(),function($a) use ($context) {
        if (($fa = $context($a)) instanceof Applicative) {
            return $fa;
        }
        throw new \Error("$context is not an applicative context");
    });
}

const map2 = "\\Phunkie\\Functions\\applicative\\map2";
function map2(callable $f)
{
    return applyPartially([$f],func_get_args(), function(Apply $fa) use ($f) {
        return function(Apply $fb) use ($fa, $f) {
            return $fa->map2($fb, $f);
        };
    });
}

Fix bug in 'pure' due to operator precedence


<?php

namespace Brick\App\View\Helper;

use Brick\Di\Injector;
use Brick\App\View\View;

/**
 * This view helper allows to render a View from within another View (referred to as a partial view).
 * The rendering of the partial view is done wia a ViewRenderer, which allows to inject dependencies into it.
 */
trait PartialViewHelper
{
    /**
     * @var \Brick\Di\Injector|null
     */
    private $injector;

    /**
     * @Brick\Di\Annotation\Inject
     *
     * @param \Brick\Di\Injector $injector
     *
     * @return void
     */
    final public function setInjector(Injector $injector)
    {
        $this->injector = $injector;
    }

    /**
     * Renders a partial View.
     *
     * @param \Brick\App\View\View $view The View object to render.
     *
     * @return string The rendered View.
     */
    final public function partial(View $view)
    {
        if ($this->injector) {
            $this->injector->inject($view);
        }

        return $view->render();
    }
}

<?php

namespace Brick\App\View\Helper;

use Brick\Di\Injector;
use Brick\App\View\View;

/**
 * This view helper allows to render a View from within another View (referred to as a partial view).
 */
trait PartialViewHelper
{
    /**
     * @var \Brick\Di\Injector|null
     */
    private $injector;

    /**
     * @Brick\Di\Annotation\Inject
     *
     * @param \Brick\Di\Injector $injector
     *
     * @return void
     */
    final public function setInjector(Injector $injector)
    {
        $this->injector = $injector;
    }

    /**
     * Renders a partial View.
     *
     * @param \Brick\App\View\View $view The View object to render.
     *
     * @return string The rendered View.
     */
    final public function partial(View $view)
    {
        if ($this->injector) {
            $this->injector->inject($view);
        }

        return $view->render();
    }
}

Remove old, now irrelevant comment

Remove old, now irrelevant comment


<?php

/**
 * This file is covered by the AGPLv3 license, which can be found at the LICENSE file in the root of this project.
 * @copyright 2017 subtitulamos.tv
 */

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

use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;

// Load env variables from file
if (getenv('ENVIRONMENT') !== 'production') {
    $dotenv = new Dotenv\Dotenv(__DIR__.'/..');
    $dotenv->load();
}

define('DEBUG', getenv('DEBUG') == 'true');

// Initialize Doctrine's ORM stuff
$config = Setup::createAnnotationMetadataConfiguration([__DIR__."/entities"], DEBUG, null, null, false);
$conn = [
    'driver' => 'pdo_mysql',
    'dbname' => getenv('DATABASE_NAME'),
    'user' => getenv('DATABASE_USER'),
    'password' => getenv('DATABASE_PASSWORD'),
    'host' => getenv('DATABASE_HOST')
];

// $entityManager is a global isntance and is used as such
$entityManager = EntityManager::create($conn, $config);
$entityManager->getConfiguration()->addEntityNamespace('App', '\App\Entities');

<?php

/**
 * This file is covered by the AGPLv3 license, which can be found at the LICENSE file in the root of this project.
 * @copyright 2017 subtitulamos.tv
 */

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

use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;

// Load env variables from file
if (getenv('ENVIRONMENT') !== 'production') {
    $dotenv = new Dotenv\Dotenv(__DIR__.'/..');
    $dotenv->load();
}

define('DEBUG', getenv('DEBUG') == 'true');

// Initialize Doctrine's ORM stuff
$config = Setup::createAnnotationMetadataConfiguration([__DIR__."/Entities"], DEBUG, null, null, false);
$conn = [
    'driver' => 'pdo_mysql',
    'dbname' => getenv('DATABASE_NAME'),
    'user' => getenv('DATABASE_USER'),
    'password' => getenv('DATABASE_PASSWORD'),
    'host' => getenv('DATABASE_HOST')
];

// $entityManager is a global isntance and is used as such
$entityManager = EntityManager::create($conn, $config);
$entityManager->getConfiguration()->addEntityNamespace('App', '\App\Entities');

Correct Entities folder case on doctrine config


<?php
/**
 * Part of the Joomla Framework Authentication Package
 *
 * @copyright  Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 */

namespace Joomla\Authentication\Exception;

/**
 * Exception class defining an unsupported password handler
 *
 * @since  2.0.0-beta
 */
class UnsupportedPasswordHandlerException extends \LogicException
{
}

<?php
/**
 * Part of the Joomla Framework Authentication Package
 *
 * @copyright  Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 */

namespace Joomla\Authentication\Exception;

/**
 * Exception class defining an unsupported password handler
 *
 * @since  2.0.0
 */
class UnsupportedPasswordHandlerException extends \LogicException
{
}

Change since version to not include beta identifier


Remove superfluous item from pattern array

The string "\r\n" within the search array is superfluous because it is already covered by the single "\r" and "\n".


<?php
namespace ThinkSayDo\EnvTenant\Events;

class TenantNotResolvedException extends \Exception
{

}

<?php
namespace ThinkSayDo\EnvTenant\Events;

class TenantNotResolvedException extends \Exception
{
    public function getTenant()
    {
        return $this->getMessage();
    }
}

Add getTenant method to Exception.

Add getTenant method to Exception.


<?php

/*
 * Bear CMS addon for Bear Framework
 * https://bearcms.com/
 * Copyright (c) 2016 Amplilabs Ltd.
 * Free to use under the MIT license.
 */

/**
 * @runTestsInSeparateProcesses
 */
class DefaultThemeTest extends BearFrameworkAddonTestCase
{

    /**
     *
     */
    public function testBlogPostsElement()
    {
        $app = $this->getApp();
        $context = $app->getContext(\BearFramework\Addons::get('bearcms/bearframework-addon')['dir'] . '/index.php');
        $result = $app->components->process('<component src="file:' . $context->dir . '/themes/default1/components/template.php" />');
        //echo $result;exit;
        //$this->assertTrue($settings['title'] === '');
    }

}

<?php

/*
 * Bear CMS addon for Bear Framework
 * https://bearcms.com/
 * Copyright (c) 2016 Amplilabs Ltd.
 * Free to use under the MIT license.
 */

/**
 * @runTestsInSeparateProcesses
 */
class DefaultThemeTest extends BearFrameworkAddonTestCase
{

    /**
     *
     */
    public function testBlogPostsElement()
    {
        $app = $this->getApp();
        $context = $app->getContext(\BearFramework\Addons::get('bearcms/bearframework-addon')['dir'] . '/index.php');
        $result = $app->components->process('<component src="file:' . $context->dir . '/themes/default1/components/defaultTemplate.php" />');
        //echo $result;exit;
        //$this->assertTrue($settings['title'] === '');
    }

}

Fix in the unit tests.

Fix in the unit tests.


<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Capsule\Manager as Capsule;

class Munkiinfo extends Migration
{
    public function up()
    {
        $capsule = new Capsule();
        $capsule::schema()->create('munkiinfo', function (Blueprint $table) {
            $table->increments('id');

            $table->string('serial_number')->nullable();
            $table->string('munkiinfo_key')->nullable();
            $table->string('munkiinfo_value')->nullable();

            $table->index('serial_number');

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

    public function down()
    {
        $capsule = new Capsule();
        $capsule::schema()->dropIfExists('munkiinfo');
    }
}

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Capsule\Manager as Capsule;

class Munkiinfo extends Migration
{
    public function up()
    {
        $capsule = new Capsule();
        $capsule::schema()->create('munkiinfo', function (Blueprint $table) {
            $table->increments('id');

            $table->string('serial_number');
            $table->string('munkiinfo_key');
            $table->string('munkiinfo_value');

            $table->index('serial_number');
            $table->index('munkiinfo_key');
            $table->index('munkiinfo_value');
        });
    }

    public function down()
    {
        $capsule = new Capsule();
        $capsule::schema()->dropIfExists('munkiinfo');
    }
}

Add indexes to munkiinfo migration

Add indexes to munkiinfo migration


<?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\Api\Middleware;

use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Zend\Stratigility\MiddlewareInterface;

class ReadJsonParameters implements MiddlewareInterface
{
    /**
     * {@inheritdoc}
     */
    public function __invoke(Request $request, Response $response, callable $out = null)
    {
        if (str_contains($request->getHeaderLine('content-type'), 'json')) {
            $input = json_decode($request->getBody(), true);

            foreach ($input as $name => $value) {
                $request = $request->withAttribute($name, $value);
            }
        }

        return $out ? $out($request, $response) : $response;
    }
}

<?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\Api\Middleware;

use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Zend\Stratigility\MiddlewareInterface;

class ReadJsonParameters implements MiddlewareInterface
{
    /**
     * {@inheritdoc}
     */
    public function __invoke(Request $request, Response $response, callable $out = null)
    {
        if (str_contains($request->getHeaderLine('content-type'), 'json')) {
            $input = json_decode($request->getBody(), true);

            if (! is_array($input)) {
                $input = [];
            }

            foreach ($input as $name => $value) {
                $request = $request->withAttribute($name, $value);
            }
        }

        return $out ? $out($request, $response) : $response;
    }
}

Make sure JSON request bodies are parsed as array.

Refs #533.


<?php

namespace SedpMis\BaseReport\GridQuery;

class ColumnedReportGridQuery extends BaseReportGridQuery
{
    protected $columns = [];

    public function __construct($query, array $columns, $modelGridQueries)
    {
        $this->query            = $query;
        $this->columns          = $columns;
        $this->modelGridQueries = $modelGridQueries;
    }

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

<?php

namespace SedpMis\BaseReport\GridQuery;

class ColumnedReportGridQuery extends BaseReportGridQuery implements ReportGridQueryInterface
{
    protected $columns = [];

    protected $gridQuery;

    public function __construct($gridQuery, array $columns, $modelGridQueries)
    {
        $this->gridQuery        = $gridQuery;
        $this->query            = $gridQuery->query();
        $this->columns          = $columns;
        $this->modelGridQueries = $modelGridQueries;
    }

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

    public function dateReferenceColumn()
    {
        return $this->gridQuery->dateReferenceColumn();
    }
}

Add gridQuery property. Implements ReportGridQueryInterface. Add dateReferenceColumn method.


<?php

/*
 * This file is part of Starbs Yeh.
 *
 * (c) Graham Campbell <graham@mineuk.com>
 * (c) Chip Wolf <hello@chipwolf.uk>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Starbs\Yeh\Http\Controllers;

use Starbs\Http\Controllers\AbstractController;

class UploadController extends AbstractController
{
    /**
     * Do some clever things, then return a response.
     *
     * @return \Symfony\Component\HttpFoundation\Response
     */
    protected function fire()
    {
        $image = $this->file('image');

        if (!$image) {
            return $this->error(['message'  => 'No image provided'], 400);
        }

        if (!$image->isValid()) {
            return $this->error(['message'  => 'The image was corrupt'], 400);
        }

        if (strtolower(substr($image->getMimeType(), 0, 5)) !== 'image') {
            return $this->error(['message'  => 'Only images are allowed'], 415);
        }

        $url = $this->container->get('factory')->save($image);

        if ($this->input('sharex')) {
            return $this->raw($url, 'text/plain');
        }

        return $this->success(['message'  => 'Image uploaded successfully', 'url' => $url]);
    }
}

<?php

/*
 * This file is part of Starbs Yeh.
 *
 * (c) Graham Campbell <graham@mineuk.com>
 * (c) Chip Wolf <hello@chipwolf.uk>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Starbs\Yeh\Http\Controllers;

use Starbs\Http\Controllers\AbstractController;

class UploadController extends AbstractController
{
    /**
     * Do some clever things, then return a response.
     *
     * @return \Symfony\Component\HttpFoundation\Response
     */
    protected function fire()
    {
        $image = $this->file('image');

        if (!$image) {
            return $this->error(['message'  => 'No media provided'], 400);
        }

        if (!$image->isValid()) {
            return $this->error(['message'  => 'The media was corrupt'], 400);
        }

        $type = strtolower(substr($image->getMimeType(), 0, 5));

        if (!in_array($type, ['audio', 'image', 'video'])) {
            return $this->error(['message'  => 'Only media uploads are allowed'], 415);
        }

        $url = $this->container->get('factory')->save($image);

        if ($this->input('sharex')) {
            return $this->raw($url, 'text/plain');
        }

        return $this->success(['message'  => 'Image uploaded successfully', 'url' => $url]);
    }
}

Allow audio and video as well as images

Allow audio and video as well as images


Add remove button in template for pivot fields


<?php
namespace PharIo\Phive;

class CurlConfigBuilder {

    /**
     * @var Environment
     */
    private $environment;

    /**
     * @var PhiveVersion
     */
    private $phiveVersion;

    /**
     * @param Environment $environment
     * @param PhiveVersion $phiveVersion
     */
    public function __construct(Environment $environment, PhiveVersion $phiveVersion) {
        $this->environment = $environment;
        $this->phiveVersion = $phiveVersion;
    }

    public function build() {
        $curlConfig = new CurlConfig(
            sprintf('Phive %s on %s',
                $this->phiveVersion->getVersion(),
                $this->environment->getRuntimeString()
            )
        );
        $curlConfig->addLocalSslCertificate(
            new LocalSslCertificate(
                'hkps.pool.sks-keyservers.net',
                __DIR__ . '/../../../conf/ssl/ca_certs/sks-keyservers.netCA.pem'
            )
        );
        if ($this->environment->hasProxy()) {
            $curlConfig->setProxy($this->environment->getProxy());
        }
        if ($this->environment->hasGitHubAuthToken()) {
            $curlConfig->addAuthenticationToken(
                'github.com',
                $this->environment->getGitHubAuthToken()
            );
        }

        return $curlConfig;
    }

}

<?php
namespace PharIo\Phive;

class CurlConfigBuilder {

    /**
     * @var Environment
     */
    private $environment;

    /**
     * @var PhiveVersion
     */
    private $phiveVersion;

    /**
     * @param Environment $environment
     * @param PhiveVersion $phiveVersion
     */
    public function __construct(Environment $environment, PhiveVersion $phiveVersion) {
        $this->environment = $environment;
        $this->phiveVersion = $phiveVersion;
    }

    public function build() {
        $curlConfig = new CurlConfig(
            sprintf('Phive %s on %s',
                $this->phiveVersion->getVersion(),
                $this->environment->getRuntimeString()
            )
        );
        $curlConfig->addLocalSslCertificate(
            new LocalSslCertificate(
                'hkps.pool.sks-keyservers.net',
                __DIR__ . '/../../../conf/ssl/ca_certs/sks-keyservers.netCA.pem'
            )
        );
        if ($this->environment->hasProxy()) {
            $curlConfig->setProxy($this->environment->getProxy());
        }
        if ($this->environment->hasGitHubAuthToken()) {
            $curlConfig->addAuthenticationToken(
                'api.github.com',
                $this->environment->getGitHubAuthToken()
            );
        }

        return $curlConfig;
    }

}

Use github auth token for api.github.com


<?php

return [
    'pdf' => [
        'phantom' => [
            'debug' => false,
            'ignore-ssl-errors' => true,
            'load-images' => true,
            'ssl-protocol' => 'any'
        ],

        'page' => [
            'margin' => '{top: "20px", right: "20px", bottom: "20px", left: "20px"}',

            //Options = ['landscape', 'portrait']
            'orientation' => 'portrait',

            //Options = ['A4', 'A3', 'Letter']
            'format' => 'A4'
        ],

        'footer' => [
            'height' => '25px',
        ],

        'header' => [
            'height' => '45px',
        ]
    ],
    'html' => [
    ]
];

<?php

return [
    'pdf' => [
        'phantom' => [
            'debug' => false,
            'ignore-ssl-errors' => true,
            'load-images' => true,
            'ssl-protocol' => 'any'
        ],

        // 72 dpi (web) 595 X 842 pixels
        // 300 dpi (print) = 2480 X 3508 pixels
        // 600 dpi (print) = 4960 X 7016 pixels
        'viewport' => [
            'larger' => '3508',
            'smaller' => '2480'
        ],

        'page' => [
            'margin' => '{top: "20px", right: "20px", bottom: "20px", left: "20px"}',

            //Options = ['landscape', 'portrait']
            'orientation' => 'portrait',

            //Options = ['A4', 'A3', 'Letter']
            'format' => 'A4'
        ],

        'footer' => [
            'height' => '25px',
        ],

        'header' => [
            'height' => '45px',
        ]
    ],
    'image' => [
        'phantom' => [
            'debug' => false,
            'ignore-ssl-errors' => true,
            'load-images' => true,
            'ssl-protocol' => 'any'
        ],

        // 72 dpi (web) 595 X 842 pixels
        // 300 dpi (print) = 2480 X 3508 pixels
        // 600 dpi (print) = 4960 X 7016 pixels
        'viewport' => [
            'larger' => '842',
            'smaller' => '595'
        ],

        'page' => [
            'margin' => '{top: "20px", right: "20px", bottom: "20px", left: "20px"}',

            //Options = ['landscape', 'portrait']
            'orientation' => 'portrait',

            //Options = ['BMP', 'JPG', 'JPEG', 'PNG']
            'format' => 'JPG'
        ],

        'footer' => [
            'height' => '25px',
        ],

        'header' => [
            'height' => '45px',
        ]
    ],
    'html' => [
    ]
];

Add new params for image exporter

Add new params for image exporter


$taxonomy_slug = 'news-type';
$term_slug = \Taco\Term\Factory::create(get_queried_object())->get('slug');

$current_page = (get_query_var('paged')) ?: 1;
$per_page = get_option('posts_per_page');
$per_page = NewsPost::getPostsPerPage();

$news_posts_of_this_type = NewsPost::getByTerm(
  $taxonomy_slug,
  $term_slug,
  'slug',
  array(
    'orderby' => 'date',
    'order' => 'DESC',
    'posts_per_page' => $per_page,
    'offset' => ($current_page - 1) * $per_page
  )
);

$total_posts = NewsPost::getCountByTerm(
  $taxonomy_slug,
  $term_slug,
  'slug'
);
echo Util::getPagination($current_page, $total_posts, array(
  'per_page' => $per_page,
  'link_prefix' => '/news/'.$term_slug,
));

$term = \Taco\Term\Factory::create(get_queried_object());

$current_page = (get_query_var('paged')) ?: 1;
$per_page = get_option('posts_per_page');
// Or: $per_page = NewsPost::getPostsPerPage();

$term_posts = NewsPost::getByTerm(
  $term->taxonomy,
  $term->slug,
  'slug',
  array(
    'orderby' => 'date',
    'order' => 'DESC',
    'posts_per_page' => $per_page,
    'offset' => ($current_page - 1) * $per_page
  )
);

$total_posts = NewsPost::getCountByTerm(
  $term->taxonomy,
  $term->slug,
  'slug'
);
echo Util::getPagination($current_page, $total_posts, array(
  'per_page' => $per_page,
  'link_prefix' => '/news/'.$term->slug,
));

Make taxonomy template pagination more modular


<?php

namespace Halfpastfour\PHPChartJS\Renderer;

/**
 * Class Json
 *
 * @package Halfpastfour\PHPChartJS\Renderer
 */
class Json extends Renderer
{
    /**
     * Render the necessary JSON for the chart to function in the frontend.
     *
     * @param int|null $flags
     *
     * @return string
     * @throws \ReflectionException
     */
    public function render($flags = JSON_PRETTY_PRINT)
    {
        $config = [
            'type' => constant(get_class($this->chart) . "::TYPE"),
            'data' => [],
        ];

        $labels = $this->chart->labels()->getArrayCopy();
        if ($labels) {
            $config['data']['labels'] = $labels;
        }

        $dataSets = $this->chart->dataSets()->getArrayCopy();
        if ($dataSets) {
            $config['data']['datasets'] = $dataSets;
        }

        $options = $this->chart->options()->getArrayCopy();
        if ($options) {
            $config['options'] = $options;
        }

        return json_encode($config, $flags);
    }
}

<?php

namespace Halfpastfour\PHPChartJS\Renderer;

/**
 * Class Json
 *
 * @package Halfpastfour\PHPChartJS\Renderer
 */
class Json extends Renderer
{
    /**
     * Render the necessary JSON for the chart to function in the frontend.
     *
     * @param int|null $flags
     *
     * @return string
     */
    public function render($flags = JSON_PRETTY_PRINT)
    {
        $config = [
            'type' => constant(get_class($this->chart) . "::TYPE"),
            'data' => [],
        ];

        $labels = $this->chart->labels()->getArrayCopy();
        if ($labels) {
            $config['data']['labels'] = $labels;
        }

        $dataSets = $this->chart->dataSets()->getArrayCopy();
        if ($dataSets) {
            $config['data']['datasets'] = $dataSets;
        }

        $options = $this->chart->options()->getArrayCopy();
        if (! empty($options)) {
            $config['options'] = $options;
        }

        return json_encode($config, $flags);
    }
}

Improve non-empty check on array.

Improve non-empty check on array.


<?php
/**
 * @author @fabfuel <fabian@fabfuel.de>
 * @created 14.11.14, 06:57
 */
namespace Fabfuel\Prophiler\Adapter;

use Mongo\Profiler\ProfilerInterface;

abstract class AdapterAbstract
{
    /**
     * @var ProfilerInterface
     */
    protected $profiler;

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

    /**
     * @return ProfilerInterface
     */
    public function getProfiler()
    {
        return $this->profiler;
    }

    /**
     * @param ProfilerInterface $profiler
     */
    public function setProfiler(ProfilerInterface $profiler)
    {
        $this->profiler = $profiler;
    }
}

<?php
/**
 * @author @fabfuel <fabian@fabfuel.de>
 * @created 14.11.14, 06:57
 */
namespace Fabfuel\Prophiler\Adapter;

use Fabfuel\Prophiler\ProfilerInterface;

abstract class AdapterAbstract
{
    /**
     * @var ProfilerInterface
     */
    protected $profiler;

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

    /**
     * @return ProfilerInterface
     */
    public function getProfiler()
    {
        return $this->profiler;
    }

    /**
     * @param ProfilerInterface $profiler
     */
    public function setProfiler(ProfilerInterface $profiler)
    {
        $this->profiler = $profiler;
    }
}

Fix namespace in import of ProfilerInterface


<?php

namespace BetterReflectionTest\ClassWithInterfaces {
    use BetterReflectionTest\ClassWithInterfacesOther\B as ImportedB;
    use BetterReflectionTest\ClassWithInterfacesOther;

    interface A {}
    interface B {}

    class ExampleClass implements A, ImportedB, C, ClassWithInterfacesOther\D, \E
    {
    }

    interface C {}

    class SubExampleClass extends ExampleClass {}
}

namespace BetterReflectionTest\ClassWithInterfacesOther {
    interface B
    {
    }

    interface D
    {
    }
}

namespace {
    interface E
    {
    }
}

<?php

namespace BetterReflectionTest\ClassWithInterfaces {
    use BetterReflectionTest\ClassWithInterfacesOther\B as ImportedB;
    use BetterReflectionTest\ClassWithInterfacesOther;

    interface A {}
    interface B {}

    class ExampleClass implements A, ImportedB, C, ClassWithInterfacesOther\D, \E
    {
    }

    interface C {}

    class SubExampleClass extends ExampleClass {}
    class SubSubExampleClass extends SubExampleClass implements ImportedB, B {}
}

namespace BetterReflectionTest\ClassWithInterfacesOther {
    interface B
    {
    }

    interface D
    {
    }
}

namespace {
    interface E
    {
    }
}

Test asset: interfaces implemented in third level class inheritance child


<?php
/**
 * @author         Pierre-Henry Soria <hello@ph7cms.com>
 * @copyright      (c) 2016, Pierre-Henry Soria. All Rights Reserved.
 * @license        GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
 * @package        PH7 / App / System / Module / User Dashboard / Controller
 */
namespace PH7;

class MainController extends Controller
{
    public function index()
    {
        $this->view->page_title = $this->view->h1_title = t('Your User Area');
        $this->design->addCss(PH7_LAYOUT . PH7_SYS . PH7_MOD . $this->registry->module . PH7_SH . PH7_TPL .
            PH7_TPL_MOD_NAME . PH7_SH . PH7_CSS, 'style.css');
        $this->design->addJs(PH7_STATIC . PH7_JS, 'Wall.js');

        $this->view->username = $this->session->get('member_username');
        $this->view->first_name = $this->session->get('member_first_name');
        $this->view->sex = $this->session->get('member_sex');
        $this->view->avatarDesign = new AvatarDesignCore; // Avatar Design Class

        $this->output();
    }
}

<?php
/**
 * @author         Pierre-Henry Soria <hello@ph7cms.com>
 * @copyright      (c) 2016, Pierre-Henry Soria. All Rights Reserved.
 * @license        GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
 * @package        PH7 / App / System / Module / User Dashboard / Controller
 */
namespace PH7;

class MainController extends Controller
{
    public function index()
    {
        $this->view->page_title = $this->view->h1_title = t('My Dashboard');
        $this->design->addCss(PH7_LAYOUT . PH7_SYS . PH7_MOD . $this->registry->module . PH7_SH . PH7_TPL .
            PH7_TPL_MOD_NAME . PH7_SH . PH7_CSS, 'style.css');
        $this->design->addCss(PH7_STATIC . PH7_CSS . PH7_JS . 'jquery/slick/', 'slick.css,slick-theme.css');
        $this->design->addJs(PH7_STATIC . PH7_JS, 'Wall.js,jquery/slick.js');

        $this->view->username = $this->session->get('member_username');
        $this->view->first_name = $this->session->get('member_first_name');
        $this->view->sex = $this->session->get('member_sex');
        $this->view->avatarDesign = new AvatarDesignCore; // For the avatar lightBox
        $this->view->userDesignModel = new UserDesignCoreModel; // For the profilesBlock

        $this->output();
    }
}

Add Avatar & UserModel classes to the view


<?php

use Symfony\Component\HttpFoundation\Request;

// If you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
//umask(0000);

// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
    || !in_array(@$_SERVER['REMOTE_ADDR'], array(
        '127.0.0.1',
        '::1',
    ))
) {
    header('HTTP/1.0 403 Forbidden');
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}

$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
require_once __DIR__.'/../app/AppKernel.php';

$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

<?php

use Symfony\Component\HttpFoundation\Request;

// If you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
//umask(0000);

// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
  || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
  || !in_array(@$_SERVER['REMOTE_ADDR'], array(
    '127.0.0.1',
    '::1',
    '83.156.34.69', // RW dev server
    '51.255.174.234', // MC dev server
  ))
) {
  header('HTTP/1.0 403 Forbidden');
  exit('You are not allowed to access this file. Check ' . basename(__FILE__) . ' for more information.');
}

$loader = require_once __DIR__ . '/../app/bootstrap.php.cache';
require_once __DIR__ . '/../app/AppKernel.php';

$kernel = new AppKernel('dev', TRUE);
$kernel->loadClassCache();
$request  = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

Add IP access for custom dev envs.

Add IP access for custom dev envs.


<?php
/*
 * Bear CMS addon for Bear Framework
 * https://bearcms.com/
 * Copyright (c) 2016 Amplilabs Ltd.
 * Free to use under the MIT license.
 */

$onClick = 'none';
if ($component->onClick === 'fullscreen') {
    $onClick = 'fullscreen';
} elseif ($component->onClick === 'openUrl') {
    $onClick = 'url';
}
$onClickAttribute = ' onClick="' . $onClick . '"';

$class = (string) $component->class;
$classAttribute = isset($class{0}) ? ' class="' . htmlentities($class) . '"' : '';

$filename = $app->bearCMS->data->getRealFilename($component->filename);
$content = '
';
if (isset($filename{0})) {
    $content .= '<component src="image-gallery" columnsCount="1"' . $onClickAttribute . $classAttribute . '>';
    $content .= '<file class="bearcms-image-element-image"' . ($onClick === 'url' ? ' url="' . htmlentities($component->url) . '"' : '') . ' title="' . htmlentities($component->title) . '" filename="' . $filename . '"/>';
    $content .= '</component>';
}
$content .= '
';

$content = \BearCMS\Internal\ElementsHelper::getElementComponentContent($component, 'image', $content);
?>
    <?= $content ?>

<?php
/*
 * Bear CMS addon for Bear Framework
 * https://bearcms.com/
 * Copyright (c) 2016 Amplilabs Ltd.
 * Free to use under the MIT license.
 */

$onClick = 'none';
if ($component->onClick === 'fullscreen') {
    $onClick = 'fullscreen';
} elseif ($component->onClick === 'openUrl') {
    $onClick = 'url';
}
$onClickAttribute = ' onClick="' . $onClick . '"';

$class = (string) $component->class;
$classAttribute = isset($class{0}) ? ' class="' . htmlentities($class) . '"' : '';

$filename = (string) $component->filename;
$content = '
';
if (isset($filename{0})) {
    $filename = $app->bearCMS->data->getRealFilename($filename);
    $content .= '<component src="image-gallery" columnsCount="1"' . $onClickAttribute . $classAttribute . '>';
    $content .= '<file class="bearcms-image-element-image"' . ($onClick === 'url' ? ' url="' . htmlentities($component->url) . '"' : '') . ' title="' . htmlentities($component->title) . '" filename="' . $filename . '"/>';
    $content .= '</component>';
}
$content .= '
';

$content = \BearCMS\Internal\ElementsHelper::getElementComponentContent($component, 'image', $content);
?>
    <?= $content ?>

Fix in expected attribute value.

Fix in expected attribute value.


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

namespace Darvin\Utils\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Blank;

/**
 * Anti-spam form type
 */
class AntiSpamType extends AbstractType
{
    const ANTI_SPAM_TYPE_CLASS = __CLASS__;

    /**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'label'       => false,
            'attr'        => array(
                'class' => 'title_field',
            ),
            'constraints' => new Blank(),
            'mapped'      => false,
            'required'    => false,
        ));
    }

    /**
     * {@inheritdoc}
     */
    public function getParent()
    {
        return 'text';
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return 'darvin_utils_anti_spam';
    }
}

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

namespace Darvin\Utils\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Blank;

/**
 * Anti-spam form type
 */
class AntiSpamType extends AbstractType
{
    const ANTI_SPAM_TYPE_CLASS = __CLASS__;

    /**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'label'       => false,
            'attr'        => array(
                'class' => 'title_field',
            ),
            'constraints' => new Blank(),
            'mapped'      => false,
            'required'    => false,
        ));
    }

    /**
     * {@inheritdoc}
     */
    public function getParent()
    {
        return 'text';
    }

    /**
     * {@inheritdoc}
     */
    public function getBlockPrefix()
    {
        return 'darvin_utils_anti_spam';
    }
}

Replace method getName() in form types with "getBlockPrefix()".


<?php

namespace App\Http\Controllers\Mship;

use Auth;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Session;
use Redirect;

class Notification extends \App\Http\Controllers\BaseController
{
    protected $redirectTo = 'mship/notification/list';

    public function postAcknowledge($notification)
    {
        $this->account->readNotifications()->syncWithoutDetaching([$notification]);

        // If this is an interrupt AND we're got no more important notifications, then let's go back!
        if (Session::has('force_notification_read_return_url')) {
            if (!Auth::user()->has_unread_important_notifications and !Auth::user()->get_unread_must_read_notifications) {
                return Redirect::to(Session::pull('force_notification_read_return_url'));
            }
        }

        return redirect($this->redirectPath());
    }

    public function getList()
    {
        // Get all unread notifications.
        $unreadNotifications = $this->account->unreadNotifications;
        $readNotifications = $this->account->readNotifications;

        return $this->viewMake('mship.notification.list')
                    ->with('unreadNotifications', $unreadNotifications)
                    ->with('readNotifications', $readNotifications)
                    ->with('allowedToLeave', (!Session::has('force_notification_read_return_url') or (!Auth::user()->has_unread_important_notifications and !Auth::user()->get_unread_must_read_notifications)));
    }
}

<?php

namespace App\Http\Controllers\Mship;

use Auth;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Session;
use Redirect;

class Notification extends \App\Http\Controllers\BaseController
{
    protected $redirectTo = 'mship/notification/list';

    public function postAcknowledge($notification)
    {
        $this->account->readNotifications()->syncWithoutDetaching([$notification->id]);

        // If this is an interrupt AND we're got no more important notifications, then let's go back!
        if (Session::has('force_notification_read_return_url')) {
            if (!Auth::user()->has_unread_important_notifications and !Auth::user()->get_unread_must_read_notifications) {
                return Redirect::to(Session::pull('force_notification_read_return_url'));
            }
        }

        return redirect($this->redirectPath());
    }

    public function getList()
    {
        // Get all unread notifications.
        $unreadNotifications = $this->account->unreadNotifications;
        $readNotifications = $this->account->readNotifications;

        return $this->viewMake('mship.notification.list')
                    ->with('unreadNotifications', $unreadNotifications)
                    ->with('readNotifications', $readNotifications)
                    ->with('allowedToLeave', (!Session::has('force_notification_read_return_url') or (!Auth::user()->has_unread_important_notifications and !Auth::user()->get_unread_must_read_notifications)));
    }
}

Use notification ID in syncWithoutDetaching


<?php

namespace ajax\listing;

use \PDO as PDO;

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

    /**
     * @param $querydata[ids] array of organism ids
     * @returns array of organisms
     */
    public function execute($querydata) {
        global $db;

        $organism_ids = $querydata['ids'];

        $place_holders = implode(',', array_fill(0, count($organism_ids), '?'));

        $query_get_organisms = <<<EOF
SELECT *
    FROM organism
    WHERE organism_id IN ($place_holders)
EOF;

        $stm_get_organisms = $db->prepare($query_get_organisms);

        $data = array();

        $stm_get_organisms->execute($organism_ids);

        while ($row = $stm_get_organisms->fetch(PDO::FETCH_ASSOC)) {
            $data[] = $row;
        }

        return $data;
    }

}

?>

<?php

namespace ajax\listing;

use \PDO as PDO;

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

    /**
     * @param $querydata[ids] array of organism ids
     * @returns array of organisms
     */
    public function execute($querydata) {
        global $db;

        $organism_ids = $querydata['ids'];

        $place_holders = implode(',', array_fill(0, count($organism_ids), '?'));

        $query_get_organisms = <<<EOF
SELECT *
    FROM organism
    WHERE organism_id IN ($place_holders)
EOF;

        $stm_get_organisms = $db->prepare($query_get_organisms);

        $data = array();

        $stm_get_organisms->execute($organism_ids);

        while ($row = $stm_get_organisms->fetch(PDO::FETCH_ASSOC)) {
            $data[] = $row;
        }

        return $data;
    }

    public function getAllOrganisms(){
        global $db;

        $query = "SELECT * FROM organism";
        $stm_get_organisms = $db->prepare($query);
        $stm_get_organisms->execute();
        $stm_get_organisms->setFetchMode(\PDO::FETCH_OBJ);

        $result = array();
        while ($row = $stm_get_organisms->fetch()) {
            $result[] = $this->abbreviation;
        }
        return $result;
    }

}

?>

Add function for getting all organisms

Add function for getting all organisms


<?php

/**
 * This class has been auto-generated by the Doctrine ORM Framework
 */
class TagGroups extends BaseTagGroups
{
  private static $groups =  array(
      'administrative area' => 'Administrative area',
      'topographic' => 'Topographic structure',
      'hydrographic' => 'Hydrographic',
      'orography' => 'Orography',
      'spot' => 'Spot',
      'area' => 'Area',
      'historical' => 'Historical',
      'populated' => 'Populated Places',
      'underground' => 'Underground',
      'road' => 'Road',
      'vegetation' => 'Vegetation',
      'other' => 'Other'
    );

  public static function getGroups()
  {
    try{
        $i18n_object = sfContext::getInstance()->getI18n();
    }
    catch( Exception $e )
    {
        return self::$groups;
    }
    return array_map(array($i18n_object, '__'), self::$groups);
  }

  static public function getGroup($name)
  {
    $groups = self::getGroups();
    return $groups[$name];
  }
}

<?php

/**
 * This class has been auto-generated by the Doctrine ORM Framework
 */
class TagGroups extends BaseTagGroups
{
  private static $groups =  array(
      'administrative area' => 'Administrative area',
      'topographic' => 'Topographic structure',
      'hydrographic' => 'Hydrographic',
      'orography' => 'Orography',
      'spot' => 'Spot',
      'area' => 'Area',
      'historical' => 'Historical',
      'populated' => 'Populated Places',
      'underground' => 'Underground',
      'road' => 'Road',
      'vegetation' => 'Vegetation',
      'habitat' => 'Habitat',
      'other' => 'Other'
    );

  public static function getGroups()
  {
    try{
        $i18n_object = sfContext::getInstance()->getI18n();
    }
    catch( Exception $e )
    {
        return self::$groups;
    }
    return array_map(array($i18n_object, '__'), self::$groups);
  }

  static public function getGroup($name)
  {
    $groups = self::getGroups();
    return $groups[$name];
  }
}

Add habitats category in GTU

Add habitats category in GTU


<?php declare(strict_types = 1);
/*
 * This file is part of the Bukashk0zzzTimestampTypeBundle
 *
 * (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Bukashk0zzz\TimestampTypeBundle\Form\Type;

use Bukashk0zzz\TimestampTypeBundle\Form\DataTransformer\TimestampToDateTimeTransformer;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\FormBuilderInterface;

/**
 * Class TimestampType
 */
class TimestampType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param mixed[]              $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder->addModelTransformer(new TimestampToDateTimeTransformer());
    }

    /**
     * @return mixed
     */
    public function getParent()
    {
        return IntegerType::class;
    }
}

<?php declare(strict_types = 1);
/*
 * This file is part of the Bukashk0zzzTimestampTypeBundle
 *
 * (c) Denis Golubovskiy <bukashk0zzz@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Bukashk0zzz\TimestampTypeBundle\Form\Type;

use Bukashk0zzz\TimestampTypeBundle\Form\DataTransformer\TimestampToDateTimeTransformer;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\FormBuilderInterface;

/**
 * Class TimestampType
 */
class TimestampType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param mixed[]              $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder->addModelTransformer(new TimestampToDateTimeTransformer());
    }

    /**
     * @return mixed
     */
    public function getParent()
    {
        return IntegerType::class;
    }

    /**
     * @return string
     */
    public function getBlockPrefix(): string
    {
        return 'integer';
    }
}

Fix for Nelmio API Doc

Fix for Nelmio API Doc


<?php
if(!defined('MEDIAWIKI')) die;

$dir = __DIR__;
$ext = 'HideUnwanted';

$wgExtensionCredits['skin'][] = array(
  'path'            => __FILE__,
  'name'            => $ext,
  'version'         => '0.1',
  'author'          => 'uta',
  'url'             => 'https://github.com/uta/HideUnwanted',
  'descriptionmsg'  => 'hide-unwanted-desc',
  'license-name'    => 'MIT-License',
);

$wgAutoloadClasses["${ext}Hooks"]               = "$dir/classes/${ext}Hooks.php";
$wgExtensionMessagesFiles[$ext]                 = "$dir/i18n/_backward_compatibility.php";
$wgHooks['SkinTemplateOutputPageBeforeExec'][]  = "${ext}Hooks::hide";
$wgMessagesDirs[$ext]                           = "$dir/i18n";

$wgHideUnwantedFooters                          = array();
$wgHideUnwantedHeaders                          = array();
$wgHideUnwantedTabs                             = array();

<?php
if(!defined('MEDIAWIKI')) die;

$dir = __DIR__;
$ext = 'HideUnwanted';

$wgExtensionCredits['other'][] = array(
  'path'            => __FILE__,
  'name'            => $ext,
  'version'         => '0.1',
  'author'          => 'uta',
  'url'             => 'https://github.com/uta/HideUnwanted',
  'descriptionmsg'  => 'hide-unwanted-desc',
  'license-name'    => 'MIT-License',
);

$wgAutoloadClasses["${ext}Hooks"]               = "$dir/classes/${ext}Hooks.php";
$wgExtensionMessagesFiles[$ext]                 = "$dir/i18n/_backward_compatibility.php";
$wgHooks['SkinTemplateOutputPageBeforeExec'][]  = "${ext}Hooks::hide";
$wgMessagesDirs[$ext]                           = "$dir/i18n";

$wgHideUnwantedFooters                          = array();
$wgHideUnwantedHeaders                          = array();
$wgHideUnwantedTabs                             = array();

Change the category from skin to other

Change the category from skin to other


<?php

namespace Hemp\Presenter;

use Illuminate\Support\Collection;
use Illuminate\Support\ServiceProvider;

class PresenterServiceProvider extends ServiceProvider
{
    public function boot()
    {
        Collection::macro('present', function ($class) {
            return $this->map(function ($object) use ($class) {
                return present($object, $class);
            });
        });
    }
}

<?php

namespace Hemp\Presenter;

use Illuminate\Support\Collection;
use Illuminate\Support\ServiceProvider;

class PresenterServiceProvider extends ServiceProvider
{
    public function boot()
    {
        Collection::macro('present', function ($class) {
            return $this->map(function ($object) use ($class) {
                return present($object, $class);
            });
        });
    }

    public function register()
    {

    }
}

Add required service provider method

Add required service provider method


<?php

namespace Fiddler\Composer;

use Fiddler\Build;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Plugin\PluginInterface;
use Composer\Script\Event;
use Composer\EventDispatcher\EventSubscriberInterface;

class Plugin implements PluginInterface, EventSubscriberInterface
{
    /**
     * @var \Fiddler\Build
     */
    private $build;

    public function __construct(Build $build = null)
    {
        $this->build = $build;
    }

    public function activate(Composer $composer, IOInterface $io)
    {
        $this->build = $this->build ?: new Build($io);
    }

    public static function getSubscribedEvents()
    {
        return [
            'post-autoload-dump' => 'generateMonorepoAutoloads',
        ];
    }

    /**
     * Delegate autoload dump to all the fiddler monorepo subdirectories.
     */
    public function generateMonorepoAutoloads(Event $event)
    {
        $flags = $event->getFlags();
        $optimize = isset($flags['optimize']) ? $flags['optimize'] : false;

        $this->build->build(getcwd(), $optimize, $event->isDevMode());
    }
}

<?php

namespace Fiddler\Composer;

use Fiddler\Build;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Plugin\PluginInterface;
use Composer\Script\Event;
use Composer\EventDispatcher\EventSubscriberInterface;

class Plugin implements PluginInterface, EventSubscriberInterface
{
    /**
     * @var \Fiddler\Build
     */
    private $build;

    public function __construct(Build $build = null)
    {
        $this->build = $build;
    }

    public function activate(Composer $composer, IOInterface $io)
    {
        $this->build = $this->build ?: new Build($io);
    }

    public static function getSubscribedEvents()
    {
        return [
            'post-autoload-dump' => 'generateMonorepoAutoloads',
        ];
    }

    /**
     * Delegate autoload dump to all the fiddler monorepo subdirectories.
     */
    public function generateMonorepoAutoloads(Event $event)
    {
        $flags = $event->getFlags();
        $optimize = isset($flags['optimize']) ? $flags['optimize'] : false;

        $this->build->build(getcwd(), $optimize, !$event->isDevMode());
    }
}

Set correct noDevMode in composer

Set correct noDevMode in composer


<?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.
 */

declare(strict_types=1);

namespace Sylius\Bundle\ShopBundle\SectionResolver;

use Sylius\Bundle\CoreBundle\SectionResolver\SectionInterface;
use Sylius\Bundle\CoreBundle\SectionResolver\UriBasedSectionResolverInterface;

final class ShopUriBasedSectionResolver implements UriBasedSectionResolverInterface
{
    /** @var string */
    private $shopCustomerAccountUri;

    public function __construct(string $shopCustomerAccountUri = 'account')
    {
        $this->shopCustomerAccountUri = $shopCustomerAccountUri;
    }

    public function getSection(string $uri): SectionInterface
    {
        if (str_contains($uri, $this->shopCustomerAccountUri)) {
            return new ShopCustomerAccountSubSection();
        }

        return new ShopSection();
    }
}

<?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.
 */

declare(strict_types=1);

namespace Sylius\Bundle\ShopBundle\SectionResolver;

use Sylius\Bundle\CoreBundle\SectionResolver\SectionInterface;
use Sylius\Bundle\CoreBundle\SectionResolver\UriBasedSectionResolverInterface;

final class ShopUriBasedSectionResolver implements UriBasedSectionResolverInterface
{
    /** @var string */
    private $shopCustomerAccountUri;

    public function __construct(string $shopCustomerAccountUri = 'account')
    {
        $this->shopCustomerAccountUri = $shopCustomerAccountUri;
    }

    public function getSection(string $uri): SectionInterface
    {
        if (strpos($uri, $this->shopCustomerAccountUri) !== false) {
            return new ShopCustomerAccountSubSection();
        }

        return new ShopSection();
    }
}

Replace str_contains with strpos method to support PHP 7


<?php

use Phinx\Migration\AbstractMigration;

class ArticleSearchable extends AbstractMigration
{
    /**
     * Up Method.
	 */
    public function up()
    {
		$table = $this->table('article');
		$table->addColumn('searchable', 'boolean', array(
			'comment' => 'Should web crawlers index this?',
			'null' => false,
			'after' => 'hidden',
			'default' => 1,
		))
		->addIndex(array('searchable'))
		->save();
    }

    /**
     * Down Method.
	 */
    public function down()
    {
		$this->execute('ALTER TABLE article DROP searchable');
    }
}

<?php

use Phinx\Migration\AbstractMigration;

class ArticleSearchable extends AbstractMigration
{
    /**
     * Up Method.
	 */
    public function up()
    {
		$table = $this->table('article');
		$table->addColumn('searchable', 'boolean', array(
			'comment' => 'Should web crawlers index this?',
			'null' => false,
			'after' => 'hidden',
			'default' => 1,
		))
		->addIndex(array('searchable'))
		->save();

		$this->execute('UPDATE `article` SET searchable = 0 WHERE `id` IN (1378, 1450)');
    }

    /**
     * Down Method.
	 */
    public function down()
    {
		$this->execute('ALTER TABLE article DROP searchable');
    }
}

Update searchable column for articles that are currently in robots.txt


<?php
/**
 * @author Evgeny Shpilevsky <evgeny@shpilevsky.com>
 */

namespace EnliteMonolog\Service;

use Monolog\Logger;
use RuntimeException;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

trait MonologServiceAwareTrait
{

    /**
     * @var Logger
     */
    protected $monologService;

    /**
     * @var string
     */
    protected $monologLoggerName = 'EnliteMonologService';

    /**
     * @param Logger $monologService
     */
    public function setMonologService(Logger $monologService)
    {
        $this->monologService = $monologService;
    }

    /**
     * @throws \RuntimeException
     * @return Logger
     */
    public function getMonologService()
    {
        if (null === $this->monologService) {
            if ($this instanceof ServiceLocatorAwareInterface || method_exists($this, 'getServiceLocator')) {
                $this->monologService = $this->getServiceLocator()->get($this->monologLoggerName);
            } else {
                if (property_exists($this, 'serviceLocator')
                    && $this->monologService instanceof ServiceLocatorInterface
                ) {
                    $this->monologService = $this->serviceLocator->get($this->monologLoggerName);
                } else {
                    throw new RuntimeException('Service locator not found');
                }
            }
        }
        return $this->monologService;
    }
}

<?php
/**
 * @author Evgeny Shpilevsky <evgeny@shpilevsky.com>
 */

namespace EnliteMonolog\Service;

use Monolog\Logger;
use RuntimeException;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

trait MonologServiceAwareTrait
{

    /**
     * @var Logger
     */
    protected $monologService;

    /**
     * @var string
     */
    protected $monologLoggerName = 'EnliteMonologService';

    /**
     * @param Logger $monologService
     */
    public function setMonologService(Logger $monologService)
    {
        $this->monologService = $monologService;
    }

    /**
     * @throws \RuntimeException
     * @return Logger
     */
    public function getMonologService()
    {
        if (null === $this->monologService) {
            if ($this instanceof ServiceLocatorAwareInterface || method_exists($this, 'getServiceLocator')) {
                $this->monologService = $this->getServiceLocator()->get($this->monologLoggerName);
            } else {
                if (property_exists($this, 'serviceLocator')
                    && $this->serviceLocator instanceof ServiceLocatorInterface
                ) {
                    $this->monologService = $this->serviceLocator->get($this->monologLoggerName);
                } else {
                    throw new RuntimeException('Service locator not found');
                }
            }
        }
        return $this->monologService;
    }
}

Fix wrong serviceLocator property name

Fix wrong serviceLocator property name


{{ trans('admin.checklist_management') }}

				{{ trans('admin.categories_list') }}

			{{ trans('admin.categories_create') }}

Remove create link for CKL

Remove create link for CKL


<?php

class Cello_Seed_Acl {

	/**
	 * Start Orchestra during construct
	 *
	 * @return void
	 */
	public function __construct()
	{
		Bundle::start('orchestra');

		if (false === Orchestra\Installer::installed())
		{
			throw new RuntimeException("Orchestra need to be install first.");
		}
	}

	/**
	 * Make changes to the database.
	 *
	 * @return void
	 */
	public function up()
	{
		$role  = Orchestra\Model\Role::find(
			Config::get('orchestra::orchestra.default_role', 1)
		);

		$cello = Orchestra\Acl::register('cello', function($acl) use ($role)
		{
			$acl->add_action('manage pages');
			$acl->add_role($role->name);

			$acl->allow($role->name, 'manage pages');
		});

		$cello->attach(Orchestra::memory());

		return true;
	}

	/**
	 * Revert the changes to the database.
	 *
	 * @return void
	 */
	public function down()
	{

	}

}

<?php

class Cello_Seed_Acl {

	/**
	 * Start Orchestra during construct
	 *
	 * @return void
	 */
	public function __construct()
	{
		Bundle::start('orchestra');

		if (false === Orchestra\Installer::installed())
		{
			throw new RuntimeException("Orchestra need to be install first.");
		}
	}

	/**
	 * Make changes to the database.
	 *
	 * @return void
	 */
	public function up()
	{
		$role  = Orchestra\Model\Role::admin();
		$cello = Orchestra\Acl::register('cello', function($acl) use ($role)
		{
			$acl->add_action('manage pages');
			$acl->add_role($role->name);

			$acl->allow($role->name, 'manage pages');
		});

		$cello->attach(Orchestra::memory());

		return true;
	}

	/**
	 * Revert the changes to the database.
	 *
	 * @return void
	 */
	public function down()
	{

	}

}

Update cello to use Orchestra\Model\Role::admin()

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


<?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'config.php';

class OrganismsTest extends PHPUnit_Framework_TestCase
{
    public function testExecute()
    {
        list($service) = \WebService::factory('listing/Organisms');
        $results = ($service->execute(array('ids' => array(1))));
        $this->assertEquals(1, $results[0]["organism_id"]);

    }

    public function testGetOrganismAbbr()
    {
        list($service) = \WebService::factory('listing/Organisms');
        $results = ($service->getOrganismAbbr(array('ids' => array(1))));
        var_dump($results);

        $this->assertEquals("H.sapiens", $results[0]["abbreviation"]);

    }
}
?>

<?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'config.php';

class OrganismsTest extends PHPUnit_Framework_TestCase
{
    public function testExecute()
    {
        list($service) = \WebService::factory('listing/Organisms');

        $results = ($service->execute(array('limit' => 2)));
        $this->assertEquals(1, count($results));

        $results = ($service->execute(array()));
        $this->assertEquals(1, count($results));

        $results = ($service->execute(array('limit' => 10000000)));
        $this->assertEquals(1, count($results));

    }
}
?>

Change php tests and they are all failing


<?php

$config['magic_replace'] = array();

$config['js_debug'] = FALSE;
$config['css_debug'] = FALSE;
$config['minify_js_ext'] = '.min.js';
$config['minify_css_ext'] = '.min.css';

$config['output_collapse'] = FALSE;

$config['title_separator'] = ' - ';

$config['base_path_symbol'] = '~/';

Add inline doc to config file

Add inline doc to config file


<?php
/**
 * Single Re Google Review
 *
 * @package Google Review
 */

?>
<?php get_header(); ?>
<?php
$place_id = get_option( 're_google_review_place_id' );
?>

Use Google
to leave your review?

	<a href="http://search.google.com/local/writereview?placeid=<?php echo esc_attr( $place_id ); ?>" class="button">Yes

<?php get_footer(); ?>

<?php
/**
 * Single Re Google Review
 *
 * @package Google Review
 */

?>
<?php get_header(); ?>

Use Google
to leave your review?

	<a href="http://search.google.com/local/writereview?placeid=<?php the_title(); ?>" class="button">Yes

<?php get_footer(); ?>

Use the title from the CPT to create unique review link.


<?php

declare(strict_types=1);

namespace OCA\B2shareBridge\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;

class Version010100Date20200130114400 extends SimpleMigrationStep {

	/**
	 * @param IOutput $output
	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
	 * @param array $options
	 * @return null|ISchemaWrapper
	 */
	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
		/** @var ISchemaWrapper $schema */
		$schema = $schemaClosure();

		if (!$schema->hasTable('b2sharebridge_server')) {
			$table = $schema->createTable('b2sharebridge_server');
			$table->addColumn('id', Type::INTEGER, [
				'autoincrement' => true,
				'notnull' => true,
			]);
			$table->addColumn('name', Type::STRING, [
				'notnull' => true,
				'length' => 64,
				'default' => '',
			]);
			$table->addColumn('publish_url', Type::STRING, [
				'notnull' => true,
                'length' => 64,
                'default' => '',
			]);
		}
		return $schema;
	}

}

<?php

declare(strict_types=1);

namespace OCA\B2shareBridge\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;

class Version010100Date20200130114400 extends SimpleMigrationStep {

	/**
	 * @param IOutput $output
	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
	 * @param array $options
	 * @return null|ISchemaWrapper
	 */
	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
		/** @var ISchemaWrapper $schema */
		$schema = $schemaClosure();

		if (!$schema->hasTable('b2sharebridge_server')) {
			$table = $schema->createTable('b2sharebridge_server');
			$table->addColumn('id', 'integer', [
				'autoincrement' => true,
				'notnull' => true,
			]);
			$table->addColumn('name', 'string', [
				'notnull' => true,
				'length' => 64,
				'default' => '',
			]);
			$table->addColumn('publish_url', 'string', [
				'notnull' => true,
                'length' => 64,
                'default' => '',
            ]);
            $table->setPrimaryKey(['id']);
		}
		return $schema;
	}

}

Set primary key and adjust types

Set primary key and adjust types


<?php
App::uses('AppShell', 'Console/Command');
App::uses('AppController', 'Controller');

class ThemeAppShell extends Shell
{
	public function initialize() {
		if ($this instanceof BakeShell || $this instanceof ThemeShell) {
			$this->tasks['View'] = array(
				'className' => 'Theme.ThemeView',
			);
		}
		parent::initialize();
	}

	public function runCommand($command, $argv) {
		$auto = false;

		if ($this instanceof ThemeShell) {
			$auto = true;
		} elseif ($this instanceof BakeShell) {
			if ($argv && $this->hasTask($argv[0])) {
				$auto = true;
			}
		}

		if ($auto) {
			$theme = Configure::read('Theme.default');

			if (!$theme) {
				$vars = get_class_vars('AppController');
				if (isset($vars['theme'])) {
					$theme = $vars['theme'];
				}
			}

			if ($theme) {
				array_splice($argv, 1, 0, array('--theme', $theme));
			}
		}

		return parent::runCommand($command, $argv);
	}
}

<?php
App::uses('AppShell', 'Console/Command');
App::uses('AppController', 'Controller');

class ThemeAppShell extends Shell
{
	public function initialize() {
		if ($this instanceof BakeShell || $this instanceof ThemeShell) {
			$this->tasks['View'] = array(
				'className' => 'Theme.ThemeView',
			);
		}
		parent::initialize();
	}

	public function runCommand($command, $argv) {
		if ($this instanceof BakeShell || $this instanceof ThemeShell) {
			$theme = Configure::read('Theme.default');

			if (!$theme) {
				$class = Configure::read('Theme.defaultClass') ?: 'AppController';
				$vars = get_class_vars($class);
				if (isset($vars['theme'])) {
					$theme = $vars['theme'];
				}
			}

			if ($theme) {
				array_splice($argv, 1, 0, array('--theme', $theme));
			}
		}
		return parent::runCommand($command, $argv);
	}
}

Fix `bake all` ignores AppController::$theme


<?php

/**
 * @param int $id The NamelessMC user's ID
 * @param string $code The NamelessMC user's reset code, used to verify they own the account
 *
 * @return string JSON Array
 */
class VerifyEndpoint extends KeyAuthEndpoint {

    public function __construct() {
        $this->_route = 'verify';
        $this->_module = 'Core';
        $this->_description = 'Validate/Activate a NamelessMC account by confirming their reset code';
        $this->_method = 'POST';
    }

    public function execute(Nameless2API $api): void {
        $api->validateParams($_POST, ['user', 'code']);

        $user = $api->getUser('id', $_POST['user']);

        if ($user->data()->active || $user->data()->reset_code == '') {
            $api->throwError(32, $api->getLanguage()->get('api', 'user_already_active'));
        }

        if ($user->data()->reset_code != $_POST['code']) {
            $api->throwError(28, $api->getLanguage()->get('api', 'invalid_code'));
        }

        $user->update([
            'active' => 1,
            'reset_code' => ''
        ]);

        EventHandler::executeEvent('validateUser', [
            'user_id' => $user->data()->id,
            'username' => $user->data()->username,
            'language' => $api->getLanguage()
        ]);

        $api->returnArray(['message' => $api->getLanguage()->get('api', 'account_validated')]);
    }
}

<?php

/**
 * @param int $id The NamelessMC user's ID
 * @param string $code The NamelessMC user's reset code, used to verify they own the account
 *
 * @return string JSON Array
 */
class VerifyEndpoint extends KeyAuthEndpoint {

    public function __construct() {
        $this->_route = 'users/{user}/verify';
        $this->_module = 'Core';
        $this->_description = 'Validate/Activate a NamelessMC account by confirming their reset code';
        $this->_method = 'POST';
    }

    public function execute(Nameless2API $api, User $user): void {
        $api->validateParams($_POST, ['code']);

        if ($user->data()->active || $user->data()->reset_code == '') {
            $api->throwError(32, $api->getLanguage()->get('api', 'user_already_active'));
        }

        if ($user->data()->reset_code != $_POST['code']) {
            $api->throwError(28, $api->getLanguage()->get('api', 'invalid_code'));
        }

        $user->update([
            'active' => 1,
            'reset_code' => ''
        ]);

        EventHandler::executeEvent('validateUser', [
            'user_id' => $user->data()->id,
            'username' => $user->data()->username,
            'language' => $api->getLanguage()
        ]);

        $api->returnArray(['message' => $api->getLanguage()->get('api', 'account_validated')]);
    }
}

Fix Verify endpoint doesn't use user tranformer

Close https://github.com/NamelessMC/Nameless/issues/2714


<?php

namespace Bpocallaghan\Titan\Http\Controllers\Website;

use App\Http\Requests;
use Bpocallaghan\Titan\Models\News;

class HomeController extends WebsiteController
{
    /**
     * Show the home page
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $items = News::active()->orderBy('created_at', 'DESC')->get()->take(6);

        return $this->view('titan::home')->with('news', $items)->with('hidePageFooter', true);
    }
}

<?php

namespace Bpocallaghan\Titan\Http\Controllers\Website;

use App\Http\Requests;
use Bpocallaghan\Titan\Models\News;

class HomeController extends WebsiteController
{
    /**
     * Show the home page
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //$items = News::active()->orderBy('created_at', 'DESC')->get()->take(6);

        return $this->view('home')->with('hidePageFooter', true); //->with('news', $items)
    }
}

Disable news by default (not included anymore)


<?php

class  Litle_LEcheck_Model_URL
{
	public function toOptionArray()
	{
		return array(

				array(
		                'value' => "https://www.testlitle.com/sandbox/communicator/online",
		                'label' => 'Sandbox'
				),
				array(
		                'value' => "https://prelive.litle.com/vap/communicator/online",
		                'label' => 'Prelive'
				),
				array(
		        		'value' => "https://postlive.litle.com/vap/communicator/online",
		                'label' => 'Postlive'
				),
				array(
				        'value' => "https://payments.litle.com/vap/communicator/online",
				        'label' => 'Production'
				)
		);

	}
}

<?php

class  Litle_LEcheck_Model_URL
{
	public function toOptionArray()
	{
		return array(

				array(
		                'value' => "https://www.testvantivcnp.com/sandbox/communicator/online",
		                'label' => 'Sandbox'
				),
				array(
		                'value' => "https://payments.vantivprelive.com/vap/communicator/online",
		                'label' => 'Prelive'
				),
				array(
		        		'value' => "https://payments.vantivpostlive.com/vap/communicator/online",
		                'label' => 'Postlive'
				),
				array(
				        'value' => "https://payments.vantivcnp.com/vap/communicator/online",
				        'label' => 'Production'
				)
		);

	}
}

Update URLs to be Vantiv

Update URLs to be Vantiv


<?php

include_once 'BottomlineWrapperBase.php';

class BottomlineWrapper extends BottomLineWrapperBase
{
    /**
     * @var mixed $value
     */
    private $value;

    /**
     * BottomlineWrapper constructor.
     *
     * @param mixed $value the value that is going to be chained
     */
    public function __construct($value)
    {
        $this->value = $value;
    }

    /**
     * dynamically calls bottomline function, prepend the list of parameters with the current collection list
     *
     * @param string $functionName must be a valid bottomline function
     * @param array  $params
     *
     * @throws \Exception
     *
     * @return $this
     */
    public function __call($functionName, $params)
    {
        if (is_callable('__', $functionName)) {
            $params = $params == null ? [] : $params;
            $params = __::prepend($params, $this->value);
            $this->value = call_user_func_array(array('__', $functionName), $params);
            return $this;
        } else {
            throw new \Exception("Invalid function {$functionName}");
        }
    }

    /**
     * @return mixed
     */
    public function value()
    {
        return $this->value;
    }
}

<?php

include_once 'BottomlineWrapperBase.php';

class BottomlineWrapper extends BottomLineWrapperBase
{
    /**
     * @var mixed $value
     */
    private $value;

    /**
     * BottomlineWrapper constructor.
     *
     * @param mixed $value the value that is going to be chained
     */
    public function __construct($value)
    {
        $this->value = $value;
    }

    /**
     * dynamically calls bottomline function, prepend the list of parameters with the current collection list
     *
     * @param string $functionName must be a valid bottomline function
     * @param array  $params
     *
     * @throws \BadFunctionCallException
     *
     * @return $this
     */
    public function __call($functionName, $params)
    {
        if (is_callable('__', $functionName)) {
            $params = $params == null ? [] : $params;
            $params = __::prepend($params, $this->value);
            $this->value = call_user_func_array(array('__', $functionName), $params);

            return $this;
        }

        throw new \BadFunctionCallException("Invalid function {$functionName}");
    }

    /**
     * @return mixed
     */
    public function value()
    {
        return $this->value;
    }
}

Throw BacFunctionCallException in our sequence


<?php

namespace SV\UserMentionsImprovements\XF\Pub\View\Member;

class Find extends XFCP_Find
{
	public function renderJson()
	{
		$response = parent::renderJson();

		foreach ($this->params['usergroups'] AS $usergroup)
		{
			$response['results'][] = [
				'id' => $usergroup->user_group_id,
				'iconHtml' => $usergroup->icon_html,
				'text' => $usergroup->title,
				'q' => $this->params['q']
			];
		}

		return $response;
	}
}

<?php

namespace SV\UserMentionsImprovements\XF\Pub\View\Member;

class Find extends XFCP_Find
{
	public function renderJson()
	{
		$response = parent::renderJson();

		foreach ($this->params['usergroups'] AS $usergroup)
		{
			array_unshift($response['results'], [
				'id' => $usergroup->user_group_id,
				'iconHtml' => $usergroup->icon_html,
				'text' => $usergroup->title,
				'q' => $this->params['q']
			]);
		}

		return $response;
	}
}

Make sure usergroups appear in the top of the suggestion list.


<?php
final class DVRUI_Vars
{
	const DVRUI_version	="0.2.6";
	const DVRUI_name	="HDHomeRun DVR UI";
	const DVRUI_git		="https://github.com/demonrik/HDHR-DVRUI.git";

	/* Set TZ to something valid from http://php.net/manual/en/timezones.php */
	const DVRUI_TZ		= '';
}
?>

<?php
final class DVRUI_Vars
{
	const DVRUI_version	="0.2.7";
	const DVRUI_name	="HDHomeRun DVR UI";
	const DVRUI_git		="https://github.com/demonrik/HDHR-DVRUI.git";

	/* Set TZ to something valid from http://php.net/manual/en/timezones.php */
	const DVRUI_TZ		= '';
}
?>

Handle API change for StorageURL

Handle API change for StorageURL


<?php

namespace Droid\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use RuntimeException;

class DebugEchoCommand extends Command
{
    public function configure()
    {
        $this->setName('debug:echo')
            ->setDescription('Echo a message to the console')
            ->addArgument(
                'message',
                InputArgument::REQUIRED,
                'Message to output'
            )
            ->addOption(
                'color',
                'c',
                InputOption::VALUE_REQUIRED,
                'Set color of the output'
            )
        ;
    }

    public function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeLn("ECHO: " . $input->getArgument('message') . " @ " . $input->getOption('color'));
        //$output->writeLn($input->getArgument('message'));
        //return 0;
    }
}

<?php

namespace Droid\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use RuntimeException;

class DebugEchoCommand extends Command
{
    public function configure()
    {
        $this->setName('debug:echo')
            ->setDescription('Echo a message to the console')
            ->addArgument(
                'message',
                InputArgument::REQUIRED,
                'Message to output'
            )
            ->addOption(
                'color',
                'c',
                InputOption::VALUE_REQUIRED,
                'Set color of the output'
            )
            ->addOption(
                'uppercase',
                'u',
                InputOption::VALUE_NONE,
                'Uppercase the output'
            )
        ;
    }

    public function execute(InputInterface $input, OutputInterface $output)
    {
        $message = $input->getArgument('message');
        if ($input->getOption('uppercase')) {
            $message = strtoupper($message);
        }
        $color = $input->getOption('color');
        if (!$color) {
            $color = 'white';
        }
        $output->writeLn('<fg=' . $color . '>' . $message . '</>');
        //$output->writeLn($input->getArgument('message'));
        //return 0;
    }
}

Enhance debug:echo with --color and --uppercase options


<?php
namespace Criterion\Helper;

class Command
{
    public $response = null;
    public $command = null;
    public $output = null;

    public function execute($command)
    {
        $this->command = $command;

        ob_start();
        passthru($this->command . ' 2>&1', $response);
        $this->output = ob_get_contents();
        ob_end_clean();

        $this->response = (string) $response;

        $this->output = trim($this->output);
        $this->output = str_replace(TEST_DIR, null, $this->output);

        return $this->response === '0';
    }
}

<?php
namespace Criterion\Helper;

class Command
{
    public $response = null;
    public $command = null;
    public $output = null;

    public function execute($command)
    {
        $this->command = $command;

        ob_start();
        passthru($this->command . ' 2>&1', $response);
        $this->output = ob_get_contents();
        ob_end_clean();

        $this->response = (string) $response;

        $this->output = trim($this->output);
        $this->output = str_replace(DATA_DIR, null, $this->output);
        $this->command = str_replace(DATA_DIR, null, $this->command);

        return $this->response === '0';
    }
}

Clean command and output of DATA_DIR

Clean command and output of DATA_DIR


<?php

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

class OrchestraMemoryCreateOptionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('orchestra_options', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name', 64);
            $table->longText('value');

            $table->unique('name');
        });
    }

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

<?php

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

class OrchestraMemoryCreateOptionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('orchestra_options', function (Blueprint $table) {
            $table->id();
            $table->string('name', 64);
            $table->longText('value');

            $table->unique('name');
        });
    }

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

Use id() instead of increments('id')

Use id() instead of increments('id')

Signed-off-by: Mior Muhammad Zaki <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>


<?php

require_once 'Inquisition/admin/components/Option/Order.php';
require_once 'CME/admin/components/Option/include/CMEOptionHelper.php';

/**
 * @package   CME
 * @copyright 2014 silverorange
 * @license   http://www.opensource.org/licenses/mit-license.html MIT License
 */
abstract class CMEOptionOrder extends InquisitionOptionOrder
{
	// {{{ protected properties

	/**
	 * @var CMEOptionHelper
	 */
	protected $helper;

	// }}}

	// init phase
	// {{{ protected function initInternal()

	protected function initInternal()
	{
		parent::initInternal();

		$this->helper = $this->getOptionHelper();
		$this->helper->initInternal();
	}

	// }}}
	// {{{ abstract protected function getOptionHelper()

	abstract protected function getOptionHelper();

	// }}}

	// build phase
	// {{{ protected function buildForm()

	protected function buildForm()
	{
		parent::buildForm();

		$form = $this->ui->getWidget('order_form');
		$form->addHiddenField('inquisition', $this->inquisition->id);
	}

	// }}}
	// {{{ protected function buildNavBar()

	protected function buildNavBar()
	{
		parent::buildNavBar();

		$this->helper->buildNavBar($this->navbar);
	}

	// }}}
}

?>

<?php

require_once 'Inquisition/admin/components/Option/Order.php';
require_once 'CME/admin/components/Option/include/CMEOptionHelper.php';

/**
 * @package   CME
 * @copyright 2014 silverorange
 * @license   http://www.opensource.org/licenses/mit-license.html MIT License
 */
abstract class CMEOptionOrder extends InquisitionOptionOrder
{
	// {{{ protected properties

	/**
	 * @var CMEOptionHelper
	 */
	protected $helper;

	// }}}

	// init phase
	// {{{ protected function initInternal()

	protected function initInternal()
	{
		parent::initInternal();

		$this->helper = $this->getOptionHelper();
		$this->helper->initInternal();
	}

	// }}}
	// {{{ abstract protected function getOptionHelper()

	abstract protected function getOptionHelper();

	// }}}

	// build phase
	// {{{ protected function buildNavBar()

	protected function buildNavBar()
	{
		parent::buildNavBar();

		$this->helper->buildNavBar($this->navbar);
	}

	// }}}
}

?>

Remove method implemented in parent.

Remove method implemented in parent.


<?php

/*
 * This file is part of Composer.
 *
 * (c) Nils Adermann <naderman@naderman.de>
 *     Jordi Boggiano <j.boggiano@seld.be>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Composer\Util;

use Composer\IO\IOInterface;

/**
 * @author Jordi Boggiano <j.boggiano@seld.be>
 */
class Git
{
    public function cleanEnv()
    {
        if (ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars', 'GIT_ASKPASS'))) {
            throw new \RuntimeException('safe_mode is enabled and safe_mode_allowed_env_vars does not contain GIT_ASKPASS, can not set env var. You can disable safe_mode with "-dsafe_mode=0" when running composer');
        }

        // added in git 1.7.1, prevents prompting the user for username/password
        if (getenv('GIT_ASKPASS') !== 'echo') {
            putenv('GIT_ASKPASS=echo');
        }

        // clean up rogue git env vars in case this is running in a git hook
        if (getenv('GIT_DIR')) {
            putenv('GIT_DIR');
        }
        if (getenv('GIT_WORK_TREE')) {
            putenv('GIT_WORK_TREE');
        }
    }
}

<?php

/*
 * This file is part of Composer.
 *
 * (c) Nils Adermann <naderman@naderman.de>
 *     Jordi Boggiano <j.boggiano@seld.be>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Composer\Util;

use Composer\IO\IOInterface;

/**
 * @author Jordi Boggiano <j.boggiano@seld.be>
 */
class Git
{
    public function cleanEnv()
    {
        if (ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
            throw new \RuntimeException('safe_mode is enabled and safe_mode_allowed_env_vars does not contain GIT_ASKPASS, can not set env var. You can disable safe_mode with "-dsafe_mode=0" when running composer');
        }

        // added in git 1.7.1, prevents prompting the user for username/password
        if (getenv('GIT_ASKPASS') !== 'echo') {
            putenv('GIT_ASKPASS=echo');
        }

        // clean up rogue git env vars in case this is running in a git hook
        if (getenv('GIT_DIR')) {
            putenv('GIT_DIR');
        }
        if (getenv('GIT_WORK_TREE')) {
            putenv('GIT_WORK_TREE');
        }
    }
}

Fix typo. when safemode is enabled we experienced the problem with ini_get arguments number


<?php /* Template Name: Home Page Template */ ?>

<?php get_header(); ?>

<?php the_title(); ?>

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

        <?php the_content(); ?>

      <?php endwhile; ?>

<?php get_footer(); ?>

<?php /* Template Name: Home Page Template */ ?>

<?php get_header(); ?>

<?php get_post_meta( $post->ID, 'callout_title', TRUE ) ?>

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

        <?php the_content(); ?>

      <?php endwhile; ?>

<?php get_footer(); ?>

Change title on home page

Change title on home page


<?php
namespace Bcremer\Sculpin\Bundle\CommonMarkBundle\DependencyInjection;

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

class Configuration implements ConfigurationInterface
{
    /**
    * {@inheritdoc}
    */
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder;

        $rootNode = $treeBuilder->root('sculpin_commonmark');

        $rootNode
            ->children()
                ->arrayNode('extensions')
                    ->defaultValue(['md', 'mdown', 'markdown'])
                    ->prototype('scalar')->end()
                ->end()
            ->end();

        return $treeBuilder;
    }
}

<?php
namespace Bcremer\Sculpin\Bundle\CommonMarkBundle\DependencyInjection;

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

class Configuration implements ConfigurationInterface
{
    /**
    * {@inheritdoc}
    */
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder;

        $rootNode = $treeBuilder->root('sculpin_commonmark');

        $rootNode
            ->children()
                ->arrayNode('extensions')
                    ->defaultValue(['md', 'mdown', 'mkdn', 'markdown'])
                    ->prototype('scalar')->end()
                ->end()
            ->end();

        return $treeBuilder;
    }
}

Add mkdn extension to markdown extension list

See: https://github.com/sculpin/sculpin/commit/c3b9cbe8827977b4d7759f94a971bb13cc00a226


<?php
namespace WordpressLib\Posts;

abstract class FakeArchive extends FakePage {

	protected $templateName = 'archive';

	public function __construct($slug, $title) {
		parent::__construct($slug, $title);

		remove_filter('the_title', [$this, 'replaceContentTitle'], 10, 2);
		remove_filter('the_content', [$this, 'replaceContent']);

		add_filter('get_the_archive_title', function($t) {
			return $this->title;
		}, 100);
	}

	public function addRewriteRules() {
		add_rewrite_rule(
			sprintf('%s/page/([0-9]+)/?$', $this->slug),
			"index.php?$this->queryVar=$this->slug&paged=\$matches[1]",
			'top'
		);
	}

	protected function createContent() {
		throw new \BadMethodCallException("This method should not be called on this class.");
	}

	protected function getBodyClasses() {
		return array_merge(parent::getBodyClasses(), ['archive']);
	}

}

<?php
namespace WordpressLib\Posts;

abstract class FakeArchive extends FakePage {

	protected $templateName = 'archive';

	public function __construct($slug, $title) {
		parent::__construct($slug, $title);

		remove_filter('the_title', [$this, 'replaceContentTitle'], 10, 2);
		remove_filter('the_content', [$this, 'replaceContent']);

		add_filter('get_the_archive_title', function($t) {
			return $this->title;
		}, 100);
	}

	public function addRewriteRules() {
		parent::addRewriteRules();
		add_rewrite_rule(
			sprintf('%s/page/([0-9]+)/?$', $this->slug),
			"index.php?$this->queryVar=$this->slug&paged=\$matches[1]",
			'top'
		);
	}

	protected function createContent() {
		throw new \BadMethodCallException("This method should not be called on this class.");
	}

	protected function getBodyClasses() {
		return array_merge(parent::getBodyClasses(), ['archive']);
	}

}

Rewrite fix for fake archive

Rewrite fix for fake archive