Skip to content

Instantly share code, notes, and snippets.

@exside
Forked from christianhanvey/modx object examiner
Created March 2, 2013 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save exside/5073335 to your computer and use it in GitHub Desktop.
Save exside/5073335 to your computer and use it in GitHub Desktop.
<?php
/**
* File viewRevoObjects.php (requires MODx Revolution 2.1)
* Created on: 9/17/11 at 9:49 AM
* Project shawn_wilkerson
* @elements
* @version 1.0
* @category
* @author W. Shawn Wilkerson
* @link http://www.shawnWilkerson.com
* @copyright Copyright (c) 2011, Sanity LLC. All rights reserved.
* @license
*
*/
if (!function_exists('retrieveObject')) {
function retrieveObject($name)
{
$rt = '';
global $modx;
$tblName = 'mod' . $name;
$rt .= '<h1>' . $tblName . ' ([[++settings_version]])</h1>';
$rt .= '<h2>Table Fields</h2>';
$rt .= '<pre>' . print_r($modx->getFields($tblName), true) . '</pre>';
$rt .= '<h2>Table Construction (meta defined in schema)</h2>';
$rt .= '<pre>' . print_r($modx->getFieldMeta($tblName), true) . '</pre>';
$rt .= '<h2>Aggregate Relations</h2>';
$rt .= '<pre>' . print_r($modx->getAggregates($tblName), true) . '</pre>';
$rt .= '<h2>Composite Relations</h2>';
$rt .= '<pre>' . print_r($modx->getComposites($tblName), true) . '</pre>';
$rt .= '<h2>Ancestors</h2>';
$rt .= '<pre>' . print_r($modx->getAncestry($tblName), true) . '</pre>';
return $rt;
}
}
$wsw = '';
$modxObjects = array('Chunk', 'Plugin', 'Resource', 'Snippet', 'Template', 'TemplateVar', 'User');
$objType = $modx->getOption('objectType', $scriptProperties, 'User');
if ($objType == "ALL") {
foreach ($modxObjects as $name) {
$wsw .= retrieveObject($name);
}
} else {
if (in_array($objType, $modxObjects)) {
$wsw = retrieveObject($objType);
}
}
$wsw = str_replace(array('(', ')', 'Array'), '', $wsw);
return $wsw;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment