• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Easy Digital Downloads a2z

Easy Digital Downloads a2z

Easy Digital Downloads a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Browser::__toString() – Returns a formatted string with a summary of the details of the browser.

You appear to be a bot. Output may be restricted

Description

Returns a formatted string with a summary of the details of the browser.

Usage

$string = Browser::__toString();

Parameters

Returns

string formatted string with a summary of the browser

Source

File name: easy-digital-downloads/includes/libraries/browser.php


Lines:

1 to 23 of 23
  function __toString() {
    $text1   = $this->getUserAgent(); //grabs the UA (user agent) string
    $UAline1 = substr( $text1, 0, 32 ); //the first line we print should only be the first 32 characters of the UA string
    $text2       = $this->getUserAgent();//now we grab it again and save it to a string
    $towrapUA    = str_replace( $UAline1, '', $text2 );//the rest of the printoff (other than first line) is equivolent
    // To the whole string minus the part we printed off. IE
    // User Agent:      thefirst32charactersfromUAline1
    //                  the rest of it is now stored in
    //                  $text2 to be printed off
    // But we need to add spaces before each line that is split other than line 1
    $space = '';
    for ( $i = 0; $i < 25; $i++ ) {
      $space .= ' ';
    }
    // Now we split the remaining string of UA ($text2) into lines that are prefixed by spaces for formatting
    $wordwrapped = chunk_split( $towrapUA, 32, "\n $space" );
    return "Platform:                 {$this->getPlatform()} \n".
      "Browser Name:             {$this->getBrowser()}  \n" .
      "Browser Version:          {$this->getVersion()} \n" .
      "User Agent String:        $UAline1 \n\t\t\t  " .
      "$wordwrapped";
  }
 

 View on GitHub View on Trac

Published: 26th November 2019 | Last updated: 15th September 2022

Primary Sidebar

Information

Function name: Browser::__toString
Class ref: Browser
Plugin ref: Easy Digital Downloads
Version: 3.1.0.2
Sourcefile: includes/libraries/browser.php
File ref: includes/libraries/browser.php
Deprecated?: No
API Letters: B,T

Footer

Easy Digital Downloads a2z
Easy Digital Downloads a2z
Easy Digital Downloads a2z
WordPress 6.1.1
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  edd.wp-a2z.org
© Copyright Easy Digital Downloads a2z 2014-2023. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins