Exemple #1
0
    def _search(self, filename):
        """
        Search file in include_path, working dir and calling script path.

        For detail logic description visit
            http://www.php.net/manual/en/function.include.php
        """
        # First we detect if path is defined or not. It determines by which way
        # we will resolve file inclusion
        if not filename.strip(' '):
            raise FileNotFound(filename)

        (directory, dummy_filename) = split_path(filename)
        if not directory or directory[0] not in ['.', '/']:
            self._switch_error_strategy()
            return self._search_in_possible_directories(filename)
        elif os.path.isfile(filename):
            return filename

        raise FileNotFound(filename)
Exemple #2
0
 def __init__(self, filename):
     self.functions = shared_context.functions.copy()
     self.include_cache = {}
     self.config = config.copy()
     self.trace = Trace(filename)
     self.calling_script_path, self.calling_script = split_path(filename)