function grab($param = array()) { extract($this->_env, EXTR_PREFIX_ALL, 'env'); include_once TOOLKIT . '/class.entrymanager.php'; $entryManager = new EntryManager($this->_parent); $section_id = $entryManager->fetchSectionIDFromHandle($this->__resolveDefine("dsFilterPARENTSECTION")); $schema = $entryManager->fetchEntryFieldSchema($section_id, NULL, $this->_dsFilterCUSTOMFIELD); $schema = $schema[0]; ##Check the cache $hash_id = md5(get_class($this)); if ($param['caching'] && ($cache = $this->check_cache($hash_id))) { return $cache; exit; } ##------------------------------ ##Create the XML container $xml = new XMLElement("categories-list"); $xml->setAttribute("section", "customfield"); ##Populate the XML if (empty($schema) || !is_array($schema)) { $xml->addChild(new XMLElement("error", "No Records Found.")); return $xml; } else { $ops = preg_split('/,/', $schema['values'], -1, PREG_SPLIT_NO_EMPTY); $ops = array_map("trim", $ops); $xml->addChild(new XMLElement("name", $schema['name'])); $xml->setAttribute("handle", $schema['handle']); $options = new XMLElement("options"); foreach ($ops as $o) { if ($schema['type'] == 'multiselect') { $table = 'tbl_entries2customfields_list'; } else { $table = 'tbl_entries2customfields'; } $count = $this->_db->fetchVar('count', 0, "SELECT count(id) AS `count` FROM `{$table}` WHERE `field_id` = '" . $schema['id'] . "' AND value_raw = '{$o}' "); $xO = new XMLElement("option", $o); $xO->setAttribute('entry-count', $count); $xO->setAttribute('handle', Lang::createHandle($o, $this->_parent->getConfigVar('handle_length', 'admin'))); $options->addChild($xO); } $xml->addChild($options); } ##------------------------------ ##Write To Cache if ($param['caching']) { $result = $xml->generate($param['indent'], $param['indent-depth']); $this->write_to_cache($hash_id, $result, $this->_cache_sections); return $result; } return $xml; }
$about = $TFM->about($fields['formatter']); $entry_formatter = $about['name']; $about = $TFM->about($Admin->getAuthorTextFormatter()); $author_formatter = $about['name']; unset($TFM); if ($entry_formatter != $author_formatter) { $Admin->pageAlert("diff-formatter", array($entry_formatter ? $entry_formatter : "raw XHTML", $author_formatter ? $author_formatter : "raw XHTML"), false, 'error'); } } if (!empty($_POST['fields'])) { $fields = $_POST['fields']; $date->set(strtotime($fields["time"] . " " . $fields['publish_date'])); } else { $date->set($fields['timestamp_gmt'], false); } $upload_fields = $entryManager->fetchEntryFieldSchema($_REQUEST['_sid'], array('upload')); foreach ($upload_fields as $row) { if ($row['type'] == 'upload' && !@is_writable(DOCROOT . "/" . $row['destination_folder'])) { $Admin->fatalError("Upload Path Not Writable", "<p>The upload path <code>" . $row['destination_folder'] . "</code>, used by your '" . $row['name'] . "' upload custom field, is not writable and needs to be corrected before you can publish to this section.</p>", true, true); exit; } } $field_schema = $entryManager->fetchEntryFieldSchema($section_id); $drawer = createMarkupForLocation("drawer", $fields, $field_schema); $sidebar = createMarkupForLocation("sidebar", $fields, $field_schema); $main_content = createMarkupForLocation("main", $fields, $field_schema); ?> <form id="entry" action="<?php print $Admin->getCurrentPageURL() . "&id=" . $entry_id . "&_sid=" . $section_id; ?>
$Admin->pageAlert("required", array(ucwords(@implode(", ", $required))), false, 'error'); } if (!empty($_POST)) { $fields = $_POST['fields']; $fields['static_xml'] = General::sanitize($fields['static_xml']); } else { $fields = array(); $fields['format_type'] = 'list'; $fields['max_records'] = 50; $fields['page_number'] = 1; } include_once TOOLKIT . "/class.entrymanager.php"; $EM = new EntryManager($Admin); $can_use_customfield_source = false; foreach ($sections as $s) { $schema = $EM->fetchEntryFieldSchema($s['id'], array("select", "multiselect")); if (is_array($schema) && !empty($schema)) { $can_use_customfield_source = true; break 1; } } ?> <form id="settings" action="" method="post"> <h2>Untitled</h2> <fieldset> <fieldset> <legend>Essentials</legend> <div class="group"> <label>Name <input name="fields[name]" <?php