コード例 #1
0
ファイル: Form.php プロジェクト: jbzdak/wikidot
 /**
  * When uploading files - this determines the max size (in bytes) allowed to 
  * download. Specified in the -form.xml file in the validation rule chain.
  */
 public function getUploadMaxSize($name)
 {
     $fields = FormXMLStorage::getFormFields($this->name);
     $rules = $fields["{$name}"]->validation[0]->rule;
     $mrule = findNodeWithAttribute($rules, 'name', 'upload_maxsize');
     if ($mrule == null) {
         return null;
     }
     return $mrule['value'];
 }
コード例 #2
0
ファイル: functions.php プロジェクト: jbzdak/wikidot
/**
 * Useful function to extract text value from the xml structure for the $node 
 * using requested $lang. If $lang is null then values: Ozone::runData->getLanguage(), 
 * GlobalProperties::$DEFAULT_LANGUAGE are used in that order. If again it does not work
 * the first <text> child node returned.
 * @param SimpleXMLElement $node
 * @return string
 */
function xml_localized_text($node, $lang = null)
{
    if ($node == null) {
        return null;
    }
    $runData = Ozone::$runData;
    if ($lang == null) {
        $lang = $runData->getLanguage();
    }
    $text = findNodeWithAttribute($node->text, "lang", "{$lang}");
    if ($text == null) {
        $text = findNodeWithAttribute($node->text, "lang", GlobalProperties::$DEFAULT_LANGUAGE);
    }
    if ($text == null) {
        $text = $node->text[0];
    }
    return "{$text}";
}