<?php

namespace CascadeEnergy\ServiceDiscovery\Consul;

use CascadeEnergy\ServiceDiscovery\ServiceDiscoveryClientInterface;

class ConsulDns implements ServiceDiscoveryClientInterface
{
    private $lookupService;

    public function __construct(callable $lookupService = null)
    {
        $this->lookupService = $lookupService;

        if (is_null($lookupService)) {
            $this->lookupService = "dns_get_record";
        }
    }

    public function getServiceAddress($serviceName, $version = null)
    {
        $dnsEntry = "$serviceName.service.consul";

        if (!empty($version)) {
            $dnsEntry = "$version.$dnsEntry";
        }

        $resultList = call_user_func($this->lookupService, $dnsEntry, DNS_SRV);

        if (empty($resultList)) {
            return false;
        }

        $ipAddress = '';
        $port = '80';

        foreach ($resultList as $result) {
            if (isset($result['ip'])) {
                $ipAddress = $result['ip'];
            }

            if (isset($result['port'])) {
                $port = $result['port'];
            }
        }

        return "$ipAddress:$port";
    }
}

<?php

namespace CascadeEnergy\ServiceDiscovery\Consul;

use CascadeEnergy\ServiceDiscovery\ServiceDiscoveryClientInterface;

class ConsulDns implements ServiceDiscoveryClientInterface
{
    private $lookupService;

    public function __construct(callable $lookupService = null)
    {
        $this->lookupService = $lookupService;

        if (is_null($lookupService)) {
            $this->lookupService = "dns_get_record";
        }
    }

    public function getServiceAddress($serviceName, $version = null)
    {
        $dnsEntry = "$serviceName.service.consul";

        if (!empty($version)) {
            $dnsEntry = "$version.$dnsEntry";
        }

        $resultList = call_user_func($this->lookupService, $dnsEntry, DNS_SRV);

        if (empty($resultList)) {
            return false;
        }

        $ipAddress = '';
        $port = '80';

        foreach ($resultList as $result) {
            if (isset($result['host'])) {
                $ipAddress = $result['host'];
            }

            if (isset($result['port'])) {
                $port = $result['port'];
            }
        }

        return "$ipAddress:$port";
    }
}

Fix ip -> target bug

Fix ip -> target bug


<?php

namespace TicketCo\Resources;

class Events extends API
{

    /**
     * @var string
     */
    protected $resource = 'events';

    /**
     * Get all events
     *
     * @param array $filters Filter by providing one or more of these params;
     *                          tags            - Filter by tags. E.g ['tags' => 'teater,standup']
     *                          title           - Filter by title. E.g ['title' => 'red']
     *                          street_address  - ['street_address' => 'Oslo']
     *                          location        - Location name: ['location' => 'Concert']
     *                          start_at        - Exact start date: ['start_at' => '2017-1-1']
     * @return mixed
     * @throws \Exception
     */
    public function all($filters = [])
    {
        return $this->request($filters);
    }

    /**
     * Retrieve a single event
     *
     * @param int $id
     * @return mixed
     * @throws \Exception
     */
    public function get($id)
    {
        return $this->request([], $id);
    }

    /**
     * Returns status of event
     *
     * @param int $id
     * @return mixed
     * @throws \Exception
     */
    public function status($id)
    {
        return $this->request([], $id . '/status');
    }

}

<?php

namespace TicketCo\Resources;

use DateTime;

class Events extends API
{

    /**
     * @var string
     */
    protected $resource = 'events';

    /**
     * Get all events
     *
     * @param array $filters Filter by providing one or more of these params;
     *                          tags            - Filter by tags. E.g ['tags' => 'teater,standup']
     *                          title           - Filter by title. E.g ['title' => 'red']
     *                          street_address  - ['street_address' => 'Oslo']
     *                          location        - Location name: ['location' => 'Concert']
     *                          start_at        - Exact start date: ['start_at' => '2017-1-1']
     * @return mixed
     * @throws \Exception
     */
    public function all($filters = [])
    {
        return $this->request($filters);
    }

    /**
     * Patch for upcoming events after API changes
     * @throws \Exception
     */
    public function upcoming()
    {
        date_default_timezone_set('Europe/Oslo');

        $events = $this->request();

        $now = new DateTime();
        return $events->filter(function($event) use ($now) {
            $dt = new DateTime($event->start_at);
            return $dt >= $now;
        });
    }

    /**
     * Retrieve a single event
     *
     * @param int $id
     * @return mixed
     * @throws \Exception
     */
    public function get($id)
    {
        return $this->request([], $id);
    }

    /**
     * Returns status of event
     *
     * @param int $id
     * @return mixed
     * @throws \Exception
     */
    public function status($id)
    {
        return $this->request([], $id . '/status');
    }

}

Patch added for upcoming events. TicketCo is working on a fix for the API


<?php

namespace CottaCush\Yii2\Assets;

class ModalAsset extends LocalAssetBundle
{
    public $js = [
        'js/modal.js',
        'js/remote-modal.js'
    ];

    public $depends = [
        'CottaCush\Yii2\Assets\FormAsset'
    ];
}

<?php

namespace CottaCush\Yii2\Assets;

class ModalAsset extends LocalAssetBundle
{
    public $js = [
        'js/modal.js'
    ];

    public $depends = [
        'CottaCush\Yii2\Assets\FormAsset'
    ];
}

Remove remote modal js dependency

Remove remote modal js dependency


<?php
declare(strict_types=1);

namespace WoohooLabs\Zen\Container\Definition;

use WoohooLabs\Zen\Container\DefinitionCompilation;

class SelfDefinition extends AbstractDefinition
{
    public function __construct(string $className)
    {
        parent::__construct($className, "", true, false, false, 0);
    }

    public function needsDependencyResolution(): bool
    {
        return false;
    }

    public function resolveDependencies(): DefinitionInterface
    {
        return $this;
    }

    public function getClassDependencies(): array
    {
        return [];
    }

    public function compile(DefinitionCompilation $compilation, int $indentationLevel, bool $inline = false): string
    {
        $indent = $this->indent($indentationLevel);

        if ($inline) {
            return "\$this";
        }

        return "${indent}return \$this;\n";
    }
}

<?php
declare(strict_types=1);

namespace WoohooLabs\Zen\Container\Definition;

use WoohooLabs\Zen\Container\DefinitionCompilation;

class SelfDefinition extends AbstractDefinition
{
    public function __construct(string $className)
    {
        parent::__construct($className, "", false, false, false, 0);
    }

    public function increaseReferenceCount(string $parentId = ""): DefinitionInterface
    {
        return $this;
    }

    public function needsDependencyResolution(): bool
    {
        return false;
    }

    public function resolveDependencies(): DefinitionInterface
    {
        return $this;
    }

    public function getClassDependencies(): array
    {
        return [];
    }

    public function compile(DefinitionCompilation $compilation, int $indentationLevel, bool $inline = false): string
    {
        $indent = $this->indent($indentationLevel);

        if ($inline) {
            return "\$this";
        }

        return "${indent}return \$this;\n";
    }
}

Optimize compiled references to the container itself


<?php

namespace Adldap\Laravel\Events;

use Adldap\Models\User;
use Illuminate\Contracts\Auth\Authenticatable;

class AuthenticatedWithCredentials
{
    /**
     * The authenticated LDAP user.
     *
     * @var User
     */
    public $user;

    /**
     * The authenticated LDAP users model.
     *
     * @var Authenticatable
     */
    public $model;

    /**
     * Constructor.
     *
     * @param User            $user
     * @param Authenticatable $model
     */
    public function __construct(User $user, Authenticatable $model)
    {
        $this->user = $user;
        $this->model = $model;
    }
}

<?php

namespace Adldap\Laravel\Events;

use Adldap\Models\User;
use Illuminate\Contracts\Auth\Authenticatable;

class AuthenticatedWithCredentials
{
    /**
     * The authenticated LDAP user.
     *
     * @var User
     */
    public $user;

    /**
     * The authenticated LDAP users model.
     *
     * @var Authenticatable
     */
    public $model;

    /**
     * Constructor.
     *
     * @param User                 $user
     * @param Authenticatable|null $model
     */
    public function __construct(User $user, Authenticatable $model = null)
    {
        $this->user = $user;
        $this->model = $model;
    }
}

Allow a null model for the NoDatabaseUserProvider


<?php

namespace Yajra\CMS\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Yajra\CMS\Entities\Category;
use Yajra\CMS\Events\CategoryWasViewed;

class CategoryController extends Controller
{
    /**
     * Display an article.
     *
     * @param \Yajra\CMS\Entities\Category $category
     * @param \Illuminate\Http\Request $request
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function show(Category $category, Request $request)
    {
        $category->increment('hits');

        $layout   = $request->query('layout', 'blog');
        $limit    = $request->get('limit', $layout == 'list' ? 10 : 5);
        $articles = $category->articles()->isNotPage()->latest()->simplePaginate($limit);

        $path = null;
        if ($layout === 'list') {
            $path .= '?layout=list';
            $articles->setPath($path);
        }

        if ($request->has('limit')) {
            $path .= '&limit=' . $limit;
            $articles->setPath($path);
        }

        event(new CategoryWasViewed($category));

        return view("category.$layout", compact('category', 'articles', 'limit'));
    }
}

<?php

namespace Yajra\CMS\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Yajra\CMS\Entities\Category;
use Yajra\CMS\Events\CategoryWasViewed;

class CategoryController extends Controller
{
    /**
     * Display an article.
     *
     * @param \Yajra\CMS\Entities\Category $category
     * @param \Illuminate\Http\Request $request
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function show(Category $category, Request $request)
    {
        $category->increment('hits');

        $layout   = $request->query('layout', 'blog');
        $limit    = $request->get('limit', $layout == 'list' ? 10 : 5);
        /** @var \Illuminate\Contracts\Pagination\Paginator $articles */
        $articles = $category->articles()->isNotPage()->latest()->simplePaginate($limit);

        if ($layout === 'list') {
            $articles->appends('layout', 'list');
        }

        if ($request->has('limit')) {
            $articles->appends('limit', $limit);
        }

        event(new CategoryWasViewed($category));

        return view("category.$layout", compact('category', 'articles', 'limit'));
    }
}

Fix appending of query params.

Fix appending of query params.


<?php
/**
 *
 */

namespace DoSomething\MBC_TransactionalDigest;

/**
 *
 */
class MB_Toolbox_FBMessenger extends MB_Toolbox_BaseService
{

  /**
   *
   */
  public function __construct() {

    parent::__construct();
    $this->transactionQueue = $this->mbConfig->getProperty('transactionalOTTQueue');
  }

 /**
  * generateMessage(): Generate message values based on Facebook Messenger requirements.
  *
  * @param array $settings
  */
 public function generateMessage($settings) {

  $message = '';

   return $message;
 }

 /**
  * dispatchMessage(): Send message to Twilio to trigger sending transactional Facebook Messenger message.
  *
  * @param array $message
  *   Values to create message for processing in ottTransactionalQueue.
  */
  public function dispatchMessage($message) {

 }

}

<?php
/**
 *
 */

namespace DoSomething\MBC_TransactionalDigest;

/**
 *
 */
class MB_Toolbox_FBMessenger extends MB_Toolbox_BaseService
{

  /**
   *
   */
  public function __construct() {

    parent::__construct();
    $this->transactionQueue = $this->mbConfig->getProperty('transactionalOTTQueue');
  }

 /**
  * generateCampaignMarkup(): Generate campaign specific row HTML markup for email.
  *
  * @param array $settings
  *   Campaign Values to be used to generate campaign row markup.
  *
  * @return string $markup
  *   HTML markup
  *
  */
   public function generateCampaignMarkup($settings) {

     $markup = ' MB_Toolbox_FBMessenger - GENERATED CAMPAIGN MARKUP';

     return $markup;
  }

 /**
  * generateCampaignsMarkup(): Generate message values based on Mandrill Send-Template requirements.
  *
  * @param array $settings
  *
  */
  public function generateCampaignsMarkup($settings) {

    $markup = ' MB_Toolbox_FBMessenger - CAMPAIGNS MARKUP';

    return $markup;
 }

 /**
  * generateMessage(): Generate message values based on Facebook Messenger requirements.
  *
  * @param array $settings
  */
  public function generateMessage($settings) {

    $markup = 'FACEBOOK MESSENGER MESSAGE';

    return $markup;
  }

 /**
  * dispatchMessage(): Send message to Twilio to trigger sending transactional Facebook Messenger message.
  *
  * @param array $message
  *   Values to create message for processing in ottTransactionalQueue.
  */
  public function dispatchMessage($message) {

 }

}

Add support for creating campaign and campaigns markup for service


<?php namespace Anomaly\UsersModule\User\Validation;

use Anomaly\UsersModule\User\Contract\UserInterface;
use Anomaly\UsersModule\User\Contract\UserRepositoryInterface;
use Anomaly\UsersModule\User\Login\LoginFormBuilder;
use Anomaly\UsersModule\User\UserAuthenticator;
use Symfony\Component\HttpFoundation\Response;

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

    /**
     * Handle the validation.
     *
     * @param  UserAuthenticator $authenticator
     * @param  LoginFormBuilder  $builder
     * @return bool
     */
    public function handle(UserAuthenticator $authenticator, LoginFormBuilder $builder)
    {
        $values = $builder->getFormValues();

        if (!$response = $authenticator->authenticate($values->all())) {
            return false;
        }

        if ($response instanceof UserInterface) {
            $builder->setUser($response);
        }

        if ($response instanceof Response) {
            $builder->setFormResponse($response);
        }

        return true;
    }
}

<?php namespace Anomaly\UsersModule\User\Validation;

use Anomaly\UsersModule\User\Contract\UserInterface;
use Anomaly\UsersModule\User\Login\LoginFormBuilder;
use Anomaly\UsersModule\User\UserAuthenticator;
use Symfony\Component\HttpFoundation\Response;

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

    /**
     * Handle the validation.
     *
     * @param  UserAuthenticator $authenticator
     * @param  LoginFormBuilder $builder
     * @return bool
     */
    public function handle(UserAuthenticator $authenticator, LoginFormBuilder $builder)
    {
        if (!$response = $authenticator->authenticate($builder->getPostData())) {
            return false;
        }

        if ($response instanceof UserInterface) {
            $builder->setUser($response);
        }

        if ($response instanceof Response) {
            $builder->setFormResponse($response);
        }

        return true;
    }
}

Use post data cause form values won't be here.


<?php

use Parvula\Parvula;
use Parvula\Parvula\Core\Config;
use Parvula\Parvula\Core\Models\Pages;

$templates = new League\Plates\Engine(__DIR__ . '/view', 'html');

$templates->addData([
	'baseUrl' => Parvula::getRelativeURIToRoot(),
	'pluginUrl' => Parvula::getRelativeURIToRoot($that->getPluginPath()),
	'templateUrl' => Parvula::getRelativeURIToRoot(_THEMES_ . $that->app['config']->get('theme'))
]);

$pages = $that->app['pages'];
$pagesList = $pages->index(true);
$templates->addData([
	'pagesList' => $pagesList,
	'_page' => 'admin'
]);

return $templates->render('base');

<?php

use Parvula\Parvula;
use Parvula\Parvula\Core\Config;
use Parvula\Parvula\Core\Models\Pages;

$templates = new League\Plates\Engine(__DIR__ . '/view', 'html');

$templates->addData([
	'baseUrl' => url(),
	'pluginUrl' => url($that->getPluginPath()),
	'templateUrl' => url(themesPath(app('config')->get('theme')))
]);

$pages = app('pages');
$pagesList = $pages->index(true);
$templates->addData([
	'pagesList' => $pagesList,
	'_page' => 'admin'
]);

return $templates->render('base');

Update Admin plugin with the new helpers


<?php

use BearFramework\App;

$app = App::get();

echo '';
echo '<link rel="client-packages-prepare" name="users">';
echo '';
echo '';
$styles = 'background-image:url(' . $app->currentUser->getImageUrl(100) . ');';
$onClick = 'clientPackages.get("users").then(function(users){users.openPreview("' . $app->currentUser->provider . '","' . $app->currentUser->id . '");});';
echo '

';
echo '';

Add aria attributes to the badge element


<?php
require 'vendor/autoload.php';

// Replace /comphppuebla/guzzle for the path to your negotiation.php file to try this route.
// curl --header "Accept: application/xml" http://localhost/comphppuebla/guzzle/negotiation.php

use Negotiation\Negotiator;
use Faker\Factory;
use Twig_Loader_Filesystem as FilesystemLoader;
use Twig_Environment as Environment;

$negotiator = new Negotiator();

$headers = getallheaders();

$format = $negotiator->getBest($headers['Accept']);
$type = $format->getValue();

$template = 'contacts/show.json.twig';
if ('application/xml' ===  $type) {

	$template = 'contacts/show.xml.twig';
}

$loader = new FilesystemLoader('views');
$environment = new Environment($loader);

$faker = Factory::create();

echo $environment->render($template, [
	'contact' => [
		'contact_id' => $faker->randomDigit, 'name' => $faker->name, 'last_name' => $faker->lastName,
	]
]);

<?php
require 'vendor/autoload.php';

// Replace /comphppuebla/guzzle for the path to your negotiation.php file to try this route.
// curl --header "Accept: application/xml" http://localhost/comphppuebla/guzzle/negotiation.php

use Negotiation\Negotiator;
use Faker\Factory;
use Twig_Loader_Filesystem as FilesystemLoader;
use Twig_Environment as Environment;

$negotiator = new Negotiator();

$headers = getallheaders();

$format = $negotiator->getBest($headers['Accept']);
$type = $format->getValue();

$template = 'contacts/show.json.twig';
if ('application/xml' ===  $type) {

	$template = 'contacts/show.xml.twig';
}

$viewLoader = new FilesystemLoader('views');
$view = new Environment($viewLoader);

$faker = Factory::create();

echo $view->render($template, [
	'contact' => [
		'contact_id' => $faker->randomDigit,
		'name' => $faker->firstName,
		'last_name' => $faker->lastName,
	]
]);

Change variable names. Change from name to firstName in the contact information example.


<?php

namespace Orphans\ElasticSearch\App\Providers;

use Illuminate\Support\Facades\App;
use Illuminate\Support\ServiceProvider;

use Elasticsearch\ClientBuilder;

class ElasticSearchServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton('elasticsearch', function($app){
            $es = new ClientBuilder;
            $this->app->instance('elasticsearch', $es->create()->build());
            return $es;
        });
    }
}

<?php

namespace Orphans\ElasticSearch\App\Providers;

use Illuminate\Support\Facades\App;
use Illuminate\Support\ServiceProvider;

use Elasticsearch\ClientBuilder;

class ElasticSearchServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton('elasticsearch', function($app){
            $es = new ClientBuilder;
            $client = $es->create()->build();
            $this->app->instance('elasticsearch', $client);
            return $client;
        });
    }
}

Return instance of Client rather than ClientBuilder


<?php
set_time_limit(0);

// Configuration
include 'config/config.php';

// Version
include 'functions/getVersion.php';
include 'functions/checkVersion.php';

echo "LinMon slave version ".getVersion("version")." started. \n";
echo checkVersion();

while (true){
	echo "Starting data collection \n";
	sleep($config['updateinterval']);
}
?>

<?php
set_time_limit(0);

// Configuration
include 'config/config.php';

// Version
include 'functions/getVersion.php';
include 'functions/checkVersion.php';

echo "LinMon slave version ".getVersion("version")." started. \n";
echo checkVersion();
echo "Collecting data every ".$config['updateinterval']." seconds \n";

while (true){
	echo "Starting data collection \n";
	sleep($config['updateinterval']);
}
?>

Add updateinterval to start message

Add updateinterval to start message


<?php

namespace Nacmartin\PhpExecJs;

use Nacmartin\PhpExecJs\Runtime\ExternalRuntime;
use Nacmartin\PhpExecJs\Runtime\V8jsRuntime;

class RuntimeAutodetector
{
    private $runtimes = array();

    public function __construct()
    {
        // Runners will be checked for availabilty by order in array so order
        // matters
        $this->runtimes[] = new V8jsRuntime('V8js PHP Extension (V8)');
        $this->runtimes[] = new ExternalRuntime('Node.js (V8)', 'node');
    }

    public function autodetect()
    {
        foreach ($this->runtimes as $runtime) {
            if ($runtime->isAvailable()) {
                return $runtime;
            }
        }
        throw new \RuntimeException('PhpExecJs: Cannot autodetect any JavaScript runtime');
    }
}

<?php

namespace Nacmartin\PhpExecJs;

use Nacmartin\PhpExecJs\Runtime\ExternalRuntime;
use Nacmartin\PhpExecJs\Runtime\V8jsRuntime;

class RuntimeAutodetector
{
    private $runtimes = array();

    public function __construct()
    {
        // Runners will be checked for availabilty by order in array so order
        // matters
        $this->runtimes[] = new V8jsRuntime('V8js PHP Extension (V8)');
        $this->runtimes[] = new ExternalRuntime('Node.js (V8)', 'node');
        $this->runtimes[] = new ExternalRuntime('Node.js (V8)', 'nodejs');
    }

