Last active
April 26, 2019 06:59
-
-
Save sergant210/7a60007de6dba7be0f61b6fd0f2a56e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Файл поиска использования метода getOption. | |
* Должен находится в корне сайта. | |
*/ | |
define('MODX_API_MODE', true); | |
require 'index.php'; | |
$modx->lexicon->load('resource','context','element','system_events','access','default','setting'); | |
//echo $modx->lexicon('setting_cache_context_settings'); exit; | |
$count = 0; | |
ob_start(); | |
foreach (['model/', 'xpdo/'] as $folder) { | |
$directory = new RecursiveDirectoryIterator(dirname(__FILE__) . '/core/' . $folder); | |
$iterator = new RecursiveIteratorIterator($directory); | |
foreach ($iterator as $object) { | |
if ($object->isFile() && $object->getExtension() == 'php') { | |
$content = file_get_contents($object->getPathname()); | |
if (preg_match_all('#(modx|xpdo|this)->getOption\([\'"]?([A-z0-9._:]+)[\'"]?.*\)#', $content, $matches)) { | |
$options = array_filter($matches[2], function ($option) use ($modx) { | |
// Раскомментировать для вывода настроек, у которых есть лексиконы | |
// Uncomment to get system settings that have lexicons | |
return !isset($modx->config[$option]); // && $modx->lexicon('setting_' . $option) != 'setting_' . $option; | |
}); | |
if (!empty($options)) { | |
$count += count($options); | |
echo '<h3>'. str_replace('D:\Projects\test.local\www/', '', $object->getPathname()).'<h3>'; | |
echo "<pre>"; | |
dump(array_unique($options)); | |
echo "</pre>"; | |
} | |
} | |
} | |
} | |
} | |
$output = ob_get_clean(); | |
ob_flush(); | |
echo "<h3>Всего {$count} записей!<h3>"; | |
echo $output; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment