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


PHP c_ws_plugin__s2member_utils_dirs::get_temp_dir方法代码示例

本文整理汇总了PHP中c_ws_plugin__s2member_utils_dirs::get_temp_dir方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_dirs::get_temp_dir方法的具体用法?PHP c_ws_plugin__s2member_utils_dirs::get_temp_dir怎么用?PHP c_ws_plugin__s2member_utils_dirs::get_temp_dir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在c_ws_plugin__s2member_utils_dirs的用法示例。


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

示例1: rel_path

 /**
  * Finds the relative path, from one location to another.
  *
  * @package s2Member\Utilities
  * @since 110815
  *
  * @param string $from The full directory path to calculate a relative path `from`.
  * @param string $to The full directory or file path, which this routine will build a relative path `to`.
  * @param bool $try_realpaths Defaults to true. When true, try to acquire ``realpath()``, thereby resolving all relative paths and/or symlinks in ``$from`` and ``$to`` args.
  * @param bool $use_win_diff_drive_jctn Defaults to true. When true, we'll work around issues with different drives on Windows by trying to create a directory junction.
  * @return string String with the relative path to: ``$to``.
  */
 public static function rel_path($from = FALSE, $to = FALSE, $try_realpaths = TRUE, $use_win_diff_drive_jctn = TRUE)
 {
     if (!($rel_path = array()) && is_string($from) && strlen($from) && is_string($to) && strlen($to)) {
         $from = $try_realpaths && ($_real_from = realpath($from)) ? $_real_from : $from;
         // Try this?
         $to = $try_realpaths && ($_real_to = realpath($to)) ? $_real_to : $to;
         // Try to find realpath?
         $from = is_file($from) ? dirname($from) . "/" : $from . "/";
         // A (directory) with trailing `/`.
         $from = c_ws_plugin__s2member_utils_dirs::n_dir_seps($from);
         // Normalize directory separators now.
         $to = c_ws_plugin__s2member_utils_dirs::n_dir_seps($to);
         // Normalize directory separators here too.
         $from = preg_split("/\\//", $from);
         // Convert ``$from``, to an array. Split on each directory separator.
         $to = preg_split("/\\//", $to);
         // Also convert ``$to``, to an array. Split this on each directory separator.
         if ($use_win_diff_drive_jctn && stripos(PHP_OS, "win") === 0) {
             if (preg_match("/^([A-Z])\\:\$/i", $from[0], $_m) && ($_from_drive = $_m[1]) && preg_match("/^([A-Z])\\:\$/i", $to[0], $_m) && ($_to_drive = $_m[1])) {
                 if ($_from_drive !== $_to_drive) {
                     $_from_drive_jctn = $_from_drive . ":/s2-" . $_to_drive . "-jctn";
                     $_sys_temp_dir_jctn = c_ws_plugin__s2member_utils_dirs::get_temp_dir(false) . "/s2-" . $_to_drive . "-jctn";
                     $_jctn = $_sys_temp_dir_jctn && strpos($_sys_temp_dir_jctn, $_from_drive) === 0 ? $_sys_temp_dir_jctn : $_from_drive_jctn;
                     if (($_from_drive_jctn_exists = is_dir($_from_drive_jctn) ? true : false) || c_ws_plugin__s2member_utils_dirs::create_win_jctn($_jctn, $_to_drive . ":/")) {
                         array_shift($to);
                         foreach (array_reverse(preg_split("/\\//", $_from_drive_jctn_exists ? $_from_drive_jctn : $_jctn)) as $_jctn_dir) {
                             array_unshift($to, $_jctn_dir);
                         }
                     } else {
                         trigger_error("Unable to generate a relative path across different Windows drives." . " Please create a Directory Junction here: " . $_from_drive_jctn . ", pointing to: " . $_to_drive . ":/", E_USER_ERROR);
                     }
                 }
             }
         }
         unset($_real_from, $_real_to, $_from_drive, $_to_drive, $_from_drive_jctn, $_sys_temp_dir_jctn, $_jctn, $_from_drive_jctn_exists, $_jctn_dir, $_m);
         $rel_path = $to;
         // Re-initialize. Start ``$rel_path`` as the value of the ``$to`` array.
         foreach (array_keys($from) as $_depth) {
             if (isset($from[$_depth], $to[$_depth]) && $from[$_depth] === $to[$_depth]) {
                 array_shift($rel_path);
             } else {
                 if (($_remaining = count($from) - $_depth) > 1) {
                     $_left_p = -1 * (count($rel_path) + ($_remaining - 1));
                     $rel_path = array_pad($rel_path, $_left_p, "..");
                     break;
                     // Stop now, no need to go any further.
                 } else {
                     $rel_path[0] = "./" . $rel_path[0];
                     break;
                     // Stop now.
                 }
             }
         }
     }
     return implode("/", $rel_path);
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:68,代码来源:utils-dirs.inc.php

示例2: _rsa_sha1_shell_sign

 /**
  * Generates an RSA-SHA1 signature from the command line.
  *
  * Used by {@link s2Member\Utilities\c_ws_plugin__s2member_utils_strings::rsa_sha1_sign()}.
  *
  * @package s2Member\Utilities
  * @since 111017
  *
  * @param str $string Input string/data, to be signed by this routine.
  * @param str $key The secret key that will be used in this signature.
  * @param str $openssl Optional. Defaults to `openssl`. Path to OpenSSL executable.
  * @return str|bool An RSA-SHA1 signature string, or false on failure.
  */
 public static function _rsa_sha1_shell_sign($string = FALSE, $key = FALSE, $openssl = FALSE)
 {
     if (function_exists("shell_exec") && ($esa = "escapeshellarg") && ($openssl = $openssl && is_string($openssl) ? $openssl : "openssl") && ($temp_dir = c_ws_plugin__s2member_utils_dirs::get_temp_dir())) {
         file_put_contents($string_file = $temp_dir . "/" . md5(uniqid("", true) . "rsa-sha1-string") . ".tmp", (string) $string);
         file_put_contents($private_key_file = $temp_dir . "/" . md5(uniqid("", true) . "rsa-sha1-private-key") . ".tmp", (string) $key);
         file_put_contents($rsa_sha1_sig_file = $temp_dir . "/" . md5(uniqid("", true) . "rsa-sha1-sig") . ".tmp", "");
         /**/
         @shell_exec($esa($openssl) . " sha1 -sign " . $esa($private_key_file) . " -out " . $esa($rsa_sha1_sig_file) . " " . $esa($string_file));
         $signature = file_get_contents($rsa_sha1_sig_file);
         /* Was the signature was written? */
         unlink($rsa_sha1_sig_file) . unlink($private_key_file) . unlink($string_file);
         /* Cleanup. */
     }
     return !empty($signature) ? $signature : false;
 }
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:28,代码来源:utils-strings.inc.php

示例3: _rsa_sha1_shell_sign

 /**
  * Generates an RSA-SHA1 signature from the command line.
  *
  * Used by {@link s2Member\Utilities\c_ws_plugin__s2member_utils_strings::rsa_sha1_sign()}.
  *
  * @package s2Member\Utilities
  * @since 111017
  *
  * @param string $string Input string/data, to be signed by this routine.
  * @param string $key The secret key that will be used in this signature.
  * @param string $openssl Optional. Defaults to `openssl`. Path to OpenSSL executable.
  *
  * @return string|bool An RSA-SHA1 signature string, or false on failure.
  */
 public static function _rsa_sha1_shell_sign($string = '', $key = '', $openssl = '')
 {
     if (function_exists('shell_exec') && ($esa = 'escapeshellarg') && ($openssl = $openssl && is_string($openssl) ? $openssl : 'openssl') && ($temp_dir = c_ws_plugin__s2member_utils_dirs::get_temp_dir())) {
         file_put_contents($string_file = $temp_dir . '/' . md5(uniqid('', TRUE) . 'rsa-sha1-string') . '.tmp', (string) $string);
         file_put_contents($private_key_file = $temp_dir . '/' . md5(uniqid('', TRUE) . 'rsa-sha1-private-key') . '.tmp', (string) $key);
         file_put_contents($rsa_sha1_sig_file = $temp_dir . '/' . md5(uniqid('', TRUE) . 'rsa-sha1-sig') . '.tmp', '');
         @shell_exec($esa($openssl) . ' sha1 -sign ' . $esa($private_key_file) . ' -out ' . $esa($rsa_sha1_sig_file) . ' ' . $esa($string_file));
         $signature = file_get_contents($rsa_sha1_sig_file);
         // Do NOT trim here. Was the signature was written?
         unlink($rsa_sha1_sig_file) . unlink($private_key_file) . unlink($string_file);
         // Cleanup.
     }
     return !empty($signature) ? $signature : FALSE;
 }
开发者ID:codeforest,项目名称:s2member,代码行数:28,代码来源:utils-strings.inc.php


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