• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP translate函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中translate函数的典型用法代码示例。如果您正苦于以下问题:PHP translate函数的具体用法?PHP translate怎么用?PHP translate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了translate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: WriteData

 function WriteData(&$data)
 {
     $this->count++;
     if (isset($this->block_title) && strlen($this->block_title) > 0) {
         if (preg_match("/(\\.[^\\/\\\\]+)\\s*\$/", $data, $m)) {
             $title = $this->block_title . $m[1];
         } else {
             $title = $this->block_title;
         }
     } else {
         $title = basename($data);
     }
     if (in_array($title, $this->list)) {
         if (preg_match("/^(.*)(\\.[^\\/\\\\]+)\\s*\$/", $title, $m)) {
             $base = $m[1];
             $ext = $m[2];
         } else {
             $base = $title;
             $ext = "";
         }
         $i = 0;
         do {
             $title = $base . ++$i . $ext;
         } while (in_array($title, $this->list));
     }
     array_push($this->list, $title);
     if ($this->zip->open($this->tmpfile, ZIPARCHIVE::CREATE) !== true) {
         throw new ADEIException(translate("Can't open/create ZIP archive (%s)", $this->tmpfile));
     }
     $this->zip->addFile($data, $title);
     $this->zip->close();
 }
开发者ID:nicolaisi,项目名称:adei,代码行数:32,代码来源:zipfilter.php


