<?php
/**
 * @file
 */

namespace CultuurNet\UDB3\Monolog;

use Monolog\Handler\AbstractProcessingHandler;
use Monolog\Logger;
use SocketIO\Emitter;

class SocketIOEmitterHandler extends AbstractProcessingHandler
{
    /**
     * @var Emitter
     */
    protected $emitter;

    /**
     * @param Emitter $emitter
     * @param integer $level  The minimum logging level at which this handler will be triggered
     * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
     */
    public function __construct(Emitter $emitter, $level = Logger::DEBUG, $bubble = true)
    {
        parent::__construct(
            $level,
            $bubble
        );

        $this->emitter = $emitter;
    }

    /**
     * {@inheritdoc}
     */
    protected function write(array $record)
    {
        $event = $record['formatted']['message'];
        $data = $record['formatted']['context'];

        $this->emitter->emit($event, $data);
    }
}

<?php
/**
 * @file
 */

namespace CultuurNet\UDB3\Monolog;

use Monolog\Formatter\FormatterInterface;
use Monolog\Formatter\NormalizerFormatter;
use Monolog\Handler\AbstractProcessingHandler;
use Monolog\Logger;
use SocketIO\Emitter;

class SocketIOEmitterHandler extends AbstractProcessingHandler
{
    /**
     * @var Emitter
     */
    protected $emitter;

    /**
     * @param Emitter $emitter
     * @param integer $level  The minimum logging level at which this handler will be triggered
     * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
     */
    public function __construct(Emitter $emitter, $level = Logger::DEBUG, $bubble = true)
    {
        parent::__construct(
            $level,
            $bubble
        );

        $this->emitter = $emitter;
    }

    /**
     * {@inheritdoc}
     */
    protected function write(array $record)
    {
        $event = $record['formatted']['message'];
        $data = $record['formatted']['context'];

        $this->emitter->emit($event, $data);
    }

    /**
     * @inheritdoc
     */
    protected function getDefaultFormatter()
    {
        return new NormalizerFormatter();
    }
}

Use formatted log values instead of raw values when emitting to Socket.io, to avoid errors when exceptions are thrown and Socket.io tries to pack them


<?php
/**
 * @copyright Copyright (c) 2016 Morris Jobke <hey@morrisjobke.de>
 *
 * @license GNU AGPL version 3 or any later version
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

return [
	'routes' => [
		['name' => 'requestTime#getTimezones', 'url' => '/timezones', 'verb' => 'GET'],
	],
	'ocs-resources' => [
		'global_workflows' => ['url' => '/api/v1/workflows/global'],
	],
];

<?php
/**
 * @copyright Copyright (c) 2016 Morris Jobke <hey@morrisjobke.de>
 *
 * @license GNU AGPL version 3 or any later version
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

return [
	'routes' => [
		['name' => 'requestTime#getTimezones', 'url' => '/timezones', 'verb' => 'GET'],
	],
	'ocs-resources' => [
		'global_workflows' => ['url' => '/api/v1/workflows/global'],
		'user_workflows' => ['url' => '/api/v1/workflows/user'],
	],
];

Add missing ocs resource for user workflows

Signed-off-by: Julius Härtl <bf353fa4999f2f148afcc6d8ee6cb1ee74cc07c3@bitgrid.net>


	<?php foreach ($ingredients as $key => $ingredient) { ?>
		<?php foreach ($ingredient['secondary'] as $secondary) { ?>

<?php echo $ingredient['name']; ?> + <?php echo $secondary['name']; ?>

						Ingredients
						Price

					<?php foreach ($secondary['tertiary'] as $tertiary) { ?>

								<?php echo $tertiary['name']; ?>

								<?php echo $tertiary['price']; ?>

					<?php } ?>

		<?php } ?>

			<a href="<?php echo site_url('/ingredients/matrix/'.($page+1).'/'.$generate); ?>">More Ingredients

	<?php } ?>

	<?php foreach ($ingredients as $key => $ingredient) { ?>
		<?php foreach ($ingredient['secondary'] as $secondary) { ?>

<?php echo $ingredient['name']; ?> + <?php echo $secondary['name']; ?>

						Ingredients
						Price

					<?php foreach ($secondary['tertiary'] as $tertiary) { ?>

								<?php echo $tertiary['name']; ?>

								<?php echo $tertiary['price']; ?>

					<?php } ?>

		<?php } ?>
	<?php } ?>

		<a href="<?php echo site_url('/ingredients/matrix/'.($page+1).'/'.$generate); ?>">More Ingredients

Remove more ingredients from primary ingredient loop


<?php

/*
	Plugin Name: WP Sentry
	Plugin URI: http://git.alboweb.nl/devalex/wp-sentry
	Description: Send all exceptions & errors to an external tracker, tracks on the PHP and JavaScript side.
	Version: 1.0
	Author: Alex Bouma
	Author URI: https://alexbouma.me
	License: MIT
*/

// Define the base directory for easy access to any libs
define( 'WP_SENTRY_DIR', __DIR__ );

// Define the application version
define( 'WP_SENTRY_VERSION', ( defined( 'WP_SENTRY_VERSION' ) ) ? WP_SENTRY_VERION : get_bloginfo( 'version' ) );

// Load the PHP tracker if we have a private DSN
if ( defined( 'WP_SENTRY_DSN' ) && ! empty( WP_SENTRY_DSN ) ) {
	require_once __DIR__ . '/trackers/php/tracker.php';
}

// Load the JS tracker if we have a public DSN
if ( defined( 'WP_SENTRY_PUBLIC_DSN' ) || ! empty( WP_SENTRY_PUBLIC_DSN ) ) {
	require_once __DIR__ . '/trackers/js/tracker.php';
}

<?php

/*
	Plugin Name: WP Sentry
	Plugin URI: http://git.alboweb.nl/devalex/wp-sentry
	Description: Send all exceptions & errors to an external tracker, tracks on the PHP and JavaScript side.
	Version: 1.0
	Author: Alex Bouma
	Author URI: https://alexbouma.me
	License: MIT
*/

// Define the base directory for easy access to any libs
define( 'WP_SENTRY_DIR', __DIR__ );

// Define the application version
define( 'WP_SENTRY_VERSION', ( defined( 'WP_SENTRY_VERSION' ) ) ? WP_SENTRY_VERION : wp_get_theme()->get( 'Version' ); );

// Load the PHP tracker if we have a private DSN
if ( defined( 'WP_SENTRY_DSN' ) && ! empty( WP_SENTRY_DSN ) ) {
	require_once __DIR__ . '/trackers/php/tracker.php';
}

// Load the JS tracker if we have a public DSN
if ( defined( 'WP_SENTRY_PUBLIC_DSN' ) || ! empty( WP_SENTRY_PUBLIC_DSN ) ) {
	require_once __DIR__ . '/trackers/js/tracker.php';
}

Fix using the WordPress version instead of the theme version


<?php

define('HASH_PATH_RELATIVE_PATH', basename(dirname(__FILE__)));

Object::add_extension('ContentController', 'HashPathExtension');

<?php

if (file_exists(__DIR__ . '../vendor/autoload.php')) {
    require_once __DIR__ . '../vendor/autoload.php';
}

define('HASH_PATH_RELATIVE_PATH', basename(dirname(__FILE__)));

Object::add_extension('ContentController', 'HashPathExtension');

MINOR: Include SS autoloader for use in test cases


<?php
/*
Section: global
Language: Traditional Chinese 繁體中文
Translator: Trey Lin
*/

$translations = array(
    'sitetitle1' => 'db4free.net',

    'sitetitle2' => '免費的 MySQL 資料庫',

    'topnav1' => '歡迎',

    'topnav2' => '資料庫',

    'topnav3' => 'Twitter',

    'topnav4' => 'mpopp.net blog',

    'topnav5' => 'phpMyAdmin',

    'sidebar_1_2' => '捐獻',

    'sidebar_1_3' => '翻譯',

    'sidebar_1_4' => '更新記錄',

    'sidebar_1_5' => '版權說明',

    'sidebar_2_1' => '關於 db4free.net',

    'sidebar_2_2' => '使用規範',

    'sidebar_2_3' => '註冊',

    'sidebar_2_4' => '更改密碼',

    'sidebar_2_5' => '刪除帳號',

    'sidebar_2_6' => '忘記密碼？',

    'pmalogin' => '登入phpMyAdmin',

    'username' => '使用者名稱',

    'password' => '使用者密碼',

    'login' => '登入',
);
?>

<?php
/*
Section: global
Language: Traditional Chinese 繁體中文
Translator: Trey Lin
*/

$translations = array(
    'sitetitle1' => 'db4free.net',

    'sitetitle2' => '免費的 MySQL 資料庫',

    'topnav1' => '歡迎',

    'topnav2' => '資料庫',

    'topnav3' => 'Twitter',

    'topnav4' => 'mpopp.net blog',

    'topnav5' => 'phpMyAdmin',

    'sidebar_1_2' => '捐獻',

    'sidebar_1_3' => '翻譯',

    'sidebar_1_4' => '更新記錄',

    'sidebar_1_5' => '版權說明',

    'sidebar_2_1' => '關於 db4free.net',

    'sidebar_2_2' => '使用規範',

    'sidebar_2_3' => '註冊',

    'sidebar_2_4' => '更改密碼',

    'sidebar_2_5' => '刪除帳號',

    'sidebar_2_6' => '忘記密碼？',

    'pmalogin' => '登入phpMyAdmin',

    'username' => '使用者名稱',

    'password' => '使用者密碼',

    'login' => '登入',

    'switch_language' => '切換語言',
);
?>

Add zh-tw translation for "Switch language"


<?php namespace Anomaly\VariablesModule\Group\Form;

use Anomaly\Streams\Platform\Stream\Form\StreamFormBuilder;

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

    /**
     * The stream prefix.
     *
     * @var string
     */
    protected $prefix = 'variables_';

    /**
     * The stream namespace.
     *
     * @var string
     */
    protected $namespace = 'variables';

    /**
     * The skipped fields.
     *
     * @var array
     */
    protected $skips = [
        'title_column',
        'trashable',
        'sortable',
    ];
}

<?php namespace Anomaly\VariablesModule\Group\Form;

use Anomaly\Streams\Platform\Stream\Form\StreamFormBuilder;

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

    /**
     * The stream prefix.
     *
     * @var string
     */
    protected $prefix = 'variables_';

    /**
     * The stream namespace.
     *
     * @var string
     */
    protected $namespace = 'variables';

    /**
     * The skipped fields.
     *
     * @var array
     */
    protected $skips = [
        'title_column',
        'searchable',
        'trashable',
        'sortable',
        'config',
    ];
}

Fix form - shouldnt have any of that junk in there.


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

namespace OCA\OcSms\AppInfo;

\OCP\App::addNavigationEntry(array(
    // the string under which your app will be referenced in owncloud
    'id' => 'ocsms',

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

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

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

    // the title of your application. This will be used in the
    // navigation or on the settings page of your app
    'name' => \OCP\Util::getL10N('ocsms')->t('Oc Sms')
));

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

namespace OCA\OcSms\AppInfo;

\OCP\App::addNavigationEntry(array(
    // the string under which your app will be referenced in owncloud
    'id' => 'ocsms',

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

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

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

    // the title of your application. This will be used in the
    // navigation or on the settings page of your app
    'name' => \OCP\Util::getL10N('ocsms')->t('SMS')
));

Change from Oc Sms ---> SMS

Change from Oc Sms ---> SMS

Looks cleaner and more like the design.


<?php
// get page thumbnail image if it is a page
if ( is_home() ) {
    $bg     = mbtheme_get_option( 'header-bg-blog', array() );
    $bg_url = $bg[ 'url' ];
} elseif ( is_page() ) {
    $page_id = get_queried_object_id();
    $bg_url  = get_the_post_thumbnail_url( $page_id, 'full' );
}

// get default backgound image
if ( !$bg_url ) {
    $bg     = mbtheme_get_option( 'header-bg-default', array() );
    $bg_url = $bg[ 'url' ];
}

// set bg style
$bg_style = ($bg_url) ? 'background-image: url("' . esc_url( $bg_url ) . '")' : '';
?>
<div class="site-header" style="<?php echo esc_attr( $bg_style ); ?>">

        <?php do_action( 'mbtheme_site_header_inner' ); ?>

<?php
// get page thumbnail image if it is a page
$bg_url = '';
if ( is_home() ) {
    $bg     = mbtheme_get_option( 'header-bg-blog', array() );
    $bg_url = $bg[ 'url' ];
} elseif ( is_page() ) {
    $page_id = get_queried_object_id();
    $bg_url  = get_the_post_thumbnail_url( $page_id, 'full' );
}

// get default backgound image
if ( !$bg_url ) {
    $bg     = mbtheme_get_option( 'header-bg-default', array() );
    $bg_url = $bg[ 'url' ];
}

// set bg style
$bg_style = ($bg_url) ? 'background-image: url("' . esc_url( $bg_url ) . '")' : '';
?>
<div class="site-header" style="<?php echo esc_attr( $bg_style ); ?>">

        <?php do_action( 'mbtheme_site_header_inner' ); ?>

Define $bg_url variable for header

Define $bg_url variable for header


<?php

namespace Stripe;

class BankAccountTest extends TestCase
{
    public function testVerify()
    {
        self::authorizeFromEnv();

        $customer = self::createTestCustomer();

        $bankAccount = $customer->sources->create(array(
            'source' => array(
                'object' => 'bank_account',
                'account_holder_type' => 'individual',
                'account_number' => '000123456789',
                'name' => 'John Doe',
                'routing_number' => '110000000',
                'country' => 'US'
            )
        ));

        $this->assertSame($bankAccount->status, 'new');

        $bankAccount = $bankAccount->verify(array(
            'amounts' => array(32, 45)
        ));

        $this->assertSame($bankAccount->status, 'verified');
    }
}

<?php

namespace Stripe;

class BankAccountTest extends TestCase
{
    public function testVerify()
    {
        self::authorizeFromEnv();

        $customer = self::createTestCustomer();

        $bankAccount = $customer->sources->create(array(
            'source' => array(
                'object' => 'bank_account',
                'account_holder_type' => 'individual',
                'account_number' => '000123456789',
                'account_holder_name' => 'John Doe',
                'routing_number' => '110000000',
                'country' => 'US'
            )
        ));

        $this->assertSame($bankAccount->status, 'new');

        $bankAccount = $bankAccount->verify(array(
            'amounts' => array(32, 45)
        ));

        $this->assertSame($bankAccount->status, 'verified');
    }
}

Fix broken test due to version update

Fix broken test due to version update


<?php

namespace Koseu\Core;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

use \Tsugi\Core\LTIX;

class Application extends \Tsugi\Silex\Application {

    public function __construct($launch)
    {
        // $app = new \Tsugi\Silex\Application($launch);
        parent::__construct($launch);
        $this['tsugi']->output->buffer = false;

        $P7 = strpos(phpversion(), '7') === 0;
        if ( !$P7 ) return false;

        $this->error(function (NotFoundHttpException $e, Request $request, $code) {
            global $CFG, $LAUNCH, $OUTPUT, $USER, $CONTEXT, $LINK, $RESULT;

            return $this['twig']->render('@Tsugi/Error.twig',
                array('error' => '
Page not found.
')
            );
        });

        // Hook up the Koseu and Tsugi tools
        \Tsugi\Controllers\Login::routes($this);
        \Tsugi\Controllers\Logout::routes($this);
        \Tsugi\Controllers\Profile::routes($this);
        \Tsugi\Controllers\Map::routes($this);
        \Koseu\Controllers\Badges::routes($this);
        \Koseu\Controllers\Assignments::routes($this);
        \Koseu\Controllers\Lessons::routes($this);
        \Koseu\Controllers\Courses::routes($this);
    }
}

<?php

namespace Koseu\Core;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

use \Tsugi\Core\LTIX;

class Application extends \Tsugi\Silex\Application {

    public function __construct($launch)
    {
        // $app = new \Tsugi\Silex\Application($launch);
        parent::__construct($launch);
        $this['tsugi']->output->buffer = false;

        $P7 = strpos(phpversion(), '7') === 0;

        // Some controllers work in PHP 5
        if ( !$P7 ) {
            \Tsugi\Controllers\Login::routes($this);
            \Tsugi\Controllers\Logout::routes($this);
            \Koseu\Controllers\Courses::routes($this);
            return false;
        }

        $this->error(function (NotFoundHttpException $e, Request $request, $code) {
            global $CFG, $LAUNCH, $OUTPUT, $USER, $CONTEXT, $LINK, $RESULT;

            return $this['twig']->render('@Tsugi/Error.twig',
                array('error' => '
Page not found.
')
            );
        });

        // Hook up the Koseu and Tsugi tools
        \Tsugi\Controllers\Login::routes($this);
        \Tsugi\Controllers\Logout::routes($this);
        \Tsugi\Controllers\Profile::routes($this);
        \Tsugi\Controllers\Map::routes($this);
        \Koseu\Controllers\Badges::routes($this);
        \Koseu\Controllers\Assignments::routes($this);
        \Koseu\Controllers\Lessons::routes($this);
        \Koseu\Controllers\Courses::routes($this);
    }
}

Add a few routes for PHP 5

Add a few routes for PHP 5


<?php
/*
 * This file is part of pmg/three-repositories
 *
 * Copyright (c) PMG <https://www.pmg.com>
 *
 * For full copyright information see the LICENSE file distributed
 * with this source code.
 *
 * @license     http://opensource.org/licenses/MIT MIT
 */

namespace PMG\ThreeRepositories;

/**
 * An implementation of articles that's just private properties and the
 * interface implementation.
 *
 * @since   0.1
 */
class SimpleArticle implements Article
{
    private $id;
    private $title;
    private $body;
    private $year;

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

    public function getIdentifier()
    {
        return $this->id;
    }

    public function getTitle()
    {
        return $this->title;
    }

    public function setTitle($title)
    {
        $this->title = $title;
    }

    public function getBody()
    {
        return $this->body;
    }

    public function setBody($body)
    {
        $this->body = $body;
    }

    public function getYear()
    {
        return $this->year;
    }

    public function setYear($year)
    {
        $this->year = $year;
    }
}

<?php
/*
 * This file is part of pmg/three-repositories
 *
 * Copyright (c) PMG <https://www.pmg.com>
 *
 * For full copyright information see the LICENSE file distributed
 * with this source code.
 *
 * @license     http://opensource.org/licenses/MIT MIT
 */

namespace PMG\ThreeRepositories;

/**
 * An implementation of articles that's just private properties and the
 * interface implementation.
 *
 * @since   0.1
 */
class SimpleArticle implements Article
{
    private $id;
    private $title;
    private $body;
    private $year;

    public function __construct($id=null)
    {
        $this->id = null === $id ? $id : intval($id);
    }

    public function getIdentifier()
    {
        return $this->id;
    }

    public function getTitle()
    {
        return $this->title;
    }

    public function setTitle($title)
    {
        $this->title = $title;
    }

    public function getBody()
    {
        return $this->body;
    }

    public function setBody($body)
    {
        $this->body = $body;
    }

    public function getYear()
    {
        return $this->year;
    }

    public function setYear($year)
    {
        $this->year = $year;
    }
}

Make Sure the Article ID is an Integer

Make Sure the Article ID is an Integer


<?php

namespace allejo\stakx\Twig;

use allejo\stakx\Object\ContentItem;

class OrderFilter
{
    public function __invoke ($array, $key, $order = "ASC")
    {
        if (!is_array($array))
        {
            return $array;
        }

        usort($array, function ($a, $b) use ($key, $order)
        {
            $a = ($a instanceof ContentItem) ? $a->getFrontMatter() : $a;
            $b = ($b instanceof ContentItem) ? $b->getFrontMatter() : $b;

            if ($a[$key] == $b[$key])
            {
                return 0;
            }

            if (strtolower($order) === "desc")
            {
                return ($a[$key] < $b[$key]) ? 1 : -1;
            }

            return ($a[$key] > $b[$key]) ? 1 : -1;
        });

        return $array;
    }

    public static function get ()
    {
        return new \Twig_SimpleFilter('order', new self());
    }
}

<?php

namespace allejo\stakx\Twig;

use allejo\stakx\Object\FrontMatterObject;

class OrderFilter
{
    public function __invoke ($array, $key, $order = "ASC")
    {
        if (!is_array($array))
        {
            return $array;
        }

        usort($array, function ($a, $b) use ($key, $order)
        {
            $a = ($a instanceof FrontMatterObject) ? $a->getFrontMatter() : $a;
            $b = ($b instanceof FrontMatterObject) ? $b->getFrontMatter() : $b;

            if ($a[$key] == $b[$key])
            {
                return 0;
            }

            if (strtolower($order) === "desc")
            {
                return ($a[$key] < $b[$key]) ? 1 : -1;
            }

            return ($a[$key] > $b[$key]) ? 1 : -1;
        });

        return $array;
    }