    public function autodetect()
    {
        foreach ($this->runtimes as $runtime) {
            if ($runtime->isAvailable()) {
                return $runtime;
            }
        }
        throw new \RuntimeException('PhpExecJs: Cannot autodetect any JavaScript runtime');
    }
}

Add nodejs as a new runtime name

Add nodejs as a new runtime name

On Debian, node js executable is called nodejs, so I suggest adding nodejs as a new runtime name.


@extends(layoutExtend())

@section('title')
    {{ trans('categorie.Translation') }} {{ trans('home.control') }}
@endsection

@section('content')

            {{ trans('admin.Files') }}
            @foreach(LaravelLocalization::getSupportedLocales() as $localeCode => $properties)
                {{ $properties['native'] }}
            @endforeach
            {{ trans('admin.Both') }}

        @foreach($files as $h)

                @php $path = explode(DIRECTORY_SEPARATOR , (string)$h) @endphp
                {{ end($path) }}
                @foreach(LaravelLocalization::getSupportedLocales() as $localeCode => $properties)

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

                @endforeach
                {{ trans('admin.Edit All Language') }}

        @endforeach

@endsection

Fix hard coded "Edit" translation link

Fix hard coded "Edit" translation link

Edit link generates 404 error when using http://localhost/<your-project>/public/en/admin/translation


<?php
    $page_title = 'Home';
    $site_title = 'Racing';
    $site_index = '/racing';
    include '../header.php';
?>

Racing Team

 The IEEE Racing Team builds an electric go-kart to compete in evGrandPrix. In addition to go-karts, the team undertakes small projects such as building an off-road buggy to explore the field of electric motorsports even further.

Contact Erick Figueroa for more details.

<?php include '../footer.php'; ?>

<?php
    $page_title = 'Home';
    $site_title = 'Racing';
    $site_index = '/racing';
    include '../header.php';
?>

Racing Team

 IEEE Racing builds an electric go-kart that competes in the Purdue evGrandPrix that takes place annually at the Indianapolis Motor Speedway. We are looking for members to redesign electrical systems, get sponsors and build industry contacts, improve safety features, and most importantly, have a great time learning about electric vehicle technology.

Team meetings are once a week in the off-season and twice a week during race season. Meetings are broken into planning time where we discuss our project and budget and build sessions where members get hands-on with the go-kart.

All majors are welcome!!

Contact Erick Figueroa for more details.

<?php include '../footer.php'; ?>

Add updated description for Racing

Add updated description for Racing


<?php
namespace GuzzleHttp\Tests\Command\Guzzle;

use GuzzleHttp\Command\Command;
use GuzzleHttp\Command\Guzzle\Description;
use GuzzleHttp\Command\Guzzle\Serializer;
use GuzzleHttp\Psr7\Request;

/**
 * @covers \GuzzleHttp\Command\Guzzle\Serializer
 */
class SerializerTest extends \PHPUnit_Framework_TestCase
{
    public function testAllowsUriTemplates()
    {
        $description = new Description([
            'baseUri' => 'http://test.com',
            'operations' => [
                'test' => [
                    'httpMethod'         => 'GET',
                    'uri'                => '/api/{key}/foo',
                    'parameters'         => [
                        'key' => [
                            'required'  => true,
                            'type'      => 'string',
                            'location'  => 'uri'
                        ],
                    ]
                ]
            ]
        ]);

        $command = new Command('test', ['key' => 'bar']);
        $serializer = new Serializer($description);
        /** @var Request $request */
        $request = $serializer($command);
        $this->assertEquals('http://test.com/api/bar/foo', $request->getUri());
    }
}

<?php
namespace GuzzleHttp\Tests\Command\Guzzle;

use GuzzleHttp\Command\Command;
use GuzzleHttp\Command\Guzzle\Description;
use GuzzleHttp\Command\Guzzle\Serializer;
use GuzzleHttp\Psr7\Request;

/**
 * @covers \GuzzleHttp\Command\Guzzle\Serializer
 */
class SerializerTest extends \PHPUnit_Framework_TestCase
{
    public function testAllowsUriTemplates()
    {
        $description = new Description([
            'baseUri' => 'http://test.com',
            'operations' => [
                'test' => [
                    'httpMethod'         => 'GET',
                    'uri'                => '/api/{key}/foo',
                    'parameters'         => [
                        'key' => [
                            'required'  => true,
                            'type'      => 'string',
                            'location'  => 'uri'
                        ],
                    ]
                ]
            ]
        ]);

        $command = new Command('test', ['key' => 'bar']);
        $serializer = new Serializer($description);
        /** @var Request $request */
        $request = $serializer($command);
        $this->assertEquals('http://test.com/api/bar/foo', $request->getUri());
    }

    public function testAllowsDefaultParameterUriTemplates()
    {
        $description = new Description([
            'baseUri' => 'http://test.com',
            'operations' => [
                'test' => [
                    'httpMethod'         => 'GET',
                    'uri'                => '/api/{key}/foo',
                    'parameters'         => [
                        'key' => [
                            'required'  => true,
                            'type'      => 'string',
                            'location'  => 'uri',
                            'default'   => 'bar',
                        ],
                    ]
                ]
            ]
        ]);

        $command = new Command('test');
        $serializer = new Serializer($description);
        /** @var Request $request */
        $request = $serializer($command);
        $this->assertEquals('http://test.com/api/bar/foo', $request->getUri());
    }
}

Test with default value fails on new query serializer


<?php

namespace Recurly;

class HttpAdapter
{
    private static $_default_options = [
        'ignore_errors' => true
    ];

    public function __construct()
    {

    }

    /**
     * @param string $method   HTTP method to use
     * @param string $url      Fully qualified URL
     * @param array  $body     The request body
     * @param array  $headers  HTTP headers
     */
    public function execute($method, $url, $body, $headers)
    {
        $body = empty($body) ? NULL : json_encode($body);
        $options = array_replace(self::$_default_options, [
            'method' => $method,
            'content' => $body,
        ]);
        $headers_str = "";
        foreach ($headers as $k => $v)
        {
            $headers_str .= "$k: $v\r\n";
        }
        $options['header'] = $headers_str;
        $context = stream_context_create(['http' => $options]);
        $result = file_get_contents($url, false, $context);
        return array($result, $http_response_header);
    }
}

<?php

namespace Recurly;

/**
 * This class abstracts away all the PHP-level HTTP
 * code. This allows us to easily mock out the HTTP
 * calls in BaseClient by injecting a mocked version of
 * this adapter.
 */
class HttpAdapter
{
    private static $_default_options = [
        'ignore_errors' => true
    ];

    /**
     * @param string $method   HTTP method to use
     * @param string $url      Fully qualified URL
     * @param array  $body     The request body
     * @param array  $headers  HTTP headers
     */
    public function execute($method, $url, $body, $headers)
    {
        $body = empty($body) ? NULL : json_encode($body);
        $options = array_replace(self::$_default_options, [
            'method' => $method,
            'content' => $body,
        ]);
        $headers_str = "";
        foreach ($headers as $k => $v)
        {
            $headers_str .= "$k: $v\r\n";
        }
        $options['header'] = $headers_str;
        $context = stream_context_create(['http' => $options]);
        $result = file_get_contents($url, false, $context);
        return array($result, $http_response_header);
    }
}

Add some docs for HttpAdapter

Add some docs for HttpAdapter


<?php

namespace Bolt\Nut;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * Nut command to list all installed extensions
 */
class Extensions extends BaseCommand
{
    /**
     * @see \Symfony\Component\Console\Command\Command::configure()
     */
    protected function configure()
    {
        $this
            ->setName('extensions')
            ->setDescription('Lists all installed extensions')
        ;
    }

    /**
     * @see \Symfony\Component\Console\Command\Command::execute()
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (count($this->app['extend.manager']->getMessages())) {
            foreach ($this->app['extend.manager']->getMessages() as $message) {
                $output->writeln(sprintf('<error>%s</error>', $message));
            }

            return;
        }

        $installed = $this->app['extend.manager']->showPackage('installed');
        $rows = [];

        foreach ($installed as $ext) {
            /** @var \Composer\Package\CompletePackageInterface $package */
            $package = $ext['package'];
            $rows[] = [$package->getPrettyName(), $package->getPrettyVersion(), $package->getType(), $package->getDescription()];
        }

        $table = $this->getHelper('table');
        $table
            ->setHeaders(['Name', 'Version', 'Type',  'Description'])
            ->setRows($rows);
        $table->render($output);
    }
}

<?php

namespace Bolt\Nut;

use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * Nut command to list all installed extensions
 */
class Extensions extends BaseCommand
{
    /**
     * @see \Symfony\Component\Console\Command\Command::configure()
     */
    protected function configure()
    {
        $this
            ->setName('extensions')
            ->setDescription('Lists all installed extensions')
        ;
    }

    /**
     * @see \Symfony\Component\Console\Command\Command::execute()
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (count($this->app['extend.manager']->getMessages())) {
            foreach ($this->app['extend.manager']->getMessages() as $message) {
                $output->writeln(sprintf('<error>%s</error>', $message));
            }

            return;
        }

        $installed = $this->app['extend.manager']->showPackage('installed');
        $rows = [];

        foreach ($installed as $ext) {
            /** @var \Composer\Package\CompletePackageInterface $package */
            $package = $ext['package'];
            $rows[] = [$package->getPrettyName(), $package->getPrettyVersion(), $package->getType(), $package->getDescription()];
        }

        $table = new Table($output);
        $table
            ->setHeaders(['Name', 'Version', 'Type',  'Description'])
            ->setRows($rows)
            ->render()
        ;
    }
}

Move Nut extension command from TableHelper to Table


<?php sleep(2); ?>

Usage

Battery

Play Time

    <fieldset>

            Years
            <input type="text" value="2"/>

            Months
            <input type="text" value="8"/>

            Days
            <input type="text" value="27"/>

    </fieldset>

Better recharge soon!

<?php sleep(2); ?>

Usage

Battery

Play Time

    <fieldset>

            Years
            2

            Months
            8

            Days
            27

    </fieldset>

Better recharge soon!

Update to use <span> instead of <input> for non-modifiable text.

--HG--
extra : convert_revision : svn%3A465e5836-af34-0410-8d6e-35500593c4db/trunk%40153


<?php

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

class CreateSettingsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('settings', function (Blueprint $table) {
            $table->string('key')->unique();
            $table->string('value')->nullable();
        });
    }

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

<?php

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

class CreateSettingsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('settings', function (Blueprint $table) {
            $table->string('key')->unique();
            $table->text('value')->nullable();
        });
    }

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

