Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix check for composer files | <?php
/**
* Plugin Name: WC Cyclone
* Plugin URI: https://metorik.com
* Description: Generate fake data for a WooCommerce store.
* Version: 0.1
* Author Name: Bryce Adams | Metorik
* Author URI: https://bryce.se
*/
add_action( 'plugins_loaded', function() {
// Check `composer install` has been ran
if ( file_... | <?php
/**
* Plugin Name: WC Cyclone
* Plugin URI: https://metorik.com
* Description: Generate fake data for a WooCommerce store.
* Version: 0.1
* Author Name: Bryce Adams | Metorik
* Author URI: https://bryce.se
*/
add_action( 'plugins_loaded', function() {
// Check `composer install` has been ran
if ( file_... |
Add debug logging for webhooks. | <?php
require_once 'CRM/Core/Page.php';
class CRM_CiviMailchimp_Page_Webhook extends CRM_Core_Page {
function run() {
if (CRM_Utils_System::authenticateKey()) {
parent::run();
$request_type = CRM_Utils_Request::retrieve('type', 'String');
$request_data = CRM_Utils_Request::retrieve('data', 'S... | <?php
require_once 'CRM/Core/Page.php';
class CRM_CiviMailchimp_Page_Webhook extends CRM_Core_Page {
function run() {
if (CRM_Utils_System::authenticateKey()) {
parent::run();
$request_type = CRM_Utils_Request::retrieve('type', 'String');
$request_data = CRM_Utils_Request::retrieve('data', 'S... |
Allow modules to set base dir name | <?php
namespace ATP;
class Module
{
protected $_moduleName = "";
public function onBootstrap(\Zend\Mvc\MvcEvent $e)
{
$eventManager = $e->getApplication()->getEventManager();
$moduleRouteListener = new \Zend\Mvc\ModuleRouteListener();
$moduleRouteListener->attach($eventManager... | <?php
namespace ATP;
class Module
{
protected $_moduleName = "";
protected $_moduleBaseDir = "vendor";
public function onBootstrap(\Zend\Mvc\MvcEvent $e)
{
$eventManager = $e->getApplication()->getEventManager();
$moduleRouteListener = new \Zend\Mvc\ModuleRouteListener();
$mo... |
Include Mail 1.1.3 with PHP 5. | <?php
/* This is a list of packages and versions
* that will be used to create the PEAR folder
* in the windows snapshot.
* See win32/build/mkdist.php for more details
* $Id$
*/
$packages = array(
"PEAR" => "1.3.1",
"Mail" => "1.1.2",
"Net_SMTP" => "1.2.5",
... | <?php
/* This is a list of packages and versions
* that will be used to create the PEAR folder
* in the windows snapshot.
* See win32/build/mkdist.php for more details
* $Id$
*/
$packages = array(
"PEAR" => "1.3.1",
"Mail" => "1.1.3",
"Net_SMTP" => "1.2.5",
... |
Add some constants for all the engines | <?php
/**
* This file is part of the Elephant.io package
*
* For the full copyright and license information, please view the LICENSE file
* that was distributed with this source code.
*
* @copyright Wisembly
* @license http://www.opensource.org/licenses/MIT-License MIT License
*/
namespace ElephantIO;
/**
... | <?php
/**
* This file is part of the Elephant.io package
*
* For the full copyright and license information, please view the LICENSE file
* that was distributed with this source code.
*
* @copyright Wisembly
* @license http://www.opensource.org/licenses/MIT-License MIT License
*/
namespace ElephantIO;
/**
... |
Fix line size too long | <?php
/**
* Created by PhpStorm.
* User: gpl
* Date: 15/10/27
* Time: 下午2:55
*/
namespace Dy\Ring\Rule;
use Dy\Ring\Exception\InvalidArgumentException;
use Dy\Ring\Exception\OutOfBoundsException;
use Dy\Ring\Source\AbstractSource;
final class SizeRule extends AbstractRule
{
/**
* @var int
*/
p... | <?php
/**
* Created by PhpStorm.
* User: gpl
* Date: 15/10/27
* Time: 下午2:55
*/
namespace Dy\Ring\Rule;
use Dy\Ring\Exception\InvalidArgumentException;
use Dy\Ring\Exception\OutOfBoundsException;
use Dy\Ring\Source\AbstractSource;
final class SizeRule extends AbstractRule
{
/**
* @var int
*/
p... |
Set default value for query params | <?php
namespace RIPS\Connector\Requests;
class UserRequests extends BaseRequest
{
// @var string
protected $uri = '/users';
/**
* Get all users
*
* @param array $queryParams
* @return array
*/
public function getAll(array $queryParams)
{
$response = $this->client-... | <?php
namespace RIPS\Connector\Requests;
class UserRequests extends BaseRequest
{
// @var string
protected $uri = '/users';
/**
* Get all users
*
* @param array $queryParams
* @return array
*/
public function getAll(array $queryParams = [])
{
$response = $this->cl... |
Change null namespaces to empty string on upgrade | <?php
namespace Concrete\Core\Updater\Migrations\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\Schema;
class Version5704 extends AbstractMigration
{
public function getName()
{
return '20140930000000';
}
public funct... | <?php
namespace Concrete\Core\Updater\Migrations\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\Schema;
class Version5704 extends AbstractMigration
{
public function getName()
{
return '20140930000000';
}
public funct... |
Use new shortcut for default settings migration | <?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Flarum\Settings\SettingsRepositoryInterface;
return [
'up' => function (SettingsRepositor... | <?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Flarum\Database\Migration;
return Migration::addSettings([
'flarum-tags.max_primary_tags'... |
Use constants for model configuration | <?php
/**
* Testimonial model
*
* @package Nails
* @subpackage module-testimonial
* @category Model
* @author Nails Dev Team
* @link
*/
namespace Nails\Testimonial\Model;
use Nails\Common\Model\Base;
class Testimonial extends Base
{
/**
* Model constructor
**/
public function ... | <?php
/**
* Testimonial model
*
* @package Nails
* @subpackage module-testimonial
* @category Model
* @author Nails Dev Team
* @link
*/
namespace Nails\Testimonial\Model;
use Nails\Common\Model\Base;
class Testimonial extends Base
{
const TABLE = NAILS_DB_PREFIX . 'testimonial... |
Add interface documentation and cleanup | <?php namespace Aedart\Scaffold\Contracts\Templates\Data;
use Aedart\Model\Contracts\Arrays\ChoicesAware;
use Aedart\Model\Contracts\Integers\IdAware;
use Aedart\Model\Contracts\Integers\TypeAware;
use Aedart\Model\Contracts\Strings\QuestionAware;
use Aedart\Model\Contracts\Strings\ValueAware;
use Aedart\Util\Interfac... | <?php namespace Aedart\Scaffold\Contracts\Templates\Data;
use Aedart\Model\Contracts\Arrays\ChoicesAware;
use Aedart\Model\Contracts\Integers\IdAware;
use Aedart\Model\Contracts\Integers\TypeAware;
use Aedart\Model\Contracts\Strings\QuestionAware;
use Aedart\Model\Contracts\Strings\ValueAware;
use Aedart\Util\Interfac... |
Change description message on internal migration | <?php declare(strict_types = 1);
namespace PharIo\Phive;
use PharIo\FileSystem\Filename;
class HomePharsXmlMigration extends InternalFileMigration {
public function __construct(Config $config) {
parent::__construct(
$config->getHomeDirectory()->file('phars.xml'),
$config->getRegist... | <?php declare(strict_types = 1);
namespace PharIo\Phive;
use PharIo\FileSystem\Filename;
class HomePharsXmlMigration extends InternalFileMigration {
public function __construct(Config $config) {
parent::__construct(
$config->getHomeDirectory()->file('phars.xml'),
$config->getRegist... |
Add debug for curl response | <?php
/*
* This file is part of the yandex-pdd-api project.
*
* (c) AmaxLab 2017 <http://www.amaxlab.ru>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace AmaxLab\YandexPddApi\Curl;
/**
* @author Egor Zyuskin <ezyuskin@... | <?php
/*
* This file is part of the yandex-pdd-api project.
*
* (c) AmaxLab 2017 <http://www.amaxlab.ru>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace AmaxLab\YandexPddApi\Curl;
/**
* @author Egor Zyuskin <ezyuskin@... |
Convert tabs to spaces. Looking at YOU sublime | <?php
namespace BournemouthData\TaxiRank;
class TaxiRank
{
private $id;
private $name;
private $description;
private $lat;
private $lng;
public function __construct($id, $name, $description, $lat, $lng)
{
$this->id = $id;
$this->name = ucwords(strtolower($name));
$this->description ... | <?php
namespace BournemouthData\TaxiRank;
class TaxiRank
{
private $id;
private $name;
private $description;
private $lat;
private $lng;
public function __construct($id, $name, $description, $lat, $lng)
{
$this->id = $id;
$this->name = ucwords(strtolower($name));
$... |
Fix bug where tag_id wasn't in budgets migration | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBudgetsTable extends Migration {
public function up() {
Schema::create('budgets', function (Blueprint $table) {
$table->increments('id');
... | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBudgetsTable extends Migration {
public function up() {
Schema::create('budgets', function (Blueprint $table) {
$table->increments('id');
... |
Fix broken reference to YouTube metadata | <?php
require_once __DIR__ . '/../bootstrap.php';
$client = new Madcoda\Youtube(['key' => $config->youtube->key]);
$mostRecentVideoDateTime = $db->getRead()->fetchValue(
"SELECT `datetime` FROM `jpemeric_stream`.`youtube` ORDER BY `datetime` DESC LIMIT 1"
);
$mostRecentVideoDateTime = new DateTime($mostRecentVid... | <?php
require_once __DIR__ . '/../bootstrap.php';
$client = new Madcoda\Youtube(['key' => $config->youtube->key]);
$mostRecentVideoDateTime = $db->getRead()->fetchValue(
"SELECT `datetime` FROM `jpemeric_stream`.`youtube` ORDER BY `datetime` DESC LIMIT 1"
);
$mostRecentVideoDateTime = new DateTime($mostRecentVid... |
Add check for permissions for every component | <?php
class Kwc_Editable_ComponentsModel extends Kwf_Model_Data_Abstract
{
public function __construct(array $config = array())
{
$data = array();
$components = Kwf_Component_Data_Root::getInstance()
->getComponentsByClass(array('Kwc_Editable_Component', 'Kwc_Editable_Trl_Component')... | <?php
class Kwc_Editable_ComponentsModel extends Kwf_Model_Data_Abstract
{
public function __construct(array $config = array())
{
$data = array();
$components = Kwf_Component_Data_Root::getInstance()
->getComponentsByClass(array('Kwc_Editable_Component', 'Kwc_Editable_Trl_Component')... |
Fix PHP unit tests with latest version of Redis. | <?php
require_once dirname(__FILE__).'/CredisClusterTest.php';
class CredisStandaloneClusterTest extends CredisClusterTest
{
protected $useStandalone = TRUE;
protected function tearDown()
{
if($this->cluster) {
foreach($this->cluster->clients() as $client){
if($client->isConnected()) {
... | <?php
require_once dirname(__FILE__).'/CredisClusterTest.php';
class CredisStandaloneClusterTest extends CredisClusterTest
{
protected $useStandalone = TRUE;
protected function tearDown()
{
if($this->cluster) {
foreach($this->cluster->clients() as $client){
if($client->isConnected()) {
... |
Disable Phutil autoloader so our tests won't blow up | <?php
require_once __DIR__ . "/../src/__init__.php";
\Symfony\Component\Debug\Debug::enable();
| <?php
require_once __DIR__ . "/../src/__init__.php";
\Symfony\Component\Debug\Debug::enable();
spl_autoload_unregister('__phutil_autoload');
|
Add `mfa` entry to fake success response (from Broker). | <?php
namespace Sil\SilAuth\tests\fakes;
use GuzzleHttp\Psr7\Response;
class FakeSuccessfulIdBroker extends FakeIdBroker
{
public function getAuthenticatedUser(string $username, string $password)
{
$this->logger->info('FAKE SUCCESS: accepting {username} and {password}.', [
'username' => va... | <?php
namespace Sil\SilAuth\tests\fakes;
use GuzzleHttp\Psr7\Response;
class FakeSuccessfulIdBroker extends FakeIdBroker
{
public function getAuthenticatedUser(string $username, string $password)
{
$this->logger->info('FAKE SUCCESS: accepting {username} and {password}.', [
'username' => va... |
Remove old PHP 4 code | <?php
require_once __DIR__.'/functions.php';
require_once __DIR__.'/defines.php';
if (PHP_VERSION_ID >= 50300) {
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT);
} else {
error_reporting(E_ALL & ~E_NOTICE);
}
ini_set('magic_quotes_runtime', 0);
if (!file_exists(CONFIG)) {
$isInstaller = (... | <?php
require_once __DIR__.'/functions.php';
require_once __DIR__.'/defines.php';
if (PHP_VERSION_ID >= 50300) {
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT);
} else {
error_reporting(E_ALL & ~E_NOTICE);
}
if (!file_exists(CONFIG)) {
$isInstaller = (bool)preg_match('%(/|\\\\)install(\.p... |
Add chunked transfer encoding terminator | <?php
if (function_exists('apache_setenv')) {
apache_setenv('no-gzip', 1);
}
@ini_set('zlib.output_compression', 0);
while(ob_get_level()){ob_end_flush();}
header("Transfer-Encoding: chunked");
header("Content-Type: text/plain");
flush();
function getThingsToSay() {
$results = [];
for ($i = 0; $i < 80; $i++) ... | <?php
if (function_exists('apache_setenv')) {
apache_setenv('no-gzip', 1);
}
@ini_set('zlib.output_compression', 0);
while(ob_get_level()){ob_end_flush();}
header("Transfer-Encoding: chunked");
header("Content-Type: text/plain");
flush();
function getThingsToSay() {
$results = [];
for ($i = 0; $i < 40; $i++) ... |
Fix "Notice: Undefined offset: 1" | <?php
/**
* Part of ci-phpunit-test
*
* @author Kenji Suzuki <https://github.com/kenjis>
* @license MIT License
* @copyright 2015 Kenji Suzuki
* @link https://github.com/kenjis/ci-phpunit-test
*/
require __DIR__ . '/Installer.php';
$app = 'application';
if ($argv && $argv[1] && is_dir($argv[1])) ... | <?php
/**
* Part of ci-phpunit-test
*
* @author Kenji Suzuki <https://github.com/kenjis>
* @license MIT License
* @copyright 2015 Kenji Suzuki
* @link https://github.com/kenjis/ci-phpunit-test
*/
require __DIR__ . '/Installer.php';
$app = 'application';
if (isset($argv[1]) && is_dir($argv[1])) {
... |
Update snapshot util, disable javascript | <?php
namespace Ob\CampaignBundle\Utils;
use Knp\Snappy\Image;
class Snapshot
{
/**
* @var string
*/
private $folder;
/**
* @var string
*/
private $binaryPath;
/**
* @param null $folder The folder where to save the image
* @param string $binaryPath The path t... | <?php
namespace Ob\CampaignBundle\Utils;
use Knp\Snappy\Image;
class Snapshot
{
/**
* @var string
*/
private $folder;
/**
* @var string
*/
private $binaryPath;
/**
* @param null $folder The folder where to save the image
* @param string $binaryPath The path t... |
Fix double space in doc string. | <?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, In... | <?php
/**
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, In... |
Switch Splunk Dao from export endpoint to normal search/job endpoint as suggested in splunk docs | <?php
return [
'SplunkDao' => [
'urls' => [
'fetchFivehundredsForAlertWidget' => ':baseUrl:/services/search/jobs/export',
],
],
];
| <?php
return [
'SplunkDao' => [
'urls' => [
'fetchFivehundredsForAlertWidget' => ':baseUrl:/services/search/jobs',
],
],
];
|
Remove Type Hinting for PHP 5 compatibility | <?php namespace SendGrid\Mail;
class Category implements \JsonSerializable
{
private $category;
public function __construct(string $category=null)
{
if(isset($category)) $this->setCategory($category);
}
public function getCategory()
{
return $this->category;
}
public ... | <?php namespace SendGrid\Mail;
class Category implements \JsonSerializable
{
private $category;
public function __construct($category=null)
{
if(isset($category)) $this->setCategory($category);
}
public function getCategory()
{
return $this->category;
}
public functio... |
Change module model display name from id to name | <?php
namespace ATPCore\Model;
class Module extends \ATP\ActiveRecord
{
public function getActiveModules()
{
return $this->loadMultiple("is_active = 1");
}
public function getActiveModuleNames()
{
$names = array();
foreach($this->getActiveModules() as $module)
{
$names[] = $module->name;
}
re... | <?php
namespace ATPCore\Model;
class Module extends \ATP\ActiveRecord
{
public function displayName()
{
return $this->name;
}
public function getActiveModules()
{
return $this->loadMultiple("is_active = 1");
}
public function getActiveModuleNames()
{
$names = array();
foreach($this->getActiveModule... |
Change singleton trait access methods | <?php
namespace acd;
trait Singleton {
/** @var static Singleton instance */
protected static $instance;
/**
* Get Instance
* @return void Returns self instance
*/
final public static function getInstance()
{
return isset(static::$instance)
? static::$instance
... | <?php
namespace acd;
trait Singleton {
/** @var static Singleton instance */
protected static $instance;
/**
* Get Instance
* @return void Returns self instance
*/
final public static function getInstance()
{
return isset(static::$instance)
? static::$instance
... |
Use the logger within exception handler and shutdown function | <?php
namespace akilli;
use ErrorException;
use Throwable;
/**
* Initialize application
*/
foreach (glob(__DIR__ . '/../src/*.php') as $file) {
include_once $file;
}
/**
* Error handler
*/
set_error_handler(
function ($severity, $message, $file, $line) {
throw new ErrorException($message, 0, $sev... | <?php
namespace akilli;
use ErrorException;
use Throwable;
/**
* Initialize application
*/
foreach (glob(__DIR__ . '/../src/*.php') as $file) {
include_once $file;
}
/**
* Error handler
*/
set_error_handler(
function ($severity, $message, $file, $line) {
throw new ErrorException($message, 0, $sev... |
Add temporary test to assert pthreads are available | <?php
namespace XerkusTest\Neovim;
use PHPUnit_Framework_TestCase;
class NvimTest extends PHPUnit_Framework_TestCase
{
}
| <?php
namespace XerkusTest\Neovim;
use PHPUnit_Framework_TestCase;
class NvimTest extends PHPUnit_Framework_TestCase
{
public function testHasTreaded()
{
self::assertTrue(class_exists('Thread'));
}
}
|
ADD exemple vmlist for admin | <?php
/**
* @var yii\widgets\ActiveForm $form
* @var dektrium\user\models\User $user
*/
?>
<?= $form->field($user, 'username')->textInput(['maxlength' => 25]) ?>
<?= $form->field($user, 'email')->textInput(['maxlength' => 255]) ?>
<?= $form->field($user, 'password')->passwordInput() ?>
<?= $form->field($user, ... | <?php
/**
* @var yii\widgets\ActiveForm $form
* @var dektrium\user\models\User $user
*/
?>
<?= $form->field($user, 'username')->textInput(['maxlength' => 25]) ?>
<?= $form->field($user, 'email')->textInput(['maxlength' => 255]) ?>
<?= $form->field($user, 'password')->passwordInput() ?>
<?= $form->field($user, ... |
Disable emails as a feature - Removed unused service argument | <?php
namespace Oro\Bundle\SidebarBundle\Model;
use Doctrine\Common\Collections\ArrayCollection;
use Oro\Bundle\FeatureToggleBundle\Checker\FeatureChecker;
class WidgetDefinitionRegistry
{
const SIDEBAR_WIDGET_FEATURE_NAME = 'sidebar_widgets';
/**
* @var ArrayCollection
*/
protected $widgetDef... | <?php
namespace Oro\Bundle\SidebarBundle\Model;
use Doctrine\Common\Collections\ArrayCollection;
use Oro\Bundle\FeatureToggleBundle\Checker\FeatureChecker;
class WidgetDefinitionRegistry
{
const SIDEBAR_WIDGET_FEATURE_NAME = 'sidebar_widgets';
/**
* @var ArrayCollection
*/
protected $widgetDef... |
Make sure events are consistently ordered | <?php
class Denkmal_Paging_Event_Date extends Denkmal_Paging_Event_Abstract {
/**
* @param DateTime $date
* @param bool|null $showAll
*/
public function __construct(DateTime $date, $showAll = null) {
$date = clone $date;
$date->setTime(Denkmal_Site::getDayOffset(), 0, 0);
$startStamp = $date->getTimest... | <?php
class Denkmal_Paging_Event_Date extends Denkmal_Paging_Event_Abstract {
/**
* @param DateTime $date
* @param bool|null $showAll
*/
public function __construct(DateTime $date, $showAll = null) {
$date = clone $date;
$date->setTime(Denkmal_Site::getDayOffset(), 0, 0);
$startStamp = $date->getTimest... |
Change getBundles() method to abstract | <?php
namespace Perfumer\Framework\Application;
use Perfumer\Component\Container\Container;
abstract class AbstractApplication
{
/**
* @return void
*/
public function run()
{
$this->before();
$container = new Container();
$container->registerBundles($this->getBundles())... | <?php
namespace Perfumer\Framework\Application;
use Perfumer\Component\Container\Container;
abstract class AbstractApplication
{
/**
* @return void
*/
public function run()
{
$this->before();
$container = new Container();
$container->registerBundles($this->getBundles())... |
Clean up some comments on ConfigTrait | <?php
namespace Elasticquent;
trait ElasticquentConfigTrait
{
/**
* Get the Elasticquent config
*
* @param string $key the configuration key
* @param string $prefix filename of configuration file
* @return array configuration
*/
public function getElasticConfig($key = 'config', $... | <?php
namespace Elasticquent;
trait ElasticquentConfigTrait
{
/**
* Get the Elasticquent config
*
* @param string $key the configuration key
* @param string $prefix filename of configuration file
* @return array configuration
*/
public function getElasticConfig($key = 'config', $... |
Remove direct dependency into constructor | <?php
namespace Zend\Romans\Filter;
use Romans\Filter\Exception as FilterException;
use Romans\Filter\IntToRoman as BaseIntToRoman;
use Zend\Filter\FilterInterface;
/**
* Integer to Roman Number Filter
*/
class IntToRoman implements FilterInterface
{
/**
* {@inheritdoc}
*/
public function filter(... | <?php
namespace Zend\Romans\Filter;
use Romans\Filter\Exception as FilterException;
use Romans\Filter\IntToRoman as IntToRomanFilter;
use Zend\Filter\FilterInterface;
/**
* Integer to Roman Number Filter
*/
class IntToRoman implements FilterInterface
{
/**
* Base Integer to Roman Number Filter
* @typ... |
Allow nested arrays in API response | <?hh //strict
type TRouterWeb = Router<classname<Page>>;
type TRouterAPI = Router<(function():array<string, string>)>;
type User = shape(
'id' => int
);
| <?hh //strict
type TRouterWeb = Router<classname<Page>>;
type TRouterAPI = Router<(function():array<string, mixed>)>;
type User = shape(
'id' => int
);
|
Mark a discussion as read when it is created | <?php namespace Flarum\Api\Actions\Discussions;
use Event;
use Flarum\Core\Discussions\Commands\StartDiscussionCommand;
use Flarum\Core\Users\User;
use Flarum\Api\Actions\Base;
use Flarum\Api\Serializers\DiscussionSerializer;
class Create extends Base
{
/**
* Start a new discussion.
*
* @return Re... | <?php namespace Flarum\Api\Actions\Discussions;
use Event;
use Flarum\Core\Discussions\Commands\StartDiscussionCommand;
use Flarum\Core\Discussions\Commands\ReadDiscussionCommand;
use Flarum\Core\Users\User;
use Flarum\Api\Actions\Base;
use Flarum\Api\Serializers\DiscussionSerializer;
class Create extends Base
{
... |
Fix a typo in the comparison string which caused the test to always fail. | <?php
/*
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
/*
Relies on PHPUnit to test the functionality in ./Get_BasePathmapping.php.
Related custom constants are defined in ./phpunit.xml.
Example PHPUnit run command from this file's parent directory:
./vendor/... | <?php
/*
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
/*
Relies on PHPUnit to test the functionality in ./Get_BasePathmapping.php.
Related custom constants are defined in ./phpunit.xml.
Example PHPUnit run command from this file's parent directory:
./vendor/... |
Convert articles on a regular basis | <?php namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel {
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
'App\Console\Commands\ConvertTo... | <?php namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel {
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
'App\Console\Commands\ConvertTo... |
Update file cache path to /storage/framework/cache/ | <?php
/**
* Author: Abel Halo <zxz054321@163.com>
*/
return [
'debug' => true,
'cache' => [
'driver' => 'file',
'file' => [
'dir' => ROOT.'/cache/',
],
'memcached' => [
[
'host' => '127.0.0.1',
'port' => ... | <?php
/**
* Author: Abel Halo <zxz054321@163.com>
*/
return [
'debug' => true,
'cache' => [
'driver' => 'file',
'file' => [
'dir' => ROOT.'/storage/framework/cache/',
],
'memcached' => [
[
'host' => '127.0.0.1',
... |
Introduce NamespaceBasedFactoryBuilderInterface + related refactoring + CI fixes | <?php
namespace Spotman\Acl\ResourceRulesCollectorFactory;
use BetaKiller\Factory\NamespaceBasedFactoryBuilder;
use Spotman\Acl\ResourceInterface;
use Spotman\Acl\ResourceRulesCollector\ResourceRulesCollectorInterface;
class GenericAclResourceRulesCollectorFactory implements AclResourceRulesCollectorFactoryInterface
... | <?php
namespace Spotman\Acl\ResourceRulesCollectorFactory;
use BetaKiller\Factory\NamespaceBasedFactoryBuilderInterface;
use BetaKiller\Factory\NamespaceBasedFactoryInterface;
use Spotman\Acl\ResourceInterface;
use Spotman\Acl\ResourceRulesCollector\ResourceRulesCollectorInterface;
class GenericAclResourceRulesCollec... |
Load the front end routes | <?php namespace Modules\Page\Providers;
use Modules\Core\Providers\RoutingServiceProvider as CoreRoutingServiceProvider;
class RouteServiceProvider extends CoreRoutingServiceProvider
{
/**
* The root namespace to assume when generating URLs to actions.
* @var string
*/
protected $namespace = 'M... | <?php namespace Modules\Page\Providers;
use Modules\Core\Providers\RoutingServiceProvider as CoreRoutingServiceProvider;
class RouteServiceProvider extends CoreRoutingServiceProvider
{
/**
* The root namespace to assume when generating URLs to actions.
* @var string
*/
protected $namespace = 'M... |
Define HasAbilities trait on default user. | <?php
namespace App;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
class User extends Mo... | <?php
namespace App;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\HasAbilities;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword... |
Make getPath() less error prone by allowing both backward and forward slashes | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\DoctrineMigrationsBundle;
use Symfony\... | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\DoctrineMigrationsBundle;
use Symfony\... |
Fix drop_connection for the default connection | <?php
/**
* @package ActiveRecord
*/
namespace ActiveRecord;
/**
* Singleton to manage any and all database connections.
*
* @package ActiveRecord
*/
class ConnectionManager extends Singleton
{
/**
* Array of {@link Connection} objects.
* @var array
*/
static private $connections = array();
/**
* If ... | <?php
/**
* @package ActiveRecord
*/
namespace ActiveRecord;
/**
* Singleton to manage any and all database connections.
*
* @package ActiveRecord
*/
class ConnectionManager extends Singleton
{
/**
* Array of {@link Connection} objects.
* @var array
*/
static private $connections = array();
/**
* If ... |
Set global db adapter only if there is one | <?php
/**
* ZnZend
*
* @author Zion Ng <zion@intzone.com>
* @link http://github.com/zionsg/ZnZend for canonical source repository
*/
namespace ZnZend;
use Zend\Db\TableGateway\Feature\GlobalAdapterFeature;
use Zend\Mvc\MvcEvent;
class Module
{
/**
* Set global/static db adapter for feature-enabled Ta... | <?php
/**
* ZnZend
*
* @author Zion Ng <zion@intzone.com>
* @link http://github.com/zionsg/ZnZend for canonical source repository
*/
namespace ZnZend;
use Zend\Db\TableGateway\Feature\GlobalAdapterFeature;
use Zend\Mvc\MvcEvent;
class Module
{
/**
* Set global/static db adapter for feature-enabled Ta... |
Add timezone to programme date format | <?php
namespace XmlTv\Tv;
class Programme
{
const DATE_FORMAT = 'YmdHis';
/**
* @var string
*/
public $start;
/**
* @var string
*/
public $stop;
/**
* @var string
*/
public $channel;
/**
* @var string
*/
public $title;
/**
* @va... | <?php
namespace XmlTv\Tv;
class Programme
{
const DATE_FORMAT = 'YmdHis O';
/**
* @var string
*/
public $start;
/**
* @var string
*/
public $stop;
/**
* @var string
*/
public $channel;
/**
* @var string
*/
public $title;
/**
* @... |
Create simple test on filters | <?php
namespace AppBundle\Tests\Controller;
class DreamControllerTest extends AbstractApiTest
{
public function testGetDreamsAction()
{
$client = static::createClient();
$crawler = $client->request('GET', '/dreams');
$response = $client->getResponse();
$this->assertJsonRes... | <?php
namespace AppBundle\Tests\Controller;
class DreamControllerTest extends AbstractApiTest
{
/**
* @dataProvider providerData
*/
public function testGetDreamsAction($status,$limit,$sort_by,$sort_order)
{
$client = static::createClient();
$crawler = $client->request('GET', ... |
Add profile link inside karma render | <?php
namespace App\Middlewares;
use App\Message;
use App\Gitter\Middleware\MiddlewareInterface;
/**
* Проверяет слово "карма" и выводит статус
*
* Class KarmaRenderMiddleware
* @package App\Gitter\Middleware
*/
class KarmaRenderMiddleware implements MiddlewareInterface
{
/**
* @param Message $message
... | <?php
namespace App\Middlewares;
use App\Message;
use App\Gitter\Middleware\MiddlewareInterface;
/**
* Проверяет слово "карма" и выводит статус
*
* Class KarmaRenderMiddleware
* @package App\Gitter\Middleware
*/
class KarmaRenderMiddleware implements MiddlewareInterface
{
/**
* @param Message $message
... |
Add summary & verbose error description to SWORDAPPErrorDocument | <?php
require_once("swordappentry.php");
require_once("utils.php");
class SWORDAPPErrorDocument extends SWORDAPPEntry {
// The error URI
public $sac_erroruri;
// Construct a new deposit response by passing in the http status code
function __construct($sac_newstatus, $sac_thexml) {
// Call the super constructo... | <?php
require_once("swordappentry.php");
require_once("utils.php");
class SWORDAPPErrorDocument extends SWORDAPPEntry {
// The error URI
public $sac_erroruri;
// Summary description of error
public $sac_error_summary;
// Verbose description of error
public $sac_verbose_description;
// Construct a new dep... |
Bring coverage back to 100% | <?php
class ErrorHandlerTest extends PHPUnit_Framework_TestCase
{
public function testHandlesException()
{
$handler = new \Fyuze\Error\ErrorHandler();
ob_start();
$handler->handle(new Exception('exception handled'));
$this->assertEquals('exception handled', ob_get_clean());
... | <?php
class ErrorHandlerTest extends PHPUnit_Framework_TestCase
{
public function testHandlesException()
{
$handler = new \Fyuze\Error\ErrorHandler();
ob_start();
$handler->handle(new Exception('exception handled'));
$this->assertEquals('exception handled', ob_get_clean());
... |
Remove duplicitade da informação required | <?php
use MapasCulturais\i; ?>
<div ng-class="field.error ? 'invalidField': '' " ng-if="::field.fieldType === 'brPhone'" id="field_{{::field.id}}">
<span class="label">
{{field.title}}
<div ng-if="requiredField(field)" class="field-required"><span class="description"><?php i::_e('obrigatório') ?><... | <?php
use MapasCulturais\i; ?>
<div ng-class="field.error ? 'invalidField': '' " ng-if="::field.fieldType === 'brPhone'" id="field_{{::field.id}}">
<span class="label">
{{field.title}}
<div ng-if="requiredField(field)" class="field-required"><span class="description"><?php i::_e('obrigatório') ?><... |
Allow tests execution even when the library is downloaded as a composer package | <?php
$ds = DIRECTORY_SEPARATOR;
include __DIR__ . $ds . ".." . $ds . "vendor" . $ds . "autoload.php";
| <?php
$ds = DIRECTORY_SEPARATOR;
$paths = array(
".." . $ds . "vendor",
".." . $ds . ".." . $ds . ".."
);
foreach ($paths as $path) {
$abspath = __DIR__ . $ds . $path . $ds . "autoload.php";
if (file_exists($abspath)) {
require_once $abspath;
break;
}
}
|
Revert last commit, to avoid vulnerabilities | <?php
namespace App\Libs;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use App\Libs\ViewResolver;
use Illuminate\Http\Request;
abstract class Control... | <?php
namespace App\Libs;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use App\Libs\ViewResolver;
use Illuminate\Http\Request;
abstract class Control... |
Remove a deprecated call to bindRequest() | <?php
namespace Acme\DemoBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Acme\DemoBundle\Form\ContactType;
// these import the "@Route" and "@Template" annotations
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use S... | <?php
namespace Acme\DemoBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Acme\DemoBundle\Form\ContactType;
// these import the "@Route" and "@Template" annotations
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use S... |
Add null coalesce for label and style attribute | <?php /** @var $l \OCP\IL10N */ ?>
<?php
script('core', 'dist/login');
?>
<div id="login"></div>
<?php if (!empty($_['alt_login'])) { ?>
<div id="alternative-logins">
<?php foreach($_['alt_login'] as $login): ?>
<a class="button <?php p(isset($login['style']) ? $login['style'] : ''); ?>" aria-... | <?php /** @var $l \OCP\IL10N */ ?>
<?php
script('core', 'dist/login');
?>
<div id="login"></div>
<?php if (!empty($_['alt_login'])) { ?>
<div id="alternative-logins">
<?php foreach($_['alt_login'] as $login): ?>
<a class="button <?php p($login['style'] ?? ''); ?>" aria-label="<?php p($login['l... |
Fix data collector function unimplemented | <?php
namespace JDecool\Bundle\TwigConstantAccessorBundle\DataCollector;
use JDecool\Bundle\TwigConstantAccessorBundle\Accessor\ConstantCollection;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
class Constant... | <?php
namespace JDecool\Bundle\TwigConstantAccessorBundle\DataCollector;
use JDecool\Bundle\TwigConstantAccessorBundle\Accessor\ConstantCollection;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
class Constant... |
Redefine public static func primaryKey | <?php
/*
* Domain plugin for HiPanel
*
* @link https://github.com/hiqdev/hipanel-module-domain
* @package hipanel-module-domain
* @license BSD-3-Clause
* @copyright Copyright (c) 2014-2015, HiQDev (http://hiqdev.com/)
*/
namespace hipanel\modules\domain\cart;
use hipanel\modules\domain\models\Domain;... | <?php
/*
* Domain plugin for HiPanel
*
* @link https://github.com/hiqdev/hipanel-module-domain
* @package hipanel-module-domain
* @license BSD-3-Clause
* @copyright Copyright (c) 2014-2015, HiQDev (http://hiqdev.com/)
*/
namespace hipanel\modules\domain\cart;
use hipanel\modules\domain\models\Domain;... |
Add commissioners to league admin | <?php
namespace SofaChamps\Bundle\BowlPickemBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
class LeagueAdmin extends Admin
{
protected function configureFormFields(FormMapper $fo... | <?php
namespace SofaChamps\Bundle\BowlPickemBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
class LeagueAdmin extends Admin
{
protected function configureFormFields(FormMapper $fo... |
Remove test code from index installer | <?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD Lic... | <?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD Lic... |
Change the notification object for an array | <?php
namespace App\Notifications;
use GuzzleHttp\Client;
use Illuminate\Http\Request;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
class RequestReview extends Notification
{
public $notification;
public $client;
/**
* Create a new notification ins... | <?php
namespace App\Notifications;
use function array_key_exists;
use GuzzleHttp\Client;
use Illuminate\Http\Request;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
class RequestReview extends Notification
{
public $notification;
public $client;
/**
... |
Use list based markup for TOC instead of a table | <?php
/**
* tobiju
*
* @link https://github.com/tobiju/bookdown-bootswatch-templates for the canonical source repository
* @copyright Copyright (c) 2015 Tobias Jüschke
* @license https://github.com/tobiju/bookdown-bootswatch-templates/blob/master/LICENSE.txt New BSD License
*/
if (!$this->page->hasToc... | <?php
/**
* tobiju
*
* @link https://github.com/tobiju/bookdown-bootswatch-templates for the canonical source repository
* @copyright Copyright (c) 2015 Tobias Jüschke
* @license https://github.com/tobiju/bookdown-bootswatch-templates/blob/master/LICENSE.txt New BSD License
*/
if (!$this->page->hasToc... |
Add a CSS parameter for JSON blocks | <?php
class JSONLoader extends Element {
public function output($args) {
$id = rand(0,100000);
echo("
<style>
#json-".$id." { font-weight: bold; font-size: ".$args["font_size"]."em; vertical-align: middle; margin-top: ".$args["margin_top"]."; }
</style>
<script>
$().ready(function() {
... | <?php
class JSONLoader extends Element {
public function output($args) {
$id = rand(0,100000);
echo("
<style>
#json-".$id." { font-weight: bold; font-size: ".$args["font_size"]."em; vertical-align: middle; margin-top: ".$args["margin_top"]."; }
".$args["css"]."
</style>
<script>
$().... |
Add title var for template | <?php
/**
* # Page View Model
*
* Automaticly load page based on slug, throw 404 if page doesn't exist.
*
* @package Flatfile
* @category View Model
* @author Ziopod <ziopod@gmail.com>
* @copyright (c) 2013-2014 Ziopod
* @license http://opensource.org/licenses/MIT
**/
class Flatfile_View_Page extends View_App{
... | <?php
/**
* # Page View Model
*
* Automaticly load page based on slug, throw 404 if page doesn't exist.
*
* @package Flatfile
* @category View Model
* @author Ziopod <ziopod@gmail.com>
* @copyright (c) 2013-2014 Ziopod
* @license http://opensource.org/licenses/MIT
**/
class Flatfile_View_Page extends View_App{
... |
Fix bug on Realisations blocks | <?php
get_template_part('templates/page', 'header'); ?>
<div class="blocks">
<ul class="blocks-wrapper"> <?
while (have_posts()) : the_post(); ?>
<li class="realisation-<?= basename(get_permalink()) ?>" style="background-image: url('<?= get_the_thumbnail_url() ?>')">
<a href="<?= get_p... | <?php
get_template_part('templates/page', 'header'); ?>
<div class="blocks">
<ul class="blocks-wrapper"> <?
while (have_posts()) : the_post(); ?>
<li class="realisation-<?= basename(get_permalink()) ?>" style="background-image: url('<?= get_the_thumbnail_url() ?>')">
<a href="<?= get_p... |
Fix Kanbanize Service use conflicts | <?php
namespace Kanbanize\Service;
use Kanbanize\Entity\KanbanizeTask;
interface KanbanizeService {
//public function moveTask(KanbanizeTask $kanbanizeTask, $status);
public function createNewTask($projectId, $taskSubject, $boardId);
public function deleteTask(KanbanizeTask $kanbanizeTask);
public functio... | <?php
namespace Kanbanize\Service;
use Kanbanize\Entity\KanbanizeTask;
interface KanbanizeService {
//public function moveTask(KanbanizeTask $kanbanizeTask, $status);
public function createNewTask($projectId, $taskSubject, $boardId);
public function deleteTask(KTask $kanbanizeTask);
public function getTas... |
Exclude description from search query | <?php
/**
* @file getmodels.php
* Script for searching models matching the words entered by the user
*/
include 'db_connect.php';
include 'tools.php';
// Get search words
$searchstr = explode(" ", trim($_POST['q']));
// Compare each word to the name, the classification and the description of a model
$whereClause ... | <?php
/**
* @file getmodels.php
* Script for searching models matching the words entered by the user
*/
include 'db_connect.php';
include 'tools.php';
// Get search words
$searchstr = explode(" ", trim($_POST['q']));
// Compare each word to the name, the classification and the description of a model
$whereClause ... |
Fix deprecation for symfony/config 4.2 | <?php
/*
* This file is part of the StampieBundle package.
*
* (c) Henrik Bjornskov <henrik@bjrnskov.dk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Stampie\StampieBundle\DependencyInjection;
use Symfony\Component\... | <?php
/*
* This file is part of the StampieBundle package.
*
* (c) Henrik Bjornskov <henrik@bjrnskov.dk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Stampie\StampieBundle\DependencyInjection;
use Symfony\Component\... |
Add user id tracking to analtics code | <script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.j... | <script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.j... |
Check for the specified env variable | <?php
namespace Dock\System\Environ;
use Dock\IO\ProcessRunner;
use Symfony\Component\Process\Process;
class BashEnvironManipulator implements EnvironManipulator
{
/**
* @var string
*/
private $file;
/**
* @var ProcessRunner
*/
private $processRunner;
/**
* @param string... | <?php
namespace Dock\System\Environ;
use Dock\IO\ProcessRunner;
use Symfony\Component\Process\Process;
class BashEnvironManipulator implements EnvironManipulator
{
/**
* @var string
*/
private $file;
/**
* @var ProcessRunner
*/
private $processRunner;
/**
* @param string... |
Use use import so the code is easier on the eyes | <?php
require dirname(__DIR__) . '/vendor/autoload.php';
// Create eventloop
$loop = \React\EventLoop\Factory::create();
// Create a socket
$socket = new \React\Socket\Server($loop);
$socket->listen(12345, '0.0.0.0');
// Bind to IP and port
$node = new \WyriHaximus\PhuninNode\Node($loop, $socket);
// Add plugins
$... | <?php
use React\EventLoop\Factory;
use React\Socket\Server;
use WyriHaximus\PhuninNode\Node;
use WyriHaximus\PhuninNode\Plugins\MemoryUsage;
use WyriHaximus\PhuninNode\Plugins\Plugins;
use WyriHaximus\PhuninNode\Plugins\PluginsCategories;
use WyriHaximus\PhuninNode\Plugins\Uptime;
require dirname(__DIR__) . '/vendor/... |
Add header login drop down and button | <div class="row">
<div class="col-md-8">
<h1>Stocks Game</h1>
</div>
<div class="col-md-4">
<nav id="main">
<ul class="nav nav-pills pull-right">
<li role="presentation"><a href="/home">Home</a></li>
<li role="presentation"><a href="/stock">Stocks</a></li>
<li role="presentat... | <div class="row">
<div class="col-md-8">
<h1>Stocks Game</h1>
</div>
<div class="col-md-4">
<nav id="main">
<ul class="nav nav-pills pull-right">
<li role="presentation"><a href="/home">Home</a></li>
<li role="presentation"><a href="/stock">Stocks</a></li>
<li role="presentat... |
Change type to improve type hint | <?php namespace Aedart\Scaffold\Console;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
/**
* Base Command
*
* The base command for all scaffold console comman... | <?php namespace Aedart\Scaffold\Console;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
/**
* Base Command
*
* The base command for all scaffold console comman... |
Set table validation to false by default | <?php
use Cake\Core\Configure;
// CsvMigrations plugin configuration
return [
'CsvMigrations' => [
'api' => [
'auth' => Configure::read('API.auth')
]
]
];
| <?php
use Cake\Core\Configure;
// CsvMigrations plugin configuration
return [
'CsvMigrations' => [
'tableValidation' => false,
'api' => [
'auth' => Configure::read('API.auth')
]
]
];
|
Switch to WP action for dependent plugins | <?php
/*
Plugin Name: Castlegate IT WP Breadcrumb
Plugin URI: http://github.com/castlegateit/cgit-wp-breadcrumb
Description: Simple breadcrumb navigation for WordPress.
Version: 3.0
Author: Castlegate IT
Author URI: http://www.castlegateit.co.uk/
License: MIT
*/
add_action('plugins_loaded', function () {
requir... | <?php
/*
Plugin Name: Castlegate IT WP Breadcrumb
Plugin URI: http://github.com/castlegateit/cgit-wp-breadcrumb
Description: Simple breadcrumb navigation for WordPress.
Version: 3.1
Author: Castlegate IT
Author URI: http://www.castlegateit.co.uk/
License: MIT
*/
if (!defined('ABSPATH')) {
wp_die('Access denied'... |
Enable to annote to parameter | <?php
declare(strict_types=1);
namespace Ray\Di\Di;
/**
* Annotates your class methods into which the Injector should inject values
*
* @Annotation
* @Target("METHOD")
*/
final class Inject implements InjectInterface
{
/**
* If true, and the appropriate binding is not found, the Injector will skip inje... | <?php
declare(strict_types=1);
namespace Ray\Di\Di;
use Attribute;
/**
* Annotates your class methods into which the Injector should inject values
*
* @Annotation
* @Target("METHOD")
*/
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_PARAMETER)]
final class Inject implements InjectInterface
{
/**
... |
Add "pictures" and "videos" tables | <?php
/**
* @author Pierre-Henry Soria <hello@ph7cms.com>
* @copyright (c) 2018, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
* @package PH7 / App / Include / Class
*/
namespace P... | <?php
/**
* @author Pierre-Henry Soria <hello@ph7cms.com>
* @copyright (c) 2018, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
* @package PH7 / App / Include / Class
*/
namespace P... |
Fix formatting broken by phpstorm | <?php
namespace AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
/**
* Asset form
*
* note: title is hidden (filled from the controller based on AssetTypeTitle form)
*/
class AssetType extends ... | <?php
namespace AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
/**
* Asset form
*
* note: title is hidden (filled from the controller based on AssetTypeTitle form)
*/
class AssetType extends... |
Use custom exception handling for test JANUS client | <?php
if (PHP_SAPI !== 'cli') {
die('Command line access only' . PHP_EOL);
}
if (!isset($argv[1])) {
die("Please supply a method to call, like so: php janus_client.php getMetadata https://example.edu" . PHP_EOL);
}
require './../library/EngineBlock/ApplicationSingleton.php';
$application = EngineBlock_Appli... | <?php
if (PHP_SAPI !== 'cli') {
die('Command line access only' . PHP_EOL);
}
if (!isset($argv[1])) {
die("Please supply a method to call, like so: php janus_client.php getMetadata https://example.edu" . PHP_EOL);
}
try {
require './../library/EngineBlock/ApplicationSingleton.php';
$application = EngineBlock_... |
Add basic homepage for unauthenticated users | <?php
require_once __DIR__."/header.php";
require_once(__DIR__."/views/views.php");
?>
<!DOCTYPE html>
<html>
<?php if(isset($_SESSION["loggedIn"]) && $_SESSION["loggedIn"]){makeHeader("Add a Video");}
else{
makeHeader("Home");
}
?>
<body>
<?php makeNav();?>
<div class="container-fluid">
<?php if(isset($... | <?php
require_once __DIR__."/header.php";
require_once(__DIR__."/views/views.php");
?>
<!DOCTYPE html>
<html>
<?php if(isset($_SESSION["loggedIn"]) && $_SESSION["loggedIn"]){makeHeader("Add a Video");}
else{
makeHeader("Home");
}
?>
<body>
<?php makeNav();?>
<div class="container-fluid">
<?php if(isset($... |
Add read only functionnality on published node | <?php
namespace PHPOrchestra\ModelBundle\EventListener;
use Doctrine\ODM\MongoDB\Event\LifecycleEventArgs;
use Doctrine\ODM\MongoDB\Event\PostFlushEventArgs;
use PHPOrchestra\ModelBundle\Model\StatusInterface;
use PHPOrchestra\ModelBundle\Model\StatusableInterface;
/**
* Class SavePublishedDocumentListener
*/
clas... | <?php
namespace PHPOrchestra\ModelBundle\EventListener;
use Doctrine\ODM\MongoDB\Event\LifecycleEventArgs;
use Doctrine\ODM\MongoDB\Event\PostFlushEventArgs;
use PHPOrchestra\ModelBundle\Model\StatusInterface;
use PHPOrchestra\ModelBundle\Model\StatusableInterface;
/**
* Class SavePublishedDocumentListener
*/
clas... |
Use ternary instead of if-statement. | <?php
namespace Phragile;
class StatusDispatcherFactory {
private $workboardMode = false;
public function __construct($workboardMode)
{
$this->workboardMode = $workboardMode;
}
/**
* @return StatusDispatcher
*/
public function createInstance()
{
if ($this->workboardMode) return new StatusByWorkboardDi... | <?php
namespace Phragile;
class StatusDispatcherFactory {
private $workboardMode = false;
public function __construct($workboardMode)
{
$this->workboardMode = $workboardMode;
}
/**
* @return StatusDispatcher
*/
public function createInstance()
{
return $this->workboardMode
? new StatusByWorkboardDi... |
Use Reference instead Site for Tags | <?php
include __DIR__.'/../../vendor/autoload.php';
/**
* Authentication
*
* You'll get the client id and secret at the plaform (API Access)
**/
$Client = new Productsup\Client();
$Client->id = 1234;
$Client->secret = 'simsalabim';
$ProductData = new Productsup\Service\ProductData($Client);
/**
* Optional... | <?php
include __DIR__.'/../../vendor/autoload.php';
/**
* Authentication
*
* You'll get the client id and secret at the plaform (API Access)
**/
$Client = new Productsup\Client();
$Client->id = 1234;
$Client->secret = 'simsalabim';
$ProductData = new Productsup\Service\ProductData($Client);
/**
* Optional... |
Add get data method to test case | <?php
namespace Michaeljennings\Carpenter\Tests;
use Michaeljennings\Carpenter\Carpenter;
use PHPUnit_Framework_TestCase;
class TestCase extends PHPUnit_Framework_TestCase
{
public function __construct()
{
// Fixes error with session_start() and phpunit
ob_start();
}
public function set... | <?php
namespace Michaeljennings\Carpenter\Tests;
use Michaeljennings\Carpenter\Carpenter;
use PHPUnit_Framework_TestCase;
class TestCase extends PHPUnit_Framework_TestCase
{
public function __construct()
{
// Fixes error with session_start() and phpunit
ob_start();
}
public function set... |
Add documentation for customising emails per channel | <?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.
*/
declare(strict_types=1);
namespace Sylius\Bundle\AdminBundle\EmailManager;
use Sylius\Bundle\CoreBun... | <?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.
*/
declare(strict_types=1);
namespace Sylius\Bundle\AdminBundle\EmailManager;
use Sylius\Bundle\CoreBun... |
Add nav bar, align contents to the center | <?php
session_start();
if (isset($_SESSION['isAdmin']) && $_SESSION['isAdmin'] == true)
{
echo "you're an admin";
}
else{
header("Location: static_homepage.php", true, 301);
die();
}
?>
<!DOCTYPE html>
<html lang = "en">
<head>
<title>Welcome to the admin page</title>
</head>
<body>
... | <?php
session_start();
if (isset($_SESSION['isAdmin']) && $_SESSION['isAdmin'] == true)
{
echo "you're an admin";
}
else{
header("Location: static_homepage.php", true, 301);
die();
}
?>
<!DOCTYPE html>
<html lang = "en">
<head>
<title>Welcome to the admin page</title>
</head>
<body>
... |
Fix issue where array was not being returnedgit checkout master | <?php namespace Anomaly\TagsFieldType;
use Anomaly\Streams\Platform\Addon\FieldType\FieldTypePresenter;
/**
* Class TagsFieldTypePresenter
*
* @link http://pyrocms.com/
* @author PyroCMS, Inc. <support@pyrocms.com>
* @author Ryan Thompson <ryan@pyrocms.com>
* @package Anomaly\TagsFi... | <?php namespace Anomaly\TagsFieldType;
use Anomaly\Streams\Platform\Addon\FieldType\FieldTypePresenter;
/**
* Class TagsFieldTypePresenter
*
* @link http://pyrocms.com/
* @author PyroCMS, Inc. <support@pyrocms.com>
* @author Ryan Thompson <ryan@pyrocms.com>
*/
class TagsFieldTypePresenter... |
Fix initialization of OC_Filesystem setup from DAV | <?php
/**
* ownCloud
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack kde@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the Lic... | <?php
/**
* ownCloud
*
* @author Jakob Sack
* @copyright 2011 Jakob Sack kde@jakobsack.de
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the Lic... |
Add new method to Payment repository | <?php
namespace Stfalcon\Bundle\PaymentBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* PaymentsRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class PaymentRepository extends EntityRepository
{
} | <?php
namespace Stfalcon\Bundle\PaymentBundle\Entity;
use Doctrine\ORM\EntityRepository;
use Application\Bundle\UserBundle\Entity\User;
/**
* PaymentsRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class PaymentRepository extends EntityRepository
... |
Use env variables for prestashop url/token | <?php
return [
'url' => 'http://domain.com',
'token' => '',
'debug' => env('APP_DEBUG', false)
];
| <?php
return [
'url' => env('PRESTASHOP_URL', 'http://domain.com'),
'token' => env('PRESTASHOP_TOKEN', ''),
'debug' => env('APP_DEBUG', false)
];
|
Add karma bot to inline data whitelist | <?php
namespace App\Middlewares;
use App\Message;
use App\Gitter\Middleware\MiddlewareInterface;
/**
* Class InlineDataMiddleware
* @package App\Gitter\Middleware
*/
class InlineDataMiddleware implements MiddlewareInterface
{
/**
* @param Message $message
* @return mixed
*/
public function h... | <?php
namespace App\Middlewares;
use App\Message;
use App\Gitter\Middleware\MiddlewareInterface;
/**
* Class InlineDataMiddleware
* @package App\Gitter\Middleware
*/
class InlineDataMiddleware implements MiddlewareInterface
{
/**
* @param Message $message
* @return mixed
*/
public function h... |
Remove unneeded abstract method implementation | <?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\PageBundle\Page\Service;
use Symfony\Component\HttpFou... | <?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\PageBundle\Page\Service;
use Symfony\Component\HttpFou... |
Fix id column in migration | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePhpdebugbarStorageTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('phpde... | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePhpdebugbarStorageTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('phpde... |
Add deprecation error for using `addLicenseKey` after Shopware 5.5. | <?php
namespace K10rProject\Helpers;
use Shopware\Bundle\PluginInstallerBundle\Service\PluginLicenceService;
use Shopware\Components\Model\ModelManager;
use Shopware\Models\Plugin\License;
class LicenseHelper
{
/** @var PluginLicenceService */
private $licenseService;
/** @var ModelManager */
privat... | <?php
namespace K10rProject\Helpers;
use Shopware\Bundle\PluginInstallerBundle\Service\PluginLicenceService;
use Shopware\Components\Model\ModelManager;
use Shopware\Models\Plugin\License;
class LicenseHelper
{
/** @var PluginLicenceService */
private $licenseService;
/** @var ModelManager */
privat... |
Add auto detedt url from model scenario | <?php
/*
* X-editable extension for Yii2
*
* @link https://github.com/hiqdev/yii2-x-editable
* @package yii2-x-editable
* @license BSD-3-Clause
* @copyright Copyright (c) 2015, HiQDev (https://hiqdev.com/)
*/
namespace hiqdev\xeditable\widgets;
use hiqdev\xeditable\traits\XEditableTrait;
use yii\base... | <?php
/*
* X-editable extension for Yii2
*
* @link https://github.com/hiqdev/yii2-x-editable
* @package yii2-x-editable
* @license BSD-3-Clause
* @copyright Copyright (c) 2015, HiQDev (https://hiqdev.com/)
*/
namespace hiqdev\xeditable\widgets;
use hiqdev\xeditable\traits\XEditableTrait;
use yii\base... |
Remove redundant routes that are now implemented using annotations. | <?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| ... | <?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| ... |
Use some PHP 5.4 constants unconditionally | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Translation\Dumper;
use Symfony\Component\Translation... | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Translation\Dumper;
use Symfony\Component\Translation... |
Improve wording of german translation file | <?php
return [
'Load more items' => 'Weitere eintrge laden',
'You reached the end' => 'Sie sind am Ende angekommen'
]; | <?php
return [
'Load more items' => 'Weitere Einträge laden',
'You reached the end' => 'Keine weiteren Einträge vorhanden'
];
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.