trql.webpage.class.php

This documentation is provided without any sort of liability.

Filename: trql.webpage.class.php Namespace: trql\web Class aliases: \trql\quitus\iContext as iContext,\trql\vaesoli\Vaesoli as Vaesoli,\trql\schema\creativework\CreativeWork as CreativeWork,\trql\quitus\Agent as Agent,DOMDocument; use DOMXPath; if ( ! defined( 'MOTHER_ABSTRACT_CLASS' ) ) require_once( 'trql.mother.cl as s Purpose: A web page. Every web page is implicitly assumed to be declared to be of type WebPage, so the various properties about that webpage, such as breadcrumb may be used. We recommend explicit declaration if these properties are specified, but if they are found outside of an itemscope, they will be assumed to be about the page. Author: Pat Y. Boens Company: Lato Sensu Management
Rue du Bois des Mazuis, 47
5070 Vitrival
Belgium
(geonames: )
Vae Soli!:
Creation date: 16-08-20 16:14 Last modification date: 25/08/2021 - 12:28:32 License/Copyrights: Intellectual Property belongs to Pat Y. Boens. You are free to:

Share — copy and redistribute the material in any medium or format
Adapt — remix, transform, and build upon the material for any purpose, even commercially.

Under the following terms:

Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.

Class: WebPage Description: A web page. Every web page is implicitly assumed to be declared to be of type WebPage, so the various properties about that webpage, such as breadcrumb may be used. We recommend explicit declaration if these properties are specified, but if they are found outside of an itemscope, they will be assumed to be about the page. Inheritance: Mother > Thing > CreativeWork > WebPage Declaration: class WebPage extends CreativeWork implements iContext Credits: The whole concept is derived from the fabulous work of Schema.org under the terms of their license: Doc: ?utm_source=TRQLLabs Properties:
Name Type Description
$about Thing The subject matter of the content. Inverse property: $subjectOf
$abstract string An abstract is a short description that summarizes a CreativeWork
$accessibilityAPI string Indicates that the resource is compatible with the referenced accessibility API (WebSchemas wiki lists possible values).
$accessibilityControl string Identifies input methods that are sufficient to fully control the described resource (WebSchemas wiki lists possible values).
$accessibilityFeature string Content features of the resource, such as accessible media, alternatives and supported enhancements for accessibility (WebSchemas wiki lists possible values).
$accessibilityHazard string A characteristic of the described resource that is physiologically dangerous to some users. Related to WCAG 2.0 guideline 2.3 (WebSchemas wiki lists possible values).
$accessibilitySummary string A human-readable summary of specific accessibility features or deficiencies, consistent with the other accessibility metadata but expressing subtleties such as "short descriptions are present but long descriptions will be needed for non-visual users" or "short descriptions are present and no long descriptions are needed."
$accessMode string The human sensory perceptual system or cognitive faculty through which a person may process or perceive information. Expected values include: auditory, tactile, textual, visual, colorDependent, chartOnVisual, chemOnVisual, diagramOnVisual, mathOnVisual, musicOnVisual, textOnVisual.
$accessModeSufficient ItemList A list of single or combined accessModes that are sufficient to understand all the intellectual content of a resource. Expected values include: auditory, tactile, textual, visual.
$accountablePerson Person Specifies the Person that is legally accountable for the CreativeWork.
$additionalType string An additional type for the item, typically used for adding more specific types from external vocabularies in microdata syntax. This is a relationship between something and a class that the thing is in. In RDFa syntax, it is better to use the native RDFa syntax - the 'typeof' attribute - for multiple types.
$aggregateRating AggregateRating The overall rating, based on a collection of reviews or ratings, of the item.
$alternateName string An alias for the item.
$alternativeHeadline string A secondary title of the CreativeWork.
$analysis array Result of the analysis of the page (call to analyze())
$associatedMedia MediaObject A media object that encodes this CreativeWork. This property is a synonym for encoding.
$audience Audience An intended audience, i.e. a group for whom something was created.
$audio AudioObject|Clip An embedded audio object.
$author Agent Author of the page
$award string An award won by or for this item. Supersedes awards.
$breadcrumb BreadcrumbList|string A set of links that can help a user understand and navigate a website hierarchy.
$breakingNews boolean Should the Breaking news be displayed on this page: true if yes; false otherwise.
$cargo string Whatever information seems interesting to load and keep in the page
$citation CreativeWork|string A citation or reference to another creative work, such as another publication, web page, scholarly article, etc.
$comment Comment Comments, typically from users.
$commentCount int The number of comments this CreativeWork (e.g. Article, Question or Answer) has received. This is most applicable to works published in Web sites with commenting system; additional comments may exist elsewhere.
$conditionsOfAccess string Conditions that affect the availability of, or method(s) of access to, an item. Typically used for real world items such as an ArchiveComponent held by an ArchiveOrganization. This property is not suitable for use as a general Web access control mechanism. It is expressed only in natural language.
For example "Available by appointment from the Reading Room" or "Accessible only from logged-in accounts ".
$content string The content of the page (the whole HTML) (filled after a call to getURL())
$contentFile string THE file that has been used to extract the real payload of the page, its content
$contentFiles array A list of files that are suitable candidates to contain the real payload of the page, its content
$contentLocation Place The location depicted or described in the content. For example, the location in a photograph or painting.
$contentRating Rating|string Official rating of a piece of content—for example,'MPAA PG-13'.
$contentReferenceTime DateTime The specific time described by a creative work, for works (e.g. articles, video objects etc.) that emphasise a particular moment within an Event.
$contributor Organization|Person A secondary contributor to the CreativeWork or Event.
$copyrightHolder Organization|Person The party holding the legal copyright to the CreativeWork.
$copyrightYear Number The year during which the claimed copyright for the CreativeWork was first asserted.
$correction CorrectionComment|string|URL Indicates a correction to a CreativeWork, either via a CorrectionComment, textually or in another document.
$creativeWorkStatus DefinedTerm|string The status of a creative work in terms of its stage in a lifecycle. Example terms include Incomplete, Draft, Published, Obsolete. Some organizations define a set of terms for the stages of their publication lifecycle.
$creator Organization|Person The creator/author of this CreativeWork. This is the same as the Author property for CreativeWork.
$dateCreated Date|DateTime The date on which the CreativeWork was created or the item was added to a DataFeed.
$dateModified Date|DateTime The date on which the CreativeWork was most recently modified or when the item's entry was modified within a DataFeed.
$datePublished Date Date of first broadcast/publication.
$description string A short description of the item.
$disambiguatingDescription string A sub property of description. A short description of the item used to disambiguate from other, similar items. Information from other properties (in particular, name) may be necessary for the description to be useful for disambiguation.
$discussionUrl URL A link to the page containing the comments of the CreativeWork.
$editor Person Specifies the Person who edited the CreativeWork.
$educationalAlignment AlignmentObject An alignment to an established educational framework.
$educationalUse string The purpose of a work in the context of education; for example, 'assignment', 'group work'.
$encoding MediaObject A media object that encodes this CreativeWork. This property is a synonym for associatedMedia. Supersedes encodings. Inverse property: encodesCreativeWork.
$encodingFormat string|URL Media type typically expressed using a MIME format (see IANA site and MDN reference) e.g. application/zip for a SoftwareApplication binary, audio/mpeg for .mp3 etc.).
$exampleOfWork CreativeWork A creative work that this work is an example/instance/realization/derivation of. Inverse property: workExample.
$expires Date Date the content expires and is no longer useful or available. For example a VideoObject or NewsArticle whose availability or relevance is time-limited, or a ClaimReview fact check whose publisher wants to indicate that it may no longer be relevant (or helpful to highlight) after some date.
$funder Organization|Person A person or organization that supports (sponsors) something through some kind of financial contribution.
$genre string|URL Genre of the creative work, broadcast channel or group.
$guid string Globally unique Identifier of the page.
$H1 string H1 of the page.
$hasPart CreativeWork Indicates an item or CreativeWork that is part of this item, or CreativeWork (in some sense). Inverse property: $isPartOf.
$headline string Headline of the article.
$helpPage string|URL Help page that provides additional explanations about the current page.
$identifier string The identifier property represents any kind of identifier for any kind of Thing, such as ISBNs, GTIN codes, UUIDs etc. http://schema.org provides dedicated properties for representing many of these, either as textual strings or as URL (URI) links. See background notes for more details.
$image string URL of an image of the item.
$inLanguage Language|string The language of the content or performance or used in an action. Please use one of the language codes from the IETF BCP 47 standard. See also availableLanguage. Supersedes language.
$interactionStatistic InteractionCounter The number of interactions for the CreativeWork using the WebSite or SoftwareApplication. The most specific child type of InteractionCounter should be used. Supersedes interactionCount.
$interactivityType string The predominant mode of learning supported by the learning resource. Acceptable values are 'active', 'expositive', or 'mixed'.
$isAccessibleForFree Boolean A flag to signal that the item, event, or place is accessible for free. Supersedes free.
$isBasedOn CreativeWork|Product|URL A resource from which this work is derived or from which it is a modification or adaption. Supersedes isBasedOnUrl.
$isFamilyFriendly Boolean Indicates whether this content is family friendly.
$isPartOf CreativeWork Indicates an item or CreativeWork that this item, or CreativeWork (in some sense), is part of. Inverse property: $hasPart.
$keywords string Keywords or tags used to describe this content. Multiple entries in a keywords list are typically delimited by commas.
$lastReviewed Date Date on which the content on this web page was last reviewed for accuracy and/or completeness.
$learningResourceType string The predominant type or kind characterizing the learning resource. For example, 'presentation', 'handout'.
$license CreativeWork|URL A license document that applies to this content, typically indicated by URL.
$locationCreated Place The location where the CreativeWork was created, which may not be the same as the location depicted in the CreativeWork.
$mainContentOfPage WebPageElement Indicates if this web page element is the main subject of the page. Supersedes aspect.
$mainEntity Thing Indicates the primary entity described in some page or other CreativeWork. Inverse property: $mainEntityOfPage.
$mainEntityOfPage string Indicates a page (or other CreativeWork, Event) for which this thing is the main entity being described. See background notes for details. Inverse property: $mainEntity.
$material Product|string|URL A material that something is made from, e.g. leather, wool, cotton, paper.
$materialExtent QuantitativeValue|string The quantity of the materials being described or an expression of the physical space they occupy.
$mentions Thing Indicates that the CreativeWork contains a reference to, but is not necessarily about a concept.
$name string The name of the item.
$obsolete boolean Is this page obsolete or not? false by default.
$offers Offer An offer to provide this item—for example, an offer to sell a product, rent the DVD of a movie, perform a service, or give away tickets to an event.
$position int|string The position of an item in a series or sequence of items.
$potentialAction Action Indicates a potential Action, which describes an idealized action in which this thing would play an 'object' role.
$primaryImageOfPage ImageObject Indicates the main image on the page.
$producer Organization|Person The person or organization who produced the work (e.g. music album, movie, tv/radio series etc.).
$provider Organization|Person The service provider, service operator, or service performer; the goods producer. Another party (a seller) may offer those services or goods on behalf of the provider. A provider may also serve as the seller. Supersedes carrier.
$publication PublicationEvent A publication event associated with the item.
$publisher Organization|Person The publisher of the creative work.
$publisherImprint Organization The publishing division which published the comic.
$publishingPrinciples CreativeWork|URL The publishingPrinciples property indicates (typically via URL) a document describing the editorial principles of an Organization (or individual e.g. a Person writing a blog) that relate to their activities as a publisher, e.g. ethics or diversity policies. When applied to a CreativeWork (e.g. NewsArticle) the principles are those of the party primarily responsible for the creation of the CreativeWork. While such policies are most typically expressed in natural language, sometimes related information (e.g. indicating a funder) can be expressed using schema.org terminology.
$recordedAt Event The Event where the CreativeWork was recorded. The CreativeWork may capture all or part of the event. Inverse property: $recordedIn.
URL A link related to this web page, for example to other related web pages.
$releasedEvent PublicationEvent The place and time the release was issued, expressed as a PublicationEvent.
$review Review A review of the item. Supersedes reviews.
$reviewedBy Organization|Person People or organizations that have reviewed the content on this web page for accuracy and/or completeness.
$sameAs string URL of a reference Web page that unambiguously indicates the item's identity. E.g. the URL of the item's Wikipedia page, Freebase page, or official website.
$schemaOrg string Where the official documentation is maintained
$schemaVersion string|URL Indicates (by URL or string) a particular version of a schema used in some CreativeWork. For example, a document could declare a schemaVersion using an URL such as http://schema.org/version/2.0/ if precise indication of schema version was required by some application.
$sdDatePublished Date Indicates the date on which the current structured data was generated / published. Typically used alongside sdPublisher
$sdLicense CreativeWork|URL A license document that applies to this structured data, typically indicated by URL.
$sdPublisher Organization|Person Indicates the party responsible for generating and publishing the current structured data markup, typically in cases where the structured data is derived automatically from existing published content but published on a different site. For example, student projects and open data initiatives often re-publish existing content with more explicitly structured metadata. The sdPublisher property helps make such practices more explicit.
$seeAlso string Pages interesting to visit from the current page (semi-colon separated list).
$self array Fixed 'class' information.
URL One of the more significant URLs on the page. Typically, these are the non-navigation links that are clicked on the most. Supersedes significantLinks.
$sourceOrganization Organization The Organization on whose behalf the creator was working.
$spatial Place The "spatial" property can be used in cases when more specific properties (e.g. locationCreated, spatialCoverage, contentLocation) are not known to be appropriate.
$spatialCoverage Place The spatialCoverage of a CreativeWork indicates the place(s) which are the focus of the content. It is a subproperty of contentLocation intended primarily for more technical and detailed materials. For example with a Dataset, it indicates areas that the dataset describes: a dataset of New York weather would have spatialCoverage which was the place: the state of New York.
$speakable SpeakableSpecification|URL Indicates sections of a Web page that are particularly 'speakable' in the sense of being highlighted as being especially appropriate for text-to-speech conversion. Other sections of a page may also be usefully spoken in particular circumstances; the 'speakable' property serves to indicate the parts most likely to be generally useful for speech. The speakable property can be repeated an arbitrary number of times, with three kinds of possible 'content-locator' values: 1.) id-value URL references - uses id-value of an element in the page being annotated. The simplest use of speakable has (potentially relative) URL values, referencing identified sections of the document concerned. 2.) CSS Selectors - addresses content in the annotated page, eg. via class attribute. Use the cssSelector property. 3.) XPaths - addresses content via XPaths (assuming an XML view of the content). Use the xpath property. For more sophisticated markup of speakable sections beyond simple ID references, either CSS selectors or XPath expressions to pick out document section(s) as speakable. For this we define a supporting type, SpeakableSpecification which is defined to be a possible value of the speakable property.
$specialty Specialty One of the domain specialities to which this web page's content applies.
$sponsor Organization|Person A person or organization that supports a thing through a pledge, promise, or financial contribution. e.g. a sponsor of a Medical Study or a corporate sponsor of an event.
$subjectOf CreativeWork|Event A CreativeWork or Event about this Thing. Inverse property: $about.
$szBody string Main body of a page
$szCanonical string Canonical URL of the page.
$szPageImage string Image that represents the page (EXCELLENT for SEO) // // // // //
$szShelter string The name of the file where the XML definition of the page is stored
$temporal DateTime|string The "temporal" property can be used in cases where more specific properties (e.g. $temporalCoverage, $dateCreated, $dateModified, $datePublished) are not known to be appropriate.
$temporalCoverage DateTime|string|URL The temporalCoverage of a CreativeWork indicates the period that the content applies to, i.e. that it describes, either as a DateTime or as a textual string indicating a time period in ISO 8601 time interval format. In the case of a Dataset it will typically indicate the relevant time period in a precise notation (e.g. for a 2011 census dataset, the year 2011 would be written "2011/2012"). Other forms of content e.g. ScholarlyArticle, Book, TVSeries or TVEpisode may indicate their temporalCoverage in broader terms - textually or via well-known URL. Written works such as books may sometimes have precise temporal coverage too, e.g. a work set in 1939 - 1945 can be indicated in ISO 8601 interval format format via "1939/1945". Open-ended date ranges can be written with ".." in place of the end date. For example, "2015-11/.." indicates a range beginning in November 2015 and with no specified final date. This is tentative and might be updated in future when ISO 8601 is officially updated. Supersedes datasetTimeInterval.
$text string The textual content of this CreativeWork.
$thumbnailUrl URL A thumbnail image relevant to the Thing.
$timeRequired Duration Approximate or typical time it takes to work with or through this learning resource for the typical intended target audience, e.g. 'PT30M', 'PT1H25M'.
$title string Title of the page (like in ...
$translationOfWork CreativeWork The work that this work has been translated from. e.g. 物种起源 is a translationOf “On the Origin of Species” Inverse property: workTranslation.
$translator Organization|Person Organization or Person who adapts a creative work to different languages, regional differences and technical requirements of a target market, or that translates during some event.
$typicalAgeRange string The typical expected age range, e.g. '7-9', '11-'.
$underConstruction boolean Is this page still under construction ? false by default
$url string URL of the item.
$version Number|string The version of the CreativeWork embodied by a specified resource.
$video Clip|VideoObject An embedded video object.
$wikidataId string Wikidata ID: Single document that is directly viewable via the World Wide Web and web browsers
$withLupdate boolean Must we display a lupdate tage on the page or not ? true by default
$withSocialNetworks boolean Should social networks be displayed on that page?
$workExample CreativeWork Example/instance/realization/derivation of the concept of this creative work. eg. The paperback edition, first edition, or eBook. Inverse property: $exampleOfWork.
$workTranslation CreativeWork A work that is a translation of the content of this work. e.g. 西遊記 has an English workTranslation “Journey to the West”,a German workTranslation “Monkeys Pilgerfahrt” and a Vietnamese translation Tây du ký bình khảo. Inverse property: $translationOfWork.

Methods of WebPage

__construct(): Class constructor

Syntax:

__construct( $szHome )

Parameters:
Name Type Description
$szHome string Home of the class. Optional.

Return:

(self): The current instance of the class


__destruct(): Class destructor

Syntax:

__destruct()

Return:

(void): No return


analyze(): Ananlyze the content of a web page

Warning:

This method is in development

Syntax:

analyze()

Return:

(self): The current instance of the class. The result of the analysis is put in the %var.analysis% property


getURL(): Get the content of the page (the whole HTML)

Warning:

This method is in development

Syntax:

getURL()

Return:

(self): The current instance of the class. The result is put in the %var.content% property


readManifest(): The page meta data is maintained in a XML file. This method permits to read the XML file and to populate internal properties based on what is in the XML file.

Syntax:

readManifest( $szFile )

Parameters:
Name Type Description
$szFile string XML file that holds the description of the page

Return:

(self): The current instance of the class

Example(s):


      /* *************************************/
      /* EXAMPLE #1 : CREATE A PAGE TEMPLATE */
      /* *************************************/

      <?php
      use \trql\vaesoli\Vaesoli   as V;
      use \trql\web\Browser       as Browser;
      use \trql\web\WebPage       as WebPage;

      if ( ! defined( "VAESOLI_CLASS_VERSION" ) )
          require_once( 'trql.vaesoli.class.php' );

      if ( ! defined( "BROWSER_CLASS_VERSION" ) )
          require_once( 'trql.browser.class.php' );

      if ( ! defined( "WEBPAGE_CLASS_VERSION" ) )
          require_once( 'trql.webpage.class.php' );

      $oPage    = new WebPage();
      $oBrowser = new Browser();
      $oBrowser->parseUA();

      $szBrowserMobility  = strtolower( trim( $oBrowser->szMobility ) );
      $szBrowserName      = $oBrowser->szName;
      $szBrowserType      = $oBrowser->szType;
      $szBrowserPlatform  = $oBrowser->szPlatform;
      $szSeason           = V::TIM_Season();
      $szTimeOfTheDay     = V::TIM_timeOfTheDay( time() );
      $szContentDir       = V::FIL_RealPath( V::FIL_ResolveRoot( '/content' ) );
      $x                  = explode( '.',$_SERVER['HTTP_HOST'] );
      $szSubDomain        = 'www';
      if ( count( $x ) > 2 )
          $szSubDomain = current( $x );

      $szPage = preg_replace( '/(\A-|\.html\z|\.htm\z|\.php\z)/si','',str_replace( '/','-',$_SERVER['SCRIPT_NAME'] ) );

      $aPossibleContentFiles[]    = V::FIL_RealPath( $szContentDir . '/' . $szSubDomain . '-' . $szPage . '-' . $szBrowserMobility . '.html'      );
      $aPossibleContentFiles[]    = V::FIL_RealPath( $szContentDir . '/' . $szSubDomain . '-' . $szPage                            . '.html'      );
      $aPossibleContentFiles[]    = V::FIL_RealPath( $szContentDir . '/' .                      $szPage . '-' . $szBrowserMobility . '.html'      );
      $aPossibleContentFiles[]    = V::FIL_RealPath( $szContentDir . '/' .                      $szPage                            . '.html'      );

      $aPossiblePageDescription[] = V::FIL_RealPath( $szContentDir . '/' . $szSubDomain . '-' . $szPage . '-' . $szBrowserMobility . '.meta.xml'  );
      $aPossiblePageDescription[] = V::FIL_RealPath( $szContentDir . '/' . $szSubDomain . '-' . $szPage . '-' . $szBrowserMobility . '.xml'       );
      $aPossiblePageDescription[] = V::FIL_RealPath( $szContentDir . '/' . $szSubDomain . '-' . $szPage                            . '.meta.xml'  );
      $aPossiblePageDescription[] = V::FIL_RealPath( $szContentDir . '/' . $szSubDomain . '-' . $szPage                            . '.xml'       );
      $aPossiblePageDescription[] = V::FIL_RealPath( $szContentDir . '/' .                      $szPage . '-' . $szBrowserMobility . '.meta.xml'  );
      $aPossiblePageDescription[] = V::FIL_RealPath( $szContentDir . '/' .                      $szPage . '-' . $szBrowserMobility . '.xml'       );
      $aPossiblePageDescription[] = V::FIL_RealPath( $szContentDir . '/' .                      $szPage                            . '.meta.xml'  );
      $aPossiblePageDescription[] = V::FIL_RealPath( $szContentDir . '/' .                      $szPage                            . '.xml'       );

      /* Read the Meta definitions of the page (if any). We have
         multiple possible files, starting from the most specific
         to the less specific. The first one that matches is the
         one we load */
      foreach( $aPossiblePageDescription as $szXMLFile )
      {
          if ( is_file( $szXMLFile ) )
          {
              $oPage->readManifest( $szXMLFile );
              break;
          }
      }   /* foreach( $aPossiblePageDescription as $szXMLFile ) */

      ?>
      <!doctype html>
      <html>
          <head>
              <meta charset="UTF-8">
              <title><?php echo $oPage->title; ?></title>
              <meta name="viewport" content="width=device-width, initial-scale=1.0">
              <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto">
              <link rel="stylesheet" href="/css/mathieu.css">
              <meta name="author" content="<?php echo $oPage->author->name; ?>">
              <meta name="description" content="<?php echo $oPage->description; ?>">
              <meta name="keywords" content="<?php echo $oPage->keywords; ?>">
          </head>

          <body vocab="https://schema.org/" typeof="WebPage" class="<?php echo $szBrowserMobility,' ',$szBrowserName,' ',$szBrowserType,' ',$szBrowserPlatform,' ',$szSeason,' ',$szTimeOfTheDay; ?>">
              <div class="wrapper">
              <?php
                  /* We have multiple possible files for the content, starting from
                     the most specific name to the less specific. The first one that
                     matches is the one we load */
                  foreach( $aPossibleContentFiles as $szFile )
                  {
                      if ( is_file( $szFile ) )
                      {
                          include_once( $szFile );
                          break;
                      }
                  }   /* foreach( $aPossibleContentFiles as $szFile ) */
              ?>
              </div>
          </body>
      </html>
  

renderComments(): Renders all comments of the page

Warning:

This method is experimental

Syntax:

renderComments( $szHome )

Parameters:
Name Type Description
$szHome string Home of the class. Optional.

Return:

(self): The current instance of the class