• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP var_export_helper函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了var_export_helper函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 [email protected].
 * 
 * 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 [email protected]
  */
 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


示例16: handleSave

 function handleSave($populate = true)
 {
     if (empty($this->_packageName)) {
         foreach (array(MB_CUSTOMMETADATALOCATION, MB_BASEMETADATALOCATION) as $value) {
             $file = $this->implementation->getFileName(MB_DASHLET, $this->_moduleName, $value);
             if (file_exists($file)) {
                 break;
             }
         }
         $writeTodashletName = $dashletName = $this->implementation->getLanguage() . 'Dashlet';
         if (!file_exists($file)) {
             $file = "modules/{$this->_moduleName}/Dashlets/My{$this->_moduleName}Dashlet/My{$this->_moduleName}Dashlet.data.php";
             $dashletName = 'My' . $this->implementation->getLanguage() . 'Dashlet';
         }
         $writeFile = $this->implementation->getFileName(MB_DASHLET, $this->_moduleName);
         if (!file_exists($writeFile)) {
             mkdir_recursive(dirname($writeFile));
         }
     } else {
         $writeFile = $file = $this->implementation->getFileName(MB_DASHLET, $this->_moduleName, $this->_packageName);
         $writeTodashletName = $dashletName = $this->implementation->module->key_name . 'Dashlet';
     }
     $this->implementation->_history->append($file);
     if ($populate) {
         $this->_populateFromRequest();
     }
     $out = "<?php\n";
     require $file;
     if (!isset($dashletData[$dashletName])) {
         sugar_die("unable to load Module Dashlet Definition");
     }
     if ($fh = sugar_fopen($writeFile, 'w')) {
         if ($this->_view == MB_DASHLETSEARCH) {
             $dashletData[$dashletName]['searchFields'] = $this->ConvertSearchToDashletDefs($this->_viewdefs);
         } else {
             $dashletData[$dashletName]['columns'] = $this->_viewdefs;
         }
         $out .= "\$dashletData['{$writeTodashletName}']['searchFields'] = " . var_export_helper($dashletData[$dashletName]['searchFields']) . ";\n";
         $out .= "\$dashletData['{$writeTodashletName}']['columns'] = " . var_export_helper($dashletData[$dashletName]['columns']) . ";\n";
         fputs($fh, $out);
         fclose($fh);
     }
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:43,代码来源:DashletMetaDataParser.php


示例17: updateMetaDataFiles

 /**
  * This method updates the metadata files (detailviewdefs.php) according to the settings in display_config.php
  *
  * @return bool $result boolean value indicating whether or not the method successfully completed.
  */
 public static function updateMetaDataFiles()
 {
     if (file_exists(CONNECTOR_DISPLAY_CONFIG_FILE)) {
         $modules_sources = [];
         require CONNECTOR_DISPLAY_CONFIG_FILE;
         Log::debug(var_export_helper($modules_sources, true));
         if (!empty($modules_sources)) {
             foreach ($modules_sources as $module => $mapping) {
                 $metadata_file = file_exists("custom/modules/{$module}/metadata/detailviewdefs.php") ? "custom/modules/{$module}/metadata/detailviewdefs.php" : "modules/{$module}/metadata/detailviewdefs.php";
                 $viewdefs = [];
                 if (!file_exists($metadata_file)) {
                     Log::info("Unable to update metadata file for module: {$module}");
                     continue;
                 } else {
                     require $metadata_file;
                 }
                 $insertConnectorButton = true;
                 self::removeHoverField($viewdefs, $module);
                 //Insert the hover field if available
                 if (!empty($mapping)) {
                     require_once 'include/connectors/sources/SourceFactory.php';
                     require_once 'include/connectors/formatters/FormatterFactory.php';
                     $shown_formatters = [];
                     foreach ($mapping as $id) {
                         $source = SourceFactory::getSource($id, false);
                         if ($source->isEnabledInHover() && $source->isRequiredConfigFieldsForButtonSet()) {
                             $shown_formatters[$id] = FormatterFactory::getInstance($id);
                         }
                     }
                     //Now we have to decide which field to put it on... use the first one for now
                     if (!empty($shown_formatters)) {
                         foreach ($shown_formatters as $id => $formatter) {
                             $added_field = false;
                             $formatter_mapping = $formatter->getSourceMapping();
                             $source = $formatter->getComponent()->getSource();
                             //go through the mapping and add the hover to every field define in the mapping
                             //1) check for hover fields
                             $hover_fields = $source->getFieldsWithParams('hover', true);
                             foreach ($hover_fields as $key => $def) {
                                 if (!empty($formatter_mapping['beans'][$module][$key])) {
                                     $added_field = self::setHoverField($viewdefs, $module, $formatter_mapping['beans'][$module][$key], $id);
                                 }
                             }
                             //2) check for first mapping field
                             if (!$added_field && !empty($formatter_mapping['beans'][$module])) {
                                 foreach ($formatter_mapping['beans'][$module] as $key => $val) {
                                     $added_field = self::setHoverField($viewdefs, $module, $val, $id);
                                     if ($added_field) {
                                         break;
                                     }
                                 }
                             }
                         }
                         //foreach
                         //Log an error message
                         if (!$added_field) {
                             Log::fatal("Unable to place hover field link on metadata for module {$module}");
                         }
                     }
                 }
                 //Make the directory for the metadata file
                 if (!file_exists("custom/modules/{$module}/metadata")) {
                     mkdir_recursive("custom/modules/{$module}/metadata");
                 }
                 if (!write_array_to_file('viewdefs', $viewdefs, "custom/modules/{$module}/metadata/detailviewdefs.php")) {
                     Log::fatal("Cannot update file custom/modules/{$module}/metadata/detailviewdefs.php");
                     return false;
                 }
                 if (file_exists($cachedfile = sugar_cached("modules/{$module}/DetailView.tpl")) && !unlink($cachedfile)) {
                     Log::fatal("Cannot delete file {$cachedfile}");
                     return false;
                 }
             }
         }
     }
     return true;
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:82,代码来源:ConnectorUtils.php


示例18: testUsingCustomPopUpElements

 public function testUsingCustomPopUpElements()
 {
     //declare the vars global and then include the modules file to make sure they are available during testing
     global $moduleList, $beanList, $beanFiles;
     include 'include/modules.php';
     if (empty($GLOBALS['app_list_strings'])) {
         $language = $GLOBALS['current_language'];
         $GLOBALS['app_list_strings'] = return_app_list_strings_language($language);
     }
     //write out to file and assert that the file was written, or we shouldn't continue
     $meta = "<?php\n \$popupMeta = array (\n";
     foreach ($this->newPopupMeta as $k => $v) {
         $meta .= "    '{$k}' => " . var_export_helper($v) . ",\n";
     }
     $meta .= ");\n";
     $writeResult = sugar_file_put_contents($this->customFilePath, $meta);
     $this->assertGreaterThan(0, $writeResult, 'there was an error writing custom popup meta to file using this path: ' . $this->customFilePath);
     //create new instance of popupmetadata parser
     $parserFactory = new ParserFactory();
     $parser = $parserFactory->getParser(MB_POPUPLIST, 'Users');
     //run save to write out the file using the new array elements.
     $parser->handleSave(false);
     //assert the file still exists
     $this->assertTrue(is_file($this->customFilePath), ' PopupMetaDataParser::handleSave() could not write out the file as expected.');
     //include the file again to get the new popup meta array
     include $this->customFilePath;
     $popupKeys = array_keys($popupMeta);
     //assert that one of the new elements is there
     $this->assertContains('whereStatement', $popupKeys, 'an element that was defined in addToReserve was not processed and save within PopupMetaDataParser::handleSave()');
     //assert that the element that was written but not defined in 'addToReserve' is no longer there
     $this->assertNotContains('disappear', $popupKeys, 'an element that was added but NOT defined in addToReserve was incorrectly processed and saved within PopupMetaDataParser::handleSave().');
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:32,代码来源:Bug50308Test.php


示例19: handle_remaining_relate_fields

 /**
  * Next, we'll attempt to update all of the remaining relate fields in the vardefs that have 'save' set in their
  * field_def Only the 'save' fields should be saved as some vardef entries today are not for display only purposes
  * and break the application if saved If the vardef has entries for field <a> of type relate, where a->id_name =
  * <b> and field <b> of type link then we receive a value for b from the MVC in the _REQUEST, and it should be set
  * in the bean as $this->$b
  *
  * @api
  * @see save_relationship_changes
  *
  * @param array $exclude any relationship's to exclude
  *
  * @return array the list of relationships that were added or removed successfully or if they were a failure
  */
 protected function handle_remaining_relate_fields($exclude = [])
 {
     $modified_relationships = ['add' => ['success' => [], 'failure' => []], 'remove' => ['success' => [], 'failure' => []]];
    

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP var_out函数代码示例发布时间:2022-05-23
下一篇:
PHP var_export函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap