<?php

namespace models;

/**
 * Supplies instances of the configured PaymentProcessor implementation.
 */
class PaymentProcessorFactory {

	/**
	 * @return instance of a \models\PaymentProcessor implementation configured
	 * for use via config.ini.
	 * @throws exception when no PaymentProcessor implementation is configured.
	 */
	static function instance() {
		if (!\F3::get('payment_processor'))
			throw new \Exception("payment_processor configuration cannot be empty. Enter the full classpath of the \models\PaymentProcessor implementation.");

		$name = \F3::get('payment_processor');
		return new $name;
	}

}

<?php

namespace models;

/**
 * Supplies instances of the configured PaymentProcessor implementation.
 */
class PaymentProcessorFactory {

	/**
	 * @return class name of the PaymentProcessor implementation
	 * @throws exception when no PaymentProcessor implementation is configured
	 */
	static function className() {
		self::checkConfig();
		return \F3::get('payment_processor');
	}

	/**
	 * @return instance of a \models\PaymentProcessor implementation configured
	 * for use via config.ini.
	 * @throws exception when no PaymentProcessor implementation is configured.
	 */
	static function instance() {
		self::checkConfig();
		$name = \F3::get('payment_processor');
		return new $name;
	}

	/**
	 * Check if implementation of PaymentProcessor is correctly configured.
	 * Throw exception if not.
	 */
	protected static function checkConfig() {
		if (!\F3::get('payment_processor'))
			throw new \Exception("payment_processor configuration cannot be empty. Enter the full classpath of the \models\PaymentProcessor implementation.");
	}

}

Allow fetching class name of configured PaymentProcessor


<?php

namespace MockaTests;

use Mocka\MethodMock;

class MethodMockTest extends \PHPUnit_Framework_TestCase {

    public function testIntegrated() {
        $method = new MethodMock();
        $method->set(function () {
            return 'foo';
        });
        $method->at(1, function () {
            return 'bar';
        });
        $method->at([2, 5], function () {
            return 'zoo';
        });

        $this->assertSame('foo', $method->invoke());
        $this->assertSame('bar', $method->invoke());
        $this->assertSame('zoo', $method->invoke());
        $this->assertSame('foo', $method->invoke());

        $method->set(function () {
            return 'def';
        });
        $this->assertSame('def', $method->invoke());
        $this->assertSame('zoo', $method->invoke());
    }
}

<?php

namespace MockaTests;

use Mocka\MethodMock;

class MethodMockTest extends \PHPUnit_Framework_TestCase {

    public function testIntegrated() {
        $method = new MethodMock();
        $method->set(function () {
            return 'foo';
        });
        $method->at(1, function () {
            return 'bar';
        });
        $method->at(array(2, 5), function () {
            return 'zoo';
        });

        $this->assertSame('foo', $method->invoke());
        $this->assertSame('bar', $method->invoke());
        $this->assertSame('zoo', $method->invoke());
        $this->assertSame('foo', $method->invoke());

        $method->set(function () {
            return 'def';
        });
        $this->assertSame('def', $method->invoke());
        $this->assertSame('zoo', $method->invoke());
    }
}

Make tests compatible with php 5.3

Make tests compatible with php 5.3


<?php

namespace Kunstmaan\NodeBundle\Tests\Helper;

use Kunstmaan\UtilitiesBundle\Helper\Slugifier;
use PHPUnit\Framework\TestCase;

class SlugifierTest extends TestCase
{
    /**
     * @var Slugifier
     */
    private $slugifier;

    public function setUp(): void
    {
        $this->slugifier = new Slugifier();
    }

    /**
     * @param string $text   The text to slugify
     * @param string $result The slug it should generate
     *
     * @dataProvider getSlugifyData
     */
    public function testSlugify($text, $result)
    {
        $this->assertEquals($result, $this->slugifier->slugify($text));
    }

    /**
     * Provides data to the {@link testSlugify} function
     *
     * @return array
     */
    public function getSlugifyData()
    {
        return [
            ['', ''],
            ['test', 'test'],
            ['een titel met spaties', 'een-titel-met-spaties'],
            ['à partir d\'aujourd\'hui', 'a-partir-daujourdhui'],
            ['CaPs ShOulD be LoweRCasEd', 'caps-should-be-lowercased'],
            ['áàäåéèëíìïóòöúùüñßæ', 'aaaaeeeiiiooouuunssae'],
            ['polish-ążśźęćńół', 'polish-azszecnol'],
        ];
    }
}

<?php

namespace Kunstmaan\UtilitiesBundle\Tests\Helper;

use Kunstmaan\UtilitiesBundle\Helper\Slugifier;
use PHPUnit\Framework\TestCase;

class SlugifierTest extends TestCase
{
    /**
     * @var Slugifier
     */
    private $slugifier;

    public function setUp(): void
    {
        $this->slugifier = new Slugifier();
    }

    /**
     * @param string $text   The text to slugify
     * @param string $result The slug it should generate
     *
     * @dataProvider getSlugifyData
     */
    public function testSlugify($text, $result)
    {
        $this->assertEquals($result, $this->slugifier->slugify($text));
    }

    /**
     * Provides data to the {@link testSlugify} function
     *
     * @return array
     */
    public function getSlugifyData()
    {
        return [
            ['', ''],
            ['test', 'test'],
            ['een titel met spaties', 'een-titel-met-spaties'],
            ['à partir d\'aujourd\'hui', 'a-partir-daujourdhui'],
            ['CaPs ShOulD be LoweRCasEd', 'caps-should-be-lowercased'],
            ['áàäåéèëíìïóòöúùüñßæ', 'aaaaeeeiiiooouuunssae'],
            ['polish-ążśźęćńół', 'polish-azszecnol'],
        ];
    }
}

[AllBundles] Fix incorrect namespaces in test classes


<?

defined('C5_EXECUTE') or die("Access Denied.");

/**
* Concrete Model Class
* The model class extends the ADOdb active record class, allowing items that inherit from it to use the automatic create, updating, read and delete functionality it provides.
* @link http://phplens.com/lens/adodb/docs-active-record.htm
* @author Andrew Embler <andrew@concrete5.org>
* @link http://www.concrete5.org
* @package Utilities
* @license http://www.opensource.org/licenses/mit-license.php MIT
*
*/
class Concrete5_Library_Model extends ADOdb_Active_Record {

	public function __construct() {
	 	$db = Loader::db();
	 	parent::__construct();
	}

}

<?

defined('C5_EXECUTE') or die("Access Denied.");

/**
* Concrete Model Class
* The model class extends the ADOdb active record class, allowing items that inherit from it to use the automatic create, updating, read and delete functionality it provides.
* @link http://phplens.com/lens/adodb/docs-active-record.htm
* @author Andrew Embler <andrew@concrete5.org>
* @link http://www.concrete5.org
* @package Utilities
* @license http://www.opensource.org/licenses/mit-license.php MIT
*
*/
class Concrete5_Library_Model extends ADOdb_Active_Record {}

Remove Unnecessary Code from Model Class

Remove Unnecessary Code from Model Class

`Model::__construct()` does not actually accomplish anything anymore. It
is just a stub to `ADOdb_Active_Record`

- Pass onto parent class by removing stub constructor


<?php

namespace Michaeljennings\Carpenter\Contracts;

interface Store
{
    /**
     * Set the model to be used for the table.
     *
     * @param mixed $model
     * @return Store
     */
    public function model($model);

    /**
     * Return all of the results.
     *
     * @return array
     */
    public function results();

    /**
     * Return a count of all of the results.
     *
     * @return int
     */
    public function count();

    /**
     * Return a paginated list of results.
     *
     * @param int|string $amount
     * @param int|string $page
     * @param int|string $perPage
     * @return array
     */
    public function paginate($amount, $page, $perPage);

    /**
     * Order the results by the given column in the given direction.
     *
     * @param string $key
     * @param string $direction
     * @return Store
     */
    public function orderBy($key, $direction = 'asc');

    /**
     * Unset any set order queries.
     *
     * @return mixed
     */
    public function refreshOrderBy();

    /**
     * Get the store data wrapper.
     *
     * @return string
     */
    public function getWrapper();
}

<?php

namespace Michaeljennings\Carpenter\Contracts;

interface Store
{
    /**
     * Set the model to be used for the table.
     *
     * @param mixed $model
     * @return Store
     */
    public function model($model);

    /**
     * Return all of the results.
     *
     * @return array
     */
    public function results();

    /**
     * Return a count of all of the results.
     *
     * @return int
     */
    public function count();

    /**
     * Return a paginated list of results.
     *
     * @param int|string $amount
     * @param int|string $page
     * @param int|string $perPage
     * @return array
     */
    public function paginate($amount, $page, $perPage);

    /**
     * Order the results by the given column in the given direction.
     *
     * @param string $key
     * @param string $direction
     * @return Store
     */
    public function orderBy($key, $direction = 'asc');

    /**
     * Unset any set order queries.
     *
     * @return mixed
     */
    public function refreshOrderBy();

    /**
     * Get the store data wrapper.
     *
     * @return string
     */
    public function getWrapper();

    /**
     * Set the unique table key.
     *
     * @param string $key
     */
    public function setKey($key);
}

Add setKey method to store contract

Add setKey method to store contract


<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/

// Search Engine Robot Routes
Route::get('/confession/{id}', function ($id) {
    $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
    $botTypes = 'bot|crawl|slurp|spider|facebookexternalhit';

    $isCrawler = ! empty($userAgent) ? preg_match("/{$botTypes}/", $userAgent) > 0 : false;

    if ($isCrawler) {
        return App::make('NUSWhispers\Http\Controllers\RobotsController')->getConfession($id);
    } else {
        return File::get(public_path() . '/app.html');
    }
});

// Auth Routes
Auth::routes(['register' => false]);

// Mobile submit page
Route::get('/mobile_submit', function () {
    return File::get(public_path() . '/mobile_submit.html');
});

// Reroute everything else to angular
Route::get('/{getEverything?}/{all?}', function () {
    return File::get(public_path() . '/app.html');
});

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/

// Search Engine Robot Routes
Route::get('/confession/{id}', function ($id) {
    $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
    $botTypes = 'bot|crawl|slurp|spider|facebookexternalhit';

    $isCrawler = ! empty($userAgent) ? preg_match("/{$botTypes}/", $userAgent) > 0 : false;

    if ($isCrawler) {
        return App::make('NUSWhispers\Http\Controllers\RobotsController')->getConfession($id);
    } else {
        return File::get(public_path() . '/app.html');
    }
});

// Auth Routes
Auth::routes(['register' => false]);
Route::get('logout', 'Auth\LoginController@logout');

// Mobile submit page
Route::get('/mobile_submit', function () {
    return File::get(public_path() . '/mobile_submit.html');
});

// Reroute everything else to angular
Route::get('/{getEverything?}/{all?}', function () {
    return File::get(public_path() . '/app.html');
});

Fix logout route not working in admin

Fix logout route not working in admin


<?php namespace Craft;

class SimpleSitemapController extends BaseController
{
	protected $allowAnonymous = true;

	public function actionIndex()
	{
		$xml = new \SimpleXMLElement(
			'<?xml version="1.0" encoding="UTF-8"?>' .
			'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"/>'
		);

		$criteria = craft()->elements->getCriteria(ElementType::Entry);
		$criteria->limit = null;

		foreach ($criteria as $entry)
		{
			$url = $xml->addChild('url');
			$url->addChild('loc', $entry->url);
			$url->addChild('lastmod', $entry->dateUpdated->format(\DateTime::W3C));
			$url->addChild('priority', $entry->uri == '__home__' ? 0.75 : 0.5);
		}

		HeaderHelper::setContentTypeByExtension('xml');
		ob_start();
		echo $xml->asXML();
		craft()->end();
	}
}

<?php namespace Craft;

class SimpleSitemapController extends BaseController
{
	protected $allowAnonymous = true;

	public function actionIndex()
	{
		$xml = new \SimpleXMLElement(
			'<?xml version="1.0" encoding="UTF-8"?>' .
			'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"/>'
		);

		$criteria = craft()->elements->getCriteria(ElementType::Entry);
		$criteria->limit = null;

		foreach ($criteria as $entry) {
			if($entry->url) {
				$url = $xml->addChild('url');
				$url->addChild('loc', $entry->url);
				$url->addChild('lastmod', $entry->dateUpdated->format(\DateTime::W3C));
				$url->addChild('priority', $entry->uri == '__home__' ? 0.75 : 0.5);
			}
		}

		HeaderHelper::setContentTypeByExtension('xml');
		ob_start();
		echo $xml->asXML();
		craft()->end();
	}
}

Exclude entries that don't have their own URLs


<?php

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

namespace FOS\RestBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

/**
 * Checks if the SensioFrameworkExtraBundle views annotations are disabled when using the View Response listener.
 *
 * @author Eriksen Costa <eriksencosta@gmail.com>
 */
class ConfigurationCheckPass implements CompilerPassInterface
{
    public function process(ContainerBuilder $container)
    {
        if ($container->has('sensio_framework_extra.view.listener') && $container->has('fos_rest.view_response_listener')) {
            throw new \RuntimeException('You need to disable the view annotations in SensioFrameworkExtraBundle when using the FOSRestBundle View Response listener.');
        }

        if ($container->has('fos_rest.converter.request_body') && !$container->has('sensio_framework_extra.converter.listener')) {
            throw new \RuntimeException('You need to enable the parameter converter listeners in SensioFrameworkExtraBundle when using the FOSRestBundle RequestBodyParamConverter');
        }
    }
}

<?php

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

namespace FOS\RestBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

/**
 * Checks if the SensioFrameworkExtraBundle views annotations are disabled when using the View Response listener.
 *
 * @author Eriksen Costa <eriksencosta@gmail.com>
 */
class ConfigurationCheckPass implements CompilerPassInterface
{
    public function process(ContainerBuilder $container)
    {
        if ($container->has('sensio_framework_extra.view.listener') && $container->has('fos_rest.view_response_listener')) {
            throw new \RuntimeException('You need to disable the view annotations in SensioFrameworkExtraBundle when using the FOSRestBundle View Response listener. Add "view: { annotations: false }" to the sensio_framework_extra: section of your config.yml');
        }

        if ($container->has('fos_rest.converter.request_body') && !$container->has('sensio_framework_extra.converter.listener')) {
            throw new \RuntimeException('You need to enable the parameter converter listeners in SensioFrameworkExtraBundle when using the FOSRestBundle RequestBodyParamConverter');
        }
    }
}

Include config in exception message

Include config in exception message

Added the configuration needed to disable view annocations.


<?php

namespace MyTravel\Core\Config;

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

final class ApplicationConfiguration implements ConfigurationInterface {

  public function getConfigTreeBuilder() {
    $treeBuilder = new TreeBuilder();
    // Build the tree
    $node = $treeBuilder
      ->root('application')
      ->children();
    $node
      ->enumNode('environment')->defaultValue('dev')
        ->values(array('dev', 'staging', 'prod'))
        ->info('Which environment the application currently runs (dev|staging|prod).')
      ->end()
      ->scalarNode('appname')->defaultValue('MyTravel')->end()
      ->scalarNode('view')->defaultValue('default')->end()
      ->integerNode('pagecachetime')
        ->defaultValue(60*60*24)
        ->info('Cache expiration time in seconds.')
      ->end()
    ->end();
    return $treeBuilder;
  }

}

<?php

namespace MyTravel\Core\Config;

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

final class ApplicationConfiguration implements ConfigurationInterface {

  public function getConfigTreeBuilder() {
    $treeBuilder = new TreeBuilder();
    // Build the tree
    $node = $treeBuilder
      ->root('application')
      ->children();
    $node
      ->enumNode('environment')->defaultValue('prod')
        ->values(array('dev', 'staging', 'prod'))
        ->info('Which environment the application currently runs (dev|staging|prod).')
      ->end()
      ->scalarNode('appname')->defaultValue('MyTravel')->end()
      ->scalarNode('view')->defaultValue('default')->end()
      ->integerNode('pagecachetime')
        ->defaultValue(60*60*24)
        ->info('Cache expiration time in seconds.')
      ->end()
    ->end();
    return $treeBuilder;
  }

}

Set production as default environment

Set production as default environment


<?php

namespace Smartbox\Integration\FrameworkBundle\DependencyInjection\CompilerPasses;

use Smartbox\Integration\FrameworkBundle\Tools\SmokeTests\ConnectivityCheckSmokeTest;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

/**
 * Class SmokeTestConnectivityCompilerPass.
 */
class SmokeTestConnectivityCompilerPass implements CompilerPassInterface
{
    /**
     * You can modify the container here before it is dumped to PHP code.
     *
     * @param ContainerBuilder $container
     *
     * @api
     */
    public function process(ContainerBuilder $container)
    {
        $smokeTestCommand = $container->getDefinition('smartcore.command.smoke_test');
        $connectivityCheckSmokeTestClass = $container->getParameter('smartesb.smoke_test.connectivity_check.class');
        $connectivityCheckSmokeTestItems = $container->findTaggedServiceIds(ConnectivityCheckSmokeTest::TAG_TEST_CONNECTIVITY);
        foreach ($connectivityCheckSmokeTestItems as $serviceName => $tags) {
            $testServiceName = $serviceName.'.connectivity_smoke_test';
            $container->register($testServiceName, $connectivityCheckSmokeTestClass)
                ->setArguments([
                    'Connectivity check for '.$serviceName,
                    [$testServiceName => new Reference($serviceName)],
                ])
            ;
            $smokeTestCommand->addMethodCall('addTest', [$testServiceName, new Reference($testServiceName)]);
        }
    }
}

<?php

namespace Smartbox\Integration\FrameworkBundle\DependencyInjection\CompilerPasses;

use Smartbox\Integration\FrameworkBundle\Tools\SmokeTests\ConnectivityCheckSmokeTest;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

/**
 * Class SmokeTestConnectivityCompilerPass.
 */
class SmokeTestConnectivityCompilerPass implements CompilerPassInterface
{
    /**
     * @param ContainerBuilder $container
     *
     * @api
     */
    public function process(ContainerBuilder $container)
    {
        $smokeTestCommand = $container->getDefinition('smartcore.command.smoke_test');
        $connectivityCheckSmokeTestClass = $container->getParameter('smartesb.smoke_test.connectivity_check.class');
        $connectivityCheckSmokeTestItems = $container->findTaggedServiceIds(ConnectivityCheckSmokeTest::TAG_TEST_CONNECTIVITY);
        foreach ($connectivityCheckSmokeTestItems as $serviceName => $tags) {
            $testServiceName = $serviceName.'.connectivity_smoke_test';
            $container->register($testServiceName, $connectivityCheckSmokeTestClass)
                ->setArguments([
                    'Connectivity check for '.$serviceName,
                    [$testServiceName => new Reference($serviceName)],
                ])
            ;

            $labels = [];

            foreach ($tags as $tag => $attr) {
                if (array_key_exists('labels', $attr)) {
                    $labels = explode(',', $attr['labels']);
                }
            }
            $smokeTestCommand->addMethodCall('addTest', [$testServiceName, new Reference($testServiceName), 'run', 'getDescription', $labels]);
        }
    }
}

Update smoke test compiler pass

Update smoke test compiler pass


<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Poll extends Model
{
  use SoftDeletes;

  protected $hidden = [
    'user_id', 'updated_at', 'deleted_at',
  ];

  protected $dates = ['deleted_at'];

  public function user()
  {
    return $this->belongsTo(User::class);
  }

  public function answers()
  {
    return $this->hasMany(Answer::class);
  }
}

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Poll extends Model
{
  use SoftDeletes;

  protected $hidden = [
    'user_id', 'updated_at', 'deleted_at',
  ];

  protected $dates = ['deleted_at'];

  public function users()
  {
    return $this->belongsTo(User::class);
  }

  public function answers()
  {
    return $this->hasMany(Answer::class);
  }
}

Rename 'user' to 'users' on poll model

Rename 'user' to 'users' on poll model


<?php
namespace Repositories\Indexers;

use Repositories\LocalRepository;

class MonsterGroup implements IndexerInterface
{
    protected $database;

    const DEFAULT_INDEX = "monstergroups";
    const ID_FIELD = "name";

    public function onFinishedLoading(LocalRepository $repo)
    {
        foreach ($repo->all(self::DEFAULT_INDEX) as $id) {
            $group = $repo->get(self::DEFAULT_INDEX, $id);
        }
    }

    public function onNewObject(LocalRepository $repo, $object)
    {
        if ($object->type == "monstergroup") {
            $repo->set(self::DEFAULT_INDEX, $object->name);
            $repo->set(self::DEFAULT_INDEX.".".$object->name, $object->repo_id);

            // create unique monsters array
            $monsters = array();

            foreach ($object->monsters as $monster) {
                $monster = $monster->monster;
                $monsters[$monster] = true;
            }
            $object->uniqueMonsters = array_keys($monsters);

            return;
        }
    }
}

<?php
namespace Repositories\Indexers;

use Repositories\LocalRepository;

class MonsterGroup implements IndexerInterface
{
    protected $database;

    const DEFAULT_INDEX = "monstergroups";
    const ID_FIELD = "name";

    public function onFinishedLoading(LocalRepository $repo)
    {
    }

    public function onNewObject(LocalRepository $repo, $object)
    {
        if ($object->type == "monstergroup") {
            $repo->set(self::DEFAULT_INDEX, $object->name);
            $repo->set(self::DEFAULT_INDEX.".".$object->name, $object->repo_id);

            return;
        }
    }
}

Remove unneeded monster indexer code.

Remove unneeded monster indexer code.


<?php echo $head; ?>

 <?php
                    echo _('Hey!');
                    echo ' ';
                    ?>

 <?php
                    echo ' ';
                    echo _('Welcome to the captive portal.');
                    ?>

 <?php
                    echo ' ';
                    echo _('You need to be connected to our WLAN Hotspot for complete functionality.');
                    ?>

 <?php
                    echo ' ';
                    echo _('However, you can try a demo mode!');
                    echo ' ';
                    echo _('After you log in with Facebook, you will be redirected to our website at');
                    echo ' ';
                    echo $portal_url;
                    echo '.';
                    ?>

                    <a class="pure-button pure-button-primary" href="<?php echo $page_url; ?>"><?php echo 'Demo: Connect to ' .  $page_name . _(' on Facebook'); ?>

<?php echo $foot; ?>

<?php echo $head; ?>

 <?php
                    echo _('Hey!');
                    echo ' ';
                    ?>

 <?php
                    echo ' ';
                    echo _('Welcome to the captive portal.');
                    ?>

 <?php
                    echo ' ';
                    echo _('You need to be connected to our WLAN Hotspot for complete functionality.');
                    ?>

 <?php
                    echo ' ';
                    echo _('However, you can try a demo mode!');
                    echo ' ';
                    echo _('After you log in with Facebook, you will be redirected to our website at');
                    echo ' ';
                    echo $portal_url;
                    echo '.';
                    ?>

                    <a class="pure-button pure-button-primary" href="<?php echo $page_url; ?>">

                        <?php echo 'Demo: Connect to ' .  $page_name . _(' on Facebook'); ?>

<?php echo $foot; ?>

Add play icon to demo button

Add play icon to demo button


<?php namespace NZTim\Queue\Commands;

use Illuminate\Support\Collection;
use NZTim\Queue\QueuedJob\QueuedJob;

class ListJobs
{
    public function table(Collection $entries)
    {
        $jobs = [];
        foreach ($entries as $entry) {
            /** @var QueuedJob $entry */
            $job['Created'] = $entry->created_at->format('Y-m-d - H:i');
            $job['ID'] =  "ID:{$entry->getId()}";
            $job['Class'] = get_class($entry->getJob());
            $job['Status'] = is_null($entry->deleted_at) ? "Incomplete" : "Complete";
            $job['Status'] .= " ({$entry->attempts})";
            if ($entry->attempts == 0) {
                $job['Status'] = "Failed!!!";
            }
            $jobs[] = $job;
        }
        return $jobs;
    }
}

<?php namespace NZTim\Queue\Commands;

use Illuminate\Support\Collection;
use NZTim\Queue\QueuedJob\QueuedJob;

class ListJobs
{
    public function table(Collection $entries)
    {
        $jobs = [];
        foreach ($entries as $entry) {
            /** @var QueuedJob $entry */
            $job['Created'] = $entry->created_at->format('Y-m-d - H:i');
            $job['ID'] =  "ID:{$entry->getId()}";
            $job['Class'] = get_class($entry->getJob());
            $job['Status'] = is_null($entry->deleted_at) ? "Incomplete" : "Complete";
            $job['Status'] .= " ({$entry->attempts})";
            if ($entry->attempts == 0) {
                $job['Status'] = "Failed!!!";
            }
            $job['Deleted'] = $entry->deleted_at ? "Yes" : '';
            $jobs[] = $job;
        }
        return $jobs;
    }
}

Add deleted status to list command

Add deleted status to list command


<?php

namespace Bishopm\Connexion\Http\Controllers\Auth;

use JWTAuth;
use Tymon\JWTAuth\Exceptions\JWTException;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Bishopm\Connexion\Models\User;

class ApiAuthController extends Controller
{
    public function login(Request $request)
    {
        // grab credentials from the request
        $credentials = $request->only('name', 'password');
        $user=User::where('name',$request->input('name'))->first();
        $fullname=$user->individual->firstname . " " . $user->individual->surname;
        $indiv_id=$user->individual_id;
        //Log::info('API login attempt: ' . json_encode($credentials));

        try {
            // attempt to verify the credentials and create a token for the user
            if (! $token = JWTAuth::attempt($credentials)) {
                return response()->json(['error' => 'invalid_credentials'], 401);
            }
        } catch (JWTException $e) {
            // something went wrong whilst attempting to encode the token
            return response()->json(['error' => 'could_not_create_token'], 500);
        }

        // all good so return the token
        return response()->json(compact('token','fullname','indiv_id'));
    }

}

<?php

namespace Bishopm\Connexion\Http\Controllers\Auth;

use JWTAuth;
use Tymon\JWTAuth\Exceptions\JWTException;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Bishopm\Connexion\Models\User;

class ApiAuthController extends Controller
{
    public function login(Request $request)
    {
        // grab credentials from the request
        $credentials = $request->only('name', 'password');
        $user=User::where('name',$request->input('name'))->first();
        $fullname=$user->individual->firstname . " " . $user->individual->surname;
        $indiv_id=$user->individual_id;
        $user_id=$user->id;
        //Log::info('API login attempt: ' . json_encode($credentials));

        try {
            // attempt to verify the credentials and create a token for the user
            if (! $token = JWTAuth::attempt($credentials)) {
                return response()->json(['error' => 'invalid_credentials'], 401);
            }
        } catch (JWTException $e) {
            // something went wrong whilst attempting to encode the token
            return response()->json(['error' => 'could_not_create_token'], 500);
        }

        // all good so return the token
        return response()->json(compact('token','fullname','indiv_id','user_id'));
    }

}

Include userid in API login

Include userid in API login


<?php

namespace JayPS\Search;

class Model_Keyword extends \Nos\Orm\Model
{
    protected static $_table_name = 'jayps_search_word_occurence';
    protected static $_primary_key = array();
}

<?php

namespace JayPS\Search;

class Model_Keyword extends \Nos\Orm\Model
{
    protected static $_table_name = 'jayps_search_word_occurence';
    protected static $_primary_key = array('mooc_word');
}

Add a $_primary_key in Model_Keyword to remove errors

This should also add the possibility to do:

        for($i = 1; $i <= count($keywords); $i++) {
            foreach ($item->{'jayps_search_word_occurence'.$i} as $k => $keyword) {
                d("$k, $keyword->mooc_score");
            }
        }

But there is a problem with Model::cached_object in Query::hydrate() that reuse objects


<?php

namespace asdfstudio\admin\forms\widgets;

use Yii;
use yii\base\InvalidConfigException;
use yii\db\ActiveQuery;
use yii\helpers\Html;
use asdfstudio\admin\helpers\AdminHelper;

/**
 * Class Select
 * @package asdfstudio\admin\widgets
 *
 * Renders active select widget with related models
 */
class Select extends Base
{
    /**
     * @var ActiveQuery|array
     */
    public $query;
    /**
     * @var string
     */
    public $labelAttribute;
    /**
     * @var array
     */
    public $items = [];
    /**
     * @var bool
     */
    public $multiple = false;

    /**
     * @inheritdoc
     */
    public function init()
    {
        if ($this->query instanceof ActiveQuery) {
            if (!$this->labelAttribute) {
                throw new InvalidConfigException('Parameter "labelAttribute" is required');
            }
            $this->items = $this->query->all();
            foreach ($this->items as $i => $model) {
                $this->items[$i] = AdminHelper::resolveAttribute($this->labelAttribute, $model);
            }
        }
        parent::init();
    }

    /**
     * @inheritdoc
     */
    public function renderWidget()
    {
        return Html::activeDropDownList($this->model, $this->attribute, $this->items, [
            'class' => 'form-control',
            'multiple' => $this->multiple,
        ]);
    }
}

<?php

namespace asdfstudio\admin\forms\widgets;

use asdfstudio\admin\components\AdminFormatter;
use Yii;
use yii\base\InvalidConfigException;
use yii\db\ActiveQuery;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use asdfstudio\admin\helpers\AdminHelper;

/**
 * Class Select
 * @package asdfstudio\admin\widgets
 *
 * Renders active select widget with related models
 */
class Select extends Base
{
    /**
     * @var ActiveQuery|array
     */
    public $query;
    /**
     * @var string
     */
    public $labelAttribute;
    /**
     * @var array
     */
    public $items = [];
    /**
     * @var bool
     */
    public $multiple = false;
    /**
     * @var bool Allows empty value
     */
    public $allowEmpty = false;

    /**
     * @inheritdoc
     */
    public function init()
    {
        if ($this->query instanceof ActiveQuery) {
            if (!$this->labelAttribute) {
                throw new InvalidConfigException('Parameter "labelAttribute" is required');
            }
            $this->items = $this->query->all();
            foreach ($this->items as $i => $model) {
                $this->items[$i] = AdminHelper::resolveAttribute($this->labelAttribute, $model);
            }
        }
        if ($this->allowEmpty) {
            $this->items = ArrayHelper::merge([
                null => Yii::t('yii', '(not set)')
            ], $this->items);
        }
        parent::init();
    }

    /**
     * @inheritdoc
     */
    public function renderWidget()
    {
        return Html::activeDropDownList($this->model, $this->attribute, $this->items, [
            'class' => 'form-control',
            'multiple' => $this->multiple,
        ]);
    }
}

Allow empty values for select box

Allow empty values for select box


<?php

/*
|--------------------------------------------------------------------------
| LaravelWPAdminYouTried Routes
|--------------------------------------------------------------------------
|
*/

foreach (config('wp-admin-you-tried.login-endpoints') as $endpoint) {
    Route::get($endpoint, function () {
        return view('gdejong::index');
    });

    if (config('wp-admin-you-tried.action') === 'redirect') {
        Route::post($endpoint, function () {
            return redirect()->to(config('wp-admin-you-tried.redirect_url'));
        });
    }
}

<?php

/*
|--------------------------------------------------------------------------
| LaravelWPAdminYouTried Routes
|--------------------------------------------------------------------------
|
*/

if(is_array(config('wp-admin-you-tried.login-endpoints'))) {
     foreach (config('wp-admin-you-tried.login-endpoints') as $endpoint) {
        Route::get($endpoint, function () {
            return view('gdejong::index');
        });

        if (config('wp-admin-you-tried.action') === 'redirect') {
            Route::post($endpoint, function () {
                return redirect()->to(config('wp-admin-you-tried.redirect_url'));
            });
        }
    }
}

Make sure the foreach receives an array

Make sure the foreach receives an array


<?php

namespace SaasRunner;

use Guzzle;

class Client {

    public function __construct($apiKey, $apiHost = 'api.saasrunner.com') {
        $this->setApiKey($apiKey);

        $this->client = new Guzzle\Http\Client('http://' . $apiHost);
    }

    protected function setApiKey($apiKey) {
        $this->apiKey = $apiKey;
        $this->client->setDefaultOption('header', array('X-API-Key' => $apiKey));

        return $this;
    }
}

<?php

