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

PHP sugar_is_dir函数代码示例

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

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



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

示例1: _init

 /**
  * initializes the cache in question
  */
 protected static function _init()
 {
     $lastPriority = 1000;
     $locations = array('include/SugarCache', 'custom/include/SugarCache');
     foreach ($locations as $location) {
         if (sugar_is_dir($location) && ($dir = opendir($location))) {
             while (($file = readdir($dir)) !== false) {
                 if ($file == ".." || $file == "." || !is_file("{$location}/{$file}")) {
                     continue;
                 }
                 require_once "{$location}/{$file}";
                 $cacheClass = basename($file, ".php");
                 if (class_exists($cacheClass) && is_subclass_of($cacheClass, 'SugarCacheAbstract')) {
                     $GLOBALS['log']->debug("Found cache backend {$cacheClass}");
                     $cacheInstance = new $cacheClass();
                     if ($cacheInstance->useBackend() && $cacheInstance->getPriority() < $lastPriority) {
                         $GLOBALS['log']->debug("Using cache backend {$cacheClass}, since " . $cacheInstance->getPriority() . " is less than " . $lastPriority);
                         self::$_cacheInstance = $cacheInstance;
                         $lastPriority = $cacheInstance->getPriority();
                     }
                 }
             }
         }
     }
 }
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:28,代码来源:SugarCache.php


示例2: sugar_mkdir

/**
 * sugar_mkdir
 * Call this function instead of mkdir to apply preconfigured permission
 * settings when creating the directory.  This method is basically
 * a wrapper to the PHP mkdir function except that it supports setting
 * the mode value by using the configuration file (if set).  The mode is
 * 0777 by default.
 *
 * @param $pathname - String value of the directory to create
 * @param $mode - The integer value of the permissions mode to set the created directory to
 * @param $recursive - boolean value indicating whether or not to create recursive directories if needed
 * @param $context
 * @return boolean - Returns true on success false on failure
 */
function sugar_mkdir($pathname, $mode = null, $recursive = false, $context = '')
{
    $mode = get_mode('dir_mode', $mode);
    if (sugar_is_dir($pathname, $mode)) {
        return true;
    }
    $result = false;
    if (empty($mode)) {
        $mode = 0777;
    }
    if (empty($context)) {
        $result = @mkdir($pathname, $mode, $recursive);
    } else {
        $result = @mkdir($pathname, $mode, $recursive, $context);
    }
    if ($result) {
        if (!sugar_chmod($pathname, $mode)) {
            return false;
        }
        if (!empty($GLOBALS['sugar_config']['default_permissions']['user'])) {
            if (!sugar_chown($pathname)) {
                return false;
            }
        }
        if (!empty($GLOBALS['sugar_config']['default_permissions']['group'])) {
            if (!sugar_chgrp($pathname)) {
                return false;
            }
        }
    } else {
        $GLOBALS['log']->error("Cannot create directory {$pathname} cannot be touched");
    }
    return $result;
}
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:48,代码来源:sugar_file_utils.php


示例3: replaceCustomSmartyPlugins

 /**
  * Scan Smarty plugins directories and relocate custom plugins to correct location
  */
 public function replaceCustomSmartyPlugins()
 {
     // Step 1: scan vendor/Smarty/plugin directory to get a list of system plugins
     $vendorSmartyPluginsList = array();
     $vendorSmartyPluginsPath = 'vendor/Smarty/plugins/';
     $failedToCopySmartyPluginsList = array();
     $customSmartyPluginsPaths = array('include/Smarty/plugins/', 'custom/include/Smarty/plugins/');
     $includeSmartyPluginsPath = 'include/SugarSmarty/plugins/';
     $correctCustomSmartyPluginsPath = 'custom/include/SugarSmarty/plugins/';
     if (is_dir($vendorSmartyPluginsPath)) {
         $iter = new FilesystemIterator($vendorSmartyPluginsPath, FilesystemIterator::UNIX_PATHS);
         foreach ($iter as $item) {
             if ($item->getFileName() == '.' || $item->getFileName() == '..' || $item->isDir() || $item->getExtension() != 'php') {
                 continue;
             }
             $filename = $item->getFilename();
             $vendorSmartyPluginsList[] = $filename;
         }
     }
     // Step 2: scan custom plugin directories and relocate ONLY custom plugins to correct location
     foreach ($customSmartyPluginsPaths as $customSmartyPluginsPath) {
         if (is_dir($customSmartyPluginsPath)) {
             $iter = new FilesystemIterator($customSmartyPluginsPath, FilesystemIterator::UNIX_PATHS);
             foreach ($iter as $item) {
                 if ($item->getFilename() == '.' || $item->getFilename() == '..' || $item->isDir() || $item->getExtension() != 'php') {
                     continue;
                 }
                 $file = $item->getPathname();
                 if (!in_array($item->getFilename(), $vendorSmartyPluginsList) && !is_file($includeSmartyPluginsPath . $item->getFilename())) {
                     $this->log("Copy custom plugin {$file} to {$correctCustomSmartyPluginsPath}");
                     if (!sugar_is_dir($correctCustomSmartyPluginsPath)) {
                         mkdir_recursive($correctCustomSmartyPluginsPath);
                     }
                     if (copy_recursive($file, $correctCustomSmartyPluginsPath . $item->getFilename())) {
                         $this->upgrader->fileToDelete($file);
                     } else {
                         $failedToCopySmartyPluginsList[] = $file;
                     }
                 }
             }
         }
     }
     //Step 3: remove all files from custom Smarty plugins destinations except the {$correctCustomSmartyPluginsPath}
     if (empty($failedToCopySmartyPluginsList)) {
         foreach ($customSmartyPluginsPaths as $customSmartyPluginsPath) {
             if (is_dir($customSmartyPluginsPath)) {
                 $this->log("Path {$customSmartyPluginsPath} is deleted from custom plugins directory due to a relocation of vendors");
                 rmdir_recursive($customSmartyPluginsPath);
             }
         }
     } else {
         foreach ($failedToCopySmartyPluginsList as $failedToCopySmartyPluginsItem) {
             $this->log("File {$failedToCopySmartyPluginsItem} cannot be copied to new location automatically");
         }
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:59,代码来源:9_RepairVendors.php


示例4: mkdir_recursive

function mkdir_recursive($path, $check_is_parent_dir = false)
{
    if (sugar_is_dir($path, 'instance')) {
        return true;
    }
    if (sugar_is_file($path, 'instance')) {
        if (!empty($GLOBALS['log'])) {
            $GLOBALS['log']->fatal("ERROR: mkdir_recursive(): argument {$path} is already a file.");
        }
        return false;
    }
    //make variables with file paths
    $pathcmp = $path = rtrim(clean_path($path), '/');
    $basecmp = $base = rtrim(clean_path(getcwd()), '/');
    if (is_windows()) {
        //make path variable lower case for comparison in windows
        $pathcmp = strtolower($path);
        $basecmp = strtolower($base);
    }
    if ($basecmp == $pathcmp) {
        return true;
    }
    $base .= "/";
    if (strncmp($pathcmp, $basecmp, strlen($basecmp)) == 0) {
        /* strip current path prefix */
        $path = substr($path, strlen($base));
    }
    $thePath = '';
    $dirStructure = explode("/", $path);
    if ($dirStructure[0] == '') {
        // absolute path
        $base = '/';
        array_shift($dirStructure);
    }
    if (is_windows()) {
        if (strlen($dirStructure[0]) == 2 && $dirStructure[0][1] == ':') {
            /* C: prefix */
            $base = array_shift($dirStructure) . "\\";
        } elseif ($dirStructure[0][0] . $dirStructure[0][1] == "\\\\") {
            /* UNC absolute path */
            $base = array_shift($dirStructure) . "\\" . array_shift($dirStructure) . "\\";
            // we won't try to mkdir UNC share name
        }
    }
    foreach ($dirStructure as $dirPath) {
        $thePath .= $dirPath . "/";
        $mkPath = $base . $thePath;
        if (!is_dir($mkPath)) {
            if (!sugar_mkdir($mkPath)) {
                return false;
            }
        }
    }
    return true;
}
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:55,代码来源:dir_inc.php


示例5: refresh_price_formulas

function refresh_price_formulas()
{
    $GLOBALS['price_formulas'] = array('Fixed' => 'modules/ProductTemplates/formulas/price_fixed.php', 'ProfitMargin' => 'modules/ProductTemplates/formulas/price_profit_margin.php', 'PercentageMarkup' => 'modules/ProductTemplates/formulas/price_cost_markup.php', 'PercentageDiscount' => 'modules/ProductTemplates/formulas/price_list_discount.php', 'IsList' => 'modules/ProductTemplates/formulas/price_list.php');
    // FG - Bug 44515 - Added inclusion of all .php formula files in custom/modules/ProductTemplates/formulas (if exists).
    //                  Every file must contain a class whose name must equals the file name (without extension) all lowercase except the first letter, uppercase.
    //                  Here devs can add classes for custom formulas - The Upgrade Safe Way
    if (sugar_is_dir("custom/modules/ProductTemplates/formulas")) {
        $_files = glob("custom/modules/ProductTemplates/formulas/*.php");
        foreach ($_files as $filename) {
            $_formulaId = ucfirst(basename(strtolower($filename), ".php"));
            $GLOBALS['price_formulas'][$_formulaId] = $filename;
        }
    }
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:14,代码来源:Formulas.php


示例6: sugar_mkdir

/**
 * sugar_mkdir
 * Call this function instead of mkdir to apply preconfigured permission
 * settings when creating the directory.  This method is basically
 * a wrapper to the PHP mkdir function except that it supports setting
 * the mode value by using the configuration file (if set).  The mode is
 * 0777 by default.
 *
 * @param $pathname - String value of the directory to create
 * @param $mode - The integer value of the permissions mode to set the created directory to
 * @param $recursive - boolean value indicating whether or not to create recursive directories if needed
 * @param $context
 * @return boolean - Returns true on success false on failure
 */
function sugar_mkdir($pathname, $mode = null, $recursive = false, $context = '')
{
    $mode = get_mode('dir_mode', $mode);
    if (sugar_is_dir($pathname, $mode)) {
        return true;
    }
    $result = false;
    if (empty($mode)) {
        $mode = 0777;
    }
    if (empty($context)) {
        $result = @mkdir($pathname, $mode, $recursive);
    } else {
        $result = @mkdir($pathname, $mode, $recursive, $context);
    }
    if ($result) {
        if (!sugar_chmod($pathname, $mode)) {
            return false;
        }
        if (!empty($GLOBALS['sugar_config']['default_permissions']['user'])) {
            if (!sugar_chown($pathname)) {
                return false;
            }
        }
        if (!empty($GLOBALS['sugar_config']['default_permissions']['group'])) {
            if (!sugar_chgrp($pathname)) {
                return false;
            }
        }
    } else {
        $errorMessage = "Cannot create directory {$pathname} cannot be touched";
        if (is_null($GLOBALS['log'])) {
            throw new Exception("Error occurred but the system doesn't have logger. Error message: \"{$errorMessage}\"");
        }
        $GLOBALS['log']->error($errorMessage);
    }
    return $result;
}
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:52,代码来源:sugar_file_utils.php


示例7: mkdir_recursive

function mkdir_recursive($path, $check_is_parent_dir = false)
{
    if (sugar_is_dir($path, 'instance')) {
        return true;
    }
    if (sugar_is_file($path, 'instance')) {
        print "ERROR: mkdir_recursive(): argument {$path} is already a file.\n";
        return false;
    }
    $path = clean_path($path);
    $path = str_replace(clean_path(getcwd()), '', $path);
    $thePath = '';
    $dirStructure = explode("/", $path);
    $status = true;
    foreach ($dirStructure as $dirPath) {
        $thePath .= '/' . $dirPath;
        $mkPath = getcwd() . '/' . $thePath;
        if (!is_dir($mkPath)) {
            $status = $status & sugar_mkdir($mkPath);
        }
    }
    return $status;
}
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:23,代码来源:dir_inc.php


示例8: saveXMLFile

 /**
  * function to save XML contents into a file
  *
  * @param 	string $xmlFilename location of the xml file
  *			string $xmlContents contents of the xml file
  * @return	string boolean denoting whether save has failed
  */
 function saveXMLFile($xmlFilename, $xmlContents)
 {
     global $app_strings;
     global $locale;
     $xmlContents = chr(255) . chr(254) . $GLOBALS['locale']->translateCharset($xmlContents, 'UTF-8', 'UTF-16LE');
     // Create dir if it doesn't exist
     $dir = dirname($xmlFilename);
     if (!sugar_is_dir($dir)) {
         sugar_mkdir($dir, null, true);
     }
     // open file
     if (!($fh = sugar_fopen($xmlFilename, 'w'))) {
         $GLOBALS['log']->debug("Cannot open file ({$xmlFilename})");
         return;
     }
     // write the contents to the file
     if (fwrite($fh, $xmlContents) === FALSE) {
         $GLOBALS['log']->debug("Cannot write to file ({$xmlFilename})");
         return false;
     }
     $GLOBALS['log']->debug("Success, wrote ({$xmlContents}) to file ({$xmlFilename})");
     fclose($fh);
     return true;
 }
开发者ID:omusico,项目名称:windcrm,代码行数:31,代码来源:SugarChart.php


示例9: copy_path

 function copy_path($from, $to, $backup_path = '', $uninstall = false)
 {
     //function copy_path($from, $to){
     /* END - RESTORE POINT - by MR. MILK August 31, 2005 02:22:18 PM */
     $to = str_replace('<basepath>', $this->base_dir, $to);
     if (!$uninstall) {
         $from = str_replace('<basepath>', $this->base_dir, $from);
         $GLOBALS['log']->debug('Copy ' . $from);
     } else {
         $from = str_replace('<basepath>', $backup_path, $from);
         //$GLOBALS['log']->debug('Restore ' . $from);
     }
     $from = clean_path($from);
     $to = clean_path($to);
     $dir = dirname($to);
     //there are cases where if we need to create a directory in the root directory
     if ($dir == '.' && is_dir($from)) {
         $dir = $to;
     }
     if (!sugar_is_dir($dir, 'instance')) {
         mkdir_recursive($dir, true);
     }
     /* BEGIN - RESTORE POINT - by MR. MILK August 31, 2005 02:22:18 PM */
     if (empty($backup_path)) {
         /* END - RESTORE POINT - by MR. MILK August 31, 2005 02:22:18 PM */
         if (!copy_recursive($from, $to)) {
             die('Failed to copy ' . $from . ' ' . $to);
         }
         /* BEGIN - RESTORE POINT - by MR. MILK August 31, 2005 02:22:18 PM */
     } elseif (!$this->copy_recursive_with_backup($from, $to, $backup_path, $uninstall)) {
         die('Failed to copy ' . $from . ' to ' . $to);
     }
     /* END - RESTORE POINT - by MR. MILK August 31, 2005 02:22:18 PM */
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:34,代码来源:ModuleInstaller.php


示例10: buildRegistry

 /**
  * Builds the theme registry
  */
 public static function buildRegistry()
 {
     self::$_themes = array();
     $dirs = array("themes/", "custom/themes/");
     // check for a default themedef file
     $themedefDefault = array();
     if (sugar_is_file("custom/themes/default/themedef.php")) {
         $themedef = array();
         require "custom/themes/default/themedef.php";
         $themedefDefault = $themedef;
     }
     foreach ($dirs as $dirPath) {
         if (sugar_is_dir('./' . $dirPath) && is_readable('./' . $dirPath) && ($dir = opendir('./' . $dirPath))) {
             while (($file = readdir($dir)) !== false) {
                 if ($file == ".." || $file == "." || $file == ".svn" || $file == "CVS" || $file == "Attic" || $file == "default" || !sugar_is_dir("./{$dirPath}" . $file) || !sugar_is_file("./{$dirPath}{$file}/themedef.php")) {
                     continue;
                 }
                 $themedef = array();
                 require "./{$dirPath}{$file}/themedef.php";
                 $themedef = array_merge($themedef, $themedefDefault);
                 $themedef['dirName'] = $file;
                 // check for theme already existing in the registry
                 // if so, then it will override the current one
                 if (self::exists($themedef['dirName'])) {
                     $existingTheme = self::get($themedef['dirName']);
                     foreach (SugarTheme::getThemeDefFields() as $field) {
                         if (!isset($themedef[$field])) {
                             $themedef[$field] = $existingTheme->{$field};
                         }
                     }
                     self::remove($themedef['dirName']);
                 }
                 if (isset($themedef['name'])) {
                     self::add($themedef);
                 }
             }
             closedir($dir);
         }
     }
     // default to setting the default theme as the current theme
     if (!isset($GLOBALS['sugar_config']['default_theme']) || !self::set($GLOBALS['sugar_config']['default_theme'])) {
         if (count(self::availableThemes()) == 0) {
             sugar_die('No valid themes are found on this instance');
         } else {
             self::set(self::getDefaultThemeKey());
         }
     }
 }
开发者ID:BMLP,项目名称:memoryhole-ansible,代码行数:51,代码来源:SugarTheme.php


示例11: deleteFiles

 /**
  * Moves file to deleted folder
  *
  * @return bool success of movement
  */
 public function deleteFiles()
 {
     if (!$this->id) {
         return true;
     }
     if (!$this->haveFiles()) {
         return true;
     }
     $files = $this->getFiles();
     if (empty($files)) {
         return true;
     }
     $directory = $this->deleteFileDirectory();
     $isCreated = sugar_is_dir('upload://deleted/' . $directory);
     if (!$isCreated) {
         sugar_mkdir('upload://deleted/' . $directory, 0777, true);
         $isCreated = sugar_is_dir('upload://deleted/' . $directory);
     }
     if (!$isCreated) {
         return false;
     }
     foreach ($files as $file) {
         if (file_exists('upload://' . $file)) {
             if (!sugar_rename('upload://' . $file, 'upload://deleted/' . $directory . '/' . $file)) {
                 $GLOBALS['log']->error('Could not move file ' . $file . ' to deleted directory');
             }
         }
     }
     /**
      * @var DBManager $db
      */
     global $db;
     $record = array('bean_id' => $db->quoted($this->id), 'module' => $db->quoted($this->module_name), 'date_modified' => $db->convert($db->quoted(date('Y-m-d H:i:s')), 'datetime'));
     $recordDB = $db->fetchOne("SELECT id FROM cron_remove_documents WHERE module={$record['module']} AND bean_id={$record['bean_id']}");
     if (!empty($recordDB)) {
         $record['id'] = $db->quoted($recordDB['id']);
     }
     if (empty($record['id'])) {
         $record['id'] = $db->quoted(create_guid());
         $db->query('INSERT INTO cron_remove_documents (' . implode(', ', array_keys($record)) . ') VALUES(' . implode(', ', $record) . ')');
     } else {
         $db->query("UPDATE cron_remove_documents SET date_modified={$record['date_modified']} WHERE id={$record['id']}");
     }
     return true;
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:50,代码来源:SugarBean.php


示例12: display

 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings, $app_list_strings, $app_strings, $current_user, $import_bean_map;
     global $import_mod_strings;
     $this->instruction = 'LBL_SELECT_UPLOAD_INSTRUCTION';
     $this->ss->assign('INSTRUCTION', $this->getInstruction());
     $this->ss->assign("MODULE_TITLE", $this->getModuleTitle(false));
     $this->ss->assign("IMP", $import_mod_strings);
     $this->ss->assign("CURRENT_STEP", $this->currentStep);
     $this->ss->assign("TYPE", !empty($_REQUEST['type']) ? $_REQUEST['type'] : "import");
     $this->ss->assign("CUSTOM_DELIMITER", !empty($_REQUEST['custom_delimiter']) ? $_REQUEST['custom_delimiter'] : ",");
     $this->ss->assign("CUSTOM_ENCLOSURE", htmlentities(!empty($_REQUEST['custom_enclosure']) && $_REQUEST['custom_enclosure'] != 'other' ? $_REQUEST['custom_enclosure'] : (!empty($_REQUEST['custom_enclosure_other']) ? $_REQUEST['custom_enclosure_other'] : "")));
     $this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']);
     $this->ss->assign("HEADER", $app_strings['LBL_IMPORT'] . " " . $mod_strings['LBL_MODULE_NAME']);
     $this->ss->assign("JAVASCRIPT", $this->_getJS());
     $this->ss->assign("SAMPLE_URL", "<a href=\"javascript: void(0);\" onclick=\"window.location.href='index.php?entryPoint=export&module=" . $_REQUEST['import_module'] . "&action=index&all=true&sample=true'\" >" . $mod_strings['LBL_EXAMPLE_FILE'] . "</a>");
     $displayBackBttn = isset($_REQUEST['action']) && $_REQUEST['action'] != 'index' ? TRUE : FALSE;
     $this->ss->assign("displayBackBttn", $displayBackBttn);
     $importSource = isset($_REQUEST['source']) ? $_REQUEST['source'] : 'csv';
     //Start custom mapping
     // show any custom mappings
     if (sugar_is_dir('custom/modules/Import') && ($dir = opendir('custom/modules/Import'))) {
         while (($file = readdir($dir)) !== false) {
             if (sugar_is_file("custom/modules/Import/{$file}") && strpos($file, ".php") !== false) {
                 require_once "custom/modules/Import/{$file}";
                 $classname = str_replace('.php', '', $file);
                 $mappingClass = new $classname();
                 $custom_mappings[] = $mappingClass->name;
             }
         }
     }
     // get user defined import maps
     $is_admin = is_admin($current_user);
     if ($is_admin) {
         $savedMappingHelpText = $mod_strings['LBL_MY_SAVED_ADMIN_HELP'];
     } else {
         $savedMappingHelpText = $mod_strings['LBL_MY_SAVED_HELP'];
     }
     $this->ss->assign('savedMappingHelpText', $savedMappingHelpText);
     $this->ss->assign('is_admin', $is_admin);
     $import_map_seed = new ImportMap();
     $custom_imports_arr = $import_map_seed->retrieve_all_by_string_fields(array('assigned_user_id' => $current_user->id, 'is_published' => 'no', 'module' => $_REQUEST['import_module']));
     if (count($custom_imports_arr)) {
         $custom = array();
         foreach ($custom_imports_arr as $import) {
             $custom[] = array("IMPORT_NAME" => $import->name, "IMPORT_ID" => $import->id);
         }
         $this->ss->assign('custom_imports', $custom);
     }
     // get globally defined import maps
     $published_imports_arr = $import_map_seed->retrieve_all_by_string_fields(array('is_published' => 'yes', 'module' => $_REQUEST['import_module']));
     if (count($published_imports_arr)) {
         $published = array();
         foreach ($published_imports_arr as $import) {
             $published[] = array("IMPORT_NAME" => $import->name, "IMPORT_ID" => $import->id);
         }
         $this->ss->assign('published_imports', $published);
     }
     //End custom mapping
     // add instructions for anything other than custom_delimited
     $instructions = array();
     $lang_key = "CUSTOM";
     for ($i = 1; isset($mod_strings["LBL_{$lang_key}_NUM_{$i}"]); $i++) {
         $instructions[] = array("STEP_NUM" => $mod_strings["LBL_NUM_{$i}"], "INSTRUCTION_STEP" => $mod_strings["LBL_{$lang_key}_NUM_{$i}"]);
     }
     $this->ss->assign("INSTRUCTIONS_TITLE", $mod_strings["LBL_IMPORT_{$lang_key}_TITLE"]);
     $this->ss->assign("instructions", $instructions);
     $content = $this->ss->fetch('modules/Import/tpls/step2.tpl');
     $this->ss->assign("CONTENT", $content);
     $this->ss->display('modules/Import/tpls/wizardWrapper.tpl');
 }
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:74,代码来源:view.step2.php


示例13: getCSSURL

 /**
  * Returns the URL for the css file in the current theme. If not found in the current theme, will revert
  * to looking in the base theme.
  *
  * @param  string $cssFileName css file name
  * @param  bool   $returnURL if true, returns URL with unique image mark, otherwise returns path to the file
  * @return string path of css file to include
  */
 public function getCSSURL($cssFileName, $returnURL = true)
 {
     if (isset($this->_cssCache[$cssFileName]) && sugar_is_file(sugar_cached($this->_cssCache[$cssFileName]))) {
         if ($returnURL) {
             return getJSPath("cache/" . $this->_cssCache[$cssFileName]);
         } else {
             return sugar_cached($this->_cssCache[$cssFileName]);
         }
     }
     $cssFileContents = '';
     $defaultFileName = $this->getDefaultCSSPath() . '/' . $cssFileName;
     $fullFileName = $this->getCSSPath() . '/' . $cssFileName;
     if (isset($this->parentTheme) && SugarThemeRegistry::get($this->parentTheme) instanceof SugarTheme && ($filename = SugarThemeRegistry::get($this->parentTheme)->getCSSURL($cssFileName, false)) != '') {
         $cssFileContents .= file_get_contents($filename);
     } else {
         foreach (SugarAutoLoader::existingCustom($defaultFileName) as $cssFile) {
             $cssFileContents .= file_get_contents($cssFile);
         }
     }
     foreach (SugarAutoLoader::existingCustom($fullFileName) as $cssFile) {
         $cssFileContents .= file_get_contents($cssFile);
     }
     if (empty($cssFileContents)) {
         $GLOBALS['log']->warn("CSS File {$cssFileName} not found");
         return false;
     }
     // fix any image references that may be defined in css files
     $cssFileContents = str_ireplace("entryPoint=getImage&", "entryPoint=getImage&themeName={$this->dirName}&", $cssFileContents);
     // create the cached file location
     $cssFilePath = create_cache_directory($fullFileName);
     // if this is the style.css file, prepend the base.css and calendar-win2k-cold-1.css
     // files before the theme styles
     if ($cssFileName == 'style.css' && !isset($this->parentTheme)) {
         if (inDeveloperMode()) {
             $cssFileContents = file_get_contents('include/javascript/yui/build/base/base.css') . $cssFileContents;
         } else {
             $cssFileContents = file_get_contents('include/javascript/yui/build/base/base-min.css') . $cssFileContents;
         }
     }
     // minify the css
     if (!inDeveloperMode() && !sugar_is_file($cssFilePath)) {
         $cssFileContents = cssmin::minify($cssFileContents);
     }
     // now write the css to cache
     sugar_file_put_contents($cssFilePath, $cssFileContents);
     // make sure that there is the font folder in the cache for the given theme
     $path = sugar_cached($this->getFilePath() . '/font');
     if (!sugar_is_dir($path)) {
         sugar_mkdir($path, null, true);
         $defaultPath = $this->getDefaultFontPath();
         foreach (glob($defaultPath . "/*") as $filename) {
             $name = substr($filename, strrpos($filename, '/'));
             sugar_file_put_contents($path . $name, sugar_file_get_contents($filename));
         }
     }
     $this->_cssCache[$cssFileName] = $fullFileName;
     if ($returnURL) {
         return getJSPath("cache/" . $fullFileName);
     }
     return sugar_cached($fullFileName);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:69,代码来源:SugarTheme.php


示例14: _findAvailableLoggers

 /**
  * Finds all the available loggers in the application
  */
 protected function _findAvailableLoggers()
 {
     $locations = array('include/SugarLogger', 'custom/include/SugarLogger');
     foreach ($locations as $location) {
         if (sugar_is_dir($location) && ($dir = opendir($location))) {
             while (($file = readdir($dir)) !== false) {
                 if ($file == ".." || $file == "." || $file == "LoggerTemplate.php" || $file == "LoggerManager.php" || !is_file("{$location}/{$file}")) {
                     continue;
                 }
                 require_once "{$location}/{$file}";
                 $loggerClass = basename($file, ".php");
                 if (class_exists($loggerClass) && class_implements($loggerClass, 'LoggerTemplate')) {
                     self::$_loggers[$loggerClass] = new $loggerClass();
                 }
             }
         }
     }
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:21,代码来源:LoggerManager.php


示例15: buildRegistry

 /**
  * Builds the theme registry
  */
 public static function buildRegistry()
 {
     self::$_themes = array();
     $dirs = array("themes/", "custom/themes/");
     foreach ($dirs as $dirPath) {
         if (sugar_is_dir('./' . $dirPath) && ($dir = opendir('./' . $dirPath))) {
             while (($file = readdir($dir)) !== false) {
                 if ($file == ".." || $file == "." || $file == ".svn" || $file == "CVS" || $file == "Attic" || !sugar_is_dir("./{$dirPath}" . $file) || !sugar_is_file("./{$dirPath}{$file}/themedef.php")) {
                     continue;
                 }
                 $themedef = array();
                 require "./{$dirPath}{$file}/themedef.php";
                 $themedef['dirName'] = $file;
                 // check for theme already existing in the registry
                 // if so, then it will override the current one
                 if (self::exists($themedef['dirName'])) {
                     $existingTheme = self::get($themedef['dirName']);
                     foreach (SugarTheme::getThemeDefFields() as $field) {
                         if (!isset($themedef[$field])) {
                             $themedef[$field] = $existingTheme->{$field};
                         }
                     }
                     self::remove($themedef['dirName']);
                 }
                 if (isset($themedef['name'])) {
                     self::add($themedef);
                 }
             }
             closedir($dir);
         }
     }
     // default to setting the default theme as the current theme
     self::set($GLOBALS['sugar_config']['default_theme']);
 }
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:37,代码来源:SugarTheme.php


示例16: display

 /** 
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings, $app_strings, $current_user;
     global $sugar_config;
     $selectedData = $this->_retrieveParams();
     $this->ss->assign("MODULE_TITLE", $this->getModuleTitle());
     $this->ss->assign("DELETE_INLINE_PNG", SugarThemeRegistry::current()->getImage('delete_inline', 'align="absmiddle" alt="' . $app_strings['LNK_DELETE'] . '" border="0"'));
     $this->ss->assign("PUBLISH_INLINE_PNG", SugarThemeRegistry::current()->getImage('publish_inline', 'align="absmiddle" alt="' . $mod_strings['LBL_PUBLISH'] . '" border="0"'));
     $this->ss->assign("UNPUBLISH_INLINE_PNG", SugarThemeRegistry::current()->getImage('unpublish_inline', 'align="absmiddle" alt="' . $mod_strings['LBL_UNPUBLISH'] . '" border="0"'));
     $this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']);
     $this->ss->assign("JAVASCRIPT", $this->_getJS(isset($selectedData->source) ? $selectedData->source : false));
     // handle publishing and deleting import maps
     if (isset($_REQUEST['delete_map_id'])) {
         $import_map = new ImportMap();
         $import_map->mark_deleted($_REQUEST['delete_map_id']);
     }
     if (isset($_REQUEST['publish'])) {
         $import_map = new ImportMap();
         $result = 0;
         $import_map = $import_map->retrieve($_REQUEST['import_map_id'], false);
         if ($_REQUEST['publish'] == 'yes') {
             $result = $import_map->mark_published($current_user->id, true);
             if (!$result) {
                 $this->ss->assign("ERROR", $mod_strings['LBL_ERROR_UNABLE_TO_PUBLISH']);
             }
         } elseif ($_REQUEST['publish'] == 'no') {
             // if you don't own this importmap, you do now!
             // unless you have a map by the same name
             $result = $import_map->mark_published($current_user->id, false);
             if (!$result) {
                 $this->ss->assign("ERROR", $mod_strings['LBL_ERROR_UNABLE_TO_UNPUBLISH']);
             }
         }
     }
     // trigger showing other software packages
     $this->ss->assign("show_salesforce", false);
     $this->ss->assign("show_outlook", false);
     $this->ss->assign("show_act", false);
     switch ($_REQUEST['import_module']) {
         case "Prospects":
             break;
         case "Accounts":
             $this->ss->assign("show_salesforce", true);
             $this->ss->assign("show_act", true);
             break;
         case "Contacts":
             $this->ss->assign("show_salesforce", true);
             $this->ss->assign("show_outlook", true);
             $this->ss->assign("show_act", true);
             break;
         default:
             $this->ss->assign("show_salesforce", true);
             break;
     }
     // show any custom mappings
     if (sugar_is_dir('custom/modules/Import') && ($dir = opendir('custom/modules/Import'))) {
         while (($file = readdir($dir)) !== false) {
             if (sugar_is_file("custom/modules/Import/{$file}") && strpos($file, ".php") !== false) {
                 require_once "custom/modules/Import/{$file}";
                 $classname = str_replace('.php', '', $file);
                 $mappingClass = new $classname();
                 $custom_mappings[] = $mappingClass->name;
             }
         }
     }
     // get user defined import maps
     $this->ss->assign('is_admin', is_admin($current_user));
     $import_map_seed = new ImportMap();
     $custom_imports_arr = $import_map_seed->retrieve_all_by_string_fields(array('assigned_user_id' => $current_user->id, 'is_published' => 'no', 'module' => $_REQUEST['import_module']));
     if (count($custom_imports_arr)) {
         $custom = array();
         foreach ($custom_imports_arr as $import) {
             $custom[] = array("IMPORT_NAME" => $import->name, "IMPORT_ID" => $import->id);
         }
         $this->ss->assign('custom_imports', $custom);
     }
     // get globally defined import maps
     $published_imports_arr = $import_map_seed->retrieve_all_by_string_fields(array('is_published' => 'yes', 'module' => $_REQUEST['import_module']));
     if (count($published_imports_arr)) {
         $published = array();
         foreach ($published_imports_arr as $import) {
             $published[] = array("IMPORT_NAME" => $import->name, "IMPORT_ID" => $import->id);
         }
         $this->ss->assign('published_imports', $published);
     }
     $this->ss->display('modules/Import/tpls/step1.tpl');
 }
开发者ID:rgauss,项目名称:sugarcrm_dev,代码行数:90,代码来源:view.step1.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP sugar_is_file函数代码示例发布时间:2022-05-23
下一篇:
PHP sugar_fopen函数代码示例发布时间: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