Skip to content

Instantly share code, notes, and snippets.

View WinterSilence's full-sized avatar
🙃
explore

Anton WinterSilence

🙃
explore
View GitHub Profile
@WinterSilence
WinterSilence / arrayToXml.php
Last active August 7, 2021 02:15
PHP function for convert array to SimpleXMLElement object
<?php
namespace Enso;
use SimpleXMLElement;
/**
* Converts array to XML object.
* Note: attribute keys must prefix '@'.
*
@WinterSilence
WinterSilence / php7_array_polyfills.php
Last active April 22, 2020 07:30
Polyfills of PHP 7.1-7.3 functions: is_iterable, is_countable, array_key_first, array_key_last
<?php
if (! function_exists('is_iterable')) {
/**
* Verify that the contents of a variable is an iterable value.
*
* @link https://php.net/manual/en/function.is_iterable.php
* @param mixed $var Variable to test
* @return bool
*/
@WinterSilence
WinterSilence / Enso\Core\Route.php
Last active February 1, 2021 14:54
KF7\Routing classes
<?php
/**
* @link https://kf7.github.io
* @copyright (c) 2006-2020 Kohana team
* @license https://kf7.github.io/license/ BSD-3-Clause
*/
declare(strict_types=1);
namespace KF7\System\Http\Routing;
@WinterSilence
WinterSilence / waExtendedPlugin.class.php
Last active January 23, 2022 07:12
Extended plugin for Webasyst framework
<?php
/**
* Extended plugin for Webasyst framework.
*/
abstract class waExtendedPlugin extends waPlugin
{
/**
* @var waSystem
*/
@WinterSilence
WinterSilence / Sitemap\Url.php
Last active January 31, 2020 17:18
Version of Sitemap\Url
<?php
namespace Sitemap;
/**
* Basic sitemap URL class.
*/
class Url extends UrlAbstract
{
/**
* Valid values of "changefreq" element.
@WinterSilence
WinterSilence / Sitemap.php
Last active May 6, 2016 09:41
Sitemap refactoring
<?php
namespace Sitemap;
/**
* A class for generating sitemaps.
* @see http://sitemaps.org
*/
class Sitemap
{
/**
<?php
/**
* A general-purpose implementation that includes the optional functionality
* of allowing multiple base directories for a single namespace prefix.
*/
class Psr4Autoloader
{
const EXTENSION = '.php';
/**
* An associative array where the key is a namespace prefix and the value
@WinterSilence
WinterSilence / css-padding-hack.css
Last active September 4, 2020 11:57
CSS padding hack for create block with responsive square image
/* Example:
<div class="thumbnail">
<div class="square-box">
<a href="#"><img src="..." class="img-responsive" alt="..."></a>
</div>
</div>
*/
.square-box {
display: table;
@WinterSilence
WinterSilence / IRequest.php
Last active August 29, 2015 14:11
Enso\Core - routing
<?php
namespace Enso\Core;
/**
* Interface for request.
*
* @package Enso\Core
* @copyright (c) 2014 WinterSilence
* @license MIT License
@WinterSilence
WinterSilence / ExceptionHandler.php
Last active August 29, 2015 14:11
Enso\Core\ShutdownHandler
<?php
namespace Enso\Core;
/**
* Inline exception handler, displays the error message, source of the exception
* and the stack trace of the error.
*
* @package Enso\Core
* @copyright (c) 2014 WinterSilence