Change Setting model value column to text type


<?php

/**
 * @package         Billing
 * @copyright       Copyright (C) 2012 BillRun Technologies Ltd. All rights reserved.
 * @license         GNU Affero General Public License Version 3; see LICENSE.txt
 */
defined('APPLICATION_PATH') || define('APPLICATION_PATH', dirname(__DIR__));

require_once(APPLICATION_PATH . DIRECTORY_SEPARATOR . 'conf' . DIRECTORY_SEPARATOR . 'config.php');
$app = new Yaf_Application(BILLRUN_CONFIG_PATH);
$app->bootstrap()->run();

<?php

/**
 * @package         Billing
 * @copyright       Copyright (C) 2012 BillRun Technologies Ltd. All rights reserved.
 * @license         GNU Affero General Public License Version 3; see LICENSE.txt
 */
defined('APPLICATION_PATH') || define('APPLICATION_PATH', dirname(__DIR__));

/* Set expiration time to one hour */
session_set_cookie_params(60 * 60);
require_once(APPLICATION_PATH . DIRECTORY_SEPARATOR . 'conf' . DIRECTORY_SEPARATOR . 'config.php');
$app = new Yaf_Application(BILLRUN_CONFIG_PATH);
$app->bootstrap()->run();

Set expiration time for one hour

Set expiration time for one hour


<?php

try {

    /**
     * Use composer autoloader
     */

    if (!file_exists($composerAutoload = __DIR__ . '/../vendor/autoload.php')) {
        header('HTTP/1.1 500');
        die("
Server Error

Composer vendors are not installed on the server.
");
    }

    require_once $composerAutoload;
    unset($composerAutoload);

    /**
     * Read the configuration
     */
    $config = include __DIR__ . "/../app/config/config.php";

    /**
     * Read auto-loader
     */
    include __DIR__ . "/../app/config/loader.php";

    /**
     * Read services
     */
    include __DIR__ . "/../app/config/services.php";

    /**
     * Read environment
     */
    if (file_exists($environment = __DIR__ . "/../environment.php")) include $environment;

    /**
     * Handle the request
     */
    $application = new \Phalcon\Mvc\Application($di);

    echo $application->handle()->getContent();

} catch (\Exception $e) {

    /**
     * Clear the buffer and show the 500 error page
     */
    if (!DEV_MODE) {
        ob_flush();
        header('HTTP/1.1 500 Internal Server Error', true, 500);
        include __DIR__ .'/maintenance/error-500.html';
    }

    throw $e;
}

<?php

try {

    /**
     * Use composer autoloader
     */

    if (!file_exists($composerAutoload = __DIR__ . '/../vendor/autoload.php')) {
        header('HTTP/1.1 500');
        die("
Server Error

Composer vendors are not installed on the server.
");
    }

    require_once $composerAutoload;
    unset($composerAutoload);

    /**
     * Read the configuration
     */
    $config = include __DIR__ . "/../app/config/config.php";

    /**
     * Read auto-loader
     */
    include __DIR__ . "/../app/config/loader.php";

    /**
     * Read services
     */
    include __DIR__ . "/../app/config/services.php";

    /**
     * Handle the request
     */
    $application = new \Phalcon\Mvc\Application($di);

    echo $application->handle()->getContent();

} catch (\Exception $e) {

    /**
     * Clear the buffer and show the 500 error page
     */
    if (!DEV_MODE) {
        ob_flush();
        header('HTTP/1.1 500 Internal Server Error', true, 500);
        include __DIR__ .'/maintenance/error-500.html';
    }

    throw $e;
}

Remove old check for environment.php (replaced with config.php)


<?php

namespace YouFood\ApiBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;

/**
 * OrderType
 *
 * @author Adrien Brault <adrien.brault@gmail.com>
 */
class OrderType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilder $builder, array $options)
    {
        $builder->add('collations', 'entity', array(
            'class' => 'YouFoodMainBundle:Collation',
            'multiple' => true,
        ));
        $builder->add('menus', 'entity', array(
            'class' => 'YouFoodMainBundle:Menu',
            'multiple' => true,
        ));
    }

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

    /**
     * {@inheritdoc}
     */
    public function getDefaultOptions()
    {
        return array(
            'csrf_protection' => false,
        );
    }
}

<?php

namespace YouFood\ApiBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

/**
 * OrderType
 *
 * @author Adrien Brault <adrien.brault@gmail.com>
 */
class OrderType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('collations', 'entity', array(
            'class' => 'YouFoodMainBundle:Collation',
            'multiple' => true,
        ));
        $builder->add('menus', 'entity', array(
            'class' => 'YouFoodMainBundle:Menu',
            'multiple' => true,
        ));
    }

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

    /**
     * {@inheritdoc}
     */
    public function getDefaultOptions()
    {
        return array(
            'csrf_protection' => false,
        );
    }
}

Update form to new interface ...

Update form to new interface ...


@extends('page::page-layouts.main-page')

@section('content')

                    Articles

@endsection

@extends('page::page-layouts.main-page')

@section('content')

                @each('page::markdown.markdown-posts', collect(MKD::markdownPosts()), 'post')

@endsection

Include posts view using @each

Include posts view using @each


<?php
$entities = array();
try {
  $res = civicrm_api3('FinancialType', 'getSingle', array("name" => "Donation", 'return' => array('id')));
}
catch (CiviCRM_API3_Exception $e) {
  $res = NULL;
}
if (!$res) {
  $entites[] = array(
    'name' => 'au.org.greens.raisely',
    'entity' => 'FinancialType',
    'params' => array(
      'version' => 3,
      'name' => 'Donation',
      'description' => 'Donation',
      'is_reserved' => 1,
      'is_active' => 1,
    ),
  );
}
try {
  $res = civicrm_api3('LocationType', 'getsingle', array('name' => 'Previous', 'return' => array('id')));
}
catch (CiviCRM_API3_Exception $e) {
  $res = NULL;
}
if (!$res) {
  $entites[] = array(
    'name' => 'au.org.greens.raisely',
    'entity' => 'LocationType',
    'params' => array(
      'version' => 3,
      'name' => 'Previous',
      'description' => 'For old addresses no longer valid',
      'is_active' => 1,
      'is_reserved' => 1,
      'is_default' => 0,
    ),
  );
}
return $entites;

<?php
$entities = array();
try {
  $res = civicrm_api3('FinancialType', 'getsingle', array("name" => "Donation", 'return' => array('id')));
}
catch (CiviCRM_API3_Exception $e) {
  $res = NULL;
}
if (!$res) {
  $entities[] = array(
    'name' => 'au.org.greens.raisely',
    'module' => 'au.org.greens.raisely',
    'entity' => 'FinancialType',
    'params' => array(
      'version' => 3,
      'name' => 'Donation',
      'description' => 'Donation',
      'is_reserved' => 1,
      'is_active' => 1,
    ),
  );
}
try {
  $res = civicrm_api3('LocationType', 'getsingle', array('name' => 'Previous', 'return' => array('id')));
}
catch (CiviCRM_API3_Exception $e) {
  $res = NULL;
}
if (!$res) {
  $entities[] = array(
    'name' => 'au.org.greens.raisely',
    'module' => 'au.org.greens.raisely',
    'entity' => 'LocationType',
    'params' => array(
      'version' => 3,
      'name' => 'Previous',
      'description' => 'For old addresses no longer valid',
      'is_active' => 1,
      'is_reserved' => 1,
      'is_default' => 0,
    ),
  );
}
return $entities;

Add module key to $entities arrays, fix typos


<?php

namespace App\Console\Commands;

use App\Models\Factories\ItemFactory;
use Illuminate\Console\Command;

class AddItem extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'add:url {url}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Add a new Item to the queue by providing a URL';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        // Fetch plausible user
        $owner = User::all()->first();

        // Create an item from the URL and try to save it
        $item = ItemFactory::create([
            'user_id' => $owner->id,
            'details' => ['url' => $this->argument('url')]
        ]);
        $item->save();
    }
}

<?php

namespace App\Console\Commands;

use App\Models\Factories\ItemFactory;
use App\Models\User;
use Illuminate\Console\Command;

class AddItem extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'add:url {url}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Add a new Item to the queue by providing a URL';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        // Fetch plausible user
        $owner = User::all()->first();

        // Create an item from the URL and try to save it
        $item = ItemFactory::create([
            'user_id' => $owner->id,
            'details' => ['url' => $this->argument('url')]
        ]);
        $item->save();
    }
}

Fix add:url command not importing User

Fix add:url command not importing User


<?php

use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $model app\models\EfProject */

$this->title = 'Update Ef Project: ' . ' ' . $model->PROJECT_ID;
$this->params['breadcrumbs'][] = ['label' => 'Ef Projects', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->PROJECT_ID, 'url' => ['view', 'id' => $model->PROJECT_ID]];
$this->params['breadcrumbs'][] = 'Update';
?>

<?= Html::encode($this->title) ?>

    <?= $this->render('_form', [
        'model' => $model,
        'documentUploadForm' => $documentUploadForm,
        'documentUploadFormConfigs' => $documentUploadFormConfigs,
        'imageUploadForm' => $imageUploadForm,
        'imageUploadFormConfigs' => $imageUploadFormConfigs
    ]) ?>

<?php

use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $model app\models\EfProject */

