Displays an XRDS document, or redirects to it.
By default, it detects whether it should display or redirect automatically.
@param bool|null $force When true, always display the document, when false always redirect.
553056
function xrds($force=null)
    {
        if($force) {
            echo $this->xrdsContent();
            die();
        } elseif($force === false) {
            header('X-XRDS-Location: '. $this->xrdsLocation);
            return;
        }
        
        if (isset($_GET['xrds'])
            || (isset($_SERVER['HTTP_ACCEPT']) &&  strpos($_SERVER['HTTP_ACCEPT'], 'application/xrds+xml') !== false)
        ) {
            header('Content-Type: application/xrds+xml');
            echo $this->xrdsContent();
            die();
        }
        
        header('X-XRDS-Location: ' . $this->xrdsLocation);
    }
47287
public static function flush_cacheblock_cache($force = false)
    {
        if (!self::$cacheblock_cache_flushed || $force) {
            $cache = Injector::inst()->get(CacheInterface::class . '.cacheblock');
            $cache->clear();


            self::$cacheblock_cache_flushed = true;
        }
    }
1236470
public function save($force = false) {
        if (!$this->writeable) {
            return false;
        }

        if (!$this->dirty && !$force) {
            return null;
        }

        $savetype = $force ? 'forced ' : '';
        if (is_null($force)) {
            $savetype = 'auto ';
        }

        $path = dirname($this->file);
        if (!is_dir($path)) {
            mkdir($path, 0755, true);
        }

        $data = $this->store->dump();
        $conf = version_compare(PHP_VERSION, '5.4', '>=') ? json_encode($data, JSON_PRETTY_PRINT) : json_encode($data);
        unset($data);
        if (!$conf || !json_decode($conf)) {
            return;
        }
        $saved = (bool)$this->writeAtomic($this->file, $conf, 0755);

        if ($saved) {
            $this->dirty = false;
        }

        return $saved;
    }
839360
public function display()
    {
        if (self::$displayer === null) {
            if (isset($_SERVER['REQUEST_URI'])) {
                echo $this->toXHTML();
            } else {
                echo $this->toString();
            }
        } else {
            $displayer = self::$displayer;
            $displayer->display($this);
        }
    }
1264875
public function setDn($dn, $force = false)
    {
        if (($this->isHydrated) && (! $force)) {
            throw new \InvalidArgumentException('Dn cannot be updated manually');
        }
        $this->dn = $dn;
    }
692981
public function is_blocked( $force = false ) {

		if( !$force && $this->blocked !== null ) {
			return $this->blocked;
		}

		pecho( "Checking if {$this->username} is blocked...\n\n", PECHO_NORMAL );

		$this->__construct( $this->wiki, $this->username );

		return $this->blocked;
	}
241343
public function execute(bool $force = false): void
	{
		if($force || $this->confirm('<yellow>Are you sure you want to reset your database?</yellow>'))
		{
			$this->nl();

			$this->rollback();

			return;
		}

		$this->nl();

		$this->write('Ok, no action was performed.');
	}
601507
public function isOffline( $force = FALSE ){
		if( $this->status === self::STATUS_UNKNOWN || $force )
			$this->check();
		return $this->status === self::STATUS_OFFLINE;
	}
164183
public function display()
    {
        if (!$this->visible) {
            return;
        }

        parent::display();

        $flydown = $this->getCompositeWidget('action_flydown');
        foreach ($this->action_items as $item) {
            if ($item->visible) {
                if ($item instanceof SwatActionItemDivider) {
                    $flydown->addDivider();
                } else {
                    $flydown->addOption($item->id, $item->title);
                }
            }
        }

        // set the flydown back to its initial state (no persistence). The
        // flydown is never reset if there is a selected item and the selected
        // items has a widget with one or more messages.
        if (
            $this->auto_reset &&
            ($this->selected === null ||
                $this->selected->widget === null ||
                !$this->selected->widget->hasMessage())
        ) {
            $flydown->reset();
        }

        // select the current action item based upon the flydown value
        if (isset($this->action_items_by_id[$flydown->value])) {
            $this->selected = $this->action_items_by_id[$flydown->value];
        } else {
            $this->selected = null;
        }

        $div_tag = new SwatHtmlTag('div');
        $div_tag->id = $this->id;
        $div_tag->class = $this->getCSSClassString();
        $div_tag->open();

        echo '<div class="swat-actions-controls">';

        $label = new SwatHtmlTag('label');
        $label->for = $flydown->getFocusableHtmlId();
        $label->setContent(Swat::_('Action: '));
        $label->display();

        $flydown->display();
        echo ' ';
        $this->displayButton();

        echo '</div>';

        foreach ($this->action_items as $item) {
            if ($item->widget !== null) {
                $div = new SwatHtmlTag('div');

                $div->class =
                    $item == $this->selected ? 'swat-visible' : 'swat-hidden';

                $div->id = $this->id . '_' . $item->id;

                $div->open();
                $item->display();
                $div->close();
            }
        }

        echo '<div class="swat-actions-note">';
        echo Swat::_('Actions apply to checked items.');
        echo '</div>';

        $div_tag->close();

        Swat::displayInlineJavaScript($this->getInlineJavaScript());
    }