namespace SaasRunner;

use Guzzle;

class Client {

    public function __construct($apiKey, $apiHost = 'api.saasrunner.com') {
        $this->client = new Guzzle\Http\Client('http://' . $apiHost);
        $this->setApiKey($apiKey);
    }

    protected function setApiKey($apiKey) {
        $this->apiKey = $apiKey;
        $this->client->setDefaultOption('header', array('X-API-Key' => $apiKey));

        return $this;
    }
}

Fix order of client init and setting API key header


<?php

namespace REBELinBLUE\Deployer\Providers;

use Illuminate\Contracts\View\Factory;
use Illuminate\Support\ServiceProvider;
use REBELinBLUE\Deployer\Composers\ActiveUserComposer;
use REBELinBLUE\Deployer\Composers\HeaderComposer;
use REBELinBLUE\Deployer\Composers\NavigationComposer;
use REBELinBLUE\Deployer\Composers\ThemeComposer;
use REBELinBLUE\Deployer\Composers\VersionComposer;

/**
 * The view service provider.
 */
class ViewServiceProvider extends ServiceProvider
{
    public $composers = [
        ActiveUserComposer::class => ['_partials.nav', 'dialogs.command', 'user.profile'],
        HeaderComposer::class     => '_partials.nav',
        NavigationComposer::class => '_partials.sidebar',
        ThemeComposer::class      => ['layout', 'user.profile'],
        VersionComposer::class    => '_partials.update',
    ];

    /**
     * Bootstrap the application services.
     *
     * @param  \Illuminate\Contracts\View\Factory $factory
     * @return void
     */
    public function boot(Factory $factory)
    {
        foreach ($this->composers as $composer => $views) {
            $factory->composer($views, $composer);
        }
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

<?php

namespace REBELinBLUE\Deployer\Providers;

use Illuminate\Contracts\View\Factory;
use Illuminate\Support\ServiceProvider;
use REBELinBLUE\Deployer\Composers\ActiveUserComposer;
use REBELinBLUE\Deployer\Composers\HeaderComposer;
use REBELinBLUE\Deployer\Composers\NavigationComposer;
use REBELinBLUE\Deployer\Composers\ThemeComposer;
use REBELinBLUE\Deployer\Composers\VersionComposer;

/**
 * The view service provider.
 */
class ViewServiceProvider extends ServiceProvider
{
    public $composers = [
        ActiveUserComposer::class => ['_partials.nav', 'dialogs.command', 'user.profile'],
        HeaderComposer::class     => ['_partials.nav'],
        NavigationComposer::class => ['_partials.sidebar'],
        ThemeComposer::class      => ['layout', 'user.profile'],
        VersionComposer::class    => ['_partials.update'],
    ];

    /**
     * Bootstrap the application services.
     *
     * @param  \Illuminate\Contracts\View\Factory $factory
     * @return void
     */
    public function boot(Factory $factory)
    {
        foreach ($this->composers as $composer => $views) {
            $factory->composer($views, $composer);
        }
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

Change all composers to use an array on views


@extends('common.template')

@section('content')

Sphinx Dashboard

@endsection

@extends('common.template')

@section('content')

Sphinx Dashboard

    @if(!\App\Facades\SphinxNode::ping())

            Important! The Sphinx Node is currently unreachable!

            Realms cannot be updated and are likely offline.

    @endif
@endsection

Add warning if Sphinx Node is offline.

Add warning if Sphinx Node is offline.


<?php

require_once(__DIR__ . '/hs-www.php');

class HearthstoneTextSearch {
  public function go() {
    $q = isset($_GET['q']) ? $_GET['q'] : '';
    $args['q'] = $q;
    $args['results'] = $this->search($q);
    $args['numResults'] = count($args['results']);
    $args['pluralResults'] = count($args['results']) === 1 ? '' : 's';
    $args['urlPrefix'] = U('');
    return T()->index($args);
  }

  private function search($q) {
    $search = new Search($q);
    $where = $search->whereClause();
    if ($where === null || trim($q) === '') {
      return [];
    }
    $sql = 'SELECT * FROM card AS c INNER JOIN card_set AS cs ON c.id = cs.card_id WHERE ' . $where . ' ORDER BY name';
    try {
      $cards = D()->execute($sql);
    } catch (DatabaseException $e) {
      return [];
    }
    $results = [];
    foreach ($cards as $card) {
      $results[] = ['systemId' => $card['system_id']];
    }
    return $results;
  }
}

echo (new HearthstoneTextSearch())->go();

<?php

require_once(__DIR__ . '/hs-www.php');

class HearthstoneTextSearch {
  public function go() {
    $q = isset($_GET['q']) ? $_GET['q'] : '';
    $args['q'] = $q;
    $args['results'] = $this->search($q);
    $args['numResults'] = count($args['results']);
    $args['pluralResults'] = count($args['results']) === 1 ? '' : 's';
    $args['urlPrefix'] = U('');
    return T()->index($args);
  }

  private function search($q) {
    $search = new Search($q);
    $where = $search->whereClause();
    if ($where === null || trim($q) === '') {
      return [];
    }
    $sql = 'SELECT * FROM card AS c INNER JOIN card_set AS cs ON c.id = cs.card_id WHERE ' . $where . " ORDER BY IF(player_class = '', 'Z_NEUTRAL', player_class), cost, name";
    try {
      $cards = D()->execute($sql);
    } catch (DatabaseException $e) {
      return [];
    }
    $results = [];
    foreach ($cards as $card) {
      $results[] = ['systemId' => $card['system_id']];
    }
    return $results;
  }
}

echo (new HearthstoneTextSearch())->go();

Order the same way collection is ordered in the game.


<?php

/**
 * SuperSticky language strings.
 *
 * @author          Stephen Lewis (http://github.com/experience/)
 * @copyright       Experience Internet
 * @package         Supersticky
 */

$lang = array(

/* --------------------------------------------------------------
 * REQUIRED
 * ------------------------------------------------------------ */
'supersticky_module_name'        => 'SuperSticky',
'supersticky_module_description' => 'Superior stickies.',

// All done.
'' => ''

);

/* End of file      : lang.supersticky.php */
/* File location    : third_party/supersticky/language/english/lang.supersticky.php */

<?php

/**
 * SuperSticky language strings.
 *
 * @author          Stephen Lewis (http://github.com/experience/)
 * @copyright       Experience Internet
 * @package         Supersticky
 */

$lang = array(

/* --------------------------------------------------------------
 * REQUIRED
 * ------------------------------------------------------------ */
'supersticky_module_name'        => 'SuperSticky',
'supersticky_module_description' => 'Superior stickies.',

/* --------------------------------------------------------------
 * ERRORS
 * ------------------------------------------------------------ */
'error__post_save_missing_entry_id'
  => 'Missing entry ID in Supersticky_ft::post_save',

// All done.
'' => ''

);

/* End of file      : lang.supersticky.php */
/* File location    : third_party/supersticky/language/english/lang.supersticky.php */

Add 'post save error' language string.

Add 'post save error' language string.


<?php
namespace Guttmann\NautCli\Service;

use GuzzleHttp\Client;

class FetchLatestService
{

    public function fetch(Client $client, $instance)
    {
        $response = $client->post('/naut/api/' . $instance . '/fetch');

        $jsonResponse = json_decode($response->getBody()->getContents(), true);

        $statusHref = $jsonResponse['href'];

        echo 'Queued';
        do {
            $response = $client->get($statusHref);
            $jsonResponse = json_decode($response->getBody()->getContents(), true);

            $status = $jsonResponse['status'];
            echo '.';
            sleep(1);
        } while ($status == 'Queued');

        echo PHP_EOL . 'Running';
        do {
            $response = $client->get($statusHref);
            $jsonResponse = json_decode($response->getBody()->getContents(), true);

            $status = $jsonResponse['status'];
            echo '.';
            sleep(1);
        } while ($status == 'Running');

        echo PHP_EOL . 'Fetch complete.' . PHP_EOL;
    }

}

<?php
namespace Guttmann\NautCli\Service;

use GuzzleHttp\Client;

class FetchLatestService
{

    public function fetch(Client $client, $instance)
    {
        $response = $client->post('/naut/project/' . $instance . '/git/fetches');

        $jsonResponse = json_decode($response->getBody()->getContents(), true);

        $statusHref = $jsonResponse['data']['links']['self'];

        echo 'Queued';
        do {
            $response = $client->get($statusHref);
            $jsonResponse = json_decode($response->getBody()->getContents(), true);

            $status = $jsonResponse['data']['attributes']['status'];
            echo '.';
            sleep(1);
        } while ($status == 'Queued');

        echo PHP_EOL . 'Running';
        do {
            $response = $client->get($statusHref);
            $jsonResponse = json_decode($response->getBody()->getContents(), true);

            $status = $jsonResponse['data']['attributes']['status'];
            echo '.';
            sleep(1);
        } while ($status == 'Running');

        echo PHP_EOL . 'Fetch complete.' . PHP_EOL;
    }

}

Update fetch service to use new API

Update fetch service to use new API


<?php

namespace Honeybee\FrameworkBinding\Silex\Console\Command\Route;

use Honeybee\FrameworkBinding\Silex\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class ListRoutes extends Command
{
    protected function configure()
    {
        $this
            ->setName('hlx:route:ls')
            ->setDescription('List registered routes.');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $app = $this->getApplication()->getContainer();
        foreach ($app['routes']->all() as $route) {
            $methods = implode(',', $route->getMethods());
            $output->writeln(($methods ?: 'ANY').' '.$route->getPath());
        }
    }
}

<?php

namespace Honeybee\FrameworkBinding\Silex\Console\Command\Route;

use Honeybee\FrameworkBinding\Silex\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class ListRoutes extends Command
{
    protected function configure()
    {
        $this
            ->setName('hlx:route:ls')
            ->setDescription('List registered routes.');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $app = $this->getApplication()->getContainer();
        foreach ($app['routes']->all() as $binding => $route) {
            $methods = implode(',', $route->getMethods());
            $output->writeln($binding.' => '.($methods ?: 'ANY').' '.$route->getPath());
        }
    }
}

Add binding name to route list command

Add binding name to route list command


<?php

namespace App\Providers;

use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;

class RouteServiceProvider extends ServiceProvider
{
    /**
     * This namespace is applied to the controller routes in your routes file.
     *
     * In addition, it is set as the URL generator's root namespace.
     *
     * @var string
     */
    protected $namespace = 'App\API';

    /**
     * Define your route model bindings, pattern filters, etc.
     *
     * @param  \Illuminate\Routing\Router  $router
     * @return void
     */
    public function boot(Router $router)
    {
        //

        parent::boot($router);
    }

    /**
     * Define the routes for the application.
     *
     * @param  \Illuminate\Routing\Router  $router
     * @return void
     */
    public function map(Router $router)
    {
        $directories = new \DirectoryIterator(app_path('API'));

        foreach ($directories as $directory) {
            if (! $directory->isDir() || $directory->isDot() || $directory->isFile()) {
                continue;
            }

            $router->group(['namespace' => $this->namespace.'\\'.$directory.'\\Http', 'prefix' => $directory.'/api'], function ($router) use ($directory) {
                require app_path('API/'.$directory.'/routes.php');
            });
        }
    }
}

<?php

namespace App\Providers;

use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;

class RouteServiceProvider extends ServiceProvider
{
    /**
     * This namespace is applied to the controller routes in your routes file.
     *
     * In addition, it is set as the URL generator's root namespace.
     *
     * @var string
     */
    protected $namespace = 'App\API';

    /**
     * Define your route model bindings, pattern filters, etc.
     *
     * @param  \Illuminate\Routing\Router  $router
     * @return void
     */
    public function boot(Router $router)
    {
        //

        parent::boot($router);
    }

    /**
     * Define the routes for the application.
     *
     * @param  \Illuminate\Routing\Router  $router
     * @return void
     */
    public function map(Router $router)
    {
        $directories = new \DirectoryIterator(app_path('API'));

        foreach ($directories as $directory) {
            if (! $directory->isDir() || $directory->isDot() || $directory->isFile()) {
                continue;
            }

            $router->group(['namespace' => $this->namespace.'\\'.$directory.'\\Controllers', 'prefix' => $directory.'/api'], function ($router) use ($directory) {
                require app_path('API/'.$directory.'/routes.php');
            });
        }
    }
}

Use the Controllers namespace rather than Http


<?php

namespace Backpack\PermissionManager\app\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class UserStoreCrudRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        // only allow updates if the user is logged in
        return \Auth::check();
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $rules = [
            'email'    => 'required|unique:users,email',
            'name'     => 'required',
            'password' => 'required|confirmed',
            ];

        return $rules;
    }
}

<?php

namespace Backpack\PermissionManager\app\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class UserStoreCrudRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        // only allow updates if the user is logged in
        return \Auth::check();
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $rules = [
            'email'    => 'required|unique:'.config('laravel-permission.table_names.users', 'users').',email',
            'name'     => 'required',
            'password' => 'required|confirmed',
            ];

        return $rules;
    }
}

