Print the login in a popup.

@param array|null $attr Custom attributes to be applied to popup div.
177331
public function print_login_popup($attr = null) {
        global $OUTPUT, $PAGE;

        $client = $this->get_user_oauth_client(false);
        $url = new moodle_url($client->get_login_url());
        $state = $url->get_param('state') . '&reloadparent=true';
        $url->param('state', $state);

        $PAGE->set_pagelayout('embedded');
        echo $OUTPUT->header();

        $repositoryname = get_string('pluginname', 'repository_onedrive');

        $button = new single_button($url, get_string('logintoaccount', 'repository', $repositoryname), 'post', true);
        $button->add_action(new popup_action('click', $url, 'Login'));
        $button->class = 'mdl-align';
        $button = $OUTPUT->render($button);
        echo html_writer::div($button, '', $attr);

        echo $OUTPUT->footer();
    }
587248
public synchronized void insert_attr(int attr)
	{

//
// Insert elt in the box
//

		box[insert_elt].req_type = Req_Attribute;
		box[insert_elt].attr_type = attr;
		box[insert_elt].op_type = Op_Unknown;
		box[insert_elt].when = new Date();

//
// get client address
//

		get_client_host();
			
//
// manage insert and read indexes
//

		inc_indexes();
	}
818742
public static function attr( $attr = array() ) {
		$buffer = " ";
		foreach( $attr as $key => $value ) {
		
			switch( $key ) {
		
				case 'class':
				if ( is_array( $value ) ) { $value = implode( ' ', $value ); }
				break;
		
				case 'style':
				if ( is_array( $value ) ) {
					$style = $value; $value = "";
					foreach( $style as $k => $v ) {
						$value .= $k.':'.$v.';';
					}
				}
				break;
			}
		
			$buffer .= $key.'="'.$value.'" ';
		}
		
		return substr( $buffer, 0, -1 );
	}
1053470
private function textBoxStartHandler(array $attrs): void
    {
        // string Background color code
        $bgcolor = '';
        if (!empty($attrs['bgcolor'])) {
            $bgcolor = $attrs['bgcolor'];
        }

        // boolean Wether or not fill the background color
        $fill = true;
        if (isset($attrs['fill'])) {
            if ($attrs['fill'] === '0') {
                $fill = false;
            } elseif ($attrs['fill'] === '1') {
                $fill = true;
            }
        }

        // var boolean Whether or not a border should be printed around this box. 0 = no border, 1 = border. Default is 0
        $border = false;
        if (isset($attrs['border'])) {
            if ($attrs['border'] === '1') {
                $border = true;
            } elseif ($attrs['border'] === '0') {
                $border = false;
            }
        }

        // int The starting height of this cell. If the text wraps the height will automatically be adjusted
        $height = 0;
        if (!empty($attrs['height'])) {
            $height = (int) $attrs['height'];
        }
        // int Setting the width to 0 will make it the width from the current location to the margin
        $width = 0;
        if (!empty($attrs['width'])) {
            $width = (int) $attrs['width'];
        }

        // mixed Position the left corner of this box on the page. The default is the current position.
        $left = ReportBaseElement::CURRENT_POSITION;
        if (isset($attrs['left'])) {
            if ($attrs['left'] === '.') {
                $left = ReportBaseElement::CURRENT_POSITION;
            } elseif (!empty($attrs['left'])) {
                $left = (int) $attrs['left'];
            } elseif ($attrs['left'] === '0') {
                $left = 0;
            }
        }
        // mixed Position the top corner of this box on the page. the default is the current position
        $top = ReportBaseElement::CURRENT_POSITION;
        if (isset($attrs['top'])) {
            if ($attrs['top'] === '.') {
                $top = ReportBaseElement::CURRENT_POSITION;
            } elseif (!empty($attrs['top'])) {
                $top = (int) $attrs['top'];
            } elseif ($attrs['top'] === '0') {
                $top = 0;
            }
        }
        // boolean After this box is finished rendering, should the next section of text start immediately after the this box or should it start on a new line under this box. 0 = no new line, 1 = force new line. Default is 0
        $newline = false;
        if (isset($attrs['newline'])) {
            if ($attrs['newline'] === '1') {
                $newline = true;
            } elseif ($attrs['newline'] === '0') {
                $newline = false;
            }
        }
        // boolean
        $pagecheck = true;
        if (isset($attrs['pagecheck'])) {
            if ($attrs['pagecheck'] === '0') {
                $pagecheck = false;
            } elseif ($attrs['pagecheck'] === '1') {
                $pagecheck = true;
            }
        }
        // boolean Cell padding
        $padding = true;
        if (isset($attrs['padding'])) {
            if ($attrs['padding'] === '0') {
                $padding = false;
            } elseif ($attrs['padding'] === '1') {
                $padding = true;
            }
        }
        // boolean Reset this box Height
        $reseth = false;
        if (isset($attrs['reseth'])) {
            if ($attrs['reseth'] === '1') {
                $reseth = true;
            } elseif ($attrs['reseth'] === '0') {
                $reseth = false;
            }
        }

        // string Style of rendering
        $style = '';

        $this->print_data_stack[] = $this->print_data;
        $this->print_data         = false;

        $this->wt_report_stack[] = $this->wt_report;
        $this->wt_report         = $this->report_root->createTextBox(
            $width,
            $height,
            $border,
            $bgcolor,
            $newline,
            $left,
            $top,
            $pagecheck,
            $style,
            $fill,
            $padding,
            $reseth
        );
    }
1345666
public function print_login() {
        $client = $this->get_user_oauth_client();
        $url = $client->get_login_url();

        if ($this->options['ajax']) {
            $popup = new stdClass();
            $popup->type = 'popup';
            $popup->url = $url->out(false);
            return array('login' => array($popup));
        } else {
            echo '<a target="_blank" href="'.$url->out(false).'">'.get_string('login', 'repository').'</a>';
        }
    }
498456
public function getAttribute($attr, $default = null) {
		
		return ($attr && array_key_exists($attr, $this->attributes)) ? $this->attributes[$attr] : $default;
		
	}
629055
private function htmlStartHandler(string $tag, array $attrs): void
    {
        if ($tag === 'tempdoc') {
            return;
        }
        $this->wt_report_stack[] = $this->wt_report;
        $this->wt_report         = $this->report_root->createHTML($tag, $attrs);
        $this->current_element   = $this->wt_report;

        $this->print_data_stack[] = $this->print_data;
        $this->print_data         = true;
    }
325832
public function print_login(){
        $url = $this->boxnetclient->get_login_url();
        if ($this->options['ajax']) {
            $ret = array();
            $popup_btn = new stdClass();
            $popup_btn->type = 'popup';
            $popup_btn->url = $url->out(false);
            $ret['login'] = array($popup_btn);
            return $ret;
        } else {
            echo html_writer::link($url, get_string('login', 'repository'), array('target' => '_blank'));
        }
    }
1122171
public function attr_first($attr)
    {
        return $this->_nodes ? current($this->_nodes)->getAttribute($attr) : null;
    }
306086
public function setAttribute( $attr, $value ) {
        //value is the text node
        //we add this for the sake of consistency amongst other form elements
        if( strtolower( $attr ) == 'value' ) {
           $this->setText( $value );
        } else {
            parent::setAttribute( $attr, $value );
        }
    }
118953
public function show($value = '', $attrib = null)
    {
        // overwrite object attributes
        if (is_array($attrib)) {
            $this->attrib = array_merge($this->attrib, $attrib);
        }

        // set value attribute
        $this->attrib['checked'] = ((string)$value == (string)$this->attrib['value']);

        return parent::show();
    }
1234176
public function get_session($attr = null){
    if ( $this->session->has(self::$un) ){
      return $attr ? $this->session->get(self::$un, $attr) : $this->session->get(self::$un);
    }
  }
1371417
protected function reportStartHandler(array $attrs): void
    {
        $this->data['access'] = $attrs['access'] ?? Auth::PRIV_PRIVATE;

        $this->data['icon'] = $attrs['icon'] ?? '';
    }
68575
public function setAttr($attr, $value = null)
    {
        if (is_array($attr)) {
            $this->attr = array_merge($this->attr, $attr);

            return $this;
        }

        $this->attr[$attr] = $value;

        return $this;
    }
102607
public function set_attribute($attr, $value = null)
	{
		$attr = is_array($attr) ? $attr : array($attr => $value);
		foreach ($attr as $key => $value)
		{
			if ($value === null)
			{
				unset($this->attributes[$key]);
			}
			else
			{
				$this->attributes[$key] = $value;
			}
		}

		return $this;
	}
139395
function resolveAttr(array $attr) {
		$out = '';
		foreach ($attr as $key => $value) {
			// build dynamic tokens
			if (preg_match('/{{(.+?)}}/s', $value))
				$value = $this->template->build($value);
			if (preg_match('/{{(.+?)}}/s', $key))
				$key = $this->template->build($key);
			// inline token
			if (is_numeric($key))
				$out .= ' '.$value;
			// value-less parameter
			elseif($value==NULL)
				$out .= ' '.$key;
			// key-value parameter
			else
				$out .= ' '.$key.'="'.$value.'"';
		}
		return $out;
	}
843797
function attribute( $attr )
    {
        switch( $attr )
        {
            case "uri":
                return $this->uri();
                break;
            case "functions":
                return $this->Functions;
            case "views":
                return $this->Functions;
            case "name":
                return $this->Name;
            case "path":
                return $this->Path;
            case "info":
                return $this->Module;
            case 'aviable_functions':
            case 'available_functions':
                return $this->FunctionList;
            default:
            {
                eZDebug::writeError( "Attribute '$attr' does not exist", __METHOD__ );
                return null;
            }
            break;
        }
    }