当前位置: 首页>>代码示例>>PHP>>正文


PHP JUDownloadHelper::appendXML方法代码示例

本文整理汇总了PHP中JUDownloadHelper::appendXML方法的典型用法代码示例。如果您正苦于以下问题:PHP JUDownloadHelper::appendXML方法的具体用法?PHP JUDownloadHelper::appendXML怎么用?PHP JUDownloadHelper::appendXML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JUDownloadHelper的用法示例。


在下文中一共展示了JUDownloadHelper::appendXML方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getForm

 public function getForm($data = array(), $loadData = true)
 {
     if ($data) {
         $data = (object) $data;
     } else {
         $data = $this->getItem();
     }
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     JForm::addFieldPath(JPATH_COMPONENT . '/models/fields');
     $field_xml_path = JPath::find(JForm::addFormPath(), 'field.xml');
     $field_xml = JFactory::getXML($field_xml_path, true);
     if ($data->plugin_id) {
         $db = JFactory::getDbo();
         $query = 'SELECT folder, type' . ' FROM #__judownload_plugins' . ' WHERE (id =' . $data->plugin_id . ')';
         $db->setQuery($query);
         $pluginObj = $db->loadObject();
         if ($pluginObj && $pluginObj->folder) {
             $folder = strtolower(str_replace(' ', '', $pluginObj->folder));
             $xml_file = JPATH_SITE . "/components/com_judownload/fields/" . $folder . "/" . $folder . '.xml';
             if (JFile::exists($xml_file)) {
                 $field_plugin_xml = JFactory::getXML($xml_file);
                 if ($field_plugin_xml->config) {
                     foreach ($field_plugin_xml->config->children() as $child) {
                         $field_params_xpath = $field_xml->xpath('//fieldset[@name="params"]');
                         JUDownloadHelper::appendXML($field_params_xpath[0], $child);
                     }
                     if ($field_plugin_xml->languages->count()) {
                         foreach ($field_plugin_xml->languages->children() as $language) {
                             $languageFile = (string) $language;
                             $first_pos = strpos($languageFile, '.');
                             $last_pos = strrpos($languageFile, '.');
                             $languageExtName = substr($languageFile, $first_pos + 1, $last_pos - $first_pos - 1);
                             $client = JApplicationHelper::getClientInfo((string) $language->attributes()->client, true);
                             $path = isset($client->path) ? $client->path : JPATH_BASE;
                             JUDownloadFrontHelperLanguage::loadLanguageFile($languageExtName, $path);
                         }
                     }
                 }
             }
         }
     }
     $form = $this->loadForm('com_judownload.field', $field_xml->asXML(), array('control' => 'jform', 'load_data' => $loadData));
     if (empty($form)) {
         return false;
     }
     $ignored_options = explode(",", $data->ignored_options);
     foreach ($ignored_options as $ignored_option) {
         $form->setFieldAttribute($ignored_option, 'disabled', 'true');
         $form->setFieldAttribute($ignored_option, 'filter', 'unset');
     }
     if (!$this->canEditState($data)) {
         $form->setFieldAttribute('ordering', 'disabled', 'true');
         $form->setFieldAttribute('published', 'disabled', 'true');
         $form->setFieldAttribute('ordering', 'filter', 'unset');
         $form->setFieldAttribute('published', 'filter', 'unset');
     }
     return $form;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:58,代码来源:field.php

示例2: getForm

 public function getForm($data = array(), $loadData = true)
 {
     if ($data) {
         $data = (object) $data;
     } else {
         $data = $this->getItem();
     }
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     JForm::addFieldPath(JPATH_COMPONENT . '/models/fields');
     $style_xml_path = JPath::find(JForm::addFormPath(), strtolower('style') . '.xml');
     $style_xml = JFactory::getXML($style_xml_path, true);
     if (isset($data->template_id) && $data->template_id) {
         $styleObject = JUDownloadFrontHelperTemplate::getTemplateStyleObject($data->id);
         $folder = $styleObject->folder;
         $folder = strtolower(str_replace(' ', '', $folder));
         if ($folder) {
             $xml_file = JPath::clean(JPATH_SITE . "/components/com_judownload/templates/" . $folder . "/" . $folder . '.xml');
             if (JFile::exists($xml_file)) {
                 $xml = JFactory::getXML($xml_file);
                 if ($xml->config) {
                     foreach ($xml->config->children() as $child) {
                         $style_params_xpath = $style_xml->xpath('//fieldset[@name="params"]');
                         JUDownloadHelper::appendXML($style_params_xpath[0], $child);
                     }
                     if ($xml->languages->count()) {
                         foreach ($xml->languages->children() as $language) {
                             $languageFile = (string) $language;
                             $first_pos = strpos($languageFile, '.');
                             $last_pos = strrpos($languageFile, '.');
                             $languageExtName = substr($languageFile, $first_pos + 1, $last_pos - $first_pos - 1);
                             $client = JApplicationHelper::getClientInfo((string) $language->attributes()->client, true);
                             $path = isset($client->path) ? $client->path : JPATH_BASE;
                             JUDownloadFrontHelperLanguage::loadLanguageFile($languageExtName, $path);
                         }
                     }
                 }
             }
         }
     }
     $form = $this->loadForm('com_judownload.style', $style_xml->asXML(), array('control' => 'jform', 'load_data' => $loadData));
     if (empty($form)) {
         return false;
     }
     $app = JFactory::getApplication();
     $id = $app->input->get('id', 0);
     if ($id) {
         $form->setFieldAttribute('template_id', 'disabled', 'true');
         $form->setFieldAttribute('template_id', 'filter', 'unset');
         if (isset($data->home) && $data->home == 1) {
             $form->setFieldAttribute('home', 'disabled', 'true');
         }
     }
     return $form;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:54,代码来源:style.php

示例3: getForm

 public function getForm($data = array(), $loadData = true)
 {
     $storeId = md5(__METHOD__ . "::" . serialize($data) . "::" . (int) $loadData);
     if (!isset($this->cache[$storeId])) {
         if ($data) {
             $data = (object) $data;
         } else {
             $data = $this->getItem();
         }
         JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/com_judownload/models/forms');
         JForm::addFieldPath(JPATH_ADMINISTRATOR . '/components/com_judownload/models/fields');
         $document_xml_path = JPath::find(JForm::addFormPath(), 'document.xml');
         $document_xml = JFactory::getXML($document_xml_path, true);
         if ($data->id) {
             $templateStyleObject = JUDownloadFrontHelperTemplate::getTemplateStyleOfDocument($data->id);
             $templateFolder = trim($templateStyleObject->folder);
             if ($templateFolder) {
                 $template_path = JPATH_SITE . "/components/com_judownload/templates/" . $templateFolder . "/" . $templateFolder . '.xml';
                 if (JFile::exists($template_path)) {
                     $template_xml = JFactory::getXML($template_path, true);
                     if ($template_xml->doc_config) {
                         foreach ($template_xml->doc_config->children() as $child) {
                             $template_params_xpath = $document_xml->xpath('//fieldset[@name="template_params"]');
                             JUDownloadHelper::appendXML($template_params_xpath[0], $child);
                         }
                     }
                     if ($template_xml->languages->count()) {
                         foreach ($template_xml->languages->children() as $language) {
                             $languageFile = (string) $language;
                             $first_pos = strpos($languageFile, '.');
                             $last_pos = strrpos($languageFile, '.');
                             $languageExtName = substr($languageFile, $first_pos + 1, $last_pos - $first_pos - 1);
                             $client = JApplicationHelper::getClientInfo((string) $language->attributes()->client, true);
                             $path = isset($client->path) ? $client->path : JPATH_BASE;
                             JUDownloadFrontHelperLanguage::loadLanguageFile($languageExtName, $path);
                         }
                     }
                 }
             }
         }
         $globalconfig_path = JPath::find(JForm::addFormPath(), 'globalconfig.xml');
         $globalconfig_xml = JFactory::getXML($globalconfig_path, true);
         $display_params_fields_xpath = $globalconfig_xml->xpath('//fields[@name="display_params"]/fields[@name="doc"]');
         $display_params_xml = $display_params_fields_xpath[0];
         if ($display_params_xml) {
             foreach ($display_params_xml->children() as $child) {
                 $display_params_xpath = $document_xml->xpath('//fields[@name="display_params"]');
                 JUDownloadHelper::appendXML($display_params_xpath[0], $child, false, true);
             }
         }
         $plugin_dir = JPATH_SITE . "/plugins/judownload/";
         $db = JFactory::getDbo();
         $query = "SELECT * FROM #__extensions WHERE type = 'plugin' AND folder = 'judownload' AND enabled = 1 ORDER BY ordering ASC";
         $db->setQuery($query);
         $elements = $db->loadObjectList();
         if ($elements) {
             foreach ($elements as $index => $element) {
                 $folder = $element->element;
                 $file_path = $plugin_dir . $folder . "/{$folder}.xml";
                 if (JFile::exists($file_path) && JUDownloadHelper::canEditJUDownloadPluginParams($folder, $index) === true) {
                     $xml = JFactory::getXML($file_path, true);
                     if ($xml->doc_config) {
                         $ruleXml = new SimpleXMLElement('<fields name="' . $folder . '"></fields>');
                         $plugin_params_xpath = $document_xml->xpath('//fields[@name="plugin_params"]');
                         JUDownloadHelper::appendXML($plugin_params_xpath[0], $ruleXml);
                         $total_fieldsets = 0;
                         foreach ($xml->doc_config->children() as $child) {
                             $total_fieldsets++;
                             $child->addAttribute('plugin_name', $folder);
                             $jplugin_xpath = $document_xml->xpath('//fields[@name="' . $folder . '"]');
                             JUDownloadHelper::appendXML($jplugin_xpath[0], $child);
                         }
                         if ($total_fieldsets) {
                             $pluginLabel = $xml->doc_config->attributes()->label ? $xml->doc_config->attributes()->label : $element->name;
                             $this->pluginsCanEdit[$folder] = array('label' => $pluginLabel, 'total_fieldsets' => $total_fieldsets);
                         }
                         if (isset($xml->languages)) {
                             JUDownloadFrontHelperLanguage::loadLanguageFile($xml->languages, JPATH_ADMINISTRATOR);
                         }
                     }
                 }
             }
         }
         $form = $this->loadForm('com_judownload.document', $document_xml->asXML(), array('control' => 'jform', 'load_data' => $loadData));
         if (!$loadData) {
             $db = JFactory::getDbo();
             $query = $db->getQuery(true);
             $query->select("field.field_name");
             $query->from("#__judownload_fields AS field");
             $query->join("LEFT", "#__judownload_plugins AS plg ON field.plugin_id = plg.id");
             $query->where("field.group_id = 1 AND field.field_name != ''");
             $db->setQuery($query);
             $fieldNames = $db->loadColumn();
             foreach ($fieldNames as $fieldName) {
                 $form->removeField($fieldName);
             }
         }
         if (empty($form)) {
             $this->cache[$storeId] = false;
         }
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:document.php

示例4: getForm

 public function getForm($data = array(), $loadData = true)
 {
     if ($data) {
         $data = (object) $data;
     } else {
         $data = $this->getItem();
     }
     JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     JForm::addFieldPath(JPATH_COMPONENT . '/models/fields');
     $category_xml_path = JPath::find(JForm::addFormPath(), 'category.xml');
     $category_xml = JFactory::getXML($category_xml_path, true);
     if ($data->id) {
         $templateStyleObject = JUDownloadFrontHelperTemplate::getTemplateStyleOfCategory($data->id);
         $templateFolder = trim($templateStyleObject->folder);
         if ($templateFolder) {
             $template_path = JPATH_SITE . "/components/com_judownload/templates/" . $templateFolder . "/" . $templateFolder . '.xml';
             if (JFile::exists($template_path)) {
                 $template_xml = JFactory::getXML($template_path, true);
                 if ($template_xml->cat_config) {
                     foreach ($template_xml->cat_config->children() as $child) {
                         $template_params_xpath = $category_xml->xpath('//fieldset[@name="template_params"]');
                         JUDownloadHelper::appendXML($template_params_xpath[0], $child);
                     }
                     if ($template_xml->languages->count()) {
                         foreach ($template_xml->languages->children() as $language) {
                             $languageFile = (string) $language;
                             $first_pos = strpos($languageFile, '.');
                             $last_pos = strrpos($languageFile, '.');
                             $languageExtName = substr($languageFile, $first_pos + 1, $last_pos - $first_pos - 1);
                             $client = JApplicationHelper::getClientInfo((string) $language->attributes()->client, true);
                             $path = isset($client->path) ? $client->path : JPATH_BASE;
                             JUDownloadFrontHelperLanguage::loadLanguageFile($languageExtName, $path);
                         }
                     }
                 }
             }
         }
     }
     $globalconfig_path = JPath::find(JForm::addFormPath(), 'globalconfig.xml');
     $globalconfig_xml = JFactory::getXML($globalconfig_path, true);
     if ($globalconfig_xml) {
         foreach ($globalconfig_xml->children() as $child) {
             $config_params_xpath = $category_xml->xpath('//fields[@name="config_params"]');
             if (isset($config_params_xpath[0])) {
                 JUDownloadHelper::appendXML($config_params_xpath[0], $child, true);
             }
         }
     }
     $display_params_fields_xpath = $globalconfig_xml->xpath('//fields[@name="display_params"]/fields[@name="cat"]');
     $display_params_xml = $display_params_fields_xpath[0];
     if ($display_params_xml) {
         foreach ($display_params_xml->children() as $child) {
             $display_params_xpath = $category_xml->xpath('//fields[@name="display_params"]');
             JUDownloadHelper::appendXML($display_params_xpath[0], $child, false, true);
         }
     }
     $plugin_dir = JPATH_SITE . "/plugins/judownload/";
     $db = JFactory::getDbo();
     $query = "SELECT * FROM #__extensions WHERE type = 'plugin' AND folder = 'judownload' AND enabled = 1 ORDER BY ordering ASC";
     $db->setQuery($query);
     $elements = $db->loadObjectList();
     if ($elements) {
         foreach ($elements as $index => $element) {
             $folder = $element->element;
             $file_path = $plugin_dir . $folder . "/{$folder}.xml";
             if (JFile::exists($file_path) && JUDownloadHelper::canEditJUDownloadPluginParams($folder, $index) === true) {
                 $xml = JFactory::getXML($file_path, true);
                 if ($xml->cat_config) {
                     $ruleXml = new SimpleXMLElement('<fields name="' . $folder . '"></fields>');
                     $plugin_params_xpath = $category_xml->xpath('//fields[@name="plugin_params"]');
                     JUDownloadHelper::appendXML($plugin_params_xpath[0], $ruleXml);
                     $total_fieldsets = 0;
                     foreach ($xml->cat_config->children() as $child) {
                         $total_fieldsets++;
                         $child->addAttribute('plugin_name', $folder);
                         $jplugin_xpath = $category_xml->xpath('//fields[@name="' . $folder . '"]');
                         JUDownloadHelper::appendXML($jplugin_xpath[0], $child);
                     }
                     if ($total_fieldsets) {
                         $pluginLabel = $xml->cat_config->attributes()->label ? $xml->cat_config->attributes()->label : $element->name;
                         $this->pluginsCanEdit[$folder] = array('label' => $pluginLabel, 'total_fieldsets' => $total_fieldsets);
                     }
                     if (isset($xml->languages)) {
                         JUDownloadFrontHelperLanguage::loadLanguageFile($xml->languages, JPATH_ADMINISTRATOR);
                     }
                 }
             }
         }
     }
     $form = $this->loadForm('com_judownload.category', $category_xml->asXML(), array('control' => 'jform', 'load_data' => $loadData));
     if (empty($form)) {
         return false;
     }
     if (!$this->canEditState($data)) {
         $form->setFieldAttribute('featured', 'disabled', 'true');
         $form->setFieldAttribute('ordering', 'disabled', 'true');
         $form->setFieldAttribute('published', 'disabled', 'true');
         $form->setFieldAttribute('publish_up', 'disabled', 'true');
         $form->setFieldAttribute('publish_down', 'disabled', 'true');
         $form->setFieldAttribute('featured', 'filter', 'unset');
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:category.php


注:本文中的JUDownloadHelper::appendXML方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。