Render the parse_subsections checkbox.

@param array $args
969034
function renderTwoLevelTOCField( $args ) {
		unset( $args['label_for'], $args['class'] );
		$this->renderCheckbox(
			[
				'id' => 'parse_subsections',
				'name' => 'pressbooks_theme_options_' . $this->getSlug(),
				'option' => 'parse_subsections',
				'value' => ( isset( $this->options['parse_subsections'] ) ) ? $this->options['parse_subsections'] : '',
				'label' => $args[0],
			]
		);
	}
1252701
public function render_module_template( string $name, array $args ) {
		if ( ! apply_filters( 'hogan/module/' . $name . '/show_in_rest', true ) && \hogan_is_rest() ) {
			return;
		}

		// Get the right module.
		$module = $this->get_module( $name );

		if ( $module instanceof Module ) {
			$module->render_template( $args, $this->_module_counter );
			$this->_module_counter++;
		}
	}
937605
protected function renderZone($zone, $args=array()){
    $sep = isset($args['seperator']) ? $args['seperator'] : ' ';

		if($this->debug===true){
      echo "\n\n".'<!-- Template Zone: '.$zone.' -->';
    }

    $content = '';
    if(isset($this->content[$zone])){
      foreach($this->content[$zone] as $item){
        switch($item['type']){
          case 'hook':
            //method will be called with two arrays as arguments
            //the first is the args passed to this method (ie. in a template call to $this->insert() )
            //the second are the args passed when the hook was bound
            $content .= call_user_func_array($item['hook'], array($args, $item['arguments']));
            break;
          case 'html':
            $content .= $sep . (string) $item['html'];
            break;
          case 'template':
            $content .= $this->renderTemplate($item['template'], $item['params']);
            break;
          case 'zone':
            $content .= $this->renderZone($item['zone'], $item['params']);
            break;
        }

      }
    }
    //content from #movetoskin and #skintemplate
    if( \Skinny::hasContent($zone) ){
      foreach(\Skinny::getContent($zone) as $item){

        //pre-rendered html from #movetoskin
        if(isset($item['html'])){
          if($this->debug===true){
            $content.='<!--Skinny:MoveToSkin: '.$template.'-->';
          }
          $content .= $sep . $item['html'];
        }
        else
        //a template name to render
        if(isset($item['template'])){
          if($this->debug===true){
            $content.='<!--Skinny:Template (via #skintemplate): '.$item['template'].'-->';
          }
          $content .= $this->renderTemplate( $item['template'], $item['params'] );
        }
      }
    }
    return $content;
  }
1226867
public function render($name, array $args = array())
    {
        if ($this->has($name)) {
            $callback = $this->widgets[$name];

            return $this->executeCallback($callback, $args);
        }

        return '';
    }
624826
function renderOutsideMarginField( $args ) {
		unset( $args['label_for'], $args['class'] );
		$this->renderField(
			[
				'id' => 'pdf_page_margin_outside',
				'name' => 'pressbooks_theme_options_' . $this->getSlug(),
				'option' => 'pdf_page_margin_outside',
				'value' => getset( $this->options, 'pdf_page_margin_outside' ),
				'description' => $args[0],
				'type' => 'text',
				'class' => 'small-text',
			]
		);
	}
