Пример #1
0
 function doStartTag()
 {
     parent::doStartTag();
     if (!$this->getAncestorByClassName('wallelementdocument')) {
         trigger_error("tag 'head' must be nested inside a 'document' tag", E_USER_ERROR);
     }
     if (defined('WALL_USE_TERA_WURFL') && WALL_USE_TERA_WURFL && TERA_WURFL_VERSION >= 2) {
         $this->uplink = TagUtil::isUpLink($this->_wall->wurfl->userAgent);
     } else {
         $this->uplink = TagUtil::isUpLink($this->_wall->wurfl->user_agent);
     }
     if (strpos($this->preferred_markup, 'xhtmlmp') !== false || strpos($this->preferred_markup, 'chtml') !== false) {
         if (strpos($this->preferred_markup, 'xhtmlmp') !== false) {
             $this->writeln('<html xmlns="http://www.w3.org/1999/xhtml">');
         } else {
             $this->writeln('<html>');
         }
         $this->write('<head>');
     } else {
         if (strpos($this->preferred_markup, 'wml') !== false) {
             $this->writeln('<wml>');
             $this->write('<head>');
         }
     }
 }
 function doEndTag()
 {
     parent::doEndTag();
     $this->href = TagUtil::normalizeHref($this->href, $this->preferred_markup);
     if (strpos($this->preferred_markup, 'xhtmlmp') !== false || strpos($this->preferred_markup, 'chtml') !== false) {
         $this->write('</h' . $this->level . '>');
     } else {
         if (strpos($this->preferred_markup, 'wml') !== false) {
             $this->write('</b></p>');
             # or should it be: $this->write('</b></p>'); ?
         }
     }
 }
Пример #3
0
 function doStartTag()
 {
     parent::doStartTag();
     if (defined('WALL_USE_TERA_WURFL') && WALL_USE_TERA_WURFL && TERA_WURFL_VERSION >= 2) {
         $this->uplink = TagUtil::isUpLink($this->_wall->wurfl->userAgent);
     } else {
         $this->uplink = TagUtil::isUpLink($this->_wall->wurfl->user_agent);
     }
     #header('X-test', $this->_wall->getCapa('xhtmlmp_preferred_mime_type'));
     if (strpos($this->preferred_markup, 'xhtmlmp') !== false) {
         if (!defined('WALL_SUPRESS_HEADERS') || !WALL_SUPRESS_HEADERS) {
             $hdr = $this->_wall->getCapa('xhtmlmp_preferred_mime_type');
             $chr = $this->_wall->getCapa('xhtml_preferred_charset');
             #                error_log($chr);
             if ($chr && $chr != 'utf8') {
                 $chr = false;
             }
             if (!$hdr) {
                 $hdr = 'text/html';
             }
             #		error_log($this->_wall->ua . ' gets Content-Type: ' . $hdr . ($chr ? '; charset=' . $chr : ''));
             #header('Content-Type: ' . $hdr . ($chr ? '; charset=' . $chr : ''));
             header('Content-Type: ' . $hdr);
         }
         $this->_wall->use_xhtml_extensions = !$this->disable_xhtml_extensions && $this->uplink && $this->_wall->getCapa('opwv_xhtml_extensions_support');
     } else {
         if (strpos($this->preferred_markup, 'wml') !== false) {
             if (!defined('WALL_SUPRESS_HEADERS') || !WALL_SUPRESS_HEADERS) {
                 error_log($this->_wall->ua . ' gets Content-Type: text/vnd.wap.wml; charset=utf-8');
                 header('Content-Type: text/vnd.wap.wml; charset=utf-8');
             }
             $this->_wall->use_wml_extensions = !$this->disable_wml_extensions && $this->uplink && $this->_wall->getCapa('opwv_wml_extensions_support');
         } else {
             if (strpos($this->preferred_markup, 'chtml') !== false) {
                 if (!defined('WALL_SUPRESS_HEADERS') || !WALL_SUPRESS_HEADERS) {
                     error_log($this->_wall->ua . ' gets Content-Type: text/html; charset=utf-8');
                     header('Content-Type: text/html; charset=utf-8');
                 }
             } else {
                 trigger_error('No valid markup found: ' . $this->preferred_markup, E_USER_ERROR);
             }
         }
     }
 }
