コード例 #1
0
 static function parseViewData($view, $items)
 {
     $form = self::getRelatedFormForView($view);
     $parsed = array();
     foreach ($items as $item) {
         if (is_array($view["fields"])) {
             foreach ($view["fields"] as $key => $field) {
                 $value = $item[$key];
                 // If we have a parser, run it.
                 if ($field["parser"]) {
                     $item[$key] = BigTree::runParser($item, $value, $field["parser"]);
                     // If we know this field is a populated list, get the title they entered in the form.
                 } else {
                     if ($form["fields"][$key]["type"] == "list" && $form["fields"][$key]["options"]["list_type"] == "db") {
                         $fdata = $form["fields"][$key];
                         $f = sqlfetch(sqlquery("SELECT `" . $fdata["options"]["pop-description"] . "` FROM `" . $fdata["options"]["pop-table"] . "` WHERE `id` = '" . sqlescape($value) . "'"));
                         $value = $f[$fdata["options"]["pop-description"]];
                     }
                     $item[$key] = strip_tags($value);
                 }
             }
         }
         $parsed[] = $item;
     }
     return $parsed;
 }
コード例 #2
0
ファイル: custom.php プロジェクト: kurt-planet/BigTree-CMS
$q = sqlquery("SELECT * FROM " . $feed["table"] . " ORDER BY {$sort} LIMIT {$limit}");
while ($item = sqlfetch($q)) {
    foreach ($item as $key => $val) {
        if (is_array(json_decode($val, true))) {
            $item[$key] = BigTree::untranslateArray(json_decode($val, true));
        } else {
            $item[$key] = $cms->replaceInternalPageLinks($val);
        }
    }
    ?>
	<item>
		<?php 
    foreach ($feed["fields"] as $key => $options) {
        $value = $item[$key];
        if ($options["parser"]) {
            $value = BigTree::runParser($item, $value, $options["parser"]);
        }
        ?>
		<<?php 
        echo $key;
        ?>
><![CDATA[<?php 
        echo $value;
        ?>
]]></<?php 
        echo $key;
        ?>
>
		<?php 
    }
    ?>