コード例 #1
0
 public function GetOutput()
 {
     $yams = YAMS::GetInstance();
     $YEM = YamsErrorMgr::GetInstance();
     $YLM = YamsLangMgr::GetInstance();
     // Load the module template
     $tpl = new Templator();
     $success = $tpl->LoadTemplateFromFile('yams/module/yams.module.tpl.html');
     if (!$success) {
         return;
     }
     if (YamsUtils::IsHTTPS()) {
         $protocol = 'https://';
     } else {
         $protocol = 'http://';
     }
     $requestURL = YamsUtils::Escape($protocol . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
     // Define the placholders
     $tpl->RegisterPlaceholder('form_action', '[+request_url+]');
     $tpl->RegisterPlaceholder('error_messages', $YEM->GetOutput());
     $tpl->RegisterPlaceholder('lang_chooser', $YLM->GetOutput());
     // Parse non-language placeholders
     $tpl->Parse(NULL, true);
     $tpl->ClearStoredPlaceholders();
     // Register global placeholders...
     $tpl->RegisterPlaceholder('request_url', $requestURL);
     $tpl->RegisterPlaceholder('modx_manager_theme', $modx->config['manager_theme']);
     $tpl->RegisterPlaceholder('modx_site_url', $modx->config['site_url']);
     $tpl->RegisterPlaceholder('modx_charset', $modx->config['modx_charset']);
     $tpl->RegisterPlaceholder('yams_contact_en_url', 'http://nashi.podzone.org/en/contact.xhtml');
     $tpl->RegisterPlaceholder('yams_contact_fr_url', 'http://nashi.podzone.org/fr/contact.xhtml');
     $tpl->RegisterPlaceholder('yams_contact_ja_url', 'http://nashi.podzone.org/ja/contact.xhtml');
     $tpl->RegisterPlaceholder('yams_donate_en_url', 'http://nashi.podzone.org/en/donate.xhtml');
     $tpl->RegisterPlaceholder('yams_donate_fr_url', 'http://nashi.podzone.org/fr/donate.xhtml');
     $tpl->RegisterPlaceholder('yams_donate_ja_url', 'http://nashi.podzone.org/ja/donate.xhtml');
     $tpl->RegisterPlaceholder('yams_package_url', 'http://modxcms.com/extras/package/?package=543');
     $tpl->RegisterPlaceholder('yams_forums_url', 'http://modxcms.com/forums/index.php/board,381.0.html');
     $tpl->RegisterPlaceholder('yams_author_url', 'http://modxcms.com/forums/index.php?action=profile;u=12570');
     $tpl->RegisterPlaceholder('yams_author', '<a href="[+yams_author_url+]" target="_blank">PMS</a>');
     $tpl->RegisterPlaceholder('yams_copyright', '<a href="http://nashi.podzone.org/" target="_blank">Nashi Power</a> 2009');
     $tpl->RegisterPlaceholder('yams_licence', 'GPL v3');
     $tpl->RegisterPlaceholder('yams_version', YamsUtils::Escape($yams->GetVersion()));
     // Parse language text...
     $YLM->ParseLanguageText($tpl);
     // Temporarily comment out this line so it's easy to find missing placeholders...
     // $tpl->RemovePlaceholdersFromTpl( NULL, true );
     return $tpl->GetTpl();
 }
コード例 #2
0
 public function GetOutput()
 {
     $yams = YAMS::GetInstance();
     $errorList = '';
     if (count($this->itsErrorMessages) > 0) {
         $errorList .= '<ul>';
         foreach ($this->itsErrorMessages as $msg) {
             $errorList .= '<li>' . YamsUtils::Escape($msg) . '</li>';
         }
         $errorList .= '</ul>';
     }
     $tpl = new Templator();
     $tpl->LoadTemplateFromFile('yams/module/yams.error.tpl.html');
     $tpl->RegisterPlaceholder('error_list', $errorList);
     return $tpl->Parse();
 }
コード例 #3
0
 public function GetOutput()
 {
     $yams = YAMS::GetInstance();
     $langChooserOptions = '';
     foreach ($this->itsAvailableLangs as $lang) {
         if ($lang == $this->itsCurrentLang) {
             $selected = 'selected="selected"';
         } else {
             $selected = '';
         }
         $langDetails = $this->GetLangDetails($lang);
         $cleanName = YamsUtils::Clean($langDetails['name']);
         $langDir = YamsUtils::Clean($langDetails['dir']);
         $langChooserOptions .= '<option ' . $selected . ' value="' . $lang . '" dir="' . $langDir . '">' . $cleanName . '</option>';
     }
     $tpl = new Templator();
     $tpl->LoadTemplateFromFile('yams/module/yams.lang.chooser.tpl.html');
     $tpl->RegisterPlaceholder('lang_chooser_options', $langChooserOptions);
     $tpl->RegisterPlaceholder('lang_post_param', YamsUtils::Escape($this->itsGetLangPostParam));
     return $tpl->Parse();
 }
コード例 #4
0
 public function SetAcceptMODxURLDocIdsString($acceptMODxURLDocIdsString, $save = TRUE)
 {
     if (!is_string($acceptMODxURLDocIdsString)) {
         return FALSE;
     }
     $newAcceptMODxURLDocIds = preg_split('/\\s*,\\s*/x' . YamsUtils::UTF8Modifier(), $acceptMODxURLDocIdsString, -1, PREG_SPLIT_NO_EMPTY);
     if ($newAcceptMODxURLDocIds === FALSE) {
         return FALSE;
     }
     foreach ($newAcceptMODxURLDocIds as $id => $docId) {
         if ($docId == '*') {
             continue;
         }
         if (YamsUtils::IsValidId($docId)) {
             continue;
         }
         unset($newAcceptMODxURLDocIds[$id]);
     }
     $this->itsAcceptMODxURLDocIds = array_unique($newAcceptMODxURLDocIds);
     if ($save) {
         return $this->SaveCurrentSettings();
     }
     return TRUE;
 }
コード例 #5
0
 protected function Initialise()
 {
     global $modx;
     // This is close to the maximum size allowed in the content field
     ini_set('pcre.backtrack_limit', '16000000');
     $this->itsOutputQuerySeparator = ini_get('arg_separator.output');
     if (is_null($this->itsOutputQuerySeparator)) {
         $this->itsOutputQuerySeparator = '&amp;';
     }
     $this->itsInputQuerySeparator = ini_get('arg_separator.input');
     if (is_null($this->itsInputQuerySeparator)) {
         $this->itsInputQuerySeparator = '&';
     }
     $this->itsMODx =& $modx;
     parent::Initialise();
     //      @include( dirname( __FILE__ ) . '/../yams.config.inc.php');
     //
     //      // Check if UTF-8 is being used
     //      // (Assume the encoding of the web page output
     //      // is the same as the encoding of the manager)
     //      YamsUtils::$itsUTF8Modifier == $this->itsEncodingModifierMode;
     $this->itsUTF8Modifier = YamsUtils::UTF8Modifier();
     //      switch ( $this->itsEncodingModifierMode )
     //      {
     //      case '':
     //      case 'u':
     //        $this->itsEncodingModifier = $this->itsEncodingModiferMode;
     //        break;
     //      default:
     //        $this->itsEncodingModifier = '';
     //        if ( $this->itsMODx->config['modx_charset'] == 'UTF-8')
     //        {
     //          $this->itsEncodingModifier = 'u';
     //        }
     //      }
     $this->UpdateLanguageDependentServerNamesMode();
     $this->UpdateLanguageDependentRootNamesMode();
     $this->UpdateLanguageQueryParamMode();
     $this->UpdateUniqueMultilingualAliasMode();
     $this->UpdateMonolingualDocIds();
     $this->CacheDocumentAliasInfo();
     // Set the current language
     $this->itsCurrentLangId = $this->DetermineCurrentLangId();
     // $this->itsCurrentLangId = $this->itsDefaultLangId;
 }
コード例 #6
0
         // Determine the docId and langId from the alias...
         // The currentLangId is set if a valid document is found.
         $aliasDecoded = YamsUtils::UrlDecode($_GET['q']);
         $docId = $yams->GetDocumentIdentifierUnique($aliasDecoded, $langId);
     } else {
         // Determine the langId from the server and root name
         $langId = $yams->DetermineCurrentLangId();
         // Determine the docId from the alias, given the language
         $docId = $yams->GetDocumentIdentifier($_GET['q'], $langId);
     }
 }
 if (is_null($docId)) {
     // If no docId was found...
     // but a standard MODx url matches... then use that.
     // This is for compatibility with standard MODx resources
     if (YamsUtils::IsValidId($modx->documentIdentifier)) {
         $docIdFoundByYAMS = FALSE;
         $docId = $modx->documentIdentifier;
         // However, in that case, the langauge will not have been
         // determined, so in the absense of other information...
         if (is_null($langId)) {
             if ($yams->IsMultilingualDocument($docId)) {
                 // Keep to the current language...
                 $langId = $yams->GetCurrentLangId();
             } else {
                 // Use the default.
                 $langId = $yams->GetDefaultLangId();
             }
         }
     }
 }
コード例 #7
0
 function YamsRemoveAssociationsForTV($tvId, $templateIds)
 {
     global $modx;
     $yams = YAMS::GetInstance();
     if (!is_array($templateIds)) {
         return FALSE;
     }
     if (count($templateIds) == 0) {
         return TRUE;
     }
     foreach ($templateIds as &$templateId) {
         if (!YamsUtils::IsValidId($templateId)) {
             return FALSE;
         }
         $templateId = $modx->db->escape($templateId);
     }
     $templateIdList = implode(',', $templateIds);
     $tblName = $modx->getFullTableName('site_tmplvar_templates');
     $result = $modx->db->delete($tblName, 'tmplvarid=' . $modx->db->escape($tvId) . ' AND ' . 'templateid IN (' . $templateIdList . ')');
     return $result;
 }
コード例 #8
0
?>
"><a href="http://svn.modxcms.com/docs/display/ADDON/YAMS+Configuration#YAMSConfiguration-ChangeLanguageParam" target="_blank">Change Language Param</a></th>
                  </tr>
<?php 
YamsAlternateRow($rowClass);
?>
                  <tr>
                    <td class="<?php 
echo $rowClass;
?>
">
                      <?php 
$MODxSubdirectory = $yams->GetMODxSubdirectory(FALSE, FALSE, FALSE);
?>
                      <input name="yams_modx_subdirectory" type="text" value="<?php 
echo YamsUtils::Escape($MODxSubdirectory);
?>
"></input>
                    </td>
                    <th class="<?php 
echo $rowClass;
?>
"><a href="http://svn.modxcms.com/docs/display/ADDON/YAMS+Configuration#YAMSConfiguration-MODxSubdirectory" target="_blank">MODx Subdirectory</a></th>
                  </tr>
<?php 
YamsAlternateRow($rowClass);
?>
                  <tr>
                    <td class="<?php 
echo $rowClass;
?>