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


PHP CombinePaths函数代码示例

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


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

示例1: Analytics

 public function Analytics($Method, $RequestParameters, $Callback = FALSE)
 {
     $AnalyticsServer = C('Garden.Analytics.Remote', 'http://analytics.vanillaforums.com');
     $FullMethod = explode('/', $Method);
     if (sizeof($FullMethod) < 2) {
         array_unshift($FullMethod, "analytics");
     }
     list($ApiController, $ApiMethod) = $FullMethod;
     $ApiController = strtolower($ApiController);
     $ApiMethod = StringEndsWith(strtolower($ApiMethod), '.json', TRUE, TRUE) . '.json';
     $FinalURL = CombinePaths(array($AnalyticsServer, $ApiController, $ApiMethod));
     // Sign request
     $this->Sign($RequestParameters, TRUE);
     $FinalURL .= '?' . http_build_query($RequestParameters);
     try {
         $Response = ProxyRequest($FinalURL, 10, TRUE);
     } catch (Exception $e) {
         $Response = FALSE;
     }
     if ($Response !== FALSE) {
         $JsonResponse = json_decode($Response);
         if ($JsonResponse !== FALSE) {
             $JsonResponse = (array) GetValue('Analytics', $JsonResponse, FALSE);
         }
         // If we received a reply, parse it
         if ($JsonResponse !== FALSE) {
             $this->ParseAnalyticsResponse($JsonResponse, $Response, $Callback);
             return $JsonResponse;
         }
     }
     return FALSE;
 }
开发者ID:Raz0r,项目名称:Garden,代码行数:32,代码来源:class.statistics.php

示例2: Structure

 public function Structure($AppName = 'garden', $Drop = '0', $Explicit = '0')
 {
     $this->Permission('Garden.AdminUser.Only');
     $File = CombinePaths(array(PATH_APPLICATIONS, $AppName, 'settings', 'structure.php'), DS);
     if (file_exists($File)) {
         $Validation = new Gdn_Validation();
         $Database = Gdn::Database();
         $Construct = $Database->Structure();
         $Drop = $Drop == '0' ? FALSE : TRUE;
         $Explicit = $Explicit == '0' ? FALSE : TRUE;
         try {
             include $File;
         } catch (Exception $ex) {
             $this->Form->AddError(strip_tags($ex->getMessage()));
         }
         if ($this->Form->ErrorCount() == 0) {
             echo 'Success';
         } else {
             echo $this->Form->Errors();
         }
     }
     $this->ControllerName = 'home';
     $this->View = 'filenotfound';
     $this->Render();
 }
开发者ID:kidmax,项目名称:Garden,代码行数:25,代码来源:utility.php

示例3: config

 /**
  * Update the configuration.
  *
  * @return void
  */
 protected function config()
 {
     saveToConfig('Garden.Cookie.Salt', RandomString(10));
     $ApplicationInfo = [];
     include CombinePaths([PATH_APPLICATIONS . DS . 'dashboard' . DS . 'settings' . DS . 'about.php']);
     // Detect Internet connection for CDNs
     $Disconnected = !(bool) @fsockopen('ajax.googleapis.com', 80);
     saveToConfig(['Garden.Version' => arrayValue('Version', val('Dashboard', $ApplicationInfo, []), 'Undefined'), 'Garden.Cdns.Disable' => $Disconnected, 'Garden.CanProcessImages' => function_exists('gd_info'), 'EnabledPlugins.HtmLawed' => 'HtmLawed']);
 }
开发者ID:TFidryForks,项目名称:spira,代码行数:14,代码来源:VanillaConfigurator.php

示例4: Setup

   /**
    * Special function automatically run upon clicking 'Enable' on your application.
    * Change the word 'skeleton' anywhere you see it.
    */
   public function Setup() {
      // You need to manually include structure.php here for it to get run at install.
      include(PATH_APPLICATIONS . DS . 'skeleton' . DS . 'settings' . DS . 'structure.php');

      // This just gets the version number and stores it in the config file. Good practice but optional.
      $ApplicationInfo = array();
      include(CombinePaths(array(PATH_APPLICATIONS . DS . 'skeleton' . DS . 'settings' . DS . 'about.php')));
      $Version = ArrayValue('Version', ArrayValue('Skeleton', $ApplicationInfo, array()), 'Undefined');
      SaveToConfig('Skeleton.Version', $Version);
   }
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:14,代码来源:class.hooks.php