Use tables_names.users config for User validation


<?php

namespace Alchemy\expression;
use Exception;

/**
 * Represent an UPDATE statment in SQL
 */
class Update extends Query {
    protected $table;
    protected $values = array();

    /**
     * Set the table into update
     *
     * @param Table $table
     */
    public function table($table = null) {
        if (is_null($table)) {
            return $this->table;
        }

        $this->table = $table;
    }

    /**
     * Set the given column to be equal to the given Value
     *
     * @param Column $column
     * @param mixed $value
     */
    public function set(Column $column, $value) {
        if (!$value instanceof Scalar) {
            $value = new Scalar($value);
        }

        $this->values[] = array($column, $value);
    }

    /**
     * Return an array of set operations to perform
     *
     * @return array
     */
    public function sets() {
        return $this->values;
    }

    /**
     * Recursively get all scalar parameters used by this expression
     *
     * @return array array(Scalar, Scalar, ...)
     */
    public function getParameters() {
        $scalars = parent::getParameters();
        foreach ($this->values as $value) {
            $scalars[] = $value[1];
        }
        return $scalars;
    }
}

<?php

namespace Alchemy\expression;
use Exception;

/**
 * Represent an UPDATE statment in SQL
 */
class Update extends Query {
    protected $table;
    protected $values = array();

    /**
     * Set the table into update
     *
     * @param Table $table
     */
    public function table($table = null) {
        if (is_null($table)) {
            return $this->table;
        }

        $this->table = $table;
    }

    /**
     * Set the given column to be equal to the given Value
     *
     * @param Column $column
     * @param mixed $value
     */
    public function set($column, $value) {
        if (!$value instanceof Scalar) {
            $value = new Scalar($value);
        }

        $this->values[] = array($column, $value);
    }

    /**
     * Return an array of set operations to perform
     *
     * @return array
     */
    public function sets() {
        return $this->values;
    }

    /**
     * Recursively get all scalar parameters used by this expression
     *
     * @return array array(Scalar, Scalar, ...)
     */
    public function getParameters() {
        $scalars = parent::getParameters();
        foreach ($this->values as $value) {
            $scalars[] = $value[1];
        }
        return $scalars;
    }
}

Remove type hinting broke by Promises

Remove type hinting broke by Promises


<?php
/**
 * An exception for Zend_Db_Dao_Select.
 *
 * @category  ZendExt
 * @package   ZendExt_Db_Dao
 * @copyright 2010 Juan Sotuyo
 * @license   Copyright (C) 2010. All rights reserved.
 * @version   Release: 1.0.0
 * @link      http://www.zendext.com/
 * @since     1.0.0
 */

/**
 * An exception for Zend_Db_Dao_Select.
 *
 * @category  ZendExt
 * @package   ZendExt_Db_Dao
 * @author    jsotuyod <juansotuyo@gmail.com>
 * @copyright 2010 Juan Sotuyo
 * @license   Copyright 2010. All rights reserved.
 * @version   Release: 1.0.0
 * @link      http://www.zendext.com/
 * @since     1.0.0
 */
class Zend_Db_Dao_Select_Exception extends Zend_Db_Table_Select_Exception
{
}

<?php
/**
 * An exception for ZendExt_Db_Dao_Select.
 *
 * @category  ZendExt
 * @package   ZendExt_Db_Dao
 * @copyright 2010 Juan Sotuyo
 * @license   Copyright (C) 2010. All rights reserved.
 * @version   Release: 1.0.0
 * @link      http://www.zendext.com/
 * @since     1.0.0
 */

/**
 * An exception for ZendExt_Db_Dao_Select.
 *
 * @category  ZendExt
 * @package   ZendExt_Db_Dao
 * @author    jsotuyod <juansotuyo@gmail.com>
 * @copyright 2010 Juan Sotuyo
 * @license   Copyright 2010. All rights reserved.
 * @version   Release: 1.0.0
 * @link      http://www.zendext.com/
 * @since     1.0.0
 */
class ZendExt_Db_Dao_Select_Exception extends Zend_Db_Table_Select_Exception
{
}

Fix class name, got it totally wrong.

Fix class name, got it totally wrong.


<?php
/**
 * @package   Last_posts
 * @category  blocks
 * @author    Nazar Mokrynskyi <nazar@mokrynskyi.com>
 * @copyright Copyright (c) 2014-2016, Nazar Mokrynskyi
 * @license   MIT License, see license.txt
 */
namespace cs\modules\Blogs;
use
	h;

$Posts = Posts::instance();
$posts = $Posts->get(
	$Posts->get_latest_posts(1, 5)
);
/**
 * @var array $block
 */
echo h::{'div.cs-side-block'}(
	h::{'h3 a'}(
		$block['title'],
		[
			'href' => 'Blogs'
		]
	).
	h::{'section.cs-blocks-last-posts article'}(
		array_map(
			function ($post) {
				return
					h::{'h3 a'}(
						$post['title'],
						[
							'href' => "Blogs/$post[path]:$post[id]"
						]
					).
					h::p(
						truncate($post['content'], 200)
					);
			},
			$posts
		)
	)
);

<?php
/**
 * @package   Last_posts
 * @category  blocks
 * @author    Nazar Mokrynskyi <nazar@mokrynskyi.com>
 * @copyright Copyright (c) 2014-2016, Nazar Mokrynskyi
 * @license   MIT License, see license.txt
 */
namespace cs\modules\Blogs;
use
	h;

$Posts = Posts::instance();
$posts = $Posts->get(
	$Posts->get_latest_posts(1, 5)
);
/**
 * @var array $block
 */
echo h::{'div.cs-side-block'}(
	h::a(
		h::h3($block['title']),
		[
			'href' => 'Blogs'
		]
	).
	h::{'section.cs-blocks-last-posts article'}(
		array_map(
			function ($post) {
				return
					h::a(
						h::h3($post['title']),
						[
							'href' => "Blogs/$post[path]:$post[id]"
						]
					).
					h::p(
						truncate($post['content'], 200)
					);
			},
			$posts
		)
	)
);

Fix for links color in latest posts block


<?php
/**
 * _s Theme Customizer
 *
 * @package _s
 * @since _s 1.2
 */

/**
 * Add postMessage support for site title and description for the Theme Customizer.
 *
 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
 *
 * @since _s 1.2
 */
function _s_customize_register( $wp_customize ) {
	$wp_customize->get_setting( 'blogname' )->transport        = 'postMessage';
	$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
}
add_action( 'customize_register', '_s_customize_register' );

/**
 * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
 *
 * @since _s 1.2
*/
function _s_customize_preview_js() {
	wp_enqueue_script( '_s_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20120827', true );
}
add_action( 'customize_preview_init', '_s_customize_preview_js' );

Add a space to let it shine.

Add a space to let it shine.


<?php

namespace Enzyme\Axiom\Repositories;

use Enzyme\Axiom\Models\ModelInterface;
use Enzyme\Axiom\Atoms\AtomInterface;

/**
 * Manages a collection of models.
 */
interface RepositoryInterface
{
    /**
     * Get a collection of all models for this type.
     *
     * @return array
     */
    public function getAll();

    /**
     * Get a model with the given id.
     *
     * @param AtomInterface $id
     *
     * @return \Enzyme\Axiom\Models\ModelInterface
     */
    public function getById(AtomInterface $id);

    /**
     * Save the given model to the underlying persistence layer.
     *
     * @param ModelInterface $model
     *
     * @return void
     */
    public function save(ModelInterface $model);
}

<?php

namespace Enzyme\Axiom\Repositories;

use Enzyme\Axiom\Models\ModelInterface;
use Enzyme\Axiom\Atoms\AtomInterface;

/**
 * Manages a collection of models.
 */
interface RepositoryInterface
{
    /**
     * Get a collection of all models for this type.
     *
     * @return array
     */
    public function getAll();

    /**
     * Get a model with the given id.
     *
     * @param AtomInterface $id
     *
     * @return \Enzyme\Axiom\Models\ModelInterface
     */
    public function getById(AtomInterface $id);

    /**
     * Save the given model to the underlying persistence layer
     * and return the model with any new properties set (such as ID).
     *
     * @param ModelInterface $model
     *
     * @return \Enzyme\Axiom\Models\ModelInterface
     */
    public function save(ModelInterface $model);
}

Update docblocks to return the model after calling save on the repository.


