<?php
namespace wcf\system\worker;
use wcf\data\attachment\AttachmentAction;
use wcf\data\attachment\AttachmentList;
use wcf\system\exception\SystemException;

/**
 * Worker implementation for updating attachments.
 *
 * @author	Marcel Werk
 * @copyright	2001-2019 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	WoltLabSuite\Core\System\Worker
 *
 * @method	AttachmentList	getObjectList()
 */
class AttachmentRebuildDataWorker extends AbstractRebuildDataWorker {
	/**
	 * @inheritDoc
	 */
	protected $objectListClassName = AttachmentList::class;

	/**
	 * @inheritDoc
	 */
	protected $limit = 10;

	/**
	 * @inheritDoc
	 */
	protected function initObjectList() {
		parent::initObjectList();

		$this->objectList->sqlOrderBy = 'attachment.attachmentID';
		$this->objectList->getConditionBuilder()->add('attachment.isImage = ?', [1]);
	}

	/**
	 * @inheritDoc
	 */
	public function execute() {
		parent::execute();

		foreach ($this->objectList as $attachment) {
			try {
				$action = new AttachmentAction([$attachment], 'generateThumbnails');
				$action->executeAction();
				$attachment->migrateStorage();
			}
			catch (SystemException $e) {}
		}
	}
}

<?php
namespace wcf\system\worker;
use wcf\data\attachment\AttachmentAction;
use wcf\data\attachment\AttachmentList;
use wcf\system\exception\SystemException;

/**
 * Worker implementation for updating attachments.
 *
 * @author	Marcel Werk
 * @copyright	2001-2019 WoltLab GmbH
 * @license	GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package	WoltLabSuite\Core\System\Worker
 *
 * @method	AttachmentList	getObjectList()
 */
class AttachmentRebuildDataWorker extends AbstractRebuildDataWorker {
	/**
	 * @inheritDoc
	 */
	protected $objectListClassName = AttachmentList::class;

	/**
	 * @inheritDoc
	 */
	protected $limit = 10;

	/**
	 * @inheritDoc
	 */
	protected function initObjectList() {
		parent::initObjectList();

		$this->objectList->sqlOrderBy = 'attachment.attachmentID';
	}

	/**
	 * @inheritDoc
	 */
	public function execute() {
		parent::execute();

		/** @var \wcf\data\attachment\Attachment $attachment */
		foreach ($this->objectList as $attachment) {
			$attachment->migrateStorage();
			try {
				$action = new AttachmentAction([$attachment], 'generateThumbnails');
				$action->executeAction();
			}
			catch (SystemException $e) {}
		}
	}
}

Handle all attachments in AttachmentRebuildDataWorker

This ensures that the storage is migrated for non-image attachments.


@extends('layout')

@section('title')File - {{$path}}@stop

@section('content')

{{$path}}

    <?php
	    $dir = base_path() . "/query/" . $path;
        $files = scandir($dir);
        $out = "";
        if ($path != "")
            if(strpos($path, "/"))
                $out .= "..
";
            else
                $out .= "..
";
        foreach ($files as $file)
        {
            if ($file != "." AND $file != "..") {
                if (strpos($file, "."))
                    $out .= "" . $file . "
";
                else
                    $out .= "" . $file . "
";
                break;
            }
        }
        echo $out;
    ?>

@stop

@extends('layout')

@section('title')Folder - {{$path}}@stop

@section('content')

{{$path}}

    <?php
        if (strpos($path, "/")) {
            if(strpos($path, "/"))
                $url = "/lists/" . substr($path, 0, strrpos($path, "/"));
            else
                $url = "/lists";
            echo "..
";
        }

        $files = scandir(base_path() . "/query/" . $path);
        foreach ($files as $file)
        {
            if ($file != "." AND $file != "..") {
                if (strpos($file, "."))
                    $url = "/lists/" . $path . "/" . substr($file, 0, strpos($file, "."));
                else
                    $url = "/lists/" . $path . "/" . $file;
				echo "" . $file . "
";
            }
        }
    ?>

@stop

Improve codestyle and fix all links, since some did not work as expected


<?php namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel {

	/**
	 * The Artisan commands provided by your application.
	 *
	 * @var array
	 */
	protected $commands = [
		'App\Console\Commands\LogPVOutput',
		'App\Console\Commands\LogSonnenertrag'
	];

	/**
	 * Define the application's command schedule.
	 *
	 * @param  \Illuminate\Console\Scheduling\Schedule	$schedule
	 * @return void
	 */
	protected function schedule(Schedule $schedule)
	{
		if (env('SCHEDULE_PVOUTPUT') == 'true') {
			$schedule->command('log:pvoutput')
					 ->everyFiveMinutes();

		}

		if (env('SCHEDULE_SONNENERTRAG') == 'true') {
			$schedule->command('log:sonnenertrag')
					 ->dailyAt('23:55');

		}
	}

}

<?php namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel {

	/**
	 * The Artisan commands provided by your application.
	 *
	 * @var array
	 */
	protected $commands = [
		'App\Console\Commands\LogPVOutput',
		'App\Console\Commands\LogSonnenertrag'
	];

	/**
	 * Define the application's command schedule.
	 *
	 * @param  \Illuminate\Console\Scheduling\Schedule	$schedule
	 * @return void
	 */
	protected function schedule(Schedule $schedule)
	{
		$schedule->command('log:pvoutput')
				 ->everyFiveMinutes()
				 ->when(function()
						{
							return env('SCHEDULE_PVOUTPUT');
						});

		$schedule->command('log:sonnenertrag')
				 ->dailyAt('23:55')
		 		 ->when(function()
						{
							return env('SCHEDULE_SONNENERTRAG');
						});

	}

}

Fix PVOutput and SonnenErtrag knobs.

Fix PVOutput and SonnenErtrag knobs.


<?php

namespace Myjob\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel {
	/**
	 * The Artisan commands provided by your application.
	 *
	 * @var array
	 */
	protected $commands = [
		\Myjob\Console\Commands\Inspire::class,
		\Myjob\Console\Commands\SendNotificationMails::class,
		\Myjob\Console\Commands\SyncLDAPStudents::class,
	];

	/**
	 * Define the application's command schedule.
	 *
	 * @param  \Illuminate\Console\Scheduling\Schedule $schedule
	 * @return void
	 */
	protected function schedule(Schedule $schedule) {
		$schedule->command('sendnotificationmails --subscribed=instantly')
			->everyThirtyMinutes();

		$schedule->command('sendnotificationmails --subscribed=daily')
			->dailyAt('4:00');

		$schedule->command('sendnotificationmails --subscribed=weekly')
			->weeklyOn(6, '4:00');
	}
}

<?php

namespace Myjob\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel {
	/**
	 * The Artisan commands provided by your application.
	 *
	 * @var array
	 */
	protected $commands = [
		\Myjob\Console\Commands\Inspire::class,
		\Myjob\Console\Commands\SendNotificationMails::class,
		\Myjob\Console\Commands\SyncLDAPStudents::class,
	];

	/**
	 * Define the application's command schedule.
	 *
	 * @param  \Illuminate\Console\Scheduling\Schedule $schedule
	 * @return void
	 */
	protected function schedule(Schedule $schedule) {
		// Synchronise student list with the LDAP
		$schedule->command('syncstudents')
			->weeklyOn(5, '4:00');

		// Send notification mails
		$schedule->command('sendnotificationmails --subscribed=instantly')
			->everyThirtyMinutes();
		$schedule->command('sendnotificationmails --subscribed=daily')
			->dailyAt('4:00');
		$schedule->command('sendnotificationmails --subscribed=weekly')
			->weeklyOn(6, '4:00');
	}
}

Add scheduler entry for ldap sync

Add scheduler entry for ldap sync


<?php

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

namespace ActiveCollab\Bootstrap\Command\DevCommand\Migrations;

use ActiveCollab\Bootstrap\Command\DevCommand\DevCommand;
use ActiveCollab\DatabaseMigrations\MigrationsInterface;

/**
 * @package ActiveCollab\Bootstrap\Command\DevCommand\Migrations
 */
abstract class Command extends DevCommand
{
    /**
     * {@inheritdoc}
     */
    public function getCommandNamePrefix()
    {
        return parent::getCommandNamePrefix() . 'migrations:';
    }

    /**
     * Return migrations instance.
     *
     * @return MigrationsInterface
     */
    public function getMigrations()
    {
        return $this->getContainer()->get('migrations');
    }
}

<?php

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

namespace ActiveCollab\Bootstrap\Command\DevCommand\Migrations;

use ActiveCollab\Bootstrap\Command\DevCommand\DevCommand;
use ActiveCollab\DatabaseMigrations\MigrationsInterface;
use RuntimeException;

/**
 * @package ActiveCollab\Bootstrap\Command\DevCommand\Migrations
 */
abstract class Command extends DevCommand
{
    /**
     * {@inheritdoc}
     */
    public function getCommandNamePrefix()
    {
        return parent::getCommandNamePrefix() . 'migrations:';
    }

    /**
     * Return migrations instance.
     *
     * @return MigrationsInterface
     */
    public function &getMigrations()
    {
        $migrations = $this->getContainer()->get('migrations');

        if ($migrations instanceof MigrationsInterface) {
            return $migrations;
        } else {
            throw new RuntimeException('Failed to get migrations utility from DI container');
        }
    }
}

Fix getMigrations method signature for migrations command


<?php

include_once(dirname(__FILE__).'/../../connector.php');

class Metrodb_Tests_Connector extends PHPUnit_Framework_TestCase {

	public function setUp() {
	}

	public function test_get_dsn() {
		$url = 'mysql://foo@bar/dbname';
		Metrodb_Connector::setDsn('default', $url);
		$url2 = Metrodb_Connector::getDsn('default');
		$this->assertEquals($url, $url2);

		$url3 = Metrodb_Connector::getDsn('write');
		$this->assertEquals(NULL, $url3);
	}

	public function test_get_driver() {
		$url = 'mysql://foo@bar/dbname';
		Metrodb_Connector::setDsn('default', $url);
		try {
			$db = Metrodb_Connector::getHandle('default');
		} catch (Exception $e ) {
			//unable to connect
			$db = NULL;
		}
		$this->assertTrue(is_object($db));
		$this->assertEquals('metrodb_mysql', strtolower(get_class($db)));
	}
}

<?php

include_once(dirname(__FILE__).'/../../connector.php');

class Metrodb_Tests_Connector extends PHPUnit_Framework_TestCase {

	public function setUp() {
	}

	public function test_get_dsn() {
		$url = 'mysql://foo@bar/dbname';
		Metrodb_Connector::setDsn('dummy1', $url);
		$url2 = Metrodb_Connector::getDsn('dummy1');
		$this->assertEquals($url, $url2);

		$url3 = Metrodb_Connector::getDsn('write');
		$this->assertEquals(NULL, $url3);
	}

	public function test_get_driver() {
		$url = 'mysql://foo@bar/dbname';
		Metrodb_Connector::setDsn('dummy2', $url);
		try {
			$db = Metrodb_Connector::getHandle('dummy2');
		} catch (Exception $e ) {
			//unable to connect
			$db = NULL;
		}
		$this->assertTrue(is_object($db));
		$this->assertEquals('metrodb_mysql', strtolower(get_class($db)));
	}
}