253584
public function breadcrumbs(array $args = [])
    {
        global $post;

        $defaults = [
            'containerEl'    => 'div',
            'containerId'    => 'breadcrumbs-container',
            'containerClass' => 'breadcrumbs-container container',
            'listEl'         => 'ol',
            'listId'         => 'breadcrumb',
            'listClass'      => 'breadcrumb',
            'crumbEl'        => 'li',
            'activeEl'       => null,
            'activeClass'    => 'active'
        ];

        $args = wp_parse_args($args, $defaults);
        extract($args, EXTR_SKIP);

        if ($activeEl) {
            $openActive = sprintf('<%s><%s class="%s">', $crumbEl, $activeEl, $activeClass);
            $closeActive = sprintf('</%s></%s>', $activeEl, $crumbEl);
        } else {
            $openActive = sprintf('<%s class="%s">', $crumbEl, $activeClass);
            $closeActive = sprintf('</%s>', $crumbEl);
        }

        $output = [];
        $output[] = sprintf('<%s id="%s" class="%s">', $containerEl, $containerId, $containerClass);
        $output[] = PHP_EOL.str_repeat('    ', 2);
        $output[] = sprintf('<%s id="%s" class="%s">', $listEl, $listId, $listClass);
        $output[] = sprintf(
            '<%s><a href="%s">%s</a></%s>',
            $crumbEl,
            esc_url(home_url('/')),
            __('Home', 'novusopress'),
            $crumbEl
        );

        if (is_home() && get_option('page_for_posts')) {
            $blogPageId = get_option('page_for_posts');
            $blogPage = get_page($blogPageId);
            $output[] = $openActive;
            $output[] = $blogPage->post_title;
            $output[] = $closeActive;
        } elseif (is_category()) {
            if (get_option('page_for_posts')) {
                $blogPageId = get_option('page_for_posts');
                $output[] = sprintf(
                    '<%s><a href="%s">%s</a></%s>',
                    $crumbEl,
                    get_permalink($blogPageId),
                    get_the_title($blogPageId),
                    $crumbEl
                );
            }

            $cat = get_category(get_query_var('cat'), false);

            if ($cat->parent != 0) {
                $parents = get_category_parents($cat->parent, true, sprintf('</%s><%s>', $crumbEl, $crumbEl));
                $parents = preg_replace('# title=".*"#', '', $parents);
                $output[] = mb_substr(sprintf('<%s>%s', $crumbEl, $parents), 0, -4);
            }

            $output[] = $openActive;
            $output[] = single_cat_title('', false);
            $output[] = $closeActive;
        } elseif (is_search()) {
            $output[] = $openActive;
            $output[] = get_search_query();
            $output[] = $closeActive;
        } elseif (is_day()) {
            if (get_option('page_for_posts')) {
                $blogPageId = get_option('page_for_posts');
                $output[] = sprintf(
                    '<%s><a href="%s">%s</a></%s>',
                    $crumbEl,
                    get_permalink($blogPageId),
                    get_the_title($blogPageId),
                    $crumbEl
                );
            }

            $output[] = sprintf(
                '<%s><a href="%s">%s</a></%s>',
                $crumbEl,
                get_year_link(get_the_time('Y')),
                get_the_time('Y'),
                $crumbEl
            );

            $output[] = sprintf(
                '<%s><a href="%s">%s</a></%s>',
                $crumbEl,
                get_month_link(get_the_time('Y'), get_the_time('m')),
                get_the_time('F'),
                $crumbEl
            );

            $output[] = $openActive;
            $output[] = get_the_time('d');
            $output[] = $closeActive;
        } elseif (is_month()) {
            if (get_option('page_for_posts')) {
                $blogPageId = get_option('page_for_posts');
                $output[] = sprintf(
                    '<%s><a href="%s">%s</a></%s>',
                    $crumbEl,
                    get_permalink($blogPageId),
                    get_the_title($blogPageId),
                    $crumbEl
                );
            }

            $output[] = sprintf(
                '<%s><a href="%s">%s</a></%s>',
                $crumbEl,
                get_year_link(get_the_time('Y')),
                get_the_time('Y'),
                $crumbEl
            );

            $output[] = $openActive;
            $output[] = get_the_time('F');
            $output[] = $closeActive;
        } elseif (is_year()) {
            if (get_option('page_for_posts')) {
                $blogPageId = get_option('page_for_posts');
                $output[] = sprintf(
                    '<%s><a href="%s">%s</a></%s>',
                    $crumbEl,
                    get_permalink($blogPageId),
                    get_the_title($blogPageId),
                    $crumbEl
                );
            }

            $output[] = $openActive;
            $output[] = get_the_time('Y');
            $output[] = $closeActive;
        } elseif (is_single() && !is_attachment()) {
            if ('post' !== get_post_type()) {
                $postType = get_post_type_object(get_post_type());
                $typeSlug = $postType->rewrite;
                $typeLink = trailingslashit(esc_url(home_url('/')).$typeSlug['slug']);
                $output[] = sprintf(
                    '<%s><a href="%s">%s</a></%s>',
                    $crumbEl,
                    $typeLink,
                    $postType->labels->singular_name,
                    $crumbEl
                );
            } else {
                if (get_option('page_for_posts')) {
                    $blogPageId = get_option('page_for_posts');
                    $output[] = sprintf(
                        '<%s><a href="%s">%s</a></%s>',
                        $crumbEl,
                        get_permalink($blogPageId),
                        get_the_title($blogPageId),
                        $crumbEl
                    );
                }

                $cat = get_the_category();

                if (isset($cat[0])) {
                    $cat = $cat[0];
                    $parents = get_category_parents($cat, true, sprintf('</%s><%s>', $crumbEl, $crumbEl));
                    $parents = preg_replace('# title=".*"#', '', $parents);
                    $output[] = mb_substr(sprintf('<%s>%s', $crumbEl, $parents), 0, -4);
                }
            }

            $output[] = $openActive;
            $output[] = get_the_title();
            $output[] = $closeActive;
        } elseif (!is_single() && !is_page() && get_post_type() != 'post' && !is_404()) {
            $postType = get_post_type_object(get_post_type());
            $output[] = $openActive;
            $output[] = $postType->labels->singular_name;
            $output[] = $closeActive;
        } elseif (is_attachment()) {
            if (get_option('page_for_posts')) {
                $blogPageId = get_option('page_for_posts');
                $output[] = sprintf(
                    '<%s><a href="%s">%s</a></%s>',
                    $crumbEl,
                    get_permalink($blogPageId),
                    get_the_title($blogPageId),
                    $crumbEl
                );
            }

            $parent = get_post($post->post_parent);
            $cat = get_the_category($parent->ID);

            if (isset($cat[0])) {
                $cat = $cat[0];
                $parents = get_category_parents($cat, true, sprintf('</%s><%s>', $crumbEl, $crumbEl));
                $parents = preg_replace('# title=".*"#', '', $parents);
                $output[] = mb_substr(sprintf('<%s>%s', $crumbEl, $parents), 0, -4);
            }

            $output[] = sprintf(
                '<%s><a href="%s">%s</a></%s>',
                $crumbEl,
                get_permalink($parent),
                $parent->post_title,
                $crumbEl
            );

            $output[] = $openActive;
            $output[] = get_the_title();
            $output[] = $closeActive;
        } elseif (is_page() && !$post->post_parent) {
            $output[] = $openActive;
            $output[] = get_the_title();
            $output[] = $closeActive;
        } elseif (is_page() && $post->post_parent) {
            $parentId = $post->post_parent;
            $frontId = get_option('page_on_front');

            if ($parentId != $frontId) {
                $breadcrumbs = [];

                while ($parentId) {
                    $page = get_page($parentId);

                    if ($parentId != $frontId) {
                        $breadcrumbs[] = sprintf(
                            '<%s><a href="%s">%s</a></%s>',
                            $crumbEl,
                            get_permalink($page->ID),
                            get_the_title($page->ID),
                            $crumbEl
                        );
                    }

                    $parentId = $page->post_parent;
                }

                for ($i = count($breadcrumbs) - 1; $i >= 0; $i--) {
                    $output[] = $breadcrumbs[$i];
                }
            }

            $output[] = $openActive;
            $output[] = get_the_title();
            $output[] = $closeActive;
        } elseif (is_tag()) {
            if (get_option('page_for_posts')) {
                $blogPageId = get_option('page_for_posts');
                $output[] = sprintf(
                    '<%s><a href="%s">%s</a></%s>',
                    $crumbEl,
                    get_permalink($blogPageId),
                    get_the_title($blogPageId),
                    $crumbEl
                );
            }

            $output[] = $openActive;
            $output[] = single_tag_title('', false);
            $output[] = $closeActive;
        } elseif (is_author()) {
            global $author;

            if (get_option('page_for_posts')) {
                $blogPageId = get_option('page_for_posts');
                $output[] = sprintf(
                    '<%s><a href="%s">%s</a></%s>',
                    $crumbEl,
                    get_permalink($blogPageId),
                    get_the_title($blogPageId),
                    $crumbEl
                );
            }

            $userdata = get_userdata($author);
            $output[] = $openActive;
            $output[] = $userdata->display_name;
            $output[] = $closeActive;
        } elseif (is_404()) {
            $output[] = $openActive;
            $output[] = __('Error 404', 'novusopress');
            $output[] = $closeActive;
        } elseif (has_post_format() && !is_singular()) {
            $output[] = $openActive;
            $output[] = get_post_format_string(get_post_format());
            $output[] = $closeActive;
        }

        $output[] = sprintf('</%s>', $listEl);
        $output[] = PHP_EOL.'    ';
        $output[] = sprintf('</%s><!-- #%s -->', $containerEl, $containerId);

        $output = implode('', $output);

        return apply_filters('novusopress_view_breadcrumbs_output', $output);
    }
1022731
public static function renderBlocks($name, $args = array())
    {
        global $PPHP, $_SESSION;

        array_merge_assoc(
            self::$_stash,
            $args,
            array(
                'config' => $PPHP['config'],
                'session' => $_SESSION,
                'req' => grab('request')
            )
        );
        try {
            $template = self::$_twig->loadTemplate($name);
            $blockNames = $template->getBlockNames(self::$_stash);
            $results = array();
            foreach ($blockNames as $blockName) {
                $results[$blockName] = $template->renderBlock($blockName, self::$_stash);
            };
        } catch (\Exception $e) {
            echo $e->getMessage();
        };
        return $results;
    }
12355
protected function parseStatusArguments(string $status, array $args): array
    {
        $name = ucfirst($status);

        return wp_parse_args($args, [
            'label' => $name,
            'public' => true,
            'exclude_from_search' => false,
            'show_in_admin_all_list' => true,
            'show_in_admin_status_list' => true,
            'label_count' => _n_noop(
                $name.' <span class="count">(%s)</span>',
                $name.' <span class="count">(%s)</span>'
            ),
            'publish_text' => __('Apply Changes')
        ]);
    }
726391
public function execute(array $args = [], array $options = [])
    {
        $d     = new Service\DebugService();
        $infos = $d->describe();
        $max   = 0;

        foreach ($infos as $section => $data) {
            foreach ($data as $k => $v) {
                $len = strlen($k);
                $max = $max < $len ? $len : $max;
            }
        }

        foreach ($infos as $section => $data) {
            echo sprintf('[%s]', strtoupper($section)).PHP_EOL.PHP_EOL;
            foreach ($data as $k => $v) {
                echo sprintf(' %'.((int) $max).'s:  %s', ucwords(str_replace('_', ' ', $k)), is_array($v) ? join(' ', $v) : (is_bool($v) ? ($v ? 'true' : 'false') : $v)).PHP_EOL;
            }
            echo PHP_EOL;
        }
    }
