本文整理汇总了PHP中Pimcore\File::putPhpFile方法的典型用法代码示例。如果您正苦于以下问题:PHP File::putPhpFile方法的具体用法?PHP File::putPhpFile怎么用?PHP File::putPhpFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\File
的用法示例。
在下文中一共展示了File::putPhpFile方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: config
/**
* @param array $config
*/
public function config($config = [])
{
$settings = null;
// check for an initial configuration template
// used eg. by the demo installer
$configTemplatePath = PIMCORE_CONFIGURATION_DIRECTORY . "/system.template.php";
if (file_exists($configTemplatePath)) {
try {
$configTemplate = new \Zend_Config(include $configTemplatePath);
if ($configTemplate->general) {
// check if the template contains a valid configuration
$settings = $configTemplate->toArray();
// unset database configuration
unset($settings["database"]["params"]["host"]);
unset($settings["database"]["params"]["port"]);
}
} catch (\Exception $e) {
}
}
// set default configuration if no template is present
if (!$settings) {
// write configuration file
$settings = ["general" => ["timezone" => "Europe/Berlin", "language" => "en", "validLanguages" => "en", "debug" => "1", "debugloglevel" => "debug", "custom_php_logfile" => "1", "extjs6" => "1"], "database" => ["adapter" => "Mysqli", "params" => ["username" => "root", "password" => "", "dbname" => ""]], "documents" => ["versions" => ["steps" => "10"], "default_controller" => "default", "default_action" => "default", "error_pages" => ["default" => "/"], "createredirectwhenmoved" => "", "allowtrailingslash" => "no", "generatepreview" => "1"], "objects" => ["versions" => ["steps" => "10"]], "assets" => ["versions" => ["steps" => "10"]], "services" => [], "cache" => ["excludeCookie" => ""], "httpclient" => ["adapter" => "Zend_Http_Client_Adapter_Socket"]];
}
$settings = array_replace_recursive($settings, $config);
// create initial /website/var folder structure
// @TODO: should use values out of startup.php (Constants)
$varFolders = ["areas", "assets", "backup", "cache", "classes", "config", "email", "log", "plugins", "recyclebin", "search", "system", "tmp", "versions", "webdav"];
foreach ($varFolders as $folder) {
\Pimcore\File::mkdir(PIMCORE_WEBSITE_VAR . "/" . $folder);
}
$configFile = \Pimcore\Config::locateConfigFile("system.php");
File::putPhpFile($configFile, to_php_data_file_format($settings));
}
示例2: installConfigFile
public function installConfigFile()
{
if (!is_file($this->configFile)) {
$settings = array("accordion" => ["configElements" => [["type" => "select", "name" => "type", "title" => "Type", "values" => ["panel-default" => "Default", "panel-danger" => "Dangers"], "default" => "panel-default"], ["type" => "additionalClasses", "values" => []]]], "columns" => ["configElements" => [["type" => "select", "name" => "type", "title" => "Columns", "values" => ["column_12" => "1 Column", "column_4_8" => "2 Columns (33:66)", "column_8_4" => "2 Columns (66:33)", "column_3_9" => "2 Columns (25:75)", "column_9_3" => "2 Columns (75:25)", "column_6_6" => "2 Columns (50:50)", "column_4_4_4" => "3 Columns (33:33:33)"], "default" => "column_12"], ["type" => "checkbox", "name" => "equalHeight", "title" => "Equal heights?", "reload" => FALSE]]], "slideColumns" => ["configElements" => [["type" => "select", "name" => "slidesPerView", "title" => "Slides per View", "values" => ["2" => "2 Columns", "3" => "3 Columns", "4" => "4 Columns", "6" => "6 Columns"], "default" => "4"], ["type" => "checkbox", "name" => "equalHeight", "title" => "Equal heights?", "reload" => FALSE]], "columnClasses" => ["2" => "col-xs-12 col-sm-6"], "breakpoints" => []], "content" => ["configElements" => [["type" => "additionalClasses", "values" => []]]], "download" => ["configElements" => [["type" => "additionalClasses", "values" => []]]], "gallery" => ["configElements" => [["type" => "additionalClasses", "values" => []]]], "headline" => ["configElements" => [["type" => "select", "name" => "headlineType", "title" => "Headline Size", "values" => ["h1" => "Headline 1", "h2" => "Headline 2", "h3" => "Headline 3", "h4" => "Headline 4", "h5" => "Headline 5", "h6" => "Headline 6"], "default" => "h3"], ["type" => "additionalClasses", "values" => []]]], "image" => ["configElements" => [["type" => "additionalClasses", "values" => []]]], "linklist" => ["configElements" => [["type" => "additionalClasses", "values" => []]]], "parallaxContainer" => ["configElements" => [["type" => "select", "name" => "type", "title" => "Type", "values" => ["image" => "Image", "snippet" => "Snippet"], "default" => "image"], ["type" => "additionalClasses", "values" => ["window-full-height" => "min. window height"]]]], "separator" => ["configElements" => [["type" => "select", "name" => "space", "title" => "Space before & after separator", "values" => ["default" => "Default", "medium" => "Medium", "large" => "Large"], "default" => "default"], ["type" => "additionalClasses", "values" => []]]], "teaser" => ["configElements" => [["type" => "select", "name" => "type", "title" => "Type", "values" => ["direct" => "Direct", "snippet" => "Snippet"], "default" => "direct"], ["type" => "select", "name" => "layout", "title" => "Layout", "values" => ["default" => "Default"], "default" => "default", "conditions" => [["type" => "direct"]]], ["type" => "checkbox", "name" => "useLightBox", "title" => "use Lightbox?"], ["type" => "additionalClasses", "values" => []]]], "video" => ["configElements" => [["type" => "additionalClasses", "values" => []], ["type" => "checkbox", "name" => "autoplay", "title" => "Autoplay?"]]], "googleMap" => ["configElements" => [], "mapOptions" => ["streetViewControl" => TRUE, "mapTypeControl" => FALSE, "panControl" => FALSE, "scrollwheel" => FALSE], "mapStyleUrl" => FALSE, "markerIcon" => FALSE], "ckeditor" => ["styles" => [['name' => 'test', 'element' => 'p', 'attributes' => ['class' => 'h5']]]], "disallowedSubAreas" => ["accordion" => ["accordion", "container", "slideColumns"], "columns" => ["container"], "slideColumns" => ["slideColumns", "accordion", "container", "columns", "anchor"], "container" => ["container"], "image" => ["parallaxContainer"], "snippet" => ["parallaxContainer"]], "disallowedContentSnippetAreas" => ["parallaxContainer", "teaser", "container", "snippet"], "areaBlockConfiguration" => ["toolbar" => ["title" => "Inhaltsbausteine", "width" => 200, "x" => 10, "y" => 125, "buttonWidth" => 200], "groups" => FALSE]);
\Pimcore\File::putPhpFile($this->configFile, to_php_data_file_format($settings));
}
}
示例3: saveAction
public function saveAction()
{
$this->checkPermission("system_settings");
$values = \Zend_Json::decode($this->getParam("data"));
$configFile = \Pimcore\Config::locateConfigFile("reports.php");
File::putPhpFile($configFile, to_php_data_file_format($values));
$this->_helper->json(["success" => true]);
}
示例4: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$source = "http://unicode.org/repos/cldr/trunk/common/supplemental/supplementalData.xml";
$data = file_get_contents($source);
$xml = simplexml_load_string($data, null, LIBXML_NOCDATA);
$languageRawData = [];
foreach ($xml->territoryInfo->territory as $territory) {
foreach ($territory->languagePopulation as $language) {
$languageCode = (string) $language["type"];
if (\Zend_Locale::isLocale($languageCode)) {
$populationAbsolute = $territory["population"] * $language["populationPercent"] / 100;
if (!isset($languageRawData[$languageCode])) {
$languageRawData[$languageCode] = [];
}
if (\Zend_Locale::isLocale($languageCode . "_" . $territory["type"], true)) {
$languageRawData[$languageCode][] = ["country" => (string) $territory["type"], "population" => $populationAbsolute];
}
}
}
}
$finalData = [];
foreach ($languageRawData as $languageCode => $rawLanguage) {
usort($rawLanguage, function ($a, $b) {
if ($a["population"] == $b["population"]) {
return 0;
}
return $a["population"] > $b["population"] ? -1 : 1;
});
$finalData[$languageCode] = [];
foreach ($rawLanguage as $territory) {
$finalData[$languageCode][] = $territory["country"];
}
}
$contents = to_php_data_file_format($finalData);
$dataFile = PIMCORE_PATH . "/config/data/cldr-language-territory-mapping.php";
File::putPhpFile($dataFile, $contents);
$this->output->writeln("Updated mappings in " . $dataFile);
}
示例5: setFlag
/**
* @param $name
* @param $value
*/
public static function setFlag($name, $value)
{
$settings = self::getSystemConfig()->toArray();
if (!isset($settings["flags"])) {
$settings["flags"] = [];
}
$settings["flags"][$name] = $value;
$configFile = \Pimcore\Config::locateConfigFile("system.php");
File::putPhpFile($configFile, to_php_data_file_format($settings));
}
示例6: setWeb2printAction
public function setWeb2printAction()
{
$this->checkPermission("web2print_settings");
$values = \Zend_Json::decode($this->getParam("data"));
if ($values['wkhtml2pdfOptions']) {
$optionArray = [];
$lines = explode("\n", $values['wkhtml2pdfOptions']);
foreach ($lines as $line) {
$parts = explode(" ", substr($line, 2));
$key = trim($parts[0]);
if ($key) {
$value = trim($parts[1]);
$optionArray[$key] = $value;
}
}
$values['wkhtml2pdfOptions'] = $optionArray;
}
$configFile = \Pimcore\Config::locateConfigFile("web2print.php");
File::putPhpFile($configFile, to_php_data_file_format($values));
$this->_helper->json(["success" => true]);
}
示例7: save
/**
*
*/
protected function save()
{
$contents = to_php_data_file_format($this->data);
File::putPhpFile($this->filePath, $contents);
}
示例8: activateMaintenanceMode
/**
* @param null $sessionId
* @throws \Exception
* @throws \Zend_Config_Exception
*/
public static function activateMaintenanceMode($sessionId = null)
{
if (empty($sessionId)) {
$sessionId = session_id();
}
if (empty($sessionId)) {
throw new \Exception("It's not possible to activate the maintenance mode without a session-id");
}
File::putPhpFile(self::getMaintenanceModeFile(), to_php_data_file_format(["sessionId" => $sessionId]));
@chmod(self::getMaintenanceModeFile(), 0777);
// so it can be removed also via FTP, ...
\Pimcore::getEventManager()->trigger("system.maintenance.activate");
}
示例9: setConfig
/**
* @static
* @param \Zend_Config $config
* @return void
*/
public static function setConfig(\Zend_Config $config)
{
self::$config = $config;
$file = \Pimcore\Config::locateConfigFile("extensions.php");
File::putPhpFile($file, to_php_data_file_format(self::$config->toArray()));
}