CloneSet10


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
157240.997toplevel_statement_sequence[2]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
115711
components/com_newsfeeds/router.php
21589
components/com_weblinks/router.php
Clone Instance
1
Line Count
157
Source Line
11
Source File
components/com_newsfeeds/router.php

function NewsfeedsBuildRoute( &$query) {

        static $items;

        $segments=        array();
        $itemid=          0;
        $menuitem=        0;

        // Get the menu items for this component.
        if (!$items) {
                $component=       &JComponentHelper::getComponent('com_newsfeeds');
                $menu=            &JSite::getMenu();
                $items=           $menu->getItems('component_id', $component->id);
              }

        if ( isset ($query['view']))
        {
                if ($query['view'] == 'category')
                {
                        $catid=  (int) $query['id'];
                      }
                  elseif ($query['view'] == 'newsfeed') {
                        $catid=  (int) $query['catid'];
                      }
                $view=  $query['view'];
              }
        if ( isset ($catid)
             &&               $catid>  0) {
                $categoryTree=  JCategories::getInstance('com_newsfeeds');
                $category=  $categoryTree->get($catid);
              }

        if ( isset ($category)
             &&                  count($items)) {
                $path=  array();
                while ($category instanceof JCategoryNode)
                {
                        foreach ($items as $item)
                        {
                                if ($item->query['view'] == 'newsfeed'
                                    &&     $view == 'newsfeed'
                                    &&     (int) $item->query['id'] == (int) $query['id'])
                                {
                                        $itemid=  $item->id;
                                        $menuitem=  1;
                                        break;
                                      }
                              }
                        foreach ($items as $item)
                        {
                                if ($item->query['view'] == 'category'
                                    &&     (int) $item->query['id'] == (int) $category->id)
                                {
                                        $itemid=  $item->id;
                                        break;
                                      }
                              }
                        if ($itemid>  0)
                        {
                                break;
                              }
                        else   {
                                $path[]=  $category->slug;
                                $category=  $category->getParent();
                              }
                      }
                if ($itemid>  0)
                {
                        $query['Itemid']=  $itemid;
                      }
                $path=  array_reverse($path);
                $segments=  array_merge($segments, $path);
              }
        if ( isset ($view)
             &&              $view == 'newsfeed'
             &&                                     $itemid>  0) {
                if (!$menuitem)
                $segments[]=  $query['id'];
              }
        if ($itemid == 0
            &&              isset ($query['id'])) {
                $segments[]=  $query['id'];
              }

        // Remove the unnecessary URL segments.
        unset ($query['view']);
        unset ($query['id']);
        unset ($query['catid']);

        return $segments;
      }

function NewsfeedsParseRoute($segments) {

        $vars=    array();

        // Get the active menu item.
        $menu=    &JSite::getMenu();
        $item=    &$menu->getActive();

        // Check if we have a valid menu item.
        if (is_object($item))
        {
                if ($item->query['view'] == 'category')
                {
                        $categorytree=  JCategories::getInstance('com_newsfeeds');
                        $category=  $categorytree->get($item->query['id']);
                        foreach ($segments as $segment)
                        {
                                $found=  0;
                                foreach ($category->getChildren() as $child)
                                {
                                        if ($segment == $child->slug)
                                        {
                                                $found=  1;
                                                $category=  $child;
                                                break;
                                              }
                                      }
                                if ($found == 0)
                                {
                                        $vars['id']=  $segment;
                                        $vars['catid']=  $category->slug;
                                        $vars['view']=  'newsfeed';
                                      }
                                else   {
                                        $vars['id']=  $category->slug;
                                        $vars['view']=  'category';
                                      }
                              }
                      }
              }
        else {
                // Count route segments
                $count=  count($segments);

                // Check if there are any route segments to handle.
                if ($count)
                {
                        if (count($segments[0]) == 2)
                        {
                                // We are viewing a newsfeed.
                                $vars['view']=    'newsfeed';
                                $vars['id']=              $segments[$count-2];
                                $vars['catid']=   $segments[$count-1];
                              }
                        else

                        {
                                // We are viewing a category.
                                $vars['view']=    'category';
                                $vars['catid']=   $segments[$count-1];
                              }
                      }
              }

        return $vars;
      }


Clone Instance
2
Line Count
158
Source Line
9
Source File
components/com_weblinks/router.php

function WeblinksBuildRoute( &$query) {

        static $items;

        $segments=        array();
        $itemid=          0;
        $menuitem=        0;

        // Get the menu items for this component.
        if (!$items) {
                $component=       &JComponentHelper::getComponent('com_weblinks');
                $menu=            &JSite::getMenu();
                $items=           $menu->getItems('component_id', $component->id);
              }

        if ( isset ($query['view']))
        {
                if ($query['view'] == 'category')
                {
                        $catid=  (int) $query['id'];
                      }
                elseif ($query['view'] == 'weblink') {
                        $catid=  (int) $query['catid'];
                      }
                $view=  $query['view'];
              }

        if ( isset ($catid)
             &&               $catid>  0) {
                $categoryTree=  JCategories::getInstance('com_weblinks');
                $category=  $categoryTree->get($catid);
              }

        if ( isset ($category)
             &&                  count($items)) {
                $path=  array();
                while ($category instanceof JCategoryNode)
                {
                        foreach ($items as $item)
                        {
                                if ($item->query['view'] == 'weblink'
                                    &&     $view == 'weblink'
                                    &&     (int) $item->query['id'] == (int) $query['id'])
                                {
                                        $itemid=  $item->id;
                                        $menuitem=  1;
                                        break;
                                      }
                              }
                        foreach ($items as $item)
                        {
                                if ($item->query['view'] == 'category'
                                    &&     (int) $item->query['id'] == (int) $category->id)
                                {
                                        $itemid=  $item->id;
                                        break;
                                      }
                              }
                        if ($itemid>  0)
                        {
                                break;
                              }
                        else   {
                                $path[]=  $category->slug;
                                $category=  $category->getParent();
                              }
                      }
                if ($itemid>  0)
                {
                        $query['Itemid']=  $itemid;
                      }
                $path=  array_reverse($path);
                $segments=  array_merge($segments, $path);
              }
        if ( isset ($view)
             &&              $view == 'weblink'
             &&                                    $itemid>  0) {
                if (!$menuitem)
                $segments[]=  $query['id'];
              }
        if ($itemid == 0
            &&              isset ($query['id'])) {
                $segments[]=  $query['id'];
              }

        // Remove the unnecessary URL segments.
        unset ($query['view']);
        unset ($query['id']);
        unset ($query['catid']);

        return $segments;
      }

function WeblinksParseRoute($segments) {

        $vars=    array();

        // Get the active menu item.
        $menu=    &JSite::getMenu();
        $item=    &$menu->getActive();

        // Check if we have a valid menu item.
        if (is_object($item))
        {
                if ($item->query['view'] == 'category')
                {
                        $categorytree=  JCategories::getInstance('com_weblinks');
                        $category=  $categorytree->get($item->query['id']);
                        foreach ($segments as $segment)
                        {
                                $found=  0;
                                foreach ($category->getChildren() as $child)
                                {
                                        if ($segment == $child->slug)
                                        {
                                                $found=  1;
                                                $category=  $child;
                                                break;
                                              }
                                      }
                                if ($found == 0)
                                {
                                        $vars['id']=  $segment;
                                        $vars['catid']=  $category->slug;
                                        $vars['view']=  'weblink';
                                      }
                                else   {
                                        $vars['id']=  $category->slug;
                                        $vars['view']=  'category';
                                      }
                              }
                      }
              }
        else {
                // Count route segments
                $count=  count($segments);

                // Check if there are any route segments to handle.
                if ($count)
                {
                        if (count($segments[0]) == 2)
                        {
                                // We are viewing a newsfeed.
                                $vars['view']=    'newsfeed';
                                $vars['id']=              $segments[$count-2];
                                $vars['catid']=   $segments[$count-1];
                              }
                        else

                        {
                                // We are viewing a category.
                                $vars['view']=    'category';
                                $vars['catid']=   $segments[$count-1];
                              }
                      }
              }

        return $vars;
      }


Clone AbstractionParameter Count: 4Parameter Bindings

function [[#variable58633ca0]]( &$query) {
  static $items;
  $segments=array();
  $itemid=0;
  $menuitem=0;
  // Get the menu items for this component.
  if (!$items) {
    $component= &JComponentHelper::getComponent( [[#variable58633e40]]);
    $menu= &JSite::getMenu();
    $items=$menu->getItems('component_id',$component->id);
  }
  if ( isset ($query['view'])) {
    if ($query['view'] == 'category') {
      $catid= (int) $query['id'];
    }
    elseif ($query['view'] == [[#variable58633e60]]) {
      $catid= (int) $query['catid'];
    }
    $view=$query['view'];
  }
  if ( isset ($catid)
       && $catid>0) {
    $categoryTree=JCategories::getInstance( [[#variable58633e40]]);
    $category=$categoryTree->get($catid);
  }
  if ( isset ($category)
       && count($items)) {
    $path=array();
    while ($category instanceof JCategoryNode) {
      foreach ($items as $item) {
        if ($item->query['view'] == [[#variable58633e60]]
            && $view == [[#variable58633e60]]
            && (int) $item->query['id'] == (int) $query['id']) {
          $itemid=$item->id;
          $menuitem=1;
          break;
        }
      }
      foreach ($items as $item) {
        if ($item->query['view'] == 'category'
            && (int) $item->query['id'] == (int) $category->id) {
          $itemid=$item->id;
          break;
        }
      }
      if ($itemid>0) {
        break;
      }
      else {
        $path[]=$category->slug;
        $category=$category->getParent();
      }
    }
    if ($itemid>0) {
      $query['Itemid']=$itemid;
    }
    $path=array_reverse($path);
    $segments=array_merge($segments,$path);
  }
  if ( isset ($view)
       && $view == [[#variable58633e60]]
       && $itemid>0) {
    if (!$menuitem)
      $segments[]=$query['id'];
  }
  if ($itemid == 0
      && isset ($query['id'])) {
    $segments[]=$query['id'];
  }
  // Remove the unnecessary URL segments.
  unset ($query['view']);
  unset ($query['id']);
  unset ($query['catid']);
  return $segments;
}

function [[#variable55097ea0]]($segments) {
  $vars=array();
  // Get the active menu item.
  $menu= &JSite::getMenu();
  $item= &$menu->getActive();
  // Check if we have a valid menu item.
  if (is_object($item)) {
    if ($item->query['view'] == 'category') {
      $categorytree=JCategories::getInstance( [[#variable58633e40]]);
      $category=$categorytree->get($item->query['id']);
      foreach ($segments as $segment) {
        $found=0;
        foreach ($category->getChildren() as $child) {
          if ($segment == $child->slug) {
            $found=1;
            $category=$child;
            break;
          }
        }
        if ($found == 0) {
          $vars['id']=$segment;
          $vars['catid']=$category->slug;
          $vars['view']= [[#variable58633e60]];
        }
        else {
          $vars['id']=$category->slug;
          $vars['view']='category';
        }
      }
    }
  }
  else {
    // Count route segments
    $count=count($segments);
    // Check if there are any route segments to handle.
    if ($count) {
      if (count($segments[0]) == 2) {
        // We are viewing a newsfeed.
        $vars['view']='newsfeed';
        $vars['id']=$segments[$count-2];
        $vars['catid']=$segments[$count-1];
      }
      else {
        // We are viewing a category.
        $vars['view']='category';
        $vars['catid']=$segments[$count-1];
      }
    }
  }
  return $vars;
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#58633ca0]]
NewsfeedsBuildRoute 
12[[#58633ca0]]
WeblinksBuildRoute 
21[[#58633e40]]
'com_newsfeeds' 
22[[#58633e40]]
'com_weblinks' 
31[[#58633e60]]
'newsfeed' 
32[[#58633e60]]
'weblink' 
41[[#55097ea0]]
NewsfeedsParseRoute 
42[[#55097ea0]]
WeblinksParseRoute