<?php
require_once dirname( __DIR__ ) .'/barovians.php';
$barovians = new Barovians();
$title = 'Names for all you meet in Barovia';
include dirname( __DIR__ ) . '/html/top.php';
echo str_replace('!', '', $barovians->generate('male') );
echo str_replace('!', '', $barovians->generate('female') );
include dirname( __DIR__ ) . '/html/bottom.php';

<?php
require_once dirname( __DIR__ ) .'/barovians.php';
$barovians = new Barovians();
$title = 'Names for all you meet in Barovia';
include dirname( __DIR__ ) . '/html/top.php';
echo $barovians->generate('male');
echo $barovians->generate('female');
include dirname( __DIR__ ) . '/html/bottom.php';

Revert "removed ! on barovian page"

Revert "removed ! on barovian page"

This reverts commit 241362cfd9c42b348014728379dcfed60f549570.


<?php

use mcordingley\Regression\RegressionAlgorithm\LinearLeastSquares;

class LinearLeastSquaresTest extends PHPUnit_Framework_TestCase
{

    protected $strategy;

    public function __construct($name = null, array $data = array(), $dataName = '')
    {
        parent::__construct($name, $data, $dataName);

        $this->strategy = new LinearLeastSquares;
    }

    public function testFatMatrix()
    {
        // TODO
    }

    public function testSkinnyMatrix()
    {
        $coefficients = $this->strategy->regress([1, 2, 3, 4, 5], [
            [1, 1],
            [1, 2],
            [1, 1.3],
            [1, 3.75],
            [1, 2.25],
        ]);

        $this->assertEquals(1.095497063, round($coefficients[0], 9));
        $this->assertEquals(0.924515989, round($coefficients[1], 9));
    }

    public function testSquareMatrix()
    {
        $coefficients = $this->strategy->regress([2, 4, 6, 8, 10], [
            [1, 3, 5, 7, 2],
            [1, 3, 2, 1, 5],
            [1, 1, 2, 3, 4],
            [1, 1, 3, 4, 7],
            [1, 19, 17, 15, 14],
        ]);

        $this->assertEquals(-2.667, round($coefficients[0], 3));
        $this->assertEquals(3.333, round($coefficients[1], 3));
        $this->assertEquals(-9.333, round($coefficients[2], 3));
        $this->assertEquals(5.333, round($coefficients[3], 3));
        $this->assertEquals(2, round($coefficients[4], 3));
    }
}

<?php

use mcordingley\Regression\RegressionAlgorithm\LinearLeastSquares;

class LinearLeastSquaresTest extends PHPUnit_Framework_TestCase
{

    protected $strategy;

    public function __construct($name = null, array $data = array(), $dataName = '')
    {
        parent::__construct($name, $data, $dataName);

        $this->strategy = new LinearLeastSquares;
    }

    public function testRegress()
    {
        $coefficients = $this->strategy->regress([1, 2, 3, 4, 5], [
            [1, 1],
            [1, 2],
            [1, 1.3],
            [1, 3.75],
            [1, 2.25],
        ]);

        $this->assertEquals(1.095497063, round($coefficients[0], 9));
        $this->assertEquals(0.924515989, round($coefficients[1], 9));
    }
}

Remove tests that targeted removed code paths in LinearLeastSquares.


<?php

/**
 * Filter that can be added to an object
 *
 * @author i-lateral (http://www.i-lateral.com)
 * @package Filterable
 */
class FilterOption extends DataObject {

    private static $db = array(
        'Title'         => 'Varchar',
        'Sort'          => 'Int'
    );

    private static $has_one = array(
        "Parent" => "FilterGroup"
    );

    private static $searchable_fields = array(
      'Title'       => array('title' => 'Title'),
      'Parent.Title'=> array('title' => 'Filter')
    );

    private static $summary_fields = array(
        'Title'         => 'Title',
        'Parent.Title'  => 'Filter'
    );

    private static $default_sort = "\"Sort\" DESC";

    public function canView($member = false) {
        return $this->Parent()->canView($member);
    }

    public function canCreate($member = false) {
        return $this->Parent()->canCreate($member);
    }

    public function canEdit($member = false) {
        return $this->Parent()->canEdit($member);
    }

    public function canDelete($member = false) {
        return $this->Parent()->canDelete($member);
    }

}

<?php

/**
 * Filter that can be added to an object
 *
 * @author i-lateral (http://www.i-lateral.com)
 * @package Filterable
 */
class FilterOption extends DataObject {

    private static $db = array(
        'Title'         => 'Varchar',
        'Sort'          => 'Int'
    );

    private static $has_one = array(
        "Parent" => "FilterGroup"
    );

    private static $searchable_fields = array(
      'Title'       => array('title' => 'Title'),
      'Parent.Title'=> array('title' => 'Filter')
    );

    private static $summary_fields = array(
        'Title'         => 'Title',
        'ParentFilter'  => 'Filter'
    );

    private static $default_sort = "\"Sort\" DESC";

    /**
     * return the title of the parent filter
     *
     * @return string
     */
    public function getParentFilter() {
        return $this->Parent()->Title;
    }

    public function canView($member = false) {
        return $this->Parent()->canView($member);
    }

    public function canCreate($member = false) {
        return $this->Parent()->canCreate($member);
    }

    public function canEdit($member = false) {
        return $this->Parent()->canEdit($member);
    }

    public function canDelete($member = false) {
        return $this->Parent()->canDelete($member);
    }

}

Fix issue with summary fields when used with gridfield editable columns


<?php
class Vpc_Directories_Item_Directory_Trl_Controller extends Vps_Controller_Action_Auto_Vpc_Grid
{
    protected $_buttons = array(
        'save',
        'reload',
    );

    protected $_editDialog = array(
        'width' =>  500,
        'height' =>  400
    );

    protected $_paging = 25;

    public function preDispatch()
    {
        $this->setModel(new Vpc_Directories_Item_Directory_Trl_AdminModel(array(
            'proxyModel' => Vpc_Abstract::createChildModel(
                Vpc_Abstract::getSetting($this->_getParam('class'), 'masterComponentClass')
            ),
            'trlModel' => Vpc_Abstract::createChildModel($this->_getParam('class')),
        )));
        parent::preDispatch();
        $url = Vpc_Admin::getInstance($this->_getParam('class'))->getControllerUrl('Form');
        $this->_editDialog['controllerUrl'] = $url;
    }

    protected function _initColumns()
    {
        parent::_initColumns();
        $this->_columns->add(new Vps_Grid_Column('id'));
    }

    protected function _getRowById($id)
    {
        if (!$id) return null;
        $s = new Vps_Model_Select();
        $s->whereEquals($this->_model->getPrimaryKey(), $id);
        $s->whereEquals('component_id', $this->_getParam('componentId'));
        return $this->_model->getRow($s);
    }
}

<?php
class Vpc_Directories_Item_Directory_Trl_Controller extends Vps_Controller_Action_Auto_Vpc_Grid
{
    protected $_buttons = array(
        'save',
        'reload',
    );

    protected $_editDialog = array(
        'width' =>  500,
        'height' =>  400
    );
    protected $_hasComponentId = false; //component_id nicht speichern

    protected $_paging = 25;

    public function preDispatch()
    {
        $this->setModel(new Vpc_Directories_Item_Directory_Trl_AdminModel(array(
            'proxyModel' => Vpc_Abstract::createChildModel(
                Vpc_Abstract::getSetting($this->_getParam('class'), 'masterComponentClass')
            ),
            'trlModel' => Vpc_Abstract::createChildModel($this->_getParam('class')),
        )));
        parent::preDispatch();
        $url = Vpc_Admin::getInstance($this->_getParam('class'))->getControllerUrl('Form');
        $this->_editDialog['controllerUrl'] = $url;
    }

    protected function _initColumns()
    {
        parent::_initColumns();
        $this->_columns->add(new Vps_Grid_Column('id'));
    }

    protected function _getSelect()
    {
        $ret = parent::_getSelect();
        $ret->whereEquals('component_id', $this->_getParam('componentId'));
        return $ret;
    }

    protected function _getRowById($id)
    {
        if (!$id) return null;
        $s = new Vps_Model_Select();
        $s->whereEquals($this->_model->getPrimaryKey(), $id);
        $s->whereEquals('component_id', $this->_getParam('componentId'));
        return $this->_model->getRow($s);
    }
}

Fix trl controller fuer directories

Fix trl controller fuer directories


<?php

namespace Datatype\Traits;

trait MethodMapperTrait
{
	abstract protected static function _function_prefix();

	abstract protected function &_get_object_data();

	public function __call( $method, $args )
	{
		$prefix = static::_function_prefix();
		$function = $prefix . $method;

		//! is_array( $args ) && $args = [$args];

		if ( function_exists( $function ) )
		{
			$data = $this->_get_object_data();
			$args = array_merge( [&$data], $args );

			return call_user_func_array( $function, $args );
		}
		else
		{
			$trace = debug_backtrace();
			trigger_error(
				'Call to undefined function ' . $function .
				' in ' . $trace[0]['file'] .
				' on line ' . $trace[0]['line'],
				E_USER_ERROR );

			return null;
		}
	}
}

<?php

namespace Datatype\Traits;

trait MethodMapperTrait
{
	abstract protected static function _function_prefix();

	abstract protected function &_get_object_data();

	public function __call( $method, $args )
	{
		$prefix = static::_function_prefix();
		$function = $prefix . $method;

		if ( function_exists( $function ) )
		{
			$data = $this->_get_object_data();
			$args = array_merge( [&$data], $args );

			return call_user_func_array( $function, $args );
		}
		else
		{
			$trace = debug_backtrace();
			trigger_error(
				'Call to undefined function ' . $function .
				' in ' . $trace[0]['file'] .
				' on line ' . $trace[0]['line'],
				E_USER_ERROR );

			return null;
		}
	}
}

Remove unnecessary piece of commented out code

[ci skip]


<?php

use ChannelEngineApiClient\Models\BaseModel;

namespace ChannelEngineApiClient\Models {

	class Message extends BaseModel {

		public static $typeMap = array(

		);

		protected $message;

		function setMessage($message) { $this->message = $message; }
		function getMessage() { return $this->message; }
	}
}

<?php

use ChannelEngineApiClient\Models\BaseModel;

namespace ChannelEngineApiClient\Models {

	class Message extends BaseModel {

		public static $typeMap = array(

		);

		protected $message;
		protected $modelState;

		function setMessage($message) { $this->message = $message; }
		function getMessage() { return $this->message; }

		function setModelState($modelState) { $this->modelState = $modelState; }
		function getModelState() { return $this->modelState; }
	}
}

Add a modelstate field to API error messages


<?php

namespace App\Controllers;
use App\File;
use App\RegExp;

class MuffinRatingController extends Controller {
	protected static $auth = false;

	public function image(){
		$ScorePercent = 100;
		if (isset($_GET['w']) && is_numeric($_GET['w']))
			$ScorePercent = max(min(\intval($_GET['w'], 10), 0), 100);
		$RatingFile = File::get(APPATH.'img/muffin-rating.svg');
		header('Content-Type: image/svg+xml');
		echo str_replace("width='100'", "width='$ScorePercent'", $RatingFile);
		exit;
	}
}

