├── .gitignore ├── Gruntfile.js ├── README.md ├── _build ├── build.config.php ├── build.prepare.php ├── build.transport.php ├── data │ ├── transport.events.php │ ├── transport.plugins.php │ ├── transport.settings.php │ └── transport.snippets.php ├── includes │ └── functions.php ├── properties │ ├── properties.pdoarchive.php │ ├── properties.pdocrumbs.php │ ├── properties.pdofield.php │ ├── properties.pdomenu.php │ ├── properties.pdoneighbors.php │ ├── properties.pdopage.php │ ├── properties.pdoresources.php │ ├── properties.pdositemap.php │ ├── properties.pdotitle.php │ └── properties.pdousers.php └── resolvers │ ├── resolve.extension.php │ └── resolve.parser.php ├── assets └── components │ └── pdotools │ ├── connector.php │ ├── css │ ├── pdopage.css │ └── pdopage.min.css │ └── js │ ├── jquery.pdopage.js │ ├── jquery.pdopage.min.js │ ├── lib │ ├── jquery.sticky.js │ └── jquery.sticky.min.js │ ├── pdopage.js │ └── pdopage.min.js ├── core └── components │ └── pdotools │ ├── composer.json │ ├── composer.lock │ ├── docs │ ├── changelog.txt │ ├── license.txt │ └── readme.txt │ ├── elements │ ├── plugins │ │ └── plugin.pdotools.php │ └── snippets │ │ ├── snippet.pdoarchive.php │ │ ├── snippet.pdocrumbs.php │ │ ├── snippet.pdofield.php │ │ ├── snippet.pdomenu.php │ │ ├── snippet.pdoneighbors.php │ │ ├── snippet.pdopage.php │ │ ├── snippet.pdoresources.php │ │ ├── snippet.pdositemap.php │ │ ├── snippet.pdotitle.php │ │ └── snippet.pdousers.php │ ├── lexicon │ ├── de │ │ ├── default.inc.php │ │ ├── pdoarchive.inc.php │ │ ├── pdopage.inc.php │ │ └── properties.inc.php │ ├── en │ │ ├── default.inc.php │ │ ├── pdoarchive.inc.php │ │ ├── pdopage.inc.php │ │ └── properties.inc.php │ ├── fr │ │ ├── pdoarchive.inc.php │ │ └── pdopage.inc.php │ ├── it │ │ ├── pdoarchive.inc.php │ │ └── pdopage.inc.php │ └── ru │ │ ├── default.inc.php │ │ ├── pdoarchive.inc.php │ │ ├── pdopage.inc.php │ │ └── properties.inc.php │ └── model │ ├── fenom │ └── Providers │ │ ├── ModChunk.php │ │ ├── ModFile.php │ │ └── ModTemplate.php │ └── pdotools │ ├── _fenom.php │ ├── _micromodx.php │ ├── metadata.mysql.php │ ├── modparser.class.php │ ├── pdofetch.class.php │ ├── pdomenu.class.php │ ├── pdopage.class.php │ ├── pdoparser.class.php │ └── pdotools.class.php └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | config.core.php 2 | .idea 3 | node_modules 4 | /core/components/pdotools/vendor/ 5 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | // Project configuration. 3 | grunt.initConfig({ 4 | uglify: { 5 | pdopage: { 6 | src: [ 7 | 'assets/components/pdotools/js/pdopage.js' 8 | ], 9 | dest: 'assets/components/pdotools/js/pdopage.min.js' 10 | }, 11 | jquery_pdopage: { 12 | src: [ 13 | 'assets/components/pdotools/js/jquery.pdopage.js' 14 | ], 15 | dest: 'assets/components/pdotools/js/jquery.pdopage.min.js' 16 | }, 17 | jquery_sticky: { 18 | src: [ 19 | 'assets/components/pdotools/js/lib/jquery.sticky.js' 20 | ], 21 | dest: 'assets/components/pdotools/js/lib/jquery.sticky.min.js' 22 | } 23 | }, 24 | cssmin: { 25 | pdopage: { 26 | src: [ 27 | 'assets/components/pdotools/css/pdopage.css' 28 | ], 29 | dest: 'assets/components/pdotools/css/pdopage.min.css' 30 | } 31 | }, 32 | watch: { 33 | scripts: { 34 | files: ['assets/components/pdotools/**/*.js'], 35 | tasks: ['uglify'] 36 | }, 37 | css: { 38 | files: ['assets/components/pdotools/**/*.css'], 39 | tasks: ['cssmin'] 40 | } 41 | } 42 | }); 43 | 44 | //load the packages 45 | grunt.loadNpmTasks('grunt-contrib-uglify'); 46 | grunt.loadNpmTasks('grunt-contrib-cssmin'); 47 | grunt.loadNpmTasks('grunt-contrib-watch'); 48 | grunt.loadNpmTasks('grunt-banner'); 49 | grunt.loadNpmTasks('grunt-ssh'); 50 | grunt.loadNpmTasks('grunt-sass'); 51 | grunt.loadNpmTasks('grunt-postcss'); 52 | grunt.loadNpmTasks('grunt-string-replace'); 53 | grunt.renameTask('string-replace', 'bump'); 54 | 55 | //register the task 56 | grunt.registerTask('default', ['uglify', 'cssmin']); 57 | }; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## pdoTools 2 | 3 | Small library for creating fast snippets for MODX Revolution that works through PDO. 4 | 5 | Required by Tickets and miniShop2. 6 | 7 | ## Main features 8 | - Builds queries with xPDO. 9 | - Retrieve results with PDO. 10 | - Improved pdoTools::getChunk() function, that processing placeholders faster, than original modX::getChunk(). 11 | 12 | pdoTools snippets will work so faster, than more fields you will retrieve from database at one query. 13 | -------------------------------------------------------------------------------- /_build/build.config.php: -------------------------------------------------------------------------------- 1 | $root, 23 | 'build' => $root . '_build/', 24 | 'data' => $root . '_build/data/', 25 | 'snippets' => $root . 'core/components/' . PKG_NAME_LOWER . '/elements/snippets/', 26 | 'lexicon' => $root . 'core/components/' . PKG_NAME_LOWER . '/lexicon/', 27 | 'docs' => $root . 'core/components/' . PKG_NAME_LOWER . '/docs/', 28 | 'source_assets' => $root . 'assets/components/' . PKG_NAME_LOWER, 29 | 'source_core' => $root . 'core/components/' . PKG_NAME_LOWER, 30 | 'resolvers' => $root . '_build/resolvers/', 31 | ); 32 | unset($root); 33 | 34 | /* override with your own defines here (see build.config.sample.php) */ 35 | require_once MODX_CORE_PATH . 'model/modx/modx.class.php'; 36 | require_once $sources['build'] . '/includes/functions.php'; 37 | 38 | $modx = new modX(); 39 | $modx->initialize('mgr'); 40 | echo '
'; /* used for nice formatting of log messages */
 41 | $modx->setLogLevel(modX::LOG_LEVEL_INFO);
 42 | $modx->setLogTarget('ECHO');
 43 | $modx->getService('error', 'error.modError');
 44 | 
 45 | $modx->loadClass('transport.modPackageBuilder', '', false, true);
 46 | $builder = new modPackageBuilder($modx);
 47 | $builder->createPackage(PKG_NAME_LOWER, PKG_VERSION, PKG_RELEASE);
 48 | $builder->registerNamespace(PKG_NAME_LOWER, false, true, '{core_path}components/' . PKG_NAME_LOWER . '/');
 49 | $modx->log(modX::LOG_LEVEL_INFO, 'Created Transport Package and Namespace.');
 50 | 
 51 | /* load system settings */
 52 | if (defined('BUILD_SETTING_UPDATE')) {
 53 |     $settings = include $sources['data'] . 'transport.settings.php';
 54 |     if (!is_array($settings)) {
 55 |         $modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in settings.');
 56 |     } else {
 57 |         $attributes = array(
 58 |             xPDOTransport::UNIQUE_KEY => 'key',
 59 |             xPDOTransport::PRESERVE_KEYS => true,
 60 |             xPDOTransport::UPDATE_OBJECT => BUILD_SETTING_UPDATE,
 61 |         );
 62 |         foreach ($settings as $setting) {
 63 |             $vehicle = $builder->createVehicle($setting, $attributes);
 64 |             $builder->putVehicle($vehicle);
 65 |         }
 66 |         $modx->log(modX::LOG_LEVEL_INFO, 'Packaged in ' . count($settings) . ' System Settings.');
 67 |     }
 68 |     unset($settings, $setting, $attributes);
 69 | }
 70 | 
 71 | /* load plugins events */
 72 | if (defined('BUILD_EVENT_UPDATE')) {
 73 |     $events = include $sources['data'] . 'transport.events.php';
 74 |     if (!is_array($events)) {
 75 |         $modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in events.');
 76 |     } else {
 77 |         $attributes = array(
 78 |             xPDOTransport::PRESERVE_KEYS => true,
 79 |             xPDOTransport::UPDATE_OBJECT => BUILD_EVENT_UPDATE,
 80 |         );
 81 |         foreach ($events as $event) {
 82 |             $vehicle = $builder->createVehicle($event, $attributes);
 83 |             $builder->putVehicle($vehicle);
 84 |         }
 85 |         $modx->log(xPDO::LOG_LEVEL_INFO, 'Packaged in ' . count($events) . ' Plugins events.');
 86 |     }
 87 |     unset ($events, $event, $attributes);
 88 | }
 89 | 
 90 | /* create category */
 91 | $category = $modx->newObject('modCategory');
 92 | $category->set('id', 1);
 93 | $category->set('category', PKG_NAME);
 94 | 
 95 | /* add snippets */
 96 | $snippets = include $sources['data'] . 'transport.snippets.php';
 97 | if (!is_array($snippets)) {
 98 |     $modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in snippets.');
 99 | } else {
100 |     $category->addMany($snippets);
101 |     $modx->log(modX::LOG_LEVEL_INFO, 'Packaged in ' . count($snippets) . ' snippets.');
102 | }
103 | 
104 | 
105 | /* create category vehicle */
106 | $attr = array(
107 |     xPDOTransport::UNIQUE_KEY => 'category',
108 |     xPDOTransport::PRESERVE_KEYS => false,
109 |     xPDOTransport::UPDATE_OBJECT => true,
110 |     xPDOTransport::RELATED_OBJECTS => true,
111 |     xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array(
112 |         'Snippets' => array(
113 |             xPDOTransport::PRESERVE_KEYS => false,
114 |             xPDOTransport::UPDATE_OBJECT => BUILD_SNIPPET_UPDATE,
115 |             xPDOTransport::UNIQUE_KEY => 'name',
116 |         ),
117 |     ),
118 | );
119 | 
120 | /* add plugins */
121 | if (defined('BUILD_PLUGIN_UPDATE')) {
122 |     $attr[xPDOTransport::RELATED_OBJECT_ATTRIBUTES]['Plugins'] = array(
123 |         xPDOTransport::PRESERVE_KEYS => false,
124 |         xPDOTransport::UPDATE_OBJECT => BUILD_PLUGIN_UPDATE,
125 |         xPDOTransport::UNIQUE_KEY => 'name',
126 |     );
127 |     $attr[xPDOTransport::RELATED_OBJECT_ATTRIBUTES]['PluginEvents'] = array(
128 |         xPDOTransport::PRESERVE_KEYS => true,
129 |         xPDOTransport::UPDATE_OBJECT => BUILD_PLUGIN_UPDATE,
130 |         xPDOTransport::UNIQUE_KEY => array('pluginid', 'event'),
131 |     );
132 |     $plugins = include $sources['data'] . 'transport.plugins.php';
133 |     if (!is_array($plugins)) {
134 |         $modx->log(modX::LOG_LEVEL_ERROR, 'Could not package in plugins.');
135 |     } else {
136 |         $category->addMany($plugins);
137 |         $modx->log(modX::LOG_LEVEL_INFO, 'Packaged in ' . count($plugins) . ' plugins.');
138 |     }
139 | }
140 | 
141 | $vehicle = $builder->createVehicle($category, $attr);
142 | 
143 | /* now pack in resolvers */
144 | $vehicle->resolve('file', array(
145 |     'source' => $sources['source_assets'],
146 |     'target' => "return MODX_ASSETS_PATH . 'components/';",
147 | ));
148 | $vehicle->resolve('file', array(
149 |     'source' => $sources['source_core'],
150 |     'target' => "return MODX_CORE_PATH . 'components/';",
151 | ));
152 | 
153 | foreach ($BUILD_RESOLVERS as $resolver) {
154 |     if ($vehicle->resolve('php', array('source' => $sources['resolvers'] . 'resolve.' . $resolver . '.php'))) {
155 |         $modx->log(modX::LOG_LEVEL_INFO, 'Added resolver "' . $resolver . '" to category.');
156 |     } else {
157 |         $modx->log(modX::LOG_LEVEL_INFO, 'Could not add resolver "' . $resolver . '" to category.');
158 |     }
159 | }
160 | 
161 | flush();
162 | $builder->putVehicle($vehicle);
163 | 
164 | $builder->setPackageAttributes(array(
165 |     'changelog' => file_get_contents($sources['docs'] . 'changelog.txt'),
166 |     'license' => file_get_contents($sources['docs'] . 'license.txt'),
167 |     'readme' => file_get_contents($sources['docs'] . 'readme.txt'),
168 | ));
169 | $modx->log(modX::LOG_LEVEL_INFO, 'Added package attributes and setup options.');
170 | 
171 | /* zip up package */
172 | $modx->log(modX::LOG_LEVEL_INFO, 'Packing up transport package zip...');
173 | $builder->pack();
174 | 
175 | $mtime = microtime();
176 | $mtime = explode(" ", $mtime);
177 | $mtime = $mtime[1] + $mtime[0];
178 | $tend = $mtime;
179 | $totalTime = ($tend - $tstart);
180 | $totalTime = sprintf("%2.4f s", $totalTime);
181 | 
182 | $signature = $builder->getSignature();
183 | $signature = $builder->getSignature();
184 | if (defined('PKG_AUTO_INSTALL') && PKG_AUTO_INSTALL) {
185 |     $sig = explode('-', $signature);
186 |     $versionSignature = explode('.', $sig[1]);
187 | 
188 |     /** @var modTransportPackage $package */
189 |     if (!$package = $modx->getObject('transport.modTransportPackage', array('signature' => $signature))) {
190 |         $package = $modx->newObject('transport.modTransportPackage');
191 |         $package->set('signature', $signature);
192 |         $package->fromArray(array(
193 |             'created' => date('Y-m-d h:i:s'),
194 |             'updated' => null,
195 |             'state' => 1,
196 |             'workspace' => 1,
197 |             'provider' => 0,
198 |             'source' => $signature . '.transport.zip',
199 |             'package_name' => PKG_NAME,
200 |             'version_major' => $versionSignature[0],
201 |             'version_minor' => !empty($versionSignature[1]) ? $versionSignature[1] : 0,
202 |             'version_patch' => !empty($versionSignature[2]) ? $versionSignature[2] : 0,
203 |         ));
204 |         if (!empty($sig[2])) {
205 |             $r = preg_split('/([0-9]+)/', $sig[2], -1, PREG_SPLIT_DELIM_CAPTURE);
206 |             if (is_array($r) && !empty($r)) {
207 |                 $package->set('release', $r[0]);
208 |                 $package->set('release_index', (isset($r[1]) ? $r[1] : '0'));
209 |             } else {
210 |                 $package->set('release', $sig[2]);
211 |             }
212 |         }
213 |         $package->save();
214 |     }
215 | 
216 |     if ($package->install()) {
217 |         $modx->runProcessor('system/clearcache');
218 |     }
219 | }
220 | if (!empty($_GET['download'])) {
221 |     echo '';
222 | }
223 | 
224 | $modx->log(modX::LOG_LEVEL_INFO, "\n
Execution time: {$totalTime}\n"); 225 | echo '
'; -------------------------------------------------------------------------------- /_build/data/transport.events.php: -------------------------------------------------------------------------------- 1 | $v) { 10 | /** @var modEvent $event */ 11 | $event = $modx->newObject('modEvent'); 12 | $event->fromArray(array( 13 | 'name' => $v, 14 | 'service' => 6, 15 | 'groupname' => PKG_NAME, 16 | ), '', true, true); 17 | $events[] = $event; 18 | } 19 | 20 | return $events; -------------------------------------------------------------------------------- /_build/data/transport.plugins.php: -------------------------------------------------------------------------------- 1 | array( 6 | 'file' => 'pdotools', 7 | 'description' => '', 8 | 'events' => array( 9 | 'OnMODXInit' => -100, 10 | 'OnSiteRefresh' => 0, 11 | 'OnWebPagePrerender' => -100, 12 | ), 13 | ), 14 | ); 15 | 16 | foreach ($tmp as $k => $v) { 17 | /** @var modplugin $plugin */ 18 | $plugin = $modx->newObject('modPlugin'); 19 | /** @noinspection PhpUndefinedVariableInspection */ 20 | $plugin->fromArray(array( 21 | 'name' => $k, 22 | 'description' => @$v['description'], 23 | 'plugincode' => getSnippetContent($sources['source_core'] . '/elements/plugins/plugin.' . $v['file'] . '.php'), 24 | 'static' => BUILD_PLUGIN_STATIC, 25 | 'source' => 1, 26 | 'static_file' => 'core/components/' . PKG_NAME_LOWER . '/elements/plugins/plugin.' . $v['file'] . '.php', 27 | ), '', true, true); 28 | 29 | $events = array(); 30 | if (!empty($v['events']) && is_array($v['events'])) { 31 | foreach ($v['events'] as $name => $priority) { 32 | /** @var $event modPluginEvent */ 33 | $event = $modx->newObject('modPluginEvent'); 34 | $event->fromArray(array( 35 | 'event' => $name, 36 | 'priority' => $priority, 37 | 'propertyset' => 0, 38 | ), '', true, true); 39 | $events[] = $event; 40 | } 41 | unset($v['events']); 42 | } 43 | 44 | if (!empty($events)) { 45 | $plugin->addMany($events); 46 | } 47 | 48 | $plugins[] = $plugin; 49 | } 50 | 51 | return $plugins; -------------------------------------------------------------------------------- /_build/data/transport.settings.php: -------------------------------------------------------------------------------- 1 | array( 7 | 'xtype' => 'textfield', 8 | 'value' => 'pdotools.pdotools', 9 | 'key' => 'pdoTools.class', 10 | ), 11 | 'pdoFetch.class' => array( 12 | 'xtype' => 'textfield', 13 | 'value' => 'pdotools.pdofetch', 14 | 'key' => 'pdoFetch.class', 15 | ), 16 | /* 17 | 'pdoParser.class' => array( 18 | 'xtype' => 'textfield', 19 | 'value' => 'pdotools.pdoparser', 20 | 'key' => 'pdoParser.class', 21 | ), 22 | */ 23 | 'pdotools_class_path' => array( 24 | 'xtype' => 'textfield', 25 | 'value' => '{core_path}components/pdotools/model/', 26 | 'key' => 'pdotools_class_path', 27 | ), 28 | 'pdofetch_class_path' => array( 29 | 'xtype' => 'textfield', 30 | 'value' => '{core_path}components/pdotools/model/', 31 | 'key' => 'pdofetch_class_path', 32 | ), 33 | 'fenom_default' => array( 34 | 'xtype' => 'combo-boolean', 35 | 'value' => true, 36 | ), 37 | 'fenom_parser' => array( 38 | 'xtype' => 'combo-boolean', 39 | 'value' => false, 40 | ), 41 | 'fenom_php' => array( 42 | 'xtype' => 'combo-boolean', 43 | 'value' => false, 44 | ), 45 | 'fenom_modx' => array( 46 | 'xtype' => 'combo-boolean', 47 | 'value' => false, 48 | ), 49 | 'fenom_options' => array( 50 | 'xtype' => 'textarea', 51 | 'value' => '', 52 | ), 53 | 'fenom_cache' => array( 54 | 'xtype' => 'combo-boolean', 55 | 'value' => false, 56 | ), 57 | 'fenom_save_on_errors' => array( 58 | 'xtype' => 'combo-boolean', 59 | 'value' => false, 60 | ), 61 | 62 | 'elements_path' => array( 63 | 'xtype' => 'textfield', 64 | 'value' => '{core_path}elements/', 65 | ), 66 | ); 67 | 68 | foreach ($tmp as $k => $v) { 69 | /** @var modSystemSetting $setting */ 70 | $setting = $modx->newObject('modSystemSetting'); 71 | $setting->fromArray(array_merge( 72 | array( 73 | 'key' => PKG_NAME_LOWER . '_' . $k, 74 | 'namespace' => PKG_NAME_LOWER, 75 | 'area' => 'pdotools_main', 76 | ), $v 77 | ), '', true, true); 78 | 79 | $settings[] = $setting; 80 | } 81 | unset($tmp); 82 | 83 | return $settings; -------------------------------------------------------------------------------- /_build/data/transport.snippets.php: -------------------------------------------------------------------------------- 1 | 'pdoresources', 7 | 'pdoUsers' => 'pdousers', 8 | 'pdoCrumbs' => 'pdocrumbs', 9 | 'pdoField' => 'pdofield', 10 | 'pdoSitemap' => 'pdositemap', 11 | 'pdoNeighbors' => 'pdoneighbors', 12 | 'pdoPage' => 'pdopage', 13 | 'pdoMenu' => 'pdomenu', 14 | 'pdoTitle' => 'pdotitle', 15 | 'pdoArchive' => 'pdoarchive', 16 | ); 17 | 18 | foreach ($tmp as $k => $v) { 19 | /** @var modSnippet $snippet */ 20 | $snippet = $modx->newObject('modSnippet'); 21 | /** @noinspection PhpUndefinedVariableInspection */ 22 | $snippet->fromArray(array( 23 | 'id' => 0, 24 | 'name' => $k, 25 | 'description' => '', 26 | 'snippet' => getSnippetContent($sources['source_core'] . '/elements/snippets/snippet.' . $v . '.php'), 27 | 'static' => BUILD_SNIPPET_STATIC, 28 | 'source' => 1, 29 | 'static_file' => 'core/components/' . PKG_NAME_LOWER . '/elements/snippets/snippet.' . $v . '.php', 30 | ), '', true, true); 31 | 32 | /** @noinspection PhpIncludeInspection */ 33 | $properties = include $sources['build'] . 'properties/properties.' . $v . '.php'; 34 | $snippet->setProperties($properties); 35 | 36 | $snippets[] = $snippet; 37 | } 38 | unset($properties); 39 | 40 | return $snippets; -------------------------------------------------------------------------------- /_build/includes/functions.php: -------------------------------------------------------------------------------- 1 | ')); 13 | } 14 | 15 | 16 | /** 17 | * Recursive directory delete 18 | * 19 | * @param $dir 20 | */ 21 | function removeDir($dir) { 22 | $dir = rtrim($dir, '/'); 23 | if (is_dir($dir)) { 24 | $objects = scandir($dir); 25 | foreach ($objects as $object) { 26 | if ($object != '.' && $object != '..') { 27 | if (is_dir($dir . '/' . $object)) { 28 | removeDir($dir . '/' . $object); 29 | } 30 | else { 31 | unlink($dir . '/' . $object); 32 | } 33 | } 34 | } 35 | rmdir($dir); 36 | } 37 | } 38 | 39 | 40 | /** 41 | * @param $base 42 | */ 43 | function cleanPackages($base) { 44 | if ($dirs = @scandir($base)) { 45 | foreach ($dirs as $dir) { 46 | if (in_array($dir, array('.', '..'))) { 47 | continue; 48 | } 49 | $path = $base . $dir; 50 | if (is_dir($path)) { 51 | if (in_array($dir, array('tests', 'docs', 'gui'))) { 52 | removeDir($path); 53 | } 54 | else { 55 | cleanPackages($path . '/'); 56 | } 57 | } 58 | elseif (pathinfo($path, PATHINFO_EXTENSION) != 'php') { 59 | unlink($path); 60 | } 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /_build/properties/properties.pdoarchive.php: -------------------------------------------------------------------------------- 1 | array( 7 | 'type' => 'textfield', 8 | 'value' => '@INLINE
  • [[+date]] [[+menutitle]]
  • ', 9 | ), 10 | 'tplYear' => array( 11 | 'type' => 'textfield', 12 | 'value' => '@INLINE

    [[+year]] ([[+count]])

    ', 13 | ), 14 | 'tplMonth' => array( 15 | 'type' => 'textfield', 16 | 'value' => '@INLINE
  • [[+month_name]] ([[+count]])

  • ', 17 | ), 18 | 'tplDay' => array( 19 | 'type' => 'textfield', 20 | 'value' => '@INLINE
  • [[+day]] ([[+count]])
  • ', 21 | ), 22 | 'tplWrapper' => array( 23 | 'type' => 'textfield', 24 | 'value' => '', 25 | ), 26 | 'wrapIfEmpty' => array( 27 | 'type' => 'combo-boolean', 28 | 'value' => false, 29 | ), 30 | 31 | 'dateField' => array( 32 | 'type' => 'textfield', 33 | 'value' => 'createdon', 34 | ), 35 | 'dateFormat' => array( 36 | 'type' => 'textfield', 37 | 'value' => '%H:%M', 38 | ), 39 | 40 | 'showLog' => array( 41 | 'type' => 'combo-boolean', 42 | 'value' => false, 43 | ), 44 | 'sortby' => array( 45 | 'type' => 'textfield', 46 | 'value' => 'createdon', 47 | ), 48 | 'sortbyTV' => array( 49 | 'type' => 'textfield', 50 | 'value' => '', 51 | ), 52 | 'sortbyTVType' => array( 53 | 'type' => 'textfield', 54 | 'value' => '', 55 | ), 56 | 'sortdir' => array( 57 | 'type' => 'list', 58 | 'options' => array( 59 | array('text' => 'ASC', 'value' => 'ASC'), 60 | array('text' => 'DESC', 'value' => 'DESC'), 61 | ), 62 | 'value' => 'DESC', 63 | ), 64 | 'sortdirTV' => array( 65 | 'type' => 'list', 66 | 'options' => array( 67 | array('text' => 'ASC', 'value' => 'ASC'), 68 | array('text' => 'DESC', 'value' => 'DESC'), 69 | ), 70 | 'value' => 'ASC', 71 | ), 72 | 'limit' => array( 73 | 'type' => 'numberfield', 74 | 'value' => 0, 75 | ), 76 | 'offset' => array( 77 | 'type' => 'numberfield', 78 | 'value' => 0, 79 | ), 80 | 'depth' => array( 81 | 'type' => 'numberfield', 82 | 'value' => 10, 83 | ), 84 | 'outputSeparator' => array( 85 | 'type' => 'textfield', 86 | 'value' => "\n", 87 | ), 88 | 'toPlaceholder' => array( 89 | 'type' => 'textfield', 90 | 'value' => '', 91 | ), 92 | 'parents' => array( 93 | 'type' => 'textfield', 94 | 'value' => '', 95 | ), 96 | 'includeContent' => array( 97 | 'type' => 'combo-boolean', 98 | 'value' => false, 99 | ), 100 | 101 | 'includeTVs' => array( 102 | 'type' => 'textfield', 103 | 'value' => '', 104 | ), 105 | 'prepareTVs' => array( 106 | 'type' => 'textfield', 107 | 'value' => '1', 108 | ), 109 | 'processTVs' => array( 110 | 'type' => 'textfield', 111 | 'value' => '', 112 | ), 113 | 'tvPrefix' => array( 114 | 'type' => 'textfield', 115 | 'value' => 'tv.', 116 | ), 117 | 118 | 'where' => array( 119 | 'type' => 'textfield', 120 | 'value' => '', 121 | ), 122 | 'showUnpublished' => array( 123 | 'type' => 'combo-boolean', 124 | 'value' => false, 125 | ), 126 | 'showDeleted' => array( 127 | 'type' => 'combo-boolean', 128 | 'value' => false, 129 | ), 130 | 'showHidden' => array( 131 | 'type' => 'combo-boolean', 132 | 'value' => true, 133 | ), 134 | 'hideContainers' => array( 135 | 'type' => 'combo-boolean', 136 | 'value' => false, 137 | ), 138 | 'context' => array( 139 | 'type' => 'textfield', 140 | 'value' => '', 141 | ), 142 | 143 | 'totalVar' => array( 144 | 'type' => 'textfield', 145 | 'value' => 'total', 146 | ), 147 | 'resources' => array( 148 | 'type' => 'textfield', 149 | 'value' => '', 150 | ), 151 | 152 | 'select' => array( 153 | 'type' => 'textarea', 154 | 'value' => '', 155 | ), 156 | 157 | 'scheme' => array( 158 | 'type' => 'list', 159 | 'options' => array( 160 | array('name' => 'System default', 'value' => ''), 161 | array('name' => '-1 (relative to site_url)', 'value' => -1), 162 | array('name' => 'full (absolute, prepended with site_url)', 'value' => 'full'), 163 | array('name' => 'abs (absolute, prepended with base_url)', 'value' => 'abs'), 164 | array('name' => 'http (absolute, forced to http scheme)', 'value' => 'http'), 165 | array('name' => 'https (absolute, forced to https scheme)', 'value' => 'https'), 166 | ), 167 | 'value' => '', 168 | ), 169 | 'useWeblinkUrl' => array( 170 | 'type' => 'combo-boolean', 171 | 'value' => true, 172 | ), 173 | 174 | ); 175 | 176 | foreach ($tmp as $k => $v) { 177 | $properties[] = array_merge(array( 178 | 'name' => $k, 179 | 'desc' => 'pdotools_prop_' . $k, 180 | 'lexicon' => 'pdotools:properties', 181 | ), $v); 182 | } 183 | 184 | return $properties; -------------------------------------------------------------------------------- /_build/properties/properties.pdocrumbs.php: -------------------------------------------------------------------------------- 1 | array( 7 | 'type' => 'combo-boolean', 8 | 'value' => false, 9 | ), 10 | 'fastMode' => array( 11 | 'type' => 'combo-boolean', 12 | 'value' => false, 13 | ), 14 | 'from' => array( 15 | 'type' => 'numberfield', 16 | 'value' => 0, 17 | ), 18 | 'to' => array( 19 | 'type' => 'numberfield', 20 | 'value' => '', 21 | ), 22 | 'customParents' => array( 23 | 'type' => 'textfield', 24 | 'value' => '', 25 | ), 26 | 'limit' => array( 27 | 'type' => 'numberfield', 28 | 'value' => 10, 29 | ), 30 | 'exclude' => array( 31 | 'type' => 'textfield', 32 | 'value' => '', 33 | ), 34 | 'outputSeparator' => array( 35 | 'type' => 'textfield', 36 | 'value' => "\n", 37 | ), 38 | 'toPlaceholder' => array( 39 | 'type' => 'textfield', 40 | 'value' => '', 41 | ), 42 | 43 | 'includeTVs' => array( 44 | 'type' => 'textfield', 45 | 'value' => '', 46 | ), 47 | 'prepareTVs' => array( 48 | 'type' => 'textfield', 49 | 'value' => '1', 50 | ), 51 | 'processTVs' => array( 52 | 'type' => 'textfield', 53 | 'value' => '', 54 | ), 55 | 'tvPrefix' => array( 56 | 'type' => 'textfield', 57 | 'value' => 'tv.', 58 | ), 59 | 60 | 'where' => array( 61 | 'type' => 'textfield', 62 | 'value' => '', 63 | ), 64 | 'showUnpublished' => array( 65 | 'type' => 'combo-boolean', 66 | 'value' => false, 67 | ), 68 | 'showDeleted' => array( 69 | 'type' => 'combo-boolean', 70 | 'value' => false, 71 | ), 72 | 'showHidden' => array( 73 | 'type' => 'combo-boolean', 74 | 'value' => true, 75 | ), 76 | 'hideContainers' => array( 77 | 'type' => 'combo-boolean', 78 | 'value' => false, 79 | ), 80 | 81 | 'tpl' => array( 82 | 'type' => 'textfield', 83 | 'value' => '@INLINE ', 84 | ), 85 | 'tplCurrent' => array( 86 | 'type' => 'textfield', 87 | 'value' => '@INLINE ', 88 | ), 89 | 'tplMax' => array( 90 | 'type' => 'textfield', 91 | 'value' => '@INLINE ', 92 | ), 93 | 'tplHome' => array( 94 | 'type' => 'textfield', 95 | 'value' => '', 96 | ), 97 | 'tplWrapper' => array( 98 | 'type' => 'textfield', 99 | 'value' => '@INLINE ', 100 | ), 101 | 'wrapIfEmpty' => array( 102 | 'type' => 'combo-boolean', 103 | 'value' => false, 104 | ), 105 | 106 | 'showCurrent' => array( 107 | 'type' => 'combo-boolean', 108 | 'value' => true, 109 | ), 110 | 'showHome' => array( 111 | 'type' => 'combo-boolean', 112 | 'value' => false, 113 | ), 114 | 'showAtHome' => array( 115 | 'type' => 'combo-boolean', 116 | 'value' => true, 117 | ), 118 | 'hideSingle' => array( 119 | 'type' => 'combo-boolean', 120 | 'value' => false, 121 | ), 122 | 'direction' => array( 123 | 'type' => 'list', 124 | 'options' => array( 125 | array( 126 | 'name' => 'Left To Right (ltr)', 127 | 'value' => 'ltr', 128 | ), 129 | array( 130 | 'name' => 'Right To Left (rtl)', 131 | 'value' => 'rtl', 132 | ), 133 | ), 134 | 'value' => 'ltr', 135 | ), 136 | 'scheme' => array( 137 | 'type' => 'list', 138 | 'options' => array( 139 | array( 140 | 'name' => 'System default', 141 | 'value' => '', 142 | ), 143 | array( 144 | 'name' => '-1 (relative to site_url)', 145 | 'value' => -1, 146 | ), 147 | array( 148 | 'name' => 'full (absolute, prepended with site_url)', 149 | 'value' => 'full', 150 | ), 151 | array( 152 | 'name' => 'abs (absolute, prepended with base_url)', 153 | 'value' => 'abs', 154 | ), 155 | array( 156 | 'name' => 'http (absolute, forced to http scheme)', 157 | 'value' => 'http', 158 | ), 159 | array( 160 | 'name' => 'https (absolute, forced to https scheme)', 161 | 'value' => 'https', 162 | ), 163 | ), 164 | 'value' => '', 165 | ), 166 | 'useWeblinkUrl' => array( 167 | 'type' => 'combo-boolean', 168 | 'value' => true, 169 | ), 170 | 171 | ); 172 | 173 | foreach ($tmp as $k => $v) { 174 | $properties[] = array_merge(array( 175 | 'name' => $k, 176 | 'desc' => 'pdotools_prop_' . $k, 177 | 'lexicon' => 'pdotools:properties', 178 | ), $v); 179 | } 180 | 181 | return $properties; 182 | -------------------------------------------------------------------------------- /_build/properties/properties.pdofield.php: -------------------------------------------------------------------------------- 1 | array( 7 | 'type' => 'numberfield', 8 | 'value' => '', 9 | ), 10 | 'field' => array( 11 | 'type' => 'textfield', 12 | 'value' => 'pagetitle', 13 | ), 14 | 'prepareTVs' => array( 15 | 'type' => 'textfield', 16 | 'value' => '1', 17 | ), 18 | 'processTVs' => array( 19 | 'type' => 'textfield', 20 | 'value' => '', 21 | ), 22 | 'where' => array( 23 | 'type' => 'textfield', 24 | 'value' => '', 25 | ), 26 | 'context' => array( 27 | 'type' => 'textfield', 28 | 'desc' => 'pdotools_prop_field_context', 29 | 'value' => '', 30 | ), 31 | 'top' => array( 32 | 'type' => 'numberfield', 33 | 'value' => '', 34 | ), 35 | 'topLevel' => array( 36 | 'type' => 'numberfield', 37 | 'value' => '', 38 | ), 39 | 'default' => array( 40 | 'type' => 'textfield', 41 | 'desc' => 'pdotools_prop_field_default', 42 | 'value' => '', 43 | ), 44 | 'output' => array( 45 | 'type' => 'textfield', 46 | 'desc' => 'pdotools_prop_field_output', 47 | 'value' => '', 48 | ), 49 | 'toPlaceholder' => array( 50 | 'type' => 'textfield', 51 | 'value' => '', 52 | ), 53 | 'ultimate' => array( 54 | 'type' => 'combo-boolean', 55 | 'value' => false, 56 | ), 57 | 58 | ); 59 | 60 | foreach ($tmp as $k => $v) { 61 | $properties[] = array_merge(array( 62 | 'name' => $k, 63 | 'desc' => 'pdotools_prop_' . $k, 64 | 'lexicon' => 'pdotools:properties', 65 | ), $v); 66 | } 67 | 68 | return $properties; 69 | -------------------------------------------------------------------------------- /_build/properties/properties.pdomenu.php: -------------------------------------------------------------------------------- 1 | array( 8 | 'type' => 'combo-boolean', 9 | 'value' => false, 10 | ), 11 | 'fastMode' => array( 12 | 'type' => 'combo-boolean', 13 | 'value' => false, 14 | ), 15 | 'level' => array( 16 | 'type' => 'numberfield', 17 | 'value' => 0, 18 | ), 19 | 'parents' => array( 20 | 'type' => 'textfield', 21 | 'value' => '', 22 | ), 23 | 'displayStart' => array( 24 | 'type' => 'combo-boolean', 25 | 'value' => false, 26 | ), 27 | 'resources' => array( 28 | 'type' => 'textfield', 29 | 'value' => '', 30 | ), 31 | 'templates' => array( 32 | 'type' => 'textfield', 33 | 'value' => '', 34 | ), 35 | 'context' => array( 36 | 'type' => 'textfield', 37 | 'value' => '', 38 | ), 39 | 40 | 'cache' => array( 41 | 'type' => 'combo-boolean', 42 | 'value' => false, 43 | ), 44 | 'cacheTime' => array( 45 | 'type' => 'numberfield', 46 | 'value' => 3600, 47 | ), 48 | 'cacheAnonymous' => array( 49 | 'type' => 'combo-boolean', 50 | 'value' => false, 51 | ), 52 | 53 | 'plPrefix' => array( 54 | 'type' => 'textfield', 55 | 'value' => 'wf.', 56 | ), 57 | 'showHidden' => array( 58 | 'type' => 'combo-boolean', 59 | 'value' => false, 60 | ), 61 | 'showUnpublished' => array( 62 | 'type' => 'combo-boolean', 63 | 'value' => false, 64 | ), 65 | 'showDeleted' => array( 66 | 'type' => 'combo-boolean', 67 | 'value' => false, 68 | ), 69 | 'previewUnpublished' => array( 70 | 'type' => 'combo-boolean', 71 | 'value' => false, 72 | ), 73 | 'hideSubMenus' => array( 74 | 'type' => 'combo-boolean', 75 | 'value' => false, 76 | ), 77 | 78 | 'useWeblinkUrl' => array( 79 | 'type' => 'combo-boolean', 80 | 'value' => true, 81 | ), 82 | 83 | 'sortdir' => array( 84 | 'type' => 'list', 85 | 'options' => array( 86 | array('text' => 'ASC', 'value' => 'ASC'), 87 | array('text' => 'DESC', 'value' => 'DESC'), 88 | ), 89 | 'value' => 'ASC', 90 | ), 91 | 'sortby' => array( 92 | 'type' => 'textfield', 93 | 'value' => 'menuindex', 94 | ), 95 | 'limit' => array( 96 | 'type' => 'numberfield', 97 | 'value' => 0, 98 | ), 99 | 'offset' => array( 100 | 'type' => 'numberfield', 101 | 'value' => 0, 102 | ), 103 | 104 | // cssTpl 105 | // jsTpl 106 | 107 | // textOfLinks 108 | // titleOfLinks 109 | 110 | 'rowIdPrefix' => array( 111 | 'type' => 'textfield', 112 | 'value' => '', 113 | ), 114 | 115 | 'firstClass' => array( 116 | 'type' => 'textfield', 117 | 'value' => 'first', 118 | ), 119 | 'lastClass' => array( 120 | 'type' => 'textfield', 121 | 'value' => 'last', 122 | ), 123 | 'hereClass' => array( 124 | 'type' => 'textfield', 125 | 'value' => 'active', 126 | ), 127 | 'parentClass' => array( 128 | 'type' => 'textfield', 129 | 'value' => '', 130 | ), 131 | 'rowClass' => array( 132 | 'type' => 'textfield', 133 | 'value' => '', 134 | ), 135 | 'outerClass' => array( 136 | 'type' => 'textfield', 137 | 'value' => '', 138 | ), 139 | 'innerClass' => array( 140 | 'type' => 'textfield', 141 | 'value' => '', 142 | ), 143 | 'levelClass' => array( 144 | 'type' => 'textfield', 145 | 'value' => '', 146 | ), 147 | 'selfClass' => array( 148 | 'type' => 'textfield', 149 | 'value' => '', 150 | ), 151 | 'webLinkClass' => array( 152 | 'type' => 'textfield', 153 | 'value' => '', 154 | ), 155 | 156 | 'tplOuter' => array( 157 | 'type' => 'textfield', 158 | 'value' => '@INLINE [[+wrapper]]', 159 | ), 160 | 'tpl' => array( 161 | 'type' => 'textfield', 162 | 'value' => '@INLINE [[+menutitle]][[+wrapper]]', 163 | ), 164 | 'tplParentRow' => array( 165 | 'type' => 'textfield', 166 | 'value' => '', 167 | ), 168 | 'tplParentRowHere' => array( 169 | 'type' => 'textfield', 170 | 'value' => '', 171 | ), 172 | 'tplHere' => array( 173 | 'type' => 'textfield', 174 | 'value' => '', 175 | ), 176 | 'tplInner' => array( 177 | 'type' => 'textfield', 178 | 'value' => '', 179 | ), 180 | 'tplInnerRow' => array( 181 | 'type' => 'textfield', 182 | 'value' => '', 183 | ), 184 | 'tplInnerHere' => array( 185 | 'type' => 'textfield', 186 | 'value' => '', 187 | ), 188 | 'tplParentRowActive' => array( 189 | 'type' => 'textfield', 190 | 'value' => '', 191 | ), 192 | 'tplCategoryFolder' => array( 193 | 'type' => 'textfield', 194 | 'value' => '', 195 | ), 196 | 'tplStart' => array( 197 | 'type' => 'textfield', 198 | 'value' => '@INLINE [[+menutitle]][[+wrapper]]', 199 | ), 200 | 201 | 'checkPermissions' => array( 202 | 'type' => 'textfield', 203 | //'value' => 'load', 204 | 'value' => '', 205 | ), 206 | 'hereId' => array( 207 | 'type' => 'numberfield', 208 | 'value' => '', 209 | ), 210 | 211 | 'where' => array( 212 | 'type' => 'textfield', 213 | 'value' => '', 214 | ), 215 | 'select' => array( 216 | 'type' => 'textfield', 217 | 'value' => '', 218 | ), 219 | 220 | 'scheme' => array( 221 | 'type' => 'list', 222 | 'options' => array( 223 | array( 224 | 'name' => 'System default', 225 | 'value' => '', 226 | ), 227 | array( 228 | 'name' => '-1 (relative to site_url)', 229 | 'value' => -1, 230 | ), 231 | array( 232 | 'name' => 'full (absolute, prepended with site_url)', 233 | 'value' => 'full', 234 | ), 235 | array( 236 | 'name' => 'abs (absolute, prepended with base_url)', 237 | 'value' => 'abs', 238 | ), 239 | array( 240 | 'name' => 'http (absolute, forced to http scheme)', 241 | 'value' => 'http', 242 | ), 243 | array( 244 | 'name' => 'https (absolute, forced to https scheme)', 245 | 'value' => 'https', 246 | ), 247 | ), 248 | 'value' => '', 249 | ), 250 | 251 | 'toPlaceholder' => array( 252 | 'type' => 'textfield', 253 | 'value' => '', 254 | ), 255 | 256 | 'countChildren' => array( 257 | 'type' => 'combo-boolean', 258 | 'value' => false, 259 | ), 260 | 261 | ); 262 | 263 | foreach ($tmp as $k => $v) { 264 | $properties[] = array_merge(array( 265 | 'name' => $k, 266 | 'desc' => 'pdotools_prop_' . $k, 267 | 'lexicon' => 'pdotools:properties', 268 | ), $v); 269 | } 270 | 271 | return $properties; -------------------------------------------------------------------------------- /_build/properties/properties.pdoneighbors.php: -------------------------------------------------------------------------------- 1 | array( 7 | 'type' => 'numberfield', 8 | 'value' => '', 9 | ), 10 | 'limit' => array( 11 | 'type' => 'numberfield', 12 | 'value' => 1, 13 | 'desc' => 'pdotools_prop_neighbors_limit', 14 | ), 15 | 'sortby' => array( 16 | 'type' => 'textfield', 17 | 'value' => 'menuindex', 18 | ), 19 | 'sortdir' => array( 20 | 'type' => 'textfield', 21 | 'value' => 'asc', 22 | ), 23 | 'depth' => array( 24 | 'type' => 'numberfield', 25 | 'value' => 0, 26 | ), 27 | 28 | 'tplPrev' => array( 29 | 'type' => 'textfield', 30 | 'value' => '@INLINE ← [[+menutitle]]', 31 | ), 32 | 'tplUp' => array( 33 | 'type' => 'textfield', 34 | 'value' => '@INLINE ↑ [[+menutitle]]', 35 | ), 36 | 'tplNext' => array( 37 | 'type' => 'textfield', 38 | 'value' => '@INLINE [[+menutitle]] →', 39 | ), 40 | 'tplWrapper' => array( 41 | 'type' => 'textfield', 42 | 'value' => '@INLINE
    [[+prev]][[+up]][[+next]]
    ', 43 | 'desc' => 'pdotools_prop_neighbors_tplWrapper', 44 | ), 45 | 'wrapIfEmpty' => array( 46 | 'type' => 'combo-boolean', 47 | 'value' => false, 48 | ), 49 | 50 | 'showUnpublished' => array( 51 | 'type' => 'combo-boolean', 52 | 'value' => false, 53 | ), 54 | 'showDeleted' => array( 55 | 'type' => 'combo-boolean', 56 | 'value' => false, 57 | ), 58 | 'showHidden' => array( 59 | 'type' => 'combo-boolean', 60 | 'value' => true, 61 | ), 62 | 'hideContainers' => array( 63 | 'type' => 'combo-boolean', 64 | 'value' => false, 65 | ), 66 | 67 | 'toSeparatePlaceholders' => array( 68 | 'type' => 'textfield', 69 | 'value' => '', 70 | ), 71 | 'toPlaceholder' => array( 72 | 'type' => 'textfield', 73 | 'value' => '', 74 | ), 75 | 'parents' => array( 76 | 'type' => 'textfield', 77 | 'value' => '', 78 | ), 79 | 'outputSeparator' => array( 80 | 'type' => 'textfield', 81 | 'value' => "\n", 82 | ), 83 | 'showLog' => array( 84 | 'type' => 'combo-boolean', 85 | 'value' => false, 86 | ), 87 | 'fastMode' => array( 88 | 'type' => 'combo-boolean', 89 | 'value' => false, 90 | ), 91 | 92 | 'includeTVs' => array( 93 | 'type' => 'textfield', 94 | 'value' => '', 95 | ), 96 | 'prepareTVs' => array( 97 | 'type' => 'textfield', 98 | 'value' => '1', 99 | ), 100 | 'processTVs' => array( 101 | 'type' => 'textfield', 102 | 'value' => '', 103 | ), 104 | 'tvPrefix' => array( 105 | 'type' => 'textfield', 106 | 'value' => 'tv.', 107 | ), 108 | 'scheme' => array( 109 | 'type' => 'list', 110 | 'options' => array( 111 | array( 112 | 'name' => 'System default', 113 | 'value' => '', 114 | ), 115 | array( 116 | 'name' => '-1 (relative to site_url)', 117 | 'value' => -1, 118 | ), 119 | array( 120 | 'name' => 'full (absolute, prepended with site_url)', 121 | 'value' => 'full', 122 | ), 123 | array( 124 | 'name' => 'abs (absolute, prepended with base_url)', 125 | 'value' => 'abs', 126 | ), 127 | array( 128 | 'name' => 'http (absolute, forced to http scheme)', 129 | 'value' => 'http', 130 | ), 131 | array( 132 | 'name' => 'https (absolute, forced to https scheme)', 133 | 'value' => 'https', 134 | ), 135 | ), 136 | 'value' => '', 137 | ), 138 | 'useWeblinkUrl' => array( 139 | 'type' => 'combo-boolean', 140 | 'value' => true, 141 | ), 142 | 'loop' => array( 143 | 'type' => 'combo-boolean', 144 | 'value' => true, 145 | ), 146 | 147 | ); 148 | 149 | foreach ($tmp as $k => $v) { 150 | $properties[] = array_merge(array( 151 | 'name' => $k, 152 | 'desc' => 'pdotools_prop_' . $k, 153 | 'lexicon' => 'pdotools:properties', 154 | ), $v); 155 | } 156 | 157 | return $properties; -------------------------------------------------------------------------------- /_build/properties/properties.pdopage.php: -------------------------------------------------------------------------------- 1 | array( 7 | 'type' => 'textfield', 8 | 'value' => '', 9 | ), 10 | 'limit' => array( 11 | 'type' => 'numberfield', 12 | 'value' => 10, 13 | ), 14 | 'maxLimit' => array( 15 | 'type' => 'numberfield', 16 | 'value' => 100, 17 | ), 18 | 'offset' => array( 19 | 'type' => 'numberfield', 20 | 'value' => '', 21 | ), 22 | 23 | 'page' => array( 24 | 'type' => 'numberfield', 25 | 'value' => '', 26 | ), 27 | 'pageVarKey' => array( 28 | 'type' => 'textfield', 29 | 'value' => 'page', 30 | ), 31 | 'totalVar' => array( 32 | 'type' => 'textfield', 33 | 'value' => 'page.total', 34 | ), 35 | 'pageLimit' => array( 36 | 'type' => 'numberfield', 37 | 'value' => 5, 38 | ), 39 | 40 | 'element' => array( 41 | 'type' => 'textfield', 42 | 'value' => 'pdoResources', 43 | ), 44 | 45 | 'pageNavVar' => array( 46 | 'type' => 'textfield', 47 | 'value' => 'page.nav', 48 | ), 49 | 'pageCountVar' => array( 50 | 'type' => 'textfield', 51 | 'value' => 'pageCount', 52 | ), 53 | 'pageLinkScheme' => array( 54 | 'type' => 'textfield', 55 | 'value' => '', 56 | ), 57 | 58 | 'tplPage' => array( 59 | 'type' => 'textfield', 60 | 'value' => '@INLINE
  • [[+pageNo]]
  • ', 61 | ), 62 | 'tplPageWrapper' => array( 63 | 'type' => 'textfield', 64 | 'value' => '@INLINE
      [[+first]][[+prev]][[+pages]][[+next]][[+last]]
    ', 65 | ), 66 | 'tplPageActive' => array( 67 | 'type' => 'textfield', 68 | 'value' => '@INLINE
  • [[+pageNo]]
  • ', 69 | ), 70 | 'tplPageFirst' => array( 71 | 'type' => 'textfield', 72 | 'value' => '@INLINE
  • [[%pdopage_first]]
  • ', 73 | ), 74 | 'tplPageLast' => array( 75 | 'type' => 'textfield', 76 | 'value' => '@INLINE
  • [[%pdopage_last]]
  • ', 77 | ), 78 | 'tplPagePrev' => array( 79 | 'type' => 'textfield', 80 | 'value' => '@INLINE
  • «
  • ', 81 | ), 82 | 'tplPageNext' => array( 83 | 'type' => 'textfield', 84 | 'value' => '@INLINE
  • »
  • ', 85 | ), 86 | 'tplPageSkip' => array( 87 | 'type' => 'textfield', 88 | 'value' => '@INLINE
  • ...
  • ', 89 | ), 90 | 91 | 'tplPageFirstEmpty' => array( 92 | 'type' => 'textfield', 93 | 'value' => '@INLINE
  • [[%pdopage_first]]
  • ', 94 | ), 95 | 'tplPageLastEmpty' => array( 96 | 'type' => 'textfield', 97 | 'value' => '@INLINE
  • [[%pdopage_last]]
  • ', 98 | ), 99 | 'tplPagePrevEmpty' => array( 100 | 'type' => 'textfield', 101 | 'value' => '@INLINE
  • «
  • ', 102 | ), 103 | 'tplPageNextEmpty' => array( 104 | 'type' => 'textfield', 105 | 'value' => '@INLINE
  • »
  • ', 106 | ), 107 | 108 | 'cache' => array( 109 | 'type' => 'combo-boolean', 110 | 'value' => false, 111 | ), 112 | 'cacheTime' => array( 113 | 'type' => 'numberfield', 114 | 'value' => 3600, 115 | ), 116 | 'cacheAnonymous' => array( 117 | 'type' => 'combo-boolean', 118 | 'value' => false, 119 | ), 120 | 121 | 'toPlaceholder' => array( 122 | 'type' => 'textfield', 123 | 'value' => '', 124 | ), 125 | 126 | 'ajax' => array( 127 | 'type' => 'combo-boolean', 128 | 'value' => false, 129 | ), 130 | 'ajaxMode' => array( 131 | 'type' => 'list', 132 | 'value' => '', 133 | 'options' => array( 134 | array('text' => 'None', 'value' => ''), 135 | array('text' => 'Default', 'value' => 'default'), 136 | array('text' => 'Scroll', 'value' => 'scroll'), 137 | array('text' => 'Button', 'value' => 'button'), 138 | ), 139 | ), 140 | 'ajaxElemWrapper' => array( 141 | 'type' => 'textfield', 142 | 'value' => '#pdopage', 143 | ), 144 | 'ajaxElemRows' => array( 145 | 'type' => 'textfield', 146 | 'value' => '#pdopage .rows', 147 | ), 148 | 'ajaxElemPagination' => array( 149 | 'type' => 'textfield', 150 | 'value' => '#pdopage .pagination', 151 | ), 152 | 'ajaxElemLink' => array( 153 | 'type' => 'textfield', 154 | 'value' => '#pdopage .pagination a', 155 | ), 156 | 'ajaxElemMore' => array( 157 | 'type' => 'textfield', 158 | 'value' => '#pdopage .btn-more', 159 | ), 160 | 'ajaxTplMore' => array( 161 | 'type' => 'textfield', 162 | 'value' => '@INLINE ', 163 | ), 164 | 'ajaxHistory' => array( 165 | 'type' => 'list', 166 | 'value' => '', 167 | 'options' => array( 168 | array('text' => 'Auto', 'value' => ''), 169 | array('text' => 'Enabled', 'value' => 1), 170 | array('text' => 'Disabled', 'value' => 0), 171 | ), 172 | ), 173 | 'frontend_js' => array( 174 | 'type' => 'textfield', 175 | 'value' => '[[+assetsUrl]]js/pdopage.min.js', 176 | ), 177 | 'frontend_css' => array( 178 | 'type' => 'textfield', 179 | 'value' => '[[+assetsUrl]]css/pdopage.min.css', 180 | ), 181 | 'setMeta' => array( 182 | 'type' => 'combo-boolean', 183 | 'value' => true, 184 | ), 185 | 'strictMode' => array( 186 | 'type' => 'combo-boolean', 187 | 'value' => true, 188 | ), 189 | 190 | ); 191 | 192 | foreach ($tmp as $k => $v) { 193 | $properties[] = array_merge(array( 194 | 'name' => $k, 195 | 'desc' => 'pdotools_prop_' . $k, 196 | 'lexicon' => 'pdotools:properties', 197 | ), $v); 198 | } 199 | 200 | return $properties; 201 | -------------------------------------------------------------------------------- /_build/properties/properties.pdoresources.php: -------------------------------------------------------------------------------- 1 | array( 7 | 'type' => 'textfield', 8 | 'value' => '', 9 | ), 10 | 'returnIds' => array( 11 | 'type' => 'combo-boolean', 12 | 'value' => false, 13 | ), 14 | 'showLog' => array( 15 | 'type' => 'combo-boolean', 16 | 'value' => false, 17 | ), 18 | 'fastMode' => array( 19 | 'type' => 'combo-boolean', 20 | 'value' => false, 21 | ), 22 | 'sortby' => array( 23 | 'type' => 'textfield', 24 | 'value' => 'publishedon', 25 | ), 26 | 'sortbyTV' => array( 27 | 'type' => 'textfield', 28 | 'value' => '', 29 | ), 30 | 'sortbyTVType' => array( 31 | 'type' => 'textfield', 32 | 'value' => '', 33 | ), 34 | 'sortdir' => array( 35 | 'type' => 'list', 36 | 'options' => array( 37 | array('text' => 'ASC', 'value' => 'ASC'), 38 | array('text' => 'DESC', 'value' => 'DESC'), 39 | ), 40 | 'value' => 'DESC', 41 | ), 42 | 'sortdirTV' => array( 43 | 'type' => 'list', 44 | 'options' => array( 45 | array('text' => 'ASC', 'value' => 'ASC'), 46 | array('text' => 'DESC', 'value' => 'DESC'), 47 | ), 48 | 'value' => 'ASC', 49 | ), 50 | 'limit' => array( 51 | 'type' => 'numberfield', 52 | 'value' => 10, 53 | ), 54 | 'offset' => array( 55 | 'type' => 'numberfield', 56 | 'value' => 0, 57 | ), 58 | 'depth' => array( 59 | 'type' => 'numberfield', 60 | 'value' => 10, 61 | ), 62 | 'outputSeparator' => array( 63 | 'type' => 'textfield', 64 | 'value' => "\n", 65 | ), 66 | 'toPlaceholder' => array( 67 | 'type' => 'textfield', 68 | 'value' => '', 69 | ), 70 | 'parents' => array( 71 | 'type' => 'textfield', 72 | 'value' => '', 73 | ), 74 | 'includeContent' => array( 75 | 'type' => 'combo-boolean', 76 | 'value' => false, 77 | ), 78 | 79 | 'includeTVs' => array( 80 | 'type' => 'textfield', 81 | 'value' => '', 82 | ), 83 | 'prepareTVs' => array( 84 | 'type' => 'textfield', 85 | 'value' => '1', 86 | ), 87 | 'processTVs' => array( 88 | 'type' => 'textfield', 89 | 'value' => '', 90 | ), 91 | 'tvPrefix' => array( 92 | 'type' => 'textfield', 93 | 'value' => 'tv.', 94 | ), 95 | 'tvFilters' => array( 96 | 'type' => 'textfield', 97 | 'value' => '', 98 | ), 99 | 'tvFiltersAndDelimiter' => array( 100 | 'type' => 'textfield', 101 | 'value' => ',', 102 | ), 103 | 'tvFiltersOrDelimiter' => array( 104 | 'type' => 'textfield', 105 | 'value' => '||', 106 | ), 107 | 108 | 'where' => array( 109 | 'type' => 'textfield', 110 | 'value' => '', 111 | ), 112 | 'showUnpublished' => array( 113 | 'type' => 'combo-boolean', 114 | 'value' => false, 115 | ), 116 | 'showDeleted' => array( 117 | 'type' => 'combo-boolean', 118 | 'value' => false, 119 | ), 120 | 'showHidden' => array( 121 | 'type' => 'combo-boolean', 122 | 'value' => true, 123 | ), 124 | 'hideContainers' => array( 125 | 'type' => 'combo-boolean', 126 | 'value' => false, 127 | ), 128 | 'context' => array( 129 | 'type' => 'textfield', 130 | 'value' => '', 131 | ), 132 | 'idx' => array( 133 | 'type' => 'numberfield', 134 | 'value' => '', 135 | ), 136 | 137 | 'first' => array( 138 | 'type' => 'numberfield', 139 | 'value' => '', 140 | ), 141 | 'last' => array( 142 | 'type' => 'numberfield', 143 | 'value' => '', 144 | ), 145 | 'tplFirst' => array( 146 | 'type' => 'textfield', 147 | 'value' => '', 148 | ), 149 | 'tplLast' => array( 150 | 'type' => 'textfield', 151 | 'value' => '', 152 | ), 153 | 'tplOdd' => array( 154 | 'type' => 'textfield', 155 | 'value' => '', 156 | ), 157 | 'tplWrapper' => array( 158 | 'type' => 'textfield', 159 | 'value' => '', 160 | ), 161 | 'wrapIfEmpty' => array( 162 | 'type' => 'combo-boolean', 163 | 'value' => false, 164 | ), 165 | 'totalVar' => array( 166 | 'type' => 'textfield', 167 | 'value' => 'total', 168 | ), 169 | 'resources' => array( 170 | 'type' => 'textfield', 171 | 'value' => '', 172 | ), 173 | 'tplCondition' => array( 174 | 'type' => 'textfield', 175 | 'value' => '', 176 | ), 177 | 'tplOperator' => array( 178 | 'type' => 'list', 179 | 'options' => array( 180 | array('text' => 'is equal to', 'value' => '=='), 181 | array('text' => 'is not equal to', 'value' => '!='), 182 | array('text' => 'less than', 'value' => '<'), 183 | array('text' => 'less than or equal to', 'value' => '<='), 184 | array('text' => 'greater than or equal to', 'value' => '>='), 185 | array('text' => 'is empty', 'value' => 'empty'), 186 | array('text' => 'is not empty', 'value' => '!empty'), 187 | array('text' => 'is null', 'value' => 'null'), 188 | array('text' => 'is in array', 'value' => 'inarray'), 189 | array('text' => 'is between', 'value' => 'between'), 190 | ), 191 | 'value' => '==', 192 | ), 193 | 'conditionalTpls' => array( 194 | 'type' => 'textarea', 195 | 'value' => '', 196 | ), 197 | 'select' => array( 198 | 'type' => 'textarea', 199 | 'value' => '', 200 | ), 201 | 'toSeparatePlaceholders' => array( 202 | 'type' => 'textfield', 203 | 'value' => '', 204 | ), 205 | 'loadModels' => array( 206 | 'type' => 'textfield', 207 | 'value' => '', 208 | ), 209 | 'scheme' => array( 210 | 'type' => 'list', 211 | 'options' => array( 212 | array('name' => 'System default', 'value' => ''), 213 | array('name' => '-1 (relative to site_url)', 'value' => -1), 214 | array('name' => 'full (absolute, prepended with site_url)', 'value' => 'full'), 215 | array('name' => 'abs (absolute, prepended with base_url)', 'value' => 'abs'), 216 | array('name' => 'http (absolute, forced to http scheme)', 'value' => 'http'), 217 | array('name' => 'https (absolute, forced to https scheme)', 'value' => 'https'), 218 | ), 219 | 'value' => '', 220 | ), 221 | 'useWeblinkUrl' => array( 222 | 'type' => 'combo-boolean', 223 | 'value' => false, 224 | ), 225 | 226 | ); 227 | 228 | foreach ($tmp as $k => $v) { 229 | $properties[] = array_merge(array( 230 | 'name' => $k, 231 | 'desc' => 'pdotools_prop_' . $k, 232 | 'lexicon' => 'pdotools:properties', 233 | ), $v); 234 | } 235 | 236 | return $properties; -------------------------------------------------------------------------------- /_build/properties/properties.pdositemap.php: -------------------------------------------------------------------------------- 1 | array( 7 | 'type' => 'textfield', 8 | 'value' => "@INLINE \n\t[[+url]]\n\t[[+date]]\n\t[[+update]]\n\t[[+priority]]\n", 9 | ), 10 | 'tplWrapper' => array( 11 | 'type' => 'textfield', 12 | 'value' => "@INLINE \n\n[[+output]]\n", 13 | ), 14 | 'templates' => array( 15 | 'type' => 'textfield', 16 | 'value' => '', 17 | ), 18 | 'context' => array( 19 | 'type' => 'textfield', 20 | 'value' => '', 21 | ), 22 | 'depth' => array( 23 | 'type' => 'numberfield', 24 | 'value' => 10, 25 | ), 26 | 'showDeleted' => array( 27 | 'type' => 'combo-boolean', 28 | 'value' => false, 29 | ), 30 | 'showHidden' => array( 31 | 'type' => 'combo-boolean', 32 | 'value' => false, 33 | ), 34 | 'sitemapSchema' => array( 35 | 'type' => 'textfield', 36 | 'value' => 'http://www.sitemaps.org/schemas/sitemap/0.9', 37 | ), 38 | 'showUnpublished' => array( 39 | 'type' => 'combo-boolean', 40 | 'value' => false, 41 | ), 42 | 'hideUnsearchable' => array( 43 | 'type' => 'combo-boolean', 44 | 'value' => true, 45 | ), 46 | 'resources' => array( 47 | 'type' => 'textfield', 48 | 'value' => '', 49 | ), 50 | 'parents' => array( 51 | 'type' => 'textfield', 52 | 'value' => '', 53 | ), 54 | 'sortby' => array( 55 | 'type' => 'textfield', 56 | 'value' => 'menuindex', 57 | ), 58 | 'sortdir' => array( 59 | 'type' => 'textfield', 60 | 'value' => 'asc', 61 | ), 62 | 'where' => array( 63 | 'type' => 'textfield', 64 | 'value' => '', 65 | ), 66 | 'includeTVs' => array( 67 | 'type' => 'textfield', 68 | 'value' => '', 69 | ), 70 | 'prepareTVs' => array( 71 | 'type' => 'textfield', 72 | 'value' => '1', 73 | ), 74 | 'processTVs' => array( 75 | 'type' => 'textfield', 76 | 'value' => '', 77 | ), 78 | 'outputSeparator' => array( 79 | 'type' => 'textfield', 80 | 'value' => "\n", 81 | ), 82 | 'forceXML' => array( 83 | 'type' => 'combo-boolean', 84 | 'value' => true, 85 | ), 86 | 'useWeblinkUrl' => array( 87 | 'type' => 'combo-boolean', 88 | 'value' => true, 89 | ), 90 | 91 | 'cache' => array( 92 | 'type' => 'combo-boolean', 93 | 'value' => true, 94 | ), 95 | 'cacheKey' => array( 96 | 'type' => 'textfield', 97 | 'value' => '', 98 | ), 99 | 'cacheTime' => array( 100 | 'type' => 'numberfield', 101 | 'value' => 600, 102 | ), 103 | ); 104 | 105 | foreach ($tmp as $k => $v) { 106 | $properties[] = array_merge(array( 107 | 'name' => $k, 108 | 'desc' => 'pdotools_prop_' . $k, 109 | 'lexicon' => 'pdotools:properties', 110 | ), $v); 111 | } 112 | 113 | return $properties; -------------------------------------------------------------------------------- /_build/properties/properties.pdotitle.php: -------------------------------------------------------------------------------- 1 | array( 8 | 'type' => 'numberfield', 9 | 'value' => 0, 10 | ), 11 | 'exclude' => array( 12 | 'type' => 'textfield', 13 | 'value' => '', 14 | ), 15 | 'limit' => array( 16 | 'type' => 'numberfield', 17 | 'value' => 3, 18 | 'desc' => 'pdotools_prop_title_limit', 19 | ), 20 | 'titleField' => array( 21 | 'type' => 'textfield', 22 | 'value' => 'longtitle', 23 | ), 24 | 25 | 'cache' => array( 26 | 'type' => 'numberfield', 27 | 'value' => false, 28 | 'desc' => 'pdotools_prop_title_cache', 29 | ), 30 | 'cacheTime' => array( 31 | 'type' => 'numberfield', 32 | 'value' => 0, 33 | ), 34 | 35 | 'tplPages' => array( 36 | 'type' => 'textfield', 37 | 'value' => '@INLINE [[%pdopage_page]] [[+page]] [[%pdopage_from]] [[+pageCount]]', 38 | ), 39 | 'pageVarKey' => array( 40 | 'type' => 'textfield', 41 | 'value' => 'page', 42 | ), 43 | 44 | 'tplSearch' => array( 45 | 'type' => 'textfield', 46 | 'value' => '@INLINE «[[+mse2_query]]»', 47 | ), 48 | 'queryVarKey' => array( 49 | 'type' => 'textfield', 50 | 'value' => 'query', 51 | ), 52 | 'minQuery' => array( 53 | 'type' => 'numberfield', 54 | 'value' => 3, 55 | ), 56 | 57 | 'outputSeparator' => array( 58 | 'type' => 'textfield', 59 | 'value' => ' / ', 60 | 'desc' => 'pdotools_prop_title_outputSeparator', 61 | ), 62 | 63 | 'registerJs' => array( 64 | 'type' => 'combo-boolean', 65 | 'value' => false, 66 | ), 67 | ); 68 | 69 | foreach ($tmp as $k => $v) { 70 | $properties[] = array_merge(array( 71 | 'name' => $k, 72 | 'desc' => 'pdotools_prop_' . $k, 73 | 'lexicon' => 'pdotools:properties', 74 | ), $v); 75 | } 76 | 77 | return $properties; 78 | -------------------------------------------------------------------------------- /_build/properties/properties.pdousers.php: -------------------------------------------------------------------------------- 1 | array( 7 | 'type' => 'textfield', 8 | 'value' => '', 9 | ), 10 | 'returnIds' => array( 11 | 'type' => 'combo-boolean', 12 | 'value' => false, 13 | ), 14 | 'showLog' => array( 15 | 'type' => 'combo-boolean', 16 | 'value' => false, 17 | ), 18 | 'fastMode' => array( 19 | 'type' => 'combo-boolean', 20 | 'value' => false, 21 | ), 22 | 'sortby' => array( 23 | 'type' => 'textfield', 24 | 'value' => 'modUser.id', 25 | ), 26 | 'sortdir' => array( 27 | 'type' => 'list', 28 | 'options' => array( 29 | array('text' => 'ASC', 'value' => 'ASC'), 30 | array('text' => 'DESC', 'value' => 'DESC'), 31 | ), 32 | 'value' => 'ASC', 33 | ), 34 | 'limit' => array( 35 | 'type' => 'numberfield', 36 | 'value' => 10, 37 | ), 38 | 'offset' => array( 39 | 'type' => 'numberfield', 40 | 'value' => 0, 41 | ), 42 | 'outputSeparator' => array( 43 | 'type' => 'textfield', 44 | 'value' => "\n", 45 | ), 46 | 'toPlaceholder' => array( 47 | 'type' => 'textfield', 48 | 'value' => '', 49 | ), 50 | 'groups' => array( 51 | 'type' => 'textfield', 52 | 'value' => '', 53 | ), 54 | 'roles' => array( 55 | 'type' => 'textfield', 56 | 'value' => false, 57 | ), 58 | 'users' => array( 59 | 'type' => 'textfield', 60 | 'value' => '', 61 | ), 62 | 'where' => array( 63 | 'type' => 'textfield', 64 | 'value' => '', 65 | ), 66 | 'showInactive' => array( 67 | 'type' => 'combo-boolean', 68 | 'value' => false, 69 | ), 70 | 'showBlocked' => array( 71 | 'type' => 'combo-boolean', 72 | 'value' => false, 73 | ), 74 | 'idx' => array( 75 | 'type' => 'numberfield', 76 | 'value' => '', 77 | ) 78 | , 79 | 'first' => array( 80 | 'type' => 'numberfield', 81 | 'value' => '', 82 | ), 83 | 'last' => array( 84 | 'type' => 'numberfield', 85 | 'value' => '', 86 | ), 87 | 'tplFirst' => array( 88 | 'type' => 'textfield', 89 | 'value' => '', 90 | ), 91 | 'tplLast' => array( 92 | 'type' => 'textfield', 93 | 'value' => '', 94 | ), 95 | 'tplOdd' => array( 96 | 'type' => 'textfield', 97 | 'value' => '', 98 | ), 99 | 'tplWrapper' => array( 100 | 'type' => 'textfield', 101 | 'value' => '', 102 | ), 103 | 'wrapIfEmpty' => array( 104 | 'type' => 'combo-boolean', 105 | 'value' => false, 106 | ), 107 | 'totalVar' => array( 108 | 'type' => 'textfield', 109 | 'value' => 'total', 110 | ), 111 | 'tplCondition' => array( 112 | 'type' => 'textfield', 113 | 'value' => '', 114 | ), 115 | 'tplOperator' => array( 116 | 'type' => 'list', 117 | 'options' => array( 118 | array('text' => 'is equal to', 'value' => '=='), 119 | array('text' => 'is not equal to', 'value' => '!='), 120 | array('text' => 'less than', 'value' => '<'), 121 | array('text' => 'less than or equal to', 'value' => '<='), 122 | array('text' => 'greater than or equal to', 'value' => '>='), 123 | array('text' => 'is empty', 'value' => 'empty'), 124 | array('text' => 'is not empty', 'value' => '!empty'), 125 | array('text' => 'is null', 'value' => 'null'), 126 | array('text' => 'is in array', 'value' => 'inarray'), 127 | array('text' => 'is between', 'value' => 'between'), 128 | ), 129 | 'value' => '==', 130 | ), 131 | 'conditionalTpls' => array( 132 | 'type' => 'textarea', 133 | 'value' => '', 134 | ), 135 | 'select' => array( 136 | 'type' => 'textarea', 137 | 'value' => '', 138 | ), 139 | 'toSeparatePlaceholders' => array( 140 | 'type' => 'textfield', 141 | 'value' => '', 142 | ), 143 | 144 | ); 145 | 146 | foreach ($tmp as $k => $v) { 147 | $properties[] = array_merge(array( 148 | 'name' => $k, 149 | 'desc' => 'pdotools_prop_' . $k, 150 | 'lexicon' => 'pdotools:properties', 151 | ), $v); 152 | } 153 | 154 | return $properties; -------------------------------------------------------------------------------- /_build/resolvers/resolve.extension.php: -------------------------------------------------------------------------------- 1 | xpdo) { 4 | /** @var $modx modX */ 5 | $modx =& $object->xpdo; 6 | 7 | switch ($options[xPDOTransport::PACKAGE_ACTION]) { 8 | case xPDOTransport::ACTION_INSTALL: 9 | case xPDOTransport::ACTION_UPGRADE: 10 | //$modx->addExtensionPackage('pdotools', '[[++core_path]]components/pdotools/model/'); 11 | $modx->removeExtensionPackage('pdotools'); 12 | $old_settings = array( 13 | //'pdoTools.class' => 'pdotools.pdotools', 14 | //'pdoFetch.class' => 'pdotools.pdofetch', 15 | 'pdoParser.class' => 'pdotools.pdoparser', 16 | 'pdotools_fenom_modifiers' => null, 17 | ); 18 | foreach ($old_settings as $k => $v) { 19 | if ($item = $modx->getObject('modSystemSetting', array('key' => $k))) { 20 | if (!$v || $item->get('value') == $v) { 21 | $item->remove(); 22 | } 23 | } 24 | } 25 | break; 26 | 27 | case xPDOTransport::ACTION_UNINSTALL: 28 | //$modx->removeExtensionPackage('pdotools'); 29 | break; 30 | } 31 | } 32 | return true; -------------------------------------------------------------------------------- /_build/resolvers/resolve.parser.php: -------------------------------------------------------------------------------- 1 | xpdo) { 4 | /** @var $modx modX */ 5 | $modx = $object->xpdo; 6 | 7 | switch ($options[xPDOTransport::PACKAGE_ACTION]) { 8 | case xPDOTransport::ACTION_INSTALL: 9 | case xPDOTransport::ACTION_UPGRADE: 10 | /** @var modSystemSetting $tmp */ 11 | if (!$tmp = $modx->getObject('modSystemSetting', ['key' => 'parser_class'])) { 12 | $tmp = $modx->newObject('modSystemSetting'); 13 | } 14 | $tmp->fromArray([ 15 | 'namespace' => 'core', 16 | 'area' => 'site', 17 | 'xtype' => 'textfield', 18 | 'value' => 'pdoParser', 19 | 'key' => 'parser_class', 20 | ], '', true, true); 21 | $tmp->save(); 22 | 23 | /** @var modSystemSetting $tmp */ 24 | if (!$tmp = $modx->getObject('modSystemSetting', ['key' => 'parser_class_path'])) { 25 | $tmp = $modx->newObject('modSystemSetting'); 26 | } 27 | $tmp->fromArray([ 28 | 'namespace' => 'core', 29 | 'area' => 'site', 30 | 'xtype' => 'textfield', 31 | 'value' => '{core_path}components/pdotools/model/pdotools/', 32 | 'key' => 'parser_class_path', 33 | ], '', true, true); 34 | $tmp->save(); 35 | 36 | // Remove old settings 37 | if ($tmp = $modx->getObject('modSystemSetting', ['key' => 'pdotools_useFenom'])) { 38 | $tmp->remove(); 39 | } 40 | break; 41 | 42 | case xPDOTransport::ACTION_UNINSTALL: 43 | if ($tmp = $modx->getObject('modSystemSetting', ['key' => 'parser_class', 'value' => 'pdoParser'])) { 44 | $tmp->remove(); 45 | } 46 | if ($tmp = $modx->getObject('modSystemSetting', ['key' => 'parser_class_path', 'value' => '{core_path}components/pdotools/model/pdotools/'])) { 47 | $tmp->remove(); 48 | } 49 | break; 50 | } 51 | } 52 | return true; -------------------------------------------------------------------------------- /assets/components/pdotools/connector.php: -------------------------------------------------------------------------------- 1 | initialize('web'); 7 | $modx->getService('error','error.modError', '', ''); 8 | $modx->setLogLevel(modX::LOG_LEVEL_ERROR); 9 | $modx->setLogTarget('FILE'); 10 | 11 | // Switch context if needed 12 | if (!empty($_REQUEST['pageId'])) { 13 | if ($resource = $modx->getObject('modResource', ['id' => (int)$_REQUEST['pageId']])) { 14 | if ($resource->get('context_key') !== 'web') { 15 | $modx->switchContext($resource->get('context_key')); 16 | } 17 | $modx->resource = $resource; 18 | } 19 | } 20 | 21 | // Run snippet 22 | if (!empty($_REQUEST['hash']) && !empty($_SESSION['pdoPage'][$_REQUEST['hash']])) { 23 | $scriptProperties = $_SESSION['pdoPage'][$_REQUEST['hash']]; 24 | $_GET = $_POST; 25 | 26 | // For ClientConfig and other similar plugins 27 | $modx->invokeEvent('OnHandleRequest'); 28 | 29 | $modx->runSnippet('pdoPage', $scriptProperties); 30 | } 31 | -------------------------------------------------------------------------------- /assets/components/pdotools/css/pdopage.css: -------------------------------------------------------------------------------- 1 | #pdopage .pagination { 2 | margin: 0; 3 | } 4 | .sticky-pagination.is-sticky { 5 | opacity: .5; 6 | } 7 | .sticky-pagination.is-sticky:hover { 8 | opacity: 1; 9 | } 10 | .btn-more { 11 | width: 150px; 12 | display: block; 13 | margin: auto; 14 | } 15 | -------------------------------------------------------------------------------- /assets/components/pdotools/css/pdopage.min.css: -------------------------------------------------------------------------------- 1 | #pdopage .pagination{margin:0}.sticky-pagination.is-sticky{opacity:.5}.sticky-pagination.is-sticky:hover{opacity:1}.btn-more{width:150px;display:block;margin:auto} -------------------------------------------------------------------------------- /assets/components/pdotools/js/jquery.pdopage.min.js: -------------------------------------------------------------------------------- 1 | !function(a,b,c,d){"use strict";function e(c,d){this.element=c,this.settings=a.extend({},g,d),this._defaults=g,this._name=f,this.key=this.settings.pageVarKey,this.wrapper=a(this.settings.wrapper),this.mode=this.settings.mode,this.reached=!1,this.history=this.settings.history,this.oldBrowser=!(b.history&&history.pushState),this.init()}var f="pdoPage",g={wrapper:"#pdopage",rows:"#pdopage .row",pagination:"#pdopage .pagination",link:"#pdopage .pagination a",more:"#pdopage .btn-more",pdoTitle:"#pdopage .title",moreTpl:'',waitAnimation:'
    ',mode:"scroll",pageVarKey:"page",pageLimit:12,assetsUrl:"/assets/components/pdotools/",scrollTop:!0};a.extend(e.prototype,{init:function(){var b=this;if(void 0==this.page){var c=this.hashGet(),d=void 0==c[this.key]?1:c[this.key];this.page=Number(d)}switch(this.mode){case"default":this.initDefault();break;case"scroll":case"button":if(this.history){if(void 0===jQuery().sticky)return void a.getScript(this.settings.assetsUrl+"js/lib/jquery.sticky.js",function(){b.init(b.settings)});this.stickyPagination()}else a(this.settings.pagination).hide();"button"==this.mode?this.initButton():this.initScroll()}},initDefault:function(){var d=this;a(c).on("click",this.settings.link,function(b){b.preventDefault();var c=a(this).prop("href"),e=c.match(new RegExp(d.key+"=(\\d+)")),f=e?e[1]:1;d.page!=f&&(d.history&&d.hashAdd(d.key,f),d.loadPage(c))}),this.history&&(a(b).on("popstate",function(a){a.originalEvent.state&&a.originalEvent.state.pdoPage&&d.loadPage(a.originalEvent.state.pdoPage)}),history.replaceState({pdoPage:b.location.href},""))},initButton:function(){var b=this;a(this.settings.rows).after(this.settings.moreTpl);var d=!1;a(this.settings.link).each(function(){var c=a(this).prop("href"),e=c.match(new RegExp(b.key+"=(\\d+)"));if((e?e[1]:1)>b.page)return d=!0,!1}),d||a(this.settings.more).hide(),a(c).on("click",this.settings.more,function(a){a.preventDefault(),b.addPage()})},initScroll:function(){var c=this,d=a(b);d.on("scroll",function(){!c.reached&&d.scrollTop()>c.wrapper.height()-d.height()&&(c.reached=!0,c.addPage())})},addPage:function(){var b=this,c=this.hashGet(),d=c[this.key]||1;a(this.settings.link).each(function(){var c=a(this).prop("href"),e=c.match(new RegExp(b.key+"=(\\d+)")),f=e?Number(e[1]):1;if(f>d)return b.history&&b.hashAdd(b.key,f),b.page=d,b.loadPage(c,"append"),!1})},loadPage:function(c,d){var e=this,f=a(this.settings.rows),g=a(this.settings.pagination),h=c.match(new RegExp(this.key+"=(\\d+)")),i=h?Number(h[1]):1;if(d||(d="replace"),this.page!=i||"force"==d){this.wrapper.trigger("beforeLoad",[this,this.settings]),"scroll"!=this.mode&&this.wrapper.css({opacity:.3}),this.page=i;var j=a(this.settings.waitAnimation);"append"==d?this.wrapper.find(f).append(j):this.wrapper.find(f).empty().append(j);var k=this.getUrlParameters(c);k[this.key]=this.page,a.get(b.location.pathname,k,function(b){b&&(e.wrapper.find(g).replaceWith(b.pagination),"append"==d?(e.wrapper.find(f).append(b.output),"button"==e.mode?b.pages==b.page?a(e.settings.more).hide():a(e.settings.more).show():"scroll"==e.mode&&(e.reached=!1),j.remove()):(e.wrapper.find(f).html(b.output),"force"==d&&e.history&&e.hashSet(k)),e.wrapper.trigger("afterLoad",[e,e.settings,b]),"scroll"!=e.mode&&(e.wrapper.css({opacity:1}),"default"==e.mode&&e.settings.scrollTop&&a("html, body").animate({scrollTop:e.wrapper.position().top-50||0},0)),e.updateTitle(b))},"json")}},stickyPagination:function(){var b=a(this.settings.pagination);b.is(":visible")&&(b.sticky({wrapperClassName:"sticky-pagination",getWidthFrom:this.settings.pagination,responsiveWidth:!0}),this.wrapper.trigger("scroll"))},updateTitle:function(b){if("undefined"!=typeof pdoTitle){for(var c=a("title"),d=pdoTitle.separator||" / ",e=pdoTitle.tpl,f=[],g=c.text().split(d),h=new RegExp("^"+e.split(" ")[0]+" "),i=0;i1&&f.push(e.replace("{page}",b.page).replace("{pageCount}",b.pages)),g[i].match(h)||f.push(g[i]);c.text(f.join(d))}},getUrlParameters:function(a){var b={},c=a.indexOf("?");return-1!==c&&(b=this.deparam(a.substring(c+1))),b},deparam:function(b){var c,d,e=/^\d+$/,f=/([^\[\]]+)|(\[\])/g,g=/([^?#]*)(#.*)?$/,h=function(a){return decodeURIComponent(a.replace(/\+/g," "))},i={};return b&&g.test(b)&&(c=b.split("&"),a.each(c,function(a,b){var c=b.split("="),g=h(c.shift()),j=h(c.join("=")),k=i;if(g){c=g.match(f);for(var l=0,m=c.length-1;l dwh) ? dwh - scrollTop : 0; 32 | 33 | for (var i = 0; i < sticked.length; i++) { 34 | var s = sticked[i], 35 | elementTop = s.stickyWrapper.offset().top, 36 | etse = elementTop - s.topSpacing - extra; 37 | 38 | if (scrollTop <= etse) { 39 | if (s.currentTop !== null) { 40 | s.stickyElement 41 | .css('position', '') 42 | .css('top', ''); 43 | s.stickyElement.trigger('sticky-end', [s]).parent().removeClass(s.className); 44 | s.currentTop = null; 45 | } 46 | } 47 | else { 48 | var newTop = documentHeight - s.stickyElement.outerHeight() 49 | - s.topSpacing - s.bottomSpacing - scrollTop - extra; 50 | if (newTop < 0) { 51 | newTop = newTop + s.topSpacing; 52 | } else { 53 | newTop = s.topSpacing; 54 | } 55 | if (s.currentTop != newTop) { 56 | s.stickyElement 57 | .css('position', 'fixed') 58 | .css('top', newTop); 59 | 60 | if (typeof s.getWidthFrom !== 'undefined') { 61 | s.stickyElement.css('width', $(s.getWidthFrom).width()); 62 | } 63 | 64 | s.stickyElement.trigger('sticky-start', [s]).parent().addClass(s.className); 65 | s.currentTop = newTop; 66 | } 67 | } 68 | } 69 | }, 70 | resizer = function() { 71 | windowHeight = $window.height(); 72 | 73 | for (var i = 0; i < sticked.length; i++) { 74 | var s = sticked[i]; 75 | if (typeof s.getWidthFrom !== 'undefined' && s.responsiveWidth === true) { 76 | s.stickyElement.css('width', $(s.getWidthFrom).width()); 77 | } 78 | } 79 | }, 80 | methods = { 81 | init: function(options) { 82 | var o = $.extend({}, defaults, options); 83 | return this.each(function() { 84 | var stickyElement = $(this); 85 | 86 | var stickyId = stickyElement.attr('id'); 87 | var wrapperId = stickyId ? stickyId + '-' + defaults.wrapperClassName : defaults.wrapperClassName 88 | var wrapper = $('
    ') 89 | .attr('id', stickyId + '-sticky-wrapper') 90 | .addClass(o.wrapperClassName); 91 | stickyElement.wrapAll(wrapper); 92 | 93 | if (o.center) { 94 | stickyElement.parent().css({width:stickyElement.outerWidth(),marginLeft:"auto",marginRight:"auto"}); 95 | } 96 | 97 | if (stickyElement.css("float") == "right") { 98 | stickyElement.css({"float":"none"}).parent().css({"float":"right"}); 99 | } 100 | 101 | var stickyWrapper = stickyElement.parent(); 102 | stickyWrapper.css('height', stickyElement.outerHeight()); 103 | sticked.push({ 104 | topSpacing: o.topSpacing, 105 | bottomSpacing: o.bottomSpacing, 106 | stickyElement: stickyElement, 107 | currentTop: null, 108 | stickyWrapper: stickyWrapper, 109 | className: o.className, 110 | getWidthFrom: o.getWidthFrom, 111 | responsiveWidth: o.responsiveWidth 112 | }); 113 | }); 114 | }, 115 | update: scroller, 116 | unstick: function(options) { 117 | return this.each(function() { 118 | var unstickyElement = $(this); 119 | 120 | var removeIdx = -1; 121 | for (var i = 0; i < sticked.length; i++) 122 | { 123 | if (sticked[i].stickyElement.get(0) == unstickyElement.get(0)) 124 | { 125 | removeIdx = i; 126 | } 127 | } 128 | if(removeIdx != -1) 129 | { 130 | sticked.splice(removeIdx,1); 131 | unstickyElement.unwrap(); 132 | unstickyElement.removeAttr('style'); 133 | } 134 | }); 135 | } 136 | }; 137 | 138 | // should be more efficient than using $window.scroll(scroller) and $window.resize(resizer): 139 | if (window.addEventListener) { 140 | window.addEventListener('scroll', scroller, false); 141 | window.addEventListener('resize', resizer, false); 142 | } else if (window.attachEvent) { 143 | window.attachEvent('onscroll', scroller); 144 | window.attachEvent('onresize', resizer); 145 | } 146 | 147 | $.fn.sticky = function(method) { 148 | if (methods[method]) { 149 | return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 150 | } else if (typeof method === 'object' || !method ) { 151 | return methods.init.apply( this, arguments ); 152 | } else { 153 | $.error('Method ' + method + ' does not exist on jQuery.sticky'); 154 | } 155 | }; 156 | 157 | $.fn.unstick = function(method) { 158 | if (methods[method]) { 159 | return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); 160 | } else if (typeof method === 'object' || !method ) { 161 | return methods.unstick.apply( this, arguments ); 162 | } else { 163 | $.error('Method ' + method + ' does not exist on jQuery.sticky'); 164 | } 165 | 166 | }; 167 | $(function() { 168 | setTimeout(scroller, 0); 169 | }); 170 | })(jQuery); -------------------------------------------------------------------------------- /assets/components/pdotools/js/lib/jquery.sticky.min.js: -------------------------------------------------------------------------------- 1 | !function(a){var b={topSpacing:0,bottomSpacing:0,className:"is-sticky",wrapperClassName:"sticky-wrapper",center:!1,getWidthFrom:"",responsiveWidth:!1},c=a(window),d=a(document),e=[],f=c.height(),g=function(){for(var b=c.scrollTop(),g=d.height(),h=g-f,i=b>h?h-b:0,j=0;j").attr("id",c+"-sticky-wrapper").addClass(d.wrapperClassName);b.wrapAll(f),d.center&&b.parent().css({width:b.outerWidth(),marginLeft:"auto",marginRight:"auto"}),"right"==b.css("float")&&b.css({float:"none"}).parent().css({float:"right"});var g=b.parent();g.css("height",b.outerHeight()),e.push({topSpacing:d.topSpacing,bottomSpacing:d.bottomSpacing,stickyElement:b,currentTop:null,stickyWrapper:g,className:d.className,getWidthFrom:d.getWidthFrom,responsiveWidth:d.responsiveWidth})})},update:g,unstick:function(b){return this.each(function(){for(var b=a(this),c=-1,d=0;d pdoPage.keys[key]) { 73 | has_results = true; 74 | return false; 75 | } 76 | }); 77 | if (!has_results) { 78 | $(config['more']).hide(); 79 | } 80 | 81 | $(document).on('click', config['more'], function (e) { 82 | e.preventDefault(); 83 | pdoPage.addPage(config) 84 | }); 85 | } 86 | else { 87 | // Scroll pagination 88 | var wrapper = $(config['wrapper']); 89 | var $window = $(window); 90 | $window.on('load scroll', function () { 91 | if (!pdoPage.Reached && $window.scrollTop() > wrapper.height() - $window.height()) { 92 | pdoPage.Reached = true; 93 | pdoPage.addPage(config); 94 | } 95 | }); 96 | } 97 | break; 98 | } 99 | }; 100 | 101 | pdoPage.addPage = function (config) { 102 | var key = config['pageVarKey']; 103 | var current = pdoPage.keys[key] || 1; 104 | $(config['link']).each(function () { 105 | var href = $(this).prop('href'); 106 | var match = href.match(new RegExp(key + '=(\\d+)')); 107 | var page = !match ? 1 : Number(match[1]); 108 | if (page > current) { 109 | if (config.history) { 110 | if (page == 1) { 111 | pdoPage.Hash.remove(key); 112 | } else { 113 | pdoPage.Hash.add(key, page); 114 | } 115 | } 116 | pdoPage.loadPage(href, config, 'append'); 117 | return false; 118 | } 119 | }); 120 | }; 121 | 122 | pdoPage.loadPage = function (href, config, mode) { 123 | var wrapper = $(config['wrapper']); 124 | var rows = $(config['rows']); 125 | var pagination = $(config['pagination']); 126 | var key = config['pageVarKey']; 127 | var match = href.match(new RegExp(key + '=(\\d+)')); 128 | var page = !match ? 1 : Number(match[1]); 129 | if (!mode) { 130 | mode = 'replace'; 131 | } 132 | 133 | if (pdoPage.keys[key] == page) { 134 | return; 135 | } 136 | if (pdoPage.callbacks['before'] && typeof(pdoPage.callbacks['before']) == 'function') { 137 | pdoPage.callbacks['before'].apply(this, [config]); 138 | } 139 | else { 140 | if (config['mode'] != 'scroll') { 141 | wrapper.css({opacity: .3}); 142 | } 143 | wrapper.addClass('loading'); 144 | } 145 | 146 | var params = pdoPage.Hash.get(); 147 | for (var i in params) { 148 | if (params.hasOwnProperty(i) && pdoPage.keys[i] && i != key) { 149 | delete(params[i]); 150 | } 151 | } 152 | params[key] = pdoPage.keys[key] = page; 153 | params['pageId'] = config['pageId']; 154 | params['hash'] = config['hash']; 155 | 156 | $.post(config['connectorUrl'], params, function (response) { 157 | if (response && response['total']) { 158 | wrapper.find(pagination).html(response['pagination']); 159 | if (mode == 'append') { 160 | wrapper.find(rows).append(response['output']); 161 | if (config['mode'] == 'button') { 162 | if (response['pages'] == response['page']) { 163 | $(config['more']).hide(); 164 | } 165 | else { 166 | $(config['more']).show(); 167 | } 168 | } 169 | else if (config['mode'] == 'scroll') { 170 | pdoPage.Reached = false; 171 | var $window = $(window); 172 | if ($window.scrollTop() > wrapper.height() - $window.height()) { 173 | pdoPage.Reached = true; 174 | pdoPage.addPage(config); 175 | } 176 | } 177 | } 178 | else { 179 | wrapper.find(rows).html(response['output']); 180 | } 181 | 182 | if (pdoPage.callbacks['after'] && typeof(pdoPage.callbacks['after']) == 'function') { 183 | pdoPage.callbacks['after'].apply(this, [config, response]); 184 | } 185 | else { 186 | wrapper.removeClass('loading'); 187 | if (config['mode'] != 'scroll') { 188 | wrapper.css({opacity: 1}); 189 | if (config['mode'] == 'default' && config['scrollTop'] !== false) { 190 | $('html, body').animate({scrollTop: wrapper.position().top - 50 || 0}, 0); 191 | } 192 | } 193 | } 194 | pdoPage.updateTitle(config, response); 195 | $(document).trigger('pdopage_load', [config, response]); 196 | } 197 | }, 'json'); 198 | }; 199 | 200 | pdoPage.stickyPagination = function (config) { 201 | var pagination = $(config['pagination']); 202 | if (pagination.is(':visible')) { 203 | pagination.sticky({ 204 | wrapperClassName: 'sticky-pagination', 205 | getWidthFrom: config['wrapper'], 206 | responsiveWidth: true, 207 | topSpacing: 2 208 | }); 209 | $(config['wrapper']).trigger('scroll'); 210 | } 211 | }; 212 | 213 | pdoPage.updateTitle = function (config, response) { 214 | if (typeof(pdoTitle) == 'undefined') { 215 | return; 216 | } 217 | var $title = $('title'); 218 | var separator = pdoTitle.separator || ' / '; 219 | var tpl = pdoTitle.tpl; 220 | 221 | var title = []; 222 | var items = $title.text().split(separator); 223 | var pcre = new RegExp('^' + tpl.split(' ')[0] + ' '); 224 | for (var i = 0; i < items.length; i++) { 225 | if (i === 1 && response.page && response.page > 1) { 226 | title.push(tpl.replace('{page}', response.page).replace('{pageCount}', response.pages)); 227 | } 228 | if (!items[i].match(pcre)) { 229 | title.push(items[i]); 230 | } 231 | } 232 | $title.text(title.join(separator)); 233 | }; 234 | 235 | pdoPage.Hash = { 236 | get: function () { 237 | var vars = {}, hash, splitter, hashes; 238 | if (!this.oldbrowser()) { 239 | var pos = window.location.href.indexOf('?'); 240 | hashes = (pos != -1) ? decodeURIComponent(window.location.href.substr(pos + 1)).replace('+', ' ') : ''; 241 | splitter = '&'; 242 | } 243 | else { 244 | hashes = decodeURIComponent(window.location.hash.substr(1)).replace('+', ' '); 245 | splitter = '/'; 246 | } 247 | 248 | if (hashes.length == 0) { 249 | return vars; 250 | } 251 | else { 252 | hashes = hashes.split(splitter); 253 | } 254 | 255 | var matches, key; 256 | for (var i in hashes) { 257 | if (hashes.hasOwnProperty(i)) { 258 | hash = hashes[i].split('='); 259 | if (typeof hash[1] == 'undefined') { 260 | vars['anchor'] = hash[0]; 261 | } 262 | else { 263 | matches = hash[0].match(/\[(.*?|)\]$/); 264 | if (matches) { 265 | key = hash[0].replace(matches[0], ''); 266 | if (!vars.hasOwnProperty(key)) { 267 | // Array 268 | if (matches[1] == '') { 269 | vars[key] = []; 270 | } 271 | // Object 272 | else { 273 | vars[key] = {}; 274 | } 275 | } 276 | if (vars[key] instanceof Array) { 277 | vars[key].push(hash[1]); 278 | } 279 | else { 280 | vars[key][matches[1]] = hash[1]; 281 | } 282 | } 283 | // String or numeric 284 | else { 285 | vars[hash[0]] = hash[1]; 286 | } 287 | } 288 | } 289 | } 290 | return vars; 291 | }, 292 | 293 | set: function (vars) { 294 | var hash = ''; 295 | for (var i in vars) { 296 | if (vars.hasOwnProperty(i)) { 297 | if (typeof vars[i] == 'object') { 298 | for (var j in vars[i]) { 299 | if (vars[i].hasOwnProperty(j)) { 300 | // Array 301 | if (vars[i] instanceof Array) { 302 | hash += '&' + i + '[]=' + vars[i][j]; 303 | } 304 | // Object 305 | else { 306 | hash += '&' + i + '[' + j + ']=' + vars[i][j]; 307 | } 308 | } 309 | } 310 | } 311 | // String or numeric 312 | else { 313 | hash += '&' + i + '=' + vars[i]; 314 | } 315 | } 316 | } 317 | 318 | if (!this.oldbrowser()) { 319 | if (hash.length != 0) { 320 | hash = '?' + hash.substr(1); 321 | } 322 | window.history.pushState({pdoPage: document.location.pathname + hash}, '', document.location.pathname + hash); 323 | } 324 | else { 325 | window.location.hash = hash.substr(1); 326 | } 327 | }, 328 | 329 | add: function (key, val) { 330 | var hash = this.get(); 331 | hash[key] = val; 332 | this.set(hash); 333 | }, 334 | 335 | remove: function (key) { 336 | var hash = this.get(); 337 | delete hash[key]; 338 | this.set(hash); 339 | }, 340 | 341 | clear: function () { 342 | this.set({}); 343 | }, 344 | 345 | oldbrowser: function () { 346 | return !(window.history && history.pushState); 347 | } 348 | }; 349 | 350 | if (typeof(jQuery) == 'undefined') { 351 | console.log("You must load jQuery for using ajax mode in pdoPage."); 352 | } 353 | -------------------------------------------------------------------------------- /assets/components/pdotools/js/pdopage.min.js: -------------------------------------------------------------------------------- 1 | "undefined"==typeof pdoPage&&(pdoPage={callbacks:{},keys:{},configs:{}}),pdoPage.Reached=!1,pdoPage.initialize=function(a){if(void 0==pdoPage.keys[a.pageVarKey]){var b=a.pageVarKey,c=pdoPage.Hash.get(),d=void 0==c[b]?1:c[b];pdoPage.keys[b]=Number(d),pdoPage.configs[b]=a}var e=this;switch(a.mode){case"default":$(document).on("click",a.link,function(b){b.preventDefault();var c=$(this).prop("href"),d=a.pageVarKey,f=c.match(new RegExp(d+"=(\\d+)")),g=f?f[1]:1;pdoPage.keys[d]!=g&&(a.history&&(1==g?pdoPage.Hash.remove(d):pdoPage.Hash.add(d,g)),e.loadPage(c,a))}),a.history&&($(window).on("popstate",function(b){b.originalEvent.state&&b.originalEvent.state.pdoPage&&e.loadPage(b.originalEvent.state.pdoPage,a)}),history.replaceState({pdoPage:window.location.href},""));break;case"scroll":case"button":if(a.history){if(void 0===jQuery().sticky)return void $.getScript(a.assetsUrl+"js/lib/jquery.sticky.min.js",function(){pdoPage.initialize(a)});pdoPage.stickyPagination(a)}else $(a.pagination).hide();var f=a.pageVarKey;if("button"==a.mode){$(a.rows).after(a.moreTpl);var g=!1;$(a.link).each(function(){var a=$(this).prop("href"),b=a.match(new RegExp(f+"=(\\d+)"));if((b?b[1]:1)>pdoPage.keys[f])return g=!0,!1}),g||$(a.more).hide(),$(document).on("click",a.more,function(b){b.preventDefault(),pdoPage.addPage(a)})}else{var h=$(a.wrapper),i=$(window);i.on("load scroll",function(){!pdoPage.Reached&&i.scrollTop()>h.height()-i.height()&&(pdoPage.Reached=!0,pdoPage.addPage(a))})}}},pdoPage.addPage=function(a){var b=a.pageVarKey,c=pdoPage.keys[b]||1;$(a.link).each(function(){var d=$(this).prop("href"),e=d.match(new RegExp(b+"=(\\d+)")),f=e?Number(e[1]):1;if(f>c)return a.history&&(1==f?pdoPage.Hash.remove(b):pdoPage.Hash.add(b,f)),pdoPage.loadPage(d,a,"append"),!1})},pdoPage.loadPage=function(a,b,c){var d=$(b.wrapper),e=$(b.rows),f=$(b.pagination),g=b.pageVarKey,h=a.match(new RegExp(g+"=(\\d+)")),i=h?Number(h[1]):1;if(c||(c="replace"),pdoPage.keys[g]!=i){pdoPage.callbacks.before&&"function"==typeof pdoPage.callbacks.before?pdoPage.callbacks.before.apply(this,[b]):("scroll"!=b.mode&&d.css({opacity:.3}),d.addClass("loading"));var j=pdoPage.Hash.get();for(var k in j)j.hasOwnProperty(k)&&pdoPage.keys[k]&&k!=g&&delete j[k];j[g]=pdoPage.keys[g]=i,j.pageId=b.pageId,j.hash=b.hash,$.post(b.connectorUrl,j,function(a){if(a&&a.total){if(d.find(f).html(a.pagination),"append"==c){if(d.find(e).append(a.output),"button"==b.mode)a.pages==a.page?$(b.more).hide():$(b.more).show();else if("scroll"==b.mode){pdoPage.Reached=!1;var g=$(window);g.scrollTop()>d.height()-g.height()&&(pdoPage.Reached=!0,pdoPage.addPage(b))}}else d.find(e).html(a.output);pdoPage.callbacks.after&&"function"==typeof pdoPage.callbacks.after?pdoPage.callbacks.after.apply(this,[b,a]):(d.removeClass("loading"),"scroll"!=b.mode&&(d.css({opacity:1}),"default"==b.mode&&!1!==b.scrollTop&&$("html, body").animate({scrollTop:d.position().top-50||0},0))),pdoPage.updateTitle(b,a),$(document).trigger("pdopage_load",[b,a])}},"json")}},pdoPage.stickyPagination=function(a){var b=$(a.pagination);b.is(":visible")&&(b.sticky({wrapperClassName:"sticky-pagination",getWidthFrom:a.wrapper,responsiveWidth:!0,topSpacing:2}),$(a.wrapper).trigger("scroll"))},pdoPage.updateTitle=function(a,b){if("undefined"!=typeof pdoTitle){for(var c=$("title"),d=pdoTitle.separator||" / ",e=pdoTitle.tpl,f=[],g=c.text().split(d),h=new RegExp("^"+e.split(" ")[0]+" "),i=0;i1&&f.push(e.replace("{page}",b.page).replace("{pageCount}",b.pages)),g[i].match(h)||f.push(g[i]);c.text(f.join(d))}},pdoPage.Hash={get:function(){var a,b,c,d={};if(this.oldbrowser())c=decodeURIComponent(window.location.hash.substr(1)).replace("+"," "),b="/";else{var e=window.location.href.indexOf("?");c=-1!=e?decodeURIComponent(window.location.href.substr(e+1)).replace("+"," "):"",b="&"}if(0==c.length)return d;c=c.split(b);var f,g;for(var h in c)c.hasOwnProperty(h)&&(a=c[h].split("="),void 0===a[1]?d.anchor=a[0]:(f=a[0].match(/\[(.*?|)\]$/),f?(g=a[0].replace(f[0],""),d.hasOwnProperty(g)||(""==f[1]?d[g]=[]:d[g]={}),d[g]instanceof Array?d[g].push(a[1]):d[g][f[1]]=a[1]):d[a[0]]=a[1]));return d},set:function(a){var b="";for(var c in a)if(a.hasOwnProperty(c))if("object"==typeof a[c])for(var d in a[c])a[c].hasOwnProperty(d)&&(a[c]instanceof Array?b+="&"+c+"[]="+a[c][d]:b+="&"+c+"["+d+"]="+a[c][d]);else b+="&"+c+"="+a[c];this.oldbrowser()?window.location.hash=b.substr(1):(0!=b.length&&(b="?"+b.substr(1)),window.history.pushState({pdoPage:document.location.pathname+b},"",document.location.pathname+b))},add:function(a,b){var c=this.get();c[a]=b,this.set(c)},remove:function(a){var b=this.get();delete b[a],this.set(b)},clear:function(){this.set({})},oldbrowser:function(){return!(window.history&&history.pushState)}},"undefined"==typeof jQuery&&console.log("You must load jQuery for using ajax mode in pdoPage."); -------------------------------------------------------------------------------- /core/components/pdotools/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bezumkin/pdotools", 3 | "type": "library", 4 | "require": { 5 | "fenom/fenom": "2.*" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /core/components/pdotools/composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "5722bbf5b6cd9e745169bc308c88ecd3", 8 | "packages": [ 9 | { 10 | "name": "fenom/fenom", 11 | "version": "2.12.0", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/fenom-template/fenom.git", 15 | "reference": "f0cb251843de469b453b15c158cf0d1589d4de6d" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://api.github.com/repos/fenom-template/fenom/zipball/f0cb251843de469b453b15c158cf0d1589d4de6d", 20 | "reference": "f0cb251843de469b453b15c158cf0d1589d4de6d", 21 | "shasum": "" 22 | }, 23 | "require": { 24 | "ext-tokenizer": "*", 25 | "php": ">=5.3.0" 26 | }, 27 | "require-dev": { 28 | "phpunit/phpunit": "<6.0", 29 | "satooshi/php-coveralls": "*" 30 | }, 31 | "type": "library", 32 | "autoload": { 33 | "psr-0": { 34 | "Fenom\\": "src/" 35 | }, 36 | "classmap": [ 37 | "src/Fenom.php" 38 | ] 39 | }, 40 | "notification-url": "https://packagist.org/downloads/", 41 | "license": [ 42 | "BSD-3" 43 | ], 44 | "authors": [ 45 | { 46 | "name": "Ivan Shalganov", 47 | "email": "a.cobest@gmail.com" 48 | } 49 | ], 50 | "description": "Fenom - excellent template engine for PHP", 51 | "keywords": [ 52 | "fenom", 53 | "template", 54 | "templater", 55 | "templating" 56 | ], 57 | "support": { 58 | "issues": "https://github.com/fenom-template/fenom/issues", 59 | "source": "https://github.com/fenom-template/fenom/tree/2.12.0" 60 | }, 61 | "time": "2020-07-06T17:02:31+00:00" 62 | } 63 | ], 64 | "packages-dev": [], 65 | "aliases": [], 66 | "minimum-stability": "stable", 67 | "stability-flags": [], 68 | "prefer-stable": false, 69 | "prefer-lowest": false, 70 | "platform": [], 71 | "platform-dev": [], 72 | "plugin-api-version": "2.0.0" 73 | } 74 | -------------------------------------------------------------------------------- /core/components/pdotools/docs/readme.txt: -------------------------------------------------------------------------------- 1 | -------------------- 2 | pdoTools 3 | -------------------- 4 | Author: Vasiliy Naumkin 5 | -------------------- 6 | 7 | Small library for creating fast snippets for MODX Revolution that works through PDO. 8 | 9 | Required by Tickets and miniShop2. 10 | 11 | Main features 12 | - Builds queries with xPDO. 13 | - Retrieve results with PDO. 14 | - Improved pdoTools::getChunk() function, that processing placeholders faster, than original modX::getChunk(). 15 | 16 | pdoTools snippets will work so faster, than more fields you will retrieve from database at one query. 17 | 18 | -------------------- 19 | Feel free to suggest ideas/improvements/bugs on GitHub: 20 | http://github.com/bezumkin/pdoTools/issues 21 | -------------------------------------------------------------------------------- /core/components/pdotools/elements/plugins/plugin.pdotools.php: -------------------------------------------------------------------------------- 1 | event->name) { 4 | 5 | case 'OnMODXInit': 6 | $fqn = $modx->getOption('pdoTools.class', null, 'pdotools.pdotools', true); 7 | $path = $modx->getOption('pdotools_class_path', null, MODX_CORE_PATH . 'components/pdotools/model/', true); 8 | $modx->loadClass($fqn, $path, false, true); 9 | 10 | $fqn = $modx->getOption('pdoFetch.class', null, 'pdotools.pdofetch', true); 11 | $path = $modx->getOption('pdofetch_class_path', null, MODX_CORE_PATH . 'components/pdotools/model/', true); 12 | $modx->loadClass($fqn, $path, false, true); 13 | break; 14 | 15 | case 'OnSiteRefresh': 16 | /** @var pdoTools $pdoTools */ 17 | if ($pdoTools = $modx->getService('pdoTools')) { 18 | if ($pdoTools->clearFileCache()) { 19 | $modx->log(modX::LOG_LEVEL_INFO, $modx->lexicon('refresh_default') . ': pdoTools'); 20 | } 21 | } 22 | break; 23 | 24 | case 'OnWebPagePrerender': 25 | $parser = $modx->getParser(); 26 | if ($parser instanceof pdoParser) { 27 | foreach ($parser->pdoTools->ignores as $key => $val) { 28 | $modx->resource->_output = str_replace($key, $val, $modx->resource->_output); 29 | } 30 | } 31 | break; 32 | } 33 | -------------------------------------------------------------------------------- /core/components/pdotools/elements/snippets/snippet.pdoarchive.php: -------------------------------------------------------------------------------- 1 | lexicon->load('pdotools:pdoarchive'); 4 | 5 | /** @var array $scriptProperties */ 6 | $tplWrapper = $modx->getOption('tplWrapper', $scriptProperties); 7 | $tplYear = $modx->getOption('tplYear', $scriptProperties); 8 | $tplMonth = $modx->getOption('tplMonth', $scriptProperties); 9 | $tplDay = $modx->getOption('tplDay', $scriptProperties); 10 | $tpl = $modx->getOption('tpl', $scriptProperties); 11 | $dateField = $modx->getOption('dateField', $scriptProperties, 'createdon', true); 12 | $dateFormat = $modx->getOption('dateFormat', $scriptProperties, 'H:i', true); 13 | $outputSeparator = $modx->getOption('outputSeparator', $scriptProperties, "\n"); 14 | 15 | // Adding extra parameters into special place so we can put them in a results 16 | /** @var modSnippet $snippet */ 17 | $additionalPlaceholders = $properties = []; 18 | if (isset($this) && $this instanceof modSnippet) { 19 | $properties = $this->get('properties'); 20 | } elseif ($snippet = $modx->getObject('modSnippet', ['name' => 'pdoResources'])) { 21 | $properties = $snippet->get('properties'); 22 | } 23 | if (!empty($properties)) { 24 | foreach ($scriptProperties as $k => $v) { 25 | if (!isset($properties[$k])) { 26 | $additionalPlaceholders[$k] = $v; 27 | } 28 | } 29 | } 30 | $scriptProperties['additionalPlaceholders'] = $additionalPlaceholders; 31 | if (isset($parents) && $parents === '') { 32 | $scriptProperties['parents'] = $modx->resource->id; 33 | } 34 | $scriptProperties['return'] = 'data'; 35 | /** @var pdoFetch $pdoFetch */ 36 | $fqn = $modx->getOption('pdoFetch.class', null, 'pdotools.pdofetch', true); 37 | $path = $modx->getOption('pdofetch_class_path', null, MODX_CORE_PATH . 'components/pdotools/model/', true); 38 | if ($pdoClass = $modx->loadClass($fqn, $path, false, true)) { 39 | $pdoFetch = new $pdoClass($modx, $scriptProperties); 40 | } else { 41 | return false; 42 | } 43 | $pdoFetch->addTime('pdoTools loaded'); 44 | $rows = $pdoFetch->run(); 45 | 46 | // Process rows 47 | $tree = []; 48 | foreach ($rows as $row) { 49 | $tmp = $row[$dateField]; 50 | if (!is_numeric($tmp)) { 51 | $tmp = strtotime($tmp); 52 | } 53 | $year = date('Y', $tmp); 54 | $month = date('m', $tmp); 55 | $day = date('d', $tmp); 56 | $tree[$year][$month][$day][] = $row; 57 | } 58 | 59 | $output = ''; 60 | foreach ($tree as $year => $months) { 61 | $rows_year = ''; 62 | $count_year = 0; 63 | 64 | foreach ($months as $month => $days) { 65 | $rows_month = ''; 66 | $count_month = 0; 67 | 68 | foreach ($days as $day => $resources) { 69 | $rows_day = []; 70 | $count_day = 0; 71 | $idx = 1; 72 | 73 | foreach ($resources as $resource) { 74 | $resource['day'] = $day; 75 | $resource['month'] = $month; 76 | $resource['year'] = $year; 77 | $resource['date'] = strftime($dateFormat, $resource[$dateField]); 78 | $resource['idx'] = $idx++; 79 | $resource['menutitle'] = !empty($resource['menutitle']) 80 | ? $resource['menutitle'] 81 | : $resource['pagetitle']; 82 | // Add placeholder [[+link]] if specified 83 | if (!empty($scriptProperties['useWeblinkUrl'])) { 84 | if (!isset($resource['context_key'])) { 85 | $resource['context_key'] = ''; 86 | } 87 | if (isset($resource['class_key']) && ($resource['class_key'] == 'modWebLink')) { 88 | $resource['link'] = isset($resource['content']) && is_numeric(trim($resource['content'], '[]~ ')) 89 | ? $pdoFetch->makeUrl(intval(trim($resource['content'], '[]~ ')), $resource) 90 | : (isset($resource['content']) ? $resource['content'] : ''); 91 | } else { 92 | $resource['link'] = $pdoFetch->makeUrl($resource['id'], $resource); 93 | } 94 | } else { 95 | $resource['link'] = ''; 96 | } 97 | $tpl = $pdoFetch->defineChunk($resource); 98 | $rows_day[] = $pdoFetch->getChunk($tpl, $resource); 99 | $count_year++; 100 | $count_month++; 101 | $count_day++; 102 | } 103 | 104 | $rows_month .= !empty($tplDay) 105 | ? $pdoFetch->getChunk($tplDay, [ 106 | 'day' => $day, 107 | 'month' => $month, 108 | 'year' => $year, 109 | 'count' => $count_day, 110 | 'wrapper' => implode($outputSeparator, $rows_day), 111 | ], $pdoFetch->config['fastMode']) 112 | : implode($outputSeparator, $rows_day); 113 | } 114 | 115 | $rows_year .= !empty($tplMonth) 116 | ? $pdoFetch->getChunk($tplMonth, [ 117 | 'month' => $month, 118 | 'month_name' => $modx->lexicon('pdoarchive_month_' . $month), 119 | 'year' => $year, 120 | 'count' => $count_month, 121 | 'wrapper' => $rows_month, 122 | ], $pdoFetch->config['fastMode']) 123 | : $rows_month; 124 | } 125 | 126 | $output .= !empty($tplYear) 127 | ? $pdoFetch->getChunk($tplYear, [ 128 | 'year' => $year, 129 | 'count' => $count_year, 130 | 'wrapper' => $rows_year, 131 | ], $pdoFetch->config['fastMode']) 132 | : $rows_year; 133 | } 134 | $pdoFetch->addTime('Rows processed'); 135 | 136 | // Return output 137 | if (!empty($tplWrapper) && (!empty($wrapIfEmpty) || !empty($output))) { 138 | $output = $pdoFetch->getChunk( 139 | $tplWrapper, 140 | array_merge($additionalPlaceholders, ['output' => $output]), 141 | $pdoFetch->config['fastMode'] 142 | ); 143 | $pdoFetch->addTime('Rows wrapped'); 144 | } 145 | 146 | if ($modx->user->hasSessionContext('mgr') && !empty($showLog)) { 147 | $output .= '
    ' . print_r($pdoFetch->getTime(), 1) . '
    '; 148 | } 149 | 150 | if (!empty($toPlaceholder)) { 151 | $modx->setPlaceholder($toPlaceholder, $output); 152 | } else { 153 | return $output; 154 | } 155 | -------------------------------------------------------------------------------- /core/components/pdotools/elements/snippets/snippet.pdocrumbs.php: -------------------------------------------------------------------------------- 1 | getOption('pdoFetch.class', null, 'pdotools.pdofetch', true); 6 | $path = $modx->getOption('pdofetch_class_path', null, MODX_CORE_PATH . 'components/pdotools/model/', true); 7 | if ($pdoClass = $modx->loadClass($fqn, $path, false, true)) { 8 | $pdoFetch = new $pdoClass($modx, $scriptProperties); 9 | } else { 10 | return false; 11 | } 12 | $pdoFetch->addTime('pdoTools loaded'); 13 | 14 | if (!isset($from) || $from == '') { 15 | $from = 0; 16 | } 17 | if (empty($to)) { 18 | $to = $modx->resource->id; 19 | } 20 | if (empty($direction)) { 21 | $direction = 'ltr'; 22 | } 23 | if ($outputSeparator == ' → ' && $direction == 'rtl') { 24 | $outputSeparator = ' ← '; 25 | } 26 | if ($limit == '') { 27 | $limit = 10; 28 | } 29 | 30 | // For compatibility with BreadCrumb 31 | if (!empty($maxCrumbs)) { 32 | $limit = $maxCrumbs; 33 | } 34 | if (!empty($containerTpl)) { 35 | $tplWrapper = $containerTpl; 36 | } 37 | if (!empty($currentCrumbTpl)) { 38 | $tplCurrent = $currentCrumbTpl; 39 | } 40 | if (!empty($linkCrumbTpl)) { 41 | $scriptProperties['tpl'] = $linkCrumbTpl; 42 | } 43 | if (!empty($maxCrumbTpl)) { 44 | $tplMax = $maxCrumbTpl; 45 | } 46 | if (isset($showBreadCrumbsAtHome)) { 47 | $showAtHome = $showBreadCrumbsAtHome; 48 | } 49 | if (isset($showHomeCrumb)) { 50 | $showHome = $showHomeCrumb; 51 | } 52 | if (isset($showCurrentCrumb)) { 53 | $showCurrent = $showCurrentCrumb; 54 | } 55 | // -- 56 | $fastMode = !empty($fastMode); 57 | $siteStart = $modx->getOption('siteStart', $scriptProperties, $modx->getOption('site_start')); 58 | 59 | if (empty($showAtHome) && $modx->resource->id == $siteStart) { 60 | return ''; 61 | } 62 | 63 | $class = $modx->getOption('class', $scriptProperties, 'modResource'); 64 | // Start building "Where" expression 65 | $where = array(); 66 | if (empty($showUnpublished) && empty($showUnPub)) { 67 | $where['published'] = 1; 68 | } 69 | if (empty($showHidden)) { 70 | $where['hidemenu'] = 0; 71 | } 72 | if (empty($showDeleted)) { 73 | $where['deleted'] = 0; 74 | } 75 | if (!empty($hideContainers) && empty($showContainer)) { 76 | $where['isfolder'] = 0; 77 | } 78 | 79 | $resource = ($to == $modx->resource->id) 80 | ? $modx->resource 81 | : $modx->getObject($class, $to); 82 | 83 | if (!$resource) { 84 | $message = 'Could not build breadcrumbs to resource "' . $to . '"'; 85 | 86 | return ''; 87 | } 88 | 89 | if (!empty($customParents)) { 90 | $customParents = is_array($customParents) ? $customParents : array_map('trim', explode(',', $customParents)); 91 | $parents = is_array($customParents) ? array_reverse($customParents) : array(); 92 | } 93 | if (empty($parents)) { 94 | $parents = $modx->getParentIds($resource->id, $limit, array('context' => $resource->get('context_key'))); 95 | } 96 | if (!empty($showHome)) { 97 | $parents[] = $siteStart; 98 | } 99 | 100 | $ids = array($resource->id); 101 | foreach ($parents as $parent) { 102 | if (!empty($parent)) { 103 | $ids[] = $parent; 104 | } 105 | if (!empty($from) && $parent == $from) { 106 | break; 107 | } 108 | } 109 | $where['id:IN'] = $ids; 110 | 111 | if (!empty($exclude)) { 112 | $where['id:NOT IN'] = array_map('trim', explode(',', $exclude)); 113 | } 114 | 115 | // Fields to select 116 | $resourceColumns = array_keys($modx->getFieldMeta($class)); 117 | $select = array($class => implode(',', $resourceColumns)); 118 | 119 | // Add custom parameters 120 | foreach (array('where', 'select') as $v) { 121 | if (!empty($scriptProperties[$v])) { 122 | $tmp = $scriptProperties[$v]; 123 | if (!is_array($tmp)) { 124 | $tmp = json_decode($tmp, true); 125 | } 126 | if (is_array($tmp)) { 127 | $$v = array_merge($$v, $tmp); 128 | } 129 | } 130 | unset($scriptProperties[$v]); 131 | } 132 | $pdoFetch->addTime('Conditions prepared'); 133 | 134 | // Default parameters 135 | $default = array( 136 | 'class' => $class, 137 | 'where' => json_encode($where), 138 | 'select' => json_encode($select), 139 | 'groupby' => $class . '.id', 140 | 'sortby' => "find_in_set(`$class`.`id`,'" . implode(',', $ids) . "')", 141 | 'sortdir' => '', 142 | 'return' => 'data', 143 | 'totalVar' => 'pdocrumbs.total', 144 | 'disableConditions' => true, 145 | ); 146 | 147 | // Merge all properties and run! 148 | $pdoFetch->addTime('Query parameters ready'); 149 | $pdoFetch->setConfig(array_merge($default, $scriptProperties), false); 150 | $rows = $pdoFetch->run(); 151 | 152 | $output = []; 153 | if (!empty($rows) && is_array($rows)) { 154 | if (strtolower($direction) == 'ltr') { 155 | $rows = array_reverse($rows); 156 | } 157 | 158 | foreach ($rows as $row) { 159 | if (!empty($useWeblinkUrl) && $row['class_key'] == 'modWebLink') { 160 | $row['link'] = is_numeric(trim($row['content'], '[]~ ')) 161 | ? $pdoFetch->makeUrl((int)trim($row['content'], '[]~ '), $row) 162 | : $row['content']; 163 | } else { 164 | $row['link'] = $pdoFetch->makeUrl($row['id'], $row); 165 | } 166 | 167 | $row = array_merge( 168 | $scriptProperties, 169 | $row, 170 | ['idx' => $pdoFetch->idx++] 171 | ); 172 | if (empty($row['menutitle'])) { 173 | $row['menutitle'] = $row['pagetitle']; 174 | } 175 | 176 | if (isset($return) && $return === 'data') { 177 | $output[] = $row; 178 | continue; 179 | } 180 | if ($row['id'] == $resource->id && empty($showCurrent)) { 181 | continue; 182 | } elseif ($row['id'] == $resource->id && !empty($tplCurrent)) { 183 | $tpl = $tplCurrent; 184 | } elseif ($row['id'] == $siteStart && !empty($tplHome)) { 185 | $tpl = $tplHome; 186 | } else { 187 | $tpl = $pdoFetch->defineChunk($row); 188 | } 189 | $output[] = empty($tpl) 190 | ? '
    ' . $pdoFetch->getChunk('', $row) . '
    ' 191 | : $pdoFetch->getChunk($tpl, $row, $fastMode); 192 | } 193 | } 194 | if (isset($return) && $return === 'data') { 195 | return $output; 196 | } 197 | 198 | $pdoFetch->addTime('Chunks processed'); 199 | 200 | if (count($output) == 1 && !empty($hideSingle)) { 201 | $pdoFetch->addTime('The only result was hidden, because the parameter "hideSingle" activated'); 202 | $output = array(); 203 | } 204 | 205 | $log = ''; 206 | if ($modx->user->hasSessionContext('mgr') && !empty($showLog)) { 207 | $log .= '
    ' . print_r($pdoFetch->getTime(), 1) . '
    '; 208 | } 209 | 210 | if (!empty($toSeparatePlaceholders)) { 211 | $output['log'] = $log; 212 | $modx->setPlaceholders($output, $toSeparatePlaceholders); 213 | } else { 214 | $output = implode($outputSeparator, $output); 215 | if ($pdoFetch->idx >= $limit && !empty($tplMax) && !empty($output)) { 216 | $output = ($direction == 'ltr') 217 | ? $pdoFetch->getChunk($tplMax, array(), $fastMode) . $output 218 | : $output . $pdoFetch->getChunk($tplMax, array(), $fastMode); 219 | } 220 | $output .= $log; 221 | 222 | if (!empty($tplWrapper) && (!empty($wrapIfEmpty) || !empty($output))) { 223 | $output = $pdoFetch->getChunk($tplWrapper, array('output' => $output, 'crumbs' => $output), $fastMode); 224 | } 225 | 226 | if (!empty($toPlaceholder)) { 227 | $modx->setPlaceholder($toPlaceholder, $output); 228 | } else { 229 | return $output; 230 | } 231 | } 232 | -------------------------------------------------------------------------------- /core/components/pdotools/elements/snippets/snippet.pdofield.php: -------------------------------------------------------------------------------- 1 | getOption('class', $scriptProperties, 'modResource', true); 14 | $isResource = $class == 'modResource' || in_array($class, $modx->getDescendants('modResource')); 15 | 16 | if (empty($field)) { 17 | $field = 'pagetitle'; 18 | } 19 | $top = isset($top) ? (int)$top : 0; 20 | $topLevel = isset($topLevel) ? (int)$topLevel : 0; 21 | if (!empty($options)) { 22 | $options = trim($options); 23 | if ($options[0] == '{') { 24 | $tmp = json_decode($options, true); 25 | if (is_array($tmp)) { 26 | extract($tmp); 27 | $scriptProperties = array_merge($scriptProperties, $tmp); 28 | } 29 | } else { 30 | $field = $options; 31 | } 32 | } 33 | if (empty($id)) { 34 | if (!empty($modx->resource)) { 35 | $id = $modx->resource->id; 36 | } else { 37 | return 'You must specify an id of ' . $class; 38 | } 39 | } 40 | if (!isset($context)) { 41 | $context = ''; 42 | } 43 | 44 | // Gets the parent from root of context, if specified 45 | if ($isResource && $id && ($top || $topLevel)) { 46 | // Select needed context for parents functionality 47 | if (empty($context)) { 48 | $q = $modx->newQuery($class, $id); 49 | $q->select('context_key'); 50 | $tstart = microtime(true); 51 | if ($q->prepare() && $q->stmt->execute()) { 52 | $modx->queryTime += microtime(true) - $tstart; 53 | $modx->executedQueries++; 54 | $context = $q->stmt->fetch(PDO::FETCH_COLUMN); 55 | } 56 | } 57 | // Original pdoField logic 58 | if (empty($ultimate)) { 59 | if ($topLevel) { 60 | $pids = $modx->getChildIds(0, $topLevel, ['context' => $context]); 61 | $pid = $id; 62 | while (true) { 63 | $tmp = $modx->getParentIds($pid, 1, ['context' => $context]); 64 | if (!$pid = current($tmp)) { 65 | break; 66 | } elseif (in_array($pid, $pids)) { 67 | $id = $pid; 68 | break; 69 | } 70 | } 71 | } elseif ($top) { 72 | $pid = $id; 73 | for ($i = 1; $i <= $top; $i++) { 74 | $tmp = $modx->getParentIds($pid, 1, ['context' => $context]); 75 | if (!$pid = current($tmp)) { 76 | break; 77 | } 78 | $id = $pid; 79 | } 80 | } 81 | } 82 | // UltimateParent logic 83 | // https://github.com/splittingred/UltimateParent/blob/develop/core/components/ultimateparent/snippet.ultimateparent.php 84 | elseif ($id != $top) { 85 | $pid = $id; 86 | $pids = $modx->getParentIds($id, 10, ['context' => $context]); 87 | if (!$topLevel || count($pids) >= $topLevel) { 88 | while ($parentIds = $modx->getParentIds($id, 1, ['context' => $context])) { 89 | $pid = array_pop($parentIds); 90 | if ($pid == $top) { 91 | break; 92 | } 93 | $id = $pid; 94 | $parentIds = $modx->getParentIds($id, 10, ['context' => $context]); 95 | if ($topLevel && count($parentIds) < $topLevel) { 96 | break; 97 | } 98 | } 99 | } 100 | } 101 | } 102 | 103 | /** @var pdoFetch $pdoFetch */ 104 | $fqn = $modx->getOption('pdoFetch.class', null, 'pdotools.pdofetch', true); 105 | $path = $modx->getOption('pdofetch_class_path', null, MODX_CORE_PATH . 'components/pdotools/model/', true); 106 | if ($pdoClass = $modx->loadClass($fqn, $path, false, true)) { 107 | $pdoFetch = new $pdoClass($modx, $scriptProperties); 108 | } else { 109 | return false; 110 | } 111 | $pdoFetch->addTime('pdoTools loaded'); 112 | 113 | $where = [$class . '.id' => $id]; 114 | // Add custom parameters 115 | foreach (array('where') as $v) { 116 | if (!empty($scriptProperties[$v])) { 117 | $tmp = $scriptProperties[$v]; 118 | if (!is_array($tmp)) { 119 | $tmp = json_decode($tmp, true); 120 | } 121 | if (is_array($tmp)) { 122 | $$v = array_merge($$v, $tmp); 123 | } 124 | } 125 | unset($scriptProperties[$v]); 126 | } 127 | $pdoFetch->addTime('Conditions prepared'); 128 | 129 | // Fields to select 130 | $resourceColumns = array_keys($modx->getFieldMeta($class)); 131 | $field = strtolower($field); 132 | if (in_array($field, $resourceColumns)) { 133 | $scriptProperties['select'] = [$class => $field]; 134 | $scriptProperties['includeTVs'] = ''; 135 | } elseif ($isResource) { 136 | $scriptProperties['select'] = [$class => 'id']; 137 | $scriptProperties['includeTVs'] = $field; 138 | } 139 | // Additional default field 140 | if (!empty($default)) { 141 | $default = strtolower($default); 142 | if (in_array($default, $resourceColumns)) { 143 | $scriptProperties['select'][$class] .= ',' . $default; 144 | } elseif ($isResource) { 145 | $scriptProperties['includeTVs'] = empty($scriptProperties['includeTVs']) 146 | ? $default 147 | : $scriptProperties['includeTVs'] . ',' . $default; 148 | } 149 | } 150 | 151 | $scriptProperties['disableConditions'] = true; 152 | if ($row = $pdoFetch->getObject($class, $where, $scriptProperties)) { 153 | foreach ($row as $k => $v) { 154 | if (strtolower($k) == $field && $v != '') { 155 | $output = $v; 156 | break; 157 | } 158 | } 159 | 160 | if (empty($output) && !empty($default)) { 161 | foreach ($row as $k => $v) { 162 | if (strtolower($k) == $default && $v != '') { 163 | $output = $v; 164 | break; 165 | } 166 | } 167 | } 168 | } 169 | 170 | if (!empty($toPlaceholder)) { 171 | $modx->setPlaceholder($toPlaceholder, $output); 172 | } else { 173 | return $output; 174 | } -------------------------------------------------------------------------------- /core/components/pdotools/elements/snippets/snippet.pdomenu.php: -------------------------------------------------------------------------------- 1 | hasPermission('view_unpublished')) { 31 | $scriptProperties['showUnpublished'] = 1; 32 | } 33 | 34 | $scriptProperties['depth'] = empty($level) ? 100 : abs($level) - 1; 35 | if (!empty($contexts)) { 36 | $scriptProperties['context'] = $contexts; 37 | } 38 | if (empty($scriptProperties['context'])) { 39 | $scriptProperties['context'] = $modx->resource->context_key; 40 | } 41 | 42 | // Save original parents specified by user 43 | $specified_parents = array_map('trim', explode(',', $scriptProperties['parents'])); 44 | 45 | if ($scriptProperties['parents'] === '') { 46 | $scriptProperties['parents'] = $modx->resource->id; 47 | } elseif ($scriptProperties['parents'] === 0 || $scriptProperties['parents'] === '0') { 48 | if ($scriptProperties['depth'] !== '' && $scriptProperties['depth'] !== 100) { 49 | $contexts = array_map('trim', explode(',', $scriptProperties['context'])); 50 | $parents = array(); 51 | if (!empty($scriptProperties['showDeleted'])) { 52 | /** @var pdoFetch $pdoFetch */ 53 | $pdoFetch = $modx->getService('pdoFetch'); 54 | foreach ($contexts as $ctx) { 55 | $parents = array_merge($parents, $pdoFetch->getChildIds('modResource', 0, $scriptProperties['depth'], array('context' => $ctx))); 56 | } 57 | } else { 58 | foreach ($contexts as $ctx) { 59 | $parents = array_merge($parents, $modx->getChildIds(0, $scriptProperties['depth'], array('context' => $ctx))); 60 | } 61 | } 62 | $scriptProperties['parents'] = !empty($parents) ? implode(',', $parents) : '+0'; 63 | $scriptProperties['depth'] = 0; 64 | } 65 | $scriptProperties['includeParents'] = 1; 66 | $scriptProperties['displayStart'] = 0; 67 | } else { 68 | $parents = array_map('trim', explode(',', $scriptProperties['parents'])); 69 | $parents_in = $parents_out = array(); 70 | foreach ($parents as $v) { 71 | if (!is_numeric($v)) { 72 | continue; 73 | } 74 | if ($v[0] == '-') { 75 | $parents_out[] = abs($v); 76 | } else { 77 | $parents_in[] = abs($v); 78 | } 79 | } 80 | 81 | if (empty($parents_in)) { 82 | $scriptProperties['includeParents'] = 1; 83 | $scriptProperties['displayStart'] = 0; 84 | } 85 | } 86 | 87 | if (!empty($displayStart)) { 88 | $scriptProperties['includeParents'] = 1; 89 | } 90 | if (!empty($ph)) { 91 | $toPlaceholder = $ph; 92 | } 93 | if (!empty($sortOrder)) { 94 | $scriptProperties['sortdir'] = $sortOrder; 95 | } 96 | if (!empty($sortBy)) { 97 | $scriptProperties['sortby'] = $sortBy; 98 | } 99 | if (!empty($permissions)) { 100 | $scriptProperties['checkPermissions'] = $permissions; 101 | } 102 | if (!empty($cacheResults)) { 103 | $scriptProperties['cache'] = $cacheResults; 104 | } 105 | if (!empty($ignoreHidden)) { 106 | $scriptProperties['showHidden'] = $ignoreHidden; 107 | } 108 | 109 | $wfTemplates = array( 110 | 'outerTpl' => 'tplOuter', 111 | 'rowTpl' => 'tpl', 112 | 'parentRowTpl' => 'tplParentRow', 113 | 'parentRowHereTpl' => 'tplParentRowHere', 114 | 'hereTpl' => 'tplHere', 115 | 'innerTpl' => 'tplInner', 116 | 'innerRowTpl' => 'tplInnerRow', 117 | 'innerHereTpl' => 'tplInnerHere', 118 | 'activeParentRowTpl' => 'tplParentRowActive', 119 | 'categoryFoldersTpl' => 'tplCategoryFolder', 120 | 'startItemTpl' => 'tplStart', 121 | ); 122 | foreach ($wfTemplates as $k => $v) { 123 | if (isset(${$k})) { 124 | $scriptProperties[$v] = ${$k}; 125 | } 126 | } 127 | //--- 128 | 129 | /** @var pdoMenu $pdoMenu */ 130 | $fqn = $modx->getOption('pdoMenu.class', null, 'pdotools.pdomenu', true); 131 | $path = $modx->getOption('pdomenu_class_path', null, MODX_CORE_PATH . 'components/pdotools/model/', true); 132 | if ($pdoClass = $modx->loadClass($fqn, $path, false, true)) { 133 | $pdoMenu = new $pdoClass($modx, $scriptProperties); 134 | } else { 135 | return false; 136 | } 137 | $pdoMenu->pdoTools->addTime('pdoTools loaded'); 138 | 139 | $cache = !empty($cache) || (!$modx->user->id && !empty($cacheAnonymous)); 140 | if (empty($scriptProperties['cache_key'])) { 141 | $scriptProperties['cache_key'] = 'pdomenu/' . sha1(serialize($scriptProperties)); 142 | } 143 | 144 | $output = ''; 145 | $tree = array(); 146 | if ($cache) { 147 | $tree = $pdoMenu->pdoTools->getCache($scriptProperties); 148 | } 149 | if (empty($tree)) { 150 | $data = $pdoMenu->pdoTools->run(); 151 | $data = $pdoMenu->pdoTools->buildTree($data, 'id', 'parent', $specified_parents); 152 | $tree = array(); 153 | foreach ($data as $k => $v) { 154 | if (empty($v['id'])) { 155 | if (!in_array($k, $specified_parents) && !$pdoMenu->checkResource($k)) { 156 | continue; 157 | } else { 158 | $tree = array_merge($tree, $v['children']); 159 | } 160 | } else { 161 | $tree[$k] = $v; 162 | } 163 | } 164 | if ($cache) { 165 | $pdoMenu->pdoTools->setCache($tree, $scriptProperties); 166 | } 167 | } 168 | if (isset($return) && $return === 'data') { 169 | return $tree; 170 | } 171 | if (!empty($tree)) { 172 | $output = $pdoMenu->templateTree($tree); 173 | } 174 | 175 | if ($modx->user->hasSessionContext('mgr') && !empty($showLog)) { 176 | $output .= '
    ' . print_r($pdoMenu->pdoTools->getTime(), 1) . '
    '; 177 | } 178 | 179 | if (!empty($toPlaceholder)) { 180 | $modx->setPlaceholder($toPlaceholder, $output); 181 | } else { 182 | return $output; 183 | } -------------------------------------------------------------------------------- /core/components/pdotools/elements/snippets/snippet.pdoneighbors.php: -------------------------------------------------------------------------------- 1 | getOption('pdoFetch.class', null, 'pdotools.pdofetch', true); 6 | $path = $modx->getOption('pdofetch_class_path', null, MODX_CORE_PATH . 'components/pdotools/model/', true); 7 | if ($pdoClass = $modx->loadClass($fqn, $path, false, true)) { 8 | $pdoFetch = new $pdoClass($modx, $scriptProperties); 9 | } else { 10 | return false; 11 | } 12 | $pdoFetch->addTime('pdoTools loaded'); 13 | 14 | if (empty($id)) { 15 | $id = $modx->resource->id; 16 | } 17 | if (empty($limit)) { 18 | $limit = 1; 19 | } 20 | if (!isset($outputSeparator)) { 21 | $outputSeparator = "\n"; 22 | } 23 | $fastMode = !empty($fastMode); 24 | 25 | $class = 'modResource'; 26 | $resource = ($id == $modx->resource->id) 27 | ? $modx->resource 28 | : $modx->getObject($class, $id); 29 | if (!$resource) { 30 | return ''; 31 | } 32 | 33 | // We need to determine ids of neighbors 34 | $params = $scriptProperties; 35 | $params['select'] = 'id'; 36 | $params['limit'] = 0; 37 | if (!empty($parents) && is_string($parents)) { 38 | $parents = array_map('trim', explode(',', $parents)); 39 | if (!in_array($resource->parent, $parents)) { 40 | $parents[] = $resource->parent; 41 | } 42 | $key = array_search($resource->parent * -1, $parents); 43 | if ($key !== false) { 44 | unset($parents[$key]); 45 | } 46 | $params['parents'] = implode(',', $parents); 47 | $ids = $pdoFetch->getCollection('modResource', [], $params); 48 | unset($scriptProperties['parents']); 49 | } else { 50 | $ids = $pdoFetch->getCollection('modResource', ['parent' => $resource->parent], $params); 51 | } 52 | 53 | $found = false; 54 | $prev = $next = []; 55 | foreach ($ids as $v) { 56 | if ($v['id'] == $id) { 57 | $found = true; 58 | continue; 59 | } elseif (!$found) { 60 | $prev[] = $v['id']; 61 | } else { 62 | $next[] = $v['id']; 63 | if (count($next) >= $limit) { 64 | break; 65 | } 66 | } 67 | } 68 | $prev = array_splice($prev, $limit * -1); 69 | if (!empty($loop)) { 70 | if (!count($prev)) { 71 | $v = end($ids); 72 | $prev[] = $v['id']; 73 | } else { 74 | if (!count($next)) { 75 | $v = reset($ids); 76 | $next[] = $v['id']; 77 | } 78 | } 79 | } 80 | $ids = array_merge($prev, $next, [$resource->parent]); 81 | $pdoFetch->addTime('Found ids of neighbors: ' . implode(',', $ids)); 82 | 83 | // Query conditions 84 | $where = [$class . '.id:IN' => $ids]; 85 | 86 | // Fields to select 87 | $resourceColumns = array_keys($modx->getFieldMeta($class)); 88 | if (empty($includeContent) && empty($useWeblinkUrl)) { 89 | $key = array_search('content', $resourceColumns); 90 | unset($resourceColumns[$key]); 91 | } 92 | $select = [$class => implode(',', $resourceColumns)]; 93 | 94 | // Add custom parameters 95 | foreach (['where', 'select'] as $v) { 96 | if (!empty($scriptProperties[$v])) { 97 | $tmp = $scriptProperties[$v]; 98 | if (!is_array($tmp)) { 99 | $tmp = json_decode($tmp, true); 100 | } 101 | if (is_array($tmp)) { 102 | $$v = array_merge($$v, $tmp); 103 | } 104 | } 105 | unset($scriptProperties[$v]); 106 | } 107 | $pdoFetch->addTime('Conditions prepared'); 108 | 109 | // Default parameters 110 | $default = [ 111 | 'class' => $class, 112 | 'where' => json_encode($where), 113 | 'select' => json_encode($select), 114 | //'groupby' => $class.'.id', 115 | 'sortby' => $class . '.menuindex', 116 | 'sortdir' => 'ASC', 117 | 'return' => 'data', 118 | 'limit' => 0, 119 | 'totalVar' => 'pdoneighbors.total', 120 | ]; 121 | 122 | // Merge all properties and run! 123 | unset($scriptProperties['limit']); 124 | $pdoFetch->addTime('Query parameters ready'); 125 | $pdoFetch->setConfig(array_merge($default, $scriptProperties), false); 126 | 127 | $rows = $pdoFetch->run(); 128 | $prev = array_flip($prev); 129 | $next = array_flip($next); 130 | 131 | if (!isset($return)) { 132 | $return = 'chunks'; 133 | } 134 | $output = ['prev' => [], 'up' => [], 'next' => []]; 135 | foreach ($rows as $row) { 136 | if (empty($row['menutitle'])) { 137 | $row['menutitle'] = $row['pagetitle']; 138 | } 139 | if (!empty($useWeblinkUrl) && $row['class_key'] == 'modWebLink') { 140 | $row['link'] = is_numeric(trim($row['content'], '[]~ ')) 141 | ? $pdoFetch->makeUrl((int)trim($row['content'], '[]~ '), $row) 142 | : $row['content']; 143 | } else { 144 | $row['link'] = $pdoFetch->makeUrl($row['id'], $row); 145 | } 146 | 147 | if (isset($prev[$row['id']])) { 148 | if ($return === 'data') { 149 | $output['prev'][] = $row; 150 | } else { 151 | $output['prev'][] = !empty($tplPrev) 152 | ? $pdoFetch->getChunk($tplPrev, $row, $fastMode) 153 | : $pdoFetch->getChunk('', $row); 154 | } 155 | } elseif (isset($next[$row['id']])) { 156 | if ($return === 'data') { 157 | $output['next'][] = $row; 158 | } else { 159 | $output['next'][] = !empty($tplNext) 160 | ? $pdoFetch->getChunk($tplNext, $row, $fastMode) 161 | : $pdoFetch->getChunk('', $row); 162 | } 163 | } else { 164 | if ($return === 'data') { 165 | $output['up'][] = $row; 166 | } else { 167 | $output['up'][] = !empty($tplUp) 168 | ? $pdoFetch->getChunk($tplUp, $row, $fastMode) 169 | : $pdoFetch->getChunk('', $row); 170 | } 171 | } 172 | } 173 | $pdoFetch->addTime('Chunks processed'); 174 | 175 | $log = ''; 176 | if ($modx->user->hasSessionContext('mgr') && !empty($showLog)) { 177 | $log .= '
    ' . print_r($pdoFetch->getTime(), 1) . '
    '; 178 | } 179 | 180 | foreach ($output as &$row) { 181 | $row = implode($outputSeparator, $row); 182 | } 183 | 184 | if (!empty($toSeparatePlaceholders)) { 185 | $output['log'] = $log; 186 | $modx->setPlaceholders($output, $toSeparatePlaceholders); 187 | } else { 188 | if (!empty($rows) || !empty($wrapIfEmpty)) { 189 | $output = !empty($tplWrapper) 190 | ? $pdoFetch->getChunk($tplWrapper, $output, $fastMode) 191 | : $pdoFetch->getChunk('', $output); 192 | } else { 193 | $output = ''; 194 | } 195 | $output .= $log; 196 | 197 | if (!empty($toPlaceholder)) { 198 | $modx->setPlaceholder($toPlaceholder, $output); 199 | } else { 200 | return $output; 201 | } 202 | } 203 | -------------------------------------------------------------------------------- /core/components/pdotools/elements/snippets/snippet.pdopage.php: -------------------------------------------------------------------------------- 1 | getOption('pdoPage.class', null, 'pdotools.pdopage', true); 76 | $path = $modx->getOption('pdopage_class_path', null, MODX_CORE_PATH . 'components/pdotools/model/', true); 77 | if ($pdoClass = $modx->loadClass($fqn, $path, false, true)) { 78 | $pdoPage = new $pdoClass($modx, $scriptProperties); 79 | } else { 80 | return false; 81 | } 82 | $pdoPage->pdoTools->addTime('pdoTools loaded'); 83 | 84 | // Script and styles 85 | if (!$isAjax && !empty($scriptProperties['ajaxMode'])) { 86 | $pdoPage->loadJsCss(); 87 | } 88 | // Removing of default scripts and styles so they do not overwrote nested snippet parameters 89 | if ($snippet = $modx->getObject('modSnippet', ['name' => 'pdoPage'])) { 90 | $properties = $snippet->get('properties'); 91 | if ($scriptProperties['frontend_js'] == $properties['frontend_js']['value']) { 92 | unset($scriptProperties['frontend_js']); 93 | } 94 | if ($scriptProperties['frontend_css'] == $properties['frontend_css']['value']) { 95 | unset($scriptProperties['frontend_css']); 96 | } 97 | } 98 | 99 | // Page 100 | if (isset($_REQUEST[$pageVarKey]) && $strictMode && (!is_numeric($_REQUEST[$pageVarKey]) || ($_REQUEST[$pageVarKey] <= 1 && !$isAjax))) { 101 | return $pdoPage->redirectToFirst($isAjax); 102 | } elseif (!empty($_REQUEST[$pageVarKey])) { 103 | $page = (integer)$_REQUEST[$pageVarKey]; 104 | } 105 | $scriptProperties['page'] = $page; 106 | $scriptProperties['request'] = $_REQUEST; 107 | $scriptProperties['setTotal'] = true; 108 | 109 | // Limit 110 | if (isset($_REQUEST['limit'])) { 111 | if (is_numeric($_REQUEST['limit']) && abs($_REQUEST['limit']) > 0) { 112 | $scriptProperties['limit'] = abs($_REQUEST['limit']); 113 | } elseif ($strictMode) { 114 | unset($_GET['limit']); 115 | 116 | return $pdoPage->redirectToFirst($isAjax); 117 | } 118 | } 119 | if (!empty($maxLimit) && !empty($scriptProperties['limit']) && $scriptProperties['limit'] > $maxLimit) { 120 | $scriptProperties['limit'] = $maxLimit; 121 | } 122 | 123 | // Offset 124 | $offset = !empty($scriptProperties['offset']) && $scriptProperties['offset'] > 0 125 | ? (int)$scriptProperties['offset'] 126 | : 0; 127 | $scriptProperties['offset'] = $page > 1 128 | ? $scriptProperties['limit'] * ($page - 1) + $offset 129 | : $offset; 130 | if (!empty($scriptProperties['offset']) && empty($scriptProperties['limit'])) { 131 | $scriptProperties['limit'] = 10000000; 132 | } 133 | 134 | $cache = !empty($cache) || (!$modx->user->id && !empty($cacheAnonymous)); 135 | $charset = $modx->getOption('modx_charset', null, 'UTF-8'); 136 | $url = htmlentities($pdoPage->getBaseUrl(), ENT_QUOTES, $charset); 137 | $output = $pagination = $total = $pageCount = ''; 138 | 139 | $data = $cache 140 | ? $pdoPage->pdoTools->getCache($scriptProperties) 141 | : []; 142 | 143 | if (empty($data)) { 144 | $output = $pdoPage->pdoTools->runSnippet($scriptProperties['element'], $scriptProperties); 145 | if ($output === false) { 146 | return ''; 147 | } elseif (!empty($toPlaceholder)) { 148 | $output = $modx->getPlaceholder($toPlaceholder); 149 | } 150 | 151 | // Pagination 152 | $total = (int)$modx->getPlaceholder($totalVar); 153 | $pageCount = !empty($scriptProperties['limit']) && $total > $offset 154 | ? ceil(($total - $offset) / $scriptProperties['limit']) 155 | : 0; 156 | 157 | // Redirect to start if somebody specified incorrect page 158 | if ($page > 1 && $page > $pageCount && $strictMode) { 159 | return $pdoPage->redirectToFirst($isAjax); 160 | } 161 | if (!empty($pageCount) && $pageCount > 1) { 162 | $pagination = [ 163 | 'first' => $page > 1 && !empty($tplPageFirst) 164 | ? $pdoPage->makePageLink($url, 1, $tplPageFirst) 165 | : '', 166 | 'prev' => $page > 1 && !empty($tplPagePrev) 167 | ? $pdoPage->makePageLink($url, $page - 1, $tplPagePrev) 168 | : '', 169 | 'pages' => $pageLimit >= 7 && empty($disableModernPagination) 170 | ? $pdoPage->buildModernPagination($page, $pageCount, $url) 171 | : $pdoPage->buildClassicPagination($page, $pageCount, $url), 172 | 'next' => $page < $pageCount && !empty($tplPageNext) 173 | ? $pdoPage->makePageLink($url, $page + 1, $tplPageNext) 174 | : '', 175 | 'last' => $page < $pageCount && !empty($tplPageLast) 176 | ? $pdoPage->makePageLink($url, $pageCount, $tplPageLast) 177 | : '', 178 | ]; 179 | 180 | if (!empty($pageCount)) { 181 | foreach (['first', 'prev', 'next', 'last'] as $v) { 182 | $tpl = 'tplPage' . ucfirst($v) . 'Empty'; 183 | if (!empty(${$tpl}) && empty($pagination[$v])) { 184 | $pagination[$v] = $pdoPage->pdoTools->getChunk(${$tpl}); 185 | } 186 | } 187 | } 188 | } else { 189 | $pagination = [ 190 | 'first' => '', 191 | 'prev' => '', 192 | 'pages' => '', 193 | 'next' => '', 194 | 'last' => '' 195 | ]; 196 | } 197 | 198 | $data = [ 199 | 'output' => $output, 200 | $pageVarKey => $page, 201 | $pageCountVar => $pageCount, 202 | $pageNavVar => !empty($tplPageWrapper) 203 | ? $pdoPage->pdoTools->getChunk($tplPageWrapper, $pagination) 204 | : $pdoPage->pdoTools->parseChunk('', $pagination), 205 | $totalVar => $total, 206 | ]; 207 | if ($cache) { 208 | $pdoPage->pdoTools->setCache($data, $scriptProperties); 209 | } 210 | } 211 | 212 | if ($modx->user->hasSessionContext('mgr') && !empty($showLog)) { 213 | $data['output'] .= '
    ' . print_r($pdoPage->pdoTools->getTime(), 1) . '
    '; 214 | } 215 | 216 | if ($isAjax) { 217 | if ($pageNavVar != 'pagination') { 218 | $data['pagination'] = $data[$pageNavVar]; 219 | unset($data[$pageNavVar]); 220 | } 221 | if ($pageCountVar != 'pages') { 222 | $data['pages'] = (int)$data[$pageCountVar]; 223 | unset($data[$pageCountVar]); 224 | } 225 | if ($pageVarKey != 'page') { 226 | $data['page'] = (int)$data[$pageVarKey]; 227 | unset($data[$pageVarKey]); 228 | } 229 | if ($totalVar != 'total') { 230 | $data['total'] = (int)$data[$totalVar]; 231 | unset($data[$totalVar]); 232 | } 233 | 234 | $maxIterations = (integer)$modx->getOption('parser_max_iterations', null, 10); 235 | $modx->getParser()->processElementTags('', $data['output'], false, false, '[[', ']]', [], $maxIterations); 236 | $modx->getParser()->processElementTags('', $data['output'], true, true, '[[', ']]', [], $maxIterations); 237 | 238 | @session_write_close(); 239 | exit(json_encode($data)); 240 | } else { 241 | if (!empty($setMeta)) { 242 | $canurl = $pdoPage->pdoTools->config['scheme'] !== 'full' 243 | ? rtrim($modx->getOption('site_url'), '/') . '/' . ltrim($url, '/') 244 | : $url; 245 | $modx->regClientStartupHTMLBlock(''); 246 | if ($data[$pageVarKey] > 1) { 247 | $prevUrl = $pdoPage->makePageLink($canurl, $data[$pageVarKey] - 1); 248 | $modx->regClientStartupHTMLBlock( 249 | '' 250 | ); 251 | } 252 | if ($data[$pageVarKey] < $data[$pageCountVar]) { 253 | $nextUrl = $pdoPage->makePageLink($canurl, $data[$pageVarKey] + 1); 254 | $modx->regClientStartupHTMLBlock( 255 | '' 256 | ); 257 | } 258 | } 259 | 260 | $modx->setPlaceholders($data, $plPrefix); 261 | if (!empty($toPlaceholder)) { 262 | $modx->setPlaceholder($toPlaceholder, $data['output']); 263 | } else { 264 | return $data['output']; 265 | } 266 | } 267 | -------------------------------------------------------------------------------- /core/components/pdotools/elements/snippets/snippet.pdoresources.php: -------------------------------------------------------------------------------- 1 | resource->id; 6 | } 7 | if (!empty($returnIds)) { 8 | $scriptProperties['return'] = $return = 'ids'; 9 | } elseif (!isset($return)) { 10 | $scriptProperties['return'] = $return = 'chunks'; 11 | } 12 | 13 | // Adding extra parameters into special place so we can put them in a results 14 | /** @var modSnippet $snippet */ 15 | $additionalPlaceholders = $properties = []; 16 | if (isset($this) && $this instanceof modSnippet && $this->get('properties')) { 17 | $properties = $this->get('properties'); 18 | } 19 | elseif ($snippet = $modx->getObject('modSnippet', ['name' => 'pdoResources'])) { 20 | $properties = $snippet->get('properties'); 21 | } 22 | if (!empty($properties)) { 23 | foreach ($scriptProperties as $k => $v) { 24 | if (!isset($properties[$k])) { 25 | $additionalPlaceholders[$k] = $v; 26 | } 27 | } 28 | } 29 | $scriptProperties['additionalPlaceholders'] = $additionalPlaceholders; 30 | 31 | /** @var pdoFetch $pdoFetch */ 32 | $fqn = $modx->getOption('pdoFetch.class', null, 'pdotools.pdofetch', true); 33 | $path = $modx->getOption('pdofetch_class_path', null, MODX_CORE_PATH . 'components/pdotools/model/', true); 34 | if ($pdoClass = $modx->loadClass($fqn, $path, false, true)) { 35 | $pdoFetch = new $pdoClass($modx, $scriptProperties); 36 | } else { 37 | return false; 38 | } 39 | $pdoFetch->addTime('pdoTools loaded'); 40 | $output = $pdoFetch->run(); 41 | 42 | $log = ''; 43 | if ($modx->user->hasSessionContext('mgr') && !empty($showLog)) { 44 | $log .= '
    ' . print_r($pdoFetch->getTime(), 1) . '
    '; 45 | } 46 | 47 | // Return output 48 | if (!empty($returnIds)) { 49 | $modx->setPlaceholder('pdoResources.log', $log); 50 | if (!empty($toPlaceholder)) { 51 | $modx->setPlaceholder($toPlaceholder, $output); 52 | } else { 53 | return $output; 54 | } 55 | } elseif ($return === 'data') { 56 | return $output; 57 | } elseif (!empty($toSeparatePlaceholders)) { 58 | $output['log'] = $log; 59 | $modx->setPlaceholders($output, $toSeparatePlaceholders); 60 | } else { 61 | $output .= $log; 62 | 63 | if (!empty($tplWrapper) && (!empty($wrapIfEmpty) || !empty($output))) { 64 | $output = $pdoFetch->getChunk($tplWrapper, array_merge($additionalPlaceholders, ['output' => $output]), 65 | $pdoFetch->config['fastMode']); 66 | } 67 | 68 | if (!empty($toPlaceholder)) { 69 | $modx->setPlaceholder($toPlaceholder, $output); 70 | } else { 71 | return $output; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /core/components/pdotools/elements/snippets/snippet.pdositemap.php: -------------------------------------------------------------------------------- 1 | getOption('pdoFetch.class', null, 'pdotools.pdofetch', true); 5 | $path = $modx->getOption('pdofetch_class_path', null, MODX_CORE_PATH . 'components/pdotools/model/', true); 6 | if ($pdoClass = $modx->loadClass($fqn, $path, false, true)) { 7 | $pdoFetch = new $pdoClass($modx, $scriptProperties); 8 | } else { 9 | return false; 10 | } 11 | $pdoFetch->addTime('pdoTools loaded'); 12 | 13 | // Default variables 14 | if (empty($tpl)) { 15 | $tpl = "@INLINE \n\n\t[[+url]]\n\t[[+date]]\n\t[[+update]]\n\t[[+priority]]\n"; 16 | } 17 | if (empty($tplWrapper)) { 18 | $tplWrapper = "@INLINE \n\n[[+output]]\n"; 19 | } 20 | if (empty($sitemapSchema)) { 21 | $sitemapSchema = 'http://www.sitemaps.org/schemas/sitemap/0.9'; 22 | } 23 | if (empty($outputSeparator)) { 24 | $outputSeparator = "\n"; 25 | } 26 | if (empty($cacheKey)) { 27 | $scriptProperties['cacheKey'] = 'sitemap/' . substr(md5(json_encode($scriptProperties)), 0, 6); 28 | } 29 | 30 | // Convert parameters from GoogleSiteMap if exists 31 | if (!empty($itemTpl)) { 32 | $tpl = $itemTpl; 33 | } 34 | if (!empty($containerTpl)) { 35 | $tplWrapper = $containerTpl; 36 | } 37 | if (!empty($allowedtemplates)) { 38 | $scriptProperties['templates'] = $allowedtemplates; 39 | } 40 | if (!empty($maxDepth)) { 41 | $scriptProperties['depth'] = $maxDepth; 42 | } 43 | if (isset($hideDeleted)) { 44 | $scriptProperties['showDeleted'] = !$hideDeleted; 45 | } 46 | if (isset($published)) { 47 | $scriptProperties['showUnpublished'] = !$published; 48 | } 49 | if (isset($searchable)) { 50 | $scriptProperties['showUnsearchable'] = !$searchable; 51 | } 52 | if (!empty($googleSchema)) { 53 | $sitemapSchema = $googleSchema; 54 | } 55 | if (!empty($excludeResources)) { 56 | $tmp = array_map('trim', explode(',', $excludeResources)); 57 | foreach ($tmp as $v) { 58 | if (!empty($scriptProperties['resources'])) { 59 | $scriptProperties['resources'] .= ',-' . $v; 60 | } else { 61 | $scriptProperties['resources'] = '-' . $v; 62 | } 63 | } 64 | } 65 | if (!empty($excludeChildrenOf)) { 66 | $tmp = array_map('trim', explode(',', $excludeChildrenOf)); 67 | foreach ($tmp as $v) { 68 | if (!empty($scriptProperties['parents'])) { 69 | $scriptProperties['parents'] .= ',-' . $v; 70 | } else { 71 | $scriptProperties['parents'] = '-' . $v; 72 | } 73 | } 74 | } 75 | if (!empty($startId)) { 76 | if (!empty($scriptProperties['parents'])) { 77 | $scriptProperties['parents'] .= ',' . $startId; 78 | } else { 79 | $scriptProperties['parents'] = $startId; 80 | } 81 | } 82 | if (!empty($sortBy)) { 83 | $scriptProperties['sortby'] = $sortBy; 84 | } 85 | if (!empty($sortDir)) { 86 | $scriptProperties['sortdir'] = $sortDir; 87 | } 88 | if (!empty($priorityTV)) { 89 | if (!empty($scriptProperties['includeTVs'])) { 90 | $scriptProperties['includeTVs'] .= ',' . $priorityTV; 91 | } else { 92 | $scriptProperties['includeTVs'] = $priorityTV; 93 | } 94 | } 95 | if (!empty($itemSeparator)) { 96 | $outputSeparator = $itemSeparator; 97 | } 98 | //--- 99 | 100 | 101 | $class = 'modResource'; 102 | $where = []; 103 | if (empty($showHidden)) { 104 | $where[] = [ 105 | $class . '.hidemenu' => 0, 106 | 'OR:' . $class . '.class_key:IN' => ['Ticket', 'Article'], 107 | ]; 108 | } 109 | if (empty($context)) { 110 | $scriptProperties['context'] = $modx->context->key; 111 | } 112 | 113 | $select = [$class => 'id,editedon,createdon,context_key,class_key,uri']; 114 | if (!empty($useWeblinkUrl)) { 115 | $select[$class] .= ',content'; 116 | } 117 | // Add custom parameters 118 | foreach (['where', 'select'] as $v) { 119 | if (!empty($scriptProperties[$v])) { 120 | $tmp = $scriptProperties[$v]; 121 | if (!is_array($tmp)) { 122 | $tmp = json_decode($tmp, true); 123 | } 124 | if (is_array($tmp)) { 125 | $$v = array_merge($$v, $tmp); 126 | } 127 | } 128 | unset($scriptProperties[$v]); 129 | } 130 | $pdoFetch->addTime('Conditions prepared'); 131 | 132 | // Default parameters 133 | $default = [ 134 | 'class' => $class, 135 | 'where' => json_encode($where), 136 | 'select' => json_encode($select), 137 | 'sortby' => "{$class}.parent ASC, {$class}.menuindex", 138 | 'sortdir' => 'ASC', 139 | 'return' => 'data', 140 | 'scheme' => 'full', 141 | 'limit' => 0, 142 | ]; 143 | // Merge all properties and run! 144 | $pdoFetch->addTime('Query parameters ready'); 145 | $pdoFetch->setConfig(array_merge($default, $scriptProperties), false); 146 | 147 | if (!empty($cache)) { 148 | $data = $pdoFetch->getCache($scriptProperties); 149 | } 150 | if (!isset($return)) { 151 | $return = 'chunks'; 152 | } 153 | if (empty($data)) { 154 | $now = time(); 155 | $data = $urls = []; 156 | $rows = $pdoFetch->run(); 157 | foreach ($rows as $row) { 158 | if (!empty($useWeblinkUrl) && $row['class_key'] == 'modWebLink') { 159 | $row['url'] = is_numeric(trim($row['content'], '[]~ ')) 160 | ? $pdoFetch->makeUrl((int)trim($row['content'], '[]~ '), $row) 161 | : $row['content']; 162 | } else { 163 | $row['url'] = $pdoFetch->makeUrl($row['id'], $row); 164 | } 165 | unset($row['content']); 166 | $time = !empty($row['editedon']) 167 | ? $row['editedon'] 168 | : $row['createdon']; 169 | $row['date'] = date('c', $time); 170 | 171 | $datediff = floor(($now - $time) / 86400); 172 | if ($datediff <= 1) { 173 | $row['priority'] = '1.0'; 174 | $row['update'] = 'daily'; 175 | } elseif (($datediff > 1) && ($datediff <= 7)) { 176 | $row['priority'] = '0.75'; 177 | $row['update'] = 'weekly'; 178 | } elseif (($datediff > 7) && ($datediff <= 30)) { 179 | $row['priority'] = '0.50'; 180 | $row['update'] = 'weekly'; 181 | } else { 182 | $row['priority'] = '0.25'; 183 | $row['update'] = 'monthly'; 184 | } 185 | if (!empty($priorityTV) && !empty($row[$priorityTV])) { 186 | $row['priority'] = $row[$priorityTV]; 187 | } 188 | 189 | // Fix possible duplicates made by modWebLink 190 | if (!empty($urls[$row['url']])) { 191 | if ($urls[$row['url']] > $row['date']) { 192 | continue; 193 | } 194 | } 195 | $urls[$row['url']] = $row['date']; 196 | 197 | // Add item to output 198 | if ($return === 'data') { 199 | $data[$row['url']] = $row; 200 | } else { 201 | $data[$row['url']] = $pdoFetch->parseChunk($tpl, $row); 202 | if (strpos($data[$row['url']], '[[') !== false) { 203 | $modx->parser->processElementTags('', $data[$row['url']], true, true, '[[', ']]', array(), 10); 204 | } 205 | } 206 | } 207 | $pdoFetch->addTime('Rows processed'); 208 | if (!empty($cache)) { 209 | $pdoFetch->setCache($data, $scriptProperties); 210 | } 211 | } 212 | 213 | if ($return === 'data') { 214 | $output = $data; 215 | } else { 216 | $output = implode($outputSeparator, $data); 217 | $output = $pdoFetch->getChunk($tplWrapper, [ 218 | 'schema' => $sitemapSchema, 219 | 'output' => $output, 220 | 'items' => $output, 221 | ]); 222 | $pdoFetch->addTime('Rows wrapped'); 223 | 224 | if ($modx->user->hasSessionContext('mgr') && !empty($showLog)) { 225 | $output .= '
    ' . print_r($pdoFetch->getTime(), 1) . '
    '; 226 | } 227 | } 228 | if (!empty($forceXML)) { 229 | header("Content-Type:text/xml"); 230 | @session_write_close(); 231 | exit($output); 232 | } else { 233 | return $output; 234 | } -------------------------------------------------------------------------------- /core/components/pdotools/elements/snippets/snippet.pdotitle.php: -------------------------------------------------------------------------------- 1 | resource->id; 27 | } 28 | if (empty($cacheKey)) { 29 | $cacheKey = 'title_crumbs'; 30 | } 31 | if (!isset($cacheTime)) { 32 | $cacheTime = 0; 33 | } 34 | /** @var pdoTools $pdoTools */ 35 | $fqn = $modx->getOption('pdoTools.class', null, 'pdotools.pdotools', true); 36 | $path = $modx->getOption('pdotools_class_path', null, MODX_CORE_PATH . 'components/pdotools/model/', true); 37 | if ($pdoClass = $modx->loadClass($fqn, $path, false, true)) { 38 | $pdoTools = new $pdoClass($modx, $scriptProperties); 39 | } else { 40 | return false; 41 | } 42 | $modx->lexicon->load('pdotools:pdopage'); 43 | 44 | /** @var modResource $resource */ 45 | $resource = ($id == $modx->resource->id) 46 | ? $modx->resource 47 | : $modx->getObject('modResource', $id); 48 | if (!$resource) { 49 | return ''; 50 | } 51 | 52 | $title = []; 53 | $pagetitle = trim($resource->get($titleField)); 54 | if (empty($pagetitle)) { 55 | $pagetitle = $resource->get('pagetitle'); 56 | } 57 | 58 | // Add search request if exists 59 | if (!empty($_GET[$queryVarKey]) && strlen($_GET[$queryVarKey]) >= $minQuery && !empty($tplSearch)) { 60 | $pagetitle .= ' ' . $pdoTools->getChunk($tplSearch, [ 61 | $queryVarKey => $modx->stripTags($_GET[$queryVarKey]), 62 | ]); 63 | } 64 | $title[] = $pagetitle; 65 | 66 | // Add pagination if exists 67 | if (!empty($_GET[$pageVarKey]) && !empty($tplPages)) { 68 | $title[] = $pdoTools->getChunk($tplPages, [ 69 | 'page' => (int)$_GET[$pageVarKey], 70 | ]); 71 | } 72 | 73 | // Add parents 74 | $cacheKey = $resource->getCacheKey() . '/' . $cacheKey; 75 | $cacheOptions = ['cache_key' => $modx->getOption('cache_resource_key', null, 'resource')]; 76 | $crumbs = ''; 77 | if (empty($cache) || !$crumbs = $modx->cacheManager->get($cacheKey, $cacheOptions)) { 78 | $crumbs = $pdoTools->runSnippet('pdoCrumbs', array_merge( 79 | [ 80 | 'to' => $resource->id, 81 | 'outputSeparator' => $outputSeparator, 82 | 'showHome' => 0, 83 | 'showAtHome' => 0, 84 | 'showCurrent' => 0, 85 | 'direction' => 'rtl', 86 | 'tpl' => '@INLINE [[+menutitle]]', 87 | 'tplCurrent' => '@INLINE [[+menutitle]]', 88 | 'tplWrapper' => '@INLINE [[+output]]', 89 | 'tplMax' => '', 90 | 'tplHome' => '', 91 | ], $scriptProperties 92 | )); 93 | } 94 | if (!empty($crumbs)) { 95 | if (!empty($cache)) { 96 | $modx->cacheManager->set($cacheKey, $crumbs, $cacheTime, $cacheOptions); 97 | } 98 | $title[] = $crumbs; 99 | } 100 | 101 | if (!empty($registerJs)) { 102 | $config = [ 103 | 'separator' => $outputSeparator, 104 | 'tpl' => str_replace(['[[+', ']]'], ['{', '}'], $pdoTools->getChunk($tplPages)), 105 | ]; 106 | /** @noinspection Annotator */ 107 | $modx->regClientStartupScript('', 108 | true); 109 | } 110 | 111 | return implode($outputSeparator, $title); -------------------------------------------------------------------------------- /core/components/pdotools/elements/snippets/snippet.pdousers.php: -------------------------------------------------------------------------------- 1 | getOption('pdoFetch.class', null, 'pdotools.pdofetch', true); 11 | $path = $modx->getOption('pdofetch_class_path', null, MODX_CORE_PATH . 'components/pdotools/model/', true); 12 | if ($pdoClass = $modx->loadClass($fqn, $path, false, true)) { 13 | $pdoFetch = new $pdoClass($modx, $scriptProperties); 14 | } else { 15 | return false; 16 | } 17 | $pdoFetch->addTime('pdoTools loaded'); 18 | 19 | $class = 'modUser'; 20 | $profile = 'modUserProfile'; 21 | $member = 'modUserGroupMember'; 22 | 23 | // Start building "Where" expression 24 | $where = []; 25 | if (empty($showInactive)) { 26 | $where[$class . '.active'] = 1; 27 | } 28 | if (empty($showBlocked)) { 29 | $where[$profile . '.blocked'] = 0; 30 | } 31 | 32 | // Add users profiles and groups 33 | $innerJoin = [ 34 | $profile => ['alias' => $profile, 'on' => "$class.id = $profile.internalKey"], 35 | ]; 36 | 37 | // Filter by users, groups and roles 38 | $tmp = [ 39 | 'users' => [ 40 | 'class' => $class, 41 | 'name' => 'username', 42 | 'join' => $class . '.id', 43 | ], 44 | 'groups' => [ 45 | 'class' => 'modUserGroup', 46 | 'name' => 'name', 47 | 'join' => $member . '.user_group', 48 | ], 49 | 'roles' => [ 50 | 'class' => 'modUserGroupRole', 51 | 'name' => 'name', 52 | 'join' => $member . '.role', 53 | ], 54 | ]; 55 | foreach ($tmp as $k => $p) { 56 | if (!empty($$k)) { 57 | $$k = array_map('trim', explode(',', $$k)); 58 | ${$k . '_in'} = ${$k . '_out'} = $fetch_in = $fetch_out = []; 59 | foreach ($$k as $v) { 60 | if (is_numeric($v)) { 61 | if ($v[0] == '-') { 62 | ${$k . '_out'}[] = abs($v); 63 | } else { 64 | ${$k . '_in'}[] = abs($v); 65 | } 66 | } else { 67 | if ($v[0] == '-') { 68 | $fetch_out[] = $v; 69 | } else { 70 | $fetch_in[] = $v; 71 | } 72 | } 73 | } 74 | 75 | if (!empty($fetch_in) || !empty($fetch_out)) { 76 | $q = $modx->newQuery($p['class'], [$p['name'] . ':IN' => array_merge($fetch_in, $fetch_out)]); 77 | $q->select('id,' . $p['name']); 78 | $tstart = microtime(true); 79 | if ($q->prepare() && $q->stmt->execute()) { 80 | $modx->queryTime += microtime(true) - $tstart; 81 | $modx->executedQueries++; 82 | while ($row = $q->stmt->fetch(PDO::FETCH_ASSOC)) { 83 | if (in_array($row[$p['name']], $fetch_in)) { 84 | ${$k . '_in'}[] = $row['id']; 85 | } else { 86 | ${$k . '_out'}[] = $row['id']; 87 | } 88 | } 89 | } 90 | } 91 | 92 | if (!empty(${$k . '_in'})) { 93 | $where[$p['join'] . ':IN'] = ${$k . '_in'}; 94 | } 95 | if (!empty(${$k . '_out'})) { 96 | $where[$p['join'] . ':NOT IN'] = ${$k . '_out'}; 97 | } 98 | } 99 | } 100 | 101 | if (!empty($groups_in) || !empty($groups_out) || !empty($roles_in) || !empty($roles_out)) { 102 | $innerJoin[$member] = ['alias' => $member, 'on' => "$class.id = $member.member"]; 103 | } 104 | 105 | // Fields to select 106 | $select = [ 107 | $profile => implode(',', array_diff(array_keys($modx->getFieldMeta($profile)), ['sessionid'])), 108 | $class => implode(',', array_diff(array_keys($modx->getFieldMeta($class)), ['password', 'cachepwd', 'salt', 'session_stale', 'remote_key', 'remote_data', 'hash_class'])), 109 | ]; 110 | 111 | // Add custom parameters 112 | foreach (['where', 'innerJoin', 'select'] as $v) { 113 | if (!empty($scriptProperties[$v])) { 114 | $tmp = $scriptProperties[$v]; 115 | if (!is_array($tmp)) { 116 | $tmp = json_decode($tmp, true); 117 | } 118 | if (is_array($tmp)) { 119 | $$v = array_merge($$v, $tmp); 120 | } 121 | } 122 | unset($scriptProperties[$v]); 123 | } 124 | $pdoFetch->addTime('Conditions prepared'); 125 | 126 | $default = [ 127 | 'class' => $class, 128 | 'innerJoin' => json_encode($innerJoin), 129 | 'where' => json_encode($where), 130 | 'select' => json_encode($select), 131 | 'groupby' => $class . '.id', 132 | 'sortby' => $class . '.id', 133 | 'sortdir' => 'ASC', 134 | 'fastMode' => false, 135 | 'return' => $return, 136 | 'disableConditions' => true, 137 | ]; 138 | 139 | if (!empty($users_in) && (empty($scriptProperties['sortby']) || $scriptProperties['sortby'] == $class . '.id')) { 140 | $scriptProperties['sortby'] = "find_in_set(`$class`.`id`,'" . implode(',', $users_in) . "')"; 141 | $scriptProperties['sortdir'] = ''; 142 | } 143 | 144 | // Merge all properties and run! 145 | $pdoFetch->addTime('Query parameters ready'); 146 | $pdoFetch->setConfig(array_merge($default, $scriptProperties), false); 147 | $output = $pdoFetch->run(); 148 | 149 | $log = ''; 150 | if ($modx->user->hasSessionContext('mgr') && !empty($showLog)) { 151 | $log .= '
    ' . print_r($pdoFetch->getTime(), 1) . '
    '; 152 | } 153 | 154 | // Return output 155 | if (!empty($returnIds)) { 156 | $modx->setPlaceholder('pdoUsers.log', $log); 157 | if (!empty($toPlaceholder)) { 158 | $modx->setPlaceholder($toPlaceholder, $output); 159 | } else { 160 | return $output; 161 | } 162 | } elseif ($return === 'data') { 163 | return $output; 164 | } elseif (!empty($toSeparatePlaceholders)) { 165 | $output['log'] = $log; 166 | $modx->setPlaceholders($output, $toSeparatePlaceholders); 167 | } else { 168 | $output .= $log; 169 | 170 | if (!empty($tplWrapper) && (!empty($wrapIfEmpty) || !empty($output))) { 171 | $output = $pdoFetch->getChunk($tplWrapper, ['output' => $output], $pdoFetch->config['fastMode']); 172 | } 173 | 174 | if (!empty($toPlaceholder)) { 175 | $modx->setPlaceholder($toPlaceholder, $output); 176 | } else { 177 | return $output; 178 | } 179 | } -------------------------------------------------------------------------------- /core/components/pdotools/lexicon/de/default.inc.php: -------------------------------------------------------------------------------- 1 | offiziellen Dokumentation beschrieben werden. Beispiel: {"auto_escape": true, "force_include": true}'; 42 | $_lang['setting_pdotools_fenom_cache'] = 'Caching verarbeiteter Chunks'; 43 | $_lang['setting_pdotools_fenom_cache_desc'] = 'Wenn Sie große und komplexe Fenom-Chunks verwenden, können Sie das Caching der verarbeiteten Versionen aktivieren. Diese werden nur aktualisiert, wenn Sie den System-Cache leeren. Nicht empfohlen während der Entwicklung der Website.'; 44 | $_lang['setting_pdotools_fenom_save_on_errors'] = 'Fehlermeldungen speichern'; 45 | $_lang['setting_pdotools_fenom_save_on_errors_desc'] = 'Aktivieren Sie diese Einstellung, um die Fenom-Compiler-Fehlermeldungen im Verzeichnis "core/cache/default/pdotools/error" zum späteren Debuggen zu speichern.'; -------------------------------------------------------------------------------- /core/components/pdotools/lexicon/de/pdoarchive.inc.php: -------------------------------------------------------------------------------- 1 | official documentation. For example: {"auto_escape":true,"force_include":true}'; 42 | $_lang['setting_pdotools_fenom_cache'] = 'Caching compiled chunks'; 43 | $_lang['setting_pdotools_fenom_cache_desc'] = 'If you use large and complex Fenom chunks, you can enable caching of its compiled versions. They will be updated only when you clear the system cache. Not recommended for the development of the site.'; 44 | $_lang['setting_pdotools_fenom_save_on_errors'] = 'Save errors'; 45 | $_lang['setting_pdotools_fenom_save_on_errors_desc'] = 'Enable this option to save Fenom compilation errors to the "core/cache/default/pdotools/error" directory for later debugging.'; -------------------------------------------------------------------------------- /core/components/pdotools/lexicon/en/pdoarchive.inc.php: -------------------------------------------------------------------------------- 1 | официальной документации. Например: {"auto_escape":true,"force_include":true}'; 42 | $_lang['setting_pdotools_fenom_cache'] = 'Кэширование скомпилированных чанков'; 43 | $_lang['setting_pdotools_fenom_cache_desc'] = 'Если вы используете большие и сложные чанки Fenom, то можно включить кэширование их скомпилированных версий. Они будут обновляться только при очистке системного кэша. Не рекомендуется при разработке сайта.'; 44 | $_lang['setting_pdotools_fenom_save_on_errors'] = 'Сохранять ошибки'; 45 | $_lang['setting_pdotools_fenom_save_on_errors_desc'] = 'Включите эту опцию, чтобы сохранять ошибки компиляции Fenom в директорию "core/cache/default/pdotools/error" для последующей отладки.'; -------------------------------------------------------------------------------- /core/components/pdotools/lexicon/ru/pdoarchive.inc.php: -------------------------------------------------------------------------------- 1 | pdoTools = $pdoTools; 14 | $this->modx = $pdoTools->modx; 15 | } 16 | 17 | 18 | /** 19 | * @param string $tpl 20 | * 21 | * @return bool 22 | */ 23 | public function templateExists($tpl) 24 | { 25 | $c = is_numeric($tpl) && $tpl > 0 26 | ? $tpl 27 | : array('name' => $tpl); 28 | 29 | return (bool)$this->modx->getCount('modChunk', $c); 30 | } 31 | 32 | 33 | /** 34 | * @param string $tpl 35 | * @param int $time 36 | * 37 | * @return string 38 | */ 39 | public function getSource($tpl, &$time) 40 | { 41 | $content = ''; 42 | if ($pos = strpos($tpl, '@')) { 43 | $propertySet = substr($tpl, $pos + 1); 44 | $tpl = substr($tpl, 0, $pos); 45 | } 46 | $c = is_numeric($tpl) && $tpl > 0 47 | ? $tpl 48 | : array('name' => $tpl); 49 | /** @var modChunk $chunk */ 50 | if ($element = $this->modx->getObject('modChunk', $c)) { 51 | $content = $element->getContent(); 52 | 53 | $properties = array(); 54 | if (!empty($propertySet)) { 55 | if ($tmp = $element->getPropertySet($propertySet)) { 56 | $properties = $tmp; 57 | } 58 | } else { 59 | $properties = $element->getProperties(); 60 | } 61 | if (!empty($content) && !empty($properties)) { 62 | $useFenom = $this->pdoTools->config['useFenom']; 63 | $this->pdoTools->config['useFenom'] = false; 64 | 65 | $content = $this->pdoTools->parseChunk('@INLINE ' . $content, $properties); 66 | $this->pdoTools->config['useFenom'] = $useFenom; 67 | } 68 | } 69 | 70 | return $content; 71 | } 72 | 73 | 74 | /** 75 | * @param string $tpl 76 | * 77 | * @return int 78 | */ 79 | public function getLastModified($tpl) 80 | { 81 | $c = is_numeric($tpl) && $tpl > 0 82 | ? $tpl 83 | : array('name' => $tpl); 84 | /** @var modChunk $chunk */ 85 | if ($chunk = $this->modx->getObject('modChunk', $c)) { 86 | if ($chunk->isStatic() && $file = $chunk->getSourceFile()) { 87 | return filemtime($file); 88 | } 89 | } 90 | 91 | return time(); 92 | } 93 | 94 | 95 | /** 96 | * Verify templates (check mtime) 97 | * 98 | * @param array $templates [template_name => modified, ...] By conversation, you may trust the template's name 99 | * 100 | * @return bool if true - all templates are valid else some templates are invalid 101 | */ 102 | public function verify(array $templates) 103 | { 104 | return true; 105 | } 106 | 107 | 108 | /** 109 | * Get all names of template from provider 110 | * @return array|\Iterator 111 | */ 112 | public function getList() 113 | { 114 | $c = $this->modx->newQuery('modChunk'); 115 | $c->select('name'); 116 | if ($c->prepare() && $c->stmt->execute()) { 117 | return $c->stmt->fetchAll(PDO::FETCH_COLUMN); 118 | } 119 | 120 | return array(); 121 | } 122 | 123 | } -------------------------------------------------------------------------------- /core/components/pdotools/model/fenom/Providers/ModFile.php: -------------------------------------------------------------------------------- 1 | config['elementsPath']) 14 | ? MODX_CORE_PATH . 'cache/' 15 | : $pdoTools->config['elementsPath']; 16 | parent::__construct($dir); 17 | $this->pdoTools = $pdoTools; 18 | $this->modx = $pdoTools->modx; 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /core/components/pdotools/model/fenom/Providers/ModTemplate.php: -------------------------------------------------------------------------------- 1 | pdoTools = $pdoTools; 14 | $this->modx = $pdoTools->modx; 15 | } 16 | 17 | 18 | /** 19 | * @param string $tpl 20 | * 21 | * @return bool 22 | */ 23 | public function templateExists($tpl) 24 | { 25 | $c = is_numeric($tpl) && $tpl > 0 26 | ? $tpl 27 | : array('templatename' => $tpl); 28 | 29 | return (bool)$this->modx->getCount('modTemplate', $c); 30 | } 31 | 32 | 33 | /** 34 | * @param string $tpl 35 | * @param int $time 36 | * 37 | * @return string 38 | */ 39 | public function getSource($tpl, &$time) 40 | { 41 | $content = ''; 42 | if ($pos = strpos($tpl, '@')) { 43 | $propertySet = substr($tpl, $pos + 1); 44 | $tpl = substr($tpl, 0, $pos); 45 | } 46 | $c = is_numeric($tpl) && $tpl > 0 47 | ? $tpl 48 | : array('templatename' => $tpl); 49 | /** @var modChunk $chunk */ 50 | if ($element = $this->modx->getObject('modTemplate', $c)) { 51 | $content = $element->getContent(); 52 | 53 | $properties = array(); 54 | if (!empty($propertySet)) { 55 | if ($tmp = $element->getPropertySet($propertySet)) { 56 | $properties = $tmp; 57 | } 58 | } else { 59 | $properties = $element->getProperties(); 60 | } 61 | if (!empty($content) && !empty($properties)) { 62 | $useFenom = $this->pdoTools->config['useFenom']; 63 | $this->pdoTools->config['useFenom'] = false; 64 | 65 | $content = $this->pdoTools->parseChunk('@INLINE ' . $content, $properties); 66 | $this->pdoTools->config['useFenom'] = $useFenom; 67 | } 68 | } 69 | 70 | return $content; 71 | } 72 | 73 | 74 | /** 75 | * @param string $tpl 76 | * 77 | * @return int 78 | */ 79 | public function getLastModified($tpl) 80 | { 81 | $c = is_numeric($tpl) && $tpl > 0 82 | ? $tpl 83 | : array('templatename' => $tpl); 84 | /** @var modChunk $chunk */ 85 | if ($chunk = $this->modx->getObject('modTemplate', $c)) { 86 | if ($chunk->isStatic() && $file = $chunk->getSourceFile()) { 87 | return filemtime($file); 88 | } 89 | } 90 | 91 | return time(); 92 | } 93 | 94 | 95 | /** 96 | * Verify templates (check mtime) 97 | * 98 | * @param array $templates [template_name => modified, ...] By conversation, you may trust the template's name 99 | * 100 | * @return bool if true - all templates are valid else some templates are invalid 101 | */ 102 | public function verify(array $templates) 103 | { 104 | return true; 105 | } 106 | 107 | 108 | /** 109 | * Get all names of template from provider 110 | * @return array|\Iterator 111 | */ 112 | public function getList() 113 | { 114 | $c = $this->modx->newQuery('modTemplate'); 115 | $c->select('templatename'); 116 | if ($c->prepare() && $c->stmt->execute()) { 117 | return $c->stmt->fetchAll(PDO::FETCH_COLUMN); 118 | } 119 | 120 | return array(); 121 | } 122 | 123 | } -------------------------------------------------------------------------------- /core/components/pdotools/model/pdotools/metadata.mysql.php: -------------------------------------------------------------------------------- 1 | getOption('pdoTools.class', null, 'pdotools.pdotools', true); 22 | $path = $modx->getOption('pdotools_class_path', null, MODX_CORE_PATH . 'components/pdotools/model/', true); 23 | if ($pdoClass = $modx->loadClass($fqn, $path, false, true)) { 24 | $this->pdoTools = new $pdoClass($modx); 25 | } 26 | } 27 | 28 | 29 | /** 30 | * Trying to process MODX pages with Fenom template engine 31 | * 32 | * @param string $parentTag 33 | * @param string $content 34 | * @param bool $processUncacheable 35 | * @param bool $removeUnprocessed 36 | * @param string $prefix 37 | * @param string $suffix 38 | * @param array $tokens 39 | * @param int $depth 40 | * 41 | * @return int 42 | */ 43 | public function processElementTags( 44 | $parentTag, 45 | & $content, 46 | $processUncacheable = false, 47 | $removeUnprocessed = false, 48 | $prefix = "[[", 49 | $suffix = "]]", 50 | $tokens = array(), 51 | $depth = 0 52 | ) { 53 | if (is_string($content) && $processUncacheable && !empty($this->pdoTools->config['useFenomParser'])) { 54 | if (preg_match_all('#\{ignore\}(.*?)\{\/ignore\}#is', $content, $ignores)) { 55 | foreach ($ignores[1] as $ignore) { 56 | $key = 'ignore_' . md5($ignore); 57 | $this->pdoTools->ignores[$key] = $ignore; 58 | $content = str_replace($ignore, $key, $content); 59 | } 60 | } 61 | $content = $this->pdoTools->fenom($content, $this->modx->placeholders); 62 | } 63 | 64 | return parent::processElementTags($parentTag, $content, $processUncacheable, $removeUnprocessed, $prefix, 65 | $suffix, $tokens, $depth 66 | ); 67 | } 68 | 69 | 70 | /** 71 | * Quickly processes a simple tag and returns the result. 72 | * 73 | * @param string $tag A full tag string parsed from content. 74 | * @param boolean $processUncacheable 75 | * 76 | * @return mixed The output of the processed element represented by the specified tag. 77 | */ 78 | public function processTag($tag, $processUncacheable = true) 79 | { 80 | $outerTag = $tag[0]; 81 | $innerTag = $tag[1]; 82 | $processed = false; 83 | $output = $token = ''; 84 | 85 | // Disabled tag 86 | if (empty($innerTag[0]) || $innerTag[0] == '-') { 87 | return ''; 88 | } // Uncacheable tag 89 | elseif ($innerTag[0] == '!' && !$processUncacheable) { 90 | $this->processElementTags($outerTag, $innerTag, $processUncacheable); 91 | $outerTag = '[[' . $innerTag . ']]'; 92 | 93 | return $outerTag; 94 | } // We processing only certain types of tags without parameters 95 | elseif (strpos($innerTag, '?') === false && preg_match('/^(?:!|)[-|%|~|+|*|#]+/', $innerTag, $matches)) { 96 | if (strpos($innerTag, '[[') !== false) { 97 | $this->processElementTags($outerTag, $innerTag, $processUncacheable); 98 | $outerTag = '[[' . $innerTag . ']]'; 99 | } 100 | 101 | $innerTag = ltrim($this->realname($innerTag), '!'); 102 | $token = $innerTag[0]; 103 | $innerTag = substr($innerTag, 1); 104 | switch ($token) { 105 | // Lexicon tag 106 | case '%': 107 | $tmp = $this->modx->lexicon($innerTag); 108 | if ($tmp != $innerTag) { 109 | $output = $tmp; 110 | $processed = true; 111 | } 112 | break; 113 | // Link tag 114 | case '~': 115 | if (is_numeric($innerTag)) { 116 | if ($tmp = $this->modx->makeUrl($innerTag, '', '', 117 | $this->modx->getOption('link_tag_scheme', null, -1, true)) 118 | ) { 119 | $output = $tmp; 120 | $processed = true; 121 | } 122 | } 123 | break; 124 | // Usual placeholder 125 | // and 126 | // System setting 127 | case '+': 128 | if (isset($this->modx->placeholders[$innerTag])) { 129 | $output = $this->modx->placeholders[$innerTag]; 130 | $processed = true; 131 | } 132 | break; 133 | // Resource tag and TVs 134 | case '*': 135 | if (is_object($this->modx->resource) && $this->modx->resource instanceof modResource) { 136 | if ($innerTag == 'content') { 137 | $output = $this->modx->resource->getContent(); 138 | } elseif (is_array($this->modx->resource->_fieldMeta) && isset($this->modx->resource->_fieldMeta[$innerTag])) { 139 | $output = $this->modx->resource->get($innerTag); 140 | } else { 141 | $output = $this->modx->resource->getTVValue($innerTag); 142 | } 143 | $processed = true; 144 | } 145 | break; 146 | // FastField tag 147 | // Thanks to Argnist and Dimlight Studio (http://dimlight.ru) for the original idea 148 | case '#': 149 | $processed = true; 150 | $tmp = array_map('trim', explode('.', $innerTag)); 151 | $length = count($tmp); 152 | // Resource tag 153 | if (is_numeric($tmp[0])) { 154 | /** @var modResource $resource */ 155 | if (!$resource = $this->pdoTools->getStore($tmp[0], 'resource')) { 156 | $resource = $this->modx->getObject('modResource', $tmp[0]); 157 | $this->pdoTools->setStore($tmp[0], $resource, 'resource'); 158 | } 159 | $output = ''; 160 | if (!empty($resource)) { 161 | // Field specified 162 | if (!empty($tmp[1])) { 163 | $tmp[1] = strtolower($tmp[1]); 164 | if ($tmp[1] == 'content') { 165 | $output = $resource->getContent(); 166 | } // Resource field 167 | elseif ($field = $resource->get($tmp[1])) { 168 | if (is_array($field) && $length > 2) { 169 | $tmp2 = array_slice($tmp, 2); 170 | $count = count($tmp2); 171 | foreach ($tmp2 as $k => $v) { 172 | if (isset($field[$v])) { 173 | if ($k == ($count - 1)) { 174 | $output = $field[$v]; 175 | } else { 176 | $field = $field[$v]; 177 | } 178 | } 179 | } 180 | } else { 181 | $output = $field; 182 | } 183 | } // Template variable 184 | elseif ($field === null) { 185 | unset($tmp[0]); 186 | $tmp = preg_replace('/^tv\./', '', implode('.', $tmp)); 187 | $output = $resource->getTVValue($tmp); 188 | } 189 | } // No field specified - print the whole resource 190 | else { 191 | $output = $resource->toArray(); 192 | } 193 | } 194 | } // Global array tag 195 | else { 196 | switch (strtolower($tmp[0])) { 197 | case 'post': 198 | $array = $_POST; 199 | break; 200 | case 'get': 201 | $array = $_GET; 202 | break; 203 | case 'request': 204 | $array = $_REQUEST; 205 | break; 206 | case 'server': 207 | $array = $_SERVER; 208 | break; 209 | case 'files': 210 | $array = $_FILES; 211 | break; 212 | case 'cookie': 213 | $array = $_COOKIE; 214 | break; 215 | case 'session': 216 | $array = $_SESSION; 217 | break; 218 | default: 219 | $array = array(); 220 | $processed = false; 221 | } 222 | // Field specified 223 | if (!empty($tmp[1])) { 224 | $field = isset($array[$tmp[1]]) 225 | ? $array[$tmp[1]] 226 | : ''; 227 | $output = $field; 228 | if (is_array($field)) { 229 | if ($length > 2) { 230 | foreach ($tmp as $k => $v) { 231 | if ($k === 0) { 232 | continue; 233 | } 234 | if (isset($field[$v])) { 235 | $output = $field[$v]; 236 | } 237 | } 238 | } 239 | } 240 | } else { 241 | $output = $array; 242 | } 243 | if (is_string($output)) { 244 | $output = $this->modx->stripTags($output); 245 | } 246 | } 247 | break; 248 | } 249 | } 250 | 251 | // Processing output filters 252 | if ($processed) { 253 | if (strpos($outerTag, ':') !== false) { 254 | /** @var pdoTag $object */ 255 | $tag = new pdoTag($this->modx); 256 | $tag->_content = $output; 257 | $tag->setTag($outerTag); 258 | $tag->setToken($token); 259 | $tag->setContent(ltrim(rtrim($outerTag, ']'), '[!' . $token)); 260 | $tag->setCacheable(!$processUncacheable); 261 | $tag->process(); 262 | $output = $tag->_output; 263 | } 264 | if ($this->modx->getDebug() === true) { 265 | $this->modx->log(xPDO::LOG_LEVEL_DEBUG, 266 | "Processing {$outerTag} as {$innerTag}:\n" . print_r($output, 1) . "\n\n"); 267 | } 268 | // Print array 269 | if (is_array($output)) { 270 | $output = htmlentities(print_r($output, true), ENT_QUOTES, 'UTF-8'); 271 | } 272 | } else { 273 | $output = parent::processTag($tag, $processUncacheable); 274 | } 275 | 276 | return $output; 277 | } 278 | 279 | } 280 | 281 | 282 | class pdoTag extends modTag 283 | { 284 | /** 285 | * @param null $properties 286 | * @param null $content 287 | * 288 | * @return bool 289 | */ 290 | public function process($properties = null, $content = null) 291 | { 292 | $this->filterInput(); 293 | 294 | if ($this->modx->getDebug() === true) { 295 | $this->modx->log( 296 | xPDO::LOG_LEVEL_DEBUG, "Processing Element: " . $this->get('name') . 297 | ($this->_tag ? "\nTag: {$this->_tag}" : "\n") . 298 | "\nProperties: " . print_r($this->_properties, true) 299 | ); 300 | } 301 | if ($this->isCacheable() && isset($this->modx->elementCache[$this->_tag])) { 302 | $this->_output = $this->modx->elementCache[$this->_tag]; 303 | } else { 304 | $this->_output = $this->_content; 305 | $this->filterOutput(); 306 | } 307 | $this->_processed = true; 308 | 309 | return $this->_result; 310 | } 311 | 312 | 313 | /** 314 | * @return string 315 | */ 316 | public function getTag() 317 | { 318 | return $this->_tag; 319 | } 320 | 321 | } 322 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pdoTools", 3 | "description": "Small library for creating fast snippets for MODX Revolution that works through PDO", 4 | "devDependencies": { 5 | "grunt": "^1.0.1", 6 | "grunt-banner": "^0.6.0", 7 | "grunt-contrib-cssmin": "^1.0.2", 8 | "grunt-contrib-uglify": "^2.0.0", 9 | "grunt-contrib-watch": "^1.0.0" 10 | } 11 | } 12 | --------------------------------------------------------------------------------