390796
protected function renderRaw($content, $args = array(), $templateDir = null)
    {
        if (\is_array($content)) {
            $content = json_encode($content);
        }

        return $content;
    }
75202
protected function handleArgs(array $args) {
        $groupedArgs = $this->argumentsParser->group($args);
        list($groupedArgs, $continue) = $this->runGlobalCommands($groupedArgs);

        if ($continue === false) {
            return;
        }

        try {
            list($command, $groupedArgs) = $this->argumentsMatcher
                ->matchCommands($this->getNotGlobalCommands(), $groupedArgs);
            $command = clone $command;
            $this->runCommand($command);
        } catch (MissingCommandNameException $ex) {
            array_unshift($args, $this->getDefaultCommandName());
            $this->parseArgs($args);
        } catch (Exception $ex) {
            if ($this->getCatchErrors()) {
                $widget = new ExceptionWidget($this->input, $this->output);
                $widget->render($ex);
            } else {
                throw $ex;
            }
        }
    }
525031
function renderInsideMarginField( $args ) {
		unset( $args['label_for'], $args['class'] );
		$this->renderField(
			[
				'id' => 'pdf_page_margin_inside',
				'name' => 'pressbooks_theme_options_' . $this->getSlug(),
				'option' => 'pdf_page_margin_inside',
				'value' => getset( $this->options, 'pdf_page_margin_inside' ),
				'description' => $args[0],
				'type' => 'text',
				'class' => 'small-text',
			]
		);
	}
