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
  • admin/plugin.php

    r3333 r3730  
    1111# -- END LICENSE BLOCK ----------------------------------------- 
    1212 
    13 require dirname(__FILE__).'/../inc/admin/prepend.php'; 
     13require dirname(__FILE__) . '/../inc/admin/prepend.php'; 
    1414 
    1515dcPage::check('usage,contentadmin'); 
    1616 
    1717$p_file = ''; 
    18 $p = !empty($_REQUEST['p']) ? $_REQUEST['p'] : null; 
    19 $popup = (integer) !empty($_REQUEST['popup']); 
     18$p      = !empty($_REQUEST['p']) ? $_REQUEST['p'] : null; 
     19$popup  = (integer) !empty($_REQUEST['popup']); 
    2020 
    2121if ($popup) { 
    22      $open_f = array('dcPage','openPopup'); 
    23      $close_f = array('dcPage','closePopup'); 
     22    $open_f  = array('dcPage', 'openPopup'); 
     23    $close_f = array('dcPage', 'closePopup'); 
    2424} else { 
    25      $open_f = array('dcPage','open'); 
    26      $close_f = array('dcPage','close'); 
     25    $open_f  = array('dcPage', 'open'); 
     26    $close_f = array('dcPage', 'close'); 
    2727} 
    2828 
    2929if ($core->plugins->moduleExists($p)) { 
    30      $p_file = $core->plugins->moduleRoot($p).'/index.php'; 
     30    $p_file = $core->plugins->moduleRoot($p) . '/index.php'; 
    3131} 
    3232 
    33 if (file_exists($p_file)) 
    34 { 
    35      # Loading plugin 
    36      $p_info = $core->plugins->getModules($p); 
     33if (file_exists($p_file)) { 
     34    # Loading plugin 
     35    $p_info = $core->plugins->getModules($p); 
    3736 
    38      $p_name = $p; 
    39      $p_url = 'plugin.php?p='.$p; 
     37    $p_name = $p; 
     38    $p_url  = 'plugin.php?p=' . $p; 
    4039 
    41      $p_title = 'no content - plugin'; 
    42      $p_head = ''; 
    43      $p_content = '<p>'.__('No content found on this plugin.').'</p>'; 
     40    $p_title  = 'no content - plugin'; 
     41    $p_head    = ''; 
     42    $p_content = '<p>' . __('No content found on this plugin.') . '</p>'; 
    4443 
    45      ob_start(); 
    46      include $p_file; 
    47      $res = ob_get_contents(); 
    48      ob_end_clean(); 
     44    ob_start(); 
     45    include $p_file; 
     46    $res = ob_get_contents(); 
     47    ob_end_clean(); 
    4948 
    50      if (preg_match('|<head>(.*?)</head|ms',$res,$m)) { 
    51           if (preg_match('|<title>(.*?)</title>|ms',$m[1],$mt)) { 
    52                $p_title = $mt[1]; 
    53           } 
     49    if (preg_match('|<head>(.*?)</head|ms', $res, $m)) { 
     50        if (preg_match('|<title>(.*?)</title>|ms', $m[1], $mt)) { 
     51            $p_title = $mt[1]; 
     52        } 
    5453 
    55           if (preg_match_all('|(<script.*?>.*?</script>)|ms',$m[1],$ms)) { 
    56                foreach ($ms[1] as $v) { 
    57                     $p_head .= $v."\n"; 
    58                } 
    59           } 
     54        if (preg_match_all('|(<script.*?>.*?</script>)|ms', $m[1], $ms)) { 
     55            foreach ($ms[1] as $v) { 
     56                $p_head .= $v . "\n"; 
     57            } 
     58        } 
    6059 
    61           if (preg_match_all('|(<style.*?>.*?</style>)|ms',$m[1],$ms)) { 
    62                foreach ($ms[1] as $v) { 
    63                     $p_head .= $v."\n"; 
    64                } 
    65           } 
     60        if (preg_match_all('|(<style.*?>.*?</style>)|ms', $m[1], $ms)) { 
     61            foreach ($ms[1] as $v) { 
     62                $p_head .= $v . "\n"; 
     63            } 
     64        } 
    6665 
    67           if (preg_match_all('|(<link.*?/>)|ms',$m[1],$ms)) { 
    68                foreach ($ms[1] as $v) { 
    69                     $p_head .= $v."\n"; 
    70                } 
    71           } 
    72      } 
     66        if (preg_match_all('|(<link.*?/>)|ms', $m[1], $ms)) { 
     67            foreach ($ms[1] as $v) { 
     68                $p_head .= $v . "\n"; 
     69            } 
     70        } 
     71    } 
    7372 
    74      if (preg_match('|<body.*?>(.+)</body>|ms',$res,$m)) { 
    75           $p_content = $m[1]; 
    76      } 
     73    if (preg_match('|<body.*?>(.+)</body>|ms', $res, $m)) { 
     74        $p_content = $m[1]; 
     75    } 
    7776 
    78      call_user_func($open_f,$p_title,$p_head); 
    79      echo $p_content; 
    80      if (!$popup) { 
    81           // Add direct links to plugin settings if any 
    82           $settings = adminModulesList::getSettingsUrls($core,$p,true,false); 
    83           if (!empty($settings)) { 
    84                echo '<hr class="clear"/><p class="right modules">'.implode(' - ',$settings).'</p>'; 
    85           } 
    86      } 
    87      call_user_func($close_f); 
     77    call_user_func($open_f, $p_title, $p_head); 
     78    echo $p_content; 
     79    if (!$popup) { 
     80        // Add direct links to plugin settings if any 
     81        $settings = adminModulesList::getSettingsUrls($core, $p, true, false); 
     82        if (!empty($settings)) { 
     83            echo '<hr class="clear"/><p class="right modules">' . implode(' - ', $settings) . '</p>'; 
     84        } 
     85    } 
     86    call_user_func($close_f); 
     87} else { 
     88    call_user_func($open_f, __('Plugin not found'), '', 
     89        dcPage::breadcrumb( 
     90            array( 
     91                __('System')           => '', 
     92                __('Plugin not found') => '' 
     93            )) 
     94    ); 
     95 
     96    echo '<p>' . __('The plugin you reached does not exist or does not have an admin page.') . '</p>'; 
     97 
     98    call_user_func($close_f); 
    8899} 
    89 else 
    90 { 
    91      call_user_func($open_f,__('Plugin not found'),'', 
    92           dcPage::breadcrumb( 
    93                array( 
    94                     __('System') => '', 
    95                     __('Plugin not found') => '' 
    96                )) 
    97      ); 
    98  
    99      echo '<p>'.__('The plugin you reached does not exist or does not have an admin page.').'</p>'; 
    100  
    101      call_user_func($close_f); 
    102 } 
Note: See TracChangeset for help on using the changeset viewer.

Sites map