<?php

namespace App\Controllers;
use App\File;
use App\RegExp;

class MuffinRatingController extends Controller {
	protected static $auth = false;

	public function image(){
		$ScorePercent = 100;
		if (isset($_GET['w']) && is_numeric($_GET['w']))
			$ScorePercent = min(max(\intval($_GET['w'], 10), 0), 100);
		$RatingFile = File::get(APPATH.'img/muffin-rating.svg');
		header('Content-Type: image/svg+xml');
		echo str_replace("width='100'", "width='$ScorePercent'", $RatingFile);
		exit;
	}
}

Fix muffin rating always showing 5 muffins


				Gilles Henrard
				<button class="navbar-toggler navbar-toggler-right" type="button"
					data-toggle="collapse" data-target="#navbarResponsive"
					aria-controls="navbarResponsive" aria-expanded="false"
					aria-label="Toggle navigation">

				</button>

Home

About

Skills

Experience

Contact

				Gilles Henrard beta
				<button class="navbar-toggler navbar-toggler-right" type="button"
					data-toggle="collapse" data-target="#navbarResponsive"
					aria-controls="navbarResponsive" aria-expanded="false"
					aria-label="Toggle navigation">

				</button>

Home

About

Skills

Experience

Contact

Add 'beta' statement in brand

Add 'beta' statement in brand


<?php
set_time_limit(0);

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

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

// Debugging Functions
include 'functions/debug.php';

echo "LinMon slave version ".getVersion("version")." started \n\n";
echo checkVersion();
debug_collectionInterval($config['debug'], $config['updateinterval']);

while (true){
	debug_collectionInfoStart($config['debug']);
    debug_collectionInfoEnd($debug['debug']);
	sleep($config['updateinterval']);
}
?>

<?php
set_time_limit(0);

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

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

// Debugging Functions
include 'functions/debug.php';

echo "LinMon slave version ".getVersion("version")." started \n\n";
echo checkVersion();
debug_collectionInterval($config['debug'], $config['updateinterval']);

while (true){
	debug_collectionInfoStart($config['debug']);
    debug_collectionInfoEnd($config['debug']);
	sleep($config['updateinterval']);
}
?>

Fix wrong array being called

Fix wrong array being called


<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use App\Http\Controllers\Controller;

class NewsCategoryController extends Controller
{
    public function index()
    {
        $newscategories = \App\NewsCategory::All();
        return view('admin/newscategory/index')->with('newscategories', $newscategories);
    }

    public function create()
    {
        $newscategory_cr = \App\NewsCategory::pluck('name', 'id');
        return view('admin/newscategory/create')->with('newscategory_cr', $newscategory_cr);
    }

    public function edit($id)
    {
        $newscategory = \App\NewsCategory::find($id);
        return view('admin/newscategory/create')->with('newscategory', $newscategory);
    }

    public function update($id)
    {
        $newscategory = \App\NewsCategory::find($id);
        $newscategory->update(Input::all());
        return redirect('/admin/newscategory')
        ->withSuccess('Cat has been updated.');
    }

    public function post()
    {
        \App\NewsCategory::create(Input::all());
        return redirect('/admin/newscategory')->withSuccess('Cat has been created.');
    }

    public function delete($id)
    {
        $newcategory = \App\NewsCategory::find($id);
        $newcategory->delete();
        return redirect('/admin/newscategory')
        ->withSuccess('News Category has been deleted.');
    }
}

<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Support\Facades\Input;
use App\Http\Controllers\Controller;

class NewsCategoryController extends Controller
{
    public function index()
    {
        $newscategories = \App\NewsCategory::All();
        return view('admin/newscategory/index')->with('newscategories', $newscategories);
    }

    public function create()
    {
        $newscategory_cr = \App\NewsCategory::pluck('name', 'id');
        return view('admin/newscategory/create')->with('newscategory_cr', $newscategory_cr);
    }

    public function edit($)
    {
        $newscategory = \App\NewsCategory::find($id);
        return view('admin/newscategory/create')->with('newscategory', $newscategory);
    }

    public function update()
    {
        $newscategory = \App\NewsCategory::find($id);
        $newscategory->update(Input::all());
        return redirect('/admin/newscategory')
        ->withSuccess('Cat has been updated.');
    }

    public function post()
    {
        \App\NewsCategory::create(Input::all());
        return redirect('/admin/newscategory')->withSuccess('Cat has been created.');
    }

    public function delete()
    {
        $newcategory = \App\NewsCategory::find($id);
        $newcategory->delete();
        return redirect('/admin/newscategory')
        ->withSuccess('News Category has been deleted.');
    }
}

Fix feate manage news category

Fix feate manage news category


<?php

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

namespace Sylius\Component\Payment\Resolver;

use Sylius\Component\Payment\Model\PaymentInterface;
use Sylius\Component\Registry\PrioritizedServiceRegistryInterface;

/**
 * @author Anna Walasek <anna.walasek@lakion.com>
 */
class CompositeMethodsResolver implements MethodsResolverInterface
{
    /**
     * @var PrioritizedServiceRegistryInterface
     */
    private $resolversRegistry;

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

    /**
     * {@inheritdoc}
     */
    public function getSupportedMethods(PaymentInterface $payment)
    {
        foreach ($this->resolversRegistry->all() as $resolver) {
            if ($resolver->supports($payment)) {
                return $resolver->getSupportedMethods($payment);
            }
        }

        return [];
    }

    /**
     * {@inheritdoc}
     */
    public function supports(PaymentInterface $payment)
    {
        foreach ($this->resolversRegistry->all() as $resolver) {
            if ($resolver->supports($payment)) {

                return true;
            }
        }

        return false;
    }
}

<?php

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

namespace Sylius\Component\Payment\Resolver;

use Sylius\Component\Payment\Model\PaymentInterface;
use Sylius\Component\Registry\PrioritizedServiceRegistryInterface;

/**
 * @author Anna Walasek <anna.walasek@lakion.com>
 */
class CompositeMethodsResolver implements MethodsResolverInterface
{
    /**
     * @var PrioritizedServiceRegistryInterface
     */
    private $resolversRegistry;

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

    /**
     * {@inheritdoc}
     */
    public function getSupportedMethods(PaymentInterface $payment)
    {
        /** @var MethodsResolverInterface $resolver */
        foreach ($this->resolversRegistry->all() as $resolver) {
            if ($resolver->supports($payment)) {
                return $resolver->getSupportedMethods($payment);
            }
        }

        return [];
    }

    /**
     * {@inheritdoc}
     */
    public function supports(PaymentInterface $payment)
    {
        /** @var MethodsResolverInterface $resolver */
        foreach ($this->resolversRegistry->all() as $resolver) {
            if ($resolver->supports($payment)) {
                return true;
            }
        }

        return false;
    }
}

Add typehints for ServiceRegistryInterface::all() calls


<?php

namespace App;

use Cviebrock\EloquentSluggable\SluggableInterface;
use Cviebrock\EloquentSluggable\SluggableTrait;
use Illuminate\Database\Eloquent\Model;

class News extends Model implements SluggableInterface
{
    use SluggableTrait;

    protected $sluggable = [
        'build_from' => 'title',
        'save_to'    => 'slug',
    ];

    protected $fillable = [
        'title',
        'body',
        'published',
    ];

    public function getTagsAttribute()
    {
        foreach ($this->tags()->get()->toArray() as $key => $value) {
            $array[$key] = $value['name'];
        }
        $tags = implode(',',$array);

        return $tags;
    }

    /**
     * Reltionship between news and tags
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function tags()
    {
        return $this->belongsToMany('App\Tag', 'news_tag', 'news_id', 'tag_id');
    }

    /**
     * A news has many pictures
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function pictures()
    {
        return $this->hasMany('App\Picture');
    }
}

<?php

namespace App;

use Cviebrock\EloquentSluggable\SluggableInterface;
use Cviebrock\EloquentSluggable\SluggableTrait;
use Illuminate\Database\Eloquent\Model;

class News extends Model implements SluggableInterface
{
    use SluggableTrait;

    protected $sluggable = [
        'build_from' => 'title',
        'save_to'    => 'slug',
    ];

    protected $fillable = [
        'title',
        'body',
        'published',
    ];

    public function getTagsAttribute()
    {

        if($this->tags()->get()->toArray() != []){
            foreach ($this->tags()->get()->toArray() as $key => $value) {
                $array[$key] = $value['name'];
            }

            $tags = implode(',',$array);
        }else{
            $tags = '';
        }

        return $tags;
    }

    /**
     * Reltionship between news and tags
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function tags()
    {
        return $this->belongsToMany('App\Tag', 'news_tag', 'news_id', 'tag_id');
    }

    /**
     * A news has many pictures
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function pictures()
    {
        return $this->hasMany('App\Picture');
    }
}

Validate tags() for prevent error when tags() is empty


<?php

/**
 * @file
 * Filter that enable the use patterns to create visual content more easy.
 * Drupal\visual_content_layout\Plugin\Filter\FilterVisualContent.
 *
 */

namespace Drupal\visual_content_layout\Plugin\Filter;

use Drupal\filter\FilterProcessResult;
use Drupal\filter\Plugin\FilterBase;

/**
 * Provides a filter to use shortdoces.
 *.
 *
 * @Filter(
 *   id = "filter_visualcontentlayout",
 *   title = @Translation("Visual Content Layout"),
 *   description = @Translation("Provides a ShortCode filter format to easily generate content layout."),
 *   type = Drupal\filter\Plugin\FilterInterface::TYPE_TRANSFORM_REVERSIBLE
 * )
 */
class FilterVisualContentLayout extends FilterBase{

  /**
   * {@inheritdoc}
   */
  public function process($text, $langcode) {
    return new FilterProcessResult(_filter_visual_layout_content($text, $this));
  }

  /**
   * {@inheritdoc}
   */
  public function tips($long = FALSE) {

  }

}

<?php

/**
 * @file
 * Filter that enable the use patterns to create visual content more easy.
 * Drupal\visual_content_layout\Plugin\Filter\FilterVisualContent.
 *
 */

namespace Drupal\visual_content_layout\Plugin\Filter;

use Drupal\filter\FilterProcessResult;
use Drupal\filter\Plugin\FilterBase;

/**
 * Provides a filter to use shortdoces.
 *.
 *
 * @Filter(
 *   id = "filter_visualcontentlayout",
 *   title = @Translation("Visual Content Layout"),
 *   description = @Translation("Provides a ShortCode filter format to easily generate content layout."),
 *   type = Drupal\filter\Plugin\FilterInterface::TYPE_TRANSFORM_REVERSIBLE,
 *   settings = {
 *     "allowed_shortcodes" = "[box]"
 *   }
 * )
 */
class FilterVisualContentLayout extends FilterBase{

  /**
   * {@inheritdoc}
   */
  public function process($text, $langcode) {
    return new FilterProcessResult(_filter_visual_layout_content($text, $this));
  }