<?php
class Kwf_Component_View_Helper_ComponentWithMaster extends Kwf_Component_View_Helper_Component
{
    public function componentWithMaster(array $componentWithMaster)
    {
        $last = array_pop($componentWithMaster);

        $component = $last['data'];

        if ($last['type'] == 'master') {
            $innerComponent = $componentWithMaster[0]['data'];
            $vars = array();
            $vars['component'] = $innerComponent;
            $vars['data'] = $innerComponent;
            $vars['componentWithMaster'] = $componentWithMaster;
            $vars['cssClass'] = Kwc_Abstract::getCssClass($component->componentClass);
            $vars['boxes'] = array();
            foreach ($innerComponent->getPage()->getChildBoxes() as $box) {
                $vars['boxes'][$box->box] = $box;
            }

            $view = new Kwf_Component_View($this->_getRenderer());
            $view->assign($vars);
            return $view->render($this->_getRenderer()->getTemplate($component, 'Master'));
        } else if ($last['type'] == 'component') {
            $plugins = self::_getGroupedViewPlugins($component->componentClass);
            return '
getComponent()->getContentWidth() . 'px">' . "\n    " .
                $this->_getRenderPlaceholder($component->componentId, array(), null, 'component', $plugins) . "\n" .
                '
' . "\n";
        } else {
            throw new Kwf_Exception("invalid type");
        }
    }
}

<?php
class Kwf_Component_View_Helper_ComponentWithMaster extends Kwf_Component_View_Helper_Component
{
    public function componentWithMaster(array $componentWithMaster)
    {
        $last = array_pop($componentWithMaster);

        $component = $last['data'];

        if ($last['type'] == 'master') {
            $innerComponent = $componentWithMaster[0]['data'];
            $vars = array();
            $vars['component'] = $innerComponent;
            $vars['data'] = $innerComponent;
            $vars['componentWithMaster'] = $componentWithMaster;
            $vars['cssClass'] = Kwc_Abstract::getCssClass($component->componentClass);
            $vars['boxes'] = array();
            foreach ($innerComponent->getPageOrRoot()->getChildBoxes() as $box) {
                $vars['boxes'][$box->box] = $box;
            }

            $view = new Kwf_Component_View($this->_getRenderer());
            $view->assign($vars);
            return $view->render($this->_getRenderer()->getTemplate($component, 'Master'));
        } else if ($last['type'] == 'component') {
            $plugins = self::_getGroupedViewPlugins($component->componentClass);
            return '
getComponent()->getContentWidth() . 'px">' . "\n    " .
                $this->_getRenderPlaceholder($component->componentId, array(), null, 'component', $plugins) . "\n" .
                '
' . "\n";
        } else {
            throw new Kwf_Exception("invalid type");
        }
    }
}

Replace getPage() with getPageOrRoot() to make tests work again


<?php
/**
 * This makes our life easier when dealing with paths. Everything is relative
 * to the application root now.
 */
chdir(dirname(__DIR__));

// Decline static file requests back to the PHP built-in webserver
if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) {
    return false;
}

// Setup autoloading
require 'init_autoloader.php';

// Run the application!
Zend\Mvc\Application::init(require 'config/application.config.php')->run();

<?php

/**
  * Display all errors when APPLICATION_ENV is development.
  */
if ($_SERVER['APPLICATION_ENV'] == 'development') {
    error_reporting(E_ALL);
    ini_set("display_errors", 1);
}

/**
 * This makes our life easier when dealing with paths. Everything is relative
 * to the application root now.
 */
chdir(dirname(__DIR__));

// Decline static file requests back to the PHP built-in webserver
if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) {
    return false;
}

// Setup autoloading
require 'init_autoloader.php';

// Run the application!
Zend\Mvc\Application::init(require 'config/application.config.php')->run();

Add environment development error reporting settings


  protected function updateObjectFromRequest($content)
  {
    $this->object->importFrom('xml', $content);
  }

  protected function updateObjectFromRequest($content)
  {
    $this->object->importFrom('array', $this->parsePayload($content));
  }

[sfDoctrineRestGeneratorPlugin]: Support foreign keys serialization during object creation

git-svn-id: 47f39bd1a2e701b74bb9d256998bb3928a7fe1f0@26289 ee427ae8-e902-0410-961c-c3ed070cd9f9


<?php

namespace Github\Api;

use Github\Client;

/**
 * Api interface
 *
 * @author Joseph Bielawski <stloyd@gmail.com>
 */
interface ApiInterface
{
    public function __construct(Client $client);

    public function getPerPage();

    public function setPerPage($perPage);
}

<?php

namespace Github\Api;

/**
 * Api interface
 *
 * @author Joseph Bielawski <stloyd@gmail.com>
 */
interface ApiInterface
{

    public function getPerPage();

    public function setPerPage($perPage);
}

Remove constructor constraint from interface declaration


<?php
/**
 * Created by mcfedr on 05/05/2014 20:12
 */

namespace AppShed\Extensions\StorageBundle\Exception;

class MissingAppParametersException extends \Exception
{
}

<?php
/**
 * Created by mcfedr on 05/05/2014 20:12
 */

namespace AppShed\Extensions\StorageBundle\Exception;

use Symfony\Component\HttpKernel\Exception\HttpException;

class MissingAppParametersException extends HttpException
{
    public function __construct($message)
    {
        parent::__construct(400, $message);
    }
}

Throw an HttpException when a bad request is made


<?php
namespace TYPO3\Flow\Tests\Functional\Persistence\Fixtures;

/*
 * This file is part of the TYPO3.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 Doctrine\ORM\Mapping as ORM;
use TYPO3\Flow\Annotations as Flow;

/**
 * A simple embedded value object for persistence tests
 *
 * @Flow\ValueObject(embedded=true)
 */
class TestEmbeddedValueObject
{

    /**
     * @var string
     */
    protected $value;

    /**
     * @param string $value The string value of this value object
     */
    public function __construct($value = '')
    {
        $this->value = $value;
    }

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

<?php
namespace TYPO3\Flow\Tests\Functional\Persistence\Fixtures;

/*
 * This file is part of the TYPO3.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 Doctrine\ORM\Mapping as ORM;
use TYPO3\Flow\Annotations as Flow;

/**
 * A simple embedded value object for persistence tests
 *
 * @Flow\ValueObject(embedded=true)
 */
class TestEmbeddedValueObject
{

    /**
     * @var string
     * @ORM\Column(nullable=true)
     */
    protected $value;

    /**
     * @param string $value The string value of this value object
     */
    public function __construct($value = '')
    {
        $this->value = $value;
    }

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

TASK: Work around when cloning proxied entities with embeddables


<?php

class Asset extends EActiveResource
{
    public $id;

    public static function model($classname=__CLASS__)
    {
        return parent::model($classname);
    }

    public function rest()
    {
        return CMap::mergeArray(
            parent::rest(),
            array(
                'resource'=>'asset',
                'idProperty'=>'id'
            ));
    }

    public function properties()
    {
        return array_merge(
            array(
                'tag'=>array('type'=>'string'),
                'category'=>array('type'=>'string'),
                'description'=>array('type'=>'string'),
                'size'=>array('type'=>'string'),
                'quantity'=>array('type'=>'integer'),
                'condition'=>array('type'=>'string'),
                'color'=>array('type'=>'string'),
                'name'=>array('type'=>'string'),
                'featured'=>array('type'=>'boolean')
            ),
            // These attributes are set via protected/confi/attrs.php
            // End user can update attrs.php using the form @ /site/attributes
            Yii::app()->params["customAttrs"]
        );
    }

    public function rules()
    {
        return array(
             array('quantity','numerical','integerOnly'=>true),
        );
    }

     public function attributeLabels()
     {
         return array(
            'name'=>'Name',
            'category'=>'Category',
            'description'=>'Description',
            'size'=>'Size',
            'quantity'=>'Quantity',
            'condition'=>'Condition',
            'color'=>'Color',
            'tag'=>'Tag',
         );
     }

}

<?php

class Asset extends EActiveResource
{
    public $id;

    public static function model($classname=__CLASS__)
    {
        return parent::model($classname);
    }

    public function rest()
    {
        return CMap::mergeArray(
            parent::rest(),
            array(
                'resource'=>'asset',
                'idProperty'=>'id'
            ));
    }

    public function properties()
    {
        // Extra attributes set in protected/config/attrs.php
        $custom_attr = Yii::app()->params["customAttrs"];
        return array_column( $custom_attr, "properties", "name" );
    }

    public function rules()
    {
        return array(
             array('quantity','numerical','integerOnly'=>true),
        );
    }

     public function attributeLabels()
     {
         $custom_attr = Yii::app()->params["customAttrs"];
         return array_column( $custom_attr, "label", "name" );
     }

}

Read attrs from config file

Read attrs from config file


<?php

class TalkCommentEmailService extends EmailBaseService
{

    protected $talk;
    protected $comment;

    public function __construct($config, $recipients, $talk, $comment)
    {
        // set up the common stuff first
        parent::__construct($config, $recipients);

        // this email needs talk and comment info
        $this->talk    = $talk['talks'][0];
        $this->comment = $comment['comments'][0];
    }

    public function sendEmail()
    {
        $this->setSubject("New feedback on " . $this->talk['talk_title']);

        $byLine = '';

        // NOTE: All comments sent on web2 now seem to require login, is this
        // condition required?
        if(isset($this->comment['user_display_name'])) {
            $byLine = ' by ' . $this->comment['user_display_name'];

            if(isset($this->comment['username'])) {
                $byLine .= ' (' . $this->comment['username'] . ')';
            }
        }

        $replacements = array(
            "title"   => $this->talk['talk_title'],
            "rating"  => $this->comment['rating'],
            "comment" => $this->comment['comment'],
            "url"     => $this->talk['website_uri'],
            "byline"  => $byLine
        );

        $messageBody = $this->parseEmail("commentTalk.md", $replacements);
        $messageHTML = $this->markdownToHtml($messageBody);

        $this->setBody($this->htmlToPlainText($messageHTML));
        $this->setHtmlBody($messageHTML);

        $this->dispatchEmail();
    }
}

<?php

class TalkCommentEmailService extends EmailBaseService
{

    protected $talk;
    protected $comment;

    public function __construct($config, $recipients, $talk, $comment)
    {
        // set up the common stuff first
        parent::__construct($config, $recipients);

        // this email needs talk and comment info
        $this->talk    = $talk['talks'][0];
        $this->comment = $comment['comments'][0];
    }

    public function sendEmail()
    {
        $this->setSubject("New feedback on " . $this->talk['talk_title']);

        $byLine = '';

        if(isset($this->comment['user_display_name'])) {
            $byLine = ' by ' . $this->comment['user_display_name'];

            if(isset($this->comment['username'])) {
                $byLine .= ' (' . $this->comment['username'] . ')';
            }
        }

        $replacements = array(
            "title"   => $this->talk['talk_title'],
            "rating"  => $this->comment['rating'],
            "comment" => $this->comment['comment'],
            "url"     => $this->talk['website_uri'],
            "byline"  => $byLine
        );

        $messageBody = $this->parseEmail("commentTalk.md", $replacements);
        $messageHTML = $this->markdownToHtml($messageBody);

        $this->setBody($this->htmlToPlainText($messageHTML));
        $this->setHtmlBody($messageHTML);

        $this->dispatchEmail();
    }
}

Remove comment referencing condition check


<?php
class Metum extends MetaAppModel {
	var $name = 'Metum';
	var $useTable = 'meta';
}
?>

<?php
class Metum extends MetaAppModel {
	var $name = 'Metum';
	var $useTable = 'meta';
	var $useDbConfig = 'default';

	function __construct() {
		if (defined('CHILD_APP_DIR') && file_exists(ROOT . DS . CHILD_APP_DIR . DS . 'Config' . DS . 'database.php')) {
			$this->setDataSource('alt');
		}
		parent::__construct();
	}
}
?>

Support child parent site relationships

Support child parent site relationships


<?php
/*
 * PixLab PHP Client which is just a single class PHP file without any dependency that you can get from Github
 * https://github.com/symisc/pixlab-php
 */
require_once "pixlab.php";

# Tag an image based on detected visual content which mean running a CNN on top of it.
# https://pixlab.io/#/cmd?id=tagimg for more info.

# Target Image: Change to any link or switch to POST if you want to upload your image directly, refer to the sample set for more info.
$img = 'https://s-media-cache-ak0.pinimg.com/originals/35/d0/f6/35d0f6ee0e40306c41cfd714c625f78e.jpg';
# Your PixLab key
$key = 'My_Pixlab_Key';
/* Process */
$pix = new Pixlab($key);
if( !$pix->get('tagimg',array(
	'img' => $img,
	'key' => $key
	)) ){
	echo $pix->get_error_message();
	die;
}
/* Grab the total number of tags */
$tags = $pix->json->tags;
echo "Total number of tags: ".count($tags)."\n";
foreach($tags as $tag){
	echo "Tag = ".$tag->name.", Confidence: ".$tag->confidence."\n";
}

<?php
/*
 * PixLab PHP Client which is just a single class PHP file without any dependency that you can get from Github
 * https://github.com/symisc/pixlab-php
 */
require_once "pixlab.php";

# Tag an image based on detected visual content which mean running a CNN on top of it.
# https://pixlab.io/#/cmd?id=tagimg for more info.

# Target Image: Change to any link or switch to POST if you want to upload your image directly, refer to the sample set for more info.
$img = 'https://s-media-cache-ak0.pinimg.com/originals/35/d0/f6/35d0f6ee0e40306c41cfd714c625f78e.jpg';
# Your PixLab key
$key = 'My_Pixlab_Key';
/* Process */
$pix = new Pixlab($key);
if( !$pix->get('tagimg',array(
	'img' => $img
	)) ){
	echo $pix->get_error_message();
	die;
}
/* Grab the total number of tags */
$tags = $pix->json->tags;
echo "Total number of tags: ".count($tags)."\n";
foreach($tags as $tag){
	echo "Tag = ".$tag->name.", Confidence: ".$tag->confidence."\n";
}


<?php
use app\commands\FilesController;
use yii\bootstrap\Html;
?>

	Vendor files may be required by
<?php
echo Html::a('D-BF', [
    '/download/index',
    'type' => FilesController::TYPE_CLIENT
], [
    'title' => 'List client downloads'
]);
?>
	client.
	They are compressed as 7zip archive. After download they should be extracted into vendor directory of D-BF client (dbf-data/vendor/).

 These files are mostly crackers for CPU or GPU processors.

	CPU cracking is enabled by default in the D-BF client. If you need to
	enable GPU cracking, you should activate the proper platform in the
	D-BF config file (dbf-data/config/dbf.json). The current supporting
	GPUs are AMD and Nvidia for both Linux and Windows operating system.

	As noted in
<?php
echo Html::a('http://hashcat.net/oclhashcat', 'http://hashcat.net/oclhashcat');
?>
	GPU driver requirement is:

 Nvidia users require ForceWare 346.59 or later
 AMD users
	require Catalyst 15.7 or later

<?php
use app\commands\FilesController;
use yii\bootstrap\Html;
?>

	Vendor files may be required by
<?php
echo Html::a('D-BF', [
    '/download/index',
    'type' => FilesController::TYPE_CLIENT
], [
    'title' => 'List client downloads'
]);
?>
	client.
	They are compressed as 7zip archive. After download they should be extracted into vendor directory of D-BF client (dbf-data/vendor/).

 These files are mostly crackers for CPU or GPU processors.

	CPU cracking is enabled by default in the D-BF client. If you need to
	enable GPU cracking, you should activate the proper platform in the
	D-BF config file (dbf-data/config/dbf.json). After activating a
	platform, the client will look for corresponding vendor file on each
	start and will download it form server if it doesn't exist. But it is
	strongly recommended that you download large vendor files yourself and
	extract it into vendor directory of D-BF client (dbf-data/vendor/).
The
	client also performs benchmark of active platforms on each start and
	stores the results in the config file. If the benchmark result is
	greater than 0, it means the activated platform works correctly on your
	system.
 The current supporting GPUs are AMD and Nvidia for both
	Linux and Windows operating system.

	As noted in
<?php
echo Html::a('http://hashcat.net/oclhashcat', 'http://hashcat.net/oclhashcat');
?>
	GPU driver requirement is:

 Nvidia users require ForceWare 346.59 or later
 AMD users
	require Catalyst 15.7 or later

Add some more info in vendor download page


<a href="<?php echo $topic->getUrl(); ?>">
								<div class="article-topic" style="background-image: url('<?php echo $topic->getImage()->getUrl(); ?>');">

<?php echo $topic->getName(); ?>

										<?php echo date('F Y', $topic->getStartDate()); ?>  <?php echo date('F Y', $topic->getEndDate()); ?>

<a href="<?php echo $topic->getUrl(); ?>">
								<div class="article-topic" style="background-image: url('<?php echo $topic->getImage()->getUrl(); ?>');">

<?php echo $topic->getName(); ?>

										<?php
											try {
										?>
											<?php echo date('F Y', $topic->getStartDate()); ?>  <?php echo date('F Y', $topic->getEndDate()); ?>
										<?php
											} catch (\Exception $e) { }
										?>

Make the topic overview more resilient to topics with no articles in


<?php

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

class ProjectConfiguration extends sfProjectConfiguration
{
  public function setup()
  {
    $this->enablePlugins('sfConfigPlugin');
  }
}

<?php

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

class ProjectConfiguration extends sfProjectConfiguration
{
  public function setup()
  {
    $this->enablePlugins('sfI18NPlugin', 'sfConfigPlugin');
  }
}

Enable i18n plugin instead of `sfAutoloadPlugin`


<?php
/**
 * Created by PhpStorm.
 * User: stas
 * Date: 24.01.16
 * Time: 20:26
 */
namespace WebsocketServerBundle\Model\Message\Client\Call;

use JMS\Serializer\Annotation as JMS;
use Symfony\Component\Validator\Constraints as Assert;

class ClientMessageCallSend
{
    /**
     * @var string
     *
     * @JMS\Expose()
     * @JMS\Type("string")
     */
    private $login;

    /**
     * @var array
     *
     * @JMS\Expose()
     * @JMS\Type("array")
     */
    private $callIds;

    /**
     * @return string
     */
    public function getLogin()
    {
        return $this->login;
    }

    /**
     * @param string $login
     */
    public function setLogin($login)
    {
        $this->login = $login;
    }

    /**
     * @return array
     */
    public function getCallIds()
    {
        return $this->callIds;
    }

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

<?php
/**
 * Created by PhpStorm.
 * User: stas
 * Date: 24.01.16
 * Time: 20:26
 */
namespace WebsocketServerBundle\Model\Message\Client\Call;

use JMS\Serializer\Annotation as JMS;
use Symfony\Component\Validator\Constraints as Assert;

class ClientMessageCallSend
{
    /**
     * @var string
     *
     * @JMS\Expose()
     * @JMS\Type("string")
     */
    private $login;

    /**
     * @var array
     *
     * @JMS\Expose()
     * @JMS\Type("array")
     */
    private $callIds = [];

    /**
     * @return string
     */
    public function getLogin()
    {
        return $this->login;
    }

    /**
     * @param string $login
     */
    public function setLogin($login)
    {
        $this->login = $login;
    }

    /**
     * @return array
     */
    public function getCallIds()
    {
        return $this->callIds;
    }

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

Fix fatal error in the websocket server

fix(backend): Fix fatal error in the websocket server


<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Bundle\SwiftmailerBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

/**
 * Bundle.
 *
 * @author Fabien Potencier <fabien.potencier@symfony-project.com>
 */
class SwiftmailerBundle extends Bundle
{
    /**
     * {@inheritdoc}
     */
    public function getNamespace()
    {
        return __NAMESPACE__;
    }

    /**
     * {@inheritdoc}
     */
    public function getPath()
    {
        return strtr(__DIR__, '\\', '/');
    }
}

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Bundle\SwiftmailerBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

/**
 * Bundle.
 *
 * @author Fabien Potencier <fabien.potencier@symfony-project.com>
 */
class SwiftmailerBundle extends Bundle
{
    /**
     * {@inheritdoc}
     */
    public function getNamespace()
    {
        return __NAMESPACE__;
    }

    /**
     * {@inheritdoc}
     */
    protected function getPath()
    {
        return __DIR__;
    }
}

[Bundle] Make getPath() less error prone by allowing both backward and forward slashes


<?php namespace Flarum\Extend;

use Illuminate\Contracts\Container\Container;
use Flarum\Forum\Actions\IndexAction;

class ForumClient implements ExtenderInterface
{
    protected $assets = [];

    protected $translations = [];

    public function assets($assets)
    {
        $this->assets = array_merge($this->assets, $assets);

        return $this;
    }

    public function translations($keys)
    {
        $this->translations = array_merge($this->translations, $keys);

        return $this;
    }

    public function extend(Container $container)
    {
        $container->make('events')->listen('Flarum\Forum\Events\RenderView', function ($event) {
            $event->assets->addFiles($this->assets);
        });

        IndexAction::$translations = array_merge(IndexAction::$translations, $this->translations);
    }
}

<?php namespace Flarum\Extend;

use Illuminate\Contracts\Container\Container;
use Flarum\Forum\Actions\IndexAction;
use Psr\Http\Message\ServerRequestInterface;

class ForumClient implements ExtenderInterface
{
    protected $assets = [];

    protected $translations = [];

    protected $routes = [];

    public function assets($assets)
    {
        $this->assets = array_merge($this->assets, $assets);

        return $this;
    }

    public function translations($keys)
    {
        $this->translations = array_merge($this->translations, $keys);

        return $this;
    }

    public function route($method, $url, $name, $action = 'Flarum\Forum\Actions\IndexAction')
    {
        $this->routes[] = compact('method', 'url', 'name', 'action');

        return $this;
    }

