ILIAS  trunk Revision v11.0_alpha-1846-g895b5f47236
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilWebDAVMountInstructionsDocumentProcessorBase Class Reference
+ 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

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 = [];
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(
38  $processing_text,
39  $open_tag_start_pos + 1,
40  $open_tag_end_pos - $open_tag_start_pos - 1
41  );
42  $close_tag = "[/$tag_name]";
43 
44  $close_tag_pos = strpos($processing_text, $close_tag);
45 
46  if ($close_tag_pos !== false && $open_tag_end_pos < $close_tag_pos) {
47  $found_instructions[$tag_name] = substr(
48  $processing_text,
49  $open_tag_end_pos + 1,
50  $close_tag_pos - $open_tag_end_pos - 1
51  );
52 
53  $processing_text = substr($processing_text, $close_tag_pos + strlen($close_tag));
54  $pair_found = true;
55  } else {
56  $processing_text = substr($processing_text, $open_tag_end_pos + 1);
57  $open_with_no_close_tag_found = true;
58  }
59  }
60  } while ($pair_found || $open_with_no_close_tag_found);
61 
62  if ($found_instructions === []) {
63  return [$a_raw_mount_instructions];
64  }
65 
66  return $found_instructions;
67  }
+ Here is the caller graph for this function:

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