    public static function get ()
    {
        return new \Twig_SimpleFilter('order', new self());
    }
}

Fix order filter to work with PageViews

Fix order filter to work with PageViews


<?php
if (is_single() || is_home()){
    the_date('F j, Y', '
', '
');
}
?>

<?php the_title() ?>

<?php
if ((is_single() || is_home()) && get_option('show_byline_on_posts')) :
?>

    <?php the_author(); ?>

 <?php the_author_meta(); ?>

<?php
endif;
  if ( ! is_home() && ! is_search() && ! is_archive() ) :
    uw_mobile_menu();
  endif;

?>

<?php

  if ( is_archive() || is_home() ) {
    the_post_thumbnail( array(130, 130), array( 'class' => 'attachment-post-thumbnail blogroll-img' ) );
    the_content();
    echo "
";
  } else
    the_content();
    //comments_template(true);
 ?>

<?php echo "" ?>

<?php
if (is_single() || is_home()){
    the_date('F j, Y', '
', '
');
}
?>

<?php the_title() ?>

<?php
if ((is_single() || is_home()) && get_option('show_byline_on_posts')) :
?>

    <?php the_author(); ?>

 <?php the_author_meta(); ?>

<?php
endif;
  if ( ! is_home() && ! is_search() && ! is_archive() ) :
    uw_mobile_menu();
  endif;

?>

<?php

  if ( is_archive() || is_home() || is_single() ) {
    the_post_thumbnail( array(130, 130), array( 'class' => 'attachment-post-thumbnail blogroll-img' ) );
    the_content();
    echo "
";
  } else
    the_content();
    //comments_template(true);
 ?>

Add si_single to conditional controlling display of featured image


<?php

$loader = new Twig_Loader_Filesystem(__DIR__ . DIRECTORY_SEPARATOR . 'templates');
$twig = new Twig_Environment($loader);
if (getenv('TEMPLATE_CACHE_ENABLED') && getenv('TEMPLATE_CACHE_ENABLED') === 'true') {
    $twig->setCache(__DIR__ . DIRECTORY_SEPARATOR . 'cache');
}
if (getenv('GOOGLE_ANALYTICS_ID')) {
    $twig->addGlobal('google_analytics_id', getenv('GOOGLE_ANALYTICS_ID'));
}
$twig->addExtension(new Twig_Extension_Debug());

<?php

$loader = new Twig_Loader_Filesystem(__DIR__ . DIRECTORY_SEPARATOR . 'templates');
$twig = new Twig_Environment($loader, ['debug' => true]);
if (getenv('TEMPLATE_CACHE_ENABLED') && getenv('TEMPLATE_CACHE_ENABLED') === 'true') {
    $twig->setCache(__DIR__ . DIRECTORY_SEPARATOR . 'cache');
}
if (getenv('GOOGLE_ANALYTICS_ID')) {
    $twig->addGlobal('google_analytics_id', getenv('GOOGLE_ANALYTICS_ID'));
}
$twig->addExtension(new Twig_Extension_Debug());

Revert template change so that the live snippets work


<?php
namespace Hostnet\Bundle\EntityTrackerBundle\Services\Blamable;

use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;

/**
 * @covers Hostnet\Bundle\EntityTrackerBundle\Services\Blamable\DefaultBlamableProvider
 * @author Eunice Valdez <evaldez@hostnet.nl>
 */
class DefaultBlamableProviderTest extends \PHPUnit_Framework_TestCase
{
    private $token_storage;

    protected function setUp()
    {
        $this->token_storage = $this->getMock(TokenStorageInterface::class);
    }

    public function testGetters()
    {
        $blamable_provider = new DefaultBlamableProvider($this->token_storage, "provided_user");
        $this->assertEquals("provided_user", $blamable_provider->getUpdatedBy());

        $token = new UsernamePasswordToken("phpunit", "hostnet", "thisisakey");
        $this->token_storage->expects($this->once())->method("getToken")->willReturn($token);
        $this->assertEquals("phpunit", $blamable_provider->getUpdatedBy());
        $this->assertInstanceOf('\DateTime', $blamable_provider->getChangedAt());
    }
}

<?php
namespace Hostnet\Bundle\EntityTrackerBundle\Services\Blamable;

use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;

/**
 * @covers Hostnet\Bundle\EntityTrackerBundle\Services\Blamable\DefaultBlamableProvider
 * @author Eunice Valdez <evaldez@hostnet.nl>
 */
class DefaultBlamableProviderTest extends \PHPUnit_Framework_TestCase
{
    private $token_storage;

    protected function setUp()
    {
        $this->token_storage = $this->getMock(
            'Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface');
    }

    public function testGetters()
    {
        $blamable_provider = new DefaultBlamableProvider($this->token_storage, "provided_user");
        $this->assertEquals("provided_user", $blamable_provider->getUpdatedBy());

        $token = new UsernamePasswordToken("phpunit", "hostnet", "thisisakey");
        $this->token_storage->expects($this->once())->method("getToken")->willReturn($token);
        $this->assertEquals("phpunit", $blamable_provider->getUpdatedBy());
        $this->assertInstanceOf('\DateTime', $blamable_provider->getChangedAt());
    }
}

Use the Fully Qualified Namespace

Use the Fully Qualified Namespace


<?php

namespace Laracasts\Integrated;

use Laracasts\Integrated\Str;
use ReflectionClass;

class AnnotationReader
{
    /**
     * Create a new AnnotationReader instance.
     *
     * @param mixed $reference
     */
    public function __construct($reference)
    {
        $this->reference = $reference;
    }

    /**
     * Get method names for the referenced object
     * which contain the given annotation.
     *
     * @param  string $annotation
     * @return array
     */
    public function having($annotation)
    {
        $methods = [];

        foreach ($this->getTraits() as $trait) {
            foreach ($trait->getMethods() as $method) {
                if (Str::contains($method->getDocComment(), "@{$annotation}")) {
                    $methods[] = $method->getName();
                }
            }
        }

        return $methods;
    }

    /**
     * Load any user-created traits for the current object.
     *
     * @return ReflectionClass
     */
    protected function getTraits()
    {
        return (new ReflectionClass($this->reference))->getTraits();
    }
}

<?php

namespace Laracasts\Integrated;

use Laracasts\Integrated\Str;
use ReflectionClass;

class AnnotationReader
{
    /**
     * Create a new AnnotationReader instance.
     *
     * @param mixed $reference
     */
    public function __construct($reference)
    {
        $this->reference = $reference;
    }

    /**
     * Get method names for the referenced object
     * which contain the given annotation.
     *
     * @param  string $annotation
     * @return array
     */
    public function having($annotation)
    {
        $methods = [];

        foreach ($this->reflectInto($this->reference) as $method) {
            if ($this->hasAnnotation($annotation, $method)) {
                $methods[] = $method->getName();
            }
        }

        return $methods;
    }

    /**
     * Load any user-created traits for the current object.
     *
     * @param  object $object
     * @return ReflectionClass
     */
    protected function reflectInto($object)
    {
        return (new ReflectionClass($object))->getMethods();
    }

    /**
     * Search the docblock for the given annotation.
     *
     * @param  string            $annotation
     * @param  \ReflectionMethod $method
     * @return boolean
     */
    protected function hasAnnotation($annotation, \ReflectionMethod $method)
    {
        return Str::contains($method->getDocComment(), "@{$annotation}");
    }

}

Fix thing where methods sometimes aren't found in subclasses


<?php

namespace Gloomy\PagerBundle\DataGrid;

use Gloomy\PagerBundle\Pager\Wrapper;

class DataGrid
{
    protected $_request;

    protected $_router;

    protected $_pager;

    protected $_config;

    protected $_title;

    public function __construct($request, $router, $pager, array $config = array(), $title = '')
    {
        $this->_request   = $request;
        $this->_router    = $router;
        $this->_pager     = $pager;
        $this->_config    = $config;
        $this->_title     = $title;
    }

    public function getPager()
    {
        return $this->_pager;
    }

    public function getFields()
    {
        $fields = array();
        foreach ($this->getPager()->getFields() as $alias => $field) {
            if ($field->isVisible()) {
                $fields[$alias] = $field;
            }
        }
        return $fields;
    }

    public function getItems()
    {
        return $this->getPager()->getItems();
    }

    public function path($page = null, array $parameters = array())
    {
        return $this->getPager()->path($page, $parameters);
    }

    public function setTitle($title)
    {
        $this->_title = $title;
        return $this;
    }

    public function getTitle()
    {
        return $this->_title;
    }
}

<?php

namespace Gloomy\PagerBundle\DataGrid;

use Gloomy\PagerBundle\Pager\Wrapper;

class DataGrid
{
    protected $_request;

    protected $_router;

    protected $_pager;

    protected $_config;

    protected $_title;

    public function __construct($request, $router, $pager, array $config = array(), $title = '')
    {
        $this->_request   = $request;
        $this->_router    = $router;
        $this->_pager     = $pager;
        $this->_config    = $config;
        $this->_title     = $title;
    }

    public function getPager()
    {
        return $this->_pager;
    }

    public function getFields($all = false)
    {
        $fields = array();
        foreach ($this->getPager()->getFields() as $alias => $field) {
            if ($all || $field->isVisible()) {
                $fields[$alias] = $field;
            }
        }
        return $fields;
    }

    public function getItems()
    {
        return $this->getPager()->getItems();
    }

    public function path($page = null, array $parameters = array())
    {
        return $this->getPager()->path($page, $parameters);
    }

    public function setTitle($title)
    {
        $this->_title = $title;
        return $this;
    }

    public function getTitle()
    {
        return $this->_title;
    }
}

Add an option to retrieve all fields, not only visible


@extends('crudapi::layouts.master')

@section('content')

{{ $model }}

        @foreach($fields as $f)
            {{ ucfirst($f) }}
        @endforeach
        Created At
        Updated At

        @if(isset($items))
            @foreach($items as $item)

                @foreach($fields as $f)
                    {{ $item->$f }}
                @endforeach
                    {{ $item->created_at }}
                    {{ $item->updated_at }}

            @endforeach
        @endif

@stop

@extends('crudapi::layouts.master')

@section('content')

{{ $model }}

        @foreach($fields as $f)
            {{ ucfirst($f) }}
        @endforeach
        Created At
        Updated At
        Actions

        @if(isset($items))
            @foreach($items as $item)

                @foreach($fields as $f)
                    {{ $item->$f }}
                @endforeach
                    {{ $item->created_at }}
                    {{ $item->updated_at }}
                    <button class="btn btn-info">Edit</button> <button class="btn btn-danger">Delete</button>

            @endforeach
        @endif

@stop

Add placeholder buttons for actions (edit, delete)


<?php
namespace MapasCulturais\Entities;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\entity(repositoryClass="MapasCulturais\Repository")
 */
class EvaluationMethodConfigurationAgentRelation extends AgentRelation {
    const STATUS_SENT = 10;

    /**
     * @var \MapasCulturais\Entities\EvaluationMethodConfiguration
     *
     * @ORM\ManyToOne(targetEntity="MapasCulturais\Entities\EvaluationMethodConfiguration")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="object_id", referencedColumnName="id", onDelete="CASCADE")
     * })
     */
    protected $owner;

    function delete($flush = false) {
        $evaluations = \MapasCulturais\App::i()->repo('RegistrationEvaluation')->findByOpportunityAndUser($this->owner->opportunity, $this->agent->user);
        foreach($evaluations as $eval){
            $eval->delete($flush);
        }
        $this->owner->opportunity->enqueueToPCacheRecreation();
        parent::delete($flush);
    }

    function reopen($flush = true){
        $this->owner->opportunity->checkPermission('reopenValuerEvaluations');

        $this->status = self::STATUS_ENABLED;

        $this->save($flush);
    }

    protected function canUserRemove($user) {
        return $this->owner->opportunity->canUser('@control');
    }

    protected function canUserCreate($user) {
        return $this->owner->opportunity->canUser('@control');
    }
}

<?php
namespace MapasCulturais\Entities;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\entity(repositoryClass="MapasCulturais\Repository")
 */
class EvaluationMethodConfigurationAgentRelation extends AgentRelation {
    const STATUS_SENT = 10;

    /**
     * @var \MapasCulturais\Entities\EvaluationMethodConfiguration
     *
     * @ORM\ManyToOne(targetEntity="MapasCulturais\Entities\EvaluationMethodConfiguration")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="object_id", referencedColumnName="id", onDelete="CASCADE")
     * })
     */
    protected $owner;

    function delete($flush = false) {
        $evaluations = \MapasCulturais\App::i()->repo('RegistrationEvaluation')->findByOpportunityAndUser($this->owner->opportunity, $this->agent->user);
        foreach($evaluations as $eval){
            $eval->delete($flush);
        }
        $this->owner->opportunity->enqueueToPCacheRecreation();
        parent::delete($flush);
    }

    function reopen($flush = true){
        $this->owner->opportunity->checkPermission('reopenValuerEvaluations');

        $this->status = self::STATUS_ENABLED;

        $this->save($flush);
    }
}

Revert "modifica permissão de criação e deleção de avaliadores para permitir gerentes colocarem avaliadores sem a necessidade de aprovação pelo avaliador"

This reverts commit c6f23dcfd0bd2308a2b612741da5e9158e2a707b.


<?php

class Project extends Eloquent {

	protected $fillable = ['title', 'slug'];

	public function sprints()
	{
		return $this->hasMany('Sprint')->orderBy('sprint_start', 'desc');
	}

	public function currentSprint()
	{
		return Sprint::where('sprint_start', '<=', date('Y-m-d'))
			->where('project_id', $this->id)
			->orderBy('sprint_start', 'desc')
			->first();
	}
}

<?php

class Project extends Eloquent {

	protected $fillable = ['title', 'slug'];

	public function sprints()
	{
		return $this->hasMany('Sprint')->orderBy('sprint_start', 'desc');
	}

	public function currentSprint()
	{
		return $this->newestPastSprint() ?: $this->closestFutureSprint();
	}

	private function newestPastSprint()
	{
		return Sprint::where('sprint_start', '<=', date('Y-m-d'))
			->where('project_id', $this->id)
			->orderBy('sprint_start', 'desc')
			->first();
	}

	private function closestFutureSprint()
	{
		return Sprint::where('sprint_start', '>', date('Y-m-d'))
			->where('project_id', $this->id)
			->orderBy('sprint_start', 'asc')
			->first();
	}
}

Make sure current sprint returns something if there are sprints for the project.


<?php
namespace App\Entity\Fixture;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use App\Entity;

class RolePermission extends AbstractFixture implements DependentFixtureInterface
{
    public function load(ObjectManager $em)
    {
        $permissions = [
            'admin_role' => [
                'administer all',
            ],
            'demo_role' => [
                'administer api keys',
                'administer stations',
                'view administration',
            ],
        ];

        foreach($permissions as $role_reference => $perm_names) {
            /** @var Entity\Role $role */
            $role = $this->getReference($role_reference);

            foreach($perm_names as $perm_name) {
                $rp = new Entity\RolePermission($role);
                $rp->setActionName($perm_name);
                $em->persist($rp);
            }
        }

        $em->flush();
    }

    public function getDependencies()
    {
        return [
            Role::class
        ];
    }
}

<?php
namespace App\Entity\Fixture;

use App\Acl;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use App\Entity;

class RolePermission extends AbstractFixture implements DependentFixtureInterface
{
    public function load(ObjectManager $em)
    {
        /** @var Entity\Station $station */
        $station = $this->getReference('station');

        $permissions = [
            'admin_role' => [
                [Acl::GLOBAL_ALL, null],
            ],
            'demo_role' => [
                [Acl::STATION_ALL, $station],
                [Acl::STATION_VIEW, $station],
            ],
        ];

        foreach($permissions as $role_reference => $perm_names) {
            /** @var Entity\Role $role */
            $role = $this->getReference($role_reference);

            foreach($perm_names as $perm_name) {
                $rp = new Entity\RolePermission($role, $perm_name[1], $perm_name[0]);
                $em->persist($rp);
            }
        }

        $em->flush();
    }

    public function getDependencies()
    {
        return [
            Role::class
        ];
    }
}

Disable station administrator role for demo account.


<?php

declare(strict_types=1);

namespace Rinvex\Auth\Providers;

use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
use Rinvex\Support\Traits\ConsoleTools;
use Rinvex\Auth\Console\Commands\PublishCommand;
use Rinvex\Auth\Services\PasswordResetBrokerManager;
use Rinvex\Auth\Services\EmailVerificationBrokerManager;

class AuthServiceProvider extends ServiceProvider
{
    use ConsoleTools;

    /**
     * The commands to be registered.
     *
     * @var array
     */
    protected $commands = [
        PublishCommand::class => 'command.rinvex.auth.publish',
    ];

    /**
     * {@inheritdoc}
     */
    public function register()
    {
        // Merge config
        $this->mergeConfigFrom(realpath(__DIR__.'/../../config/config.php'), 'rinvex.auth');

        // Register console commands
        $this->registerCommands();

        // Register the password reset broker manager
        $this->app->singleton('auth.password', function ($app) {
            return new PasswordResetBrokerManager($app);
        });

        // Register the verification broker manager
        $this->app->singleton('rinvex.auth.emailverification', function ($app) {
            return new EmailVerificationBrokerManager($app);
        });
    }

    /**
     * {@inheritdoc}
     */
    public function boot(Router $router)
    {
        // Publish resources
        $this->publishesConfig('rinvex/laravel-auth');
    }
}

<?php

declare(strict_types=1);

namespace Rinvex\Auth\Providers;

use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
use Rinvex\Support\Traits\ConsoleTools;
use Rinvex\Auth\Console\Commands\PublishCommand;
use Rinvex\Auth\Services\PasswordResetBrokerManager;
use Rinvex\Auth\Services\EmailVerificationBrokerManager;

class AuthServiceProvider extends ServiceProvider
{
    use ConsoleTools;

    /**
     * The commands to be registered.
     *
     * @var array
     */
    protected $commands = [
        PublishCommand::class => 'command.rinvex.auth.publish',
    ];

    /**
     * {@inheritdoc}
     */
    public function register()
    {
        // Merge config
        $this->mergeConfigFrom(realpath(__DIR__.'/../../config/config.php'), 'rinvex.auth');

        // Register console commands
        $this->registerCommands($this->commands);

        // Register the password reset broker manager
        $this->app->singleton('auth.password', function ($app) {
            return new PasswordResetBrokerManager($app);
        });

        // Register the verification broker manager
        $this->app->singleton('rinvex.auth.emailverification', function ($app) {
            return new EmailVerificationBrokerManager($app);
        });
    }

    /**
     * {@inheritdoc}
     */
    public function boot(Router $router)
    {
        // Publish resources
        $this->publishesConfig('rinvex/laravel-auth');
    }
}

Fix ServiceProvider registerCommands method compatibility


<!DOCTYPE html>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="{{ URL::asset('vendor/fluxbb/core/public/css/admin.css') }}" />

	@include('fluxbb::admin.layout.header')

	@include('fluxbb::admin.layout.sidemenu')

	@include('fluxbb::admin.layout.menu')

		@yield('alerts')

		@yield('main')

<!DOCTYPE html>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="{{ URL::asset('packages/fluxbb/core/css/admin.css') }}" />

	@include('fluxbb::admin.layout.header')

	@include('fluxbb::admin.layout.sidemenu')

	@include('fluxbb::admin.layout.menu')

		@yield('alerts')

		@yield('main')

Use properly published asset paths instead of hardcoded paths.


<?php

namespace RadDB;

use Illuminate\Database\Eloquent\Model;

class SurveyScheduleView extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'surveyschedule_view';

    /*
     * Relationships
     */
    public function machine()
    {
        return $this->belongsTo('RadDB\Machine', 'id');
    }

    public function prev_survey()
    {
        return $this->belongsTo('RadDB\TestDate');
    }

    public function curr_survey()
    {
        return $this->belongsTo('RadDB\TestDate');
    }
}

<?php

namespace RadDB;

use Illuminate\Database\Eloquent\Model;

class SurveyScheduleView extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'surveyschedule_view';

    /*
     * Relationships
     */
    public function machine()
    {
        return $this->belongsTo('RadDB\Machine', 'id');
    }

    public function prevSurvey()
    {
        return $this->belongsTo('RadDB\TestDate', 'prevSurveyID');
    }

    public function currSurvey()
    {
        return $this->belongsTo('RadDB\TestDate', 'currSurveyID');
    }
}

Fix foreign key name in relationships

Fix foreign key name in relationships


<script src="http://cdn.tinymce.com/4/tinymce.min.js"></script>
<script>
tinymce.init(
{
  selector: ".has_editor",
  menubar: false,
    plugins: [
      "lists link image textcolor",
  ],
  formats: {
    forecolor: {inline: 'span', classes: 'forecolor', styles:{color: "%value"}}
  },
  textcolor_map: [
    "0c0934", "Dark Blue", "152845", "Blue", "CACEE8", "Sky Blue", "E5DED8", "Mushy White", "2F0000", "Cherry"
  ],
  toolbar: [
    "undo redo | styleselect | bold italic underline | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
    "fontsizeselect | forecolor backcolor"
  ]
})
</script>

<script src="http://cdn.tinymce.com/4/tinymce.min.js"></script>
<script>
tinymce.init(
{
  selector: ".has_editor",
  menubar: false,
    plugins: [
      "lists link image textcolor paste",
  ],
  paste_as_text: true,
  formats: {
    forecolor: {inline: 'span', classes: 'forecolor', styles:{color: "%value"}}
  },
  textcolor_map: [
    "0c0934", "Dark Blue", "152845", "Blue", "CACEE8", "Sky Blue", "E5DED8", "Mushy White", "2F0000", "Cherry"
  ],
  toolbar: [
    "undo redo | styleselect | bold italic underline | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
    "fontsizeselect | forecolor backcolor"
  ]
})
</script>

Add paste plugin and set it to remove formatting


<?php

namespace AppBundle\API\Mapping;

use AppBundle\API\Webservice;
use AppBundle\User\FennecUser;
use Symfony\Component\HttpFoundation\ParameterBag;

class ByDbxrefId extends Webservice
{
    private $db;

