Exemplo n.º 1
0
<?php

namespace Bewotec;

require __DIR__ . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'Cms.php';
// Create new extension - disabled
$zre = new \ZRayExtension('Bewotec');
$zre->setEnabledAfter('Zend\\Mvc\\Application::init');
$cms = new Cms();
// @TODO: Adjust the class name
$zre->traceFunction('Application\\Controller\\IndexController::indexAction', function ($context, &$storage) {
}, array($cms, 'onLeaveIndexAction'));
// Collect information for the requests
// @TODO: Adjust the class name
//$zre->traceFunction('<ActualClassName>::doRequest',
$zre->traceFunction('Application\\Service\\Remote::doRequest', function ($context, &$storage) {
}, array($cms, 'onLeaveDoRequest'));
// Summarize that information
$zre->traceFunction('Bewotec\\Cms::shutdown', function ($context, &$storage) {
}, array($cms, 'onLeaveShutdown'));
register_shutdown_function(array($cms, 'shutdown'));
$zre->setMetadata(array(array('logo' => __DIR__ . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'logo.png')));
Exemplo n.º 2
0
<?php

$zre = new \ZRayExtension("Oro");
$zre->setMetadata(array('logo' => __DIR__ . DIRECTORY_SEPARATOR . 'logo.png'));
$zre->setEnabledAfter('Oro\\Bundle\\DistributionBundle\\OroKernel::registerBundles');
$zre->traceFunction("Symfony\\Component\\HttpKernel\\Kernel::terminate", function () {
}, function ($context, &$storage) {
    $applicationContext = $context['this'];
    $container = $applicationContext->getContainer();
    $cm = $container->get('oro_config.global');
    $settingsFromAppConfig = $container->get('oro_config.config_definition_bag');
    $isInstalled = $container->hasParameter('installed') && $container->getParameter('installed');
    $currentConfiguration = [];
    if ($isInstalled) {
        foreach ($settingsFromAppConfig->all() as $bundleAlias => $settings) {
            foreach (array_keys($settings) as $settingName) {
                $key = implode('.', [$bundleAlias, $settingName]);
                $currentConfiguration[$key] = $cm->get($key);
            }
        }
    } else {
        $currentConfiguration['installed'] = false;
    }
    $storage['OroConfiguration'][] = $currentConfiguration;
});
Exemplo n.º 3
0
<?php

namespace AcploLog;

class AcploZray
{
    public function storeLog($context, &$storage)
    {
        $msg = $context["functionArgs"][0];
        list($usec, $sec) = explode(" ", microtime());
        $date = date("Y-m-d H:i:s", $sec) . substr($usec, 1);
        $storage['AcploLog'][] = array('date' => $date, 'message' => $msg);
    }
}
$acploStorage = new \AcploLog\AcploZray();
$acplolog = new \ZRayExtension("acplolog");
$acplolog->setMetadata(array('logo' => __DIR__ . DIRECTORY_SEPARATOR . 'logo.png'));
$acplolog->setEnabledAfter('Zend\\Mvc\\Application::init');
$acplolog->traceFunction("AcploLog\\Log\\StaticLogger::save", array($acploStorage, 'storeLog'), function () {
});
Exemplo n.º 4
0
            $item = strtolower($item) . '.php';
        });
        $reports = array();
        foreach ($folders as $folder) {
            $path = APPPATH . $folder . '/';
            $directoryIterator = new \RecursiveDirectoryIterator($path);
            foreach ($directoryIterator as $fileInfo) {
                if ($fileInfo->isFile() && in_array(strtolower($fileInfo->getFileName()), $loadedFiles)) {
                    $phpcsFile = $phpcs->processFile($fileInfo->getPathName());
                    $reportData = $phpcs->reporting->prepareFileReport($phpcsFile);
                    if (count($reportData['messages'])) {
                        foreach ($reportData['messages'] as $line => $_messages) {
                            foreach ($_messages as $message) {
                                foreach ($message as $msg) {
                                    $reports[] = array('filename' => str_replace(str_replace('\\', '/', FCPATH), '', str_replace('\\', '/', $reportData['filename'])), 'filepath' => $reportData['filename'], 'severity' => $msg['type'], 'line' => $line, 'message' => $msg['message']);
                                }
                            }
                        }
                    }
                }
            }
        }
        return $reports;
    }
}
$zre = new \ZRayExtension('CodeIgniter');
$zre->setEnabledAfter('CI_Loader::initialize');
$codeIgniter = new CodeIgniter();
$zre->traceFunction('CI_Output::_display', function () {
}, array($codeIgniter, 'init'));
$zre->setMetadata(array('logo' => __DIR__ . DIRECTORY_SEPARATOR . 'logo.png'));
Exemplo n.º 5
0
<?php

namespace OPcache;

require_once __DIR__ . DIRECTORY_SEPARATOR . 'OPcache.php';
$zre = new \ZRayExtension('opcache');
$zre->setMetadata(array('logo' => __DIR__ . DIRECTORY_SEPARATOR . 'logo.png'));
$opcache = new OPcache();
$zre->setEnabledAfter('session_start');
$zre->traceFunction('session_start', array($opcache, 'startup'), array($opcache, 'shutdown'));
Exemplo n.º 6
0
                        $storage['customPagePermissions'][] = array('Type' => $obj->getPermissionObjectKeyCategoryHandle(), 'Object' => $obj->getPermissionObjectIdentifier());
                    }
                    $lastobj = $obj;
                }
            }
        }
    }
}
require __DIR__ . '/objects.php';
// Create new extension - disabled
$zre = new \ZRayExtension('concrete5');
$concrete5 = new Zray();
// set additional data such as logo
$zre->setMetadata(array('logo' => __DIR__ . DIRECTORY_SEPARATOR . 'double_logo.png'));
// start tracing only when 'your_application_initial_method' is called, e.g. 'Mage::run()'
$zre->setEnabledAfter('Concrete\\Core\\Application\\Application::checkPageCache');
// start everything
$zre->traceFunction('Concrete\\Core\\Application\\Application::checkPageCache', array($concrete5, 'start'), function () {
});
// trace config values checked and what their value was
$zre->traceFunction('Illuminate\\Config\\Repository::get', function () {
}, array($concrete5, 'onAfterGetConfigValue'));
// trace blocks
$zre->traceFunction('Concrete\\Core\\Page\\View\\PageView::startRender', array($concrete5, 'onBeforePageRender'), function () {
});
// trace block render time
$zre->traceFunction('Concrete\\Core\\Block\\View\\BlockView::start', array($concrete5, 'onBeforeBlockRender'), function () {
});
$zre->traceFunction('Concrete\\Core\\Block\\View\\BlockView::finishRender', function () {
}, array($concrete5, 'onAfterBlockRender'));
// trace page requests
Exemplo n.º 7
0
<?php

$zre = new \ZRayExtension('MyWp');
$zre->setEnabledAfter('wp_cache_close');
$zre->traceFunction('wp_cache_close', function () {
}, function ($context, &$storage) {
    if (!function_exists('get_plugins')) {
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    $pluginsData = get_plugins();
    $activePlugins = get_option('active_plugins');
    if (is_array($pluginsData) && count($pluginsData) > 0) {
        foreach ($pluginsData as $pluginKey => $pluginData) {
            $storage['default_panels'][] = array('name' => $pluginData['Name'], 'version' => $pluginData['Version'], 'active' => in_array($pluginKey, $activePlugins) ? 'Active' : 'Inactive');
        }
    }
    // duplicate the data for the new panel
    $storage['clean_html'] = $storage['default_panels'];
    $storage['simple_table'] = $storage['default_panels'];
    $storage['search_and_paging'] = $storage['default_panels'];
    $storage['summary_table'] = $storage['default_panels'];
});
Exemplo n.º 8
0
    public function multExit($context, &$storage)
    {
        $storage['multiplyGeneralTree'][] = array('col1' => $context['functionArgs'][0], 'col2' => 'val2', 'params' => array(array('col1' => 'val1.1', 'col2' => 'val2.1', 'params' => 'aaa'), array('col1' => 'val1.2', 'col2' => 'val2.2', 'params' => 'bbb')));
    }
    public function productsExit($context, &$storage)
    {
        foreach ($context['returnValue'] as $product) {
            $storage['defaultTable'][] = $product;
            $storage['products'][$product['name']] = $product;
        }
    }
}
$zraySamples = new Samples();
$zre = new \ZRayExtension('Samples');
// enable the extension when this method called
$zre->setEnabledAfter('Samples::run');
// bind to run method
$zre->traceFunction('Samples::run', array($zraySamples, 'runEnter'), function () {
});
// bind to mult method
$zre->traceFunction('Samples::mult', function () {
}, array($zraySamples, 'multExit'));
// bind to mult method
$zre->traceFunction('Samples::getProducts', function () {
}, array($zraySamples, 'productsExit'));
// bind to stats method
$zre->traceFunction('Samples::stats', function ($context, &$storage) {
    $storage['stats'][] = array('name' => $context['functionArgs'][0], 'count' => $context['functionArgs'][1]);
}, function () {
});
// set the logo for default panels