<?php
 if (!defined('LANGUAGE_XML')) define('LANGUAGE_XML', 'language.xml'); class SimpleMediaPlayerModuleService { public function getLanguages() { $responseVO = new ResponseVO(); try { $query = './language'; $config = MOTO_ADMIN_DIR . '/' . CONTROL_PANEL_CONFIGURATION; if (file_exists($config)) { $config_xml = new MotoXML($config); $lang = MotoXML::findOneByXPath('.//item[@name="language"]', $config_xml); if (!is_null($lang)) { $query = './language[@id="eng" or @id="' . $lang->nodeValue . '"]'; } } $dom = new MotoXML(LANGUAGE_XML); $lanugages = array(); $lanugagesXML = MotoXML::findByXPath($query, $dom); foreach ($lanugagesXML as $languageXML) { array_push($lanugages, new LanguageVO($languageXML)); } $responseVO->result = $lanugages; $responseVO->status->status = StatusEnum::SUCCESS; } catch (Exception $e) { $responseVO->result = null; $responseVO->status->status = StatusEnum::ERROR_WHILE_WORKING_WITH_FILE; $responseVO->status->message = $e->getMessage(); } return $responseVO; } }