    /**
     * @inheritdoc
     */
    public function execute(ParameterBag $query, FennecUser $user = null)
    {
        $this->db = $this->getManagerFromQuery($query)->getConnection();
        if(!$query->has('ids') || !is_array($query->get('ids')) || count($query->get('ids')) === 0 || !$query->has('db')){
            return array();
        }
        $ids = $query->get('ids');
        $result = array_fill_keys($ids, null);
        $placeholders = implode(',', array_fill(0, count($ids), '?'));
        $query_get_mapping = <<<EOF
SELECT fennec_id, identifier AS ncbi_taxid
    FROM fennec_dbxref
        WHERE db_id=(SELECT db_id FROM db WHERE name=?)
        AND identifier IN ({$placeholders})
EOF;
        $stm_get_mapping = $this->db->prepare($query_get_mapping);
        $stm_get_mapping->execute(array_merge([$query->get('db')], $ids));

        while($row = $stm_get_mapping->fetch(\PDO::FETCH_ASSOC)){
            $result[$row['ncbi_taxid']] = $row['fennec_id'];
        }

        return $result;
    }
}

<?php

namespace AppBundle\API\Mapping;

use AppBundle\API\Webservice;
use AppBundle\User\FennecUser;
use Symfony\Component\HttpFoundation\ParameterBag;

class ByDbxrefId extends Webservice
{
    private $db;

    /**
     * @inheritdoc
     */
    public function execute(ParameterBag $query, FennecUser $user = null)
    {
        $this->db = $this->getManagerFromQuery($query)->getConnection();
        if(!$query->has('ids') || !is_array($query->get('ids')) || count($query->get('ids')) === 0 || !$query->has('db')){
            return array();
        }
        $ids = $query->get('ids');
        $result = array_fill_keys($ids, null);
        $placeholders = implode(',', array_fill(0, count($ids), '?'));
        $query_get_mapping = <<<EOF
SELECT fennec_id, identifier
    FROM fennec_dbxref
        WHERE db_id=(SELECT db_id FROM db WHERE name=?)
        AND identifier IN ({$placeholders})
EOF;
        $stm_get_mapping = $this->db->prepare($query_get_mapping);
        $stm_get_mapping->execute(array_merge([$query->get('db')], $ids));

        while($row = $stm_get_mapping->fetch(\PDO::FETCH_ASSOC)){
            $id = $row['identifier'];
            if($result[$id] === null){
                $result[$id] = $row['fennec_id'];
            } else {
                if(! is_array($result[$id]) ){
                    $result[$id] = [$result[$id]];
                }
                $result[$id][] = $row['fennec_id'];
            }
        }

        return $result;
    }
}

Allow for multiple mappings by dbxref

Allow for multiple mappings by dbxref


<?php

namespace Kordy\Ticketit\Controllers;

use App\Http\Controllers\Controller;
use Input;
use App\User;

class UserSearchController extends Controller {

    public function userSearch() {

        $keyword = Input::get('q');
        // If you wanted to search multiple Terms you could do something like the following
        //$searchRaw = Input::get('q');
        //$keywords = explode(" ", $searchRaw);

        $user_list = User::Where('users.name', 'LIKE', '%' . $keyword . '%');

        // This is where you put additional fields to be searched through
        $user_list->orWhere(function ($query) use ($keyword) {
            $query->orWhere('users.email', 'LIKE', '%' . $keyword . '%');
            $query->orWhere('users.last_name', 'LIKE', '%' . $keyword . '%');
            $query->orWhere('users.first_name', 'LIKE', '%' . $keyword . '%');
            $query->orWhere('users.business_name', 'LIKE', '%' . $keyword . '%');
            $query->orWhere('users.phone_1', 'LIKE', '%' . $keyword . '%');
            $query->orWhere('users.phone_2', 'LIKE', '%' . $keyword . '%');
        });

        $data = $user_list->get();
        echo json_encode($data);
    }

}

<?php

namespace Kordy\Ticketit\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\User;

class UserSearchController extends Controller {

    public function userSearch(Request $request) {

        $keyword = $request->get('q');
        // If you wanted to search multiple Terms you could do something like the following
        //$searchRaw = Input::get('q');
        //$keywords = explode(" ", $searchRaw);

        $user_list = User::Where('users.name', 'LIKE', '%' . $keyword . '%');

        // This is where you put additional fields to be searched through
        $user_list->orWhere(function ($query) use ($keyword) {
            $query->orWhere('users.email', 'LIKE', '%' . $keyword . '%');
//            $query->orWhere('users.last_name', 'LIKE', '%' . $keyword . '%');
//            $query->orWhere('users.first_name', 'LIKE', '%' . $keyword . '%');
//            $query->orWhere('users.business_name', 'LIKE', '%' . $keyword . '%');
//            $query->orWhere('users.phone_1', 'LIKE', '%' . $keyword . '%');
//            $query->orWhere('users.phone_2', 'LIKE', '%' . $keyword . '%');
        });

        $data = $user_list->get();
        echo json_encode($data);
    }

}

Use Request instead of input comment out examples


<?php

declare(strict_types = 1);

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

namespace FiveLab\Component\Resource\Resource;

use FiveLab\Component\Resource\Resource\Relation\RelationCollection;
use FiveLab\Component\Resource\Resource\Relation\RelationInterface;

/**
 * The abstract class for support resource.
 *
 * @author Vitaliy Zhuk <v.zhuk@fivelab.org>
 */
abstract class AbstractResourceSupport implements ResourceInterface, RelatedResourceInterface
{
    /**
     * @var RelationInterface[]
     */
    private $relations = [];

    /**
     * {@inheritdoc}
     */
    public function addRelation(RelationInterface $relation): void
    {
        $this->relations[] = $relation;
    }

    /**
     * {@inheritdoc}
     */
    public function getRelations(): RelationCollection
    {
        return new RelationCollection(...$this->relations);
    }

    /**
     * {@inheritdoc}
     */
    public function removeRelation(RelationInterface $relation): void
    {
        $key = array_search($relation, $this->relations, true);

        if (null !== $key) {
            unset($this->relations[$key]);
        }
    }
}

<?php

declare(strict_types = 1);

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

namespace FiveLab\Component\Resource\Resource;

use FiveLab\Component\Resource\Resource\Relation\RelationCollection;
use FiveLab\Component\Resource\Resource\Relation\RelationInterface;

/**
 * The abstract class for support resource.
 *
 * @author Vitaliy Zhuk <v.zhuk@fivelab.org>
 */
abstract class AbstractResourceSupport implements ResourceInterface, RelatedResourceInterface
{
    /**
     * @var \SplObjectStorage|RelationInterface[]
     */
    private $relations = [];

    /**
     * Constructor.
     */
    public function __construct()
    {
        $this->relations = new \SplObjectStorage();
    }

    /**
     * {@inheritdoc}
     */
    public function addRelation(RelationInterface $relation): void
    {
        $this->relations->attach($relation);
    }

    /**
     * {@inheritdoc}
     */
    public function getRelations(): RelationCollection
    {
        return new RelationCollection(...iterator_to_array($this->relations));
    }

    /**
     * {@inheritdoc}
     */
    public function removeRelation(RelationInterface $relation): void
    {
        $this->relations->detach($relation);
    }
}

Fix resource support for work with SplObjectStorage


<?php namespace Flarum\Api\Middleware;

use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Zend\Stratigility\MiddlewareInterface;

class ReadJsonParameters implements MiddlewareInterface
{
    /**
     * {@inheritdoc}
     */
    public function __invoke(Request $request, Response $response, callable $out = null)
    {
        if (str_contains($request->getHeaderLine('content-type'), 'application/vnd.api+json')) {
            $input = json_decode($request->getBody(), true);

            foreach ($input as $name => $value) {
                $request = $request->withAttribute($name, $value);
            }
        }

        return $out ? $out($request, $response) : $response;
    }
}

<?php namespace Flarum\Api\Middleware;

use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Zend\Stratigility\MiddlewareInterface;

class ReadJsonParameters implements MiddlewareInterface
{
    /**
     * {@inheritdoc}
     */
    public function __invoke(Request $request, Response $response, callable $out = null)
    {
        if (str_contains($request->getHeaderLine('content-type'), 'json')) {
            $input = json_decode($request->getBody(), true);

            foreach ($input as $name => $value) {
                $request = $request->withAttribute($name, $value);
            }
        }

        return $out ? $out($request, $response) : $response;
    }
}

Make JSON parameter middleware a bit more generic


		<?php $t = tabs($_GET['i']); echo $t; ?>

			  Report Problems | Logout | Status: Offline

This is the home file.

Fix jquery error in template

Fix jquery error in template

git-svn-id: 245d8f85226f8eeeaacc1269b037bb4851d63c96@727 54a900ba-8191-11dd-a5c9-f1483cedc3eb


<?php

namespace SilexGuzzle;

use Silex\Application;
use Silex\ServiceProviderInterface;
use GuzzleHttp\Client;

class GuzzleServiceProvider implements ServiceProviderInterface
{
    private $configuration = array();

    public function boot(Application $app)
    {

    }

    public function register(Application $app)
    {
        $app['guzzle'] = $app->share(function () use ($app) {

            $this->setConfiguration($app);
            return new Client($this->configuration);
        });
    }

    protected function setConfiguration($app){

        if(isset($app['guzzle.base_uri'])){
            $this->configuration['base_uri'] = $app['guzzle.base_uri'];
        }
        if(isset($app['guzzle.timeout'])){
            $this->configuration['timeout'] = $app['guzzle.timeout'];
        }
        if(isset($app['guzzle.request_options']) && is_array($app['guzzle.request_options'])){
            $this->configuration['timeout'] = $app['guzzle.timeout'];
            foreach($app['guzzle.request_options'] as $valueName => $value){
                $this->configuration[$valueName] = $value ;
            }
        }

    }
}

<?php

namespace SilexGuzzle;

use Silex\Application;
use Silex\ServiceProviderInterface;
use GuzzleHttp\Client;

class GuzzleServiceProvider implements ServiceProviderInterface
{
    private $configuration = array();

    public function boot(Application $app)
    {

    }

    public function register(Application $app)
    {
        $app['guzzle'] = $app->share(function () use ($app) {

            $this->setConfiguration($app);
            return new Client($this->configuration);
        });
    }

    protected function setConfiguration($app){

        if(isset($app['guzzle.base_uri'])){
            $this->configuration['base_uri'] = $app['guzzle.base_uri'];
        }
        if(isset($app['guzzle.timeout'])){
            $this->configuration['timeout'] = $app['guzzle.timeout'];
        }
        if(isset($app['guzzle.debug'])){
            $this->configuration['debug'] = $app['guzzle.debug'];
        }
        if(isset($app['guzzle.request_options']) && is_array($app['guzzle.request_options'])){
            foreach($app['guzzle.request_options'] as $valueName => $value){
                $this->configuration[$valueName] = $value ;
            }
        }
    }
}

Remove error statement, add guzzle.debug options in shortcut


<?php

/*
 * This file is part of Flarum.
 *
 * For detailed copyright and license information, please view the
 * LICENSE file that was distributed with this source code.
 */

use Illuminate\Database\Schema\Builder;

return [
    'up' => function (Builder $schema) {
        $db = $schema->getConnection();

        $db->table('group_permission')
            ->where('permission', 'LIKE', '%viewDiscussions')
            ->update(['permission' => $db->raw("REPLACE(permission,  'viewDiscussions', 'viewForum')")]);

        $db->table('group_permission')
            ->where('permission', 'LIKE', 'viewUserList')
            ->update(['permission' => $db->raw("REPLACE(permission,  'viewUserList', 'searchUsers')")]);
    },

    'down' => function (Builder $schema) {
        $db = $schema->getConnection();

        $db->table('group_permission')
            ->where('permission', 'LIKE', '%viewForum')
            ->update(['permission' => $db->raw("REPLACE(permission,  'viewForum', 'viewDiscussions')")]);

        $db->table('group_permission')
            ->where('permission', 'LIKE', 'searchUsers')
            ->update(['permission' => $db->raw("REPLACE(permission,  'searchUsers', 'viewUserList')")]);
    }
];

<?php

/*
 * This file is part of Flarum.
 *
 * For detailed copyright and license information, please view the
 * LICENSE file that was distributed with this source code.
 */

use Illuminate\Database\Schema\Builder;

return [
    'up' => function (Builder $schema) {
        $db = $schema->getConnection();

        $db->table('group_permission')
            ->where('permission', 'LIKE', '%viewDiscussions')
            ->update(['permission' => $db->raw("REPLACE(permission,  'viewDiscussions', 'viewForum')")]);

        $db->table('group_permission')
            ->where('permission', 'viewUserList')
            ->update(['permission' => 'searchUsers']);
    },

    'down' => function (Builder $schema) {
        $db = $schema->getConnection();

        $db->table('group_permission')
            ->where('permission', 'LIKE', '%viewForum')
            ->update(['permission' => $db->raw("REPLACE(permission,  'viewForum', 'viewDiscussions')")]);

        $db->table('group_permission')
            ->where('permission', 'searchUsers')
            ->update(['permission' => 'viewUserList']);
    }
];

Remove `LIKE` and raw from viewUserList rename


<?php

/**
 * Define Constants.
 */
define('TEMPLATE_DIR', get_template_directory());
define('TEMPLATE_URI', get_template_directory_uri());
define('ADMIN_DIR', TEMPLATE_DIR.'/admin');
define('ADMIN_URL', TEMPLATE_URI.'/admin');

define('AUTHOR', 'Vincent Klaiber');
define('AUTHOR_URL', 'http://vinkla.com');

define('LOGIN_IMAGE_PATH', TEMPLATE_DIR.'/images/admin-login-logo.png');
define('LOGIN_HEADER_URL', get_site_url());

define('TINYMCE_BLOCKFORMATS', implode(',', [
	'p', 'h2', 'h3'
]));
define('TINYMCE_DISABLED', implode(',', [
	'strikethrough',
	'underline',
	'forecolor',
	'justifyfull'
]);

/**
 * Load Admin Components.
 */
require ADMIN_DIR.'/admin-remove.php';
require ADMIN_DIR.'/admin-functions.php';
require ADMIN_DIR.'/admin-acf.php';

<?php

/**
 * Define Constants.
 */
define('TEMPLATE_DIR', get_template_directory());
define('TEMPLATE_URI', get_template_directory_uri());
define('ADMIN_DIR', TEMPLATE_DIR.'/admin');
define('ADMIN_URL', TEMPLATE_URI.'/admin');

define('AUTHOR', 'Vincent Klaiber');
define('AUTHOR_URL', 'http://vinkla.com');

define('LOGIN_IMAGE_PATH', TEMPLATE_DIR.'/images/admin-login-logo.png');
define('LOGIN_HEADER_URL', get_site_url());

define('TINYMCE_BLOCKFORMATS', implode(',', [
	'p', 'h2', 'h3'
]));
define('TINYMCE_DISABLED', implode(',', [
	'strikethrough',
	'underline',
	'forecolor',
	'justifyfull'
]));

/**
 * Load Admin Components.
 */
require ADMIN_DIR.'/admin-remove.php';
require ADMIN_DIR.'/admin-functions.php';
require ADMIN_DIR.'/admin-acf.php';

Add missin character in define.

Add missin character in define.


<?php

namespace Http\Factory\Diactoros;

use Interop\Http\Factory\StreamFactoryInterface;
use Zend\Diactoros\Stream;

class StreamFactory implements StreamFactoryInterface
{
    public function createStream($resource)
    {
        return new Stream($resource);
    }
}

<?php

namespace Http\Factory\Diactoros;

use Interop\Http\Factory\StreamFactoryInterface;
use Zend\Diactoros\Stream;

class StreamFactory implements StreamFactoryInterface
{
    public function createStream($content = '')
    {
        $resource = fopen('php://temp', 'r+');
        fwrite($resource, $content);
        rewind($resource);

        return $this->createStreamFromResource($resource);
    }

    public function createStreamFromFile($file, $mode = 'r')
    {
        $resource = fopen($file, $mode);

        return $this->createStreamFromResource($resource);
    }

    public function createStreamFromResource($resource)
    {
        return new Stream($resource);
    }
}

Add separate methods for creating streams


<?php

class AdminControllerTest extends AimeosTestAbstract
{
	public function setUp()
	{
		parent::setUp();
		require dirname(dirname(__DIR__)).'/src/routes_admin.php';
	}

	public function testIndexAction()
	{
		$response = $this->action('GET', '\Aimeos\Shop\Controller\AdminController@indexAction');

		$this->assertResponseOk();
		$this->assertRegexp('#<script type="text/javascript">.*window.MShop = {#smu', $response->getContent());
	}

	public function testDoAction()
	{
		$response = $this->action('GET', '\Aimeos\Shop\Controller\AdminController@doAction');

		$this->assertResponseOk();
		$this->assertRegexp('#{.*}#smu', $response->getContent());
	}
}

<?php

class AdminControllerTest extends AimeosTestAbstract
{
	public function setUp()
	{
		parent::setUp();
		require dirname(dirname(__DIR__)).'/src/routes_admin.php';
	}

	public function testIndexAction()
	{
		$response = $this->action('GET', '\Aimeos\Shop\Controller\AdminController@indexAction', ['site' => 'unittest']);

		$this->assertResponseOk();
		$this->assertRegexp('#<script type="text/javascript">.*window.MShop = {#smu', $response->getContent());
	}

	public function testDoAction()
	{
		$response = $this->action('GET', '\Aimeos\Shop\Controller\AdminController@doAction', ['site' => 'unittest']);

		$this->assertResponseOk();
		$this->assertRegexp('#{.*}#smu', $response->getContent());
	}
}

Use unit test data for admin tests

Use unit test data for admin tests


<?php

$callArray = array (
        'func' => 'subresGet',
        'data' => array (
                'username' => OSRS_USERNAME,
        ),
);

require_once '../opensrs/openSRS_loader.php';

$callstring = json_encode($callArray);

$osrsHandler = processOpenSRS ('json', $callstring);

echo (' In: '.$callstring.'<br>');
echo ('Out: '.$osrsHandler->resultFormatted);
?>

<?php

require_once '../opensrs/openSRS_loader.php';

$callArray = array (
        'func' => 'subresGet',
        'data' => array (
                'username' => 'subreseller',
        ),
);

$callstring = json_encode($callArray);
$osrsHandler = processOpenSRS ('json', $callstring);

echo (' In: '.$callstring.'<br>');
echo ('Out: '.$osrsHandler->resultFormatted);
?>

Revert the last commit Do not actually want to use the reseller ID for this test. We should create a sub reseller for this


<?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;

/**
 * @author Grzegorz Sadowski <grzegorz.sadowski@lakion.com>
 */
class PaymentTransitions
{
    const GRAPH = 'sylius_payment';

    const TRANSITION_CREATE = 'create';
    const TRANSITION_PROCESS = 'process';
    const TRANSITION_COMPLETE = 'complete';
    const TRANSITION_FAIL = 'fail';
    const TRANSITION_CANCEL = 'cancel';
    const TRANSITION_REFUND = 'refund';
    const TRANSITION_VOID = 'void';
}

<?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;

/**
 * @author Grzegorz Sadowski <grzegorz.sadowski@lakion.com>
 */
final class PaymentTransitions
{
    const GRAPH = 'sylius_payment';

    const TRANSITION_CREATE = 'create';
    const TRANSITION_PROCESS = 'process';
    const TRANSITION_COMPLETE = 'complete';
    const TRANSITION_FAIL = 'fail';
    const TRANSITION_CANCEL = 'cancel';
    const TRANSITION_REFUND = 'refund';
    const TRANSITION_VOID = 'void';

    private function __construct()
    {
    }
}

[Payment] Make classes with states and transitions static


<?php
namespace Concrete\Package\KintDebug;

use Illuminate\Filesystem\Filesystem;;
use Concrete\Core\Package\Package;
use View;

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

$fs = new Filesystem();
$fs->getRequire(__DIR__ . '/vendor/autoload.php');

class Controller extends Package {
    protected $pkgHandle = 'kint_debug';
    protected $appVersionRequired = '5.7.0.4';
    protected $pkgVersion = '0.9.3';

    public function getPackageDescription() {
        return t('Add Kint debugging tools');
    }

    public function getPackageName() {
        return t('Debug Kit');
    }

    public function on_start() {
        $al = \Concrete\Core\Asset\AssetList::getInstance();
        $al->register('css', $this->pkgHandle . '/css', 'css/debug.css', array(), $this->pkgHandle);

        // Never include the css in ajax responses
        if(!$this->isAjaxRequest()) {
            View::getInstance()->requireAsset('css', $this->pkgHandle . '/css');
        }
    }

    /**
     * Check, if possible, that this execution was triggered by an AJAX request.
     * @return bool
     */
    protected function isAjaxRequest()
    {
        return !empty($_SERVER['HTTP_X_REQUESTED_WITH']) &&
            strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest';
    }
}

<?php
namespace Concrete\Package\KintDebug;

use Illuminate\Filesystem\Filesystem;;
use Concrete\Core\Package\Package;
use View;
use Config;

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

$fs = new Filesystem();
$fs->getRequire(__DIR__ . '/vendor/autoload.php');

class Controller extends Package {
    protected $pkgHandle = 'kint_debug';
    protected $appVersionRequired = '5.7.0.4';
    protected $pkgVersion = '0.9.3';

    public function getPackageDescription() {
        return t('Add Kint debugging tools');
    }

    public function getPackageName() {
        return t('Debug Kit');
    }

    public function on_start() {
        $al = \Concrete\Core\Asset\AssetList::getInstance();
        $al->register('css', $this->pkgHandle . '/css', 'css/debug.css', array(), $this->pkgHandle);

        $displayErrors = Config::get('concrete.debug.display_errors');

        // Only enable Kint if display_errors is true
        if (!$displayErrors) {
            \Kint::enabled(false);
        }
        else {
            // Never include the css in ajax responses
            if(!$this->isAjaxRequest()) {
                View::getInstance()->requireAsset('css', $this->pkgHandle . '/css');
            }
        }
    }

    /**
     * Check, if possible, that this execution was triggered by an AJAX request.
     * @return bool
     */
    protected function isAjaxRequest() {
        return !empty($_SERVER['HTTP_X_REQUESTED_WITH']) &&
            strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest';
    }
}

Disable Kint if display_errors is false

Disable Kint if display_errors is false


<?php

namespace GearHub\LaravelEnhancementSuite\Repositories;

use GearHub\LaravelEnhancementSuite\Contracts\Repositories\RepositoryFactory as RepositoryFactoryContract;

class RepositoryFactory implements RepositoryFactoryContract
{
    /**
     * Mapping keys to repositories. Takes precidence over the dynamic resolution.
     *
     * @var array
     */
    protected $overrides = [];

    /**
     * Create new instance of RepositoryFactory.
     *
     * @param  array $overrides
     *
     * @return void
     */
    public function __construct(array $overrides = [])
    {
        $this->overrides = $overrides;
    }

    /**
     * Get repository for the corresponding model.
     * If $key is null return instance of the factory.
     *
     * @param  string|null $key
     *
     * @return mixed
     */
    public function get($key = null)
    {
        if (!empty($key)) {
            $class = null;

            if (array_has($this->overrides, $key)) {
                $class = array_get($this->overrides, $key);
            } else {
                $class = $this->build($key);
            }

            return resolve($class);
        }

        return $this;
    }

    /**
     * Build the path of the Repository class.
     *
     * @param  string $key
     *
     * @return string
     */
    protected function build($key)
    {
        return app()->getNamespace() . $this->laravel['config']['les.repository_namespace'] . '\\' . studly_case(str_singular($key)) . 'Repository';
    }
}

<?php

namespace GearHub\LaravelEnhancementSuite\Repositories;

use GearHub\LaravelEnhancementSuite\Contracts\Repositories\RepositoryFactory as RepositoryFactoryContract;

class RepositoryFactory implements RepositoryFactoryContract
{
    /**
     * Mapping keys to repositories. Takes precidence over the dynamic resolution.
     *
     * @var array
     */
    protected $overrides = [];

    /**
     * Create new instance of RepositoryFactory.
     *
     * @param  array $overrides
     *
     * @return void
     */
    public function __construct(array $overrides = [])
    {
        $this->overrides = $overrides;
    }

    /**
     * Get repository for the corresponding model.
     * If $key is null return instance of the factory.
     *
     * @param  string|null $key
     *
     * @return mixed
     */
    public function get($key = null)
    {
        if (!empty($key)) {
            $class = null;

            if (array_has($this->overrides, $key)) {
                $class = array_get($this->overrides, $key);
            } else {
                $class = $this->build($key);
            }

            return resolve($class);
        }

        return $this;
    }

    /**
     * Build the path of the Repository class.
     *
     * @param  string $key
     *
     * @return string
     */
    protected function build($key)
    {
        return app()->getNamespace() . config('les.repository_namespace') . '\\' . studly_case(str_singular($key)) . 'Repository';
    }
}

Call to config helper function instead of an instance of the container


<?php

namespace HbgEventImporter;

class Location extends \HbgEventImporter\Entity\PostManager
{
    public $post_type = 'location';

    public function afterSave()
    {
        $res = Helper\Address::gmapsGetAddressComponents($this->postal_address . ' ' . $this->postal_code . ' ' . $this->city . ' ' . $this->country);

        if (!isset($res->geometry->location)) {
            return;
        }

        update_post_meta($this->ID, 'map', array(
            'address' => $res->formatted_address,
            'lat' => $res->geometry->location->lat,
            'lng' => $res->geometry->location->lng
        ));

        update_post_meta($this->ID, 'formatted_address', $res->formatted_address);
    }
}

<?php

namespace HbgEventImporter;

class Location extends \HbgEventImporter\Entity\PostManager
{
    public $post_type = 'location';

    public function afterSave()
    {
        $res = Helper\Address::gmapsGetAddressComponents($this->street_address . ' ' . $this->postal_code . ' ' . $this->city . ' ' . $this->country);

        if (!isset($res->geometry->location)) {
            return;
        }

        update_post_meta($this->ID, 'map', array(
            'address' => $res->formatted_address,
            'lat' => $res->geometry->location->lat,
            'lng' => $res->geometry->location->lng
        ));

        update_post_meta($this->ID, 'formatted_address', $res->formatted_address);
    }
}

Use correct field for address formatting


<?php

/*
 * This file is part of the Sonata project.
 *
 * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sonata\AdminBundle\Security\Handler;

use Symfony\Component\Security\Core\SecurityContextInterface;
use Sonata\AdminBundle\Admin\AdminInterface;

class AclSecurityHandler implements SecurityHandlerInterface
{
    public function __construct(SecurityContextInterface $securityContext)
    {
        $this->securityContext = $securityContext;
    }

    /**
     * {@inheritDoc}
     */
    public function isGranted($attributes, $object = null)
    {
        return $this->securityContext->isGranted($attributes, $this);
    }

    /**
     * {@inheritDoc}
     */
    public function buildSecurityInformation(AdminInterface $admin)
    {
        $baseRole = 'ROLE_'.str_replace('.', '_', strtoupper($admin->getCode())).'_%s';

        $results = array();
        foreach ($admin->getSecurityInformation() as $name => $permissions) {
            $results[sprintf($baseRole, $name)] = $permissions;
        }

        return $results;
    }
}

<?php

/*
 * This file is part of the Sonata project.
 *
 * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sonata\AdminBundle\Security\Handler;

use Symfony\Component\Security\Core\SecurityContextInterface;
use Sonata\AdminBundle\Admin\AdminInterface;

class AclSecurityHandler implements SecurityHandlerInterface
{
    public function __construct(SecurityContextInterface $securityContext)
    {
        $this->securityContext = $securityContext;
    }

    /**
     * {@inheritDoc}
     */
    public function isGranted($attributes, $object = null)
    {
        return $this->securityContext->isGranted($attributes, $object);
    }

