This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('MODX_API_MODE', true); | |
require 'index.php'; | |
// Instantiate the Commerce class | |
$path = $modx->getOption('commerce.core_path', null, MODX_CORE_PATH . 'components/commerce/') . 'model/commerce/'; | |
$params = ['mode' => $modx->getOption('commerce.mode')]; | |
/** @var Commerce|null $commerce */ | |
$commerce = $modx->getService('commerce', 'Commerce', $path, $params); | |
if (!($commerce instanceof Commerce)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$client = $modx->getService('rest', 'rest.modRest', null, ['headers' => ['X-Auth-Token' => $token]]); | |
$client->setOption('format','json'); | |
$client->setOption('suppressSuffix','true'); | |
$data = $client->get(self::API_URL . 'Positions/', ['delta' => '2023-01-01'])->process(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$context_key = 'fr'; | |
$babel = $modx->getService('babel', 'Babel', $modx->getOption('babel.core_path', null, $modx->getOption('core_path').'components/babel/').'model/babel/', []); | |
$resources = $modx->getCollection('modResource', ['context_key' => 'web']); | |
foreach ($resources as $res) { | |
echo $res->id . '. ' . $res->pagetitle . ' => '; | |
if ($link = $modx->getObject('modResource', ['uri' => $res->uri, 'context_key' => $context_key])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* pThumb | |
* Copyright 2013, 2014 Jason Grant | |
* | |
* Please see the GitHub page for documentation or to report bugs: | |
* https://github.com/oo12/phpThumbOf | |
* | |
* Forked from phpThumbOf 1.4.0 | |
* Copyright 2009-2012 by Shaun McCormick <shaun@modx.com> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'config.core.php'; | |
require MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php'; | |
$filename = $dbase . '-' . date('Y-m-d') . '.sql.gz'; | |
$mime = "application/x-gzip"; | |
header('Content-Type: ' . $mime); | |
header('Content-Disposition: attachment; filename="' . $filename . '"'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILE=`date '+%Y%m%d-%H%M'` | |
USER=`whoami` | |
cd ~ | |
mysqldump --skip-lock-tables -u$USER -p $USER > dump.sql | |
rm -rf www/core/cache/* | |
zip -r $FILE www dump.sql | |
rm dump.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<data package="contentblocks" exported="2021-05-04@16:36:10" total="4"> | |
<cbCategory> | |
<id>1</id> | |
<name><![CDATA[Content]]></name> | |
<description><![CDATA[]]></description> | |
<sortorder>0</sortorder> | |
</cbCategory> | |
<cbCategory> | |
<id>2</id> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$modxminify = $modx->getService('modxminify','modxMinify', MODX_CORE_PATH . 'components/modxminify/model/modxminify/',[]); | |
$files = $modx->getCollection('modxMinifyFile'); | |
$list = []; | |
foreach ($files as $file) { | |
if (empty($list[$file->group]) || !in_array($file->filename, $list[$file->group])) { | |
echo $file->filename . '<br>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$resource_id = 39; | |
$priceList = [ | |
'1000' => ['name' => '1 liter', 'price' => 2250], | |
'2500' => ['name' => '2,5 liter', 'price' => 5023], | |
]; | |
$resource = $modx->getObject('modResource', $resource_id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Instantiate the Commerce class | |
$path = $modx->getOption('commerce.core_path', null, MODX_CORE_PATH . 'components/commerce/') . 'model/commerce/'; | |
$params = ['mode' => $modx->getOption('commerce.mode')]; | |
/** @var Commerce|null $commerce */ | |
$commerce = $modx->getService('commerce', 'Commerce', $path, $params); | |
if (!($commerce instanceof Commerce)) { | |
return '<p class="error">Oops! It is not possible to view your cart currently. We\'re sorry for the inconvenience. Please try again later.</p>'; | |
} |
NewerOlder