/** * Execute the task * * @param array $taskData Task data * * @return bool True on success, false otherwise */ public function run($taskData) { $languages = NenoHelper::getLanguages(); $defaultLanguage = NenoSettings::get('source_language'); $profiler = new JProfiler(); foreach ($languages as $language) { if ($language->lang_code !== $defaultLanguage) { $profiler->mark('Before create job' . $language->lang_code . ' Method: Machine'); $machineJob = NenoJob::createJob($language->lang_code, NenoContentElementTranslation::MACHINE_TRANSLATION_METHOD); $profiler->mark('After create job' . $language->lang_code . ' Method: Machine'); // If there are translations for this language and for this translation method if ($machineJob !== null) { NenoLog::add(count($machineJob->getTranslations()) . ' translations have been found to translate through machine translation'); } $proJob = NenoJob::createJob($language->lang_code, NenoContentElementTranslation::PROFESSIONAL_TRANSLATION_METHOD); // If there are translations for this language and for this translation method if ($proJob !== null) { NenoLog::add(count($proJob->getTranslations()) . ' translations have been found to translate through professional translation'); } if ($machineJob !== null || $proJob !== null) { NenoTaskMonitor::addTask('job_sender'); } } } }
/** * Rendering is the process of pushing the document buffers into the template * placeholders, retrieving data from the document and pushing it into * the application response buffer. * * @return void * * @since 3.2 */ protected function render() { // Setup the document options. $this->docOptions['template'] = $this->get('theme'); $this->docOptions['file'] = $this->get('themeFile', 'index.php'); $this->docOptions['params'] = $this->get('themeParams'); if ($this->get('themes.base')) { $this->docOptions['directory'] = $this->get('themes.base'); } else { $this->docOptions['directory'] = defined('JPATH_THEMES') ? JPATH_THEMES : (defined('JPATH_BASE') ? JPATH_BASE : __DIR__) . '/themes'; } // Parse the document. $this->document->parse($this->docOptions); // Trigger the onBeforeRender event. JPluginHelper::importPlugin('system'); $this->triggerEvent('onBeforeRender'); $caching = false; if ($this->isSite() && $this->get('caching') && $this->get('caching', 2) == 2 && !JFactory::getUser()->get('id')) { $caching = true; } // Render the document. $data = $this->document->render($caching, $this->docOptions); // Set the application output data. $this->setBody($data); // Trigger the onAfterRender event. $this->triggerEvent('onAfterRender'); // Mark afterRender in the profiler. JDEBUG ? $this->profiler->mark('afterRender') : null; }
$_view = 'others'; } $show_in_views = $params->get('show_in_views', array()); $show_in_views = !is_array($show_in_views) ? array($show_in_views) : $show_in_views; $views_show_mod = !count($show_in_views) || in_array($_view, $show_in_views); if ($params->get('enable_php_rule', 0)) { $php_show_mod = eval($params->get('php_rule')); $show_mod = $params->get('combine_show_rules', 'AND') == 'AND' ? $views_show_mod && $php_show_mod : $views_show_mod || $php_show_mod; } else { $show_mod = $views_show_mod; } if ($show_mod) { global $modfc_jprof; jimport('joomla.error.profiler'); $modfc_jprof = new JProfiler(); $modfc_jprof->mark('START: FLEXIcontent Module'); global $mod_fc_run_times; $mod_fc_run_times = array(); // Logging Info variables global $fc_content_plg_microtime; $fc_content_plg_microtime = 0; // load english language file for 'mod_flexicontent' module then override with current language file JFactory::getLanguage()->load('mod_flexicontent', JPATH_SITE, 'en-GB', true); JFactory::getLanguage()->load('mod_flexicontent', JPATH_SITE, null, true); // initialize various variables global $globalcats; $document = JFactory::getDocument(); $caching = $app->getCfg('caching', 0); // include the helper only once require_once dirname(__FILE__) . DS . 'helper.php'; // Verify parameters (like forced menu item id and comments showing)
$_view = 'others'; } $show_in_views = $params->get('show_in_views', array()); $show_in_views = !is_array($show_in_views) ? array($show_in_views) : $show_in_views; $views_show_mod = !count($show_in_views) || in_array($_view, $show_in_views); if ($params->get('enable_php_rule', 0)) { $php_show_mod = eval($params->get('php_rule')); $show_mod = $params->get('combine_show_rules', 'AND') == 'AND' ? $views_show_mod && $php_show_mod : $views_show_mod || $php_show_mod; } else { $show_mod = $views_show_mod; } if ($show_mod) { global $modfc_jprof; jimport('joomla.error.profiler'); $modfc_jprof = new JProfiler(); $modfc_jprof->mark('START: FLEXIcontent Filter-Search Module'); // load english language file for 'mod_flexifilter' module then override with current language file JFactory::getLanguage()->load('mod_flexifilter', JPATH_SITE, 'en-GB', true); JFactory::getLanguage()->load('mod_flexifilter', JPATH_SITE, null, true); // initialize various variables $document = JFactory::getDocument(); $caching = $app->getCfg('caching', 0); // include the helper only once require_once dirname(__FILE__) . DS . 'helper.php'; // Other parameters $moduleclass_sfx = $params->get('moduleclass_sfx', ''); $layout = $params->get('layout', 'default'); $add_ccs = $params->get('add_ccs', 1); $add_tooltips = $params->get('add_tooltips', 1); $autosubmit = $params->get('filter_autosubmit', 0); // current & default category IDs
$db = JFactory::getDbo(); $config = JCckDev::init(); $cck = JCckDev::preload(array('')); $doc = JFactory::getDocument(); $profiler = new JProfiler(); // -- DEBUG:START -- // $js = ''; $js2 = ''; $js_script = ''; $js_script = JURI::root(true) . $js_script; echo '<br /><div style="color: #999999; font-size: 10px; font-weight: bold;">-------- Debug --------<br />'; // -------- -------- -------- -------- -------- -------- -------- -------- // $n = 10000; $profiler = new JProfiler(); for ($i = 0; $i < $n; $i++) { // } $profiler_res = $profiler->mark('afterDebug'); // -------- -------- -------- -------- -------- -------- -------- -------- // if ($js_script) { $doc->addScript($js_script); } if ($js || $js2) { echo '<input text id="toto" name="toto" value="" />' . '<input text id="toto2" name="toto2" value="" />'; $doc->addScriptDeclaration('jQuery(document).ready(function($) {' . $js . '});' . $js2); } echo '<br />' . $profiler_res . '<br />-------- Debug --------<br /></div>'; // -- DEBUG:END -- // /* $log = JLog::addLogger( array( 'format'=>'{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}', 'text_file'=>'com_cck.php' ) ); */
// Initialize some variables // ************************* global $is_fc_component; $is_fc_component = 1; // Get component parameters and add tooltips css and js code $cparams = JComponentHelper::getParams('com_flexicontent'); $print_logging_info = $cparams->get('print_logging_info'); if ($print_logging_info) { global $fc_run_times; $fc_run_times['render_field'] = array(); $fc_run_times['render_subfields'] = array(); $start_microtime = microtime(true); global $fc_jprof; jimport('joomla.error.profiler'); $fc_jprof = new JProfiler(); $fc_jprof->mark('START: FLEXIcontent component'); } $force_print = false; /*if (JRequest::getCmd('format', null)!="raw") { $session = JFactory::getSession(); $postinst_integrity_ok = $session->get('flexicontent.postinstall'); $recheck_aftersave = $session->get('flexicontent.recheck_aftersave'); $force_print = $postinst_integrity_ok===NULL || $postinst_integrity_ok===false || $recheck_aftersave; }*/ // ******************************** // Load needed helper/classes files // ******************************** //include constants file require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'defineconstants.php'; // Enable printing of notices,etc, except strict if error_reporting is enabled if (!FLEXI_J16GE && error_reporting() && ini_get('display_errors')) {
$_view = 'others'; } $show_in_views = $params->get('show_in_views', array()); $show_in_views = !is_array($show_in_views) ? array($show_in_views) : $show_in_views; $views_show_mod = !count($show_in_views) || in_array($_view, $show_in_views); if ($params->get('enable_php_rule', 0)) { $php_show_mod = eval($params->get('php_rule')); $show_mod = $params->get('combine_show_rules', 'AND') == 'AND' ? $views_show_mod && $php_show_mod : $views_show_mod || $php_show_mod; } else { $show_mod = $views_show_mod; } if ($show_mod) { global $modfc_jprof; jimport('joomla.error.profiler'); $modfc_jprof = new JProfiler(); $modfc_jprof->mark('START: FLEXIcontent Tags Cloud Module'); // load english language file for 'mod_flexitagcloud' module then override with current language file JFactory::getLanguage()->load('mod_flexitagcloud', JPATH_SITE, 'en-GB', true); JFactory::getLanguage()->load('mod_flexitagcloud', JPATH_SITE, null, true); // initialize various variables $document = JFactory::getDocument(); $caching = $app->getCfg('caching', 0); // include the helper only once require_once dirname(__FILE__) . DS . 'helper.php'; // get module's basic display parameters $add_ccs = $params->get('add_ccs', 1); $layout = $params->get('layout', 'default'); // Add css if ($add_ccs) { if ($caching && !FLEXI_J16GE) { // Work around for caching bug in J1.5
/** * Set profiler mark * @param string $name */ public function mark($name = '') { if (self::$_jbdump !== null && method_exists(self::$_jbdump, 'mark')) { self::$_jbdump->mark($name); } }
$this->_param = $param; } public static function getInstance($param) { return new TestClass($param); } } // Using Reflection $p = new JProfiler(); for ($i = 0; $i < 10000; $i++) { $class = new ReflectionClass('TestClass'); $method = $class->getMethod('getInstance'); $instance = $method->invoke(null, 'Some param'); } $p->mark('Using Reflection'); var_dump($p->getBuffer()); // Using shortened Reflection $p = new JProfiler(); for ($i = 0; $i < 10000; $i++) { $method = new ReflectionMethod('TestClass', 'getInstance'); $instance = $method->invoke(null, 'Some param'); } $p->mark('Using shortened Reflection'); var_dump($p->getBuffer()); // Using call_user_func $p = new JProfiler(); for ($i = 0; $i < 10000; $i++) { $instance = call_user_func(array('TestClass', 'getInstance'), 'Some param'); } $p->mark('Using call_user_func()'); var_dump($p->getBuffer());
* @license GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html> * @link http://www.koowa.org */ /** * Compares the performance of ReflectionObject::getMethods() vs * get_class_methods() * * @todo Replace JProfiler with KProfiler * * @author Mathias Verraes <*****@*****.**> */ jimport('joomla.error.profiler'); $methods = array(); $p = new JProfiler(); for ($i = 0; $i < 10000; $i++) { $r = new ReflectionObject($this); foreach ($r->getMethods() as $method) { $methods[$method->name] = $this; } } $p->mark('Using Reflection'); var_dump($p->getBuffer()); $methods = array(); $p = new JProfiler(); for ($i = 0; $i < 10000; $i++) { foreach (get_class_methods($this) as $method) { $methods[$method] = $this; } } $p->mark('Using get_class_methods()'); var_dump($p->getBuffer());
* @link http://www.koowa.org */ /** * Compares the performance of generating a new object vs cloning * * @todo Replace JProfiler with KProfiler * * @author Mathias Verraes <*****@*****.**> */ jimport('joomla.error.profiler'); $config['table'] = KFactory::get('TestTableCustomers'); $prefix = 'test'; $suffix = 'customers'; $data = array('test_customer_id' => '2', 'name' => 'Bob', 'company' => 'BuildingCo', 'user_id' => '0'); // New KRow Object $p = new JProfiler(); for ($i = 0; $i < 10000; $i++) { $row = KFactory::getInstance('DatabaseRow', $prefix, $suffix, $config, null); $row->setProperties($data); } $p->mark('New KRow object'); var_dump($p->getBuffer()); // Clone KRow Object $p = new JProfiler(); $row = KFactory::getInstance('DatabaseRow', $prefix, $suffix, $config, null); for ($i = 0; $i < 10000; $i++) { $row1 = clone $row; $row1->setProperties($data); } $p->mark('Clone KRow object'); var_dump($p->getBuffer());