/** * allow upload mimes type * @hook upload_mimes * @param array $existing_mimes * @return array */ public function _custom_upload_mimes($existing_mimes = array()) { $mimes = hw_list_mines_type(); $allow_uploadfile_type = hw_get_setting('allow_uploadfile_type'); // add your extension to the array, add as many as you like foreach ($mimes as $mime_type => $ext) { if (isset($allow_uploadfile_type[$mime_type]) && $allow_uploadfile_type[$mime_type]) { $existing_mimes[$mime_type] = $ext; } } // removing existing file types //unset( $existing_mimes['exe'] ); // and return the new full result return $existing_mimes; }
/** * general tab * @param $oAdminPage AdminPageFramework * @param $tab_id */ private function setUp_tab_general($oAdminPage, $tab_id) { /** * general tab */ //$post_types = get_post_types( '', 'names' ); //custom menu labels tip $custom_admin_menu_tip = '<ul>'; if (function_exists('is_plugin_active') && is_plugin_active('adminimize/adminimize.php')) { $custom_admin_menu_tip .= '<li>Truy cập <a href="' . admin_url('options-general.php?page=adminimize/adminimize.php') . '" target="_blank">vào đây</a> để tùy biến.</li>'; } else { $custom_admin_menu_tip = '<li>Kích hoạt plugin ' . hw_install_plugin_link('adminimize/adminimize.php', '<em>adminimize</em>') . ' để tùy biến.</li>'; } if (function_exists('is_plugin_active') && is_plugin_active('admin-menu-editor/menu-editor.php')) { $custom_admin_menu_tip .= '<li>Truy cập <a href="' . admin_url('options-general.php?page=menu_editor') . '" target="_blank">vào đây</a> để tùy biến.</li>'; } else { $custom_admin_menu_tip .= '<li>Kích hoạt plugin ' . hw_install_plugin_link('admin-menu-editor/menu-editor.php', '<em>adminimize</em>') . ' để tùy biến.</li>'; } $custom_admin_menu_tip .= '</ul>'; $tab = $this->get_tabs($tab_id); $oAdminPage->addSettingSections(self::HW_SETTINGS_PAGE, array('section_id' => $tab_id, 'title' => $tab['title'], 'description' => $tab['description'], 'section_tab_slug' => 'setting_tabs', 'repeatable' => false)); $oAdminPage->addSettingFields($tab_id, array('field_id' => 'enable_developer_feature', 'type' => 'checkbox', 'title' => 'Kích hoạt tính năng phát triển', 'description' => 'Hiển thị các tính năng nâng cao dành cho Developer.' . $custom_admin_menu_tip), array('field_id' => 'match_occurence', 'type' => 'select', 'title' => 'Phát hiện điều kiện.', 'label' => array('first_occurence' => __('Điều kiện đầu tiên'), 'last_occurence' => __('Điều kiện sau cùng'))), array('field_id' => 'allow_uploadfile_type', 'type' => 'checkbox', 'title' => 'Cho phép upload kiểu tệp', 'description' => 'Hiển thị các tính năng nâng cao dành cho Developer.', 'label' => hw_list_mines_type(), 'select_all_button' => true, 'select_none_button' => true), array('field_id' => 'submit', 'type' => 'submit', 'label' => 'Lưu lại', 'show_title_column' => false)); }