<?php

namespace Nzesalem\Lastus\Middleware;

/**
 * @package Nzesalem\Lastus
 */
use Closure;
use Illuminate\Contracts\Auth\Guard;

class LastusUserStatus
{
    protected $auth;
    /**
     * Creates a new instance of the middleware.
     *
     * @param Guard $auth
     */
    public function __construct(Guard $auth)
    {
        $this->auth = $auth;
    }

    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  Closure $next
     * @param  $status
     * @return mixed
     */
    public function handle($request, Closure $next, $status)
    {
        if ($this->auth->guest() || !$request->user()->isCurrently($status)) {
            abort(403);
        }

        return $next($request);
    }
}

<?php

namespace Nzesalem\Lastus\Middleware;

/**
 * @package Nzesalem\Lastus
 */
use Closure;
use Illuminate\Contracts\Auth\Guard;

class LastusUserStatus
{
    protected $auth;
    /**
     * Creates a new instance of the middleware.
     *
     * @param Guard $auth
     */
    public function __construct(Guard $auth)
    {
        $this->auth = $auth;
    }

    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  Closure $next
     * @param  $status
     * @return mixed
     */
    public function handle($request, Closure $next, $status)
    {
        if ($this->auth->guest() || !$request->user()->isCurrently($status)) {
            abort(403, 'Account is not in the right status to view this page');
        }

        return $next($request);
    }
}

Add abort message in status middleware

Add abort message in status middleware

Add exception message when there is a user status mismatch in a user
status protected route


<?php

trait TestHelperTrait {

  public function wire($name = 'wire')
  {
    return \ProcessWire\wire($name);
  }

  public function module()
  {
    return $this->wire('modules')->get('ProcessGraphQL');
  }

}

<?php

trait TestHelperTrait {

  public static $defaultConfig;

  public function wire($name = 'wire')
  {
    return \ProcessWire\wire($name);
  }

  public function module()
  {
    return $this->wire('modules')->get('ProcessGraphQL');
  }

  public static function setUpBeforeClass()
  {
    self::$defaultConfig = \ProcessWire\wire('modules')->get('ProcessGraphQL')->data();
  }

  public static function tearDownAfterClass()
  {
    \ProcessWire\wire('modules')->get('ProcessGraphQL')->setArray(self::$defaultConfig);
  }

}

Set default config on after each test class.


<?php

namespace SearchApi\Builders;

use SearchApi\Builders\QueryBuilder;

/**
 * Responsible for building a query string for SolrSearch
 */
class SolrQueryBuilder implements QueryBuilder {
  /**
   * Build a query string from provided search terms and search options.
   * Returns a query string for a SOLR server.
   *
   * @param SearchTerm[]|null $search_terms Search terms to search
   * @param SearchApi\Models\SearchOptions|null $options Query options
   */
  function build( $search_terms, $options = null ) {
    $keyword_strings = '';

    assert( gettype( $options ) === 'NULL' || gettype( $options ) === 'object' );

    foreach ( $search_terms as &$word ) {
      $keyword_strings = $keyword_strings . urlencode($word->value) . ' ';
    }

    return '?df=collector&indent=on&q=' . $keyword_strings . '&wt=json';
  }
}

<?php

namespace SearchApi\Builders;

use SearchApi\Builders\QueryBuilder;

/**
 * Responsible for building a query string for SolrSearch
 */
class SolrQueryBuilder implements QueryBuilder {
  /**
   * Build a query string from provided search terms and search options.
   * Returns a query string for a SOLR server.
   *
   * @param SearchTerm[]|null $search_terms Search terms to search
   * @param SearchApi\Models\SearchOptions|null $options Query options
   */
  function build( $search_terms, $options = null ) {
    $keyword_strings = '';

    assert( gettype( $options ) === 'NULL' || gettype( $options ) === 'object' );

    foreach ( $search_terms as &$word ) {
      $keyword_strings = $keyword_strings . $word->value . ' ';
    }

    return '?df=collector&indent=on&q=' . urlencode( $keyword_strings ) . '&wt=json';
  }
}

Fix url encoding in query builder

Fix url encoding in query builder


<?php

namespace Libs;

class Redirect
{
	protected $session;

	public function __construct(\Libs\interfaces\SessionInterface $session)
	{
		$this->session = $session;
	}

	public function back()
	{
		header('Location: ' . $_SERVER['HTTP_REFERER']);
	}

	public function backWithInput($input)
	{
		$this->session->set('input', $input);
		$this->back();
	}

	public function to($url)
	{
		header('Location: ' . WEBROOT. $url);
	}

	public function home()
	{
		$config = \Core\Config::getInstance();
		$this->to($config->get('default_controller') . '/' . $config->get('default_method'));
	}
}

<?php

namespace Libs;

use \Core\Config;

class Redirect
{
	protected $session;

	public function __construct(\Libs\interfaces\SessionInterface $session)
	{
		$this->session = $session;
	}

	public function back()
	{
		header('Location: ' . $_SERVER['HTTP_REFERER']);
	}

	public function backWithInput($input)
	{
		$this->session->set('input', $input);
		$this->back();
	}

	public function to($url)
	{
		header('Location: ' . WEBROOT. $url);
	}

	public function home()
	{
		$config = Config::getInstance();
		$this->to($config->get('default_controller') . '/' . $config->get('default_method'));
	}
}

Use Config at the beginning

Use Config at the beginning


<?php
namespace \Saft\Data;

interface ParserInterface
{
    /**
     * @note We have to decide how the ParserInterface should be implemented. One option
     * could be that a parser can accept multiple files/streams which are handled as one
     * graph and all statements are combined in the resulting StatementIterator.
     * So eather addFile or setFile should be used
     * @unstable
     */
    public function addFile();
    /**
     * @unstable
     */
    public function setFile();

    /**
     * @return \Saft\Rdf\StatementIterator a StatementIterator containing all the Statements parsed by the parser to far
     */
    public function getStatementIterator();

    /**
     * @return array with a prefix mapping of the prefixes parsed so far
     */
    public function getCurrentPrefixlist();

}

<?php
namespace \Saft\Data;

interface ParserInterface
{
    /**
     * @note We have to decide how the ParserInterface should be implemented. One option
     * could be that a parser can accept multiple files/streams which are handled as one
     * graph and all statements are combined in the resulting StatementIterator.
     * So eather addFile or setFile should be used.
     * Maybe the PHP Stream API will be relevant here:
     * http://php.net/manual/en/book.stream.php
     * @unstable
     */
    public function addFile();
    /**
     * @unstable
     */
    public function setFile();

    /**
     * @return \Saft\Rdf\StatementIterator a StatementIterator containing all the Statements parsed by the parser to far
     */
    public function getStatementIterator();

    /**
     * @return array with a prefix mapping of the prefixes parsed so far
     */
    public function getCurrentPrefixlist();

}

Add reference to php streams

Add reference to php streams


<?php namespace App\Models;

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

/**
 * Class Domain
 * @package app\Models
 */
class Domain extends Model
{
    protected $fillable = [
        'name',
        'is_word_press',
        'user_id',
        'username',
        'password',
    ];

    /**
     * Each domain was created by a user
     *
     * @return mixed
     */
    public function user()
    {
        return $this->belongsTo(User::class);
    }
}

<?php namespace App\Models;

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

/**
 * Class Domain
 * @package app\Models
 */
class Domain extends Model
{
    use SoftDeletes;

    protected $fillable = [
        'name',
        'is_word_press',
        'user_id',
        'username',
        'password',
    ];

    /**
     * Each domain was created by a user
     *
     * @return mixed
     */
    public function user()
    {
        return $this->belongsTo(User::class);
    }
}

Add soft deletes to domain model

Add soft deletes to domain model


<?php

namespace Oro\Bundle\DataAuditBundle\Datagrid;

use Oro\Bundle\DataAuditBundle\Provider\AuditConfigProvider;
use Oro\Bundle\DataGridBundle\Datasource\ResultRecord;
use Oro\Bundle\EntityBundle\Provider\EntityClassNameProviderInterface;

class EntityTypeProvider
{
    /** @var EntityClassNameProviderInterface */
    protected $entityClassNameProvider;

    /** @var AuditConfigProvider */
    protected $configProvider;

    /**
     * @param EntityClassNameProviderInterface $entityClassNameProvider
     * @param AuditConfigProvider              $configProvider
     */
    public function __construct(
        EntityClassNameProviderInterface $entityClassNameProvider,
        AuditConfigProvider $configProvider
    ) {
        $this->entityClassNameProvider = $entityClassNameProvider;
        $this->configProvider = $configProvider;
    }

    /**
     * @param string $gridName
     * @param string $keyName
     * @param array  $node
     *
     * @return callable
     */
    public function getEntityType($gridName, $keyName, $node)
    {
        return function (ResultRecord $record) {
            return $this->entityClassNameProvider->getEntityClassName(
                $record->getValue('objectClass')
            );
        };
    }

    /**
     * @return array [entity class => entity type, ...]
     */
    public function getEntityTypes()
    {
        $result = [];
        $classNames = $this->configProvider->getAllAuditableEntities();
        foreach ($classNames as $className) {
            $result[$className] = $this->entityClassNameProvider->getEntityClassName($className);
        }

        return $result;
    }
}

<?php

namespace Oro\Bundle\DataAuditBundle\Datagrid;

use Oro\Bundle\DataAuditBundle\Provider\AuditConfigProvider;
use Oro\Bundle\DataGridBundle\Datasource\ResultRecord;
use Oro\Bundle\EntityBundle\Provider\EntityClassNameProviderInterface;

class EntityTypeProvider
{
    /** @var EntityClassNameProviderInterface */
    protected $entityClassNameProvider;

    /** @var AuditConfigProvider */
    protected $configProvider;

    /**
     * @param EntityClassNameProviderInterface $entityClassNameProvider
     * @param AuditConfigProvider              $configProvider
     */
    public function __construct(
        EntityClassNameProviderInterface $entityClassNameProvider,
        AuditConfigProvider $configProvider
    ) {
        $this->entityClassNameProvider = $entityClassNameProvider;
        $this->configProvider = $configProvider;
    }

    /**
     * @param string $gridName
     * @param string $keyName
     * @param array  $node
     *
     * @return callable
     */
    public function getEntityType($gridName, $keyName, $node)
    {
        return function (ResultRecord $record) {
            return $this->entityClassNameProvider->getEntityClassName(
                $record->getValue('objectClass')
            );
        };
    }

    /**
     * @return array [entity class => entity type, ...]
     */
    public function getEntityTypes()
    {
        $result = [];
        $classNames = $this->configProvider->getAllAuditableEntities();
        foreach ($classNames as $className) {
            $result[$className] = $this->entityClassNameProvider->getEntityClassName($className);
        }
        asort($result, SORT_STRING | SORT_FLAG_CASE);

        return $result;
    }
}

BAP-10771: Migrate data audit command to be executed in new message queue. Sort entities in data audit grid filter alphabetically


<?php

/*
 * Copyright 2012 Facebook, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @group markup
 */
final class PhutilRemarkupRuleMonospace
  extends PhutilRemarkupRule {

  public function apply($text) {
    return preg_replace(
      '@##(.+?)##@s',
      '<tt>\1</tt>',
      $text);
  }

}

<?php

/*
 * Copyright 2012 Facebook, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @group markup
 */
final class PhutilRemarkupRuleMonospace
  extends PhutilRemarkupRule {

  public function apply($text) {
    return preg_replace(
      array('@##(.+?)##@s', '@\B`(.+?)`\B@'),
      '<tt>\1</tt>',
      $text);
  }

}

Support ` for delimiting monospaced text in Remarkup

Summary:
Command line commands are often denoted by ` in plain text. It is natural to convert them to monospaced text in formatted text.
Other tools (such as GitHub flavored Markdown) use the same delimiter.
Delimiter ## is problematic in commit messages because git eats all lines starting by #. So it is not possible to start a line with monospaced text.

I am not aware about any conflits, old syntax is still supported.

Test Plan:
  `test`
  `test`s
  `test
  test`

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1773


<?php

class CleverQueryParamTest extends PHPUnit_Framework_TestCase
{
  public function testWhere()
  {
    authorizeFromEnv();

    $validQueries = array(
      array('where' => json_encode(array('name' => 'Clever High School'))),
      array('where' => '{"name": {"$regex": "High"}}'),
      array('where' => array('name' => 'Clever High School'))
    );
    foreach ($validQueries as $query) {
      $schools = CleverSchool::all($query);
      $this->assertEquals(count($schools), 1);
      $this->assertEquals($schools[0]->name, 'Clever High School');
    }
  }

  public function testCount()
  {
    authorizeFromEnv();

    $validQueries = array(
      array('count' => 'true'),
      array('count' => true),
    );
    foreach ($validQueries as $query) {
      $resp = CleverStudent::all($query);
      $this->assertEquals($resp['count'] > 0, true);
    }
  }

}

<?php

class CleverQueryParamTest extends PHPUnit_Framework_TestCase
{
  public function testWhere()
  {
    authorizeFromEnv();

    $validQueries = array(
      array('where' => json_encode(array('name' => 'City High School'))),
      array('where' => '{"name": {"$regex": "High"}}'),
      array('where' => array('name' => 'City High School'))
    );
    foreach ($validQueries as $query) {
      $schools = CleverSchool::all($query);
      $this->assertEquals(count($schools), 1);
      $this->assertEquals($schools[0]->name, 'City High School');
    }
  }

  public function testCount()
  {
    authorizeFromEnv();

    $validQueries = array(
      array('count' => 'true'),
      array('count' => true),
    );
    foreach ($validQueries as $query) {
      $resp = CleverStudent::all($query);
      $this->assertEquals($resp['count'] > 0, true);
    }
  }

}

Fix test that depended on previous high school name in demo data set


<?php
/**
 * Box packing (3D bin packing, knapsack problem)
 * @package BoxPacker
 * @author Doug Wright
 */
namespace DVDoug\BoxPacker;

/**
 * An item to be packed
 * @author Doug Wright
 * @package BoxPacker
 */
interface Item
{

    /**
     * Item SKU etc
     * @return string
     */
    public function getDescription();

    /**
     * Item width in mm
     * @return int
     */
    public function getWidth();

    /**
     * Item length in mm
     * @return int
     */
    public function getLength();

    /**
     * Item depth in mm
     * @return int
     */
    public function getDepth();

    /**
     * Item weight in g
     * @return int
     */
    public function getWeight();

    /**
     * Item volume in mm^3
     * @return int
     */
    public function getVolume();

    /**
     * Does this item need to be kept flat?
     * XXX not yet used, all items are kept flat
     * @return bool
     */
    public function getKeepFlat();

}

<?php
/**
 * Box packing (3D bin packing, knapsack problem)
 * @package BoxPacker
 * @author Doug Wright
 */
namespace DVDoug\BoxPacker;

/**
 * An item to be packed
 * @author Doug Wright
 * @package BoxPacker
 */
interface Item
{

    /**
     * Item SKU etc
     * @return string
     */
    public function getDescription();

    /**
     * Item width in mm
     * @return int
     */
    public function getWidth();

    /**
     * Item length in mm
     * @return int
     */
    public function getLength();

    /**
     * Item depth in mm
     * @return int
     */
    public function getDepth();

    /**
     * Item weight in g
     * @return int
     */
    public function getWeight();

    /**
     * Item volume in mm^3
     * @return int
     */
    public function getVolume();

    /**
     * Does this item need to be kept flat?
     * @return bool
     */
    public function getKeepFlat();

}

Remove out of date comment

Remove out of date comment


<?php

/*
 * This file is part of the WizadDoctrineDocBundle.
 *
 * (c) William POTTIER <developer@william-pottier.fr>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Wizad\DoctrineDocBundle\Formatter;

class MarkdownFormatter
{
    private $buffer;

    public function __construct()
    {

    }

    public function dump($file)
    {
        file_put_contents($file, $this->buffer);
    }

    /*
     * Advanced styling
     */

    public function addTitle($title)
    {
        $this->writeln(PHP_EOL . $title . PHP_EOL . '====================');
    }

    public function addSection($title)
    {
        $this->writeln(PHP_EOL . $title . PHP_EOL . '--------------------');
    }

    public function addParagraph($text)
    {
        $this->writeln(PHP_EOL . $text . PHP_EOL);
    }

    /*
     * RAW manipulation
     */

    protected function writeln($line)
    {
        $this->write($line . PHP_EOL);
    }

    protected function write($text)
    {
        $this->buffer .= $text;
    }
}

<?php

/*
 * This file is part of the WizadDoctrineDocBundle.
 *
 * (c) William POTTIER <developer@william-pottier.fr>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Wizad\DoctrineDocBundle\Formatter;

class MarkdownFormatter
{
    private $buffer;

    public function __construct()
    {

    }

    public function dump($file)
    {
        file_put_contents($file, $this->buffer);
    }

    /*
     * Advanced styling
     */

    public function addTitle($title)
    {
        $this->writeln(PHP_EOL . $title . PHP_EOL . '====================');
    }

    public function addSection($title)
    {
        $this->writeln(PHP_EOL . $title . PHP_EOL . '--------------------');
    }

    public function addParagraph($text)
    {
        $this->writeln(PHP_EOL . $text . PHP_EOL);
    }

    public function addLink($url, $text = null)
    {
        if (!$text) {
            $this->write(sprintf('[[%s]]', $url));
        } else {
            $this->write(sprintf('[%s](%s)', $text, $url));
        }
    }

    /*
     * RAW manipulation
     */

    protected function writeln($line)
    {
        $this->write($line . PHP_EOL);
    }

    protected function write($text)
    {
        $this->buffer .= $text;
    }
}

Add link helper on markdown formatter

Add link helper on markdown formatter


<?php

use Pagon\Route\Rest;
use Pagon\Url;
use Pagon\View;

class Api extends Rest
{
    protected $data = array();

    /**
     * Show error error message
     *
     * @param $message
     */
    protected function error($message)
    {
        $this->output->status(400);
        $this->output->json(array('message' => $message, 'status' => 'ERROR'));
    }

    /**
     * Show ok message
     */
    protected function ok()
    {
        $this->output->status(200);
        $this->output->json(array('status' => 'OK'));
    }

    /**
     * Before
     */
    protected function before()
    {
        $this->loadOrm();
    }

    /**
     * After
     */
    protected function after()
    {
        if (!$this->app->output->body) {
            $this->output->json($this->data);
        }
    }

    /**
     * Load ORM and database
     */
    protected function loadOrm()
    {
        $this->app->loadOrm();
    }
}

<?php

use Pagon\Route\Rest;
use Pagon\Url;
use Pagon\View;

class Api extends Rest
{
    protected $data = array();

    /**
     * Show error error message
     *
     * @param $message
     */
    protected function error($message)
    {
        $this->output->status(400);
        $this->output->json(array('message' => $message, 'status' => 'ERROR'))->end();
    }

    /**
     * Show ok message
     */
    protected function ok()
    {
        $this->output->status(200);
        $this->output->json(array('status' => 'OK'))->end();
    }

    /**
     * Before
     */
    protected function before()
    {
        $this->loadOrm();
    }

    /**
     * After
     */
    protected function after()
    {
        if (!$this->app->output->body) {
            $this->output->json($this->data);
        }
    }

    /**
     * Load ORM and database
     */
    protected function loadOrm()
    {
        $this->app->loadOrm();
    }
}

Add end for api output

Add end  for api output


<?php
namespace Flowpack\SingleSignOn\Client\Command;

/*                                                                               *
 * This script belongs to the TYPO3 Flow package "Flowpack.SingleSignOn.Client". *
 *                                                                               */

use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Cli\CommandController;

/**
 * Command controller for the SSO key management
 *
 * @Flow\Scope("singleton")
 */
class SsoKeyCommandController extends CommandController {

	/**
	 * @var \TYPO3\Flow\Security\Cryptography\RsaWalletServiceInterface
	 * @Flow\Inject
	 */
	protected $rsaWalletService;

	/**
	 * Generate key pair command
	 *
	 * Creates a new key pair and imports it into the wallet.
	 * Used by SSO client and server.
	 *
	 * @return void
	 */
	public function generateKeyPairCommand() {
		$keyUuid = $this->rsaWalletService->generateNewKeypair();
		$this->outputLine('Created key with uuid: ' . $keyUuid);
	}

	/**
	 * Export a public key
	 *
	 * @param string $publicKeyFingerprint
	 * @return void
	 */
	public function exportPublicKeyCommand($publicKeyFingerprint) {
		$publicKey = $this->rsaWalletService->getPublicKey($publicKeyFingerprint);
		$this->output($publicKey->getKeyString());
	}

}

?>

<?php
namespace Flowpack\SingleSignOn\Client\Command;

/*                                                                               *
 * This script belongs to the TYPO3 Flow package "Flowpack.SingleSignOn.Client". *
 *                                                                               */

use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Cli\CommandController;

/**
 * Command controller for the SSO key management
 *
 * @Flow\Scope("singleton")
 */
class SsoKeyCommandController extends CommandController {

	/**
	 * @var \TYPO3\Flow\Security\Cryptography\RsaWalletServiceInterface
	 * @Flow\Inject
	 */
	protected $rsaWalletService;

	/**
	 * Generate key pair command
	 *
	 * Creates a new key pair and imports it into the wallet.
	 * Used by SSO client and server.
	 *
	 * @return void
	 */
	public function generateKeyPairCommand() {
		$publicKeyFingerprint = $this->rsaWalletService->generateNewKeypair();
		$this->outputLine('Created key with fingerprint: ' . $publicKeyFingerprint);
	}

	/**
	 * Export a public key
	 *
	 * @param string $publicKeyFingerprint
	 * @return void
	 */
	public function exportPublicKeyCommand($publicKeyFingerprint) {
		$publicKey = $this->rsaWalletService->getPublicKey($publicKeyFingerprint);
		$this->output($publicKey->getKeyString());
	}

}

?>

[TASK] Change name of uuid to fingerprint in command


<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title><?php echo WEBSITE_NAME; ?></title>
    <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Website" />
    <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png" />
    <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png" />
    <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png" />
    <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png" />
    <link rel="icon" type="image/x-icon" href="/favicon.ico" />
    <link href="//<?php echo STATIC_DOMAIN; ?>/css/styles.css" media="all" rel="stylesheet" type="text/css" />
  </head>
  <body>

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title><?php echo WEBSITE_NAME; ?></title>
    <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="<?php echo WEBSITE_NAME; ?>">
    <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png">
    <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png">
    <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png">
    <link rel="icon" type="image/x-icon" href="/favicon.ico">
    <link href="//<?php echo STATIC_DOMAIN; ?>/css/styles.css" media="all" rel="stylesheet" type="text/css">
    <script src="//<?php echo STATIC_DOMAIN; ?>/js/scripts.js"></script>
  </head>
  <body>

Add script for js file and update html tags


<?php

	/**
	 * Register Twitter Feed and widgetized areas.
	 *
	 */
	function twitter_feed_widgets_init() {
	  register_sidebar( array(
	    'name' => 'Twitter Feeds Section',
	    'id' => 'twitter-feed-widget',
	    'before_widget' => '
',
	    'after_widget' => '
'
	  ) );
	}
	add_action( 'widgets_init', 'twitter_feed_widgets_init' );

	/**
	 * Register blog post and widgetized areas.
	 *
	 */
	function blog_sidebar_widgets_init() {
	  register_sidebar( array(
	    'name' => 'Blog Sitebar Section',
	    'id' => 'blog-sitebar-widget',
	    'before_widget' => '
',
	    'after_widget' => '
'
	  ) );
	}
	add_action( 'widgets_init', 'blog_sidebar_widgets_init' );

?>

Remove the closing php tag ?> to fix the broken RSS feed problem


<?php
namespace Respect\Validation\Rules;

use Respect\Validation\Validator as v;

class HexRgbColor extends AbstractRule
{
    public function validate($input)
    {
        if (v::oneOf(v::object(), v::arr(), v::nullValue(), v::not(v::string()))->validate($input)) {
            return false;
        }

        if (!v::startsWith('#')->validate($input)) {
            $input = '#'.$input;
        }

        $length = strlen($input) - 1;

        if ($length != 3 && $length != 6) {
            return false;
        }

        $hexdec = hexdec(substr($input, 1));

        return v::xdigit()->validate(substr($input, 1))
                        && $hexdec < 16777216 && $hexdec >= 0;
    }
}

<?php
namespace Respect\Validation\Rules;

use Respect\Validation\Validator as v;

class HexRgbColor extends Xdigit
{
    public function validate($input)
    {
        if (!is_string($input)) {
            return false;
        }

        if (0 === strpos($input, '#')) {
            $input = substr($input, 1);
        }

        $length = strlen($input);
        if ($length != 3 && $length != 6) {
            return false;
        }

        return parent::validate($input);
    }
}

Remove unnecessary code from `hexRgbColor()` rule


{tr:admin_page}

    <?php

    $sections = array('statistics', 'transfers', 'guests');

    try {
        if(count(Config::overrides()))
            $sections[] = 'config';
    } catch(ConfigOverrideDisabledException $e) {}

    $section = 'statistics';
    if(array_key_exists('as', $_REQUEST))
        $section = $_REQUEST['as'];

    if(!in_array($section, $sections)) throw new GUIUnknownAdminSectionException($section);

    ?>

        <?php foreach($sections as $s) { ?>
            <li class="<?php if($s == $section) echo 'current' ?>">
                <a href="?s=admin&as=<?php echo $s ?>">
                    <?php echo Lang::tr('admin_'.$s.'_section') ?>

        <?php } ?>

    <div class="<?php echo $section ?>_section section">
        <?php Template::display('admin_'.$section.'_section') ?>

{tr:admin_page}

    <?php

    $sections = array('statistics', 'transfers', 'guests');

    if(Config::get('config_overrides'))
        $sections[] = 'config';

    $section = 'statistics';
    if(array_key_exists('as', $_REQUEST))
        $section = $_REQUEST['as'];

    if(!in_array($section, $sections)) throw new GUIUnknownAdminSectionException($section);

    ?>

        <?php foreach($sections as $s) { ?>
            <li class="<?php if($s == $section) echo 'current' ?>">
                <a href="?s=admin&as=<?php echo $s ?>">
                    <?php echo Lang::tr('admin_'.$s.'_section') ?>

        <?php } ?>

    <div class="<?php echo $section ?>_section section">
        <?php Template::display('admin_'.$section.'_section') ?>

Fix overrides enabled check to stop getting exceptions

git-svn-id: 28fe03dfd74dd77dcc8ecfe99fabcec8eed81bba@3461 8555b757-d854-4b86-925a-82fd84c90ff4


<?php

class Db_model extends CI_Model {

  function __construct()
  {
    // Call the Model constructor
    parent::__construct();
  }

  function insert_record($record)
  {
    /*
     * convert coordinate string to mysql geospacial fucntion call
     */
    $coord_string = $record['coordinates'];
    unset($record['coordinates']);

    // convert string to function call, if string is null or not well formatted
    // set as null
    $coord = NULL;
    if ($coord_string != NULL and $coord_string != '')
    {
      $coord_array = explode(", ", $coord_string);

      if (sizeof($coord == 2)) { // make sure we have two coordinates
        $coord = "GeomFromText('POINT(" . implode(' ', $coord_array) . ")')";
      } else {
        $coord = NULL;
      }
    }

    // insert in to db
    $this->db->set($record);
    if ($coord) $this->db->set('coordinate', $coord, FALSE);
    $this->db->insert('point');
  }
}

<?php

class Db_model extends CI_Model {

  function __construct()
  {
    // Call the Model constructor
    parent::__construct();
  }

  function insert_record($record)
  {
    /*
     * convert coordinate string to mysql geospacial fucntion call
     */
    $coord_string = $record['coordinates'];
    unset($record['coordinates']);

    // convert string to function call, if string is null or not well formatted
    // set as null

    $coord = NULL;
    if ($coord_string != NULL and $coord_string != '')
    {
      $coord_array = explode(", ", $coord_string);
      if (sizeof($coord == 2)) { // make sure we have two coordinates
        $coord = NULL;
      }
    }

    if ($coord == NULL) {
      // set to antarctica
      $coord_array = array(-90, 0);
    }

    $coord = "GeomFromText('POINT(" . implode(' ', $coord_array) . ")')";

    // insert in to db
    $this->db->set($record);
    if ($coord) $this->db->set('coordinate', $coord, FALSE);
    $this->db->insert('point');
  }
}

Set default coordinate to -90, 0(antarctica) since mysql refuses to index coordinates if there exists empty or null value.


<?php

namespace Minify\Test;

use Minify_HTML_Helper;

class LessSourceTest extends TestCase
{
    public function setUp()
    {
        $this->realDocRoot = $_SERVER['DOCUMENT_ROOT'];
        $_SERVER['DOCUMENT_ROOT'] = self::$document_root;
    }

    /**
     * @link https://github.com/mrclay/minify/issues/500
     */
    public function testLessTimestamp()
    {
        $baseDir = self::$test_files;

        $mainLess = "$baseDir/main.less";
        $includedLess = "$baseDir/included.less";

        // touch timestamp with 1s difference
        touch($mainLess);
        sleep(1);
        touch($includedLess);

        $mtime1 = filemtime($mainLess);
        $mtime2 = filemtime($includedLess);

        $max = max($mtime1, $mtime2);

        $options = array(
            'groupsConfigFile' => "$baseDir/htmlHelper_groupsConfig.php",
        );
        $res = Minify_HTML_Helper::getUri('less', $options);

        $this->assertEquals("/min/g=less&{$max}", $res);
    }
}

<?php

namespace Minify\Test;

use Minify_HTML_Helper;

/**
 * @requires php < 7.3
 */
class LessSourceTest extends TestCase
{
    public function setUp()
    {
        $this->realDocRoot = $_SERVER['DOCUMENT_ROOT'];
        $_SERVER['DOCUMENT_ROOT'] = self::$document_root;
    }

    /**
     * @link https://github.com/mrclay/minify/issues/500
     */
    public function testLessTimestamp()
    {
        $baseDir = self::$test_files;

        $mainLess = "$baseDir/main.less";
        $includedLess = "$baseDir/included.less";

        // touch timestamp with 1s difference
        touch($mainLess);
        sleep(1);
        touch($includedLess);

        $mtime1 = filemtime($mainLess);
        $mtime2 = filemtime($includedLess);

        $max = max($mtime1, $mtime2);

        $options = array(
            'groupsConfigFile' => "$baseDir/htmlHelper_groupsConfig.php",
        );
        $res = Minify_HTML_Helper::getUri('less', $options);

        $this->assertEquals("/min/g=less&{$max}", $res);
    }
}

Disable less tests on php 7.4+

Disable less tests on php 7.4+


<?php

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

namespace Composer\DependencyResolver;

/**
 * @author Nils Adermann <naderman@naderman.de>
 */
class SolverBugException extends \RuntimeException
{
    protected $problems;

    public function __construct($message)
    {
        parent::__construct(
            $message."\nThis exception was most likely caused by a bug in Composer.\n".
            "Please report the command you ran, the exact error you received, and your composer.json on https://github.com/composer/composer/issues - thank you!\n");
    }
}

<?php

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

namespace Composer\DependencyResolver;

/**
 * @author Nils Adermann <naderman@naderman.de>
 */
class SolverBugException extends \RuntimeException
{
    public function __construct($message)
    {
        parent::__construct(
            $message."\nThis exception was most likely caused by a bug in Composer.\n".
            "Please report the command you ran, the exact error you received, and your composer.json on https://github.com/composer/composer/issues - thank you!\n");
    }
}

Remove useless property in exception class


<?php

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

namespace Symfony\Component\Validator;

/**
 * A list of constraint violations.
 *
 * @author Bernhard Schussek <bschussek@gmail.com>
 */
interface ConstraintViolationListInterface extends \Traversable, \Countable, \ArrayAccess
{
    /**
     * Adds a constraint violation to this list.
     */
    public function add(ConstraintViolationInterface $violation);

    /**
     * Merges an existing violation list into this list.
     */
    public function addAll(self $otherList);

    /**
     * Returns the violation at a given offset.
     *
     * @param int $offset The offset of the violation
     *
     * @return ConstraintViolationInterface The violation
     *
     * @throws \OutOfBoundsException if the offset does not exist
     */
    public function get($offset);

    /**
     * Returns whether the given offset exists.
     *
     * @param int $offset The violation offset
     *
     * @return bool Whether the offset exists
     */
    public function has($offset);

    /**
     * Sets a violation at a given offset.
     *
     * @param int                          $offset    The violation offset
     * @param ConstraintViolationInterface $violation The violation
     */
    public function set($offset, ConstraintViolationInterface $violation);

    /**
     * Removes a violation at a given offset.
     *
     * @param int $offset The offset to remove
     */
    public function remove($offset);
}

<?php

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

namespace Symfony\Component\Validator;

/**
 * A list of constraint violations.
 *
 * @author Bernhard Schussek <bschussek@gmail.com>
 */
interface ConstraintViolationListInterface extends \Traversable, \Countable, \ArrayAccess
{
    /**
     * Adds a constraint violation to this list.
     */
    public function add(ConstraintViolationInterface $violation);

    /**
     * Merges an existing violation list into this list.
     */
    public function addAll(ConstraintViolationListInterface $otherList);