示例5: __construct

 /**
  * Constructor
  */
 function __construct()
 {
     $this->PhpMailer = new PHPMailer();
     $this->PhpMailer->CharSet = C('Garden.Charset', 'utf-8');
     $this->PhpMailer->SingleTo = C('Garden.Email.SingleTo', FALSE);
     $this->PhpMailer->PluginDir = CombinePaths(array(PATH_LIBRARY, 'vendors/phpmailer/'));
     $this->PhpMailer->Hostname = C('Garden.Email.Hostname', '');
     $this->PhpMailer->Encoding = 'quoted-printable';
     $this->Clear();
     parent::__construct();
 }
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:14,代码来源:class.email.php

示例6: ServerMapFolder

function ServerMapFolder($resourceType, $folderPath, $sCommand)
{
    // Get the resource type directory.
    $sResourceTypePath = GetResourceTypeDirectory($resourceType, $sCommand);
    // Ensure that the directory exists.
    $sErrorMsg = CreateServerFolder($sResourceTypePath);
    if ($sErrorMsg != '') {
        SendError(1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})");
    }
    // Return the resource type directory combined with the required path.
    return CombinePaths($sResourceTypePath, $folderPath);
}
开发者ID:golfcrseven,项目名称:scsuper,代码行数:12,代码来源:io.php

示例7: Base_BeforeAddCss_Handler

 public function Base_BeforeAddCss_Handler($Sender)
 {
     if ($Sender->DeliveryType() != DELIVERY_TYPE_ALL) {
         return;
     }
     $CssFiles =& $Sender->EventArguments['CssFiles'];
     foreach ($CssFiles as $Index => $CssInfo) {
         $CssFile = $CssInfo['FileName'];
         if (substr($CssFile, -7) != '.dt.css') {
             continue;
         }
         $AppFolder = $CssInfo['AppFolder'];
         if ($AppFolder == '') {
             $AppFolder = $Sender->ApplicationFolder;
         }
         $CssPaths = array();
         if (strpos($CssFile, '/') !== False) {
             $CssPaths[] = CombinePaths(array(PATH_ROOT, $CssFile));
         } else {
             if ($Sender->Theme) {
                 $CssPaths[] = PATH_THEMES . DS . $Sender->Theme . DS . 'design' . DS . $CssFile;
             }
             $CssPaths[] = PATH_APPLICATIONS . DS . $AppFolder . DS . 'design' . DS . $CssFile;
             $CssPaths[] = PATH_APPLICATIONS . DS . 'dashboard' . DS . 'design' . DS . $CssFile;
         }
         $CssPath = False;
         foreach ($CssPaths as $Glob) {
             $Paths = SafeGlob($Glob);
             if (count($Paths) > 0) {
                 $CssPath = $Paths[0];
                 break;
             }
         }
         if ($CssPath == False) {
             continue;
         }
         // not found
         $Basename = pathinfo(pathinfo($CssPath, 8), 8);
         // without .dt.css
         $Hash = self::GetHash($CssPath . filemtime($CssPath));
         $CacheFileName = sprintf('__%s-c-%s.css', $Basename, $Hash);
         $CachedCssFile = dirname($CssPath) . DS . $CacheFileName;
         if (!file_exists($CachedCssFile)) {
             self::MakeCssFile($CssPath, $CachedCssFile, True);
         }
         // TODO: use AbsoluteSource() from 2.0.18
         // ... and replace preprocessored dt.css file by css
         $CssInfo['FileName'] = substr($CachedCssFile, strlen(PATH_ROOT));
         $CssFiles[$Index] = $CssInfo;
         // AppFolder nevermind (will be ignored)
     }
 }
开发者ID:unlight,项目名称:DtCss,代码行数:52,代码来源:class.dtcss.plugin.php

