本文整理汇总了PHP中sugar_file_put_contents函数的典型用法代码示例。如果您正苦于以下问题:PHP sugar_file_put_contents函数的具体用法?PHP sugar_file_put_contents怎么用?PHP sugar_file_put_contents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sugar_file_put_contents函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
if (!version_compare($this->from_version, '7.0', '>') || !version_compare($this->from_version, '7.6', '<')) {
// only need to run this upgrading for greater than 7.0 and less than 7.7
return;
}
$customModules = $this->getCustomModules();
if (empty($customModules)) {
// No MB modules - nothing to do
return;
}
foreach ($customModules as $module) {
$path = 'modules/' . $module . '/clients/base/menus/header/header.php';
$this->foundPattern = false;
$viewdefs = null;
include $path;
if (!empty($viewdefs)) {
$module = key($viewdefs);
$array = $viewdefs[$module]['base']['menu']['header'];
$this->fixIcons($array);
if ($this->foundPattern) {
sugar_file_put_contents($path, "<?php\n\n/* This file was generated by the 7_FixIconNameChanges upgrader */\n\$viewdefs['{$module}']['base']['menu']['header'] = " . var_export($array, true) . ";\n");
}
}
$viewdefs = null;
}
}
示例2: setUp
public function setUp()
{
$this->authclassname = 'TestAuthClass' . mt_rand();
sugar_mkdir("custom/modules/Users/authentication/{$this->authclassname}/", null, true);
sugar_file_put_contents("custom/modules/Users/authentication/{$this->authclassname}/{$this->authclassname}.php", "<?php\nrequire_once 'modules/Users/authentication/SugarAuthenticate/SugarAuthenticate.php';\nclass {$this->authclassname} extends SugarAuthenticate {\n public \$userAuthenticateClass = '{$this->authclassname}User';\n public \$authenticationDir = '{$this->authclassname}';\n\n public function _construct(){\n\t parent::SugarAuthenticate();\n\t}\n}");
sugar_file_put_contents("custom/modules/Users/authentication/{$this->authclassname}/{$this->authclassname}User.php", "<?php\nrequire_once 'modules/Users/authentication/SugarAuthenticate/SugarAuthenticateUser.php';\nclass {$this->authclassname}User extends SugarAuthenticateUser {\n}");
}
示例3: saveDictionaryToStorage
/**
* Save a dictionary for a particular API to storage
* @internal
* @param string $apiType The api type for the dictionary you want to load ("Rest" or "Soap")
* @param array $storageData The data that the API needs to store for it's dictionary.
*/
protected function saveDictionaryToStorage($apiType, $storageData)
{
if (!is_dir($this->cacheDir)) {
sugar_mkdir($this->cacheDir, null, true);
}
sugar_file_put_contents($this->cacheDir . 'ServiceDictionary.' . $apiType . '.php', '<' . "?php\n\$apiDictionary['" . $apiType . "'] = " . var_export($storageData, true) . ";\n");
}
示例4: run
public function run()
{
$path = 'custom/Extension/application/Ext';
$file_name = 'project_unhide.php';
if (version_compare($this->to_version, '7.2.2.0', '=') && SugarAutoLoader::fileExists($path . '/Include/' . $file_name)) {
$file_contents = '
<?php
// WARNING: The contents of this file are auto-generated.
$moduleList[] = \'Project\';
$moduleList[] = \'ProjectTask\';
if (isset($modInvisList) && is_array($modInvisList)) {
foreach($modInvisList as $key => $mod) {
if($mod == \'Project\' || $mod == \'ProjectTask\') {
unset($modInvisList[$key]);
}
}
}
';
// enable the project module in the upgrade instance
global $moduleList, $modInvisList;
$moduleList[] = 'ProjectTask';
foreach ($modInvisList as $key => $mod) {
if ($mod == 'Project' || $mod == 'ProjectTask') {
unset($modInvisList[$key]);
}
}
sugar_file_put_contents($path . '/Include/' . $file_name, $file_contents);
}
}
示例5: post_install
function post_install()
{
// Include existing custom entry point registry array
@(include_once 'custom/include/MVC/Controller/entry_point_registry.php');
// Start building custom entry point PHP
$the_string = "<?php\n" . '// created: ' . date('Y-m-d H:i:s') . "\n\n";
// Define new entry point
$entry_point_registry['AsteriskController'] = array('file' => 'custom/modules/Asterisk/include/controller.php', 'auth' => true);
$entry_point_registry['AsteriskCallListener'] = array('file' => 'custom/modules/Asterisk/include/callListener.php', 'auth' => true);
$entry_point_registry['AsteriskCallCreate'] = array('file' => 'custom/modules/Asterisk/include/callCreate.php', 'auth' => true);
// For each custom entry point, add override value
foreach ($entry_point_registry as $key => $value) {
$the_string .= override_value_to_string('entry_point_registry', $key, $value) . "\n";
}
// Write the dir if needed
if (!is_dir('custom/include/MVC/Controller')) {
$result = sugar_mkdir('custom/include/MVC/Controller', NULL, true);
}
// Write the new custom entry point registry file
$result = @sugar_file_put_contents('custom/include/MVC/Controller/entry_point_registry.php', $the_string);
if ($_REQUEST['mode'] == 'Install') {
?>
<br /><br />
<span style="font-size: 2em;"><strong>Please review the documentation! There are several additional steps that must be taken.</strong></span>
<br /><span style="font-size: 1.3em;">The User Guide can be found on the Project website here: <a href="https://github.com/blak3r/yaai/wiki/User-Manual">https://github.com/blak3r/yaai/wiki/User-Manual</a></span>
<?php
}
}
示例6: testGetMetaDataFile
public function testGetMetaDataFile()
{
// backup custom file if it already exists
if (file_exists('custom/modules/Contacts/metadata/listviewdefs.php')) {
copy('custom/modules/Contacts/metadata/listviewdefs.php', 'custom/modules/Contacts/metadata/listviewdefs.php.bak');
unlink('custom/modules/Contacts/metadata/listviewdefs.php');
}
$this->_view->module = 'Contacts';
$this->_view->type = 'list';
$metaDataFile = $this->_view->getMetaDataFile();
$this->assertEquals('modules/Contacts/metadata/listviewdefs.php', $metaDataFile, 'Did not load the correct metadata file');
//test custom file
if (!file_exists('custom/modules/Contacts/metadata/')) {
sugar_mkdir('custom/modules/Contacts/metadata/', null, true);
}
$customFile = 'custom/modules/Contacts/metadata/listviewdefs.php';
if (!file_exists($customFile)) {
sugar_file_put_contents($customFile, array());
$customMetaDataFile = $this->_view->getMetaDataFile();
$this->assertEquals($customFile, $customMetaDataFile, 'Did not load the correct custom metadata file');
unlink($customFile);
}
// Restore custom file if we backed it up
if (file_exists('custom/modules/Contacts/metadata/listviewdefs.php.bak')) {
rename('custom/modules/Contacts/metadata/listviewdefs.php.bak', 'custom/modules/Contacts/metadata/listviewdefs.php');
}
}
示例7: setUp
public function setUp()
{
$this->_has_initial_server_port = isset($_SERVER['SERVER_PORT']);
if ($this->_has_initial_server_port) {
$this->_initial_server_port = $_SERVER['SERVER_PORT'];
}
sugar_file_put_contents($this->_cron_test_file, "<?php echo 'Hello World!';");
}
示例8: testEmailImport
/**
* Check if semi-colon separated non-primary mails
* are being imported properly
*
* @dataProvider providerEmailImport
*/
public function testEmailImport($module, $lastName, $expected, $test)
{
$fileCreated = sugar_file_put_contents($this->_file, $test);
$this->assertGreaterThan(0, $fileCreated, 'Failed to write to ' . $this->_file);
// Create the ImportFile the Importer uses from our CSV
$importSource = new ImportFile($this->_file, ',', '"');
// Create the bean type we're importing
$this->_importObject = $bean = new $module();
// Setup needed $_REQUEST data
$_REQUEST['columncount'] = 2;
$_REQUEST['colnum_0'] = 'email_addresses_non_primary';
$_REQUEST['colnum_1'] = 'last_name';
// A few changed for Accounts module
if ($module == "Account") {
$_REQUEST['columncount'] = 3;
$_REQUEST['colnum_1'] = 'name';
$_REQUEST['colnum_2'] = 'team_id';
}
$_REQUEST['import_module'] = $bean->module_dir;
$_REQUEST['importlocale_charset'] = 'UTF-8';
$_REQUEST['importlocale_dateformat'] = "m/d/Y";
$_REQUEST['importlocale_timeformat'] = "h:i a";
$_REQUEST['importlocale_timezone'] = 'GMT';
$_REQUEST['importlocale_default_currency_significant_digits'] = '2';
$_REQUEST['importlocale_currency'] = '-99';
$_REQUEST['importlocale_dec_sep'] = '.';
$_REQUEST['importlocale_currency'] = '-99';
$_REQUEST['importlocale_default_locale_name_format'] = 's f l';
$_REQUEST['importlocale_num_grp_sep'] = ',';
// Create the Importer and try importing
$importer = new Importer($importSource, $bean);
$importer->import();
// Check if the Lead is created
$query = "SELECT id FROM {$bean->table_name} WHERE {$_REQUEST['colnum_1']} = '{$lastName}'";
$result = $GLOBALS['db']->query($query);
$row = $GLOBALS['db']->fetchByAssoc($result);
$this->assertNotEmpty($row['id'], $module . ' not created');
// Save Lead id for easier cleanup after test
$this->_cleanId = $row['id'];
// Check if all of the mails got created and linked properly
foreach ($expected as $mail) {
// Check if the mail got created
$query = "SELECT id FROM email_addresses WHERE email_address = '{$mail}'";
$result = $GLOBALS['db']->query($query);
$row = $GLOBALS['db']->fetchByAssoc($result);
$this->assertNotEmpty($row['id'], 'Mail not created');
$mailId = $row['id'];
// Check if the mail is linked
$query = "SELECT id FROM email_addr_bean_rel WHERE email_address_id = '{$mailId}' AND bean_module = '{$bean->module_dir}' AND deleted = 0 AND primary_address = 0";
$result = $GLOBALS['db']->query($query);
$row = $GLOBALS['db']->fetchByAssoc($result);
$this->assertNotEmpty($row['id'], 'Mail not linked');
}
}
示例9: run
public function run()
{
foreach (glob('custom/themes/clients/*/*/variables.less') as $customTheme) {
$path = pathinfo($customTheme, PATHINFO_DIRNAME);
$variables = $this->parseFile($path . '/variables.less');
// Convert to new defs
$lessdefs = array('colors' => $variables['hex']);
// Write new defs
$write = "<?php\n" . '// created: ' . date('Y-m-d H:i:s') . "\n" . '$lessdefs = ' . var_export_helper($lessdefs) . ';';
sugar_file_put_contents($path . '/variables.php', $write);
// Delete old defs
$this->fileToDelete($path . '/variables.less');
}
}
示例10: tearDown
public function tearDown()
{
$this->removeCustomAppStrings();
$this->removeModuleStrings(array('Accounts'));
SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
unset($GLOBALS['current_user']);
unset($GLOBALS['beanList']);
unset($GLOBALS['beanFiles']);
SugarCache::$isCacheReset = false;
if (!empty($this->language_contents)) {
foreach ($this->language_contents as $key => $contents) {
sugar_file_put_contents("custom/modules/{$key}/language/en_us.lang.php", $contents);
}
}
}
示例11: testGetMetaDataFile
public function testGetMetaDataFile()
{
$this->_view->module = 'Contacts';
$this->_view->type = 'list';
$metaDataFile = $this->_view->getMetaDataFile();
$this->assertEquals('modules/Contacts/metadata/listviewdefs.php', $metaDataFile, 'Did not load the correct metadata file');
//test custom file
sugar_mkdir('custom/modules/Contacts/metadata/', null, true);
$customFile = 'custom/modules/Contacts/metadata/listviewdefs.php';
if (!file_exists($customFile)) {
sugar_file_put_contents($customFile, array());
$customMetaDataFile = $this->_view->getMetaDataFile();
$this->assertEquals($customFile, $customMetaDataFile, 'Did not load the correct custom metadata file');
unlink($customFile);
}
}
示例12: run
public function run()
{
// if we are coming from anything newer than 7, just bail
if (version_compare($this->from_version, '7.0.0', '>')) {
return;
}
if (!SugarAutoLoader::fileExists($this->file)) {
# if we don't have a custom file, then bail
return;
}
$viewdefs = null;
include $this->file;
if (!empty($viewdefs)) {
$viewdefs = $this->fixFieldName($viewdefs);
sugar_file_put_contents($this->file, "<?php\n\n \$viewdefs = " . var_export($viewdefs, true) . ";\n");
}
$viewdefs = null;
}
示例13: post_install
function post_install()
{
// Include existing custom entry point registry array
@(include_once 'custom/include/MVC/Controller/entry_point_registry.php');
// Start building custom entry point PHP
$the_string = "<?php\n" . '// created: ' . date('Y-m-d H:i:s') . "\n\n";
// Define new entry point
$entry_point_registry['AsteriskController'] = array('file' => 'custom/modules/Asterisk/include/controller.php', 'auth' => true);
$entry_point_registry['AsteriskCallListener'] = array('file' => 'custom/modules/Asterisk/include/callListener.php', 'auth' => true);
$entry_point_registry['AsteriskCallCreate'] = array('file' => 'custom/modules/Asterisk/include/callCreate.php', 'auth' => true);
// For each custom entry point, add override value
foreach ($entry_point_registry as $key => $value) {
$the_string .= override_value_to_string('entry_point_registry', $key, $value) . "\n";
}
// Write the dir if needed
if (!is_dir('custom/include/MVC/Controller')) {
$result = sugar_mkdir('custom/include/MVC/Controller', NULL, true);
}
// Write the new custom entry point registry file
$result = @sugar_file_put_contents('custom/include/MVC/Controller/entry_point_registry.php', $the_string);
if ($_REQUEST['mode'] == 'Install') {
?>
<br /><br />
<span style="font-size: 1.6em;"><strong>Please review the documentation! There are several additional steps that must be taken.</strong></span>
<br /><span style="font-size: 1.3em;">The User Guide can be found on the Project website here: <a href="https://github.com/blak3r/yaai/wiki/User-Manual">https://github.com/blak3r/yaai/wiki/User-Manual</a>. Please note the fairly comprehensive troubleshooting section at the end of the manual.</span>
<br>
<BR>
<span style="font-size: 1.6em;"><strong>Donate to YAAI</strong></span>
<br /><span style="font-size:1.3em;">Please consider making a donation to the project. Your contribution allows me to spend more time improving/supporting.
We're also in great need of some help from developers. Please see: <a href="https://github.com/blak3r/yaai/wiki/Project-TODO-List">https://github.com/blak3r/yaai/wiki/Project-TODO-List</a> for ways you can help.</span>
<P>
<BR/>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="FA36DGSYQ3NE6">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</P>
<?php
}
}
示例14: handleSave
public function handleSave()
{
if (empty($this->sidecarViewdefs)) {
return true;
}
if ($this->isExt) {
$newExtLocation = "custom/Extension/modules/{$this->module}/Ext/clients/base/menus/header/";
if (!is_dir($newExtLocation)) {
sugar_mkdir($newExtLocation, null, true);
}
$content = "<?php \n";
foreach ($this->sidecarViewdefs as $menuItem) {
$content .= "\${$this->menuName}[] = " . var_export($menuItem, true) . ";\n";
}
return sugar_file_put_contents($newExtLocation . "/" . $this->filename, $content);
} elseif ($this->basename === 'globalControlLinks') {
return $this->handleSaveArray($this->menuName, "custom/clients/base/views/profileactions/profileactions.php");
} else {
return $this->handleSaveArray($this->menuName, "custom/modules/{$this->module}/clients/base/menus/header/header.php");
}
}
示例15: run
public function run()
{
if (version_compare($this->from_version, '7.0', '<') || version_compare($this->from_version, '7.2', '>=')) {
// only need to run this upgrading from 7.0 - 7.2
return;
}
foreach (glob('custom/modules/*/clients/base/views/record/record.php') as $recordFile) {
$this->foundPattern = false;
$viewdef = null;
include $recordFile;
if (!empty($viewdefs)) {
$module = key($viewdefs);
$array = $viewdefs[$module]['base']['view']['record'];
$this->fixLabels($array);
if ($this->foundPattern) {
$this->log("Removing Smarty labels from file {$recordFile}");
sugar_file_put_contents($recordFile, "<?php\n\n/* This file was generated by the 7_UpdateCustomBrokenViewLabels upgrader */\n\$viewdefs['{$module}']['base']['view']['record'] = " . var_export($array, true) . ";\n");
}
}
$viewdefs = null;
}
}