376296
static public function tagsChildren( $args )
    {
        $http = eZHTTPTool::instance();
        $filter = urldecode( trim( $http->getVariable( 'filter', '' ) ) );

        if ( !isset( $args[0] ) || !is_numeric( $args[0] ) )
            return array( 'count' => 0, 'offset' => false, 'filter' => $filter, 'data' => array() );

        $offset = false;
        $limits = null;

        if ( $http->hasGetVariable( 'offset' ) )
        {
            $offset = (int) $http->getVariable( 'offset' );

            if ( $http->hasGetVariable( 'limit' ) )
                $limit = (int) $http->getVariable( 'limit' );
            else
                $limit = 10;

            $limits = array( 'offset' => $offset, 'limit' => $limit );
        }

        $sorts = null;
        if ( $http->hasGetVariable( 'sortby' ) )
        {
            $sortBy = trim( $http->getVariable( 'sortby' ) );

            $sortDirection = 'asc';
            if ( $http->hasGetVariable( 'sortdirection' ) && trim( $http->getVariable( 'sortdirection' ) ) == 'desc' )
                $sortDirection = 'desc';

            $sorts = array( $sortBy => $sortDirection );
        }

        $fetchParams = array( 'parent_id' => (int) $args[0], 'main_tag_id' => 0 );
        if ( !empty( $filter ) )
            $fetchParams['keyword'] = array( 'like', '%' . $filter . '%' );

        /** @var eZTagsObject[] $children */
        $children = eZTagsObject::fetchList( $fetchParams, $limits, $sorts );
        $childrenCount = eZTagsObject::fetchListCount( $fetchParams );

        if ( !is_array( $children ) || empty( $children ) )
            return array( 'count' => 0, 'offset' => false, 'filter' => $filter, 'data' => array() );

        $dataArray = array();
        foreach ( $children as $child )
        {
            $tagArray = array();
            $tagArray['id'] = $child->attribute( 'id' );
            $tagArray['keyword'] = htmlspecialchars( $child->attribute( 'keyword' ), ENT_QUOTES );
            $tagArray['modified'] = $child->attribute( 'modified' );

            $tagArray['translations'] = array();
            foreach ( $child->getTranslations() as $translation )
            {
                $tagArray['translations'][] = htmlspecialchars( $translation->attribute( 'locale' ), ENT_QUOTES );
            }

            $dataArray[] = $tagArray;
        }

        return array(
            'count'  => $childrenCount,
            'offset' => $offset,
            'filter' => $filter,
            'data'   => $dataArray
        );
    }
258008
protected function parseArguments(array $args)
    {
        $output = [];

        foreach ($args as $arg) {
            if (is_string($arg) && strpos($arg, '@') === 0) {
                $service = substr($arg, 1);
                $output[] = $this->container->get($service);

                continue;
            }

            $output[] = $arg;
        }

        return $output;
    }
1249988
public function pageDropDown(array $args)
    {
        $default = $args['post_type']->name;
        if (isset($this->original_slugs[$args['post_type']->name])) {
            $default = self::$originalSlugs[$args['post_type']->name];
        }

        wp_dropdown_pages(array(
            'post_status'      => array('publish', 'private'),
            'name'             => esc_attr($args['name']),
            'id'               => esc_attr($args['name'] . '_dropdown'),
            'selected'         => esc_attr($args['value']),
            'show_option_none' => sprintf(__('Default (/%s/)'), $default),
        ));

        $useTemplate = checked(get_option('page_for_' . $args['post_type']->name . '_template'), 'on', false);
        if ($useTemplate) {
            echo '<label style="margin-left: 10px;"><input type="checkbox" name="page_for_' . $args['post_type']->name . '_template" checked> ' . __('Use template from page', 'wp-page-for-post-type') . '</label>';
        } else {
            echo '<label style="margin-left: 10px;"><input type="checkbox" name="page_for_' . $args['post_type']->name . '_template"> ' . __('Use template from page', 'wp-page-for-post-type') . '</label>';
        }

        $useContent = checked(get_option('page_for_' . $args['post_type']->name . '_content'), 'on', false);
        if ($useContent) {
            echo '<label style="margin-left: 10px;"><input type="checkbox" name="page_for_' . $args['post_type']->name . '_content" checked> ' . __('Use content from page', 'wp-page-for-post-type') . '</label>';
        } else {
            echo '<label style="margin-left: 10px;"><input type="checkbox" name="page_for_' . $args['post_type']->name . '_content"> ' . __('Use content from page', 'wp-page-for-post-type') . '</label>';
        }
    }
492427
private function parse_args($args = [])
    {
        $args['NAMESPACE'] = '';

        $class_name = $this->sanitise_filename($args['CLASSNAME']);

        if ($this->is_nested_directory($class_name)) {
            $parts = \explode('\\', $class_name);
            $class = \array_pop($parts);

            $args['NAMESPACE'] = '\\' . \implode('\\', $parts);
            $args['CLASSNAME'] = $class;
        }

        return $args;
    }
1154096
public function inputRow(array $args = [])
    {
        $default_args = [
            // Required.
            'label' => '',

            // Suggested.
            'tip' => '',

            // Required.
            'name'  => '',
            'value' => '',

            // Optional.
            'type' => 'text',

            // Optional.
            'placeholder' => '',
            'note'        => '',

            // Optional.
            'class' => '',
            'style' => '',
            'attrs' => '',

            // Optional.
            'if' => '',
        ];
        if (!array_key_exists('value', $args)) {
            throw $this->c::issue('Missing `value` key.');
        }
        $cfg = array_merge($default_args, $args);
        $cfg = array_intersect_key($cfg, $default_args);
        $cfg = array_map('strval', $cfg);

        if (!$cfg['name']) {
            throw $this->c::issue('Arg `name` is required.');
        } elseif (in_array($cfg['type'], ['checkbox', 'radio', 'reset', 'button', 'image'], true)) {
            throw $this->c::issue(sprintf('Input `type="%1$s"` is unsupported at this time.', $cfg['type']));
        }
        $cfg['var_name'] = $cfg['name']; // Internal copy.
        $cfg['id']       = $this->elementId($cfg['var_name']);
        $cfg['name']     = $this->elementName($cfg['var_name']);
        $cfg['class']    = $this->c::mbTrim($cfg['class'].' '.$this->elementClass($cfg['var_name']));

        $cfg['tip']  = $cfg['tip'] ? $this->s::menuPageTip($cfg['tip']) : '';
        $cfg['note'] = $cfg['note'] ? $this->s::menuPageNote($cfg['note']) : '';

        if ($cfg['type'] === 'hidden') {
            $markup = '<tr class="-hidden">';
            $markup .= '<td colspan="2">';
            $markup .= '<input'. // Hidden input value.
                            ' type="'.esc_attr($cfg['type']).'"'.
                            ' name="'.esc_attr($cfg['name']).'" id="'.esc_attr($cfg['id']).'"'.
                            ' class="'.esc_attr($cfg['class']).'" style="'.esc_attr($cfg['style']).'"'.
                            ' placeholder="'.esc_attr($cfg['placeholder']).'" autocomplete="new-password"'.
                            ' value="'.($cfg['type'] === 'url' ? esc_url($cfg['value']) : esc_attr($cfg['value'])).'"'.
                            ($cfg['attrs'] ? ' '.$cfg['attrs'] : '').
                            ' />';
            $markup .= '</td>';
            $markup .= '</tr>';
        } else { // Any other type of `<input>` tag.
            $markup = '<tr'.($cfg['if'] ? ' data-if="'.esc_attr($cfg['if']).'"' : '').'>';

            if ($cfg['label']) {
                $markup .= '<th scope="row">';
                $markup .= '<div>'; // For positioning.
                $markup .= $cfg['tip'];
                $markup .= '<label for="'.esc_attr($cfg['id']).'" title="'.esc_attr($cfg['label']).'">'.
                                $cfg['label'].
                           '</label>';
                $markup .= '</div>';
                $markup .= '</th>';
            }
            $markup .= '<td'.(!$cfg['label'] ? ' colspan="2"' : '').'>';
            $markup .= '<div>'; // For positioning.
            $markup .= '<input'.
                            ' type="'.esc_attr($cfg['type']).'"'.
                            ' name="'.esc_attr($cfg['name']).'" id="'.esc_attr($cfg['id']).'"'.
                            ' class="'.esc_attr($cfg['class']).'" style="'.esc_attr($cfg['style']).'"'.
                            ' placeholder="'.esc_attr($cfg['placeholder']).'" autocomplete="new-password"'.
                            ' value="'.($cfg['type'] === 'url' ? esc_url($cfg['value']) : esc_attr($cfg['value'])).'"'.
                            ($cfg['attrs'] ? ' '.$cfg['attrs'] : '').
                            ' />';
            $markup .= $cfg['note'];
            $markup .= '</div>';
            $markup .= '</td>';

            $markup .= '</tr>';
        }
        return $markup;
    }