示例8: Check

 public function Check($Type = '', $Name = '')
 {
     if ($Type != '' && $Name != '') {
         $this->AddItem($Type, $Name);
     }
     if (count($this->_Items) > 0) {
         // TODO: Use garden update check url instead of this:
         $UpdateUrl = Url('/lussumo/update', TRUE, TRUE);
         $Host = Gdn_Url::Host();
         $Path = CombinePaths(array(Gdn_Url::WebRoot(), 'lussumo', 'update'), '/');
         $Port = 80;
         /*
         $UpdateUrl = Gdn::Config('Garden.UpdateCheckUrl', '');
         $UpdateUrl = parse_url($UpdateUrl);
         $Host = ArrayValue('host', $UpdateUrl, 'www.lussumo.com');
         $Path = ArrayValue('path', $UpdateUrl, '/');
         $Port = ArrayValue('port', $UpdateUrl, '80');
         */
         $Path .= '?Check=' . urlencode(Format::Serialize($this->_Items));
         $Locale = Gdn::Config('Garden.Locale', 'Undefined');
         $Referer = Gdn_Url::WebRoot(TRUE);
         if ($Referer === FALSE) {
             $Referer = 'Undefined';
         }
         $Timeout = 10;
         $Response = '';
         // Connect to the update server.
         $Pointer = @fsockopen($Host, '80', $ErrorNumber, $Error, $Timeout);
         if (!$Pointer) {
             throw new Exception(sprintf(Gdn::Translate('Encountered an error when attempting to connect to the update server (%1$s): [%2$s] %3$s'), $UpdateUrl, $ErrorNumber, $Error));
         } else {
             // send the necessary headers to get the file
             fputs($Pointer, "GET {$Path} HTTP/1.0\r\n" . "Host: {$Host}\r\n" . "User-Agent: Lussumo Garden/1.0\r\n" . "Accept: */*\r\n" . "Accept-Language: " . $Locale . "\r\n" . "Accept-Charset: utf-8;\r\n" . "Keep-Alive: 300\r\n" . "Connection: keep-alive\r\n" . "Referer: {$Referer}\r\n\r\n");
             // Retrieve the response from the remote server
             while ($Line = fread($Pointer, 4096)) {
                 $Response .= $Line;
             }
             fclose($Pointer);
             // Remove response headers
             $Response = substr($Response, strpos($Response, "\r\n\r\n") + 4);
         }
         $Result = Format::Unserialize($Response);
         // print_r($Result);
         if (is_array($Result)) {
             $this->_Items = $Result;
         } else {
             $Result = FALSE;
         }
         return $Result;
     }
 }
开发者ID:kidmax,项目名称:Garden,代码行数:51,代码来源:class.updatemanager.php

示例9: __construct

 /**
  * Set up ProxyRequest
  * 
  * Options:
  *   URL
  *   Host
  *   Method
  *   ConnectTimeout
  *   Timeout
  *   Redirects
  *   Cookies
  *   SaveAs
  *   CloseSession
  *   Redirected
  *   Debug
  *   Simulate
  * 
  * @param boolean $Loud
  * @param array $RequestDefaults
  * @return type 
  */
 public function __construct($Loud = FALSE, $RequestDefaults = NULL)
 {
     $this->Loud = $Loud;
     $CookieKey = md5(mt_rand(0, 72312189) . microtime(true));
     if (defined('PATH_CACHE')) {
         $this->CookieJar = CombinePaths(array(PATH_CACHE, "cookiejar.{$CookieKey}"));
     } else {
         $this->CookieJar = CombinePaths(array("/tmp", "cookiejar.{$CookieKey}"));
     }
     if (!is_array($RequestDefaults)) {
         $RequestDefaults = array();
     }
     $Defaults = array('URL' => NULL, 'Host' => NULL, 'Method' => 'GET', 'ConnectTimeout' => 5, 'Timeout' => 5, 'TransferMode' => 'normal', 'SaveAs' => NULL, 'Redirects' => TRUE, 'SSLNoVerify' => FALSE, 'PreEncodePost' => TRUE, 'Cookies' => TRUE, 'CookieJar' => FALSE, 'CookieSession' => FALSE, 'CloseSession' => TRUE, 'Redirected' => FALSE, 'Debug' => FALSE, 'Simulate' => FALSE);
     $this->RequestDefaults = array_merge($Defaults, $RequestDefaults);
 }
开发者ID:3marproof,项目名称:vanilla,代码行数:36,代码来源:class.proxyrequest.php

示例10: Setup

 public function Setup()
 {
     // Got Setup?
     $Database = Gdn::Database();
     $Config = Gdn::Factory(Gdn::AliasConfig);
     $Drop = C('Skeleton.Version') === FALSE ? TRUE : FALSE;
     $Explicit = TRUE;
     $Validation = new Gdn_Validation();
     // This is going to be needed by structure.php to validate permission names
     include PATH_APPLICATIONS . DS . 'skeleton' . DS . 'settings' . DS . 'structure.php';
     $ApplicationInfo = array();
     include CombinePaths(array(PATH_APPLICATIONS . DS . 'skeleton' . DS . 'settings' . DS . 'about.php'));
     $Version = ArrayValue('Version', ArrayValue('Skeleton', $ApplicationInfo, array()), 'Undefined');
     SaveToConfig('Skeleton.Version', $Version);
 }
开发者ID:tautomers,项目名称:knoopvszombies,代码行数:15,代码来源:class.hooks.php

示例11: ServerMapFolder

function ServerMapFolder($resourceType, $folderPath, $sCommand)
{
    global $Config;
    // Get the resource type directory.
    $sResourceTypePath = GetResourceTypeDirectory($resourceType, $sCommand);
    // Ensure that the directory exists.
    $sErrorMsg = CreateServerFolder($sResourceTypePath);
    if ($sErrorMsg != '') {
        SendError(1, "Ошибка создания папки \"{$sResourceTypePath}\" ({$sErrorMsg})");
    }
    if ($Config['ThumbList'] && $resourceType == 'Image') {
        ServerMapFolder('ImageThumb', $folderPath, $sCommand);
    }
    // Return the resource type directory combined with the required path.
    return CombinePaths($sResourceTypePath, $folderPath);
}
开发者ID:smartcorestudio,项目名称:ckfsys,代码行数:16,代码来源:io.php

示例12: Analytics

 public function Analytics($Method, $RequestParameters, $Callback = FALSE, $ParseResponse = TRUE)
 {
     $FullMethod = explode('/', $Method);
     if (sizeof($FullMethod) < 2) {
         array_unshift($FullMethod, "analytics");
     }
     list($ApiController, $ApiMethod) = $FullMethod;
     $ApiController = strtolower($ApiController);
     $ApiMethod = StringEndsWith(strtolower($ApiMethod), '.json', TRUE, TRUE) . '.json';
     $FinalURL = 'http://' . CombinePaths(array($this->AnalyticsServer, $ApiController, $ApiMethod));
     // Allow hooking of analytics events
     $this->EventArguments['AnalyticsMethod'] =& $Method;
     $this->EventArguments['AnalyticsArgs'] =& $RequestParameters;
     $this->EventArguments['AnalyticsUrl'] =& $FinalURL;
     $this->FireEvent('SendAnalytics');
     // Sign request
     $this->Sign($RequestParameters, TRUE);
     $RequestMethod = GetValue('RequestMethod', $RequestParameters, 'GET');
     unset($RequestParameters['RequestMethod']);
     try {
         $ProxyRequest = new ProxyRequest(FALSE, array('Method' => $RequestMethod, 'Timeout' => 10, 'Cookies' => FALSE));
         $Response = $ProxyRequest->Request(array('Url' => $FinalURL), $RequestParameters);
     } catch (Exception $e) {
         $Response = FALSE;
     }
     if ($Response !== FALSE) {
         $JsonResponse = json_decode($Response, TRUE);
         if ($JsonResponse !== FALSE) {
             if ($ParseResponse) {
                 $AnalyticsJsonResponse = (array) GetValue('Analytics', $JsonResponse, FALSE);
                 // If we received a reply, parse it
                 if ($AnalyticsJsonResponse !== FALSE) {
                     $this->ParseAnalyticsResponse($AnalyticsJsonResponse, $Response, $Callback);
                     return $AnalyticsJsonResponse;
                 }
             } else {
                 return $JsonResponse;
             }
         }
         return $Response;
     }
     return FALSE;
 }
开发者ID:rnovino,项目名称:Garden,代码行数:43,代码来源:class.statistics.php

示例13: Index

 /**
  * Setup the application.
  *
  * The methods in setup controllers should not call "Render". Rendering will
  * be handled by the controller that initiated the setup. This method should
  * return a boolean value indicating success.
  *
  * @return bool True on successful setup
  */
 public function Index()
 {
     $Database = Gdn::Database();
     $Config = Gdn::Factory(Gdn::AliasConfig);
     $Drop = Gdn::Config('Conversations.Version') === FALSE ? TRUE : FALSE;
     $Explicit = TRUE;
     $Validation = new Gdn_Validation();
     // This is going to be needed by structure.php to validate permission names
     try {
         include PATH_APPLICATIONS . DS . 'conversations' . DS . 'settings' . DS . 'structure.php';
     } catch (Exception $ex) {
         $this->Form->AddError(strip_tags($ex->getMessage()));
     }
     if ($this->Form->ErrorCount() == 0) {
         $ApplicationInfo = array();
         include CombinePaths(array(PATH_APPLICATIONS . DS . 'conversations' . DS . 'settings' . DS . 'about.php'));
         $Version = ArrayValue('Version', ArrayValue('Conversations', $ApplicationInfo, array()), 'Undefined');
         SaveToConfig('Conversations.Version', $Version);
     }
     return $this->Form->ErrorCount() > 0 ? FALSE : TRUE;
 }
开发者ID:Aetasiric,项目名称:Garden,代码行数:30,代码来源:setup.php

示例14: Structure

 public function Structure($AppName = 'garden', $CaptureOnly = '1', $Drop = '0', $Explicit = '0')
 {
     $this->Permission('Garden.AdminUser.Only');
     $File = CombinePaths(array(PATH_APPLICATIONS, $AppName, 'settings', 'structure.php'), DS);
     if (file_exists($File)) {
         $Validation = new Gdn_Validation();
         $Database = Gdn::Database();
         $Drop = $Drop == '0' ? FALSE : TRUE;
         $Explicit = $Explicit == '0' ? FALSE : TRUE;
         $CaptureOnly = !($CaptureOnly == '0');
         $Structure = Gdn::Structure();
         $Structure->CaptureOnly = $CaptureOnly;
         $this->SetData('CaptureOnly', $Structure->CaptureOnly);
         $this->SetData('Drop', $Drop);
         $this->SetData('Explicit', $Explicit);
         $this->SetData('ApplicationName', $AppName);
         $this->SetData('Status', '');
         try {
             include $File;
         } catch (Exception $ex) {
             $this->Form->AddError(strip_tags($ex->getMessage()));
         }
         if (property_exists($Structure, 'CapturedSql')) {
             $this->SetData('CapturedSql', (array) $Structure->CapturedSql);
         } else {
             $this->SetData('CapturedSql', array());
         }
         if ($this->Form->ErrorCount() == 0 && !$CaptureOnly) {
             $this->SetData('Status', 'The structure was successfully executed.');
         }
     }
     //$this->ControllerName = 'home';
     //$this->View = 'filenotfound';
     $this->AddCssFile('admin.css');
     $this->Render();
 }
开发者ID:robi-bobi,项目名称:Garden,代码行数:36,代码来源:utility.php

示例15: analyzeAddon


//.........这里部分代码省略.........
         $Addon['Path'] = $Path;
         $UploadsPath = PATH_UPLOADS . '/';
         if (stringBeginsWith($Addon['Path'], $UploadsPath)) {
             $Addon['File'] = substr($Addon['Path'], strlen($UploadsPath));
         }
         if (is_file($Path)) {
             $Addon['MD5'] = md5_file($Path);
             $Addon['FileSize'] = filesize($Path);
         }
     } elseif ($ThrowError) {
         $Msg = implode("\n", $Result);
         throw new Gdn_UserException($Msg, 400);
     } else {
         return false;
     }
     return $Addon;
     // Figure out what kind of addon this is.
     $Root = '';
     $NewRoot = '';
     $Addon = false;
     foreach ($Entries as $Entry) {
         $Name = '/' . ltrim($Entry['name'], '/');
         $Filename = basename($Name);
         $Folder = substr($Name, 0, -strlen($Filename));
         $NewRoot = '';
         // Check to see if the entry is a plugin file.
         if ($Filename == 'default.php' || StringEndsWith($Filename, '.plugin.php')) {
             if (count(explode('/', $Folder)) > 3) {
                 // The file is too deep to be a plugin file.
                 continue;
             }
             // This could be a plugin file, but we have to examine its info array.
             $Zip->extractTo($FolderPath, $Entry['name']);
             $FilePath = CombinePaths(array($FolderPath, $Name));
             $Info = self::ParseInfoArray($FilePath, 'PluginInfo');
             Gdn_FileSystem::RemoveFolder(dirname($FilePath));
             if (!is_array($Info) || !count($Info)) {
                 continue;
             }
             // Check to see if the info array conforms to a plugin spec.
             $Key = key($Info);
             $Info = $Info[$Key];
             $Root = trim($Folder, '/');
             $Valid = true;
             // Make sure the key matches the folder name.
             if ($Root && strcasecmp($Root, $Key) != 0) {
                 $Result[] = "{$Name}: The plugin's key is not the same as its folder name.";
                 $Valid = false;
             } else {
                 $NewRoot = $Root;
             }
             if (!val('Description', $Info)) {
                 $Result[] = $Name . ': ' . sprintf(t('ValidateRequired'), t('Description'));
                 $Valid = false;
             }
             if (!val('Version', $Info)) {
                 $Result[] = $Name . ': ' . sprintf(t('ValidateRequired'), t('Version'));
                 $Valid = false;
             }
             if ($Valid) {
                 // The plugin was confirmed.
                 $Addon = array('AddonKey' => $Key, 'AddonTypeID' => ADDON_TYPE_PLUGIN, 'Name' => val('Name', $Info) ? $Info['Name'] : $Key, 'Description' => $Info['Description'], 'Version' => $Info['Version'], 'Path' => $Path);
                 break;
             }
             continue;
         }
开发者ID:caidongyun,项目名称:vanilla,代码行数:67,代码来源:class.updatemodel.php


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