@@ 351-381 (lines=31) @@ | ||
348 | return $result; |
|
349 | } |
|
350 | ||
351 | public static function getReferences($html) { |
|
352 | $context = pobject::getContext(); |
|
353 | $me = $context["arCurrentObject"]; |
|
354 | // Find out all references to other objects |
|
355 | // (images, links) in this object, so we can |
|
356 | // warn the user if he tries to delete/rename |
|
357 | // an object which is still referenced somewhere |
|
358 | // Use Perl compatible regex for non-greedy matching |
|
359 | preg_match_all("/['\"](\{(arSite|arRoot|arBase|arCurrentPage)(\/[a-z][a-z])?}.*?)['\"]/", $html, $matches); |
|
360 | $refs = preg_replace( |
|
361 | array( |
|
362 | "|{arSite(/[a-z][a-z])?}|", |
|
363 | "|{arRoot(/[a-z][a-z])?}|", |
|
364 | "|{arBase(/[a-z][a-z])?}|", |
|
365 | "|{arCurrentPage(/[a-z][a-z])?}|" ), |
|
366 | array( |
|
367 | $me->currentsite(), |
|
368 | "", |
|
369 | "", |
|
370 | $me->path), |
|
371 | $matches[1]); |
|
372 | $result = array(); |
|
373 | foreach ($refs as $ref) { |
|
374 | if (substr($ref, -1) != '/' && !$me->exists($ref)) { |
|
375 | // Drop the template name |
|
376 | $ref = substr($ref, 0, strrpos($ref, "/")+1); |
|
377 | } |
|
378 | $result[] = $ref; |
|
379 | } |
|
380 | return $result; |
|
381 | } |
|
382 | ||
383 | public static function stripARNameSpace($html) { |
|
384 | $context = pobject::getContext(); |
@@ 215-246 (lines=32) @@ | ||
212 | return $result; |
|
213 | } |
|
214 | ||
215 | public static function getReferences($page) { |
|
216 | $context = pobject::getContext(); |
|
217 | $me = $context["arCurrentObject"]; |
|
218 | // Find out all references to other objects |
|
219 | // (images, links) in this object, so we can |
|
220 | // warn the user if he tries to delete/rename |
|
221 | // an object which is still referenced somewhere |
|
222 | // Use Perl compatible regex for non-greedy matching |
|
223 | preg_match_all("/['\"](\{(arSite|arRoot|arBase|arCurrentPage)(\/[a-z][a-z])?}.*?)['\"]/", $page, $matches); |
|
224 | $refs = preg_replace( |
|
225 | array( |
|
226 | "|{arSite(/[a-z][a-z])?}|", |
|
227 | "|{arRoot(/[a-z][a-z])?}|", |
|
228 | "|{arBase(/[a-z][a-z])?}|", |
|
229 | "|{arCurrentPage(/[a-z][a-z])?}|" ), |
|
230 | array( |
|
231 | $me->currentsite(), |
|
232 | "", |
|
233 | "", |
|
234 | $me->path), |
|
235 | $matches[1]); |
|
236 | ||
237 | $result = array(); |
|
238 | foreach ($refs as $ref) { |
|
239 | if (substr($ref, -1) != '/' && !$me->exists($ref)) { |
|
240 | // Drop the template name |
|
241 | $ref = substr($ref, 0, strrpos($ref, "/")+1); |
|
242 | } |
|
243 | $result[] = $ref; |
|
244 | } |
|
245 | return $result; |
|
246 | } |
|
247 | ||
248 | public static function stripARNameSpace($page) { |
|
249 | $context = pobject::getContext(); |