Пример #4
0
 function WallElement(&$wall, $attributes = array())
 {
     $this->_wall =& $wall;
     $this->preferred_markup = TagUtil::getWallMarkUp($this->_wall->getCapa('preferred_markup'));
     foreach ($attributes as $name => $value) {
         if (isset($this->{$name})) {
             if (strtolower($value) == 'false') {
                 $value = false;
             } else {
                 if (strtolower($value) == 'true') {
                     $value = true;
                     #                } else if (is_numeric($value)) {
                     #                    $value = (int)$value;
                 }
             }
             $this->{$name} = $value;
         }
     }
 }
Пример #5
0
                    $scores[$ltag] += $point;
                } else {
                    $scores[$ltag] = $point;
                }
            }
        }
        foreach ($tags as $tag) {
            unset($scores[$tag]);
        }
        $sorter = array();
        foreach ($scores as $name => $score) {
            $sorter[] = array("name" => $name, "score" => $score);
        }
        uasort($sorter, function ($a, $b) {
            if ($a["score"] > $b["score"]) {
                return -1;
            }
            if ($a["score"] < $b["score"]) {
                return 1;
            }
            return 0;
        });
        $res = array();
        foreach ($sorter as $e) {
            $res[] = $e["name"];
        }
        return $res;
    }
}
TagUtil::$comFile = new SFile(new NativeFS("./"), "scoreSheet/score/tags/cmt.txt");
Пример #6
0
require_once __DIR__."/../ErrorHandler.php";


$scoreDir=new SFile(new NativeFS("./"),"/scoreSheet/score/");*/
require_once __DIR__ . "/TagUtil.php";
require_once __DIR__ . "/../json.php";
if (isset($_GET["cmd"]) && $_GET["cmd"] == "tags") {
    echo json_encode(TagUtil::tagList($_GET["cmt"]));
    exit;
}
$cmd = $_POST["cmd"];
$digest = $_POST["digest"];
$f = ScoreUtil::scoreFile($digest);
if ($cmd == "write") {
    $data = $_POST["data"];
    $f->text($data);
    $o = json_decode($data);
    TagUtil::add($o->com);
} else {
    header("Content-type", "text/json;charset=utf8");
    if ($f->exists()) {
        echo $f->text();
    } else {
        echo "{}";
    }
}
/*function scoreFile($digest) {
    global $scoreDir;
    $m=md5($digest);
    return $scoreDir->rel($m);
}*/
Пример #7
0
 function doStartTag()
 {
     parent::doStartTag();
     $this->href = TagUtil::normalizeHref($this->href, $this->preferred_markup);
     if ($this->menu) {
         // INSIDE A MENU
         $counter = ++$this->menu->counter;
         if (strpos($this->preferred_markup, 'xhtmlmp') !== false) {
             $this->fancy_ok = $this->menu->colorize && $this->_wall->menu_css_tag && $this->menu->table_and_css_background;
             if ($this->fancy_ok) {
                 $this->write('<tr>');
                 $this->write('<td class="bgcolor' . (($counter + 1) % 2 + 1) . '">');
                 if ($this->menu->autonumber) {
                     $this->write(' ' . $counter);
                     if ($this->opvw_icon) {
                         $this->write(' <img localsrc="' . $this->opvw_icon . '" src="" alt=""/>');
                     }
                     $this->write(' <a accesskey="' . $counter . '"');
                 } else {
                     if ($this->accesskey) {
                         $this->write(' ' . $this->accesskey . ' <a accesskey="' . $this->accesskey . '"');
                     } else {
                         $this->write('<a');
                     }
                 }
                 $this->write(' href="' . $this->href . '"');
                 if ($this->title) {
                     $this->write(' title="' . $this->title . '"');
                 }
                 if ($this->xhtmlClass) {
                     $this->write(' class="' . $this->xhtmlClass . '"');
                 }
                 if ($this->xhtmlId) {
                     $this->write(' id="' . $this->xhtmlId . '"');
                 }
                 $this->write('>');
             } else {
                 $this->write('<li>');
                 if ($this->opvw_icon && $this->_wall->use_xhtml_extensions) {
                     $this->write('<img localsrc="' . $this->opvw_icon . '" src="" alt=""/> ');
                 }
                 if ($this->menu->autonumber) {
                     $this->write('<a accesskey="' . $counter . '"');
                 } else {
                     if ($this->accesskey) {
                         $this->write('<a accesskey="' . $this->accesskey . '"');
                     } else {
                         $this->write('<a');
                     }
                 }
                 $this->write(' href="' . $this->href . '"');
                 if ($this->title) {
                     $this->write(' title="' . $this->title . '"');
                 }
                 if ($this->xhtmlClass) {
                     $this->write(' class="' . $this->xhtmlClass . '"');
                 }
                 if ($this->xhtmlId) {
                     $this->write(' id="' . $this->xhtmlId . '"');
                 }
                 $this->write('>');
             }
         } else {
             if (strpos($this->preferred_markup, 'chtml') !== false) {
                 if ($this->menu->autonumber) {
                     $emoji = TagUtil::getEmoji($counter, $this->region);
                     $this->write($emoji . '&nbsp;<a accesskey="' . $counter . '"');
                 } else {
                     if ($this->accesskey) {
                         $emoji = TagUtil::getEmoji($this->accesskey, $this->region);
                         $this->write($emoji . '&nbsp;<a accesskey="' . $this->accesskey . '"');
                     } else {
                         $this->write('<a');
                     }
                 }
                 $this->write(' href="' . $this->href . '"');
                 $this->write('>');
             } else {
                 if (strpos($this->preferred_markup, 'wml') !== false) {
                     if ($this->wml_menu_with_select) {
                         $this->write('<option onpick="' . $this->href . '"');
                         if ($this->title) {
                             $this->write(' title="' . $this->title . '"');
                         }
                         $this->write('>');
                         if ($this->opvw_icon && $this->_wall->use_wml_extensions) {
                             $this->write('<img localsrc="' . $this->opvw_icon . '" src="" alt=""/>');
                         }
                     } else {
                         //accesskey for WML is tricky: extra check accesskey support by WML browser
                         //SECOND THOUGHT: I get problems with GATEWAY. removing accesskey
                         //                for WML for the time being
                         $this->write('<a href="' . $this->href . '"');
                         if ($this->title) {
                             $this->write(' title="' . $this->title . '"');
                         }
                         $this->write('>');
                     }
                 }
             }
         }
     } else {
         // NOT INSIDE A MENU
         if (strpos($this->preferred_markup, 'xhtmlmp') !== false) {
             if ($this->accesskey) {
                 $this->write('<a accesskey="' . $this->accesskey . '"');
             } else {
                 $this->write('<a');
             }
             $this->write(' href="' . $this->href . '"');
             if ($this->title) {
                 $this->write(' title="' . $this->title . '"');
             }
             $this->write('>');
         } else {
             if (strpos($this->preferred_markup, 'chtml') !== false) {
                 if ($this->accesskey) {
                     $this->write('<a accesskey="' . $this->accesskey . '"');
                 } else {
                     $this->write('<a');
                 }
                 $this->write(' href="' . $this->href . '"');
                 $this->write('>');
             } else {
                 if (strpos($this->preferred_markup, 'wml') !== false) {
                     $this->write('<a');
                     $this->write(' href="' . $this->href . '"');
                     if ($this->title) {
                         $this->write(' title="' . $this->title . '"');
                     }
                     $this->write('>');
                 }
             }
         }
     }
 }