Giter VIP home page Giter VIP logo

sfflattrplugin's Introduction

sfFlattrPlugin

This Symfony plugin enables easy to use integration with the Flattr service. Specifically, it provides a helper function to create Flattr buttons.

Installation

I recommend installing the plugin as a Git submodule:

$ git submodule add plugins/sfFlattrPlugin http://github.com/tobiassjosten/sfFlattrPlugin.git

Then you add it to your list of enabled plugins:

<?php
// config/ProjectConfiguration.class.php
class ProjectConfiguration extends sfProjectConfiguration
{
  public function setup()
  {
    $this->enablePlugins('sfFlattrPlugin');
  }
}

And finally you add it you you filter chain:

# apps/frontend/config/filters.yml
rendering: ~
security:  ~
sf_flattr_plugin:
  class: sfFlattrFilter
cache:     ~
execution: ~

Configuration

There are three ways to configure your Flattr buttons. You can either do it in app.yml, when you create buttons or a mix of the two.

These are the settings you can use in your app.yml:

all:
  sf_flattr_plugin:
    # Required
    uid:         User ID on Flattr.
    title:       The title of your item.
    description: A description of your item.
    category:    text, images, video, audio, software or rest
    # Optional
    language:    Language of the item, using syntax 'en_GB'.
    tags:        Comma seperated,list of,tags
    button:      normal (default) or compact
    hidden:      1 to hide, 0 (default) to show on Flattr.com listing
    html5:       false

Usage

Creating a Flattr buttons involves first including the helper. Either in your settings.yml:

# apps/frontend/config/settings.yml
all:
  .settings:
    standard_helpers:
      - Flattr

... or directly in your view:

<?php use_helper('Flattr') ?>

And then you may use the helper. Here is an example with most of the configuration options either instead of or to override settings in app.yml:

flattr_button(url_for('my_route', $item, true), array(
  'uid' => 'tobiassjosten',
  'title' => 'Example title',
  'description' => 'A very descriptive text',
  'category' => 'text',
  'button' => 'compact',
  'html5' => false,
  'data' => array('button' => 'compact'),
));

sfflattrplugin's People

Contributors

tobiassjosten avatar

Stargazers

 avatar  avatar  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.