示例2: __construct

 public function __construct()
 {
     if (!pageArray(2) || !pageArray(3)) {
         return false;
     }
     $email = pageArray(2);
     $code = pageArray(3);
     runHook("action:verify_email:before");
     $access = getIgnoreAccess();
     setIgnoreAccess();
     $user = getEntities(array("type" => "User", "metadata_name_value_pairs" => array(array("name" => "email", "value" => $email), array("name" => "email_verification_code", "value" => $code))));
     setIgnoreAccess($access);
     if (!$user) {
         new SystemMessage(translate("system_message:email_could_not_be_verified"));
         forward("home");
     }
     $user = $user[0];
     $user->email_verification_code = NULL;
     $user->verified = "true";
     $user->save();
     runHook("action:verify_email:after");
     new SystemMessage(translate("system_message:email_verified"));
     new Activity($user->guid, "activity:joined", array($user->getURL(), $user->full_name));
     forward("login");
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:25,代码来源:VerifyEmailActionHandler.php


示例3: lodgegold_dohook

function lodgegold_dohook($hookname, $args)
{
    global $session;
    $cost1 = get_module_setting("cost1", "lodgegold");
    $cost2 = get_module_setting("cost2", "lodgegold");
    $cost3 = get_module_setting("cost3", "lodgegold");
    $gold1 = get_module_setting("gold1", "lodgegold");
    $gold2 = get_module_setting("gold2", "lodgegold");
    $gold3 = get_module_setting("gold3", "lodgegold");
    switch ($hookname) {
        case "lodge":
            addnav("Buy Requisition");
            $donationsleft = $session['user']['donation'] - $session['user']['donationspent'];
            if ($donationsleft >= $cost1) {
                addnav(array("`^%s Gold - `#(%s Points)", $gold1, $cost1), "runmodule.php?module=lodgegold&op=cost1&gold=gold1");
            }
            if ($donationsleft >= $cost2) {
                addnav(array("`^%s Gold - `#(%s Points)", $gold2, $cost2), "runmodule.php?module=lodgegold&op=cost2&gold=gold2");
            }
            if ($donationsleft >= $cost3) {
                addnav(array("`^%s Gold - `#(%s Points)", $gold3, $cost3), "runmodule.php?module=lodgegold&op=cost3&gold=gold3");
            }
            break;
        case "pointsdesc":
            $args['count']++;
            $format = $args['format'];
            $str = translate("Trade in donation points for gold.");
            $str = sprintf($str, get_module_setting("cost1"), get_module_setting("cost2"));
            output($format, $str, true);
            break;
    }
    return $args;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:33,代码来源:lodgegold.php


示例4: launch

 function launch()
 {
     global $interface;
     $id = $_GET['id'];
     $interface->assign('id', $id);
     $this->eContentRecord = new EContentRecord();
     $this->eContentRecord->id = $_GET['id'];
     $this->eContentRecord->find(true);
     $recordDriver = new EcontentRecordDriver();
     $recordDriver->setDataObject($this->eContentRecord);
     $interface->assign('sourceUrl', $this->eContentRecord->sourceUrl);
     $interface->assign('source', $this->eContentRecord->source);
     $interface->setPageTitle(translate('Copies') . ': ' . $recordDriver->getBreadcrumb());
     $driver = new EContentDriver();
     $holdings = $driver->getHolding($id);
     $showEContentNotes = false;
     foreach ($holdings as $holding) {
         if (strlen($holding->notes) > 0) {
             $showEContentNotes = true;
         }
     }
     $interface->assign('showEContentNotes', $showEContentNotes);
     $interface->assign('holdings', $holdings);
     //Load status summary
     $result = $driver->getStatusSummary($id, $holdings);
     if (PEAR_Singleton::isError($result)) {
         PEAR_Singleton::raiseError($result);
     }
     $holdingData->holdingsSummary = $result;
     $interface->assign('subTemplate', 'view-holdings.tpl');
     $interface->setTemplate('view-alt.tpl');
     // Display Page
     $interface->display('layout.tpl');
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:34,代码来源:Copies.php


示例5: saveDropDown

 /**
  * Takes in the request params from a save request and processes
  * them for the save.
  *
  * @param REQUEST params  $params
  */
 function saveDropDown($params)
 {
     require_once 'modules/Administration/Common.php';
     $emptyMarker = translate('LBL_BLANK');
     $selected_lang = !empty($params['dropdown_lang']) ? $params['dropdown_lang'] : $_SESSION['authenticated_user_language'];
     $type = $_REQUEST['view_package'];
     $dir = '';
     $dropdown_name = $params['dropdown_name'];
     $json = getJSONobj();
     $list_value = str_replace('"":""', '"__empty__":""', $params['list_value']);
     //Bug 21362 ENT_QUOTES- convert single quotes to escaped single quotes.
     $dropdown = $json->decode(html_entity_decode(rawurldecode($list_value), ENT_QUOTES));
     if (array_key_exists($emptyMarker, $dropdown)) {
         unset($dropdown[$emptyMarker]);
         $dropdown[''] = '';
     }
     if ($type != 'studio') {
         $mb = new ModuleBuilder();
         $module =& $mb->getPackageModule($params['view_package'], $params['view_module']);
         $this->synchMBDropDown($dropdown_name, $dropdown, $selected_lang, $module);
         //Can't use synch on selected lang as we want to overwrite values, not just keys
         $module->mblanguage->appListStrings[$selected_lang . '.lang.php'][$dropdown_name] = $dropdown;
         $module->mblanguage->save($module->key_name);
         // tyoung - key is required parameter as of
     } else {
         $contents = return_custom_app_list_strings_file_contents($selected_lang);
         $my_list_strings = return_app_list_strings_language($selected_lang);
         if ($selected_lang == $GLOBALS['current_language']) {
             $GLOBALS['app_list_strings'][$dropdown_name] = $dropdown;
         }
         //write to contents
         $contents = str_replace("?>", '', $contents);
         if (empty($contents)) {
             $contents = "<?php";
         }
         //add new drop down to the bottom
         if (!empty($params['use_push'])) {
             //this is for handling moduleList and such where nothing should be deleted or anything but they can be renamed
             foreach ($dropdown as $key => $value) {
                 //only if the value has changed or does not exist do we want to add it this way
                 if (!isset($my_list_strings[$dropdown_name][$key]) || strcmp($my_list_strings[$dropdown_name][$key], $value) != 0) {
                     //clear out the old value
                     $pattern_match = '/\\s*\\$app_list_strings\\s*\\[\\s*\'' . $dropdown_name . '\'\\s*\\]\\[\\s*\'' . $key . '\'\\s*\\]\\s*=\\s*[\'\\"]{1}.*?[\'\\"]{1};\\s*/ism';
                     $contents = preg_replace($pattern_match, "\n", $contents);
                     //add the new ones
                     $contents .= "\n\$GLOBALS['app_list_strings']['{$dropdown_name}']['{$key}']=" . var_export_helper($value) . ";";
                 }
             }
         } else {
             //Now synch up the keys in other langauges to ensure that removed/added Drop down values work properly under all langs.
             $this->synchDropDown($dropdown_name, $dropdown, $selected_lang, $dir);
             $contents = $this->getNewCustomContents($dropdown_name, $dropdown, $selected_lang);
         }
         if (!empty($dir) && !is_dir($dir)) {
             $continue = mkdir_recursive($dir);
         }
         save_custom_app_list_strings_contents($contents, $selected_lang, $dir);
     }
     sugar_cache_reset();
 }
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:66,代码来源:parser.dropdown.php


示例6: errorMessage

function errorMessage($tag = '')
{
    $toReturn = translate('If you want to install Plugin WIRIS manually, see') . ' <a href="http://www.wiris.com/download/moodle/install.html#' . $tag . '">' . translate('our manual') . '</a>.<br /><br />';
    $toReturn .= '<a href="..">' . translate('Return to moodle home.') . '</a><br /><br />';
    $toReturn .= '<a href="./install.php">' . translate('Try to reinstall') . '</a>.';
    return $toReturn;
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:7,代码来源:functions.php


示例7: smarty_function_sugar_translate

/**
 * Smarty {sugar_translate} function plugin
 *
 * Type:     function<br>
 * Name:     sugar_translate<br>
 * Purpose:  translates a label into the users current language
 *
 * @author Majed Itani {majed at sugarcrm.com
 * @param array
 * @param Smarty
 */
function smarty_function_sugar_translate($params, &$smarty)
{
    if (!isset($params['label'])) {
        $smarty->trigger_error("sugar_translate: missing 'label' parameter");
        return '';
    }
    $module = isset($params['module']) ? $params['module'] : '';
    if (isset($params['select'])) {
        if (empty($params['select'])) {
            $value = "";
        } else {
            $value = translate($params['label'], $module, $params['select']);
        }
    } else {
        $value = translate($params['label'], $module);
    }
    if (!empty($params['for_js']) && $params['for_js']) {
        $value = addslashes($value);
        $value = str_replace(array('&#039;', '&#39;'), "\\'", $value);
    }
    if (isset($params['trimColon']) && !$params['trimColon']) {
        return $value;
    } elseif ($params['label'] == '0') {
        return translate("DEFAULT", $module);
    } else {
        return preg_replace("/([:]|:)[\\s]*\$/", "", $value);
    }
}
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:39,代码来源:function.sugar_translate.php


示例8: action_get_user_admin_page

/**
 * set the html for user admin page
 * this function is registered in xajax
 * @return xajaxResponse every xajax registered function needs to return this object
 */
function action_get_user_admin_page()
{
    global $logging;
    global $user;
    global $user_admin_table_configuration;
    global $user_start_time_array;
    $logging->info("USER_ACTION " . __METHOD__ . " (user=" . $user->get_name() . ")");
    # store start time
    $user_start_time_array[__METHOD__] = microtime(TRUE);
    # create necessary objects
    $result = new Result();
    $response = new xajaxResponse();
    $html_database_table = new HtmlDatabaseTable($user_admin_table_configuration);
    # set page, title, explanation and navigation
    $response->assign("page_title", "innerHTML", translate("LABEL_USER_ADMIN_TITLE"));
    $response->assign("navigation_container", "innerHTML", get_page_navigation(PAGE_TYPE_USER_ADMIN));
    $html_database_table->get_page(translate("LABEL_USER_ADMIN_TITLE"), $result);
    $response->assign("main_body", "innerHTML", $result->get_result_str());
    # set content
    $html_database_table->get_content($user, HTML_NO_LIST_PERMISSION_CHECK, "", DATABASETABLE_UNKWOWN_PAGE, $result);
    $response->custom_response->assign_with_effect(PORTAL_CSS_NAME_PREFIX . "content_pane", $result->get_result_str());
    # set action pane
    $html_str = $html_database_table->get_action_bar(USER_TABLE_NAME, "");
    $response->custom_response->assign_and_show("action_pane", $html_str);
    # set footer
    $response->assign("footer_text", "innerHTML", "&nbsp;");
    # check post conditions
    if (check_postconditions($result, $response) == FALSE) {
        return $response;
    }
    # log total time for this function
    $logging->info(get_function_time_str(__METHOD__));
    return $response;
}
开发者ID:jzp74,项目名称:firstthingsfirst,代码行数:39,代码来源:Html.UserAdministration.php


示例9: action_savelanguages

 public function action_savelanguages()
 {
     global $sugar_config;
     $toDecode = html_entity_decode($_REQUEST['disabled_langs'], ENT_QUOTES);
     $disabled_langs = json_decode($toDecode);
     $toDecode = html_entity_decode($_REQUEST['enabled_langs'], ENT_QUOTES);
     $enabled_langs = json_decode($toDecode);
     if (count($sugar_config['languages']) === count($disabled_langs)) {
         sugar_die(translate('LBL_CAN_NOT_DISABLE_ALL_LANG'));
     } else {
         $cfg = new Configurator();
         if (in_array($sugar_config['default_language'], $disabled_langs)) {
             reset($enabled_langs);
             $cfg->config['default_language'] = current($enabled_langs);
         }
         if (in_array($GLOBALS['current_user']->preferred_language, $disabled_langs)) {
             $GLOBALS['current_user']->preferred_language = current($enabled_langs);
             $GLOBALS['current_user']->save();
         }
         $cfg->config['disabled_languages'] = join(',', $disabled_langs);
         // TODO: find way to enforce order
         $cfg->handleOverride();
         // Clear the metadata cache so changes to languages are picked up right away
         MetaDataManager::refreshLanguagesCache($enabled_langs);
         require_once 'modules/Administration/QuickRepairAndRebuild.php';
         $repair = new RepairAndClear();
         $repair->clearLanguageCache();
     }
     //Call Ping API to refresh the language list.
     die("\n            <script>\n            var app = window.parent.SUGAR.App;\n            app.api.call('read', app.api.buildURL('ping'));\n            app.router.navigate('#bwc/index.php?module=Administration&action=Languages', {trigger:true, replace:true});\n            </script>");
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:31,代码来源:controller.php


示例10: action_get_user_settings_page

/**
 * set the html for user settings page
 * this function is registered in xajax
 * @return xajaxResponse every xajax registered function needs to return this object
 */
function action_get_user_settings_page()
{
    global $logging;
    global $user;
    global $user_settings_table_configuration;
    global $firstthingsfirst_portal_title;
    global $user_start_time_array;
    $logging->info("USER_ACTION " . __METHOD__ . " (user=" . $user->get_name() . ")");
    # store start time
    $user_start_time_array[__METHOD__] = microtime(TRUE);
    # create necessary objects
    $result = new Result();
    $response = new xajaxResponse();
    $html_database_table = new HtmlDatabaseTable($user_settings_table_configuration);
    # create an array with selection of fields that user may change
    $db_fields_array = array(DB_ID_FIELD_NAME, USER_NAME_FIELD_NAME, USER_PW_FIELD_NAME, USER_LANG_FIELD_NAME, USER_DATE_FORMAT_FIELD_NAME, USER_DECIMAL_MARK_FIELD_NAME, USER_LINES_PER_PAGE_FIELD_NAME, USER_THEME_FIELD_NAME);
    $user_record_key_string = DatabaseTable::_get_encoded_key_string(array(DB_ID_FIELD_NAME => $user->get_id()));
    # set page, title, explanation and navigation
    $response->assign("page_title", "innerHTML", translate("LABEL_USER_SETTINGS_TITLE"));
    $response->assign("navigation_container", "innerHTML", get_page_navigation(PAGE_TYPE_USER_SETTINGS));
    $html_database_table->get_page(translate("LABEL_USER_SETTINGS_TITLE"), $result);
    $response->assign("main_body", "innerHTML", $result->get_result_str());
    # get action pane for current user
    $html_database_table->get_record($user, USER_TABLE_NAME, $user_record_key_string, $db_fields_array, $result);
    $response->custom_response->assign_with_effect("action_pane", $result->get_result_str());
    # set footer
    $response->assign("footer_text", "innerHTML", "&nbsp;");
    # check post conditions
    if (check_postconditions($result, $response) == FALSE) {
        return $response;
    }
    # log total time for this function
    $logging->info(get_function_time_str(__METHOD__));
    return $response;
}
开发者ID:jzp74,项目名称:firstthingsfirst,代码行数:40,代码来源:Html.UserSettings.php


示例11: __construct

 function __construct($data)
 {
     $guid = $data['guid'];
     $text = $data['text'];
     $chat_message = new Chatmessage();
     $chat_message->text = $text;
     $chat_message->owner_guid = getLoggedInUserGuid();
     $chat_message->container_guid = $guid;
     $chat_message->save();
     // If recipient is offline, send them an email
     $chat = getEntity($guid);
     if (getLoggedInUserGuid() == $chat->user_one) {
         $recipient_guid = $chat->user_two;
     } else {
         $recipient_guid = $chat->user_one;
     }
     $recipient = getEntity($recipient_guid);
     if ($recipient->online == "false") {
         $offline_chats = $recipient->offline_chats;
         if (!is_array($offline_chats)) {
             $offline_chats = array(getLoggedInUserGuid());
             $recipient->offline_chats = $offline_chats;
             $recipient->save();
         }
         if (!in_array(getLoggedInUserGuid(), $recipient->offline_chats)) {
             $recipient->offline_chats[] = getLoggedInUserGuid();
             $recipient->save();
         }
         $setting = $recipient->notify_offline_chat;
         if ($setting == "yes") {
             new Email(array("to" => array("name" => "", "email" => ""), "from" => array("name" => "", "email" => ""), "subject" => translate("offline_message_email_subject"), "body" => translate("offline_message_email_body"), "html" => true));
         }
     }
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:34,代码来源:AddChatMessageActionHandler.php


示例12: _getModuleTitleParams

 /**
  * @see SugarView::_getModuleTitleParams()
  */
 protected function _getModuleTitleParams($browserTitle = false)
 {
     global $mod_strings;
     $returnAction = 'DetailView';
     $returnModule = 'Users';
     $returnId = $GLOBALS['current_user']->id;
     $returnName = $GLOBALS['current_user']->full_name;
     if (!empty($_REQUEST['return_action']) && !empty($_REQUEST['return_module'])) {
         if ('Users' == $_REQUEST['return_module']) {
             if ('EditView' == $_REQUEST['return_action']) {
                 $returnAction = 'EditView';
             }
             if (!empty($_REQUEST['return_name'])) {
                 $returnName = $_REQUEST['return_name'];
             }
             if (!empty($_REQUEST['user_id'])) {
                 $returnId = $_REQUEST['user_id'];
             }
         }
     }
     $this->_returnId = $returnId;
     $iconPath = $this->getModuleTitleIconPath($this->module);
     $params = array();
     if (!empty($iconPath) && !$browserTitle) {
         $params[] = "<a href='index.php?module=Users&action=index'><!--not_in_theme!--><img src='{$iconPath}' alt='" . translate('LBL_MODULE_NAME', 'Users') . "' title='" . translate('LBL_MODULE_NAME', 'Users') . "' align='absmiddle'></a>";
     } else {
         $params[] = translate('LBL_MODULE_NAME', 'Users');
     }
     $params[] = "<a href='index.php?module={$returnModule}&action=EditView&record={$returnId}'>" . $returnName . "</a>";
     if ($returnAction == 'EditView') {
         $params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL'];
     }
     return $params;
 }
开发者ID:NALSS,项目名称:SuiteCRM,代码行数:37,代码来源:view.detail.php


示例13: parse_template_bean

 function parse_template_bean($string, $bean_name, &$focus)
 {
     $repl_arr = array();
     foreach ($focus->field_defs as $field_def) {
         if ($field_def['type'] == 'enum' && isset($field_def['options'])) {
             $translated = translate($field_def['options'], $bean_name, $focus->{$field_def}['name']);
             if (isset($translated) && !is_array($translated)) {
                 $repl_arr[strtolower($focus->module_dir) . "_" . $field_def['name']] = $translated;
             } else {
                 // unset enum field, make sure we have a match string to replace with ""
                 $repl_arr[strtolower($focus->module_dir) . "_" . $field_def['name']] = '';
             }
         } else {
             $repl_arr[strtolower($focus->module_dir) . "_" . $field_def['name']] = $focus->{$field_def}['name'];
         }
     }
     // end foreach()
     krsort($repl_arr);
     reset($repl_arr);
     foreach ($repl_arr as $name => $value) {
         if ($value != '' && is_string($value)) {
             $string = str_replace("\${$name}", $value, $string);
         } else {
             $string = str_replace("\${$name}", ' ', $string);
         }
     }
     return $string;
 }
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:28,代码来源:TemplateParser.php


示例14: get_list_view_data

 function get_list_view_data()
 {
     $data = parent::get_list_view_data();
     $data['VNAME'] = translate($this->vname, $this->custom_module);
     $data['NAMELINK'] = '<input class="checkbox" type="checkbox" name="remove[]" value="' . $this->id . '">&nbsp;&nbsp;<a href="index.php?module=Studio&action=wizard&wizard=EditCustomFieldsWizard&option=EditCustomField&record=' . $this->id . '" >';
     return $data;
 }
开发者ID:omusico,项目名称:windcrm,代码行数:7,代码来源:FieldsMetaData.php


示例15: display_conflict_between_objects

function display_conflict_between_objects($object_1, $object_2, $field_defs, $module_dir, $display_name)
{
    $mod_strings = return_module_language($GLOBALS['current_language'], 'OptimisticLock');
    $title = '<tr><td >&nbsp;</td>';
    $object1_row = '<tr class="oddListRowS1"><td><b>' . $mod_strings['LBL_YOURS'] . '</b></td>';
    $object2_row = '<tr class="evenListRowS1"><td><b>' . $mod_strings['LBL_IN_DATABASE'] . '</b></td>';
    $exists = false;
    foreach ($field_defs as $name => $ignore) {
        $value = $object_1[$name];
        // FIXME: Replace the comparison here with a function from SugarWidgets
        if (!is_scalar($value) || $name == 'team_name') {
            continue;
        }
        if ($value != $object_2->{$name} && !$object_2->{$name} instanceof Link) {
            $title .= '<td ><b>&nbsp;' . translate($field_defs[$name]['vname'], $module_dir) . '</b></td>';
            $object1_row .= '<td>&nbsp;' . $value . '</td>';
            $object2_row .= '<td>&nbsp;' . $object_2->{$name} . '</td>';
            $exists = true;
        }
    }
    if ($exists) {
        echo "<b>{$mod_strings['LBL_CONFLICT_EXISTS']}<a href='index.php?action=DetailView&module={$module_dir}&record={$object_1['id']}'  target='_blank'>{$display_name}</a> </b> <br><table  class='list view' border='0' cellspacing='0' cellpadding='2'>{$title}<td  >&nbsp;</td></tr>{$object1_row}<td><a href='index.php?&module=OptimisticLock&action=LockResolve&save=true'>{$mod_strings['LBL_ACCEPT_YOURS']}</a></td></tr>{$object2_row}<td><a href='index.php?&module={$object_2->module_dir}&action=DetailView&record={$object_2->id}'>{$mod_strings['LBL_ACCEPT_DATABASE']}</a></td></tr></table><br>";
    } else {
        echo "<b>{$mod_strings['LBL_RECORDS_MATCH']}</b><br>";
    }
}
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:26,代码来源:LockResolve.php


示例16: save

 public function save($id = null)
 {
     $this->load->helper('memberspace/authorization');
     $this->load->helper('flashmessages/flashmessages');
     $this->load->model('memberspace/user');
     $this->load->helper('form');
     $datas = array();
     if (isset($_POST) && isset($_POST['save-user'])) {
         $datas = $_POST;
         unset($_POST['save-user']);
         if (isset($_POST['id']) && $_POST['id']) {
             if (!user_can('update', 'user', $_POST['id'])) {
                 add_error(translate('Vous ne pouvez pas modifier cet utilisateur'));
             }
         } else {
             if (!user_can('add', 'user', $_POST['id'])) {
                 add_error(translate('Vous ne pouvez pas ajouter d\'utilisateur'));
             }
         }
         if ($this->user->fromPost() !== false) {
             add_success(translate('L\'utilisateur a bien été ajouté'));
             redirect('bo/users/all');
         } else {
             add_error($this->form_validation->error_string());
         }
     } else {
         if ($id) {
             $datas = $this->user->getId($id, 'array');
         }
     }
     return $datas;
 }
开发者ID:Cevantime,项目名称:site-core-modules,代码行数:32,代码来源:Users.php


示例17: init

 public function init()
 {
     $firstName = new Monkeys_Form_Element_Text('firstname');
     translate('First Name');
     $firstName->setLabel('First Name')->setRequired(true);
     $lastName = new Monkeys_Form_Element_Text('lastname');
     translate('Last Name');
     $lastName->setLabel('Last Name')->setRequired(true);
     $email = new Monkeys_Form_Element_Text('email');
     translate('E-mail');
     $email->setLabel('E-mail')->addFilter('StringToLower')->setRequired(true)->addValidator('EmailAddress');
     $username = new Monkeys_Form_Element_Text('username');
     translate('Username');
     $username->setLabel('Username')->addValidator(new Monkeys_Validate_Username())->setRequired(true);
     $password1 = new Monkeys_Form_Element_Password('password1');
     translate('Enter desired password');
     $passwordValidator = new Monkeys_Validate_Password();
     $password1->setLabel('Enter desired password')->setRequired(true)->addValidator(new Monkeys_Validate_PasswordConfirmation())->addValidator($passwordValidator);
     if ($restrictions = $passwordValidator->getPasswordRestrictionsDescription()) {
         $password1->setDescription($restrictions);
     }
     $password2 = new Monkeys_Form_Element_Password('password2');
     translate('Enter password again');
     $password2->setLabel('Enter password again')->setRequired(true);
     // ZF has some bugs when using mutators here, so I have to use the config array
     translate('Please enter the text below');
     $captcha = new Monkeys_Form_Element_Captcha('captcha', array('label' => 'Please enter the text below', 'captcha' => array('captcha' => 'Image', 'sessionClass' => get_class(Zend_Registry::get('appSession')), 'font' => APP_DIR . '/libs/Monkeys/fonts/Verdana.ttf', 'imgDir' => WEB_DIR . '/captchas', 'imgUrl' => $this->_baseWebDir . '/captchas', 'wordLen' => 4, 'fontSize' => 30, 'timeout' => 300)));
     $this->addElements(array($firstName, $lastName, $email, $username, $password1, $password2, $captcha));
 }
开发者ID:sdgdsffdsfff,项目名称:auth-center,代码行数:29,代码来源:Register.php


示例18: smarty_function_jquery_validation

function smarty_function_jquery_validation($params, &$smarty)
{
    // @codingStandardsIgnoreEnd
    // jquery validation rules that this plugin currently supports
    $supported_rules = array('required', 'email', 'digits', 'equalTo', 'phoneUS', 'mobileUK');
    $messages = array();
    $rules = array();
    foreach ($supported_rules as $rule) {
        if (isset($params[$rule])) {
            switch ($rule) {
                case 'equalTo':
                    $rules[] = "equalTo:'" . $params['equalToField'] . "'";
                    $messages[$rule] = translate($params[$rule]);
                    break;
                default:
                    $rules[] = "{$rule}:true";
                    $messages[$rule] = translate($params[$rule]);
                    break;
            }
        }
    }
    // format the output
    $output = '{' . implode(',', $rules) . ',messages:{';
    $first = true;
    foreach ($messages as $rule => $message) {
        if (!$first) {
            $output .= ',';
        }
        $output .= "{$rule}:'{$message}'";
        $first = false;
    }
    $output .= '}}';
    return $output;
}
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:34,代码来源:function.jquery_validation.php


示例19: displayList

 function displayList($layout_def)
 {
     global $app_strings;
     $return_module = $_REQUEST['module'];
     $return_id = $_REQUEST['record'];
     $module_name = $layout_def['module'];
     $record_id = $layout_def['fields']['ID'];
     // calls and meetings are held.
     $new_status = 'Held';
     switch ($module_name) {
         case 'Tasks':
             $new_status = 'Completed';
             break;
     }
     $subpanel = $layout_def['subpanel_id'];
     if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) {
         $linked_field = $layout_def['linked_field_set'];
     } else {
         $linked_field = $layout_def['linked_field'];
     }
     $refresh_page = 0;
     if (!empty($layout_def['refresh_page'])) {
         $refresh_page = 1;
     }
     $html = "<a onclick='return sp_del_conf();' href=\"javascript:sub_p_del('{$subpanel}', '{$module_name}', '{$record_id}', {$refresh_page});\">" . SugarThemeRegistry::current()->getImage("delete_inline", "alt=" . translate('LBL_LIST_DELETE', $module_name) . " border='0'") . "</a>";
     return $html;
 }
开发者ID:razorinc,项目名称:sugarcrm-example,代码行数:27,代码来源:SugarWidgetSubPanelDeleteButton.php


示例20: menu_list

/**
 * List items
 */
function menu_list($row_id = NULL, $search = NULL, $sort = NULL, $page = 1)
{
    $view = new ListView();
    // Row Id for update only row
    if (!empty($row_id)) {
        $row_id = 'id = ' . $row_id;
    } else {
        $row_id = 'id != 0';
    }
    // Sort
    if (empty($sort)) {
        $sort = 'id ASC';
    }
    $limit = PAGER_LIMIT;
    $offset = $page * $limit - $limit;
    $db = DataConnection::readOnly();
    $total_records = 0;
    // Search
    if (!empty($search)) {
        $search_fields = array('id', 'label', 'func', 'module');
        $exceptions = array();
        $search_query = build_search_query($search, $search_fields, $exceptions);
        $menus = $db->menu()->where($row_id)->and($search_query)->order($sort)->limit($limit, $offset);
    } else {
        $menus = $db->menu()->where($row_id)->order($sort)->limit($limit, $offset);
    }
    $total_records = $db->menu()->count("*");
    $i = 0;
    if (count($menus)) {
        // Building the header with sorter
        $headers[] = array('display' => 'Id', 'field' => 'id');
        $headers[] = array('display' => 'Label', 'field' => 'label');
        $headers[] = array('display' => 'Function', 'field' => 'func');
        $headers[] = array('display' => 'Module', 'field' => 'module');
        $headers[] = array('display' => 'Edit', 'field' => NULL);
        $headers[] = array('display' => 'Delete', 'field' => NULL);
        $headers = build_sort_header('menu_list', 'menu', $headers, $sort);
        foreach ($menus as $menu) {
            $j = $i + 1;
            //This is important for the row update/delete
            $rows[$j]['row_id'] = $menu['id'];
            /////////////////////////////////////////////
            $rows[$j]['id'] = $menu['id'];
            $rows[$j]['label'] = $menu['label'];
            $rows[$j]['func'] = $menu['func'];
            $rows[$j]['module'] = $menu['module'];
            if ($menu['system'] == 1) {
                $disabled = 'disabled';
            } else {
                $disabled = '';
            }
            $rows[$j]['edit'] = theme_link_process_information('', 'menu_edit_form', 'menu_edit_form', 'menu', array('extra_value' => 'id|' . $menu['id'], 'response_type' => 'modal', 'icon' => NATURAL_EDIT_ICON, 'class' => $disabled));
            $rows[$j]['delete'] = theme_link_process_information('', 'menu_delete_form', 'menu_delete_form', 'menu', array('extra_value' => 'id|' . $menu['id'], 'response_type' => 'modal', 'icon' => NATURAL_REMOVE_ICON, 'class' => $disabled));
            $i++;
        }
    }
    $options = array('show_headers' => TRUE, 'page_title' => translate('Users List'), 'page_subtitle' => translate('Manage Menus'), 'empty_message' => translate('No menu found!'), 'table_prefix' => theme_link_process_information(translate('Create New Menu'), 'menu_create_form', 'menu_create_form', 'menu', array('response_type' => 'modal')), 'pager_items' => build_pager('menu_list', 'menu', $total_records, $limit, $page), 'page' => $page, 'sort' => $sort, 'search' => $search, 'show_search' => TRUE, 'function' => 'menu_list', 'module' => 'menu', 'update_row_id' => '', 'table_form_id' => '', 'table_form_process' => '');
    $listview = $view->build($rows, $headers, $options);
    return $listview;
}
开发者ID:enettolima,项目名称:mvno-platform,代码行数:63,代码来源:menu.controller.php



注:本文中的translate函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP translateFN函数代码示例发布时间:2022-05-23
下一篇:
PHP transformFileSize函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap