private function _share_translations_form() { $form = new Forge("admin/languages/share", "", "post", array("id" => "gShareTranslationsForm")); $group = $form->group("sharing")->label(t("Sharing your own translations with the Gallery community is easy. Please do!")); $api_key = l10n_client::api_key(); $server_link = l10n_client::server_api_key_url(); $group->input("api_key")->label(empty($api_key) ? t("This is a unique key that will allow you to send translations to the remote server. To get your API key go to %server-link.", array("server-link" => html::anchor($server_link))) : t("API Key"))->value($api_key)->error_messages("invalid", t("The API key you provided is invalid.")); $group->submit("save")->value(t("Save settings")); if ($api_key && $this->_outgoing_translations_count()) { // TODO: UI improvement: hide API key / save button when API key is set. $group->submit("share")->value(t("Submit translations")); } return $form; }
private static function _sign($payload, $api_key = null) { $api_key = $api_key == null ? l10n_client::api_key() : $api_key; return md5($api_key . $payload . l10n_client::client_token()); }