function process() { if (!$this->_application->isAdmin()) { $this->_content = array(); $this->_content['label'] = $this->getAttribute('label'); $this->_content['buttonLabel'] = $this->getAttribute('buttonLabel'); $this->_content['comment'] = $this->getAttribute('comment'); $this->_content['comment1'] = org_glizy_locale_Locale::get('GLZ_SEARCH_RESULT'); $this->_content['value'] = org_glizy_Request::get('search', ''); $this->_content['result'] = null; // preg_match( '/"([^"]*)"/i', $this->_content['value'], $match ); // if ( count( $match ) ) // { // $searchArray2 = array( $match[ 1 ] ); // } // else // { // if ($this->getAttribute('explodeWords')) { // $searchArray = explode(' ', $this->_content['value']); // $searchArray2 = array(); // foreach ($searchArray as $word) // { // if (strlen($word)>=3) $searchArray2[] = $word; // } // } else { // $searchArray2 = $this->_content['value']; // } // } if (strlen($this->_content['value']) >= 3) { $pluginObj =& org_glizy_ObjectFactory::createObject('org.glizy.plugins.Search'); $this->_content['result'] = $pluginObj->run(array('search' => $this->_content['value'], 'languageId' => $this->_application->getLanguageId())); } $this->_content['total'] = org_glizy_locale_Locale::get('GLZ_SEARCH_RESULT_TOTAL') . ' ' . count($this->_content['result']); } }
function process() { $user =& $this->_application->getCurrentUser(); $this->_content = array(); $this->_content['id'] = $this->getId(); $this->_content['cssClass'] = $this->getAttribute('cssClass'); $this->_content['message'] = ''; if ($this->getAttribute('showWelcome')) { $this->_content['message'] = org_glizy_locale_Locale::get('LOGGED_MESSAGE', $user->firstName); } $this->processChilds(); }
function process() { $allowGroups = $this->getAttribute('allowGroups') != '' ? explode(',', $this->getAttribute('allowGroups')) : array(); if ((!org_glizy_Session::get('glizy.userLogged') || !(count($allowGroups) ? in_array($this->_user->groupId, $allowGroups) : true)) && $this->getAttribute('enabled')) { if (org_glizy_helpers_Link::scriptUrl() != org_glizy_helpers_Link::makeUrl('link', array('pageId' => org_glizy_Config::get('START_PAGE')))) { if ($this->getAttribute('showErrorMessage')) { org_glizy_Session::set('glizy.loginError', org_glizy_locale_Locale::get('GLZ_LOGIN_NOACCESS')); } org_glizy_Session::set('glizy.loginUrl', __Request::get('__url__')); } org_glizy_helpers_Navigation::gotoUrl(org_glizy_helpers_Link::makeUrl('link', array('pageId' => $this->getAttribute('accessPageId')))); exit; } if ($this->getAttribute('checkAcl') && !$this->_user->acl($this->_application->getPageId(), 'visible')) { header('HTTP/1.0 403 Forbidden'); exit; } }
public function executeLater($email) { if ($this->submit && $this->controller->validate()) { $ar = org_glizy_ObjectFactory::createModel('org.glizy.models.User'); if (!$ar->find(array('user_email' => $email))) { // utente non trovato $this->view->validateAddError(__T('MW_LOSTPASSWORD_ERROR')); return false; } // utente trovato // genera una nuova password e la invia per email glz_import('org.glizy.helpers.Mail'); // invia la notifica all'utente $subject = org_glizy_locale_Locale::get('MW_LOSTPASSWORD_EMAIL_SUBJECT'); $body = org_glizy_locale_Locale::get('MW_LOSTPASSWORD_EMAIL_BODY'); $body = str_replace('##USER##', $email, $body); $body = str_replace('##HOST##', org_glizy_helpers_Link::makeSimpleLink(GLZ_HOST, GLZ_HOST), $body); $body = str_replace('##PASSWORD##', $ar->user_password, $body); org_glizy_helpers_Mail::sendEmail(array('email' => org_glizy_Request::get('email', ''), 'name' => $ar->user_firstName . ' ' . $ar->user_lastName), array('email' => org_glizy_Config::get('SMTP_EMAIL'), 'name' => org_glizy_Config::get('SMTP_SENDER')), $subject, $body); $this->changeAction('lostPasswordConfirm'); } }
public function addColumn($column) { if (preg_match("/\\{i18n\\:.*\\}/i", $column['headerText'])) { $code = preg_replace("/\\{i18n\\:(.*)\\}/i", "\$1", $column['headerText']); $column['headerText'] = org_glizy_locale_Locale::getPlain($code); } $this->columns[] = $column; }
<?php $strings = array('LANGUAGE_ALREADY_PRESENT' => 'Language already present'); org_glizy_locale_Locale::append($strings);
protected function changePageTitle() { if (method_exists($this->_parent, "getAction")) { $currentAction = $this->_parent->getAction(); foreach ($this->pageTitleModifiers as $modifier) { if ($currentAction == $modifier->action) { $newTitle = $modifier->label; $newSubtitle = $modifier->fieldSubtitle && $this->_content[$modifier->fieldSubtitle] ? $this->_content[$modifier->fieldSubtitle] : ''; if ($modifier->isNew) { if ($modifier->idField && ($this->_content[$modifier->idField] != '0' && isset($this->_content[$modifier->idField]))) { continue; } } if (preg_match("/\\{i18n\\:.*\\}/i", $newTitle)) { $code = preg_replace("/\\{i18n\\:(.*)\\}/i", "\$1", $newTitle); $newTitle = org_glizy_locale_Locale::get($code, $newSubtitle); } $evt = array('type' => GLZ_EVT_PAGETITLE_UPDATE, 'data' => $newTitle); $this->dispatchEvent($evt); break; } } } }
function render() { $content = $this->getContent(); $outputTitle = ''; $outputImage = ''; $outputProperty = ''; $outputDescription = ''; foreach ($this->items as $i) { $value = $content[$i['field']]; if (glz_empty($value)) { continue; } if (is_array($value) && $value['__html__']) { $value = $value['__html__']; } $renderCell = $i['renderCell']; if (!empty($renderCell)) { if (!is_object($renderCell)) { $renderCell =& org_glizy_ObjectFactory::createObject($renderCell); $i['renderCell'] = $renderCell; } if (is_object($renderCell)) { $value = $renderCell->renderCell($value); } } $label = $i['label']; if (preg_match("/\\{i18n\\:.*\\}/i", $label)) { $code = preg_replace("/\\{i18n\\:(.*)\\}/i", "\$1", $label); $label = org_glizy_locale_Locale::getPlain($code); } if ($i['type'] == 'title') { $outputTitle .= '<h2>' . $value . '</h2>'; } else { if ($i['type'] == 'property') { $outputProperty .= '<li><span>' . $label . ':</span> ' . $value . '</li>'; } else { if ($i['type'] == 'description') { $outputDescription .= '<h3>' . $label . '</h3> ' . $value; } else { if ($i['type'] == 'image') { $outputImage .= $value; } } } } } $cssClass = $this->getAttribute('cssClass'); if ($outputProperty != '') { $outputProperty = '<ul>' . $outputProperty . '</ul>'; } if ($outputImage != '') { $outputImage = '<dic class="row"><div class="three columns images">' . $outputImage . '</div>'; $outputProperty = '<div class="eight columns">' . $outputProperty . '</div></div>'; } $output = '<div id="' . $this->getOriginalId() . '"' . ($cssClass != "" ? ' class="' . $cssClass . '"' : '') . '>'; $output .= $outputTitle . $outputImage . $outputProperty . $outputDescription; $output .= '</div>'; $this->addOutputCode($output); }
function render() { if (!$this->iterator) { $this->addOutputCode('<p>' . $this->getAttribute('emptySearchLabel') . '</p>'); return; } // legge le colonne da visualizzare dai figli // NOTA: le colonne sono gi� state lette sul process // ma vengono rilette perch� pu� essere variata la visibilit� $this->_columns = array(); for ($i = 0; $i < count($this->childComponents); $i++) { $this->_columns[] = $this->childComponents[$i]->getProperties(); } $addJsCode = false; $output = ''; if ($this->_totalRecord > 0) { $class = $this->getAttribute('tableCssClass') != '' ? ' class="' . $this->getAttribute('tableCssClass') . '"' : ''; $output .= '<table id="' . $this->getId() . '"' . $class . '>'; if ($this->getAttribute('label') != '') { $output .= '<caption>' . $this->getAttribute('label') . '</caption>'; } if ($this->getAttribute('drawHeader')) { // disegna le colonne $output .= '<thead>'; $output .= '<tr>'; //foreach ($this->_columns as $v) for ($i = 0; $i < count($this->_columns); $i++) { $v = $this->_columns[$i]; if ($v['visible'] === true) { $cssClass = !empty($v['cssClass']) ? ' class="' . $v['cssClass'] . '"' : ''; $id = !empty($v['id']) ? ' id="' . $v['id'] . '"' : ''; $width = !empty($v['width']) ? ' style="width: ' . $v['width'] . 'px;"' : ''; if (!empty($v['renderCell'])) { $renderCell =& org_glizy_ObjectFactory::createObject($v['renderCell'], $this->_application); if (method_exists($renderCell, 'getHeader')) { $v['headerText'] = $renderCell->getHeader($v['headerText']); } unset($renderCell); } if (!empty($v['command'])) { $output .= '<th' . $id . $cssClass . $width . '>'; if ($v['command'] == 'publish') { $output .= '<input name="publishAll" value="" type="checkbox" class="js-selectall" />'; } $output .= '</th>'; } else { if (!$this->getAttribute('skipOrder') && $v['orderable']) { $addJsCode = true; $headerId = 'orderBy_' . $i; $headerClass = 'DataGridHeader'; $headerImage = ''; if ($i == $this->_orderBy) { $headerId .= '_' . ($this->_orderDirection == 'ASC' ? 'DESC' : 'ASC'); $headerImage = $this->_orderDirection == 'ASC' ? '<span class="ui-icon ui-icon-triangle-1-s"></span>' : '<span class="ui-icon ui-icon-triangle-1-n"></span>'; } else { $headerId .= '_' . $this->_orderDirection; } $output .= '<th' . $id . $cssClass . $width . '><a href="#" id="' . $headerId . '" class="' . $headerClass . '">' . $v['headerText'] . '</a>' . $headerImage . '</th>'; } else { $output .= '<th' . $cssClass . $width . '>' . $v['headerText'] . '</th>'; } } } } $output .= '</tr>'; $output .= '</thead>'; } if (!$this->getAttribute('hideTotals')) { $output .= '<tfoot>'; $output .= '<tr><td style="text-align: right;" colspan="' . count($this->_columns) . '">' . __T('GLZ_TOTAL_RECORDS') . ' ' . $this->_totalRecord . '</td></tr>'; $output .= '</tfoot>'; } $output .= '<tbody>'; $key = 0; $tempCssClass = $this->_cssClass; $rowCellClass = $this->getAttribute('renderRow'); if (!empty($rowCellClass)) { $rowCellClass =& org_glizy_ObjectFactory::createObject($rowCellClass, $this->_application); } foreach ($this->iterator as $ar) { $v = $ar->getValuesAsArray(true); $rowOutput = ''; foreach ($this->_columns as $vv) { if ($vv['key']) { $key = $v[$vv['columnName']]; } if ($vv['visible'] === false) { continue; } $tempOutput = ''; $cssClass = ''; if (!empty($vv['renderCell'])) { $renderCell =& org_glizy_ObjectFactory::createObject($vv['renderCell'], $this->_application); if (is_object($renderCell)) { $tempOutput .= $renderCell->renderCell($key, isset($v[$vv['columnName']]) ? $v[$vv['columnName']] : '', $ar, $vv['columnName']); $cssClass = !empty($vv['cssClass']) ? $vv['cssClass'] : ''; if (method_exists($renderCell, 'getCssClass')) { $cssClass = $renderCell->getCssClass($key, isset($v[$vv['columnName']]) ? $v[$vv['columnName']] : '', $v); } } } else { if (!empty($vv['command'])) { $addJsCode = true; if (strtolower($this->_application->getPageId()) == 'usergroups') { if ($vv['command'] == 'delete' && $v['usergroup_backEndAccess']) { continue; } } switch ($vv['command']) { case 'edit': if ($this->_user->acl($vv['aclService'], $vv['command'])) { if (!is_null($this->_versionFieldName)) { if ($this->_user->acl($vv['aclService'], $vv['command'])) { $icon = org_glizy_Assets::get('ICON_EDIT'); $ar =& $this->_dataProvider->getNewObject(); $joinFields = $ar->getJoinFields(); $result = $ar->find(array($joinFields['detailTable'] => $key, $this->_versionFieldName => 'PUBLISHED')); //$result = $ar->find(array($joinFields['detailTable'] => $key, $this->_versionFieldName => 'PUBLISHED', $this->_languageFieldName => $this->_application->getEditingLanguageId())); } else { $icon = org_glizy_Assets::get('ICON_EDITDRAFT'); $result = true; } if ($result) { $tempOutput .= '<img title="' . org_glizy_locale_Locale::get('GLZ_RECORD_EDIT') . '" id="edit_' . $key . '" class="DataGridCommand" src="' . $icon . '" width="16" height="16" border="0" />'; } else { $tempOutput .= '<img id="" class="DataGridCommand" src="' . org_glizy_Assets::get('ICON_EDIT_OFF') . '" width="16" height="16" border="0" />'; } } else { $tempOutput .= '<img title="' . org_glizy_locale_Locale::get('GLZ_RECORD_EDIT') . '" id="edit_' . $key . '" class="DataGridCommand" src="' . org_glizy_Assets::get('ICON_EDIT') . '" width="16" height="16" border="0" />'; } } break; case 'editDraft': if (!is_null($this->_versionFieldName) && $this->_user->acl($vv['aclService'], $vv['command'])) { $ar =& $this->_dataProvider->getNewObject(); $joinFields = $ar->getJoinFields(); $result = $ar->find(array($joinFields['detailTable'] => $key, $this->_versionFieldName => 'DRAFT')); //$result = $ar->find(array($joinFields['detailTable'] => $key, $this->_versionFieldName => 'DRAFT', $this->_languageFieldName => $this->_application->getEditingLanguageId())); if ($result) { $tempOutput .= '<img title="' . org_glizy_locale_Locale::get('GLZ_RECORD_EDIT') . '" id="editDraft_' . $key . '" class="DataGridCommand" src="' . org_glizy_Assets::get('ICON_EDITDRAFT') . '" width="16" height="16" border="0" />'; } else { $tempOutput .= '<img id="" class="DataGridCommand" src="' . org_glizy_Assets::get('ICON_EDITDRAFT_OFF') . '" width="16" height="16" border="0" />'; } } break; case 'preview': $tempOutput .= '<img title="' . org_glizy_locale_Locale::get('GLZ_RECORD_PREVIEW') . '" id="preview_' . $key . '" class="DataGridCommand" src="' . org_glizy_Assets::get('ICON_PREVIEW') . '" width="16" height="16" border="0" />'; break; case 'delete': if ($this->_user->acl($vv['aclService'], $vv['command'])) { $tempOutput .= '<img title="' . org_glizy_locale_Locale::get('GLZ_RECORD_DELETE') . '" id="delete_' . $key . '" class="DataGridCommand" src="' . org_glizy_Assets::get('ICON_DELETE') . '" width="16" height="16" border="0" />'; } break; case 'publish': if ($this->_user->acl($vv['aclService'], $vv['command'])) { $tempOutput .= '<input name="publish[]" value="' . $key . '" type="checkbox">'; } break; } } else { if (!is_null($this->_languageFieldName) && $v[$this->_languageFieldName] != $this->_application->getEditingLanguageId()) { $tempOutput .= '<em>' . $v[$vv['columnName']] . '</em>'; } else { $tempOutput .= $v[$vv['columnName']]; } } } $cssClass = !empty($cssClass) ? ' class="' . $cssClass . '"' : ''; $rowOutput .= '<td style="text-align: ' . $vv['align'] . ';"' . $cssClass . '>' . $tempOutput . '</td>'; } if (!count($tempCssClass)) { $tempCssClass = $this->_cssClass; } $cssClass = array_shift($tempCssClass); if (!empty($rowCellClass)) { $output .= $rowCellClass->renderRow($v, $cssClass); } else { $output .= '<tr class="' . $cssClass . '" id="row_' . $key . '">'; } $output .= $rowOutput . '</tr>'; } $output .= '</tbody>'; $output .= '</table>'; } else { $emptyLabel = $this->getAttribute('emptyLabel'); if (!empty($emptyLabel)) { $output .= '<p class="datagridEmpty">' . $emptyLabel . '</p>'; } } $this->addOutputCode($output); if (!$addJsCode) { return; } $jsId = $this->getId(); $jsMessage = org_glizy_locale_Locale::get('GLZ_RECORD_MSG_DELETE'); // TODO // controllare che il valore di controller sia settato $controllerClass =& $this->getAttribute('controller'); if (is_object($controllerClass)) { $jsStateUrl = $controllerClass->changeStateUrl(); $jsStateUrl = str_replace(__Link::makeUrl('link', array('pageId' => $this->_application->getPageId())) . '?', '', $jsStateUrl); $jsStateUrl = __Link::removeParams(array($controllerClass->getId() . '_recordId'), $jsStateUrl); $jsCurrentStateUrl = $controllerClass->changeStateUrl($controllerClass->getState()); $controllerId = $controllerClass->getid(); } else { $jsStateUrl = __Link::removeParams(array($jsId . '_orderBy', $jsId . '_orderDirection')); $jsCurrentStateUrl = $jsStateUrl; $controllerId = ''; } $output = ''; $output = <<<EOD <script language="JavaScript" type="text/JavaScript"> jQuery(document).ready(function() { jQuery('#{$jsId} input.js-selectall').change(function(){ var checked = this.checked; \$(this).closest('table').find("input[name='publish[]']").each(function(i, el){ el.checked = checked; }) }); jQuery(['#{$jsId} .DataGridCommand', '#{$jsId} .DataGridHeader']).each(function(index,element) { jQuery( element ).css( {cursor: 'pointer'} ); jQuery( element ).click( function() { var command = this.id.split('_'); var loc = "{$jsStateUrl}"+command[0]+"&{$controllerId}_recordId="+command[1]; switch (command[0]) { case 'delete': this.parentNode.parentNode.oldClass2 = this.parentNode.parentNode.oldClass; this.parentNode.parentNode.className2 = this.parentNode.parentNode.className; this.parentNode.parentNode.className = "ruled"; this.parentNode.parentNode.oldClass = "ruled"; if (confirm("{$jsMessage}")) { location.href = loc; } this.parentNode.parentNode.oldClass = this.parentNode.parentNode.oldClass2; this.parentNode.parentNode.className = this.parentNode.parentNode.oldClass2; break; case 'orderBy': loc = "{$jsCurrentStateUrl}&{$jsId}_orderBy="+command[1]+"&{$jsId}_orderDirection="+command[2]; location.href = loc; default: location.href = loc; break; } }); }); }); </script> EOD; if (!empty($output)) { $this->addOutputCode($output); } }
/** * @param $name * * @return mixed|string */ function getAttributeString($name) { $value = strval($this->_attributes[$name]); if (preg_match("/\\{i18n\\:.*\\}/i", $value)) { $code = preg_replace("/\\{i18n\\:(.*)\\}/i", "\$1", $value); $value = org_glizy_locale_Locale::get($code); } else { $value = glz_encodeOutput($value); } return $value; }
protected function loadSiteProperties() { $menu = $this->_application->getCurrentMenu(); $siteProp = $this->_application->getSiteProperty(); $title = org_glizy_ObjectValues::get('org.glizy.og', 'title', $menu->title); $description = org_glizy_ObjectValues::get('org.glizy.og', 'description', $menu->description); $keywords = org_glizy_ObjectValues::get('org.glizy.og', 'keywords', $menu->keywords); $this->addOutputCode($title . ' - ' . $siteProp['title'], 'docTitle'); $this->addOutputCode($title . ' - ' . $siteProp['title'], 'doctitle'); // NOTE: per compatibilità $this->addOutputCode($title, 'metadata_title'); $this->addOutputCode($description, 'metadata_description'); $this->addOutputCode($keywords, 'metadata_keywords'); $this->addOutputCode($siteProp['copyright'], 'copyright'); $this->addOutputCode($siteProp['address'], 'address'); $slideShowSpeed = ((int) $siteProp['slideShow'] ?: 5) * 1000; $this->addOutputCode(org_glizy_helpers_JS::JScode('if (typeof(Glizy)!=\'object\') Glizy = {}; Glizy.slideShowSpeed = ' . $slideShowSpeed . ';'), 'head'); $reg = __T(strlen($menu->creationDate) <= 10 || preg_match('/00:00:00|12:00:00 AM/', $menu->creationDate) ? 'GLZ_DATE_FORMAT' : 'GLZ_DATETIME_FORMAT'); $updateText = org_glizy_locale_Locale::get('MW_FOOTER', glz_defaultDate2locale($reg, $menu->creationDate), glz_defaultDate2locale($reg, $menu->modificationDate)); $this->addOutputCode($updateText, 'docUpdate'); }
public function addCriteria($id, $label, $type, $values, $dataProvider) { if (preg_match("/\\{i18n\\:.*\\}/i", $label)) { $code = preg_replace("/\\{i18n\\:(.*)\\}/i", "\$1", $label); $label = org_glizy_locale_Locale::getPlain($code); } $temp = new StdClass(); $temp->id = $id; $temp->label = $label; $temp->type = $type; $temp->values = $values; $temp->dataProvider = $dataProvider; $this->criteria[$temp->label] = $temp; }
function process() { // check if the user is already logged if ($this->_user->isLogged()) { $this->setAttribute('visible', false); $this->redirectAfterLogin(); } $submitId = 'submit_' . $this->getId(); $this->_content['id'] = $this->getId(); $this->_content['submitName'] = $submitId; $this->_content['errorLabel'] = ''; $this->_content['cssClass'] = $this->getAttribute('cssClass'); $this->_content['userLabel'] = $this->getAttribute('userLabel'); $this->_content['userField'] = $this->getAttribute('userField'); $this->_content['passwordLabel'] = $this->getAttribute('passwordLabel'); $this->_content['passwordField'] = $this->getAttribute('passwordField'); $this->_content['registrationPage'] = $this->getAttribute('registrationPage'); $this->_content['registrationLabel'] = $this->getAttribute('registrationLabel'); $this->_content['confirmLabel'] = $this->getAttribute('confirmLabel'); $this->_content['rememberLabel'] = $this->getAttribute('rememberLabel'); $this->_content['askPasswordLabel'] = $this->getAttribute('askPasswordLabel'); $this->_content['title'] = $this->getAttributeString('title'); $this->_content['__url__'] = org_glizy_helpers_Link::makeURL($this->getAttribute('registrationUrl')); $this->_content['askPasswordUrl'] = org_glizy_helpers_Link::makeURL($this->getAttribute('askPasswordUrl')); if (__Request::exists($this->_content['userField']) || __Request::exists($this->_content['passwordField'])) { $authClass = org_glizy_ObjectFactory::createObject(__Config::get('glizy.authentication')); if ($authClass) { try { $allowGroups = $this->getAttribute('allowGroups') != '' ? explode(',', $this->getAttribute('allowGroups')) : array(); $authClass->setAllowGroups($allowGroups); $authClass->setOnlyBackendUser($this->getAttribute('backend')); $authClass->setUserLanguage(__Request::get($this->getAttribute('languageField'))); $authClass->loginFromRequest($this->getAttribute('userField'), $this->getAttribute('passwordField'), $this->getAttribute('rememberField'), true); $this->redirectAfterLogin(); } catch (org_glizy_authentication_AuthenticationException $e) { switch ($e->getCode()) { case org_glizy_authentication_AuthenticationException::EMPTY_LOGINID_OR_PASSWORD: case org_glizy_authentication_AuthenticationException::WRONG_LOGINID_OR_PASSWORD: $this->_content['errorLabel'] = $this->getAttribute('errorLabel'); break; case org_glizy_authentication_AuthenticationException::USER_NOT_ACTIVE: case org_glizy_authentication_AuthenticationException::ACCESS_NOT_ALLOWED: $this->_content['errorLabel'] = org_glizy_locale_Locale::get('GLZ_LOGIN_DISABLED'); break; } } } else { // TODO mostrare errore $this->_content['errorLabel'] = __Config::get('glizy.authentication'); } } else { $this->_content['errorLabel'] = org_glizy_Session::get('glizy.loginError', ''); org_glizy_Session::remove('glizy.loginError'); } }
function _searchNodeDetails(&$myNode, &$title, $language) { if ($myNode->hasAttribute('value')) { $title = $myNode->getAttribute('value'); if (preg_match("/\\{i18n\\:.*\\}/i", $title)) { $code = preg_replace("/\\{i18n\\:(.*)\\}/i", "\$1", $title); $title = org_glizy_locale_Locale::getPlain($code); } return $title; } foreach ($myNode->childNodes as $currNode) { if (($currNode->nodeName == 'Title' || $currNode->nodeName == 'glz:Title') && $currNode->getAttribute('lang') == $language) { $title = $currNode->hasAttribute('value') ? trim($currNode->getAttribute('value')) : trim($currNode->getText()); break; } } }