    /**
     * Returns the violation at a given offset.
     *
     * @param int $offset The offset of the violation
     *
     * @return ConstraintViolationInterface The violation
     *
     * @throws \OutOfBoundsException if the offset does not exist
     */
    public function get($offset);

    /**
     * Returns whether the given offset exists.
     *
     * @param int $offset The violation offset
     *
     * @return bool Whether the offset exists
     */
    public function has($offset);

    /**
     * Sets a violation at a given offset.
     *
     * @param int                          $offset    The violation offset
     * @param ConstraintViolationInterface $violation The violation
     */
    public function set($offset, ConstraintViolationInterface $violation);

    /**
     * Removes a violation at a given offset.
     *
     * @param int $offset The offset to remove
     */
    public function remove($offset);
}

Fix tests for legacy phpunit versions

Fix tests for legacy phpunit versions


<?php
namespace Craft;

class Neo_BlockRecord extends BaseRecord
{
	public function getTableName()
	{
		return 'neoblocks';
	}

	public function defineRelations()
	{
		return [
			'element' => [static::BELONGS_TO, 'ElementRecord', 'id',
				'required' => true,
				'onDelete' => static::CASCADE
			],
			'owner' => [static::BELONGS_TO, 'ElementRecord',
				'required' => true,
				'onDelete' => static::CASCADE
			],
			'ownerLocale' => [static::BELONGS_TO, 'LocaleRecord', 'ownerLocale',
				'onDelete' => static::CASCADE,
				'onUpdate' => static::CASCADE
			],
			'field' => [static::BELONGS_TO, 'FieldRecord',
				'required' => true,
				'onDelete' => static::CASCADE
			],
			'type' => [static::BELONGS_TO, 'Neo_BlockTypeRecord',
				'onDelete' => static::CASCADE
			],
		];
	}

	public function defineIndexes()
	{
		return [
			['columns' => ['ownerId']],
			['columns' => ['fieldId']],
			['columns' => ['typeId']],
			['columns' => ['collapsed']],
		];
	}

	protected function defineAttributes()
	{
		return [
			'collapsed' => [AttributeType::Bool, 'default' => false],
			'ownerLocale' => AttributeType::Locale,
		];
	}
}

<?php
namespace Craft;

class Neo_BlockRecord extends BaseRecord
{
	public function getTableName()
	{
		return 'neoblocks';
	}

	public function defineRelations()
	{
		return [
			'element' => [static::BELONGS_TO, 'ElementRecord', 'id',
				'required' => true,
				'onDelete' => static::CASCADE
			],
			'owner' => [static::BELONGS_TO, 'ElementRecord',
				'required' => true,
				'onDelete' => static::CASCADE
			],
			'ownerLocale' => [static::BELONGS_TO, 'LocaleRecord', 'ownerLocale',
				'onDelete' => static::CASCADE,
				'onUpdate' => static::CASCADE
			],
			'field' => [static::BELONGS_TO, 'FieldRecord',
				'required' => true,
				'onDelete' => static::CASCADE
			],
			'type' => [static::BELONGS_TO, 'Neo_BlockTypeRecord',
				'onDelete' => static::CASCADE
			],
		];
	}

	public function defineIndexes()
	{
		return [
			['columns' => ['ownerId']],
			['columns' => ['fieldId']],
			['columns' => ['typeId']],
			['columns' => ['collapsed']],
		];
	}

	protected function defineAttributes()
	{
		return [
			'collapsed' => AttributeType::Bool,
			'ownerLocale' => AttributeType::Locale,
		];
	}
}

Remove collapsed default for easier migration


<?php
/*
 * Fonts template
 *
 * 		1 Google fonts
 */

/*
 * 1 GOOGLE FONTS
 * ************************************************************
 */

function osea_fonts() {
	wp_enqueue_style('googleFonts', 'http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700');
}
add_action('wp_print_styles', 'osea_fonts');

<?php
/*
 * Fonts template
 *
 * 		1 Google fonts
 */

/*
 * 1 GOOGLE FONTS
 * ************************************************************
 */

function osea_fonts() {
	wp_enqueue_style('googleFonts', 'http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700');
}
add_action('wp_enqueue_scripts', 'osea_fonts');

Change the styles hook (674)

Change the styles hook (674)


<?php

namespace OkulBilisim\OjsImportBundle\Importer\PKP;

use Ojs\JournalBundle\Entity\Article;
use OkulBilisim\OjsImportBundle\Importer\Importer;

class ArticleSubmitterImporter extends Importer
{
    /**
     * @param UserImporter $userImporter
     */
    public function importArticleSubmitter($userImporter)
    {
        $pendingImports = $this->em->getRepository('OkulBilisimOjsImportBundle:PendingSubmitterImport')->findAll();
        $this->consoleOutput->writeln("Importing article submitters...");

        foreach ($pendingImports as $import) {
            $user = $userImporter->importUser($import->getOldId());

            if ($user) {
                /** @var Article $article */
                $article = $import->getArticle();
                $article->setSubmitterUser($user);

                $this->em->persist($article);
                $this->em->flush($article);
            }
        }
    }
}

<?php

namespace OkulBilisim\OjsImportBundle\Importer\PKP;

use Ojs\JournalBundle\Entity\Article;
use OkulBilisim\OjsImportBundle\Importer\Importer;

class ArticleSubmitterImporter extends Importer
{
    /**
     * @param UserImporter $userImporter
     */
    public function importArticleSubmitter($userImporter)
    {
        $pendingImports = $this->em->getRepository('OkulBilisimOjsImportBundle:PendingSubmitterImport')->findAll();
        $this->consoleOutput->writeln("Importing article submitters...");

        foreach ($pendingImports as $import) {
            $user = $userImporter->importUser($import->getOldId());

            if ($user) {
                /** @var Article $article */
                $article = $import->getArticle();
                $article->setSubmitterUser($user);

                $this->em->persist($article);
            }

            $this->em->remove($import);
            $this->em->flush();
        }
    }
}

Remove pending import record after importing the user


<?php
/**
 * @author         Pierre-Henry Soria <ph7software@gmail.com>
 * @copyright      (c) 2012-2017, Pierre-Henry Soria. All Rights Reserved.
 * @license        GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
 * @package        PH7 / App / System / Module / Admin / From / Processing
 */
namespace PH7;

defined('PH7') or die('Restricted access');

use
PH7\Framework\Mvc\Model\Design,
PH7\Framework\Mvc\Model\Analytics,
PH7\Framework\Cache\Cache,
PH7\Framework\Mvc\Request\Http;

class AnalyticsApiFormProcess extends Form
{
    public function __construct()
    {
        parent::__construct();

        if (!$this->str->equals($this->httpRequest->post('code', Http::NO_CLEAN), (new Design)->analyticsApi(false)))
        {
            (new Analytics)->updateApi($this->httpRequest->post('code', Http::NO_CLEAN));

            /* Clean Model\Design for STATIC / analyticsApi data */
            (new Cache)->start(Design::CACHE_STATIC_GROUP, 'analyticsApi1', null)->clear();
        }
        \PFBC\Form::setSuccess('form_analytics', t('The code Analytics Api has been successfully updated!'));
    }
}

<?php
/**
 * @author         Pierre-Henry Soria <ph7software@gmail.com>
 * @copyright      (c) 2012-2017, Pierre-Henry Soria. All Rights Reserved.
 * @license        GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
 * @package        PH7 / App / System / Module / Admin / From / Processing
 */
namespace PH7;

defined('PH7') or die('Restricted access');

use
PH7\Framework\Mvc\Model\Design,
PH7\Framework\Mvc\Model\Analytics,
PH7\Framework\Cache\Cache,
PH7\Framework\Mvc\Request\Http;

class AnalyticsApiFormProcess extends Form
{
    public function __construct()
    {
        parent::__construct();

        if (!$this->str->equals(
            $this->httpRequest->post('code', Http::NO_CLEAN),
            (new Design)->analyticsApi(false))
        ) {
            (new Analytics)->updateApi($this->httpRequest->post('code', Http::NO_CLEAN));
            $this->clearCache();
        }
        \PFBC\Form::setSuccess('form_analytics', t('Analytics Code updated!'));
    }

    /**
     * Clear the 'active' "analyticsApi" data
     *
     * @return void
     */
    private function clearCache()
    {
        (new Cache)->start(Design::CACHE_STATIC_GROUP, 'analyticsApi1', null)->clear();
    }
}

Fix typo + add separated method for clearing the cache


<?php

namespace Underscore\Mutator;

use Underscore\Collection;
use Underscore\Mutator;

/**
 * Class WhereMutator
 * @package Underscore\Mutator
 */
class WhereMutator extends Mutator
{
    /**
     * Remove all values that do not match the given key-value pairs.
     *
     * By default strict comparison is used.
     *
     * @param Collection $collection
     * @param array $properties
     * @param boolean $strict
     * @return Collection
     */
    public function __invoke($collection, array $properties, $strict = true)
    {
        $collection = clone $collection;

        // This can be refactored to use array_filter once #54 is merged.
        foreach ($collection as $index => $item) {
            $item = new Collection($item);
            foreach ($properties as $key => $value) {
                if (empty($item[$key])
                    || ($strict && $item[$key] !== $value)
                    || (!$strict && $item[$key] != $value)
                ) {
                    unset($collection[$index]);
                }
            }
        }

        return $collection;
    }
}

<?php

namespace Underscore\Mutator;

use Underscore\Collection;
use Underscore\Mutator;

class WhereMutator extends Mutator
{
    /**
     * Remove all values that do not match the given key-value pairs.
     *
     * By default strict comparison is used.
     *
     * @param Collection $collection
     * @param array      $properties
     * @param boolean    $strict
     * @return Collection
     */
    public function __invoke($collection, array $properties, $strict = true)
    {
        return $this->wrap(array_filter((array)$collection, function ($item) use ($properties, $strict) {
            foreach ($properties as $key => $value) {
                if (empty($item[$key])
                    || ($strict && $item[$key] !== $value)
                    || (!$strict && $item[$key] != $value)
                ) {
                    return false;
                }
            }

            return true;
        }));
    }
}

Fix and refactor where() mutator

Fix and refactor where() mutator


<?php namespace Flarum\Api\Events;

class SerializeAttributes
{
    public $serializer;

    public $model;

    public $attributes;

    public function __construct($serializer, $model, &$attributes)
    {
        $this->serializer = $serializer;
        $this->model = $model;
        $this->attributes = $attributes;
    }
}

<?php namespace Flarum\Api\Events;

class SerializeAttributes
{
    public $serializer;

    public $model;

    public $attributes;

    public function __construct($serializer, $model, &$attributes)
    {
        $this->serializer = $serializer;
        $this->model = $model;
        $this->attributes = &$attributes;
    }
}

Fix attribute serialisation event mutability


<?php
namespace Criterion\Helper;

class Repo
{
    public static function provider($url)
    {
        if (strpos($url, 'github.com'))
        {
            return 'github';
        }

        return false;
    }

    public static function short($url)
    {
        if (self::provider($url) == 'github')
        {
            return Github::shortRepo($url);
        }

        return $url;
    }
}

<?php
namespace Criterion\Helper;

class Repo
{
    public static function provider($url)
    {
        if (strpos($url, 'github.com'))
        {
            return 'github';
        }

        return false;
    }

    public static function username($repo)
    {
        $username = explode('@', $repo);
        return str_replace('https://', null, $username[0]);
    }

    public static function short($url)
    {
        if (self::provider($url) == 'github')
        {
            return Github::shortRepo($url);
        }

        return $url;
    }
}

Add the ability to get a repo username E.G. git@ from a repo url


<?php

namespace BlizzardGalaxy\ApiSupervisor\Enum\Method;

use BlizzardGalaxy\ApiSupervisor\Enum\ArrayEnumInterface;

/**
 * Keeps a list of all the starcraft methods that can be called.
 *
 * @package BlizzardGalaxy\ApiSupervisor\Enum\Method
 * @author  Petre Pătrașc <petre@dreamlabs.ro>
 */
class StarcraftApiMethod implements ArrayEnumInterface
{
    const PLAYER = 'profile';
    const LADDER = 'ladder';
    const ACHIEVEMENTS = 'achievements';
    const REWARDS = 'rewards';

    /**
     * Get all of the entries as an array.
     *
     * @return array
     */
    public static function getAllAsArray()
    {
        return [
            self::PLAYER,
            self::LADDER,
            self::ACHIEVEMENTS,
            self::REWARDS,
        ];
    }
}

<?php

namespace BlizzardGalaxy\ApiSupervisor\Enum\Method;

/**
 * Keeps a list of all the starcraft methods that can be called.
 *
 * @package BlizzardGalaxy\ApiSupervisor\Enum\Method
 * @author  Petre Pătrașc <petre@dreamlabs.ro>
 */
class StarcraftApiMethod
{
    const PLAYER = 'profile';
    const LADDER = 'ladder';
    const ACHIEVEMENTS = 'achievements';
    const REWARDS = 'rewards';
}

Remove ArrayInterface constraint for Method enums


<?php
/*
 * Copyright NEXPER <info@nexper.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

$GLOBALS['TL_DCA']['tl_layout']['palettes']['default'] .= ';{nx_columns_legend},nx_columns_load_reset_css,nx_columns_load_css';

$GLOBALS['TL_DCA']['tl_layout']['fields']['nx_columns_load_reset_css'] = array(
	'inputType' => 'checkbox',
	'label' => &$GLOBALS['TL_LANG']['tl_layout']['nx_columns_load_reset_css'],
    'eval' => array('tl_class' => 'w50'),
	'sql' => "char(1) NOT NULL default '0'",
);
$GLOBALS['TL_DCA']['tl_layout']['fields']['nx_columns_load_css'] = array(
	'inputType' => 'checkbox',
	'label' => &$GLOBALS['TL_LANG']['tl_layout']['nx_columns_load_css'],
    'eval' => array('tl_class' =>'w50'),
	'sql' => "char(1) NOT NULL default '1'",
);

<?php
/*
 * Copyright NEXPER <info@nexper.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

$GLOBALS['TL_DCA']['tl_layout']['palettes']['__selector__'][] = 'nx_columns_load_css';
$GLOBALS['TL_DCA']['tl_layout']['palettes']['default'] .= ';{nx_columns_legend},nx_columns_load_css';
$GLOBALS['TL_DCA']['tl_layout']['subpalettes']['nx_columns_load_css'] = 'nx_columns_load_reset_css';

$GLOBALS['TL_DCA']['tl_layout']['fields']['nx_columns_load_css'] = array(
	'inputType' => 'checkbox',
	'label' => &$GLOBALS['TL_LANG']['tl_layout']['nx_columns_load_css'],
    'eval' => array('submitOnChange' => true, 'tl_class' =>'w50'),
	'sql' => "char(1) NOT NULL default '1'",
);

$GLOBALS['TL_DCA']['tl_layout']['fields']['nx_columns_load_reset_css'] = array(
	'inputType' => 'checkbox',
	'label' => &$GLOBALS['TL_LANG']['tl_layout']['nx_columns_load_reset_css'],
    'eval' => array('tl_class' => 'w50'),
	'sql' => "char(1) NOT NULL default '0'",
);

Change reset css option to subpalette

Change reset css option to subpalette


<?php
Yii::setAlias('common', dirname(__DIR__));
Yii::setAlias('frontend', dirname(dirname(__DIR__)) . '/frontend');
Yii::setAlias('backend', dirname(dirname(__DIR__)) . '/backend');
Yii::setAlias('console', dirname(dirname(__DIR__)) . '/console');

<?php
Yii::setAlias('@common', dirname(__DIR__));
Yii::setAlias('@frontend', dirname(dirname(__DIR__)) . '/frontend');
Yii::setAlias('@backend', dirname(dirname(__DIR__)) . '/backend');
Yii::setAlias('@console', dirname(dirname(__DIR__)) . '/console');

Add '@' prefix of setAlias('common', ...)


<?php namespace App\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;

abstract class Controller extends BaseController {

	use DispatchesCommands, ValidatesRequests;

}

<?php namespace App\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Support\Facades\Auth;
use Zizaco\Entrust\Entrust;

abstract class Controller extends BaseController {

	use DispatchesCommands, ValidatesRequests;

    public function adminOrAuthorPermissionRequired($user_id)
    {
        if (!Entrust::can('manage_topics') && $user_id != Auth::user()->id) {
            abort(401, "Admin or author permission required!");
        }
    }

}

Add the method to require permission or throw an exception.


<?php

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

class CreateMusicSettings extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('music_settings', function (Blueprint $table) {
            $table->string('id')->primary();
            $table->boolean('enabled')->default(true);
            $table->enum('mode', ['OFF','WHITELIST', 'BLACKLIST'])->default('OFF');
            $table->text('channels')->default('');
            $table->text('blacklist_songs')->default('')->nullable();
            $table->integer('max_queue_length')->default(-1);
            $table->integer('max_song_length')->default(-1);
            $table->integer('skip_cooldown')->default(0);
            $table->integer('skip_timer')->default(30);
            $table->timestamps();
        });
    }

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

<?php

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

class CreateMusicSettings extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('music_settings', function (Blueprint $table) {
            $table->string('id')->primary();
            $table->boolean('enabled')->default(true);
            $table->enum('mode', ['OFF','WHITELIST', 'BLACKLIST'])->default('OFF');
            $table->text('channels')->nullable();
            $table->text('blacklist_songs')->nullable();
            $table->integer('max_queue_length')->default(-1);
            $table->integer('max_song_length')->default(-1);
            $table->integer('skip_cooldown')->default(0);
            $table->integer('skip_timer')->default(30);
            $table->timestamps();
        });
    }

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

Remove default values from channels columns


<?php

/**
 * Return a path to the icon.
 * @param integer $size Icon size
 * @param string $context Context for the icon
 * @param string $name Name of the icon
 * @return string Path to the icon
 */
function ti_get_image_path($size, $context, $name) {
	return sfContext::getInstance()->getRequest()->getRelativeUrlRoot()."/sfTangoIconsPlugin/images/{$size}x{$size}/{$context}/{$name}.png";
}

<?php

/**
 * Return a path to the icon.
 * @param string $context Context for the icon
 * @param string $name Name of the icon
 * @param integer $size Icon size
 * @return string Path to the icon
 */
function ti_get_image_path($context, $name, $size) {
	return sfContext::getInstance()->getRequest()->getRelativeUrlRoot()."/sfTangoIconsPlugin/images/{$size}x{$size}/{$context}/{$name}.png";
}

Change the sequence of parameters

Change the sequence of parameters


<?php

/***************************************************************
 * Extension Manager/Repository config file for ext "bootstrap_package".
 ***************************************************************/

$EM_CONF[$_EXTKEY] = array (
    'title' => 'Bootstrap Package',
    'description' => 'Bootstrap Package delivers a full configured frontend for TYPO3 CMS 6.2, based on the Bootstrap CSS Framework.',
    'category' => 'templates',
    'shy' => 0,
    'version' => '6.2.6-dev',
    'dependencies' => '',
    'conflicts' => '',
    'priority' => 'top',
    'loadOrder' => '',
    'module' => '',
    'state' => 'beta',
    'uploadfolder' => 0,
    'createDirs' => '',
    'modify_tables' => 'tt_content',
    'clearcacheonload' => 1,
    'lockType' => '',
    'author' => 'Benjamin Kott',
    'author_email' => 'info@bk2k.info',
    'author_company' => 'private',
    'CGLcompliance' => NULL,
    'CGLcompliance_note' => NULL,
    'constraints' => array(
        'depends' => array(
            'typo3' => '6.2.0-6.3.99',
            'css_styled_content' => '6.2.0-6.3.99',
            'realurl' => '1.12.8-1.12.99',
        ),
        'conflicts' => array(
            'fluidpages' => '*',
            'dyncss' => '*',
        ),
        'suggests' => array()
    ),
);

<?php

/***************************************************************
 * Extension Manager/Repository config file for ext "bootstrap_package".
 ***************************************************************/

$EM_CONF[$_EXTKEY] = array (
    'title' => 'Bootstrap Package',
    'description' => 'Bootstrap Package delivers a full configured frontend for TYPO3 CMS 6.2, based on the Bootstrap CSS Framework.',
    'category' => 'templates',
    'shy' => 0,
    'version' => '6.2.6-dev',
    'dependencies' => '',
    'conflicts' => '',
    'priority' => 'top',
    'loadOrder' => '',
    'module' => '',
    'state' => 'beta',
    'uploadfolder' => 0,
    'createDirs' => '',
    'modify_tables' => 'tt_content',
    'clearcacheonload' => 1,
    'lockType' => '',
    'author' => 'Benjamin Kott',
    'author_email' => 'info@bk2k.info',
    'author_company' => 'private',
    'CGLcompliance' => NULL,
    'CGLcompliance_note' => NULL,
    'constraints' => array(
        'depends' => array(
            'typo3' => '6.2.4-6.3.99',
            'css_styled_content' => '6.2.0-6.3.99',
            'realurl' => '1.12.8-1.12.99',
        ),
        'conflicts' => array(
            'fluidpages' => '*',
            'dyncss' => '*',
        ),
        'suggests' => array()
    ),
);

Correct dependency to TYPO3 version to ensure that the correct forms are loaded


<?php if ( !in_array($_SERVER['REMOTE_ADDR'],array('10.14.27.13','10.14.22.162','10.14.22.163')) ):?>

<?php endif; ?>
  Spokane Is Reading
  Get a Library Card
  Support Your Library!

<?php if ( !in_array($_SERVER['REMOTE_ADDR'],array('10.14.27.13','10.14.22.162','10.14.22.163')) ):?>

<?php endif; ?>

  Get a Library Card
  Support Your Library!

Remove Spokane is Reading mini-promo

Remove Spokane is Reading mini-promo


<?php
    class ReadMore extends Modules {
        public function __init() {
            # Replace comment codes before markup modules filters them.
            $this->setPriority("markup_post_text", 4);
        }

        public function markup_post_text($text, $post = null) {
            if (!is_string($text) or !preg_match("//i", $text, $matches))
                return $text;

            $route = Route::current();
            $controller = $route->controller;

            if ($route->action == "view" or ($controller instanceof MainController and $controller->feed))
                return preg_replace("//i", "", $text);

            $more = oneof(trim(fallback($matches[1])), __("…more", "read_more"));
            $url = (isset($post) and !$post->no_results) ? $post->url() : "#" ;
            $split = preg_split("//i", $text, -1, PREG_SPLIT_NO_EMPTY);

            return $split[0].''.$more.'';
        }

        public function title_from_excerpt($text) {
            $split = preg_split('/<a class="read_more"/', $text);
            return $split[0];
        }
    }

<?php
    class ReadMore extends Modules {
        public function __init() {
            # Replace comment codes before markup modules filters them.
            $this->setPriority("markup_post_text", 4);
        }

        public function markup_post_text($text, $post = null) {
            if (!is_string($text) or !preg_match("//i", $text, $matches))
                return $text;

            $route = Route::current();
            $controller = $route->controller;

            if (!isset($post) or $route->action == "view" or ($controller instanceof MainController and $controller->feed))
                return preg_replace("//i", "", $text);

            $more = oneof(trim(fallback($matches[1])), __("…more", "read_more"));
            $url = (!$post->no_results) ? $post->url() : "#" ;
            $split = preg_split("//i", $text, -1, PREG_SPLIT_NO_EMPTY);

            return $split[0].''.$more.'';
        }

        public function title_from_excerpt($text) {
            $split = preg_split('/<a class="read_more"/', $text);
            return $split[0];
        }
    }

Read More module: changes to filter logic

Absence of a post indicates we are previewing content.


<?php
/**
 * Created by enea dhack - 12/06/17 10:54 PM
 */

namespace Enea\Cashier\Facades;

use Enea\Cashier\Contracts\BuyerContract;
use Enea\Cashier\Contracts\InvoiceContract;
use Enea\Cashier\ShoppingCard;
use Illuminate\Support\Facades\Facade;
use \Enea\Cashier\ShoppingManager as Manager;

/**
 * Class ShoppingManager
 * @package Enea\Cashier\Facades
 * @author enea dhack <enea.so@live.com>
 *
 * Methods
 *
 * @method static ShoppingCard initialize( BuyerContract $buyer, InvoiceContract $invoice = null)
 * @method static ShoppingCard find( string $token )
 *
 * @see \Enea\Cashier\ShoppingManager
 */
class ShoppingManager extends Facade
{

    /**
     * Get the registered name of the component.
     *
     * @return string
     *
     * @throws \RuntimeException
     */
    protected static function getFacadeAccessor()
    {
        return Manager::class;
    }

}

<?php
/**
 * Created by enea dhack - 12/06/17 10:54 PM
 */

namespace Enea\Cashier\Facades;

use Enea\Cashier\Contracts\BuyerContract;
use Enea\Cashier\Contracts\InvoiceContract;
use Enea\Cashier\ShoppingCard;
use Illuminate\Support\Facades\Facade;
use \Enea\Cashier\ShoppingManager as Manager;

/**
 * Class ShoppingManager
 * @package Enea\Cashier\Facades
 * @author enea dhack <enea.so@live.com>
 *
 * Methods
 *
 * @method static ShoppingCard initialize( BuyerContract $buyer, InvoiceContract $invoice = null)
 * @method static ShoppingCard find( string $token )
 * @method static bool drop( string $token )
 * @method static void flush( )
 *
 * @see \Enea\Cashier\ShoppingManager
 */
class ShoppingManager extends Facade
{

    /**
     * Get the registered name of the component.
     *
     * @return string
     *
     * @throws \RuntimeException
     */
    protected static function getFacadeAccessor()
    {
        return Manager::class;
    }

}

Add methods to shopping manager

Add methods to shopping manager


<?php

namespace JsonSchema\Tests\Drafts;

class Draft4Test extends BaseDraftTestCase
{
    protected function getFilePaths()
    {
        return array(
            realpath(__DIR__ . $this->relativeTestsRoot . '/draft4'),
            realpath(__DIR__ . $this->relativeTestsRoot . '/draft4/optional')
        );
    }

    protected function getSkippedTests()
    {
        return array(
            // Not Yet Implemented
            'definitions.json',
            // Partially Implemented
            //'ref.json',
            'refRemote.json',
            // Optional
            'bignum.json',
            'zeroTerminatedFloats.json'
        );
    }

}

<?php

namespace JsonSchema\Tests\Drafts;

class Draft4Test extends BaseDraftTestCase
{
    protected function getFilePaths()
    {
        return array(
            realpath(__DIR__ . $this->relativeTestsRoot . '/draft4'),
            realpath(__DIR__ . $this->relativeTestsRoot . '/draft4/optional')
        );
    }

    protected function getSkippedTests()
    {
        return array(
            // Not Yet Implemented
            'definitions.json',
            // Partially Implemented
            'ref.json',
            'refRemote.json',
            // Optional
            'bignum.json',
            'zeroTerminatedFloats.json'
        );
    }

}

Add ref back to the ignore list - we still have three non-passing tests


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

/**
 * views/irc.php
 *
 * Render news releases, newest first
 *
 */
?>

			Please Note
			This IRC channel is neither owned nor monitored by BCIT. It may contain content unsuitable for work or family.

Enable sandbox restrictions on iframe

Enable sandbox restrictions on iframe


<?php
    namespace DB\Builder;

    /**
     * Interface for all SQL Query Builder
     *
     * @package DB\Driver
     */
    abstract class Builder
    {
        abstract public function clear();
        abstract public function table($tables);

        protected function splitToArr($s, $delim=',')
        {
            if (is_string($s))
            {
                if (strpos($s, $delim) !== false)
                {
                    return explode($delim, $s);
                }
                else
                {
                    return [$s];
                }
            }
            elseif (is_array($s))
            {
                return $s;
            }

            return $s;
        }

        protected function fieldQuote($field)
        {
            if (strpos($field, '.') !== false)
            {
                $ex = explode ('.', $field);
                $ex[0] = trim($ex[0]);
                $ex[1] = trim($ex[1]);
                return "`$ex[0]`.`$ex[1]`";
            }
            else if ($field === '*')
            {
                return $field;
            }
            return "`$field`";
        }
    }

?>

<?php
    namespace DB\Builder;

    /**
     * Interface for all SQL Query Builder
     *
     * @package DB\Driver
     */
    abstract class Builder
    {
        abstract public function reset();
        abstract public function table($tables);
        abstract public function join($table, $field1, $field2);
        abstract public function where($field, $vo1, $vo2='');
        abstract public function whereOr($field, $vo1, $vo2='');
        abstract public function get($field='*');

        protected function splitToArr($s, $delim=',')
        {
            if (is_string($s))
            {
                if (strpos($s, $delim) !== false)
                {
                    return explode($delim, $s);
                }
                else
                {
                    return [$s];
                }
            }
            elseif (is_array($s))
            {
                return $s;
            }

            return $s;
        }

        protected function fieldQuote($field)
        {
            if (strpos($field, '.') !== false)
            {
                $ex = explode ('.', $field);
                $ex[0] = trim($ex[0]);
                $ex[1] = trim($ex[1]);
                return "`$ex[0]`.`$ex[1]`";
            }
            else if ($field === '*')
            {
                return $field;
            }
            return "`$field`";
        }

        protected function addCond(&$conds, $vo1, $op, $vo2, $cond='AND')
        {
            if ($conds === '')
            {
                $conds = "$vo1$op$vo2";
            }
            else
            {
                $conds .= " $cond $vo1$op$vo2";
            }
        }
    }

?>

Add more function to builder abstract class


<?php declare(strict_types=1);

namespace DaveRandom\LibDNS\HostsFile;

final class Parser
{
    public function parseString(string $data): HostsFile
    {
        $ctx = new ParsingContext();
        $ctx->addData($data);

        return $ctx->getResult();
    }

    /**
     * @param resource $stream
     */
    public function parseStream($stream, int $chunkSize = 1024): HostsFile
    {
        if (!\is_resource($stream) || \get_resource_type($stream) !== 'stream') {
            throw new \InvalidArgumentException("Supplied argument is not a valid stream resource");
        }

        $ctx = new ParsingContext();

        while (false !== $chunk = \fread($stream, $chunkSize)) {
            $ctx->addData($chunk);
        }

        return $ctx->getResult();
    }

    public function parseFile(string $filePath): HostsFile
    {
        if (!$fp = \fopen($filePath, 'r')) {
            throw new \InvalidArgumentException("Failed to open {$filePath} for reading");
        }

        return $this->parseStream($fp);
    }

    public function beginParseString(string $initialData = ''): ParsingContext
    {
        $ctx = new ParsingContext();
        $ctx->addData($initialData);

        return $ctx;
    }
}

<?php declare(strict_types=1);

namespace DaveRandom\LibDNS\HostsFile;

final class Parser
{
    public function parseString(string $data): HostsFile
    {
        $ctx = new ParsingContext();
        $ctx->addData($data);

        return $ctx->getResult();
    }

    /**
     * @param resource $stream
     */
    public function parseStream($stream, int $chunkSize = 1024): HostsFile
    {
        if (!\is_resource($stream) || \get_resource_type($stream) !== 'stream') {
            throw new \InvalidArgumentException("Supplied argument is not a valid stream resource");
        }

        $ctx = new ParsingContext();

        while ('' !== (string)$chunk = \fread($stream, $chunkSize)) {
            $ctx->addData($chunk);
        }

        return $ctx->getResult();
    }

    public function parseFile(string $filePath): HostsFile
    {
        if (!$fp = \fopen($filePath, 'r')) {
            throw new \InvalidArgumentException("Failed to open {$filePath} for reading");
        }

        return $this->parseStream($fp);
    }

    public function beginParseString(string $initialData = ''): ParsingContext
    {
        $ctx = new ParsingContext();
        $ctx->addData($initialData);

        return $ctx;
    }
}

Fix file read loop logic in hosts file parser


<?php
/**
 *
 */

namespace DoSomething\MBC_TransactionalDigest;

/**
 *
 */
class MB_Toolbox_FBMessenger extends MB_Toolbox_BaseService
{

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

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

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

   return $message;
 }

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

 }

}

<?php
/**
 *
 */

namespace DoSomething\MBC_TransactionalDigest;

/**
 *
 */
class MB_Toolbox_FBMessenger extends MB_Toolbox_BaseService
{

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

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

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

  $message = '';

   return $message;
 }

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

 }

}

Add default empty returned markup

Add default empty returned markup


<?php namespace Modules\Setting\Repositories;

use Modules\Core\Repositories\BaseRepository;

interface SettingRepository extends BaseRepository
{
    /**
     * Create or update the settings
     * @param $settings
     * @return mixed
     */
    public function createOrUpdate($settings);

    /**
     * Find a setting by its name
     * @param $settingName
     * @return mixed
     */
    public function findByName($settingName);

    /**
     * Return all modules that have settings
     * with its settings
     * @param array|string $modules
     * @return array
     */
    public function moduleSettings($modules);

    /**
     * Return the saved module settings
     * @param $module
     * @return mixed
     */
    public function savedModuleSettings($module);
}

<?php namespace Modules\Setting\Repositories;

use Modules\Core\Repositories\BaseRepository;

interface SettingRepository extends BaseRepository
{
    /**
     * Create or update the settings
     * @param $settings
     * @return mixed
     */
    public function createOrUpdate($settings);

