$sourceData){ foreach($sourceData['rx_cogs'] as $cogId => $cog){ $cog['id'] = $cogId; $cog['source'] = explode('@', $source, 2)[0]; $cog['source_name'] = $sourceData['name']; $cog['rx_category'] = $sourceData['rx_category']; $cog['rx_branch'] = $sourceData['rx_branch']; if($cog['min_bot_version'] == '0.0.0'){ $cog['min_bot_version'] = ''; } if($cog['max_bot_version'] == '0.0.0'){ $cog['max_bot_version'] = ''; } if($cog['min_bot_version'] === $cog['max_bot_version']){ if(!empty($cog['max_bot_version'])){ array_unshift($cog['requirements'], 'Bot==' . $cog['max_bot_version']); } else if(!empty($cog['max_bot_version'])){ array_unshift($cog['requirements'], 'Bot==' . $cog['max_bot_version']); } } else { if(!empty($cog['max_bot_version'])){ array_unshift($cog['requirements'], 'Bot<=' . $cog['max_bot_version']); } if(!empty($cog['min_bot_version'])){ array_unshift($cog['requirements'], 'Bot>=' . $cog['min_bot_version']); } } if(!empty($cog['min_python_version'])){ array_unshift($cog['requirements'], 'Python>=' . implode('.', $cog['min_python_version'])); } if($cog['hidden'] || $cog['disabled']){ continue; } if($cog['rx_category'] == 'unapproved' && $show_ua !== "1"){ continue; } if(count($cog['author']) == 0){ continue; } # ghost entries foreach($cog['tags'] as $index => $this_tag){$cog['tags'][$index] = strtolower($this_tag);} if($filter && !in_array(strtolower($filter), $cog['tags'])){ continue; } if($search){ $matched = FALSE; if(stripos(strtolower($cog['id']), strtolower($search)) !== false){ $matched = TRUE; } else if(stripos(strtolower($cog['description'] ?: $cog['short']), strtolower($search)) !== false){ $matched = TRUE; } else if(in_array(strtolower($search), $cog['tags'])){ $matched = TRUE; } else { foreach($cog['author'] as $author) { if(stripos(strtolower($author), strtolower($search)) !== false){ $matched = TRUE; break; } } foreach($cog['requirements'] as $req) { if(stripos(strtolower($req), strtolower($search)) !== false){ $matched = TRUE; break; } } } if(!$matched){ continue; } } array_push($cogs, $cog); } } function byName($a,$b){ return ($a['id'] <= $b['id']) ? -1 : 1;} usort($cogs, "byName"); $cog_chunks = array_chunk($cogs, $per_page); ?>