Dotclear 2.24
Loading...
Searching...
No Matches
dcWidget Class Reference

Public Member Functions

 serialize (int $order)
 
 __construct (string $id, string $name, $callback, string $desc='')
 
 id ()
 
 name ()
 
 desc ()
 
 getCallback ()
 
 call ($i=0)
 
 renderDiv (bool $content_only, string $class, string $attr, string $content)
 
 renderTitle (?string $title)
 
 renderSubtitle (?string $title, $render=true)
 
 __get (string $n)
 
 __set (string $n, $v)
 
 setting (string $name, string $title, $value, string $type='text')
 
 settings ()
 
 formSettings (string $pr='', int &$i=0)
 
 formSetting (string $id, array $s, string $pr='', int &$i=0)
 
 addTitle (string $title='')
 
 addHomeOnly ()
 
 checkHomeOnly ($type, $alt_not_home=1, $alt_home=0)
 
 addContentOnly (int $content_only=0)
 
 addClass (string $class='')
 
 addOffline (int $offline=0)
 
 isOffline ()
 

Data Fields

const ALL_PAGES = 0
 
const HOME_ONLY = 1
 
const EXCEPT_HOME = 2
 
 $append_callback = null
 

Protected Attributes

 $settings = []
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( string  $id,
string  $name,
  $callback,
string  $desc = '' 
)

Constructs a new instance.

Parameters
string$idThe identifier
string$nameThe name
mixed$callbackThe callback
string$descThe description

References desc(), and name().

Member Function Documentation

◆ serialize()

serialize ( int  $order)

Get array of widget settings

Parameters
int$orderThe order
Returns
array

References settings().

◆ id()

id ( )

Get widget ID

Returns
string

◆ name()

name ( )

Get widget name

Returns
string

Referenced by __construct().

◆ desc()

desc ( )

Get widget description

Returns
string

Referenced by __construct().

◆ getCallback()

getCallback ( )

Gets the widget callback.

Returns
null|callable The callback.

◆ call()

call (   $i = 0)

Call a widget callback

Parameters
mixed$i
Returns
string

◆ renderDiv()

renderDiv ( bool  $content_only,
string  $class,
string  $attr,
string  $content 
)

Widget rendering tool

Parameters
bool$content_onlyThe content only
string$classThe class
string$attrThe attribute
string$contentThe content
Returns
string

References dcCore\app(), and html\escapeHTML().

Referenced by defaultWidgets\bestof(), defaultWidgets\categories(), defaultWidgets\feed(), defaultWidgets\langs(), defaultWidgets\lastcomments(), defaultWidgets\lastposts(), linksWidget(), defaultWidgets\navigation(), tplPages\pagesWidget(), defaultWidgets\search(), defaultWidgets\subscribe(), and defaultWidgets\text().

◆ renderTitle()

◆ renderSubtitle()

renderSubtitle ( ?string  $title,
  $render = true 
)

Render widget subtitle

Parameters
null | string$titleThe title
bool$renderThe render
Returns
string

References dcCore\app(), and DC_DEFAULT_TPLSET.

Referenced by linksWidget().

◆ __get()

__get ( string  $n)

Gets the specified setting value.

Parameters
string$nThe setting name
Returns
mixed

References settings().

◆ __set()

__set ( string  $n,
  $v 
)

Set the specified setting value

Parameters
string$nThe setting name
mixed$vThe new value

References settings().

◆ setting()

setting ( string  $name,
string  $title,
  $value,
string  $type = 'text' 
)

Store a setting

Parameters
string$nameThe name
string$titleThe title
mixed$valueThe value
string$typeThe type
Returns
bool|self

References settings().

Referenced by addClass(), addContentOnly(), addHomeOnly(), addOffline(), and addTitle().

◆ settings()

settings ( )

Get widget settings

Returns
array

References $settings.

Referenced by __get(), __set(), checkHomeOnly(), formSettings(), isOffline(), serialize(), and setting().

◆ formSettings()

formSettings ( string  $pr = '',
int &  $i = 0 
)

Get widget settings form

Parameters
string$prThe prefix
int$iThe index
Returns
string

References formSetting(), and settings().

◆ formSetting()

formSetting ( string  $id,
array  $s,
string  $pr = '',
int &  $i = 0 
)

Get a widget setting field

Parameters
string$idThe identifier
array$sThe setting
string$prThe prefix
int$iThe index
Returns
string

References dcCore\app(), form\checkbox(), form\color(), form\combo(), form\email(), html\escapeHTML(), form\field(), form\hidden(), form\number(), and form\radio().

Referenced by formSettings().

◆ addTitle()

addTitle ( string  $title = '')

Adds a title setting.

Parameters
string$titleThe title
Returns
bool|self

References setting().

◆ addHomeOnly()

addHomeOnly ( )

Adds a home only setting.

Returns
bool|self

References setting().

◆ checkHomeOnly()

checkHomeOnly (   $type,
  $alt_not_home = 1,
  $alt_home = 0 
)

Check if the widget should be displayed, depending on its homeonly setting

Parameters
string$typeThe type
int$alt_not_homeAlternate not home test value
int$alt_homeAlternate home test value
Returns
bool

References dcCore\app(), and settings().

Referenced by defaultWidgets\bestof(), defaultWidgets\categories(), defaultWidgets\feed(), defaultWidgets\langs(), defaultWidgets\lastcomments(), defaultWidgets\lastposts(), linksWidget(), defaultWidgets\navigation(), tplPages\pagesWidget(), defaultWidgets\search(), defaultWidgets\subscribe(), and defaultWidgets\text().

◆ addContentOnly()

addContentOnly ( int  $content_only = 0)

Adds a content only setting.

Parameters
int$content_onlyThe content only flag
Returns
self|bool

References setting().

◆ addClass()

addClass ( string  $class = '')

Adds a class setting.

Parameters
string$classThe class
Returns
self|bool

References setting().

◆ addOffline()

addOffline ( int  $offline = 0)

Adds an offline setting.

Parameters
int$offlineThe offline flag
Returns
self|bool

References setting().

◆ isOffline()

isOffline ( )

Determines if setting is offline.

Returns
bool True if offline, False otherwise.

References settings().

Field Documentation

◆ ALL_PAGES

const ALL_PAGES = 0

◆ HOME_ONLY

const HOME_ONLY = 1

◆ EXCEPT_HOME

const EXCEPT_HOME = 2

◆ $append_callback

$append_callback = null

◆ $settings

$settings = []
protected

Referenced by settings().


The documentation for this class was generated from the following file: