function preserveUrl($docid = '', $alias = '', $array_values = array(), $suffix = false) { global $modx; $yams = YAMS::GetInstance(); $array_get = $_GET; $urlstring = array(); unset($array_get["id"]); unset($array_get["q"]); // YAMS START unset($array_get[$yams->GetLangQueryParam()]); // YAMS END $array_url = array_merge($array_get, $array_values); foreach ($array_url as $name => $value) { if (!is_null($value)) { $urlstring[] = $name . '=' . urlencode($value); } } $url = join('&', $urlstring); // YAMS START if ($url != '') { $url = '?' . $url; } // YAMS END if ($suffix) { if (empty($url)) { $url = "?"; } else { $url .= "&"; } } // YAMS START // return $modx->makeUrl($docid, $alias, $url); return '(yams_doc:' . $docid . ')' . $url; // YAMS END }
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(); }
function asParseYAMS($results) { global $modx; $yams = YAMS::GetInstance(); $docId = $modx->documentObject['id']; $isMultilingualDocument = $yams->IsMultilingualDocument($docId); $yams->InitialiseParser($isMultilingualDocument); do { $finished = $yams->PreParse($results, $docId, $template, $isMultilingualDocument); } while (!$finished); $success = $yams->PostParse($isMultilingualDocument, $results, NULL, FALSE); if (!$success) { return ''; } return $results; }
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(); }
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(); }
/** * ManagerManager rules for formatting the document interface so as to display * different languages on different tabs * * @author PMS (http://modxcms.com/forums/index.php?action=profile;u=12570) * @copyright Nashi Power (http://nashi.podzone.org/) 2009 * @license GPL v3 * @package YAMS (http://modxcms.com/extras/package/?package=543) * @see Forum (http://modxcms.com/forums/index.php/board,381.0.html) * */ global $mm_version; require_once dirname(__FILE__) . '/class/yams.class.inc.php'; require_once dirname(__FILE__) . '/yams.module.funcs.inc.php'; $yams = YAMS::GetInstance(); $activeTemplateList = $yams->GetActiveTemplatesList(); $hideFields = $yams->GetHideFields(); $useMultilingualAliases = $yams->GetUseMultilingualAliases(); $encodingModifier = $yams->GetEncodingModifier(); $langIds = array_merge($yams->GetActiveLangIds(), $yams->GetInactiveLangIds()); //// yamsRoles is an array mapping which applies roles to each language //if ( ! is_array( $yamsLanguageRoleMap ) ) //{ // $yamsLanguageRoleMap = array(); //} // if ($activeTemplateList != '') { mm_renameField('pagetitle', 'Internal Name', '', $activeTemplateList, 'This field is used to identify the document (and its language variants) within the document tree of the MODx Manager. It will not appear anywhere on the document itself.'); if ($hideFields) { // Don't hide the pagetitle because it is used within the modx document tree
function yamsChooseLangContent($resource) { global $ditto_object; $yams = YAMS::GetInstance(); if (!$yams->IsMultilingualDocument($resource['id'])) { return $resource['content']; } $output = $yams->MultiLangExpand('data', 'content', $resource['id']); return $output; }
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; }