Skip to content

Instantly share code, notes, and snippets.

@sergant210
sergant210 / mSearch2ext
Last active Aug 29, 2015
Класс mSearch2ext
View mSearch2ext
<?php
/**
* The extended class for mSearch2.
* Feature: search in found
*/
require_once 'mSearch2.class.php';
class mSearch2ext extends mSearch2 {
/** @var array $resources */
public $resources = array();
@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'
@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');
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;
View _fenomplus.php
<?php
require_once '_fenom.php';
class FenomPlus extends FenomX
{
/**
* @inheritdoc
*/
protected function _addDefaultModifiers()
{
View pdotoolsplus.class.php
<?php
require_once 'pdotools.class.php';
class pdoToolsPlus extends pdoTools
{
/**
* Loads template engine
*
* @return bool|Fenom
*/
@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 / StorageTrait.php
Last active Oct 10, 2017
Fenom Storage trait
View StorageTrait.php
<?php
namespace Fenom;
trait StorageTrait
{
/**
* @var array storage
*/
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;
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;
You can’t perform that action at this time.