  /**
   * {@inheritdoc}
   */
  public function tips($long = FALSE) {

  }

}

Create a pattern to replace with the shortcodes.


<?php

namespace Bolt\Extension;

use Pimple as Container;

/**
 * Storage helpers.
 *
 * @author Gawain Lynch <gawain.lynch@gmail.com>
 */
trait StorageTrait
{
    /**
     * Return a list of entities to map to repositories.
     *
     * <pre>
     *  return [
     *      'alias' => [\Entity\Class\Name => \Repository\Class\Name],
     *  ];
     * </pre>
     *
     * @return array
     */
    protected function registerRepositoryMappings()
    {
        return [];
    }

    /**
     * Call this in register method.
     *
     * @internal
     */
    final protected function extendRepositoryMapping()
    {
        $app = $this->getContainer();
        foreach ($this->registerRepositoryMappings() as $alias => $map) {
            $app['storage.repositories'] += $map;
            $app['storage.metadata']->setDefaultAlias($app['schema.prefix'] . $alias, key($map));
            $app['storage']->setRepository(key($map), current($map));
        }
    }

    /** @return Container */
    abstract protected function getContainer();
}

<?php

namespace Bolt\Extension;

use Pimple as Container;

/**
 * Storage helpers.
 *
 * @author Gawain Lynch <gawain.lynch@gmail.com>
 */
trait StorageTrait
{
    /**
     * Return a list of entities to map to repositories.
     *
     * <pre>
     *  return [
     *      'alias' => [\Entity\Class\Name => \Repository\Class\Name],
     *  ];
     * </pre>
     *
     * @return array
     */
    protected function registerRepositoryMappings()
    {
        return [];
    }

    /**
     * Call this in register method.
     *
     * @internal
     */
    final protected function extendRepositoryMapping()
    {
        $app = $this->getContainer();
        foreach ($this->registerRepositoryMappings() as $alias => $map) {
            $app['storage.repositories'] += $map;

            $app['storage.metadata'] = $app->share(
                $app->extend(
                    'storage.metadata',
                    function ($storageMetadata) use ($app, $alias, $map) {
                        $storageMetadata->setDefaultAlias($app['schema.prefix'] . $alias, key($map));

                        return $storageMetadata;
                    }
                )
            );

            $app['storage'] = $app->share(
                $app->extend(
                    'storage',
                    function ($entityManager) use ($app, $alias, $map) {
                        $entityManager->setRepository(key($map), current($map));

                        return $entityManager;
                    }
                )
            );
        }
    }

    /** @return Container */
    abstract protected function getContainer();
}

Extend services… and actually return the service


<?php
$Gcm__ = array(
	'GatewayApiController'=>'controllers/GatewayApiController.php',
	'ManagementApiController'=>'controllers/ManagementApiController.php',
	'SpringApiController'=>'controllers/SpringApiController.php',
	'CoreHandler'=>'handlers/CoreHandler.php',
	'GatewayHandler'=>'handlers/GatewayHandler.php',
	'ModuleHandler'=>'handlers/ModuleHandler.php',
	'ProtocolHandler'=>'handlers/ProtocolHandler.php',
	'RequestHandler'=>'handlers/RequestHandler.php',
	'SemanticVersion'=>'handlers/SemanticVersion.php',
	'VersionHandler'=>'handlers/VersionHandler.php',
	'ICoreHandler'=>'interfaces/ICoreHandler.php',
	'IModuleHandler'=>'interfaces/IModuleHandler.php',
	'ISystemUpdateDb'=>'interfaces/ISystemUpdateDb.php',
	'IVersionHandler'=>'interfaces/IVersionHandler.php',
	'NetspaceKvs'=>'models/NetspaceKvs.php',
	'Resolution'=>'models/Resolution.php',
	'SystemUpdateKvs'=>'models/SystemUpdateKvs.php',
	'UpdateCheck'=>'updater/UpdateCheck.php',
	'UpdateRunner'=>'updater/UpdateRunner.php',
);
spl_autoload_register(function ($class) {
	global $Gcm__;
	if(!isset($Gcm__[$class])) return;
	include __DIR__.'/system/' . $Gcm__[$class];
});

<?php
$Gcm__ = array(
	'GatewayApiController'=>'controllers/GatewayApiController.php',
	'ManagementApiController'=>'controllers/ManagementApiController.php',
	'SpringApiController'=>'controllers/SpringApiController.php',
	'CoreHandler'=>'handlers/CoreHandler.php',
	'GatewayHandler'=>'handlers/GatewayHandler.php',
	'ModuleHandler'=>'handlers/ModuleHandler.php',
	'PackageHandler'=>'handlers/PackageHandler.php',
	'ProtocolHandler'=>'handlers/ProtocolHandler.php',
	'RequestHandler'=>'handlers/RequestHandler.php',
	'SemanticVersion'=>'handlers/SemanticVersion.php',
	'VersionHandler'=>'handlers/VersionHandler.php',
	'ICoreHandler'=>'interfaces/ICoreHandler.php',
	'IModuleHandler'=>'interfaces/IModuleHandler.php',
	'IPackageHandler'=>'interfaces/IPackageHandler.php',
	'ISystemUpdateDb'=>'interfaces/ISystemUpdateDb.php',
	'IVersionHandler'=>'interfaces/IVersionHandler.php',
	'NetspaceKvs'=>'models/NetspaceKvs.php',
	'Resolution'=>'models/Resolution.php',
	'SystemUpdateKvs'=>'models/SystemUpdateKvs.php',
	'UpdateCheck'=>'updater/UpdateCheck.php',
	'UpdateRunner'=>'updater/UpdateRunner.php',
);
spl_autoload_register(function ($class) {
	global $Gcm__;
	if(!isset($Gcm__[$class])) return;
	include __DIR__.'/system/' . $Gcm__[$class];
});

Add package handler to class map

general: Add package handler to class map


<?php

/**
 * GridField config necessary for managing a SiteTree object.
 *
 * @package silverstripe
 * @subpackage blog
 *
 * @author Michael Strong <github@michaelstrong.co.uk>
**/
class GridFieldConfig_BlogPost extends GridFieldConfig {

	public function __construct($itemsPerPage = null) {
		parent::__construct($itemsPerPage);
		$this->addComponent(new GridFieldButtonRow('before'));
		$this->addComponent(new GridFieldSiteTreeAddNewButton('buttons-before-left'));
		$this->addComponent(new GridFieldToolbarHeader());
		$this->addComponent(new GridFieldSortableHeader());
		$this->addComponent(new GridFieldFilterHeader());
		$this->addComponent(new GridFieldDataColumns());
		$this->addComponent(new GridFieldSiteTreeEditButton());
		$this->addComponent(new GridFieldPageCount('toolbar-header-right'));
		$this->addComponent($pagination = new GridFieldPaginator($itemsPerPage));
		$this->addComponent(new GridFieldBlogPostState());

		$pagination->setThrowExceptionOnBadDataType(true);
	}
}

<?php

/**
 * GridField config necessary for managing a SiteTree object.
 *
 * @package silverstripe
 * @subpackage blog
 *
 * @author Michael Strong <github@michaelstrong.co.uk>
**/
class GridFieldConfig_BlogPost extends GridFieldConfig_Lumberjack {

	public function __construct($itemsPerPage = null) {
		parent::__construct($itemsPerPage);
		$this->removeComponentsByType('SiteTreeEditButton');
		$this->addComponent(new GridFieldSiteTreeEditButton());
	}
}

FIX GridField state was being removed when the config was removed


<?php

include '../../passwd/analytics-key.inc.php';

// Override any of the default settings below:

$config['site_title'] = 'schmitt.co';                 // Site title
$config['theme'] = 'pico-pure';                       // Set the theme (defaults to "default")
$config['pages_order_by'] = 'date ';                  // Order pages by "alpha" or "date"
$config['pages_order'] = 'desc';                      // Order pages "asc" or "desc"

// adv-meta
$config['adv_meta_values'] = array('description' => 'Description');

// Google Analytics
$config['google_tracking_id'] = $ANALYTICS_TRACKING_ID;

/*
$config['base_url'] = '';                             // Override base URL (e.g. http://example.com)
$config['date_format'] = 'jS M Y';                    // Set the PHP date format
$config['twig_config'] = array(                       // Twig settings
        'cache' => false,                             // To enable Twig caching change this to CACHE_DIR
        'autoescape' => false,                        // Autoescape Twig vars
        'debug' => false                              // Enable Twig debug
);
$config['excerpt_length'] = 50;                       // The pages excerpt length (in words)

// To add a custom config setting:

$config['custom_setting'] = 'Hello';                  // Can be accessed by {{ config.custom_setting }} in a theme

*/

?>

<?php

include '../../passwd/analytics-key.inc.php';

// Override any of the default settings below:

$config['site_title'] = 'schmitt.co';                 // Site title
$config['theme'] = 'pico-pure';                       // Set the theme (defaults to "default")
$config['pages_order_by'] = 'date ';                  // Order pages by "alpha" or "date"
$config['pages_order'] = 'desc';                      // Order pages "asc" or "desc"

// adv-meta
$config['custom_meta_values'] = array('description' => 'Description',
                                      'exclude'     => 'Exclude',
                                      //'tags'        => 'Tags'
                                     );

// Google Analytics
$config['google_tracking_id'] = $ANALYTICS_TRACKING_ID;

/*
$config['base_url'] = '';                             // Override base URL (e.g. http://example.com)
$config['date_format'] = 'jS M Y';                    // Set the PHP date format
$config['twig_config'] = array(                       // Twig settings
        'cache' => false,                             // To enable Twig caching change this to CACHE_DIR
        'autoescape' => false,                        // Autoescape Twig vars
        'debug' => true                               // Enable Twig debug
);
$config['excerpt_length'] = 50;                       // The pages excerpt length (in words)

// To add a custom config setting:

$config['custom_setting'] = 'Hello';                  // Can be accessed by {{ config.custom_setting }} in a theme

*/

?>

Fix adv-meta custum values ignored

Fix adv-meta custum values ignored


<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>An error occurred</title>

        <?php
        "../login.php";
        echo "
$error
";
        ?>

DELETE FORGOTEN INLINE STYLE USED DURING DEBUG MODE


<?php
include_once($_SERVER['DOCUMENT_ROOT'] . '/templates/header.php');
?>

News

            <?php
            foreach ($posts as $post) {
                getPost($post);
            } ?>

    <button class="toggle-action-button facebook" value="facebook"></button>
    <button class="toggle-action-button twitter" value="twitter"></button>
    <button class="toggle-action-button instagram" value="instagram"></button>
    <button class="toggle-action-button google" value="google"></button>

<?php
include_once($_SERVER['DOCUMENT_ROOT'] . '/templates/footer.php');

Implement simple-gui-tempalte on News view


<?php

use Tomahawk\HttpKernel\Kernel;

class AppKernel extends Kernel
{

    public function registerBundles()
    {
        $bundles = array(
            new \Tomahawk\Bundle\FrameworkBundle\FrameworkBundle(),
            new \Tomahawk\Bundle\GeneratorBundle\GeneratorBundle(),
            new \Acme\AcmeBundle()
        );

        if ($this->getEnvironment() === 'dev') {
            $bundles[] = new \Tomahawk\Bundle\WebProfilerBundle\WebProfilerBundle();
        }

        return $bundles;
    }

    public function registerMiddleware()
    {
        return array(
            new \Tomahawk\HttpCore\Middleware\Response(),
            new \Tomahawk\Session\Middleware\Session()
        );
    }
}

<?php

use Tomahawk\HttpKernel\Kernel;

class AppKernel extends Kernel
{

    public function registerBundles()
    {
        $bundles = array(
            new \Tomahawk\Bundle\FrameworkBundle\FrameworkBundle(),
            new \Tomahawk\Bundle\GeneratorBundle\GeneratorBundle(),
            new \Tomahawk\Bundle\MigrationsBundle\MigrationsBundle(),
            new \Acme\AcmeBundle()
        );

        if ($this->getEnvironment() === 'dev') {
            $bundles[] = new \Tomahawk\Bundle\WebProfilerBundle\WebProfilerBundle();
        }

        return $bundles;
    }

    public function registerMiddleware()
    {
        return array(
            new \Tomahawk\HttpCore\Middleware\Response(),
            new \Tomahawk\Session\Middleware\Session()
        );
    }
}

Add migrations bundle to kernel

Add migrations bundle to kernel


<?php

namespace App\Http\Middleware;

use Closure;

class GuestAuth extends Authenticate
{

    /**
     * Check if the user is logged in OR has the public_id of the project stored in a cookie
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if($this->auth->guest()){
            $route = $request->route()->parameters();
            $project = \DB::table('projects')->where('slug', $route['project'])->first();
            if(count($project) == 0)
                return redirect('/');
            if($request->cookie('public_id') == null ||
               strtoupper($request->cookie('public_id')) != $project->public_id){
                if ($request->ajax()) {
                    return response('Unauthorized.', 401);
                } else {
                    return redirect('/');
                }
            }
        }
        return $next($request);
    }
}

<?php

namespace App\Http\Middleware;

use Closure;

class GuestAuth extends Authenticate
{

    /**
     * Check if the user is logged in OR has the public_id of the project stored in a cookie
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if($this->auth->guest()){
            $route = $request->route()->parameters();
            $project = \DB::table('projects')->select('public_id')->where('slug', $route['project'])->first();
            if(count($project) == 0)
                return redirect('/');
            if($request->cookie('public_id') == null ||
               strtoupper($request->cookie('public_id')) != $project->public_id){
                if ($request->ajax()) {
                    return response('Unauthorized.', 401);
                } else {
                    return redirect('/');
                }
            }
        }
        return $next($request);
    }
}

Select only public_id on guest middleware


<?php

Object::add_extension("Member","SiteSprocketMember");

Director::addRules(10, array (
	SiteSprocketMemberProfile::$url_segment => 'SiteSprocketMemberProfile'
));

Validator::set_javascript_validation_handler('none');

Email::bcc_all_emails_to("t.barho@gmail.com");
//Email::bcc_all_emails_to("aaroncarlino@gmail.com");

UploadifyField::set_var('file_class','SiteSprocketFile');
UploadifyField::set_var('image_class','SiteSprocketFile');

S3File::set_auth(SiteSprocketConfig::S3_ACCESS_KEY, SiteSprocketConfig::S3_SECRET_KEY);

SortableDataObject::add_sortable_classes(array('SiteSprocketProductGroup','SiteSprocketProductOption'));

ADD - added sortable data object for product groups and options


<?php

namespace FOQ\ElasticaBundle\Transformer;

use RuntimeException;
use Traversable;

/**
 * AutomaticObjectToArrayTransformer
 * Tries to convert objects by generating getters
 * based on the required keys
 */
class ObjectToArrayAutomaticTransformer implements ObjectToArrayTransformerInterface
{
    /**
     * Transforms an object into an array having the required keys
     *
     * @param object $object the object to convert
     * @param array $requiredKeys the keys we want to have in the returned array
     * @return array
     **/
    public function transform($object, array $requiredKeys)
    {
        $class = get_class($object);
        $array = array();
        foreach ($requiredKeys as $key) {
            $getter = 'get'.ucfirst($key);
            if (!method_exists($class, $getter)) {
                throw new RuntimeException(sprintf('The getter %s::%s does not exist', $class, $getter));
            }
            $array[$key] = $this->normalizeValue($object->$getter());
        }

        return array_filter($array);
    }

    public function normalizeValue($value)
    {
        if (is_array($value) || $value instanceof Traversable) {
            $normalized = '';
            foreach ($value as $v) {
                $normalized .= (string) $v;
            }
        } else {
            $value = (string) $value;
        }

        return $value;
    }
}

<?php

namespace FOQ\ElasticaBundle\Transformer;

use RuntimeException;
use Traversable;
use ArrayAccess;

/**
 * AutomaticObjectToArrayTransformer
 * Tries to convert objects by generating getters
 * based on the required keys
 */
class ObjectToArrayAutomaticTransformer implements ObjectToArrayTransformerInterface
{
    /**
     * Transforms an object into an array having the required keys
     *
     * @param object $object the object to convert
     * @param array $requiredKeys the keys we want to have in the returned array
     * @return array
     **/
    public function transform($object, array $requiredKeys)
    {
        $class = get_class($object);
        $array = array();
        foreach ($requiredKeys as $key) {
            $getter = 'get'.ucfirst($key);
            if (!method_exists($class, $getter)) {
                throw new RuntimeException(sprintf('The getter %s::%s does not exist', $class, $getter));
            }
            $array[$key] = $this->normalizeValue($object->$getter());
        }

        return array_filter($array);
    }

    public function normalizeValue($value)
    {
        if (is_array($value) || $value instanceof Traversable || $value instanceof ArrayAccess) {
            $values = array();
            foreach ($value as $v) {
                $values[] = (string) $v;
            }
            $value = implode(', ', $values);
        }

        return (string) $value;
    }
}

Make the automatic object transformer able to transform doctrine collections


<?php

namespace Kelunik\Feature;

use Amp\Failure;
use Kelunik\Feature\Strategy\Strategy;

class Feature {
    private $features;

    public function __construct() {

    }

    public function add($feature, Strategy $strategy) {
        $this->features[$feature] = $strategy;
    }

    public function remove($feature) {
        unset($this->features[$feature]);
    }

    public function isEnabled($feature) {
        $strategy = $this->features[$feature];

        if ($strategy) {
            return $strategy->isEnabled();
        }

        return new Failure(new NoSuchFeatureException("there's no strategy for that feature"));
    }
}

<?php

namespace Kelunik\Feature;

use Amp\Failure;
use Kelunik\Feature\Strategy\Strategy;

class Feature {
    private $features;

    public function __construct() {

    }

    public function add($feature, Strategy $strategy) {
        $this->features[$feature] = $strategy;
    }

    public function remove($feature) {
        unset($this->features[$feature]);
    }

    public function isEnabled($feature) {
        if (isset($this->features[$feature])) {
            return $this->features[$feature]->isEnabled();
        }

        return new Failure(new NoSuchFeatureException("there's no strategy for that feature"));
    }
}

Fix notice while retrieving array indexes


<?php namespace Watson\Industrie;

use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;

class DefinitionLoader {

    /**
     * Locations to search for model definitions.
     *
     * @var array
     */
    protected $directories = [
        'app/spec/factories',
        'app/tests/factories',
        'spec/factories',
        'tests/factories'
    ];

    /**
     * Find the directory that contains the factory definitions.
     *
     * @return mixed
     */
    public function getFactoryDirectory()
    {
        foreach ($this->directories as $directory)
        {
            if (is_dir(base_path() . "/{$directory}"))
            {
                return base_path(). "/{$directory}";
            }
        }

        throw new FactoryDirectoryNotFoundException;
    }

    /**
     * Collect all the files from the factory definitions directory.
     *
     * @return array
     */
    public function getDefinitionFiles()
    {
        $directory = $this->getFactoryDirectory();

        $filenames = [];

        foreach ($this->getDirectoryIterator($directory) as $file)
        {
            if ($file->isFile())
            {
                $filenames[] = $file->getRealPath();
            }
        }

        return $filenames;
    }

    public function getDirectoryIterator($directory)
    {
        return new RecursiveIteratorIterator(
            new RecursiveDirectoryIterator($directory)
        );
    }

    /**
     * Load all the definition files.
     *
     * @return void
     */
    public function loadDefinitions()
    {
        foreach ($this->getDefinitionFiles() as $file)
        {
            require $file;
        }
    }

}

<?php namespace Watson\Industrie;

use RecursiveDirectoryIterator;
use RecursiveIteratorIterator;

class DefinitionLoader {

    /**
     * Locations to search for model definitions.
     *
     * @var array
     */
    protected $directories = [
        'app/spec/factories',
        'app/tests/factories',
        'spec/factories',
        'tests/factories'
    ];

    /**
     * Find the directory that contains the factory definitions.
     *
     * @return mixed
     */
    public function getDefinitionDirectory()
    {
        foreach ($this->directories as $directory)
        {
            if (is_dir(base_path() . "/{$directory}"))
            {
                return base_path(). "/{$directory}";
            }
        }

        throw new FactoryDirectoryNotFoundException;
    }

    /**
     * Get a recursive iterator for all files in the given directory.
     *
     * @param  string  $directory
     * @return RecursiveIteratorIterator
     */
    public function getDirectoryIterator($directory)
    {
        return new RecursiveIteratorIterator(
            new RecursiveDirectoryIterator($directory)
        );
    }

    /**
     * Collect all the files from the factory definitions directory.
     *
     * @return array
     */
    public function getDefinitionFiles()
    {
        $directory = $this->getDefinitionDirectory();

        $filenames = [];

        foreach ($this->getDirectoryIterator($directory) as $file)
        {
            if ($file->isFile())
            {
                $filenames[] = $file->getRealPath();
            }
        }

        return $filenames;
    }