$this->title = 'Update Ef Project: ' . ' ' . $model->PROJECT_ID;
$this->params['breadcrumbs'][] = ['label' => 'Ef Projects', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->PROJECT_ID, 'url' => ['view', 'id' => $model->PROJECT_ID]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="ef-project-update">

    <?= $this->render('_form', [
        'model' => $model,
        'documentUploadForm' => $documentUploadForm,
        'documentUploadFormConfigs' => $documentUploadFormConfigs,
        'imageUploadForm' => $imageUploadForm,
        'imageUploadFormConfigs' => $imageUploadFormConfigs
    ]) ?>

</div>

Remove the duplicate header in edit project page.


<?php namespace GovTribe\LaravelKinvey\Database\Eloquent;

use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;

class User extends Model implements UserInterface, RemindableInterface {

	/**
	 * The collection associated with the model.
	 *
	 * @var string
	 */
	protected $collection = 'user';

	/**
	 * Suspend users instead of deleting them.
	 *
	 * @var bool
	 */
	protected $softDelete = true;

	/**
	 * Get the unique identifier for the user.
	 *
	 * @return mixed
	 */
	public function getAuthIdentifier()
	{
		return $this->_id;
	}

	/**
	 * Get the password for the user.
	 *
	 * @return string
	 */
	public function getAuthPassword()
	{
		return $this->password;
	}

    /**
     * Get the unique identifier for the user.
     *
     * @return mixed
     */
    public function getAuthIdentifier()
    {
        return $this->getKey();
    }

	/**
	 * Get the e-mail address where password reminders are sent.
	 *
	 * @return string
	 */
	public function getReminderEmail()
	{
		return $this->username;
	}
}

<?php namespace GovTribe\LaravelKinvey\Database\Eloquent;

use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;

class User extends Model implements UserInterface, RemindableInterface {

	/**
	 * The collection associated with the model.
	 *
	 * @var string
	 */
	protected $collection = 'user';

	/**
	 * Suspend users instead of deleting them.
	 *
	 * @var bool
	 */
	protected $softDelete = true;

	/**
	 * Get the unique identifier for the user.
	 *
	 * @return mixed
	 */
	public function getAuthIdentifier()
	{
		return $this->_id;
	}

	/**
	 * Get the password for the user.
	 *
	 * @return string
	 */
	public function getAuthPassword()
	{
		return $this->password;
	}

	/**
	 * Get the e-mail address where password reminders are sent.
	 *
	 * @return string
	 */
	public function getReminderEmail()
	{
		return $this->username;
	}
}

Remove duplicate method in the user model.


<?php

namespace Coreplex\Meta\Managers;

use Illuminate\Support\Manager;
use Coreplex\Meta\Eloquent\Repository as EloquentRepository;

class Store extends Manager
{
    public function createEloquentDriver()
    {
        return new EloquentRepository;
    }

    /**
     * Get the default authentication driver name.
     *
     * @return string
     */
    public function getDefaultDriver()
    {
        return $this->container['config']['drivers.store'];
    }

    /**
     * Set the default authentication driver name.
     *
     * @param  string $name
     * @return void
     */
    public function setDefaultDriver($name)
    {
        $this->container['config']['drivers.store'] = $name;
    }
}

<?php

namespace Coreplex\Meta\Managers;

use Illuminate\Support\Manager;
use Coreplex\Meta\Eloquent\Repository as EloquentRepository;

class Store extends Manager
{
    public function createEloquentDriver()
    {
        return new EloquentRepository;
    }

    /**
     * Get the default authentication driver name.
     *
     * @return string
     */
    public function getDefaultDriver()
    {
        $container = ! empty($this->container) ? $this->container : $this->app;

        return $container['config']['drivers.store'];
    }

    /**
     * Set the default authentication driver name.
     *
     * @param  string $name
     * @return void
     */
    public function setDefaultDriver($name)
    {
        $container = ! empty($this->container) ? $this->container : $this->app;

        $container['config']['drivers.store'] = $name;
    }
}

Update to ensure backwards compatibility for Laravel 5.8 and below


<?php

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

class CreateWatches extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('watches', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('user_id')->unsigned();
            $table->enum('notifiable_type', ['beatmapset', 'build', 'news_post']);
            $table->bigInteger('notifiable_id')->unsigned();
            $table->string('subtype');
            $table->timestampsTz();

            $table->unique(['user_id', 'notifiable_type', 'notifiable_id', 'subtype']);
            $table->index(['notifiable_type', 'notifiable_id']);
        });
    }

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

<?php

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

class CreateWatches extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('watches', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('user_id')->unsigned();
            $table->enum('notifiable_type', ['beatmapset', 'build', 'news_post']);
            $table->bigInteger('notifiable_id')->unsigned();
            $table->enum('subtype', ['comment']);
            $table->timestampsTz();

            $table->unique(['user_id', 'notifiable_type', 'notifiable_id', 'subtype']);
            $table->index(['notifiable_type', 'notifiable_id']);
        });
    }

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

Use enum for subtype as well

Use enum for subtype as well


<?php

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

use Camspiers\StatisticalClassifier\Config\Config;
use Camspiers\StatisticalClassifier\Console\Command\GenerateContainerCommand;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;

if (!file_exists(Config::getConfigOption('container_dir') . '/StatisticalClassifierServiceContainer.php')) {
    $command = new GenerateContainerCommand();
    $command->run(
        new ArrayInput(array()),
        new NullOutput()
    );
}

<?php

$files = array(
    __DIR__ . '/../vendor/autoload.php',
    __DIR__ . '/../../../autoload.php'
);

$loader = false;

foreach ($files as $file) {
    if (file_exists($file)) {
        $loader = require_once $file;
        break;
    }
}

if (!$loader instanceof \Composer\Autoload\ClassLoader) {
    echo 'You must first install the vendors using composer.' . PHP_EOL;
    exit(1);
}

use Camspiers\StatisticalClassifier\Config\Config;
use Camspiers\StatisticalClassifier\Console\Command\GenerateContainerCommand;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;

if (!file_exists(Config::getConfigOption('container_dir') . '/StatisticalClassifierServiceContainer.php')) {
    $command = new GenerateContainerCommand();
    $command->run(
        new ArrayInput(array()),
        new NullOutput()
    );
}

Support installation as a vendor

UPDATE: Support installation as a vendor


<?php

namespace phpSmug\Tests;

/**
 * @class
 * Test properties of our codebase rather than the actual code.
 */
class PsrComplianceTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @test
     */
    public function testPSR()
    {
        // If we can't find the command-line tool, we mark the test as skipped
        // so it shows as a warning to the developer rather than passing silently.
        if (!file_exists('vendor/bin/php-cs-fixer')) {
            $this->markTestSkipped(
                'Needs linter to check PSR compliance'
            );
        }

        // Let's check all PSR compliance for our code and tests.
        // Add any other pass you want to test to this array.
        foreach (array('lib/', 'examples/', 'test/') as $path) {
            // Run linter in dry-run mode so it changes nothing.
            exec(
                escapeshellcmd('vendor/bin/php-cs-fixer fix --dry-run '.$_SERVER['PWD']."/$path"),
                $output,
                $return_var
            );

            // If we've got output, pop its first item ("Fixed all files...")
            // and trim whitespace from the rest so the below makes sense.
            if ($output) {
                array_pop($output);
                $output = array_map('trim', $output);
            }

            // Check shell return code: if nonzero, report the output as a failure.
            $this->assertEquals(
                0,
                $return_var,
                "PSR linter reported errors in $path: \n\t".implode("\n\t", $output)
            );
        }
    }
}

<?php

namespace phpSmug\Tests;

/**
 * @class
 * Test properties of our codebase rather than the actual code.
 */
class PsrComplianceTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @test
     */
    public function testPSR()
    {
        // If we can't find the command-line tool, we mark the test as skipped
        // so it shows as a warning to the developer rather than passing silently.
        if (!file_exists('vendor/bin/php-cs-fixer')) {
            $this->markTestSkipped(
                'Needs linter to check PSR compliance'
            );
        }

        // Let's check all PSR compliance for our code and tests.
        // Add any other pass you want to test to this array.
        foreach (array('lib/', 'examples/', 'test/') as $path) {
            // Run linter in dry-run mode so it changes nothing.
            exec(
                escapeshellcmd('vendor/bin/php-cs-fixer fix -v --dry-run '.$_SERVER['PWD']."/$path"),
                $output,
                $return_var
            );

            // If we've got output, pop its first item ("Fixed all files...")
            // and trim whitespace from the rest so the below makes sense.
            if ($output) {
                array_pop($output);
                $output = array_map('trim', $output);
            }

            // Check shell return code: if nonzero, report the output as a failure.
            $this->assertEquals(
                0,
                $return_var,
                "PSR linter reported errors in $path: \n\t".implode("\n\t", $output)
            );
        }
    }
}

Make psr test more verbose

Make psr test more verbose


<?php

namespace Concrete\Tests\Update;

use Concrete\TestHelpers\DockerTrait;
use PHPUnit_Framework_TestCase;

/**
 * @group docker
 */
class InstallUpdateTest extends PHPUnit_Framework_TestCase
{
    use DockerTrait;

    public function testFullInstallation()
    {
        $this->runScriptInDocker('mlocati/docker5:8.5.2-full', 'run-install.sh');
    }

    public function testUpdatePreviousInstallation()
    {
        $this->runScriptInDocker('mlocati/docker5:8.5.2-full', 'run-update.sh');
    }
}

<?php

namespace Concrete\Tests\Update;

use Concrete\TestHelpers\DockerTrait;
use PHPUnit_Framework_TestCase;

/**
 * @group docker
 */
class InstallUpdateTest extends PHPUnit_Framework_TestCase
{
    use DockerTrait;

    public function testFullInstallation()
    {
        $this->runScriptInDocker('mlocati/docker5:8.5.2-full', 'run-install.sh');
    }

    public function testUpdatePreviousInstallation()
    {
        $this->runScriptInDocker('mlocati/docker5:5.7.5.13-full', 'run-update.sh');
    }
}

Test upgrading from concrete5 5.7.5.13

Test upgrading from concrete5 5.7.5.13


<?php

namespace App\Models;

/**
 * @property int            $id
 * @property string         $username
 * @property string         $user_id
 * @property DeviantartUser $user     (Via relations)
 * @method static PreviousUsername|PreviousUsername[] find_by_username(string $username)
 */
class PreviousUsername extends NSModel {
  public static $belongs_to = [
    ['user', 'class' => 'DeviantartUser'],
  ];

  public static function record(string $user_id, string $username) {
    if (self::exists(['username' => $username]))
      return;

    self::create([
      'username' => $username,
      'user_id' => $user_id,
    ]);
  }
}

<?php

namespace App\Models;

/**
 * @property int            $id
 * @property string         $username
 * @property string         $user_id
 * @property DeviantartUser $user     (Via relations)
 * @method static PreviousUsername|PreviousUsername[] find_by_username(string $username)
 */
class PreviousUsername extends NSModel {
  public static $belongs_to = [
    ['user', 'class' => 'DeviantartUser', 'foreign_key' => 'user_id'],
  ];

  public static function record(string $user_id, string $username) {
    if (self::exists(['username' => $username]))
      return;

    self::create([
      'username' => $username,
      'user_id' => $user_id,
    ]);
  }
}

Fix redirection based on previous usernames


<?php
  function authenticate($conn, $device_name, $password) {
    $sql = $conn->prepare("SELECT * FROM devices WHERE name = ?");
    $sql = $conn->bind_param("s", $device_name);
    $sql->execute();
    $device = $sql->get_result()->fetch_assoc();
    if ($device["approved"] && password_verify($password, $device["hash"])) {
      return true;
    } else {
      return false;
    }
  }
?>

<?php
  function authenticate($conn, $device_name, $password) {
    $sql = $conn->prepare("SELECT * FROM devices WHERE name = ?");
    $sql = $conn->bind_param("s", $device_name);
    $sql->execute();
    $result = $sql->get_result();
    if ($result->num_rows == 1) {
      $device = $result->fetch_assoc();
      if ($device["approved"] && password_verify($password, $device["hash"])) {
        return true;
      } else {
        return false;
      }
    } else {
      return false;
    }
  }
?>

Make sure that there is only 1 such device


<?php
/**
 * Wingman
 *
 * @link      http://github.com/mleko/wingman
 * @copyright Copyright (c) 2017 Daniel Król
 * @license   MIT
 */

namespace Mleko\Wingman;

use Mleko\Wingman\IO\Output;

class MistakeChecker
{
    private static $possibleMistakes = [
        "tags" => "keywords",
        "desc" => "description",
        "author" => "authors",
        "bugs" => "support",
        "dependencies" => "require",
        "devDependencies" => "require-dev",
        "optionalDependencies" => "suggests"
    ];

    private $rules = [];

    /**
     * MistakeChecker constructor.
     * @param array $rules
     */
    public function __construct(array $rules = null)
    {
        $this->rules = null === $rules ? static::$possibleMistakes : $rules;
    }

    public function checkForMistakes($composerJson, Output $output)
    {
        $mistakes = array_intersect_key($this->rules, (array)$composerJson);
        if (!$mistakes) {
            return;
        }
        $output->write("Potential mistakes have been found\n");
        foreach ($mistakes as $from => $to) {
            $output->write("$from => $to\n");
        }
    }
}

<?php
/**
 * Wingman
 *
 * @link      http://github.com/mleko/wingman
 * @copyright Copyright (c) 2017 Daniel Król
 * @license   MIT
 */

namespace Mleko\Wingman;

use Mleko\Wingman\IO\Output;

class MistakeChecker
{
    private static $possibleMistakes = [
        "tags" => "keywords",
        "desc" => "description",
        "author" => "authors",
        "bugs" => "support",
        "dependencies" => "require",
        "devDependencies" => "require-dev",
        "optionalDependencies" => "suggests"
    ];

    private $rules = [];

    /**
     * MistakeChecker constructor.
     * @param array $rules
     */
    public function __construct(array $rules = null)
    {
        $this->rules = null === $rules ? self::$possibleMistakes : $rules;
    }

    public function checkForMistakes($composerJson, Output $output)
    {
        $mistakes = array_intersect_key($this->rules, (array)$composerJson);
        if (empty($mistakes)) {
            return;
        }
        $output->write("Potential mistakes have been found\n");
        foreach ($mistakes as $from => $to) {
            $output->write("$from => $to\n");
        }
    }
}

Use empty to check for empty array

Use empty to check for empty array


<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class API extends CI_Controller {
    public function index()
    {
        $this->load->view('API/index');
    }

    public function comparativos(){
        $comparativo = array("Volvo", "BMW", "Toyota","Volvo", "BMW", "<button>Ver</button>");
        $this->output->set_content_type('application/json');
        $this->output->set_output('{"aaData":['.json_encode($comparativo)."]}");
    }
}

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class API extends CI_Controller {
    public function index()
    {
        $this->load->view('API/index');
    }

    public function comparativos(){
        $comparativo = array("Volvo", "BMW", "Toyota","Volvo", "BMW", "<button>Ver</button>");
        $this->output->set_content_type('application/json');
        $this->output->set_output(json_encode(array('Comparativos'=> $comparativo)));
    }
}

Revert "Ariel - Avances de "La borra  del cafe 1""

This reverts commit ba96a3f7fcb37ee54fc386713f1686447a0866d2.


<?php
/**
 * Created by PhpStorm.
 * User: inste
 * Date: 07.09.2015
 * Time: 16.17
 */

$langs = [
    'en'    => 'English',
    'no'    => 'Norsk',
];
if(!isset($_SESSION['lang'])){
    $_SESSION['lang'] = 'en';
}

if(isset($_POST['lang'])){
    $_SESSION['lang'] = $_POST['lang'];
}

