ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilWebDAVMountInstructionsDocumentProcessorBase Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilWebDAVMountInstructionsDocumentProcessorBase:
+ Collaboration diagram for ilWebDAVMountInstructionsDocumentProcessorBase:

Public Member Functions

 parseInstructionsToAssocArray (string $a_raw_mount_instructions)
 
- Public Member Functions inherited from ilWebDAVMountInstructionsDocumentProcessor
 processMountInstructions (string $a_raw_mount_instructions)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 21 of file class.ilWebDAVMounInstructionsDocumentProcessorBase.php.

Member Function Documentation

◆ parseInstructionsToAssocArray()

ilWebDAVMountInstructionsDocumentProcessorBase::parseInstructionsToAssocArray ( string  $a_raw_mount_instructions)

Definition at line 23 of file class.ilWebDAVMounInstructionsDocumentProcessorBase.php.

Referenced by ilWebDAVMountInstructionsTextDocumentProcessor\processMountInstructions(), and ilWebDAVMountInstructionsHtmlDocumentProcessor\processMountInstructions().

23  : array
24  {
25  $processing_text = $a_raw_mount_instructions;
26 
27  $found_instructions = array();
28 
29  do {
30  $pair_found = false;
31  $open_with_no_close_tag_found = false;
32 
33  $open_tag_start_pos = strpos($processing_text, '[');
34  $open_tag_end_pos = strpos($processing_text, ']');
35 
36  if ($open_tag_start_pos !== false && $open_tag_end_pos !== false && $open_tag_start_pos < $open_tag_end_pos) {
37  $tag_name = substr($processing_text, $open_tag_start_pos + 1, $open_tag_end_pos - $open_tag_start_pos - 1);
38  $close_tag = "[/$tag_name]";
39 
40  $close_tag_pos = strpos($processing_text, $close_tag);
41 
42  if ($close_tag_pos !== false && $open_tag_end_pos < $close_tag_pos) {
43  $found_instructions[$tag_name] = substr($processing_text, $open_tag_end_pos + 1, $close_tag_pos - $open_tag_end_pos - 1);
44 
45  $processing_text = substr($processing_text, $close_tag_pos + strlen($close_tag));
46  $pair_found = true;
47  } else {
48  $processing_text = substr($processing_text, $open_tag_end_pos + 1);
49  $open_with_no_close_tag_found = true;
50  }
51  }
52  } while ($pair_found || $open_with_no_close_tag_found);
53 
54  if (count($found_instructions) === 0) {
55  $found_instructions = [ $a_raw_mount_instructions ];
56  }
57 
58  return $found_instructions;
59  }
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: