phpDocumentor plugins
[ class tree: plugins ] [ index: plugins ] [ all elements ]

Procedural File: _plugin.funcs.php

Source Location: /qp_inc/plugins/_plugin.funcs.php

Page Details

Functions for Plugin handling.

This file is part of Quam Plures - http://quamplures.net/ See also https://launchpad.net/quam-plures.

Author:  fplanque: Francois PLANQUE
Author:  blueyed: Daniel HAHLER
Copyright:  

(c)2003-2009 by Francois PLANQUE - http://fplanque.net/ Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - http://thequod.de/contact.

Copyright:  (c) 2009 - 2011 by the Quam Plures developers - http://quamplures.net/
Filesource:  Source Code for this file
Functions
autoform_display_field  [line 54]

void autoform_display_field( string $parname, array $parmeta, Form &$Form, string $set_type, Plugin|Widget $Obj, [mixed $set_target = NULL], [mixed $use_value = NULL]  )

Recursive helper function to display a field of the plugin's settings (by manipulating a Form).

Used for PluginSettings ("Edit plugin") and PluginUserSettings ("Edit user settings") as well as widgets.

Parameters:
string   $parname:  Settings path, e.g. 'locales[0]' or 'setting'
array   $parmeta:  Meta data for this setting.
Form   &$Form:  (by reference)
string   $set_type:  Settings type ('Settings' or 'UserSettings' or 'Widget' or 'Template')
Plugin|Widget   $Obj: 
mixed   $set_target:  Target (User object for 'UserSettings')
mixed   $use_value:  Value to really use (used for recursion into array type settings)

Information Tags:
Todo:  dh> (obsolete path reference! - EdB) Allow to move setting sets up and down (order). Control goes into /inc/CONTROL/settings/plugins.php.
Todo:  NOTE: fp> I'm using this outside of Plugins; I'm not sure about proper factorization yet. This should probably be an extension of the Form class. Sth like "AutoForm" ;)

[ Top ]
autoform_set_param_from_request  [line 638]

void autoform_set_param_from_request( string $parname, array $parmeta, Plugin|Widget &$Obj, string $set_type, [mixed $set_target = NULL]  )

Set Plugin settings from params.

fp> WARNING: also used outside of plugins. Work in progress.

This handled plugin specific params when saving a user profile (PluginUserSettings) or plugin settings (PluginSettings).

Parameters:
string   $parname:  Settings path, e.g. 'locales[0]' or 'setting'
array   $parmeta:  Meta data for this setting.
Plugin|Widget   &$Obj: 
string   $set_type:  Type of Settings (either 'Settings' or 'UserSettings').
mixed   $set_target:  Target (User object for 'UserSettings')


[ Top ]
autoform_validate_param_value  [line 763]

boolean autoform_validate_param_value( string $param_name, array $value, $meta  )

Validates settings according to their meta info recursively.

Parameters:
string   $param_name:  Param name
array   $value:  Meta info
   $meta: 

Information Tags:
Todo:  Init "checkbox" values in "array" type settings (they do not get send) (dh)

[ Top ]
get_plugin_settings_node_by_path  [line 531]

array get_plugin_settings_node_by_path( Plugin &$Plugin, string $set_type, string $path, [ $create = false]  )

Get a node from settings by path (e.g. "locales[0][questions]")

Parameters:
Plugin   &$Plugin: 
string   $set_type:  Settings type ("Settings" or "UserSettings")
string   $path:  The settings path, e.g. 'setting[0]foo[1]' or even 'setting[]'. (Is used as array internally for recursion.)
   $create: 

API Tags:
Return:  Array(
  • 'set_name': setting name (string); key of the first level
  • 'set_node': selected setting node, may be NULL (by reference)
  • 'set_meta': meta info (from GetDefault[User]Settings()) for selected node (array)
  • 'set_parent': parent node (by reference)
  • 'set_key': key in parent node (by reference)
  • 'setting': whole settings (array)


[ Top ]
handle_array_keys_in_plugin_settings  [line 976]

void handle_array_keys_in_plugin_settings( array &$a  )

This handles the special "__key__" index in all array type values in the given array. It makes sure, that "__key__" is unique and replaces the original key of the value with it.

Parameters:
array   &$a:  (by reference)


[ Top ]
_set_setting_by_path  [line 453]

array|false _set_setting_by_path( Plugin &$Plugin, string $set_type, string $path, [mixed $init_value = array()]  )

Helper method for "add_settings_set" and "delete_settings_set" action.

Walks the given settings path and either inits the target entry or unsets it ($init_value=NULL).

Parameters:
Plugin   &$Plugin: 
string   $set_type:  Settings type ("Settings" or "UserSettings")
string   $path:  The settings path, e.g. 'setting[0]foo[1]'. (Is used as array internally for recursion.)
mixed   $init_value:  The initial value of the setting, typically array() - NULL to unset it (action "delete_settings_set" uses it)


[ Top ]