Rename default DSN to avoid overwriting bootstrap.

Moving the DSN definition to bootstrap allowed this test to overwrite
the "default" key, messing up later tests.


<?php

namespace SearchBundle;

use Becklyn\SearchBundle\DependencyInjection\SearchBundleExtension;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class SearchBundle extends Bundle
{
    /**
     * @inheritdoc
     */
    protected function getContainerExtensionClass ()
    {
        return SearchBundleExtension::class;
    }
}

<?php

namespace Becklyn\SearchBundle;

use Becklyn\SearchBundle\DependencyInjection\SearchBundleExtension;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class SearchBundle extends Bundle
{
    /**
     * @inheritdoc
     */
    protected function getContainerExtensionClass ()
    {
        return SearchBundleExtension::class;
    }
}

Fix namespace of bundle class

Fix namespace of bundle class


<!DOCTYPE html>

    <title>Event RSVP | MyRoboJackets</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="{{ mix('/css/app.css') }}" rel="stylesheet">

    @include('favicon')

You're all set!

                We can't wait to see you at {{ $event->name }}.

                @isset($event['location'])
                    Location:  {{ $event->location }}

                @endisset
                @if($event['cost'] != 0)
                    Cost:  ${{ $event->cost }}
                @endif

<!DOCTYPE html>

    <title>Event RSVP | MyRoboJackets</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="{{ mix('/css/app.css') }}" rel="stylesheet">

    @include('favicon')

You're all set!

                We can't wait to see you at {{ $event->name }}.

                @isset($event['location'])
                    Location:  {{ $event->location }}

                @endisset
                @isset($event['start_time'])
                    Date:  {{ date("l, F jS, Y \a\\t h:i A" ,strtotime($event->start_time)) }}

                @endisset
                @if($event['cost'] != 0)
                    Cost:  ${{ $event->cost }}
                @endif

Revert "Do not display the start time of an event on the RSVP confirmation view"

This reverts commit 79f86048c086e8a3928decfc27e7ac5af95e4f28.
Fixes #1386.


<?php
namespace Neos\Flow\Reflection;

/*
 * This file is part of the Neos.Flow package.
 *
 * (c) Contributors of the Neos Project - www.neos.io
 *
 * This package is Open Source Software. For the full copyright and license
 * information, please view the LICENSE file which was distributed with this
 * source code.
 */

use Neos\Flow\Annotations as Flow;

/**
 * Extended version of the ReflectionParameter
 *
 * @Flow\Proxy(false)
 */
class ParameterReflection extends \ReflectionParameter
{
    /**
     * @var string
     */
    protected $parameterClassName;

    /**
     * Returns the declaring class
     *
     * @return ClassReflection The declaring class
     */
    public function getDeclaringClass()
    {
        return new ClassReflection(parent::getDeclaringClass()->getName());
    }

    /**
     * Returns the parameter class
     *
     * @return ClassReflection The parameter class
     */
    public function getClass()
    {
        try {
            $class = parent::getClass();
        } catch (\Exception $exception) {
            return null;
        }

        return is_object($class) ? new ClassReflection($class->getName()) : null;
    }

    /**
     * @return string The name of a builtin type (e.g. string, int) if it was declared for the parameter (scalar type declaration), null otherwise
     */
    public function getBuiltinType()
    {
        if (!is_callable([$this, 'getType'])) {
            return null;
        }
        $type = $this->getType();
        if ($type === null || !$type->isBuiltin()) {
            return null;
        }
        return (string)$type;
    }
}

<?php
namespace Neos\Flow\Reflection;

/*
 * This file is part of the Neos.Flow package.
 *
 * (c) Contributors of the Neos Project - www.neos.io
 *
 * This package is Open Source Software. For the full copyright and license
 * information, please view the LICENSE file which was distributed with this
 * source code.
 */

use Neos\Flow\Annotations as Flow;

/**
 * Extended version of the ReflectionParameter
 *
 * @Flow\Proxy(false)
 */
class ParameterReflection extends \ReflectionParameter
{
    /**
     * @var string
     */
    protected $parameterClassName;

    /**
     * Returns the declaring class
     *
     * @return ClassReflection The declaring class
     */
    public function getDeclaringClass()
    {
        return new ClassReflection(parent::getDeclaringClass()->getName());
    }

    /**
     * Returns the parameter class
     *
     * @return ClassReflection The parameter class
     */
    public function getClass()
    {
        try {
            $class = parent::getClass();
        } catch (\Exception $exception) {
            return null;
        }

        return is_object($class) ? new ClassReflection($class->getName()) : null;
    }

    /**
     * @return string The name of a builtin type (e.g. string, int) if it was declared for the parameter (scalar type declaration), null otherwise
     */
    public function getBuiltinType()
    {
        $type = $this->getType();
        if ($type === null || !$type->isBuiltin()) {
            return null;
        }
        return $type instanceof \ReflectionNamedType ? $type->getName() : (string)$type;
    }
}

BUGFIX: Remove pre-PHP7 code and avoid __toString deprecation warning


<?php

namespace swestcott\MonologExtension\Context\Initializer;

use Behat\Behat\Context\Initializer\InitializerInterface,
    Behat\Behat\Context\ContextInterface;

class MonologInitializer implements InitializerInterface
{
    private $container;

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

    public function initialize(ContextInterface $context)
    {
        $loggerName = $this->container->getParameter('behat.monolog.logger_name');
        $class = $this->container->getParameter('behat.monolog.class');

        $def = $this->container->getDefinition('behat.monolog.logger.manager');
        $def->setArguments(array(get_class($context)));

        // In theory, this uses my factory to generate the logger instance,
        // passing in the Behat Context class name to factory->get($name)
        $logger = $this->container->get('behat.monolog.logger.manager');

        // Finally, attached logger to (sub-)context
        $context->$loggerName = $logger;
    }

    public function supports(ContextInterface $context)
    {
        return ($context instanceof SubcontextableContextInterface);
    }
}

<?php

namespace swestcott\MonologExtension\Context\Initializer;

use Behat\Behat\Context\Initializer\InitializerInterface,
    Behat\Behat\Context\ContextInterface;

class MonologInitializer implements InitializerInterface
{
    private $container;

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

    public function initialize(ContextInterface $context)
    {
        $loggerName = $this->container->getParameter('behat.monolog.logger_name');
        $class = $this->container->getParameter('behat.monolog.class');

        $def = $this->container->getDefinition('behat.monolog.logger.manager');
        $def->setArguments(array(get_class($context)));

        // In theory, this uses my factory to generate the logger instance,
        // passing in the Behat Context class name to factory->get($name)
        $logger = $this->container->get('behat.monolog.logger.manager');

        // Finally, attached logger to (sub-)context
        $context->$loggerName = $logger;
    }

    public function supports(ContextInterface $context)
    {
        $class = new \ReflectionClass($context);
        return $class->implementsInterface('Behat\Behat\Context\SubcontextableContextInterface');
    }
}

Patch logic which determines if a feature context is supported or not


<?php

if (!defined("BASEPATH")) {
    exit("No direct script access allowed");
} include_once "entity/master_corps.php";

class Model_master_corps extends Master_corps {

    protected $rules = array(
        array("kode_corps", "required|min_length[1]"),
        array("init_corps", "required|min_length[3]|max_length[300]"),
        array("ur_corps", "required|min_length[3]|max_length[300]"),
    );

    public function __construct() {
        parent::__construct();
    }
    public function all($force_limit = FALSE, $force_offset = FALSE) {
        return parent::get_all(array(
                    "ur_corps",
                        ), FALSE, TRUE, FALSE, 1, TRUE, $force_limit, $force_offset);
    }

}

?>

<?php

if (!defined("BASEPATH")) {
    exit("No direct script access allowed");
} include_once "entity/master_corps.php";

class Model_master_corps extends Master_corps {

    protected $rules = array(
        array("kode_corps", "required|min_length[1]"),
        array("init_corps", "required|min_length[3]|max_length[300]"),
        array("ur_corps", "required|min_length[3]|max_length[300]"),
    );

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

    public function all($force_limit = FALSE, $force_offset = FALSE) {
        return parent::get_all(array(
                    "ur_corps",
                        ), FALSE, TRUE, FALSE, 1, TRUE, $force_limit, $force_offset);
    }

    public function get_like($keyword = FALSE) {

        $result = FALSE;
        if ($keyword) {
            $this->db->order_by("kode_corps", "asc");
            $this->db->where(" lower(" . $this->table_name . ".ur_corps) LIKE lower('%" . $keyword . "%') OR lower(" . $this->table_name . ".kode_corps) LIKE lower('%" . $keyword . "%')", NULL, FALSE);
            $result = $this->get_where();
        }
        return $result;
    }

}

?>

Update Master Corps - Index

Update Master Corps - Index


<?php

require_once 'Doctrine/Common/ClassLoader.php';

$classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
$classLoader->register();

$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';
$configuration = new \Doctrine\Common\Cli\Configuration();

if (file_exists($configFile)) {
    if ( ! is_readable($configFile)) {
        trigger_error(
            'Configuration file [' . $configFile . '] does not have read permission.', E_ERROR
        );
    }

    require $configFile;

    foreach ($GLOBALS as $configCandidate) {
        if ($configCandidate instanceof \Doctrine\Common\Cli\Configuration) {
            $configuration = $configCandidate;
            break;
        }
    }
}

$cli = new \Doctrine\Common\Cli\CliController($configuration);
$cli->run($_SERVER['argv']);

<?php

require_once 'Doctrine/Common/ClassLoader.php';

$classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
$classLoader->register();

$configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';

$configuration = null;
if (file_exists($configFile)) {
    if ( ! is_readable($configFile)) {
        trigger_error(
            'Configuration file [' . $configFile . '] does not have read permission.', E_ERROR
        );
    }

    require $configFile;

    foreach ($GLOBALS as $configCandidate) {
        if ($configCandidate instanceof \Doctrine\Common\Cli\Configuration) {
            $configuration = $configCandidate;
            break;
        }
    }
}

$configuration = ($configuration) ?: new \Doctrine\Common\Cli\Configuration();

$cli = new \Doctrine\Common\Cli\CliController($configuration);
$cli->run($_SERVER['argv']);

[2.0] Fix bug in detection of global Doctrine Cli Configuration finding the empty replacement configuration before the correct one.

git-svn-id: c8c49e1140e1cd2a8fb163f3c2b0f6eec231a71d@7322 625475ce-881a-0410-a577-b389adb331d8


<?php

namespace Pancake;

class Invoices {

    public static function get(Server $server) {
        return $server->get("invoices");
    }

    public static function send(Server $server, $unique_id) {
        return $server->post("invoices/send", array("unique_id" => $unique_id));
    }

}

<?php

namespace Pancake;

class Invoices {

    public static function get(Server $server) {
        return $server->get("invoices");
    }

    public static function send(Server $server, $unique_id) {
        $result = $server->post("invoices/send", array("unique_id" => $unique_id));
        return $result['status'];
    }

}

Use 'status' to return whether or not the email has sent successfully.


<?php
namespace TheSeer\phpDox\Generator\Enricher {

    use TheSeer\phpDox\Generator\AbstractEvent;
    use TheSeer\phpDox\Generator\ClassStartEvent;
    use TheSeer\phpDox\Generator\InterfaceStartEvent;
    use TheSeer\phpDox\Generator\TraitStartEvent;

    class PHPUnit implements ClassEnricherInterface, InterfaceEnricherInterface, TraitEnricherInterface {

        private $config;

        public function __construct(CheckStyleConfig $config) {
            $this->config = $config;
            $this->loadIndex($config->getLogFilePath());
        }

        /**
         * @return string
         */
        public function getName() {
            return 'PHPUnit Coverage XML';
        }

        public function enrichClass(ClassStartEvent $event) {
            // TODO: Implement enrichClass() method.
        }

        public function enrichInterface(InterfaceStartEvent $event) {
            // TODO: Implement enrichInterface() method.
        }

        public function enrichTrait(TraitStartEvent $event) {
            // TODO: Implement enrichTrait() method.
        }

    }

}

<?php
namespace TheSeer\phpDox\Generator\Enricher {

    use TheSeer\phpDox\Generator\AbstractEvent;
    use TheSeer\phpDox\Generator\ClassStartEvent;
    use TheSeer\phpDox\Generator\InterfaceStartEvent;
    use TheSeer\phpDox\Generator\TraitStartEvent;

    class PHPUnit implements ClassEnricherInterface, InterfaceEnricherInterface, TraitEnricherInterface {

        private $config;

        public function __construct(PHPUnitConfig $config) {
            $this->config = $config;
            $this->loadIndex($config->getLogFilePath());
        }

        /**
         * @return string
         */
        public function getName() {
            return 'PHPUnit Coverage XML';
        }

        public function enrichClass(ClassStartEvent $event) {
            // TODO: Implement enrichClass() method.
        }

        public function enrichInterface(InterfaceStartEvent $event) {
            // TODO: Implement enrichInterface() method.
        }

        public function enrichTrait(TraitStartEvent $event) {
            // TODO: Implement enrichTrait() method.
        }

    }

}

Fix type hint for constructor argument

Fix type hint for constructor argument


<?php

define('ZEND_SEARCH_LUCENE_BASE_PATH', dirname(__FILE__));

set_include_path(
    get_include_path() . PATH_SEPARATOR . dirname(__FILE__).'/thirdparty'
);

<?php

if (!defined('ZEND_SEARCH_LUCENE_BASE_PATH')) define('ZEND_SEARCH_LUCENE_BASE_PATH', realpath(dirname(__FILE__)));

set_include_path(
    get_include_path() . PATH_SEPARATOR . dirname(__FILE__).'/thirdparty'
);

Check if constant is already defined

Check if constant is already defined


@if(Auth::user())
  @if (Auth::user()->canVoteInCategory($category))

Hey, {{ Auth::user()->first_name }}! Ready to cast your vote for {{{ $category->name }}}?

    {{ Form::open(['route' => 'votes.store']) }}
    {{ Form::hidden('candidate_id', (isset($id) ? $id : null)) }}
    {{ Form::submit('Count My Vote', ['class' => 'button -primary']) }}
    {{ Form::close() }}
  @else

Thanks for voting! You can vote again in this category in 24 hours.

Get {{ $candidate->name or "CANDIDATE_NAME" }} more votes!

    @include('candidates.share');
  @endif
@else
    {{ Form::open(['route'=> ['sessions.store'], 'id' => 'sign_in_form']) }}
      @include('sessions.form', [$type])
      {{ Form::hidden('candidate_id', (isset($candidate->id) ? $candidate->id : null)) }}
      {{ Form::submit('Count My Vote', ['class' => 'button -primary']) }}

By voting you agree to receive future updates from DoSomething.org. Message & data rates may apply. Text STOP to opt-out, HELP for help.

    {{ Form::close() }}
@endif

@if(Auth::user())
{{-- If user is logged in... --}}

  {{--  ...and can vote, show the voting form.  --}}
  @if (Auth::user()->canVoteInCategory($category))

Hey, {{ Auth::user()->first_name }}! Ready to cast your vote for {{{ $category->name }}}?

    {{ Form::open(['route' => 'votes.store']) }}
    {{ Form::hidden('candidate_id', (isset($id) ? $id : null)) }}
    {{ Form::submit('Count My Vote', ['class' => 'button -primary']) }}
    {{ Form::close() }}

  {{-- ...and already voted, display a message. --}}
  @else

Thanks for voting! You can vote again in this category in 24 hours.

Get {{ $candidate->name or "CANDIDATE_NAME" }} more votes!

    @include('candidates.share');
  @endif

{{-- If user is not logged in, show the login/vote form. --}}
@else
    {{ Form::open(['route'=> ['sessions.store'], 'id' => 'sign_in_form']) }}
      @include('sessions.form', [$type])
      {{ Form::hidden('candidate_id', (isset($candidate->id) ? $candidate->id : null)) }}
      {{ Form::submit('Count My Vote', ['class' => 'button -primary']) }}

By voting you agree to receive future updates from DoSomething.org. Message & data rates may apply. Text STOP to opt-out, HELP for help.

    {{ Form::close() }}
@endif

Add comments to make vote form partial more readable.


<?php

/////////////////////////////////////////////////////////////////////////////
// This API allows you to get cluster name for a hostname
//
// Currently only query supported is
//
// hostname=YOURHOSTNAME&search_type=exact
//
// will give you back the an array of cluster names where host is in
/////////////////////////////////////////////////////////////////////////////

$conf['gweb_root'] = dirname(dirname(__FILE__));

include_once $conf['gweb_root'] . "/eval_conf.php";
include_once $conf['gweb_root'] . "/lib/common_api.php";
include_once $conf['gweb_root'] . "/lib/functions.php";

ganglia_cache_metrics();

if ( isset($_GET['hostname']) and isset($_GET['search_type']) and $_GET['search_type'] == "exact") {
    $hostname = $_GET['hostname'];
    if ( isset($index_array['cluster'][$hostname])) {
        api_return_ok($index_array['cluster'][$hostname]);
    } else {
        api_return_error("Cluster not found");
    }
} else {
    api_return_error("No valid search provided");
}

?>

<?php

/////////////////////////////////////////////////////////////////////////////
// This API allows you to get cluster name for a hostname
//
// Currently only query supported is
//
// hostname=YOURHOSTNAME&search_type=exact
//
// will give you back the an array of cluster names where host is in
/////////////////////////////////////////////////////////////////////////////

$conf['gweb_root'] = dirname(dirname(__FILE__));

include_once $conf['gweb_root'] . "/eval_conf.php";
include_once $conf['gweb_root'] . "/lib/common_api.php";
include_once $conf['gweb_root'] . "/functions.php";

ganglia_cache_metrics();

if ( isset($_GET['hostname']) and isset($_GET['search_type']) and $_GET['search_type'] == "exact") {
    $hostname = $_GET['hostname'];
    if ( isset($index_array['cluster'][$hostname])) {
        api_return_ok($index_array['cluster'][$hostname]);
    } else {
        api_return_error("Cluster not found");
    }
} else {
    api_return_error("No valid search provided");
}

?>

Use the new path for functions.php

Use the new path for functions.php

`/lib/functions.php` was moved to `/functions.php` for quite a while.
This PR uses the new path for `/api/search.php` to include it.


<?php
    /**
     * @author Manuel Thalmann <m@nuth.ch>
     * @license Apache-2.0
     */
    namespace ManuTh\TemPHPlate\Pages;
    use System\Web;
    use System\Web\Forms\Rendering\PaintEventArgs;
    use System\Web\Forms\MenuItem;
    use ManuTh\TemPHPlate\Templates\BootstrapTemplate;
    {
        /**
         * A page
         */
        class Page extends Web\Page
        {
            /**
             * Initializes a new instance of the `Page` class.
             */
            public function Page()
            {
                $this->Template = new BootstrapTemplate($this);
            }

            /**
             * Draws the object.
             *
             * @return void
             */
            protected function DrawInternal()
            {
                echo '

TemPHPlate

                        Next you may wanna edit your menu-bar.

                        Open up /Properties/MenuBar.json for doing so.

';
            }
        }
    }
?>

<?php
    /**
     * @author Manuel Thalmann <m@nuth.ch>
     * @license Apache-2.0
     */
    namespace ManuTh\TemPHPlate\Pages;
    use System\Web;
    use System\Web\Forms\Rendering\PaintEventArgs;
    use System\Web\Forms\MenuItem;
    use ManuTh\TemPHPlate\Templates\BootstrapTemplate;
    {
        /**
         * A page
         */
        class Page extends Web\Page
        {
            /**
             * Initializes a new instance of the `Page` class.
             */
            public function Page()
            {
                $this->Template = new BootstrapTemplate($this);
                $this->Title = 'TemPHPlate - Home';
            }

            /**
             * Draws the object.
             *
             * @return void
             */
            protected function DrawInternal()
            {
                echo '

TemPHPlate

                        Next you may wanna edit your menu-bar.

                        Open up /Properties/MenuBar.json for doing so.

';
            }
        }
    }
?>

Set the title of the default page

Set the title of the default page


<?php

namespace Adldap\Models\Traits;

trait ModelTrait
{
    /**
     * Returns the current query builder.
     *
     * @return \Adldap\Query\Builder
     */
    abstract public function getQuery();

    /**
     * Returns the current models schema.
     *
     * @return \Adldap\Contracts\Schemas\SchemaInterface
     */
    abstract public function getSchema();

    /**
     * Returns the model's distinguished name string.
     *
     * (Alias for getDistinguishedName())
     *
     * https://msdn.microsoft.com/en-us/library/aa366101(v=vs.85).aspx
     *
     * @return string|null
     */
    abstract public function getDn();

    /**
     * Returns the models attribute with the specified key.
     *
     * If a sub-key is specified, it will try and
     * retrieve it from the parent keys array.
     *
     * @param int|string $key
     * @param int|string $subKey
     *
     * @return mixed
     */
    abstract public function getAttribute($key, $subKey = null);

    /**
     * Sets attributes on the current entry.
     *
     * @param int|string $key
     * @param mixed      $value
     * @param int|string $subKey
     *
     * @return \Adldap\Models\Model
     */
    abstract public function setAttribute($key, $value, $subKey = null);

    /**
     * Converts the inserted string boolean to a PHP boolean.
     *
     * @param string $bool
     *
     * @return null|bool
     */
    abstract public function convertStringToBool($bool);
}

<?php

namespace Adldap\Models\Traits;

trait ModelTrait
{
    /**
     * {@inheritdoc}
     */
    abstract public function getQuery();

    /**
     * {@inheritdoc}
     */
    abstract public function getSchema();

    /**
     * {@inheritdoc}
     */
    abstract public function getDn();

    /**
     * {@inheritdoc}
     */
    abstract public function getAttribute($key, $subKey = null);

    /**
     * {@inheritdoc}
     */
    abstract public function setAttribute($key, $value, $subKey = null);

    /**
     * {@inheritdoc}
     */
    abstract public function convertStringToBool($bool);
}

Revert "Fix model trait code docs."

Revert "Fix model trait code docs."

This reverts commit 2b96fb82406073ab0253c827a387e2e0ea7b81b0.


<?php

namespace REBELinBLUE\Deployer\Github;

use Httpful\Request;
use Illuminate\Support\Facades\Cache;

/**
 * A class to get the latest release tag for Github.
 */
class LatestRelease
{
    /**
     * @var string
     **/
    private $github_url = 'https://api.github.com/repos/REBELinBLUE/deployer/releases/latest';

    /**
     * Get the latest release from Github.
     *
     * @return string
     */
    public function latest()
    {
        $release = Cache::remember('latest_version', 3600, function () {

            $request = Request::get($this->github_url)
                              ->expectsJson()
                              ->withAccept('application/vnd.github.v3+json');

            if (config('deployer.github_oauth_token')) {
                $request->withAuthorization('token ' . config('deployer.github_oauth_token'));
            }

            $response = $request->send();

            // FIXME: handle errors, maybe throw an exception?
            return $response->body;
        });

        return $release->tag_name;
    }
}

<?php

namespace REBELinBLUE\Deployer\Github;

use Httpful\Request;
use Illuminate\Support\Facades\Cache;

/**
 * A class to get the latest release tag for Github.
 */
class LatestRelease
{
    const CACHE_TIME_IN_HOURS = 12;

    /**
     * @var string
     **/
    private $github_url = 'https://api.github.com/repos/REBELinBLUE/deployer/releases/latest';

    /**
     * Get the latest release from Github.
     *
     * @return string
     */
    public function latest()
    {
        $cache_for = self::CACHE_TIME_IN_HOURS * 60;

        $release = Cache::remember('latest_version', $cache_for, function () {

            $request = Request::get($this->github_url)
                              ->expectsJson()
                              ->withAccept('application/vnd.github.v3+json');

            if (config('deployer.github_oauth_token')) {
                $request->withAuthorization('token ' . config('deployer.github_oauth_token'));
            }

            $response = $request->send();

            // FIXME: handle errors, maybe throw an exception?
            return $response->body;
        });

        return $release->tag_name;
    }
}

Fix the cache time as it is in minutes, not seconds


<?php

namespace Orchestra\Model\Scopes;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;
use Illuminate\Database\Eloquent\Builder;

class UserWithRoleScope implements Scope
{
    /**
     * The selected role.
     *
     * @var string
     */
    protected $role;

    /**
     * Construct the scope.
     *
     * @param  string  $role
     */
    public function __construct($role)
    {
        $this->role = $role;
    }

    /**
     * Apply the scope to a given Eloquent query builder.
     *
     * @param  \Illuminate\Database\Eloquent\Builder  $builder
     * @param  \Illuminate\Database\Eloquent\Model  $model
     *
     * @return void
     */
    public function apply(Builder $builder, Model $model)
    {
        if (empty($this->role)) {
            return;
        }

        $builder->whereHas('roles', function ($query) {
            $query->where('name', '=', $this->role);
        });
    }
}

<?php

namespace Orchestra\Model\Scopes;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Scope;
use Illuminate\Database\Eloquent\Builder;

class UserWithRoleScope implements Scope
{
    /**
     * The selected role.
     *
     * @var string|array
     */
    protected $role;

    /**
     * Construct the scope.
     *
     * @param  string|array  $role
     */
    public function __construct($role)
    {
        $this->role = $role;
    }

    /**
     * Apply the scope to a given Eloquent query builder.
     *
     * @param  \Illuminate\Database\Eloquent\Builder  $builder
     * @param  \Illuminate\Database\Eloquent\Model  $model
     *
     * @return void
     */
    public function apply(Builder $builder, Model $model)
    {
        if (empty($this->role)) {
            return;
        }

        $builder->whereHas('roles', function ($query) {
            $query->whereIn('name', (array) $this->role);
        });
    }
}

Use where in and cast to array.

Use where in and cast to array.

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


<?php

namespace Emergence\People;

use HandleBehavior;

class Invitation extends \ActiveRecord
{
    public static $tableName = 'invitations';
    public static $singularNoun = 'invitation';
    public static $pluralNoun = 'invitations';

    public static $fields = [
        'RecipientID' => [
            'type' => 'uint',
            'index' => true
        ],
        'Handle' => [
            'unique' => true
        ],
        'Status' => [
            'type' => 'enum',
            'values' => ['Pending', 'Used', 'Revoked'],
            'default' => 'Pending'
        ],
        'Expires' => [
            'type' => 'timestamp',
            'notnull' => false
        ],
        'Used' => [
            'type' => 'timestamp',
            'notnull' => false
        ]
    ];

    public static $relationships = [
        'Recipient' => [
            'type' => 'one-one',
            'class' => Person::class
        ]
    ];

    public function save($deep = true)
    {
        // set handle
        if (!$this->Handle) {
            $this->Handle = HandleBehavior::generateRandomHandle($this);
        }

        // call parent
        parent::save($deep);
    }
}

<?php

namespace Emergence\People;

use HandleBehavior;

class Invitation extends \ActiveRecord
{
    public static $tableName = 'invitations';
    public static $singularNoun = 'invitation';
    public static $pluralNoun = 'invitations';

    public static $fields = [
        'RecipientID' => [
            'type' => 'uint',
            'index' => true
        ],
        'Handle' => [
            'unique' => true
        ],
        'Status' => [
            'type' => 'enum',
            'values' => ['Pending', 'Used', 'Revoked'],
            'default' => 'Pending'
        ],
        'Expires' => [
            'type' => 'timestamp',
            'default' => null
        ],
        'Used' => [
            'type' => 'timestamp',
            'default' => null
        ]
    ];

    public static $relationships = [
        'Recipient' => [
            'type' => 'one-one',
            'class' => Person::class
        ]
    ];

    public function save($deep = true)
    {
        // set handle
        if (!$this->Handle) {
            $this->Handle = HandleBehavior::generateRandomHandle($this);
        }

        // call parent
        parent::save($deep);
    }
}

Use ActiveRecord field 'default' config

Use ActiveRecord field 'default' config


<?php
// ~/Sites/presentation/mvc-basics/database/migrations/YYYY_MM_DD_HHIISS_create_event_tickets_table.php
// Use your text editor to edit the migration file and add the following code in the `up` method to replace
// the placeholder `//` comment. Documentation on other column types is available on the Laravel website.
//

public function up()
    {
        // Table columns
        $table->increments('id');
        $table->string('ticketholder_name')->nullable();
        $table->decimal('ticket_price', 10, 2)->default(0.00);
        $table->timestamps();
    }

<?php
// ~/Sites/presentation/mvc-basics/database/migrations/YYYY_MM_DD_HHIISS_create_event_tickets_table.php
// Use your text editor to edit the migration file and add the following code in the `up` method to replace
// the placeholder `//` comment. Documentation on other column types is available on the Laravel website.
//

public function up()
    {
        Schema::create('event_tickets', function (Blueprint $table) {
            $table->increments('id');
            $table->string('ticketholder_name')->nullable();
            $table->decimal('ticket_price', 10, 2)->default(0.00);
            $table->timestamps();
        });
    }

Update laravel/mvc-basics/step-by-step/03 to add schema for table


<?php
/*
 * This file is part of Yolk - Gamer Network's PHP Framework.
 *
 * Copyright (c) 2015 Gamer Network Ltd.
 *
 * Distributed under the MIT License, a copy of which is available in the
 * LICENSE file that was bundled with this package, or online at:
 * https://github.com/gamernetwork/yolk-contracts
 */

namespace yolk\contracts\app;

interface Dispatcher {

	/**
	 * Dispatches the specified request.
	 * @param $request
	 * @return  the response to the request
	 */
	public function dispatch( Request $request );

}

// EOF

<?php
/*
 * This file is part of Yolk - Gamer Network's PHP Framework.
 *
 * Copyright (c) 2015 Gamer Network Ltd.
 *
 * Distributed under the MIT License, a copy of which is available in the
 * LICENSE file that was bundled with this package, or online at:
 * https://github.com/gamernetwork/yolk-contracts
 */

namespace yolk\contracts\app;

interface Dispatcher {

	/**
	 * Dispatches the specified request.
	 * @param $request
	 * @return Response the response to the request
	 */
	public function dispatch( Request $request );

}

// EOF

Correct return type in docblock

Correct return type in docblock


<?php namespace Illuminate\Console;

use Closure;

trait ConfirmableTrait {

	/**
	 * Confirm before proceeding with the action
	 *
	 * @param  string    $warning
	 * @param  \Closure  $callback
	 * @return bool
	 */
	public function confirmToProceed($warning = 'Application In Production!', Closure $callback = null)
	{
		$shouldConfirm = $callback ?: $this->getDefaultConfirmCallback();

		if (call_user_func($shouldConfirm))
		{
			if ($this->option('force')) return true;

			$this->comment(str_repeat('*', strlen($warning) + 12));
			$this->comment('*     '.$warning.'     *');
			$this->comment(str_repeat('*', strlen($warning) + 12));
			$this->output->writeln('');

			$confirmed = $this->confirm('Do you really wish to run this command?');

			if ( ! $confirmed)
			{
				$this->comment('Command Cancelled!');

				return false;
			}
		}

		return true;
	}

	/**
	 * Get the default confirmation callback.
	 *
	 * @return \Closure
	 */
	protected function getDefaultConfirmCallback()
	{
		return function() { return $this->getLaravel()->environment() == 'production'; };
	}

}

<?php namespace Illuminate\Console;

use Closure;

trait ConfirmableTrait {

	/**
	 * Confirm before proceeding with the action
	 *
	 * @param  string    $warning
	 * @param  \Closure  $callback
	 * @return bool
	 */
	public function confirmToProceed($warning = 'Application In Production!', Closure $callback = null)
	{
		$shouldConfirm = $callback ?: $this->getDefaultConfirmCallback();

		if (call_user_func($shouldConfirm))
		{
			if ($this->option('force')) return true;

			$this->comment(str_repeat('*', strlen($warning) + 12));
			$this->comment('*     '.$warning.'     *');
			$this->comment(str_repeat('*', strlen($warning) + 12));
			$this->output->writeln('');

			$confirmed = $this->confirm('Do you really wish to run this command? [Y/n]');

			if ( ! $confirmed)
			{
				$this->comment('Command Cancelled!');

				return false;
			}
		}

		return true;
	}

	/**
	 * Get the default confirmation callback.
	 *
	 * @return \Closure
	 */
	protected function getDefaultConfirmCallback()
	{
		return function() { return $this->getLaravel()->environment() == 'production'; };
	}

}

Make default action on confirmToProceed very clear

It's not clear by default whether this will default to Yes or No. This fixes that.


<?PHP  //$Id$
// This file defines the current version of the
// backup/restore code that is being used.  This can be
// compared against the values stored in the
// database (backup_version) to determine whether upgrades should
// be performed (see db/backup_*.php)

$backup_version = 2004042700;   // The current version is a date (YYYYMMDDXX)

$backup_release = "1.3 development";  // User-friendly version number

