Пример #1
0
 function _getEditMode()
 {
     return edit::getEditMode();
 }
Пример #2
0
 public static function ARtoRAW($page)
 {
     global $ARCurrent, $AR;
     $context = pobject::getContext();
     $me = $context["arCurrentObject"];
     $find = array();
     $repl = array();
     if ($ARCurrent->session && $ARCurrent->session->id) {
         $session = '/-' . $ARCurrent->session->id . '-';
     } else {
         $session = '';
     }
     $site = $me->currentsite($me->path, true);
     $root = $me->store->get_config("root");
     if (substr($root, -3) == "/{$me->nls}") {
         $root = substr($root, 0, -3);
     }
     if ($site && $site !== '/') {
         $page = preg_replace_callback("%\\{(?:arSite)(?:/([^}]+))?\\}\\Q\\E%", function ($matches) use($me, $site) {
             return $me->make_url($site, $matches[1]);
         }, $page);
         $page = preg_replace_callback("%\\{(?:arRoot|arBase)(?:/([^}]+))?\\}\\Q" . $site . "\\E%", function ($matches) use($me, $site) {
             return $me->make_url($site, $matches[1]);
         }, $page);
     }
     $find[] = "%\\{arBase(/(?:[^}]+))?\\}%";
     $repl[] = $AR->host . $root . "\\1";
     $find[] = "%\\{arRoot(/(?:[^}]+))?\\}%";
     $repl[] = $AR->host . $me->store->get_config("root") . "\\1";
     $page = preg_replace_callback("%\\{arCurrentPage(?:/([^}]+))?\\}%", function ($matches) use($me) {
         return $me->make_local_url('', $matches[1]);
     }, $page);
     $find[] = "%\\{arSession\\}%";
     $repl[] = $session;
     if (class_exists('edit', false) && edit::getEditMode()) {
         $find[] = "%ar:editable=([^ ]+)%";
         $repl[] = "contentEditable=\\1";
     }
     $page = preg_replace($find, $repl, $page);
     // FIXME: Maybe do not process arCall when ESI is enabled?
     $page = URL::processArCall($page, $full);
     return $page;
 }