    /**
     * {@inheritDoc}
     */
    public function buildSecurityInformation(AdminInterface $admin)
    {
        $baseRole = 'ROLE_'.str_replace('.', '_', strtoupper($admin->getCode())).'_%s';

        $results = array();
        foreach ($admin->getSecurityInformation() as $name => $permissions) {
            $results[sprintf($baseRole, $name)] = $permissions;
        }

        return $results;
    }
}

Use the right object for ACL validation

Use the right object for ACL validation


<?php

namespace Hitmeister\Component\Api\Helper;

/**
 * Class Security
 *
 * @category PHP-SDK
 * @package  Hitmeister\Component\Api\Helper
 * @author   Maksim Naumov <maksim.naumov@hitmeister.de>
 * @license  https://opensource.org/licenses/MIT MIT
 * @link     https://www.hitmeister.de/api/v1/
 */
class Security
{
	/**
	 * Makes signature
	 *
	 * @param string $clientSecret Client secret key
	 * @param string $method Request method
	 * @param string $url Request url
	 * @param string $body Request body
	 * @param int    $timestamp Current timestamp
	 * @return string
	 */
	public static function signRequest($clientSecret, $method, $url, $body, $timestamp)
	{
		// Build string that need to be signed [ METHOD, URL, BODY, UNIX_TIMESTAMP ]
		$string = implode(PHP_EOL, [$method, $url, $body, $timestamp]);

		// Sign
		return hash_hmac('sha256', $string, $clientSecret);
	}
}

<?php

namespace Hitmeister\Component\Api\Helper;

/**
 * Class Security
 *
 * @category PHP-SDK
 * @package  Hitmeister\Component\Api\Helper
 * @author   Maksim Naumov <maksim.naumov@hitmeister.de>
 * @license  https://opensource.org/licenses/MIT MIT
 * @link     https://www.hitmeister.de/api/v1/
 */
class Security
{
	/**
	 * Makes signature
	 *
	 * @param string $clientSecret Client secret key
	 * @param string $method Request method
	 * @param string $url Request url
	 * @param string $body Request body
	 * @param int    $timestamp Current timestamp
	 * @return string
	 */
	public static function signRequest($clientSecret, $method, $url, $body, $timestamp)
	{
		$separator = "\n";
		// Build string that need to be signed [ METHOD, URL, BODY, UNIX_TIMESTAMP ]
		$string = implode($separator, [$method, $url, $body, $timestamp]);

		// Sign
		return hash_hmac('sha256', $string, $clientSecret);
	}
}

Replace PHP_EOL with \n to make it work under Win OS


<?php
// define environment
define('ENV', 'dev');
ob_start();
session_start();
// define absolute server path
define('ABS_PATH', $_SERVER['DOCUMENT_ROOT']);
// include configuration file
if(ENV == 'dev'){
    require_once(ABS_PATH.'/includes/.dev.config.php');
} else {
    require_once(ABS_PATH.'/includes/config.php');
}
// load database settings
require_once (ABS_PATH.'/includes/database.php');
// load composer libs
require (ABS_PATH . '/vendor/autoload.php');
// loads users class for all pages, needed for confirming login etc
$users = new \SimpleLance\Users($db);

<?php
ob_start();
session_start();
// define absolute server path
define('ABS_PATH', $_SERVER['DOCUMENT_ROOT']);
// checks to see if a dev config file exists and if does, loads it
if(file_exists(ABS_PATH.'/includes/.dev.config.php')){
    require_once(ABS_PATH.'/includes/.dev.config.php');
} else { // if no dev config file found loads main config
    require_once(ABS_PATH.'/includes/config.php');
}
// load database settings
require_once (ABS_PATH.'/includes/database.php');
// load composer libs
require (ABS_PATH . '/vendor/autoload.php');
// loads users class for all pages, needed for confirming login etc
$users = new \SimpleLance\Users($db);

Update to dev config check

Update to dev config check


<?php

/**
 * Database factory class, this will determine whether to use the main database
 * or an external database defined in configuration file
 */
class MWEchoDbFactory {

	/**
	 * Database loadbalancer
	 */
	private static $lb;

	/**
	 * Database cache
	 */
	private static $cache = array();

	/**
	 * Internal function for getting database loadbalancer, Echo database
	 * can reside on extension1 db
	 *
	 * @param $wiki string The wiki ID, or false for the current wiki
	 */
	private static function initLB( $wiki ) {
		if ( self::$lb === null ) {
			global $wgEchoCluster;

			// Use the external db defined for Echo
			if ( $wgEchoCluster ) {
				self::$lb = wfGetLBFactory()->getExternalLB( $wgEchoCluster );
			} else {
				self::$lb = wfGetLB( $wiki );
			}
		}
	}

	/**
	 * Wrapper function for wfGetDB
	 *
	 * @param $db int Index of the connection to get
	 * @param $groups mixed Query groups.
	 * @param $wiki string The wiki ID, or false for the current wiki
	 * @return DatabaseBase
	 */
	public static function getDB( $db, $groups = array(), $wiki = false ) {
		if ( !isset( self::$cache[$db] ) ) {
			self::initLB( $wiki );

			self::$cache[$db] = self::$lb->getConnection( $db, $groups, $wiki );
		}

		return self::$cache[$db];
	}

}

<?php

/**
 * Database factory class, this will determine whether to use the main database
 * or an external database defined in configuration file
 */
class MWEchoDbFactory {

	/**
	 * Wrapper function for wfGetDB
	 *
	 * @param $db int Index of the connection to get
	 * @param $groups mixed Query groups.
	 * @param $wiki string The wiki ID, or false for the current wiki
	 * @return DatabaseBase
	 */
	public static function getDB( $db, $groups = array(), $wiki = false ) {
		global $wgEchoCluster;

		// Use the external db defined for Echo
		if ( $wgEchoCluster ) {
			$lb = wfGetLBFactory()->getExternalLB( $wgEchoCluster, $wiki );
		} else {
			$lb = wfGetLB( $wiki );
		}

		return $lb->getConnection( $db, $groups, $wiki );

	}

}

Remove the redundant db, lb static cache layer

They are already cached in db and lb object

Change-Id: I3e4db98a3eecdf184db64274b3914eec076af905


<article <?php post_class(); ?>>

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

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

    <?php the_excerpt(); ?>

<article <?php post_class(); ?>>

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

    <?php if ($posts[0]->post_type == 'post')
      		get_template_part('templates/entry-meta'); ?>

    <?php the_excerpt(); ?>

Remove Meta on archive pages that aren't articles.


<?php

namespace Aerys\Watch;

use Aerys\Server,
    Aerys\BinOptions,
    Aerys\Bootstrapper;

class DebugWatcher {
    public function watch(BinOptions $binOptions) {
        list($reactor, $server, $hosts) = (new Bootstrapper)->boot($binOptions);

        register_shutdown_function(function() use ($server) {
            $this->shutdown($server);
        });

        $server->start($hosts);

        foreach ($hosts->getBindableAddresses() as $addr) {
            $addr = substr(str_replace('0.0.0.0', '*', $addr), 6);
            printf("Listening for HTTP traffic on %s ...\n", $addr);
        }

        $reactor->run();
    }

    private function shutdown(Server $server) {
        if (!$err = error_get_last()) {
            return;
        }

        switch ($err['type']) {
            case E_ERROR:
            case E_PARSE:
            case E_USER_ERROR:
            case E_CORE_ERROR:
            case E_CORE_WARNING:
            case E_COMPILE_ERROR:
            case E_COMPILE_WARNING:
                extract($err);
                printf("%s in %s on line %d\n", $message, $file, $line);
                $server->stop()->onComplete(function() { exit; });
                break;
        }
    }
}

<?php

declare(ticks = 1);

namespace Aerys\Watch;

use Aerys\Server,
    Aerys\BinOptions,
    Aerys\Bootstrapper;

class DebugWatcher {
    public function watch(BinOptions $binOptions) {
        list($reactor, $server, $hosts) = (new Bootstrapper)->boot($binOptions);

        register_shutdown_function(function() use ($server) {
            $this->shutdown($server);
        });

        $server->start($hosts);

        foreach ($hosts->getBindableAddresses() as $addr) {
            $addr = substr(str_replace('0.0.0.0', '*', $addr), 6);
            printf("Listening for HTTP traffic on %s ...\n", $addr);
        }

        if (extension_loaded('pcntl')) {
            $f = function() use ($server) { $server->stop()->onComplete(function(){ exit; }); };
            pcntl_signal(SIGINT, $f);
            pcntl_signal(SIGTERM, $f);
        }

        $reactor->run();
    }

    private function shutdown(Server $server) {
        if (!$err = error_get_last()) {
            return;
        }

        switch ($err['type']) {
            case E_ERROR:
            case E_PARSE:
            case E_USER_ERROR:
            case E_CORE_ERROR:
            case E_CORE_WARNING:
            case E_COMPILE_ERROR:
            case E_COMPILE_WARNING:
                extract($err);
                printf("%s in %s on line %d\n", $message, $file, $line);
                $server->stop()->onComplete(function() { exit; });
                break;
        }
    }
}

Add minimal shutdown signal handling

Add minimal shutdown signal handling


<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Doug
 * Date: 28/07/13
 * Time: 12:58
 * To change this template use File | Settings | File Templates.
 */

  namespace DVDoug\BoxPacker;

  class BoxListTest extends \PHPUnit_Framework_TestCase {

    function testCompare() {

      $box1 = new TestBox('Small', 21, 21, 3, 1, 20, 20, 2, 100);
      $box2 = new TestBox('Large', 201, 201, 21, 1, 200, 200, 20, 1000);
      $box3 = new TestBox('Medium', 101, 101, 11, 5, 100, 100, 10, 500);

      $list = new BoxList;
      $list->insert($box1);
      $list->insert($box2);
      $list->insert($box3);

      $sorted = [];
      while (!$list->isEmpty()) {
        $sorted[] = $list->extract();
      }
      self::assertEquals(array($box1,$box3,$box2), $sorted);
    }
  }

<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Doug
 * Date: 28/07/13
 * Time: 12:58
 * To change this template use File | Settings | File Templates.
 */

  namespace DVDoug\BoxPacker;

  class BoxListTest extends \PHPUnit_Framework_TestCase {

    function testCompare() {

      $box1 = new TestBox('Small', 21, 21, 3, 1, 20, 20, 2, 100);
      $box2 = new TestBox('Large', 201, 201, 21, 1, 200, 200, 20, 1000);
      $box3 = new TestBox('Medium', 101, 101, 11, 5, 100, 100, 10, 500);

      $list = new BoxList;
      $list->insert($box1);
      $list->insert($box2);
      $list->insert($box3);

      $sorted = array();
      while (!$list->isEmpty()) {
        $sorted[] = $list->extract();
      }
      self::assertEquals(array($box1,$box3,$box2), $sorted);
    }
  }

Use PHP5.3 compat array syntax

Use PHP5.3 compat array syntax


<?php

/*
 * This file is part of Cachet.
 *
 * (c) Alt Three Services Limited
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace CachetHQ\Cachet\Http\Routes\Dashboard;

use Illuminate\Contracts\Routing\Registrar;

/**
 * This is the dashboard api routes class.
 *
 * @author James Brooks <james@alt-three.com>
 * @author Connor S. Parks <connor@connorvg.tv>
 */
class ApiRoutes
{
    /**
     * Defines if these routes are for the browser.
     *
     * @var bool
     */
    public static $browser = false;

    /**
     * Define the dashboard api routes.
     *
     * @param \Illuminate\Contracts\Routing\Registrar $router
     *
     * @return void
     */
    public function map(Registrar $router)
    {
        $router->group([
            'middleware' => ['auth'],
            'namespace'  => 'Dashboard',
            'prefix'     => 'dashboard/api',
        ], function (Registrar $router) {
            $router->get('incidents/templates', 'ApiController@getIncidentTemplate');
            $router->post('components/groups/order', 'ApiController@postUpdateComponentGroupOrder');
            $router->post('components/order', 'ApiController@postUpdateComponentOrder');
            $router->any('components/{component}', 'ApiController@postUpdateComponent');
        });
    }
}

<?php

/*
 * This file is part of Cachet.
 *
 * (c) Alt Three Services Limited
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace CachetHQ\Cachet\Http\Routes\Dashboard;

use Illuminate\Contracts\Routing\Registrar;

/**
 * This is the dashboard api routes class.
 *
 * @author James Brooks <james@alt-three.com>
 * @author Connor S. Parks <connor@connorvg.tv>
 */
class ApiRoutes
{
    /**
     * Defines if these routes are for the browser.
     *
     * @var bool
     */
    public static $browser = true;

    /**
     * Define the dashboard api routes.
     *
     * @param \Illuminate\Contracts\Routing\Registrar $router
     *
     * @return void
     */
    public function map(Registrar $router)
    {
        $router->group([
            'middleware' => ['auth'],
            'namespace'  => 'Dashboard',
            'prefix'     => 'dashboard/api',
        ], function (Registrar $router) {
            $router->get('incidents/templates', 'ApiController@getIncidentTemplate');
            $router->post('components/groups/order', 'ApiController@postUpdateComponentGroupOrder');
            $router->post('components/order', 'ApiController@postUpdateComponentOrder');
            $router->any('components/{component}', 'ApiController@postUpdateComponent');
        });
    }
}

Revert "Dashboard API routes are not meant for the browser"

This reverts commit 8fcef7b711423816260aba7669283fe2840f7893.


<?php defined('SYSPATH') or die('No direct access allowed.');
/**
 * Roles list
 *
 * @package    Anqh
 * @author     Antti Qvickström
 * @copyright  (c) 2010 Antti Qvickström
 * @license    http://www.opensource.org/licenses/mit-license.php MIT license
 */
?>

	<?php foreach ($roles as $role): ?>

<?php echo HTML::anchor(URL::model($role), $role->name), ' - ', HTML::chars($role->description) ?>

	<?php endforeach; ?>

<?php defined('SYSPATH') or die('No direct access allowed.');
/**
 * Roles list
 *
 * @package    Anqh
 * @author     Antti Qvickström
 * @copyright  (c) 2010 Antti Qvickström
 * @license    http://www.opensource.org/licenses/mit-license.php MIT license
 */
?>

	<?php foreach ($roles as $role): ?>

<?php echo HTML::anchor(Route::model($role, 'edit', false), $role->name), ' - ', HTML::chars($role->description) ?>

	<?php endforeach; ?>

Use Route::model instead of URL::model

Use Route::model instead of URL::model


<?php

namespace Forestry\Orm;

class Storage {

	/**
	 * @var array
	 */
	private static $instances = ['default' => []];

    /**
     * Set a new connection with the given name.
     *
     * @param string $name
     * @param array $config
     * @return mixed
     * @throws \LogicException
     * @throws \PDOException
     */
    public static function set($name = 'default', array $config = []) {
        if(isset(self::$instances[$name]) && self::$instances[$name] instanceof \PDO) {
            throw new \LogicException(sprintf('Connection "%s" already set', $name));
        }

        self::$instances[$name] = new \PDO(
            isset($config['dsn']) ? $config['dsn'] : 'mysql:host=localhost',
            isset($config['user']) ? $config['user'] : 'root',
            isset($config['password']) ? $config['password']: '',
            isset($config['option']) ? $config['option'] : array()
        );

        return self::$instances[$name];
    }

    /**
     * Creates a new instance of PDO or returns an existing one.
     *
     * @param string $name
     * @return \PDO
     * @throws \OutOfBoundsException
     */
    public static function get($name) {
        if(!isset(self::$instances[$name])) {
            throw new \OutOfBoundsException(sprintf('Storage "%s" not set', $name));
        }

        return self::$instances[$name];
    }

}

<?php

namespace Forestry\Orm;

class Storage {

	/**
	 * @var array
	 */
	private static $instances = ['default' => []];

    /**
     * Set a new connection with the given name.
     *
     * @param string $name
     * @param array $config
     * @return mixed
     * @throws \LogicException
     * @throws \PDOException
     */
    public static function set($name = 'default', array $config = []) {
        if(isset(self::$instances[$name]) && self::$instances[$name] instanceof \PDO) {
            throw new \LogicException(sprintf('Connection "%s" already set', $name));
        }

        self::$instances[$name] = new \PDO(
            isset($config['dsn']) ? $config['dsn'] : 'mysql:host=localhost',
            isset($config['user']) ? $config['user'] : 'root',
            isset($config['password']) ? $config['password']: '',
            isset($config['option']) ? $config['option'] : array()
        );

        return self::$instances[$name];
    }

    /**
     * Creates a new instance of PDO or returns an existing one.
     *
     * @param string $name
     * @return \PDO
     * @throws \OutOfBoundsException
     */
    public static function get($name) {
        if(!isset(self::$instances[$name])) {
            throw new \OutOfBoundsException(sprintf('Storage "%s" not set', $name));
        }

        return self::$instances[$name];
    }

    /**
     * Closes the connection.
     *
     * @param string $name
     * @return bool
     * @throws \OutOfBoundsException
     */
    public static function delete($name) {
        if(!isset(self::$instances[$name])) {
            throw new \OutOfBoundsException(sprintf('Storage "%s" not set', $name));
        }

        self::$instances[$name] = null;

        return true;
    }

}

Add methods to delete a connection

Add methods to delete a connection


<?php declare(strict_types=1);
/*
 * This file is part of phpunit/php-code-coverage.
 *
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace SebastianBergmann\CodeCoverage;

use function dirname;
use SebastianBergmann\Version as VersionId;

final class Version
{
    /**
     * @var string
     */
    private static $version;

    public static function id(): string
    {
        if (self::$version === null) {
            self::$version = (new VersionId('9.1.0', dirname(__DIR__)))->getVersion();
        }

        return self::$version;
    }
}

<?php declare(strict_types=1);
/*
 * This file is part of phpunit/php-code-coverage.
 *
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace SebastianBergmann\CodeCoverage;

use function dirname;
use SebastianBergmann\Version as VersionId;

final class Version
{
    /**
     * @var string
     */
    private static $version;

    public static function id(): string
    {
        if (self::$version === null) {
            self::$version = (new VersionId('9.1.1', dirname(__DIR__)))->getVersion();
        }

        return self::$version;
    }
}

Fix version (which, of course, has no effect on the tag/release)


<?php defined('SYSPATH') or die('No direct script access.');

class Auth_CrowdmapID extends Pingapp_Auth_CrowdmapID { }

<?php defined('SYSPATH') or die('No direct script access.');

class Auth_CrowdmapID extends PingApp_Auth_CrowdmapID { }

Fix class reference error :rage:

Fix class reference error :rage: