A simple log recording action on the background of a website, similar to the UC language pack-PHP source code

Source: Internet
Author: User
A simple log record action on the background of a website, similar to the lang_message language pack function of UC. with this function, you can easily manage categories.

Public function lang_message () {return $ _ action = array (// login 'login' => array ('action' => 'login ', 'Body' => 'logged on to the background system'), 'login _ out' => array ('action' => 'logout ', 'Body' => 'Exit the background system'), // CRM 'CRM _ update_user_status '=> array ('action' => 'modify account status ', 'Body' => 'changed the account status of member \ 1 from \ 2 to \ 3 '), 'CRM _ update_user_bank '=> array ('action' => 'modify withdrawal account', 'body' => 'modify withdrawal account information of member \ 1 '), 'CRM _ update_user_remark' => array ('action' => 'Add follow-up ', 'body' =>' add follow-up information for member \ 1 '), 'CRM _ update_user_info '=> array ('action' => 'modify personal information', 'body' => 'modify personal information of member \ 1 '), 'CRM _ del_user_public '=> array ('action' => 'release resource', 'body' =>' releases Members \ 1 to the high seas '), 'CRM _ add_user' => array ('action' => 'Add customer', 'body' => 'new customer' added '), 'CRM _ add_public_user '=> array ('action' => 'allocate resource', 'body' =>' allocating high seas resources \ 1 to \ 2 '), // app 'app _ check_yes '=> array ('action' => 'approved', 'body' => 'approved \ 1 application '), 'app _ check_no '=> array ('action' => 'Audit denied', 'body' => 'Audit denied \ 1 application '), 'app _ low' => array ('action' => 'download', 'body' => 'downloaded \ 1 applications '), 'app _ update_assign' => array ('action' => 'modify application', 'body' => 'modified application \ 1 allocation settings '), 'app _ update_ad_assign '=> array ('action' => 'modify application', 'body' =>' modified the additive allocation settings of application \ 1 '), 'app _ add_sort '=> array ('action' => 'Add application', 'body' =>' added \ 1 app category '), 'app _ update_sort '=> array ('action' => 'modify category', 'body' =>' modified the application category name \ 1 to \ 2 '), 'app _ del_sort '=> array ('action' => 'Delete category', 'body' =>' deleted \ 1 app category '), // system_user 'system _ add_user '=> array ('action' => 'Add user ', 'Body' => 'added the \ 1 user \ 2 '), 'system _ update_user_info '=> array ('action' => 'modify user information', 'body' => 'modify user information '), // system_permission 'system _ update_permission '=> array ('action' => 'modify authorization', 'body' =>' modified \ 1 permission information '), 'system _ add_permission_group '=> array ('action' => 'Add permission group', 'body' =>' added \ 1 permission group '), 'system _ add_child_permission' => array ('action' => 'Add subauthorization ', 'Body' => 'added the sub-permission \ 2' to the permission Group \ 1 '), 'system _ update_all_user_permission '=> array ('action' => 'update user group authorization', 'body' => 'update all user group authorization '), 'system _ del_permission' => array ('action' => 'Delete authorization ', 'Body' => 'The \ 1 permission and the sub-permissions under this permission are deleted '), 'system _ add_identity '=> array ('action' => 'Add role', 'body' => 'added a user role named \ 1 '), // system_menu 'system _ add_menu '=> array ('action' => 'Add menu', 'body' => 'added menu \ 1 '), 'system _ add_child_menu '=> array ('action' => 'Add submenus ', 'Body' => 'added sub menu \ 2' to menu \ 1), 'system _ update_menu' => array ('action' => 'Edit menu ', 'Body' => 'edited menu \ 1'), 'system _ del_menu' => array ('action' => 'Delete menu ', 'Body' => 'deleted menu \ 1'), // cache 'system _ update_cache' => array ('action' => 'update cache ', 'Body' => 'updated background cache'), 'system _ del_log '=> array ('action' => 'Delete log ', 'Body' => 'deleted \ 1 system operation log '),);}

Language substitution function, simple and effective

// Language replacement private function lang_replace ($ text, $ vars) {if ($ vars) {foreach ($ vars as $ k => $ v) {$ rk = $ k + 1; $ text = str_replace ('\\'. $ rk, $ v, $ text) ;}return $ text ;}

Define action and call language packs

public function addSystemLog($action,$values){   $message = $this->lang_replace($lan_message[$action]['body'], $values);}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.