Set nav classes
@param  array    $sorted_menu_items The menu items, sorted by each menu item's menu order
@param  stdClass $args              An object containing wp_nav_menu() arguments
@return array
772372
public function updateNavCLasses($sorted_menu_items, $args)
    {
        $object_post_type = get_post_type();
        if (! get_post_type()) {
            return $sorted_menu_items;
        }

        // Get post page ID array
        $page_ids = $this->get_page_ids();
        if (! isset($page_ids[$object_post_type])) {
            return $sorted_menu_items;
        }

        foreach ($sorted_menu_items as &$item) {
            if ($item->type === 'post_type' && $item->object === 'page' && intval($item->object_id) === intval($page_ids[$object_post_type])) {
                if (is_singular($object_post_type)) {
                    $item->classes[]             = 'current-menu-ancestor';
                    $item->current_item_ancestor = true;
                }
                if (is_post_type_archive($object_post_type)) {
                    $item->classes[]    = 'current-menu-item';
                    $item->current_item = true;
                }
            }
        }

        return $sorted_menu_items;
    }
903316
protected function sortArgs($prototype, $args)
    {
        $keyArgs = [];
        $posArgs = [];

        // separate positional and keyword arguments
        foreach ($args as $arg) {
            list($key, $value) = $arg;

            $key = $key[1];

            if (empty($key)) {
                $posArgs[] = empty($arg[2]) ? $value : $arg;
            } else {
                $keyArgs[$key] = $value;
            }
        }

        if (! isset($prototype)) {
            return [$posArgs, $keyArgs];
        }

        // copy positional args
        $finalArgs = array_pad($posArgs, count($prototype), null);

        // overwrite positional args with keyword args
        foreach ($prototype as $i => $names) {
            foreach ((array) $names as $name) {
                if (isset($keyArgs[$name])) {
                    $finalArgs[$i] = $keyArgs[$name];
                }
            }
        }

        return [$finalArgs, $keyArgs];
    }
1135507
def sorted_args(self):
        
        return sorted(self.args,
                      key=lambda x: x.is_flag or x.can_be_inferred)
646563
public function get_menu( $menu, $args ) {

		if ( $this->should_cache_menu( $args ) ) {
			$cached_menu = get_transient( $this->menu_key( $args ) );
			if ( is_string( $cached_menu ) ) {
				return $cached_menu;
			}
		}

		return $menu;
	}
768887
public function _remove_current_classes( $items, $args ) {
		if ( is_customize_preview() ) {
			return $items;
		}

		if ( ! static::_is_caching_nav_menus() ) {
			return $items;
		}

		if ( ! $this->_is_caching_nav_menu( $args->theme_location ) ) {
			return $items;
		}

		foreach ( $items as $items_index => $item ) {
			foreach ( $item->classes as $index => $class ) {
				if ( false === strpos( $class, 'current' ) ) {
					continue;
				}
				unset( $items[ $items_index ]->classes[ $index ] );
			}
		}
		return $items;
	}
1372662
public function adminMenuOrderSetting($args)
    {
        if (empty($args)) {
            return;
        }

        add_filter('custom_menu_order', '__return_true');
        add_filter('menu_order', function ($menu_ord) use ($args) {
            return !$menu_ord ? [] : $args;
        });
    }
1123291
private function getLinkInformation(array $args): array
    {
        $arg = Menu::getIndexes($args);
        $url = $this->menuData[$arg[0]][$arg[1]][$arg[2]][$arg[3]][$arg[4]][$arg[5]][$arg[6]][$arg[7]][$arg[8]][$arg[9]]['url'];
        $text = $this->menuData[$arg[0]][$arg[1]][$arg[2]][$arg[3]][$arg[4]][$arg[5]][$arg[6]][$arg[7]][$arg[8]][$arg[9]]['text'];
        $place = $this->menuData[$arg[0]][$arg[1]][$arg[2]][$arg[3]][$arg[4]][$arg[5]][$arg[6]][$arg[7]][$arg[8]][$arg[9]]['place'];
        $id = $this->menuData[$arg[0]][$arg[1]][$arg[2]][$arg[3]][$arg[4]][$arg[5]][$arg[6]][$arg[7]][$arg[8]][$arg[9]]['id'];
        $class = $this->menuData[$arg[0]][$arg[1]][$arg[2]][$arg[3]][$arg[4]][$arg[5]][$arg[6]][$arg[7]][$arg[8]][$arg[9]]['class'];
        return [$url, $text, $place, $id, $class];
    }
359290
public function bootstrapAlertLinkFunction(array $args = []) {

        $attributes = [];

        $attributes["href"] = ArrayHelper::get($args, "href", NavigationInterface::NAVIGATION_HREF_DEFAULT);

        $innerHTML = ArrayHelper::get($args, "content");

        return static::coreHTMLElement("a", $innerHTML, $attributes);
    }
825708
public function addMenu(array $args = [])
    {
        $default_args = [
            'auto_prefix'   => true,
            'page_title'    => '',
            'menu_title'    => '',
            'capability'    => '',
            'page'          => '',
            'class'         => '',
            'template_file' => '',
            'template_dir'  => '',
            'icon'          => '',
            'position'      => null,
            'meta_links'    => [],
            'tabs'          => [],
            'callback'      => null,
        ];
        $cfg = (object) array_merge($default_args, $args);

        $cfg->auto_prefix   = (bool) $cfg->auto_prefix;
        $cfg->page_title    = (string) $cfg->page_title;
        $cfg->menu_title    = (string) $cfg->menu_title;
        $cfg->capability    = (string) $cfg->capability;
        $cfg->page          = (string) $cfg->page;
        $cfg->class         = (string) $cfg->class;
        $cfg->template_file = (string) $cfg->template_file;
        $cfg->template_dir  = (string) $cfg->template_dir;
        $cfg->icon          = (string) $cfg->icon;
        $cfg->position      = (string) $cfg->position;
        $cfg->meta_links    = (array) $cfg->meta_links;
        $cfg->tabs          = (array) $cfg->tabs;

        if ($cfg->page_title && $cfg->auto_prefix // Smart auto-prefixing.
                && $cfg->page_title !== $this->App->Config->©brand['©name']) {
            $cfg->page_title = $cfg->page_title.' | '.$this->App->Config->©brand['©name'];
        } elseif (!$cfg->page_title) {
            $cfg->page_title = $this->App->Config->©brand['©name'];
        }
        if (!$cfg->menu_title) {
            $cfg->menu_title = $this->App->Config->©brand['©name'];
        }
        if (!$cfg->capability) {
            $cfg->capability = $this->App->Config->§caps['§manage'];
        }
        if ($cfg->page && $cfg->auto_prefix // Smart auto-prefixing.
                && $cfg->page[0] !== '/' && mb_stripos($cfg->page, '.php') === false) {
            $cfg->page = $this->App->Config->©brand['©slug'].'-'.$cfg->page;
        } elseif (!$cfg->page) {
            $cfg->page = $this->App->Config->©brand['©slug'];
        }
        $cfg->class .= ($cfg->class ? ' ' : '').'wrap';
        $cfg->class .= ' '.$this->App::CORE_CONTAINER_SLUG.'-menu-page-area';
        $cfg->class .= ' '.$this->App::CORE_CONTAINER_SLUG.'-menu-page-wrapper';
        $cfg->class .= ' '.$this->App->Config->©brand['©slug'].'-menu-page-wrapper';
        $cfg->class .= $cfg->page !== $this->App->Config->©brand['©slug'] ? ' '.$cfg->page.'-menu-page-wrapper' : '';

        if (!$cfg->icon) {
            $cfg->icon = 'dashicons-admin-generic';
        }
        if (!isset($cfg->position[0])) {
            $cfg->position = null; // No preference.
        }
        $cfg = $this->s::applyFilters('menu_page', $cfg, $args, $default_args);

        if (!$cfg->template_file) {
            throw $this->c::issue('Missing template file.');
        }
        $cfg->nav_tabs = $this->is($cfg->page) ? $this->buildNavTabs($cfg) : '';
        $cfg->callback = $cfg->callback ?: function () use ($cfg) {
            echo $this->c::getTemplate('s-core/admin/menu-pages/template.php')->parse(compact('cfg'));
        };
        $this->hook_names[$cfg->page] = // By slug. See: <https://developer.wordpress.org/reference/functions/add_menu_page/>
            add_menu_page($cfg->page_title, $cfg->menu_title, $cfg->capability, $cfg->page, $cfg->callback, $cfg->icon, $cfg->position);
    }
1363218
protected function setArgs( $args ) {
		// Check for an API key being stored.
		if ( $this->getKey() ) {
			$args = wp_parse_args( $args, array( 'key' => $this->getKey() ) );
		}

		// Check for a site hash being stored.
		if ( $this->getSiteHash() ) {
			$args = wp_parse_args( $args, array( 'site_hash' => $this->getSiteHash() ) );
		}

		return $this->args = array(
			'timeout' => 15, // Default timeout is 5 seconds, change to 15.
			'body' => $args
		);
	}
454802
public function _set_cache( $nav_menu, $args ) {
		if ( ! $this->_is_caching_nav_menus() ) {
			return $nav_menu;
		}

		if ( $this->_is_caching_nav_menu( $args->theme_location ) ) {
			set_transient( $this->_get_transient_id( $args->theme_location ), $nav_menu, HOUR_IN_SECONDS );
		}

		return $nav_menu;
	}
683385
public function orderQr(array $args = array()) {
        $data = $this->order($args);
        if ($data === false) {
            return false;
        }
        if (array_key_exists('code_url', $data)) {
            return (new QrCode())->create($data['code_url']);
        }
        throw new Exception('unkown');
        //return (new QrCode())->create($this->getUrl('orderQr', $data));
    }
124738
public function add_section( $args ) {
		global $wp_customize;

		// The default class to be used when creating a section.
		$section_classname = 'WP_Customize_Section';

		if ( isset( $args['type'] ) && array_key_exists( $args['type'], $this->section_types ) ) {
			$section_classname = $this->section_types[ $args['type'] ];
		}
		if ( isset( $args['type'] ) && 'kirki-outer' === $args['type'] ) {
			$args['type']      = 'outer';
			$section_classname = 'WP_Customize_Section';
		}

		// Add the section.
		$wp_customize->add_section( new $section_classname( $wp_customize, $args['id'], $args ) );
	}
882071
public function setNavigationClass($class) {
        if(is_string($class) && !empty(trim($class))){
            $this->menuElements['ul_class'] = $class;
        }
        if((is_string($class) && empty(trim($class))) || $class === false){
            $this->menuElements['ul_class'] = '';
        }
        return $this;
    }
48879
private function set_defaults( $args ) {

		if ( ! isset( $args['glotpress_logo'] ) ) {
			$args['glotpress_logo'] = 'https://plugins.svn.wordpress.org/' . $args['textdomain'] . '/assets/icon-128x128.png';
		}

		if ( ! isset( $args['register_url'] ) ) {
			$args['register_url'] = 'https://translate.wordpress.org/projects/wp-plugins/' . $args['textdomain'] . '/';
		}

		if ( ! isset( $args['glotpress_name'] ) ) {
			$args['glotpress_name'] = 'Translating WordPress';
		}

		if ( ! isset( $args['project_slug'] ) ) {
			$args['project_slug'] = $args['textdomain'];
		}

		return $args;
	}
710519
public function set( $args = array(), $assoc_args = array() ) {
		list( $mod, $value ) = $args;

		set_theme_mod( $mod, $value );

		if ( get_theme_mod( $mod ) === $value ) {
			WP_CLI::success( "Theme mod {$mod} set to {$value}." );
		} else {
			WP_CLI::success( "Could not update theme mod {$mod}." );
		}
	}
963901
public static function getWhere($args = array(), $load_terms = true)
    {
        $instance = Post\Factory::create(get_called_class());

        // Allow sorting both by core fields and custom fields
        // See: http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
        $default_orderby = $instance->getDefaultOrderBy();
        $default_order = $instance->getDefaultOrder();
        $default_args = array(
            'post_type'  => $instance->getPostType(),
            'numberposts'=> -1,
            'orderby'    => $default_orderby,
            'order'      => $default_order,
        );

        // Sometimes you will specify a default orderby using getDefaultOrderBy
        if ($default_orderby !== 'menu_order') {
            $fields = $instance->getFields();
            if (array_key_exists($default_orderby, $fields)) {
                $default_args['meta_key'] = $default_orderby;
                
                // Number fields should be sorted numerically, not alphabetically
                // Of course, this currently requires you to use type=number to achieve numeric sorting
                $default_args['orderby'] = ($fields[$default_orderby]['type'] === 'number')
                    ? 'meta_value_num'
                    : 'meta_value';
            }
        }

        // But other times, you'll just pass in orderby via $args,
        // e.g. if you call getBy or getWhere with the $args param
        if (array_key_exists('orderby', $args)) {
            $fields = $instance->getFields();
            if (array_key_exists($args['orderby'], $fields)) {
                $args['meta_key'] = $args['orderby'];
                
                // Number fields should be sorted numerically, not alphabetically
                // Of course, this currently requires you to use type=number to achieve numeric sorting
                $args['orderby'] = ($fields[$args['orderby']]['type'] === 'number')
                    ? 'meta_value_num'
                    : 'meta_value';
            }
        }
        
        $criteria = array_merge($default_args, $args);
        return Post\Factory::createMultiple(get_posts($criteria), $load_terms);
    }