Changeset 4859

Show
Ignore:
Timestamp:
12/24/07 12:33:30 (2 years ago)
Author:
inureyes
Message:

#708

  • 플러그인 설정 값이 비었을 경우 발생할 수도 있는 오류 방지
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/plugins.php

    r4799 r4859  
    2929    $editorCount     = 0; 
    3030    $formatterCount  = 0; 
    31     foreach ($activePlugins as $plugin) { 
    32         $version = ''; 
    33         $disablePlugin= false; 
    34          
    35         $manifest = @file_get_contents(ROOT . "/plugins/$plugin/index.xml"); 
    36         if ($manifest && $xmls->open($manifest)) { 
    37             $requiredTattertoolsVersion = $xmls->getValue('/plugin/requirements/tattertools'); 
    38             $requiredTextcubeVersion = $xmls->getValue('/plugin/requirements/textcube'); 
     31    if(!empty($activePlugins)) { 
     32        foreach ($activePlugins as $plugin) { 
     33            $version = ''; 
     34            $disablePlugin= false; 
    3935             
    40             if (!is_null($requiredTattertoolsVersion) && !is_null($requiredTextcubeVersion)) { 
    41                 if ($currentTextcubeVersion < $requiredTattertoolsVersion && $currentTextcubeVersion < $requiredTextcubeVersion) 
    42                     $disablePlugin = true; 
    43             } else if (!is_null($requiredTattertoolsVersion) && is_null($requiredTextcubeVersion)) { 
    44                 if ($currentTextcubeVersion < $requiredTattertoolsVersion) 
    45                     $disablePlugin = true; 
    46             } else if (is_null($requiredTattertoolsVersion) && !is_null($requiredTextcubeVersion)) { 
    47                 if ($currentTextcubeVersion < $requiredTextcubeVersion) 
    48                     $disablePlugin = true; 
    49             } 
    50              
    51             if ($disablePlugin == false) { 
    52                 if ($xmls->doesExist('/plugin/version')) { 
    53                     $version = $xmls->getValue('/plugin/version'); 
     36            $manifest = @file_get_contents(ROOT . "/plugins/$plugin/index.xml"); 
     37            if ($manifest && $xmls->open($manifest)) { 
     38                $requiredTattertoolsVersion = $xmls->getValue('/plugin/requirements/tattertools'); 
     39                $requiredTextcubeVersion = $xmls->getValue('/plugin/requirements/textcube'); 
     40                 
     41                if (!is_null($requiredTattertoolsVersion) && !is_null($requiredTextcubeVersion)) { 
     42                    if ($currentTextcubeVersion < $requiredTattertoolsVersion && $currentTextcubeVersion < $requiredTextcubeVersion) 
     43                        $disablePlugin = true; 
     44                } else if (!is_null($requiredTattertoolsVersion) && is_null($requiredTextcubeVersion)) { 
     45                    if ($currentTextcubeVersion < $requiredTattertoolsVersion) 
     46                        $disablePlugin = true; 
     47                } else if (is_null($requiredTattertoolsVersion) && !is_null($requiredTextcubeVersion)) { 
     48                    if ($currentTextcubeVersion < $requiredTextcubeVersion) 
     49                        $disablePlugin = true; 
    5450                } 
    55                 if ($xmls->doesExist('/plugin/storage')) { 
    56                     foreach ($xmls->selectNodes('/plugin/storage/table') as $table) { 
    57                         $storageMappings = array(); 
    58                         $storageKeymappings = array();                    
    59                         if(empty($table['name'][0]['.value'])) continue; 
    60                         $tableName = htmlspecialchars($table['name'][0]['.value']); 
    61                         if (!empty($table['fields'][0]['field'])) { 
    62                             foreach($table['fields'][0]['field'] as $field)  
    63                             { 
    64                                 if (!isset($field['name'])) 
    65                                     continue; // Error? maybe loading fail, so skipping is needed. 
    66                                 $fieldName = $field['name'][0]['.value']; 
     51                 
     52                if ($disablePlugin == false) { 
     53                    if ($xmls->doesExist('/plugin/version')) { 
     54                        $version = $xmls->getValue('/plugin/version'); 
     55                    } 
     56                    if ($xmls->doesExist('/plugin/storage')) { 
     57                        foreach ($xmls->selectNodes('/plugin/storage/table') as $table) { 
     58                            $storageMappings = array(); 
     59                            $storageKeymappings = array();                    
     60                            if(empty($table['name'][0]['.value'])) continue; 
     61                            $tableName = htmlspecialchars($table['name'][0]['.value']); 
     62                            if (!empty($table['fields'][0]['field'])) { 
     63                                foreach($table['fields'][0]['field'] as $field)  
     64                                { 
     65                                    if (!isset($field['name'])) 
     66                                        continue; // Error? maybe loading fail, so skipping is needed. 
     67                                    $fieldName = $field['name'][0]['.value']; 
     68                                 
     69                                    if (!isset($field['attribute'])) 
     70                                        continue; // Error? maybe loading fail, so skipping is needed. 
     71                                    $fieldAttribute = $field['attribute'][0]['.value']; 
     72                                 
     73                                    $fieldLength = isset($field['length']) ? $field['length'][0]['.value'] : -1; 
     74                                    $fieldIsNull = isset($field['isnull']) ? $field['isnull'][0]['.value'] : 1; 
     75                                    $fieldDefault = isset($field['default']) ? $field['default'][0]['.value'] : null; 
     76                                    $fieldAutoIncrement = isset($field['autoincrement']) ? $field['autoincrement'][0]['.value'] : 0; 
     77                                 
     78                                    array_push($storageMappings, array('name' => $fieldName, 'attribute' => $fieldAttribute, 'length' => $fieldLength, 'isnull' => $fieldIsNull, 'default' => $fieldDefault, 'autoincrement' => $fieldAutoIncrement)); 
     79                                } 
     80                            } 
     81                            if (!empty($table['key'][0]['.value'])) { 
     82                                foreach($table['key'] as $key) { 
     83                                    array_push($storageKeymappings, $key['.value']); 
     84                                } 
     85                            } 
     86                            treatPluginTable($plugin, $tableName, $storageMappings, $storageKeymappings, $version); 
     87                            unset($tableName); 
     88                            unset($storageMappings); 
     89                            unset($storageKeymappings); 
     90                        } 
     91                    } 
     92                    if ($xmls->doesExist('/plugin/binding/listener')) { 
     93                        foreach ($xmls->selectNodes('/plugin/binding/listener') as $listener) { 
     94                            if (!empty($listener['.attributes']['event']) && !empty($listener['.value'])) { 
     95                                if (!isset($eventMappings[$listener['.attributes']['event']])) 
     96                                    $eventMappings[$listener['.attributes']['event']] = array(); 
     97                                array_push($eventMappings[$listener['.attributes']['event']], array('plugin' => $plugin, 'listener' => $listener['.value'])); 
     98                            } 
     99                        } 
     100                        unset($listener); 
     101                    } 
     102                    if ($xmls->doesExist('/plugin/binding/tag')) { 
     103                        foreach ($xmls->selectNodes('/plugin/binding/tag') as $tag) { 
     104                            if (!empty($tag['.attributes']['name']) && !empty($tag['.attributes']['handler'])) { 
     105                                if (!isset($tagMappings[$tag['.attributes']['name']])) 
     106                                    $tagMappings[$tag['.attributes']['name']] = array(); 
     107                                array_push($tagMappings[$tag['.attributes']['name']], array('plugin' => $plugin, 'handler' => $tag['.attributes']['handler'])); 
     108                            } 
     109                        } 
     110                        unset($tag); 
     111                    } 
     112                    if (doesHaveMembership() && $xmls->doesExist('/plugin/binding/center')) { 
     113                        $title = htmlspecialchars($xmls->getValue('/plugin/title[lang()]')); 
     114                        foreach ($xmls->selectNodes('/plugin/binding/center') as $center) { 
     115                            if (!empty($center['.attributes']['handler'])) { 
     116                                array_push($centerMappings, array('plugin' => $plugin, 'handler' => $center['.attributes']['handler'], 'title' => $title)); 
     117                            } 
     118                        } 
     119                        unset($title); 
     120                        unset($center); 
     121                    } 
     122                    if ($xmls->doesExist('/plugin/binding/sidebar')) { 
     123                        $title = htmlspecialchars($xmls->getValue('/plugin/title[lang()]')); 
     124                        foreach ($xmls->selectNodes('/plugin/binding/sidebar') as $sidebar) { 
     125                            if (!empty($sidebar['.attributes']['handler'])) { 
     126                                // parameter parsing 
     127                                $parameters = array(); 
     128                                if (isset($sidebar['params']) && isset($sidebar['params'][0]) && isset($sidebar['params'][0]['param'])) { 
     129                                    foreach($sidebar['params'][0]['param'] as $param) { 
     130                                        $parameter = array('name' => $param['name'][0]['.value'], 'type' => $param['type'][0]['.value'], 'title' => XMLStruct::getValueByLocale($param['title'])); 
     131                                        array_push($parameters, $parameter);                 
     132                                    } 
     133                                } 
     134                                array_push($sidebarMappings, array('plugin' => $plugin, 'title' => $sidebar['.attributes']['title'], 'display' => $title, 'handler' => $sidebar['.attributes']['handler'], 'parameters' => $parameters)); 
     135                            } 
     136                        } 
     137                        unset($sidebar); 
     138                    } 
     139                    if ($xmls->doesExist('/plugin/binding/coverpage')) { 
     140                        $title = htmlspecialchars($xmls->getValue('/plugin/title[lang()]')); 
     141                        foreach ($xmls->selectNodes('/plugin/binding/coverpage') as $coverpage) { 
     142                            if (!empty($coverpage['.attributes']['handler'])) { 
     143                                // parameter parsing 
     144                                $parameters = array(); 
     145                                if (isset($coverpage['params']) && isset($coverpage['params'][0]) && isset($coverpage['params'][0]['param'])) { 
     146                                    foreach($coverpage['params'][0]['param'] as $param) { 
     147                                        $parameter = array('name' => $param['name'][0]['.value'], 'type' => $param['type'][0]['.value'], 'title' => XMLStruct::getValueByLocale($param['title'])); 
     148                                        array_push($parameters, $parameter);                 
     149                                    } 
     150                                } 
     151                                array_push($coverpageMappings, array('plugin' => $plugin, 'title' => $coverpage['.attributes']['title'], 'display' => $title, 'handler' => $coverpage['.attributes']['handler'], 'parameters' => $parameters)); 
     152                            } 
     153                        } 
     154                        unset($coverpage); 
     155                    } 
     156                    if($xmls->doesExist('/plugin/binding/config')) { 
     157                        $config = $xmls->selectNode('/plugin/binding/config'); 
     158                        if( !empty( $config['.attributes']['dataValHandler'] ) ) 
     159                            $configMappings[$plugin] =  
     160                            array( 'config' => 'ok' , 'dataValHandler' => $config['.attributes']['dataValHandler'] ); 
     161                        else 
     162                            $configMappings[$plugin] = array( 'config' => 'ok') ; 
     163                    } 
     164                    if (doesHaveOwnership() && $xmls->doesExist('/plugin/binding/adminMenu')) { 
     165                        $title = htmlspecialchars($xmls->getValue('/plugin/title[lang()]')); 
     166     
     167                        if ($xmls->doesExist('/plugin/binding/adminMenu/viewMethods')) { 
     168                            foreach($xmls->selectNodes('/plugin/binding/adminMenu/viewMethods/method') as $adminViewMenu) { 
     169                                $menutitle = htmlspecialchars(XMLStruct::getValueByLocale($adminViewMenu['title'])); 
     170                                if (empty($menutitle)) continue; 
     171                                if(isset($adminViewMenu['topMenu'][0]['.value'])) { 
     172                                    $pluginTopMenuLocation = htmlspecialchars($adminViewMenu['topMenu'][0]['.value']); 
     173                                    switch($pluginTopMenuLocation) { 
     174                                        case 'center': 
     175                                        case 'entry': 
     176                                        case 'link': 
     177                                        case 'skin': 
     178                                        case 'plugin': 
     179                                        case 'setting': 
     180                                            break; 
     181                                        default: 
     182                                            $pluginTopMenuLocation = 'plugin'; 
     183                                    } 
     184                                } else { 
     185                                    $pluginTopMenuLocation = 'plugin'; 
     186                                } 
     187                                $pluginContentMenuOrder = empty($adminViewMenu['contentMenuOrder'][0]['.value'])? '100':$adminViewMenu['contentMenuOrder'][0]['.value']; 
     188                                $menuhelpurl = empty($adminViewMenu['helpurl'][0]['.value'])?'':$adminViewMenu['helpurl'][0]['.value']; 
    67189                             
    68                                 if (!isset($field['attribute'])) 
    69                                     continue; // Error? maybe loading fail, so skipping is needed. 
    70                                 $fieldAttribute = $field['attribute'][0]['.value']; 
    71                              
    72                                 $fieldLength = isset($field['length']) ? $field['length'][0]['.value'] : -1; 
    73                                 $fieldIsNull = isset($field['isnull']) ? $field['isnull'][0]['.value'] : 1; 
    74                                 $fieldDefault = isset($field['default']) ? $field['default'][0]['.value'] : null; 
    75                                 $fieldAutoIncrement = isset($field['autoincrement']) ? $field['autoincrement'][0]['.value'] : 0; 
    76                              
    77                                 array_push($storageMappings, array('name' => $fieldName, 'attribute' => $fieldAttribute, 'length' => $fieldLength, 'isnull' => $fieldIsNull, 'default' => $fieldDefault, 'autoincrement' => $fieldAutoIncrement)); 
    78                             } 
    79                         } 
    80                         if (!empty($table['key'][0]['.value'])) { 
    81                             foreach($table['key'] as $key) { 
    82                                 array_push($storageKeymappings, $key['.value']); 
    83                             } 
    84                         } 
    85                         treatPluginTable($plugin, $tableName, $storageMappings, $storageKeymappings, $version); 
    86                         unset($tableName); 
    87                         unset($storageMappings); 
    88                         unset($storageKeymappings); 
    89                     } 
    90                 } 
    91                 if ($xmls->doesExist('/plugin/binding/listener')) { 
    92                     foreach ($xmls->selectNodes('/plugin/binding/listener') as $listener) { 
    93                         if (!empty($listener['.attributes']['event']) && !empty($listener['.value'])) { 
    94                             if (!isset($eventMappings[$listener['.attributes']['event']])) 
    95                                 $eventMappings[$listener['.attributes']['event']] = array(); 
    96                             array_push($eventMappings[$listener['.attributes']['event']], array('plugin' => $plugin, 'listener' => $listener['.value'])); 
    97                         } 
    98                     } 
    99                     unset($listener); 
    100                 } 
    101                 if ($xmls->doesExist('/plugin/binding/tag')) { 
    102                     foreach ($xmls->selectNodes('/plugin/binding/tag') as $tag) { 
    103                         if (!empty($tag['.attributes']['name']) && !empty($tag['.attributes']['handler'])) { 
    104                             if (!isset($tagMappings[$tag['.attributes']['name']])) 
    105                                 $tagMappings[$tag['.attributes']['name']] = array(); 
    106                             array_push($tagMappings[$tag['.attributes']['name']], array('plugin' => $plugin, 'handler' => $tag['.attributes']['handler'])); 
    107                         } 
    108                     } 
    109                     unset($tag); 
    110                 } 
    111                 if (doesHaveMembership() && $xmls->doesExist('/plugin/binding/center')) { 
    112                     $title = htmlspecialchars($xmls->getValue('/plugin/title[lang()]')); 
    113                     foreach ($xmls->selectNodes('/plugin/binding/center') as $center) { 
    114                         if (!empty($center['.attributes']['handler'])) { 
    115                             array_push($centerMappings, array('plugin' => $plugin, 'handler' => $center['.attributes']['handler'], 'title' => $title)); 
    116                         } 
    117                     } 
    118                     unset($title); 
    119                     unset($center); 
    120                 } 
    121                 if ($xmls->doesExist('/plugin/binding/sidebar')) { 
    122                     $title = htmlspecialchars($xmls->getValue('/plugin/title[lang()]')); 
    123                     foreach ($xmls->selectNodes('/plugin/binding/sidebar') as $sidebar) { 
    124                         if (!empty($sidebar['.attributes']['handler'])) { 
    125                             // parameter parsing 
    126                             $parameters = array(); 
    127                             if (isset($sidebar['params']) && isset($sidebar['params'][0]) && isset($sidebar['params'][0]['param'])) { 
    128                                 foreach($sidebar['params'][0]['param'] as $param) { 
    129                                     $parameter = array('name' => $param['name'][0]['.value'], 'type' => $param['type'][0]['.value'], 'title' => XMLStruct::getValueByLocale($param['title'])); 
    130                                     array_push($parameters, $parameter);                 
    131                                 } 
    132                             } 
    133                             array_push($sidebarMappings, array('plugin' => $plugin, 'title' => $sidebar['.attributes']['title'], 'display' => $title, 'handler' => $sidebar['.attributes']['handler'], 'parameters' => $parameters)); 
    134                         } 
    135                     } 
    136                     unset($sidebar); 
    137                 } 
    138                 if ($xmls->doesExist('/plugin/binding/coverpage')) { 
    139                     $title = htmlspecialchars($xmls->getValue('/plugin/title[lang()]')); 
    140                     foreach ($xmls->selectNodes('/plugin/binding/coverpage') as $coverpage) { 
    141                         if (!empty($coverpage['.attributes']['handler'])) { 
    142                             // parameter parsing 
    143                             $parameters = array(); 
    144                             if (isset($coverpage['params']) && isset($coverpage['params'][0]) && isset($coverpage['params'][0]['param'])) { 
    145                                 foreach($coverpage['params'][0]['param'] as $param) { 
    146                                     $parameter = array('name' => $param['name'][0]['.value'], 'type' => $param['type'][0]['.value'], 'title' => XMLStruct::getValueByLocale($param['title'])); 
    147                                     array_push($parameters, $parameter);                 
    148                                 } 
    149                             } 
    150                             array_push($coverpageMappings, array('plugin' => $plugin, 'title' => $coverpage['.attributes']['title'], 'display' => $title, 'handler' => $coverpage['.attributes']['handler'], 'parameters' => $parameters)); 
    151                         } 
    152                     } 
    153                     unset($coverpage); 
    154                 } 
    155                 if($xmls->doesExist('/plugin/binding/config')) { 
    156                     $config = $xmls->selectNode('/plugin/binding/config'); 
    157                     if( !empty( $config['.attributes']['dataValHandler'] ) ) 
    158                         $configMappings[$plugin] =  
    159                         array( 'config' => 'ok' , 'dataValHandler' => $config['.attributes']['dataValHandler'] ); 
    160                     else 
    161                         $configMappings[$plugin] = array( 'config' => 'ok') ; 
    162                 } 
    163                 if (doesHaveOwnership() && $xmls->doesExist('/plugin/binding/adminMenu')) { 
    164                     $title = htmlspecialchars($xmls->getValue('/plugin/title[lang()]')); 
    165  
    166                     if ($xmls->doesExist('/plugin/binding/adminMenu/viewMethods')) { 
    167                         foreach($xmls->selectNodes('/plugin/binding/adminMenu/viewMethods/method') as $adminViewMenu) { 
    168                             $menutitle = htmlspecialchars(XMLStruct::getValueByLocale($adminViewMenu['title'])); 
    169                             if (empty($menutitle)) continue; 
    170                             if(isset($adminViewMenu['topMenu'][0]['.value'])) { 
    171                                 $pluginTopMenuLocation = htmlspecialchars($adminViewMenu['topMenu'][0]['.value']); 
    172                                 switch($pluginTopMenuLocation) { 
    173                                     case 'center': 
    174                                     case 'entry': 
    175                                     case 'link': 
    176                                     case 'skin': 
    177                                     case 'plugin': 
    178                                     case 'setting': 
    179                                         break; 
    180                                     default: 
    181                                         $pluginTopMenuLocation = 'plugin'; 
    182                                 } 
    183                             } else { 
    184                                 $pluginTopMenuLocation = 'plugin'; 
    185                             } 
    186                             $pluginContentMenuOrder = empty($adminViewMenu['contentMenuOrder'][0]['.value'])? '100':$adminViewMenu['contentMenuOrder'][0]['.value']; 
    187                             $menuhelpurl = empty($adminViewMenu['helpurl'][0]['.value'])?'':$adminViewMenu['helpurl'][0]['.value']; 
    188                          
    189                             if (!isset($adminViewMenu['handler'][0]['.value'])) continue; 
    190                             $viewhandler = htmlspecialchars($adminViewMenu['handler'][0]['.value']);     
    191                             if (empty($viewhandler)) continue; 
    192                             $params = array(); 
    193                             if (isset($adminViewMenu['params'][0]['param'])) { 
    194                                 foreach($adminViewMenu['params'][0]['param'] as $methodParam) { 
     190                                if (!isset($adminViewMenu['handler'][0]['.value'])) continue; 
     191                                $viewhandler = htmlspecialchars($adminViewMenu['handler'][0]['.value']);     
     192                                if (empty($viewhandler)) continue; 
     193                                $params = array(); 
     194                                if (isset($adminViewMenu['params'][0]['param'])) { 
     195                                    foreach($adminViewMenu['params'][0]['param'] as $methodParam) { 
     196                                            if (!isset($methodParam['name'][0]['.value']) || !isset($methodParam['type'][0]['.value'])) continue; 
     197                                            $mandatory = null; 
     198                                            $default   = null; 
     199                                            if( isset($methodParam['mandatory'][0]['.value']) ) { 
     200                                                $mandatory = $methodParam['mandatory'][0]['.value']; 
     201                                            } 
     202                                            if( isset($methodParam['default'][0]['.value']) ) { 
     203                                                $default = $methodParam['default'][0]['.value']; 
     204                                            } 
     205                                            array_push($params,array( 
     206                                                    'name' => $methodParam['name'][0]['.value'], 
     207                                                    'type' => $methodParam['type'][0]['.value'], 
     208                                                    'mandatory' => $mandatory, 
     209                                                    'default' => $default 
     210                                                    )); 
     211                                    } 
     212                                } 
     213                                     
     214                                $adminMenuMappings[$plugin . '/' . $viewhandler] = array( 
     215                                    'plugin'   => $plugin,  
     216                                    'title'    => $menutitle, 
     217                                    'handler'  => $viewhandler, 
     218                                    'params'   => $params, 
     219                                    'helpurl'  => $menuhelpurl, 
     220                                    'topMenu'  => $pluginTopMenuLocation, 
     221                                    'contentMenuOrder' => $pluginContentMenuOrder 
     222                                ); 
     223                            } 
     224                        } 
     225                     
     226                        unset($menutitle); 
     227                        unset($viewhandler); 
     228                        unset($adminViewMenu); 
     229                        unset($params); 
     230                     
     231                        if (doesHaveOwnership() &&$xmls->doesExist('/plugin/binding/adminMenu/methods')) { 
     232                            foreach($xmls->selectNodes('/plugin/binding/adminMenu/methods/method') as $adminMethods) { 
     233                                $method = array(); 
     234                                $method['plugin'] = $plugin; 
     235                                if (!isset($adminMethods['handler'][0]['.value'])) continue; 
     236                                $method['handler'] = $adminMethods['handler'][0]['.value']; 
     237                                $method['params'] = array(); 
     238                                    if (isset($adminMethods['params'][0]['param'])) { 
     239                                    foreach($adminMethods['params'][0]['param'] as $methodParam) { 
    195240                                        if (!isset($methodParam['name'][0]['.value']) || !isset($methodParam['type'][0]['.value'])) continue; 
    196241                                        $mandatory = null; 
     
    202247                                            $default = $methodParam['default'][0]['.value']; 
    203248                                        } 
    204                                         array_push($params,array( 
    205                                                 'name' => $methodParam['name'][0]['.value'], 
    206                                                 'type' => $methodParam['type'][0]['.value'], 
    207                                                 'mandatory' => $mandatory, 
    208                                                 'default' => $default 
    209                                                 )); 
    210                                 } 
    211                             } 
    212                                  
    213                             $adminMenuMappings[$plugin . '/' . $viewhandler] = array( 
    214                                 'plugin'   => $plugin,  
    215                                 'title'    => $menutitle, 
    216                                 'handler'  => $viewhandler, 
    217                                 'params'   => $params, 
    218                                 'helpurl'  => $menuhelpurl, 
    219                                 'topMenu'  => $pluginTopMenuLocation, 
    220                                 'contentMenuOrder' => $pluginContentMenuOrder 
    221                             ); 
    222                         } 
    223                     } 
    224                  
    225                     unset($menutitle); 
    226                     unset($viewhandler); 
    227                     unset($adminViewMenu); 
    228                     unset($params); 
    229                  
    230                     if (doesHaveOwnership() &&$xmls->doesExist('/plugin/binding/adminMenu/methods')) { 
    231                         foreach($xmls->selectNodes('/plugin/binding/adminMenu/methods/method') as $adminMethods) { 
    232                             $method = array(); 
    233                             $method['plugin'] = $plugin; 
    234                             if (!isset($adminMethods['handler'][0]['.value'])) continue; 
    235                             $method['handler'] = $adminMethods['handler'][0]['.value']; 
    236                             $method['params'] = array(); 
    237                                 if (isset($adminMethods['params'][0]['param'])) { 
    238                                 foreach($adminMethods['params'][0]['param'] as $methodParam) { 
    239                                     if (!isset($methodParam['name'][0]['.value']) || !isset($methodParam['type'][0]['.value'])) continue; 
    240                                     $mandatory = null; 
    241                                     $default   = null; 
    242                                     if( isset($methodParam['mandatory'][0]['.value']) ) { 
    243                                         $mandatory = $methodParam['mandatory'][0]['.value']; 
    244                                     } 
    245                                     if( isset($methodParam['default'][0]['.value']) ) { 
    246                                         $default = $methodParam['default'][0]['.value']; 
    247                                     } 
    248                                     array_push($method['params'],array( 
    249                                         'name' => $methodParam['name'][0]['.value'], 
    250                                         'type' => $methodParam['type'][0]['.value'], 
    251                                         'mandatory' => $mandatory, 
    252                                         'default' => $default 
    253                                     )); 
    254                                 } 
    255                             } 
    256                             $adminHandlerMappings[$plugin . '/' . $method['handler']] = $method; 
    257                         } 
    258                     } 
    259                  
    260                     unset($method); 
    261                     unset($methodParam); 
    262                     unset($adminMethods); 
    263                  
     249                                        array_push($method['params'],array( 
     250                                            'name' => $methodParam['name'][0]['.value'], 
     251                                            'type' => $methodParam['type'][0]['.value'], 
     252                                            'mandatory' => $mandatory, 
     253                                            'default' => $default 
     254                                        )); 
     255                                    } 
     256                                } 
     257                                $adminHandlerMappings[$plugin . '/' . $method['handler']] = $method; 
     258                            } 
     259                        } 
     260                     
     261                        unset($method); 
     262                        unset($methodParam); 
     263                        unset($adminMethods); 
     264                     
     265                    } 
     266                    if ($xmls->doesExist('/plugin/binding/formatter[lang()]')) { 
     267                        $formatterCount = $formatterCount + 1; 
     268                        foreach (array($xmls->selectNode('/plugin/binding/formatter[lang()]')) as $formatter) { 
     269                            if (!isset($formatter['.attributes']['name'])) continue; 
     270                            if (!isset($formatter['.attributes']['id'])) continue; 
     271                            $formatterid = $formatter['.attributes']['id']; 
     272                            $formatterinfo = array('id' => $formatterid, 'name' => $formatter['.attributes']['name'], 'plugin' => $plugin, 'editors' => array()); 
     273                            if (isset($formatter['format'][0]['.value'])) $formatterinfo['formatfunc'] = $formatter['format'][0]['.value']; 
     274                            if (isset($formatter['summary'][0]['.value'])) $formatterinfo['summaryfunc'] = $formatter['summary'][0]['.value']; 
     275                            if (isset($formatter['usedFor'])) { 
     276                                foreach ($formatter['usedFor'] as $usedFor) { 
     277                                    if (!isset($usedFor['.attributes']['editor'])) continue; 
     278                                    $formatterinfo['editors'][$usedFor['.attributes']['editor']] = @$usedFor['.value']; 
     279                                } 
     280                            } 
     281                            $formatterMapping[$formatterid] = $formatterinfo; 
     282                        } 
     283                        unset($formatter); 
     284                        unset($formatterid); 
     285                        unset($formatterinfo); 
     286                        unset($usedFor); 
     287                    } 
     288                    if (doesHaveOwnership() && $xmls->doesExist('/plugin/binding/editor[lang()]')) { 
     289                        $editorCount = $editorCount + 1; 
     290                        foreach (array($xmls->selectNode('/plugin/binding/editor[lang()]')) as $editor) { 
     291                            if (!isset($editor['.attributes']['name'])) continue; 
     292                            if (!isset($editor['.attributes']['id'])) continue; 
     293                            $editorid = $editor['.attributes']['id']; 
     294                            $editorinfo = array('id' => $editorid, 'name' => $editor['.attributes']['name'], 'plugin' => $plugin); 
     295                            if (isset($editor['initialize'][0]['.value'])) $editorinfo['initfunc'] = $editor['initialize'][0]['.value']; 
     296                            if (isset($editor['usedFor'])) { 
     297                                foreach ($editor['usedFor'] as $usedFor) { 
     298                                    if (!isset($usedFor['.attributes']['formatter'])) continue; 
     299                                    $formatterMapping[$usedFor['.attributes']['formatter']]['editors'][$editorid] = @$usedFor['.value']; 
     300                                } 
     301                            } 
     302                            $editorMapping[$editorid] = $editorinfo; 
     303                        } 
     304                        unset($editor); 
     305                        unset($editorid); 
     306                        unset($editorinfo); 
     307                        unset($usedFor); 
     308                    } 
    264309                } 
    265                 if ($xmls->doesExist('/plugin/binding/formatter[lang()]')) { 
    266                     $formatterCount = $formatterCount + 1; 
    267                     foreach (array($xmls->selectNode('/plugin/binding/formatter[lang()]')) as $formatter) { 
    268                         if (!isset($formatter['.attributes']['name'])) continue; 
    269                         if (!isset($formatter['.attributes']['id'])) continue; 
    270                         $formatterid = $formatter['.attributes']['id']; 
    271                         $formatterinfo = array('id' => $formatterid, 'name' => $formatter['.attributes']['name'], 'plugin' => $plugin, 'editors' => array()); 
    272                         if (isset($formatter['format'][0]['.value'])) $formatterinfo['formatfunc'] = $formatter['format'][0]['.value']; 
    273                         if (isset($formatter['summary'][0]['.value'])) $formatterinfo['summaryfunc'] = $formatter['summary'][0]['.value']; 
    274                         if (isset($formatter['usedFor'])) { 
    275                             foreach ($formatter['usedFor'] as $usedFor) { 
    276                                 if (!isset($usedFor['.attributes']['editor'])) continue; 
    277                                 $formatterinfo['editors'][$usedFor['.attributes']['editor']] = @$usedFor['.value']; 
    278                             } 
    279                         } 
    280                         $formatterMapping[$formatterid] = $formatterinfo; 
    281                     } 
    282                     unset($formatter); 
    283                     unset($formatterid); 
    284                     unset($formatterinfo); 
    285                     unset($usedFor); 
    286                 } 
    287                 if (doesHaveOwnership() && $xmls->doesExist('/plugin/binding/editor[lang()]')) { 
    288                     $editorCount = $editorCount + 1; 
    289                     foreach (array($xmls->selectNode('/plugin/binding/editor[lang()]')) as $editor) { 
    290                         if (!isset($editor['.attributes']['name'])) continue; 
    291                         if (!isset($editor['.attributes']['id'])) continue; 
    292                         $editorid = $editor['.attributes']['id']; 
    293                         $editorinfo = array('id' => $editorid, 'name' => $editor['.attributes']['name'], 'plugin' => $plugin); 
    294                         if (isset($editor['initialize'][0]['.value'])) $editorinfo['initfunc'] = $editor['initialize'][0]['.value']; 
    295                         if (isset($editor['usedFor'])) { 
    296                             foreach ($editor['usedFor'] as $usedFor) { 
    297                                 if (!isset($usedFor['.attributes']['formatter'])) continue; 
    298                                 $formatterMapping[$usedFor['.attributes']['formatter']]['editors'][$editorid] = @$usedFor['.value']; 
    299                             } 
    300                         } 
    301                         $editorMapping[$editorid] = $editorinfo; 
    302                     } 
    303                     unset($editor); 
    304                     unset($editorid); 
    305                     unset($editorinfo); 
    306                     unset($usedFor); 
    307                 } 
     310            } else { 
     311                $disablePlugin = true; 
    308312            } 
    309         } else { 
    310             $disablePlugin = true; 
    311         } 
    312          
    313         if ($disablePlugin == true) { 
    314             deactivatePlugin($plugin); 
     313             
     314            if ($disablePlugin == true) { 
     315                deactivatePlugin($plugin); 
     316            } 
    315317        } 
    316318    }