/**
  * @param  SimpleXMLElement[]  $xmlToolbarMenuArray
  * @return void
  */
 static function _PLUGIN_MENU($xmlToolbarMenuArray)
 {
     if ($xmlToolbarMenuArray && count($xmlToolbarMenuArray) > 0) {
         $started = false;
         foreach ($xmlToolbarMenuArray as $xmlTBmenu) {
             if ($xmlTBmenu && count($xmlTBmenu->children()) > 0) {
                 foreach ($xmlTBmenu->children() as $menu) {
                     /** @var SimpleXMLElement $menu */
                     if ($menu->getName() == 'menu') {
                         // $name			=	$menu->attributes( 'name' );
                         $action = $menu->attributes('action');
                         $task = $menu->attributes('task');
                         $label = $menu->attributes('label');
                         $class = RegistryEditView::buildClasses($menu);
                         $description = $menu->attributes('description');
                         if (in_array($action, get_class_methods('CBtoolmenuBar')) || in_array(strtolower($action), get_class_methods('CBtoolmenuBar'))) {
                             // PHP 5 || PHP 4
                             if (!$started) {
                                 CBtoolmenuBar::startTable();
                                 $started = true;
                             }
                             switch ($action) {
                                 case 'custom':
                                 case 'customX':
                                     $icon = $menu->attributes('icon');
                                     $iconOver = $menu->attributes('iconover');
                                     CBtoolmenuBar::$action($task, $icon, $iconOver, $label, false, null, $class);
                                     break;
                                 case 'editList':
                                     CBtoolmenuBar::editListNoSelect($task, $label);
                                     break;
                                 case 'deleteList':
                                 case 'deleteListX':
                                     $message = $menu->attributes('message');
                                     CBtoolmenuBar::$action($message, $task, $label);
                                     break;
                                 case 'trash':
                                     CBtoolmenuBar::$action($task, $label, false);
                                     break;
                                 case 'preview':
                                     $popup = $menu->attributes('popup');
                                     CBtoolmenuBar::$action($popup, true);
                                     break;
                                 case 'help':
                                     $ref = $menu->attributes('href');
                                     if (!$ref) {
                                         // Backwards compatibility to CB 1.x:
                                         $ref = $menu->attributes('ref');
                                     }
                                     CBtoolmenuBar::$action($ref, true);
                                     break;
                                 case 'divider':
                                 case 'spacer':
                                     CBtoolmenuBar::$action();
                                     break;
                                 case 'back':
                                     $href = $menu->attributes('href');
                                     CBtoolmenuBar::$action($label, $href);
                                     break;
                                 case 'media_manager':
                                     $directory = $menu->attributes('directory');
                                     CBtoolmenuBar::$action($directory, $label);
                                     break;
                                 case 'linkAction':
                                     $urllink = $menu->attributes('urllink');
                                     if ($menu->attributes('task') == 'new') {
                                         CBtoolmenuBar::$action($task, $urllink, $label, $class ? $class : (checkJversion('j3.0+') ? 'btn-success' : null));
                                     } else {
                                         CBtoolmenuBar::$action($task, $urllink, $label, $class);
                                     }
                                     break;
                                 default:
                                     CBtoolmenuBar::$action($task, $label);
                                     break;
                             }
                         } elseif ($action == 'permissions') {
                             if ($description) {
                                 $headerHtml = '<div class="cbbejeoptionsintro cbbejeoptionsintro' . htmlspecialchars($task) . '">' . $description . '</div>';
                             } else {
                                 $headerHtml = null;
                             }
                             self::_PERMISSIONS($task, $headerHtml);
                             if ($label) {
                                 self::_TRANSLATECONFIGTITLE($task, $label);
                             }
                         }
                         // if ( in_array( $action, array(	'customX', 'addNew', 'addNewX', 'publish', 'publishList', 'makeDefault', 'assign', 'unpublish', 'unpublishList',
                         //								'archiveList', 'unarchiveList', ) ) ) {
                         // nothing
                         // }
                     }
                 }
             }
         }
         if ($started) {
             CBtoolmenuBar::endTable();
         }
     }
 }
 static function _PLUGIN_MENU(&$xmlToolbarMenuArray)
 {
     if ($xmlToolbarMenuArray && count($xmlToolbarMenuArray) > 0) {
         $started = false;
         foreach ($xmlToolbarMenuArray as $xmlTBmenu) {
             if ($xmlTBmenu && count($xmlTBmenu->children()) > 0) {
                 foreach ($xmlTBmenu->children() as $menu) {
                     if ($menu->name() == 'menu') {
                         // $name			=	$menu->attributes( 'name' );
                         $action = $menu->attributes('action');
                         $task = $menu->attributes('task');
                         $label = $menu->attributes('label');
                         // $description	=	$menu->attributes( 'description' );
                         if (in_array($action, get_class_methods('CBtoolmenuBar')) || in_array(strtolower($action), get_class_methods('CBtoolmenuBar'))) {
                             // PHP 5 || PHP 4
                             if (!$started) {
                                 CBtoolmenuBar::startTable();
                                 $started = true;
                             }
                             switch ($action) {
                                 case 'custom':
                                 case 'customX':
                                     $icon = $menu->attributes('icon');
                                     $iconOver = $menu->attributes('iconover');
                                     CBtoolmenuBar::$action($task, $icon, $iconOver, $label, false);
                                     break;
                                 case 'editList':
                                     CBtoolmenuBar::editListNoSelect($task, $label);
                                     break;
                                 case 'deleteList':
                                 case 'deleteListX':
                                     $message = $menu->attributes('message');
                                     CBtoolmenuBar::$action($message, $task, $label);
                                     break;
                                 case 'trash':
                                     CBtoolmenuBar::$action($task, $label, false);
                                     break;
                                 case 'preview':
                                     $popup = $menu->attributes('popup');
                                     CBtoolmenuBar::$action($popup, true);
                                     break;
                                 case 'help':
                                     $ref = $menu->attributes('ref');
                                     CBtoolmenuBar::$action($ref, true);
                                     break;
                                 case 'savenew':
                                 case 'saveedit':
                                 case 'divider':
                                 case 'spacer':
                                     CBtoolmenuBar::$action();
                                     break;
                                 case 'back':
                                     $href = $menu->attributes('href');
                                     CBtoolmenuBar::$action($label, $href);
                                     break;
                                 case 'media_manager':
                                     $directory = $menu->attributes('directory');
                                     CBtoolmenuBar::$action($directory, $label);
                                     break;
                                 case 'linkAction':
                                     $urllink = $menu->attributes('urllink');
                                     CBtoolmenuBar::$action($task, $urllink, $label);
                                     break;
                                 default:
                                     CBtoolmenuBar::$action($task, $label);
                                     break;
                             }
                         }
                         // if ( in_array( $action, array(	'customX', 'addNew', 'addNewX', 'publish', 'publishList', 'makeDefault', 'assign', 'unpublish', 'unpublishList',
                         //								'archiveList', 'unarchiveList', ) ) ) {
                         // nothing
                         // }
                     }
                 }
             }
         }
         if ($started) {
             CBtoolmenuBar::endTable();
         }
     }
 }