Perf: Optimize page loading of CSS.

This commit is contained in:
Laurent Destailleur 2010-03-13 16:27:11 +00:00
parent 8ce5c5b66e
commit ef5d9dbc9b
6 changed files with 74 additions and 53 deletions

View File

@ -23,15 +23,17 @@
* \version $Id$ * \version $Id$
*/ */
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url.
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // We need to use translation files to know direction if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); if (! defined('NOLOGIN')) define('NOLOGIN',1);
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
//require_once("../../conf/conf.php");
require_once("../../master.inc.php"); require_once("../../master.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/functions.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/functions.lib.php");

View File

@ -24,25 +24,29 @@
* \version $Id$ * \version $Id$
*/ */
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url.
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // We need to use translation files to know direction if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); if (! defined('NOLOGIN')) define('NOLOGIN',1);
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
//require_once("../../conf/conf.php");
require_once("../../master.inc.php"); require_once("../../master.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/functions.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/functions.lib.php");
// Define css type // Define css type
header('Content-type: text/css'); header('Content-type: text/css');
// Important: Avoid page request by browser and dynamic build at // Important: Following code is to avoid page request by browser and PHP CPU at
// each Dolibarr page access. // each Dolibarr page access.
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
else header('Cache-Control: no-cache'); else header('Cache-Control: no-cache');
if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]); // If language was forced on URL by the main.inc.php if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]); // If language was forced on URL by the main.inc.php
$langs->load("main",0,1); $langs->load("main",0,1);
$right=($langs->direction=='rtl'?'left':'right'); $right=($langs->direction=='rtl'?'left':'right');

View File

@ -24,21 +24,24 @@
* \version $Id$ * \version $Id$
*/ */
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url.
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // We need to use translation files to know direction if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); if (! defined('NOLOGIN')) define('NOLOGIN',1);
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
//require_once("../../conf/conf.php");
require_once("../../master.inc.php"); require_once("../../master.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/functions.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/functions.lib.php");
// Define css type // Define css type
header('Content-type: text/css'); header('Content-type: text/css');
// Important: Avoid page request by browser and dynamic build at // Important: Following code is to avoid page request by browser and PHP CPU at
// each Dolibarr page access. // each Dolibarr page access.
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
else header('Cache-Control: no-cache'); else header('Cache-Control: no-cache');

View File

@ -23,25 +23,29 @@
* \version $Id$ * \version $Id$
*/ */
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url.
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // We need to use translation files to know direction if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); if (! defined('NOLOGIN')) define('NOLOGIN',1);
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
//require_once("../../conf/conf.php");
require_once("../../master.inc.php"); require_once("../../master.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/functions.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/functions.lib.php");
// Define css type // Define css type
header('Content-type: text/css'); header('Content-type: text/css');
// Important: Avoid page request by browser and dynamic build at // Important: Following code is to avoid page request by browser and PHP CPU at
// each Dolibarr page access. // each Dolibarr page access.
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
else header('Cache-Control: no-cache'); else header('Cache-Control: no-cache');
if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]); // If language was forced on URL by the main.inc.php if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]); // If language was forced on URL by the main.inc.php
$langs->load("main",0,1); $langs->load("main",0,1);
$right=($langs->direction=='rtl'?'left':'right'); $right=($langs->direction=='rtl'?'left':'right');

View File

@ -24,25 +24,29 @@
* \version $Id$ * \version $Id$
*/ */
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url.
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // We need to use translation files to know direction if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); if (! defined('NOLOGIN')) define('NOLOGIN',1);
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
//require_once("../../conf/conf.php");
require_once("../../master.inc.php"); require_once("../../master.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/functions.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/functions.lib.php");
// Define css type // Define css type
header('Content-type: text/css'); header('Content-type: text/css');
// Important: Avoid page request by browser and dynamic build at // Important: Following code is to avoid page request by browser and PHP CPU at
// each Dolibarr page access. // each Dolibarr page access.
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
else header('Cache-Control: no-cache'); else header('Cache-Control: no-cache');
if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]); // If language was forced on URL by the main.inc.php if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]); // If language was forced on URL by the main.inc.php
$langs->load("main",0,1); $langs->load("main",0,1);
$right=($langs->direction=='rtl'?'left':'right'); $right=($langs->direction=='rtl'?'left':'right');

View File

@ -23,25 +23,29 @@
* \version $Id$ * \version $Id$
*/ */
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url.
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // We need to use translation files to know direction if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); if (! defined('NOLOGIN')) define('NOLOGIN',1);
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
//require_once("../../conf/conf.php");
require_once("../../master.inc.php"); require_once("../../master.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/functions.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/functions.lib.php");
// Define css type // Define css type
header('Content-type: text/css'); header('Content-type: text/css');
// Important: Avoid page request by browser and dynamic build at // Important: Following code is to avoid page request by browser and PHP CPU at
// each Dolibarr page access. // each Dolibarr page access.
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
else header('Cache-Control: no-cache'); else header('Cache-Control: no-cache');
if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]); // If language was forced on URL by the main.inc.php if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]); // If language was forced on URL by the main.inc.php
$langs->load("main",0,1); $langs->load("main",0,1);
$right=($langs->direction=='rtl'?'left':'right'); $right=($langs->direction=='rtl'?'left':'right');