'lang','default'=>'en_US','optional'=>true)); /** * @access private * @ignore */ public $wysiwygactive = false; /** * @access private * @ignore */ public $syntaxactive = false; /** * @access private * @ignore */ var $error = ''; /** * @access private * @ignore */ private $modinstall = false; /** * @access private * @ignore */ private $modtemplates = false; /** * @access private * @ignore */ private $modlang = false; /** * @access private * @ignore */ private $modform = false; /** * @access private * @ignore */ private $modredirect = false; /** * @access private * @ignore */ private $modmisc = false; /** * @access private * @ignore */ private $param_map = array(); /** * @access private * @ignore */ private $restrict_unknown_params = false; /** * @access private * @ignore */ private $__errors; /** * @access private * @ignore */ private $__messages; /** * @access private * @ignore */ private $__current_tab; /** * Magic methods. This handles the deprecated. $this->db etc, syntax. * * @param string The key to get. possible values are cms,db,smarty.config * @deprecated */ public function &__get($key) { switch( $key ) { case 'cms': return cmsms(); case 'smarty': return cmsms()->GetSmarty(); case 'config': return cmsms()->GetConfig(); case 'db': return cmsms()->GetDb(); } $tmp = null; return $tmp; } /** * Constructor * */ public function CMSModule() { global $CMS_STYLESHEET; global $CMS_ADMIN_PAGE; global $CMS_MODULE_PAGE; global $CMS_INSTALL_PAGE; //$this->curlang = cms_current_language(); // current language for this request. <- Messes up frontend NLS stuff if( !isset($CMS_ADMIN_PAGE) && !isset($CMS_STYLESHEET) && !isset($CMS_INSTALL_PAGE)) { $this->SetParameterType('assign',CLEAN_STRING); $this->SetParameterType('module',CLEAN_STRING); $this->SetParameterType('lang',CLEAN_STRING); $this->SetParameterType('returnid',CLEAN_INT); $this->SetParameterType('action',CLEAN_STRING); $this->SetParameterType('showtemplate',CLEAN_STRING); $this->SetParameterType('inline',CLEAN_INT); $this->InitializeFrontend(); } else if( isset($CMS_ADMIN_PAGE) && !isset($CMS_STYLESHEET) && !isset($CMS_INSTALL_PAGE) ) { $this->params[0]['help'] = lang('langparam'); $this->InitializeAdmin(); } } /** * Private * * @ignore */ function LoadTemplateMethods() { if (!$this->modtemplates) { require_once(cms_join_path(dirname(__FILE__), 'module_support', 'modtemplates.inc.php')); $this->modtemplates = true; } } /** * Private * * @ignore */ function LoadLangMethods() { if (!$this->modlang) { require_once(cms_join_path(dirname(__FILE__), 'module_support', 'modlang.inc.php')); $this->modlang = true; } } /** * Private * * @ignore */ function LoadFormMethods() { if (!$this->modform) { require_once(cms_join_path(dirname(__FILE__), 'module_support', 'modform.inc.php')); $this->modform = true; } } /** * Private * * @ignore */ function LoadRedirectMethods() { if (!$this->modredirect) { require_once(cms_join_path(dirname(__FILE__), 'module_support', 'modredirect.inc.php')); $this->modredirect = true; } } /** * Private * * @ignore */ function LoadMiscMethods() { if (!$this->modmisc) { require_once(cms_join_path(dirname(__FILE__), 'module_support', 'modmisc.inc.php')); $this->modmisc = true; } } /** * ------------------------------------------------------------------ * Plugin Functions. * ------------------------------------------------------------------ */ /** * Callback function for module plugins. * This method is used to call the module from * within template co. * * This function should not be overridden * * @final * @return mixed module call output. * @ignore */ final static public function function_plugin($params,&$template) { $class = get_called_class(); $params['module'] = $class; return cms_module_plugin($params,$template); } /** * Register a smarty plugin and attach it to this module. * This method registers a static plugin to the plugins database table, and should be used only when a module * is installed or upgraded. * * @see smarty documentation. * @author calguy1000 * @since 1.11 * @param string The plugin name * @param string The plugin type (function,compiler,block, etc) * @param mixed The function callback (must be a static function) * @param boolean Wether this function is cachable. * @param integer Indicates frontend (0), or frontend and backend (1) availability. * @return void */ public function RegisterSmartyPlugin($name,$type,$callback,$cachable = TRUE,$usage = 0) { if( !$name || !$type || !$callback ) { throw new CmsException('Invalid data passed to RegisterSmartyPlugin'); } // todo: check name, and type if( $usage == 0 ) $usage = cms_module_smarty_plugin_manager::AVAIL_FRONTEND; cms_module_smarty_plugin_manager::addStatic($this->GetName(),$name,$type,$callback,$cachable,$usage); } /** * Unregister a smarty plugin from the system. * This method removes any matching rows from the database, and should only be used in a modules uninstall or upgrade routine. * * @author calguy1000 * @since 1.11 * @param string The smarty plugin name. If no name is specified all smarty plugins registered to this module will be removed. * @return void */ public function RemoveSmartyPlugin($name = '') { if( $name == '' ) { cms_module_smarty_plugin_manager::remove_by_module($this->GetName()); } else { cms_module_smarty_plugin_manager::remove_by_name($name); } } /** * Register a plugin to smarty with the * name of the module. This method should be called * from the module constructor, or from the InitializeFrontend() * method. * * Note: * @final * @return void * @see SetParameters * @see can_cache_output * @param boolean Indicate wether this registration should be forced to be entered in the database. Default value is false (for compatibility) * @param mixed Indicate wether this plugins output should be cachable. If null, use the site preferences, and the can_cache_output method. Otherwise a boolean is expected. * @deprecated */ final public function RegisterModulePlugin($forcedb = FALSE,$cachable = null) { global $CMS_ADMIN_PAGE; global $CMS_INSTALL_PAGE; if( is_null($cachable) ) { $do_cache = get_site_preference('smarty_cachemodules','never'); $cachable = false; if( $do_cache == 'always' ) { $cachable = true; } else if( $do_cache == 'moduledecides' ) { $cachable = $this->can_cache_output(); } } // frontend request. $admin_req = (isset($CMS_ADMIN_PAGE) && !$this->LazyLoadAdmin())?1:0; $fe_req = (!isset($CMS_ADMIN_PAGE) && !$this->LazyLoadFrontend())?1:0; if( ($fe_req || $admin_req) && !$forcedb ) { // no lazy loading. $gCms = cmsms(); $smarty = $gCms->GetSmarty(); $smarty->register_function($this->GetName(), array($this->GetName(),'function_plugin'), $cachable ); return TRUE; } else { return cms_module_smarty_plugin_manager::addStatic($this->GetName(), $this->GetName(), 'function', 'function_plugin', $cachable); } } /** * Callback to determine if the output from a call to the module can be cached by smarty. * * @since 1.11 * @author Robert Campbell * @return boolean */ final public function can_cache_output() { global $CMS_ADMIN_PAGE, $CMS_INSTALL_PAGE, $CMS_STYLESHEET; if( isset($CMS_ADMIN_PAGE) || isset($CMS_INSTALL_PAGE) || isset($CMS_STYLESHEET) ) return FALSE; return $this->AllowSmartyCaching(); } /** * Callback to determine if the output from a call to the module can be cached by smarty. * * @since 1.11 * @author Robert Campbell * @return boolean */ public function AllowSmartyCaching() { return FALSE; } /** * ------------------------------------------------------------------ * Basic Functions. Name and Version MUST be overridden. * ------------------------------------------------------------------ */ /** * Returns a sufficient about page for a module * * @abstract * @return string The about page HTML text. */ function GetAbout() { $this->LoadMiscMethods(); return cms_module_GetAbout($this); } /** * Returns a sufficient help page for a module * this function should not be overridden * * @return string The help page HTML text. * @final */ final public function GetHelpPage() { $this->LoadMiscMethods(); return cms_module_GetHelpPage($this); } /** * Returns the name of the module * * @abstract * @return string The name of the module. */ function GetName() { return get_class($this); } /** * Returns the full path to the module directory. * * @final * @return string The full path to the module directory. */ final public function GetModulePath() { if (is_subclass_of($this, 'CMSModule')) { return cms_join_path($this->config['root_path'], 'modules' , $this->GetName()); } else { return dirname(__FILE__); } } /** * Returns the URL path to the module directory. * * @final * @param boolean Optional generate an URL using HTTPS path * @return string The full path to the module directory. */ final public function GetModuleURLPath($use_ssl=false) { return ($use_ssl?$this->config['ssl_url']:$this->config->smart_root_url()) . '/modules/' . $this->GetName(); } /** * Returns a translatable name of the module. For modulues who's names can * probably be translated into another language (like News) * * @abstract * @return string */ function GetFriendlyName() { return $this->GetName(); } /** * Returns the version of the module * * @abstract * @return string */ function GetVersion() { return '0.0.0.1'; } /** * Returns the minimum version necessary to run this version of the module. * * @abstract * @return string */ function MinimumCMSVersion() { global $CMS_VERSION; return $CMS_VERSION; } /** * Returns the maximum version necessary to run this version of the module. * * @abstract * @deprecated * @return string */ function MaximumCMSVersion() { global $CMS_VERSION; return $CMS_VERSION; } /** * Returns the help for the module * * @param string Optional language that the admin is using. If that language * is not defined, use en_US. * * @abstract * @return string Help HTML Text. */ function GetHelp() { return ''; } /** * Returns XHTML that needs to go between the
tags when this module is called from an admin side action. * * This method is called by the admin theme when executing an action for a specific module. * * @return string XHTML text */ function GetHeaderHTML() { return ''; } /** * Use this method to prevent the admin interface from outputting header, footer, * theme, etc, so your module can output files directly to the administrator. * Do this by returning true. * * @param array The input request. This can be used to test conditions wether or not admin output should be suppressed. * @return boolean */ function SuppressAdminOutput(&$request) { return false; } /** * Register a route to use for pretty url parsing * * Note: This method is not compatible wih lazy loading in the front end. * * @final * @see SetParameters * @param string Regular Expression Route to register * @param array Defaults for parameters that might not be included in the url * @return void */ final public function RegisterRoute($routeregex, $defaults = array()) { $route = new CmsRoute($routeregex,$this->GetName(),$defaults); cms_route_manager::register($route); } /** * Register all static routes for this module. * * @since 1.11 * @author Robert Campbell * @return void */ public function CreateStaticRoutes() {} /** * Returns a list of parameters and their help strings in a hash. This is generally * used internally. * * @final * @internal * @access private * @return array */ final public function GetParameters() { if( count($this->params) == 1 && $this->params[0]['name'] == 'lang' ) { // quick hack to load parameters if they are not already loaded. $this->InitializeAdmin(); } return $this->params; } /** * Called from within the constructor, This method should be overridden to call the CreaeteParameter * method for each parameter that the module understands. * * Note: In past versions of CMSMS This method was used for both admin and frontend requests to * register routes, and create parameters, and register a module plugin, etc. As of version 1.10 * this method is deprecated, and the appropriate functions are InitializeFrontend() and InitializeAdmin() * This method is scheduled for removal in version 1.11 * * @abstract * @see CreateParameter * @see InitializeFrontend() * @see InitializeAdmin() * @deprecated * @return void */ function SetParameters() { } /** * Called from within the constructor, ONLY for frontend module * actions. This method should be overridden to create routes, and * set handled parameters, and perform other initialization tasks * that need to be setup for all frontend actions. * * @abstract * @see SetParameterType * @see RegisterRoute * @see RestrictUnknownParams * @see RegisterModulePlugin * @return void */ protected function InitializeFrontend() { $this->SetParameters(); // for backwards compatibility purposes. may be removed. } /** * Called from within the constructor, ONLY for admin module * actions. This method should be overridden to create routes, and * set handled parameters, and perform other initialization tasks * that need to be setup for all frontend actions. * * @abstract * @see CreateParameter * @return void */ protected function InitializeAdmin() { $this->SetParameters(); // for backwards compatibility purposes. may be removed. } /** * A method to indicate that the system should drop and optionally * generate an error about unknown parameters on frontend actions. * * @see SetParameterType * @see CreateParameter * @final * @param boolean Flag indicating wether unknown params should be restricted. * @return void */ final public function RestrictUnknownParams($flag = true) { $this->restrict_unknown_params = $flag; } /** * Indicate the name of, and type of a parameter that is * acceptable for frontend actions. * * possible values for type are: * CLEAN_INT,CLEAN_FLOAT,CLEAN_NONE,CLEAN_STRING * * i.e: * $this->SetParameterType('numarticles',CLEAN_INT); * * @see CreateParameter * @see SetParameters * @final * @param string Parameter name; * @param define Parameter type; * @return void; */ final public function SetParameterType($param, $type) { switch($type) { case CLEAN_INT: case CLEAN_FLOAT: case CLEAN_NONE: case CLEAN_STRING: $this->param_map[trim($param)] = $type; break; default: trigger_error('Attempt to set invalid parameter type'); break; } } /** * Create a parameter and it's documentation for display in the * module help. * * i.e: * $this->CreateParameter('numarticles',100000,$this->Lang('help_numarticles'),true); * * @see SetParameters * @see SetParameterType * @final * @param string Parameter name; * @param string Default parameter value * @param string Help String * @param boolean Flag indicating wether this parameter is optional or required. * @return void; */ final public function CreateParameter($param, $defaultval='', $helpstring='', $optional=true) { //was: array_unshift( array_push($this->params, array( 'name' => $param, 'default' => $defaultval, 'help' => $helpstring, 'optional' => $optional )); } /** * Returns a short description of the module * * @abstract * @param string Optional language that the admin is using. If that language * is not defined, use en_US. * @return string */ function GetDescription($lang = 'en_US') { return ''; } /** * Returns a description of what the admin link does. * * @abstract * @return string */ function GetAdminDescription() { return ''; } /** * Returns whether this module should only be loaded from the admin * * @abstract * @return boolean */ function IsAdminOnly() { return false; } /** * Returns the changelog for the module * * @return string HTML text of the changelog. */ function GetChangeLog() { return ''; } /** * Returns the name of the author * * @abstract * @return string The name of the author. */ function GetAuthor() { return ''; } /** * Returns the email address of the author * * @abstract * @return string The email address of the author. */ function GetAuthorEmail() { return ''; } /** * ------------------------------------------------------------------ * Reference functions * ------------------------------------------------------------------ */ /** * Returns the cms->config object as a reference * * @final * @deprecated * @return array The config hash. */ final public function GetConfig() { return cmsms()->GetConfig(); } /** * Returns the cms->db object as a reference * * @final * @deprecated * @return object Adodb Database object. */ final public function & GetDb() { return cmsms()->GetDb(); } /** * Returns CMSMS temporary and state variables. * * @final * @deprecated Subject for removal in CMSMS 1.12 * @return array a hash of CMSMS temporary variables. */ final public function GetVariables() { return cmsms()->variables; } /** * ------------------------------------------------------------------ * Content Block Related Functions * ------------------------------------------------------------------ */ /** * Get an input field for a module generated content block type. * * This method can be overridden if the module is providing content * block types to the CMSMS content objects. * * @abstract * @param string Content block name * @param mixed Content block value * @param array Content block parameters * @param boolean A flag indicating wether the content editor is in create mode (adding) vs. edit mod. * @return mixed Either an array with two elements (prompt, and xhtml element) or a string containing only the xhtml input element. */ function GetContentBlockInput($blockName,$value,$params,$adding = false) { return FALSE; } /** * Return a value for a module generated content block type. * Given input parameters (i.e: via _POST or _REQUEST), this method * will extract a value for the given content block information. * * This method can be overridden if the module is providing content * block types to the CMSMS content objects. * * @abstract * @param string Content block name * @param array Content block parameters * @param array input parameters * @return mixed The content block value if possible. */ function GetContentBlockValue($blockName,$blockParams,$inputParams) { return FALSE; } /** * Validate the value for a module generated content block type. * * This method can be overridden if the module is providing content * block types to the CMSMS content objects. * * @abstract * @param string Content block name * @param mixed Content block value * @param arrray Content block parameters. * @return string An error message if the value is invalid, empty otherwise. */ function ValidateContentBlockValue($blockName,$value,$blockparams) { return ''; } /** * Register a bulk content action * * For use in the CMSMS content list this method allows a module to * register a bulk content action. * * @final * @param string A label for the action * @param string A module action name. * @return void */ final public function RegisterBulkContentFunction($label,$action) { bulkcontentoperations::register_function($label,$action,$this->GetName()); } /** * ------------------------------------------------------------------ * Content Type Related Functions * ------------------------------------------------------------------ */ /** * Does this module support a custom content type? * * This method can be overridden if the module is defining one or more * custom content types (note this is different than content block * types) * * @abstract * @return boolean */ function HasContentType() { return FALSE; } /** * Register a new content type * * @deprecated * @final * @param string A name for the new content type * @param string A filename containing the content type definition. * @param string A friendly name for this content type. * @return void */ final public function RegisterContentType($name, $file, $friendlyname = '') { $contentops = cmsms()->GetContentOperations(); $obj = new CmsContentTypePlaceholder(); $obj->class = $name; $obj->type = strtolower($name); $obj->filename = $file; $obj->loaded = false; $obj->friendlyname = ($friendlyname != '' ? $friendlyname : $name); $contentops->register_content_type($obj); } /** * Return an instance of the new content type * * This method must be overridden if this object is providing * a content type. * * @abstract * @deprecated * @return object */ function GetContentTypeInstance() { return FALSE; } // // what is this? // function IsExclusive() // { // return FALSE; // } /** * ------------------------------------------------------------------ * Installation Related Functions * ------------------------------------------------------------------ */ /** * Function that will get called as module is installed. This function should * do any initialization functions including creating database tables. It * should return a string message if there is a failure. Returning nothing (FALSE) * will allow the install procedure to proceed. * * The default behavior of this method is to include a file named method.install.php * in the module directory, if one can be found. This provides a way of splitting * secondary functions into other files. * * @abstract * @return mixed FALSE indicates no error. Any other value will be used as an error message. */ function Install() { $filename = dirname(dirname(dirname(__FILE__))) . '/modules/'.$this->GetName().'/method.install.php'; if (@is_file($filename)) { { $gCms = cmsms(); $db = $gCms->GetDb(); $config = $gCms->GetConfig(); $smarty = $gCms->GetSmarty(); $res = include($filename); if( $res == 1 || $res == '' ) return FALSE; return $res; } } else { return FALSE; } } /** * Display a message after a successful installation of the module. * * @abstract * @return XHTML Text */ function InstallPostMessage() { return FALSE; } /** * Function that will get called as module is uninstalled. This function should * remove any database tables that it uses and perform any other cleanup duties. * It should return a string message if there is a failure. Returning nothing * (FALSE) will allow the uninstall procedure to proceed. * * The default behaviour of this function is to include a file called method.uninstall.php * in your module directory to do uninstall operations. * * @abstract * @return mixed FALSE indicates that the module uninstalled correctly, any other value indicates an error message. */ function Uninstall() { $filename = dirname(dirname(dirname(__FILE__))) . '/modules/'.$this->GetName().'/method.uninstall.php'; if (@is_file($filename)) { $gCms = cmsms(); $db = $gCms->GetDb(); $config = $gCms->GetConfig(); $smarty = $gCms->GetSmarty(); $res = include($filename); if( $res == 1 || $res == '') return FALSE; if( is_string($res)) { $modops = $gCms->GetModuleOperations(); $modops->SetError($res); } return $res; } else { return FALSE; } } /** * Function that gets called upon module uninstall, and returns a boolean to indicate whether or * not the core should remove all module events, event handlers, module templates, and preferences. * The module must still remove its own database tables and permissions * @abstract * @return boolean whether the core may remove all module events, event handles, module templates, and preferences on uninstall (defaults to true) */ function AllowUninstallCleanup() { return true; } /** * Display a message and a Yes/No dialog before doing an uninstall. Returning noting * (FALSE) will go right to the uninstall. * * @abstract * @return XHTML Text, or FALSE. */ function UninstallPreMessage() { return FALSE; } /** * Display a message after a successful uninstall of the module. * * @abstract * @return XHTML Text, or FALSE */ function UninstallPostMessage() { return FALSE; } /** * Function to perform any upgrade procedures. This is mostly used to for * updating databsae tables, but can do other duties as well. It should * return a string message if there is a failure. Returning nothing (FALSE) * will allow the upgrade procedure to proceed. Upgrades should have a path * so that they can be upgraded from more than one version back. While not * a requirement, it makes life easy for your users. * * The default behavior of this method is to call a function called method.upgrade.php * in your module directory, if it exists. * * @param string The version we are upgrading from * @param string The version we are upgrading to * @return boolean */ function Upgrade($oldversion, $newversion) { $filename = dirname(dirname(dirname(__FILE__))) . '/modules/'.$this->GetName().'/method.upgrade.php'; if (@is_file($filename)) { { $gCms = cmsms(); $db = $gCms->GetDb(); $config = $gCms->GetConfig(); $smarty = $gCms->GetSmarty(); $res = include($filename); if( $res == 1 || $res == '' ) return TRUE; $modops = $gCms->GetModuleOperations(); //$modops->SetError($res); return FALSE; } } } /** * Returns whether or not modules should be autoupgraded while upgrading * CMS versions. Generally only useful for modules included with the CMS * base install, but there could be a situation down the road where we have * different distributions with different modules included in them. Defaults * to TRUE, as there is not many reasons to not allow it. * * @abstract * @return boolean */ function AllowAutoInstall() { return TRUE; } /** * Returns whether or not modules should be autoupgraded while upgrading * CMS versions. Generally only useful for modules included with the CMS * base install, but there could be a situation down the road where we have * different distributions with different modules included in them. Defaults * to TRUE, as there is not many reasons to not allow it. * * @abstract * @return boolean */ function AllowAutoUpgrade() { return TRUE; } /** * Returns a list of dependencies and minimum versions that this module * requires. It should return an hash, eg. * return array('somemodule'=>'1.0', 'othermodule'=>'1.1'); * * @abstract * @return array */ function GetDependencies() { return array(); } /** * Checks to see if currently installed modules depend on this module. This is * used by the plugins.php page to make sure that a module can't be uninstalled * before any modules depending on it are uninstalled first. * * @internal * @access private * @final * @return boolean */ final public function CheckForDependents() { $gCms = cmsms(); $db = $gCms->GetDb(); $result = false; $query = "SELECT child_module FROM ".cms_db_prefix()."module_deps WHERE parent_module = ? LIMIT 1"; $tmp = $db->GetOne($query,array($this->GetName())); if( $tmp ) { $result = true; } return $result; } /** * Creates an xml data package from the module directory. * * @final * @return string XML Text * @param string reference to returned message. * @param integer reference to returned file count. */ final public function CreateXMLPackage( &$message, &$filecount ) { $gCms = cmsms(); $modops = $gCms->GetModuleOperations(); return $modops->CreateXmlPackage($this, $message, $filecount); } /** * Return true if there is an admin for the module. Returns false by * default. * * @abstract * @return boolean */ function HasAdmin() { return false; } /** * Returns which admin section this module belongs to. * this is used to place the module in the appropriate admin navigation * section. Valid options are currently: * * content, layout, files, usersgroups, extensions, preferences, siteadmin, ecommerce * * @abstract * @return string */ function GetAdminSection() { return 'extensions'; } /** * Returns true or false, depending on whether the user has the * right permissions to see the module in their Admin menus. * * Typically permission checks are done in the overriden version of * this method. * * Defaults to true. * * @abstract * @return boolean */ function VisibleToAdminUser() { return true; } /** * Returns true if the module should be treated as a content module. * Returns false by default. * * @abstract * @return boolean */ function IsContentModule() { return false; } /** * Returns true if the module should be treated as a plugin module (like * {cms_module module='name'}. Returns false by default. * * @abstract * @return boolean */ function IsPluginModule() { return false; } /** * Returns true if the module acts as a soap server * * @abstract * @return boolean */ function IsSoapModule() { return false; } /** * Returns true if the module may support lazy loading in the front end * * @since 1.8 * @abstract * @return boolean * @deprecated */ public function SupportsLazyLoading() { return LazyLoadFrontend(); } /** * Returns true if the module may support lazy loading in the front end * * Note: The results of this function are not read on each request, only during install and upgrade * therefore if the return value of this function changes the version number of the module should be * increased to force a re-load * * In CMSMS 1.10 routes are loaded upon each request, if a module registers routes it cannot be lazy loaded. * * @since 1.10 * @abstract * @return boolean */ public function LazyLoadFrontend() { return FALSE; } /** * Returns true if the module may support lazy loading in the admin interface. * * Note: The results of this function are not read on each request, only during install and upgrade * therefore if the return value of this function changes the version number of the module should be * increased to force a re-load * * In CMSMS 1.10 routes are loaded upon each request, if a module registers routes it cannot be lazy loaded. * * @since 1.10 * @abstract * @return boolean */ public function LazyLoadAdmin() { return FALSE; } /** * ------------------------------------------------------------------ * HTML Blob / GCB Related Functions * ------------------------------------------------------------------ */ /** * ------------------------------------------------------------------ * Module capabilities, a new way of checking what a module can do * ------------------------------------------------------------------ */ /** * Returns true if the modules thinks it has the capability specified * * @abstract * @param an id specifying which capability to check for, could be "wysiwyg" etc. * @param associative array further params to get more detailed info about the capabilities. Should be syncronized with other modules of same type * @return boolean */ function HasCapability($capability, $params=array()) { return false; } /** * Returns a list of the tasks that this module manages * * @since 1.8 * @abstract * @return array of CmsRegularTask objects, or one object. NULL if not handled. */ function get_tasks() { return FALSE; } /** * ------------------------------------------------------------------ * Syntax Highlighter Related Functions * * These functions are only used if creating a syntax highlighter module. * ------------------------------------------------------------------ */ /** * Returns true if this module should be treated as a Syntax Highlighting module. It * returns false be default. * * @abstract * @return boolean */ function IsSyntaxHighlighter() { return false; } /** * Returns true if this SyntaxHighlighter should be considered active, eventhough it's * not the choice of the user. Used for forcing a wysiwyg. * returns false be default. * * @abstract * @return boolean */ function SyntaxActive() { return $this->syntaxactive; } /** * Returns content destined for the , but * could be extended later on down the road. It's here mainly for consistency. * * @final * @return string */ function CreateFieldsetEnd() { return ''."\n"; } /** * Returns the start of a module form, optimized for frontend use * * @param string The id given to the module on execution * @param string The id to eventually return to when the module is finished it's task * @param string The action that this form should do when the form is submitted * @param string Method to use for the form tag. Defaults to 'post' * @param string Optional enctype to use, Good for situations where files are being uploaded * @param boolean A flag to determine if actions should be handled inline (no moduleinterface.php -- only works for frontend) * @param string Text to append to the end of the id and name of the form * @param array Extra parameters to pass along when the form is submitted * @return string */ function CreateFrontendFormStart($id,$returnid,$action='default',$method='post', $enctype='',$inline=true,$idsuffix='',$params=array()) { return $this->CreateFormStart($id,$action,$returnid,$method,$enctype,$inline,$idsuffix,$params); } /** * Returns the start of a module form * * @param string The id given to the module on execution * @param string The action that this form should do when the form is submitted * @param string The id to eventually return to when the module is finished it's task * @param string Method to use for the form tag. Defaults to 'post' * @param string Optional enctype to use, Good for situations where files are being uploaded * @param boolean A flag to determine if actions should be handled inline (no moduleinterface.php -- only works for frontend) * @param string Text to append to the end of the id and name of the form * @param array Extra parameters to pass along when the form is submitted * @param string Text to append to the , but * could be extended later on down the road. It's here mainly for consistency. * * @return string */ function CreateFormEnd() { return ''."\n"; } /** * Returns the xhtml equivalent of an input textbox. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's xhtml compliant. * * @param string The id given to the module on execution * @param string The html name of the textbox * @param string The predefined value of the textbox, if any * @param string The number of columns wide the textbox should be displayed * @param string The maximum number of characters that should be allowed to be entered * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputText($id, $name, $value='', $size='10', $maxlength='255', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputText($this, $id, $name, $value, $size, $maxlength, $addttext); } /** * Returns the xhtml equivalent of an label for input field. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's xhtml compliant. * * @param string The id given to the module on execution * @param string The html name of the input field this label is associated to * @param string The text in the label * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateLabelForInput($id, $name, $labeltext='', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateLabelForInput($this, $id, $name, $labeltext, $addttext); } /** * Returns the xhtml equivalent of an input textbox with label. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's xhtml compliant. * * @param string The id given to the module on execution * @param string The html name of the textbox * @param string The predefined value of the textbox, if any * @param string The number of columns wide the textbox should be displayed * @param string The maximum number of characters that should be allowed to be entered * @param string Any additional text that should be added into the tag when rendered * @param string The text for label * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputTextWithLabel($id, $name, $value='', $size='10', $maxlength='255', $addttext='', $label='', $labeladdtext='') { $this->LoadFormMethods(); return cms_module_CreateInputTextWithLabel($this, $id, $name, $value, $size, $maxlength, $addttext, $label, $labeladdtext); } /** * Returns the html5 equivalent of an input of type color. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's html5 compliant. * * @param string The id given to the module on execution * @param string The html name of the input field * @param string The predefined value of the textbox, if any * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputColor($id, $name, $value='', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputColor($this, $id, $name, $value, $addttext); } /** * Returns the html5 equivalent of an input of type date. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's html5 compliant. * * @param string The id given to the module on execution * @param string The html name of the input field * @param string The predefined value of the textbox, if any * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputDate($id, $name, $value='', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputDate($this, $id, $name, $value, $addttext); } /** * Returns the html5 equivalent of an input of type datetime. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's html5 compliant. * * @param string The id given to the module on execution * @param string The html name of the input field * @param string The predefined value of the textbox, if any * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputDatetime($id, $name, $value='', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputDatetime($this, $id, $name, $value, $addttext); } /** * Returns the html5 equivalent of an input of type datetime-local. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's html5 compliant. * * @param string The id given to the module on execution * @param string The html name of the input field * @param string The predefined value of the textbox, if any * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputDatetimeLocal($id, $name, $value='', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputDatetimeLocal($this, $id, $name, $value, $addttext); } /** * Returns the html5 equivalent of an input of type month. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's html5 compliant. * * @param string The id given to the module on execution * @param string The html name of the input field * @param string The predefined value of the textbox, if any * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputMonth($id, $name, $value='', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputMonth($this, $id, $name, $value, $addttext); } /** * Returns the html5 equivalent of an input of type week. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's html5 compliant. * * @param string The id given to the module on execution * @param string The html name of the input field * @param string The predefined value of the textbox, if any * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputWeek($id, $name, $value='', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputWeek($this, $id, $name, $value, $addttext); } /** * Returns the html5 equivalent of an input of type time. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's html5 compliant. * * @param string The id given to the module on execution * @param string The html name of the input field * @param string The predefined value of the textbox, if any * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputTime($id, $name, $value='', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputTime($this, $id, $name, $value, $addttext); } /** * Returns the html5 equivalent of an input of type number. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's html5 compliant. * * @param string The id given to the module on execution * @param string The html name of the input field * @param string The predefined value of the textbox, if any * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputNumber($id, $name, $value='', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputNumber($this, $id, $name, $value, $addttext); } /** * Returns the html5 equivalent of an input of type range. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's html5 compliant. * * @param string The id given to the module on execution * @param string The html name of the input field * @param string The predefined value of the textbox, if any * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputRange($id, $name, $value='', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputRange($this, $id, $name, $value, $addttext); } /** * Returns the html5 equivalent of an input textbox of type email. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's html5 compliant. * * @param string The id given to the module on execution * @param string The html name of the textbox * @param string The predefined value of the textbox, if any * @param string The number of columns wide the textbox should be displayed * @param string The maximum number of characters that should be allowed to be entered * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputEmail($id, $name, $value='', $size='10', $maxlength='255', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputEmail($this, $id, $name, $value, $size, $maxlength, $addttext); } /** * Returns the html5 equivalent of an input textbox of type tel. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's html5 compliant. * * @param string The id given to the module on execution * @param string The html name of the textbox * @param string The predefined value of the textbox, if any * @param string The number of columns wide the textbox should be displayed * @param string The maximum number of characters that should be allowed to be entered * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputTel($id, $name, $value='', $size='10', $maxlength='255', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputTel($this, $id, $name, $value, $size, $maxlength, $addttext); } /** * Returns the html5 equivalent of an input of type search. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's html5 compliant. * * @param string The id given to the module on execution * @param string The html name of the textbox * @param string The predefined value of the textbox, if any * @param string The number of columns wide the textbox should be displayed * @param string The maximum number of characters that should be allowed to be entered * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputSearch($id, $name, $value='', $size='10', $maxlength='255', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputSearch($this, $id, $name, $value, $size, $maxlength, $addttext); } /** * Returns the html5 equivalent of an input of type url. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's xhtml compliant. * * @param string The id given to the module on execution * @param string The html name of the textbox * @param string The predefined value of the textbox, if any * @param string The number of columns wide the textbox should be displayed * @param string The maximum number of characters that should be allowed to be entered * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputUrl($id, $name, $value='', $size='10', $maxlength='255', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputUrl($this, $id, $name, $value, $size, $maxlength, $addttext); } /** * Returns the xhtml equivalent of a file-selector field. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's xhtml compliant. * * @param string The id given to the module on execution * @param string The html name of the textbox * @param string The MIME-type to be accepted, default is all * @param string The number of columns wide the textbox should be displayed * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputFile($id, $name, $accept='', $size='10',$addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputFile($this, $id, $name, $accept, $size, $addttext); } /** * Returns the xhtml equivalent of an input password-box. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's xhtml compliant. * * @param string The id given to the module on execution * @param string The html name of the textbox * @param string The predefined value of the textbox, if any * @param string The number of columns wide the textbox should be displayed * @param string The maximum number of characters that should be allowed to be entered * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputPassword($id, $name, $value='', $size='10', $maxlength='255', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputPassword($this, $id, $name, $value, $size, $maxlength, $addttext); } /** * Returns the xhtml equivalent of a hidden field. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's xhtml compliant. * * @param string The id given to the module on execution * @param string The html name of the hidden field * @param string The predefined value of the field, if any * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputHidden($id, $name, $value='', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputHidden($this, $id, $name, $value, $addttext); } /** * Returns the xhtml equivalent of a checkbox. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's xhtml compliant. * * @param string The id given to the module on execution * @param string The html name of the checkbox * @param string The value returned from the input if selected * @param string The current value. If equal to $value the checkbox is selected * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputCheckbox($id, $name, $value='', $selectedvalue='', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputCheckbox($this, $id, $name, $value, $selectedvalue, $addttext); } /** * Returns the xhtml equivalent of a submit button. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's xhtml compliant. * * @param string The id given to the module on execution * @param string The html name of the button * @param string The predefined value of the button, if any * @param string Any additional text that should be added into the tag when rendered * @param string Use an image instead of a regular button * @param string Optional text to display in a confirmation message. * @return string */ function CreateInputSubmit($id, $name, $value='', $addttext='', $image='', $confirmtext='') { $this->LoadFormMethods(); return cms_module_CreateInputSubmit($this, $id, $name, $value, $addttext, $image, $confirmtext); } /** * Returns the xhtml equivalent of a reset button. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's xhtml compliant. * * @param string The id given to the module on execution * @param string The html name of the button * @param string The predefined value of the button, if any * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputReset($id, $name, $value='Reset', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputReset($this, $id, $name, $value, $addttext); } /** * Returns the xhtml equivalent of a file upload input. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's xhtml compliant. * * @param string The id given to the module on execution * @param string The html name of the input * @param string Any additional text that should be added into the tag when rendered * @param integer The size of the text field associated with the file upload field. Some browsers may not respect this value. * @param integer The maximim length of the content of the text field associated with the file upload field. Some browsers may not respect this value. * @return string */ function CreateFileUploadInput($id, $name, $addttext='',$size='10', $maxlength='255') { $this->LoadFormMethods(); return cms_module_CreateFileUploadInput($this, $id, $name, $addttext, $size, $maxlength); } /** * Returns the xhtml equivalent of a dropdown list. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it is xhtml compliant. * * @param string The id given to the module on execution * @param string The html name of the dropdown list * @param string An array of items to put into the dropdown list... they should be $key=>$value pairs * @param string The default selected index of the dropdown list. Setting to -1 will result in the first choice being selected * @param string The default selected value of the dropdown list. Setting to '' will result in the first choice being selected * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputDropdown($id, $name, $items, $selectedindex=-1, $selectedvalue='', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputDropdown($this, $id, $name, $items, $selectedindex, $selectedvalue, $addttext); } /** * Returns the html5 equivalent input field with datalist options. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it's html5 compliant. * * @param string The id given to the module on execution * @param string The html name of the textbox * @param string The predefined value of the textbox, if any * @param string An array of items to put into the list... they should be $key=>$value pairs * @param string The number of columns wide the textbox should be displayed * @param string The maximum number of characters that should be allowed to be entered * @param string Any additional text that should be added into the tag when rendered * @return string */ function CreateInputDataList($id, $name, $value='', $items, $size='10', $maxlength='255', $addttext='') { $this->LoadFormMethods(); return cms_module_CreateInputDataList($this, $id, $name, $value, $items, $size, $maxlength, $addttext); } /** * Returns the xhtml equivalent of a multi-select list. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it is xhtml compliant. * * @param string The id given to the module on execution * @param string The html name of the select list * @param string An array of items to put into the list... they should be $key=>$value pairs * @param string An array of items in the list that should default to selected. * @param string The number of rows to be visible in the list (before scrolling). * @param string Any additional text that should be added into the tag when rendered * @param boolean indicates wether multiple selections are allowed (defaults to true) * @return string */ function CreateInputSelectList($id, $name, $items, $selecteditems=array(), $size=3, $addttext='', $multiple = true) { $this->LoadFormMethods(); return cms_module_CreateInputSelectList($this, $id, $name, $items, $selecteditems, $size, $addttext, $multiple); } /** * Returns the xhtml equivalent of a set of radio buttons. This is basically a nice little wrapper * to make sure that id's are placed in names and also that it is xhtml compliant. * * @param string The id given to the module on execution * @param string The html name of the radio group * @param string An array of items to create as radio buttons... they should be $key=>$value pairs * @param string The default selected index of the radio group. Setting to -1 will result in the first choice being selected * @param string Any additional text that should be added into the tag when rendered * @param string A delimiter to throw between each radio button, e.g., a