Skip to content

Instantly share code, notes, and snippets.

Sergey Shlokov sergant210

Block or report user

Report or block sergant210

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sergant210
sergant210 / Worker.php
Created May 9, 2019 — forked from etheriqa/Worker.php
Parallel processing on PHP using stream_select()
View Worker.php
<?php
interface Worker
{
public function getCommand();
public function done($stdout, $stderr);
public function fail($stdout, $stderr, $status);
}
View search_getoption_use.php
<?php
/**
* Файл поиска использования метода getOption.
* Должен находится в корне сайта.
*/
define('MODX_API_MODE', true);
require 'index.php';
$modx->lexicon->load('resource','context','element','system_events','access','default','setting');
//echo $modx->lexicon('setting_cache_context_settings'); exit;
$count = 0;
View plugin.onebooking.php
<?php
/** @var array $scriptProperties
* @var msOrder $msOrder
*/
switch ($modx->event->name) {
case 'msOnBeforeAddToCart':
if (!empty($_SESSION['oneBooking']['price'])) {
$product->set('price', $_SESSION['oneBooking']['price']);
}
break;
@sergant210
sergant210 / StorageTrait.php
Last active Oct 10, 2017
Fenom Storage trait
View StorageTrait.php
<?php
namespace Fenom;
trait StorageTrait
{
/**
* @var array storage
*/
View pdotoolsplus.class.php
<?php
require_once 'pdotools.class.php';
class pdoToolsPlus extends pdoTools
{
/**
* Loads template engine
*
* @return bool|Fenom
*/
View _fenomplus.php
<?php
require_once '_fenom.php';
class FenomPlus extends FenomX
{
/**
* @inheritdoc
*/
protected function _addDefaultModifiers()
{
View obExtras
<?php
$oneBooking = $modx->getService('onebooking','oneBooking',$modx->getOption('core_path').'components/onebooking/model/onebooking/', $scriptProperties);
if (!($oneBooking instanceof oneBooking)) return '';
$included = array();
if (!empty($scriptProperties['fields'])) {
$included = explode(',',$scriptProperties['fields']);
array_walk($included,'trim');
}
$fields = false;
@sergant210
sergant210 / gist:4a5e631a7005bea680da
Created Sep 19, 2015
Скрипт переноса данных из HitsPage в siteStatistics
View gist:4a5e631a7005bea680da
<?php
$tstart = microtime(true);
$hits = array();
$q = $modx->newQuery('modResource');
$q->select('id,properties');
$q->sortby('id');
// Для поэтапной обработки указываем limit и offset
//$q->limit(100,0);
if ($q->prepare() && $q->stmt->execute()) {
while($row = $q->stmt->fetch(PDO::FETCH_ASSOC)) {
@sergant210
sergant210 / showErrors.php
Last active Aug 29, 2015
Show errors from the system error log in a new window
View showErrors.php
<?php
switch ($modx->event->name) {
case 'OnManagerPageBeforeRender':
// Определяем названия // Define titles on your language
$lang['no'] = 'Нет'; //No
$lang['yes'] = 'Есть'; //Yes
$lang['errors'] = 'Ошибки'; //Errors
$lang['errors_title'] = 'Открыть журнал ошибок в новом окне'; //Open the error log in a new window
//
$response = $modx->runProcessor('system/errorlog/get');
@sergant210
sergant210 / default2
Created Feb 19, 2015
mSearch2/default2.js
View default2
var mSearch2 = {
options: {
wrapper: '#mse2_mfilter'
,filters: '#mse2_filters'
,results: '#mse2_results'
,total: '#mse2_total'
,pagination: '#mse2_pagination'
,sort: '#mse2_sort'
,limit: '#mse2_limit'
,slider: '.mse2_number_slider'
You can’t perform that action at this time.