Elgg  Version 1.9
ViewFilter.php
Go to the documentation of this file.
1 <?php
2 
22  private function getAmdName($name) {
23  $pieces = explode("/", $name); // [js, elgg, module.js]
24  if (count($pieces) <= 1 || $pieces[0] != 'js') {
25  return '';
26  }
27 
28  array_shift($pieces); // [elgg, module.js]
29  $basename = basename(array_pop($pieces), ".js"); // module
30  array_push($pieces, $basename); // [elgg, module]
31 
32  return implode("/", $pieces); // elgg/module
33  }
34 
43  public function filter($viewName, $content) {
44  $amdName = $this->getAmdName($viewName);
45 
46  if (!empty($amdName)) {
47  $content = preg_replace('/^define\(([^\'"])/m', "define(\"$amdName\", \$1", $content, 1);
48  }
49 
50  return $content;
51  }
52 }
if($guid==elgg_get_logged_in_user_guid()) $name
Definition: delete.php:21
filter($viewName, $content)
Inserts the AMD name into $content and returns the new value.
Definition: ViewFilter.php:43
$content
Set robots.txt action.
Definition: set_robots.php:6