本文整理汇总了PHP中XMLElement::setSelfClosingTag方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLElement::setSelfClosingTag方法的具体用法?PHP XMLElement::setSelfClosingTag怎么用?PHP XMLElement::setSelfClosingTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLElement
的用法示例。
在下文中一共展示了XMLElement::setSelfClosingTag方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addScriptToHead
function addScriptToHead($path, $position = NULL)
{
$script = new XMLElement('script');
$script->setSelfClosingTag(false);
$script->setAttributeArray(array('type' => 'text/javascript', 'src' => $path));
return $this->addElementToHead($script, $position);
}
示例2: addScriptToHead
public function addScriptToHead($path, $position = NULL, $duplicate = true)
{
if ($duplicate === true || $duplicate === false && $this->checkElementsInHead($path, 'src') !== true) {
$script = new XMLElement('script');
$script->setSelfClosingTag(false);
$script->setAttributeArray(array('type' => 'text/javascript', 'src' => $path));
return $this->addElementToHead($script, $position);
}
}
示例3: list
function __SelectBuildOption($option)
{
list($value, $selected, $desc, $class, $id, $attr) = $option;
if (!$desc) {
$desc = $value;
}
$obj = new XMLElement('option', "{$desc}");
$obj->setSelfClosingTag(false);
$obj->setAttribute('value', "{$value}");
if (!empty($class)) {
$obj->setAttribute('class', $class);
}
if (!empty($id)) {
$obj->setAttribute('id', $id);
}
if (!empty($attr)) {
$obj->setAttributeArray($attr);
}
if ($selected) {
$obj->setAttribute('selected', 'selected');
}
return $obj;
}
示例4: view
function view()
{
$this->appendSubheading(__('Components'));
$utilities = General::listStructure(UTILITIES, array('xsl'), false, 'asc', UTILITIES);
$utilities = $utilities['filelist'];
$ul = new XMLElement('ul');
$ul->setAttribute('id', 'components');
$ul->setAttribute('class', 'triple group');
### EVENTS ###
$EventManager = new EventManager($this->_Parent);
$events = $EventManager->listAll();
$li = new XMLElement('li');
$h3 = new XMLElement('h3', __('Events'));
$h3->appendChild(Widget::Anchor(__('Create New'), URL . '/symphony/blueprints/events/new/', __('Create a new event'), 'create button'));
$li->appendChild($h3);
$list = new XMLElement('ul');
$list->setSelfClosingTag(false);
if (is_array($events) && !empty($events)) {
foreach ($events as $e) {
$item = new XMLElement('li');
$item->appendChild(Widget::Anchor($e['name'], URL . '/symphony/blueprints/events/' . ($e['can_parse'] ? 'edit' : 'info') . '/' . strtolower($e['handle']) . '/', 'event.' . $e['handle'] . '.php'));
$item->setAttribute('class', 'external');
$list->appendChild($item);
}
}
$li->appendChild($list);
$ul->appendChild($li);
######
### DATASOURCES ###
$DSManager = new DatasourceManager($this->_Parent);
$datasources = $DSManager->listAll();
$li = new XMLElement('li');
$h3 = new XMLElement('h3', __('Data Sources'));
$h3->appendChild(Widget::Anchor(__('Create New'), URL . '/symphony/blueprints/datasources/new/', __('Create a new data source'), 'create button'));
$li->appendChild($h3);
$list = new XMLElement('ul');
$list->setSelfClosingTag(false);
if (is_array($datasources) && !empty($datasources)) {
foreach ($datasources as $ds) {
$item = new XMLElement('li');
if ($ds['can_parse']) {
$item->appendChild(Widget::Anchor($ds['name'], URL . '/symphony/blueprints/datasources/edit/' . strtolower($ds['handle']) . '/', 'data.' . $ds['handle'] . '.php'));
} else {
$item->appendChild(Widget::Anchor($ds['name'], URL . '/symphony/blueprints/datasources/info/' . strtolower($ds['handle']) . '/', 'data.' . $ds['handle'] . '.php'));
}
$list->appendChild($item);
}
}
$li->appendChild($list);
$ul->appendChild($li);
######
### UTILITIES ###
$li = new XMLElement('li');
$h3 = new XMLElement('h3', __('Utilities'));
$h3->appendChild(Widget::Anchor(__('Create New'), URL . '/symphony/blueprints/utilities/new/', __('Create a new utility'), 'create button'));
$li->appendChild($h3);
$list = new XMLElement('ul');
$list->setSelfClosingTag(false);
if (is_array($utilities) && !empty($utilities)) {
foreach ($utilities as $u) {
$item = new XMLElement('li');
$item->appendChild(Widget::Anchor($u, URL . '/symphony/blueprints/utilities/edit/' . str_replace('.xsl', '', $u) . '/'));
$list->appendChild($item);
}
}
$li->appendChild($list);
$ul->appendChild($li);
######
$this->Form->appendChild($ul);
}
示例5: prepareAssociationsDrawer
/**
* Prepare a Drawer to visualize section associations
*
* @param Section $section The current Section object
* @throws InvalidArgumentException
* @throws Exception
*/
private function prepareAssociationsDrawer($section)
{
$entry_id = !is_null($this->_context['entry_id']) ? $this->_context['entry_id'] : null;
$show_entries = Symphony::Configuration()->get('association_maximum_rows', 'symphony');
if (is_null($entry_id) && !isset($_GET['prepopulate']) || is_null($show_entries) || $show_entries == 0) {
return;
}
$parent_associations = SectionManager::fetchParentAssociations($section->get('id'), true);
$child_associations = SectionManager::fetchChildAssociations($section->get('id'), true);
$content = null;
$drawer_position = 'vertical-right';
/**
* Prepare Associations Drawer from an Extension
*
* @since Symphony 2.3.3
* @delegate PrepareAssociationsDrawer
* @param string $context
* '/publish/'
* @param integer $entry_id
* The entry ID or null
* @param array $parent_associations
* Array of Sections
* @param array $child_associations
* Array of Sections
* @param string $drawer_position
* The position of the Drawer, defaults to `vertical-right`. Available
* values of `vertical-left, `vertical-right` and `horizontal`
*/
Symphony::ExtensionManager()->notifyMembers('PrepareAssociationsDrawer', '/publish/', array('entry_id' => $entry_id, 'parent_associations' => &$parent_associations, 'child_associations' => &$child_associations, 'content' => &$content, 'drawer-position' => &$drawer_position));
// If there are no associations, return now.
if ((is_null($parent_associations) || empty($parent_associations)) && (is_null($child_associations) || empty($child_associations))) {
return;
}
if (!$content instanceof XMLElement) {
$content = new XMLElement('div', null, array('class' => 'content'));
$content->setSelfClosingTag(false);
// Process Parent Associations
if (!is_null($parent_associations) && !empty($parent_associations)) {
foreach ($parent_associations as $as) {
if ($field = FieldManager::fetch($as['parent_section_field_id'])) {
if (isset($_GET['prepopulate'])) {
$prepopulate_field = key($_GET['prepopulate']);
}
// get associated entries if entry exists,
if ($entry_id) {
$entry_ids = $field->findParentRelatedEntries($as['child_section_field_id'], $entry_id);
// get prepopulated entry otherwise
} elseif (isset($_GET['prepopulate'])) {
$entry_ids = array(intval(current($_GET['prepopulate'])));
} else {
$entry_ids = array();
}
// Use $schema for perf reasons
$schema = array($field->get('element_name'));
$where = !empty($entry_ids) ? sprintf(' AND `e`.`id` IN (%s)', implode(', ', $entry_ids)) : null;
$entries = !empty($entry_ids) || isset($_GET['prepopulate']) && $field->get('id') === $prepopulate_field ? EntryManager::fetchByPage(1, $as['parent_section_id'], $show_entries, $where, null, false, false, true, $schema) : array();
$has_entries = !empty($entries) && $entries['total-entries'] != 0;
if ($has_entries) {
$element = new XMLElement('section', null, array('class' => 'association parent'));
$header = new XMLElement('header');
$header->appendChild(new XMLElement('p', __('Linked to %s in', array('<a class="association-section" href="' . SYMPHONY_URL . '/publish/' . $as['handle'] . '/">' . $as['name'] . '</a>'))));
$element->appendChild($header);
$ul = new XMLElement('ul', null, array('class' => 'association-links', 'data-section-id' => $as['child_section_id'], 'data-association-ids' => implode(', ', $entry_ids)));
foreach ($entries['records'] as $e) {
// let the field create the mark up
$li = $field->prepareAssociationsDrawerXMLElement($e, $as);
// add it to the unordered list
$ul->appendChild($li);
}
$element->appendChild($ul);
$content->appendChild($element);
}
}
}
}
// Process Child Associations
if (!is_null($child_associations) && !empty($child_associations)) {
foreach ($child_associations as $as) {
// Get the related section
$child_section = SectionManager::fetch($as['child_section_id']);
if (!$child_section instanceof Section) {
continue;
}
// Get the visible field instance (using the sorting field, this is more flexible than visibleColumns())
// Get the link field instance
$visible_field = current($child_section->fetchVisibleColumns());
$relation_field = FieldManager::fetch($as['child_section_field_id']);
// Get entries, using $schema for performance reasons.
$entry_ids = $relation_field->findRelatedEntries($entry_id, $as['parent_section_field_id']);
$schema = $visible_field ? array($visible_field->get('element_name')) : array();
$where = sprintf(' AND `e`.`id` IN (%s)', implode(', ', $entry_ids));
$entries = !empty($entry_ids) ? EntryManager::fetchByPage(1, $as['child_section_id'], $show_entries, $where, null, false, false, true, $schema) : array();
$has_entries = !empty($entries) && $entries['total-entries'] != 0;
//.........这里部分代码省略.........
示例6: createCheckbox
private function createCheckbox($text, $key)
{
$order = $this->get('sortorder');
$lbl = new XMLElement('label', __($text), array('class' => 'column'));
$input = new XMLElement('input', NULL, array('type' => 'checkbox', 'name' => "fields[{$order}][{$key}]"));
$input->setSelfClosingTag(true);
if ($this->get($key) == 'yes') {
$input->setAttribute('checked', 'checked');
}
$lbl->prependChild($input);
return $lbl;
}
示例7: createHidden
private function createHidden($id)
{
$h = new XMLElement('input', NULL, array('id' => $id, 'name' => "fields[{$id}]", 'type' => 'hidden'));
$h->setSelfClosingTag(true);
return $h;
}
示例8: view
public function view()
{
Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/members/assets/styles.css', 'screen', 9125341);
Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/members/assets/jquery-ui.css', 'screen', 9125342);
Administration::instance()->Page->addScriptToHead(URL . '/extensions/members/assets/jquery-ui.js', 9126342);
Administration::instance()->Page->addScriptToHead(URL . '/extensions/members/assets/members.js', 9126343);
$formHasErrors = is_array($this->_errors) && !empty($this->_errors);
if ($formHasErrors) {
$this->pageAlert(__('An error occurred while processing this form. <a href="#error">See below for details.</a>'), AdministrationPage::PAGE_ALERT_ERROR);
}
$this->setPageType('form');
$this->appendSubheading(__('Untitled'));
$fields = array();
if (isset($_POST['fields'])) {
$fields = $_POST['fields'];
}
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings type-file');
$fieldset->appendChild(new XMLElement('legend', __('Essentials')));
$label = Widget::Label(__('Name'));
$label->appendChild(Widget::Input('fields[name]', General::sanitize($fields['name'])));
if (isset($this->_errors['name'])) {
$fieldset->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['name']));
} else {
$fieldset->appendChild($label);
}
$this->Form->appendChild($fieldset);
$EventManager = new EventManager($this->_Parent);
$events = $EventManager->listAll();
if (is_array($events) && !empty($events)) {
foreach ($events as $handle => $e) {
$show_in_role_permissions = method_exists("event{$handle}", 'showInRolePermissions') && call_user_func(array("event{$handle}", 'showInRolePermissions')) === true ? true : false;
if (!$e['can_parse'] && !$show_in_role_permissions) {
unset($events[$handle]);
}
}
}
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings type-file');
$fieldset->appendChild(new XMLElement('legend', __('Event Level Permissions')));
$aTableHead = array(array(__('Event'), 'col'), array(__('Create'), 'col'), array(__('Edit'), 'col'));
$aTableBody = array();
/*
<tr class="global">
<td>Set Global Permissions</td>
<td class="add">
<input type="checkbox" name="add-global" value="no"/>
</td>
<td class="edit">
<p class="global-slider"></p>
<span>n/a</span>
</td>
<!--<td class="delete">
<p class="global-slider"></p>
<span>n/a</span>
</td>-->
</tr>
*/
## Setup each cell
$td1 = Widget::TableData(__('Global Permissions'));
$td2 = Widget::TableData(Widget::Input('global-add', '1', 'checkbox'), 'add');
$td3 = Widget::TableData(NULL, 'edit');
$td3->appendChild(new XMLElement('p', NULL, array('class' => 'global-slider')));
$td3->appendChild(new XMLElement('span', 'n/a'));
$td4 = Widget::TableData(NULL, 'delete');
$td4->appendChild(new XMLElement('p', NULL, array('class' => 'global-slider')));
$td4->appendChild(new XMLElement('span', 'n/a'));
## Add a row to the body array, assigning each cell to the row
$aTableBody[] = Widget::TableRow(array($td1, $td2, $td3), 'global');
//, $td4
if (is_array($events) && !empty($events)) {
foreach ($events as $event_handle => $event) {
$permissions = $fields['permissions'][$event_handle];
## Setup each cell
$td1 = Widget::TableData($event['name']);
$td2 = Widget::TableData(Widget::Input("fields[permissions][{$event_handle}][create]", '1', 'checkbox', $permissions['create'] == 1 ? array('checked' => 'checked') : NULL), 'add');
$td3 = Widget::TableData(NULL, 'edit');
$td3->appendChild(new XMLElement('p', NULL, array('class' => 'slider')));
$span = new XMLElement('span');
$span->setSelfClosingTag(false);
$td3->appendChild($span);
$td3->appendChild(Widget::Input('fields[permissions][' . $event_handle . '][edit]', isset($permissions['edit']) ? $permissions['edit'] : '0', 'hidden'));
$td4 = Widget::TableData(NULL, 'delete');
$td4->appendChild(new XMLElement('p', NULL, array('class' => 'slider')));
$span = new XMLElement('span');
$span->setSelfClosingTag(false);
$td4->appendChild($span);
$td4->appendChild(Widget::Input('fields[permissions][' . $event_handle . '][delete]', isset($permissions['delete']) ? $permissions['delete'] : '0', 'hidden'));
/*
<tr>
<td>{EVENT-NAME}</td>
<td class="add">
<input type="checkbox" name="{ANY NAME}" value="{EXISTING STATE:No}"/>
</td>
<td class="edit">
<p class="slider"></p>
<span></span>
<input type="hidden" name="{ANY NAME}" value="{EXISTING-VALUE:1}"/>
</td>
<!--<td class="delete">
//.........这里部分代码省略.........
示例9: addJStoRenewLock
protected function addJStoRenewLock($entry_id, $author_id)
{
$script = new XMLElement('script');
$script->setSelfClosingTag(false);
$script->setAttributeArray(array('type' => 'text/javascript'));
$script->setValue("\n\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\tLocking.init();\n\t\t\t\t\tLocking.renewLock('" . $entry_id . "', '" . $author_id . "', '" . $this->renew_lock . "');\n\t\t\t\t});\t\t\t\t\t\t\t\t\n\t\t\t");
return $script;
}
示例10: __publishPanelJS
public function __publishPanelJS($ctx)
{
// context array contains: &$oPage
$Admin = Administration::instance();
if (!is_array($Admin->markitup) || empty($Admin->markitup)) {
return;
}
$fileMode = $Admin->Configuration->get('write_mode', 'file');
asort($Admin->markitup);
$path = CACHE . '/markitup_' . md5(implode(',', $Admin->markitup));
$cacheJS = $path . '.js';
$cacheCSS = $path . '.css';
if (file_exists($cacheJS)) {
$cacheJSTime = filemtime($cacheJS);
}
if (file_exists($cacheCSS)) {
$cacheCSSTime = filemtime($cacheCSS);
}
$path = EXTENSIONS . '/markitup/assets/markitup/sets';
$refresh = false;
foreach ($Admin->markitup as $type) {
if (file_exists("{$path}/{$type}/set.js") && filemtime("{$path}/{$type}/set.js") > $cacheJSTime) {
$refresh = true;
break;
}
if (file_exists("{$path}/{$type}/style.css") && filemtime("{$path}/{$type}/style.css") > $cacheCSSTime) {
$refresh = true;
break;
}
}
if ($refresh) {
$supported = $Admin->Configuration->get('markitup');
$data = '';
$data .= "\n\t\tvar markItUpFormatters = {";
foreach ($supported as $format => $class) {
$data .= "\n\t\t\t'{$format}': '{$class}',";
}
$data .= "\n\t\t};\n";
$data .= "\n\t\tvar markItUpFormattersRegex = /(^| )(" . implode('|', array_keys($supported)) . ')( |$)/;';
$data .= "\n\n";
foreach ($Admin->markitup as $type) {
$data .= $this->convertJS(file_get_contents("{$path}/{$type}/set.js"), $type);
$data .= "\n\n";
}
$data = file_get_contents(EXTENSIONS . '/markitup/assets/jquery.pack.js') . ";\n\n" . file_get_contents(EXTENSIONS . '/markitup/assets/markitup/jquery.markitup.pack.js') . ";\n\n" . '
(function($) {
' . $data . '
$(document).ready(function() {
$(".markItUp").each(function(){
var formatter = this.className.match(markItUpFormattersRegex);
if (!formatter[2]) return;
formatter = formatter[2];
var c = markItUpFormatters[formatter];
if (c != "default") {
myMarkItUpSettings[c].previewParserPath = "' . URL . '/symphony/extension/markitup/preview/"+formatter+"/";
myMarkItUpSettings[c].previewParserVar = "data";
}
$(this).markItUp(myMarkItUpSettings[c]);
});
});
})(jQuery);
jQuery.noConflict();
';
if (!General::writeFile($cacheJS, $data, $fileMode)) {
$script = new XMLElement('script', $data, array('type' => 'text/javascript'));
$script->setSelfClosingTag(false);
$ctx['oPage']->addElementToHead($script, 1001);
$cacheJS = NULL;
}
}
if ($cacheJS) {
$ctx['oPage']->addScriptToHead(str_replace(DOCROOT, URL, $cacheJS), 1001);
}
if ($refresh) {
$data = file_get_contents(EXTENSIONS . '/markitup/assets/markitup/skins/symphony/style.css') . "\n";
$url = str_replace(DOCROOT, URL, $path);
foreach ($Admin->markitup as $type) {
$data .= $this->convertCSS(file_get_contents("{$path}/{$type}/style.css"), $type, "{$url}/{$type}");
}
if (!General::writeFile($cacheCSS, $data, $fileMode)) {
$style = new XMLElement('style', $data, array('type' => 'text/css', 'media' => 'screen'));
$ctx['oPage']->addElementToHead($style, 1002);
$cacheCSS = NULL;
}
}
if ($cacheCSS) {
$ctx['oPage']->addStylesheetToHead(str_replace(DOCROOT, URL, $cacheCSS), 'screen', 1002);
}
}