768011
public function add(array $file = null, $force = false)
    {
        $args   = array();
        if ($force) {
            $args[]  = '--force';
        }
        if ($file !== null) {
            $args[] = '--';
            $args   = array_merge($args, array_map(array($this, 'translatePathspec'), $this->resolveLocalPath($file)));
        } else {
            $args[] = '--all';
        }

        /** @var $result CallResult */
        $result = $this->getGit()->{'add'}($this->getRepositoryPath(), $args);
        $result->assertSuccess(sprintf('Cannot add "%s" to "%s"',
            ($file !== null) ? implode(', ', $file) : '*', $this->getRepositoryPath()
        ));
    }
508908
public function getParentFolder($force = FALSE) {
		
		if(!isset($this->parentFolder) || $force) {
			
			$parentPath = realpath($this->path . '..');
			
			// flag parentFolder property, when $this is already the root folder
			
			if($parentPath === $this->path) {
				$this->parentFolder = FALSE;
			}

			else {
				$this->parentFolder = self::getInstance($parentPath);
			}

		}

		// return NULL (instead of FALSE) when there is no parent folder

		return $this->parentFolder ?: NULL;
		
	}
1293846
private function setData(array $data, ?bool $force = null) : void
    {
        $force = $force ?? false;

        /** @var DOMElement $node */
        foreach ($this->getNodeList() as $name => $node) {
            if (! array_key_exists($name, $data)) {
                // No value set for this element
                continue;
            }

            $value = $data[$name];

            $reuseSubmittedValue = filter_var(
                $node->getAttribute('data-reuse-submitted-value'),
                FILTER_VALIDATE_BOOLEAN
            );

            if (! $reuseSubmittedValue && $force === false) {
                // Don't need to set the value
                continue;
            }

            if (in_array($node->getAttribute('type'), ['checkbox', 'radio'], true)) {
                if ($value === $node->getAttribute('value')) {
                    $node->setAttribute('checked', 'checked');
                } else {
                    $node->removeAttribute('checked');
                }
            } elseif ($node->nodeName === 'select') {
                /** @var DOMElement $option */
                foreach ($node->getElementsByTagName('option') as $option) {
                    if ($value === $option->getAttribute('value')) {
                        $option->setAttribute('selected', 'selected');
                    } else {
                        $option->removeAttribute('selected');
                    }
                }
            } elseif ($node->nodeName === 'input') {
                // Set value for input elements
                $node->setAttribute('value', (string) $value);
            } elseif ($node->nodeName === 'textarea') {
                $node->nodeValue = $value;
            }
        }
    }
517438
public function render(Entry $entry = null)
    {
        if ($entry) {
            $this->context->setEntry($entry);
        }

        /** @var \Concrete\Core\Form\Control\View $view */
        $view = $this->form->getControlView($this->context);

        $renderer = $view->getControlRenderer();
        $renderer->render();
    }
482332
protected function display($templateFile='',$charset='',$contentType='',$content='',$prefix='') {
        $this->view->display($templateFile,$charset,$contentType,$content,$prefix);
    }
1215810
private function setup($force = false)
    {
        // Set a default error code to indicate if anything changes
        $this->errorCode = NULL;

        // Indicate if this is a forced procedure
        $this->force = $force;

        // Load the current user
        $this->getUser();

        // Get the current bcrypt cost
		$this->_cost = Cii::getBcryptCost();

        // Preload the number of password attempts. As of 1.10.0
        $this->getPasswordAttempts();

        return;
    }
475889
protected function getHttpClient(bool $force = false): HttpClient
    {
        if ($this->_httpClient === null || $force) {
            $config = ArrayHelper::merge(['class' => HttpClient::class], $this->httpClientConfig);
            $config['baseUrl'] = $this->getBaseUrl();

            return $this->_httpClient = Yii::createObject($config);
        } else {
            return $this->_httpClient;
        }
    }
187032
public function render($force = false) {

		if(empty($this->html) || $force) {

            if($this->template) {

                parent::render();

            }

            else {

                $name = $this->parentElement->getName();
                $value = $this->getValue();

                if($this->selected) {
                    $this->attributes['checked'] = 'checked';
                }
                else {
                    unset($this->attributes['checked']);
                }

                if(!isset($this->attributes['id'])) {
                    $formId = $this->parentElement->getForm()->getAttribute('id');
                    $this->attributes['id'] = ($formId ? ($formId . '_') : '') . $name . '_' . $value;
                }

                $this->attributes['value'] = $this->getValue();
                $this->attributes['name'] = $this->parentElement->getName();

                $attr = [];

                foreach($this->attributes as $k => $v) {
                    $attr[] = sprintf('%s="%s"', $k, $v);
                }

                $this->html = sprintf(
                    '<input type="radio" %s>',
                    implode(' ', $attr)
                );

                if($this->label) {
                    $this->html .= $this->label->setAttribute('for', $this->attributes['id'])->render();
                }

            }

		}

		return $this->html;

	}