" method="post" name="adminForm" id="adminForm" > <fieldset> <div class="header" style="float: left;"><?php echo JText::_('SHARE') . ' : ' . $this->file->name; ?> </div> <div class="toolbar" id="toolbar" style="float: right;"> <button class="btn" type="button" onclick="javascript:submitbutton('send')"><?php echo JText::_('SHARE'); ?> </button> </div> </fieldset> <fieldset class="adminform"> <?php hikaserial::display(JText::_('SHARE_CONFIRMATION_1') . '<br/>' . JText::_('SHARE_CONFIRMATION_2') . '<br/>' . JText::_('SHARE_CONFIRMATION_3'), 'info'); ?> <br/> <textarea cols="100" rows="8" name="mailbody">Hi Hikari Software team, Here is a new version of the language file for HikaSerial, I translated few more strings...</textarea> </fieldset> <div class="clr"></div> <input type="hidden" name="code" value="<?php echo $this->file->name; ?> " /> <input type="hidden" name="option" value="<?php echo HIKASERIAL_COMPONENT; ?> " /> <input type="hidden" name="task" value="" />
public function language() { $code = JRequest::getString('code'); if (empty($code)) { hikaserial::display('Code not specified', 'error'); return; } jimport('joomla.filesystem.file'); $path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.' . HIKASERIAL_COMPONENT . '.ini'; $file = new stdClass(); $file->name = $code; $file->path = $path; if (JFile::exists($path)) { $file->content = JFile::read($path); if (empty($file->content)) { hikaserial::display('File not found : ' . $path, 'error'); } } else { hikaserial::display(JText::_('LOAD_ENGLISH_1') . '<br/>' . JText::_('LOAD_ENGLISH_2') . '<br/>' . JText::_('LOAD_ENGLISH_3'), 'info'); $file->content = JFile::read(JLanguage::getLanguagePath(JPATH_ROOT) . DS . 'en-GB' . DS . 'en-GB.' . HIKASERIAL_COMPONENT . '.ini'); } $override_content = ''; $override_path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . 'overrides' . DS . $code . '.override.ini'; if (JFile::exists($override_path)) { $override_content = JFile::read($override_path); } $this->assignRef('override_content', $override_content); $this->assignRef('showLatest', $showLatest); $this->assignRef('file', $file); }
public function installMenu($code = '') { if (empty($code)) { $lang = JFactory::getLanguage(); $code = $lang->getTag(); } $path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.' . HIKASERIAL_COMPONENT . '.ini'; if (!file_exists($path)) { return; } $content = file_get_contents($path); if (empty($content)) { return; } $menuFileContent = strtoupper(HIKASERIAL_COMPONENT) . '="' . HIKASERIAL_NAME . '"' . "\r\n" . strtoupper(HIKASERIAL_NAME) . '="' . HIKASERIAL_NAME . '"' . "\r\n"; $menuStrings = array('SERIALS', 'PACKS', 'PLUGINS', 'HELP', 'UPDATE_ABOUT'); foreach ($menuStrings as $s) { preg_match('#(\\n|\\r)(HIKA_)?' . $s . '="(.*)"#i', $content, $matches); if (empty($matches[3])) { continue; } if (!HIKASHOP_J16) { $menuFileContent .= strtoupper(HIKASERIAL_COMPONENT) . '.' . $s . '="' . $matches[3] . '"' . "\r\n"; } else { $menuFileContent .= $s . '="' . $matches[3] . '"' . "\r\n"; } } if (!HIKASHOP_J16) { $menuPath = HIKASERIAL_ROOT . 'administrator' . DS . 'language' . DS . $code . DS . $code . '.' . HIKASERIAL_COMPONENT . '.menu.ini'; } else { $menuPath = HIKASERIAL_ROOT . 'administrator' . DS . 'language' . DS . $code . DS . $code . '.' . HIKASERIAL_COMPONENT . '.sys.ini'; } if (!JFile::write($menuPath, $menuFileContent)) { hikaserial::display(JText::sprintf('FAIL_SAVE', $menuPath), 'error'); } }
private function savelng() { jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); $code = JRequest::getString('code'); JRequest::setVar('code', $code); $content = JRequest::getVar('content', '', '', 'string', JREQUEST_ALLOWRAW); if (empty($code)) { return; } $content_override = JRequest::getVar('content_override', '', '', 'string', JREQUEST_ALLOWRAW); $folder = JLanguage::getLanguagePath(JPATH_ROOT) . DS . 'overrides'; if (!JFolder::exists($folder)) { JFolder::create($folder); } if (JFolder::exists($folder)) { $path = $folder . DS . $code . '.override.ini'; $result = JFile::write($path, $content_override); if (!$result) { hikaserial::display(JText::sprintf('FAIL_SAVE', $path), 'error'); } } if (empty($content)) { return; } $path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.' . HIKASERIAL_COMPONENT . '.ini'; $result = JFile::write($path, $content); if ($result) { hikaserial::display(JText::_('HIKASHOP_SUCC_SAVED'), 'success'); $updateHelper = hikaserial::get('helper.update'); $updateHelper->installMenu($code); $js = 'window.top.document.getElementById("image' . $code . '").src = "' . HIKASHOP_IMAGES . 'icons/icon-16-edit.png"'; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($js); } else { hikaserial::display(JText::sprintf('FAIL_SAVE', $path), 'error'); } return $result; }