static function file_get_contents($file_name, $options = array()) { $default_options = array('ftp' => defined('AK_READ_FILES_USING_FTP') && AK_READ_FILES_USING_FTP, 'base_path' => self::getDefaultBasePath($file_name)); $options = array_merge($default_options, $options); $file_name = self::getRestrictedPath($file_name, $options); if ($options['ftp']) { return AkFtp::get_contents($file_name); } else { $base_path = self::getNormalizedBasePath($options); if (!file_exists($base_path . $file_name)) { if (empty($options['skip_raising_errors'])) { throw new Exception('File ' . $base_path . $file_name . ' not found.'); } return; } return file_get_contents($base_path . $file_name); } }
function file_get_contents($file_name, $options = array()) { $default_options = array('ftp' => defined('AK_READ_FILES_USING_FTP') && AK_READ_FILES_USING_FTP, 'base_path' => AK_BASE_DIR); $options = array_merge($default_options, $options); $file_name = trim(str_replace($options['base_path'], '', $file_name), DS); if ($options['ftp']) { require_once AK_LIB_DIR . DS . 'AkFtp.php'; $file_name = trim(str_replace(array(DS, '//'), array('/', '/'), $file_name), '/'); return AkFtp::get_contents($file_name); } else { return file_get_contents($options['base_path'] . DS . $file_name); } }
static function file_get_contents($file_name, $options = array()) { $default_options = array('ftp' => defined('AK_READ_FILES_USING_FTP') && AK_READ_FILES_USING_FTP, 'base_path' => strstr($file_name, AK_TMP_DIR) ? AK_TMP_DIR : AK_BASE_DIR); $options = array_merge($default_options, $options); $file_name = trim(str_replace($options['base_path'], '', $file_name), DS); if ($options['ftp']) { $file_name = trim(str_replace(array(DS, '//'), array('/', '/'), $file_name), '/'); return AkFtp::get_contents($file_name); } else { $base_path = AK_WIN && empty($options['base_path']) ? '' : $options['base_path'] . DS; return file_get_contents($base_path . $file_name); } }