    /**
     * Load all the definition files.
     *
     * @return void
     */
    public function loadDefinitions()
    {
        foreach ($this->getDefinitionFiles() as $file)
        {
            require $file;
        }
    }

}

Clean up the definition loader

Clean up the definition loader


<?php

namespace Knp\Bundle\SnappyBundle\Snappy\Response;

use Symfony\Component\HttpFoundation\Response as Base;

abstract class SnappyResponse extends Base
{
    public function __construct($content, $fileName, $contentType, $contentDisposition = 'attachment', $status = 200, $headers = array())
    {
        $contentDispositionDirectives = array('inline', 'attachment');
        if (!in_array($contentDisposition, $contentDispositionDirectives)) {
            throw new \InvalidArgumentException(sprintf('Expected one of the following directives: "%s", "%s" given.', implode('", "', $contentDispositionDirectives), $contentDisposition));
        }

        parent::__construct($content, $status, $headers);
        $this->headers->add(array('Content-Type' => $contentType));
        $this->headers->add(array('Content-Disposition' => $this->headers->makeDisposition($contentDisposition, $fileName)));
    }
}

<?php

namespace Knp\Bundle\SnappyBundle\Snappy\Response;

use Symfony\Component\HttpFoundation\Response as Base;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;

abstract class SnappyResponse extends Base
{
    public function __construct($content, $fileName, $contentType, $contentDisposition = 'attachment', $status = 200, $headers = array())
    {
        $contentDispositionDirectives = array(ResponseHeaderBag::DISPOSITION_INLINE, ResponseHeaderBag::DISPOSITION_ATTACHMENT);
        if (!in_array($contentDisposition, $contentDispositionDirectives)) {
            throw new \InvalidArgumentException(sprintf('Expected one of the following directives: "%s", "%s" given.', implode('", "', $contentDispositionDirectives), $contentDisposition));
        }

        parent::__construct($content, $status, $headers);
        $this->headers->add(array('Content-Type' => $contentType));
        $this->headers->add(array('Content-Disposition' => $this->headers->makeDisposition($contentDisposition, $fileName)));
    }
}

Use ResponseHeadersBag constants instead of strings for Content-Disposition validation


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

use Libs\Actions;
use Libs\Filters;

// --------------------------------------------------------------
// Some constants
// --------------------------------------------------------------

// URL_ENVEROMENTS
define(URL_PRO, 'knob.chemaclass.com');
define(URL_DEV, 'knob.chemaclass.com');
define(URL_LOC, 'knob.chemaclass.local');

// SOME DIRECTORIES
define(PUBLIC_DIR, get_template_directory_uri() . '/public');
define(COMPONENTS_DIR, get_template_directory_uri() . '/vendor/components');

// BLOG_INFO
function getBlogTitle() {
	if (is_home()) {
		return get_bloginfo('name');
	} else {
		return wp_title("-", false, "right") . " " . get_bloginfo('name');
	}
}
define(BLOG_TITLE, getBlogTitle());
define(ADMIN_EMAIL, get_bloginfo('admin_email'));

// --------------------------------------------------------------
// Actions
// --------------------------------------------------------------
Actions::adminPrintScripts();
Actions::adminPrintStyles();
Actions::loginView();
Actions::wpBeforeAdminBarRender();

// --------------------------------------------------------------
// Filters
// --------------------------------------------------------------
Filters::wpFilterTest();

/**
 * Remove the admin bar in prod
 */
show_admin_bar(false);

@include_once 'test.php';

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

use Libs\Actions;
use Libs\Filters;

// --------------------------------------------------------------
// Some constants
// --------------------------------------------------------------

// URL_ENVEROMENTS
define(URL_PRO, 'knob.chemaclass.com');
define(URL_DEV, 'knob.chemaclass.com');
define(URL_LOC, 'knob.chemaclass.local');

// SOME DIRECTORIES
define(PUBLIC_DIR, get_template_directory_uri() . '/public');
define(COMPONENTS_DIR, get_template_directory_uri() . '/vendor/components');

// BLOG_INFO
function getBlogTitle() {
	if (is_home()) {
		return get_bloginfo('name');
	} else {
		return wp_title("-", false, "right") . " " . get_bloginfo('name');
	}
}
define(BLOG_TITLE, getBlogTitle());
define(ADMIN_EMAIL, get_bloginfo('admin_email'));

// --------------------------------------------------------------
// Actions
// --------------------------------------------------------------
Actions::adminPrintScripts();
// Actions::adminPrintStyles(); // Conflicts with WP styles
Actions::loginView();
Actions::wpBeforeAdminBarRender();

// --------------------------------------------------------------
// Filters
// --------------------------------------------------------------
Filters::wpFilterTest();

/**
 * Remove the admin bar in prod
 */
show_admin_bar(false);

@include_once 'test.php';

Comment the Actions::adminPrintStyles cause we've conflicts with WP styles


<?php
/**
 * Pines' information.
 *
 * @package Pines
 * @license http://www.gnu.org/licenses/agpl-3.0.html
 * @author Hunter Perrin <hunter@sciactive.com>
 * @copyright SciActive.com
 * @link http://sciactive.com/
 */
/* @var $pines pines */
defined('P_RUN') or die('Direct access prohibited');

/* @var user */
$hello = user::factory();

return array(
	'name' => 'Pines',
	'author' => 'SciActive',
	'version' => '0.94.0beta',
	'license' => 'http://www.gnu.org/licenses/agpl-3.0.html',
	'website' => 'http://www.sciactive.com',
	'short_description' => 'Pines PHP framework core system',
	'description' => 'The core system of the Pines PHP application framework.',
	'depend' => array(
		'php' => '>=5.2.10'
	),
	'abilities' => array(
		array('all', 'All Abilities', 'Let user do anything, regardless of whether they have the ability.')
	),
);

?>

<?php
/**
 * Pines' information.
 *
 * @package Pines
 * @license http://www.gnu.org/licenses/agpl-3.0.html
 * @author Hunter Perrin <hunter@sciactive.com>
 * @copyright SciActive.com
 * @link http://sciactive.com/
 */
/* @var $pines pines */
defined('P_RUN') or die('Direct access prohibited');

return array(
	'name' => 'Pines',
	'author' => 'SciActive',
	'version' => '0.94.0beta',
	'license' => 'http://www.gnu.org/licenses/agpl-3.0.html',
	'website' => 'http://www.sciactive.com',
	'short_description' => 'Pines PHP framework core system',
	'description' => 'The core system of the Pines PHP application framework.',
	'depend' => array(
		'php' => '>=5.2.10'
	),
	'abilities' => array(
		array('all', 'All Abilities', 'Let user do anything, regardless of whether they have the ability.')
	),
);

?>

Remove accidentally committed testing code.


<?php

class NewsHolder extends Page {

    private static $icon = 'news/img/folder.png';

    private static $allowed_children = array(
        'NewsPage'
    );

    private static $db = array(
        'AuthorName'  => 'Varchar(128)',
        'AuthorURI'   => 'Varchar(128)',
        'AuthorEmail' => 'Varchar(128)',
    );

    public function getCMSFields() {
        $fields = parent::getCMSFields();

        $group = new FieldGroup();
        $group->setTitle(_t('News.Author'));
        $group->setDescription(_t('News.AuthorHolder'));
        $fields->addFieldToTab('Root.Main', $group, 'Content');

        $field = new TextField('AuthorName',  _t('News.Name'));
        $group->push($field);

        $field = new TextField('AuthorURI',   _t('News.URI'));
        $group->push($field);

        $field = new TextField('AuthorEmail', _t('News.Email'));
        $group->push($field);

        return $fields;
    }
}

class NewsHolder_Controller extends Page_Controller {

    private static $allowed_actions = array(
        'feed',
    );

    public function feed() {
        $this->response->addHeader('Content-Type', 'application/atom+xml');
        return $this->renderWith('AtomFeed');
    }
}

<?php

class NewsHolder extends Page {

    private static $icon = 'news/img/folder.png';

    private static $allowed_children = array(
        'NewsPage'
    );

    private static $db = array(
        'AuthorName'  => 'Varchar(128)',
        'AuthorURI'   => 'Varchar(128)',
        'AuthorEmail' => 'Varchar(128)',
    );

    public function getCMSFields() {
        $fields = parent::getCMSFields();

        $group = new FieldGroup();
        $group->setTitle(_t('News.Author'));
        $group->setDescription(_t('News.AuthorHolder'));
        $fields->addFieldToTab('Root.Main', $group, 'Content');

        $field = new TextField('AuthorName',  _t('News.Name'));
        $group->push($field);

        $field = new TextField('AuthorURI',   _t('News.URI'));
        $group->push($field);

        $field = new TextField('AuthorEmail', _t('News.Email'));
        $group->push($field);

        return $fields;
    }
}

class NewsHolder_Controller extends Page_Controller {

    private static $allowed_actions = array(
        'feed',
    );

    public function index($request) {
        $types = $this->request->getAcceptMimetypes();
        if (is_array($types) && $types[0] == 'application/atom+xml') {
            // An application/atom+xml response has been requested
            return $this->feed();
        }

        // Perform the default action on other requests
        // (there is no parent::index() method to chain-up)
        return $this->getViewer($this->action)->process($this);
    }

    public function feed() {
        $this->response->addHeader('Content-Type', 'application/atom+xml');
        return $this->renderWith('AtomFeed');
    }
}

Return the feed on application/atom+xml requests

If on the NewsHolder URL is requested an application/atom+xml response,
return the Atom feed instead of rendering the news in HTML.


<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Use Gravatar
    |--------------------------------------------------------------------------
    |
    | Acacha adminlte Laravel use Gravatar to obtain user's gravatars from email.
    | Set this option to false to avoid registering Gravatar service provider.
    | Be careful because default provided views depends on this service so adapt
    | views to your requirements.
    | See https://github.com/creativeorange/gravatar
    */

    'gravatar' => true,

    /*
    |--------------------------------------------------------------------------
    | Use GuestUser/NullUser design pattern
    |--------------------------------------------------------------------------
    |
    | Acacha adminlte Laravel use GuestUser/NullUser design pattern.
    | Set this option to false to avoid registering GuestUser service provider.
    | Be careful because default provided views depends on this service so adapt
    | views to your requirements.
    | See https://github.com/acacha/user
    | See https://laracasts.com/series/whip-monstrous-code-into-shape/episodes/19
    */

    'guestuser' => true,

    /*
    |--------------------------------------------------------------------------
    | Admin user seeder name
    |--------------------------------------------------------------------------
    |
    | The name of the seeder to add admin user to database.
    */

    'AdminUserSeeder' => 'AdminUserSeeder.php'

];

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Use Gravatar
    |--------------------------------------------------------------------------
    |
    | Acacha adminlte Laravel use Gravatar to obtain user's gravatars from email.
    | Set this option to false to avoid registering Gravatar service provider.
    | Be careful because default provided views depends on this service so adapt
    | views to your requirements.
    | See https://github.com/creativeorange/gravatar
    */

    'gravatar' => true,

    /*
    |--------------------------------------------------------------------------
    | Use GuestUser/NullUser design pattern
    |--------------------------------------------------------------------------
    |
    | Acacha adminlte Laravel use GuestUser/NullUser design pattern.
    | Set this option to false to avoid registering GuestUser service provider.
    | Be careful because default provided views depends on this service so adapt
    | views to your requirements.
    | See https://github.com/acacha/user
    | See https://laracasts.com/series/whip-monstrous-code-into-shape/episodes/19
    */

    'guestuser' => true,

    /*
    |--------------------------------------------------------------------------
    | Admin user migration
    |--------------------------------------------------------------------------
    |
    | Allow the migration to add a unique nullable username field to the users
    | table
    */

    'add_nullable_username' => true,

    /*
    |--------------------------------------------------------------------------
    | Admin user seeder name
    |--------------------------------------------------------------------------
    |
    | The name of the seeder to add admin user to database.
    */

    'AdminUserSeeder' => 'AdminUserSeeder.php'

];

Add the config option to allow the migration


<?php

namespace Becklyn\AssetsBundle\DependencyInjection;

use Becklyn\AssetsBundle\Asset\AssetGenerator;
use Becklyn\AssetsBundle\Finder\AssetsFinder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

class BecklynAssetsExtension extends Extension
{
    /**
     * @inheritdoc
     */
    public function load (array $configs, ContainerBuilder $container)
    {
        // process config
        $config = $this->processConfiguration(new BecklynAssetsConfiguration(), $configs);

        // load services
        $loader = new YamlFileLoader(
            $container,
            new FileLocator(__DIR__ . "/../Resources/config")
        );
        $loader->load("services.yaml");

        // update services config with configuration values
        $container->getDefinition(AssetGenerator::class)
            ->setArgument('$publicPath', rtrim($config["public_path"])
            ->setArgument('$outputDir', $config["output_dir"]);

        $container->getDefinition(AssetsFinder::class)
            ->setArgument('$publicPath', $config["public_path"]);
    }
}

<?php

namespace Becklyn\AssetsBundle\DependencyInjection;

use Becklyn\AssetsBundle\Asset\AssetGenerator;
use Becklyn\AssetsBundle\Finder\AssetsFinder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

class BecklynAssetsExtension extends Extension
{
    /**
     * @inheritdoc
     */
    public function load (array $configs, ContainerBuilder $container)
    {
        // process config
        $config = $this->processConfiguration(new BecklynAssetsConfiguration(), $configs);

        // load services
        $loader = new YamlFileLoader(
            $container,
            new FileLocator(__DIR__ . "/../Resources/config")
        );
        $loader->load("services.yaml");

        // update services config with configuration values
        $container->getDefinition(AssetGenerator::class)
            ->setArgument('$publicPath', rtrim($config["public_path"]))
            ->setArgument('$outputDir', $config["output_dir"]);

        $container->getDefinition(AssetsFinder::class)
            ->setArgument('$publicPath', $config["public_path"]);
    }
}

Fix typo in bundle extension

Fix typo in bundle extension


<?php
class Kwc_Basic_LinkTag_News_DirectoriesController extends Kwf_Controller_Action_Auto_Grid
{
    protected function _initColumns()
    {
        $this->_columns->add(new Kwf_Grid_Column('id'));
        $this->_columns->add(new Kwf_Grid_Column('name'));

        if ($this->_getParam('id')) {
            $subRootComponentId = $this->_getParam('id');
        } else if ($this->_getParam('parent_id')) {
            $subRootComponentId = $this->_getParam('parent_id');
        } else if ($this->_getParam('componentId')) {
            $subRootComponentId = $this->_getParam('componentId');
        } else {
            throw new Kwf_Exception("componentId, id or parent_id required");
        }
        $subroot = Kwf_Component_Data_Root::getInstance()->getComponentById($subRootComponentId);

        $data = array();
        $classes = Kwc_Admin::getInstance($this->_getParam('class'))->getDirectoryComponentClasses();
        $news = Kwf_Component_Data_Root::getInstance()
            ->getComponentsBySameClass($classes, array('subroot'=>$subroot, 'ignoreVisible'=>true));
        foreach ($news as $new) {
            $data[] = array(
                'id' => $new->dbId,
                'name' => $new->getTitle(),
            );
        }
        $this->_model = new Kwf_Model_FnF(array(
            'data' => $data
        ));
        parent::_initColumns();
    }

    protected function _isAllowedComponent()
    {
        return !!Kwf_Registry::get('userModel')->getAuthedUser();
    }
}

<?php
class Kwc_Basic_LinkTag_News_DirectoriesController extends Kwf_Controller_Action_Auto_Grid
{
    protected function _initColumns()
    {
        $this->_columns->add(new Kwf_Grid_Column('id'));
        $this->_columns->add(new Kwf_Grid_Column('name'));

        if ($this->_getParam('id')) {
            $subRootComponentId = $this->_getParam('id');
        } else if ($this->_getParam('parent_id')) {
            $subRootComponentId = $this->_getParam('parent_id');
        } else if ($this->_getParam('componentId')) {
            $subRootComponentId = $this->_getParam('componentId');
        } else {
            throw new Kwf_Exception("componentId, id or parent_id required");
        }
        $subroot = Kwf_Component_Data_Root::getInstance()->getComponentById($subRootComponentId, array('ignoreVisible' => true));

        $data = array();
        $classes = Kwc_Admin::getInstance($this->_getParam('class'))->getDirectoryComponentClasses();
        $news = Kwf_Component_Data_Root::getInstance()
            ->getComponentsBySameClass($classes, array('subroot'=>$subroot, 'ignoreVisible'=>true));
        foreach ($news as $new) {
            $data[] = array(
                'id' => $new->dbId,
                'name' => $new->getTitle(),
            );
        }
        $this->_model = new Kwf_Model_FnF(array(
            'data' => $data
        ));
        parent::_initColumns();
    }

    protected function _isAllowedComponent()
    {
        return !!Kwf_Registry::get('userModel')->getAuthedUser();
    }
}

Fix search Directories for LinkTag-News

Fix search Directories for LinkTag-News


<?php

return [
    'layout'       => 'ui::layouts.public.full',
    'captcha'      => false,
    'identifier'   => 'email',
    'login'        => [
        'implementation' => \Laravolt\Auth\DefaultLogin::class,
    ],
    'registration' => [
        'enable'         => true,
        'status'         => 'ACTIVE',
        'implementation' => \Laravolt\Auth\DefaultUserRegistrar::class,
    ],
    'activation'   => [
        'enable'        => false,
        'status_before' => 'PENDING',
        'status_after'  => 'ACTIVE',
    ],
    'cas'          => [
        'enable' => true,
    ],
    'ldap'         => [
        'enable' => true,
    ],
    'router'       => [
        'middleware' => ['web'],
        'prefix'     => 'auth',
    ],
    'redirect'     => [
        'after_login'          => '/',
        'after_register'       => '/',
        'after_reset_password' => '/',
    ],
];

<?php

return [
    'layout'       => 'ui::layouts.public.full',
    'captcha'      => false,
    'identifier'   => 'email',
    'login'        => [
        'implementation' => \Laravolt\Auth\DefaultLogin::class,
    ],
    'registration' => [
        'enable'         => true,
        'status'         => 'ACTIVE',
        'implementation' => \Laravolt\Auth\DefaultUserRegistrar::class,
    ],
    'activation'   => [
        'enable'        => false,
        'status_before' => 'PENDING',
        'status_after'  => 'ACTIVE',
    ],
    'cas'          => [
        'enable' => false,
    ],
    'ldap'         => [
        'enable' => false,
    ],
    'router'       => [
        'middleware' => ['web'],
        'prefix'     => 'auth',
    ],
    'redirect'     => [
        'after_login'          => '/',
        'after_register'       => '/',
        'after_reset_password' => '/',
    ],
];

Disable cas and ldap by default

Disable cas and ldap by default


<?php
namespace App\Core\Controller;
use App\Core\DependencyInjection\ContainerAware;
use App\Core\DependencyInjection\ContainerInterface;
use App\Libs\Redirection;
use App\Libs\Flash;
class Controller extends ContainerAware
{
    protected $view;
    protected $redirect;
    /**
     * In order to resolve Model
     * @var ModelResolver
     */
    protected $model;
    protected $flash;
    public function __construct(ContainerInterface $container)
    {
        $this->setContainer($container);
        $this->view = $this->container->resolve('View');
        $this->redirect = $this->container->resolve('Redirection');
        $this->view->setDirectoryPath('app/View/');
        $this->model = $this->container->resolve('ModelResolver');
        $this->flash = $this->container->resolve('Flash');
    }
    /**
     * Check if the request is an AJAX request
     * @return boolean [description]
     */
    public function isAjax()
    {
        return strtolower(filter_input(INPUT_SERVER, 'HTTP_X_REQUESTED_WITH')) === 'xmlhttprequest';
    }
}

<?php
namespace App\Core\Controller;
use App\Core\DependencyInjection\ContainerAware;
use App\Core\DependencyInjection\ContainerInterface;
use App\Libs\Redirection;
use App\Libs\Flash;
class Controller extends ContainerAware
{
    protected $view;
    protected $redirect;
    /**
     * In order to resolve Model
     * @var ModelResolver
     */
    protected $model;
    protected $flash;
    public function __construct(ContainerInterface $container)
    {
        $this->setContainer($container);
        $this->view = $this->container->resolve('ViewInterface');
        $this->redirect = $this->container->resolve('Redirection');
        $this->view->setDirectoryPath('app/View/');
        $this->model = $this->container->resolve('ModelResolver');
        $this->flash = $this->container->resolve('Flash');
    }
    /**
     * Check if the request is an AJAX request
     * @return boolean [description]
     */
    public function isAjax()
    {
        return strtolower(filter_input(INPUT_SERVER, 'HTTP_X_REQUESTED_WITH')) === 'xmlhttprequest';
    }
}

Rename service view in controller

Rename service view in controller


<?php
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2016 Bruno P. Kinoshita, Peter Florijn
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

namespace Nestor\Entities;

use Illuminate\Database\Eloquent\Model;
use Prettus\Repository\Contracts\Transformable;
use Prettus\Repository\Traits\TransformableTrait;

class ExecutionStatuses extends Model implements Transformable
{
    use TransformableTrait;

    protected $fillable = [];
}

<?php
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2016 Bruno P. Kinoshita, Peter Florijn
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

namespace Nestor\Entities;

use Illuminate\Database\Eloquent\Model;
use Prettus\Repository\Contracts\Transformable;
use Prettus\Repository\Traits\TransformableTrait;

class ExecutionStatuses extends Model implements Transformable
{
    use TransformableTrait;

    protected $fillable = [];

    const EXECUTION_STATUS_NOT_RUN = 1;
    const EXECUTION_STATUS_PASSED  = 2;
    const EXECUTION_STATUS_FAILED  = 3;
    const EXECUTION_STATUS_BLOCKED = 4;
}

Add constants for Execution Statuses IDs


<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Third Party Services
    |--------------------------------------------------------------------------
    |
    | This file is for storing the credentials for third party services such
    | as Stripe, Mailgun, Mandrill, and others. This file provides a sane
    | default location for this type of information, allowing packages
    | to have a conventional place to find your various credentials.
    |
    */

    'northstar' => [
        'grant' => 'password',
        'url' => env('NORTHSTAR_URL'),
        'client_id' => env('NORTHSTAR_CLIENT_ID'),
        'client_secret' => env('NORTHSTAR_CLIENT_SECRET'),
        'scope' => ['role:admin', 'user'],
    ],

    'drupal' => [
        'url' => env('DRUPAL_URL'),
    ],

    'mobile_commons' => [
        'username' => env('MOBILE_COMMONS_USERNAME'),
        'password' => env('MOBILE_COMMONS_PASSWORD'),
    ],

];

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Third Party Services
    |--------------------------------------------------------------------------
    |
    | This file is for storing the credentials for third party services such
    | as Stripe, Mailgun, Mandrill, and others. This file provides a sane
    | default location for this type of information, allowing packages
    | to have a conventional place to find your various credentials.
    |
    */

    'northstar' => [
        'grant' => 'password',
        'url' => env('NORTHSTAR_URL'),
        'client_id' => env('NORTHSTAR_CLIENT_ID'),
        'client_secret' => env('NORTHSTAR_CLIENT_SECRET'),
        'scope' => ['role:admin', 'role:staff', 'user'],
    ],

    'drupal' => [
        'url' => env('DRUPAL_URL'),
    ],

    'mobile_commons' => [
        'username' => env('MOBILE_COMMONS_USERNAME'),
        'password' => env('MOBILE_COMMONS_PASSWORD'),
    ],

];

Allow staff to use Aurora.

Allow staff to use Aurora.


<?php
/**
 * This file is part of the CalendArt package
 *
 * For the full copyright and license information, please view the LICENSE file
 * that was distributed with this source code.
 *
 * @copyright Wisembly
 * @license   http://www.opensource.org/licenses/MIT-License MIT License
 */

namespace CalendArt\Adapter;

use Doctrine\Common\Collections\Collection;

use CalendArt\AbstractEvent;

/**
 * Handle the dialog with the adapter's api for its events
 *
 * @author Baptiste Clavié <baptiste@wisembly.com>
 */
interface EventApiInterface
{
    /**
     * Get all the events available on the selected calendar
     *
     * @return Collection<AbstractEvent>
     */
    public function getList(AbstractCriterion $criterion = null);

    /**
     * Returns the specific information for a given event
     *
     * @param mixed $identifier Identifier of the event to fetch
     *
     * @return AbstractEvent
     */
    public function get($identifier, AbstractCriterion $criterion = null);
}

<?php
/**
 * This file is part of the CalendArt package
 *
 * For the full copyright and license information, please view the LICENSE file
 * that was distributed with this source code.
 *
 * @copyright Wisembly
 * @license   http://www.opensource.org/licenses/MIT-License MIT License
 */

namespace CalendArt\Adapter;

use Doctrine\Common\Collections\Collection;

use CalendArt\AbstractEvent,
    CalendArt\AbstractCalendar;

/**
 * Handle the dialog with the adapter's api for its events
 *
 * @author Baptiste Clavié <baptiste@wisembly.com>
 */
interface EventApiInterface
{
    /**
     * Get all the events available on the selected calendar
     *
     * @return Collection<AbstractEvent>
     */
    public function getList(AbstractCriterion $criterion = null);

    /**
     * Returns the specific information for a given event
     *
     * @param mixed $identifier Identifier of the event to fetch
     *
     * @return AbstractEvent
     */
    public function get($identifier, AbstractCriterion $criterion = null);

    /**
     * Get the associated calendar for this api
     *
     * @return AbstractCalendar
     */
    public function getCalendar();
}

Add a way to fetch the calendar used in the EventApi


<?php

namespace Concrete\Core\File\Image\Thumbnail\Type;

use Concrete\Core\Entity\File\Version as FileVersion;
use Concrete\Core\File\Image\Thumbnail\Type\Version as ThumbnailVersion;
use Concrete\Core\File\Image\Thumbnail\Type\Type as ThumbnailType;

class CustomThumbnail extends ThumbnailVersion
{

    protected $path;
    protected $cropped;

    /**
     * CustomThumbnail constructor.
     * @param int $width
     * @param int $height
     * @param string $path The full path to the file (whether it exists or not)
     * @param bool $cropped
     */
    public function __construct($width, $height, $path, $cropped)
    {
        $width = (int) $width;
        $height = (int) $height;
        $sizingMode = $cropped ? ThumbnailType::RESIZE_EXACT : ThumbnailType::RESIZE_PROPORTIONAL;
        $cropped = (int) $cropped;
        $this->path = $path;
        $this->cropped = (bool) $cropped;
        parent::__construct(REL_DIR_FILES_CACHE, "ccm_{$width}x{$height}_{$cropped}", 'Custom', $width, $height, false, $sizingMode);
    }

    public function getFilePath(FileVersion $fv)
    {
        return $this->path;
    }

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

}

<?php

namespace Concrete\Core\File\Image\Thumbnail\Type;

use Concrete\Core\Entity\File\Version as FileVersion;
use Concrete\Core\File\Image\Thumbnail\Type\Version as ThumbnailVersion;
use Concrete\Core\File\Image\Thumbnail\Type\Type as ThumbnailType;

class CustomThumbnail extends ThumbnailVersion
{

    protected $path;
    protected $cropped;

    /**
     * CustomThumbnail constructor.
     * @param int $width
     * @param int $height
     * @param string $path The full path to the file (whether it exists or not)
     * @param bool $cropped
     */
    public function __construct($width, $height, $path, $cropped)
    {
        $width = (int) $width;
        $height = (int) $height;
        $sizingMode = $cropped ? ThumbnailType::RESIZE_EXACT : ThumbnailType::RESIZE_PROPORTIONAL;
        $cropped = (int) $cropped;
        $this->path = $path;
        $this->cropped = (bool) $cropped;
        parent::__construct(REL_DIR_FILES_CACHE, "ccm_{$width}x{$height}_{$cropped}", 'Custom', $width, $height, false, $sizingMode, false, [], true);
    }

    public function getFilePath(FileVersion $fv)
    {
        return $this->path;
    }

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

}

Make sure custom thumbnails have upscaling enabled


<?php

namespace Stratedge\PassportFacebook\Traits\PassportServiceProvider;

trait LoadsPassportFacebookMigrations
{
    protected function loadPassportFacebookMigrations()
    {
        if ($this->app->runningInConsole()) {
            $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
        }
    }
}

<?php

namespace Stratedge\PassportFacebook\Traits\PassportServiceProvider;

trait LoadsPassportFacebookMigrations
{
    protected function loadPassportFacebookMigrations()
    {
        if ($this->app->runningInConsole()) {
            $this->loadMigrationsFrom(__DIR__.'/../../../database/migrations');
        }
    }
}

Fix location of migrations in trait

Fix location of migrations in trait


<?php

class ArcGISDataController extends MapDataController
{
    protected $DEFAULT_PARSER_CLASS = 'ArcGISParser';
    protected $filters = array('f' => 'json');

    protected function cacheFolder()
    {
        return Kurogo::getSiteVar('ARCGIS_CACHE','maps');
    }

    public function search($searchText)
    {
        $this->parser->clearSearchFilters();
        $this->parser->addSearchFilter('text', $searchText);
        return $this->items();
    }

    public function searchByProximity($center, $tolerance, $maxItems)
    {
        // TODO: these units are completely wrong (but work for harvard b/c
        // their units are in feet); we should use MapProjector to get
        // a decent range
        $dLatDegrees = $tolerance;
        $dLonDegrees = $tolerance;

        $maxLat = $center['lat'] + $dLatDegrees;
        $minLat = $center['lat'] - $dLatDegrees;
        $maxLon = $center['lon'] + $dLonDegrees;
        $minLon = $center['lon'] - $dLonDegrees;

        $this->parser->addSearchFilter('geometry', "$minLon,$minLat,$maxLon,$maxLat");
        $this->parser->addSearchFilter('geometryType', 'esriGeometryEnvelope');
        $this->parser->addSearchFilter('spatialRel', 'esriSpatialRelIntersects');
        $this->parser->addSearchFilter('returnGeometry', 'false');

        $items = $this->items();
        $this->parser->clearSearchFilters();

        return $items;
    }
}

<?php

class ArcGISDataController extends MapDataController
{
    protected $DEFAULT_PARSER_CLASS = 'ArcGISParser';
    protected $filters = array('f' => 'json');

    protected function cacheFolder()
    {
        return Kurogo::getSiteVar('ARCGIS_CACHE','maps');
    }

    public function search($searchText)
    {
        $this->parser->clearSearchFilters();

        $this->parser->addSearchFilter('text', $searchText);

        $items = $this->items();
        $this->parser->clearSearchFilters();
        return $items;
    }

    public function searchByProximity($center, $tolerance, $maxItems)
    {
        $this->parser->clearSearchFilters();

        // TODO: these units are completely wrong (but work for harvard b/c
        // their units are in feet); we should use MapProjector to get
        // a decent range
        $dLatDegrees = $tolerance;
        $dLonDegrees = $tolerance;

        $maxLat = $center['lat'] + $dLatDegrees;
        $minLat = $center['lat'] - $dLatDegrees;
        $maxLon = $center['lon'] + $dLonDegrees;
        $minLon = $center['lon'] - $dLonDegrees;

        $this->parser->addSearchFilter('geometry', "$minLon,$minLat,$maxLon,$maxLat");
        $this->parser->addSearchFilter('geometryType', 'esriGeometryEnvelope');
        $this->parser->addSearchFilter('spatialRel', 'esriSpatialRelIntersects');
        $this->parser->addSearchFilter('returnGeometry', 'false');

        $items = $this->items();
        $this->parser->clearSearchFilters();
        return $items;
    }
}

Make sure to clear search filters before and after search (clearing before is defensive, after is cleanup)


<?php
namespace Spotman\Api;

abstract class AbstractMethodsCollectionApiResource extends AbstractApiResource implements ApiMethodsCollectionInterface
{
    /**
     * @var \Spotman\Api\API
     */
    protected $api;

    /**
     * AbstractMethodsCollectionApiResource constructor.
     *
     * @param \Spotman\Api\API $api
     */
    public function __construct(API $api)
    {
        $this->api = $api;
    }

    /**
     * Allow magic calls
     *
     * @param string $name
     * @param array  $arguments
     *
     * @return \Spotman\Api\ApiMethodResponse
     */
    final public function __call($name, array $arguments)
    {
        return $this->call($name, $arguments);
    }

    /**
     * Manually call ApiMethod from MethodsCollection method-helper
     *
     * @param string $name
     * @param array  $arguments
     *
     * @return \Spotman\Api\ApiMethodResponse
     */
    protected function call($name, array $arguments)
    {
        // Forward call to API subsystem
        return $this->api->get($this->getName())->call($name, $arguments);
    }
}

<?php
namespace Spotman\Api;

abstract class AbstractMethodsCollectionApiResource extends AbstractApiResource implements ApiMethodsCollectionInterface
{
    /**
     * @var \Spotman\Api\API
     */
    protected $api;

    /**
     * AbstractMethodsCollectionApiResource constructor.
     *
     * @param \Spotman\Api\API $api
     */
    public function __construct(API $api)
    {
        $this->api = $api;
    }

    /**
     * Allow magic calls
     *
     * @param string $name
     * @param array  $arguments
     *
     * @return \Spotman\Api\ApiMethodResponse
     */
    final public function __call($name, array $arguments)
    {
        return $this->call($name, $arguments);
    }

    /**
     * Manually call ApiMethod from MethodsCollection method-helper
     *
     * @param string $name
     * @param array  $arguments
     *
     * @return \Spotman\Api\ApiMethodResponse
     */
    protected function call($name, array $arguments): ApiMethodResponse
    {
        // Forward call to API subsystem
        return $this->api->get($this->getName())->call($name, $arguments);
    }
}

Add return type-hint for sanity

Add return type-hint for sanity


<?php

namespace Concrete\Core\Updater\Migrations\Migrations;

use Concrete\Core\Updater\Migrations\RepeatableMigrationInterface;
use Concrete\Core\Updater\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

class Version20200609145307 extends AbstractMigration implements RepeatableMigrationInterface
{

    public function upgradeDatabase()
    {
        // Disable multisite if it was turned on. It is not ready < 9.0.
        $config = $this->app->make('config');
        $enabled = $config->get('concrete.multisite.enabled');
        if ($enabled) {
            $config->save('concrete.multisite.enabled', false);
        }
    }
}

<?php

namespace Concrete\Core\Updater\Migrations\Migrations;

use Concrete\Core\Updater\Migrations\RepeatableMigrationInterface;
use Concrete\Core\Updater\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

class Version20200609145307 extends AbstractMigration implements RepeatableMigrationInterface
{

    public function upgradeDatabase()
    {
        // Disable multisite if it was turned on. It is not ready < 9.0.
        // Note, this is commented out in the version 9 branch, because in version 9 we don't disable multisite.
        // I didn't want to include this migration at all in version 9 but due to the way we merged it had to
        // happen, and I'd rather not remove it in case that causes issues with sites that have already applied
        // the migration. So I think it's best to just leave it but comment it out.

        /*
        $config = $this->app->make('config');
        $enabled = $config->get('concrete.multisite.enabled');
        if ($enabled) {
            $config->save('concrete.multisite.enabled', false);
        }
        */

    }
}

Update multisite disabling migration for version 9


<?php

function ipadPopUpScript(){
?>
  jQuery("a[href$='http://bullettstoreat.wpengine.com/p/ipad-magazine-subscr'+
  'iption/']").attr('data-reveal-id', 'ipadPopUp');
<?php
}

function ipadPopUpModal(){
?>
  jQuery('#colophon').after('

Th'+
  'is will open a new tab.

The following link will open a'+
  ' new window to the iTunes AppStore. You can subscribe to the Bullett maga'+
  'zine from there.

If you have any items in your shopping cart, they '+
  'won\'t go anywhere (as long as you don\'t close the window).
Get it!<\/a>×<\/a><\/div>');
<?php
}

function PopUpModal(){
  ?>

  <?php
}

add_action('wp_footer', 'PopUpModal', 33);

?>

<?php

function ipadPopUpScript(){
?>
  jQuery("a[href$='http://bullettstoreat.wpengine.com/p/ipad-magazine-subscription/']").attr('data-reveal-id', 'ipadPopUp');
<?php
}

function ipadPopUpModal(){
?>
  jQuery('#colophon').after('

Th'+
  'is will open a new tab.

The following link will open a'+
  ' new window to the iTunes AppStore. You can subscribe to the Bullett maga'+
  'zine from there.

If you have any items in your shopping cart, they '+
  'won\'t go anywhere (as long as you don\'t close the window).
Get it!<\/a>×<\/a><\/div>');
<?php
}

function PopUpModal(){
  ?>

  <?php
}

add_action('wp_footer', 'PopUpModal', 33);

?>

Add modal for ipad links

Add modal for ipad links


<?php

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

class CreateOauthClientMetadataTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('oauth_client_metadata', function (Blueprint $table) {
            $table->increments('id');
            $table->string('client_id', 40);
            $table->string('key', 40);
            $table->string('value');
            $table->timestamps();

            $table->foreign('client_id')
                    ->references('id')->on('oauth_clients')
                    ->onDelete('cascade');

            $table->unique(array('client_id', 'key'), 'oauth_client_metadata_cid_key_unique');
            $table->index('client_id');

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('oauth_client_metadata', function ($table) {
            $table->dropForeign('oauth_grant_scopes_client_id_foreign');
        });
        Schema::drop('oauth_client_metadata');
    }
}

<?php

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

class CreateOauthClientMetadataTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('oauth_client_metadata', function (Blueprint $table) {
            $table->increments('id');
            $table->string('client_id', 40);
            $table->string('key', 40);
            $table->string('value');
            $table->timestamps();

            $table->foreign('client_id')
                    ->references('id')->on('oauth_clients')
                    ->onDelete('cascade');

            $table->unique(array('client_id', 'key'), 'oauth_client_metadata_cid_key_unique');
            $table->index('client_id');

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('oauth_client_metadata', function ($table) {
            $table->dropForeign('oauth_client_metadata_client_id_foreign');
        });
        Schema::drop('oauth_client_metadata');
    }
}

Fix foreign key name for oauth_client_metadata rollback


<?php
// Jivoo
// Copyright (c) 2015 Niels Sonnich Poulsen (http://nielssp.dk)
// Licensed under the MIT license.
// See the LICENSE file or http://opensource.org/licenses/MIT for more information.
namespace Jivoo\Models\File;

/**
 * A directory record.
 */
class DirectoryRecord extends FileRecord {
  /**
   * {@inheritdoc}
   */
  public function __get($field) {
    if ($field == 'type')
      return 'directory';
    return parent::__get($field);
  }

  /**
   * {@inheritdoc}
   */
  public function getData() {
    $data = parent::getData();
    $data['type'] = 'directory';
    return $data;
  }

  /**
   * Get content of directory.
   * @return FileRecord[] List of file records.
   */
  public function getContent() {
    $files = scandir($this->path);
    if ($files === false)
      return array();
    $records = array();
    foreach ($files as $file) {
      if ($file[0] != '.') {
        $path = $this->path . '/' . $file;
        if (is_dir($path))
          $records[] = new DirectoryRecord($this->getModel(), $path);
        else
          $records[] = new FileRecord($this->getModel(), $path);
      }
    }
    return $records;
  }
}

<?php
// Jivoo
// Copyright (c) 2015 Niels Sonnich Poulsen (http://nielssp.dk)
// Licensed under the MIT license.
// See the LICENSE file or http://opensource.org/licenses/MIT for more information.
namespace Jivoo\Models\File;

/**
 * A directory record.
 */
class DirectoryRecord extends FileRecord {
  /**
   * {@inheritdoc}
   */
  public function __get($field) {
    if ($field == 'type')
      return 'directory';
    return parent::__get($field);
  }

  /**
   * {@inheritdoc}
   */
  public function getData() {
    $data = parent::getData();
    $data['type'] = 'directory';
    return $data;
  }

  /**
   * Get content of directory.
   * @return FileRecord[] List of file records.
   */
  public function getContent() {
    $files = scandir($this->path);
    if ($files === false)
      return array();
    $records = array();
    foreach ($files as $file) {
      if ($file[0] != '.') {
        $path = $this->path . '/' . $file;
        if (is_dir($path))
          $records[] = new DirectoryRecord($path);
        else
          $records[] = new FileRecord($path);
      }
    }
    return $records;
  }
}

Fix fetching files from directory record.


<?php namespace Fitztrev\LaravelHtmlMinify;

use Illuminate\Support\ServiceProvider;
use Illuminate\View\Engines\CompilerEngine;

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

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        $this->package('fitztrev/laravel-html-minify');
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $app = $this->app;
        $app->view->getEngineResolver()->register(
            'blade.php',
            function () use ($app) {
                    $cachePath = $app['path'].'/storage/views';
                    $compiler  = new LaravelHtmlMinifyCompiler(
                        $app->make('config')->get('laravel-html-minify::config'),
                        $app['files'],
                        $cachePath
                    );

                    return new CompilerEngine($compiler);
            }
        );
        $app->view->addExtension('blade.php', 'blade.php');
    }

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

}

<?php namespace Fitztrev\LaravelHtmlMinify;

use Illuminate\Support\ServiceProvider;
use Illuminate\View\Engines\CompilerEngine;

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

    /**
     * Bootstrap the application events.
     *
     * @return void
     */
    public function boot()
    {
        $this->package('fitztrev/laravel-html-minify');
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $app = $this->app;
        $app->view->getEngineResolver()->register(
            'blade.php',
            function () use ($app) {
                    $cachePath = storage_path() . '/views';
                    $compiler  = new LaravelHtmlMinifyCompiler(
                        $app->make('config')->get('laravel-html-minify::config'),
                        $app['files'],
                        $cachePath
                    );

                    return new CompilerEngine($compiler);
            }
        );
        $app->view->addExtension('blade.php', 'blade.php');
    }

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

}

Change the static mention of views cache path to the path on the configuration file


<?php

declare(strict_types=1);

namespace Phpml\Math\Statistic;

use Phpml\Exception\InvalidArgumentException;

class Mean
{
    /**
     * @param array $numbers
     *
     * @return float
     *
     * @throws InvalidArgumentException
     */
    public static function arithmetic(array $numbers)
    {
        self::checkArrayLength($numbers);

        return array_sum($numbers) / count($numbers);
    }

    /**
     * @param array $numbers
     *
     * @return float|mixed
     *
     * @throws InvalidArgumentException
     */
    public static function median(array $numbers)
    {
        self::checkArrayLength($numbers);

        $count = count($numbers);
        $middleIndex = floor($count / 2);
        sort($numbers, SORT_NUMERIC);
        $median = $numbers[$middleIndex];

        if (0 == $count % 2) {
            $median = ($median + $numbers[$middleIndex - 1]) / 2;
        }

        return $median;
    }

    /**
     * @param array $numbers
     *
     * @return mixed
     *
     * @throws InvalidArgumentException
     */
    public static function mode(array $numbers)
    {
        self::checkArrayLength($numbers);

        $values = array_count_values($numbers);

        return array_search(max($values), $values);
    }

    /**
     * @param array $array
     *
     * @throws InvalidArgumentException
     */
    private static function checkArrayLength(array $array)
    {
        if (0 == count($array)) {
            throw InvalidArgumentException::arrayCantBeEmpty();
        }
    }
}

<?php

declare(strict_types=1);

namespace Phpml\Math\Statistic;

use Phpml\Exception\InvalidArgumentException;

class Mean
{
    /**
     * @param array $numbers
     *
     * @return float
     *
     * @throws InvalidArgumentException
     */
    public static function arithmetic(array $numbers)
    {
        self::checkArrayLength($numbers);

        return array_sum($numbers) / count($numbers);
    }

    /**
     * @param array $numbers
     *
     * @return float|mixed
     *
     * @throws InvalidArgumentException
     */
    public static function median(array $numbers)
    {
        self::checkArrayLength($numbers);

        $count = count($numbers);
        $middleIndex = (int)floor($count / 2);
        sort($numbers, SORT_NUMERIC);
        $median = $numbers[$middleIndex];

        if (0 === $count % 2) {
            $median = ($median + $numbers[$middleIndex - 1]) / 2;
        }

        return $median;
    }

    /**
     * @param array $numbers
     *
     * @return mixed
     *
     * @throws InvalidArgumentException
     */
    public static function mode(array $numbers)
    {
        self::checkArrayLength($numbers);

        $values = array_count_values($numbers);

        return array_search(max($values), $values);
    }

    /**
     * @param array $array
     *
     * @throws InvalidArgumentException
     */
    private static function checkArrayLength(array $array)
    {
        if (0 == count($array)) {
            throw InvalidArgumentException::arrayCantBeEmpty();
        }
    }
}

Secure index access and type safe comparision in statistic median