**/ ?>

コンテンツ表示の流れ

コンテツが表示されるまでの流れ

プラグインを実行してるタイミングが今一つ、理解できない~(涙

 ※プラグインからプラグイン({{{~ で記述されたプラグイン)を実行したくなったため。

 ※プラグインそのものの実行は PHPのeval関数で実行されてる

 

1:template.htm で

<?php echo content();?>

 ↓

function content() : cmsimple/tplfuncs.php
    global $s, $o, $c, $edit,  $cf;
    で rerturn $o でコンテンツ返す

 

cmsimple/cms.php で

if (!($edit && XH_ADM) && $s > -1) {
    $c[$s] = evaluate_scripting($c[$s]);  // ココで実行してる?

 


 

cmsimple/function.php

evaluate_scripting :Returns a text with CMSimple scripting and plugin calls evaluated.

function evaluate_scripting($text, $compat = true)
{
// @codingStandardsIgnoreEnd
    return evaluate_cmsimple_scripting(evaluate_plugincall($text), $compat);
}

 

evaluate_cmsimple_scripting 評価されたテキストを返す
 evalあり
 hide の処理?
 function evaluate_cmsimple_scripting($__text, $__compat = true)

  

evaluate_plugincall :Returns a text with all plugin calls evaluatated. 
 これを呼び出せば

preCallPlugins $c[$as] = evaluate_plugincall($c[$as])

 

/**
 * Returns a text with all plugin calls evaluatated.
 *
 * All Plugins which are called through a function-call
 * can use this. At the moment it is not possible to do
 * this with class-based plugins. They need to be called
 * through standard-CMSimple-Scripting. Alternatively one
 * can offer a functional wrapper.
 *
 * To call a plugin, place the following on a CMSimple_XH page (example):
 * Function pluginfunction() が定義されてません!
 *
 * About the scope rules see {@link XH_evaluateSinglePluginCall}.
 *
 * @param string $text The text.
 *
 * @return string
 *
 * @global array The localization of the core.
 *
 * @since 1.5
 */
// @codingStandardsIgnoreStart
function evaluate_plugincall($text)
{
// @codingStandardsIgnoreEnd
    global $tx;
    $message = '<span class="xh_fail">' . $tx['error']['plugincall']
        . '</span>';
    $re = '/{{{(?:PLUGIN:)?([a-z_0-9]+)\s*\(?(.*?)\)?;?}}}/iu';
    preg_match_all($re, $text, $calls, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
    $results = array();
    foreach ($calls as $call) {
        $arguments = preg_replace(
            array(
                '/&(quot|#34);/i', '/&(amp|#38);/i', '/&(apos|#39);/i',
                '/&(lt|#60);/i', '/&(gt|#62);/i', '/&(nbsp|#160);/i'
            ),
            array('"', '&', '\'', '<', '>', ' '),
            $call[2][0]
        );
        $function = $call[1][0];
        if (function_exists($function)) {
            $results[] = XH_evaluateSinglePluginCall(
                $function . '(' . $arguments . ')'
            );
        } else {
            $results[] = sprintf($message, $function);
        }
    }
    $calls = array_reverse($calls);
    $results = array_reverse($results);
    foreach ($calls as $i => $call) {
        $length = strlen($call[0][0]);
        $offset = $call[0][1];
        XH_spliceString($text, $offset, $length, $results[$i]);
    }
    return $text;
}