<?PHP  //$Id$
// This file defines the current version of the
// backup/restore code that is being used.  This can be
// compared against the values stored in the
// database (backup_version) to determine whether upgrades should
// be performed (see db/backup_*.php)

$backup_version = 2004042701;   // The current version is a date (YYYYMMDDXX)

$backup_release = "1.3 development";  // User-friendly version number

Update it a bit too!

Update it a bit too!


<?php

namespace Wnx\LaravelStats\Tests\Stubs;

use Wnx\LaravelStats\ReflectionClass;
use Wnx\LaravelStats\Contracts\Classifier;

class MyCustomComponentClassifier implements Classifier
{
    public function getName() : string
    {
        return 'My Custom Component';
    }

    public function satisfies(ReflectionClass $class) : bool
    {
        return $class->hasProperty('foo');
    }
}

<?php

namespace Wnx\LaravelStats\Tests\Stubs;

use Wnx\LaravelStats\ReflectionClass;
use Wnx\LaravelStats\Contracts\Classifier;

class MyCustomComponentClassifier implements Classifier
{
    public function name() : string
    {
        return 'My Custom Component';
    }

    public function satisfies(ReflectionClass $class) : bool
    {
        return $class->hasProperty('foo');
    }
}

Update Classifier used in Tests

Update Classifier used in Tests


<?php

namespace Siler\Test\Unit;

use PHPUnit\Framework\TestCase;
use function Siler\Dotenv\env as env;

class DotenvTest extends TestCase
{
    public function testEnv()
    {
        $lines = \Siler\Dotenv\init(__DIR__.'/../../fixtures');

        $this->assertEquals(1, count($lines));
        $this->assertEquals('FOO=bar', $lines[0]);
        $this->assertEquals($_SERVER, env());
        $this->assertEquals('bar', env('FOO'));
        $this->assertEquals('baz', env('BAR', 'baz'));
        $this->assertNull(env('BAR'));
    }
}

<?php

namespace Siler\Test\Unit;

use PHPUnit\Framework\TestCase;
use function Siler\Dotenv\env as env;

class DotenvTest extends TestCase
{
    public function testEnv()
    {
        $lines = \Siler\Dotenv\init(__DIR__.'/../../fixtures');

        $this->assertEquals(4, count($lines));
        $this->assertEquals('FOO=bar', $lines[0]);
        $this->assertEquals($_SERVER, env());
        $this->assertEquals('bar', env('FOO'));
        $this->assertEquals('baz', env('BAR', 'baz'));
        $this->assertNull(env('BAR'));
    }
}

Update test with new env keys count

Update test with new env keys count


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

/**
 * @see    http://hiqdev.com/hipanel-module-hosting
 * @license http://hiqdev.com/hipanel-module-hosting/license
 * @copyright Copyright (c) 2015 HiQDev
 */

namespace hipanel\modules\hosting\models;

use hipanel\base\SearchModelTrait;
use hipanel\helpers\ArrayHelper;

class RequestSearch extends Request
{
    use SearchModelTrait {
        searchAttributes as defaultSearchAttributes;
    }

    public function rules()
    {
        return ArrayHelper::merge(parent::rules(), [
            [['ids'], 'safe', 'on' => ['search']],
        ]);
    }
}

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

/**
 * @see    http://hiqdev.com/hipanel-module-hosting
 * @license http://hiqdev.com/hipanel-module-hosting/license
 * @copyright Copyright (c) 2015 HiQDev
 */

namespace hipanel\modules\hosting\models;

use hipanel\base\SearchModelTrait;
use hipanel\helpers\ArrayHelper;

class RequestSearch extends Request
{
    use SearchModelTrait {
        searchAttributes as defaultSearchAttributes;
    }

    public function rules()
    {
        return ArrayHelper::merge(parent::rules(), [
            [['ids'], 'safe', 'on' => ['search']],
            [['id_in'], 'safe'],
        ]);
    }
}

Add `id_in` to request search

Add `id_in` to request search


<?php
namespace mxdiModuleTest;

use mxdiModule\Factory\DiAbstractFactory;
use mxdiModuleTest\TestObjects;
use Zend\ServiceManager as SM;

abstract class TestCase extends \PHPUnit_Framework_TestCase
{
    /** @var SM\ServiceManager */
    private $sm;

    /** @var array */
    private $config = [
        'invokables' => [
            TestObjects\DependencyA::class => TestObjects\DependencyA::class,
            TestObjects\DependencyB::class => TestObjects\DependencyB::class,
            TestObjects\DependencyC::class => TestObjects\DependencyC::class,
            TestObjects\DependencyD::class => TestObjects\DependencyD::class,
            'dependency_e'                 => TestObjects\DependencyE::class,
        ],
        'abstract_factories' => [
            DiAbstractFactory::class,
        ],
    ];

    /**
     * @return SM\ServiceManager
     */
    protected function getServiceManager()
    {
        if (! $this->sm) {
            $this->sm = new SM\ServiceManager(new SM\Config($this->config));
        }

        return $this->sm;
    }
}

<?php
namespace mxdiModuleTest;

use mxdiModule\Factory\DiAbstractFactory;
use mxdiModuleTest\TestObjects;
use Zend\ServiceManager as SM;

abstract class TestCase extends \PHPUnit_Framework_TestCase
{
    /** @var SM\ServiceManager */
    private $sm;

    /** @var array */
    private $config = [
        'invokables' => [
            TestObjects\DependencyA::class => TestObjects\DependencyA::class,
            TestObjects\DependencyB::class => TestObjects\DependencyB::class,
            TestObjects\DependencyC::class => TestObjects\DependencyC::class,
            TestObjects\DependencyD::class => TestObjects\DependencyD::class,
            'dependency_e'                 => TestObjects\DependencyE::class,
        ],
        'abstract_factories' => [
            DiAbstractFactory::class,
        ],
    ];

    /**
     * @return SM\ServiceManager
     */
    protected function getServiceManager()
    {
        if (! $this->sm) {
            $this->sm = new SM\ServiceManager(new SM\Config($this->config));
        }

        return $this->sm;
    }

    /**
     * @param array $config
     */
    public function setServiceManagerConfig(array $config)
    {
        $this->config = $config;
    }
}

Allow config override for the sm

Allow config override for the sm


<?php
declare (strict_types = 1);

\Jentil()->utilities->loader->loadPartial('header');

if (!\Jentil()->utilities->page->is('singular')) {
    if (($jentil_title = \Jentil()->utilities->page->title->themeMod()->get())
        || \Jentil()->utilities->page->is('customize_preview')
    ) { ?>

            <?php \do_action('jentil_before_title'); ?>

<?php
                echo $jentil_title;
            ?>

            <?php \do_action('jentil_after_title'); ?>

    <?php }
}

/**
 * Prevent calls to `global $jentil_title`.
 */
unset($jentil_title);

\do_action('jentil_before_content');

if (\Jentil()->utilities->page->is('404')
    || !($jentil_posts = \Jentil()->utilities->page->posts->render())
) {
    \Jentil()->utilities->loader->loadPartial('none');
} else {
    echo $jentil_posts;
}

/**
 * Prevent calls to `global $jentil_posts`.
 */
unset($jentil_posts);

\do_action('jentil_after_content');

\Jentil()->utilities->loader->loadPartial('footer');

Move `||` at the beginning of lines to end of previous line


<?php

/*
 * This file is part of the Api package.
 *
 * (c) EXSyst
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace EXSyst\Component\Api\Version\Resolver;

use Composer\Semver\Semver;
use EXSyst\Component\Api\Version\VersionResolverInterface;

abstract class AbstractVersionResolver implements VersionResolverInterface
{
    /**
     * @var array
     */
    protected $versions;

    /**
     * @param array $versions ordered
     */
    public function __construct(array $versions)
    {
        $this->versions = $versions;
    }

    /**
     * @param string $constraint
     *
     * @return scalar|false
     */
    protected function satisfiedBy($constraint)
    {
        foreach ($this->versions as $version => $options) {
            if (Semver::satisfies($version, $constraint)) {
                return $version;
            }
        }

        return false;
    }
}

<?php

/*
 * This file is part of the Api package.
 *
 * (c) EXSyst
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace EXSyst\Component\Api\Version\Resolver;

use Composer\Semver\Semver;
use EXSyst\Component\Api\Version\VersionResolverInterface;

abstract class AbstractVersionResolver implements VersionResolverInterface
{
    /**
     * @var array
     */
    protected $versions;

    /**
     * @param array $versions ordered
     */
    public function __construct(array $versions)
    {
        $this->versions = $versions;
    }

    /**
     * @param string $constraint
     *
     * @return scalar|false
     */
    protected function satisfiedBy($constraint)
    {
        foreach ($this->versions as $version) {
            if (Semver::satisfies($version, $constraint)) {
                return $version;
            }
        }

        return false;
    }
}

[BC] Use the value as the version number in the version resolvers


<?php

namespace App\Console\Commands;

use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;

class MarkPastEventsDeleted extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'harvester:mark-past-events-deleted';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Finds any events and performances that are in the past and soft-deletes them. This is intended to be run at 12:01AM.';

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

    /**
     * Execute the console command.
     *
     * @return mixed
     * @throws Exception
     */
    public function handle()
    {
        $now = new Carbon();
        $eventCounts = DB::table('events')->where('occurs_at', '<', $now)->whereNull('deleted_at')->update(['deleted_at' => $now]);
        $this->info($eventCounts . ' Events were soft-deleted.');

        $performancesCounts = DB::table('performances')->where('occurs_at', '<', $now)->whereNull('deleted_at')->update(['deleted_at' => $now]);
        $this->info($performancesCounts . ' Performances were soft-deleted.');

    }
}

<?php

namespace App\Console\Commands;

use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;

class MarkPastEventsDeleted extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'harvester:mark-past-events-deleted';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Finds any events and performances that are in the past and soft-deletes them. This is intended to be run at 12:01AM.';

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

    /**
     * Execute the console command.
     *
     * @return mixed
     * @throws Exception
     */
    public function handle()
    {
        $now = new Carbon();
        $endOfYesterday = new Carbon('midnight today');
        $endOfYesterday->subSecond();

        $eventCounts = DB::table('events')->where('occurs_at', '<=', $endOfYesterday)->whereNull('deleted_at')->update(['deleted_at' => $now]);
        $this->info($eventCounts . ' Events were soft-deleted.');

        $performancesCounts = DB::table('performances')->where('occurs_at', '<=', $endOfYesterday)->whereNull('deleted_at')->update(['deleted_at' => $now]);
        $this->info($performancesCounts . ' Performances were soft-deleted.');

    }
}

Improve soft-deleting of past events

Improve soft-deleting of past events


<?php

namespace App\Console\Commands;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

class ImportScheduleDaily extends BaseCommand
{

    protected $signature = 'import:daily';

    protected $description = 'Run all increment commands on sources that we\'re able to, and do a full refresh on sources that require it.';

    public function handle()
    {

        $this->call('import:collections');
        $this->call('import:exhibitions-legacy');
        $this->call('import:events-ticketed');
        $this->call('import:events-legacy');
        $this->call('import:mobile');
        $this->call('import:set-ulan-uris');
        $this->call('import:products');
        $this->call('import:web');

    }

}

<?php

namespace App\Console\Commands;

use Aic\Hub\Foundation\AbstractCommand as BaseCommand;

class ImportScheduleDaily extends BaseCommand
{

    protected $signature = 'import:daily';

    protected $description = 'Run all increment commands on sources that we\'re able to, and do a full refresh on sources that require it.';

    public function handle()
    {

        $this->call('import:collections');
        $this->call('import:exhibitions-legacy');
        $this->call('import:events-ticketed');
        $this->call('import:events-legacy');
        $this->call('import:mobile');
        $this->call('import:set-ulan-uris');
        $this->call('import:products');
        $this->call('import:web');
        $this->call('import:analytics');

    }

}

Add daily import for Google Analytics boosting


<?php

namespace Michaeljennings\Feed\Contracts;

interface Repository
{

}

<?php

namespace Michaeljennings\Feed\Contracts;

interface Repository
{
    /**
     * Create a new notification.
     *
     * @param array $notification
     * @return \Michaeljennings\Feed\Contracts\Notification
     */
    public function newNotification(array $notification);

    /**
     * Get all of the unread notifications for the notifiable members.
     *
     * @param array $types
     * @param array $ids
     * @param null  $limit
     * @param null  $offset
     * @return mixed
     */
    public function getNotifications(array $types, array $ids, $limit = null, $offset = null);

    /**
     * Get all of the read notifications for the notifiable members.
     *
     * @param array $types
     * @param array $ids
     * @param null  $limit
     * @param null  $offset
     * @return mixed
     */
    public function getReadNotifications(array $types, array $ids, $limit = null, $offset = null);

    /**
     * Mark the notification as read.
     *
     * @param Notification $notification
     * @return mixed
     */
    public function read(Notification $notification);

    /**
     * Mark the notification as unread.
     *
     * @param Notification $notification
     * @return mixed
     */
    public function unread(Notification $notification);
}

Add method stubs to the repository contract


<?php
namespace Craft;

use Cake\Utility\Hash as Hash;

class DropdownFeedMeFieldType extends BaseFeedMeFieldType
{
    // Templates
    // =========================================================================

    // Public Methods
    // =========================================================================

    public function prepFieldData($element, $field, $fieldData, $handle, $options)
    {
        $preppedData = array();

        $data = Hash::get($fieldData, 'data');

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

        $settings = $field->getFieldType()->getSettings();
        $options = $settings->getAttribute('options');

        // find matching option label
        foreach ($options as $option) {
            if ($data == $option['value']) {
                $preppedData = $option['value'];
                break;
            }
        }

        return $preppedData;
    }

}

<?php
namespace Craft;

use Cake\Utility\Hash as Hash;

class DropdownFeedMeFieldType extends BaseFeedMeFieldType
{
    // Templates
    // =========================================================================

    // Public Methods
    // =========================================================================

    public function prepFieldData($element, $field, $fieldData, $handle, $options)
    {
        $preppedData = null;

        $data = Hash::get($fieldData, 'data');

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

        $settings = $field->getFieldType()->getSettings();
        $options = $settings->getAttribute('options');

        foreach ($options as $option) {
            if ($data == $option['value']) {
                $preppedData = $option['value'];
                break;
            }
        }

        return $preppedData;
    }

}

Fix default value for dropdown field (when no value matches)


<?php

namespace Brexis\LaravelWorkflow\Traits;

use Workflow;

trait WorkflowTrait
{
    public function workflow_can($transition, $workflow = null)
    {
        return Workflow::get($this, $workflow)->can($this, $transition);
    }

    public function workflow_transitions()
    {
        return Workflow::get($this)->getEnabledTransitions($this);
    }
}

<?php

namespace Brexis\LaravelWorkflow\Traits;

use Workflow;

trait WorkflowTrait
{
    public function workflow_apply($transition, $workflow = null)
    {
        return Workflow::get($this, $workflow)->apply($this, $transition);
    }

    public function workflow_can($transition, $workflow = null)
    {
        return Workflow::get($this, $workflow)->can($this, $transition);
    }

    public function workflow_transitions()
    {
        return Workflow::get($this)->getEnabledTransitions($this);
    }
}

Add apply method to workflow trait

Add apply method to workflow trait


<?php

if (!defined('PAGE_TITLE')) define('PAGE_TITLE', 'Matavior');
if (!defined('PAGE_AUTHOR')) define('PAGE_AUTHOR', 'MadnessFreak');
if (!defined('PAGE_KEYWORDS')) define('PAGE_KEYWORDS', 'Matavior, Mata, Framework, Free, Open Source, PHP');
if (!defined('PAGE_DESCRIPTION')) define('PAGE_DESCRIPTION', 'Matavior is a little free web-framework.');

if (!defined('DB_PREFIX')) define('DB_PREFIX', 'mata');

<?php

if (!defined('PAGE_TITLE')) define('PAGE_TITLE', 'Matavior');
if (!defined('PAGE_AUTHOR')) define('PAGE_AUTHOR', 'MadnessFreak');
if (!defined('PAGE_KEYWORDS')) define('PAGE_KEYWORDS', 'Matavior, Mata, Framework, Free, Open Source, PHP');
if (!defined('PAGE_DESCRIPTION')) define('PAGE_DESCRIPTION', 'Matavior is a little free web-framework.');
if (!defined('DEFAULT_LANGUAGE')) define('DEFAULT_LANGUAGE', 'en');
if (!defined('DB_PREFIX')) define('DB_PREFIX', 'mata');

if (!defined('SESSION_TIMEOUT')) define('SESSION_TIMEOUT', 450); // 7.5 min

if (!defined('COOKIE_SESSION')) define('COOKIE_SESSION', 'mata_session');
if (!defined('COOKIE_LANGUAGE')) define('COOKIE_LANGUAGE', 'mata_lang');
if (!defined('COOKIE_LOGIN_REMEMBER')) define('COOKIE_LOGIN_REMEMBER', 'mata_remember');

Add cookie and session defines

Add cookie and session defines


<?php

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

class AddQuantityColumnToPostsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('posts', function (Blueprint $table) {
            $table->integer('quantity')->after('northstar_id')->default(null)->nullable();
        });
    }

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

<?php

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

class AddQuantityColumnToPostsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('posts', function (Blueprint $table) {
            $table->integer('quantity')->after('northstar_id')->nullable();
        });
    }

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

Remove default null because nullable does that


<?php

namespace LaravelLb;

use Illuminate\Support\ServiceProvider;

class LaravelLbServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        $this->publishes([
            __DIR__.'../config/logicboxes.php' => config_path('logicboxes.php'),
        ]);
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind('LaravelLb\LogicBoxes', function ($app) {
            $testMode = config('logicboxes.test_mode');
            $userId = config('logicboxes.auth_userid');
            $apiKey = config('logicboxes.api_key');
            return new LogicBoxes($userId, $apiKey, $testMode);
        });
    }
}

<?php

namespace LaravelLb;

use Illuminate\Support\ServiceProvider;

class LaravelLbServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        $this->publishes([
            __DIR__.'/../config/logicboxes.php' => config_path('logicboxes.php'),
        ]);
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind('LaravelLb\LogicBoxes', function ($app) {
            $testMode = config('logicboxes.test_mode');
            $userId = config('logicboxes.auth_userid');
            $apiKey = config('logicboxes.api_key');
            return new LogicBoxes($userId, $apiKey, $testMode);
        });
    }
}

Fix can't publish config file.

Fix can't publish config file.


<?php

namespace Omnipay\GoPay\Message;

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

class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface
{

    /**
     * Is the response successful?
     *
     * @return boolean
     */
    public function isSuccessful()
    {
        $redirectUrl = $this->getRedirectUrl();
        return is_string($redirectUrl);
    }

    /**
     * Gets the redirect target url.
     */
    public function getRedirectUrl()
    {
        if (!is_array($this->data) || !isset($this->data['gw_url']) || !is_string($this->data['gw_url'])) {
            return null;
        }
        return $this->data['gw_url'];
    }

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

    /**
     * Gets the redirect form data array, if the redirect method is POST.
     */
    public function getRedirectData()
    {
        return null;
    }

    /**
     * @return string
     */
    public function getState()
    {
        return $this->data['state'];
    }
}

<?php

namespace Omnipay\GoPay\Message;

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

class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface
{
    /**
     * Is the response successful?
     *
     * @return boolean
     */
    public function isSuccessful()
    {
        $redirectUrl = $this->getRedirectUrl();
        return is_string($redirectUrl);
    }

    /**
     * Gets the redirect target url.
     */
    public function getRedirectUrl()
    {
        if (!is_array($this->data) || !isset($this->data['gw_url']) || !is_string($this->data['gw_url'])) {
            return null;
        }
        return $this->data['gw_url'];
    }

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

    /**
     * Gets the redirect form data array, if the redirect method is POST.
     */
    public function getRedirectData()
    {
        return null;
    }

    /**
     * @return string
     */
    public function getState()
    {
        return $this->data['state'];
    }

    public function getTransactionReference()
    {
        if (isset($this->data['id'])) {
            return $this->data['id'];
        }
        return null;
    }
}

Add support for Transactions Reference Id from Gopay

https://doc.gopay.com/en/?shell#standard-payment


<?php

namespace Soap\ThProvinces;

use Soap\ThProvinces\Provinces\Provinces;
use Soap\ThProvinces\Commands\MigrationCommand;
use Illuminate\Support\ServiceProvider;

class ProvincesServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        $this->publishes([
            __DIR__.'/Config/thprovinces.php' => config_path('thprovinces.php'),
        ], 'config');
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->mergeConfigFrom( __DIR__.'/Config/thprovinces.php', 'thprovinces');
        $this->registerProvinces();
        $this->registerCommands();
    }

    protected function registerProvinces()
    {
        $this->app['thprovinces'] = $this->app->share(function($app) {
            return new Provinces;
        });
    }

    protected function registerCommands()
    {
        $this->app['command.provinces.migration'] = $this->app->share(function($app)
        {
            return new MigrationCommand($app);
        });

        $this->commands('command.provinces.migration');
    }
}

<?php

namespace Soap\ThProvinces;

use Soap\ThProvinces\Provinces\Provinces;
use Soap\ThProvinces\Commands\MigrationCommand;
use Illuminate\Support\ServiceProvider;

class ProvincesServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        $this->publishes([
            __DIR__.'/Config/thprovinces.php' => config_path('thprovinces.php'),
        ], 'thprovinces');
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->mergeConfigFrom( __DIR__.'/Config/thprovinces.php', 'thprovinces');
        $this->registerProvinces();
        $this->registerCommands();
    }

    protected function registerProvinces()
    {
        $this->app['thprovinces'] = $this->app->share(function($app) {
            return new Provinces;
        });
    }

    protected function registerCommands()
    {
        $this->app['command.provinces.migration'] = $this->app->share(function($app)
        {
            return new MigrationCommand($app);
        });

        $this->commands('command.provinces.migration');
    }
}

Fix configuration file did not publish.

Fix configuration file did not publish.


<?php

namespace Rogue\Services;

use Illuminate\Support\Facades\Log;
use Softonic\GraphQL\ClientBuilder;

class GraphQL
{
    /**
     * Build a new GraphQL client.
     */
    public function __construct()
    {
        $this->client = ClientBuilder::build(config('services.graphql.url'));
    }

    /**
     * Run a GraphQL query using the client
     * and parse the data result into a convenient format.
     *
     * @param  $query     String
     * @param  $variables Array
     * @param  $queryKey  String
     * @return array|null
     */
    public function query($query, $variables, $queryKey)
    {
        // Use try/catch to avoid any GraphQL related errors breaking the application.
        try {
            $response = $this->client->query($query, $variables);
        } catch (\Exception $exception) {
            Log::error(
                'GraphQL request failed. Variables: '.json_encode($variables).' Exception: '.$exception->getMessage()
            );

            return null;
        }

        return $response ? array_get($response->getData(), $queryKey) : null;
    }

    /**
     * Query for a CampaignWebsite by campaignId field.
     *
     * @param  $campaignId String
     * @return array|null
     */
    public function getCampaignWebsiteByCampaignId($campaignId)
    {
        $query = '
        query GetCampaignWebsiteByCampaignId($campaignId: String!) {
          campaignWebsiteByCampaignId(campaignId: $campaignId) {
            title
            slug
          }
        }';

        $variables = [
            'campaignId' => $campaignId,
        ];

        return $this->query($query, $variables, 'campaignWebsiteByCampaignId');
    }
}

<?php

namespace Rogue\Services;

use Illuminate\Support\Facades\Log;
use Softonic\GraphQL\ClientBuilder;

class GraphQL
{
    /**
     * Build a new GraphQL client.
     */
    public function __construct()
    {
        $this->client = ClientBuilder::build(config('services.graphql.url'));
    }

    /**
     * Run a GraphQL query using the client and return the data result.
     *
     * @param  $query     String
     * @param  $variables Array
     * @return array|null
     */
    public function query($query, $variables)
    {
        // Use try/catch to avoid any GraphQL related errors breaking the application.
        try {
            $response = $this->client->query($query, $variables);
        } catch (\Exception $exception) {
            Log::error(
                'GraphQL request failed. Variables: '.json_encode($variables).' Exception: '.$exception->getMessage()
            );

            return null;
        }

        return $response ? $response->getData() : null;
    }

    /**
     * Query for a CampaignWebsite by campaignId field.
     *
     * @param  $campaignId String
     * @return array|null
     */
    public function getCampaignWebsiteByCampaignId($campaignId)
    {
        $query = '
        query GetCampaignWebsiteByCampaignId($campaignId: String!) {
          campaignWebsiteByCampaignId(campaignId: $campaignId) {
            title
            slug
          }
        }';

        $variables = [
            'campaignId' => $campaignId,
        ];

        return $this->query($query, $variables, 'campaignWebsiteByCampaignId');
    }
}

Remove the $queryKey param and associated parsing


<?php
/**
 * Created by PhpStorm.
 * User: mgrloren
 * Date: 7/31/15
 * Time: 2:55 PM
 */
?>

                    {{--

--}}

                    {{--

--}}
                    {{--

--}}

                {{--
Built with  at Bootply
      --}}

Add Instagram link to footer

Add Instagram link to footer


<?php

// Try to find the application root directory.
$appRoot = "E:\approot\app";
if (isset($_SERVER['ApplicationPath'])) {
    $appRoot = $_SERVER['ApplicationPath'] . '\app';
}

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

use Symfony\Component\HttpFoundation\Request;

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

<?php

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

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

use Symfony\Component\HttpFoundation\Request;

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

Fix GH-3 - Switching E/F drives now and using the Env variable ApplicationPath as default.


<?php namespace Despark\LaravelSocialFeeder;

use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\ServiceProvider;

class LaravelSocialFeederServiceProvider extends ServiceProvider {

	/**
	 * Indicates if loading of the provider is deferred.
	 *
	 * @var bool
	 */
	protected $defer = false;

	/**
	 * Register the service provider.
	 *
	 * @return void
	 */
	public function register()
	{
		//
	}

	public function boot()
	{
		$this->package('despark/laravel-social-feeder');

		AliasLoader::getInstance()->alias('SocialFeeder', 'Despark\LaravelSocialFeeder\SocialFeeder');
	}

	/**
	 * Get the services provided by the provider.
	 *
	 * @return array
	 */
	public function provides()
	{
		return array();
	}

}

<?php namespace Despark\LaravelSocialFeeder;

use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\ServiceProvider;
use App;

class LaravelSocialFeederServiceProvider extends ServiceProvider {

	/**
	 * Indicates if loading of the provider is deferred.
	 *
	 * @var bool
	 */
	protected $defer = false;

	/**
	 * Register the service provider.
	 *
	 * @return void
	 */
	public function register()
	{
		//
	}

	public function boot()
	{
		$this->package('despark/laravel-social-feeder');

		App::register('SammyK\LaravelFacebookSdk\LaravelFacebookSdkServiceProvider');

		AliasLoader::getInstance()->alias('SocialFeeder', 'Despark\LaravelSocialFeeder\SocialFeeder');
		AliasLoader::getInstance()->alias('Facebook', 'SammyK\LaravelFacebookSdk\FacebookFacade');
	}

	/**
	 * Get the services provided by the provider.
	 *
	 * @return array
	 */
	public function provides()
	{
		return array();
	}

}

Add alias and register facebook

Add alias and register facebook


<?php namespace Layla\Module\Generators;

use Illuminate\Support\Facades\Blade;

class Generator {

	/**
	 * The blueprint to use
	 *
	 * @var \Layla\Module\Blueprints\Blueprint
	 */
	protected $blueprint;

	/**
	 * Location of the stub
	 *
	 * @var string
	 */
	protected $stub;

	/**
	 * Create a new Generator instance
	 *
	 * @param Blueprint $blueprint
	 */
	public function __construct(Blueprint $blueprint)
	{
		$this->blueprint = $blueprint;
	}

	/**
	 * Generate the file
	 *
	 * @return boolean Could we save it?
	 */
	public function generate()
	{
		$result = $this->generateString();

		$destination = $this->blueprint->getDestination();
		$pathInfo = pathinfo($destination);
		$directory = $pathInfo['dirname'];

		// try to make sure that the destination exists
		@mkdir($directory, 0755, true);

		// store the result
		return file_put_contents($destination, $result);
	}

	/**
	 * Get the generated string
	 *
	 * @return string
	 */
	public function generateString()
	{
		$blueprint = $this->blueprint;
		$destination = $blueprint->getDestination();
		$data = $blueprint->getAttributes();

		$data = array_merge($data, compact('blueprint', 'destination'));

		return eval_blade(layla_module_stubs_path().$this->stub, $data);
	}

}

<?php namespace Layla\Module\Generators;

use Illuminate\Support\Facades\Blade;

class Generator {

	/**
	 * The blueprint to use
	 *
	 * @var \Layla\Module\Blueprints\Blueprint
	 */
	protected $blueprint;

	/**
	 * Location of the stub
	 *
	 * @var string
	 */
	protected $stub;

	/**
	 * Create a new Generator instance
	 *
	 * @param Blueprint $blueprint
	 */
	public function __construct(Blueprint $blueprint)
	{
		$this->blueprint = $blueprint;
	}

	/**
	 * Generate the file
	 *
	 * @return boolean Could we save it?
	 */
	public function generate()
	{
		$result = $this->generateString();

		$destination = $this->blueprint->getDestination();
		$pathInfo = pathinfo($destination);
		$directory = $pathInfo['dirname'];

		// try to make sure that the destination exists
		@mkdir($directory, 0755, true);

		// store the result
		return file_put_contents($destination, $result);
	}

	/**
	 * Get the generated string
	 *
	 * @return string
	 */
	public function generateString()
	{
		$blueprint = $this->blueprint;
		$destination = $blueprint->getDestination();
		$data = $blueprint->getAttributes();

		$data = array_merge($data, compact('blueprint', 'destination'));

		return '<?php'.eval_blade(layla_module_stubs_path().$this->stub, $data);
	}

}

Include php tag after processing stub for generators


<?php
/**
 * Queue wrapper
 */
class Model_TaskQueue extends \Queue\Model_TaskQueue
{
	/**
	 * @override
	 */
	public static function notify($msg)
	{
		\HipChat::forge()->send_message($msg);
	}
}

<?php
/**
 * Queue wrapper
 */
class Model_TaskQueue extends \Queue\Model_TaskQueue
{

	/**
	 * @override
	 */
	protected static $_observers = array(
		'Orm\\Observer_CreatedAt' => array(
			'events' => array('before_insert'),
			'mysql_timestamp' => true,
			'property' => 'created_at',
		),
		'Orm\\Observer_UpdatedAt' => array(
			'events' => array('before_save'),
			'mysql_timestamp' => true,
			'property' => 'updated_at',
		),
	);

	/**
	 * @override
	 */
	public static function notify($msg)
	{
		\HipChat::forge()->send_message($msg);
	}
}

Add $_observer to Model_TaskQueue for overwrap


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

<?php the_title(); ?>

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

      <?php the_content(); ?>

      <?php wp_link_pages(['before' => '
' . __('Pages:', 'sage'), 'after' => '
']); ?>

    <?php comments_template('/templates/comments.php'); ?>

<?php endwhile; ?>

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

<?php the_title(); ?>

      <?php the_content(); ?>

<?php endwhile; ?>

Remove extra info from posts

Remove extra info from posts


<?php
/**
 * @license   http://opensource.org/licenses/BSD-2-Clause BSD-2-Clause
 */

namespace ZF\Configuration;

use Zend\Mvc\Controller\AbstractActionController;
use ZF\ApiProblem\ApiProblem;

class ConfigController extends AbstractActionController
{
    protected $config;

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

    public function processAction()
    {
        $request = $this->getRequest();
        switch ($request->getMethod()) {
            case $request::METHOD_GET:
                return $this->config->fetch();
            case $request::METHOD_PATCH:
                $params = $this->bodyParams();
                return $this->config->patch($params);
            default:
                return new ApiProblem(405, 'Only the methods GET and PATCH are allowed for this URI');
        }
    }
}

<?php
/**
 * @license   http://opensource.org/licenses/BSD-2-Clause BSD-2-Clause
 */

namespace ZF\Configuration;

use Zend\Mvc\Controller\AbstractActionController;
use ZF\ApiProblem\ApiProblem;

class ConfigController extends AbstractActionController
{
    protected $config;

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

    public function processAction()
    {
        $request  = $this->getRequest();
        $headers  = $request->getHeaders();
        $useTrees = $this->shouldUseTrees($headers);

        switch ($request->getMethod()) {
            case $request::METHOD_GET:
                return $this->config->fetch($useTrees);
            case $request::METHOD_PATCH:
                $params = $this->bodyParams();
                return $this->config->patch($params, $useTrees);
            default:
                return new ApiProblem(405, 'Only the methods GET and PATCH are allowed for this URI');
        }
    }

    protected function shouldUseTrees($headers)
    {
        if (!$headers->has('content-type')) {
            return false;
        }

        $header      = $headers->has('content-type');
        $value       = $header->getFieldValue();
        $value       = explode(';', $value, 2);
        $contentType = array_shift($value);
        $contentType = strtolower($value);

        if ($contentType === 'application/vnd.zfcampus.v1.config') {
            return true;
        }

        return false;
    }
}

Switch usage of trees based on content-type

- If content-type is application/vnd.zfcampus.v1.config, use trees


<?php
/**
 * Runs PHPUnit command in browser for ZnZend module tests
 *
 * Useful if there is no access to commandline, eg. restricted permissions
 * Assuming the contents of ZnZend module are in <webroot>/zf2app/vendor/ZnZend,
 * and this file resides in ZnZend/test, just type the following line in the browser:
 *     http://localhost/zf2app/vendor/ZnZend/test/phpunit_cmd_browser.php
 *
 * @author Zion Ng <zion@intzone.com>
 * @link   [Source] http://github.com/zionsg/ZnZend
 * @since  2012-12-04T13:00+08:00
 */
require_once 'PHPUnit/vendor/autoload.php'; // assumes PHPUnit library is in include path
$command = new PHPUnit_TextUI_Command;
?>
<pre>
  <?php $command->run(array(), true); // output result in <pre> tags ?>
</pre>

<?php
/**
 * Runs PHPUnit command in browser for ZnZend module tests
 *
 * Useful if there is no access to commandline, eg. restricted permissions
 * Assuming the contents of ZnZend module are in <webroot>/zf2app/vendor/ZnZend,
 * and this file resides in ZnZend/test, just type the following line in the browser:
 *     http://localhost/zf2app/vendor/ZnZend/test/phpunit_cmd_browser.php
 *
 * @author Zion Ng <zion@intzone.com>
 * @link   [Source] http://github.com/zionsg/ZnZend
 * @since  2012-12-04T13:00+08:00
 */

// Assumes PHPUnit has been installed via Composer and is in include path
require_once 'PHPUnit/vendor/autoload.php';
$command = new PHPUnit_TextUI_Command;
?>
<pre>
  <?php $command->run(array(), true); // output result in <pre> tags ?>
</pre>

Add comment on PHPUnit installation via Composer


<?php

/**
 * The main Slimdown namespace.
 */
namespace Slimdown;

class Slimdown {

  /**
   * The config object.
   * @var \Slimdown\Config
   */
  protected static $config;

  /**
   * Application version.
   */
  const VERSION = '1.0.0';

  /**
   * Sets and retrieves global configuration.
   *
   * If called with a block, the config object will be passed to the block and
   * allow settings to be modified.
   *
   *     \Slimdown\Slimdown::config(function($config) {
   *       $config->set_location('pages');
   *     }
   *
   * The settings object is always returned.
   *
   * @param callable $block Anonymous function to call with config object.
   * @return \Slimdown\Config Object with configuration params.
  */
  public static function config(\Closure $block = null) {
    if (!self::$config) {
      self::$config = new \Slimdown\Config();
    }

    // Allow configuration via a block.
    if ($block) {
      $block(self::$config);
    }

    return self::$config;
  }
}

<?php

/**
 * The main Slimdown namespace.
 */
namespace Slimdown;

class Slimdown {

  /**
   * The config object.
   * @var \Slimdown\Config
   */
  protected static $config;

  /**
   * Application version.
   */
  const VERSION = '0.1.0';

  /**
   * Sets and retrieves global configuration.
   *
   * If called with a block, the config object will be passed to the block and
   * allow settings to be modified.
   *
   *     \Slimdown\Slimdown::config(function($config) {
   *       $config->set_location('pages');
   *     }
   *
   * The settings object is always returned.
   *
   * @param callable $block Anonymous function to call with config object.
   * @return \Slimdown\Config Object with configuration params.
  */
  public static function config(\Closure $block = null) {
    if (!self::$config) {
      self::$config = new \Slimdown\Config();
    }

    // Allow configuration via a block.
    if ($block) {
      $block(self::$config);
    }

    return self::$config;
  }
}

Set the version for testing.

Set the version for testing.


<?php

return [
    'listId' => '',
    'installationUrl' => '',
    'apiKey' => '',
];

<?php

return [
    // Sendy installation URL
    'installationUrl' => '',

    // Default list id
    'listId' => '',

    // The Sendy API Key
    'apiKey' => '',
];

Add some documentation in settings

Add some documentation in settings


<?php

return [
    'name'          => [
        'name' => 'Name'
    ],
    'slug'          => [
        'name' => 'Slug'
    ],
    'size'          => [
        'name' => 'Size'
    ],
    'disk'          => [
        'name' => 'Disk'
    ],
    'folder'        => [
        'name' => 'Folder'
    ],
    'adapter'       => [
        'name' => 'Adapter'
    ],
    'keywords'      => [
        'name' => 'Keywords'
    ],
    'mime_type'     => [
        'name' => 'Mime Type'
    ],
    'preview'       => [
        'name' => 'Preview'
    ],
    'description'   => [
        'name' => 'Description'
    ],
    'allowed_types' => [
        'name'         => 'Allowed Types',
        'instructions' => 'Specify the file type extensions that are allowed in this folder.',
        'placeholder'  => 'pdf, psd, jpg'
    ]
];

<?php

return [
    'name'          => [
        'name' => 'Name'
    ],
    'slug'          => [
        'name' => 'Slug'
    ],
    'size'          => [
        'name' => 'Size'
    ],
    'disk'          => [
        'name' => 'Disk'
    ],
    'folder'        => [
        'name' => 'Folder'
    ],
    'adapter'       => [
        'name' => 'Adapter'
    ],
    'keywords'      => [
        'name' => 'Keywords'
    ],
    'mime_type'     => [
        'name' => 'Mime Type'
    ],
    'preview'       => [
        'name' => 'Preview'
    ],
    'description'   => [
        'name' => 'Description'
    ],
    'allowed_types' => [
        'name'         => 'Allowed Types',
        'instructions' => 'Specify the file type extensions that are allowed in this folder.',
        'warning'      => 'Note subtle differences between mime types like jpg and jpeg.',
        'placeholder'  => 'pdf, psd, jpg, jpeg'
    ]
];

Add warning about mime types

Add warning about mime types


<?php
declare(strict_types=1);

    $call = str_replace('/', DIRECTORY_SEPARATOR, '../vendor/bin/condorcet-doc');
    $arg = substr(__DIR__, 0, strlen(__DIR__) - 4);
    $arg .= DIRECTORY_SEPARATOR.'Documentation';

    $cmd = $call.' "'.$arg.'"';

    shell_exec($cmd);

<?php
declare(strict_types=1);

    // Build command

    $call = str_replace('/', DIRECTORY_SEPARATOR, '../vendor/bin/condorcet-doc');
    $path = substr(__DIR__, 0, strlen(__DIR__) - 4);
    $path .= DIRECTORY_SEPARATOR.'Documentation';

    $cmd = $call.' "'.$path.'"';

    // Clear folder

    function rrmdir($dir, $path) {
       if (is_dir($dir)) :
         $objects = scandir($dir);
         foreach ($objects as $object) :
           if ($object != "." && $object != ".." && $object !== 'doc.yaml') :
             if (filetype($dir."/".$object) == "dir") :
                rrmdir($dir."/".$object,$path);
            else :
                 unlink($dir."/".$object);
            endif;
           endif;
         endforeach;
         reset($objects);
        if ($dir !== $path) :
            rmdir($dir);
        endif;
       endif;
    }

    rrmdir($path,$path);

    // Execute command

    shell_exec($cmd);

Clear old documentation before rewrite

Clear old documentation before rewrite


<?
class SessionsController extends ApplicationController{
  function login(){
		$this->layout = 'login';
	}

	function process(){
		$this->auth->logUserIn($_POST['email'], $_POST['password']);
	}

	function logout(){
		$this->auth->logout();

		$this->redirect($this->config['root']);
	}
}
?>

<?
class SessionsController extends ApplicationController{
  function login(){
    //Show Login Page
	}

	function process(){
		$this->auth->logUserIn($_POST['email'], $_POST['password']);
	}

	function logout(){
		$this->auth->logout();

		$this->redirect($this->config['root']);
	}
}
?>

Update sessions controller to remove custom layout


<?php

/**
 * PluginProductCategory form.
 *
 * @package    ##PROJECT_NAME##
 * @subpackage form
 * @author     ##AUTHOR_NAME##
 * @version    SVN: $Id: sfDoctrineFormPluginTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
abstract class PluginProductCategoryForm extends BaseProductCategoryForm
{
	public function configure()
	{
		parent::setup();

		$this->useFields(array(
            'id', 'name', 'description'
        ));
	}

    protected function doSave($con = null)
    {
        parent::doSave($con);

        if($this->isNew())
        {
	        $node = $this->object->getNode();
	        $parent = $this->object->getTable()->getTree()->fetchRoot();

	        if($parent)
	        {
	            $method = ($node->isValidNode() ? 'move' : 'insert') . 'AsLastChildOf';
	            $node->$method($parent); //calls $this->object->save internally
	        }
        }
    }
}

<?php

/**
 * PluginProductCategory form.
 *
 * @package    ##PROJECT_NAME##
 * @subpackage form
 * @author     ##AUTHOR_NAME##
 * @version    SVN: $Id: sfDoctrineFormPluginTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
abstract class PluginProductCategoryForm extends BaseProductCategoryForm
{
	public function setup()
	{
		parent::setup();

		$this->useFields(array(
            'id', 'name', 'description'
        ));
	}

    protected function doSave($con = null)
    {
        parent::doSave($con);

        if($this->isNew())
        {
	        $node = $this->object->getNode();
	        $parent = $this->object->getTable()->getTree()->fetchRoot();

	        if($parent)
	        {
	            $method = ($node->isValidNode() ? 'move' : 'insert') . 'AsLastChildOf';
	            $node->$method($parent); //calls $this->object->save internally
	        }
        }
    }
}

Change configure to setup method

[ddOnlineStorePlugin] Change configure to setup method

git-svn-id: 8b8afaa04106040b671d0ed3b268285890208be0@33046 ee427ae8-e902-0410-961c-c3ed070cd9f9


<?php

/**
 * This file is part of the hyyan/woo-poly-integration plugin.
 * (c) Hyyan Abo Fakher <hyyanaf@gmail.com>.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Hyyan\WPI;

/**
 * Ajax.
 *
 * Handle Ajax
 *
 * @author Marian Kadanka <marian.kadanka@gmail.com>
 */
class Ajax {

	/**
	 * Construct object.
	 */
	public function __construct() {
		add_filter( 'pll_home_url_white_list', array( $this, 'pll_home_url_white_list' ) );
	}

	/**
	 * Add WooCommerce class-wc-ajax.php to the Polylang home_url white list
	 *
	 * @param array $white_list Polylang home_url white list
	 *
	 * @return array filtered white list
	 */
	public function pll_home_url_white_list( $white_list ) {
		$white_list[] = array( 'file' => 'class-wc-ajax.php' );
		return $white_list;
	}

}

Fix indentation according to coding standards