function trans($index, $replace = ''){
    global $langs;
    $text = include('lang/'.$langs[$_SESSION['lang']].'.php');
    $text = $text[$index];
    if($replace !== ''){
        foreach($replace as $key => $word){
            $text = str_replace(':'.$key, $word, $text);
        }
    }
    $text = htmlentities($text);
    $text = str_replace(["<i>", "<b>", "</i>", "</b>", "<br />", "<br/>"], ["", "", "", "", "
", "
"], $text);
    return $text;
}

<?php
/**
 * Created by PhpStorm.
 * User: inste
 * Date: 07.09.2015
 * Time: 16.17
 */

$langs = [
    'en'    => 'English',
    'no'    => 'Norsk',
];
if(!isset($_SESSION['lang'])){
    $_SESSION['lang'] = 'en';
}
else{
    $_SESSION['lang'] = $_POST['lang'];
}

function trans($index, $replace = ''){
    global $langs;
    $text = include('lang/'.$langs[$_SESSION['lang']].'.php');
    $text = $text[$index];
    if($replace !== ''){
        foreach($replace as $key => $word){
            $text = str_replace(':'.$key, $word, $text);
        }
    }
    $text = htmlentities($text);
    $text = str_replace(["<i>", "<b>", "</i>", "</b>", "<br />", "<br/>"], ["", "", "", "", "
", "
"], $text);
    return $text;
}

Replace if with just an else

Replace if with just an else


<?php

namespace JwPersistentUser;

use JwPersistentUser\Service\CookieAuthenticationService;
use Zend\EventManager\EventInterface;
use Zend\EventManager\EventManager;
use Zend\ModuleManager\Feature;
use Zend\ServiceManager\ServiceManager;

class Module implements
    Feature\ConfigProviderInterface,
    Feature\BootstrapListenerInterface,
    Feature\AutoloaderProviderInterface
{
    public function getConfig()
    {
        return include __DIR__ . '/config/module.config.php';
    }

    public function onBootstrap(EventInterface $e)
    {
        /** @var EventManager $em */
        $em = $e->getApplication()->getEventManager();

        /** @var ServiceManager $sm */
        $sm = $e->getApplication()->getServiceManager();

        $request = $e->getApplication()->getRequest();
        $response = $e->getApplication()->getResponse();

        // Try to login from Cookie if applicable
        $service = new CookieAuthenticationService($sm);
        $service->setEventManager($em);
        $service->loginFrom($request, $response);
    }

    public function getAutoloaderConfig()
    {
        return [
            'Zend\Loader\StandardAutoloader' => [
                'namespaces' => [
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ],
            ],
        ];
    }
}

<?php

namespace JwPersistentUser;

use JwPersistentUser\Service\CookieAuthenticationService;
use Zend\EventManager\EventInterface;
use Zend\EventManager\EventManager;
use Zend\ModuleManager\Feature;
use Zend\ServiceManager\ServiceManager;

class Module implements
    Feature\ConfigProviderInterface,
    Feature\BootstrapListenerInterface,
    Feature\AutoloaderProviderInterface
{
    public function getConfig()
    {
        return include __DIR__ . '/config/module.config.php';
    }

    public function onBootstrap(EventInterface $e)
    {
        /** @var EventManager $em */
        $em = $e->getApplication()->getEventManager();

        /** @var ServiceManager $sm */
        $sm = $e->getApplication()->getServiceManager();

        $request = $e->getApplication()->getRequest();
        $response = $e->getApplication()->getResponse();

        // Try to login from Cookie if applicable
        $service = new CookieAuthenticationService($sm);
        $service->setEventManager(new EventManager($em->getSharedManager()));
        $service->loginFrom($request, $response);
    }

    public function getAutoloaderConfig()
    {
        return [
            'Zend\Loader\StandardAutoloader' => [
                'namespaces' => [
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ],
            ],
        ];
    }
}

Fix shared event manager when used in ZF3


<?php

namespace MinePlus\WebSocketBundle;

use Symfony\Component\Console\Output\OutputInterface;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;

class Chat implements MessageComponentInterface {

    protected $clients;

    protected $output;

    public function __construct(OutputInterface $output)
    {
        $this->clients = new \SplObjectStorage;
        $this->output = $output;
    }

    public function onOpen(ConnectionInterface $conn)
    {
        $this->clients->attach($conn);
        $this->output->writeln('New Connection: '.$conn->resourceId);
    }

    public function onMessage(ConnectionInterface $from, $msg)
    {
        $this->output->writeln($from->resourceId.': '.$msg);
        $this->broadcast($msg);
    }

    public function onClose(ConnectionInterface $conn)
    {
        $this->clients->detach($conn);
        $this->output->writeln('Lost Connection: '.$conn->resourceId);
    }

    public function onError(ConnectionInterface $conn, \Exception $e)
    {
        $conn->close();
    }

    private function broadcast($msg, $exception = null)
    {
        foreach ($this->clients as $client)
        {
            if ($exception != $client) $client->send($msg);
        }
    }

}

?>

<?php

namespace MinePlus\WebSocketBundle;

use Symfony\Component\Console\Output\OutputInterface;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;

class Chat implements MessageComponentInterface {

    protected $clients;

    protected $output;

    public function __construct(OutputInterface $output)
    {
        $this->clients = new \SplObjectStorage;
        $this->output = $output;
    }

    public function onOpen(ConnectionInterface $conn)
    {
        $this->clients->attach($conn);
        $this->output->writeln('New Connection: '.$conn->resourceId);
    }

    public function onMessage(ConnectionInterface $from, $msg)
    {
        $this->output->writeln($from->resourceId.': '.$msg);
        $this->broadcast($msg);
    }

    public function onClose(ConnectionInterface $conn)
    {
        $this->clients->detach($conn);
        $this->output->writeln('Lost Connection: '.$conn->resourceId);
    }

    public function onError(ConnectionInterface $conn, \Exception $e)
    {
        $conn->close();
    }

    private function broadcast($msg, $exception = null)
    {
        foreach ($this->clients as $client)
        {
            if ($exception != $client) $client->send($msg);
        }
    }

    private function send($client, $msg)
    {
        if (is_object($client)) {
            $client->send($msg);
        } else if (is_int($client)) {
            foreach ($this->clients as $c) {
                if ($c->resourceId == $client) {
                    $c->send($msg);
                }
            }
        }
    }

}

?>

Add send() method to chat object.

Add send() method to chat object.


<?php namespace Pingpong\Modules;

use Illuminate\Foundation\Application;
use Illuminate\Support\Str;

class ModuleFinder
{
	/**
	 * @var \Illuminate\Foundation\Application
	 */
	protected $app;

	/**
	 * Constructor.
	 *
	 * @param \Illuminate\Foundation\Application $app
	 */
	public function __construct(Application $app)
	{
		$this->app = $app;
		$this->files = $app['files'];
	}

	/**
	 * Get all modules.
	 *
	 * @return 	array
	 */
	public function all()
	{
		$modules = array();
		foreach ($this->getDirectories() as $module) {
			$name = basename($module);
			if( ! Str::startsWith($name, '.'))
			{
				$modules[] = $name;
			}
		}
		return $modules;
	}

	/**
	 * Get all directories from modules path.
	 *
	 * @return 	string
	 */
	protected function getDirectories()
	{
		return $this->files->directories($this->getModulesPath());
	}

	/**
	 * Get modules path.
	 *
	 * @return 	string
	 */
	protected function getModulesPath()
	{
		return $this->app['modules']->getPath();
	}
}

<?php namespace Pingpong\Modules;

use Illuminate\Foundation\Application;
use Illuminate\Support\Str;

class ModuleFinder
{
	/**
	 * @var \Illuminate\Foundation\Application
	 */
	protected $app;

	/**
	 * Constructor.
	 *
	 * @param \Illuminate\Foundation\Application $app
	 */
	public function __construct(Application $app)
	{
		$this->app = $app;
		$this->files = $app['files'];
	}

	/**
	 * Get all modules.
	 *
	 * @return 	array
	 */
	public function all()
	{
		$modules = array();
		if($this->getDirectories())
		{
			foreach ($this->getDirectories() as $module) {
				$name = basename($module);
				if( ! Str::startsWith($name, '.'))
				{
					$modules[] = $name;
				}
			}
		}
		return $modules;
	}

	/**
	 * Get all directories from modules path.
	 *
	 * @return 	string
	 */
	protected function getDirectories()
	{
		if(is_dir($dir = $this->getModulesPath()))
		{
			return $this->files->directories($dir);
		}
		return null;
	}

	/**
	 * Get modules path.
	 *
	 * @return 	string
	 */
	protected function getModulesPath()
	{
		return $this->app['modules']->getPath();
	}
}

Fix artisan error for empty module

Fix artisan error for empty module


<?php
namespace Concrete\Core\Config;

use Illuminate\Config\FileLoader;
use Illuminate\Filesystem\Filesystem;

class ConfigLoader extends FileLoader {

    protected $config;

    public function __construct(Filesystem $files, Config $config) {
        $this->config = $config;
        parent::__construct($files, DIR_APPLICATION . '/config');
        $this->addNamespace('core', DIR_BASE . '/concrete/config');
    }

    public function load($environment, $group, $namespace = null)
    {
        if (is_null($namespace)) {
            return array_replace_recursive(
                parent::load($environment, $group, 'core'),
                parent::load($environment, $group, $namespace)
                (array) parent::load($environment, $group, 'core'),
                (array) parent::load($environment, $group, $namespace)
            );
        }
        return parent::load($environment, $group, $namespace);
    }

}

<?php
namespace Concrete\Core\Config;

use Illuminate\Config\FileLoader;
use Illuminate\Filesystem\Filesystem;

class ConfigLoader extends FileLoader {

    protected $config;

    public function __construct(Filesystem $files, Config $config) {
        $this->config = $config;
        parent::__construct($files, DIR_APPLICATION . '/config');
        $this->addNamespace('core', DIR_BASE . '/concrete/config');
    }

    public function load($environment, $group, $namespace = null)
    {
        if (is_null($namespace)) {
            return array_replace_recursive(
                (array) parent::load($environment, $group, 'core'),
                (array) parent::load($environment, $group, $namespace)
            );
        }
        return parent::load($environment, $group, $namespace);
    }

}

Convert everything other than assets to app config

We're using Laravel's config resolving classes:

```PHP
$config = $app->make('config');
$config->get('app.version'); // '5.7.0b2'
```


  <?php echo '
CollectionEvent Tuple Count: ' . $collecEvent . '
'; ?>
  <?php echo '
Locality Tuple Count: ' . $locality . '
'; ?>
  <?php echo '
PaleoContext Tuple Count: ' . $paleo . '
'; ?>
  <?php echo '
Specimen Tuple Count: ' . $specimen . '
'; ?>
  <?php echo '
TaxonDetermination Tuple Count: ' . $taxonD . '
'; ?>

Total: <?php echo $totalCount ?>

      Collection Event
      Locality
      Paleo Context
      Specimen
      Taxon Determination
      Total

      <?php echo $collecEvent ?>
      <?php echo $locality ?>
      <?php echo $paleo ?>
      <?php echo $specimen ?>
      <?php echo $taxonD ?>
      <?php echo $totalCount ?>

Change Tuple count view to use html table


<?php
// Check for empty fields
if(empty($_POST['name'])  		||
   empty($_POST['email']) 		||
   empty($_POST['message'])	||
   !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
   {
	echo "No arguments Provided!";
	return false;
   }

$name = $_POST['name'];
$email_address = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];

// Create the email and send the message
$to = 'hello@zing.org.uk'; // Add your email address inbetween the '' replacing yourname@yourdomain.com - This is where the form will send a message to.
$email_subject = "Website Contact Form:  $name";
$email_body = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $email_address\n\nPhone: $phone\n\nMessage:\n$message";
$headers = "From: noreply@zing.org.uk\n"; // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com.
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
return true;
?>

<?php
// Check for empty fields
if(empty($_POST['name'])  		||
   empty($_POST['email']) 		||
   empty($_POST['message'])	||
   !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
   {
	echo "No arguments Provided!";
	return false;
   }

$name = $_POST['name'];
$email_address = $_POST['email'];
$message = $_POST['message'];

// Create the email and send the message
$to = 'hello@zing.org.uk'; // Add your email address inbetween the '' replacing yourname@yourdomain.com - This is where the form will send a message to.
$email_subject = "Website Contact Form:  $name";
$email_body = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $email_address\n\nMessage:\n$message";
$headers = "From: noreply@zing.org.uk\n"; // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com.
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
return true;
?>

Remove phone number from email body

Remove phone number from email body


<?php

declare(strict_types=1);

/**
 * @author Christoph Wurst <wurst.christoph@gmail.com>
 * @author Lukas Reschke <lukas@owncloud.com>
 * @author Thomas Müller <thomas.mueller@tmit.eu>
 *
 * Mail
 *
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License, version 3,
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 */

namespace OCA\Mail\Http;

use OCP\AppFramework\Http\Response;

class HtmlResponse extends Response {

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

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

	/**
	 * Simply sets the headers and returns the file contents
	 *
	 * @return string the file contents
	 */
	public function render(): string {
		return $this->content;
	}

}

<?php

declare(strict_types=1);

/**
 * @author Christoph Wurst <wurst.christoph@gmail.com>
 * @author Lukas Reschke <lukas@owncloud.com>
 * @author Thomas Müller <thomas.mueller@tmit.eu>
 *
 * Mail
 *
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License, version 3,
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 */

namespace OCA\Mail\Http;

use OCP\AppFramework\Http\Response;

class HtmlResponse extends Response {

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

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

	/**
	 * Simply sets the headers and returns the file contents
	 *
	 * @return string the file contents
	 */
	public function render(): string {
		return $this->content;
	}

}

Fix missing parent constructor call

Fix missing parent constructor call

Signed-off-by: Christoph Wurst <7abde52c298496fa169fb750f91f213a282142af@winzerhof-wurst.at>


<?php

namespace App\Http\Controllers;

use Illuminate\Http\Response;

abstract class AssetsController extends ApiController
{

    // TODO: Had to be disabled due to a faulty import (id was citi_id). Please re-enable once that's fixed.
    // protected function validateId( $id )
    // {
    //     return $this->isUuid( $id );
    // }

    protected function respondInvalidSyntax($message = 'Invalid identifier', $detail = 'The id should be a universally unique identifier. Please ensure you\'re passing the correct source id and try again.')
    {
        return response()->error($message, $detail, Response::HTTP_BAD_REQUEST);
    }

}

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Response;

abstract class AssetsController extends ApiController
{

    protected function validateId( $id )
    {
        return $this->isUuid( $id );
    }

    protected function respondInvalidSyntax($message = 'Invalid identifier', $detail = 'The id should be a universally unique identifier. Please ensure you\'re passing the correct source id and try again.')
    {
        return response()->error($message, $detail, Response::HTTP_BAD_REQUEST);
    }

}

Enable UUID validation on Assets

Enable UUID validation on Assets

This test is unstable: when a UUID is generated, it may or may not
start with a number. If it starts with a number, it'll pass default
`validateId()` logic. If it starts with a letter, it'll fail.

The deafult `validateId()` method should be fixed to be more strict.


<?php

declare(strict_types=1);

namespace Rinvex\Tags\Console\Commands;

use Illuminate\Console\Command;

class PublishCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'rinvex:publish:tags {--f|force : Overwrite any existing files.} {--r|resource=all}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Publish Rinvex Tags Resources.';

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle(): void
    {
        $this->alert($this->description);

        switch ($this->option('resource')) {
            case 'config':
                $this->call('vendor:publish', ['--tag' => 'rinvex/tags::config', '--force' => $this->option('force')]);
                break;
            case 'migrations':
                $this->call('vendor:publish', ['--tag' => 'rinvex/tags::migrations', '--force' => $this->option('force')]);
                break;
            default:
                $this->call('vendor:publish', ['--tag' => 'rinvex/tags::config', '--force' => $this->option('force')]);
                $this->call('vendor:publish', ['--tag' => 'rinvex/tags::migrations', '--force' => $this->option('force')]);
                break;
        }

        $this->line('');
    }
}

<?php

declare(strict_types=1);

namespace Rinvex\Tags\Console\Commands;

use Illuminate\Console\Command;

class PublishCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'rinvex:publish:tags {--f|force : Overwrite any existing files.} {--r|resource=* : Specify which resources to publish.}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Publish Rinvex Tags Resources.';

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle(): void
    {
        $this->alert($this->description);

        collect($this->option('resource'))->each(function ($resource) {
            $this->call('vendor:publish', ['--tag' => "rinvex/tags::{$resource}", '--force' => $this->option('force')]);
        });

        $this->line('');
    }
}

Refactor publish command and allow multiple resource values


<?php include 'header_meta_inc_view.php';?>

<?php include 'header_inc_view.php';?>

<?php include 'office_table_inc_view.php';?>

Agencies

            See the documentation for an explanation of this table.

			<?php

			if(!empty($cfo_offices)) {
				status_table('CFO Act Agencies', $cfo_offices);
			}

			if(!empty($executive_offices)) {
				status_table('Other Offices Reporting to the White House', $executive_offices);
			}

			if(!empty($independent_offices)) {
				status_table('Other Independent Offices', $independent_offices);
			}

			?>

<?php include 'footer.php'; ?>

<?php include 'header_meta_inc_view.php';?>

<?php include 'header_inc_view.php';?>

<?php include 'office_table_inc_view.php';?>

Agencies

			<?php

			if(!empty($cfo_offices)) {
				status_table('CFO Act Agencies', $cfo_offices);
			}

			if(!empty($executive_offices)) {
				status_table('Other Offices Reporting to the White House', $executive_offices);
			}

			if(!empty($independent_offices)) {
				status_table('Other Independent Offices', $independent_offices);
			}

			?>

<?php include 'footer.php'; ?>

Remove link for documentation on list view


<?php

function atws_autoload($class) {
    $namespaceParts = explode('\\', $class);
    $className = array_pop($namespaceParts);

    array_shift($namespaceParts);
    require_once __DIR__ . '/' . implode('/', $namespaceParts) . "/{$className}.php";
}

spl_autoload_register('atws_autoload');

<?php

function atws_autoload($class) {
    $dirSep = DIRECTORY_SEPARATOR;
    $namespaceParts = explode('\\', $class);
    $className = array_pop($namespaceParts);

    array_shift($namespaceParts);
    require_once __DIR__ . $dirSep . implode($dirSep, $namespaceParts) . "{$className}.php";
}

spl_autoload_register('atws_autoload');

Use DIRECTORY_SEPARATOR instead of assuming unix


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

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

            $table->string('serial_number')->unique()->nullable();
            $table->integer('agrctlrssi')->nullable();
            $table->integer('agrextrssi')->nullable();
            $table->integer('agrctlnoise')->nullable();
            $table->integer('agrextnoise')->nullable();
            $table->string('state')->nullable();
            $table->string('op_mode')->nullable();
            $table->integer('lasttxrate')->nullable();
            $table->string('lastassocstatus')->nullable();
            $table->integer('maxrate')->nullable();
            $table->string('x802_11_auth')->nullable();
            $table->string('link_auth')->nullable();
            $table->string('bssid')->nullable();
            $table->string('ssid')->nullable();
            $table->integer('mcs')->nullable();
            $table->string('channel')->nullable();

//            $table->timestamps();

            $table->index('bssid');
            $table->index('ssid');
            $table->index('state');
        });

    }

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

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

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

            $table->string('serial_number')->unique();
            $table->integer('agrctlrssi');
            $table->integer('agrextrssi');
            $table->integer('agrctlnoise');
            $table->integer('agrextnoise');
            $table->string('state');
            $table->string('op_mode');
            $table->integer('lasttxrate');
            $table->string('lastassocstatus');
            $table->integer('maxrate');
            $table->string('x802_11_auth');
            $table->string('link_auth');
            $table->string('bssid');
            $table->string('ssid');
            $table->integer('mcs');
            $table->string('channel');

            $table->index('bssid');
            $table->index('ssid');
            $table->index('state');
        });

    }

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

Remove nullable() from wifi migration

Remove nullable() from wifi migration


<?php

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

namespace Sylius\Bundle\WebBundle\Controller\Frontend;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

/**
 * Frontend homepage controller.
 *
 * @author Paweł Jędrzejewski <pawel@sylius.org>
 */
class HomepageController extends Controller
{
    public function mainAction(Request $request)
    {
        $manager = $this->get('sylius.settings.manager');

        $zone = $this->get('sylius.repository.zone')->findAll()[0];

        $settings = $manager->load('sylius_taxation');
//        $settings['default_tax_zone'] = $zone;

//        echo '<pre>';
        var_dump($settings->getParameters()['default_tax_zone']->getId());
//
        $manager->save($settings);

        var_dump($settings->getParameters()['default_tax_zone']->getId());

        die;

        return $this->render('SyliusWebBundle:Frontend/Homepage:main.html.twig');
    }
}

<?php

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

namespace Sylius\Bundle\WebBundle\Controller\Frontend;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

/**
 * Frontend homepage controller.
 *
 * @author Paweł Jędrzejewski <pawel@sylius.org>
 */
class HomepageController extends Controller
{
    public function mainAction()
    {
        return $this->render('SyliusWebBundle:Frontend/Homepage:main.html.twig');
    }
}

Remove test code from homepage controller


<?php

namespace Transport\Test;

use Silex\WebTestCase;

abstract class IntegrationTest extends WebTestCase
{
    protected $browser;

    public function createApplication()
    {
        $app = new \Transport\Application();

        $app['debug'] = false;

        $this->browser = $this->getMock('Buzz\\Browser', array('post', 'get'));

        $app['api'] = new \Transport\API($this->browser);

        return $app;
    }

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

    public function json($response)
    {
        $content = $response->getContent();

        $json = json_decode($content);
        $json = json_encode($json, JSON_PRETTY_PRINT);

        $json .= "\n";

        return $json;
    }

    public function getFixture($filename)
    {
        return file_get_contents(__DIR__ . '/../../fixtures/' . $filename);
    }

    public function getXmlFixture($filename)
    {
        return simplexml_load_string($this->getFixture($filename));
    }
}

<?php

namespace Transport\Test;

use Silex\WebTestCase;

abstract class IntegrationTest extends WebTestCase
{
    protected $browser;

    public function createApplication()
    {
        $app = new \Transport\Application();

        $app['debug'] = false;

        // uncomment the following lines for debugging
        //$app['debug'] = true;
        //unset($app['exception_handler']);

        $this->browser = $this->getMock('Buzz\\Browser', array('post', 'get'));

        $app['api'] = new \Transport\API($this->browser);

        return $app;
    }

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

    public function json($response)
    {
        $content = $response->getContent();

        $json = json_decode($content);
        $json = json_encode($json, JSON_PRETTY_PRINT);

        $json .= "\n";

        return $json;
    }

    public function getFixture($filename)
    {
        return file_get_contents(__DIR__ . '/../../fixtures/' . $filename);
    }

    public function getXmlFixture($filename)
    {
        return simplexml_load_string($this->getFixture($filename));
    }
}

Add helpful debugging in integration tests

Useful for PHPUnit mocks


<?php

namespace Frontend\Modules\Instagram\Ajax;

use Frontend\Core\Engine\Base\AjaxAction as FrontendBaseAJAXAction;
use Frontend\Core\Engine\Model as FrontendModel;
use Frontend\Modules\Instagram\Engine\Model as FrontendInstagramModel;
use Symfony\Component\HttpFoundation\Response;

/**
 * Fetches the recent user media and passes it back to javascript
 */
class LoadRecentMedia extends FrontendBaseAJAXAction
{
    public function execute(): void
    {
        parent::execute();

        $this->output(Response::HTTP_OK, $this->getRecentMedia());
    }

    private function getRecentMedia(): array
    {
        return FrontendInstagramModel::getRecentMedia(
            $this->getRequest()->request->get('userId'),
            FrontendModel::get('fork.settings')->get('Instagram', 'num_recent_items', 10)
        );
    }
}

<?php

namespace Frontend\Modules\Instagram\Ajax;

use Frontend\Core\Engine\Base\AjaxAction as FrontendBaseAJAXAction;
use Frontend\Core\Engine\Model as FrontendModel;
use Frontend\Modules\Instagram\Engine\Model as FrontendInstagramModel;
use Symfony\Component\HttpFoundation\Response;

/**
 * Fetches the recent user media and passes it back to javascript
 */
class LoadRecentMedia extends FrontendBaseAJAXAction
{
    public function execute(): void
    {
        parent::execute();

        $this->output(Response::HTTP_OK, $this->getRecentMedia());
    }

    private function getRecentMedia(): ?array
    {
        return FrontendInstagramModel::getRecentMedia(
            $this->getRequest()->request->get('userId'),
            FrontendModel::get('fork.settings')->get('Instagram', 'num_recent_items', 10)
        );
    }
}

Add null to return type for getRecentMedia


<?php

namespace Ddeboer\DataImport\Tests\Writer;

use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Console\Helper\Table;

use Ddeboer\DataImport\Workflow;
use Ddeboer\DataImport\Reader\ArrayReader;
use Ddeboer\DataImport\ItemConverter\MappingItemConverter;
use Ddeboer\DataImport\Writer\ConsoleTableWriter;

/**
 *  @author Igor Mukhin <igor.mukhin@gmail.com>
 */
class ConsoleTableWriterTest extends \PHPUnit_Framework_TestCase
{
    public function testRightColumnsHeadersNamesAfterItemConverter()
    {
        $data = array(
            array(
                'first'  => 'John',
                'lastname' => 'Doe'
            ),
            array(
                'first'  => 'Ivan',
                'lastname' => 'Sidorov'
            )
        );
        $reader = new ArrayReader($data);

        $converter = new MappingItemConverter();
        $converter
            ->addMapping('first', 'firstname')
        ;

        $output = new BufferedOutput();
        $table = new Table($output);
        $table
            ->setHeaders($reader->getFields())
            ->setStyle('compact')
        ;

        $workflow = new Workflow($reader);
        $workflow
            ->addItemConverter($converter)
            ->addWriter(new ConsoleTableWriter($output, $table))
            ->process()
        ;

        $this->assertRegExp('/\s+lastname\s+firstname\s+Doe\s+John\s+Sidorov\s+Ivan\s+/', $output->fetch());
    }
}

<?php

namespace Ddeboer\DataImport\Tests\Writer;

use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Console\Helper\Table;

use Ddeboer\DataImport\Workflow;
use Ddeboer\DataImport\Reader\ArrayReader;
use Ddeboer\DataImport\ItemConverter\MappingItemConverter;
use Ddeboer\DataImport\Writer\ConsoleTableWriter;

/**
 *  @author Igor Mukhin <igor.mukhin@gmail.com>
 */
class ConsoleTableWriterTest extends \PHPUnit_Framework_TestCase
{
    public function testRightColumnsHeadersNamesAfterItemConverter()
    {
        $data = array(
            array(
                'first'  => 'John',
                'lastname' => 'Doe'
            ),
            array(
                'first'  => 'Ivan',
                'lastname' => 'Sidorov'
            )
        );
        $reader = new ArrayReader($data);

        $converter = new MappingItemConverter();
        $converter
            ->addMapping('first', 'firstname')
        ;

        $output = new BufferedOutput();
        $table = new Table($output);
        $table
            ->setStyle('compact')
        ;

        $workflow = new Workflow($reader);
        $workflow
            ->addItemConverter($converter)
            ->addWriter(new ConsoleTableWriter($output, $table))
            ->process()
        ;

        $this->assertRegExp('/\s+lastname\s+firstname\s+Doe\s+John\s+Sidorov\s+Ivan\s+/', $output->fetch());
    }
}

Remove old code from TestCase

Remove old code from TestCase