Giter Club home page Giter Club logo

site's Introduction

Site

Site is a Website framework built on top of Swat. Site provides several features in one monolothic package:

  • general application framework
  • command line application framework
  • web application framework
  • web request routing
  • image processing
  • media processing
  • account sign in and session management
  • ad referral processing
  • attachment uploading
  • cdn management
  • user commenting

SiteApplication

This represents an application. There are two main child classes:

  • SiteWebApplication, and
  • SiteCommandLineApplication

SiteApplicationModule

Reusable features of applications (web or CLI) that should be available wherever there is application context are provided using a module interface.

Example provided modules are:

  • database
  • config
  • memcache
  • cd
  • messages (cross-request session messages)

Modules declare their dependencies and are initialized using a tree sorting algorithm. For example, the messages module depends on the session module.

SitePage and SitePageDecorator

Pages represent route endpoints (URLs) in a web application. The URL path is often referred to as $source. Each page has several lifecycle hooks that can be overridden:

  • init() - initialize objects that may be common to both the process() and build methods. Validating HTTP GET parameters can be done here.
  • process() - runs between init() and build(). This method is indended to contain request logic that might prevent the page from being rendered. Handling HTTP POST parameters is done here.
  • build() - use this method to render content and pass it to the page layout. If the page request does not cause a redirect, this method is used to build the response.
  • finalize() - use this method to collect HTML head entries or perform any other post-build operations.

Decorators are composable objects that implement the page interface. They can enable horizontal reuse of features.

SiteLayout

In a web application, each page has an associated layout. The page and layout are created and configured in SiteWebApplication::getPage(). One or more SitePageFactory objects may be used to select the correct page object and layout for a request.

The page sets properties on the layout's $data object. These properties can be used directly inside layout templates. Templates use pure immediate-mode PHP.

Like pages, layouts have request lifecycle hooks. These hooks run before the page hooks of the same name:

  • init()
  • process()
  • build()
  • finalize()
  • complete() - this hook is only present in layouts and allows using data from the page's finalize() hook to build layout template values. It runs after the page's finalize() hook.

Additional Documentation

Installation

Make sure the silverorange composer repository is added to the composer.json for the project and then run:

composer require silverorange/site

site's People

Contributors

charleswaddell avatar gauthierm avatar gervaisdem avatar isagrant avatar jaymefso avatar keithburgoyne avatar kendraso avatar m-mitchell avatar marjmandi avatar nburka avatar nrfredrickson avatar pparke avatar qcode avatar sgarrity avatar wen-2018 avatar wittman avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

site's Issues

Attachment CDN upload issue

Attachment on disk is large.
Filesize in db is small. File on CDN matches the db file size, and re-uploading doesn't fix. Figure it out.

Resend contract and paperwork reminder.

Jerry mentioned that they do this manually. Follow up and figure out what needs to be sent, and on what exact threshold. We should be able to easily automate it.

Add HLS Support to SiteMedia

Figure out what the data structure is going to look like. We have a meeting to do this on March 10th at 10 AM.

Inconsistent APIs between media and attachments

Charles and I just noticed a discrepancy between SiteAttachment and SiteMedia getHumanFileType(). One takes an array of type mappings and the other takes a shortname.

Is there any way we can unify those APIs?

Maybe SiteImage as well.

ffprobe calculates audio duration incorrectly

To fix, requires a modern ffmpeg and then:

ffprobe -select_streams a -show_packets -print_format compact -v quiet $filename 2>/dev/null

Then split the last line of output by | and use the pts_time field as the duration in seconds.What it is doing is reading each packet without playing the MP3. This will be slower than the default ffprobe behavior, but much more accurate.

This requires streaming the entire file rather than just reading the header, so bandwidth needs to be considered.

Video not supported message broken and missing across sites.

Somewhere along the way this regressed for all sites using SiteJwPlayer.

I've also broken this up into individual issues across the site repos, detailing how it is broken on each site for the various video players on each site. See issues referenced below.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.