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

PHP parse_path函数代码示例

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

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



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

示例1: xsl_transform_feed

function xsl_transform_feed($feedUrl, $xslPath)
{
    $doc = new DOMDocument();
    $xsl = new XSLTProcessor();
    $doc->load(parse_path($xslPath));
    $xsl->importStyleSheet($doc);
    $doc->loadXML(file_get_contents(parse_path($feedUrl)));
    $xsl->registerPHPFunctions(array('xsl_counter'));
    return $xsl->transformToXML($doc);
}
开发者ID:BGCX262,项目名称:zwf-svn-to-git,代码行数:10,代码来源:xsl.php


示例2: parse_path

function parse_path($dir)
{
    $css_files = array();
    // Retrieving files
    $files = glob($dir . '*', GLOB_MARK);
    // Ordering by name
    asort($files);
    foreach ($files as $file) {
        // Searching for files inside a folder
        if (is_dir($file)) {
            $css_files = array_merge(parse_path($file), $css_files);
        } elseif (substr($file, -3, 3) == 'css') {
            $css_files[] = $file;
        }
    }
    return $css_files;
}
开发者ID:xfifix,项目名称:WPUTheme,代码行数:17,代码来源:styles.php


示例3: parse_path

<?php

function parse_path()
{
    $path = array();
    if (isset($_SERVER['REQUEST_URI'])) {
        $request_path = explode('?', $_SERVER['REQUEST_URI']);
        $path['base'] = rtrim(dirname($_SERVER['SCRIPT_NAME']), '\\/');
        $path['call_utf8'] = substr(urldecode($request_path[0]), strlen($path['base']) + 1);
        $path['call'] = utf8_decode($path['call_utf8']);
        if ($path['call'] == basename($_SERVER['PHP_SELF'])) {
            $path['call'] = '';
        }
        $path['call_parts'] = explode('/', $path['call']);
    }
    return $path;
}
$path_info = parse_path();
开发者ID:victorillescas,项目名称:basic-php-sass-famework,代码行数:18,代码来源:functions.php


示例4: define

define('PUBLIC_ENDPOINT', false);
// Can anyone can access this endpoint
# Including our configuration
require_once __DIR__ . '/_includes/config.php';
require_once __DIR__ . '/_includes/validate-app.php';
# Our return class
$content = new stdClass();
$content->success = true;
$content->env = PostParser::create_attribute($G_APP_ENVIRONMENT);
$content->error_message = [];
$content->replaced = [];
$content->path = [];
$content->url = [];
$content->version = [];
# Our target directory
$G_PATH_DATA = parse_path($_CGET['dir'], $_ENDPOINT, $G_TOKEN_SESSION_DATA);
$G_DIRECTORY_DATA = directory_hierarchy($G_STORAGE_CONTROLLER_DBLINK, $G_APP_DATA['id'], $G_APP_ENVIRONMENT, $G_PATH_DATA->absolute, $G_APP_DATA['file_auto_makedir'] == 1);
# Getting our server where we are going to store the files
$query = "\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t" . NQ_SERVERS_TABLE . "\n\t\t\tWHERE\n\t\t\t\t`server_type`\t='file' AND\n\t\t\t\t`environment`\t='" . mysqli_escape_string($G_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "'\n\t\t\tORDER BY\n\t\t\t\t`tier` ASC,\n\t\t\t\t`available_space` DESC\n\t\t\tLIMIT 1";
$G_SERVER_DATA = mysqli_single_result_query($G_CONTROLLER_DBLINK, $query);
# Combining our host properties into our path
$G_SERVER_HOST = NQ_FILE_STORAGE_PROTOCOL . $G_SERVER_DATA['username'] . NQ_FILE_STORAGE_CRED_SEPARATOR . $G_SERVER_DATA['password'] . NQ_FILE_STORAGE_HOST_SEPARATOR . $G_SERVER_DATA['host'] . $G_SERVER_DATA['path'];
# Tracking filesize changes
$G_FILESIZE_ADDED = 0;
# Looping through our files
foreach ($_FILES as $file) {
    # Our names and tmp_name files
    $names = array();
    $tmp_names = array();
    $file_types = array();
    # If we have an array or we don't we need to make it an array
开发者ID:nuQuery,项目名称:v1m0-api-file,代码行数:31,代码来源:upload.php


示例5: action_install


//.........这里部分代码省略.........
         } elseif ($action['type'] == 'requires') {
             $installed_version = false;
             $version_check = true;
             // Package missing required values?
             if (!isset($action['id'])) {
                 $context['has_failure'] = true;
             } else {
                 // See if this dependency is installed
                 $installed_version = checkPackageDependency($action['id']);
                 // Do a version level check (if requested) in the most basic way
                 $version_check = isset($action['version']) ? $installed_version == $action['version'] : true;
             }
             // Set success or failure information
             $action['description'] = $installed_version && $version_check ? $txt['package_action_success'] : $txt['package_action_failure'];
             $context['has_failure'] = !($installed_version && $version_check);
             $thisAction = array('type' => $txt['package_requires'], 'action' => $txt['package_check_for'] . ' ' . $action['id'] . (isset($action['version']) ? ' / ' . ($version_check ? $action['version'] : '<span class="error">' . $action['version'] . '</span>') : ''));
         } elseif (in_array($action['type'], array('require-dir', 'require-file'))) {
             // Do this one...
             $thisAction = array('type' => $txt['package_extract'] . ' ' . ($action['type'] == 'require-dir' ? $txt['package_tree'] : $txt['package_file']), 'action' => Util::htmlspecialchars(strtr($action['destination'], array(BOARDDIR => '.'))));
             // Could this be theme related?
             if (!empty($action['unparsed_destination']) && preg_match('~^\\$(languagedir|languages_dir|imagesdir|themedir|themes_dir)~i', $action['unparsed_destination'], $matches)) {
                 // Is the action already stated?
                 $theme_action = !empty($action['theme_action']) && in_array($action['theme_action'], array('no', 'yes', 'auto')) ? $action['theme_action'] : 'auto';
                 // If it's not auto do we think we have something we can act upon?
                 if ($theme_action != 'auto' && !in_array($matches[1], array('languagedir', 'languages_dir', 'imagesdir', 'themedir'))) {
                     $theme_action = '';
                 } elseif ($theme_action == 'auto' && $matches[1] != 'imagesdir') {
                     $theme_action = '';
                 }
                 // So, we still want to do something?
                 if ($theme_action != '') {
                     $themeFinds['candidates'][] = $action;
                 } elseif ($matches[1] == 'themes_dir') {
                     $themeFinds['other_themes'][] = strtolower(strtr(parse_path($action['unparsed_destination']), array('\\' => '/')) . '/' . basename($action['filename']));
                 }
             }
         } elseif (in_array($action['type'], array('move-dir', 'move-file'))) {
             $thisAction = array('type' => $txt['package_move'] . ' ' . ($action['type'] == 'move-dir' ? $txt['package_tree'] : $txt['package_file']), 'action' => Util::htmlspecialchars(strtr($action['source'], array(BOARDDIR => '.'))) . ' => ' . Util::htmlspecialchars(strtr($action['destination'], array(BOARDDIR => '.'))));
         } elseif (in_array($action['type'], array('remove-dir', 'remove-file'))) {
             $thisAction = array('type' => $txt['package_delete'] . ' ' . ($action['type'] == 'remove-dir' ? $txt['package_tree'] : $txt['package_file']), 'action' => Util::htmlspecialchars(strtr($action['filename'], array(BOARDDIR => '.'))));
             // Could this be theme related?
             if (!empty($action['unparsed_filename']) && preg_match('~^\\$(languagedir|languages_dir|imagesdir|themedir|themes_dir)~i', $action['unparsed_filename'], $matches)) {
                 // Is the action already stated?
                 $theme_action = !empty($action['theme_action']) && in_array($action['theme_action'], array('no', 'yes', 'auto')) ? $action['theme_action'] : 'auto';
                 $action['unparsed_destination'] = $action['unparsed_filename'];
                 // If it's not auto do we think we have something we can act upon?
                 if ($theme_action != 'auto' && !in_array($matches[1], array('languagedir', 'languages_dir', 'imagesdir', 'themedir'))) {
                     $theme_action = '';
                 } elseif ($theme_action == 'auto' && $matches[1] != 'imagesdir') {
                     $theme_action = '';
                 }
                 // So, we still want to do something?
                 if ($theme_action != '') {
                     $themeFinds['candidates'][] = $action;
                 } elseif ($matches[1] == 'themes_dir') {
                     $themeFinds['other_themes'][] = strtolower(strtr(parse_path($action['unparsed_filename']), array('\\' => '/')) . '/' . basename($action['filename']));
                 }
             }
         }
         if (empty($thisAction)) {
             continue;
         }
         if (isset($action['filename'])) {
             if ($context['uninstalling']) {
                 $file = in_array($action['type'], array('remove-dir', 'remove-file')) ? $action['filename'] : BOARDDIR . '/packages/temp/' . $context['base_path'] . $action['filename'];
             } else {
开发者ID:scripple,项目名称:Elkarte,代码行数:67,代码来源:Packages.controller.php


示例6: define

# Setting our constants
define('CACHEABLE', false);
// Can this page be cached on the users browser
define('PUBLIC_ENDPOINT', false);
// Can anyone can access this endpoint
define('INCLUDE_IMAGE_CLASS', false);
// Are you going to be using the image class
# Including our configuration
require_once __DIR__ . '/_includes/config.php';
require_once __DIR__ . '/_includes/validate-app.php';
# Handling our global json parsing
$_JPOST = PostParser::decode();
# Our return class
$content = new stdClass();
# Creating our directory
$G_PATH_DATA = parse_path($_JPOST->dir, $_ENDPOINT, $G_TOKEN_SESSION_DATA);
$G_DIRECTORY_DATA = directory_hierarchy($G_STORAGE_CONTROLLER_DBLINK, $G_APP_DATA['id'], $G_APP_ENVIRONMENT, $G_PATH_DATA->absolute, true);
# Our return values!
$content->success = true;
$content->env = PostParser::create_attribute($G_APP_ENVIRONMENT);
$content->path = $G_PATH_DATA->urlpath;
# How are we going to return our data
PostParser::send($content);
/* --- Connection closed wit PostParser::send --- Below this point things need to be tracked and cleaned up --- */
# Closing the storage connection
mysqli_shared_close($G_STORAGE_CONTROLLER_DBLINK, $G_SHARED_DBLINKS);
# Closing controller if tracking is different
if (NQ_CONTROLLER_HOST != NQ_TRACKING_HOST) {
    mysqli_shared_close($G_CONTROLLER_DBLINK, $G_SHARED_DBLINKS);
}
# Adding our usage
开发者ID:nuQuery,项目名称:v1m0-api-image,代码行数:31,代码来源:mkdir.php


示例7: PackageInstallTest


//.........这里部分代码省略.........
                        $context['actions'][$actual_filename]['operations'][] = array('type' => $txt['execute_modification'], 'action' => commonAPI::htmlspecialchars(strtr($mod_action['filename'], array($boarddir => '.'))), 'description' => $mod_action['failed'] ? $txt['package_action_failure'] : $txt['package_action_success'], 'position' => $mod_action['position'], 'operation_key' => $operation_key, 'filename' => $action['filename'], 'is_boardmod' => $action['boardmod'], 'failed' => $mod_action['failed'], 'ignore_failure' => !empty($mod_action['ignore_failure']));
                    }
                    // Themes are under the saved type.
                    if (isset($mod_action['is_custom']) && isset($context['theme_actions'][$mod_action['is_custom']])) {
                        $context['theme_actions'][$mod_action['is_custom']]['actions'][$actual_filename]['operations'][] = array('type' => $txt['execute_modification'], 'action' => commonAPI::htmlspecialchars(strtr($mod_action['filename'], array($boarddir => '.'))), 'description' => $mod_action['failed'] ? $txt['package_action_failure'] : $txt['package_action_success'], 'position' => $mod_action['position'], 'operation_key' => $operation_key, 'filename' => $action['filename'], 'is_boardmod' => $action['boardmod'], 'failed' => $mod_action['failed'], 'ignore_failure' => !empty($mod_action['ignore_failure']));
                    }
                }
            }
            // Don't add anything else.
            $thisAction = array();
        } elseif ($action['type'] == 'code') {
            $thisAction = array('type' => $txt['execute_code'], 'action' => commonAPI::htmlspecialchars($action['filename']));
        } elseif ($action['type'] == 'database') {
            $thisAction = array('type' => $txt['execute_database_changes'], 'action' => commonAPI::htmlspecialchars($action['filename']));
        } elseif (in_array($action['type'], array('create-dir', 'create-file'))) {
            $thisAction = array('type' => $txt['package_create'] . ' ' . ($action['type'] == 'create-dir' ? $txt['package_tree'] : $txt['package_file']), 'action' => commonAPI::htmlspecialchars(strtr($action['destination'], array($boarddir => '.'))));
        } elseif (in_array($action['type'], array('require-dir', 'require-file'))) {
            // Do this one...
            $thisAction = array('type' => $txt['package_extract'] . ' ' . ($action['type'] == 'require-dir' ? $txt['package_tree'] : $txt['package_file']), 'action' => commonAPI::htmlspecialchars(strtr($action['destination'], array($boarddir => '.'))));
            // Could this be theme related?
            if (!empty($action['unparsed_destination']) && preg_match('~^\\$(languagedir|languages_dir|imagesdir|themedir|themes_dir)~i', $action['unparsed_destination'], $matches)) {
                // Is the action already stated?
                $theme_action = !empty($action['theme_action']) && in_array($action['theme_action'], array('no', 'yes', 'auto')) ? $action['theme_action'] : 'auto';
                // If it's not auto do we think we have something we can act upon?
                if ($theme_action != 'auto' && !in_array($matches[1], array('languagedir', 'languages_dir', 'imagesdir', 'themedir'))) {
                    $theme_action = '';
                } elseif ($theme_action == 'auto' && $matches[1] != 'imagesdir') {
                    $theme_action = '';
                }
                // So, we still want to do something?
                if ($theme_action != '') {
                    $themeFinds['candidates'][] = $action;
                } elseif ($matches[1] == 'themes_dir') {
                    $themeFinds['other_themes'][] = strtolower(strtr(parse_path($action['unparsed_destination']), array('\\' => '/')) . '/' . basename($action['filename']));
                }
            }
        } elseif (in_array($action['type'], array('move-dir', 'move-file'))) {
            $thisAction = array('type' => $txt['package_move'] . ' ' . ($action['type'] == 'move-dir' ? $txt['package_tree'] : $txt['package_file']), 'action' => commonAPI::htmlspecialchars(strtr($action['source'], array($boarddir => '.'))) . ' => ' . commonAPI::htmlspecialchars(strtr($action['destination'], array($boarddir => '.'))));
        } elseif (in_array($action['type'], array('remove-dir', 'remove-file'))) {
            $thisAction = array('type' => $txt['package_delete'] . ' ' . ($action['type'] == 'remove-dir' ? $txt['package_tree'] : $txt['package_file']), 'action' => commonAPI::htmlspecialchars(strtr($action['filename'], array($boarddir => '.'))));
            // Could this be theme related?
            if (!empty($action['unparsed_filename']) && preg_match('~^\\$(languagedir|languages_dir|imagesdir|themedir|themes_dir)~i', $action['unparsed_filename'], $matches)) {
                // Is the action already stated?
                $theme_action = !empty($action['theme_action']) && in_array($action['theme_action'], array('no', 'yes', 'auto')) ? $action['theme_action'] : 'auto';
                $action['unparsed_destination'] = $action['unparsed_filename'];
                // If it's not auto do we think we have something we can act upon?
                if ($theme_action != 'auto' && !in_array($matches[1], array('languagedir', 'languages_dir', 'imagesdir', 'themedir'))) {
                    $theme_action = '';
                } elseif ($theme_action == 'auto' && $matches[1] != 'imagesdir') {
                    $theme_action = '';
                }
                // So, we still want to do something?
                if ($theme_action != '') {
                    $themeFinds['candidates'][] = $action;
                } elseif ($matches[1] == 'themes_dir') {
                    $themeFinds['other_themes'][] = strtolower(strtr(parse_path($action['unparsed_filename']), array('\\' => '/')) . '/' . basename($action['filename']));
                }
            }
        }
        if (empty($thisAction)) {
            continue;
        }
        // !!! None given?
        $thisAction['description'] = isset($action['description']) ? $action['description'] : '';
        $context['actions'][] = $thisAction;
    }
开发者ID:norv,项目名称:EosAlpha,代码行数:67,代码来源:Packages.php


示例8: icopy

function icopy($path, $dir)
{
    if (!file_exists($path)) {
        return false;
    }
    $tmpPath = parse_path($path);
    if (!is_dir($path)) {
        create_dir($dir);
        if (!copy($path, $dir . '/' . $tmpPath['filename'])) {
            return false;
        }
    } else {
        create_dir($dir);
        foreach ((array) list_dir($path) as $lineArray) {
            if ($lineArray['type'] == 'dir') {
                icopy($lineArray['path'], $dir . '/' . $lineArray['filename']);
            } else {
                icopy($lineArray['path'], $dir);
            }
        }
    }
    return true;
}
开发者ID:AlvarodelRosal,项目名称:xppass,代码行数:23,代码来源:utils.php


示例9: define

		FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
		AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
		LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
		OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
		THE SOFTWARE.
*/
# Setting our constants
define('CACHEABLE', false);
// Can this page be cached on the users browser
define('PUBLIC_ENDPOINT', false);
// Can anyone can access this endpoint
# Including our configuration
require_once __DIR__ . '/_includes/config.php';
require_once __DIR__ . '/_includes/validate-app.php';
# Getting our directory
$G_PATH_DATA = parse_path(implode('/', array_splice($_BASEDIR, 3)), $_ENDPOINT, $G_TOKEN_SESSION_DATA);
$query = "\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t" . NQ_DIRECTORY_TABLE . "\n\t\t\tWHERE\n\t\t\t\t`app_id`\t=" . (int) $G_APP_DATA['id'] . " AND\n\t\t\t\t`environment`\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "' AND\n\t\t\t\t`path`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, urldecode($G_PATH_DATA->dir)) . "' AND\n\t\t\t\t`name`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, urldecode($G_PATH_DATA->name)) . "'\n\t\t\tLIMIT 1";
$directory_data = mysqli_single_result_query($G_STORAGE_CONTROLLER_DBLINK, $query);
# Checking to see if we are blacklisted
$tid = isset($G_TOKEN_DATA['id']) ? $G_TOKEN_DATA['id'] : 0;
check_directory_blacklisted($G_CONTROLLER_DBLINK, $tid, $G_TOKEN_SESSION_DATA, $directory_data['path'] . $directory_data['name'], true);
# Getting our file
$query = "\tSELECT\n\t\t\t\t`created`,\n\t\t\t\t`filesize`,\n\t\t\t\t`file_id`,\n\t\t\t\t`meta_height` AS `height`,\n\t\t\t\t1 AS `live`,\n\t\t\t\t`modified`,\n\t\t\t\t`name`,\n\t\t\t\t`version`,\n\t\t\t\t`meta_width` AS `width`,\n\t\t\t\tCONCAT('" . NQ_DOMAIN_ROOT . '/' . $G_APP_DATA['id'] . '/view' . "','" . substr($directory_data['path'], 2) . $directorty_data['name'] . "','/',`name`" . ($G_APP_ENVIRONMENT == 'prod' ? "" : ",'?env=" . $G_APP_ENVIRONMENT . "'") . ") AS `url`\n  \t\t\tFROM\n\t\t\t\t" . NQ_FILE_TABLE . "\n\t\t\tWHERE \n\t\t\t\t`app_id`\t=" . (int) $G_APP_DATA['id'] . " AND\n\t\t\t\t`environment`\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "' AND\n\t\t\t\t`directory_id`\t=" . (int) $directory_data['id'] . " AND\n\t\t\t\t`name`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, urldecode($_FILENAME)) . "'\n\t\t\tLIMIT 1";
$file_data = mysqli_single_result_query($G_STORAGE_CONTROLLER_DBLINK, $query);
# Erroring if we don't have a file
if (!isset($file_data['name'])) {
    exit_fail(NQ_INVALID_VALUE, LANG_INVALID_FILE);
}
# Getting our file
$query = "\tSELECT\n\t\t\t\t`created`,\n\t\t\t\t`filesize`,\n\t\t\t\t`meta_height` AS `height`,\n\t\t\t\t0 AS `live`,\n\t\t\t\t`modified`,\n\t\t\t\t`name`,\n\t\t\t\t`version`,\n\t\t\t\t`meta_width` AS `width`,\n\t\t\t\tCONCAT('" . NQ_DOMAIN_ROOT . '/' . $G_APP_DATA['id'] . '/view' . "','" . substr($directory_data['path'], 2) . $directorty_data['name'] . "','/',`name`,'?version=',`version`" . ($G_APP_ENVIRONMENT == 'prod' ? "" : ",'&env=" . $G_APP_ENVIRONMENT . "'") . ") AS `url`\n  \t\t\tFROM\n\t\t\t\t" . NQ_FILE_VERSION_TABLE . "\n\t\t\tWHERE \n\t\t\t\t`file_id`\t=" . (int) $file_data['file_id'] . "\n\t\t\tORDER BY \n\t\t\t\t`version` DESC";
$result = mysqli_multi_result_query($G_STORAGE_CONTROLLER_DBLINK, $query);
开发者ID:nuQuery,项目名称:v1m0-api-file,代码行数:31,代码来源:versions.php


示例10: parseBoardMod

function parseBoardMod($file, $testing = true, $undo = false)
{
    global $boarddir, $sourcedir, $settings, $txt, $modSettings;
    @set_time_limit(600);
    $file = strtr($file, array("\r" => ''));
    $working_file = null;
    $working_search = null;
    $working_data = '';
    $replace_with = null;
    $actions = array();
    $everything_found = true;
    while (preg_match('~<(edit file|file|search|search for|add|add after|replace|add before|add above|above|before)>\\n(.*?)\\n</\\1>~is', $file, $code_match) != 0) {
        // Edit a specific file.
        if ($code_match[1] == 'file' || $code_match[1] == 'edit file') {
            // Backup the old file.
            if ($working_file !== null) {
                package_chmod($working_file);
                // Don't even dare.
                if (basename($working_file) == 'Settings_bak.php') {
                    continue;
                }
                if (!is_writable($working_file)) {
                    $actions[] = array('type' => 'chmod', 'filename' => $working_file);
                }
                if (!$testing && !empty($modSettings['package_make_backups']) && file_exists($working_file)) {
                    if (basename($working_file) == 'Settings.php') {
                        @copy($working_file, dirname($working_file) . '/Settings_bak.php');
                    } else {
                        @copy($working_file, $working_file . '~');
                    }
                }
                package_put_contents($working_file, $working_data, $testing);
            }
            if ($working_file !== null) {
                $actions[] = array('type' => 'saved', 'filename' => $working_file);
            }
            // Make sure the file exists!
            $working_file = parse_path($code_match[2]);
            if ($working_file[0] != '/' && $working_file[1] != ':') {
                trigger_error('parseBoardMod(): The filename \'' . $working_file . '\' is not a full path!', E_USER_WARNING);
                $working_file = $boarddir . '/' . $working_file;
            }
            if (!file_exists($working_file)) {
                $places_to_check = array($boarddir, $sourcedir, $settings['default_theme_dir'], $settings['default_theme_dir'] . '/languages');
                foreach ($places_to_check as $place) {
                    if (file_exists($place . '/' . $working_file)) {
                        $working_file = $place . '/' . $working_file;
                        break;
                    }
                }
            }
            if (file_exists($working_file)) {
                // Load the new file.
                $working_data = str_replace("\r", '', package_get_contents($working_file));
                $actions[] = array('type' => 'opened', 'filename' => $working_file);
            } else {
                $actions[] = array('type' => 'missing', 'filename' => $working_file);
                $working_file = null;
                $everything_found = false;
            }
            // Can't be searching for something...
            $working_search = null;
        } elseif (($code_match[1] == 'search' || $code_match[1] == 'search for') && $working_file !== null) {
            if ($working_search !== null) {
                $actions[] = array('type' => 'error', 'filename' => $working_file);
                $everything_found = false;
            }
            $working_search = $code_match[2];
        } elseif ($working_search !== null) {
            // This is the base string....
            $replace_with = $code_match[2];
            // Add this afterward...
            if ($code_match[1] == 'add' || $code_match[1] == 'add after') {
                $replace_with = $working_search . "\n" . $replace_with;
            } elseif ($code_match[1] == 'before' || $code_match[1] == 'add before' || $code_match[1] == 'above' || $code_match[1] == 'add above') {
                $replace_with .= "\n" . $working_search;
            }
            // Otherwise.. replace with $replace_with ;).
        }
        // If we have a search string, replace string, and open file..
        if ($working_search !== null && $replace_with !== null && $working_file !== null) {
            // Make sure it's somewhere in the string.
            if ($undo) {
                $temp = $replace_with;
                $replace_with = $working_search;
                $working_search = $temp;
            }
            if (strpos($working_data, $working_search) !== false) {
                $working_data = str_replace($working_search, $replace_with, $working_data);
                $actions[] = array('type' => 'replace', 'filename' => $working_file, 'search' => $working_search, 'replace' => $replace_with);
            } else {
                $actions[] = array('type' => 'failure', 'filename' => $working_file, 'search' => $working_search);
                $everything_found = false;
            }
            // These don't hold any meaning now.
            $working_search = null;
            $replace_with = null;
        }
        // Get rid of the old tag.
        $file = substr_replace($file, '', strpos($file, $code_match[0]), strlen($code_match[0]));
//.........这里部分代码省略.........
开发者ID:alencarmo,项目名称:OCF,代码行数:101,代码来源:Subs-Package.php


示例11: list_integration_hooks_data

/**
 * Callback function for the integration hooks list (list_integration_hooks)
 *
 * What it does:
 * - Gets all of the hooks in the system and their status
 * - Would be better documented if Ema was not lazy
 *
 * @package AddonSettings
 * @param int $start
 * @param int $per_page
 * @param string $sort
 * @return array
 */
function list_integration_hooks_data($start, $per_page, $sort)
{
    global $txt, $context, $scripturl, $modSettings;
    require_once SUBSDIR . '/Package.subs.php';
    $hooks = $temp_hooks = get_integration_hooks();
    $hooks_data = $temp_data = $hook_status = array();
    $files = get_files_recursive(SOURCEDIR);
    if (!empty($files)) {
        foreach ($files as $file) {
            if (is_file($file['dir'] . '/' . $file['name']) && substr($file['name'], -4) === '.php') {
                $fp = fopen($file['dir'] . '/' . $file['name'], 'rb');
                $fc = strtr(fread($fp, filesize($file['dir'] . '/' . $file['name'])), array("\r" => '', "\n" => ''));
                fclose($fp);
                foreach ($temp_hooks as $hook => $functions) {
                    foreach ($functions as $function_o) {
                        $hook_name = str_replace(']', '', $function_o);
                        if (strpos($hook_name, '::') !== false) {
                            $function = explode('::', $hook_name);
                            $class = $function[0];
                            $function = $function[1];
                        } else {
                            $class = '';
                            $function = $hook_name;
                        }
                        $function = explode('|', $function);
                        $function = $function[0];
                        if (substr($hook, -8) === '_include') {
                            $real_path = parse_path(trim($hook_name));
                            if ($real_path == $hook_name) {
                                $hook_status[$hook][$hook_name]['exists'] = false;
                            } else {
                                $hook_status[$hook][$hook_name]['exists'] = file_exists(parse_path(ltrim($real_path, '|')));
                            }
                            // I need to know if there is at least one function called in this file.
                            $temp_data['include'][basename($function)] = array('hook' => $hook, 'function' => $function);
                            unset($temp_hooks[$hook][$function_o]);
                        } elseif (empty($class) && strpos(str_replace(' (', '(', $fc), 'function ' . trim($function) . '(') !== false) {
                            $hook_status[$hook][$hook_name]['exists'] = true;
                            $hook_status[$hook][$hook_name]['in_file'] = $file['name'];
                            // I want to remember all the functions called within this file (to check later if they are
                            // enabled or disabled and decide if the integrate_*_include of that file can be disabled too)
                            $temp_data['function'][$file['name']][] = $function_o;
                            unset($temp_hooks[$hook][$function_o]);
                        } elseif (!empty($class) && preg_match('~class\\s*' . preg_quote(trim($class)) . '.*function\\s*' . preg_quote(trim($function), '~') . '\\s*\\(~i', $fc) != 0) {
                            $hook_status[$hook][$hook_name]['exists'] = true;
                            $hook_status[$hook][$hook_name]['in_file'] = $file['name'];
                            // I want to remember all the functions called within this file (to check later if they are
                            // enabled or disabled and decide if the integrate_*_include of that file can be disabled too)
                            $temp_data['function'][$file['name']][] = $function_o;
                            unset($temp_hooks[$hook][$function_o]);
                        }
                    }
                }
            }
        }
    }
    $sort_types = array('hook_name' => array('hook_name', SORT_ASC), 'hook_name DESC' => array('hook_name', SORT_DESC), 'function_name' => array('function_name', SORT_ASC), 'function_name DESC' => array('function_name', SORT_DESC), 'file_name' => array('file_name', SORT_ASC), 'file_name DESC' => array('file_name', SORT_DESC), 'status' => array('status', SORT_ASC), 'status DESC' => array('status', SORT_DESC));
    $sort_options = $sort_types[$sort];
    $sort = array();
    $hooks_filters = array();
    foreach ($hooks as $hook => $functions) {
        $hooks_filters[] = '<option ' . ($context['current_filter'] == $hook ? 'selected="selected" ' : '') . ' value="' . $hook . '">' . $hook . '</option>';
        foreach ($functions as $function) {
            $function = str_replace(']', '', $function);
            // This is a not an include and the function is included in a certain file (if not it doesn't exists so don't care)
            if (substr($hook, -8) !== '_include' && isset($hook_status[$hook][$function]['in_file'])) {
                $current_hook = isset($temp_data['include'][$hook_status[$hook][$function]['in_file']]) ? $temp_data['include'][$hook_status[$hook][$function]['in_file']] : '';
                $enabled = false;
                // Checking all the functions within this particular file
                // if any of them is enable then the file *must* be included and the integrate_*_include hook cannot be disabled
                foreach ($temp_data['function'][$hook_status[$hook][$function]['in_file']] as $func) {
                    $enabled = $enabled || strstr($func, ']') !== false;
                }
                if (!$enabled && !empty($current_hook)) {
                    $hook_status[$current_hook['hook']][$current_hook['function']]['enabled'] = true;
                }
            }
        }
    }
    addInlineJavascript('
			var hook_name_header = document.getElementById(\'header_list_integration_hooks_hook_name\');
			hook_name_header.innerHTML += ' . JavaScriptEscape('
				<select onchange="window.location = \'' . $scripturl . '?action=admin;area=maintain;sa=hooks\' + (this.value ? \';filter=\' + this.value : \'\');">
					<option>---</option>
					<option value="">' . $txt['hooks_reset_filter'] . '</option>' . implode('', $hooks_filters) . '</select>' . '
				</select>') . ';', true);
    $temp_data = array();
//.........这里部分代码省略.........
开发者ID:KeiroD,项目名称:Elkarte,代码行数:101,代码来源:AddonSettings.subs.php


示例12: stewie_exception_handler

/**
 * @param Exception $exception
 */
function stewie_exception_handler(Exception $exception)
{
    if (_DEBUG_MODE_) {
        echo "<div style='padding: 5px;border:2px solid black;background-color: #ff6e66;color: #FFFFFF;font-family: sans-serif;font-weight: bold;'>" . $exception->getMessage() . "</div>";
        foreach ($exception->getTrace() as $trace) {
            echo "<div style='padding: 5px;margin-top: 10px; background-color: #47B1F0;color: #000000;font-family:sans-serif'>";
            foreach ($trace as $key => $value) {
                if (!is_array($value)) {
                    echo $key . " : " . $value . "<br>";
                } else {
                    echo $key . " : <br><blockquote style='color:#FFFFFF'>";
                    foreach ($value as $v) {
                        echo "{$v}";
                    }
                    echo "</blockquote><br>";
                }
            }
            echo "</div>";
        }
        echo "<div style='padding: 5px;margin-top: 10px;border: 2px solid #ff4c4a; background-color: #fafafa;color: #1e1e1e;font-family:sans-serif'>";
        echo "<h2>REQUEST DETAILS</h2>";
        echo "<h3>\$_SERVER</h3>";
        clearPrint($_SERVER);
        echo "<h3>parse path</h3>";
        import("ParsePath");
        clearPrint(parse_path());
        echo "<h3>Session</h3>";
        clearPrint($_SESSION);
        echo "<h3>POST</h3>";
        clearPrint($_POST);
        echo "<h3>Cookies</h3>";
        clearPrint($_COOKIE);
        echo "</div>";
    } else {
        s_error_log($exception->getCode(), $exception->getMessage(), $exception->getFile(), $exception->getLine());
    }
}
开发者ID:sepehr-gh,项目名称:stewie,代码行数:40,代码来源:functions.php


示例13: stdClass

require_once __DIR__ . '/_includes/validate-app.php';
# Handling our global json parsing
$_JPOST = PostParser::decode();
# Initializing our return value
$content = new stdClass();
$content->success = true;
$content->env = PostParser::create_attribute($G_APP_ENVIRONMENT);
# Getting our source directory
$G_SRC_PATH_DATA = parse_path($_JPOST->src, $_ENDPOINT, $G_TOKEN_SESSION_DATA);
$query = "\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t" . NQ_DIRECTORY_TABLE . "\n\t\t\tWHERE\n\t\t\t\t`app_id`\t=" . (int) $G_APP_DATA['id'] . " AND\n\t\t\t\t`environment`\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "' AND\n\t\t\t\t`path`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_SRC_PATH_DATA->dir) . "' AND\n\t\t\t\t`name`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_SRC_PATH_DATA->name) . "'\n\t\t\tLIMIT 1";
$G_SRC_DIR_DATA = mysqli_single_result_query($G_STORAGE_CONTROLLER_DBLINK, $query);
!isset($G_SRC_DIR_DATA['id']) && exit_fail(NQ_ERROR_INVALID_VALUE, LANG_INVALID_SRC_DIR);
# If we aren't allowed in this directory
check_directory_blacklisted($G_CONTROLLER_DBLINK, $G_TOKEN_DATA['id'], $G_TOKEN_SESSION_DATA, $G_SRC_DIR_DATA['path'] . $G_SRC_DIR_DATA['name']);
# Getting our destination directory
$G_DEST_PATH_DATA = parse_path($_JPOST->dest, $_ENDPOINT, $G_TOKEN_SESSION_DATA);
$query = "\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t" . NQ_DIRECTORY_TABLE . "\n\t\t\tWHERE\n\t\t\t\t`app_id`\t=" . (int) $G_APP_DATA['id'] . " AND\n\t\t\t\t`environment`\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "' AND\n\t\t\t\t`path`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_DEST_PATH_DATA->dir) . "' AND\n\t\t\t\t`name`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_DEST_PATH_DATA->name) . "'\n\t\t\tLIMIT 1";
$G_DEST_DIR_DATA = mysqli_single_result_query($G_STORAGE_CONTROLLER_DBLINK, $query);
!isset($G_DEST_DIR_DATA['id']) && exit_fail(NQ_ERROR_INVALID_VALUE, LANG_INVALID_DEST_DIR);
# If we aren't allowed in this directory
check_directory_blacklisted($G_CONTROLLER_DBLINK, $G_TOKEN_DATA['id'], $G_TOKEN_SESSION_DATA, $G_DEST_DIR_DATA['path'] . $G_DEST_DIR_DATA['name']);
# If we are updating a directory
if (boolval_ext($_JPOST->is_dir)) {
    # Making sure we have our directory we are trying to move
    $dirname = str_replace(str_split(NQ_INVALID_PATH_CHARS), '', $_JPOST->name);
    $query = "\tSELECT\n\t\t\t\t\t*\n\t\t\t\tFROM\n\t\t\t\t\t" . NQ_DIRECTORY_TABLE . "\n\t\t\t\tWHERE\n\t\t\t\t\t`app_id`\t\t=" . (int) $G_APP_DATA['id'] . " AND\n\t\t\t\t\t`environment`\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $G_APP_ENVIRONMENT) . "' AND\n\t\t\t\t\t`parent_directory_id`\t=" . (int) $G_SRC_DIR_DATA['id'] . " AND\n\t\t\t\t\t`name`\t\t\t='" . mysqli_escape_string($G_STORAGE_CONTROLLER_DBLINK, $dirname) . "'\n\t\t\t\tLIMIT 1";
    $directory_data = mysqli_single_result_query($G_STORAGE_CONTROLLER_DBLINK, $query);
    !isset($directory_data['id']) && exit_fail(NQ_ERROR_INVALID_VALUE, LANG_INVALID_DIR);
    # If we aren't allowed in this directory
    check_directory_blacklisted($G_STORAGE_CONTROLLER_DBLINK, $G_TOKEN_DATA['id'], $G_TOKEN_SESSION_DATA, $directory_data['path'] . $directory_data['name']);
    # Checking to make sure we don't put the folder inside itself
开发者ID:nuQuery,项目名称:v1m0-api-image,代码行数:31,代码来源:move.php


示例14: splitFormat

 public function splitFormat(string $path) : array
 {
     $path = rtrim($path, KE_PATH_NOISE);
     $format = '';
     if ($path !== '') {
         $parse = parse_path($path);
         $path = '';
         if ($parse[0] !== '') {
             $path = $parse[0];
         }
         if ($parse[1] !== '') {
             $path .= ($path === '' ? '' : '/') . $parse[1];
         }
         if (isset($parse[2]) && $parse[2] !== '') {
             $format = $parse[2];
         }
     }
     return [$path, $format];
 }
开发者ID:janpoem,项目名称:kephp,代码行数:19,代码来源:Result.php


示例15: urldecode

      $path['query_utf8'] = urldecode($request_path[1]);
       $path['query'] = utf8_decode(urldecode($request_path[1]));
    $vars = explode('&', $path['query']);
    foreach ($vars as $var) {
      $t = explode('=', $var);
      $path['query_vars'][$t[0]] = $t[1];
    }
    }
   
   
  }
return $path;
}

//first url path
$path = parse_path();
$path_url = $path['call_parts'][1];

//second path
$path_act = (isset($path['call_parts'][2]))?$path['call_parts'][2]:'';
//third path
$path_id = (isset($path['call_parts'][3]))?$path['call_parts'][3]:'';


//simpan role url page user di array sesuai login session level
  $role_user=array();
  $role_act=array();
foreach ($db->fetch_custom("select sys_menu.url from sys_menu inner join sys_menu_role on sys_menu.id=sys_menu_role.id_menu
    where sys_menu_role.group_id=? and sys_menu_role.read_act=?",array('sys_menu_role.group_id'=>$_SESSION['level'],'sys_menu_role.read_act'=>'Y')) as $role) {
  $role_user[]=$role->url;
}
开发者ID:smilescripts,项目名称:consina_project,代码行数:31,代码来源:fungsi.php


示例16: __construct

 public function __construct()
 {
     $this->address = "/" . parse_path()["call_utf8"];
 }
开发者ID:sepehr-gh,项目名称:stewie,代码行数:4,代码来源:Router.php


示例17: parseBoardMod

function parseBoardMod($file, $testing = true, $undo = false, $theme_paths = array())
{
    global $boarddir, $sourcedir, $settings, $txt, $modSettings;
    @set_time_limit(600);
    $file = strtr($file, array("\r" => ''));
    $working_file = null;
    $working_search = null;
    $working_data = '';
    $replace_with = null;
    $actions = array();
    $everything_found = true;
    // This holds all the template changes in the standard mod file.
    $template_changes = array();
    // This is just the temporary file.
    $temp_file = $file;
    // This holds the actual changes on a step counter basis.
    $temp_changes = array();
    $counter = 0;
    $step_counter = 0;
    // Before we do *anything*, let's build a list of what we're editing, as it's going to be used for other theme edits.
    while (preg_match('~<(edit file|fil 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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