XANNYANAXIUM FILE MANAGER

Navigate and manage your files

Current Directory
Upload File
Standard Upload
Advanced Upload

Status: No file selected

Create New
Name Type Size Modified Permission Actions
/ .. Directory — 2025-05-23 05:57:18 0755
/ wp-admin Directory — 2026-08-24 09:01:10 0755
/ wp-content Directory — 2026-09-23 15:34:11 0755
/ wp-includes Directory — 2026-09-23 15:34:04 0755
.htaccess HTACCESS 1.92 KB 2026-05-07 22:43:39 0644
.htaccess.bk BK 1.15 KB 2025-11-21 07:04:52 0644
.htaccess_old HTACCESS_OLD 1.80 KB 2025-11-21 07:14:55 0644
.user.ini INI 9 bytes 2026-01-05 06:16:59 0644
atomlib.php PHP 0 bytes 2026-09-22 09:09:48 0644
default.php PHP 15.99 KB 2025-05-23 12:16:32 0644
edits.php PHP 0 bytes 2026-09-22 08:49:13 0644
index.php PHP 1.30 KB 2026-09-22 06:21:28 0644
license.txt TXT 19.44 KB 2026-08-20 12:39:46 0644
phpinfo.php PHP 20 bytes 2025-05-23 05:57:32 0644
readme.html HTML 7.23 KB 2026-09-18 01:39:40 0644
robots.txt TXT 405 bytes 2026-09-22 07:12:19 0644
wp-activate.php PHP 7.54 KB 2026-08-20 12:39:46 0644
wp-blog-header.php PHP 351 bytes 2025-05-23 12:16:32 0644
wp-comments-post.php PHP 2.27 KB 2025-05-23 12:16:32 0644
wp-config-sample.php PHP 46 bytes 2026-09-23 15:34:06 0644
wp-config.php PHP 3.53 KB 2025-11-21 07:39:35 0644
wp-cron.php PHP 5.49 KB 2025-05-23 12:16:32 0644
wp-links-opml.php PHP 2.43 KB 2025-12-03 12:55:28 0644
wp-load.php PHP 3.84 KB 2025-05-23 12:16:32 0644
wp-login.php PHP 51.30 KB 2026-08-20 12:39:46 0644
wp-mail.php PHP 8.52 KB 2025-12-03 12:55:30 0644
wp-postnews.php PHP 12.59 KB 2026-09-23 09:22:15 0644
wp-settings.php PHP 32.38 KB 2026-08-20 12:39:46 0644
wp-signup.php PHP 34.26 KB 2026-08-20 12:39:46 0644
wp-sx9a.php PHP 0 bytes 2026-09-22 08:49:04 0644
wp-trackback.php PHP 5.27 KB 2026-08-20 12:39:46 0644
xmlrpc.php PHP 3.13 KB 2025-05-23 12:16:32 0644

Dir : /opt/go/pkg/mod/github.com/go-openapi/analysis@v0.22.2/internal/flatten/sortref/
Server: Linux in-mum-web1754.main-hosting.eu 5.14.0-611.55.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 19 15:19:29 EDT 2026 x86_64
IP: 77.37.46.203
Choose File :
Url:
Dir : //opt/go/pkg/mod/github.com/go-openapi/analysis@v0.22.2/internal/flatten/sortref/keys.go

package sortref

import (
	"net/http"
	"path"
	"strconv"
	"strings"

	"github.com/go-openapi/jsonpointer"
	"github.com/go-openapi/spec"
)

const (
	paths       = "paths"
	responses   = "responses"
	parameters  = "parameters"
	definitions = "definitions"
)

var (
	ignoredKeys  map[string]struct{}
	validMethods map[string]struct{}
)

func init() {
	ignoredKeys = map[string]struct{}{
		"schema":     {},
		"properties": {},
		"not":        {},
		"anyOf":      {},
		"oneOf":      {},
	}

	validMethods = map[string]struct{}{
		"GET":     {},
		"HEAD":    {},
		"OPTIONS": {},
		"PATCH":   {},
		"POST":    {},
		"PUT":     {},
		"DELETE":  {},
	}
}

// Key represent a key item constructed from /-separated segments
type Key struct {
	Segments int
	Key      string
}

// Keys is a sortable collable collection of Keys
type Keys []Key

func (k Keys) Len() int      { return len(k) }
func (k Keys) Swap(i, j int) { k[i], k[j] = k[j], k[i] }
func (k Keys) Less(i, j int) bool {
	return k[i].Segments > k[j].Segments || (k[i].Segments == k[j].Segments && k[i].Key < k[j].Key)
}

// KeyParts construct a SplitKey with all its /-separated segments decomposed. It is sortable.
func KeyParts(key string) SplitKey {
	var res []string
	for _, part := range strings.Split(key[1:], "/") {
		if part != "" {
			res = append(res, jsonpointer.Unescape(part))
		}
	}

	return res
}

// SplitKey holds of the parts of a /-separated key, so that their location may be determined.
type SplitKey []string

// IsDefinition is true when the split key is in the #/definitions section of a spec
func (s SplitKey) IsDefinition() bool {
	return len(s) > 1 && s[0] == definitions
}

// DefinitionName yields the name of the definition
func (s SplitKey) DefinitionName() string {
	if !s.IsDefinition() {
		return ""
	}

	return s[1]
}

func (s SplitKey) isKeyName(i int) bool {
	if i <= 0 {
		return false
	}

	count := 0
	for idx := i - 1; idx > 0; idx-- {
		if s[idx] != "properties" {
			break
		}
		count++
	}

	return count%2 != 0
}

// PartAdder know how to construct the components of a new name
type PartAdder func(string) []string

// BuildName builds a name from segments
func (s SplitKey) BuildName(segments []string, startIndex int, adder PartAdder) string {
	for i, part := range s[startIndex:] {
		if _, ignored := ignoredKeys[part]; !ignored || s.isKeyName(startIndex+i) {
			segments = append(segments, adder(part)...)
		}
	}

	return strings.Join(segments, " ")
}

// IsOperation is true when the split key is in the operations section
func (s SplitKey) IsOperation() bool {
	return len(s) > 1 && s[0] == paths
}

// IsSharedOperationParam is true when the split key is in the parameters section of a path
func (s SplitKey) IsSharedOperationParam() bool {
	return len(s) > 2 && s[0] == paths && s[2] == parameters
}

// IsSharedParam is true when the split key is in the #/parameters section of a spec
func (s SplitKey) IsSharedParam() bool {
	return len(s) > 1 && s[0] == parameters
}

// IsOperationParam is true when the split key is in the parameters section of an operation
func (s SplitKey) IsOperationParam() bool {
	return len(s) > 3 && s[0] == paths && s[3] == parameters
}

// IsOperationResponse is true when the split key is in the responses section of an operation
func (s SplitKey) IsOperationResponse() bool {
	return len(s) > 3 && s[0] == paths && s[3] == responses
}

// IsSharedResponse is true when the split key is in the #/responses section of a spec
func (s SplitKey) IsSharedResponse() bool {
	return len(s) > 1 && s[0] == responses
}

// IsDefaultResponse is true when the split key is the default response for an operation
func (s SplitKey) IsDefaultResponse() bool {
	return len(s) > 4 && s[0] == paths && s[3] == responses && s[4] == "default"
}

// IsStatusCodeResponse is true when the split key is an operation response with a status code
func (s SplitKey) IsStatusCodeResponse() bool {
	isInt := func() bool {
		_, err := strconv.Atoi(s[4])

		return err == nil
	}

	return len(s) > 4 && s[0] == paths && s[3] == responses && isInt()
}

// ResponseName yields either the status code or "Default" for a response
func (s SplitKey) ResponseName() string {
	if s.IsStatusCodeResponse() {
		code, _ := strconv.Atoi(s[4])

		return http.StatusText(code)
	}

	if s.IsDefaultResponse() {
		return "Default"
	}

	return ""
}

// PathItemRef constructs a $ref object from a split key of the form /{path}/{method}
func (s SplitKey) PathItemRef() spec.Ref {
	if len(s) < 3 {
		return spec.Ref{}
	}

	pth, method := s[1], s[2]
	if _, isValidMethod := validMethods[strings.ToUpper(method)]; !isValidMethod && !strings.HasPrefix(method, "x-") {
		return spec.Ref{}
	}

	return spec.MustCreateRef("#" + path.Join("/", paths, jsonpointer.Escape(pth), strings.ToUpper(method)))
}

// PathRef constructs a $ref object from a split key of the form /paths/{reference}
func (s SplitKey) PathRef() spec.Ref {
	if !s.IsOperation() {
		return spec.Ref{}
	}

	return spec.MustCreateRef("#" + path.Join("/", paths, jsonpointer.Escape(s[1])))
}