$scriptProperties['scheme'] = $pageNavScheme; } if (!empty($cache_expires)) { $scriptProperties['cacheTime'] = $cache_expires; } //--- $isAjax = !empty($ajax) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'; if ($isAjax && !isset($_REQUEST[$pageVarKey])) { return; } /** @var pdoPage $pdoPage */ if (!$modx->loadClass('pdotools.pdoPage', MODX_CORE_PATH . 'components/pdotools/model/', false, true)) { $modx->log(modX::LOG_LEVEL_ERROR, 'Could not load pdoPage from "MODX_CORE_PATH/components/pdotools/model/".'); return false; } $pdoPage = new pdoPage($modx, $scriptProperties); $pdoPage->pdoTools->addTime('pdoTools loaded'); // Page if (isset($_REQUEST[$pageVarKey]) && (!is_numeric($_REQUEST[$pageVarKey]) || $_REQUEST[$pageVarKey] <= 1 && !$isAjax)) { return $pdoPage->redirectToFirst($isAjax); } elseif (!empty($_REQUEST[$pageVarKey])) { $page = (int) $_REQUEST[$pageVarKey]; } $scriptProperties['page'] = $page; $scriptProperties['request'] = $_REQUEST; // Limit if (isset($_REQUEST['limit'])) { if (is_numeric($_REQUEST['limit']) && abs($_REQUEST['limit']) > 0) { $scriptProperties['limit'] = abs($_REQUEST['limit']); } else { unset($_GET['limit']);
$scriptProperties['scheme'] = $pageNavScheme; } if (!empty($cache_expires)) { $scriptProperties['cacheTime'] = $cache_expires; } //--- $isAjax = !empty($scriptProperties['ajax']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'; if ($isAjax && !isset($_REQUEST[$pageVarKey])) { return; } /** @var pdoPage $pdoPage */ if (!$modx->loadClass('pdotools.pdoPage', MODX_CORE_PATH . 'components/pdotools/model/', false, true)) { $modx->log(modX::LOG_LEVEL_ERROR, 'Could not load pdoPage from "MODX_CORE_PATH/components/pdotools/model/".'); return false; } $pdoPage = new pdoPage($modx, $scriptProperties); $pdoPage->pdoTools->addTime('pdoTools loaded'); // Script and styles if (!$isAjax && !empty($scriptProperties['ajaxMode'])) { $pdoPage->loadJsCss(); } // Removing of default scripts and styles so they do not overwrote nested snippet parameters if ($snippet = $modx->getObject('modSnippet', array('name' => 'pdoPage'))) { $properties = $snippet->get('properties'); if ($scriptProperties['frontend_js'] == $properties['frontend_js']['value']) { unset($scriptProperties['frontend_js']); } if ($scriptProperties['frontend_css'] == $properties['frontend_css']['value']) { unset($scriptProperties['frontend_css']); } }