本文整理汇总了PHP中create_custom_directory函数的典型用法代码示例。如果您正苦于以下问题:PHP create_custom_directory函数的具体用法?PHP create_custom_directory怎么用?PHP create_custom_directory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_custom_directory函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: open
function open($filename)
{
require_once 'modules/DynamicLayout/DynamicLayoutUtils.php';
$custom_file = create_custom_directory('layout/' . $filename . '_slot.log');
$this->fp = fopen($custom_file, 'a');
fwrite($this->fp, "BEGIN;");
}
示例2: saveTabGroups
/**
* Takes in the request params from a save request and processes
* them for the save.
*
* @param REQUEST params $params
*/
function saveTabGroups($params)
{
$tabGroups = array();
$selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
for ($count = 0; isset($params['slot_' . $count]); $count++) {
if ($params['delete_' . $count] == 1) {
continue;
}
$index = $params['slot_' . $count];
$labelID = !empty($params['tablabelid_' . $index]) ? $params['tablabelid_' . $index] : 'LBL_GROUPTAB' . $count . '_' . time();
$labelValue = $params['tablabel_' . $index];
if (empty($GLOBALS['app_strings'][$labelID]) || $GLOBALS['app_strings'][$labelID] != $labelValue) {
$contents = return_custom_app_list_strings_file_contents($selected_lang);
$new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
save_custom_app_list_strings_contents($new_contents, $selected_lang);
$app_strings[$labelID] = $labelValue;
}
$tabGroups[$labelID] = array('label' => $labelID);
$tabGroups[$labelID]['modules'] = array();
for ($subcount = 0; isset($params[$index . '_' . $subcount]); $subcount++) {
$tabGroups[$labelID]['modules'][] = $params[$index . '_' . $subcount];
}
}
sugar_cache_put('app_strings', $GLOBALS['app_strings']);
$newFile = create_custom_directory('include/tabConfig.php');
write_array_to_file("GLOBALS['tabStructure']", $tabGroups, $newFile);
$GLOBALS['tabStructure'] = $tabGroups;
}
示例3: write_logic_file
function write_logic_file($module_name, $contents)
{
$file = "modules/" . $module_name . '/logic_hooks.php';
$file = create_custom_directory($file);
$fp = sugar_fopen($file, 'wb');
fwrite($fp, $contents);
fclose($fp);
//end function write_logic_file
}
示例4: backupList
/**
* Retrieves a list of files that are backups to a given file
*
* @param unknown_type $file
* @return unknown
*/
function backupList($file)
{
$newPath = create_custom_directory('backup/' . $file);
$path = dirname($newPath);
$d = dir($path);
$files = array();
while ($entry = $d->read()) {
if (is_file($path . '/' . $entry) && substr_count($path . '/' . $entry, $file) == 1) {
$files[] = $path . '/' . $entry;
}
}
arsort($files);
return $files;
}
示例5: upgrade_aos
function upgrade_aos()
{
global $sugar_config, $db;
if (!isset($sugar_config['aos']['version']) || $sugar_config['aos']['version'] < 5.2) {
$db->query("UPDATE aos_pdf_templates SET type = 'AOS_Quotes' WHERE type = 'Quotes'");
$db->query("UPDATE aos_pdf_templates SET type = 'AOS_Invoices' WHERE type = 'Invoices'");
require_once 'include/utils/file_utils.php';
$old_files = array('custom/Extension/modules/Accounts/Ext/Layoutdefs/Account.php', 'custom/Extension/modules/Accounts/Ext/Vardefs/Account.php', 'custom/Extension/modules/Contacts/Ext/Layoutdefs/Contact.php', 'custom/Extension/modules/Contacts/Ext/Vardefs/Contact.php', 'custom/Extension/modules/Opportunities/Ext/Layoutdefs/Opportunity.php', 'custom/Extension/modules/Opportunities/Ext/Vardefs/Opportunity.php', 'custom/Extension/modules/Project/Ext/Layoutdefs/Project.php', 'custom/Extension/modules/Project/Ext/Vardefs/Project.php', 'modules/AOS_Quotes/js/Quote.js');
foreach ($old_files as $old_file) {
if (file_exists($old_file)) {
create_custom_directory('bak_aos/' . $old_file);
sugar_rename($old_file, 'custom/bak_aos/' . $old_file);
}
}
}
}
示例6: createCustom
public function createCustom()
{
//create new varchar widget and associate with Accounts
$this->custField = get_widget('varchar');
$this->custField->id = 'Accounts' . $this->custFieldName;
$this->custField->name = $this->custFieldName;
$this->custField->type = 'varchar';
$this->custField->label = 'LBL_' . strtoupper($this->custFieldName);
$this->custField->vname = 'LBL_' . strtoupper($this->custFieldName);
$this->custField->len = 255;
$this->custField->custom_module = 'Accounts';
$this->custField->required = 0;
$this->custField->default = 'goofy';
$this->acc = new Account();
$this->df = new DynamicField('Accounts');
$this->df->setup($this->acc);
$this->df->addFieldObject($this->custField);
$this->df->buildCache('Accounts');
$this->custField->save($this->df);
VardefManager::clearVardef();
VardefManager::refreshVardefs('Accounts', 'Account');
//Now create the meta files to make this a Calculated Field.
$fn = $this->custFieldName;
$extensionContent = <<<EOQ
<?php
\$dictionary['Account']['fields']['{$fn}']['duplicate_merge_dom_value']=0;
\$dictionary['Account']['fields']['{$fn}']['calculated']='true';
\$dictionary['Account']['fields']['{$fn}']['formula']='related(\$assigned_user_link,"name")';
\$dictionary['Account']['fields']['{$fn}']['enforced']='true';
\$dictionary['Account']['fields']['{$fn}']['dependency']='';
\$dictionary['Account']['fields']['{$fn}']['type']='varchar';
\$dictionary['Account']['fields']['{$fn}']['name']='{$fn}';
EOQ;
//create custom field file
$this->custFileDirPath = create_custom_directory($this->custFileDirPath);
$fileLoc = $this->custFileDirPath . 'sugarfield_' . $this->custFieldName . '.php';
file_put_contents($fileLoc, $extensionContent);
//run repair and clear to make sure the meta gets picked up
$_REQUEST['repair_silent'] = 1;
$rc = new RepairAndClear();
$rc->repairAndClearAll(array("clearAll", "rebuildExtensions"), array("Accounts"), false, false);
$fn = $this->custFieldName;
}
示例7: pre_install
function pre_install()
{
require_once 'include/utils/array_utils.php';
require_once 'include/utils/file_utils.php';
require_once 'include/utils/sugar_file_utils.php';
$modules_array = array('Accounts', 'Contacts', 'Leads');
foreach ($modules_array as $module) {
$file = "custom/modules/{$module}/metadata/detailviewdefs.php";
if (file_exists($file)) {
$old_contents = file_get_contents($file);
include $file;
} else {
$old_contents = file_get_contents("modules/{$module}/metadata/detailviewdefs.php");
include "modules/{$module}/metadata/detailviewdefs.php";
create_custom_directory("modules/{$module}/metadata/detailviewdefs.php");
}
if (!isset($viewdefs[$module]['DetailView']['templateMeta']['form']['buttons']['AOS_GENLET'])) {
$new_contents = "\$viewdefs['{$module}']['DetailView']['templateMeta']['form']['buttons']['AOS_GENLET'] = array('customCode'=>'<input type=\"button\" class=\"button\" onClick=\"showPopup();\" value=\"{\$APP.LBL_GENERATE_LETTER}\">');\n?>";
$new_contents = str_replace("?>", $new_contents, $old_contents);
$fp = sugar_fopen($file, 'wb');
fwrite($fp, $new_contents);
fclose($fp);
}
}
/** add following:
$entry_point_registry['formLetter'] = array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php', 'auth' => true);
$entry_point_registry['generatePdf'] = array('file' => 'modules/AOS_PDF_Templates/generatePdf.php', 'auth' => true);
*/
$add_entry_point = false;
$new_contents = "";
$entry_point_registry = null;
if (file_exists("custom/include/MVC/Controller/entry_point_registry.php")) {
// This will load an array of the hooks to process
include "custom/include/MVC/Controller/entry_point_registry.php";
if (!isset($entry_point_registry['formLetter'])) {
$add_entry_point = true;
$entry_point_registry['formLetter'] = array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php', 'auth' => true);
}
if (!isset($entry_point_registry['generatePdf'])) {
$add_entry_point = true;
$entry_point_registry['generatePdf'] = array('file' => 'modules/AOS_PDF_Templates/generatePdf.php', 'auth' => true);
}
} else {
$add_entry_point = true;
$entry_point_registry['formLetter'] = array('file' => 'modules/AOS_PDF_Templates/formLetterPdf.php', 'auth' => true);
$entry_point_registry['generatePdf'] = array('file' => 'modules/AOS_PDF_Templates/generatePdf.php', 'auth' => true);
}
if ($add_entry_point == true) {
foreach ($entry_point_registry as $entryPoint => $epArray) {
$new_contents .= "\$entry_point_registry['" . $entryPoint . "'] = array('file' => '" . $epArray['file'] . "' , 'auth' => '" . $epArray['auth'] . "'); \n";
}
$new_contents = "<?php\n{$new_contents}\n?>";
$file = 'custom/include/MVC/Controller/entry_point_registry.php';
$paths = explode('/', $file);
$dir = '';
for ($i = 0; $i < sizeof($paths) - 1; $i++) {
if ($i > 0) {
$dir .= '/';
}
$dir .= $paths[$i];
if (!file_exists($dir)) {
sugar_mkdir($dir, 0755);
}
}
$fp = sugar_fopen($file, 'wb');
fwrite($fp, $new_contents);
fclose($fp);
}
}
示例8: getcwd
}
// re-minify the JS source files
$_REQUEST['root_directory'] = getcwd();
$_REQUEST['js_rebuild_concat'] = 'rebuild';
require_once 'jssource/minify.php';
//Add the cache cleaning here.
if (function_exists('deleteCache')) {
logThis('Call deleteCache', $path);
@deleteCache();
}
// creating full text search logic hooks
// this will be merged into application/Ext/LogicHooks/logichooks.ext.php
// when rebuild_extensions is called
logThis(' Writing FTS hooks');
if (!function_exists('createFTSLogicHook')) {
$customFileLoc = create_custom_directory('Extension/application/Ext/LogicHooks/SugarFTSHooks.php');
$fp = sugar_fopen($customFileLoc, 'wb');
$contents = <<<CIA
<?php
if (!isset(\$hook_array) || !is_array(\$hook_array)) {
\$hook_array = array();
}
if (!isset(\$hook_array['after_save']) || !is_array(\$hook_array['after_save'])) {
\$hook_array['after_save'] = array();
}
\$hook_array['after_save'][] = array(1, 'fts', 'include/SugarSearchEngine/SugarSearchEngineQueueManager.php', 'SugarSearchEngineQueueManager', 'populateIndexQueue');
CIA;
fwrite($fp, $contents);
fclose($fp);
} else {
createFTSLogicHook('Extension/application/Ext/LogicHooks/SugarFTSHooks.php');
示例9: saveTabGroups
/**
* Takes in the request params from a save request and processes
* them for the save.
*
* @param REQUEST params $params
*/
function saveTabGroups($params)
{
//#30205
global $sugar_config;
//Get the selected tab group language
$grouptab_lang = !empty($params['grouptab_lang']) ? $params['grouptab_lang'] : $_SESSION['authenticated_user_language'];
$tabGroups = array();
$selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
$slot_count = $params['slot_count'];
$completedIndexes = array();
for ($count = 0; $count < $slot_count; $count++) {
if ($params['delete_' . $count] == 1 || !isset($params['slot_' . $count])) {
continue;
}
$index = $params['slot_' . $count];
if (isset($completedIndexes[$index])) {
continue;
}
$labelID = !empty($params['tablabelid_' . $index]) ? $params['tablabelid_' . $index] : 'LBL_GROUPTAB' . $count . '_' . time();
$labelValue = $params['tablabel_' . $index];
$app_strings = return_application_language($grouptab_lang);
if (empty($app_strings[$labelID]) || $app_strings[$labelID] != $labelValue) {
$contents = return_custom_app_list_strings_file_contents($grouptab_lang);
$new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
save_custom_app_list_strings_contents($new_contents, $grouptab_lang);
$languages = get_languages();
foreach ($languages as $language => $langlabel) {
if ($grouptab_lang == $language) {
continue;
}
$app_strings = return_application_language($language);
if (!isset($app_strings[$labelID])) {
$contents = return_custom_app_list_strings_file_contents($language);
$new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
save_custom_app_list_strings_contents($new_contents, $language);
}
}
$app_strings[$labelID] = $labelValue;
}
$tabGroups[$labelID] = array('label' => $labelID);
$tabGroups[$labelID]['modules'] = array();
for ($subcount = 0; isset($params[$index . '_' . $subcount]); $subcount++) {
$tabGroups[$labelID]['modules'][] = $params[$index . '_' . $subcount];
}
$completedIndexes[$index] = true;
}
// Force a rebuild of the app language
sugar_cache_clear('app_strings.' . $grouptab_lang);
$newFile = create_custom_directory('include/tabConfig.php');
write_array_to_file("GLOBALS['tabStructure']", $tabGroups, $newFile);
$GLOBALS['tabStructure'] = $tabGroups;
}
示例10: saveCompanyLogo
/**
* Saves the company logo to the custom directory for the default theme, so all themes can use it
*
* @param string $path path to the image to set as the company logo image
*/
function saveCompanyLogo($path)
{
$path = $this->checkTempImage($path);
$logo = create_custom_directory(SugarThemeRegistry::current()->getDefaultImagePath() . '/company_logo.png');
copy($path, $logo);
SugarAutoLoader::addToMap($logo);
sugar_cache_clear('company_logo_attributes');
SugarThemeRegistry::clearAllCaches();
SugarThemeRegistry::current()->clearImageCache('company_logo.png');
MetaDataManager::refreshSectionCache(array(MetaDataManager::MM_LOGOURL));
}
示例11: write_workflow
function write_workflow(&$workflow_object)
{
global $beanlist;
$module = $workflow_object->base_module;
$file = "modules/" . $module . '/workflow/workflow.php';
$file = create_custom_directory($file);
$dump = $workflow_object->get_trigger_contents();
$fp = sugar_fopen($file, 'wb');
fwrite($fp, "<?php\n");
fwrite($fp, '
include_once("include/workflow/alert_utils.php");
include_once("include/workflow/action_utils.php");
include_once("include/workflow/time_utils.php");
include_once("include/workflow/trigger_utils.php");
//BEGIN WFLOW PLUGINS
include_once("include/workflow/custom_utils.php");
//END WFLOW PLUGINS
class ' . $workflow_object->base_module . '_workflow {
function process_wflow_triggers(& $focus){
include("custom/modules/' . $module . '/workflow/triggers_array.php");
include("custom/modules/' . $module . '/workflow/alerts_array.php");
include("custom/modules/' . $module . '/workflow/actions_array.php");
include("custom/modules/' . $module . '/workflow/plugins_array.php");
' . $dump . '
//end function process_wflow_triggers
}
//end class
}
');
fwrite($fp, "\n?>");
fclose($fp);
SugarAutoLoader::addToMap($file);
//end function write_triggers
}
示例12: build_plugin_list
function build_plugin_list()
{
$plugin_list_dump = extract_plugin_list();
$file = "workflow/plugins/plugin_list.php";
$file = create_custom_directory($file);
write_array_to_file('plugin_list', $plugin_list_dump, $file);
SugarAutoLoader::addToMap($file);
}
示例13: saveTabGroups
/**
* Takes in the request params from a save request and processes
* them for the save.
*
* @param REQUEST params $params
*/
function saveTabGroups($params)
{
//#30205
global $sugar_config;
if (strcmp($params['other_group_tab_displayed'], '1') == 0) {
$value = true;
} else {
$value = false;
}
if (!isset($sugar_config['other_group_tab_displayed']) || $sugar_config['other_group_tab_displayed'] != $value) {
require_once 'modules/Configurator/Configurator.php';
$cfg = new Configurator();
$cfg->config['other_group_tab_displayed'] = $value;
$cfg->handleOverride();
}
//Get the selected tab group language
$grouptab_lang = !empty($params['grouptab_lang']) ? $params['grouptab_lang'] : $_SESSION['authenticated_user_language'];
$tabGroups = array();
$selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
$slot_count = $params['slot_count'];
$completedIndexes = array();
for ($count = 0; $count < $slot_count; $count++) {
if ($params['delete_' . $count] == 1 || !isset($params['slot_' . $count])) {
continue;
}
$index = $params['slot_' . $count];
if (isset($completedIndexes[$index])) {
continue;
}
$labelID = !empty($params['tablabelid_' . $index]) ? $params['tablabelid_' . $index] : 'LBL_GROUPTAB' . $count . '_' . time();
$labelValue = $params['tablabel_' . $index];
$appStirngs = return_application_language($grouptab_lang);
if (empty($appStirngs[$labelID]) || $appStirngs[$labelID] != $labelValue) {
$contents = return_custom_app_list_strings_file_contents($grouptab_lang);
$new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
save_custom_app_list_strings_contents($new_contents, $grouptab_lang);
$languages = get_languages();
foreach ($languages as $language => $langlabel) {
if ($grouptab_lang == $language) {
continue;
}
$appStirngs = return_application_language($language);
if (!isset($appStirngs[$labelID])) {
$contents = return_custom_app_list_strings_file_contents($language);
$new_contents = replace_or_add_app_string($labelID, $labelValue, $contents);
save_custom_app_list_strings_contents($new_contents, $language);
}
}
$app_strings[$labelID] = $labelValue;
}
$tabGroups[$labelID] = array('label' => $labelID);
$tabGroups[$labelID]['modules'] = array();
for ($subcount = 0; isset($params[$index . '_' . $subcount]); $subcount++) {
$tabGroups[$labelID]['modules'][] = $params[$index . '_' . $subcount];
}
$completedIndexes[$index] = true;
}
sugar_cache_put('app_strings', $GLOBALS['app_strings']);
$newFile = create_custom_directory('include/tabConfig.php');
write_array_to_file("GLOBALS['tabStructure']", $tabGroups, $newFile);
$GLOBALS['tabStructure'] = $tabGroups;
}
示例14: createAnonymousCustomTheme
public static function createAnonymousCustomTheme($themename = '')
{
if (empty($themename)) {
$themename = 'TestThemeCustom' . mt_rand();
}
create_custom_directory("themes/{$themename}/images/");
create_custom_directory("themes/{$themename}/css/");
create_custom_directory("themes/{$themename}/js/");
sugar_touch("custom/themes/{$themename}/css/style.css");
sugar_touch("custom/themes/{$themename}/js/style.js");
sugar_touch("custom/themes/{$themename}/images/Accounts.gif");
sugar_touch("custom/themes/{$themename}/images/fonts.big.icon.gif");
$themedef = "<?php\n";
$themedef .= "\$themedef = array(\n";
$themedef .= "'name' => 'custom {$themename}',";
$themedef .= "'dirName' => '{$themename}',";
$themedef .= "'description' => 'custom {$themename}',";
$themedef .= "'version' => array('regex_matches' => array('.*')),";
$themedef .= ");";
sugar_file_put_contents("custom/themes/{$themename}/themedef.php", $themedef);
self::$_createdThemes[] = $themename;
SugarThemeRegistry::buildRegistry();
return $themename;
}
示例15: sugar_die
global $current_user;
if (!is_admin($current_user)) {
sugar_die("Unauthorized access to administration.");
}
$title = getClassicModuleTitle("Administration", array("<a href='index.php?module=Administration&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>", translate('LBL_CONFIGURE_SHORTCUT_BAR')), true);
$msg = "";
global $theme, $currentModule, $app_list_strings, $app_strings;
$GLOBALS['log']->info("Administration ConfigureShortcutBar view");
$actions_path = "include/DashletContainer/Containers/DCActions.php";
//If save is set, save then let the user know if the save worked.
if (!empty($_REQUEST['enabled_modules'])) {
$toDecode = html_entity_decode($_REQUEST['enabled_modules'], ENT_QUOTES);
$modules = json_decode($toDecode);
$out = "<?php\n \$DCActions = \n" . var_export_helper($modules) . ";";
if (!is_file("custom/" . $actions_path)) {
create_custom_directory("include/DashletContainer/Containers/");
}
if (file_put_contents("custom/" . $actions_path, $out) === false) {
echo translate("LBL_SAVE_FAILED");
} else {
echo "true";
}
} else {
include $actions_path;
//Start with the default module
$availibleModules = $DCActions;
//Add the ones currently on the layout
if (is_file('custom/' . $actions_path)) {
include 'custom/' . $actions_path;
$availibleModules = array_merge($availibleModules, $DCActions);
}