Git Product home page Git Product logo

php-pavatar's Introduction

Pavatar

Introduction

This PHP library implements Pavatar, an open specification for a decentralized way of including avatars (user-defined images, such as photos) in web applications.

Supporting web applications is easy, through a simple API or, better yet, creating plugins. It currently includes plugins for b2evolution and WordPress.

The current version can be determined via make get-version.

More Information.

Changes in php-pavatar 0.5

Version 0.5 mostly features some modernization, but might have bugs, so please report them:

  • The code has been updated for PHP 5.2+. The code was originally written when PHP 4.x was ubiquitous, but that's no longer a concern.
  • The possible bugginess of the code is specifically due to using class properties rather than passing around variables.
  • In a way, _pavatar.class.php is the successor of pavatar-oop.php, but it's not 100% compatible. In php-pavatar 0.4.5, some changes were made to make it a transitional change to php-pavatar 0.5, at the risk of backwards compatibility (see below).
  • b2evolution: 6.7.2 or higher is required for correct functioning.
  • WordPress: I didn't feel like installing WordPress to test the new code, so you can send me pull requests to fix whatever I might have accidentally done wrong.

If any of that concerns you, you can always check out a previous tag. 0.4.4 is the code as of 2015-05-31. 0.4.5 is code containing the bug fixes for b2evolution 6.7.2+ (and the aforementioned changes in pavatar-oop.php).

Migrating from 0.4.4's pavatar-oop.php to 0.4.5's

  • Don't use the Pavatar::to_html() method. Instead, the class's return value will be a string. So, $ret = $pavatar->to_html() becomes $ret = $pavatar.
  • Don't use the Pavatar::accessor() method. So, $version = $pavatar->accessor('version') becomes $version = $pavatar->version.

Migrating from 0.4.5's pavatar-oop.php to 0.5's _pavatar.class.php

  • Optionally pass the cache directory to the constructor.
  • Use the Pavatar::$post_content property rather than the Pavatar::set_post_content() method.
  • Use the Pavatar::$author_url property rather than the Pavatar::set_url() method.
  • Change Pavatar::$version to Pavatar::VERSION.

Migrating from _pavatar.inc.php to _pavatar.class.php

  • Construct a Pavatar object rather than calling _pavatar_init().
  • The constructor can be called with the cache directory (defaulting to the current) or false to disable caching.
  • The $_pavatar_<variable> variables have been changed to the Pavatar::$<variable> properties with a few exceptions:
    • $_pavatar_cache_dir has been changed to passing the cache directory to the constructor.
    • $_pavatar_email becomes Pavatar::$author_email.
    • $_pavatar_version becomes Pavatar::VERSION.
    • $_pavatar_ui_name and $_pavatar_ui_version become Pavatar::$user_agent['name'] and Pavatar::$user_agent['version'].
    • $_pavatar_use_legacy has been removed. Legacy HTML code is no longer produced.
  • Instead of _pavatar_getPavatarCode(), set Pavatar::$author_url and Pavatar::$post_content. The resulting HTML will be contained in the Pavatar object.

You can look at the b2evolution plugin for a functioning example.

Thanks To

php-pavatar's People

Contributors

keithbowes avatar

Watchers

 avatar

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.