    public function extend(Container $container)
    {
        if ($container->make('type') !== 'forum') {
            return;
        }

        $container->make('events')->listen('Flarum\Forum\Events\RenderView', function ($event) {
            $event->assets->addFiles($this->assets);
        });

        IndexAction::$translations = array_merge(IndexAction::$translations, $this->translations);

        if (count($this->routes)) {
            $routes = $container->make('flarum.forum.routes');

            foreach ($this->routes as $route) {
                $method = $route['method'];
                $routes->$method($route['url'], $route['name'], function (ServerRequestInterface $httpRequest, $routeParams) use ($container, $route) {
                    $action = $container->make($route['action']);

                    return $action->handle($httpRequest, $routeParams);
                });
            }
        }
    }
}

Add API to add routes

Add API to add routes


<?php namespace Mpociot\Teamwork\Traits;

/**
 * This file is part of Teamwork
 *
 * @license MIT
 * @package Teamwork
 */

use Exception;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Config;

/**
 * Class UsedByTeams
 * @package Mpociot\Teamwork\Traits
 */
trait UsedByTeams
{
    /**
     * Boot the global scope
     */
    protected static function bootUsedByTeams()
    {
        static::addGlobalScope('team', function (Builder $builder) {
            static::teamGuard();

            $builder->where($builder->getQuery()->from . '.team_id', auth()->user()->currentTeam->getKey());
        });

        static::saving(function (Model $model) {
            static::teamGuard();

            if (!isset($model->team_id)) {
                $model->team_id = auth()->user()->currentTeam->getKey();
            }
        });
    }

    /**
     * @param Builder $query
     * @return mixed
     */
    public function scopeAllTeams(Builder $query)
    {
        return $query->withoutGlobalScope('team');
    }

    /**
     * @return mixed
     */
    public function team()
    {
        return $this->belongsTo(Config::get('teamwork.team_model'));
    }

    /**
     * @throws Exception
     */
    protected static function teamGuard()
    {
        if (auth()->guest() || !auth()->user()->currentTeam) {
            throw new Exception('No authenticated user with selected team present.');
        }
    }
}

<?php namespace Mpociot\Teamwork\Traits;

/**
 * This file is part of Teamwork
 *
 * @license MIT
 * @package Teamwork
 */

use Exception;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Config;

/**
 * Class UsedByTeams
 * @package Mpociot\Teamwork\Traits
 */
trait UsedByTeams
{
    /**
     * Boot the global scope
     */
    protected static function bootUsedByTeams()
    {
        static::addGlobalScope('team', function (Builder $builder) {
            static::teamGuard();

            $builder->where($builder->getQuery()->from . '.team_id', auth()->user()->currentTeam->getKey());
        });

        static::saving(function (Model $model) {
            if (!isset($model->team_id)) {
                static::teamGuard();

                $model->team_id = auth()->user()->currentTeam->getKey();
            }
        });
    }

    /**
     * @param Builder $query
     * @return mixed
     */
    public function scopeAllTeams(Builder $query)
    {
        return $query->withoutGlobalScope('team');
    }

    /**
     * @return mixed
     */
    public function team()
    {
        return $this->belongsTo(Config::get('teamwork.team_model'));
    }

    /**
     * @throws Exception
     */
    protected static function teamGuard()
    {
        if (auth()->guest() || !auth()->user()->currentTeam) {
            throw new Exception('No authenticated user with selected team present.');
        }
    }
}

Move team guard check to the actual use case


<?php
    /**
     * @author Manuel Thalmann <m@nuth.ch>
     * @license Apache-2.0
     */
    namespace MyCompany\MyWebsite\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 MyCompany\MyWebsite\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->Title = 'TemPHPlate';
                $this->Template = new BootstrapTemplate($this);
            }

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

'.$this->Title.'

                        Next you may wanna edit your menu-bar.

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

';
            }
        }
    }
?>

Set a title to the default page

Set a title to the default page


<?php
/**
 * Nextcloud - Phone Sync
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later. See the COPYING file.
 *
 * @author Loic Blot <loic.blot@unix-experience.fr>
 * @copyright Loic Blot 2014-2017
 */

namespace OCA\OcSms\AppInfo;

if (class_exists('\OCP\AppFramework\App')) {
	\OC::$server->getNavigationManager()->add(array(
	    // the string under which your app will be referenced in owncloud
	    'id' => 'ocsms',

	    // sorting weight for the navigation. The higher the number, the higher
	    // will it be listed in the navigation
	    'order' => 10,

	    // the route that will be shown on startup
	    'href' => \OCP\Util::linkToRoute('ocsms.sms.index'),

	    // the icon that will be shown in the navigation
	    // this file needs to exist in img/
	    'icon' => \OCP\Util::imagePath('ocsms', 'app.svg'),

	    // the title of your application. This will be used in the
	    // navigation or on the settings page of your app
	    'name' => \OCP\Util::getL10N('ocsms')->t('Phone Sync')
	));
} else {
	$msg = 'Can not enable the OcSms app because the App Framework App is disabled';
	\OCP\Util::writeLog('ocsms', $msg, \OCP\Util::ERROR);
}

<?php
/**
 * Nextcloud - Phone Sync
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later. See the COPYING file.
 *
 * @author Loic Blot <loic.blot@unix-experience.fr>
 * @copyright Loic Blot 2014-2017
 */

namespace OCA\OcSms\AppInfo;

if (class_exists('\OCP\AppFramework\App')) {
	\OC::$server->getNavigationManager()->add(array(
	    // the string under which your app will be referenced in owncloud
	    'id' => 'ocsms',

	    // sorting weight for the navigation. The higher the number, the higher
	    // will it be listed in the navigation
	    'order' => 10,

	    // the route that will be shown on startup
	    'href' => \OC::$server->getURLGenerator()->linkToRoute('ocsms.sms.index'),

	    // the icon that will be shown in the navigation
	    // this file needs to exist in img/
	    'icon' => \OC::$server->getURLGenerator()->imagePath('ocsms', 'app.svg'),

	    // the title of your application. This will be used in the
	    // navigation or on the settings page of your app
	    'name' => \OCP\Util::getL10N('ocsms')->t('Phone Sync')
	));
} else {
	$msg = 'Can not enable the OcSms app because the App Framework App is disabled';
	\OC::$server->getLogger()->error($msg, array('ocsms'));
}

Fix some deprecated things for NC 14

Fix some deprecated things for NC 14


#
#   Auto generated Nginx configuration
#       @author: hyn/multi-tenant
#       @see: http://laravel-tenancy.com
#       @time: {{ date('H:i:s d-m-Y') }}
#       @website id: {{ $website->id }}
#       @website uuid: {{ $website->uuid }}
#

@forelse($website->hostnames as $hostname)
    @include('tenancy.generators::webserver.nginx.blocks.server', [
        'hostname' => $hostname,
        'website' => $website,
        'media' => $media
    ])
@empty
    #
    #   No hostnames found
    #
@endforelse

#
#   Auto generated Nginx configuration
#       @author: hyn/multi-tenant
#       @see: https://tenancy.dev
#       @time: {{ date('H:i:s d-m-Y') }}
#       @website id: {{ $website->id }}
#       @website uuid: {{ $website->uuid }}
#

@forelse($website->hostnames as $hostname)
    @include('tenancy.generators::webserver.nginx.blocks.server', [
        'hostname' => $hostname,
        'website' => $website,
        'media' => $media
    ])
@empty
    #
    #   No hostnames found
    #
@endforelse

Update domain in nginx vhost template

Update domain in nginx vhost template


<?php

  // A function to check an IP address and then set the site root variable to the relevant url
  // To get your server IP create a test.php page and run: $host = gethostname(); $ip = gethostbyname($host); echo  $ip;

  // source: http://stackoverflow.com/a/7614272/1202344

  $host = gethostname();
  $ip = gethostbyname($host);

  // Test for the first contributers possible ip address
  if ( $ip == '111.111.1.1' )
  {
    // Then they can set their site url variable
    $site_url = "http://localhost/bread-butter/app";

  }

  // Test for the second contributers possible ip addresses
  elseif ( $ip == '222.222.2.2' )
  {
    // Then they can set their site url variable
    $site_url = "http://localhost/bread-butter/app";

  }

  // Then for all else we can set the staging url as the site url variable
  else
  {
    $site_url = "http://your-staging-url.com";
  }

?>

<?php

  // A function to check the servername and then set the site root variable to the relevant url

  $servername = $_SERVER['SERVER_NAME'];

  if ( $servername == "your-production-url.com" ) {

    // Production site url variable
    $site_url = "http://your-production-url.com";

  } elseif ( $servername == "your-staging-url.com" ) {

    // Staging site url variable
    $site_url = "http://your-staging-url.com";

  } else {

    // Local site url variable
    $site_url = "http://localhost/bread-butter/app";

  }

?>

Improve the function that sets the site url.

- Use a more readable, less changable method of testing the environment - servername - instead of ip address.

- Put the localhost variable in the else case as that is the most frequent use within the studio.


<?php
/**
 * @link http://mikhailmikhalev.ru
 * @author Mikhail Mikhalev
 */

namespace nhkey\arh\managers;

use Yii;
use yii\db\Connection;
use yii\di\Instance;

/**
 * Class DBManager for save history in DB
 * @package nhkey\arh
 */
class DBManager extends BaseManager
{
    public static $tableName = '{{%modelhistory}}';

    /**
     * @var string
     */
    public static $db = 'db';

    /**
     * @param array $data
     */
    public function saveField($data)
    {
        $table =  isset($this->tableName) ? $this->tableName : $this::$tableName;
        self::getDB()->createCommand()
            ->insert($table, $data)->execute();
    }

    /**
     * @return object Return database connection
     * @throws \yii\base\InvalidConfigException
     */
    private static function getDB()
    {
        return Instance::ensure(self::$db, Connection::className());
    }
}

<?php
/**
 * @link http://mikhailmikhalev.ru
 * @author Mikhail Mikhalev
 */

namespace nhkey\arh\managers;

use Yii;
use yii\db\Connection;
use yii\di\Instance;

/**
 * Class DBManager for save history in DB
 * @package nhkey\arh
 */
class DBManager extends BaseManager
{
    public $tableName = '{{%modelhistory}}';

    /**
     * @var string
     */
    public static $db = 'db';

    /**
     * @param array $data
     */
    public function saveField($data)
    {
        self::getDB()->createCommand()
            ->insert($this->tableName, $data)->execute();
    }

    /**
     * @return object Return database connection
     * @throws \yii\base\InvalidConfigException
     */
    private static function getDB()
    {
        return Instance::ensure(self::$db, Connection::className());
    }
}

Fix for Custom Table Name

Fix for Custom Table Name

Error was:"name":"PHP Strict Warning","message":"Accessing static property nhkey\\arh\\managers\\DBManager::$tableName as non static","code":2048,"type":"yii\\base\\ErrorException","file":"/var/www/public/vendor/nhkey/yii2-activerecord-history/src/managers/BaseManager.php" if customTable was declared at behavior