foreach ($skins as $id => $attributes) { // skip invalid skins -- for example, obsoleted skins if (!file_exists($context['path_to_root'] . $id . '/template.php')) { continue; } // style description $text = ''; // the style title if ($label = i18n::l($attributes, 'label')) { if ($context['skin'] == $id) { $label .= ' <span class="details">' . i18n::s('current theme') . '</span>'; } $text .= Skin::build_block($label, 'title'); } // style description if ($description = i18n::l($attributes, 'description')) { $text .= '<p>' . Codes::beautify($description) . '</p>'; } // a small menu $menu = array(); // test the skin $menu = array_merge($menu, array('skins/test.php?skin=' . substr($id, 6) => i18n::s('Test this theme'))); // commands for associates if (Surfer::is_associate()) { // this skin is not yet used if ($context['skin'] != $id) { $menu = array_merge($menu, array('control/configure.php?parameter=skin&value=' . $id => i18n::s('Use this theme'))); } // configure the theme if (file_exists($context['path_to_root'] . $id . '/configure.php')) { $menu = array_merge($menu, array($id . '/configure.php' => i18n::s('Configure this theme')));
if (isset($hook['source']) && $hook['source']) { $text .= '- ' . sprintf(i18n::s('source: %s'), $hook['source']) . BR . "\n"; } $text .= "</dd>\n\n"; // remember for later use $calls[$id] = $text; break; case 'serve': // form item $input = '<input type="checkbox" name="' . $id . '" value="Y" checked="checked" />'; // description if ($description = i18n::l($hook, 'description')) { $description .= BR; } // user information $text = '<dt>' . $input . ' <b>' . i18n::l($hook, 'label') . '</b></dt><dd>' . $description . "\n"; if (isset($hook['id']) && $hook['id']) { $text .= '- ' . sprintf(i18n::s('service: %s'), $hook['id']) . BR . "\n"; } if (isset($hook['script']) && $hook['script']) { $text .= '- ' . sprintf(i18n::s('script: %s'), $hook['script']) . BR . "\n"; } if ($hook['function'] && $hook['function']) { $text .= '- ' . sprintf(i18n::s('function: %s'), $hook['function']) . BR . "\n"; } if (isset($hook['source']) && $hook['source']) { $text .= '- ' . sprintf(i18n::s('source: %s'), $hook['source']) . BR . "\n"; } $text .= "</dd>\n\n"; // remember for later use $services[$id] = $text;
/** * get a localized string for a surfer * * To localize strings internally you should put alternative strings in the $local array, and use * this function to select the correct version. * * Example: * [php] * $local['mystring_en'] = 'my string'; * $local['mystring_fr'] = 'ma chaine de caracteres'; * $text = i18n::user('mystring'); * [/php] * * This function also transcode HTML entities to Unicode entities, if any. * * @param string the label identifying string * @param string desired language, if any * @return string the localized string, if any */ public static function &user($name, $forced = '') { global $local; $text =& i18n::l($local, $name, $forced); return $text; }