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


PHP CWizardUtil::CopyFile方法代码示例

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


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

示例1: OnPostForm

 function OnPostForm()
 {
     $wizard =& $this->GetWizard();
     $templateID = $wizard->GetSiteTemplateID();
     $templatePath = BX_PERSONAL_ROOT . "/templates/" . $templateID;
     $arReplace = array("COMPANY_NAME" => $wizard->GetVar("company_name"), "COMPANY_SLOGAN" => $wizard->GetVar("company_slogan"));
     CWizardUtil::ReplaceMacros($_SERVER["DOCUMENT_ROOT"] . $templatePath . "/include_areas/company_name.php", $arReplace);
     $server_name = $_SERVER["HTTP_HOST"] != '' ? $_SERVER["HTTP_HOST"] : $_SERVER["SERVER_NAME"];
     if ($_SERVER["SERVER_PORT"] != 80 && $_SERVER["SERVER_PORT"] != 443 && $_SERVER["SERVER_PORT"] > 0 && strpos($_SERVER["HTTP_HOST"], ":") === false) {
         $server_name .= ":" . $_SERVER["SERVER_PORT"];
     }
     COption::SetOptionString("main", "server_name", $server_name);
     COption::SetOptionString("main", "site_name", htmlspecialcharsEx($wizard->GetVar("company_name")));
     COption::SetOptionString("main", "wizard_company_slogan", $wizard->GetVar("company_slogan"));
     $themeVarName = $templateID . "_themeID";
     $themeID = $wizard->GetVar($themeVarName);
     $themeID = Rel2Abs("/", $themeID);
     $themePath = $_SERVER["DOCUMENT_ROOT"] . DemoSiteUtil::GetTemplatesPath($wizard->GetPath()) . "/" . $templateID . "/themes/" . $themeID;
     CopyDirFiles($themePath, $_SERVER["DOCUMENT_ROOT"] . $templatePath, $rewrite = true, $recursive = true, $delete_after_copy = false, $exclude = "description.php");
     $companyLogo = $wizard->GetVar("company_logo");
     CWizardUtil::CopyFile($companyLogo, $templatePath . "/images/logo.gif", false);
     COption::SetOptionString("main", "wizard_site_logo", $companyLogo);
 }
开发者ID:Satariall,项目名称:izurit,代码行数:23,代码来源:install_steps.php

示例2: OnPostForm


//.........这里部分代码省略.........

			$component_file_content = strtr($component_file_content, array(
				"#name#" => htmlspecialchars($arResult['name']),
				"#description#" => htmlspecialchars($arResult['description']),
				"#path_id#" => htmlspecialchars($arResult['path_id']),
				"#path_child_id#" => htmlspecialchars($arResult['path_child_id']),
				"#path_child_name#" => htmlspecialchars($arResult['path_child_name']),
				"#type#" => ($arResult['type']=='complex')?'Y':'N',
			));
			
			$arCreateFiles[$new_component_path."/.description.php"] = $component_file_content;
			
			// .parameters.php
		
			$parameters_snippets = $arResult["snippets"];
			if ($arResult['type'] == 'complex' && !in_array('iblock', $arResult["snippets"])) {
				$parameters_snippets[] = 'iblock';			
			}
			
			$component_file_content = file_get_contents(dirname(__FILE__)."/src/.parameters.php");			
			$arCreateFiles[$new_component_path."/.parameters.php"] = $this->__getContentBySnippets($component_file_content, $parameters_snippets);

			if ($arResult['type'] == 'complex') {
				$arResult["snippets"][] = 'template';
			}
			
			if (in_array('template', $arResult["snippets"])) {
				
				$new_component_template_path = $new_component_path."/templates/.default";
				
				$arCreateDirs[] = $new_component_template_path;
				
				if ($arResult['type'] == 'complex') {
					$arCreateFiles[$new_component_template_path."/list.php"] = file_get_contents(dirname(__FILE__)."/src/templates/.default/list.php");
					$arCreateFiles[$new_component_template_path."/detail.php"] = file_get_contents(dirname(__FILE__)."/src/templates/.default/detail.php");
				} else {
					$arCreateFiles[$new_component_template_path."/template.php"] = file_get_contents(dirname(__FILE__)."/src/templates/.default/template.php");
				}
				
				if (in_array('css', $arResult["template_options"])) {					
					$arCreateFiles[$new_component_template_path."/style.css"] = " ";					
				}
				
				if (in_array('js', $arResult["template_options"])) {					
					$arCreateFiles[$new_component_template_path."/script.js"] = " ";					
				}
				
				if (in_array('epilog', $arResult["template_options"])) {					
					$arCreateFiles[$new_component_template_path."/component_epilog.php"] = '<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die(); ?>';					
				}
				
				if (in_array('lang', $arResult["template_options"])) {					
					$arCreateDirs[] = $new_component_template_path."/lang";
					$arCreateDirs[] = $new_component_template_path."/lang/ru";
					$arCreateFiles[$new_component_template_path."/lang/ru/template.php"] = '<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die(); ?>';				
				}
			}
			
			// Lang
			
			if (in_array('lang', $arResult["snippets"])) {
				$arCreateDirs[] = $new_component_path."/lang";
				$arCreateDirs[] = $new_component_path."/lang/ru";
				$arCreateFiles[$new_component_path."/lang/ru/.description.php"] = '<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die(); ?>';
				$arCreateFiles[$new_component_path."/lang/ru/.parameters.php"] = '<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die(); ?>';
				$arCreateFiles[$new_component_path."/lang/ru/component.php"] = '<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die(); ?>';
			}
			
			// icon.gif			
			$arCreateDirs[] = $new_component_path."/images";
			
			if(!$wizard->GetVar("icon")) {				
				$arCreateFiles[$new_component_path."/images/icon.gif"] = file_get_contents(dirname(__FILE__)."/src/images/icon.gif");			
			}
			
			// Создаем папки
			foreach($arCreateDirs as $new_dir_path) {
				if (!file_exists($new_dir_path)) {				
					if(!mkdir($new_dir_path, BX_DIR_PERMISSIONS, true)) {
						$this->SetError("Can't create directory ".$new_dir_path);
						return false;
					}			
				}
			}
			
			// Создаем файлы
			foreach($arCreateFiles as $new_file_path=>$new_file_content) {
				if(!file_put_contents($new_file_path, $new_file_content)) {					
					$this->SetError("Can't create file ".$new_file_path);
					return false;
				} else {
					chmod($new_file_path, BX_FILE_PERMISSIONS);
				}
			}

			if($wizard->GetVar("icon")) {	
				CWizardUtil::CopyFile($wizard->GetVar("icon"), str_replace($_SERVER['DOCUMENT_ROOT'], '', $new_component_path."/images/icon.gif"));							
			}
		}
	}
开发者ID:ASDAFF,项目名称:bitrix-mastercomponent,代码行数:101,代码来源:wizard.php


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