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


PHP var_export_helper函数代码示例

本文整理汇总了PHP中var_export_helper函数的典型用法代码示例。如果您正苦于以下问题:PHP var_export_helper函数的具体用法?PHP var_export_helper怎么用?PHP var_export_helper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: set_array

 function set_array($array, $indent = 0)
 {
     $slot_start = '<slot>';
     $slot_end = '</slot>';
     if (empty($this->contents)) {
         $this->contents = 'Array(<br>';
     } else {
         $slot_start = '';
         $slot_end = '';
         $this->contents .= ' Array(<br>';
     }
     foreach ($array as $key => $arr) {
         for ($i = 0; $i < $indent; $i++) {
             $this->contents .= '&nbsp; &nbsp; &nbsp; ';
         }
         $this->contents .= '&nbsp;&nbsp;&nbsp;' . $slot_start . var_export_helper($key) . $slot_end . '&nbsp;=>&nbsp;';
         if (is_array($arr)) {
             $this->contents .= $slot_start;
             $this->set_array($arr, $indent + 1);
             $this->contents .= $slot_end;
         } else {
             $this->contents .= $slot_start . var_export_helper($arr, true) . $slot_end . '<br>';
         }
     }
     for ($i = 0; $i < $indent; $i++) {
         $this->contents .= '&nbsp; &nbsp; &nbsp; ';
     }
     $this->contents .= ');<br>';
 }
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:29,代码来源:ArrayParser.php

示例2: parse

 /**
  * parse
  * @param $mixed 
  * @return $obj A MetaDataBean instance
  **/
 function parse($filePath, $vardefs = array(), $moduleDir = '', $merge = false, $masterCopy = null)
 {
     $contents = file_get_contents($filePath);
     $contents = $this->trimHTML($contents);
     // Get the second table in the page and onward
     $tables = $this->getElementsByType("table", $contents);
     //basic search table
     $basicSection = $this->processSection("basic", $tables[0], $filePath, $vardefs);
     $advancedSection = $this->processSection("advanced", $tables[1], $filePath, $vardefs);
     if (file_exists($masterCopy)) {
         require $masterCopy;
         $layouts = $searchdefs[$moduleDir]['layout'];
         if (isset($layouts['basic_search'])) {
             $basicSection = $this->mergeSection($basicSection, $layouts['basic_search']);
             $basicSection = $this->applyRules($moduleDir, $basicSection);
         }
         if (isset($layouts['advanced_search'])) {
             $advancedSection = $this->mergeSection($advancedSection, $layouts['advanced_search']);
             $advancedSection = $this->applyRules($moduleDir, $advancedSection);
         }
     }
     //if
     $header = "<?php\n\n";
     $header .= "\$searchdefs['{$moduleDir}'] = array(\n    'templateMeta' => array('maxColumns' => '3', 'widths' => array('label' => '10', 'field' => '30')),\n    'layout' => array(  \t\t\t\t\t\n\n\t'basic_search' =>";
     $header .= "\t" . var_export_helper($basicSection);
     $header .= "\n\t,'advanced_search' =>";
     $header .= "\t" . var_export_helper($advancedSection);
     $header .= "\n     ),\n\n);\n?>";
     $header = preg_replace('/(\\d+)[\\s]=>[\\s]?/', "", $header);
     return $header;
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:36,代码来源:SearchFormMetaParser.php

示例3: upgrade_custom_relationships

/**
 * Searches through the installed relationships to find broken self referencing one-to-many relationships 
 * (wrong field used in the subpanel, and the left link not marked as left)
 */
function upgrade_custom_relationships($modules = array())
{
    global $current_user, $moduleList;
    if (!is_admin($current_user)) {
        sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
    }
    require_once "modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php";
    require_once "modules/ModuleBuilder/parsers/relationships/OneToManyRelationship.php";
    if (empty($modules)) {
        $modules = $moduleList;
    }
    foreach ($modules as $module) {
        $depRels = new DeployedRelationships($module);
        $relList = $depRels->getRelationshipList();
        foreach ($relList as $relName) {
            $relObject = $depRels->get($relName);
            $def = $relObject->getDefinition();
            //We only need to fix self referencing one to many relationships
            if ($def['lhs_module'] == $def['rhs_module'] && $def['is_custom'] && $def['relationship_type'] == "one-to-many") {
                $layout_defs = array();
                if (!is_dir("custom/Extension/modules/{$module}/Ext/Layoutdefs") || !is_dir("custom/Extension/modules/{$module}/Ext/Vardefs")) {
                    continue;
                }
                //Find the extension file containing the vardefs for this relationship
                foreach (scandir("custom/Extension/modules/{$module}/Ext/Vardefs") as $file) {
                    if (substr($file, 0, 1) != "." && strtolower(substr($file, -4)) == ".php") {
                        $dictionary = array($module => array("fields" => array()));
                        $filePath = "custom/Extension/modules/{$module}/Ext/Vardefs/{$file}";
                        include $filePath;
                        if (isset($dictionary[$module]["fields"][$relName])) {
                            $rhsDef = $dictionary[$module]["fields"][$relName];
                            //Update the vardef for the left side link field
                            if (!isset($rhsDef['side']) || $rhsDef['side'] != 'left') {
                                $rhsDef['side'] = 'left';
                                $fileContents = file_get_contents($filePath);
                                $out = preg_replace('/\\$dictionary[\\w"\'\\[\\]]*?' . $relName . '["\'\\[\\]]*?\\s*?=\\s*?array\\s*?\\(.*?\\);/s', '$dictionary["' . $module . '"]["fields"]["' . $relName . '"]=' . var_export_helper($rhsDef) . ";", $fileContents);
                                file_put_contents($filePath, $out);
                            }
                        }
                    }
                }
                //Find the extension file containing the subpanel definition for this relationship
                foreach (scandir("custom/Extension/modules/{$module}/Ext/Layoutdefs") as $file) {
                    if (substr($file, 0, 1) != "." && strtolower(substr($file, -4)) == ".php") {
                        $layout_defs = array($module => array("subpanel_setup" => array()));
                        $filePath = "custom/Extension/modules/{$module}/Ext/Layoutdefs/{$file}";
                        include $filePath;
                        foreach ($layout_defs[$module]["subpanel_setup"] as $key => $subDef) {
                            if ($layout_defs[$module]["subpanel_setup"][$key]['get_subpanel_data'] == $relName) {
                                $fileContents = file_get_contents($filePath);
                                $out = preg_replace('/[\'"]get_subpanel_data[\'"]\\s*=>\\s*[\'"]' . $relName . '[\'"],/s', "'get_subpanel_data' => '{$def["join_key_lhs"]}',", $fileContents);
                                file_put_contents($filePath, $out);
                            }
                        }
                    }
                }
            }
        }
    }
}
开发者ID:NALSS,项目名称:SuiteCRM,代码行数:64,代码来源:upgrade_custom_relationships.php

示例4: testvar_export_helper

 public function testvar_export_helper()
 {
     //execute the method and test if it returns expected values
     $tempArray = array('Key1' => 'value1', 'Key2' => 'value2');
     $expected = "array (\n  'Key1' => 'value1',\n  'Key2' => 'value2',\n)";
     $actual = var_export_helper($tempArray);
     $this->assertSame($actual, $expected);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:8,代码来源:arrayUtilsTest.php

示例5: override_recursive_helper

function override_recursive_helper($key_names, $array_name, $value)
{
    if (empty($key_names)) {
        return "=" . var_export_helper($value, true) . ";";
    } else {
        $key = array_shift($key_names);
        return "[" . var_export($key, true) . "]" . override_recursive_helper($key_names, $array_name, $value);
    }
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:9,代码来源:array_utils.php

示例6: write_array_to_file

function write_array_to_file($the_name, $the_array, $the_file)
{
    $the_string = "<?php\n" . '// created: ' . date('Y-m-d H:i:s') . "\n" . "\${$the_name} = " . var_export_helper($the_array) . ";\n?>\n";
    if ($fh = @fopen($the_file, "w")) {
        fputs($fh, $the_string, strlen($the_string));
        fclose($fh);
        return true;
    } else {
        return false;
    }
}
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:11,代码来源:file_utils.php

示例7: 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');
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:14,代码来源:4_ConvertPortalTheme.php

示例8: write_array_to_file

function write_array_to_file($the_name, $the_array, $the_file)
{
    $the_string = "<?php\n" . '\\n
if(empty(\\$GLOBALS["sugarEntry"])) die("Not A Valid Entry Point");
/*********************************************************************************
 * SugarCRM is a customer relationship management program developed by
 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
 * 
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 * 
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/
' . "\n \${$the_name} = " . var_export_helper($the_array) . ";\n?>\n";
    if ($fh = @sugar_fopen($the_file, "w")) {
        fputs($fh, $the_string);
        fclose($fh);
        return true;
    } else {
        return false;
    }
}
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:47,代码来源:parseEncoding.php

示例9: _saveToFile

 protected function _saveToFile($filename, $defs, $useVariables = true, $forPopup = false)
 {
     if (file_exists($filename)) {
         unlink($filename);
     }
     mkdir_recursive(dirname($filename));
     $useVariables = count($this->_variables) > 0 && $useVariables;
     // only makes sense to do the variable replace if we have variables to replace...
     // create the new metadata file contents, and write it out
     $out = "<?php\n";
     if ($useVariables) {
         // write out the $<variable>=<modulename> lines
         foreach ($this->_variables as $key => $value) {
             $out .= "\${$key} = '" . $value . "';\n";
         }
     }
     $viewVariable = $this->_fileVariables[$this->_view];
     if ($forPopup) {
         $out .= "\${$viewVariable} = \n" . var_export_helper($defs);
     } else {
         $out .= "\${$viewVariable} [" . ($useVariables ? '$module_name' : "'{$this->_moduleName}'") . "] = \n" . var_export_helper($defs);
     }
     $out .= ";\n?>\n";
     if (sugar_file_put_contents($filename, $out) === false) {
         $GLOBALS['log']->fatal(get_class($this) . ": could not write new viewdef file " . $filename);
     }
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:27,代码来源:AbstractMetaDataImplementation.php

示例10: _writeToFile

 function _writeToFile($file, $view, $moduleName, $defs, $variables)
 {
     if (file_exists($file)) {
         unlink($file);
     }
     mkdir_recursive(dirname($file));
     $GLOBALS['log']->debug("ModuleBuilderParser->_writeFile(): file=" . $file);
     $useVariables = count($variables) > 0;
     if ($fh = @sugar_fopen($file, 'w')) {
         $out = "<?php\n";
         if ($useVariables) {
             // write out the $<variable>=<modulename> lines
             foreach ($variables as $key => $value) {
                 $out .= "\${$key} = '" . $value . "';\n";
             }
         }
         // write out the defs array itself
         switch (strtolower($view)) {
             case 'editview':
             case 'detailview':
             case 'quickcreate':
                 $defs = array($view => $defs);
                 break;
             default:
                 break;
         }
         $viewVariable = $this->_defMap[strtolower($view)];
         $out .= "\${$viewVariable} = ";
         $out .= $useVariables ? "array (\n\$module_name =>\n" . var_export_helper($defs) : var_export_helper(array($moduleName => $defs));
         // tidy up the parenthesis
         if ($useVariables) {
             $out .= "\n)";
         }
         $out .= ";\n?>\n";
         //           $GLOBALS['log']->debug("parser.modifylayout.php->_writeFile(): out=".print_r($out,true));
         fputs($fh, $out);
         fclose($fh);
     } else {
         $GLOBALS['log']->fatal("ModuleBuilderParser->_writeFile() Could not write new viewdef file " . $file);
     }
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:41,代码来源:ModuleBuilderParser.php

示例11: authenticateUser

 /**
  * Does the actual authentication of the user and returns an id that will be used
  * to load the current user (loadUserOnSession)
  *
  * @param STRING $name
  * @param STRING $password
  * @return STRING id - used for loading the user
  *
  * Contributions by Erik Mitchell erikm@logicpd.com
  */
 function authenticateUser($name, $password)
 {
     $server = $GLOBALS['ldap_config']->settings['ldap_hostname'];
     $port = $GLOBALS['ldap_config']->settings['ldap_port'];
     if (!$port) {
         $port = DEFAULT_PORT;
     }
     Log::debug("ldapauth: Connecting to LDAP server: {$server}");
     $ldapconn = ldap_connect($server, $port);
     $error = ldap_errno($ldapconn);
     if ($this->loginError($error)) {
         return '';
     }
     @ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
     @ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
     // required for AD
     // If constant is defined, set the timeout (PHP >= 5.3)
     if (defined('LDAP_OPT_NETWORK_TIMEOUT')) {
         // Network timeout, lower than PHP and DB timeouts
         @ldap_set_option($ldapconn, LDAP_OPT_NETWORK_TIMEOUT, 60);
     }
     $bind_user = $this->ldap_rdn_lookup($name, $password);
     Log::debug("ldapauth.ldap_authenticate_user: ldap_rdn_lookup returned bind_user=" . $bind_user);
     if (!$bind_user) {
         Log::fatal("SECURITY: ldapauth: failed LDAP bind (login) by " . $name . ", could not construct bind_user");
         return '';
     }
     // MRF - Bug #18578 - punctuation was being passed as HTML entities, i.e. &amp;
     $bind_password = html_entity_decode($password, ENT_QUOTES);
     Log::info("ldapauth: Binding user " . $bind_user);
     $bind = ldap_bind($ldapconn, $bind_user, $bind_password);
     $error = ldap_errno($ldapconn);
     if ($this->loginError($error)) {
         $full_user = $GLOBALS['ldap_config']->settings['ldap_bind_attr'] . "=" . $bind_user . "," . $GLOBALS['ldap_config']->settings['ldap_base_dn'];
         Log::info("ldapauth: Binding user " . $full_user);
         $bind = ldap_bind($ldapconn, $full_user, $bind_password);
         $error = ldap_errno($ldapconn);
         if ($this->loginError($error)) {
             return '';
         }
     }
     Log::info("ldapauth: Bind attempt complete.");
     if ($bind) {
         // Authentication succeeded, get info from LDAP directory
         $attrs = array_keys($GLOBALS['ldapConfig']['users']['fields']);
         $base_dn = $GLOBALS['ldap_config']->settings['ldap_base_dn'];
         $name_filter = $this->getUserNameFilter($name);
         //add the group user attribute that we will compare to the group attribute for membership validation if group membership is turned on
         if (!empty($GLOBALS['ldap_config']->settings['ldap_group']) && !empty($GLOBALS['ldap_config']->settings['ldap_group_user_attr']) && !empty($GLOBALS['ldap_config']->settings['ldap_group_attr'])) {
             if (!in_array($attrs, $GLOBALS['ldap_config']->settings['ldap_group_user_attr'])) {
                 $attrs[] = $GLOBALS['ldap_config']->settings['ldap_group_user_attr'];
             }
         }
         Log::debug("ldapauth: Fetching user info from Directory using base dn: " . $base_dn . ", name_filter: " . $name_filter . ", attrs: " . var_export_helper($attrs));
         $result = @ldap_search($ldapconn, $base_dn, $name_filter, $attrs);
         $error = ldap_errno($ldapconn);
         if ($this->loginError($error)) {
             return '';
         }
         Log::debug("ldapauth: ldap_search complete.");
         $info = @ldap_get_entries($ldapconn, $result);
         $error = ldap_errno($ldapconn);
         if ($this->loginError($error)) {
             return '';
         }
         Log::debug("ldapauth: User info from Directory fetched.");
         // some of these don't seem to work
         $this->ldapUserInfo = array();
         foreach ($GLOBALS['ldapConfig']['users']['fields'] as $key => $value) {
             //MRF - BUG:19765
             $key = strtolower($key);
             if (isset($info[0]) && isset($info[0][$key]) && isset($info[0][$key][0])) {
                 $this->ldapUserInfo[$value] = $info[0][$key][0];
             }
         }
         //we should check that a user is a member of a specific group
         if (!empty($GLOBALS['ldap_config']->settings['ldap_group'])) {
             Log::debug("LDAPAuth: scanning group for user membership");
             $group_user_attr = $GLOBALS['ldap_config']->settings['ldap_group_user_attr'];
             $group_attr = $GLOBALS['ldap_config']->settings['ldap_group_attr'];
             if (!isset($info[0][$group_user_attr])) {
                 Log::fatal("ldapauth: {$group_user_attr} not found for user {$name} cannot authenticate against an LDAP group");
                 ldap_close($ldapconn);
                 return '';
             } else {
                 $user_uid = $info[0][$group_user_attr];
                 if (is_array($user_uid)) {
                     $user_uid = $user_uid[0];
                 }
                 // If user_uid contains special characters (for LDAP) we need to escape them !
//.........这里部分代码省略.........
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:101,代码来源:LDAPAuthenticateUser.php

示例12: handleSave

 function handleSave($populate = true)
 {
     if (empty($this->_packageName)) {
         foreach (array(MB_CUSTOMMETADATALOCATION, MB_BASEMETADATALOCATION) as $value) {
             $file = $this->implementation->getFileName(MB_POPUPLIST, $this->_moduleName, $value);
             if (file_exists($file)) {
                 break;
             }
         }
         $writeFile = $this->implementation->getFileName(MB_POPUPLIST, $this->_moduleName);
         if (!file_exists($writeFile)) {
             mkdir_recursive(dirname($writeFile));
         }
     } else {
         $writeFile = $file = $this->implementation->getFileName(MB_POPUPLIST, $this->_moduleName, $this->_packageName);
     }
     $this->implementation->_history->append($file);
     if ($populate) {
         $this->_populateFromRequest();
     }
     $out = "<?php\n";
     //Load current module languages
     global $mod_strings, $current_language;
     $oldModStrings = $mod_strings;
     $GLOBALS['mod_strings'] = return_module_language($current_language, $this->_moduleName);
     require $file;
     if (!isset($popupMeta)) {
         sugar_die("unable to load Module Popup Definition");
     }
     if ($this->_view == MB_POPUPSEARCH) {
         foreach ($this->_viewdefs as $k => $v) {
             if (isset($this->_viewdefs[$k]) && isset($this->_viewdefs[$k]['default'])) {
                 unset($this->_viewdefs[$k]['default']);
             }
         }
         $this->_viewdefs = $this->convertSearchToListDefs($this->_viewdefs);
         $popupMeta['searchdefs'] = $this->_viewdefs;
         $this->addNewSearchDef($this->_viewdefs, $popupMeta);
     } else {
         $popupMeta['listviewdefs'] = array_change_key_case($this->_viewdefs, CASE_UPPER);
     }
     //provide a way for users to add to the reserve properties list via the 'addToReserve' element
     $totalReserveProps = self::$reserveProperties;
     if (!empty($popupMeta['addToReserve'])) {
         $totalReserveProps = array_merge(self::$reserveProperties, $popupMeta['addToReserve']);
     }
     $allProperties = array_merge($totalReserveProps, array('searchdefs', 'listviewdefs'));
     $out .= "\$popupMeta = array (\n";
     foreach ($allProperties as $p) {
         if (isset($popupMeta[$p])) {
             $out .= "    '{$p}' => " . var_export_helper($popupMeta[$p]) . ",\n";
         }
     }
     $out .= ");\n";
     file_put_contents($writeFile, $out);
     //return back mod strings
     $GLOBALS['mod_strings'] = $oldModStrings;
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:58,代码来源:PopupMetaDataParser.php

示例13: writeLanguageFile

 /**
  * @param string $fileNameToUpdate
  * @param array $app_list_strings
  * @param array $app_strings
  * @param int $keyCount - How many keys were changed
  * @param bool $fullArray - denotes if this is the full array or just additions
  */
 private function writeLanguageFile($fileNameToUpdate, $app_list_strings, $app_strings, $keyCount, $fullArray)
 {
     $this->logThis("-> Updating");
     $this->backupFile($fileNameToUpdate);
     $GLOBALS['log']->debug("fixLanguageFiles: BEGIN writeLanguageFile {$fileNameToUpdate}");
     if (!is_writable($fileNameToUpdate)) {
         $this->logThis("{$fileNameToUpdate} is not writable!!!!!!!", self::SEV_HIGH);
     }
     if ($keyCount > 0) {
         $this->logThis("-> {$keyCount} keys changed");
     }
     $flags = LOCK_EX;
     $moduleList = false;
     $moduleListSingular = false;
     $phpTag = "<?php";
     if (count($app_list_strings) > 0) {
         foreach ($app_list_strings as $key => $value) {
             if ($key == 'moduleList' && $moduleList == false) {
                 $the_string = "{$phpTag}\n";
                 foreach ($value as $mKey => $mValue) {
                     if (!empty($mValue)) {
                         $the_string .= "\$app_list_strings['moduleList']['{$mKey}'] = '{$mValue}';\n";
                     }
                 }
                 sugar_file_put_contents($fileNameToUpdate, $the_string, $flags);
                 $flags = FILE_APPEND | LOCK_EX;
                 $phpTag = "";
                 $moduleList = true;
             } elseif ($key == 'moduleListSingular' && $moduleListSingular == false) {
                 $the_string = "{$phpTag}\n";
                 foreach ($value as $mKey => $mValue) {
                     if (!empty($mValue)) {
                         $the_string .= "\$app_list_strings['moduleListSingular']['{$mKey}'] = '{$mValue}';\n";
                     }
                 }
                 sugar_file_put_contents($fileNameToUpdate, $the_string, $flags);
                 $flags = FILE_APPEND | LOCK_EX;
                 $phpTag = "";
                 $moduleListSingular = true;
             } else {
                 if ($fullArray) {
                     $the_string = "{$phpTag}\n\$app_list_strings['{$key}'] = " . var_export_helper($app_list_strings[$key]) . ";\n";
                 } else {
                     $the_string = "{$phpTag}\n";
                     foreach ($value as $mKey => $mValue) {
                         if (!empty($mValue)) {
                             $the_string .= "\$app_list_strings['moduleList']['{$mKey}'] = '{$mValue}';\n";
                         }
                     }
                 }
                 sugar_file_put_contents($fileNameToUpdate, $the_string, $flags);
                 $flags = FILE_APPEND | LOCK_EX;
                 $phpTag = "";
             }
         }
     } else {
         $flags = LOCK_EX;
     }
     if (count($app_strings) > 0) {
         $the_string = "{$phpTag}\n";
         foreach ($app_strings as $key => $value) {
             if ($value == NULL || $key == NULL) {
                 continue;
             }
             $the_string .= "\$app_strings['{$key}']='{$value}';\n";
         }
         sugar_file_put_contents($fileNameToUpdate, $the_string, $flags);
     }
     //Make sure the final file is loadable
     // If there is an error this REQUIRE will error out
     require $fileNameToUpdate;
     $GLOBALS['log']->debug("fixLanguageFiles: END writeLanguageFile");
 }
开发者ID:kbrill,项目名称:sugarcrm-tools,代码行数:80,代码来源:fixLanguageFiles.php

示例14: setLastUser

function setLastUser($user_id, $id)
{
    $_SESSION['lastuser'][$id] = $user_id;
    $file = create_cache_directory('modules/AOW_WorkFlow/Users/') . $id . 'lastUser.cache.php';
    $arrayString = var_export_helper(array('User' => $user_id));
    $content = <<<eoq
<?php
\t\$lastUser = {$arrayString};
?>
eoq;
    if ($fh = @sugar_fopen($file, 'w')) {
        fputs($fh, $content);
        fclose($fh);
    }
    return true;
}
开发者ID:isrealconsulting,项目名称:ic-suite,代码行数:16,代码来源:aow_utils.php

示例15: _writeCacheFile

    /**
     * Performs the actual file write.  Abstracted from writeCacheFile() for
     * flexibility
     * @param array $array The array to write to the cache
     * @param string $file Full path (relative) with cache file name
     * @return bool
     */
    function _writeCacheFile($array, $file)
    {
        global $sugar_config;
        $arrayString = var_export_helper($array);
        $date = date("r");
        $the_string = <<<eoq
<?php // created: {$date}
\t\$cacheFile = {$arrayString};
?>
eoq;
        if ($fh = @sugar_fopen($file, "w")) {
            fputs($fh, $the_string);
            fclose($fh);
            return true;
        } else {
            $GLOBALS['log']->debug("EMAILUI: Could not write cache file [ {$file} ]");
            return false;
        }
    }
开发者ID:NALSS,项目名称:SuiteCRM,代码行数:26,代码来源:EmailUI.php


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