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


PHP Alias::select方法代码示例

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


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

示例1: exportFrom

 public static function exportFrom($intElementId, $intTemplateId, $arrElementFilters, $arrTemplateFilters, $intAccountId = 0, $exportElements = true, $exportFiles = true, $includeSelf = false)
 {
     global $objLiveAdmin, $_CONF, $_PATHS;
     $arrFiles = array();
     //*** Init DOM object.
     $objDoc = new DOMDocument("1.0", "UTF-8");
     $objDoc->formatOutput = false;
     $objDoc->preserveWhiteSpace = true;
     //*** Init Zip archive.
     $strZipName = $_PATHS['upload'] . "exportZip_" . rand() . ".zip";
     $objZip = new dZip($strZipName, true);
     $objStructure = $objDoc->createElement('structure');
     $objStructure->setAttribute("version", "1.0");
     $objStructure->setAttribute("type", "element");
     $objStructure = $objDoc->appendChild($objStructure);
     $objLogic = $objDoc->createElement('logic');
     $objLogic = $objStructure->appendChild($objLogic);
     //*** export templates
     $includeTemplateSelf = $intElementId === NULL || $includeSelf;
     $objTemplates = self::exportTemplate($objDoc, $intAccountId, $intTemplateId, $arrTemplateFilters, $includeTemplateSelf);
     $objTemplates = $objLogic->appendChild($objTemplates);
     //*** export elements
     if ($exportElements) {
         //*** export languages
         $objLanguages = $objDoc->createElement('languages');
         $objLanguages = $objLogic->appendChild($objLanguages);
         $objContentLangs = ContentLanguage::select();
         foreach ($objContentLangs as $objContentLang) {
             $objLanguage = $objDoc->createElement('language');
             $objLanguage->setAttribute("id", $objContentLang->getId());
             $objLanguage->setAttribute("name", $objContentLang->getName());
             $objLanguage->setAttribute("abbr", $objContentLang->getAbbr());
             $objLanguage->setAttribute("default", $objContentLang->default);
             $objLanguage->setAttribute("active", $objContentLang->getActive());
             $objLanguage->setAttribute("sort", $objContentLang->getSort());
             $objLanguage->setAttribute("username", $objContentLang->getUsername());
             $objLanguages->appendChild($objLanguage);
         }
         //*** export elements
         if ($intElementId == NULL) {
             // export all elements with given template id
             $strSql = sprintf("SELECT * FROM pcms_element WHERE templateId = '%s' AND accountId = '%s' ORDER BY sort", $intTemplateId, $_CONF['app']['account']->getId());
             $objElements = Element::select($strSql);
             foreach ($objElements as $objElement) {
                 $objElements = self::exportElement($objDoc, $intAccountId, $objElement->getId(), $arrFiles, $arrTemplateFilters, $arrElementFilters, $includeTemplateSelf);
                 $objElements = $objLogic->appendChild($objElements);
             }
         } else {
             // export from one element
             $objElements = self::exportElement($objDoc, $intAccountId, $intElementId, $arrFiles, $arrTemplateFilters, $arrElementFilters, $includeTemplateSelf);
             $objElements = $objLogic->appendChild($objElements);
         }
         //*** export aliases
         $objAliases = $objDoc->createElement('aliases');
         $objAliases = $objLogic->appendChild($objAliases);
         $objDbAliases = Alias::select();
         foreach ($objDbAliases as $objDbAlias) {
             if (in_array($objDbAlias->getUrl(), $arrElementFilters)) {
                 $objAlias = $objDoc->createElement('alias');
                 $objAlias->setAttribute("language", $objDbAlias->getLanguageId());
                 $objAlias->setAttribute("cascade", $objDbAlias->getCascade());
                 $objAlias->setAttribute("alias", $objDbAlias->getAlias());
                 $objAlias->setAttribute("url", $objDbAlias->getUrl());
                 $objAlias->setAttribute("active", $objDbAlias->getActive());
                 $objAlias->setAttribute("sort", $objDbAlias->getSort());
                 $objAlias->setAttribute("created", $objDbAlias->getCreated());
                 $objAlias->setAttribute("modified", $objDbAlias->getModified());
                 $objAliases->appendChild($objAlias);
             }
         }
     }
     //*** Files.
     if ($exportFiles) {
         $strServer = Setting::getValueByName("ftp_server");
         $webServer = Setting::getValueByName("web_server");
         if ($strServer != "localhost") {
             $strLocation = "http://" . $strServer . Setting::getValueByName("file_folder");
         } else {
             if (!empty($webServer)) {
                 $strLocation = $webServer . Setting::getValueByName("file_folder");
             }
         }
         $objZip = self::exportFilesToZip($objZip, $arrFiles, $strLocation);
     }
     //*** Destroy temporary account object.
     unset($_CONF['app']['account']);
     //*** Return XML.
     $objZip->addFile(NULL, 'data.xml', "", $objDoc->saveXML());
     $objZip->save();
     return $strZipName;
 }
开发者ID:laiello,项目名称:punchcms,代码行数:91,代码来源:class.impex.php


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