Dotclear


Ignore:
Timestamp:
03/08/18 17:58:39 (8 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Code formatting (PSR-2)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/public/prepend.php

    r3260 r3730  
    1212 
    1313if (!empty($_GET['pf'])) { 
    14      require dirname(__FILE__).'/../load_plugin_file.php'; 
    15      exit; 
     14    require dirname(__FILE__) . '/../load_plugin_file.php'; 
     15    exit; 
    1616} 
    1717 
    1818if (!empty($_GET['vf'])) { 
    19      require dirname(__FILE__).'/../load_var_file.php'; 
    20      exit; 
     19    require dirname(__FILE__) . '/../load_var_file.php'; 
     20    exit; 
    2121} 
    2222 
    2323if (!isset($_SERVER['PATH_INFO'])) { 
    24      $_SERVER['PATH_INFO'] = ''; 
     24    $_SERVER['PATH_INFO'] = ''; 
    2525} 
    2626 
    27 require_once dirname(__FILE__).'/../prepend.php'; 
    28 require_once dirname(__FILE__).'/rs.extension.php'; 
     27require_once dirname(__FILE__) . '/../prepend.php'; 
     28require_once dirname(__FILE__) . '/rs.extension.php'; 
    2929 
    3030# Loading blog 
    3131if (defined('DC_BLOG_ID')) { 
    32      try { 
    33           $core->setBlog(DC_BLOG_ID); 
    34      } catch (Exception $e) { 
    35           init_prepend_l10n(); 
    36           __error(__('Database problem') 
    37                ,DC_DEBUG ? 
    38                     __('The following error was encountered while trying to read the database:').'</p><ul><li>'.$e->getMessage().'</li></ul>' : 
    39                     __('Something went wrong while trying to read the database.') 
    40                ,620); 
    41      } 
     32    try { 
     33        $core->setBlog(DC_BLOG_ID); 
     34    } catch (Exception $e) { 
     35        init_prepend_l10n(); 
     36        __error(__('Database problem') 
     37            , DC_DEBUG ? 
     38            __('The following error was encountered while trying to read the database:') . '</p><ul><li>' . $e->getMessage() . '</li></ul>' : 
     39            __('Something went wrong while trying to read the database.') 
     40            , 620); 
     41    } 
    4242} 
    4343 
    4444if ($core->blog->id == null) { 
    45      __error(__('Blog is not defined.') 
    46           ,__('Did you change your Blog ID?') 
    47           ,630); 
     45    __error(__('Blog is not defined.') 
     46        , __('Did you change your Blog ID?') 
     47        , 630); 
    4848} 
    4949 
    50 if ((boolean)!$core->blog->status) { 
    51      $core->unsetBlog(); 
    52      __error(__('Blog is offline.') 
    53           ,__('This blog is offline. Please try again later.') 
    54           ,670); 
     50if ((boolean) !$core->blog->status) { 
     51    $core->unsetBlog(); 
     52    __error(__('Blog is offline.') 
     53        , __('This blog is offline. Please try again later.') 
     54        , 670); 
    5555} 
    5656 
    5757# Loading media 
    5858try { 
    59      $core->media = new dcMedia($core); 
     59    $core->media = new dcMedia($core); 
    6060} catch (Exception $e) {} 
    6161 
     
    6363$_ctx = new context(); 
    6464try { 
    65      $core->tpl = new dcTemplate(DC_TPL_CACHE,'$core->tpl',$core); 
     65    $core->tpl = new dcTemplate(DC_TPL_CACHE, '$core->tpl', $core); 
    6666} catch (Exception $e) { 
    67      __error(__('Can\'t create template files.') 
    68           ,$e->getMessage() 
    69           ,640); 
     67    __error(__('Can\'t create template files.') 
     68        , $e->getMessage() 
     69        , 640); 
    7070} 
    7171 
    7272# Loading locales 
    7373$_lang = $core->blog->settings->system->lang; 
    74 $_lang = preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$_lang) ? $_lang : 'en'; 
     74$_lang = preg_match('/^[a-z]{2}(-[a-z]{2})?$/', $_lang) ? $_lang : 'en'; 
    7575 
    7676l10n::lang($_lang); 
    77 if (l10n::set(dirname(__FILE__).'/../../locales/'.$_lang.'/date') === false && $_lang != 'en') { 
    78      l10n::set(dirname(__FILE__).'/../../locales/en/date'); 
     77if (l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/date') === false && $_lang != 'en') { 
     78    l10n::set(dirname(__FILE__) . '/../../locales/en/date'); 
    7979} 
    80 l10n::set(dirname(__FILE__).'/../../locales/'.$_lang.'/public'); 
    81 l10n::set(dirname(__FILE__).'/../../locales/'.$_lang.'/plugins'); 
     80l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/public'); 
     81l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/plugins'); 
    8282 
    8383// Set lexical lang 
    84 dcUtils::setlexicalLang('public',$_lang); 
     84dcUtils::setlexicalLang('public', $_lang); 
    8585 
    8686# Loading plugins 
    8787try { 
    88      $core->plugins->loadModules(DC_PLUGINS_ROOT,'public',$_lang); 
     88    $core->plugins->loadModules(DC_PLUGINS_ROOT, 'public', $_lang); 
    8989} catch (Exception $e) {} 
    9090 
     
    9595# Defining theme if not defined 
    9696if (!isset($__theme)) { 
    97      $__theme = $core->blog->settings->system->theme; 
     97    $__theme = $core->blog->settings->system->theme; 
    9898} 
    9999 
    100100if (!$core->themes->moduleExists($__theme)) { 
    101      $__theme = $core->blog->settings->system->theme = 'default'; 
     101    $__theme = $core->blog->settings->system->theme = 'default'; 
    102102} 
    103103 
    104 $__parent_theme = $core->themes->moduleInfo($__theme,'parent'); 
     104$__parent_theme = $core->themes->moduleInfo($__theme, 'parent'); 
    105105if ($__parent_theme) { 
    106      if (!$core->themes->moduleExists($__parent_theme)) { 
    107           $__theme = $core->blog->settings->system->theme = 'default'; 
    108           $__parent_theme = null; 
    109      } 
     106    if (!$core->themes->moduleExists($__parent_theme)) { 
     107        $__theme        = $core->blog->settings->system->theme        = 'default'; 
     108        $__parent_theme = null; 
     109    } 
    110110} 
    111111 
    112112# If theme doesn't exist, stop everything 
    113113if (!$core->themes->moduleExists($__theme)) { 
    114      __error(__('Default theme not found.') 
    115           ,__('This either means you removed your default theme or set a wrong theme '. 
    116           'path in your blog configuration. Please check theme_path value in '. 
    117           'about:config module or reinstall default theme. ('.$__theme.')') 
    118           ,650); 
     114    __error(__('Default theme not found.') 
     115        , __('This either means you removed your default theme or set a wrong theme ' . 
     116            'path in your blog configuration. Please check theme_path value in ' . 
     117            'about:config module or reinstall default theme. (' . $__theme . ')') 
     118        , 650); 
    119119} 
    120120 
    121121# Loading _public.php file for selected theme 
    122 $core->themes->loadNsFile($__theme,'public'); 
     122$core->themes->loadNsFile($__theme, 'public'); 
    123123 
    124124# Loading translations for selected theme 
    125125if ($__parent_theme) { 
    126      $core->themes->loadModuleL10N($__parent_theme,$_lang,'main'); 
     126    $core->themes->loadModuleL10N($__parent_theme, $_lang, 'main'); 
    127127} 
    128 $core->themes->loadModuleL10N($__theme,$_lang,'main'); 
     128$core->themes->loadModuleL10N($__theme, $_lang, 'main'); 
    129129 
    130130# --BEHAVIOR-- publicPrepend 
    131 $core->callBehavior('publicPrepend',$core); 
     131$core->callBehavior('publicPrepend', $core); 
    132132 
    133133# Prepare the HTTP cache thing 
    134134$mod_files = get_included_files(); 
    135 $mod_ts = array(); 
    136 $mod_ts[] = $core->blog->upddt; 
     135$mod_ts    = array(); 
     136$mod_ts[]  = $core->blog->upddt; 
    137137 
    138138$__theme_tpl_path = array( 
    139      $core->blog->themes_path.'/'.$__theme.'/tpl' 
     139    $core->blog->themes_path . '/' . $__theme . '/tpl' 
    140140); 
    141141if ($__parent_theme) { 
    142      $__theme_tpl_path[] = $core->blog->themes_path.'/'.$__parent_theme.'/tpl'; 
     142    $__theme_tpl_path[] = $core->blog->themes_path . '/' . $__parent_theme . '/tpl'; 
    143143} 
    144 $tplset = $core->themes->moduleInfo($core->blog->settings->system->theme,'tplset'); 
    145 if (!empty($tplset) && is_dir(dirname(__FILE__).'/default-templates/'.$tplset)) { 
    146      $core->tpl->setPath( 
    147           $__theme_tpl_path, 
    148           dirname(__FILE__).'/default-templates/'.$tplset, 
    149           $core->tpl->getPath()); 
     144$tplset = $core->themes->moduleInfo($core->blog->settings->system->theme, 'tplset'); 
     145if (!empty($tplset) && is_dir(dirname(__FILE__) . '/default-templates/' . $tplset)) { 
     146    $core->tpl->setPath( 
     147        $__theme_tpl_path, 
     148        dirname(__FILE__) . '/default-templates/' . $tplset, 
     149        $core->tpl->getPath()); 
    150150} else { 
    151      $core->tpl->setPath( 
    152           $__theme_tpl_path, 
    153           $core->tpl->getPath()); 
     151    $core->tpl->setPath( 
     152        $__theme_tpl_path, 
     153        $core->tpl->getPath()); 
    154154} 
    155155$core->url->mode = $core->blog->settings->system->url_scan; 
    156156 
    157157try { 
    158      # --BEHAVIOR-- publicBeforeDocument 
    159      $core->callBehavior('publicBeforeDocument',$core); 
     158    # --BEHAVIOR-- publicBeforeDocument 
     159    $core->callBehavior('publicBeforeDocument', $core); 
    160160 
    161      $core->url->getDocument(); 
     161    $core->url->getDocument(); 
    162162 
    163      # --BEHAVIOR-- publicAfterDocument 
    164      $core->callBehavior('publicAfterDocument',$core); 
     163    # --BEHAVIOR-- publicAfterDocument 
     164    $core->callBehavior('publicAfterDocument', $core); 
    165165} catch (Exception $e) { 
    166      __error($e->getMessage() 
    167           ,__('Something went wrong while loading template file for your blog.') 
    168           ,660); 
     166    __error($e->getMessage() 
     167        , __('Something went wrong while loading template file for your blog.') 
     168        , 660); 
    169169} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map