    /**
     * Find a setting by its name
     * @param $settingName
     * @return mixed
     */
    public function findByName($settingName);

    /**
     * Return all modules that have settings
     * with its settings
     * @param array|string $modules
     * @return array
     */
    public function moduleSettings($modules);

    /**
     * Return the saved module settings
     * @param $module
     * @return mixed
     */
    public function savedModuleSettings($module);

    /**
     * Find settings by module name
     * @param string $module
     * @return mixed
     */
    public function findByModule($module);
}

Add the corresponding interface method

Add the corresponding interface method


<?php

/*
 * By adding type hints and enabling strict type checking, code can become
 * easier to read, self-documenting and reduce the number of potential bugs.
 * By default, type declarations are non-strict, which means they will attempt
 * to change the original type to match the type specified by the
 * type-declaration.
 *
 * In other words, if you pass a string to a function requiring a float,
 * it will attempt to convert the string value to a float.
 *
 * To enable strict mode, a single declare directive must be placed at the top
 * of the file.
 * This means that the strictness of typing is configured on a per-file basis.
 * This directive not only affects the type declarations of parameters, but also
 * a function's return type.
 *
 * For more info review the Concept on strict type checking in the PHP track
 * <link>.
 *
 * To disable strict typing, comment out the directive below.
 */

declare(strict_types=1);

function isIsogram(string $word): bool
{
    throw new \BadFunctionCallException("Implement the isogram function");
}

<?php

/*
 * By adding type hints and enabling strict type checking, code can become
 * easier to read, self-documenting and reduce the number of potential bugs.
 * By default, type declarations are non-strict, which means they will attempt
 * to change the original type to match the type specified by the
 * type-declaration.
 *
 * In other words, if you pass a string to a function requiring a float,
 * it will attempt to convert the string value to a float.
 *
 * To enable strict mode, a single declare directive must be placed at the top
 * of the file.
 * This means that the strictness of typing is configured on a per-file basis.
 * This directive not only affects the type declarations of parameters, but also
 * a function's return type.
 *
 * For more info review the Concept on strict type checking in the PHP track
 * <link>.
 *
 * To disable strict typing, comment out the directive below.
 */

declare(strict_types=1);

function isIsogram(string $word): bool
{
    throw new \BadFunctionCallException("Implement the isIsogram function");
}

Update exception copy with function name


Top 10

Top 50

Top 100

	<?php

			include 'includes/sqllogin.php';

			$result = mysqli_query($con,"SELECT * FROM  `Top Player` ORDER BY Distance DESC LIMIT 10");

			echo "

					Rank
					Name
					Distance

";

				while($row = mysqli_fetch_array($result))
				{
					$rank = 1;
					echo "
";
					echo "" . $rank++ . "	";
					echo "" . $row['PlayerName'] . "	";
					echo "" . $row['Distance'] . "	";
					echo "
";
				}
			echo "
";

			mysqli_close($con);
	?>

Top 10

Top 50

Top 100

	<?php
	$rank = 1;
			include 'includes/sqllogin.php';

			$result = mysqli_query($con,"SELECT * FROM  `Top Player` ORDER BY Distance DESC LIMIT 10");

			echo "

					Rank
					Name
					Distance

";

				while($row = mysqli_fetch_array($result))
				{

					echo "
";
					echo "" . $rank++ . "	";
					echo "" . $row['PlayerName'] . "	";
					echo "" . $row['Distance'] . "	";
					echo "
";
				}
			echo "
";

			mysqli_close($con);
	?>

TEST moving rank outside loop

TEST moving rank outside loop


<?php

namespace app\models\glabs\sites;

/**
 * Backpage site.
 *
 * @package    glabs
 * @author     Nikolaj Rudakov <nnrudakov@gmail.com>
 * @copyright  2016
 */
class Backpage
{
    public function __construct($categories, $count)
    {

    }

    public function parse()
    {

    }
}

<?php

namespace app\models\glabs\sites;

/**
 * Backpage site.
 *
 * @package    glabs
 * @author     Nikolaj Rudakov <nnrudakov@gmail.com>
 * @copyright  2016
 */
class Backpage
{
    public function __construct($count)
    {

    }

    public function parse()
    {

    }
}

Remove categories from init params.

Remove categories from init params.


<?php

class Denkmal_Paging_ScraperSourceResult_ScraperSource extends Denkmal_Paging_ScraperSourceResult_Abstract {

    /**
     * @param Denkmal_Scraper_Source_Abstract $source
     * @param DateTime|null                   $createdMin
     */
    public function __construct(Denkmal_Scraper_Source_Abstract $source, DateTime $createdMin = null) {
        $where = '`sourceType` = ' . $source->getType();
        if (null !== $createdMin) {
            $where .= ' AND `created` > ' . $createdMin->getTimestamp();
        }
        $source = new CM_PagingSource_Sql('id', 'denkmal_scraper_sourceresult', $where);
        parent::__construct($source);
    }
}

<?php

class Denkmal_Paging_ScraperSourceResult_ScraperSource extends Denkmal_Paging_ScraperSourceResult_Abstract {

    /**
     * @param Denkmal_Scraper_Source_Abstract $source
     * @param DateTime|null                   $createdMin
     */
    public function __construct(Denkmal_Scraper_Source_Abstract $source, DateTime $createdMin = null) {
        $where = '`sourceType` = ' . $source->getType();
        if (null !== $createdMin) {
            $where .= ' AND `created` > ' . $createdMin->getTimestamp();
        }
        $source = new CM_PagingSource_Sql('id', 'denkmal_scraper_sourceresult', $where, 'created DESC');
        parent::__construct($source);
    }
}

Order scrapersourceresult paging by "created"


<?php
/**
 * © 2016 Procurios
 */
namespace Procurios\TDD\PhpunitAdapter;

use ReflectionClass;

/**
 * Detect the version of PHPUnit we are running on by using class reflection
 * @return null|string
 */
function detectBaseClass()
{
    $reflectionClass = new ReflectionClass('PHPUnit_Framework_TestCase');
    if ($reflectionClass->hasMethod('expectException')) {
        return 'Procurios\TDD\PhpunitAdapter\PhpunitAdapterTestCase_5_2_0';
    }

    if ($reflectionClass->hasMethod('getMockWithoutInvokingTheOriginalConstructor')) {
        return 'Procurios\TDD\PhpunitAdapter\PhpunitAdapterTestCase_5_0_0';
    }

    return null;
}

$baseClass = detectBaseClass();

if ($baseClass !== null) {
    // Runtime definition of the PhpunitAdapterTestCase class
    $classDefinition = <<< PHP
namespace Procurios\TDD\PhpunitAdapter;
class PhpunitAdapterTestCase extends \\$baseClass
{
}
PHP;

    eval($classDefinition);
}

if (!class_exists('Procurios\TDD\PhpunitAdapter\PhpunitAdapterTestCase', false)) {
    /**
     * Fall back on extending the most complete compatibility layer
     */
    class PhpunitAdapterTestCase extends PhpunitAdapterTestCase_4_8_0
    {
    }
}

<?php
/**
 * © 2016 Procurios
 */
namespace Procurios\TDD\PhpunitAdapter;

use PHPUnit_Runner_Version;

/**
 * Detect the version of PHPUnit we are running on by using class reflection
 * @return null|string
 */
function detectBaseClass()
{
    if (!class_exists('PHPUnit_Runner_Version')) {
        return null;
    }

    $phpunitVersion = PHPUnit_Runner_Version::id();
    if (version_compare($phpunitVersion, '5.2', '>=')) {
        return 'Procurios\TDD\PhpunitAdapter\PhpunitAdapterTestCase_5_2_0';
    }

    if (version_compare($phpunitVersion, '5.0', '>=')) {
        return 'Procurios\TDD\PhpunitAdapter\PhpunitAdapterTestCase_5_0_0';
    }

    return null;
}

$baseClass = detectBaseClass();

if ($baseClass !== null) {
    // Runtime definition of the PhpunitAdapterTestCase class
    $classDefinition = <<< PHP
namespace Procurios\TDD\PhpunitAdapter;
class PhpunitAdapterTestCase extends \\$baseClass
{
}
PHP;

    eval($classDefinition);
}

if (!class_exists('Procurios\TDD\PhpunitAdapter\PhpunitAdapterTestCase', false)) {
    /**
     * Fall back on extending the most complete compatibility layer
     */
    class PhpunitAdapterTestCase extends PhpunitAdapterTestCase_4_8_0
    {
    }
}

Use the PHPUnit_Runner_Version class to determine the phpunit version


<?php
    class Intent {
        public $action;
        public $direction;

        public function __construct( $action, $direction ) {
            $this->action = $action;
            $this->direction = $direction;
        }
    }
?>

<?php
    define( 'DIRECTION_NONE', 0 );
    define( 'DIRECTION_NORTH', 1 );
    define( 'DIRECTION_EAST', 2 );
    define( 'DIRECTION_SOUTH', 3 );
    define( 'DIRECTION_WEST', 4 );
    define( 'ACTION_ATACK', 0 );
    define( 'ACTION_MOVE', 1 );
    class Intent {
        public $action;
        public $direction;

        public function __construct( $action, $direction ) {
            switch( $direction ) {
                case 'DIRECTION_NONE':
                    $this->direction = DIRECTION_NONE;
                    break;
                case 'DIRECTION_NORTH':
                    $this->direction = DIRECTION_NORTH;
                    break;
                case 'DIRECTION_EAST':
                    $this->direction = DIRECTION_EAST;
                    break;
                case 'DIRECTION_SOUTH':
                    $this->direction = DIRECTION_SOUTH;
                    break;
                case 'DIRECTION_WEST':
                    $this->direction = DIRECTION_SOUTH;
                    break;
                default:
                    $this->direction = NULL;
                    break;
            }

            switch( $action ) {
                case 'ACTION_ATACK':
                    $this->action = ACTION_ATACK;
                    break;
                case 'ACTION_MOVE':
                    $this->action = ACTION_MOVE;
                    break;
                default:
                    $this->action = NULL;
                    break;
            }
        }
    }
?>

Add defines so we don't have huge strings stored


<?php

namespace Dotenv\Store;

use Dotenv\Exception\InvalidPathException;
use Dotenv\Store\File\Reader;

class FileStore implements StoreInterface
{
    /**
     * The file paths.
     *
     * @var string[]
     */
    protected $filePaths;

    /**
     * Should file loading short circuit?
     *
     * @var bool
     */
    protected $shortCircuit;

    /**
     * Create a new file store instance.
     *
     * @param string[] $filePaths
     * @param bool     $shortCircuit
     *
     * @return void
     */
    public function __construct(array $filePaths, $shortCircuit)
    {
        $this->filePaths = $filePaths;
        $this->shortCircuit = $shortCircuit;
    }

    /**
     * Read the content of the environment file(s).
     *
     * @throws \Dotenv\Exception\InvalidPathException
     *
     * @return string
     */
    public function read()
    {
        if ($this->filePaths === []) {
            throw new InvalidPathException('At least one environment file path must be provided.');
        }

        $contents = Reader::read($this->filePaths, $this->shortCircuit);

        if ($contents) {
            return implode("\n", $contents);
        }

        throw new InvalidPathException(
            sprintf('Unable to read any of the environment file(s) at [%s].', implode(', ', $this->filePaths))
        );
    }
}

<?php

namespace Dotenv\Store;

use Dotenv\Exception\InvalidPathException;
use Dotenv\Store\File\Reader;

class FileStore implements StoreInterface
{
    /**
     * The file paths.
     *
     * @var string[]
     */
    protected $filePaths;

    /**
     * Should file loading short circuit?
     *
     * @var bool
     */
    protected $shortCircuit;

    /**
     * Create a new file store instance.
     *
     * @param string[] $filePaths
     * @param bool     $shortCircuit
     *
     * @return void
     */
    public function __construct(array $filePaths, $shortCircuit)
    {
        $this->filePaths = $filePaths;
        $this->shortCircuit = $shortCircuit;
    }

    /**
     * Read the content of the environment file(s).
     *
     * @throws \Dotenv\Exception\InvalidPathException
     *
     * @return string
     */
    public function read()
    {
        if ($this->filePaths === []) {
            throw new InvalidPathException('At least one environment file path must be provided.');
        }

        $contents = Reader::read($this->filePaths, $this->shortCircuit);

        if (count($contents) > 0) {
            return implode("\n", $contents);
        }

        throw new InvalidPathException(
            sprintf('Unable to read any of the environment file(s) at [%s].', implode(', ', $this->filePaths))
        );
    }
}

Use best practice for array emptiness check


<?php
/**
 * @version     $Id$
 * @category	Nooku
 * @package     Nooku_Server
 * @subpackage  Categories
 * @copyright   Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net).
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */
defined('KOOWA') or die( 'Restricted access' ); ?>

		<li class="<?= !is_numeric($state->published) ? 'active' : ''; ?> separator-right">
			<a href="<?= @route('&published=' ) ?>">
			    <?= @text('All') ?>

		<li class="<?= $state->published === true ? 'active' : ''; ?>">
			<a href="<?= @route($state->published === true ? 'published=' : 'published=1') ?>">
			    <?= @text('Published') ?>

		<li class="<?= $state->published === false ? 'active' : ''; ?>">
			<a href="<?= @route($state->published === false ? 'published=' : 'published=0' ) ?>">
			    <?= @text('Unpublished') ?>

<?php
/**
 * @version     $Id$
 * @category	Nooku
 * @package     Nooku_Server
 * @subpackage  Categories
 * @copyright   Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net).
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */
defined('KOOWA') or die( 'Restricted access' ); ?>

		<li class="<?= is_null($state->published) ? 'active' : ''; ?> separator-right">
			<a href="<?= @route('published=' ) ?>">
			    <?= @text('All') ?>

		<li class="<?= $state->published === true ? 'active' : ''; ?>">
			<a href="<?= @route($state->published === true ? 'published=' : 'published=1') ?>">
			    <?= @text('Published') ?>

		<li class="<?= $state->published === false ? 'active' : ''; ?>">
			<a href="<?= @route($state->published === false ? 'published=' : 'published=0' ) ?>">
			    <?= @text('Unpublished') ?>

Use is_null to check if a state isn't available.


<?php

/*
|--------------------------------------------------------------------------
| Login/ULS Routes
|--------------------------------------------------------------------------
|
*/

Route::middleware(['login'])->group(function() {
    Route::get('/', 'SSOController@getIndex');
    Route::get('/return', 'SSOController@getReturn');
});

Route::prefix("/uls")->middleware(['login'])->group(function () {
    Route::prefix("/v2")->group(function() {
       Route::get('login', 'ULSv2Controller@getLogin');
       Route::get('redirect', 'ULSv2Controller@getRedirect');
       Route::get('info', 'ULSv2Controller@getInfo');
    });
});

<?php

/*
|--------------------------------------------------------------------------
| Login/ULS Routes
|--------------------------------------------------------------------------
|
*/

Route::middleware(['login'])->group(function() {
    Route::get('/', 'SSOController@getIndex');
    Route::get('/return', 'SSOController@getReturn');
});

Route::prefix("/uls")->middleware(['login'])->group(function () {
    Route::prefix("/v2")->group(function() {
        Route::get('/', 'SSOController@getIndex');
        Route::get('/return', 'SSOController@getReturn');
        Route::get('/login', 'ULSv2Controller@getLogin');
        Route::get('/redirect', 'ULSv2Controller@getRedirect');
        Route::get('/info', 'ULSv2Controller@getInfo');
    });
});

Duplicate uls routes into versioned path


</div>
</div>

<!-- No Element, Can be --->

<script src="<?= skin_url(); ?>scripts/jquery.cookie.js" type="text/javascript"></script>
<script src="<?= skin_url(); ?>scripts/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="<?= skin_url(); ?>scripts/theme.js" type="text/javascript"></script>

</div>
</div>

<!-- No Element, Can be --->

<script src="<?= skin_url(); ?>scripts/jquery.cookie.js" type="text/javascript"></script>
<script src="<?= skin_url(); ?>scripts/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="<?= skin_url(); ?>scripts/bootbox.js" type="text/javascript"></script>
<script src="<?= skin_url(); ?>scripts/theme.js" type="text/javascript"></script>

Fix bootbox pop on remove

Fix bootbox pop on remove


<?php

namespace MssPhp\Schema\Response;

use JMS\Serializer\Annotation\Type;

class Channel {
    /**
     * @Type("string")
     */
    public $channel_id;

    /**
     * @Type("MssPhp\Schema\Response\OfferDescription")
     */
    public $offer_description;

    /**
     * @Type("MssPhp\Schema\Response\RoomPrices")
     */
    public $room_price;

    /**
     * @Type("MssPhp\Schema\Response\RoomDescription")
     */
    public $room_description;

    /**
     * @Type("MssPhp\Schema\Response\ServicePrice")
     */
    public $service_price;

    /**
     * @Type("integer")
     */
    public $from_price;

    /**
     * @Type("MssPhp\Schema\Response\BasePrice")
     */
    public $base_price;

    /**
     * @Type("MssPhp\Schema\Response\CancelPolicies")
     */
    public $cancel_policies;

    /**
     * @Type("MssPhp\Schema\Response\PaymentTerms")
     */
    public $payment_terms;
}

<?php

namespace MssPhp\Schema\Response;

use JMS\Serializer\Annotation\Type;

class Channel {
    /**
     * @Type("string")
     */
    public $channel_id;

    /**
     * @Type("integer")
     */
    public $offer_id;

    /**
     * @Type("MssPhp\Schema\Response\OfferDescription")
     */
    public $offer_description;

    /**
     * @Type("MssPhp\Schema\Response\RoomPrices")
     */
    public $room_price;

    /**
     * @Type("MssPhp\Schema\Response\RoomDescription")
     */
    public $room_description;

    /**
     * @Type("MssPhp\Schema\Response\ServicePrice")
     */
    public $service_price;

    /**
     * @Type("integer")
     */
    public $from_price;

    /**
     * @Type("MssPhp\Schema\Response\BasePrice")
     */
    public $base_price;

    /**
     * @Type("MssPhp\Schema\Response\CancelPolicies")
     */
    public $cancel_policies;

    /**
     * @Type("MssPhp\Schema\Response\PaymentTerms")
     */
    public $payment_terms;
}

Add offer_id to channel interface

Add offer_id to channel interface


<?php

namespace hipanel\actions;

use hiqdev\hiart\Collection;
use Yii;
use yii\base\Action;

class AddToCartAction extends Action
{
    public $productClass;

    public $bulkLoad = false;

    public function run()
    {
        $data = null;

        $collection = new Collection([
            'model' => new $this->productClass
        ]);
        $cart = Yii::$app->cart;
        $request = Yii::$app->request;
//        $data = $request->isPost ? $request->post() : $request->get();

        if (!$this->bulkLoad) {
            $data = [Yii::$app->request->post() ?: Yii::$app->request->get()];
        }

        if ($collection->load($data)) {
            foreach ($collection->models as $position) {
                if (!$cart->hasPosition($position->getId())) {
                    $cart->put($position);
                    Yii::$app->session->addFlash('success', Yii::t('app', 'Item is added to cart'));
                } else {
                    Yii::$app->session->addFlash('warning', Yii::t('app', 'Item already exists in the cart'));
                }
            }
        }

        if ($request->isAjax) {
            Yii::$app->end();
        } else {
            return $this->controller->redirect(Yii::$app->request->referrer);
        }
    }
}

<?php

namespace hipanel\actions;

use hiqdev\hiart\Collection;
use Yii;
use yii\base\Action;

class AddToCartAction extends Action
{
    public $productClass;

    public $bulkLoad = false;

    public function run()
    {
        $data = null;

        $collection = new Collection([
            'model' => new $this->productClass
        ]);
        $cart = Yii::$app->cart;
        $request = Yii::$app->request;
//        $data = $request->isPost ? $request->post() : $request->get();

        if (!$this->bulkLoad) {
            $data = [Yii::$app->request->post() ?: Yii::$app->request->get()];
        }

        if ($collection->load($data) && $collection->validate()) {
            foreach ($collection->models as $position) {
                if (!$cart->hasPosition($position->getId())) {
                    $cart->put($position);
                    Yii::$app->session->addFlash('success', Yii::t('app', 'Item is added to cart'));
                } else {
                    Yii::$app->session->addFlash('warning', Yii::t('app', 'Item already exists in the cart'));
                }
            }
        } else {
            Yii::$app->session->addFlash('warning', Yii::t('app', 'Item does not exists'));
        }

        if ($request->isAjax) {
            Yii::$app->end();
        } else {
            return $this->controller->redirect(Yii::$app->request->referrer);
        }
    }
}

Add validation before Add To Cart

Add validation before Add To Cart


<?php

class FacebookUser extends RedisModel {

  public static $_keyPrefix = 'user';

  public $name;
  public $perms;

  public function afterConstruct() {
    if (isset(Yii::app()->params->appUserClass)) {
      $userClass = Yii::app()->params->appUserClass;
      $this->attachBehavior("appUserClass", $userClass);
    }
  }
}

<?php

class FacebookUser extends RedisModel {

  public static $_keyPrefix = 'user';

  public $name;
  public $perms;
  public $popeName;

  public function afterConstruct() {
    if (isset(Yii::app()->params->appUserClass)) {
      $userClass = Yii::app()->params->appUserClass;
      $this->attachBehavior("appUserClass", $userClass);
    }
  }
}

Add popeName property for storing the popeName of a user


<?php
/**
 * Copyright (C) 2019 Xibo Signage Ltd
 *
 * Xibo - Digital Signage - http://www.xibo.org.uk
 *
 * This file is part of Xibo.
 *
 * Xibo is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * Xibo is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with Xibo.  If not, see <http://www.gnu.org/licenses/>.
 */

use Phinx\Migration\AbstractMigration;

/**
 * Class AddNotificationAttachmentFilenameNonUsersMigration
 */

class AddNotificationAttachmentFilenameNonUsersMigration extends AbstractMigration
{
    /** @inheritdoc */
    public function change()
    {
        $table = $this->table('notification');
        $table
            ->addColumn('filename', 'string', ['limit' => 1000, 'null' => true])
            ->addColumn('nonusers', 'string', ['limit' => 1000, 'null' => true])
            ->save();
    }
}

Fix empty first line in migration

Fix empty first line in migration