API Documentation
Table of Contents
Namespaces
Classes
Enums
Constants
- ACTIONGROUP_ADVANCED : mixed = 6
- ACTIONGROUP_COLLECTION : mixed = 2
- ACTIONGROUP_EDIT : mixed = 3
- ACTIONGROUP_RESEARCH : mixed = 5
- ACTIONGROUP_RESOURCE : mixed = 1
- ACTIONGROUP_SHARE : mixed = 4
- ACTIONS_EMAIL_MAX_AGE : mixed = 168
- API_NATIVE_WHITELIST : mixed = ['add_resource_to_collection', 'collection_add_...
- BLOCKED_STREAM_WRAPPERS : mixed = ['php', 'file']
- BRAND_GUIDELINES_CONTENT_TYPES : mixed = ['text' => 0, 'resource' => 1, 'colour' => 2, '...
- Types of content you can add to brand guideline pages
- BRAND_GUIDELINES_DB_COLS_CONTENT : mixed = columns_in('brand_guidelines_content', null, 'b...
- BRAND_GUIDELINES_DB_COLS_PAGES : mixed = columns_in('brand_guidelines_pages', null, 'bra...
- BRAND_GUIDELINES_URL_MANAGE_CONTENT : mixed = "{$GLOBALS['baseurl']}/plugins/brand_guidelines...
- COLLECTION_REQUEST : mixed = 2
- COLLECTION_TYPE_FEATURED : mixed = 3
- COLLECTION_TYPE_PUBLIC : mixed = 4
- COLLECTION_TYPE_REQUEST : mixed = 6
- COLLECTION_TYPE_SELECTION : mixed = 2
- COLLECTION_TYPE_SHARE_UPLOAD : mixed = 5
- COLLECTION_TYPE_STANDARD : mixed = 0
- COLLECTION_TYPE_UPLOAD : mixed = 1
- CONTRIBUTIONS_ICON : mixed = '<i aria-hidden="true" class="icon-user-round-p...
- DATE_RANGE_SEPARATOR : mixed = " / "
- DEFAULT_DOWNLOAD_FILENAME_FORMAT : mixed = 'RS%resource_%filename%size.%extension'
- DEPRECATED_STARSEARCH : mixed = 0
- DOWNLOAD_FILE_LIFETIME : mixed = 14
- EMU_SCRIPT_MODE_IMPORT : mixed = 100
- EMU_SCRIPT_MODE_SYNC : mixed = 1000
- EMU_SCRIPT_SYNC_LOCK : mixed = 'emu_sync_mode_lock'
- FACIAL_RECOGNITION_CROP_SIZE_PREFIX : mixed = '_facial_recognition_crop_'
- FACIAL_RECOGNITION_PREPARED_IMAGE_EXT : mixed = 'pgm'
- FIELD_SORT_METHODS : mixed = ['default' => 0, 'dot-notation' => 1]
- FIELD_TYPE_CATEGORY_TREE : mixed = 7
- FIELD_TYPE_CHECK_BOX_LIST : mixed = 2
- FIELD_TYPE_COLOUR_PREVIEW : mixed = 103
- FIELD_TYPE_DATE : mixed = 10
- FIELD_TYPE_DATE_AND_OPTIONAL_TIME : mixed = 4
- FIELD_TYPE_DATE_RANGE : mixed = 14
- FIELD_TYPE_DROP_DOWN_LIST : mixed = 3
- FIELD_TYPE_DYNAMIC_KEYWORDS_LIST : mixed = 9
- FIELD_TYPE_EXPIRY_DATE : mixed = 6
- FIELD_TYPE_NUMERIC : mixed = 101
- FIELD_TYPE_RADIO_BUTTONS : mixed = 12
- FIELD_TYPE_TEXT_BOX_FORMATTED_AND_TINYMCE : mixed = 8
- FIELD_TYPE_TEXT_BOX_LARGE_MULTI_LINE : mixed = 5
- FIELD_TYPE_TEXT_BOX_MULTI_LINE : mixed = 1
- FIELD_TYPE_TEXT_BOX_SINGLE_LINE : mixed = 0
- FIELD_TYPE_TEXT_RICH : mixed = 102
- FIELD_TYPE_WARNING_MESSAGE : mixed = 13
- FULLTEXT_SEARCH_PREFIX : mixed = '@FULL_TEXT'
- FULLTEXT_SEARCH_QUOTES_PLACEHOLDER : mixed = '[QUOTES]'
- ICON_CUBE : mixed = '<i class="icon-box" aria-hidden="true"></i>&nb...
- ICON_EDIT : mixed = '<i class="icon-pencil" aria-hidden="true"></i>...
- ICON_FOLDER : mixed = '<i class="icon-folder" aria-hidden="true"></i>...
- ICON_REMOVE : mixed = '<i class="icon-circle-minus" aria-hidden="true...
- IMAGE_BANKS_MAX_INSTANCE_COUNT : int = 100
- Defines the maximum number of instances a Provider with multi-instance support can have.
- INLINE_VIEWABLE_TYPES : mixed = ['pdf' => 'application/pdf', 'jpg' => 'image/jp...
- JOB_PRIORITY_COMPLETED : mixed = 9
- JOB_PRIORITY_IMMEDIATE : mixed = 0
- JOB_PRIORITY_SYSTEM : mixed = 2
- JOB_PRIORITY_USER : mixed = 1
- LIB_OPENSEADRAGON : mixed = '/lib/openseadragon'
- LINK_CARET : mixed = '<i aria-hidden="true" class="icon-chevron-righ...
- LINK_CARET_BACK : mixed = '<i aria-hidden="true" class="icon-chevron-left...
- LINK_CHEVRON_RIGHT : mixed = '<i aria-hidden="true" class="icon-chevron-righ...
- LINK_PLUS : mixed = '<i aria-hidden="true" class="icon-plus"></i>&n...
- LINK_PLUS_CIRCLE : mixed = '<i aria-hidden="true" class="icon-circle-plus"...
- LOG_CODE_ACCESS_CHANGED : mixed = 'a'
- LOG_CODE_ALTERNATIVE_CREATED : mixed = 'b'
- LOG_CODE_COLLECTION_ACCESS_CHANGED : mixed = 'A'
- LOG_CODE_COLLECTION_ADDED_RESOURCE : mixed = 'a'
- LOG_CODE_COLLECTION_ADDED_RESOURCE_COMMENT : mixed = 'm'
- LOG_CODE_COLLECTION_ADDED_RESOURCE_COPIED : mixed = 'c'
- LOG_CODE_COLLECTION_ADDED_RESOURCE_RATING : mixed = '*'
- LOG_CODE_COLLECTION_BATCH_TRANSFORMED : mixed = 'b'
- LOG_CODE_COLLECTION_COLLECTION_DOWNLOADED : mixed = 'Z'
- LOG_CODE_COLLECTION_DELETED_ALL_RESOURCES : mixed = 'D'
- LOG_CODE_COLLECTION_DELETED_COLLECTION : mixed = 'X'
- LOG_CODE_COLLECTION_DELETED_RESOURCE : mixed = 'd'
- LOG_CODE_COLLECTION_EDIT_UPLOAD_SHARE : mixed = 'EEU'
- LOG_CODE_COLLECTION_EMAILED_COLLECTION : mixed = 'E'
- LOG_CODE_COLLECTION_REMOVED_ALL_RESOURCES : mixed = 'R'
- LOG_CODE_COLLECTION_REMOVED_RESOURCE : mixed = 'r'
- LOG_CODE_COLLECTION_REORDER : mixed = 'O'
- LOG_CODE_COLLECTION_SHARED_COLLECTION : mixed = 'S'
- LOG_CODE_COLLECTION_SHARED_RESOURCE_WITH : mixed = 's'
- LOG_CODE_COLLECTION_SHARED_UPLOAD : mixed = 'SEU'
- LOG_CODE_COLLECTION_STOPPED_RESOURCE_ACCESS : mixed = 't'
- LOG_CODE_COLLECTION_STOPPED_SHARING_COLLECTION : mixed = 'T'
- LOG_CODE_COPIED : mixed = 'C'
- LOG_CODE_CREATED : mixed = 'c'
- LOG_CODE_CREATED_BY_CHANGED : mixed = 'o'
- LOG_CODE_DELETED : mixed = 'x'
- LOG_CODE_DELETED_ACCESS_KEY : mixed = 'XK'
- LOG_CODE_DELETED_ALTERNATIVE : mixed = 'y'
- LOG_CODE_DELETED_PERMANENTLY : mixed = 'xx'
- LOG_CODE_DISABLED : mixed = '-'
- LOG_CODE_DOWNLOADED : mixed = 'd'
- LOG_CODE_EDITED : mixed = 'e'
- LOG_CODE_EDITED_RESOURCE : mixed = 'EDT'
- LOG_CODE_EMAILED : mixed = 'E'
- LOG_CODE_ENABLED : mixed = '+'
- LOG_CODE_EXTERNAL_UPLOAD : mixed = 'EUP'
- LOG_CODE_FAILED_LOGIN_ATTEMPT : mixed = 'Xl'
- LOG_CODE_JOB_ADDED : mixed = 'J'
- LOG_CODE_JOB_COMPLETED : mixed = 'JC'
- LOG_CODE_JOB_DELETED : mixed = 'JD'
- LOG_CODE_LOCKED : mixed = 'X'
- LOG_CODE_LOGGED_IN : mixed = 'l'
- LOG_CODE_MULTI_EDITED : mixed = 'm'
- LOG_CODE_NODE_REVERT : mixed = 'N'
- LOG_CODE_REORDERED : mixed = 'R'
- LOG_CODE_REPLACED : mixed = 'f'
- LOG_CODE_REVERTED_REUPLOADED : mixed = 'r'
- LOG_CODE_SET_NO_FILE : mixed = 'NOFIL'
- LOG_CODE_STATICSYNC_FILE_MODIFIED : mixed = 'sf'
- LOG_CODE_STATUS_CHANGED : mixed = 's'
- LOG_CODE_SYSTEM : mixed = 'S'
- LOG_CODE_TRANSFORMED : mixed = 't'
- LOG_CODE_UNLOCKED : mixed = 'Y'
- LOG_CODE_UNSET_NO_FILE : mixed = 'FIL'
- LOG_CODE_UNSPECIFIED : mixed = 'U'
- LOG_CODE_UPLOADED : mixed = 'u'
- LOG_CODE_UPLOADED_PREVIEW : mixed = 'up'
- LOG_CODE_USER_OPT_IN : mixed = 'O'
- LOG_CODE_VIEWED : mixed = 'v'
- LUCIDE_EXTENSIONS : mixed = [ // Images 'png' => 'image', 'jpg' => 'image',...
- MANAGED_REQUEST : mixed = 1
- MIGRATION_FIELD_OPTIONS_DEPRECATED_PREFIX : mixed = '!deprecated'
- MIGRATION_FIELD_OPTIONS_DEPRECATED_PREFIX_CATEGORY_TREE : mixed = "-1,,!deprecated\n"
- MPLUS_FIELD_ID : mixed = '__id'
- MPLUS_LAST_IMPORT : mixed = 'last_museumplus_import'
- MPLUS_LAST_LOG_TRUNCATE : mixed = 'last_museumplus_log_truncate'
- MPLUS_LOCK : mixed = 'museumplus_import'
- NODE_NAME_STRING_SEPARATOR : mixed = '@@|@@'
- NODE_TOKEN_NOT : mixed = '!'
- NODE_TOKEN_OR : mixed = '|'
- NODE_TOKEN_PREFIX : mixed = '@@'
- NON_FIXED_LIST_SINGULAR_RESOURCE_VALUE_FIELD_TYPES : mixed = \array_merge($TEXT_FIELD_TYPES, \array_diff($DA...
- NON_PREVIEW_EXTENSIONS : mixed = ['zip', 'fla']
- PHP_VERSION_ID : mixed = $version[0] * 10000 + $version[1] * 100 + $vers...
- PHP_VERSION_SUPPORTED : mixed = 80200
- REPORT_PLACEHOLDER_NON_CORRELATED_SQL : mixed = '[non_correlated_sql]'
- RESOURCE_ACCESS_CONFIDENTIAL : mixed = 2
- RESOURCE_ACCESS_CUSTOM_GROUP : mixed = 3
- RESOURCE_ACCESS_FULL : mixed = 0
- RESOURCE_ACCESS_INVALID_REQUEST : mixed = 99
- RESOURCE_ACCESS_RESTRICTED : mixed = 1
- RESOURCE_ACCESS_TYPES : mixed = [\RESOURCE_ACCESS_FULL, \RESOURCE_ACCESS_RESTRI...
- RESOURCE_LOG_APPEND_PREVIOUS : mixed = -1
- RESOURCE_PREVIEWS_ALL : mixed = 1
- RESOURCE_PREVIEWS_MINIMAL : mixed = 2
- RESOURCE_PREVIEWS_NONE : mixed = 0
- RESOURCESPACE_BASE_PATH : mixed = \dirname(__DIR__)
- RS_FILTER_ALL : mixed = 1
- RS_FILTER_ANY : mixed = 3
- RS_FILTER_NODE_IN : mixed = 1
- RS_FILTER_NODE_NOT_IN : mixed = 0
- RS_FILTER_NONE : mixed = 2
- RS_SYSTEM_UTILITIES : mixed = ['im-convert' => ['required' => \true, 'path_va...
- SENSITIVE_VARIABLE_NAMES : mixed = [ 'mysql_server', 'mysql_username', 'mysql_pass...
- SEVERITY_CRITICAL : mixed = 0
- SEVERITY_NOTICE : mixed = 2
- SEVERITY_WARNING : mixed = 1
- STATUS_ACTIVE : mixed = 1
- STATUS_COMPLETE : mixed = 2
- STATUS_DISABLED : mixed = 0
- STATUS_ERROR : mixed = 5
- STATUS_INPROGRESS : mixed = 3
- SUBMITTED_COLLECTION : mixed = 5
- SUBMITTED_RESOURCE : mixed = 4
- SYSTEM_DATABASE_IDS_CHUNK_SIZE : mixed = 500
- SYSTEM_DATABASE_MAX_RETRIES : mixed = 2
- SYSTEM_DOWNLOAD_CONFIG_FORCE_OBFUSCATION : mixed = \true
- SYSTEM_MAX_PREVIEW_ATTEMPTS : mixed = 5
- SYSTEM_REQUIRED_PHP_MODULES : mixed = ['curl' => 'curl_init', 'gd' => 'imagecrop', 'x...
- SYSTEM_UPGRADE_LEVEL : mixed = 30
- TAG_EDITOR_DELIMITER : mixed = '~'
- THEME_IMAGES_NUMBER : mixed = 3
- THIS_PROCESS_LOCK : mixed = 'watchedsearchescron'
- TINYMCE_VALID_PLUGINS : mixed = ['autolink' => 'Autolink', 'autoresize' => 'Aut...
- TMS_LINK_MODULES_MIGRATED : mixed = 'tms_link_modules_migrated'
- UNREGISTER_WRAPPERS : mixed = ['ftp', 'ftps', 'phar']
- UPLOAD_ICON : mixed = '<i aria-hidden="true" class="icon-upload"></i>...
- USER_REQUEST : mixed = 3
- VIEW_IN_BROWSER_EXTENSIONS : mixed = ['pdf', 'mp3']
- WORKFLOW_DEFAULT_ICON : mixed = "workflow"
- WORKFLOW_DEFAULT_ICONS : mixed = ['-2' => 'clock-arrow-up', '-1' => 'clock-fadin...
Functions
- get_user_actions() : mixed
- Retrieve a list of user actions for the My Actions area.
- get_editable_resource_sql() : mixed
- Return an SQL statement to find all editable resources in $actions_notify_states.
- get_user_actions_recent() : array<string|int, mixed>
- Get recent user actions, optionally for all users. For use by action notifications cron job.
- actions_filter_by_user() : array<string|int, mixed>
- Filter actions in the provided array to return only those applicable to the given user
- ajax_permission_denied() : void
- Returns a standard AJAX response for unauthorised access
- ajax_send_response() : void
- Send AJAX response back to the client together with the appropriate HTTP status code
- ajax_send_text_response() : void
- Send AJAX text/html response back to the client together with the appropriate HTTP status code
- ajax_response_ok() : array<string|int, mixed>
- Builds the correct response expected for a success request where there is data to return (e.g getting search results)
- ajax_response_fail() : array<string|int, mixed>
- Builds the correct response expected for failures.
- ajax_response_ok_no_data() : array<string|int, mixed>
- Builds the correct response expected for a success request where there is no data to return (e.g when deleting a record)
- ajax_unauthorized() : void
- Returns a standard AJAX response for unauthorised access with a 401 HTTP status code
- ajax_build_message() : array<string|int, mixed>
- Builds a message to be used in an AJAX response
- get_annotate_fields() : array<string|int, mixed>
- Get (viewable) "annotate_fields" config. The configs' value is validated (e.g. view access, supported type, active RTF, excluded RT, etc.).
- get_all_viable_annotate_metadata_fields() : array<string|int, mixed>
- Get all metadata fields which could be used for the annotate feature. Removes inapplicable fields when excluding specific resource types.
- getAnnotation() : array<string|int, mixed>
- Get annotation by ID
- getAnnotations() : array<string|int, mixed>
- General annotations search functionality
- getResourceAnnotationsCount() : int
- Get number of annotations available for a resource.
- getResourceAnnotations() : array<string|int, mixed>
- Get annotations for a specific resource
- getAnnotoriousResourceAnnotations() : array<string|int, mixed>
- Create an array of Annotorious annotation objects which can be JSON encoded and passed directly to Annotorious
- annotationEditable() : bool
- Check if an annotation can be editable (add/ edit + remove) by the user. Please note that Annotorious JS library is treating edit & remove as the same under the "editable" property.
- getAnnotationTags() : array<string|int, mixed>
- Get all tags of an annotation. Checks if a tag is attached to the resource, allowing the user to search by it which is represented by the virtual column "tag_searchable"
- deleteAnnotation() : bool
- Delete annotation
- createAnnotation() : bool|int
- Create new annotations based on Annotorious annotation
- updateAnnotation() : bool
- Update (field bound) annotation and its tags, if applicable.
- addAnnotationNodes() : bool
- Add relations between annotation and nodes
- prepareTags() : array<string|int, mixed>
- Utility function which allows annotation tags to be prepared (i.e make sure they are all valid nodes) before creating associations between annotations and tags
- search_add_annotation_count() : mixed
- Add annotation count to a search result set
- get_annotorious_lang() : array<string|int, mixed>
- Get all translations relevant to the Annotorious (RSTagging) plugin.
- get_annotorious_resourcespace_config() : array<string|int, mixed>
- Get all ResourceSpace config options relevant for the Annotorious (RSTagging) plugin functionality.
- get_valid_annotate_field_types() : array<string|int, mixed>
- Get list of allowed field types to be configured for the "annotate_fields" option
- get_annotate_file_path() : string
- Get annotate file path (old annotate plugin logic)
- create_annotated_pdf() : mixed
- Create annotations PDF (old annotate plugin logic)
- annotation_pdf_class() : mixed
- Utility function to generate a one-off TCPDF variant (with multiRow method)
- resource_can_be_annotated() : bool
- Check if a resource can be annotated
- resource_type_applicable_for_annotations() : bool
- Check if a given resource type is applicable for annotations
- api_do_search() : mixed
- api_search_get_previews() : mixed
- api_get_resource_field_data() : mixed
- api_create_resource() : mixed
- api_update_field() : mixed
- Provides simple way to update field by passing in simple string values for text fields, comma separated values for fixed list (node) fields, using double quotes to enclose strings and backslash as escape character Uses update_field and add_resource_nodes/delete_resource_nodes
- api_delete_resource() : mixed
- api_copy_resource() : mixed
- api_get_resource_log() : mixed
- api_update_resource_type() : mixed
- api_get_resource_path() : mixed
- {@see get_resource_path()}
- api_get_resource_data() : mixed
- api_put_resource_data() : mixed
- api_get_alternative_files() : mixed
- api_get_resource_types() : mixed
- api_add_alternative_file() : mixed
- api_delete_access_keys() : mixed
- api_delete_alternative_file() : mixed
- api_upload_file() : mixed
- api_upload_file_by_url() : mixed
- api_get_related_resources() : mixed
- api_get_field_options() : mixed
- api_get_nodes() : mixed
- api_get_user_collections() : mixed
- api_add_resource_to_collection() : mixed
- api_collection_add_resources() : mixed
- api_remove_resource_from_collection() : mixed
- api_collection_remove_resources() : mixed
- api_create_collection() : mixed
- api_delete_collection() : mixed
- api_search_public_collections() : mixed
- api_set_node() : mixed
- api_add_resource_nodes() : mixed
- api_add_resource_nodes_multi() : mixed
- api_resource_log_last_rows() : mixed
- api_get_resource_all_image_sizes() : mixed
- api_get_node_id() : mixed
- api_replace_resource_file() : mixed
- api_get_data_by_field() : bool|array<string|int, mixed>
- API binding to get_data_by_field function.
- api_get_resource_collections() : bool|array<string|int, mixed>
- API binding to modified get_resource_collections function, as we only want to pass collection ID, name, and description for security purposes.
- api_update_related_resource() : mixed
- api_get_collections_resource_count() : mixed
- api_get_users() : mixed
- api_save_collection() : mixed
- api_get_collection() : mixed
- api_send_user_message() : mixed
- api_get_profile_image() : mixed
- api_get_system_status() : mixed
- api_relate_all_resources() : mixed
- api_show_hide_collection() : mixed
- api_send_collection_to_admin() : mixed
- api_reorder_featured_collections() : mixed
- api_get_dash_search_data() : mixed
- api_reorder_tabs() : mixed
- api_delete_tabs() : mixed
- api_save_tab() : mixed
- api_mark_email_as_invalid() : mixed
- api_get_user_message() : mixed
- api_get_users_by_permission() : mixed
- api_upload_multipart() : array<string|int, mixed>
- Upload files using HTTP multipart.
- api_get_resource_type_fields() : array<string|int, mixed>
- Get metadata field information for all (matching) fields.
- api_create_resource_type_field() : array<string|int, mixed>
- Create metadata field
- api_get_featured_collections() : array<string|int, mixed>
- Expose {@see get_featured_collections} to the API
- api_get_edit_access() : bool
- api_toggle_active_state_for_nodes() : array<string|int, mixed>
- Toggle active state for nodes
- api_get_processing_message() : false|array<string|int, mixed>
- Expose {@see get_processing_message} to the API
- api_checkperm() : bool
- Expose {@see checkperm} to the API
- api_get_resource_access() : false|int
- Expose {@see get_resource_access} to the API
- api_resource_file_readonly() : array<string|int, mixed>
- Exposing {@see resource_file_readonly} to the API
- api_delete_resources_in_collection() : bool
- Exposing {@see delete_resources_in_collection} to the API
- api_new_user() : array<string|int, mixed>
- Exposing {@see new_user} to the API
- api_save_user() : array<string|int, mixed>
- Exposing {@see save_user} to the API
- api_get_resource_comments() : array<string|int, mixed>
- Make resource comments available to the API.
- api_delete_comment() : bool
- Allow comment to be deleted via the API.
- api_get_reports() : array<string|int, mixed>
- Return a list of reports using the API.
- api_do_report() : array<string|int, mixed>|bool
- Run report via the API.
- get_api_key() : string|false
- Return a private scramble key for this user.
- check_api_key() : bool
- Check a query is signed correctly.
- execute_api_call() : bool|string
- Execute the specified API function.
- get_session_api_key() : string
- Return the session specific key for the given user.
- api_login() : string|false
- API login function
- api_validate_upload_url() : bool
- Validate URL supplied in APIs create resource or upload by URL. Requires the URL hostname to be added in config $api_upload_urls
- assert_post_request() : array<string|int, mixed>
- Assert API request is using POST method.
- assert_content_type() : array<string|int, mixed>
- Assert API sent the expected content type.
- api_get_daily_stat_summary() : mixed
- Return a summary of daily statistics
- get_user_collections() : array<string|int, mixed>
- Return all collections belonging to or shared with $user
- get_collection() : array<string|int, mixed>|bool
- Returns all data for collection $ref.
- get_collection_resources() : array<string|int, mixed>|bool
- Returns all resources in collection
- get_collection_resources_with_data() : array<string|int, mixed>
- Get all resources in a collection without checking permissions or filtering by workflow states.
- add_resource_to_collection() : bool|string
- Add resource $resource to collection $collection
- remove_resource_from_collection() : bool|string
- Remove resource $resource from collection $collection
- collection_add_resources() : bool|string
- Add resource(s) $resources to collection $collection
- collection_remove_resources() : bool|string
- collection_remove_resources
- collection_writeable() : bool
- Is the collection $collection writable by the current user? Returns true if the current user has write access to the given collection.
- collection_readable() : bool
- Returns true if the current user has read access to the given collection.
- set_user_collection() : void
- Sets the current collection of $user to be $collection
- create_collection() : int
- Creates a new collection for user $userid called $name
- delete_collection() : bool|void
- Deletes the collection with reference $ref
- refresh_collection_frame() : void
- Adds script to page that refreshes the Collection bar
- search_public_collections() : array<string|int, mixed>
- Performs a search for featured collections / public collections.
- do_collections_search() : array<string|int, mixed>
- Search within available collections
- add_collection() : bool
- Add a collection to a user's 'My Collections'
- remove_collection() : mixed
- Remove someone else's collection from a user's My Collections
- index_collection() : int
- Update the keywords index for this collection
- save_collection() : false|void
- Process the save action when saving a collection
- collections_comparator() : mixed
- Case insensitive string comparisons using a "natural order" algorithm for collection names
- collections_comparator_desc() : mixed
- Case insensitive string comparisons using a "natural order" algorithm for collection names
- get_smart_theme_headers() : array<string|int, mixed>
- Returns a list of smart theme headers, which are basically fields with a 'smart theme name' set.
- get_smart_themes_nodes() : array<string|int, mixed>
- get_smart_themes_nodes
- email_collection() : string
- E-mail a collection to users
- generate_collection_access_key() : string
- Generate an external access key to allow external people to view the resources in this collection.
- get_saved_searches() : array<string|int, mixed>
- Returns all saved searches in a collection
- add_saved_search() : void
- Add a saved search to a collection
- remove_saved_search() : void
- Remove a saved search from a collection
- add_smart_collection() : void
- Greate a new smart collection using submitted values
- get_search_title() : string
- Get a display friendly name for the given search string Takes a full searchstring of the form 'search=restypes=archive=' and uses search_title_processing to autocreate a more informative title
- add_saved_search_items() : bool
- Adds all the resources in the provided search to $collection
- allow_multi_edit() : bool
- Returns true or false, can all resources in this collection be edited by the user?
- get_featured_collection_resources() : array<string|int, mixed>
- Get featured collection resources (including from child nodes). For normal FCs this is using the collection_resource table.
- get_featured_collection_categ_sub_fcs() : array<string|int, mixed>
- Get a list of featured collections based on a higher level featured collection category. This returns all direct/indirect collections under that category.
- generate_featured_collection_image_urls() : array<string|int, mixed>
- Get preview URLs for a list of resource IDs
- swap_collection_order() : void
- Inserts $resource1 into the position currently occupied by $resource2
- update_collection_order() : void
- Reorder the items in a collection using $neworder as the order by metric
- get_collection_resource_comment() : array<string|int, mixed>|bool
- Return comments and other columns stored in the collection_resource join.
- save_collection_resource_comment() : bool
- Save a comment and/or rating for the instance of a resource in a collection.
- relate_to_collection() : void
- Relates every resource in $collection to $ref
- get_collection_comments() : array<string|int, mixed>
- Fetch all the comments for a given collection.
- send_collection_feedback() : array<string|int, mixed>|void
- Sends the feedback to the owner of the collection
- copy_collection() : void
- Copy a collection contents
- collection_is_research_request() : bool
- Returns true if a collection is a research request
- add_to_collection_link() : string
- Generates a HTML link for adding a resource to a collection
- remove_from_collection_link() : string
- Render a "remove from collection" link wherever such a function is shown in the UI
- change_collection_link() : string
- Generates a HTML link for adding a changing the current collection
- get_collection_external_access() : array<string|int, mixed>
- Return all external access given to a collection.
- delete_collection_access_key() : void
- Delete a specific collection access key, withdrawing access via that key to the collection in question
- collection_log() : void
- Add a new row to the collection log (e.g. after an action on that collection)
- get_collection_log() : array<string|int, mixed>
- Return the log for $collection
- collection_max_access() : int
- Returns the maximum access (the most permissive) that the current user has to the resources in $collection.
- collection_min_access() : int
- Returns the minimum access (the least permissive) that the current user has to the resources in $collection.
- collection_set_public() : bool
- Set an existing collection to be public
- remove_all_resources_from_collection() : void
- Remove all resources from a collection
- get_home_page_promoted_collections() : array<string|int, mixed>
- Retrieve promoted collections to be displayed on the home page.
- is_collection_approved() : array<string|int, mixed>
- Return an array of distinct archive/workflow states for resources in $collection
- edit_collection_external_access() : bool
- Update an existing external access share
- show_hide_collection() : bool
- Hide or show a collection from the My Collections area.
- get_session_collections() : array<string|int, mixed>
- Get an array of collection IDs for the specified ResourceSpace session and user
- update_collection_user() : bool
- Update collection to belong to a new user
- compile_collection_actions() : array<string|int, mixed>
- Helper function for render_actions(). Compiles actions that are normally valid for collections
- makeFilenameUnique() : string
- Make a filename unique by appending a dupe-string.
- new_featured_collection_form() : void
- Render the new featured collection form
- GetThemesFromRequest() : array<string|int, mixed>
- Get a themes array
- collection_download_use_original_filenames_when_downloading() : void
- collection_download_process_text_file() : string
- Provide resource data/collection_resource data to add to text file during a collection download.
- collection_download_log_resource_ready() : void
- Update the resource log to show the download during a collection download.
- collection_download_process_data_only_types() : void
- Add PDFs for "data only" types to a zip file during creation.
- collection_download_process_summary_notes() : mixed
- collection_download_process_csv_metadata_file() : void
- Add a CSV containing resource metadata to a downloaded zip file during creation of the zip.
- collection_download_process_collection_download_name() : void
- Modifies the filename for downloading as part of the specified collection
- collection_download_process_archive_command() : bool
- Executes the archiver command when downloading a collection.
- collection_download_clean_temp_files() : void
- Remove temporary files created during download by exiftool for adding metadata.
- collection_cleanup_inaccessible_resources() : void
- Delete any resources from collection moved out of users archive status permissions by other users
- relate_all_collection() : bool
- Relate all resources in a collection
- unrelate_all_collection() : bool
- Un-relate all resources in a collection
- update_collection_type() : bool
- Update collection type for one collection or batch
- update_collection_parent() : bool
- Update collection parent for this collection
- get_user_selection_collection() : null|int
- Get a users' collection of type SELECTION.
- delete_old_collections() : int
- Delete all collections that are not in use e.g. session collections for the anonymous user. Will not affect collections that are public.
- get_all_featured_collections() : array<string|int, mixed>
- Get all featured collections
- get_featured_collections() : array<string|int, mixed>
- Get all featured collections by parent node
- featured_collections_permissions_filter_sql() : array<string|int, mixed>|string
- Build appropriate SQL (for WHERE clause) to filter out featured collections for the user. The function will use either an IN or NOT IN depending which list is smaller to increase performance of the search
- featured_collection_check_access_control() : bool
- Access control function used to determine if a featured collection should be accessed by the user
- order_featured_collections() : Return
- Helper comparison function for ordering featured collections. It sorts using the order_by property, then based if the collection is a category (using the "has_resource" property), then by name (this takes into account the legacy use of '*' as a prefix to move to the start).
- get_featured_collection_categories() : array<string|int, mixed>
- Get featured collection categories
- is_featured_collection_category() : bool
- Check if a collection is a featured collection category
- is_featured_collection_category_by_children() : bool
- Check if a collection is a featured collection category by checking if the collection has been used as a parent. This function will make a DB query to find this out, it does not use existing structures.
- validate_collection_parent() : null|int
- Validate a collection parent value
- get_featured_collection_category_branch_by_leaf() : array<string|int, mixed>
- Get to the root of the branch starting from the leaf featured collection
- process_posted_featured_collection_categories() : array<string|int, mixed>
- Process POSTed featured collections categories data for a collection
- get_featured_collection_ref_by_name() : null|int
- Find existing featured collection ref using its name and parent
- move_featured_collection_branch_path_root() : array<string|int, mixed>
- Move a featured collection branch paths' root to the node determined by the global configuration option $featured_collections_root_collection.
- allow_collection_share() : bool
- Check if user is allowed to share collection
- allow_featured_collection_share() : bool
- Check if user is allowed to share featured collection. If the featured collection provided is a category, then this function will return FALSE if at least one sub featured collection has no share access (this is kept consistent with the check for normal collections when checking resources).
- filter_featured_collections_by_root() : array<string|int, mixed>
- Filter out featured collections that have a different root path. The function builds internally the path to the root from the provided featured collection ref and then filters out any featured collections that have a different root path.
- get_featured_collections_by_resources() : array<string|int, mixed>
- Get all featured collections branches where the specified resources can be found.
- can_delete_featured_collection() : bool
- Verify if a featured collection can be deleted. To be deleted, it MUST not have any resources or children (if category).
- strip_prefix_chars() : string
- Remove all instances of the specified character from start of string
- allow_upload_to_collection() : bool
- Check access control if user is allowed to upload to a collection.
- compute_featured_collections_access_control() : bool|array<string|int, mixed>
- Compute the featured collections allowed based on current access control
- can_reorder_featured_collections() : bool
- Check if user is allowed to re-order featured collections
- can_edit_featured_collection_category() : bool
- Check if user is authorised to edit a featured collection category
- cleanup_anonymous_collections() : void
- Remove all old anonymous collections
- can_share_upload_link() : bool
- Check if user is permitted to create an external upload link for the given collection
- can_edit_upload_share() : bool
- Check if user can edit an existing upload share
- create_upload_link() : string
- Creates an upload link for a collection that can be shared
- generate_share_key() : string
- Generates an external share key based on provided string
- upload_share_active() : mixed
- Check if an external upload link is being used
- upload_share_setup() : void
- Set up external upload share
- external_upload_notify() : void
- Notify the creator of an external upload share that resources have been uploaded
- purge_expired_shares() : string|int
- Purge all expired shares/**
- can_delete_collection() : bool
- Check if user has the appropriate access to delete a collection.
- send_collection_to_admin() : bool
- Send collection to administrators - used if $send_collection_to_admin is enabled
- get_default_user_collection() : int
- Get the user's default collection, creating one if necessary
- update_smart_collection() : void
- Update a smart collection with or without the $smart_collections_async option.
- check_upload_terms() : bool
- Check if the terms have been accepted for the given upload Terms only need to be accepted when uploading through an upload share link If uploading through an upload share link then the accepted terms have been stored in $_COOKIE["acceptedterms"]
- can_create_collections() : bool
- Determines whether the current user has permission to create collections.
- can_view_collection_log() : bool
- Determines whether the current user has permission to view the collection log.
- reorder_all_featured_collections_with_parent() : array<string|int, mixed>
- Re-order all featured collections at a particular tree depth.
- process_collection_download() : array<string|int, mixed>
- Generate a collection download ZIP file and the download filename
- comments_submit() : void
- Write comments to the database, also deals with hiding and flagging comments
- clean_comment_tree() : int
- Check all comments that are children of the comment ref provided. If there is a branch made up entirely of hidden comments then remove the branch.
- find_root_comment() : int|null
- Find the root of a comment tree that the ref provided is a part of
- comments_tags_to_links() : string
- Parse a comment and replace and add links to any user, resource and collection tags
- comments_show() : void
- Display all comments for a resource or collection
- comments_notify_tagged() : void
- Notify anyone tagged when a new comment is posted
- get_comments_by_ref() : array<string|int, mixed>
- Return comments for a resource or collection. There are two options for the output: 1. A flat list of comments ordered by creation date, newest first. Config $comments_flat_view = true 2. A tree view of comments, top level ordered most recent first with lower levels also most recent first while respecting a hierarchy of nested comments. Config $comments_flat_view = false (default) User permissions are also checked to ensure users can view comments. $comments_responses_max_level limits the number of levels returned in the comments tree (only applies when $comments_flat_view = false).
- hide_delete_comment() : bool
- Hide or delete a comment or annotation. Comments will be hidden where they have comments below them.
- render_select_option() : string
- Renders a select element.
- render_bool_option() : string
- Render a yes/no field with the given fieldname.
- render_text_option() : string
- Renders a text field for a given field name.
- set_config_option() : bool
- Save/ Update config option for user preference or system config. For user group config see set_usergroup_config_option().
- set_usergroup_config_option() : bool
- Save or update config option for user group.
- delete_config_option() : bool
- Delete entry from the user_preferences table completely (instead of setting to blank via set_config_option).
- remove_config_option() : bool
- Remove system/user preferences
- get_config_option() : bool
- Get config option value from the database. This may be a system wide config, a user group preference, a user preference, or the result of overriding a user group preference with a user preference if any are present.
- get_config_option_users() : array<string|int, mixed>
- Get all user refs with a specific configuration option set from database
- get_config_options() : bool
- Get config option from database for a specific user, system wide or user group.
- get_usergroup_parent_for_inherit_flag() : int
- Check if the usergroup has a parent and the specified inherit flag is in use e.g. user group inherits permissions from parent.
- process_config_options() : void
- Process configuration options from database either system wide, user group or user specific, setting the global variable.
- config_clean() : a
- Utility function to "clean" the passed $config. Cleaning consists of two parts: * Suppressing really simple XSS attacks by refusing to allow strings containing the characters "<script" in upper, lower or mixed case.
- config_html() : mixed
- Generate arbitrary html
- config_add_html() : mixed
- Return a data structure that will instruct the configuration page generator functions to add arbitrary HTML
- config_text_input() : mixed
- Generate an html text entry or password block
- config_integer_input() : void
- Generate an HTML form element for input of integer only values. Field will include validation for supplied value being of type int and between supplied min and max values.
- config_add_text_input() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a text entry configuration variable to the setup page.
- config_add_integer_input() : mixed
- config_add_hidden_input() : array<string|int, mixed>
- Generate a data structure to instruct the configuration page generator to add a hidden input
- config_file_input() : mixed
- Generate an HTML input file with its own form
- config_add_file_input() : mixed
- Return a data structure that will be used to generate the HTML for uploading a file
- config_single_select() : mixed
- Generate an html single-select + options block
- config_add_single_select() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a single select configuration variable to the setup page.
- config_boolean_select() : mixed
- Generate an html boolean select block
- config_add_boolean_select() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a boolean configuration variable to the setup page.
- config_checkbox_select() : mixed
- Generate an html checkbox options block
- config_add_checkbox_select() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a multi select configuration variable to the setup page.
- config_add_colouroverride_input() : mixed
- config_add_single_ftype_select() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a single RS field-type select configuration variable to the setup page.
- config_single_ftype_select() : mixed
- Generate an html single-select + options block for selecting one of the RS field types. The selected field type is posted as the value of the "ref" column of the selected field type.
- config_generate_AutoSaveConfigOption_function() : mixed
- Generate Javascript function used for auto saving individual config options
- config_process_file_input() : mixed
- config_generate_html() : mixed
- Generates HTML foreach element found in the page definition
- config_merge_non_image_types() : array<string|int, mixed>
- Merge all non image configurations
- get_header_image() : string
- Retrieves the header image URL based on the user's appearance preference and system configuration.
- config_register_core_fieldvars() : void
- Used to block deletion of 'core' fields. Any variable added to the $corefields array will be checked before a field is deleted and if the field is referenced by one of these core variables the deletion will be blocked
- config_register_core_field_refs() : mixed
- Used to block deletion of 'core' fields.
- override_rs_variables_by_eval() : void
- Run PHP code on array of variables. Used for modifying $GLOBALS.
- update_resource_type_field_resource_types() : void
- Update the resource_type_field - resource_type mappings
- get_resource_type_field_resource_types() : array<string|int, mixed>
- Get all resource_type->resource-type_field associations
- create_resource_type() : int|bool
- Create a new resource type with the specified name
- save_resource_type() : bool
- Save updated resource_type data
- clear_restype_cache() : void
- Force clear of restype_cache after editing resource type where get_resource_types() needs to pick up the new value.
- rs_get_resource_type() : array<string|int, mixed>
- Get resource_type data
- save_resource_type_field() : bool
- Save resource type field - used on pages/admin/admin_resource_type_field_edit.php
- get_resource_type_field_columns() : array<string|int, mixed>
- Get the definitions for resource_type_field columns, including properties and display configurations.
- is_valid_contact_sheet_preview_size() : bool
- Input validation helper function to determine if the $contact_sheet_preview_size config is valid.
- save_removed_ui_config() : bool
- Store a config option that has been removed from the UI so that it will still work until it has been set in config file
- check_removed_ui_config() : bool
- Check if there is a previously stored value for the given config option.
- config_add_fixed_input() : array<string|int, mixed>
- Return a data structure that will instruct the configuration page generator functions to add a fixed input setting to the setup page. Uses render_fixed_text_question(). Useful for options removed from the UI
- render_config_filter_by_search() : void
- Add config option search to user preferences / system configuration page.
- config_filter_by_search() : array<string|int, mixed>
- Process values from config search fields, see render_config_filter_by_search() Filter $page_def elements to show only those searched for.
- config_remove_user_preferences() : void
- Remove user preferences by resetting to system preferences. Used to display system config or user group config without the current user's preferences changing the values.
- config_percent_range() : mixed
- Generate a percentage range input
- config_add_percent_range() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a text entry configuration variable to the setup page.
- config_check_valid_option() : bool
- Server side validation for saving values submitted using the page generation functions "config_add_...()" and created with config_generate_html(). For example, the system configuration page.
- generateResourcesMetadataCSV() : bool|void
- Generates the CSV content of the metadata for resources passed in the array The CSV is echoed to output for direct download or saved to a file
- generateNodesExport() : mixed
- Generates the file content when exporting nodes
- existing_dash_tile() : int
- returns a ref for an existing dash tile in dash_tile table, returns 0 if no existing dash tile
- create_dash_tile() : mixed
- update_dash_tile() : mixed
- delete_dash_tile() : mixed
- revoke_all_users_flag_cascade_delete() : mixed
- append_default_position() : mixed
- reorder_default_dash() : mixed
- update_default_dash_tile_order() : mixed
- get_tile() : mixed
- all_user_dash_tile_active() : mixed
- existing_tile() : mixed
- cleanup_dash_tiles() : mixed
- checkTileConfig() : mixed
- checkConfigCustomHomePanels() : mixed
- get_alluser_available_tiles() : mixed
- get_default_dash() : mixed
- get_managed_dash() : mixed
- add_usergroup_dash_tile() : mixed
- append_usergroup_position() : mixed
- reorder_usergroup_dash() : void
- Reorder dashboard tiles for a specific user group.
- update_usergroup_dash_tile_order() : void
- Update the display order of a specific dashboard tile for a user group.
- build_usergroup_dash() : void
- build_usergroup_dash - rebuild the usergroup tiles for either a specific user or all users.
- get_tile_user_groups() : array<string|int, mixed>
- Retrieve user group IDs associated with a specific dashboard tile.
- get_usergroup_available_tiles() : array<string|int, mixed>
- Retrieve dashboard tiles available to a specific user group.
- get_usergroup_tile() : array<string|int, mixed>
- Get usergroup_dash_tile record
- add_user_dash_tile() : mixed
- get_user_tile() : mixed
- create_new_user_dash() : mixed
- update_user_dash_tile_order() : mixed
- delete_user_dash_tile() : mixed
- empty_user_dash() : mixed
- reorder_user_dash() : mixed
- append_user_position() : mixed
- get_user_available_tiles() : mixed
- get_user_dash() : mixed
- render_delete_dialog_JS() : void
- Render JavaScript for the dashboard tile delete dialog.
- parse_dashtile_link() : mixed
- build_dash_tile_list() : mixed
- delete_usergroup_dash_tile() : mixed
- allowPromotedResources() : bool
- Confirms whether a dash tile type allows for promoted resources
- render_upgrade_available_tile() : void
- Render "Upgrade available" tile for Administrators and Super Admins. This tile cannot be deleted or removed unless ResourceSpace version is up to date
- generate_dash_tile_toolbar() : void
- Generate HTML and JavaScript for the dashboard tile toolbar.
- dash_tile_featured_collection_get_resources() : array<string|int, mixed>
- Build list of resources that can be shown on a dash tile as a background image. Helper function.
- dash_tile_featured_collection_get_top_resources() : mixed
- validate_tile_style() : string
- Validate the type of dash tile and check that the style provided is valid for it.
- validate_build_url() : string
- Sanitise the url provided when saving a dash tile. This function will take the value obtained by the form and pass it through if valid.
- tltype_srch_generate_js_for_background_and_count() : mixed
- Generate client side logic for doing expensive computation async for retrieving the tile background and total results count.
- get_dash_search_data() : array<string|int, mixed>
- Get images and resource count for search dash tile.
- can_edit_tile() : bool
- Check if current user can edit dash tile. Users shouldn't be able to edit tiles that they can't view and only dash admins should be able to edit shared tiles.
- tile_select() : mixed
- tile_graph() : void
- Generate the HTML for a graph dash tile.
- tile_config_themeselector() : mixed
- tile_icon() : void
- Generate HTML for an icon tile, i.e. pending submission, pending review or upload
- tile_freetext() : void
- Generate HTML for a freetext tile
- tile_search_thumbs() : mixed
- tile_search_multi_or_blank() : mixed
- tile_featured_collection_thumbs() : mixed
- tile_featured_collection_multi() : mixed
- errorhandler() : void
- Centralised error handler. Display friendly error messages.
- db_use_multiple_connection_modes() : bool
- Check if ResourceSpace has been configured to run with differnt users (read-write and/or read-only)
- db_set_connection_mode() : void
- Used to force the database connection mode before running a particular SQL query
- db_get_connection_mode() : string
- Return the current DB connection mode
- db_clear_connection_mode() : void
- Clear the current DB connection mode that is in use to override the current SQL queries.
- sql_connect() : void
- Connect to the database using the configured settings.
- db_begin_transaction() : bool
- Indicate that from now on we want to group together DML statements into one transaction.
- db_end_transaction() : bool
- Tell the database to commit the current transaction.
- db_rollback_transaction() : bool
- Tell the database to rollback the current transaction.
- ps_query() : array<string|int, mixed>
- Execute a prepared statement and return the results as an array.
- copy_value() : mixed
- Copy value as value (flatten / no references)
- ps_value() : string
- Return a single value from a database query, or the default if no rows
- ps_array() : array<string|int, mixed>
- Like ps_value() but returns an array of all values found
- sql_insert_id() : int
- Return the ID of the previously inserted row.
- get_query_cache_location() : string
- Returns the location of the query cache files
- clear_query_cache() : bool
- Clear all cached queries for cache group $cache
- check_db_structs() : void
- Check the database structure conforms to that describe in the /dbstruct folder. Usually only happens after a SQL error after which the SQL is retried, thus the database is automatically upgraded.
- CheckDBStruct() : void
- Check the database structure against the text files stored in $path.
- sql_limit() : string
- Generate the LIMIT statement for a SQL query
- sql_limit_with_total_count() : array<string|int, mixed>
- Utility function to obtain the total found rows while paginating the results.
- sql_truncate_text_val() : string
- Query helper to ensure code honours the database schema constraints on text columns.
- ps_param_insert() : string
- When constructing prepared statements and using e.g. ref in (some list of values), assists in outputting the correct number of parameters.
- ps_param_fill() : array<string|int, mixed>
- When constructing prepared statements and using e.g. ref in (some list of values), assists in preparing the parameter array.
- ps_fill_param_array() : array<string|int, mixed>
- Assists in generating parameter arrays where all of the parameters for a given section of sql are the same.
- sql_reorder_records() : void
- Re-order rows in the table
- columns_in() : string|array<string|int, mixed>
- Returns a comma separated list of table columns from the given table. Optionally, will use an alias instead of the table name to prefix the columns. For inclusion in SQL to replace "select *" which is not supported when using prepared statements.
- db_chunk_id_list() : array<int, array<int, int>>
- Database helper to chunk a list of IDs
- db_delete_table_records() : bool
- Delete database table records from a list of IDs
- check_debug_log_override() : void
- Check and set the debug log override status for the current user.
- create_debug_log_override() : void
- Create a debug log override for a specified user or globally.
- debug_function_call() : bool|void
- Debug called function and its arguments
- debug_stringify() : string
- Stringify variables for use in the debug log. This is used more as fallback to json_encode() failing to maintain quick readability of the logs.
- LOG_CODE_validate() : mixed
- LOG_CODE_get_all() : mixed
- definitions_get_by_prefix() : mixed
- do_search() : null|string|array<string|int, mixed>|PreparedStatementQuery
- Takes a search string $search, as provided by the user, and returns a results set of matching resources. If there are no matches, instead returns an array of suggested searches
- resolve_given_nodes() : mixed
- rsEncrypt() : string
- Encrypts data
- rsDecrypt() : false|string
- Decrypts data
- eval_check_signed() : string
- Prior to eval() checks to make sure the code has been signed first, by the offline script / migration script.
- sign_code() : string
- Returns a signature for a given block of code.
- resign_all_code() : void
- Returns a signature for a given block of code.
- rs_validate_token() : bool
- Used to compare the user's provided token with the expected value derived from the given identifier
- initFacialRecognition() : bool
- Initialize facial recognition functionality.
- prepareFaceImage() : bool
- Crops out a selected area of an image and makes it ready to be used by FaceRecognizer.
- faceRecognizerPredict() : bool|array<string|int, mixed>
- Use FaceRecognizer to predict the association between a face and a label (i.e person name)
- safe_file_name() : string
- Ensures the filename cannot leave the directory set.
- generateUserFilenameUID() : string
- Generate a UID for filnames that can be different from user to user (e.g. contact sheets)
- isPathWhitelisted() : bool
- Checks if a path is part of a whitelisted list of paths. This applies to both folders and files.
- get_checksum() : string|false
- Return a checksum for the given file path.
- temp_local_download_remote_file() : string|bool
- Download remote file to the temp filestore location.
- check_valid_file_extension() : bool
- Basic check of uploaded file against list of allowed extensions
- is_banned_extension() : bool
- Is the given extension in the list of blocked extensions? Also ensures extension is no longer than 10 characters due to resource.file_extension database column limit
- remove_empty_temp_directory() : void
- Remove empty folder from path to file. Helpful to remove a temp directory once the file it was created to hold no longer exists.
- is_valid_upload_path() : bool
- Confirm upload path is one of valid paths.
- validate_resource_files() : array<string|int, mixed>
- Validate the files on disk that are associated with the given resources
- is_valid_rs_path() : bool
- Check if a given file path is from a valid RS accessible location
- is_safe_basename() : bool
- Validation helper function to determine if a path base name is unsafe (e.g OS command injection).
- process_file_upload() : ProcessFileUploadErrorCondition}
- High level function which can handle processing file uploads.
- parse_filename_extension() : string
- Parse file name (can include path, although it's unnecessary) to prevent known security bypasses associated with extensions, such as: - Double extensions, e.g. .jpg.php - Null bytes, e.g. .php%00.jpg, where .jpg gets truncated and .php becomes the new extension - Using Windows (DOS) 8.3 short path feature where it's possible to replace existing files by using their shortname (e.g. ".htaccess" can be replaced by "HTACCE~1")
- delete_temp_files() : void
- Delete old files and folders from tempo directory based on the configured $purge_temp_folder_age value Affects filestore/tmp, $storagedir/tmp or the configured $tempdir directory
- purge_query_cache() : void
- permitted_archiver_arguments() : bool
- Are the arguments set in $archiver_settings["arguments"] permitted? Allows word characters, '@', and '-' only
- check_symlink() : bool
- Check if a given path is absolute or contains a symlink or junction is_link() does not accurately detect junction links on Windows systems instead we check if the output from stat() and lstat() differ.
- getval() : mixed
- Retrieve a user-submitted parameter from the browser via post/get/cookies, in that order.
- escape_check() : string
- Escape a value prior to using it in SQL.
- unescape() : string
- For comparing escape_checked strings against mysql content because just doing $text=str_replace("\\","",$text); does not undo escape_check
- nicedate() : string
- Formats a MySQL ISO date
- date_to_age() : string
- Generates a text representation of the age from a given date
- preview_from_text() : string
- Generates preview text of a certain line length and count
- redirect() : never
- Redirect to the provided URL using a HTTP header Location directive. Exits after redirect
- trim_spaces() : string
- replace multiple spaces with a single space
- trim_array() : array<string|int, mixed>
- Removes whitespace from the beginning/end of all elements in an array
- tidylist() : string
- Takes a value as returned from a check-list field type and reformats to be more display-friendly.
- tidy_trim() : string
- Trims $text to $length if necessary. Tries to trim at a space if possible. Adds three full stops if trimmed.
- average_length() : float
- Returns the average length of the strings in an array
- get_stats_activity_types() : array<string|int, mixed>
- Returns a list of activity types for which we have stats data (Search, User Session etc.)
- newlines() : string
- Replace escaped newlines with real newlines.
- get_all_site_text() : array<string|int, mixed>
- Returns a list of all available editable site text (content). If $find is specified a search is performed across page, name and text fields.
- get_site_text() : string
- Returns a specific site text entry.
- check_site_text_custom() : bool
- Check if site text section is custom, i.e. deletable.
- save_site_text() : void
- Saves the submitted site text changes to the database.
- formatfilesize() : string
- Return a human-readable string representing $bytes in either KB or MB.
- filesize2bytes() : int
- Converts human readable file size (e.g. 10 MB, 200.20 GB) into bytes.
- get_mime_type() : array<string|int, mixed>
- Get the mime type for a file on disk
- get_mime_types_by_extension() : array<int, string>
- Find matching MIME type(s) for a file extension.
- get_unsafe_mime_types() : array<string|int, mixed>
- Get the global MIME types associated with the configured banned extensions.
- allowed_type_mime() : string
- Convert the permitted resource type extension to MIME type. Used by upload_batch.php
- send_mail() : mixed
- Send a mail - but correctly encode the message/subject in quoted-printable UTF-8.
- send_mail_phpmailer() : void
- if ($use_phpmailer==true) this function is used instead.
- log_mail() : void
- Log email
- rs_quoted_printable_encode() : string
- Quoted printable encoding is rather simple.
- rs_quoted_printable_encode_subject() : string
- As rs_quoted_printable_encode() but for e-mail subject
- pager() : void
- A generic pager function used by many display lists in ResourceSpace.
- remove_extension() : string
- Remove the extension part of a filename
- get_allowed_extensions_by_type() : string
- Retrieve a list of permitted extensions for the given resource type.
- getAbsolutePath() : string
- Detect if a path is relative or absolute.
- getFolderContents() : array<string|int, mixed>
- Find the files present in a folder, and sub-folder.
- mb_basename() : string
- Returns filename component of path This version is UTF-8 proof.
- strip_extension() : string
- Remove the extension part of a filename.
- is_process_lock() : bool
- Checks to see if a process lock exists for the given process name.
- set_process_lock() : bool
- Set a process lock
- clear_process_lock() : bool
- Clear a process lock
- filesize_unlimited() : int|bool
- Custom function for retrieving a file size. A resolution for PHP's issue with large files and filesize().
- strip_leading_comma() : string
- Strip the leading comma from a string
- get_temp_dir() : string
- Determines where the tmp directory is. There are three options here: 1. tempdir - If set in config.php, use this value.
- convert_path_to_url() : Url
- Converts a path to a url relative to the installation.
- escape_command_args() : string
- Escaping an unsafe command string
- run_command() : string
- Utility function which works like system(), but returns the complete output string rather than just the last line of it.
- run_external() : array<string|int, mixed>
- Similar to run_command but returns an array with the resulting output (stdout & stderr) fetched concurrently for improved performance.
- error_alert() : void
- Display a styledalert() modal error and optionally return the browser to the previous page after 2 seconds
- format_display_field() : string
- When displaying metadata, applies trim/wordwrap.
- format_string_more_link() : string
- Formats a string with a collapsible more / less section
- draw_performance_footer() : void
- Render a performance footer with metrics.
- format_query() : string
- Format SQL queries for display purposes Note: these queries are no longer known to be safe from sql injection
- sql_affected_rows() : mixed
- Abstracted mysqli_affected_rows()
- get_imagemagick_path() : string
- Returns the path to the ImageMagick utilities such as 'convert'.
- get_utility_path() : string|bool
- Returns the full path to a utility, if installed or FALSE otherwise.
- get_executable_path() : string|bool
- Get full path to utility
- truncate_cache_arrays() : void
- Clean up the resource data cache to keep within $cache_array_limit
- is_html() : bool
- Work out of a string is likely to be in HTML format.
- rs_setcookie() : void
- Set a cookie.
- get_editable_states() : array<string|int, mixed>
- Get an array of all the states that a user has edit access to
- validate_html() : bool|string
- Returns true if $html is valid HTML, otherwise an error string describing the problem.
- generateURL() : string
- Utility function to generate URLs with query strings easier, with the ability to override existing query string parameters when needed.
- move_array_element() : void
- Utility function used to move the element of one array from a position to another one in the same array Note: the manipulation is done on the same array
- emptyiszero() : bool
- Check if a value that may equate to false in PHP is actually a zero
- get_slideshow_files_data() : array<string|int, mixed>
- Get data for each image that should be used on the slideshow.
- is_login_slideshow_enabled() : bool
- Determines if at least one slideshow image is configured for the login page
- form_value_display() : string
- Returns a sanitised row from the table in a safe form for use in a form value, suitable overwritten by POSTed data if it has been supplied.
- user_set_usergroup() : void
- Change the user's user group
- generateSecureKey() : string
- Generates a random string of requested length.
- IsModal() : bool
- Check if current page is a modal and set global $modal variable if not already set
- generateCSRFToken() : string
- Generates a CSRF token (Encrypted Token Pattern)
- isValidCSRFToken() : bool
- Checks if CSRF Token is valid
- generateFormToken() : void
- Render the CSRF Token input tag
- generateAjaxToken() : string
- Render the CSRF Token for AJAX use
- generate_csrf_js_object() : string
- Create a CSRF token as a JS object
- generate_csrf_data_for_api_native_authmode() : string
- Create an HTML data attribute holding a CSRF token (JS) object
- enforcePostRequest() : bool|void
- Enforce using POST requests
- is_resourcespace_upgrade_available() : bool
- Check if ResourceSpace is up to date or an upgrade is available
- get_recent_users() : int
- Fetch a count of recently active users
- get_total_approved_users() : int
- Return the total number of approved
- get_total_resources() : int
- Return the number of resources in the system with optional filter by archive state
- check_script_last_ran() : bool
- Check if script last ran more than the failure notification days Note: Never/ period longer than allowed failure should return false
- count_errors() : int
- Counting errors found in a collection of items. An error is found when an item has an "error" key.
- search_array_by_keyvalue() : array<string|int, mixed>
- Function can be used to order a multi-dimensional array using a key and corresponding value
- bypass_permissions() : mixed
- Temporary bypass access controls for a particular function
- set_sysvar() : bool
- Set a system variable (which is stored in the sysvars table) - set to null to remove
- get_sysvar() : string
- Get a system variable (which is received from the sysvars table)
- hook() : mixed
- Plugin architecture. Look for hooks with this name (and corresponding page, if applicable) and run them sequentially.
- html_find_and_replace_node() : void
- Performs a string replace once a text-only node is encountered, otherwise loops and calls itself to iterate over child nodes Not intended to be called directly - use html_find_and_replace
- html_find_and_replace() : string
- Loads HTML fragment into a DOMDocument instance to parse and perform a recursive find/replace on text-only nodes.
- strip_tags_and_attributes() : mixed
- Utility function to remove unwanted HTML tags and attributes.
- strip_paragraph_tags() : string
- Remove paragraph tags from start and end of text.
- get_inner_html_from_tag() : string
- Helper function to quickly return the inner HTML of a specific tag element from a DOM document.
- show_pagetime() : string
- Returns the page load time until this point.
- get_debug_log_dir() : string
- Determines where the debug log will live. Typically, same as tmp dir (See general.php: get_temp_dir().
- debug() : bool
- Output debug information to the debug log, if debugging is enabled.
- rcRmdir() : bool
- Recursively removes a directory.
- daily_stat() : void
- Update the daily statistics after a loggable event.
- pagename() : string
- Returns the current page name minus the extension, e.g. "home" for pages/home.php
- pluginname() : string
- text() : string
- Returns the site content from the language strings. These will already be overridden with site_text content if present.
- get_section_list() : array<string|int, mixed>
- Gets a list of site text sections, used for a multi-page help area.
- resolve_user_agent() : string
- Returns a more friendly user agent string based on the passed user agent. Used in the user area to establish browsers used.
- get_ip() : string
- Returns the current user's IP address, using HTTP proxy headers if present.
- ResolveKB() : string
- For a value such as 10M return the kilobyte equivalent such as 10240. Used by check.php
- trim_filename() : string
- Trim a filename that is longer than 255 characters while keeping its extension (if present)
- array_flip_by_value_key() : array<string|int, mixed>
- Flip array keys to use one of the keys of the values it contains. All elements (ie values) of the array must contain the key (ie. they are arrays). Helper function to greatly increase search performance on huge PHP arrays.
- reshape_array_by_value_keys() : array<string|int, mixed>
- Reshape array using the keys of its values. All values must contain the selected keys.
- permission_j() : bool
- Permission check for "j[ref]"
- permission_negative_j() : bool
- Permission check for "-j[ref]"
- cleanup_files() : void
- Delete temporary files
- is_int_loose() : bool
- Validate if value is integer or string integer
- is_positive_int_loose() : bool
- Helper function to check if value is a positive integer looking type.
- is_positive_or_zero_int_loose() : bool
- Helper function to check if value is a positive or zero integer looking type.
- is_array_of_pos_or_zero_ints() : bool
- Helper function to check if value is an array containing only positive or zero integer looking types
- is_string_loose() : bool
- Helper function to check if a value is able to be cast to a string
- is_input_list_loose() : bool
- Input (type) validation helper function for a list of integers (mostly used for IDs). This covers cases when the submitted data is either sent as an actual list (i.e. myInput[]) or when retrieved from the cookie/query string as a CSV.
- is_float_loose() : bool
- Helper function to check if a value is able to be cast to a float
- ip_matches() : bool|int
- Does the provided $ip match the string $ip_restrict? Used for restricting user access by IP address.
- set_unique_filename() : string
- Ensures filename is unique in $filenames array and adds resulting filename to the array
- build_permission() : Closure
- Build a specific permission closure which can be applied to a list of items.
- validate_remote_code() : bool
- Attempt to validate remote code.
- get_system_status() : array<string|int, mixed>
- Get system status information
- try_unlink() : bool|string
- Try and delete a file without triggering a fatal error
- try_getimagesize() : mixed
- check_filestore_browseability() : array<string|int, mixed>
- Check filestore folder browseability.
- check_imagemagick_cli_version_found() : array<string|int, mixed>
- Check CLI version found for ImageMagick is as expected.
- check_exiftool_cli_version_found() : array<string|int, mixed>
- Check CLI version found for Exiftool is as expected.
- check_numeric_cli_version_found() : array<string|int, mixed>
- Check CLI numeric version found for a utility is as expected.
- check_utility_cli_version_found_by_name() : array<string|int, mixed>
- Check CLI version found for a utility is as expected by looking up for its name.
- command_line_only() : void
- Check we're running on the command line, exit otherwise. Security feature for the scripts in /pages/tools/
- prefix_value() : Closure
- Helper function to quickly build a list of values, all prefixed the same way.
- validateDatetime() : bool
- Utility function to check string is a valid date/time with a specific format.
- string_ends_with() : mixed
- set_order_by_to_zero() : array<string|int, mixed>
- Helper function to set the order_by key of an array to zero.
- cast_echo_to_string() : string
- Helper function to cast functions that only echo things out (e.g render functions) to string type.
- parse_csv_to_list_of_type() : array<string|int, mixed>
- Helper function to parse input to a list of a particular type.
- execution_lockout_remove_resource_type_field_props() : array<string|int, mixed>
- Remove metadata field properties during execution lockout
- set_watermark_image() : void
- Update global variable watermark to point to the correct file. Watermark set on System Configuration page will override a watermark set in config.php. config.default.php will apply otherwise (blank) so no watermark will be applied.
- compute_dpi() : mixed
- DPI calculations
- compute_megapixel() : float
- MP calculation
- get_size_info() : string
- Get size info as a paragraphs HTML tag
- is_jpeg_extension() : bool
- Simple function to check if a given extension is associated with a JPG file
- url_starts_with() : bool
- Input validation helper function to check a URL is ours (e.g. if it's our base URL). Mostly used for redirect URLs.
- is_safe_url() : bool
- Input validation helper function to check if a URL is safe (from XSS) in an HTML context.
- sanitise_url() : string
- Sanitise URL for HTML rendering purposes.
- validate_sort_value() : bool
- Input validation helper function for sorting (ASC/DESC).
- validate_digit_csv() : bool
- Input validation helper function for a CSV of integers (mostly used for IDs).
- get_sub_array_with() : callable
- Helper function to get an array of values with a subset of their original keys.
- enforceSharePassword() : void
- Server side check to backup front end javascript validation.
- js_call_CentralSpaceLoad() : never
- Helper function to call the JS CentralSpaceLoad().
- getCertificateExpiry() : string|bool
- Get expiration date of a given PEM certificate
- isValidCssColor() : bool
- Is the provided colour a valid CSS colour and therefore safe to display?
- hslToRgb() : array<string|int, mixed>
- Convert HSL to RGB.
- check_tinymce_plugins() : string
- Check TinyMCE plugin list against an array of valid options The passed list is checked against TINYMCE_VALID_PLUGINS.
- check_tinymce_toolbar() : string
- Check TinyMCE toolbar configuration to ensure it contains only alphanumeric characters, spaces and the pipe (|) symbol.
- get_non_ingested_resources() : int
- Return the number of resources in the system that are not ingested into the filestore i.e. with 'file_path' set
- get_favicon_url() : string
- Return URL of the application favicon
- is_original_preview() : bool
- Determine what is a manually uploaded preview based off of data in the resource log
- get_page_title() : string
- Return the page title to use for the given page and optionally plugin.
- log_bandwidth() : void
- Log the bandwidth used by download.php
- strip_unicode_points() : string
- Strip Unicode points from a text value.
- allow_unicode_characters() : string
- Strip any characters not present in the allow list. Mostly useful for search/indexing purposes where we care more about the words themselves and less about linking or any other type of characters.
- set_per_page_cookie() : void
- Add or update the value used for paging for the current page to the list of stored pager cookies
- get_per_page_cookie() : int
- Retrieve the pager cookie for the current page.
- parse_int_ranges() : array<string|int, mixed>
- Parse a comma-separated list of integers and integer ranges into a sorted array.
- build_range_where_condition() : array<string|int, mixed>
- Build a SQL WHERE fragment and bound parameters from a list of integers and ranges.
- iiif_get_canvases() : array<string|int, mixed>
- Get an array of all the canvases for the identifier ready for JSON encoding
- iiif_get_thumbnail() : array<string|int, mixed>
- Get thumbnail information for the specified resource id ready for IIIF JSON encoding
- iiif_get_image() : array<string|int, mixed>
- Get the image for the specified identifier canvas and resource id
- iiif_error() : void
- Handle a IIIF error.
- is_power_of_two() : bool
- upload_file() : bool
- Upload a file from the provided path to the given resource
- extract_exif_comment() : bool
- Extract and process EXIF, IPTC, and FITS metadata for a resource.
- iptc_return_utf8() : string
- Convert IPTC metadata text to UTF-8 encoding.
- create_previews() : bool
- Generate previews for a resource, including thumbnails and alternative image sizes.
- extract_mean_colour() : void
- Calculate and update the mean color values for a resource image.
- update_portrait_landscape_field() : void
- Update the portrait or landscape orientation field for a resource.
- get_colour_key() : string
- Generate a color key for an image based on dominant colors.
- tweak_preview_images() : bool
- Apply rotation and gamma adjustments to all preview images of a resource.
- tweak_wm_preview_images() : bool
- Apply rotation and gamma adjustments to all watermarked preview images of a resource.
- AltImageRotate() : resource
- Rotate an image resource by a specified angle without using built-in rotation functions.
- base64_to_jpeg() : void
- Convert a base64-encoded image to a JPEG file.
- extract_indd_pages() : array<string|int, mixed>|bool
- Extracts JPG previews from INDD files when these have been set with a preview Note: it requires ExifTool >= 9.50
- generate_file_checksum() : bool
- Generate or update the checksum for a resource file.
- clear_file_checksum() : bool
- Clear the checksum value for a specified resource.
- check_duplicate_checksum() : array<string|int, mixed>
- Check for duplicate files based on checksum.
- upload_preview() : bool
- Upload and generate previews for a resource.
- extract_text() : bool
- Extract text from the resource and save to the configured field
- get_image_orientation() : int
- Get the orientation of an image file using ExifTool.
- AutoRotateImage() : bool
- Automatically rotate an image based on its orientation metadata.
- extract_icc_profile() : bool
- Provides ability to extract the ICC profile for a specified resource/ alternative file
- extract_icc() : bool
- Extracts the ICC profile from an image file using ImageMagick.
- get_imagemagick_version() : mixed
- Retrieves the version of ImageMagick installed on the system.
- calculate_image_dimensions() : array<string|int, mixed>
- Function used to get new width & height for an image in order to maintain aspect ratio while it will fit within a desired dimension.
- upload_file_by_url() : bool
- Upload file from a URL and add it to a resource.
- delete_previews() : mixed
- Delete all preview files for specified resource id or resource data array
- getFileDimensions() : array<string|int, mixed>
- Get dimensions of image file
- getSvgSize() : array<string|int, mixed>
- Get SVG size by reading the file and looking for dimensions at either width and height OR at Viewbox attribute(s)
- convertSvgLengthToPx() : int|null
- Convert SVG length/width dimension to px size at 96DPI
- replace_preview_from_resource() : bool
- Replace preview image with preview image from another resource/alternaive file
- get_preview_source_file() : string
- Get the source file to use for creating a preview
- compute_tiles_at_scale_factor() : array<string|int, mixed>
- Compute image tile regions based on a scale factor.
- transform_file() : bool
- Perform the requested action on the original file to create a new file
- remove_video_previews() : void
- For a given resource reference, remove the video pre size and all snapshots.
- start_previews() : int
- Create preview sizes via create_previews() and/or generate jobs as necessary
- get_sizes_to_generate() : array<string|int, mixed>|bool
- Get an array of preview size IDs to generate
- create_image_alternatives() : bool
- Generates alternative image files for a specified resource.
- is_valid_imagemagick_color() : bool
- Input validation helper function for ImageMagick's color values (e.g. blue, #ddddff and rgb(255,255,255))
- can_apply_icc_profile() : bool
- With $icc_extraction enabled, determine whether we should apply the icc profile that has been found.
- transform_apply_icc_profile() : array<string|int, mixed>
- Check if system is using ICC profiles and prepare ImageMagick command for use by transform_file() to enable system wide configuration for $icc_extraction to be applied when transforming a file, such as by format chooser or image tools.
- create_previews_using_im() : bool
- Generate previews for a resource using ImageMagick.
- job_queue_add() : string|int
- Adds a job to the job_queue table.
- job_queue_update() : void
- Update the data/status/time of a job queue record.
- job_queue_delete() : void
- Delete a job queue entry if user owns job or user is admin
- job_queue_get_jobs() : mixed
- Gets a list of offline jobs
- job_queue_get_job() : array<string|int, mixed>
- Get details of specified offline job
- job_queue_purge() : void
- Delete all jobs in the specified state
- job_queue_run_job() : string
- Run offline job
- get_job_type_priority() : int
- Get the default priority for a given job type
- get_job_queue_log_path() : string|false
- Build and ensure a writable log file path for a queued job
- get_job_queue_log_path_by_ref() : string|false
- Resolve a queued job reference to its corresponding log file path
- get_job_progress_from_log_file() : array<string|int, mixed>
- Scan a log file from the end and return the most recent line matching a pattern.
- job_trigger_permission_check() : bool
- Determine whether the current user is allowed to manually trigger background jobs.
- triggerable_job_check() : bool
- Determine whether a job type is user triggerable.
- update_preview() : mixed
- lang_or_i18n_get_translated() : string
- Translates field names / values using two methods: First it checks if $text exists in the current $lang (after $text is sanitized and $mixedprefix - one by one if an array - and $suffix are added). If not found in the $lang, it tries to translate $text using the i18n_get_translated function.
- i18n_get_translated() : string
- For field names / values using the i18n syntax, return the version in the current user's language. Format is ~en:Somename~es:Someothername
- i18n_get_collection_name() : string
- Translates collection names
- i18n_get_indexable() : string
- For field names / values using the i18n syntax, return all language versions, as necessary for indexing.
- i18n_get_translations() : array<string|int, mixed>
- For a string in the language format, return all translations as an associative array E.g. "en"->"English translation"; "fr"->"French translation"
- str_replace_formatted_placeholder() : string
- Returns a string with all occurrences of the $mixedplaceholder in $subject replaced with the $mixedreplace.
- ucfirstletter() : string|array<string|int, mixed>|null
- Returns a string with the first LETTER of $string capitalized.
- ucfirstletter_callback() : void
- Callback used by ucfirstletter
- normalize_keyword() : string
- Normalize the text if function available
- remove_accents() : string
- This function and seems_utf8 are reused from WordPress. See documentation/licenses/wordpress.txt for license information
- seems_utf8() : bool
- Looks for particular patterns to attempt to determine if the provided string is in UTF8 format
- http_get_preferred_language() : string
- Use the browser settings to determine the default / preferred language
- setLanguage() : string
- Set the user's current language based on get/post/cookie values as appropriate.
- lang_load_site_text() : void
- Load all site text for the given page and language into the global $lang array
- i18n_get_all_translations() : array<string|int, mixed>
- Return an array of all available language strings for the given id, with the language code as the key
- i18n_merge_translations() : array<string|int, mixed>
- Merge values for across multiple translation strings.
- get_display_language() : string
- Get the name of a language in your own language plus its native name.
- is_i18n_language_string() : bool
- Simple check to determine if the text string supplied contains i18n language translations.
- log_activity() : void
- Log activity in the system (e.g user deleted a user)
- logScript() : void
- Log script messages on screen and optionally in a file. If debug_log is enabled, it will also write the message in the debug log file.
- resource_log_last_rows() : array<string|int, mixed>
- Retrieve entries from resource log based on date or references
- get_activity_log() : array<string|int, mixed>|int
- Get activity log entries from log tables (e.g activity_log, resource_log and collection_log)
- get_user_downloads() : int
- Use resource log to obtain a count of resources downloaded by the specified user in the last X days
- log_node_changes() : bool
- Add detail of node changes to resource log
- log_search_event() : void
- Log search events
- generate_trace_id() : string
- Generate a fingerprint which could then be used as a trace ID for event correlation purposes.
- daily_stat_past_month_by_activity() : int
- Return sum of activity from the daily_stat table for the past month for a given activity_type.
- perform_login() : array<string|int, mixed>
- Performs the login using the global $username, and $password. Since the "externalauth" hook is allowed to change the credentials later on, the $password_hash needs to be global as well.
- generate_session_hash() : string
- Generates a unique session hash for user authentication.
- set_login_cookies() : void
- Set login cookies
- rs_password_hash() : string|false
- ResourceSpace password hashing
- rs_password_verify() : bool
- ResourceSpace verify password
- get_password_hash_info() : array<string|int, mixed>
- Helper function to get the password hash information (algorithm and options) from the global scope.
- leaflet_osm_basemaps() : string
- Generates OpenStreetMap basemaps for use in a Leaflet map.
- leaflet_esri_basemaps() : string
- Generates ESRI basemaps for use in a Leaflet map.
- leaflet_stamen_basemaps() : mixed
- leaflet_hydda_basemaps() : string
- Generates Hydda basemaps for use in a Leaflet map.
- leaflet_nasa_basemaps() : string
- Generates NASA basemaps for use in a Leaflet map.
- leaflet_usgs_basemaps() : string
- Generates USGS basemaps for use in a Leaflet map.
- leaflet_thunderforest_basemaps() : string
- Generates Thunderforest basemaps for use in a Leaflet map.
- leaflet_mapbox_basemaps() : mixed
- leaflet_map_zoom() : string
- Generates Mapbox basemaps for use in a Leaflet map.
- leaflet_polygon_parsing() : array<string|int, mixed>
- Parses the resource polygon string to extract latitude and longitude bounds and formats the polygon string.
- leaflet_coordinate_check() : bool
- Validates geolocation coordinates to ensure they are numeric and within acceptable bounds.
- leaflet_markers_legend() : void
- Creates a map color markers legend for Leaflet maps.
- header_add_map_providers() : void
- Adds map providers for Leaflet maps.
- get_geolibraries() : void
- Checks the current page and includes necessary geolocation libraries for Leaflet maps.
- set_geo_map_centerview() : void
- Set bounds for default map view (geo_search.php and geo_edit.php)
- get_geo_maps_scripts() : void
- Outputs the script tag for including additional Leaflet plugins.
- message_get() : bool
- Gets messages for a given user (returns true if there are messages, false if not) Note that messages are passed by reference.
- message_add() : void
- Add a new resourcespace system message
- message_remove() : void
- Remove a message from message table and associated user_messages
- message_seen() : void
- Mark a message as seen
- message_unseen() : void
- Mark a message as unseen
- message_seen_all() : void
- Flags all non-read messages as read for given user and seen type
- message_purge() : void
- Remove all messages from message and user_message tables that have expired (regardless of read).
- message_deleteselusrmsg() : void
- Delete all selected messages
- message_selectedseen() : void
- Mark all selected messages as seen
- message_selectedunseen() : void
- Mark all selected messages as unseen
- message_send_unread_emails() : bool
- Send a summary of all unread notifications as an email from the standard cron_copy_hitcount
- message_remove_related() : void
- Remove all messages related to a certain activity (e.g. resource request or resource submission) matching the given ref(s)
- system_notification() : void
- Send a system notification or email to the system administrators according to preference
- message_getrefs() : void
- Get all message refs for a given user
- message_get_conversation() : array<string|int, mixed>
- Get all messages between the given user IDs
- send_user_message() : bool|string
- Send a user to user(s) message
- send_user_notification() : array<string|int, mixed>
- Send system notifications to specified users, checking the user preferences first if specified
- get_user_message() : array<string|int, mixed>|bool
- Gets the user message for the given ref
- send_integrity_failure_notices() : void
- Send notifications about file integrity failures
- build_specialsearch_list_urls() : array<string|int, mixed>
- Limit the length of !list special search url by adding a maximum of 650 characters of resource references per link including separators.
- runFitsForFile() : bool|SimpleXMLElement
- Run FITS on a file and get the output back
- getFitsMetadataFieldValue() : string
- Get metadata value for a FITS field
- extractFitsMetadata() : bool
- Extract FITS metadata from a file for a specific resource.
- check_date_format() : string
- Check date conforms to "yyyy-mm-dd hh:mm" format or any valid partital of that e.g. yyyy-mm.
- check_date_parts() : string
- Check datepart conforms to its formatting and error out each section accordingly
- update_fieldx() : void
- updates the value of fieldx field further to a metadata field value update
- exiftool_resolution_calc() : void
- Extract and store dimensions, resolution, and unit (if available) from exif data Exiftool output format (tab delimited): widthxheight resolution unit (e.g., 1440x1080 300 inches)
- get_required_fields() : array<string|int, mixed>
- Return array containing data for all required fields that apply to the given resource type.
- missing_fields_check() : array<string|int, mixed>
- For a given resource, return an array of data for required metadata field references which have not been completed.
- update_archive_required_fields_check() : array<string|int, mixed>
- Considers if checking of missed required fields is required when a resource changes archive state. We'll always allow moving to the $resource_deletion_state and Pending Submission state (-2). Exceptions made to archive states in rse_workflow will be applied.
- update_geolocation_fields() : void
- Update the geo location fields (if set) for the given resource(s).
- migrate_resource_type_field_check() : mixed
- migrate_category_tree_to_nodes() : mixed
- migrate_filter() : mixed
- random_char() : string
- Utility function to generate a random UTF8 character
- mix_date() : string
- Utility function to randomly alter date by offset
- mix_text() : string
- Utility function to randomly scramble string
- alter_data() : void
- Utility function to randomly scramble data array for exporting
- mix_url() : string
- Utility function to scramble a URL
- mix_filename() : string
- Utility function to scramble a filename
- mix_email() : string
- Utility function to scramble an email address
- safe_export() : string
- Utility function to escape and replace any empty strings with NULLS for exported SQL scripts
- get_export_tables() : array<string|int, mixed>
- Get array of tables to export when exporting system config and data
- edit_filter_to_restype_permission() : mixed
- set_node() : bool|int
- Set node - Used for both creating and saving a node in the database.
- delete_node() : void
- Delete node. This will fully delete a node and remove any association between the deleted node and resources / keywords.
- delete_nodes_for_resource_type_field() : void
- Delete all nodes for a resource type field
- get_node() : bool
- Get a specific node by ref
- get_nodes() : array<string|int, mixed>
- Get all nodes from database for a specific metadata field or parent.
- get_nodes_by_refs() : array<string|int, mixed>
- Find and return node details for a list of node IDs.
- is_parent_node() : bool
- Checks whether a node is parent to other nodes or not
- get_tree_node_level() : int
- Determine how many level deep a node is. Useful for knowing how much to indent a node
- get_all_ancestors_for_node() : array<string|int, mixed>|bool
- Return a row consisting of all ancestor nodes of a given node Example: 1 2 2.3 2.7 2.8.4 2.8.5 2.8.6 2.9 3 Passing in node 5 will return nodes 8,2 in one row
- reorder_node() : void
- Function used to reorder nodes based on an array with nodes in the new order
- reorder_nodes() : array<string|int, mixed>
- Virtually re-order nodes
- render_new_node_record() : void
- Renders HTML for adding a new node record in the database
- get_node_order_by() : int
- Calculate the next order by for a new record
- draw_tree_node_table() : bool
- Renders HTML for a tree node
- node_field_options_override() : bool
- Overrides either a field[options] array structure or a flat option array with values derived from nodes.
- add_node_keyword() : bool
- Adds node keyword for indexing purposes
- remove_node_keyword() : void
- Removes node keyword for indexing purposes
- remove_all_node_keyword_mappings() : void
- Removes all indexed keywords for a specific node ID
- check_node_indexed() : void
- Function used to check if a fields' node needs (re-)indexing
- add_node_keyword_mappings() : bool
- Function used to index node keywords
- remove_node_keyword_mappings() : bool
- Function used to un-index node keywords
- add_resource_nodes() : bool
- Add nodes in array to resource
- add_resource_nodes_multi() : bool
- Add nodes in array to multiple resources. Changes made using this function will not be logged by default.
- get_resource_nodes() : array<string|int, mixed>
- Get nodes associated with a particular resource for all / a specific field (optionally)
- get_resources_nodes_by_rtf() : Generator
- Get all resource nodes associated for a specific resource type field.
- delete_resource_nodes() : void
- Delete nodes in array from resource
- delete_resource_nodes_multi() : void
- Delete all node relationships matching the passed resource IDs and node IDs.
- delete_all_resource_nodes() : void
- Delete all node relationships for the given resource.
- delete_node_resources() : void
- Delete all resource node relationships for the given node.
- copy_resource_nodes() : void
- Copy resource nodes from one resource to another. Only applies for active metadata fields.
- copy_resource_type_field_nodes() : bool
- Copy all nodes from one metadata field to another one.
- get_parent_nodes() : array<string|int, mixed>
- Get all the parent nodes of the given node, all the way back to the top of the node tree.
- get_nodes_count() : int
- Get the total number of nodes for a specific field
- extract_node_options() : array<string|int, mixed>
- Extract option names (in raw form if desired) from a nodes array.
- get_node_by_name() : array<string|int, mixed>
- Search an array of nodes by name
- get_node_id() : false|int
- Return a node ID for a given string
- node_translated_name_comparator() : 0
- Comparator function for uasort to allow sorting of node array by translated name
- node_orderby_comparator() : 0
- Comparator function for uasort to allow sorting of node array by order_by field
- get_node_elements() : array<string|int, mixed>
- This function returns an array containing list of values for a selected field, identified by $field_label, in the multidimensional array $nodes
- get_node_tree() : array<string|int, mixed>
- This function returns a multidimensional array with hierarchy that reflects category tree field hierarchy, using parent and order_by fields
- get_cattree_nodes_ordered() : array<string|int, mixed>
- This function returns an array of category tree nodes in the hierarchical sequence defined in manage options
- get_cattree_node_strings() : array<string|int, mixed>
- This function returns an array of category tree node strings in the hierarchical sequence defined in manage options The returned strings are i18 translated
- cattree_node_creator() : array<string|int, mixed>
- Helper function for building node entry arrays for ordering
- cattree_node_flatten() : array<string|int, mixed>
- Helper function which adds child nodes after each flattened parent node
- get_node_strings() : array<string|int, mixed>
- This function returns an array of strings that represent the full paths to each tree node passed
- compute_node_branch_path() : array<string|int, mixed>
- Get to the root of the branch starting from a node.
- compute_nodes_by_parent() : array<string|int, mixed>
- Find all nodes with parent
- get_resource_nodes_batch() : array<string|int, mixed>
- Get all nodes for given resources and fields. Returns a multidimensional array wth resource IDs as top level indexes and field IDs as second level indexes
- process_node_search_syntax_to_names() : array<string|int, mixed>
- Process one of the columns whose value is a search string containing nodes (e.g @@228@229, @@555) and mutate input array by adding a new column (named $column + '_node_name') which will hold the nodes found in the search string and their translated names
- delete_unused_non_fixed_list_nodes() : mixed
- Delete unused non-fixed list field nodes with a 1:1 resource association
- remove_invalid_node_keyword_mappings() : mixed
- Delete invalid node_keyword associations. Note, by invalid, it's meant where the node is missing.
- remove_invalid_resource_node_mappings() : mixed
- Delete invalid resource_node associations. Note, by invalid, it's meant where the node is missing.
- get_nodes_use_count() : array<string|int, mixed>
- Get a count of how many resources are using the specified nodes
- check_delete_nodes() : mixed
- Check array of nodes and delete any that relate to non-fixed list fields and are unused
- remove_field_keywords() : void
- Delete all keywords for all nodes associated with the specified field
- update_resource_node_hitcount() : void
- For the specified $resource, increment the hitcount for each node in array
- order_tree_nodes() : array<string|int, mixed>
- Order array of tree nodes into logical order - Each parent followed by its child nodes, all following order_by
- add_sql_node_language() : void
- Append SQL to an existing node query to obtain the translated names of the node
- migrate_fixed_to_text() : bool
- Migrate fixed list field data to text field data for a given resource reference. Useful when changing resource type field from a data type that can contain multiple values such as a dynamic keywords field. This script will concatenate the existing values and leave one remaining node for the new text field.
- cleanup_invalid_nodes() : int
- Remove invalid field data from resources, optionally just for the specified resource types and/or fields
- update_node_active_state() : void
- Batch update nodes' active state to the database. The same state will apply to all nodes in the list.
- toggle_active_state_for_nodes() : array<int, 0|1>
- Toggle nodes' active state
- toggle_category_tree_nodes_active_state() : array<int, 0|1>
- Toggle category tree nodes' active state
- node_is_active() : bool
- Helper function to check if a node is active Note: a node here requires the "active" key.
- suggest_dynamic_keyword_nodes() : array<string|int, mixed>
- Suggest dynamic keyword nodes. Used by pages/edit_fields/9_ajax/suggest_keywords.php
- get_pdf_template_path() : string
- Returns the path to a pdf template
- generate_pdf() : bool
- Takes an HTML template suitable for HTML2PDF library and generates a PDF file if successfull
- get_template_path() : string
- Returns the path to any template in the system.
- process_template() : string
- Function used to process a template
- process_if_statements() : string
- Process a string (mainly HTML) which contains if statement placeholders and return the processed string
- resolve_pdf_language() : string
- Function to convert the user's language into an HTML2PDF supported language.
- get_pdf_templates() : mixed
- Returns an array of available PDF template names *
- activate_plugin() : bool
- Activate a named plugin.
- deactivate_plugin() : void
- Deactivate a named plugin.
- purge_plugin_config() : mixed
- Purge configuration of a plugin.
- get_plugin_yaml() : array<string|int, mixed>|bool
- Load plugin .yaml file.
- config_json_encode() : string
- A subset json_encode function that only works on $config arrays but has none of the version-to-version variability and other "unusual" behavior of PHP's.
- config_encode() : an
- Utility function to encode the passed string to something that conforms to the json spec for a string. Json doesn't allow strings with double-quotes, backslashes or control characters in them. For double-quote and backslash, the encoding is '\"' and '\\' respectively. The encoding for control characters is of the form '\uxxx' where "xxx" is the UTF-8 4-digit hex value of the encoded character.
- get_plugin_config() : mixed|null
- Return plugin config stored in plugins table for a given plugin name.
- set_plugin_config() : mixed
- Store a plugin's configuration in the database.
- is_plugin_activated() : bool
- Check if a plugin is activated.
- get_active_plugins() : array<string|int, mixed>
- Get active plugins
- config_gen_setup_post() : void|string
- Generate the first half of the "guts" of a plugin setup page from a page definition array. This function deals with processing the POST that comes (usually) as a result of clicking on the Save Configuration button.
- config_gen_setup_html() : mixed
- Generate the second half of the "guts" of a plugin setup page from a page definition array. The page definition array is typically constructed by a series of calls to config_add_xxxx functions (see below). See the setup page for the sample plugin for information on how to use this and the associated functions.
- config_section_header() : mixed
- Generate an html text section header
- config_add_section_header() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a section header.
- config_add_text_list_input() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a comma-separated list text entry configuration variable to the setup page.
- config_multi_select() : mixed
- Generate an html multi-select + options block
- config_add_multi_select() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a multi select configuration variable to the setup page.
- config_single_user_select() : mixed
- Generate an html single-select block for selecting one of the RS users.
- config_add_single_user_select() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a single RS user select configuration variable to the setup page.
- config_multi_user_select() : mixed
- Generate an html multi-select block for selecting from among RS users.
- config_add_multi_user_select() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a multiple RS user select configuration variable to the setup page.
- config_single_group_select() : mixed
- Generate an html single-select block for selecting from among RS user groups.
- config_add_single_group_select() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a single RS group select configuration variable to the setup page.
- config_multi_group_select() : mixed
- Generate an html multi-select block for selecting from among RS user groups.
- config_add_multi_group_select() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a multiple RS user select configuration variable to the setup page.
- config_multi_ftype_select() : mixed
- Generate an html multi-select + options block for selecting multiple RS field types. The selected field type is posted as an array of the values of the "ref" column of the selected field types.
- config_add_multi_ftype_select() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a multiple RS field-type select configuration variable to the setup page.
- config_single_rtype_select() : mixed
- Generate an html single-select + options block for selecting one of the RS resource types. The selected field type is posted as the value of the "ref" column of the selected resource type.
- config_add_single_rtype_select() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a single RS resource-type select configuration variable to the setup page.
- config_multi_rtype_select() : mixed
- Generate an html multi-select check boxes block for selecting multiple the RS resource types. The selected field type is posted as an array of the values of the "ref" column of the selected resource types.
- config_add_multi_rtype_select() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a multiple RS resource-type select configuration variable to the setup page.
- config_multi_archive_select() : mixed
- Generate an html multi-select check boxes block for selecting multiple the RS archive states.
- config_add_multi_archive_select() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a multiple RS archive select configuration variable to the setup page.
- config_db_single_select() : mixed
- Generate an html single-select + options block for selecting from among rows returned by a database query in which one of the columns is the unique key (by default, the "ref" column) and one of the others is the text to display (by default the "name" column). The value posted is the value at the intersection of the selected rown with the column given by the $ixcol variable.
- config_add_db_single_select() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a single select configuration variable whose value is chosen from among the results of a db query to the setup page.
- config_db_multi_select() : mixed
- Generate an html multi-select + options block for selecting from among rows returned by a database query in which one of the columns is the unique key (by default, the "ref" column) and one of the others is the text to display (by default the "name" column). The value posted is an array of the values of the column given by the $ixcol variable for the rows selected.
- config_add_db_multi_select() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a multi select configuration variable whose values are chosen from among the results of a db query to the setup page.
- config_add_hidden() : mixed
- Return a data structure that will instruct the configuration page generator functions to add a hidden configuration variable.
- config_text_field() : mixed
- Deprecated -- use config_text_input instead
- config_userselect_field() : mixed
- Deprecated -- use config_multi_user_select instead
- config_field_select() : mixed
- Deprecated -- use config_single_ftype_select instead
- config_boolean_field() : mixed
- Deprecated -- use config_boolean_select instead
- config_custom_select_multi() : mixed
- Deprecated -- use config_db_multi_select instead
- config_custom_select() : mixed
- Deprecated -- use config_single_select instead
- get_plugin_css() : mixed
- plugin_activate_for_setup() : mixed
- include_plugin_config() : void
- Includes configuration files for a specified plugin.
- register_plugin_language() : void
- Registers the language files for a specified plugin.
- get_plugin_path() : string|false
- Retrieves the file path for a specified plugin.
- register_plugin() : bool
- Registers a specified plugin by including its hooks and API bindings.
- plugin_encode_complex_configs() : string
- Encode complex plugin configuration (e.g mappings defined by users on plugins' setup page)
- plugin_decode_complex_configs() : mixed
- Decode complex plugin configuration (e.g mappings defined by users on plugins' setup page)
- register_group_access_plugins() : array<string|int, mixed>
- Load group specific plugins and reorder plugins list
- register_all_group_access_plugins() : array<string|int, mixed>
- Load ALL group specific plugins and reorder plugins list This will bypass any group access controls for use with CLI scripts
- RenderPlugin() : void
- Render the plugin in the Plugin Manager with options to activate and configure.
- render_search_field() : mixed
- Renders the HTML for the provided $field for inclusion in a search form, for example the advanced search page. Standard field titles are translated using $lang. Custom field titles are i18n translated.
- render_sort_order() : mixed
- Renders sort order functionality as a dropdown box
- render_dropdown_option() : mixed
- Renders a dropdown option
- render_actions() : void
- Renders search actions functionality as a dropdown box
- render_user_group_multi_select() : mixed
- render_user_group_checkbox_select() : void
- Renders a list of user groups
- render_text_question() : void
- render_text_input_question - Used to display a question with simple text input
- render_split_text_question() : mixed
- render_split_text_question - Used to display a question with two inputs e.g. for a from/to range
- render_dropdown_question() : void
- render_dropdown_question - Used to display a question with a dropdown selector
- render_access_key_tr() : void
- Render a table row (tr) for a single access key
- is_field_displayed() : bool
- Checks whether a specified field should be displayed based on various conditions.
- display_field() : mixed
- Displays a field in the resource edit interface.
- render_date_range_field() : mixed
- Renders a date range input field for resource editing.
- renderBreadcrumbs() : void
- Renders a full breadcrumbs trail.
- render_new_featured_collection_cta() : void
- Render a blank tile used for call to actions (e.g: on featured collections, a tile for creating new collections)
- renderSocialMediaShareLinksForUrl() : void
- Renders social media links in order to share a particular link
- renderLockButton() : void
- Renders a lock button for a field - used to 'lock' metadata in upload_review_mode
- render_resource_image() : void
- Renders an image, with width and height specified for centering in div
- calculate_image_display() : array<string|int, mixed>
- Calculations width, height and margin-top property for resource image to display in ResourcePanel
- render_share_options() : void
- Render the share options (used on collection_share.php and resource_share.php)
- render_field_selector_question() : void
- Renders a metadata field selector
- render_filter_bar_button() : void
- Render a filter bar button
- render_upload_here_button() : void|array<string|int, mixed>
- Render "Upload here" button.
- render_trash() : string|void
- Renders the trash bin. This is used to delete dash tiles and remove resources from collections
- render_help_link() : mixed
- Generates a help icon that opens the relevant Knowledge Base article in a modal
- render_question_div() : void
- Render generic Question div (including clearleft)
- render_custom_fields() : true
- Render custom fields (NOT metadata fields)
- render_selected_resources_counter() : string
- Generates HTML for the "X Selected" in the search results found part pointing to the special collection COLLECTION_TYPE_SELECTION
- render_edit_selected_btn() : void
- Renders the "Edit selected" button. This is using the special 'COLLECTION_TYPE_SELECTION' collection
- render_clear_selected_btn() : void
- Renders the "Clear selected" button. This is using the special 'COLLECTION_TYPE_SELECTION' collection
- render_selected_collection_actions() : void
- Render the actions specific to when a user selected resources (using the special "COLLECTION_TYPE_SELECTION" collection)
- render_user_collection_select() : mixed
- render_csrf_data_attributes() : mixed
- Render CSRF information as data attributes. Useful to allow JS to run state changing operations
- check_display_condition() : bool
- Check display condition for a field.
- display_upload_options() : bool
- Utility to if collapsable upload options should be displayed
- display_field_data() : mixed
- render_fixed_list_as_pills() : string
- render_resource_lock_link() : mixed
- EditNav() : void
- EditNav - render html for next/back browsing on the resource edit page. Called by SaveAndClearButtons()
- SaveAndClearButtons() : void
- Render the 'QuestionSubmit' div with the 'Save', 'Clear' and 'Save all with values' locked Buttons - used by the resource edit page
- display_size_option() : void
- display_size_option
- render_featured_collection_category_selector() : void
- Render the featured collection category selector
- render_featured_collections() : mixed
- Render featured collections (as tiles on the collections_featured.php page)
- render_featured_collection() : void
- Render a featured collection (as tiles on the collections_featured.php page)
- render_top_right_menu_btn() : void
- Render the top right menu button ellipsis icon.
- render_featured_collection_context_menu() : void
- Render a featured collection (category) contextual menu
- DrawOption() : void
- Renders an option in the Permission Manager (admin_group_permissions.php page)
- render_featured_collections_category_permissions() : void
- Render featured collections options in the Permission Manager (admin_group_permissions.php page)
- show_upgrade_in_progress() : void
- show_upgrade_in_progress message
- render_audio_download_link() : mixed
- add link to mp3 preview file if resource is a wav file
- render_table() : void
- Render a table based on ResourceSpace data to include sorting by various columns
- render_array_in_table_cells() : void
- Render multimensional array or object to display within table cells
- render_top_page_error_style() : void
- Render the top page error style version
- render_question_form_helper() : mixed
- Render a FormHelper. These are used in forms, to provide extra information to the user to a question.
- render_hidden_input() : mixed
- Render an HTML hidden input
- render_workflow_state_question() : mixed
- Renders a dropdown for selecting the workflow state of a resource.
- render_share_password_question() : mixed
- Renders a question field for setting a share password.
- radio_get_layout() : array<string|int, mixed>
- Get required rows and columns for use when displaying radio buttons in a table
- render_radio_buttons_question() : void
- render_radio_buttons_question - Used to display a question with radio buttons
- render_message() : void
- Render a user message for use in conversation view
- render_antispam_question() : mixed
- Render the antispam Question form section
- render_fixed_text_question() : void
- Renders a 'fixed' text question - not an input but to display information or values that cannot be changed
- escape() : string
- Output encoding for HTML context when unsafe input is rendered inside it
- encode_js_value() : string
- Output encoding for Javascript (JS) context. Allows PHP code to embed data as a JS value by producing a JS-compatible literal for the common JSON types.
- html_break_long_words() : string
- HTML aware function to break up long words onto multiple lines for PDF generation where CSS text wrapping can't be used
- render_lucide_icon_selector() : void
- Renders a Lucide icon selector question Requires lib/lucide/icon_classes.php to be included in the page using the function
- display_related_resources() : void
- Render all related resources on view page
- admin_resource_type_field_constraint() : void
- Display appropriate field constraint for use on admin_resource_type_field_edit.php e.g. single select/Number
- admin_resource_type_field_option() : void
- Render metadata field option input on admin_resource_type_field_edit.php
- render_resource_type_selector_question() : void
- Renders a resource type selection dropdown
- add_download_column() : mixed
- Render the Download info for the resource tool (on view page)
- render_resource_view_image() : void
- Render image on view.php
- render_resource_tools_size_download_options() : void
- Render the resource tools for preview sizes
- toast_notification() : void
- Adds script to display toast notification. Note: Must be included after header.php.
- render_icon_wrapper_component() : void
- render_header_links() : void
- Render the header's primary navigation. In responsive mode, all the nav links are being overflown.
- get_smart_fc_branch_trail() : array<string|int, mixed>
- Helper function for smart featured collections to update $branch_trail with all parent nodes of the selected node
- get_report_name() : string
- Retrieves the name of a report
- get_reports() : array<string|int, mixed>
- Retrieves an array of reports from the database.
- do_report() : void|string|array<string|int, mixed>
- do_report - Runs the specified report. This is used in a number of ways:- 1) Outputs an HTML table to screen ($download = false) 2) Produces a CSV - for direct download from team_report.php - captured and saved as a CSV file if called by send_periodic_report_emails() and over 100 rows are returned
- create_periodic_email() : mixed
- Creates a new automatic periodic e-mail report
- send_periodic_report_emails() : void
- Sends periodic report emails to users based on configured schedules.
- delete_periodic_report() : bool
- Deletes a periodic report for the current user.
- unsubscribe_user_from_periodic_report() : bool
- Unsubscribes a user from a specified periodic report.
- get_translated_activity_type() : string
- Retrieves the translated version of an activity type.
- report_has_date() : bool
- Checks for the presence of date placeholders in a report's SQL query.
- report_has_date_by_id() : bool
- Checks for the presence of date placeholders in a report's sql query using the report's id.
- report_has_thumbnail() : bool
- Check if report has a "thumbnail" column in its SQL query.
- report_process_period() : array<string|int, mixed>
- Get report date range based on user input
- report_process_query_placeholders() : string
- Find and replace a reports' query placeholders with their values.
- render_pie_graph() : void
- Output the Javascript to build a pie chart in the canvas denoted by $id $data must be in the following format $data = array( "slice_a label" => "slice_a value", "slice_b label" => "slice_b value", );
- render_bar_graph() : void
- Output the Javascript to build a bar chart in the canvas denoted by $id $data must be in the following format $data = array( "point_a x value" => "point_a y value", "point_b x value" => "point_b y value",
- get_request() : mixed
- Retrieve a resource request record
- get_user_requests() : mixed
- Fetch a list of all requests for a user
- save_request() : bool
- Handle the posted request form, when saving a request in the admin area.
- get_requests() : mixed
- Fetch a list of requests assigned to the logged in user
- email_collection_request() : bool
- Email a collection request to the team responsible for dealing with requests. Request mode 0 only (non managed).
- managed_collection_request() : bool
- Request mode 1 - quests are managed via the administrative interface. Sends an e-mail but also logs the request in the request table.
- email_resource_request() : void|false|string
- E-mails a basic resource request for a single resource (posted) to the team (not a managed request)
- get_valid_custom_fields() : array<string|int, mixed>
- Get collection of valid custom fields. A valid fields has at least the expected field properties
- gen_custom_fields_html_props() : array<string|int, mixed>
- Generate HTML properties for custom fields. These properties can then be used by other functions like render_custom_fields or process_custom_fields_submission
- process_custom_fields_submission() : array<string|int, mixed>
- Process posted custom fields
- can_use_owner_field() : bool
- Initialisation and system check if configuration is correctly enabled to use the owner field and mappings logic.
- get_notification_users_by_owner_field() : array<string|int, mixed>
- Get users to notify for requested resources "owned" by particular groups. Configurable using a metadata field ($owner_field) and a defined map ($owner_field_mappings).
- resource_request_visible() : bool
- Can the logged in user see the request specified?
- send_research_request() : void
- Sends a research request by inserting it into the requests table and notifying the relevant users.
- get_research_requests() : array<string|int, mixed>
- Retrieves research requests from the database, optionally filtering by a search term and sorting the results by a specified field.
- get_research_request() : array<string|int, mixed>|false
- Retrieves a research request by its reference number, returning its details including name, description, deadline, contact information, user assignment, status, and custom fields.
- save_research_request() : bool
- Saves a research request by updating its status and assigned user, sending notifications to the originator if the status changes, and optionally deleting the request or copying existing collection resources.
- get_research_request_collection() : int|false
- Retrieves the collection reference associated with a given research request.
- set_research_collection() : void
- Updates the collection reference associated with a specified research request.
- get_resource_path() : string
- Get resource path / resource URL / download URL for this resource
- get_resource_data() : mixed
- get_resource_data_batch() : array<string|int, mixed>
- get_resource_data_batch - get data from resource table for all resource IDs
- put_resource_data() : bool
- Updates $resource with the name/value pairs in $data - this relates to the resource table column, not metadata.
- create_resource() : mixed
- create_resource
- update_hitcount() : mixed
- save_resource_data() : true|array<string|int, mixed>
- Save resource data
- set_resource_defaults() : bool
- Set resource defaults. Optional, a list of field IDs can be passed on to only update certain fields.
- save_resource_data_multi() : true|array<string|int, mixed>
- Batch save resources in a collection
- update_field() : bool
- Updates resource field. Works out the previous value, so this is not efficient if we already know what this previous value is (hence it is not used for edit where multiple fields are saved)
- email_resource() : mixed
- delete_resource() : mixed
- get_resource_type_field() : bool|array<string|int, mixed>
- Returns field data from resource_type_field for the given field
- get_resource_field_data() : array<string|int, mixed>|bool
- get_resource_field_data
- get_resource_field_data_batch() : array<string|int, mixed>
- get_resource_field_data_batch - Get all resource data for the given resources
- get_resource_types() : array<string|int, mixed>
- Return an array of resource types that this user has access to
- get_all_resource_types() : array<string|int, mixed>
- Returns all resources types
- clear_resource_data() : mixed
- copy_resource() : bool|int
- Create a new resource, copying all data from the resource with reference $from.
- resource_log() : int
- Log resource activity
- get_resource_log() : array<string|int, mixed>
- Get resource log records. The standard field titles are translated using $lang. Custom field titles are i18n translated.
- get_resource_type_name() : mixed
- get_resource_custom_access() : mixed
- get_resource_custom_access_users_usergroups() : array<string|int, mixed>
- Retrieves custom access settings for users and user groups associated with a specific resource.
- save_resource_custom_access() : void
- Saves custom access settings for a specific resource.
- get_custom_access() : mixed
- Lookup custom access value for a resource
- get_themes_by_resource() : array<string|int, mixed>
- Determine the featured collections and public collections a resource is associated with.
- update_resource_type() : mixed
- get_exiftool_fields() : array<string|int, mixed>
- Returns a list of exiftool fields, which are basically fields with an 'exiftool field' set.
- createTempFile() : bool|string
- Create a temporary copy of the file in the tmp folder (ie. the usual filestore/tmp/)
- stripMetadata() : bool|string
- Strips metadata from file
- write_metadata() : string|bool
- Writes metadata to a specified file using ExifTool.
- delete_exif_tmpfile() : mixed
- Delete Exif temp file
- update_resource() : int|bool
- Updates a resource with a new file and its associated metadata.
- import_resource() : int|bool
- Imports a resource from the specified path and updates its details.
- get_alternative_files() : array<string|int, mixed>|bool
- Retrieves alternative files associated with a specified resource.
- get_alternative_files_by_filename() : array<string|int, mixed>
- Search the alternative file records for matching filenames Alternative files can be optionally filtered by the Resource ID or by collection
- add_alternative_file() : int
- Add alternative file
- delete_alternative_file() : bool
- delete_alternative_file
- get_alternative_file() : array<string|int, mixed>|bool
- Retrieves a specific alternative file associated with a given resource.
- save_alternative_file() : void
- Updates the details of an alternative file in the database.
- user_rating_save() : void
- Saves a user rating for a given resource.
- get_field() : bool|array<string|int, mixed>
- A standard field title is translated using $lang. A custom field title is i18n translated.
- get_keyword_from_option() : string
- Retrieves the keyword that will be indexed for a given field option.
- get_resource_access() : int
- Retrieves the access level for the currently logged-in user for a specified resource.
- get_custom_access_user() : mixed
- Retrieves the custom access level for a specific user on a given resource.
- edit_resource_external_access() : bool
- Edits the external access settings for a given resource.
- resource_download_allowed() : bool
- For the given resource and size, can the current user download it? resource type and access may already be available in the case of search, so pass them along to get_resource_access to avoid extra queries $resource can be a resource-specific search result array.
- get_edit_access() : bool
- Check if current user has edit access to a resource. Checks the edit permissions (e0, e-1 etc.) and also the group edit filter which filters edit access based on resource metadata.
- filter_match() : int
- In the given filter string, does name/value match? Returns: 0 = no match for name 1 = matched name but value was not present 2 = matched name and value was correct
- log_diff() : string
- Check changes made to a metadata field and create a nice user friendly summary
- get_metadata_templates() : array<string|int, mixed>
- Retrieves a list of all metadata templates for a specified resource type.
- get_resource_collections() : array<string|int, mixed>
- Retrieves a list of collections that a resource is used in for the specified resource reference.
- download_summary() : array<string|int, mixed>
- Retrieves a summary of downloads for a given resource, categorized by usage type.
- check_use_watermark() : mixed
- autocomplete_blank_fields() : bool|array<string|int, mixed>
- Fill in any blank fields for the resource.
- get_page_count() : mixed
- update_disk_usage() : bool
- Updates the disk usage for a specified resource by calculating the total size of the files in the resource's directory and storing the result in the resource table.
- update_disk_usage_cron() : bool|void
- Update disk usage for all resources that have not yet been updated or have not been updated in the past 30 days.
- get_total_disk_usage() : int
- Returns the total disk space used by all resources on the system
- overquota() : array<string|int, mixed>|bool
- Calculate if the quota set by $disksize in the configuration has been exceeded.
- get_original_imagesize() : array<string|int, mixed>|bool
- Get size of specified image file
- generate_resource_access_key() : string|bool
- Generates an external access key for a resource, allowing specified access to a user or group.
- get_resource_external_access() : array<string|int, mixed>
- Retrieves all external access keys granted for a specific resource.
- delete_resource_access_key() : mixed
- resource_type_config_override() : mixed
- update_archive_status() : void
- Update the archive state of resource(s) and log this
- delete_resources_in_collection() : mixed
- update_related_resource() : bool
- Update related resources - add new related resource(s) or delete existing
- can_share_resource() : bool
- Check if sharing of resource is permitted
- delete_resource_custom_access_usergroups() : mixed
- Delete all usergroup specific access to resource $ref
- truncate_join_field_value() : string
- Truncate the field for insertion into the main resource table field
- get_video_snapshots() : array<string|int, mixed>|int
- Check whether a resource (of a video type) has any snapshots created.
- resource_file_readonly() : bool
- Check if resource file is read-only because it's part of the filestore template threshold
- delete_resource_custom_user_access() : mixed
- get_video_info() : mixed
- copyAllDataToResource() : bool
- Provides the ability to copy any metadata field data from one resource to another.
- copy_locked_data() : array<string|int, mixed>
- Update resource data for 'locked' fields from last edited resource. Used for upload_then_edit
- copy_locked_fields() : void
- Update resource metadata for 'locked' fields from last edited resource.
- copyRelatedResources() : void
- Copy related resources from one resource to another
- process_edit_form() : mixed
- update_timestamp() : mixed
- get_extension() : string
- Get resource file extension from the database or use JPG, for download
- get_last_resource_edit_array() : array<string|int, mixed>|false
- Obtain details of the last resource edited in the given array of resource ids
- get_default_archive_state() : int
- Get the default archive state for new resources
- save_original_file_as_alternative() : bool|int
- Save the original file being replaced, as an alternative file
- replace_resource_file() : bool
- Replace the primary resource file with the file located at the path specified
- get_resource_all_image_sizes() : array<string|int, mixed>
- Return all sizes available for a specific resource. Multi page resources should have each page size included as well in the output.
- sanitize_date_field_input() : mixed
- download_link_generate_key() : string
- Create a temporary download key for a specific user or key and resource combination Used when both $watermark_open and $terms_download are enabled
- download_link_check_key() : string
- Check the download key for a specific user/resource combination
- filter_check() : bool
- Check if a given set of nodes meets the conditions set for the provided filter NOte that all resource_nodes for a resource should be passed to check if a filter is matched
- update_node_hitcount_from_search() : mixed
- copy_hitcount_to_live() : mixed
- get_image_sizes() : array<string|int, mixed>
- Returns a table of available image sizes for resource $ref. The standard image sizes are translated using $lang. Custom image sizes are i18n translated.
- get_related_resources() : array<string|int, mixed>
- Return an array of resource references that are related to resource $ref
- get_field_options() : array<string|int, mixed>|bool
- Get available options for fixed list field types
- get_data_by_field() : string|array<string|int, mixed>|Generator
- Get the resource data value for a field and a specific resource or get the specified field for all resources in the system
- get_all_image_sizes() : mixed
- image_size_restricted_access() : mixed
- get_fields() : array<string|int, mixed>
- Returns a list of fields with refs matching the supplied field refs.
- get_hidden_indexed_fields() : mixed
- get_OR_fields() : mixed
- get_nopreview_html() : string
- Returns the HTML necessary to represent a resource with the given extension when no image preview exists.
- get_resource_type_fields() : array<string|int, mixed>
- Gets all metadata fields, optionally for a specified array of resource types
- notify_resource_change() : mixed
- add_verbatim_keywords() : mixed
- metadata_field_edit_access() : bool
- Check the current user's edit access to given metadata field ID
- get_download_filename() : string
- Work out the filename to use, based on the download_filename_format configuration option, when downloading the specified resource file with the given settings
- get_resource_type_from_extension() : int
- Get resource type ID based on extension $mappings = array(resource_type_id => array(allowed_extensions));
- canSeePreviewTools() : bool
- Helper function for Preview tools feature. Checks all necessary permissions or options in order to tell the system whether PreviewTools panel should be displayed
- canSeeAnnotationsFields() : array<string|int, mixed>
- Helper function to determine if annotations are to be displayed.
- alt_is_ffmpeg_alternative() : bool
- Determine if a video alternative was created from $ffmpeg_alternatives settings.
- create_resource_type_field() : bool|int
- Create a new resource type field with the specified name of the required type
- metadata_field_view_access() : bool
- Check if user has view access to metadata field
- get_workflow_states() : array<string|int, mixed>
- Utility to get all workflow states available in the system.
- get_workflow_state_names() : array<string|int, mixed>
- delete_resource_type_field() : bool|string
- Delete the specified metadata field. Also delets any node or resource_data rows associated with that field
- get_resource_table_joins() : mixed
- update_resource_lock() : mixed
- get_resource_lock_message() : mixed
- get_external_shares() : array<string|int, mixed>
- Get details of external shares
- get_video_duration() : float
- Get video duration
- relate_all_resources() : bool
- Relate all resources in the passed array with each other
- update_resource_type_field_order() : void
- Apply new order to metadata fields
- update_resource_type_order() : void
- Apply a new order to resource types
- allow_in_browser() : bool
- Check if file can be rendered in browser via download.php
- update_resource_field_column() : bool
- Update the value of the fieldXX field on resource table
- data_joins_field_value_translate_and_csv() : string|null
- Convert $data_joins (ie fieldX column) value to a user friendly version.
- process_resource_data_joins_values() : array<string|int, mixed>
- Process resource data_joins (ie fieldX columns) values
- resource_has_access_denied_by_RT_size() : bool
- Check if resource has access denied by its type and for a size.
- revert_resource_file() : bool
- Revert primary resource file based on log entry data
- apply_resource_default() : void
- When changing resource type, new resource type specific fields may become available. This function will apply any resource default values for resource type specific fields that were not previously available (i.e. not containing user data). This is used by upload then edit mode after switching resource types and also when locking the resource type with save and next.
- related_resource_pull() : array<string|int, mixed>|bool
- Get a related resource to pull images from
- get_resource_preview() : array<string|int, mixed>|bool
- Get the largest available preview URL for the given resource and the given array of sizes
- check_resources() : array<string|int, mixed>
- Check integrity of primary resource files
- get_resources_to_validate() : array<string|int, mixed>
- Get an array of all resources that require files to be validated
- acl_can_edit_resource_of_type() : bool
- Access control check that user can edit (a resource) of a particular Resource Type (RT). Main use is to hide inapplicable RTs.
- can_upload_preview_image() : bool
- Check if current user can upload a preview image
- resource_has_preview_source() : bool
- Check if a resource has a file to derive previews from.
- acl_can_edit_contributed_by() : bool
- Access control check that user can edit a resources 'Contributed by' field
- resolve_soundex() : string|false
- Resolves the most commonly used keyword that sounds like the given keyword.
- suggest_refinement() : array<string|int, mixed>
- Suggests search refinements based on common keywords from a set of resource references.
- get_advanced_search_fields() : array<string|int, mixed>
- Retrieves a list of fields suitable for advanced searching.
- get_advanced_search_collection_fields() : array<string|int, mixed>
- Retrieves a list of fields suitable for advanced searching within collections.
- search_form_to_search_query() : string
- Constructs a search query string from the posted search form data.
- refine_searchstring() : string
- Refines the search string to eliminate duplicates and ensure proper formatting.
- compile_search_actions() : array<string|int, mixed>
- Compiles a list of actions based on the provided top actions and search parameters.
- search_filter() : PreparedStatementQuery
- Constructs a SQL filter based on the provided search parameters.
- search_special() : mixed
- Processes special searches and constructs a corresponding SQL query.
- resolve_nodes_from_string() : array<string|int, mixed>
- Function used to create a list of nodes found in a search string
- rebuild_specific_field_search_from_node() : string
- Utility function which helps rebuilding a specific field search string from a node element
- search_get_previews() : mixed
- get_upload_here_selected_nodes() : mixed
- get_default_search_states() : array<string|int, mixed>
- get the default archive states to search
- get_filter_sql() : PreparedStatementQuery
- Get the required search filter sql for the given filter for use in do_search()
- split_keywords() : mixed
- cleanse_string() : string
- Removes characters from a string, for example full stops, prior to keyword splitting - {@see split_keywords()}.
- resolve_keyword() : int|bool
- Resolve keyword
- add_partial_index() : array<string|int, mixed>
- Generates a list of keywords for indexing, including all possible infixes for each keyword in the provided list.
- get_suggested_keywords() : array<string|int, mixed>
- Suggests complete existing keywords based on a partial search term.
- get_related_keywords() : array<string|int, mixed>
- Retrieves keywords related to a given keyword reference.
- get_grouped_related_keywords() : array<string|int, mixed>
- Retrieves keywords and their related keywords, optionally filtered by specific keywords.
- save_related_keywords() : bool
- Saves the related keywords for a specified keyword.
- get_simple_search_fields() : array<string|int, mixed>
- Retrieves a list of fields suitable for the simple search box.
- get_fields_for_search_display() : array<string|int, mixed>
- Retrieves a list of fields/properties suitable for search display based on the provided field references.
- get_filters() : array<string|int, mixed>
- Get all defined filters (currently only used for search)
- get_filter() : array<string|int, mixed>
- Get filter summary details
- get_filter_rules() : array<string|int, mixed>
- Get filter rules for use in search
- get_filter_rule() : array<string|int, mixed>
- Get filter rule
- save_filter() : bool|int
- Save filter, will return existing filter ID if text matches already migrated
- save_filter_rule() : bool|int
- Save filter rule, will return existing rule ID if text matches already migrated
- delete_filter() : bool|array<string|int, mixed>
- Delete specified filter
- delete_filter_rule() : bool|int
- Delete specified filter_rule
- copy_filter() : bool|int
- Copy specified filter_rule
- update_search_from_request() : string
- Add POST/GET parameters into search string. Moved from pages/search.php
- get_search_default_restypes() : array<string|int, mixed>
- Retrieves the default resource types for search functionality.
- get_selectedtypes() : array<string|int, mixed>
- Retrieves the selected resource types for the search functionality.
- render_advanced_search_buttons() : void
- Renders the buttons for the advanced search form.
- check_order_by_in_table_joins() : string
- If a "fieldX" order_by is used, check it's a valid value.
- get_collections_resource_count() : array<string|int, mixed>
- Get collection total resource count for a list of collections
- get_search_params() : mixed
- Get all search request parameters. Note that this does not escape the parameters which must be sanitised using e.g. htmlspecialchars() or urlencode() before rendering on page
- is_not_wildcard_only() : bool
- Helper function to check a string is not just the asterisk.
- search_title_node_processing() : string
- Convert node searches into a friendly syntax. Used by search_title_processing.php
- setup_search_chunks() : void
- Allow $fetchrows as supplied to do_search() to support an integer or array. If integer then search will recieve the number of rows with no offset.
- log_keyword_usage() : mixed
- Log which keywords are used in a search
- set_search_order_by() : string
- Validate and set the order_by for the current search from the requested values passed to do_search()
- prepare_regex_search_string() : string
- Escape and process a string from ResourceSpace search syntax to regex syntax Wildcards are replaced with '.*?' - any character 0 or more times Multiple keyword matches are split into an OR group Word boundaries are added to avoid unintended wildcards.
- convert_search_form_date_to_search_query() : string
- Utility converter between sumitted date input and ResourceSpace search query
- set_slideshow() : bool|int
- Create/ Update a slideshow image record. Use NULL for $ref to create new records.
- delete_slideshow() : bool
- Delete slideshow record
- reorder_slideshow_images() : bool
- Function used to re-order slideshow images
- get_slideshow_image_file_path() : string
- Get the full path for the slideshow image file
- acl_can_manage_tabs() : bool
- Access control check if user is allowed to manage system tabs.
- get_tabs_by_refs() : array<string|int, mixed>
- Get entire tab records for a list of IDs
- get_tabs_with_usage_count() : array<string|int, mixed>
- Get tabs (paged) based on some criteria (currently only order by and limit).
- get_all_tabs() : array<string|int, mixed>
- Get all tab records, sorted by the order_by column
- get_tab_name_options() : array<string|int, mixed>
- Get list of all tabs sorted based on current configuration. This always adds a fake record (ref #0) to indicate no assignment.
- sort_tabs_as_configured() : array<string|int, mixed>
- Sort list of tab names (preserving their key ID)
- create_tab() : bool|int
- Create a new system tab record NOTE: order_by should only be set when re-ordering the set by the user. {@see sql_reorder_records('tab', $refs)}
- delete_tabs() : bool
- Delete system tabs.
- save_tab() : bool
- Update an existing tab.
- resource_random_jpg() : bool
- Generates a random JPEG image for a given resource with random background color and text.
- create_random_image() : array<string|int, mixed>
- Generate a random image which can be used during testing (e.g to upload, or create previews for)
- create_random_video() : array<string|int, mixed>
- Generate a random video which can be used during testing (e.g to upload, or create previews for)
- test_log() : void
- Debug logs for ResourceSpace automated tests
- test_get_file_id() : int
- Get the test files' ID (from its file name)
- validate_user() : bool|array<string|int, mixed>
- Validate user - check we have a valid user based on SQL criteria e.g. session that is passed in as $user_select_sql Will always return false if matches criteria but the user account is not approved or has expired
- setup_user() : bool
- Given an array of user data loaded from the user table, set up all necessary global variables for this user including permissions, current collection, config overrides and so on.
- get_users() : array<string|int, mixed>|object
- Returns a user list. Group or search term is optional. The standard user group names are translated using $lang. Custom user group names are i18n translated.
- get_users_with_permission() : array<string|int, mixed>
- Returns all the users who have the permission $permission.
- get_user_by_email() : array<string|int, mixed>
- Retrieve user records by e-mail address
- get_user_by_username() : mixed
- Retrieve user ID by username
- get_usergroups() : array<string|int, mixed>
- Returns a list of user groups. The standard user groups are translated using $lang. Custom user groups are i18n translated.
- get_usergroup() : mixed
- Returns the user group corresponding to the $ref. A standard user group name is translated using $lang. A custom user group name is i18n translated.
- get_user() : array<string|int, mixed>|bool
- Return the user group record matching $ref
- save_user() : bool|string
- Function used to update or delete a user.
- email_user_welcome() : void
- E-mail the user the welcome message on account creation.
- email_reset_link() : bool|string
- Email password reset link to the user
- auto_create_user_account() : bool
- Automatically creates a user account The request can be auto approved if $auto_approve_accounts is true Otherwise the approval is managed by admins via notification messages and/or emails
- email_user_request() : bool
- Send user request to admins in form of notification messages and/or emails Send email confirmation to requesting user
- user_limit_reached() : bool
- Check to see if the user limit has been reached.
- new_user() : bool|int
- Create a new user *
- get_active_users() : array<string|int, mixed>
- Returns a list of active users
- change_password() : mixed
- Sets a new password for the current user.
- make_password() : string
- Generate a password using the configured settings.
- bulk_mail() : string
- Send a bulk e-mail using the bulk e-mail tool.
- get_user_log() : array<string|int, mixed>
- Returns a user action log for $user.
- resolve_userlist_groups() : string
- Given an array or comma separated user list (from the user select include file) turn all Group: entries into fully resolved list of usernames.
- resolve_userlist_groups_smart() : string
- Given a comma separated user list (from the user select include file) turn all Group: entries into fully resolved list of usernames.
- remove_groups_smart_from_userlist() : string
- Remove smart lists from the provided user lists.
- check_password() : mixed
- Checks that a password conforms to the configured paramaters.
- resolve_users() : string
- For a given comma-separated list of user refs (e.g. returned from a group_concat()), return a string of matching usernames.
- check_access_key() : bool
- Verify a supplied external access key
- check_access_key_collection() : bool
- Check access key for a collection. For a featured collection category, the check will be done on all sub featured collections.
- make_username() : string
- Generates a unique username for the given name
- get_registration_selectable_usergroups() : array<string|int, mixed>
- Returns a list of user groups selectable in the registration . The standard user groups are translated using $lang. Custom user groups are i18n translated.
- open_access_to_user() : bool
- Give the user full access to the given resource. Used when approving requests.
- open_access_to_group() : bool
- Give the user full access to the given resource. Used when approving requests.
- resolve_open_access() : void
- Grants open access to the user list for the specified resource.
- remove_access_to_user() : bool
- Remove any user-specific access granted by an 'approve'. Used when declining requests.
- user_email_exists() : bool
- Returns true if a user account exists with e-mail address $email
- resolve_user_emails() : array<string|int, mixed>
- Return an array of emails from a list of usernames and email addresses.
- mark_email_as_invalid() : bool
- Finds all users with matching email and marks them as having an invalid email
- check_email_invalid() : bool
- Checks if the email entered is marked as invalid for any users
- create_password_reset_key() : string
- Creates a reset key for password reset e-mails
- get_rs_session_id() : mixed
- For anonymous access - a unique session key to identify the user (e.g. so they can still have their own collections)
- get_notification_users() : array<string|int, mixed>
- Returns an array of users (refs and emails) for use when sending email notifications (messages that in the past went to $email_notify, which can be emulated by using $email_notify_usergroups)
- verify_antispam() : bool
- Validates the user entered antispam code
- check_share_password() : bool
- Check that access for given external share key is correct
- offset_user_local_timezone() : string
- Offset a datetime to user local time zone
- checkPermission_anonymoususer() : bool
- Returns whether a user is anonymous or not
- checkPermission_dashadmin() : bool
- Does the current user have the ability to administer the dash (the tiles for all users)
- checkPermission_dashuser() : bool
- Can the user manage their own dash tiles.
- checkPermission_dashmanage() : bool
- Can the user manage their dash?
- checkPermission_dashcreate() : bool
- Can the user create tiles?
- checkperm() : bool
- Check that the user has the $perm permission
- checkperm_user_edit() : bool
- Check if the current user is allowed to edit user with passed reference
- checkperm_login_as_user() : bool
- Check if the current user has sufficient permissions to log in as the specified user
- internal_share_access() : bool
- Determine if this is an internal share access request
- save_usergroup() : mixed
- Save changes to a usergroup or create usergroup
- copy_usergroup_permissions() : mixed
- Copy the permissions string from another usergroup
- set_user_profile() : bool
- Set user's profile image and profile description (bio). Used by ../pages/user/user_profile_edit.php to setup user's profile.
- delete_profile_image() : void
- Delete a user's profile image. This will first remove the file and then update the db to clear the existing value.
- get_profile_image() : string
- Generate the url to the user's profile image. Fetch the url by the user's id or by the profile image filename.
- get_profile_text() : string
- Return user profile for a defined user.
- get_languages_notify_users() : array<string|int, mixed>
- load language files for all users that need to be notified into an array - use for message and email notification load in default language strings first and then overwrite with preferred language strings
- get_upload_url() : string
- Generate upload URL - alters based on $upload_then_edit setting and external uploads
- emulate_user() : void
- Used to emulate system users when accessing system anonymously or via external shares Sets global array such as $userpermissions, $username and sets any relevant config options
- is_authenticated() : mixed
- get_approver_usergroups() : array<string|int, mixed>
- Returns an array of the user groups the supplied user group acts as an approver for.
- get_usergroup_approvers() : array<string|int, mixed>
- Returns an array of user groups who act as user request approvers to the user group supplied.
- get_users_by_permission() : array<string|int, mixed>
- Retrieve all user records in groups with/without the specified permissions
- is_anonymous_user() : bool
- Determine whether user is anonymous user
- get_users_by_preference() : array<string|int, mixed>
- Retrieve all user records with the user preference specified
- get_default_notify_states() : array<string|int, mixed>
- Get the default notification workflow states for the current user. Used by setup_user() and get_user_actions() if no user preference has been set
- generate_temp_download_key() : string
- Generate a temporary download key for user. Used to enable temporary resource access to a file via download.php so that API can access resources after calling get_resource_path()
- validate_temp_download_key() : bool
- Validate the provided download key to authenticate a download or override an access check.
- setup_command_line_user() : bool
- Set up a dummy user with required permissions etc. to pass permission checks if running scripts from the command line
- update_user_access() : bool
- Update user table to record access by a user
- checkPermission_manage_users() : bool
- Check if the user can manage users.
- get_processing_message() : false|array<string|int, mixed>
- Get the processing status message for the current user.
- set_processing_message() : mixed
- can_set_admin_usergroup() : bool
- Consider if the current user is able to escalate the permissions of a user to the level of a "super admin".
- cors_is_origin_allowed() : bool
- Checks if the origin matches a whitelist entry, supporting wildcards like "*.example.com".
- delete_usergroup() : bool
- Delete a user group and associated records.
- browser_check() : mixed
- Check that this is a real browser by executing JS to set an expected cookie.
- xor_base64_encode() : string
- Obfuscates a string using a fixed XOR pattern and encodes it in Base64.
- load_site_text_for_usergroup() : void
- Load site text for a user group. To preserve the original state of global language values, this function will always revert previous changes first.
- get_video_resolution() : array<string|int, mixed>
- Get video resolution and framerate using FFMpeg
- display_video_subtitles() : void
- Generate HTML to display subtitles in playback of a video resource.
- generate_videojs_options() : string|false
- Generate JSON array of VideoJS options to be used in the data-setup attribute
- HookAction_datesAllInitialise() : mixed
- HookAction_datesCronCron() : mixed
- HookAction_datesCron_copy_hitcountCron() : mixed
- HookAdobe_linkAllInitialise() : mixed
- HookAdobe_linkDownloadProvideusercredentials() : mixed
- HookAdobe_linkDownloadCookies_notification_bypass() : mixed
- HookAdobe_linkDownloadBlockwatermark() : mixed
- HookAdobe_linkDownloadAllow_in_browser() : mixed
- HookAdobe_linkUpload_batchProvideusercredentials() : mixed
- HookAdobe_linkUpload_batchCookies_notification_bypass() : mixed
- HookAdobe_linkUpload_batchModify_upload_file() : mixed
- HookAdobe_linkViewBefore_footer_always() : mixed
- Replace download links with code to support importing resources into Adobe CC
- HookAdobe_linkViewDownloadbuttonreplace() : mixed
- HookAdobe_linkViewOrigdownloadlink() : mixed
- HookAdobe_linkViewReplacepreviewlink() : mixed
- adobe_link_genkey() : mixed
- adobe_link_check_credentials() : mixed
- HookApi_webhooksEditExtra_edit_buttons() : mixed
- HookApi_webhooksEditRedirectaftersave() : mixed
- HookApi_webhooksEditUploadreviewabortnext() : mixed
- HookApi_webhooksEditRedirectaftersavetemplate() : mixed
- HookAutoassign_mrequestsAllAutoassign_individual_requests() : mixed
- HookAutoassign_mrequestsAllAutoassign_collection_requests() : mixed
- HookAutoassign_mrequestsAllBypass_end_managed_collection_request() : mixed
- HookAutoassign_mrequestsAllExport_add_tables() : mixed
- HookAutoassign_mrequestsAllOn_delete_user() : mixed
- get_mapped_fields() : mixed
- get_mapped_user_by_field() : mixed
- HookBrand_guidelinesAdmin_group_permissionsAdditionalperms() : mixed
- HookBrand_guidelinesAllInitialise() : mixed
- HookBrand_guidelinesAllHandleuserref() : mixed
- HookBrand_guidelinesContentRender_custom_fields_default_case_override() : bool
- Render decorator of custom fields used by Brand Guidelines
- HookBrand_guidelinesContentProcess_custom_fields_submission_validator() : false|string
- Validate custom fields' submitted input.
- HookBrand_guidelinesEditEditbeforeheader() : void
- Ensure we always pass along the Brand Guidelines callback URL, if one was provided.
- HookBrand_guidelinesEditUploadreviewabortnext() : bool
- Hooks onto the upload review workflow (for upload then edit mode) when "save and next" is carried out and adds the first resource ID (which is supposed to be the last uploaded resource, for brand guidelines) to the manage content callback (redirect URL).
- HookBrand_guidelinesEditRedirectaftersavetemplate() : bool
- Hooks onto the edit then upload mode and changes the redirect URL to the provided callback. This will allow the upload_batch page to use it once the file upload has finished.
- HookBrand_guidelinesGuidelinesExtra_videojs_content_html() : mixed
- HookBrand_guidelinesUpload_batchModify_redirecturl() : mixed
- Ensure we always pass along the Brand Guidelines callback URL, if one was provided.
- HookBrand_guidelinesUpload_batchPostUploadActions_before_csl_redirurl_js() : void
- IMPORTANT: Directly within Javascript world on the upload_batch page!
- HookClipAdmin_group_permissionsAdditionalperms() : mixed
- HookClipAllAddspecialsearch() : mixed
- HookClipAllSearch_pipeline_setup() : mixed
- HookClipAllSearchbarafterbuttons() : mixed
- HookClipAllAfterpreviewcreation() : void
- Runs vector generation automatically after preview creation, if configured.
- HookClipAllCron() : mixed
- HookClipAllBeforedeleteresourcefromdb() : mixed
- HookClipAllAddtriggerablejob() : array<string|int, mixed>
- Hook into offline jobs list to add custom job
- HookClipSearchSearch_header_after_actions() : mixed
- HookClipViewCustompanels() : mixed
- get_vector() : array<string|int, mixed>|false
- Sends an image file or text input to the CLIP vector service and returns the resulting vector.
- vector_visualise() : string
- Generates a simple visual representation of a CLIP vector as a 64-character string. This helps visualise differences between vectors in a human-readable form.
- clip_generate_vector() : bool
- Generates and stores a CLIP vector for a given resource.
- clip_tag() : bool
- Auto-tags and titles a resource using CLIP vector search.
- clip_generate_missing_vectors() : mixed
- clip_count_vectors() : int
- Returns a count of vectors in the system
- clip_missing_vectors() : int
- Returns a count of vectors missing
- clip_vector_cleanup() : void
- Removes orphaned vectors - those that do not have a valid resource specified either because the resource has been removed or because the list of resource types for which vectors are created has been changed.
- HookConditional_termsAllInitialise() : mixed
- HookConditional_termsAllExtra_checks() : mixed
- HookConditional_termsCheckAddinstallationcheck() : mixed
- HookConditional_termsViewDownloadlink() : mixed
- conditional_terms_config_check() : mixed
- api_consentmanager_get_consents() : mixed
- api_consentmanager_delete_consent() : mixed
- api_consentmanager_batch_link_unlink() : mixed
- api_consentmanager_link_consent() : mixed
- api_consentmanager_unlink_consent() : mixed
- api_consentmanager_create_consent() : mixed
- api_consentmanager_get_consent() : mixed
- api_consentmanager_update_consent() : mixed
- api_consentmanager_get_all_consents() : mixed
- api_consentmanager_get_all_consents_by_collection() : mixed
- api_consentmanager_save_file() : mixed
- HookConsentmanagerAdmin_group_permissionsAdditionalperms() : mixed
- HookConsentmanagerAllExport_add_tables() : mixed
- HookConsentmanagerAllRender_actions_add_collection_option() : mixed
- HookConsentmanagerAllHandleuserref() : mixed
- HookConsentmanagerAllCron() : mixed
- HookConsentmanagerAllAddspecialsearch() : mixed
- HookConsentmanagerEditEndofmetadataaddcustomfield() : mixed
- HookConsentmanagerEditAftersaveresourcedata() : bool|array<string|int, mixed>
- HookConsentmanagerEditCopy_locked_data_extra() : bool|array<string|int, mixed>
- HookConsentmanagerTeam_homeCustomteamfunction() : mixed
- HookConsentmanagerUser_preferencesAdd_user_preference_page_def() : mixed
- HookConsentmanagerViewCustompanels() : mixed
- consentmanager_check_read() : bool
- Check if the user should have read access to a consent record
- consentmanager_check_write() : bool
- Check if the user should have write access to a consent record
- consentmanager_get_consents() : array<string|int, mixed>|bool
- Get a list of consents for a given resource
- consentmanager_delete_consent() : bool
- Delete a consent record
- consentmanager_create_consent() : int|bool
- Create a new consent record
- consentmanager_link_consent() : bool
- Link a consent record with a resource
- consentmanager_unlink_consent() : bool
- Unlink a consent record from a resource
- consentmanager_batch_link_unlink() : bool
- Link/unlink all resources in a collection with a consent record
- consentmanager_get_consent() : array<string|int, mixed>|bool
- Retrieve a consent record
- consentmanager_update_consent() : bool
- Update a consent record
- consentmanager_get_all_consents_by_collection() : array<string|int, mixed>|bool
- Fetch all consent records linked to resources in a collection
- consentmanager_get_all_consents() : array<string|int, mixed>|bool
- Fetch all consent records, optionally filtered by search text
- consentmanager_get_all_consents_grouped() : array<string|int, mixed>|bool
- Fetch all consent records grouped by if they are expiring or not
- consentmanager_save_file() : bool
- Save a file associated with a consent record
- consentmanager_get_expiring_consents() : array<string|int, mixed>|bool
- Fetch all expiring consent records
- consentmanager_set_consent_expiration_notice() : bool
- Sets expiration notice sent flag on consent records
- consentmanager_get_expired_consent_resources() : array<string|int, mixed>|bool
- Fetch expired consent records
- consentmanager_process_expiry_notifications() : bool
- Process expiring consent records and send a notification/email
- consentmanager_process_expired_auto_archive() : bool
- Process expired consent records and archive them
- get_consent_file_path() : mixed
- HookCookies_notificationAllHandleuserref() : mixed
- HookCookies_notificationAllAfteruicenter() : mixed
- HookCookies_notificationLoginPostlogout() : mixed
- HookCookies_notificationAllRemoveuseridcookie() : mixed
- HookCsv_uploadTeam_resourceMenuitem() : mixed
- csv_upload_process() : bool
- Process the uploaded CSV
- csv_upload_get_info() : mixed
- csv_upload_log() : void
- Append text to csv log file
- get_csv_line_matching_resources() : array<string|int, mixed>
- Return the resources with the csv value found in the specified field.
- csv_check_utf8() : array<string|int, mixed>
- Checks if a passed csv file is valid for being processed, needs to be UTF-8 and if a BOM is present it will be stripped out before processing.
- csv_strip_bom() : bool
- Attempt to strip out BOM from passed csv file if present. Replaces the original file.
- meta_get_map() : mixed
- HookCsv_user_importTeam_userRender_options_to_create_users() : mixed
- csv_user_import_process() : bool
- Import users from uploaded CSV file or validate file for future use
- HookCustom_filenameAllUploadfilesuccess() : mixed
- HookDirect_LinkResource_ShareAdditionalshares() : mixed
- HookEmbeddocumentAllModified_cors_process() : mixed
- HookEmbeddocumentViewAfterresourceactions2() : mixed
- HookEmbedslideshowAllExternal_share_view_as_internal_override() : mixed
- HookEmbedslideshowCollection_shareExtra_share_options() : mixed
- HookEmbedvideoAllDirectdownloadaccess() : mixed
- HookEmbedvideoAllModified_cors_process() : mixed
- HookEmbedvideoViewAfterresourceactions() : mixed
- HookEmuAllInitialise() : mixed
- HookEmuAllExtra_checks() : mixed
- HookEmuCheckAddinstallationcheck() : mixed
- HookEmuCron_copy_hitcountAddplugincronjob() : mixed
- HookEmuEditEdithidefield() : mixed
- HookEmuEditEditbeforesectionhead() : mixed
- HookEmuAllAdditionalvalcheck() : mixed
- HookEmuEditSaveextraresourcedata() : mixed
- HookEmuEditAftersaveresourcedata() : bool|array<string|int, mixed>
- Emu plugin attaching to the 'aftersaveresourcedata' hook IMPORTANT: 'aftersaveresourcedata' hook is called from both save_resource_data() and save_resource_data_multi()!
- HookEmuEditcopylockedfieldsaddfields() : bool|array<string|int, mixed>
- When uploading a batch of resources in upload then edit mode, locked fields are copied between resources in the batch.
- HookEmuViewRenderfield() : mixed
- emu_format_date() : string
- Format date for EMu use (similar to the ISO8601 date format except the time zone designator is not included)
- get_emu_resources() : array<string|int, mixed>
- Function to retrieve all resources that have their IRN field set to a value and that are within the allowed resource types for an EMu update
- get_emu_data() : array<string|int, mixed>
- Get EMu data by using an array of IRNs.
- emu_script_log() : void
- Log EMu script history both on screen and in a file
- check_config_changed() : bool
- Utility function to figure out emu plugin configuration changed.
- add_search_criteria() : IMuTerms
- Add search criteria to any existing IMuTerms object before doing a search on a module Note: uses $emu_search_criteria which value is basic TexQL (currently only AND and OR are supported, without support for nesting)
- emu_update_resource() : bool
- Update resource with the newly imported orginal file from EMu
- emu_get_rs_mapped_field_id() : int
- Utility function to get the mapped ResourceSpace field from the mapping we set for emu plugin
- emu_update_resource_metadata_from_record() : bool
- Update a resource with all the information from an EMu record which has mapped fields to ResourceSpace
- emu_update_rs_field() : bool
- Update ResourceSpace field based on an EMu record field value (atomic/ non-atomic) Note: non-atomic values will be converted to a CSV value
- emu_convert_to_atomic() : string
- Utility function which allows ResourceSpace to convert any EMu record field to an atomic field with its value formatted as CSV
- HookFacesAdmin_group_permissionsAdditionalperms() : mixed
- HookFacesAllAddspecialsearch() : PreparedStatementQuery|false
- Hook that enables special search syntax to find resources with visually similar faces to a given resource.
- HookFacesAllAfterpreviewcreation() : void
- Runs face detection and tagging automatically after preview creation, if configured.
- HookFacesAllCron() : void
- Add face detection to the cron.
- HookFacesAllAddtriggerablejob() : array<string|int, mixed>
- Hook into offline jobs list to add custom job
- HookFacesViewCustompanels() : bool
- Adds a custom panel to the resource view page displaying detected faces and tagging options.
- faces_detect() : bool
- Detects faces in the image associated with a given resource.
- faces_tag() : bool
- Tags detected faces in a given resource based on similarity to existing tagged faces.
- api_faces_set_node() : bool
- API function to update the named person tag for a specific face using the provided node value.
- faces_detect_missing() : int
- Detect faces in resources that have not yet been processed
- faces_count_missing() : int
- Return count of images to process
- faces_count_faces() : int
- Return a count of the detected faces
- HookFalcon_linkAllInitialise() : mixed
- HookFalcon_linkAllRender_actions_add_collection_option() : mixed
- HookFalcon_linkViewAfterresourceactions() : mixed
- HookFalcon_linkViewRenderfield() : mixed
- falcon_link_publish() : array<string|int, mixed>
- Publish resources in the array to falcon.io
- falcon_link_archive() : array<string|int, mixed>
- Archive resources in falcon.io
- HookFormat_chooserAllGetdownloadurl() : mixed
- HookFormat_chooserAllReplaceuseoriginal() : mixed
- HookFormat_chooserAllSize_is_available() : mixed
- HookFormat_chooserAllReplacedownloadextension() : mixed
- HookFormat_chooserAllReplacedownloadfile() : mixed
- HookFormat_chooserAllCollection_download_modify_job() : mixed
- HookFormat_chooserViewAppend_to_download_filename_td() : mixed
- HookFormat_chooserViewAppend_to_resource_tools_size_download_options_script() : mixed
- HookFormat_chooserViewAppend_to_updateDownloadLink_js() : mixed
- HookFormat_chooserViewModifySizesArray() : array<string|int, mixed>|false
- HookFormat_chooserViewModifyAllowed_Sizes() : array<string|int, mixed>|false
- HookFormat_chooserViewModifycheckifexists() : bool
- getDefaultOutputFormat() : mixed
- Returns the default output file format to use given an optional input format.
- supportsInputFormat() : mixed
- getImageFormat() : mixed
- Returns the size record from the database specified by its ID.
- convertImage() : mixed
- Converts the file of the given resource to the new target file with the specified size. The target file format is determined from the suffix of the target file.
- sendFile() : mixed
- showProfileChooser() : void
- Show colour profile selector based on $format_chooser_profiles config
- getProfileFileName() : mixed
- failed_format_chooser_checks() : bool
- Helper function to run determine if the plugin should take effect.
- HookGoogle_analyticsAllFootertop() : mixed
- HookGoogle_analyticsAllExtra_meta() : mixed
- HookGoogle_visionAllInitialise() : mixed
- HookGoogle_visionAllAfterpreviewcreation() : void
- HookGoogle_visionAllAddtriggerablejob() : array<string|int, mixed>
- Hook into offline jobs list to add custom job
- HookGoogle_visionEditEdithidefield() : mixed
- HookGoogle_visionRecreate_previewsBeforescriptaction() : mixed
- google_visionProcess() : mixed
- google_visionTranslate() : mixed
- HookGrant_editAllCustomediteaccess() : mixed
- HookGrant_editAllModifysearcheditable() : mixed
- HookGrant_editAllExport_add_tables() : mixed
- HookGrant_editAllModifyDefaultStatusMode() : mixed
- HookGrant_editEditeditbeforeheader() : mixed
- HookGrant_editEditEditstatushide() : bool
- Needed to prevent user changing the archive stat otherwise a user with temporary edit access to an active resource could change it from active to pending submission
- HookGrant_editEditAppendcustomfields() : mixed
- HookGrant_editViewBeforepermissionscheck() : mixed
- HookImage_banksAllExtra_checks() : mixed
- HookImage_banksAllSearchfiltertop() : mixed
- HookImage_banksAllAdd_folders_to_delete_from_temp() : mixed
- HookImage_banksAllClearsearchcookies() : mixed
- HookImage_banksAllSimplesearchfieldsarehidden() : mixed
- HookImage_banksSearchSearchaftersearchcookie() : mixed
- api_licensemanager_get_licenses() : mixed
- HookLicensemanagerAdmin_group_permissionsAdditionalperms() : mixed
- HookLicensemanagerAllExport_add_tables() : mixed
- HookLicensemanagerAllRender_actions_add_collection_option() : mixed
- HookLicensemanagerAllHandleuserref() : mixed
- HookLicensemanagerAllCron() : mixed
- HookLicensemanagerAllAddspecialsearch() : mixed
- HookLicensemanagerEditEndofmetadataaddcustomfield() : mixed
- HookLicensemanagerEditAftersaveresourcedata() : bool|array<string|int, mixed>
- HookLicensemanagerEditCopy_locked_data_extra() : bool|array<string|int, mixed>
- HookLicensemanagerTeam_homeCustomteamfunction() : mixed
- HookLicensemanagerUser_preferencesAdd_user_preference_page_def() : mixed
- HookLicensemanagerViewCustompanels() : mixed
- get_license_file_path() : mixed
- licensemanager_check_read() : bool
- Check if the user should have read access to a license record
- licensemanager_check_write() : bool
- Check if the user should have write access to a license record
- licensemanager_get_licenses() : array<string|int, mixed>|bool
- Get a list of licenses for a given resource
- licensemanager_delete_license() : bool
- Delete a license record
- licensemanager_link_license() : bool
- Link a license record with a resource
- licensemanager_get_license() : array<string|int, mixed>|bool
- Retrieve a license record
- licensemanager_get_all_licenses() : array<string|int, mixed>|bool
- Fetch all license records, optionally filtered by search text
- licensemanager_get_all_licenses_grouped() : array<string|int, mixed>|bool
- Fetch all license records grouped by if they are expiring or not
- licensemanager_get_expiring_licenses() : array<string|int, mixed>|bool
- Fetch all expiring license records
- licensemanager_set_license_expiration_notice() : bool
- Sets expiration notice sent flag on license records
- licensemanager_get_expired_license_resources() : array<string|int, mixed>|bool
- Fetch expired license records
- licensemanager_process_expiry_notifications() : bool
- Process expiring license records and send a notification/email
- licensemanager_process_expired_auto_archive() : bool
- Process expired license records and archive them
- HookLightbox_previewAllAdditionalheaderjs() : mixed
- HookLightbox_previewAllReplacefullscreenpreviewicon() : mixed
- HookLightbox_previewViewRenderbeforerecorddownload() : mixed
- HookLightbox_previewViewGetpreviewurlforsize() : mixed
- HookLightbox_previewViewRenderaltthumb() : bool
- HookLightbox_previewViewRenderaltthumb
- HookLightbox_previewViewAftersearchimg() : mixed
- getPreviewURLForType() : mixed
- getPreviewURL() : mixed
- addLightBox() : mixed
- HookMuseumplusAllInitialise() : mixed
- HookMuseumplusAllAfter_setup_user() : mixed
- HookMuseumplusAllAftersaveresourcedata() : bool|array<string|int, mixed>
- MuseumPlus plugin attaching to the 'aftersaveresourcedata' hook IMPORTANT: 'aftersaveresourcedata' hook is called from both save_resource_data() and save_resource_data_multi()!
- HookMuseumplusAllAddspecialsearch() : mixed
- HookMuseumplusAllHandleuserref() : mixed
- HookMuseumplusAllAfternewresource() : mixed
- HookMuseumplusCron_copy_hitcountAddplugincronjob() : mixed
- HookMuseumplusViewRenderfield() : mixed
- do_http_request() : array<string|int, mixed>
- Execute a cURL request
- mplus_get_connection_data() : array<string|int, mixed>
- Helper function to ensure required connection data was provided
- mplus_notify() : bool
- Send notifications to users regarding MuseumPlus events (e.g script failed)
- mplus_generate_module_record_url() : string
- Generate a MuseumPlus URL for any module records without having to know the form name
- mplus_save_module_config() : void
- Save MuseumPlus modules configuration
- mplus_get_associated_module_conf() : array<string|int, mixed>
- For a list of resources, obtain the associated modules' configuration.
- mplus_get_cfg_by_module_name() : array<string|int, mixed>
- Find the module configuration using the module name.
- mplus_validate_association() : array<string|int, mixed>
- Validate a modules' record ID (technical or virtual)
- mplus_flip_struct_by_module() : array<string|int, mixed>
- Transpose a resource associated module config array to one ready to be used for batch searching via MuseumPlus API.
- mplus_compute_data_md5() : array<string|int, mixed>
- Compute the MD5 hash for the association between a resource and the combination of "module name - MpID (virtual or technical).
- mplus_log_event() : void
- Log events related to MuseumPlus integration. Any information that can be useful (even a user trying to save a resource)
- mplus_validate_resource_association_filters() : array<string|int, mixed>
- Validate a list of filter names that can be used by {@see mplus_resource_get_association_data()}.
- mplus_resource_get_data() : array<string|int, mixed>
- Get resource table columns relevant to the MuseumPlus integration
- mplus_resource_mark_validation_failed() : void
- Mark resource failed validating the MuseumPlus association
- mplus_resource_update_association() : void
- Mark resource module association as valid. This updates the MD5 hash for the current combination of "module name - MpID" and the valid technical ID retrieved from MuseumPlus.
- mplus_resource_clear_metadata() : void
- Clear resource metadata fields that are mapped to any of the modules configured by the plugin.
- mplus_resource_get_association_data() : array<string|int, mixed>
- Get all resources associated with a MuseumPlus module.
- mplus_xml_search_by_fieldpath() : DOMDocument
- Build the search XML for MuseumPlus API request body {@see http://docs.zetcom.com/ws/module/search/search_1_4.xsd}
- mplus_search() : array<string|int, mixed>
- Run an ad-hoc module search using the provided expert search expression {@see http://docs.zetcom.com/ws/#Perform_an_ad-hoc_search_for_modules_items}
- mplus_get_response_xml() : DOMDocument
- Get XML response body received from MuseumPlus search request {@see http://docs.zetcom.com/ws/module/module_1_4.xsd}
- mplus_sync() : void|array<string|int, mixed>
- Synchronise (search & import) MuseumPlus module fields to the associated ("linked") resources.
- HookNewsHomeHomebeforepanels() : mixed
- HookNewsTeam_homeCustomteamfunction() : mixed
- get_news() : mixed
- get_news_headlines() : mixed
- get_news_ref() : mixed
- delete_news() : mixed
- add_news() : mixed
- update_news() : mixed
- HookOffline_archiveAllInitialise() : mixed
- HookOffline_archiveAllAddplugincronjob() : mixed
- HookOffline_archiveTeam_homeCustomteamfunction() : mixed
- HookOffline_archiveViewResourceactions() : mixed
- HookOffline_archiveViewRenderbeforeresourceview() : mixed
- offline_archive_run_jobs() : bool|array<string|int, mixed>
- Run any outstanding offline archive jobs
- HookOpenai_gptAdmin_resource_type_fieldsReplacetabnamecolumnheader() : mixed
- HookOpenai_gptAdmin_resource_type_fieldsReplacetabnamecolumn() : mixed
- HookOpenai_gptAllModifyresourcetypefieldcolumns() : array<string|int, mixed>
- Add to array of field column data on metadata field editing page
- HookOpenai_gptAdmin_resource_type_field_editAdmin_field_replace_question() : bool
- Alter rendering of the new columns on the metadata field editing page
- HookOpenai_gptAllUpdate_field() : bool
- Hook into update_field() to process value changes
- HookOpenai_gptAllAftersaveresourcedata() : bool
- Hook into save_resource_data() and save_resource_data_multi() to process value changes
- HookOpenai_gptAllAfterpreviewcreation() : bool
- Hook into image upload to process the image as GPT input *
- HookOpenai_gptAllExtra_checks() : array<string|int, mixed>
- Return total token usage for the past 30 days.
- HookOpenai_gptAllAddtriggerablejob() : array<string|int, mixed>
- Hook into offline jobs list to add custom job
- HookOpenai_gptTeam_homeCustomteamfunctionadmin() : mixed
- openai_gpt_update_field() : bool|array<string|int, mixed>
- Send the new field value or image to the OpenAI API in order to update the linked field
- openai_gpt_generate_completions() : string
- Call OpenAI compatibile APIs
- openai_gpt_get_dependent_fields() : array<string|int, mixed>
- Return array of resource type field refs for a given openai_gpt_input_field value.
- openai_gpt_get_configured_fields() : array<string|int, mixed>
- Return an array of resource type field refs for all AI configured fields
- openai_gpt_get_tokens_used() : int
- Return a count of tokens used by GPT during the number of days passed as a parameter.
- openai_gpt_get_provider() : string
- Return the configured AI provider handles the remote override.
- HookOpenai_image_editAllExtra_checks() : array<string|int, mixed>
- Return total successful image edits for the past 30 days.
- HookOpenai_image_editViewAfterresourceactions() : mixed
- curlprogress() : mixed
- HookPdf_splitViewAfterresourceactions() : mixed
- HookPropose_changesAllAddtoactions() : mixed
- HookPropose_changesAllShowfieldedit() : mixed
- HookPropose_changesAllExport_add_tables() : mixed
- HookPropose_changesAlluser_actions_recent() : array<string|int, mixed>
- Add any recent proposed changes to the $newactions array passed from get_user_actions_recent() and return the updated array
- HookPropose_changesAllUpdateactiontypes() : mixed
- HookPropose_changesAllActioneditlink() : mixed
- HookPropose_changesCollection_editSavecollectionAdditionalfields() : mixed
- HookPropose_changesCollection_editGetcollectionAdditionalfields() : mixed
- HookPropose_changesCollection_editAdditionalfields2() : mixed
- HookPropose_changesCollection_emailAdditionalemailfield() : mixed
- HookPropose_changesCollection_emailAdditional_email_collection() : mixed
- HookPropose_changesUser_preferencesAdd_user_preference_page_def() : mixed
- HookPropose_changesViewAfterresourceactions() : mixed
- save_proposed_changes() : mixed
- get_proposed_changes() : mixed
- delete_proposed_changes() : mixed
- propose_changes_display_field() : mixed
- HookRefineresultsSearchBeforesearchresults() : mixed
- HookRefineresultsSearchBeforesearchresultsexpandspace() : mixed
- HookRefineresultsSearchSearchstringprocessing() : mixed
- HookRefineresultsSearchSearch_header_after_actions() : mixed
- HookRemote_assistAllHomeafterwelcometext() : mixed
- HookResource_usageViewCustompanels() : mixed
- HookRse_search_notificationsAllRender_search_actions_add_option() : mixed
- HookRse_search_notificationsAllRender_actions_add_collection_option() : mixed
- HookRse_search_notificationsCron_copy_hitcountAddplugincronjob() : mixed
- HookRse_search_notificationsSearchafterResulthints() : mixed
- HookRse_search_notificationsUser_homeUser_home_additional_links() : mixed
- search_notifications_get() : mixed
- search_notification_add() : mixed
- search_notification_delete() : mixed
- search_notification_enable() : mixed
- search_notification_disable() : mixed
- search_notification_enable_all() : mixed
- search_notification_disable_all() : mixed
- search_notification_process() : mixed
- search_notification_make_url() : mixed
- search_notification_delete_by_owner() : void
- Delete all watched searches by user
- render_sortable_header() : mixed
- HookRse_VersionAllBeforeremoveexistingfile() : mixed
- HookRse_VersionAllUpload_image_after_log_write() : mixed
- HookRse_VersionAllGet_alternative_files_extra_sql() : mixed
- HookRse_versionAllSave_resource_data_multi_extra_modes() : mixed
- HookRse_versionAllGet_resource_log_extra_fields() : mixed
- HookRse_versionCollection_logLog_extra_columns_header() : mixed
- HookRse_versionCollection_logLog_extra_columns_row() : mixed
- HookRse_versionCollection_logCollection_log_extra_fields() : mixed
- HookRse_versionEditEdit_all_extra_modes() : mixed
- HookRse_versionEditEdit_all_mode_js() : mixed
- HookRse_versionEditEdit_all_after_findreplace() : mixed
- HookRse_versionEditBefore_status_question() : mixed
- HookRse_versionEditSave_resource_data_multi_set_archive_state() : mixed
- HookRse_versionLog_entryLog_entry_processing() : mixed
- HookRse_workflowAdmin_group_permissionsAdditionalperms() : mixed
- HookRse_workflowAdmin_homeCustomadminsetup() : mixed
- HookRse_workflowAllInitialise() : mixed
- HookRse_workflowAllAfter_update_archive_status() : mixed
- HookRse_workflowAllRender_actions_add_collection_option() : mixed
- HookRse_workflowAllRender_search_actions_add_option() : mixed
- HookRse_workflowAllRender_actions_add_option_js_case() : mixed
- HookRse_workflowAllAfter_setup_user() : mixed
- HookRse_workflowAllArchive_skip_required_fields() : mixed
- Check if supplied archive state code (e.g. 0 = Active) allows required field checking to be skipped when a resource is moved to this archive state.
- HookRse_workflowViewPageevaluation() : mixed
- HookRse_workflowViewAdditionaldownloadtabs() : mixed
- HookRse_workflowViewAdditionaldownloadtabbuttons() : mixed
- HookRse_workflowViewReplacetitleprefix() : mixed
- rse_workflow_get_actions() : array<string|int, mixed>
- Fetch a list of actions from the rse_workflow plugin Action text, name, and button text support i18n translation strings
- rse_workflow_save_action() : mixed
- rse_workflow_delete_action() : mixed
- rse_workflow_get_archive_states() : mixed
- rse_workflow_delete_state() : mixed
- rse_workflow_get_valid_actions() : array<string|int, mixed>
- Validate list of actions for a resource or a batch of resources. For a batch of resources, an action is valid only if using the 'wf' permission is set for that action.
- rse_workflow_validate_action() : bool
- Validate a workflow action for a particular resource
- rse_workflow_compile_actions() : array<string|int, mixed>
- Compile workflow actions for the unified dropdown actions. This will validate actions using only 'wf' permissions (@see rse_workflow_get_valid_actions)
- rse_workflow_create_state() : bool|array<string|int, mixed>
- Create new workflow state
- HookRss2AllInitialise() : mixed
- HookRss2AllPreheaderoutput() : mixed
- HookRss2AllSearchbarbeforebottomlinks() : mixed
- HookRss2SearchRender_search_actions_add_option() : mixed
- xmlentities() : mixed
- HookSensitive_imagesAllAdditionaljoins() : mixed
- HookSensitive_imagesAllStopblurbleed() : mixed
- SensitiveImageResultsReplace() : mixed
- HookSensitive_imagesSearchResourcethumbtop() : mixed
- HookSensitive_imagesCollectionsRendercollectionthumb() : mixed
- HookSensitive_imagesViewReplacepreviewlink() : mixed
- HookSimpleldapAllExternalauth() : mixed
- HooksimpleldapCheckAddinstallationcheck() : mixed
- HookSimpleldapTeam_user_editAdditionaluserfields() : mixed
- HookSimpleldapTeam_user_editPassword() : mixed
- HookSimpleldapTeam_user_editTicktoemailpassword() : mixed
- simpleldap_authenticate() : array<string|int, mixed>|bool
- Authenticate to directory by binding and performing LDAP search
- simpleldap_to_utf8() : string
- Helper function to convert received data from LDAP server to UTF-8
- HookSimplesamlAllInitialise() : mixed
- HookSimplesamlAllPreheaderoutput() : mixed
- HookSimplesamlAllProvideusercredentials() : mixed
- HookSimplesamlAllLoginformlink() : mixed
- HookSimplesamlLoginPostlogout() : mixed
- HookSimplesamlLoginPostlogout2() : mixed
- HookSimplesamlAllCheckuserloggedin() : mixed
- HookSimplesamlAllReplaceheadernav1anon() : mixed
- Render header navigation links in anonymous mode based on simplasaml configuration
- HookSimplesamlCollection_emailReplacecollectionemailredirect() : mixed
- HookSimplesamlResource_emailReplaceresourceemailredirect() : mixed
- HookSimplesamlAllCheck_access_key() : mixed
- HookSimplesamlAllExtra_checks() : mixed
- HookSimplesamlAllSsologindefault() : mixed
- HookSimplesamlAllCron() : mixed
- HooksimplesamlCheckAddinstallationcheck() : mixed
- HookSimplesamlTeam_user_editAdditionaluserfields() : mixed
- HookSimplesamlTeam_user_editPassword() : mixed
- HookSimplesamlTeam_user_editTicktoemailpassword() : mixed
- simplesaml_get_lib_path() : string
- Get the configured path to the root of the SimpleSAML library If $simplesaml_lib_path is not set this will be the [webroot]/plugins/simplesaml/lib folder
- simplesaml_authenticate() : bool
- Authenticate user, redfirecting to IdP if necessary
- simplesaml_getattributes() : array<string|int, mixed>
- Get SAML attributes
- simplesaml_signout() : void
- Sign out of SAML SP
- simplesaml_is_authenticated() : bool
- Check if user has been authenticated by SimpleSAMLPHP
- simplesaml_getauthdata() : mixed
- simplesaml_duplicate_notify() : void
- Notify of a new SAML user with an email address that is already in use by an existing user
- simplesaml_config_check() : array{success: bool, error?: string}
- Check that the SimpleSAMLphp configuration is valid
- simplesaml_php_check() : bool
- Check whether PHP version will cause an error with current SAML config
- simplesaml_is_configured() : bool
- Check that the SimpleSAMLphp has been configured.
- simplesaml_generate_keypair() : array<string|int, mixed>
- Generate a key/certificate pair
- get_saml_sp_name() : string
- Get the name of the saml SP to use
- get_saml_metadata_expiry() : string
- Get the latest expiration date for the given SAML Identity Provider's certificates
- simplesaml_update_metadata() : bool|string
- Get the latest metadata from the configured IdP Metadata URL
- get_saml_metadata() : array<string|int, mixed>|false
- Get SAML IdP metadata from sysvars, updating if necessary
- simplesaml_use_idp_metadata_url_mode() : bool
- HookSystem_resetAdmin_homeCustomadminfunction() : mixed
- HookTesseractAllCron() : void
- Add tesseract processing to the cron.
- HookTesseractAllAfterpreviewcreation() : void
- Runs tesseract processing after preview creation.
- tesseract_process_unprocessed() : int|false
- Processes all unprocessed audio/video resources supported by tesseract.
- tesseract_process() : bool
- Extracts text from an image or scanned document using tesseract OCR.
- HookTms_linkAllInitialise() : mixed
- HookTms_linkAllUpdate_field() : mixed
- HookTms_linkAllAfterpreviewcreation() : void
- HookTms_linkCheckAddinstallationcheck() : mixed
- HookTms_linkCron_copy_hitcountAddplugincronjob() : mixed
- HookTms_linkEditEditbeforesectionhead() : mixed
- HookTMS_linkEditEdithidefield() : mixed
- HookTms_linkAllAdditionalvalcheck() : mixed
- HookTms_linkEditAftersaveresourcedata() : array<string|int, mixed>|bool
- TMS plugin implementing the 'aftersaveresourcedata' hook IMPORTANT: 'aftersaveresourcedata' hook is called from both save_resource_data() and save_resource_data_multi()!
- HookTms_linkTeam_homeCustomteamfunctionadmin() : mixed
- HookTms_linkViewRenderfield() : mixed
- unistr_to_ords() : mixed
- getEncodingOrder() : mixed
- tms_convert_value() : mixed
- tms_link_get_tms_data() : mixed
- tms_link_get_tms_resources() : mixed
- tms_link_test() : mixed
- tms_add_mediaxref() : mixed
- tms_link_create_tms_thumbnail() : mixed
- tms_get_mediamasterid() : bool|string
- tms_get_mediamasterid Retrieve a list of unused Media Master IDs from the TMS database and return the first available.
- tms_get_renditionid() : mixed
- tms_get_mediapathid() : mixed
- tms_update_media_rendition() : mixed
- tms_check_thumb() : mixed
- tms_update_media_rendition_thumb() : mixed
- tms_add_mediafile() : mixed
- tms_show_data() : mixed
- tms_link_check_preview() : mixed
- tms_link_save_module_mappings_config() : void
- Save plugins' module saved mappings configuration on an ad-hoc basis
- tms_link_get_modules_mappings() : mixed
- tms_link_encode_modules_mappings() : mixed
- tms_link_is_rs_uid_field() : mixed
- tms_link_split_identifiers() : array<string|int, mixed>
- Split string identifier values on commas with optional whitespace for multiple tms object IDs
- HookTotpAllPreheaderoutput() : void
- Redirects the user to the TOTP setup page if their TOTP cookie is invalid or missing.
- HookTotpAllAdditionalheaderjs() : void
- Includes the QR code JavaScript library needed for TOTP setup.
- HookTotpTeam_user_editAdditionaluserfields() : void
- Adds a TOTP reset checkbox to the user edit form.
- HookTotpTeam_user_editAdditionaluserfieldssave() : PreparedStatementQuery|null
- Processes the TOTP reset checkbox and prepares a query to reset the user's TOTP data.
- HookTotpAllBeforetermsredirect() : mixed
- TOTP_validate() : bool
- Validates a TOTP code for the given user reference.
- TOTP_cookie() : string
- Generates a daily cookie hash based on the user reference and scramble key.
- TOTP_is_user_set_up() : bool
- Checks whether TOTP is set up for the specified user.
- TOTP_get_secret() : string
- Generates the TOTP secret for the given user.
- TOTP_get_url() : string
- Constructs the otpauth URL for the user's TOTP setup.
- TOTP_setup_complete() : void
- Marks TOTP setup as complete for the specified user.
- TOTP_tries() : int
- Retrieves the number of failed TOTP attempts for the user.
- TOTP_increase_tries() : void
- Increments the TOTP attempt counter for the specified user.
- TOTP_saml_authenticate() : bool
- Checks to see if SAML is authenticated for the given user if TOTP can be skipped for SAML users.
- HookTrack_field_historyViewValue_mod_after_highlight() : mixed
- track_field_history_get_field_log() : mixed
- HookTransformAdmin_manage_slideshowRender_new_element_for_manage_slideshow() : mixed
- HookTransformAdmin_manage_slideshowRender_replace_button_for_manage_slideshow() : mixed
- HookTransformAdmin_manage_slideshowRender_replace_slideshow_form_for_manage_slideshow() : mixed
- HookTransformAllAdditionalheaderjs() : mixed
- HookTransformAllRender_actions_add_collection_option() : mixed
- HookTransformAllAdditional_title_pages_array() : mixed
- HookTransformAllAdditional_title_pages() : mixed
- HookTransformAllreplace_resource_file_extra() : mixed
- HookTransformCollection_editColleditformbottom() : mixed
- HookTransformViewAfterresourceactions() : mixed
- HookTypesense_searchAllExternal_search() : array<string|int, mixed>|false
- Intercept ResourceSpace searches and optionally handle them using Typesense.
- HookTypesense_searchAllBeforenodedelete() : void
- Store resources using a node before the node is deleted.
- HookTypesense_searchAllAfternodedelete() : void
- Reindex resources that used a node after the node has been deleted.
- HookTypesense_searchAllAftersaveresourcedata() : false
- Reindex resource after metadata has been saved.
- HookTypesense_searchAllAfter_save_related_keywords() : false
- Sync Typesense related keyword synonyms after related keywords have been saved.
- typesense_search_supported() : bool
- Check whether the current ResourceSpace search can be handled by Typesense.
- typesense_search_do_search() : array<string|int, mixed>|false
- Run a ResourceSpace search using Typesense and return ResourceSpace-compatible results.
- typesense_search_get_refs() : array<string|int, mixed>|false
- Query Typesense and return matching resource refs in relevance order.
- typesense_search_filter_by() : string
- Build a Typesense filter expression for simple ResourceSpace filters.
- typesense_search_hydrate_refs() : array<string|int, mixed>
- Hydrate Typesense resource refs into the standard ResourceSpace search result structure.
- typesense_search_request() : array<string|int, mixed>|false
- Send a request to the Typesense API.
- typesense_search_ensure_collection() : bool
- Ensure that the Typesense resources collection exists.
- typesense_search_get_document_data() : array<string|int, mixed>|false
- Build a Typesense document for a ResourceSpace resource.
- typesense_search_index_resource() : bool
- Index a single ResourceSpace resource in Typesense.
- typesense_search_delete_resource() : bool
- Delete a resource document from Typesense.
- typesense_search_reindex_node_resources() : int
- Reindex all resources that are currently linked to a node.
- typesense_search_reindex_all() : array<string|int, mixed>
- Reindex resources in batches.
- typesense_search_index_document() : bool
- Index a Typesense document.
- typesense_search_sync_related_keywords() : bool
- Synchronise ResourceSpace related keywords to Typesense synonyms.
- HookUser_preferencesuser_change_passwordReplaceuserpreferencesheader() : mixed
- HookUser_preferencesuser_change_passwordSaveadditionaluserpreferences() : mixed
- HookUser_preferencesuser_change_passwordAdditionaluserpreferences() : mixed
- HookVideo_bookendViewAfterresourceactions() : mixed
- HookVideo_spliceAllInitialise() : mixed
- HookVideo_spliceAllRender_actions_add_collection_option() : mixed
- HookVideo_spliceViewAfterresourceactions() : mixed
- generate_merged_video() : mixed
- generate_video_trim() : void
- Trim video as requested from pages/trim.php
- HookVideo_timestamp_linksViewFooterbottom() : mixed
- HookVideo_tracksAllStaticsync_after_alt() : mixed
- HookVideo_tracksAllAfter_alt_upload() : mixed
- HookVideo_tracksViewModifydownloadbutton() : mixed
- HookVideo_tracksViewDownloadbuttonreplace() : mixed
- HookVideo_tracksViewAfterresourceactions() : mixed
- HookVideo_tracksViewAdditionalresourcetools2() : mixed
- HookVimeo_publishAllInitialise() : mixed
- HookVimeo_publishViewAfterresourceactions() : mixed
- init_vimeo_api() : mixed
- get_access_token() : mixed
- delete_vimeo_token() : mixed
- get_vimeo_user() : mixed
- vimeo_upload() : mixed
- set_video_information() : mixed
- HookVm2rsAllInitialise() : mixed
- Hookvm2rsUpload_batchUpload_page_bottom() : mixed
- isValidVimeoURL() : mixed
- Hookvm2rsViewrenderinnerresourcepreview() : mixed
- Hookvm2rsViewreplacedownloadoptions() : mixed
- HookVr_viewAllInitialise() : mixed
- HookVr_viewAllAdditionalheaderjs() : mixed
- HookVr_viewAllmodified_Cors_Process() : mixed
- HookVr_viewPreviewFullpreviewresultnav() : mixed
- HookVr_viewPreviewcustomflvplay() : mixed
- HookVr_viewPreviewReplacepreviewimage() : mixed
- HookVr_viewViewaftergetresourcedataview() : mixed
- HookVr_viewViewReplacepreviewlink() : mixed
- HookVr_viewViewRenderinnerresourcepreview() : mixed
- VrViewUseVR() : bool
- Check whether VR view is to be enabled for the specified resource
- VrViewRenderPlayer() : mixed
- HookWhisperAllCron() : void
- Add whisper processing to the cron.
- HookWhisperAllTemp_block_deletion() : string
- Prevent downloaded Whisper models from being deleted
- HookWhisperAllAddtriggerablejob() : array<string|int, mixed>
- Hook into offline jobs list to add custom job
- whisper_process_unprocessed() : int|false
- Processes all unprocessed audio/video resources supported by Whisper.
- whisper_process() : bool
- Converts a media file to audio, transcribes it using Whisper, and stores the transcript in a metadata field.
- HookYoutube_publishAllInitialise() : mixed
- HookYoutube_publishViewAfterresourceactions() : mixed
- youtube_publish_initialize() : mixed
- get_youtube_authorization_code() : mixed
- delete_youtube_tokens() : mixed
- upload_video() : mixed
- youtube_upload_get_categories() : mixed
- Hookyt2rsAllInitialise() : mixed
- Hookyt2rsUpload_batchUpload_page_bottom() : mixed
- isValidURL() : mixed
- Hookyt2rsViewrenderinnerresourcepreview() : mixed
- Hookyt2rsViewreplacedownloadoptions() : mixed
Constants
ACTIONGROUP_ADVANCED
public
mixed
ACTIONGROUP_ADVANCED
= 6
ACTIONGROUP_COLLECTION
public
mixed
ACTIONGROUP_COLLECTION
= 2
ACTIONGROUP_EDIT
public
mixed
ACTIONGROUP_EDIT
= 3
ACTIONGROUP_RESEARCH
public
mixed
ACTIONGROUP_RESEARCH
= 5
ACTIONGROUP_RESOURCE
public
mixed
ACTIONGROUP_RESOURCE
= 1
ACTIONGROUP_SHARE
public
mixed
ACTIONGROUP_SHARE
= 4
ACTIONS_EMAIL_MAX_AGE
public
mixed
ACTIONS_EMAIL_MAX_AGE
= 168
API_NATIVE_WHITELIST
public
mixed
API_NATIVE_WHITELIST
= ['add_resource_to_collection', 'collection_add_resources', 'collection_remove_resources', 'create_collection', 'delete_access_keys', 'delete_alternative_file', 'delete_resource', 'delete_tabs', 'do_search', 'get_collections_resource_count', 'get_dash_search_data', 'get_field_options', 'get_users', 'get_user_message', 'relate_all_resources', 'remove_resource_from_collection', 'reorder_featured_collections', 'reorder_tabs', 'save_tab', 'send_collection_to_admin', 'send_user_message', 'update_related_resource', 'toggle_active_state_for_nodes', 'put_resource_data', 'get_processing_message', 'delete_resources_in_collection', 'checkperm', 'faces_set_node', 'update_field']
BLOCKED_STREAM_WRAPPERS
public
mixed
BLOCKED_STREAM_WRAPPERS
= ['php', 'file']
BRAND_GUIDELINES_CONTENT_TYPES
Types of content you can add to brand guideline pages
public
mixed
BRAND_GUIDELINES_CONTENT_TYPES
= ['text' => 0, 'resource' => 1, 'colour' => 2, 'group' => 100]
BRAND_GUIDELINES_DB_COLS_CONTENT
public
mixed
BRAND_GUIDELINES_DB_COLS_CONTENT
= columns_in('brand_guidelines_content', null, 'brand_guidelines')
BRAND_GUIDELINES_DB_COLS_PAGES
public
mixed
BRAND_GUIDELINES_DB_COLS_PAGES
= columns_in('brand_guidelines_pages', null, 'brand_guidelines')
BRAND_GUIDELINES_URL_MANAGE_CONTENT
public
mixed
BRAND_GUIDELINES_URL_MANAGE_CONTENT
= "{$GLOBALS['baseurl']}/plugins/brand_guidelines/pages/manage/content.php"
COLLECTION_REQUEST
public
mixed
COLLECTION_REQUEST
= 2
COLLECTION_TYPE_FEATURED
public
mixed
COLLECTION_TYPE_FEATURED
= 3
COLLECTION_TYPE_PUBLIC
public
mixed
COLLECTION_TYPE_PUBLIC
= 4
COLLECTION_TYPE_REQUEST
public
mixed
COLLECTION_TYPE_REQUEST
= 6
COLLECTION_TYPE_SELECTION
public
mixed
COLLECTION_TYPE_SELECTION
= 2
COLLECTION_TYPE_SHARE_UPLOAD
public
mixed
COLLECTION_TYPE_SHARE_UPLOAD
= 5
COLLECTION_TYPE_STANDARD
public
mixed
COLLECTION_TYPE_STANDARD
= 0
COLLECTION_TYPE_UPLOAD
public
mixed
COLLECTION_TYPE_UPLOAD
= 1
CONTRIBUTIONS_ICON
public
mixed
CONTRIBUTIONS_ICON
= '<i aria-hidden="true" class="icon-user-round-plus"></i> '
DATE_RANGE_SEPARATOR
public
mixed
DATE_RANGE_SEPARATOR
= " / "
DEFAULT_DOWNLOAD_FILENAME_FORMAT
public
mixed
DEFAULT_DOWNLOAD_FILENAME_FORMAT
= 'RS%resource_%filename%size.%extension'
DEPRECATED_STARSEARCH
public
mixed
DEPRECATED_STARSEARCH
= 0
DOWNLOAD_FILE_LIFETIME
public
mixed
DOWNLOAD_FILE_LIFETIME
= 14
EMU_SCRIPT_MODE_IMPORT
public
mixed
EMU_SCRIPT_MODE_IMPORT
= 100
EMU_SCRIPT_MODE_SYNC
public
mixed
EMU_SCRIPT_MODE_SYNC
= 1000
EMU_SCRIPT_SYNC_LOCK
public
mixed
EMU_SCRIPT_SYNC_LOCK
= 'emu_sync_mode_lock'
FACIAL_RECOGNITION_CROP_SIZE_PREFIX
public
mixed
FACIAL_RECOGNITION_CROP_SIZE_PREFIX
= '_facial_recognition_crop_'
FACIAL_RECOGNITION_PREPARED_IMAGE_EXT
public
mixed
FACIAL_RECOGNITION_PREPARED_IMAGE_EXT
= 'pgm'
FIELD_SORT_METHODS
public
mixed
FIELD_SORT_METHODS
= ['default' => 0, 'dot-notation' => 1]
FIELD_TYPE_CATEGORY_TREE
public
mixed
FIELD_TYPE_CATEGORY_TREE
= 7
FIELD_TYPE_CHECK_BOX_LIST
public
mixed
FIELD_TYPE_CHECK_BOX_LIST
= 2
FIELD_TYPE_COLOUR_PREVIEW
public
mixed
FIELD_TYPE_COLOUR_PREVIEW
= 103
FIELD_TYPE_DATE
public
mixed
FIELD_TYPE_DATE
= 10
FIELD_TYPE_DATE_AND_OPTIONAL_TIME
public
mixed
FIELD_TYPE_DATE_AND_OPTIONAL_TIME
= 4
FIELD_TYPE_DATE_RANGE
public
mixed
FIELD_TYPE_DATE_RANGE
= 14
FIELD_TYPE_DROP_DOWN_LIST
public
mixed
FIELD_TYPE_DROP_DOWN_LIST
= 3
FIELD_TYPE_DYNAMIC_KEYWORDS_LIST
public
mixed
FIELD_TYPE_DYNAMIC_KEYWORDS_LIST
= 9
FIELD_TYPE_EXPIRY_DATE
public
mixed
FIELD_TYPE_EXPIRY_DATE
= 6
FIELD_TYPE_NUMERIC
public
mixed
FIELD_TYPE_NUMERIC
= 101
FIELD_TYPE_RADIO_BUTTONS
public
mixed
FIELD_TYPE_RADIO_BUTTONS
= 12
FIELD_TYPE_TEXT_BOX_FORMATTED_AND_TINYMCE
public
mixed
FIELD_TYPE_TEXT_BOX_FORMATTED_AND_TINYMCE
= 8
FIELD_TYPE_TEXT_BOX_LARGE_MULTI_LINE
public
mixed
FIELD_TYPE_TEXT_BOX_LARGE_MULTI_LINE
= 5
FIELD_TYPE_TEXT_BOX_MULTI_LINE
public
mixed
FIELD_TYPE_TEXT_BOX_MULTI_LINE
= 1
FIELD_TYPE_TEXT_BOX_SINGLE_LINE
public
mixed
FIELD_TYPE_TEXT_BOX_SINGLE_LINE
= 0
FIELD_TYPE_TEXT_RICH
public
mixed
FIELD_TYPE_TEXT_RICH
= 102
FIELD_TYPE_WARNING_MESSAGE
public
mixed
FIELD_TYPE_WARNING_MESSAGE
= 13
FULLTEXT_SEARCH_PREFIX
public
mixed
FULLTEXT_SEARCH_PREFIX
= '@FULL_TEXT'
FULLTEXT_SEARCH_QUOTES_PLACEHOLDER
public
mixed
FULLTEXT_SEARCH_QUOTES_PLACEHOLDER
= '[QUOTES]'
ICON_CUBE
public
mixed
ICON_CUBE
= '<i class="icon-box" aria-hidden="true"></i> '
ICON_EDIT
public
mixed
ICON_EDIT
= '<i class="icon-pencil" aria-hidden="true"></i> '
ICON_FOLDER
public
mixed
ICON_FOLDER
= '<i class="icon-folder" aria-hidden="true"></i> '
ICON_REMOVE
public
mixed
ICON_REMOVE
= '<i class="icon-circle-minus" aria-hidden="true"></i> '
IMAGE_BANKS_MAX_INSTANCE_COUNT
Defines the maximum number of instances a Provider with multi-instance support can have.
public
int
IMAGE_BANKS_MAX_INSTANCE_COUNT
= 100
INLINE_VIEWABLE_TYPES
public
mixed
INLINE_VIEWABLE_TYPES
= ['pdf' => 'application/pdf', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'png' => 'image/png', 'gif' => 'image/gif', 'bmp' => 'image/bmp', 'webp' => 'image/webp', 'svg' => 'image/svg+xml', 'txt' => 'text/plain']
JOB_PRIORITY_COMPLETED
public
mixed
JOB_PRIORITY_COMPLETED
= 9
JOB_PRIORITY_IMMEDIATE
public
mixed
JOB_PRIORITY_IMMEDIATE
= 0
JOB_PRIORITY_SYSTEM
public
mixed
JOB_PRIORITY_SYSTEM
= 2
JOB_PRIORITY_USER
public
mixed
JOB_PRIORITY_USER
= 1
LIB_OPENSEADRAGON
public
mixed
LIB_OPENSEADRAGON
= '/lib/openseadragon'
LINK_CARET
public
mixed
LINK_CARET
= '<i aria-hidden="true" class="icon-chevron-right"></i> '
LINK_CARET_BACK
public
mixed
LINK_CARET_BACK
= '<i aria-hidden="true" class="icon-chevron-left"></i> '
LINK_CHEVRON_RIGHT
public
mixed
LINK_CHEVRON_RIGHT
= '<i aria-hidden="true" class="icon-chevron-right"></i>'
LINK_PLUS
public
mixed
LINK_PLUS
= '<i aria-hidden="true" class="icon-plus"></i> '
LINK_PLUS_CIRCLE
public
mixed
LINK_PLUS_CIRCLE
= '<i aria-hidden="true" class="icon-circle-plus"></i> '
LOG_CODE_ACCESS_CHANGED
public
mixed
LOG_CODE_ACCESS_CHANGED
= 'a'
LOG_CODE_ALTERNATIVE_CREATED
public
mixed
LOG_CODE_ALTERNATIVE_CREATED
= 'b'
LOG_CODE_COLLECTION_ACCESS_CHANGED
public
mixed
LOG_CODE_COLLECTION_ACCESS_CHANGED
= 'A'
LOG_CODE_COLLECTION_ADDED_RESOURCE
public
mixed
LOG_CODE_COLLECTION_ADDED_RESOURCE
= 'a'
LOG_CODE_COLLECTION_ADDED_RESOURCE_COMMENT
public
mixed
LOG_CODE_COLLECTION_ADDED_RESOURCE_COMMENT
= 'm'
LOG_CODE_COLLECTION_ADDED_RESOURCE_COPIED
public
mixed
LOG_CODE_COLLECTION_ADDED_RESOURCE_COPIED
= 'c'
LOG_CODE_COLLECTION_ADDED_RESOURCE_RATING
public
mixed
LOG_CODE_COLLECTION_ADDED_RESOURCE_RATING
= '*'
LOG_CODE_COLLECTION_BATCH_TRANSFORMED
public
mixed
LOG_CODE_COLLECTION_BATCH_TRANSFORMED
= 'b'
LOG_CODE_COLLECTION_COLLECTION_DOWNLOADED
public
mixed
LOG_CODE_COLLECTION_COLLECTION_DOWNLOADED
= 'Z'
LOG_CODE_COLLECTION_DELETED_ALL_RESOURCES
public
mixed
LOG_CODE_COLLECTION_DELETED_ALL_RESOURCES
= 'D'
LOG_CODE_COLLECTION_DELETED_COLLECTION
public
mixed
LOG_CODE_COLLECTION_DELETED_COLLECTION
= 'X'
LOG_CODE_COLLECTION_DELETED_RESOURCE
public
mixed
LOG_CODE_COLLECTION_DELETED_RESOURCE
= 'd'
LOG_CODE_COLLECTION_EDIT_UPLOAD_SHARE
public
mixed
LOG_CODE_COLLECTION_EDIT_UPLOAD_SHARE
= 'EEU'
LOG_CODE_COLLECTION_EMAILED_COLLECTION
public
mixed
LOG_CODE_COLLECTION_EMAILED_COLLECTION
= 'E'
LOG_CODE_COLLECTION_REMOVED_ALL_RESOURCES
public
mixed
LOG_CODE_COLLECTION_REMOVED_ALL_RESOURCES
= 'R'
LOG_CODE_COLLECTION_REMOVED_RESOURCE
public
mixed
LOG_CODE_COLLECTION_REMOVED_RESOURCE
= 'r'
LOG_CODE_COLLECTION_REORDER
public
mixed
LOG_CODE_COLLECTION_REORDER
= 'O'
LOG_CODE_COLLECTION_SHARED_COLLECTION
public
mixed
LOG_CODE_COLLECTION_SHARED_COLLECTION
= 'S'
LOG_CODE_COLLECTION_SHARED_RESOURCE_WITH
public
mixed
LOG_CODE_COLLECTION_SHARED_RESOURCE_WITH
= 's'
LOG_CODE_COLLECTION_SHARED_UPLOAD
public
mixed
LOG_CODE_COLLECTION_SHARED_UPLOAD
= 'SEU'
LOG_CODE_COLLECTION_STOPPED_RESOURCE_ACCESS
public
mixed
LOG_CODE_COLLECTION_STOPPED_RESOURCE_ACCESS
= 't'
LOG_CODE_COLLECTION_STOPPED_SHARING_COLLECTION
public
mixed
LOG_CODE_COLLECTION_STOPPED_SHARING_COLLECTION
= 'T'
LOG_CODE_COPIED
public
mixed
LOG_CODE_COPIED
= 'C'
LOG_CODE_CREATED
public
mixed
LOG_CODE_CREATED
= 'c'
LOG_CODE_CREATED_BY_CHANGED
public
mixed
LOG_CODE_CREATED_BY_CHANGED
= 'o'
LOG_CODE_DELETED
public
mixed
LOG_CODE_DELETED
= 'x'
LOG_CODE_DELETED_ACCESS_KEY
public
mixed
LOG_CODE_DELETED_ACCESS_KEY
= 'XK'
LOG_CODE_DELETED_ALTERNATIVE
public
mixed
LOG_CODE_DELETED_ALTERNATIVE
= 'y'
LOG_CODE_DELETED_PERMANENTLY
public
mixed
LOG_CODE_DELETED_PERMANENTLY
= 'xx'
LOG_CODE_DISABLED
public
mixed
LOG_CODE_DISABLED
= '-'
LOG_CODE_DOWNLOADED
public
mixed
LOG_CODE_DOWNLOADED
= 'd'
LOG_CODE_EDITED
public
mixed
LOG_CODE_EDITED
= 'e'
LOG_CODE_EDITED_RESOURCE
public
mixed
LOG_CODE_EDITED_RESOURCE
= 'EDT'
LOG_CODE_EMAILED
public
mixed
LOG_CODE_EMAILED
= 'E'
LOG_CODE_ENABLED
public
mixed
LOG_CODE_ENABLED
= '+'
LOG_CODE_EXTERNAL_UPLOAD
public
mixed
LOG_CODE_EXTERNAL_UPLOAD
= 'EUP'
LOG_CODE_FAILED_LOGIN_ATTEMPT
public
mixed
LOG_CODE_FAILED_LOGIN_ATTEMPT
= 'Xl'
LOG_CODE_JOB_ADDED
public
mixed
LOG_CODE_JOB_ADDED
= 'J'
LOG_CODE_JOB_COMPLETED
public
mixed
LOG_CODE_JOB_COMPLETED
= 'JC'
LOG_CODE_JOB_DELETED
public
mixed
LOG_CODE_JOB_DELETED
= 'JD'
LOG_CODE_LOCKED
public
mixed
LOG_CODE_LOCKED
= 'X'
LOG_CODE_LOGGED_IN
public
mixed
LOG_CODE_LOGGED_IN
= 'l'
LOG_CODE_MULTI_EDITED
public
mixed
LOG_CODE_MULTI_EDITED
= 'm'
LOG_CODE_NODE_REVERT
public
mixed
LOG_CODE_NODE_REVERT
= 'N'
LOG_CODE_REORDERED
public
mixed
LOG_CODE_REORDERED
= 'R'
LOG_CODE_REPLACED
public
mixed
LOG_CODE_REPLACED
= 'f'
LOG_CODE_REVERTED_REUPLOADED
public
mixed
LOG_CODE_REVERTED_REUPLOADED
= 'r'
LOG_CODE_SET_NO_FILE
public
mixed
LOG_CODE_SET_NO_FILE
= 'NOFIL'
LOG_CODE_STATICSYNC_FILE_MODIFIED
public
mixed
LOG_CODE_STATICSYNC_FILE_MODIFIED
= 'sf'
LOG_CODE_STATUS_CHANGED
public
mixed
LOG_CODE_STATUS_CHANGED
= 's'
LOG_CODE_SYSTEM
public
mixed
LOG_CODE_SYSTEM
= 'S'
LOG_CODE_TRANSFORMED
public
mixed
LOG_CODE_TRANSFORMED
= 't'
LOG_CODE_UNLOCKED
public
mixed
LOG_CODE_UNLOCKED
= 'Y'
LOG_CODE_UNSET_NO_FILE
public
mixed
LOG_CODE_UNSET_NO_FILE
= 'FIL'
LOG_CODE_UNSPECIFIED
public
mixed
LOG_CODE_UNSPECIFIED
= 'U'
LOG_CODE_UPLOADED
public
mixed
LOG_CODE_UPLOADED
= 'u'
LOG_CODE_UPLOADED_PREVIEW
public
mixed
LOG_CODE_UPLOADED_PREVIEW
= 'up'
LOG_CODE_USER_OPT_IN
public
mixed
LOG_CODE_USER_OPT_IN
= 'O'
LOG_CODE_VIEWED
public
mixed
LOG_CODE_VIEWED
= 'v'
LUCIDE_EXTENSIONS
public
mixed
LUCIDE_EXTENSIONS
= [
// Images
'png' => 'image',
'jpg' => 'image',
'jpeg' => 'image',
'gif' => 'image',
'svg' => 'image',
'svgz' => 'image',
'tif' => 'image',
'tiff' => 'image',
'bmp' => 'image',
'ico' => 'image',
'psd' => 'image',
'raw' => 'image',
'dng' => 'image',
'cr2' => 'image',
'nef' => 'image',
'orf' => 'image',
'rw2' => 'image',
// Video
'mp4' => 'video',
'mov' => 'video',
'avi' => 'video',
'mkv' => 'video',
'flv' => 'video',
'fla' => 'video',
'wmv' => 'video',
'3gp' => 'video',
'webm' => 'video',
'vob' => 'video',
'm4v' => 'video',
'mxf' => 'video',
// Audio
'mp3' => 'music',
'wav' => 'music',
'aac' => 'music',
'flac' => 'music',
'm4a' => 'music',
'wma' => 'music',
'ogg' => 'music',
'aif' => 'music',
'aiff' => 'music',
// Documents
'pdf' => 'file-text',
'doc' => 'file-text',
'docx' => 'file-text',
'odt' => 'file-text',
'xls' => 'file-spreadsheet',
'xlsx' => 'file-spreadsheet',
'ods' => 'file-spreadsheet',
'ppt' => 'file-chart-pie',
'pptx' => 'file-chart-pie',
'odp' => 'file-chart-pie',
'rtf' => 'file-text',
'txt' => 'file-text',
'md' => 'file-text',
// Code
'php' => 'file-braces',
'html' => 'file-braces',
'htm' => 'file-braces',
'css' => 'file-braces',
'js' => 'file-braces',
'json' => 'file-braces',
'xml' => 'file-braces',
'sql' => 'file-braces',
'sh' => 'file-braces',
'py' => 'file-braces',
'java' => 'file-braces',
'c' => 'file-braces',
'cpp' => 'file-braces',
'rb' => 'file-braces',
'go' => 'file-braces',
// Compressed
'zip' => 'file-archive',
'rar' => 'file-archive',
'7z' => 'file-archive',
'tar' => 'file-archive',
'gz' => 'file-archive',
'bz2' => 'file-archive',
'xz' => 'file-archive',
'iso' => 'file-archive',
// Miscellaneous
'log' => 'file-text',
'cfg' => 'file-text',
'ini' => 'file-text',
'csv' => 'file-spreadsheet',
// Fonts
'ttf' => 'file-type',
'otf' => 'file-type',
'woff' => 'file-type',
'woff2' => 'file-type',
// Default to 'file' for unrecognized extensions
'default' => 'file',
]
MANAGED_REQUEST
public
mixed
MANAGED_REQUEST
= 1
MIGRATION_FIELD_OPTIONS_DEPRECATED_PREFIX
public
mixed
MIGRATION_FIELD_OPTIONS_DEPRECATED_PREFIX
= '!deprecated'
MIGRATION_FIELD_OPTIONS_DEPRECATED_PREFIX_CATEGORY_TREE
public
mixed
MIGRATION_FIELD_OPTIONS_DEPRECATED_PREFIX_CATEGORY_TREE
= "-1,,!deprecated\n"
MPLUS_FIELD_ID
public
mixed
MPLUS_FIELD_ID
= '__id'
MPLUS_LAST_IMPORT
public
mixed
MPLUS_LAST_IMPORT
= 'last_museumplus_import'
MPLUS_LAST_LOG_TRUNCATE
public
mixed
MPLUS_LAST_LOG_TRUNCATE
= 'last_museumplus_log_truncate'
MPLUS_LOCK
public
mixed
MPLUS_LOCK
= 'museumplus_import'
NODE_NAME_STRING_SEPARATOR
public
mixed
NODE_NAME_STRING_SEPARATOR
= '@@|@@'
NODE_TOKEN_NOT
public
mixed
NODE_TOKEN_NOT
= '!'
NODE_TOKEN_OR
public
mixed
NODE_TOKEN_OR
= '|'
NODE_TOKEN_PREFIX
public
mixed
NODE_TOKEN_PREFIX
= '@@'
NON_FIXED_LIST_SINGULAR_RESOURCE_VALUE_FIELD_TYPES
public
mixed
NON_FIXED_LIST_SINGULAR_RESOURCE_VALUE_FIELD_TYPES
= \array_merge($TEXT_FIELD_TYPES, \array_diff($DATE_FIELD_TYPES, [\FIELD_TYPE_DATE_RANGE]))
NON_PREVIEW_EXTENSIONS
public
mixed
NON_PREVIEW_EXTENSIONS
= ['zip', 'fla']
PHP_VERSION_ID
public
mixed
PHP_VERSION_ID
= $version[0] * 10000 + $version[1] * 100 + $version[2]
PHP_VERSION_SUPPORTED
public
mixed
PHP_VERSION_SUPPORTED
= 80200
REPORT_PLACEHOLDER_NON_CORRELATED_SQL
public
mixed
REPORT_PLACEHOLDER_NON_CORRELATED_SQL
= '[non_correlated_sql]'
RESOURCE_ACCESS_CONFIDENTIAL
public
mixed
RESOURCE_ACCESS_CONFIDENTIAL
= 2
RESOURCE_ACCESS_CUSTOM_GROUP
public
mixed
RESOURCE_ACCESS_CUSTOM_GROUP
= 3
RESOURCE_ACCESS_FULL
public
mixed
RESOURCE_ACCESS_FULL
= 0
RESOURCE_ACCESS_INVALID_REQUEST
public
mixed
RESOURCE_ACCESS_INVALID_REQUEST
= 99
RESOURCE_ACCESS_RESTRICTED
public
mixed
RESOURCE_ACCESS_RESTRICTED
= 1
RESOURCE_ACCESS_TYPES
public
mixed
RESOURCE_ACCESS_TYPES
= [\RESOURCE_ACCESS_FULL, \RESOURCE_ACCESS_RESTRICTED, \RESOURCE_ACCESS_CONFIDENTIAL, \RESOURCE_ACCESS_CUSTOM_GROUP]
RESOURCE_LOG_APPEND_PREVIOUS
public
mixed
RESOURCE_LOG_APPEND_PREVIOUS
= -1
RESOURCE_PREVIEWS_ALL
public
mixed
RESOURCE_PREVIEWS_ALL
= 1
RESOURCE_PREVIEWS_MINIMAL
public
mixed
RESOURCE_PREVIEWS_MINIMAL
= 2
RESOURCE_PREVIEWS_NONE
public
mixed
RESOURCE_PREVIEWS_NONE
= 0
RESOURCESPACE_BASE_PATH
public
mixed
RESOURCESPACE_BASE_PATH
= \dirname(__DIR__)
RS_FILTER_ALL
public
mixed
RS_FILTER_ALL
= 1
RS_FILTER_ANY
public
mixed
RS_FILTER_ANY
= 3
RS_FILTER_NODE_IN
public
mixed
RS_FILTER_NODE_IN
= 1
RS_FILTER_NODE_NOT_IN
public
mixed
RS_FILTER_NODE_NOT_IN
= 0
RS_FILTER_NONE
public
mixed
RS_FILTER_NONE
= 2
RS_SYSTEM_UTILITIES
public
mixed
RS_SYSTEM_UTILITIES
= ['im-convert' => ['required' => \true, 'path_var_name' => 'imagemagick_path', 'display_name' => 'ImageMagick/GraphicsMagick - convert', 'show_on_check_page' => \true, 'version_check' => ['argument' => '', 'callback' => ['fct_name' => 'check_imagemagick_cli_version_found', 'args' => []]]], 'im-identify' => ['required' => \true, 'path_var_name' => 'imagemagick_path', 'display_name' => 'ImageMagick/GraphicsMagick - identify', 'show_on_check_page' => \false, 'version_check' => ['argument' => '', 'callback' => ['fct_name' => 'check_imagemagick_cli_version_found', 'args' => []]]], 'im-composite' => ['required' => \true, 'path_var_name' => 'imagemagick_path', 'display_name' => 'ImageMagick/GraphicsMagick - composite', 'show_on_check_page' => \false, 'version_check' => ['argument' => '', 'callback' => ['fct_name' => 'check_imagemagick_cli_version_found', 'args' => []]]], 'im-mogrify' => ['required' => \true, 'path_var_name' => 'imagemagick_path', 'display_name' => 'ImageMagick/GraphicsMagick - mogrify', 'show_on_check_page' => \false, 'version_check' => ['argument' => '', 'callback' => ['fct_name' => 'check_imagemagick_cli_version_found', 'args' => []]]], 'ghostscript' => ['required' => \true, 'path_var_name' => 'ghostscript_path', 'display_name' => 'Ghostscript', 'show_on_check_page' => \true, 'version_check' => ['argument' => '', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['ghostscript']]]]], 'ffmpeg' => ['required' => \true, 'path_var_name' => 'ffmpeg_path', 'display_name' => 'FFmpeg', 'show_on_check_page' => \true, 'version_check' => ['argument' => '', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['ffmpeg', 'avconv']]]]], 'ffprobe' => ['required' => \true, 'path_var_name' => 'ffmpeg_path', 'display_name' => 'ffprobe', 'show_on_check_page' => \false, 'version_check' => ['argument' => '', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['ffprobe', 'avprobe']]]]], 'exiftool' => ['required' => \true, 'path_var_name' => 'exiftool_path', 'display_name' => 'ExifTool', 'show_on_check_page' => \true, 'version_check' => ['argument' => '-ver', 'callback' => ['fct_name' => 'check_exiftool_cli_version_found', 'args' => []]]], 'php' => ['required' => \false, 'path_var_name' => 'php_path', 'display_name' => 'PHP', 'show_on_check_page' => \false, 'version_check' => ['argument' => '', 'callback' => ['fct_name' => '', 'args' => []]]], 'python' => ['required' => \false, 'path_var_name' => 'python_path', 'display_name' => 'Python', 'show_on_check_page' => \true, 'version_check' => ['argument' => '--version', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['Python']]]]], 'opencv' => ['required' => \false, 'path_var_name' => 'python_path', 'display_name' => 'OpenCV (Python module)', 'show_on_check_page' => \true, 'version_check' => ['argument' => '-c "import cv2; print(cv2.__version__)"', 'callback' => ['fct_name' => 'check_numeric_cli_version_found', 'args' => []]]], 'archiver' => ['required' => \false, 'path_var_name' => 'archiver_path', 'display_name' => 'Archiver', 'show_on_check_page' => \true, 'version_check' => ['argument' => '--help', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['zip', '7z', 'tar']]]]], 'fits' => ['required' => \false, 'path_var_name' => 'fits_path', 'display_name' => 'File Information Tool Set (FITS)', 'show_on_check_page' => \true, 'version_check' => ['argument' => '-v', 'callback' => ['fct_name' => 'check_numeric_cli_version_found', 'args' => []]]], 'pdftotext' => ['required' => \false, 'path_var_name' => 'pdftotext_path', 'display_name' => 'pdftotext', 'show_on_check_page' => \true, 'version_check' => ['argument' => '-v', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['pdftotext']]]]], 'blender' => ['required' => \false, 'path_var_name' => 'blender_path', 'display_name' => 'Blender', 'show_on_check_page' => \true, 'version_check' => ['argument' => '-v', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['blender']]]]], 'unoconvert' => ['required' => \false, 'path_var_name' => 'unoconv_path', 'display_name' => 'Unoserver', 'show_on_check_page' => \true, 'version_check' => ['argument' => '--version', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['unoconvert']]]]], 'calibre' => ['required' => \false, 'path_var_name' => 'calibre_path', 'display_name' => 'Calibre', 'show_on_check_page' => \true, 'version_check' => ['argument' => '--version', 'callback' => ['fct_name' => 'check_utility_cli_version_found_by_name', 'args' => [['calibre']]]]]]
SENSITIVE_VARIABLE_NAMES
public
mixed
SENSITIVE_VARIABLE_NAMES
= [
'mysql_server',
'mysql_username',
'mysql_password',
'mysql_db',
'mysql_log_location',
'mysqli_ssl_server_cert',
'mysqli_ssl_ca_cert',
'read_only_db_username',
'read_only_db_password',
'storagedir',
'storageurl',
'email_notify',
'scramble_key',
'scramble_key_old',
'api_scramble_key',
'smtp_username',
'smtp_password',
'homeanim_folder',
'remote_config_url',
'remote_config_key',
'syncdir',
'debug_log_location',
'log_error_messages_url',
'CORS_whitelist',
'facial_recognition_face_recognizer_models_location',
'fstemplate_alt_scramblekey',
// Plugins
'ldapauth_rootdn',
'ldapauth_rootpass',
'ldapauth',
'tms_link_user',
'tms_link_password',
'youtube_publish_username',
'youtube_publish_password',
'vimeo_publish_client_id',
'vimeo_publish_client_secret',
'vimeo_publish_access_token',
'museumplus_api_user',
'museumplus_api_pass',
'emu_email_notify',
]
SEVERITY_CRITICAL
public
mixed
SEVERITY_CRITICAL
= 0
SEVERITY_NOTICE
public
mixed
SEVERITY_NOTICE
= 2
SEVERITY_WARNING
public
mixed
SEVERITY_WARNING
= 1
STATUS_ACTIVE
public
mixed
STATUS_ACTIVE
= 1
STATUS_COMPLETE
public
mixed
STATUS_COMPLETE
= 2
STATUS_DISABLED
public
mixed
STATUS_DISABLED
= 0
STATUS_ERROR
public
mixed
STATUS_ERROR
= 5
STATUS_INPROGRESS
public
mixed
STATUS_INPROGRESS
= 3
SUBMITTED_COLLECTION
public
mixed
SUBMITTED_COLLECTION
= 5
SUBMITTED_RESOURCE
public
mixed
SUBMITTED_RESOURCE
= 4
SYSTEM_DATABASE_IDS_CHUNK_SIZE
public
mixed
SYSTEM_DATABASE_IDS_CHUNK_SIZE
= 500
SYSTEM_DATABASE_MAX_RETRIES
public
mixed
SYSTEM_DATABASE_MAX_RETRIES
= 2
SYSTEM_DOWNLOAD_CONFIG_FORCE_OBFUSCATION
public
mixed
SYSTEM_DOWNLOAD_CONFIG_FORCE_OBFUSCATION
= \true
SYSTEM_MAX_PREVIEW_ATTEMPTS
public
mixed
SYSTEM_MAX_PREVIEW_ATTEMPTS
= 5
SYSTEM_REQUIRED_PHP_MODULES
public
mixed
SYSTEM_REQUIRED_PHP_MODULES
= ['curl' => 'curl_init', 'gd' => 'imagecrop', 'xml' => 'xml_parser_create', 'mbstring' => 'mb_strtoupper', 'intl' => 'locale_get_default', 'json' => 'json_decode', 'zip' => 'zip_open', 'apcu' => 'apcu_fetch', 'dom' => 'dom_import_simplexml', 'mysqli' => 'mysqli_init']
SYSTEM_UPGRADE_LEVEL
public
mixed
SYSTEM_UPGRADE_LEVEL
= 30
TAG_EDITOR_DELIMITER
public
mixed
TAG_EDITOR_DELIMITER
= '~'
THEME_IMAGES_NUMBER
public
mixed
THEME_IMAGES_NUMBER
= 3
THIS_PROCESS_LOCK
public
mixed
THIS_PROCESS_LOCK
= 'watchedsearchescron'
TINYMCE_VALID_PLUGINS
public
mixed
TINYMCE_VALID_PLUGINS
= ['autolink' => 'Autolink', 'autoresize' => 'Autoresize', 'charmap' => 'Character Map', 'code' => 'Code', 'directionality' => 'Directionality', 'emoticons' => 'Emoticons', 'fullscreen' => 'Full Screen', 'help' => 'Help', 'insertdatetime' => 'Insert Date/Time', 'link' => 'Link', 'lists' => 'Lists', 'advlist' => 'List Styles', 'nonbreaking' => 'Nonbreaking Space', 'preview' => 'Preview', 'quickbars' => 'Quick Toolbars', 'searchreplace' => 'Search and Replace', 'visualblocks' => 'Visual Blocks', 'visualchars' => 'Visual Characters', 'wordcount' => 'Word Count']
TMS_LINK_MODULES_MIGRATED
public
mixed
TMS_LINK_MODULES_MIGRATED
= 'tms_link_modules_migrated'
UNREGISTER_WRAPPERS
public
mixed
UNREGISTER_WRAPPERS
= ['ftp', 'ftps', 'phar']
UPLOAD_ICON
public
mixed
UPLOAD_ICON
= '<i aria-hidden="true" class="icon-upload"></i> '
USER_REQUEST
public
mixed
USER_REQUEST
= 3
VIEW_IN_BROWSER_EXTENSIONS
public
mixed
VIEW_IN_BROWSER_EXTENSIONS
= ['pdf', 'mp3']
WORKFLOW_DEFAULT_ICON
public
mixed
WORKFLOW_DEFAULT_ICON
= "workflow"
WORKFLOW_DEFAULT_ICONS
public
mixed
WORKFLOW_DEFAULT_ICONS
= ['-2' => 'clock-arrow-up', '-1' => 'clock-fading', '0' => 'check', '1' => 'file-clock', '2' => 'file-archive', '3' => 'file-x']
Functions
get_user_actions()
Retrieve a list of user actions for the My Actions area.
get_user_actions([bool $countonly = false ][, string $type = "" ][, string $order_by = "date" ][, string $sort = "DESC" ]) : mixed
Parameters
- $countonly : bool = false
-
Return the count of actions instead of the actions themselves
- $type : string = ""
-
Filter the actions based on action type The available inputs are: resourcereview resourcerequest userrequest
- $order_by : string = "date"
- $sort : string = "DESC"
Return values
mixed —Count or array of actions
get_editable_resource_sql()
Return an SQL statement to find all editable resources in $actions_notify_states.
get_editable_resource_sql() : mixed
get_user_actions_recent()
Get recent user actions, optionally for all users. For use by action notifications cron job.
get_user_actions_recent(int $minutes, bool $allusers) : array<string|int, mixed>
Parameters
- $minutes : int
-
Return actions that were created in the last $minutes minutes
- $allusers : bool
-
Return actions for all users? If false, or if the current user does not have the 'a' permission and the current script is not running from CLI then only the currently logged on user's actions will be returned
Return values
array<string|int, mixed> —An array with the user id as the index and the following arrays of sub elements. Included columns are as per get_user_actions()
- resourcerequest - array of resource requests
- userrequest - array of user requests
- resourcereview - array of resources to reviewdescription)
actions_filter_by_user()
Filter actions in the provided array to return only those applicable to the given user
actions_filter_by_user(int $actionuser, array<string|int, mixed> $actions) : array<string|int, mixed>
Parameters
- $actionuser : int
-
User ref to get actions for
- $actions : array<string|int, mixed>
-
Array of actions as returned by get_user_actions_recent()
Return values
array<string|int, mixed> —Subset of actions for the given user as would be provided by get_user_actions()
ajax_permission_denied()
Returns a standard AJAX response for unauthorised access
ajax_permission_denied() : void
The function will return a 401 HTTP status code.
ajax_send_response()
Send AJAX response back to the client together with the appropriate HTTP status code
ajax_send_response(int $code, array<string|int, mixed> $response) : void
Parameters
- $code : int
-
HTTP status code for this response
- $response : array<string|int, mixed>
-
Response data (@see other ajax_response_* functions for expected structure)
ajax_send_text_response()
Send AJAX text/html response back to the client together with the appropriate HTTP status code
ajax_send_text_response(int $code, string $response) : void
Parameters
- $code : int
-
HTTP status code for this response
- $response : string
-
Response data (text/html)
ajax_response_ok()
Builds the correct response expected for a success request where there is data to return (e.g getting search results)
ajax_response_ok(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
-
Data to be returned back to the client
Return values
array<string|int, mixed>ajax_response_fail()
Builds the correct response expected for failures.
ajax_response_fail(array<string|int, mixed> $data) : array<string|int, mixed>
When a call is rejected due to invalid data or call conditions, the response data key contains an object explaining what went wrong, typically a hash of validation errors.
Parameters
- $data : array<string|int, mixed>
-
Provides details of why the request failed. If the reasons for failure correspond to POST values, the response objects' keys SHOULD correspond to those POST values. If generic, use message key instead (@see ajax_build_message() ).
Return values
array<string|int, mixed>ajax_response_ok_no_data()
Builds the correct response expected for a success request where there is no data to return (e.g when deleting a record)
ajax_response_ok_no_data() : array<string|int, mixed>
Return values
array<string|int, mixed>ajax_unauthorized()
Returns a standard AJAX response for unauthorised access with a 401 HTTP status code
ajax_unauthorized() : void
ajax_build_message()
Builds a message to be used in an AJAX response
ajax_build_message(string $msg) : array<string|int, mixed>
Parameters
- $msg : string
-
An end-user message explaining what happened (as a generic message for fails or part of errors)
Return values
array<string|int, mixed> —Returns a message
get_annotate_fields()
Get (viewable) "annotate_fields" config. The configs' value is validated (e.g. view access, supported type, active RTF, excluded RT, etc.).
get_annotate_fields() : array<string|int, mixed>
Return values
array<string|int, mixed>get_all_viable_annotate_metadata_fields()
Get all metadata fields which could be used for the annotate feature. Removes inapplicable fields when excluding specific resource types.
get_all_viable_annotate_metadata_fields(array<int, int> $exclude_resource_types) : array<string|int, mixed>
Parameters
- $exclude_resource_types : array<int, int>
-
List of Resource types to exclude
Return values
array<string|int, mixed>getAnnotation()
Get annotation by ID
getAnnotation(int $ref) : array<string|int, mixed>
Parameters
- $ref : int
-
Annotation ID
Return values
array<string|int, mixed>getAnnotations()
General annotations search functionality
getAnnotations([int $resource = 0 ][, int $resource_type_field = 0 ][, int $user = 0 ][, int $page = 0 ]) : array<string|int, mixed>
Parameters
- $resource : int = 0
- $resource_type_field : int = 0
- $user : int = 0
- $page : int = 0
Tags
Return values
array<string|int, mixed>getResourceAnnotationsCount()
Get number of annotations available for a resource.
getResourceAnnotationsCount(int $resource) : int
Note: multi page resources will show the total number (ie. all pages)
Parameters
- $resource : int
-
Resource ID
Tags
Return values
intgetResourceAnnotations()
Get annotations for a specific resource
getResourceAnnotations(int $resource[, int $page = 0 ]) : array<string|int, mixed>
Parameters
- $resource : int
-
Resource ID
- $page : int = 0
-
Page number of a document. Non documents will have 0
Return values
array<string|int, mixed>getAnnotoriousResourceAnnotations()
Create an array of Annotorious annotation objects which can be JSON encoded and passed directly to Annotorious
getAnnotoriousResourceAnnotations(int $resource[, int $page = 0 ][, array{k?: string} $ctx = [] ]) : array<string|int, mixed>
Parameters
- $resource : int
-
Resource ID
- $page : int = 0
-
Page number of a document
- $ctx : array{k?: string} = []
-
Environment context (e.g. external share)
Return values
array<string|int, mixed>annotationEditable()
Check if an annotation can be editable (add/ edit + remove) by the user. Please note that Annotorious JS library is treating edit & remove as the same under the "editable" property.
annotationEditable(array<string|int, mixed> $annotation, array{k?: string} $ctx) : bool
Parameters
- $annotation : array<string|int, mixed>
- $ctx : array{k?: string}
-
Environment context (e.g. external share)
Tags
Return values
boolgetAnnotationTags()
Get all tags of an annotation. Checks if a tag is attached to the resource, allowing the user to search by it which is represented by the virtual column "tag_searchable"
getAnnotationTags(array<string|int, mixed> $annotation) : array<string|int, mixed>
Parameters
- $annotation : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>deleteAnnotation()
Delete annotation
deleteAnnotation(array<string|int, mixed> $annotation, array{k?: string} $ctx) : bool
Parameters
- $annotation : array<string|int, mixed>
-
Annotation array as returned by getAnnotation()
- $ctx : array{k?: string}
-
Environment context (e.g. external share)
Tags
Return values
boolcreateAnnotation()
Create new annotations based on Annotorious annotation
createAnnotation(array<string|int, mixed> $annotation, array{k?: string} $ctx) : bool|int
NOTE: Annotorious annotation shape is an array but at the moment they use only the first shape found
Parameters
- $annotation : array<string|int, mixed>
- $ctx : array{k?: string}
-
Environment context (e.g. external share)
Return values
bool|int —Returns false on failure OR the ref of the newly created annotation
updateAnnotation()
Update (field bound) annotation and its tags, if applicable.
updateAnnotation(array<string|int, mixed> $annotation, array{k?: string} $ctx) : bool
Text (comment) annotatins can't be updated (same as the comments logic for those with o perm).
Parameters
- $annotation : array<string|int, mixed>
- $ctx : array{k?: string}
-
Environment context (e.g. external share)
Tags
Return values
booladdAnnotationNodes()
Add relations between annotation and nodes
addAnnotationNodes(int $annotation_ref, array<string|int, mixed> $nodes) : bool
Parameters
- $annotation_ref : int
-
The annotation ID in ResourceSpace
- $nodes : array<string|int, mixed>
-
List of node structures get_nodes(). Only the "ref" property is required.
Tags
Return values
boolprepareTags()
Utility function which allows annotation tags to be prepared (i.e make sure they are all valid nodes) before creating associations between annotations and tags
prepareTags(array<string|int, mixed> $dirty_tags) : array<string|int, mixed>
Parameters
- $dirty_tags : array<string|int, mixed>
-
Original array of tags. These can be (in)valid tags/ new tags. IMPORTANT: a tag should have the same structure as a node
Tags
Return values
array<string|int, mixed>search_add_annotation_count()
Add annotation count to a search result set
search_add_annotation_count(mixed &$result) : mixed
Parameters
- $result : mixed
get_annotorious_lang()
Get all translations relevant to the Annotorious (RSTagging) plugin.
get_annotorious_lang(array<string, string> $map) : array<string|int, mixed>
Parameters
- $map : array<string, string>
-
Language strings map
Return values
array<string|int, mixed>get_annotorious_resourcespace_config()
Get all ResourceSpace config options relevant for the Annotorious (RSTagging) plugin functionality.
get_annotorious_resourcespace_config() : array<string|int, mixed>
Return values
array<string|int, mixed>get_valid_annotate_field_types()
Get list of allowed field types to be configured for the "annotate_fields" option
get_valid_annotate_field_types() : array<string|int, mixed>
Return values
array<string|int, mixed>get_annotate_file_path()
Get annotate file path (old annotate plugin logic)
get_annotate_file_path(int $ref, bool $getfilepath, string $extension) : string
Parameters
- $ref : int
- $getfilepath : bool
- $extension : string
Return values
stringcreate_annotated_pdf()
Create annotations PDF (old annotate plugin logic)
create_annotated_pdf(int $ref[, bool $is_collection = false ][, string $size = "letter" ][, bool $cleanup = false ][, bool $preview = false ]) : mixed
Parameters
- $ref : int
- $is_collection : bool = false
- $size : string = "letter"
- $cleanup : bool = false
- $preview : bool = false
annotation_pdf_class()
Utility function to generate a one-off TCPDF variant (with multiRow method)
annotation_pdf_class() : mixed
resource_can_be_annotated()
Check if a resource can be annotated
resource_can_be_annotated(int $ref) : bool
Parameters
- $ref : int
-
Resource ID
Return values
boolresource_type_applicable_for_annotations()
Check if a given resource type is applicable for annotations
resource_type_applicable_for_annotations(int $ref) : bool
Parameters
- $ref : int
-
Resource type ID
Return values
boolapi_do_search()
api_do_search(mixed $search[, mixed $restypes = "" ][, mixed $order_by = "relevance" ][, mixed $archive = 0 ][, mixed $fetchrows = -1 ][, mixed $sort = "desc" ][, mixed $offset = 0 ]) : mixed
Parameters
- $search : mixed
- $restypes : mixed = ""
- $order_by : mixed = "relevance"
- $archive : mixed = 0
- $fetchrows : mixed = -1
- $sort : mixed = "desc"
- $offset : mixed = 0
api_search_get_previews()
api_search_get_previews(mixed $search[, mixed $restypes = "" ][, mixed $order_by = "relevance" ][, mixed $archive = 0 ][, mixed $fetchrows = -1 ][, mixed $sort = "desc" ][, mixed $recent_search_daylimit = "" ][, mixed $getsizes = "" ][, mixed $previewext = "jpg" ]) : mixed
Parameters
- $search : mixed
- $restypes : mixed = ""
- $order_by : mixed = "relevance"
- $archive : mixed = 0
- $fetchrows : mixed = -1
- $sort : mixed = "desc"
- $recent_search_daylimit : mixed = ""
- $getsizes : mixed = ""
- $previewext : mixed = "jpg"
api_get_resource_field_data()
api_get_resource_field_data(mixed $resource) : mixed
Parameters
- $resource : mixed
api_create_resource()
api_create_resource(mixed $resource_type[, mixed $archive = 999 ][, mixed $url = "" ][, mixed $no_exif = false ][, mixed $revert = false ][, mixed $autorotate = false ][, mixed $metadata = "" ]) : mixed
Parameters
- $resource_type : mixed
- $archive : mixed = 999
- $url : mixed = ""
- $no_exif : mixed = false
- $revert : mixed = false
- $autorotate : mixed = false
- $metadata : mixed = ""
api_update_field()
Provides simple way to update field by passing in simple string values for text fields, comma separated values for fixed list (node) fields, using double quotes to enclose strings and backslash as escape character Uses update_field and add_resource_nodes/delete_resource_nodes
api_update_field(mixed $resource, mixed $field, mixed $value[, mixed $nodevalues = false ]) : mixed
Parameters
- $resource : mixed
- $field : mixed
- $value : mixed
- $nodevalues : mixed = false
api_delete_resource()
api_delete_resource(mixed $resource) : mixed
Parameters
- $resource : mixed
api_copy_resource()
api_copy_resource(mixed $from[, mixed $resource_type = -1 ]) : mixed
Parameters
- $from : mixed
- $resource_type : mixed = -1
api_get_resource_log()
api_get_resource_log(mixed $resource[, mixed $fetchrows = -1 ]) : mixed
Parameters
- $resource : mixed
- $fetchrows : mixed = -1
api_update_resource_type()
api_update_resource_type(mixed $resource, mixed $type) : mixed
Parameters
- $resource : mixed
- $type : mixed
api_get_resource_path()
{@see get_resource_path()}
api_get_resource_path(mixed $ref[, mixed $not_used = null ][, mixed $size = "" ][, mixed $generate = true ][, mixed $extension = "jpg" ][, mixed $page = 1 ][, mixed $watermarked = false ][, mixed $alternative = -1 ][, bool $write_metadata = false ]) : mixed
Parameters
- $ref : mixed
- $not_used : mixed = null
- $size : mixed = ""
- $generate : mixed = true
- $extension : mixed = "jpg"
- $page : mixed = 1
- $watermarked : mixed = false
- $alternative : mixed = -1
- $write_metadata : bool = false
-
Specify if embedded metadata should be written to the requested file (if applicable).
api_get_resource_data()
api_get_resource_data(mixed $resource) : mixed
Parameters
- $resource : mixed
api_put_resource_data()
api_put_resource_data(mixed $resource, array<string|int, mixed> $data) : mixed
Parameters
- $resource : mixed
- $data : array<string|int, mixed>
api_get_alternative_files()
api_get_alternative_files(mixed $resource[, mixed $order_by = "" ][, mixed $sort = "" ][, mixed $type = "" ]) : mixed
Parameters
- $resource : mixed
- $order_by : mixed = ""
- $sort : mixed = ""
- $type : mixed = ""
api_get_resource_types()
api_get_resource_types() : mixed
api_add_alternative_file()
api_add_alternative_file(mixed $resource, mixed $name[, mixed $description = '' ][, mixed $file_name = '' ][, mixed $file_extension = '' ][, mixed $file_size = 0 ][, mixed $alt_type = '' ][, mixed $file = '' ]) : mixed
Parameters
- $resource : mixed
- $name : mixed
- $description : mixed = ''
- $file_name : mixed = ''
- $file_extension : mixed = ''
- $file_size : mixed = 0
- $alt_type : mixed = ''
- $file : mixed = ''
api_delete_access_keys()
api_delete_access_keys(mixed $access_keys, mixed $resources, mixed $collections) : mixed
Parameters
- $access_keys : mixed
- $resources : mixed
- $collections : mixed
api_delete_alternative_file()
api_delete_alternative_file(mixed $resource, mixed $ref) : mixed
Parameters
- $resource : mixed
- $ref : mixed
api_upload_file()
api_upload_file(mixed $ref[, mixed $no_exif = false ][, mixed $revert = false ][, mixed $autorotate = false ][, mixed $file_path = "" ]) : mixed
Parameters
- $ref : mixed
- $no_exif : mixed = false
- $revert : mixed = false
- $autorotate : mixed = false
- $file_path : mixed = ""
api_upload_file_by_url()
api_upload_file_by_url(mixed $ref[, mixed $no_exif = false ][, mixed $revert = false ][, mixed $autorotate = false ][, mixed $url = "" ]) : mixed
Parameters
- $ref : mixed
- $no_exif : mixed = false
- $revert : mixed = false
- $autorotate : mixed = false
- $url : mixed = ""
api_get_related_resources()
api_get_related_resources(mixed $ref) : mixed
Parameters
- $ref : mixed
api_get_field_options()
api_get_field_options(mixed $ref[, mixed $nodeinfo = false ]) : mixed
Parameters
- $ref : mixed
- $nodeinfo : mixed = false
api_get_nodes()
api_get_nodes(mixed $ref[, mixed $parent = null ][, mixed $recursive = false ][, mixed $offset = null ][, mixed $rows = null ][, mixed $name = "" ][, mixed $use_count = false ][, mixed $order_by_translated_name = false ]) : mixed
Parameters
- $ref : mixed
- $parent : mixed = null
- $recursive : mixed = false
- $offset : mixed = null
- $rows : mixed = null
- $name : mixed = ""
- $use_count : mixed = false
- $order_by_translated_name : mixed = false
api_get_user_collections()
api_get_user_collections() : mixed
api_add_resource_to_collection()
api_add_resource_to_collection(mixed $resource[, mixed $collection = '' ][, mixed $search = '' ]) : mixed
Parameters
- $resource : mixed
- $collection : mixed = ''
- $search : mixed = ''
api_collection_add_resources()
api_collection_add_resources([mixed $collection = '' ][, mixed $resources = '' ][, mixed $search = '' ][, mixed $selected = false ]) : mixed
Parameters
- $collection : mixed = ''
- $resources : mixed = ''
- $search : mixed = ''
- $selected : mixed = false
api_remove_resource_from_collection()
api_remove_resource_from_collection(mixed $resource[, mixed $collection = '' ]) : mixed
Parameters
- $resource : mixed
- $collection : mixed = ''
api_collection_remove_resources()
api_collection_remove_resources([mixed $collection = '' ][, mixed $resources = '' ][, mixed $removeall = false ][, mixed $selected = false ]) : mixed
Parameters
- $collection : mixed = ''
- $resources : mixed = ''
- $removeall : mixed = false
- $selected : mixed = false
api_create_collection()
api_create_collection(mixed $name[, mixed $forupload = false ]) : mixed
Parameters
- $name : mixed
- $forupload : mixed = false
api_delete_collection()
api_delete_collection(mixed $ref) : mixed
Parameters
- $ref : mixed
api_search_public_collections()
api_search_public_collections([mixed $search = "" ][, mixed $order_by = "name" ][, mixed $sort = "ASC" ][, mixed $exclude_themes = true ][, mixed $exclude_public = false ]) : mixed
Parameters
- $search : mixed = ""
- $order_by : mixed = "name"
- $sort : mixed = "ASC"
- $exclude_themes : mixed = true
- $exclude_public : mixed = false
api_set_node()
api_set_node(mixed $ref, mixed $resource_type_field, mixed $name[, mixed $parent = '' ][, mixed $order_by = 0 ][, mixed $returnexisting = false ]) : mixed
Parameters
- $ref : mixed
- $resource_type_field : mixed
- $name : mixed
- $parent : mixed = ''
- $order_by : mixed = 0
- $returnexisting : mixed = false
api_add_resource_nodes()
api_add_resource_nodes(mixed $resource, mixed $nodestring) : mixed
Parameters
- $resource : mixed
- $nodestring : mixed
api_add_resource_nodes_multi()
api_add_resource_nodes_multi(mixed $resources, mixed $nodestring) : mixed
Parameters
- $resources : mixed
- $nodestring : mixed
api_resource_log_last_rows()
api_resource_log_last_rows([mixed $minref = 0 ][, mixed $days = 7 ][, mixed $maxrecords = 0 ][, string $field = '' ][, string $log_code = '' ]) : mixed
Parameters
- $minref : mixed = 0
- $days : mixed = 7
- $maxrecords : mixed = 0
- $field : string = ''
- $log_code : string = ''
api_get_resource_all_image_sizes()
api_get_resource_all_image_sizes(mixed $resource) : mixed
Parameters
- $resource : mixed
api_get_node_id()
api_get_node_id(mixed $value, mixed $resource_type_field) : mixed
Parameters
- $value : mixed
- $resource_type_field : mixed
api_replace_resource_file()
api_replace_resource_file(mixed $ref, mixed $file_location[, mixed $no_exif = false ][, mixed $autorotate = false ][, mixed $keep_original = true ]) : mixed
Parameters
- $ref : mixed
- $file_location : mixed
- $no_exif : mixed = false
- $autorotate : mixed = false
- $keep_original : mixed = true
api_get_data_by_field()
API binding to get_data_by_field function.
api_get_data_by_field(int $ref, int $field) : bool|array<string|int, mixed>
Parameters
- $ref : int
-
Resource ref
- $field : int
-
Resource type field ref
Return values
bool|array<string|int, mixed>api_get_resource_collections()
API binding to modified get_resource_collections function, as we only want to pass collection ID, name, and description for security purposes.
api_get_resource_collections(int $ref) : bool|array<string|int, mixed>
Parameters
- $ref : int
-
Resource ref
Return values
bool|array<string|int, mixed>api_update_related_resource()
api_update_related_resource(mixed $ref, mixed $related[, mixed $add = 1 ]) : mixed
Parameters
- $ref : mixed
- $related : mixed
- $add : mixed = 1
api_get_collections_resource_count()
api_get_collections_resource_count(string $refs) : mixed
Parameters
- $refs : string
api_get_users()
api_get_users([mixed $find = "" ][, mixed $exact_username_match = false ]) : mixed
Parameters
- $find : mixed = ""
- $exact_username_match : mixed = false
api_save_collection()
api_save_collection(int $ref, array<string|int, mixed> $coldata) : mixed
Parameters
- $ref : int
- $coldata : array<string|int, mixed>
api_get_collection()
api_get_collection(int $ref) : mixed
Parameters
- $ref : int
api_send_user_message()
api_send_user_message(mixed $users, mixed $text) : mixed
Parameters
- $users : mixed
- $text : mixed
api_get_profile_image()
api_get_profile_image(mixed $user) : mixed
Parameters
- $user : mixed
api_get_system_status()
api_get_system_status([mixed $basic = false ]) : mixed
Parameters
- $basic : mixed = false
api_relate_all_resources()
api_relate_all_resources(mixed $related) : mixed
Parameters
- $related : mixed
api_show_hide_collection()
api_show_hide_collection(mixed $collection, mixed $show, mixed $user) : mixed
Parameters
- $collection : mixed
- $show : mixed
- $user : mixed
api_send_collection_to_admin()
api_send_collection_to_admin(mixed $collection) : mixed
Parameters
- $collection : mixed
api_reorder_featured_collections()
api_reorder_featured_collections(mixed $refs) : mixed
Parameters
- $refs : mixed
api_get_dash_search_data()
api_get_dash_search_data(mixed $link, mixed $promimg) : mixed
Parameters
- $link : mixed
- $promimg : mixed
api_reorder_tabs()
api_reorder_tabs(mixed $refs) : mixed
Parameters
- $refs : mixed
api_delete_tabs()
api_delete_tabs(mixed $refs) : mixed
Parameters
- $refs : mixed
api_save_tab()
api_save_tab(mixed $tab) : mixed
Parameters
- $tab : mixed
api_mark_email_as_invalid()
api_mark_email_as_invalid(mixed $email) : mixed
Parameters
- $email : mixed
api_get_user_message()
api_get_user_message(mixed $ref) : mixed
Parameters
- $ref : mixed
api_get_users_by_permission()
api_get_users_by_permission(mixed $permissions) : mixed
Parameters
- $permissions : mixed
api_upload_multipart()
Upload files using HTTP multipart.
api_upload_multipart(int $ref, bool $no_exif, bool $revert[, bool $previewonly = false ][, int $alternative = 0 ][, bool $autorotate = false ]) : array<string|int, mixed>
Parameters
- $ref : int
-
Resource ID
- $no_exif : bool
-
Do not extract embedded metadata
- $revert : bool
-
Delete all data and re-extract embedded data
- $previewonly : bool = false
-
Will use the uploaded file to replace preview image only
- $alternative : int = 0
-
Use the uploaded file to replace the alternative file with the given ID Note that api_add_alternative_file() must be called first if creating a new alternative file If an $alternative identifier is specified then $previewonly is ignored and set to false
- $autorotate : bool = false
-
Automatically rotate (correct) images
Return values
array<string|int, mixed> —Returns JSend data back ajax_functions.php if upload failed, otherwise 204 HTTP status
api_get_resource_type_fields()
Get metadata field information for all (matching) fields.
api_get_resource_type_fields([string $by_resource_types = '' ][, string $find = '' ][, string $by_types = '' ]) : array<string|int, mixed>
Parameters
- $by_resource_types : string = ''
-
Filter result by resource type. If multiple, use a CSV of resource types.
- $find : string = ''
-
Filter result by fuzzy searching in different properties (e.g name, title, ref, help text etc)
- $by_types : string = ''
-
Filter result by field type (FIELD_TYPE_* constants). If multiple, use a CSV of field types.
Return values
array<string|int, mixed> —Returns the matching fields' information or 403 HTTP status if not authorised
api_create_resource_type_field()
Create metadata field
api_create_resource_type_field(string $name, string $resource_types, int $type) : array<string|int, mixed>
Parameters
- $name : string
-
Field name
- $resource_types : string
-
CSV of applicable resource types for this field. Use 0 (zero) for global, for others \API
- $type : int
-
Metadata field type. For values, FIELD_TYPE_* constants
Return values
array<string|int, mixed> —Returns JSend data back ajax_functions.php and 200 HTTP status or 403 HTTP status if not authorised
api_get_featured_collections()
Expose {@see get_featured_collections} to the API
api_get_featured_collections(int $parent) : array<string|int, mixed>
Parameters
- $parent : int
-
The feature collection parent's ref. Use 0 for obtaining the root ones.
Return values
array<string|int, mixed>api_get_edit_access()
api_get_edit_access(int $resource) : bool
Parameters
- $resource : int
Return values
boolapi_toggle_active_state_for_nodes()
Toggle active state for nodes
api_toggle_active_state_for_nodes(array<string|int, mixed> $refs) : array<string|int, mixed>
Parameters
- $refs : array<string|int, mixed>
-
List of node IDs
Tags
Return values
array<string|int, mixed> —Returns the affected nodes' active state (including empty list) and 403 HTTP status if not authorised.
api_get_processing_message()
Expose {@see get_processing_message} to the API
api_get_processing_message() : false|array<string|int, mixed>
Return values
false|array<string|int, mixed>api_checkperm()
Expose {@see checkperm} to the API
api_checkperm(string $perm) : bool
Parameters
- $perm : string
-
The permissions string to check for.
Return values
boolapi_get_resource_access()
Expose {@see get_resource_access} to the API
api_get_resource_access(int $resource) : false|int
Parameters
- $resource : int
-
The reference ID of the resource.
Return values
false|int —The access level for the resource, or false if a number was not supplied.
api_resource_file_readonly()
Exposing {@see resource_file_readonly} to the API
api_resource_file_readonly(int|numeric-string $ref) : array<string|int, mixed>
Parameters
- $ref : int|numeric-string
-
Resource ID
Tags
Return values
array<string|int, mixed>api_delete_resources_in_collection()
Exposing {@see delete_resources_in_collection} to the API
api_delete_resources_in_collection(int $collection) : bool
Parameters
- $collection : int
-
ID of collection containing resources to be deleted.
Return values
boolapi_new_user()
Exposing {@see new_user} to the API
api_new_user(string $username[, int $usergroup = 0 ]) : array<string|int, mixed>
Parameters
- $username : string
-
- username to create
- $usergroup : int = 0
-
- optional usergroup to assign
Return values
array<string|int, mixed> —Returns JSend data back ajax_functions.php with the ref value (id of new user or false if user already exists / permission denied, or -2 if user limit reached) and 200 HTTP status or 409 HTTP status if an issue is detected.
api_save_user()
Exposing {@see save_user} to the API
api_save_user(string $ref, string $data) : array<string|int, mixed>
Parameters
- $ref : string
-
ID of the user
- $data : string
-
Data to save in JSON format (optional, will use posted data otherwise)
Return values
array<string|int, mixed> —Returns JSend data back ajax_functions.php and 200 HTTP status or 409 HTTP status with reason in the response
api_get_resource_comments()
Make resource comments available to the API.
api_get_resource_comments(int $resource_ref[, bool $flat_view = false ]) : array<string|int, mixed>
Parameters
- $resource_ref : int
-
ID of resource to get comments for.
- $flat_view : bool = false
-
Provide comments as nested tree view (this is the default mode) or a flat list most recent first. See config: $comments_flat_view
Return values
array<string|int, mixed> —Array of resource comment data. Array will be empty if comments are not enabled on the system or user has insufficient permissions to view comments.
api_delete_comment()
Allow comment to be deleted via the API.
api_delete_comment(int $comment_ref) : bool
Not for comments linked to annotations.
Parameters
- $comment_ref : int
-
ID of the comment to be deleted.
Return values
bool —False if comments are not enabled on the system, user has insufficient permissions or the comment being deleted is linked to an annotation - this will delete only standard comments.
api_get_reports()
Return a list of reports using the API.
api_get_reports() : array<string|int, mixed>
Return values
array<string|int, mixed> —Reports (name and ID) ordered by name asc. The array will be empty if user has insufficient permissions.
api_do_report()
Run report via the API.
api_do_report(int $report_ref[, string $from_date = '' ][, string $to_date = '' ]) : array<string|int, mixed>|bool
Where report includes a "thumbnail" column which would normally display an image on the report, the thumbnail key will contain a base64 encoded thumbnail image in jpg format. A "thumbnail_view_link" key will also be added containing a link to the resource.
Parameters
- $report_ref : int
-
ID of the report to run.
- $from_date : string = ''
-
Start date for the report period in format YYYY-MM-DD.
- Optional here - not all reports use a date range but some may need it. Check report SQL. If not set $from_date will default to 7 days ago as when running a report in RS.
- $to_date : string = ''
-
End date for the report period in format YYYY-MM-DD.
- Optional here - not all reports use a date range but some may need it. Check report SQL. If not set $to_date will default to today as when running a report in RS.
Return values
array<string|int, mixed>|bool —Array of report data on success or false if user has insufficient permissions or there was an input error.
get_api_key()
Return a private scramble key for this user.
get_api_key(int $user) : string|false
Parameters
- $user : int
-
The user ID
Return values
string|falsecheck_api_key()
Check a query is signed correctly.
check_api_key(string $username, string $querystring, string $sign[, string $authmode = "userkey" ]) : bool
Parameters
- $username : string
-
The username of the calling user
- $querystring : string
-
The query being passed to the API
- $sign : string
-
The signature to check
- $authmode : string = "userkey"
-
The type of key being provided (user key or session key)
Return values
boolexecute_api_call()
Execute the specified API function.
execute_api_call(string $query[, bool $pretty = false ]) : bool|string
Parameters
- $query : string
-
The query string passed to the API
- $pretty : bool = false
-
Should the JSON encoded result be 'pretty' i.e. formatted for reading?
Return values
bool|stringget_session_api_key()
Return the session specific key for the given user.
get_session_api_key(int $user) : string
Parameters
- $user : int
-
The user ID
Return values
stringapi_login()
API login function
api_login(string $username, string $password) : string|false
Parameters
- $username : string
-
Username
- $password : string
-
Password to validate
Return values
string|false —FALSE if invalid, session API key if valid
api_validate_upload_url()
Validate URL supplied in APIs create resource or upload by URL. Requires the URL hostname to be added in config $api_upload_urls
api_validate_upload_url(string $url) : bool
Parameters
- $url : string
-
The full URL.
Return values
bool —Returns true if a valid URL is found.
assert_post_request()
Assert API request is using POST method.
assert_post_request(bool $force) : array<string|int, mixed>
Parameters
- $force : bool
-
Force the assertion
Return values
array<string|int, mixed> —Returns JSend data back ajax_functions.php if not POST method
assert_content_type()
Assert API sent the expected content type.
assert_content_type(string $expected, string $received_raw) : array<string|int, mixed>
Parameters
- $expected : string
-
MIME type
- $received_raw : string
-
MIME type
Return values
array<string|int, mixed> —Returns JSend data back ajax_functions.php if received Content-Type is unexpected
api_get_daily_stat_summary()
Return a summary of daily statistics
api_get_daily_stat_summary([int $days = 30 ]) : mixed
Parameters
- $days : int = 30
-
The number of days - note max 365 days as only the current and previous year's data is accessed.
get_user_collections()
Return all collections belonging to or shared with $user
get_user_collections(int $user[, string $find = "" ][, string $order_by = "name" ][, string $sort = "ASC" ][, int $fetchrows = -1 ][, bool $auto_create = true ]) : array<string|int, mixed>
Parameters
- $user : int
- $find : string = ""
-
A search string
- $order_by : string = "name"
-
Column to sort by
- $sort : string = "ASC"
-
ASC or DESC sort order
- $fetchrows : int = -1
-
How many rows to fetch
- $auto_create : bool = true
-
Create a standard "Default Collection" if one doesn't exist
Return values
array<string|int, mixed>get_collection()
Returns all data for collection $ref.
get_collection(int $ref[, bool $usecache = false ]) : array<string|int, mixed>|bool
Parameters
- $ref : int
-
Collection ID
- $usecache : bool = false
-
Optionally retrieve from cache
Return values
array<string|int, mixed>|boolget_collection_resources()
Returns all resources in collection
get_collection_resources(int $collection) : array<string|int, mixed>|bool
Parameters
- $collection : int
-
ID of collection being requested
Return values
array<string|int, mixed>|boolget_collection_resources_with_data()
Get all resources in a collection without checking permissions or filtering by workflow states.
get_collection_resources_with_data(int $ref) : array<string|int, mixed>
This is useful when you want to get all the resources for further subprocessing (@see render_selected_collection_actions() as an example)
Parameters
- $ref : int
-
Collection ID
Return values
array<string|int, mixed>add_resource_to_collection()
Add resource $resource to collection $collection
add_resource_to_collection(int $resource, int $collection[, bool $smartadd = false ][, string $size = "" ][, string $addtype = "" ][, bool $col_access_control = null ][, array<string|int, mixed> $external_shares = null ][, string $search = '' ][, int $sort_order = null ]) : bool|string
Parameters
- $resource : int
- $collection : int
- $smartadd : bool = false
- $size : string = ""
- $addtype : string = ""
- $col_access_control : bool = null
-
Collection access control. Is user allowed to add to it? You can leave it null to allow this function to determine it but it may have performance issues.
- $external_shares : array<string|int, mixed> = null
-
List of external share keys. get_external_shares(). You can leave it null to allow this function to determine it but it will affect performance.
- $search : string = ''
-
Optionsl search string. Used to update resource_node hit count
- $sort_order : int = null
-
Sort order of resource in collection
Return values
bool|stringremove_resource_from_collection()
Remove resource $resource from collection $collection
remove_resource_from_collection(int $resource, int $collection[, bool $smartadd = false ]) : bool|string
Parameters
- $resource : int
- $collection : int
- $smartadd : bool = false
Return values
bool|stringcollection_add_resources()
Add resource(s) $resources to collection $collection
collection_add_resources(mixed $collection[, mixed $resources = '' ][, mixed $search = '' ][, mixed $selected = false ]) : bool|string
Parameters
- $collection : mixed
- $resources : mixed = ''
- $search : mixed = ''
- $selected : mixed = false
Return values
bool|stringcollection_remove_resources()
collection_remove_resources
collection_remove_resources(mixed $collection[, mixed $resources = '' ][, mixed $removeall = false ][, mixed $selected = false ]) : bool|string
Parameters
- $collection : mixed
- $resources : mixed = ''
- $removeall : mixed = false
- $selected : mixed = false
Return values
bool|stringcollection_writeable()
Is the collection $collection writable by the current user? Returns true if the current user has write access to the given collection.
collection_writeable(int $collection) : bool
Parameters
- $collection : int
Return values
boolcollection_readable()
Returns true if the current user has read access to the given collection.
collection_readable(int $collection) : bool
Parameters
- $collection : int
Return values
boolset_user_collection()
Sets the current collection of $user to be $collection
set_user_collection(int $user, int $collection) : void
Parameters
- $user : int
- $collection : int
create_collection()
Creates a new collection for user $userid called $name
create_collection(int $userid, string $name[, bool $allowchanges = 0 ][, bool $cant_delete = 0 ][, int $ref = 0 ][, bool $public = false ][, mixed $extraparams = array() ]) : int
Parameters
- $userid : int
- $name : string
- $allowchanges : bool = 0
- $cant_delete : bool = 0
- $ref : int = 0
- $public : bool = false
- $extraparams : mixed = array()
Return values
intdelete_collection()
Deletes the collection with reference $ref
delete_collection(int $collection) : bool|void
Parameters
- $collection : int
Return values
bool|voidrefresh_collection_frame()
Adds script to page that refreshes the Collection bar
refresh_collection_frame([int $collection = "" ]) : void
Parameters
- $collection : int = ""
-
Collection id
search_public_collections()
Performs a search for featured collections / public collections.
search_public_collections([string $search = "" ][, string $order_by = "name" ][, string $sort = "ASC" ][, bool $exclude_themes = true ][, bool $exclude_public = false ][, bool $include_resources = false ][, bool $override_group_restrict = false ][, int $fetchrows = -1 ]) : array<string|int, mixed>
Parameters
- $search : string = ""
- $order_by : string = "name"
- $sort : string = "ASC"
- $exclude_themes : bool = true
- $exclude_public : bool = false
- $include_resources : bool = false
- $override_group_restrict : bool = false
- $fetchrows : int = -1
Return values
array<string|int, mixed>do_collections_search()
Search within available collections
do_collections_search(string $search, string $restypes[, int $archive = 0 ][, string $order_by = '' ][, string $sort = "DESC" ][, int $fetchrows = -1 ]) : array<string|int, mixed>
Parameters
- $search : string
- $restypes : string
- $archive : int = 0
- $order_by : string = ''
- $sort : string = "DESC"
- $fetchrows : int = -1
Return values
array<string|int, mixed>add_collection()
Add a collection to a user's 'My Collections'
add_collection(int $user, int $collection) : bool
Parameters
- $user : int
-
ID of user
- $collection : int
-
ID of collection
Return values
boolremove_collection()
Remove someone else's collection from a user's My Collections
remove_collection(int $user, int $collection) : mixed
Parameters
- $user : int
- $collection : int
index_collection()
Update the keywords index for this collection
index_collection(int $ref[, string $index_string = '' ]) : int
Parameters
- $ref : int
- $index_string : string = ''
Return values
int —How many keywords were indexed?
save_collection()
Process the save action when saving a collection
save_collection(int $ref[, array<string|int, mixed> $coldata = array() ]) : false|void
Parameters
- $ref : int
- $coldata : array<string|int, mixed> = array()
Return values
false|voidcollections_comparator()
Case insensitive string comparisons using a "natural order" algorithm for collection names
collections_comparator(string $a, string $b) : mixed
Parameters
- $a : string
- $b : string
Tags
collections_comparator_desc()
Case insensitive string comparisons using a "natural order" algorithm for collection names
collections_comparator_desc(string $a, string $b) : mixed
Parameters
- $a : string
- $b : string
Tags
get_smart_theme_headers()
Returns a list of smart theme headers, which are basically fields with a 'smart theme name' set.
get_smart_theme_headers() : array<string|int, mixed>
Return values
array<string|int, mixed>get_smart_themes_nodes()
get_smart_themes_nodes
get_smart_themes_nodes(int $field, bool $is_category_tree[, int $parent = null ][, array<string|int, mixed> $field_meta = array() ]) : array<string|int, mixed>
Parameters
- $field : int
- $is_category_tree : bool
- $parent : int = null
- $field_meta : array<string|int, mixed> = array()
-
- resource type field metadata
Return values
array<string|int, mixed>email_collection()
E-mail a collection to users
email_collection(mixed $colrefs, string $collectionname, string $fromusername, string $userlist, string $message, string $feedback[, int $access = -1 ][, string $expires = "" ][, string $useremail = "" ][, string $from_name = "" ][, string $cc = "" ][, bool $themeshare = false ][, string $themename = "" ][, string $themeurlsuffix = "" ][, bool $list_recipients = false ][, bool $add_internal_access = false ][, string $group = "" ][, string $sharepwd = "" ]) : string
- Attempt to resolve all users in the string $userlist to user references.
- Add $collection to these user's 'My Collections' page
- Send them an e-mail linking to this collection
- Handle multiple collections (comma separated list)
Parameters
- $colrefs : mixed
- $collectionname : string
- $fromusername : string
- $userlist : string
- $message : string
- $feedback : string
- $access : int = -1
- $expires : string = ""
- $useremail : string = ""
- $from_name : string = ""
- $cc : string = ""
- $themeshare : bool = false
- $themename : string = ""
- $themeurlsuffix : string = ""
- $list_recipients : bool = false
- $add_internal_access : bool = false
- $group : string = ""
- $sharepwd : string = ""
Return values
stringgenerate_collection_access_key()
Generate an external access key to allow external people to view the resources in this collection.
generate_collection_access_key(int $collection[, int $feedback = 0 ][, string $email = "" ][, int $access = -1 ][, string $expires = "" ][, string $group = "" ][, string $sharepwd = "" ][, array<string|int, mixed> $sub_fcs = array() ]) : string
Parameters
- $collection : int
-
Collection ref -or- collection data structure
- $feedback : int = 0
- $email : string = ""
- $access : int = -1
- $expires : string = ""
- $group : string = ""
- $sharepwd : string = ""
- $sub_fcs : array<string|int, mixed> = array()
-
List of sub-featured collections IDs (collection_email.php page has logic to determine this which is carried forward to email_collection())
Return values
string —The generated key used for external sharing
get_saved_searches()
Returns all saved searches in a collection
get_saved_searches(int $collection) : array<string|int, mixed>
Parameters
- $collection : int
Return values
array<string|int, mixed>add_saved_search()
Add a saved search to a collection
add_saved_search(int $collection) : void
Parameters
- $collection : int
remove_saved_search()
Remove a saved search from a collection
remove_saved_search(int $collection, int $search) : void
Parameters
- $collection : int
- $search : int
add_smart_collection()
Greate a new smart collection using submitted values
add_smart_collection() : void
get_search_title()
Get a display friendly name for the given search string Takes a full searchstring of the form 'search=restypes=archive=' and uses search_title_processing to autocreate a more informative title
get_search_title(string $searchstring) : string
Parameters
- $searchstring : string
-
Search string
Return values
string —Friendly name for search
add_saved_search_items()
Adds all the resources in the provided search to $collection
add_saved_search_items(int $collection[, string $search = "" ][, string $restypes = "" ][, string $archivesearch = "" ][, string $order_by = "relevance" ][, string $sort = "desc" ][, string $daylimit = "" ][, int $res_access = "" ][, bool $editable_only = false ]) : bool
Parameters
- $collection : int
- $search : string = ""
- $restypes : string = ""
- $archivesearch : string = ""
- $order_by : string = "relevance"
- $sort : string = "desc"
- $daylimit : string = ""
- $res_access : int = ""
-
The ID of the resource access level
- $editable_only : bool = false
-
If true then only editable resources will be added
Return values
boolallow_multi_edit()
Returns true or false, can all resources in this collection be edited by the user?
allow_multi_edit(array<string|int, mixed>|int $collection[, array<string|int, mixed> $collectionid = 0 ]) : bool
Parameters
- $collection : array<string|int, mixed>|int
-
Collection IDs
- $collectionid : array<string|int, mixed> = 0
Return values
boolget_featured_collection_resources()
Get featured collection resources (including from child nodes). For normal FCs this is using the collection_resource table.
get_featured_collection_resources(array<string|int, mixed> $c, array<string|int, mixed> $ctx) : array<string|int, mixed>
For FC categories, this will check within normal FCs contained by that category. Normally used in combination with generate_featured_collection_image_urls() but useful to determine if a FC category is full of empty FCs.
Parameters
- $c : array<string|int, mixed>
-
Collection data structure similar to the one returned by get_featured_collections()
- $ctx : array<string|int, mixed>
-
Extra context used to get FC resources (e.g smart FC?, limit on number of resources returned). Context information should take precedence over internal logic (e.g determining the result limit)
Return values
array<string|int, mixed>get_featured_collection_categ_sub_fcs()
Get a list of featured collections based on a higher level featured collection category. This returns all direct/indirect collections under that category.
get_featured_collection_categ_sub_fcs(array<string|int, mixed> $c[, array<string|int, mixed> $ctx = array() ]) : array<string|int, mixed>
Parameters
- $c : array<string|int, mixed>
-
Collection data structure
- $ctx : array<string|int, mixed> = array()
-
Contextual data (e.g disable access control). This param MUST NOT get exposed over the API
Return values
array<string|int, mixed>generate_featured_collection_image_urls()
Get preview URLs for a list of resource IDs
generate_featured_collection_image_urls(array<string|int, mixed> $resource_refs) : array<string|int, mixed>
Parameters
- $resource_refs : array<string|int, mixed>
-
List of resources
Return values
array<string|int, mixed> —List of resource refs and corresponding images URLs
swap_collection_order()
Inserts $resource1 into the position currently occupied by $resource2
swap_collection_order(int $resource1, int $resource2, int $collection) : void
Parameters
- $resource1 : int
- $resource2 : int
- $collection : int
update_collection_order()
Reorder the items in a collection using $neworder as the order by metric
update_collection_order(array<string|int, mixed> $neworder, int $collection[, int $offset = 0 ]) : void
Parameters
- $neworder : array<string|int, mixed>
-
Array of columns to order by
- $collection : int
- $offset : int = 0
get_collection_resource_comment()
Return comments and other columns stored in the collection_resource join.
get_collection_resource_comment(int $resource, int $collection) : array<string|int, mixed>|bool
Parameters
- $resource : int
- $collection : int
Return values
array<string|int, mixed>|bool —Returns found record data, false otherwise
save_collection_resource_comment()
Save a comment and/or rating for the instance of a resource in a collection.
save_collection_resource_comment(int $resource, int $collection, string $comment, int $rating) : bool
Parameters
- $resource : int
- $collection : int
- $comment : string
- $rating : int
Return values
boolrelate_to_collection()
Relates every resource in $collection to $ref
relate_to_collection(int $ref, int $collection) : void
Parameters
- $ref : int
- $collection : int
get_collection_comments()
Fetch all the comments for a given collection.
get_collection_comments(int $collection) : array<string|int, mixed>
Parameters
- $collection : int
Return values
array<string|int, mixed>send_collection_feedback()
Sends the feedback to the owner of the collection
send_collection_feedback(int $collection, string $comment) : array<string|int, mixed>|void
Parameters
- $collection : int
-
Collection ID
- $comment : string
-
Comment text
Return values
array<string|int, mixed>|voidcopy_collection()
Copy a collection contents
copy_collection(int $copied, int $current[, bool $remove_existing = false ]) : void
Parameters
- $copied : int
-
The collection to copy from
- $current : int
-
The collection to copy to
- $remove_existing : bool = false
-
Should existing items be removed?
collection_is_research_request()
Returns true if a collection is a research request
collection_is_research_request(int $collection) : bool
Parameters
- $collection : int
-
Collection ID
Return values
booladd_to_collection_link()
Generates a HTML link for adding a resource to a collection
add_to_collection_link(int $resource[, string $extracode = "" ][, string $size = "" ][, string $class = "" ][, string $view_title = "" ]) : string
Parameters
- $resource : int
-
ID of resource
- $extracode : string = ""
-
Additional code to be run when link is selected IMPORTANT: never use untrusted data here!
- $size : string = ""
-
Resource size if appropriate
- $class : string = ""
-
Class to be applied to link
- $view_title : string = ""
-
The title of the field, taken from $view_title_field
Return values
stringremove_from_collection_link()
Render a "remove from collection" link wherever such a function is shown in the UI
remove_from_collection_link(int $resource[, string $class = "" ][, string $onclick = '' ][, bool $notused = false ][, string $view_title = "" ]) : string
Parameters
- $resource : int
- $class : string = ""
- $onclick : string = ''
-
Additional onclick code to call before returning false.
- $notused : bool = false
-
No longer used
- $view_title : string = ""
-
The title of the field, taken from $view_title_field
Return values
stringchange_collection_link()
Generates a HTML link for adding a changing the current collection
change_collection_link(int $collection) : string
Parameters
- $collection : int
Return values
stringget_collection_external_access()
Return all external access given to a collection.
get_collection_external_access(int $collection) : array<string|int, mixed>
Users, emails and dates could be multiple for a given access key, an in this case they are returned comma-separated.
Parameters
- $collection : int
Return values
array<string|int, mixed>delete_collection_access_key()
Delete a specific collection access key, withdrawing access via that key to the collection in question
delete_collection_access_key(int $collection, string $access_key) : void
Parameters
- $collection : int
- $access_key : string
collection_log()
Add a new row to the collection log (e.g. after an action on that collection)
collection_log(int $collection, string $type, int $resource[, string $notes = "" ]) : void
Parameters
- $collection : int
- $type : string
-
Action type
- $resource : int
- $notes : string = ""
get_collection_log()
Return the log for $collection
get_collection_log(int $collection[, int $fetchrows = -1 ]) : array<string|int, mixed>
Parameters
- $collection : int
- $fetchrows : int = -1
-
How many rows to fetch
Return values
array<string|int, mixed>collection_max_access()
Returns the maximum access (the most permissive) that the current user has to the resources in $collection.
collection_max_access(int $collection) : int
Parameters
- $collection : int
Return values
intcollection_min_access()
Returns the minimum access (the least permissive) that the current user has to the resources in $collection.
collection_min_access(int|array<string|int, mixed> $collection) : int
Can be passed a collection ID or the results of a collection search, the result will be the most restrictive access that is found.
Parameters
- $collection : int|array<string|int, mixed>
-
Collection ID as an integer or the result of a search as an array
Return values
int —0 - Open, 1 - restricted, 2 - Confidential
collection_set_public()
Set an existing collection to be public
collection_set_public(int $collection) : bool
Parameters
- $collection : int
-
ID of collection
Return values
boolremove_all_resources_from_collection()
Remove all resources from a collection
remove_all_resources_from_collection(int $ref) : void
Parameters
- $ref : int
-
The collection in question
get_home_page_promoted_collections()
Retrieve promoted collections to be displayed on the home page.
get_home_page_promoted_collections() : array<string|int, mixed>
This function fetches public collections that are marked for publishing to the home page. It returns an array of collection data, including metadata and thumbnail information for the home page image if one is assigned.
Return values
array<string|int, mixed> —An array of associative arrays representing each promoted collection, with keys:
- 'ref' (int): The unique identifier for the collection.
- 'type' (int): The type identifier for the collection.
- 'name' (string): The name of the collection.
- 'home_page_publish' (int): Indicates if the collection is published on the home page.
- 'home_page_text' (string): Display text for the collection for the home page.
- 'home_page_image' (int): Resource ID for the image displayed on the home page.
- 'thumb_height' (int): Thumbnail height of the associated image.
- 'thumb_width' (int): Thumbnail width of the associated image.
- 'resource_type' (int): The type of the associated resource.
- 'file_extension' (string): File extension of the associated resource.
is_collection_approved()
Return an array of distinct archive/workflow states for resources in $collection
is_collection_approved(int $collection) : array<string|int, mixed>
Parameters
- $collection : int
Return values
array<string|int, mixed>edit_collection_external_access()
Update an existing external access share
edit_collection_external_access(string $key[, int $access = -1 ][, string $expires = "" ][, int $group = "" ][, string $sharepwd = "" ][, array<string|int, mixed> $shareopts = array() ]) : bool
Parameters
- $key : string
-
External access key
- $access : int = -1
-
Share access level
- $expires : string = ""
-
Share expiration date
- $group : int = ""
-
ID of usergroup that share will emulate permissions for
- $sharepwd : string = ""
-
Share password
- $shareopts : array<string|int, mixed> = array()
-
Array of additional share options "collection" - int collection ID "upload" - bool Set to true if share is an upload link (no visibility of existing resources)
Return values
boolshow_hide_collection()
Hide or show a collection from the My Collections area.
show_hide_collection(int $colref[, bool $show = true ][, int $user = "" ]) : bool
Parameters
- $colref : int
- $show : bool = true
-
Show or hide?
- $user : int = ""
Return values
boolget_session_collections()
Get an array of collection IDs for the specified ResourceSpace session and user
get_session_collections(string $rs_session[, int $userref = "" ][, bool $create = false ]) : array<string|int, mixed>
Parameters
- $rs_session : string
-
Session id - as obtained by get_rs_session_id()
- $userref : int = ""
-
User ID
- $create : bool = false
-
Create new collection?
Return values
array<string|int, mixed> —Array of collection IDs for the specified sesssion
update_collection_user()
Update collection to belong to a new user
update_collection_user(int $collection, int $newuser) : bool
Parameters
- $collection : int
-
Collection ID
- $newuser : int
-
User ID to assign collection to
Return values
bool —success|failure
compile_collection_actions()
Helper function for render_actions(). Compiles actions that are normally valid for collections
compile_collection_actions(array<string|int, mixed> $collection_data, bool $top_actions[, array<string|int, mixed> $resource_data = array() ]) : array<string|int, mixed>
Parameters
- $collection_data : array<string|int, mixed>
-
Collection data
- $top_actions : bool
-
Set to true if actions are to be rendered in the search filter bar (above results)
- $resource_data : array<string|int, mixed> = array()
-
Resource data
Return values
array<string|int, mixed>makeFilenameUnique()
Make a filename unique by appending a dupe-string.
makeFilenameUnique(array<string|int, mixed> $base_values, string $filename, string $dupe_string, string $extension[, int $dupe_increment = null ]) : string
Parameters
- $base_values : array<string|int, mixed>
- $filename : string
- $dupe_string : string
- $extension : string
- $dupe_increment : int = null
Return values
string —Unique filename
new_featured_collection_form()
Render the new featured collection form
new_featured_collection_form(int $parent) : void
Parameters
- $parent : int
-
Featured collection parent. Use zero for root featured collection category
GetThemesFromRequest()
Get a themes array
GetThemesFromRequest(int $levels) : array<string|int, mixed>
Parameters
- $levels : int
-
Number of levels to parse from request
Return values
array<string|int, mixed> —Array containing names of themes matching the syntax used in the collection table i.e. theme, theme2, theme3
collection_download_use_original_filenames_when_downloading()
collection_download_use_original_filenames_when_downloading(array<string|int, mixed> &$dl_data, string &$filename, int $ref, string $pextension, string &$p, bool $copy) : void
Parameters
- $dl_data : array<string|int, mixed>
-
Array of collection download data from process_collection_download() (passed by reference so can be added to)
- $filename : string
-
Filename (passed by reference)
- $ref : int
-
Resource ID
- $pextension : string
-
File extension
- $p : string
-
Path to download file = passed by reference as may be replaced with a copy file
- $copy : bool
-
Copy the file from filestore rather than renaming?
collection_download_process_text_file()
Provide resource data/collection_resource data to add to text file during a collection download.
collection_download_process_text_file(array<string|int, mixed> $dl_data, int $ref, string $filename, bool $subbed_original) : string
Parameters
- $dl_data : array<string|int, mixed>
-
Array of collection download data passed from process_collection_download()
- $ref : int
-
Resource ID
- $filename : string
- $subbed_original : bool
-
Has original file been substituted for unavailable size?
Return values
string —Text to append to file
collection_download_log_resource_ready()
Update the resource log to show the download during a collection download.
collection_download_log_resource_ready(array<string|int, mixed> $dl_data, string $tmpfile, int $ref[, string $email = "" ]) : void
Parameters
- $dl_data : array<string|int, mixed>
-
Array of collection download data passed from process_collection_download()
- $tmpfile : string
-
Temp download file path
- $ref : int
-
The resource ID
- $email : string = ""
-
Email address of downloader
collection_download_process_data_only_types()
Add PDFs for "data only" types to a zip file during creation.
collection_download_process_data_only_types(array<string|int, mixed> $dl_data, object &$zip) : void
Parameters
- $dl_data : array<string|int, mixed>
-
Array of collection download data
- $zip : object
-
Collection zip file
collection_download_process_summary_notes()
collection_download_process_summary_notes(array<string|int, mixed> &$dl_data, string $filename, mixed &$zip) : mixed
Parameters
- $dl_data : array<string|int, mixed>
-
Array of collection download data from process_collection_download() (passed by reference so can be added to)
- $filename : string
-
Resource filename
- $zip : mixed
-
Collection zip file, false if using TAR
collection_download_process_csv_metadata_file()
Add a CSV containing resource metadata to a downloaded zip file during creation of the zip.
collection_download_process_csv_metadata_file(array<string|int, mixed> &$dl_data, object &$zip) : void
Parameters
- $dl_data : array<string|int, mixed>
-
Array of collection download data from process_collection_download() (passed by reference so can be added to)
- $zip : object
-
Collection zip file
collection_download_process_collection_download_name()
Modifies the filename for downloading as part of the specified collection
collection_download_process_collection_download_name(string &$filename, int $collection, string $size, string $suffix, array<string|int, mixed> $collectiondata) : void
Parameters
- $filename : string
-
Filename (passed by reference)
- $collection : int
-
Collection ID
- $size : string
-
Size code e.g scr,pre
- $suffix : string
-
String suffix to add (before file extension)
- $collectiondata : array<string|int, mixed>
-
Collection data obtained by get_collection()
collection_download_process_archive_command()
Executes the archiver command when downloading a collection.
collection_download_process_archive_command(array<string|int, mixed> &$dl_data, object &$zip, string $filename, mixed &$zipfile) : bool
Parameters
- $dl_data : array<string|int, mixed>
-
Array of collection download data from process_collection_download() (passed by reference so can be added to)
- $zip : object
-
Collection zip file
- $filename : string
-
Download filename
- $zipfile : mixed
Return values
bool —Will return true if there is no further work to be done as will be the case for a tar file. False when further processing needed e.g. when producing a zip file.
collection_download_clean_temp_files()
Remove temporary files created during download by exiftool for adding metadata.
collection_download_clean_temp_files(array<string|int, mixed> $deletion_array) : void
Parameters
- $deletion_array : array<string|int, mixed>
-
An array of file paths
collection_cleanup_inaccessible_resources()
Delete any resources from collection moved out of users archive status permissions by other users
collection_cleanup_inaccessible_resources(int $collection) : void
Parameters
- $collection : int
-
ID of collection
relate_all_collection()
Relate all resources in a collection
relate_all_collection(int $collection[, mixed $checkperms = true ]) : bool
Parameters
- $collection : int
-
ID of collection
- $checkperms : mixed = true
Return values
boolunrelate_all_collection()
Un-relate all resources in a collection
unrelate_all_collection(int $collection[, mixed $checkperms = true ]) : bool
Parameters
- $collection : int
-
ID of collection
- $checkperms : mixed = true
Return values
boolupdate_collection_type()
Update collection type for one collection or batch
update_collection_type(int|array<string|int, mixed> $cid, int $type[, mixed $log = true ]) : bool
Parameters
- $cid : int|array<string|int, mixed>
-
Collection ID -or- list of collection IDs
- $type : int
-
Collection type. @see include/definitions.php for available options
- $log : mixed = true
Return values
boolupdate_collection_parent()
Update collection parent for this collection
update_collection_parent(int $cid, int $parent) : bool
Parameters
- $cid : int
- $parent : int
Return values
boolget_user_selection_collection()
Get a users' collection of type SELECTION.
get_user_selection_collection(int $user) : null|int
There can only be one collection of this type per user. If more, the first one found will be used instead.
Parameters
- $user : int
-
User ID
Return values
null|int —Returns NULL if none found or the collection ID
delete_old_collections()
Delete all collections that are not in use e.g. session collections for the anonymous user. Will not affect collections that are public.
delete_old_collections([int $userref = 0 ][, int $days = 30 ]) : int
Parameters
- $userref : int = 0
-
- ID of user to delete collections for
- $days : int = 30
-
- minimum age of collections to delete in days
Return values
int —- number of collections deleted
get_all_featured_collections()
Get all featured collections
get_all_featured_collections() : array<string|int, mixed>
Return values
array<string|int, mixed>get_featured_collections()
Get all featured collections by parent node
get_featured_collections(int $parent, array<string|int, mixed> $ctx) : array<string|int, mixed>
Parameters
- $parent : int
-
The ref of the parent collection. When a featured collection contains another collection, it is then considered a featured collection category and won't have any resources associated with it.
- $ctx : array<string|int, mixed>
-
Contextual data (e.g disable access control). This param MUST NOT get exposed over the API
Return values
array<string|int, mixed> —List of featured collections (with data)
featured_collections_permissions_filter_sql()
Build appropriate SQL (for WHERE clause) to filter out featured collections for the user. The function will use either an IN or NOT IN depending which list is smaller to increase performance of the search
featured_collections_permissions_filter_sql(string $prefix, string $column[, bool $returnstring = false ]) : array<string|int, mixed>|string
Parameters
- $prefix : string
-
SQL WHERE clause element. Mostly should be either WHERE, AND -or- OR depending on the SQL statement this is part of.
- $column : string
-
SQL column on which to apply the filter for
- $returnstring : bool = false
-
(temporary) Will return the legacy string version until do_search() and others are migrated to use prepared statements. This can be removed once all functions use prepared statements
Return values
array<string|int, mixed>|string —Returns "" if user should see all featured collections or a SQL filter (e.g AND ref IN("32", "34") ) with the placholders as the first element and the collection IDs as params for the second - for use in e.g. ps_query(), ps_value()
featured_collection_check_access_control()
Access control function used to determine if a featured collection should be accessed by the user
featured_collection_check_access_control(int $c_ref) : bool
Parameters
- $c_ref : int
-
Collection ref to be tested
Return values
bool —Returns TRUE if user should have access to the featured collection (no parent category prevents this), FALSE otherwise
order_featured_collections()
Helper comparison function for ordering featured collections. It sorts using the order_by property, then based if the collection is a category (using the "has_resource" property), then by name (this takes into account the legacy use of '*' as a prefix to move to the start).
order_featured_collections(array<string|int, mixed> $a, array<string|int, mixed> $b) : Return
Parameters
- $a : array<string|int, mixed>
-
First featured collection data structure to compare
- $b : array<string|int, mixed>
-
Second featured collection data structure to compare
Return values
Return —an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
get_featured_collection_categories()
Get featured collection categories
get_featured_collection_categories(int $parent, array<string|int, mixed> $ctx) : array<string|int, mixed>
Parameters
- $parent : int
-
The ref of the parent collection.
- $ctx : array<string|int, mixed>
-
Extra context for get_featured_collections(). Mostly used for overriding access control (e.g on the admin_group_permissions.php where we want to see all available featured collection categories).
Return values
array<string|int, mixed>is_featured_collection_category()
Check if a collection is a featured collection category
is_featured_collection_category(array<string|int, mixed> $fc) : bool
Parameters
- $fc : array<string|int, mixed>
-
A featured collection data structure as returned by get_featured_collections()
Return values
boolis_featured_collection_category_by_children()
Check if a collection is a featured collection category by checking if the collection has been used as a parent. This function will make a DB query to find this out, it does not use existing structures.
is_featured_collection_category_by_children(int $c_ref) : bool
Normally a featured collection is a category if it has no resources. In some circumstances, when it's impossible to determine whether it should be or not, relying on children is another approach.
Parameters
- $c_ref : int
-
Collection ID
Return values
boolvalidate_collection_parent()
Validate a collection parent value
validate_collection_parent(int|array<string|int, mixed> $c) : null|int
Parameters
- $c : int|array<string|int, mixed>
-
Collection ref -or- collection data as returned by get_collection()
Return values
null|intget_featured_collection_category_branch_by_leaf()
Get to the root of the branch starting from the leaf featured collection
get_featured_collection_category_branch_by_leaf(int $ref, array<string|int, mixed> $fcs) : array<string|int, mixed>
Parameters
- $ref : int
-
Collection ref which is considered a leaf of the tree
- $fcs : array<string|int, mixed>
-
List of all featured collections
Return values
array<string|int, mixed> —Branch path structure starting from root to the leaf
process_posted_featured_collection_categories()
Process POSTed featured collections categories data for a collection
process_posted_featured_collection_categories(int $depth, array<string|int, mixed> $branch_path) : array<string|int, mixed>
Parameters
- $depth : int
-
The depth from which to start from. Usually zero.
- $branch_path : array<string|int, mixed>
-
A full branch path of the collection. get_featured_collection_category_branch_by_leaf()
Return values
array<string|int, mixed> —Returns changes done regarding the collection featured collection category structure. This information then can be provided to save_collection() as: $coldata["featured_collections_changes"]
get_featured_collection_ref_by_name()
Find existing featured collection ref using its name and parent
get_featured_collection_ref_by_name(string $name, null|int $parent) : null|int
Parameters
- $name : string
-
Featured collection name to search by
- $parent : null|int
-
The featured collection parent
Return values
null|intmove_featured_collection_branch_path_root()
Move a featured collection branch paths' root to the node determined by the global configuration option $featured_collections_root_collection.
move_featured_collection_branch_path_root(array<string|int, mixed> $branch_path) : array<string|int, mixed>
This temporarily moves the root of the featured collection branch, removing any nodes on the branch from the real root up to the new root.
Parameters
- $branch_path : array<string|int, mixed>
-
List of branch path nodes as returned by compute_node_branch_path()
Tags
Return values
array<string|int, mixed>allow_collection_share()
Check if user is allowed to share collection
allow_collection_share(array<string|int, mixed> $c) : bool
Parameters
- $c : array<string|int, mixed>
-
Collection data
Return values
bool —Return TRUE if user is allowed to share the collection, FALSE otherwise
allow_featured_collection_share()
Check if user is allowed to share featured collection. If the featured collection provided is a category, then this function will return FALSE if at least one sub featured collection has no share access (this is kept consistent with the check for normal collections when checking resources).
allow_featured_collection_share(array<string|int, mixed> $c) : bool
Parameters
- $c : array<string|int, mixed>
-
Collection data. You can add "has_resources" and "sub_fcs" keys if you already have this information
Return values
bool —Return TRUE if user is allowed to share the featured collection, FALSE otherwise
filter_featured_collections_by_root()
Filter out featured collections that have a different root path. The function builds internally the path to the root from the provided featured collection ref and then filters out any featured collections that have a different root path.
filter_featured_collections_by_root(array<string|int, mixed> $fcs, int $c_ref[, array<string|int, mixed> $ctx = array() ]) : array<string|int, mixed>
Parameters
- $fcs : array<string|int, mixed>
-
List of featured collections refs to filter out
- $c_ref : int
-
A root featured collection ref
- $ctx : array<string|int, mixed> = array()
-
Contextual data
Return values
array<string|int, mixed>get_featured_collections_by_resources()
Get all featured collections branches where the specified resources can be found.
get_featured_collections_by_resources(array<string|int, mixed> $r_refs) : array<string|int, mixed>
Parameters
- $r_refs : array<string|int, mixed>
-
List of resource IDs
Return values
array<string|int, mixed> —Returns list of featured collections (categories included) that contain the specified resource(s).
can_delete_featured_collection()
Verify if a featured collection can be deleted. To be deleted, it MUST not have any resources or children (if category).
can_delete_featured_collection(int $ref) : bool
Parameters
- $ref : int
-
Collection ID
Return values
bool —Returns TRUE if the featured collection can be deleted, FALSE otherwise
strip_prefix_chars()
Remove all instances of the specified character from start of string
strip_prefix_chars(string $string, string $char) : string
Parameters
- $string : string
-
String to update
- $char : string
-
Character to remove
Return values
stringallow_upload_to_collection()
Check access control if user is allowed to upload to a collection.
allow_upload_to_collection(array<string|int, mixed> $c) : bool
Parameters
- $c : array<string|int, mixed>
-
Collection data structure
Return values
boolcompute_featured_collections_access_control()
Compute the featured collections allowed based on current access control
compute_featured_collections_access_control() : bool|array<string|int, mixed>
Return values
bool|array<string|int, mixed> —Returns FALSE if user should not see any featured collections (usually means misconfiguration) -or- TRUE if user has access to all featured collections. If some access control is in place, then the return will be an array with all the allowed featured collections
can_reorder_featured_collections()
Check if user is allowed to re-order featured collections
can_reorder_featured_collections() : bool
Return values
boolcan_edit_featured_collection_category()
Check if user is authorised to edit a featured collection category
can_edit_featured_collection_category() : bool
Return values
boolcleanup_anonymous_collections()
Remove all old anonymous collections
cleanup_anonymous_collections([int $limit = 100 ]) : void
Parameters
- $limit : int = 100
-
Maximum number of collections to delete - if run from browser this is kept low to avoid delays
can_share_upload_link()
Check if user is permitted to create an external upload link for the given collection
can_share_upload_link(array<string|int, mixed> $collection_data) : bool
Parameters
- $collection_data : array<string|int, mixed>
-
Array of collection data
Return values
boolcan_edit_upload_share()
Check if user can edit an existing upload share
can_edit_upload_share(int $collection, string $uploadkey) : bool
Parameters
- $collection : int
-
Collection ID of share
- $uploadkey : string
-
External upload key
Return values
boolcreate_upload_link()
Creates an upload link for a collection that can be shared
create_upload_link(int $collection, array<string|int, mixed> $shareoptions) : string
Parameters
- $collection : int
-
Collection ID
- $shareoptions : array<string|int, mixed>
-
- values to set 'usergroup' Usergroup id to share as (must be in $upload_link_usergroups array) 'expires' Expiration date in 'YYYY-MM-DD' format 'password' Optional password for share access 'emails' Optional array of email addresses to generate keys for
Return values
string —Share access key
generate_share_key()
Generates an external share key based on provided string
generate_share_key(string $string) : string
Parameters
- $string : string
Return values
string —Generated key
upload_share_active()
Check if an external upload link is being used
upload_share_active() : mixed
Return values
mixed —false|int ID of upload collection, or false if not active
upload_share_setup()
Set up external upload share
upload_share_setup(string $key[, array<string|int, mixed> $shareopts = array() ]) : void
Parameters
- $key : string
-
access key
- $shareopts : array<string|int, mixed> = array()
-
Array of share options "collection" - (int) collection ID "user" - (int) user ID of share creator "usergroup" - (int) usergroup ID used for share
external_upload_notify()
Notify the creator of an external upload share that resources have been uploaded
external_upload_notify(int $collection, string $k, int $tempcollection) : void
Parameters
- $collection : int
-
Ref of external shared collection
- $k : string
-
External upload access key
- $tempcollection : int
-
Ref of temporay upload collection
purge_expired_shares()
Purge all expired shares/**
purge_expired_shares(array<string|int, mixed> $filteropts) : string|int
Parameters
- $filteropts : array<string|int, mixed>
-
Array of options to filter shares purged "share_group" - (int) Usergroup ref 'shared as' "share_user" - (int) user ID of share creator "share_type" - (int) 0=view, 1=upload "share_collection" - (int) Collection ID
Return values
string|intcan_delete_collection()
Check if user has the appropriate access to delete a collection.
can_delete_collection(array<string|int, mixed> $collection_data, int $userref[, int $k = "" ]) : bool
Parameters
- $collection_data : array<string|int, mixed>
-
Array of collection details, typically from get_collection()
- $userref : int
-
Id of user
- $k : int = ""
-
External access key value
Return values
bool —Returns true is the collection can be deleted or false if it cannot.
send_collection_to_admin()
Send collection to administrators - used if $send_collection_to_admin is enabled
send_collection_to_admin(int $collection) : bool
Parameters
- $collection : int
-
Collection ID
Return values
boolget_default_user_collection()
Get the user's default collection, creating one if necessary
get_default_user_collection([bool $setactive = false ]) : int
Parameters
- $setactive : bool = false
-
Set the collection as the user's active collection?
Return values
int —collection ID
update_smart_collection()
Update a smart collection with or without the $smart_collections_async option.
update_smart_collection(int $smartsearch_ref) : void
Parameters
- $smartsearch_ref : int
-
Id of 'savedsearch'.
check_upload_terms()
Check if the terms have been accepted for the given upload Terms only need to be accepted when uploading through an upload share link If uploading through an upload share link then the accepted terms have been stored in $_COOKIE["acceptedterms"]
check_upload_terms(int $collection, string $k) : bool
Parameters
- $collection : int
-
Collection ref
- $k : string
-
Share key
Return values
bool —True if external upload share and terms have also been accepted OR if not an external upload False if external upload share and terms have NOT been accepted
can_create_collections()
Determines whether the current user has permission to create collections.
can_create_collections() : bool
This function checks for specific conditions that would prevent the user from creating collections.
It returns false if any of these conditions are met:
- The user has the "b" permission, which restricts collection creation.
- The user is anonymous and does not have a session collection.
Return values
bool —Returns true if the user can create collections; otherwise, false.
can_view_collection_log()
Determines whether the current user has permission to view the collection log.
can_view_collection_log(array<string|int, mixed> $collection_data) : bool
Parameters
- $collection_data : array<string|int, mixed>
-
Array of collection data, typically from get_collection()
Return values
bool —Returns true if the collection log can be viewed by the current user.
reorder_all_featured_collections_with_parent()
Re-order all featured collections at a particular tree depth.
reorder_all_featured_collections_with_parent(int|null $parent) : array<string|int, mixed>
Parameters
- $parent : int|null
Return values
array<string|int, mixed> —Featured collection IDs list, in the new order
process_collection_download()
Generate a collection download ZIP file and the download filename
process_collection_download(array<string|int, mixed> $dl_data) : array<string|int, mixed>
Parameters
- $dl_data : array<string|int, mixed>
-
Array of collection download options passed from collection_download.php or from the offline job This array will be updated and passed to subsidiary functions to keep track of processed file, generate text etc. Could be moved to an object later [ "filename" => [the name of download file], "collection" => [Collection ID], "collection_resources" => [Resources to include in download], "collectiondata" => [Collection data - from get_collection()], "exiftool_write_option" => [Write exif data?], "useoriginal" => [Use original if requested size not available?], "size" => [Requested Download size ID], "settings_id" => [Index of selected option from $collection_download_settings], "deletion_array" => [Array of paths to delete], "include_csv_file" => [Include metadata CSV file?], "include_alternatives" => [Include alternative files?], "includetext" => Include text file?, "collection_download_tar" => [Generate a TAR file?], "count_data_only_types" => [Count of data only resources], "id" => [Optional unique identifier - [used to create a download.php link that is specific to the user], "k" => External access key from download request if set ];
Return values
array<string|int, mixed> —Array of data about the created file and the download file nam, or the TAR status i.e. [ "filename" => [the name of download file], "path" => [path to the zip file], "completed" => [Set to true if a tar has been sent], ];
comments_submit()
Write comments to the database, also deals with hiding and flagging comments
comments_submit() : void
clean_comment_tree()
Check all comments that are children of the comment ref provided. If there is a branch made up entirely of hidden comments then remove the branch.
clean_comment_tree(mixed $ref) : int
@param int $ref Ref of the comment that is being deleted.
Parameters
- $ref : mixed
Return values
int —Number of child comments that are not hidden.
find_root_comment()
Find the root of a comment tree that the ref provided is a part of
find_root_comment(int $ref) : int|null
Parameters
- $ref : int
-
ref of a comment
Return values
int|null —ref of the root comment or null if the comment tree has been completely removed / the comment being checked has already been deleted.
comments_tags_to_links()
Parse a comment and replace and add links to any user, resource and collection tags
comments_tags_to_links(string $text) : string
Parameters
- $text : string
-
The input text e.g. the body of the comment
Return values
stringcomments_show()
Display all comments for a resource or collection
comments_show(int $ref[, bool $bcollection_mode = false ]) : void
Parameters
- $ref : int
-
The reference of the resource or collection
- $bcollection_mode : bool = false
-
false == show comments for resources, true == show comments for collection
comments_notify_tagged()
Notify anyone tagged when a new comment is posted
comments_notify_tagged(string $comment, int $from_user[, int $resource = null ][, int $collection = null ]) : void
Parameters
- $comment : string
-
The comment body
- $from_user : int
-
Who posted the comment
- $resource : int = null
-
If commenting on a resource, the resource ID
- $collection : int = null
-
If commenting on a collection, the collection ID
get_comments_by_ref()
Return comments for a resource or collection. There are two options for the output: 1. A flat list of comments ordered by creation date, newest first. Config $comments_flat_view = true 2. A tree view of comments, top level ordered most recent first with lower levels also most recent first while respecting a hierarchy of nested comments. Config $comments_flat_view = false (default) User permissions are also checked to ensure users can view comments. $comments_responses_max_level limits the number of levels returned in the comments tree (only applies when $comments_flat_view = false).
get_comments_by_ref(int $ref[, bool $collection_mode = false ]) : array<string|int, mixed>
Parameters
- $ref : int
-
Resource or collection ID.
- $collection_mode : bool = false
-
True if the $ref provided is a collection ID. False if $ref providing resource ID (default)
Return values
array<string|int, mixed> —Array of comments sorted per $comments_flat_view. Empty array if user doesn't have permission to to view comments.
hide_delete_comment()
Hide or delete a comment or annotation. Comments will be hidden where they have comments below them.
hide_delete_comment(int $comment_to_hide[, bool $allow_annotations = true ]) : bool
If the comment has no comments below it will be deleted. Trees with all hidden comments will also be deleted. Option to disable deletion / hiding of comments created as annotations e.g. to prevent API use.
Parameters
- $comment_to_hide : int
-
Reference of the comment to be deleted / hidden.
- $allow_annotations : bool = true
-
Should comments created by annotations be deleted / hidden.
Return values
bool —True if successful else false.
render_select_option()
Renders a select element.
render_select_option(string $fieldname, array<string|int, mixed> $opt_array, mixed $selected[, string $groupby = '' ]) : string
Takes an array of options (as returned from sql_query and returns a valid
select element. The query must have a column aliased as value and label.
Option groups can be created as well with the optional $groupby parameter.
This function retrieves a language field in the form of
$lang['cfg-
$options = sql_select("SELECT name AS label, ref AS value FROM resource_type");
render_select_option('myfield', $options, 18);
Parameters
- $fieldname : string
-
Name to use for the field.
- $opt_array : array<string|int, mixed>
-
Array of options to fill the select with
- $selected : mixed
-
If matches value the option is marked as selected
- $groupby : string = ''
-
Column to group by
Return values
string —HTML output.
render_bool_option()
Render a yes/no field with the given fieldname.
render_bool_option(string $fieldname, bool $value) : string
This function will use $lang['cfg-
Parameters
- $fieldname : string
-
Name of field.
- $value : bool
-
Current field value
Return values
string —HTML Output
render_text_option()
Renders a text field for a given field name.
render_text_option(string $fieldname, string $value[, int $size = 20 ][, string $units = '' ]) : string
Uses $lang['cfg-
Parameters
- $fieldname : string
-
Name of field
- $value : string
-
Current field value
- $size : int = 20
-
Size of text field, optional, defaults to 20
- $units : string = ''
-
Optional units parameter. Displays to right of text field.
Return values
string —HTML Output
set_config_option()
Save/ Update config option for user preference or system config. For user group config see set_usergroup_config_option().
set_config_option(int $user_id, string $param_name, string $param_value[, string $activity_log_note = null ]) : bool
Parameters
- $user_id : int
-
Current user ID. Use NULL for system wide config options
- $param_name : string
-
Parameter name
- $param_value : string
-
Parameter value
- $activity_log_note : string = null
-
Optional. Allows a note to be recorded in the activity log entry. Helpful to record the origin of the configuration change.
Return values
boolset_usergroup_config_option()
Save or update config option for user group.
set_usergroup_config_option(int $usergroup_id, string $param_name, string $param_value) : bool
Parameters
- $usergroup_id : int
-
User group id
- $param_name : string
-
Config parameter name
- $param_value : string
-
Config parameter value
Return values
booldelete_config_option()
Delete entry from the user_preferences table completely (instead of setting to blank via set_config_option).
delete_config_option(array<string|int, mixed> $config_type, string $param_name[, string|null $activity_log_note = null ]) : bool
Used by system preferences page when deleting a file to allow fallback to value (if set) in config.php instead of replacing it with blank from user_preference value.
Parameters
- $config_type : array<string|int, mixed>
-
The type of config to delete supplied as an array. The following are possible: array() - Supply an empty array to delete a system config value. array('user' => 1) - Supply 'user' with the integer user reference to delete a user config value. array('usergroup' => 2) - Supply 'usergroup' with the integer user reference to delete a user group config value.
- $param_name : string
-
Parameter name
- $activity_log_note : string|null = null
Return values
bool —True if preference was deleted else false.
remove_config_option()
Remove system/user preferences
remove_config_option(int|null $user_id, string $name) : bool
Parameters
- $user_id : int|null
-
Database user ID
- $name : string
-
Configuration option (variable) name
Return values
boolget_config_option()
Get config option value from the database. This may be a system wide config, a user group preference, a user preference, or the result of overriding a user group preference with a user preference if any are present.
get_config_option(array<string|int, mixed> $config_type, string $name, string &$returned_value[, mixed $default = null ]) : bool
Parameters
- $config_type : array<string|int, mixed>
-
The type of config to retrieve supplied as an array. The following combinations are possible: array() - Supply an empty array to return a system config value. array('usergroup' => 2) - Supply 'usergroup' with the integer user group reference to return a user group config value. array('user' => 1) - Supply 'user' with the integer user reference to return a user config value. array('user' => 1, 'usergroup' => 2) - Supply 'user' with the integer user reference and 'usergroup' with the integer user group reference to return the result of user group config overridden with user preference. Usergroup should always be that of the supplied user. Don't supply parent group as this will be checked.
- $name : string
-
Parameter name
- $returned_value : string
-
The config value will be returned through this parameter which is passed by reference. IMPORTANT: it falls back (defaults) to the globally scoped config option value if there's nothing in the database.
- $default : mixed = null
-
Optionally used to set a default that may not be the current global setting e.g. for checking admin resource preferences
Return values
bool —Indicates if the config option was found in the database or not.
get_config_option_users()
Get all user refs with a specific configuration option set from database
get_config_option_users(string $option, string $value) : array<string|int, mixed>
Parameters
- $option : string
-
Parameter name
- $value : string
-
Parameter value
Return values
array<string|int, mixed> —Array of user references
get_config_options()
Get config option from database for a specific user, system wide or user group.
get_config_options(array<string|int, mixed> $config_type, array<string|int, mixed> &$returned_options) : bool
Parameters
- $config_type : array<string|int, mixed>
-
The type of config to retrieve supplied as an array. The following combinations are possible: array() - Supply an empty array to return a system config value. array('user' => 1) - Supply 'user' with the integer user reference to return user config values. array('usergroup' => 2) - Supply 'usergroup' with the integer user reference to return user group config values. Note: Supplying both 'user' and 'usergroup' is invalid.
- $returned_options : array<string|int, mixed>
-
If a value does exist it will be returned through this parameter which is passed by reference
Return values
boolget_usergroup_parent_for_inherit_flag()
Check if the usergroup has a parent and the specified inherit flag is in use e.g. user group inherits permissions from parent.
get_usergroup_parent_for_inherit_flag(int $usergroup_id, string $inherit_flag) : int
Parameters
- $usergroup_id : int
-
User group of the current user / user group to test.
- $inherit_flag : string
-
Inherit flag to test for.
Return values
int —User group id of parent if found and using supplied inherit flag else returns user group id supplied.
process_config_options()
Process configuration options from database either system wide, user group or user specific, setting the global variable.
process_config_options(array<string|int, mixed> $config_type) : void
Three modes are possible: array() - Supply an empty array to load system config values. array('user' => 1) - Supply 'user' with the integer user reference to load user config values. array('usergroup' => 2) - Supply 'usergroup' with the integer user reference to load user group config values. Note: Supplying both 'user' and 'usergroup' is invalid. In some scenarios, calling this function twice will be required e.g. load user group config then override with user config. Note: calling this function will not revert user preferences applied previously e.g. during initialisation as a different user. If the current user's preferences shouldn't be shown, consider using $system_wide_config_options to reapply selected system values.
Parameters
- $config_type : array<string|int, mixed>
-
Specify the type of config to be loaded. See details above.
config_clean()
Utility function to "clean" the passed $config. Cleaning consists of two parts: * Suppressing really simple XSS attacks by refusing to allow strings containing the characters "<script" in upper, lower or mixed case.
config_clean(mixed $config) : a
- Unescaping instances of "'" and '"' that have been escaped by the lovely magic_quotes_gpc facility, if it's on.
Parameters
- $config : mixed
-
mixed thing to be cleaned.
Return values
a —cleaned version of $config.
config_html()
Generate arbitrary html
config_html(string $content) : mixed
Parameters
- $content : string
-
arbitrary HTML
config_add_html()
Return a data structure that will instruct the configuration page generator functions to add arbitrary HTML
config_add_html(string $content) : mixed
Parameters
- $content : string
config_text_input()
Generate an html text entry or password block
config_text_input(string $name, string $label, string $current[, bool $password = false ][, int $width = 420 ][, bool $textarea = false ][, string $title = null ][, bool $autosave = false ][, bool $hidden = false ][, string $help_link = "" ]) : mixed
Parameters
- $name : string
-
The name of the configuration variable to be added.
- $label : string
-
The user text displayed to label the text block. Usually a $lang string.
- $current : string
-
The current value of the config variable being set.
- $password : bool = false
-
Whether this is a "normal" text-entry field or a password-style field.
- $width : int = 420
-
The width of the input field in pixels. Default: 420.
- $textarea : bool = false
-
Render as a HTML <textarea>
- $title : string = null
-
The title attribute of the element
- $autosave : bool = false
-
Enable auto-saving of changes when focus is lost
- $hidden : bool = false
-
Whether field is hidden on the page
- $help_link : string = ""
-
Help link to be displayed alongside the label.
config_integer_input()
Generate an HTML form element for input of integer only values. Field will include validation for supplied value being of type int and between supplied min and max values.
config_integer_input(string $name, string $label, string $current, int $min_value, int $max_value[, int $width = 55 ][, string $title = null ][, bool $autosave = false ][, bool $hidden = false ][, string $help_link = "" ]) : void
** While this function can handle client side validation, config_check_valid_option() must be used on save to allow for server side checking of the value. For an example, see pages/admin/admin_system_config.php
Parameters
- $name : string
-
The name of the configuration variable to be added.
- $label : string
-
The user text displayed to label the text block. Usually a $lang string.
- $current : string
-
The current value of the config variable being set.
- $min_value : int
-
Minimum value permitted in field.
- $max_value : int
-
Maximum value permitted in field.
- $width : int = 55
-
The width of the input field in pixels. Default: 55.
- $title : string = null
-
The title attribute of the element
- $autosave : bool = false
-
Enable auto-saving of changes when focus is lost
- $hidden : bool = false
-
Whether field is hidden on the page
- $help_link : string = ""
-
Help link to be displayed alongside the label.
config_add_text_input()
Return a data structure that will instruct the configuration page generator functions to add a text entry configuration variable to the setup page.
config_add_text_input(string $config_var, string $label[, bool $password = false ][, int $width = 420 ][, bool $textarea = false ][, string $title = null ][, bool $autosave = false ][, bool $hidden = false ][, string $help_link = "" ]) : mixed
Parameters
- $config_var : string
-
The name of the configuration variable to be added.
- $label : string
-
The user text displayed to label the text block. Usually a $lang string.
- $password : bool = false
-
Whether this is a "normal" text-entry field or a password-style field.
- $width : int = 420
-
The width of the input field in pixels. Default: 420.
- $textarea : bool = false
-
Render as a HTML <textarea>
- $title : string = null
-
The title attribute of the element
- $autosave : bool = false
-
Enable auto-saving of changes when focus is lost
- $hidden : bool = false
-
Whether field is hidden on the page
- $help_link : string = ""
-
Help link to be displayed alongside the label.
config_add_integer_input()
config_add_integer_input(mixed $config_var, mixed $label, mixed $min_value, mixed $max_value[, mixed $width = 420 ][, mixed $title = null ][, mixed $autosave = false ][, mixed $hidden = false ][, string $help_link = "" ]) : mixed
Parameters
- $config_var : mixed
- $label : mixed
- $min_value : mixed
- $max_value : mixed
- $width : mixed = 420
- $title : mixed = null
- $autosave : mixed = false
- $hidden : mixed = false
- $help_link : string = ""
config_add_hidden_input()
Generate a data structure to instruct the configuration page generator to add a hidden input
config_add_hidden_input(string $cf_var_name[, string $cf_var_value = '' ]) : array<string|int, mixed>
Parameters
- $cf_var_name : string
-
Plugins' configuration variable name
- $cf_var_value : string = ''
-
Value
Return values
array<string|int, mixed>config_file_input()
Generate an HTML input file with its own form
config_file_input(string $name, string $label, mixed $current, string $form_action[, int $width = 420 ][, mixed $valid_extensions = array() ][, mixed $file_preview = false ][, string $title = null ]) : mixed
Parameters
- $name : string
-
HTML input file name attribute
- $label : string
- $current : mixed
- $form_action : string
-
URL where the form should post to
- $width : int = 420
-
Wdidth of the input file HTML tag. Default - 420
- $valid_extensions : mixed = array()
- $file_preview : mixed = false
- $title : string = null
-
Title to be used for the label title. Default: null. Will display as hover text e.g. "Sets configuration variable: $variable_name" if $title is supplied as null. Use '' (blank) to disable where no text is required.
config_add_file_input()
Return a data structure that will be used to generate the HTML for uploading a file
config_add_file_input(mixed $config_var, string $label, string $form_action[, int $width = 420 ][, array<string|int, mixed> $valid_extensions = array() ][, mixed $file_preview = false ][, string $title = null ]) : mixed
Parameters
- $config_var : mixed
- $label : string
-
Label for field
- $form_action : string
-
URL where the form should post to
- $width : int = 420
-
Width of the input file HTML tag. Default - 420
- $valid_extensions : array<string|int, mixed> = array()
-
Optional array of file extensions that will be validated during upload, see config_process_file_input()
- $file_preview : mixed = false
- $title : string = null
-
Title to be used for the label title. Default: null. Will display as hover text e.g. "Sets configuration variable: $variable_name" if $title is supplied as null. Use '' (blank) to disable where no text is required.
config_single_select()
Generate an html single-select + options block
config_single_select(string $name, string $label, string $current, mixed $choices[, bool $usekeys = true ][, int $width = 420 ][, string $title = null ][, bool $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ][, bool $reload_page = false ]) : mixed
Parameters
- $name : string
-
The name of the select block. Usually the name of the config variable being set.
- $label : string
-
The user text displayed to label the select block. Usually a $lang string.
- $current : string
-
The current value of the config variable being set.
- $choices : mixed
- $usekeys : bool = true
-
Tells whether to use the keys from $choices as the values of the options. If set to false the values from $choices will be used for both the values of the options and the text the user sees. Defaulted to true.
- $width : int = 420
-
The width of the input field in pixels. Default: 420.
- $title : string = null
-
Title to be used for the label title. Default: null
- $autosave : bool = false
-
Flag to say whether the there should be an auto save message feedback through JS. Default: false Note: onChange event will call AutoSaveConfigOption([option name])
- $on_change_js : mixed = null
- $hidden : mixed = false
- $reload_page : bool = false
config_add_single_select()
Return a data structure that will instruct the configuration page generator functions to add a single select configuration variable to the setup page.
config_add_single_select(string $config_var, string $label[, mixed $choices = '' ][, bool $usekeys = true ][, int $width = 420 ][, mixed $title = null ][, mixed $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ][, bool $reload_page = false ]) : mixed
Parameters
- $config_var : string
-
the name of the configuration variable to be added.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $choices : mixed = ''
- $usekeys : bool = true
-
tells whether to use the keys from $choices as the values of the options. If set to false the values from $choices will be used for both the values of the options and the text the user sees. Defaulted to true.
- $width : int = 420
-
the width of the input field in pixels. Default: 420.
- $title : mixed = null
- $autosave : mixed = false
- $on_change_js : mixed = null
- $hidden : mixed = false
- $reload_page : bool = false
config_boolean_select()
Generate an html boolean select block
config_boolean_select(string $name, string $label, bool $current[, mixed $choices = '' ][, int $width = 420 ][, string $title = null ][, bool $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ][, string $help = '' ][, bool $reload_page = false ]) : mixed
Parameters
- $name : string
-
The name of the select block. Usually the name of the config variable being set.
- $label : string
-
The user text displayed to label the select block. Usually a $lang string.
- $current : bool
-
The current value (true or false) of the config variable being set.
- $choices : mixed = ''
- $width : int = 420
-
The width of the input field in pixels. Default: 420.
- $title : string = null
-
Title to be used for the label title. Default: null
- $autosave : bool = false
-
Flag to say whether the there should be an auto save message feedback through JS. Default: false Note: onChange event will call AutoSaveConfigOption([option name])
- $on_change_js : mixed = null
- $hidden : mixed = false
- $help : string = ''
-
Help text to display for this question
- $reload_page : bool = false
-
Reload the page after saving, useful for large CSS changes.
config_add_boolean_select()
Return a data structure that will instruct the configuration page generator functions to add a boolean configuration variable to the setup page.
config_add_boolean_select(string $config_var, string $label[, mixed $choices = '' ][, int $width = 420 ][, mixed $title = null ][, mixed $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ][, string $help = '' ][, bool $reload_page = false ]) : mixed
Parameters
- $config_var : string
-
the name of the configuration variable to be added.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $choices : mixed = ''
- $width : int = 420
-
the width of the input field in pixels. Default: 420.
- $title : mixed = null
- $autosave : mixed = false
- $on_change_js : mixed = null
- $hidden : mixed = false
- $help : string = ''
-
Help text to display for this question
- $reload_page : bool = false
-
Reload the page after saving.
config_checkbox_select()
Generate an html checkbox options block
config_checkbox_select(string $name, string $label, mixed $current, mixed $choices[, bool $usekeys = true ][, int $width = 300 ][, int $columns = 1 ][, mixed $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ]) : mixed
Parameters
- $name : string
-
the name of the checkbox block.
- $label : string
-
the user text displayed to label the checkbox block. Usually a $lang string.
- $current : mixed
- $choices : mixed
- $usekeys : bool = true
-
tells whether to use the keys from $choices as the values of the options. If set to false the values from $choices will be used for both the values of the options and the text the user sees. Defaulted to true.
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
- $columns : int = 1
-
the number of columns to use
- $autosave : mixed = false
- $on_change_js : mixed = null
- $hidden : mixed = false
config_add_checkbox_select()
Return a data structure that will instruct the configuration page generator functions to add a multi select configuration variable to the setup page.
config_add_checkbox_select(string $config_var, string $label, mixed $choices[, bool $usekeys = true ][, int $width = 300 ][, mixed $columns = 1 ][, mixed $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ]) : mixed
Parameters
- $config_var : string
-
the name of the configuration variable to be added.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $choices : mixed
- $usekeys : bool = true
-
tells whether to use the keys from $choices as the values of the options. If set to false the values from $choices will be used for both the values of the options and the text the user sees. Defaulted to true.
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
- $columns : mixed = 1
- $autosave : mixed = false
- $on_change_js : mixed = null
- $hidden : mixed = false
config_add_colouroverride_input()
config_add_colouroverride_input(mixed $config_var[, mixed $label = '' ][, mixed $default = '' ][, mixed $title = '' ][, mixed $autosave = false ][, mixed $on_change_js = null ][, mixed $hidden = false ]) : mixed
Parameters
- $config_var : mixed
- $label : mixed = ''
- $default : mixed = ''
- $title : mixed = ''
- $autosave : mixed = false
- $on_change_js : mixed = null
- $hidden : mixed = false
config_add_single_ftype_select()
Return a data structure that will instruct the configuration page generator functions to add a single RS field-type select configuration variable to the setup page.
config_add_single_ftype_select(string $config_var, string $label[, int $width = 300 ][, int $rtype = false ][, mixed $ftypes = array() ][, mixed $autosave = false ]) : mixed
Parameters
- $config_var : string
-
the name of the configuration variable to be added.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
- $rtype : int = false
-
optional to specify a resource type to get fields for
- $ftypes : mixed = array()
- $autosave : mixed = false
config_single_ftype_select()
Generate an html single-select + options block for selecting one of the RS field types. The selected field type is posted as the value of the "ref" column of the selected field type.
config_single_ftype_select(string $name, string $label, int $current[, int $width = 300 ][, mixed $rtype = false ][, mixed $ftypes = array() ][, mixed $autosave = false ]) : mixed
Parameters
- $name : string
-
the name of the select block. Usually the name of the config variable being set.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $current : int
-
the current value of the config variable being set
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
- $rtype : mixed = false
- $ftypes : mixed = array()
- $autosave : mixed = false
config_generate_AutoSaveConfigOption_function()
Generate Javascript function used for auto saving individual config options
config_generate_AutoSaveConfigOption_function(string $post_url) : mixed
Parameters
- $post_url : string
-
URL to where the data will be posted
config_process_file_input()
config_process_file_input(array<string|int, mixed> $page_def, mixed $file_location, mixed $redirect_location) : mixed
Parameters
- $page_def : array<string|int, mixed>
- $file_location : mixed
- $redirect_location : mixed
config_generate_html()
Generates HTML foreach element found in the page definition
config_generate_html(array<string|int, mixed> $page_def) : mixed
Parameters
- $page_def : array<string|int, mixed>
-
Array of all elements for which we need to generate HTML
config_merge_non_image_types()
Merge all non image configurations
config_merge_non_image_types() : array<string|int, mixed>
Return values
array<string|int, mixed> —Returns merged array of non image configurations.
get_header_image()
Retrieves the header image URL based on the user's appearance preference and system configuration.
get_header_image([bool $full = false ][, bool $for_header = false ][, string $force_appearance = "" ]) : string
Parameters
- $full : bool = false
-
Whether to return the full URL including the base URL.
- $for_header : bool = false
-
Whether the image is being displayed in the header.
- $force_appearance : string = ""
-
Optionally force the appearance mode ('dark' or 'light').
Return values
string —The resolved URL for the header image.
config_register_core_fieldvars()
Used to block deletion of 'core' fields. Any variable added to the $corefields array will be checked before a field is deleted and if the field is referenced by one of these core variables the deletion will be blocked
config_register_core_fieldvars([string $source = "BASE" ][, array<string|int, mixed> $varnames = array() ]) : void
Parameters
- $source : string = "BASE"
-
Optional origin of variables e.g. 'Transform plugin'
- $varnames : array<string|int, mixed> = array()
-
Array of variable names
config_register_core_field_refs()
Used to block deletion of 'core' fields.
config_register_core_field_refs(string $source, array<string|int, mixed> $refs) : mixed
Parameters
- $source : string
-
What part (e.g plugin) relies on this list of metadata fields
- $refs : array<string|int, mixed>
-
List of metadata field IDs to prevent being deleted
override_rs_variables_by_eval()
Run PHP code on array of variables. Used for modifying $GLOBALS.
override_rs_variables_by_eval(array<string|int, mixed> $variables, string $code, string $override_for) : void
Parameters
- $variables : array<string|int, mixed>
-
Array of variables to apply override on.
- $code : string
-
Signed string containing the PHP code to run.
- $override_for : string
-
Context in which override is being made. Generally this will be 'usergroup' or 'resource_type' config overrides. This ensures we only revert config to its original state for the same origin of the override. For example, if applying resource type specific config, don't revert config changed at the user group level. This also prevents unexpected changes of config whilst pages are being loaded.
update_resource_type_field_resource_types()
Update the resource_type_field - resource_type mappings
update_resource_type_field_resource_types(int $ref, array<string|int, mixed> $resource_types) : void
Parameters
- $ref : int
-
Resource type field ref
- $resource_types : array<string|int, mixed>
-
Array of resource type refs
get_resource_type_field_resource_types()
Get all resource_type->resource-type_field associations
get_resource_type_field_resource_types([array<string|int, mixed> $fields = [] ]) : array<string|int, mixed>
Parameters
- $fields : array<string|int, mixed> = []
-
Optional array of resource_type_field data returned by get_resource_type_fields()
Return values
array<string|int, mixed> —Array with resource_type_field ID as keys and arrays of resource_type IDs as values
create_resource_type()
Create a new resource type with the specified name
create_resource_type(mixed $name) : int|bool
Parameters
- $name : mixed
-
Name of new resouce type
Return values
int|bool —ref of new resource type or false if invalid data passed
save_resource_type()
Save updated resource_type data
save_resource_type(int $ref, array<string|int, mixed> $savedata) : bool
Parameters
- $ref : int
-
Ref of resource type
- $savedata : array<string|int, mixed>
-
Array of column values
Return values
boolclear_restype_cache()
Force clear of restype_cache after editing resource type where get_resource_types() needs to pick up the new value.
clear_restype_cache() : void
rs_get_resource_type()
Get resource_type data
rs_get_resource_type(int $ref) : array<string|int, mixed>
Parameters
- $ref : int
Return values
array<string|int, mixed>save_resource_type_field()
Save resource type field - used on pages/admin/admin_resource_type_field_edit.php
save_resource_type_field(int $ref, array<string|int, mixed> $columns, mixed $postdata) : bool
Parameters
- $ref : int
-
Field ID
- $columns : array<string|int, mixed>
-
Array of column data
- $postdata : mixed
-
POST'd data
Return values
boolget_resource_type_field_columns()
Get the definitions for resource_type_field columns, including properties and display configurations.
get_resource_type_field_columns() : array<string|int, mixed>
Return values
array<string|int, mixed> —An associative array of resource type field column definitions.
is_valid_contact_sheet_preview_size()
Input validation helper function to determine if the $contact_sheet_preview_size config is valid.
is_valid_contact_sheet_preview_size(string $val) : bool
Parameters
- $val : string
Return values
boolsave_removed_ui_config()
Store a config option that has been removed from the UI so that it will still work until it has been set in config file
save_removed_ui_config(string $option) : bool
Parameters
- $option : string
Return values
bool —Returns true if option been saved, false if not
check_removed_ui_config()
Check if there is a previously stored value for the given config option.
check_removed_ui_config(string $option[, mixed $default = "" ]) : bool
Intended for options that were previously set in the UI but now need to be set in config.
Parameters
- $option : string
- $default : mixed = ""
-
The default value to set for the config option if not set anywhere
Return values
bool —True if the config option is overridden with a stored value from user_preferences, false if not
config_add_fixed_input()
Return a data structure that will instruct the configuration page generator functions to add a fixed input setting to the setup page. Uses render_fixed_text_question(). Useful for options removed from the UI
config_add_fixed_input(string $label, string $value[, string $helptext = "" ]) : array<string|int, mixed>
Parameters
- $label : string
-
The user text displayed to label the text block. Usually a $lang string.
- $value : string
-
The fixed text value to be displayed
- $helptext : string = ""
-
Optional text that will be displayed below the question
Return values
array<string|int, mixed> —Array of data that will be passed to the page generation code
render_config_filter_by_search()
Add config option search to user preferences / system configuration page.
render_config_filter_by_search(string $filter, string $only_modified) : void
Also requires config_filter_by_search() to process results. For examples, see the above pages.
Parameters
- $filter : string
-
Value from getval("filter", "")
- $only_modified : string
-
Value from getval("only_modified", "no")
config_filter_by_search()
Process values from config search fields, see render_config_filter_by_search() Filter $page_def elements to show only those searched for.
config_filter_by_search(array<string|int, mixed> $page_def, array<string|int, mixed> $config_type, string $find, string $only_modified) : array<string|int, mixed>
Parameters
- $page_def : array<string|int, mixed>
-
Array containing page definition, from functions config_add_ ...
- $config_type : array<string|int, mixed>
-
Array representing the type of config to check: array() - empty array for system config array('user' => 1) - key 'user' and int representing user ref to check user preferences array('usergroup' => 2) - key 'usergroup' and int representing usergroup ref to check user group preferences
- $find : string
-
Value from getval("find", "")
- $only_modified : string
-
Value from getval("only_modified", "no")
Return values
array<string|int, mixed>config_remove_user_preferences()
Remove user preferences by resetting to system preferences. Used to display system config or user group config without the current user's preferences changing the values.
config_remove_user_preferences(array<string|int, mixed> $page_def) : void
Parameters
- $page_def : array<string|int, mixed>
-
Array containing page definition, from functions config_add_ ...
config_percent_range()
Generate a percentage range input
config_percent_range(string $name, string $label, string $current[, int $width = 420 ][, string $title = null ][, string $help_link = "" ]) : mixed
Parameters
- $name : string
-
The name of the configuration variable to be added.
- $label : string
-
The user text displayed to label the text block. Usually a $lang string.
- $current : string
-
The current value of the config variable being set.
- $width : int = 420
-
The width of the input field in pixels. Default: 420.
- $title : string = null
-
The title attribute of the element
- $help_link : string = ""
-
Help link to be displayed alongside the label.
config_add_percent_range()
Return a data structure that will instruct the configuration page generator functions to add a text entry configuration variable to the setup page.
config_add_percent_range(string $config_var, string $label[, int $width = 380 ][, string $title = null ][, string $help_link = "" ]) : mixed
Parameters
- $config_var : string
-
The name of the configuration variable to be added.
- $label : string
-
The user text displayed to label the text block. Usually a $lang string.
- $width : int = 380
-
The width of the input field in pixels. Default: 420.
- $title : string = null
-
The title attribute of the element
- $help_link : string = ""
-
Help link to be displayed alongside the label.
config_check_valid_option()
Server side validation for saving values submitted using the page generation functions "config_add_...()" and created with config_generate_html(). For example, the system configuration page.
config_check_valid_option(array<string|int, mixed> $def, mixed $value) : bool
Parameters
- $def : array<string|int, mixed>
-
Array containing field definition e.g. from config_add_integer_input()
- $value : mixed
-
User submitted value to be checked.
Return values
bool —True if the option is valid, else false.
generateResourcesMetadataCSV()
Generates the CSV content of the metadata for resources passed in the array The CSV is echoed to output for direct download or saved to a file
generateResourcesMetadataCSV(array<string|int, mixed> $resources[, bool $personal = false ][, bool $alldata = false ][, string $outputfile = "" ]) : bool|void
Parameters
- $resources : array<string|int, mixed>
-
array of resource ids to create a CSV for
- $personal : bool = false
-
flag to include only fields expected to include personal data
- $alldata : bool = false
-
flag to include extra data from the resource table
- $outputfile : string = ""
-
optional file path to output CSV to
Return values
bool|void —TRUE if the file has been created, void if the data has been sent as a direct download
generateNodesExport()
Generates the file content when exporting nodes
generateNodesExport(array<string|int, mixed> $field[, mixed $parent = null ][, bool $send_headers = false ]) : mixed
Parameters
- $field : array<string|int, mixed>
-
Array containing field information (as retrieved by get_field)
- $parent : mixed = null
- $send_headers : bool = false
-
If true, function sends headers used for downloading content. Default is set to false
existing_dash_tile()
returns a ref for an existing dash tile in dash_tile table, returns 0 if no existing dash tile
existing_dash_tile([string $url = "" ][, string $link = "" ][, string $title = "" ][, string $text = "" ][, int $reload_interval = 0 ][, int $all_users = 0 ][, int $resource_count = 0 ]) : int
Parameters
- $url : string = ""
- $link : string = ""
- $title : string = ""
- $text : string = ""
- $reload_interval : int = 0
- $all_users : int = 0
- $resource_count : int = 0
Return values
intcreate_dash_tile()
create_dash_tile(mixed $url, mixed $link, mixed $title, mixed $reload_interval, mixed $all_users, mixed $default_order_by, mixed $resource_count[, mixed $text = "" ][, mixed $delete = 1 ][, array<string|int, mixed> $specific_user_groups = array() ]) : mixed
Parameters
- $url : mixed
- $link : mixed
- $title : mixed
- $reload_interval : mixed
- $all_users : mixed
- $default_order_by : mixed
- $resource_count : mixed
- $text : mixed = ""
- $delete : mixed = 1
- $specific_user_groups : array<string|int, mixed> = array()
update_dash_tile()
update_dash_tile(mixed $tile, mixed $url, mixed $link, mixed $title, mixed $reload_interval, mixed $all_users, mixed $tile_audience, mixed $current_specific_user_groups, mixed $specific_user_groups, mixed $default_order_by, mixed $resource_count[, mixed $text = "" ][, mixed $delete = 1 ]) : mixed
Parameters
- $tile : mixed
- $url : mixed
- $link : mixed
- $title : mixed
- $reload_interval : mixed
- $all_users : mixed
- $tile_audience : mixed
- $current_specific_user_groups : mixed
- $specific_user_groups : mixed
- $default_order_by : mixed
- $resource_count : mixed
- $text : mixed = ""
- $delete : mixed = 1
delete_dash_tile()
delete_dash_tile(mixed $tile[, mixed $cascade = true ][, mixed $force = false ]) : mixed
Parameters
- $tile : mixed
- $cascade : mixed = true
- $force : mixed = false
revoke_all_users_flag_cascade_delete()
revoke_all_users_flag_cascade_delete(mixed $tile) : mixed
Parameters
- $tile : mixed
append_default_position()
append_default_position() : mixed
reorder_default_dash()
reorder_default_dash() : mixed
update_default_dash_tile_order()
update_default_dash_tile_order(mixed $tile, mixed $order_by) : mixed
Parameters
- $tile : mixed
- $order_by : mixed
get_tile()
get_tile(mixed $tile) : mixed
Parameters
- $tile : mixed
all_user_dash_tile_active()
all_user_dash_tile_active(mixed $tile) : mixed
Parameters
- $tile : mixed
existing_tile()
existing_tile(mixed $title, mixed $all_users, mixed $url, mixed $link, mixed $reload_interval, mixed $resource_count[, mixed $text = "" ]) : mixed
Parameters
- $title : mixed
- $all_users : mixed
- $url : mixed
- $link : mixed
- $reload_interval : mixed
- $resource_count : mixed
- $text : mixed = ""
cleanup_dash_tiles()
cleanup_dash_tiles() : mixed
checkTileConfig()
checkTileConfig(mixed $tile, mixed $tile_style) : mixed
Parameters
- $tile : mixed
- $tile_style : mixed
checkConfigCustomHomePanels()
checkConfigCustomHomePanels(mixed $tile, mixed $tile_style) : mixed
Parameters
- $tile : mixed
- $tile_style : mixed
get_alluser_available_tiles()
get_alluser_available_tiles([mixed $tile = "null" ]) : mixed
Parameters
- $tile : mixed = "null"
get_default_dash()
get_default_dash([mixed $user_group_id = null ][, mixed $edit_mode = false ]) : mixed
Parameters
- $user_group_id : mixed = null
- $edit_mode : mixed = false
get_managed_dash()
get_managed_dash() : mixed
add_usergroup_dash_tile()
add_usergroup_dash_tile(mixed $usergroup, mixed $tile, mixed $default_order_by) : mixed
Parameters
- $usergroup : mixed
- $tile : mixed
- $default_order_by : mixed
append_usergroup_position()
append_usergroup_position(mixed $usergroup) : mixed
Parameters
- $usergroup : mixed
reorder_usergroup_dash()
Reorder dashboard tiles for a specific user group.
reorder_usergroup_dash(int $usergroup) : void
This function retrieves all dashboard tiles assigned to a user group and updates each tile's order in increments of 10.
Parameters
- $usergroup : int
-
The user group ID for which dashboard tiles should be reordered.
update_usergroup_dash_tile_order()
Update the display order of a specific dashboard tile for a user group.
update_usergroup_dash_tile_order(int $usergroup, int $tile, int $default_order_by) : void
Parameters
- $usergroup : int
-
The user group ID to which the dashboard tile belongs.
- $tile : int
-
The ID of the dashboard tile to update.
- $default_order_by : int
-
The new default order position for the tile within the user group's dashboard.
build_usergroup_dash()
build_usergroup_dash - rebuild the usergroup tiles for either a specific user or all users.
build_usergroup_dash(int $user_group[, int $user_id = 0 ][, int $newtileid = "" ]) : void
If a specific tile is passed e.g. if called from create_dash_tile then we just add it to the end
Parameters
- $user_group : int
-
ID of group to add tile(s) to
- $user_id : int = 0
-
ID of individual user to add tile(s) to
- $newtileid : int = ""
-
ID of a single tile to add on the end
get_tile_user_groups()
Retrieve user group IDs associated with a specific dashboard tile.
get_tile_user_groups(int $tile_id) : array<string|int, mixed>
This function fetches the IDs of all user groups that have access to a given dashboard tile. Each user group ID is returned as a value in the resulting array.
Parameters
- $tile_id : int
-
The ID of the dashboard tile for which to retrieve associated user groups.
Return values
array<string|int, mixed> —An array of user group IDs that are linked to the specified dashboard tile.
get_usergroup_available_tiles()
Retrieve dashboard tiles available to a specific user group.
get_usergroup_available_tiles(int $user_group_id[, int|string $tile = '' ]) : array<string|int, mixed>
This function returns the tiles that are accessible by a particular user group, optionally filtered by a specific tile ID. The function ensures that the user group ID is numeric and fetches the tiles that are either available to all users or specifically assigned to the provided user group.
Parameters
- $user_group_id : int
-
The ID of the user group for which to retrieve available tiles.
- $tile : int|string = ''
-
(optional) Specific tile ID to filter by; if omitted, all available tiles for the user group are returned.
Tags
Return values
array<string|int, mixed> —An array of associative arrays, each representing a dashboard tile with keys:
- 'ref' (int): Unique reference ID of the tile.
- 'tile' (int): Same as 'ref', included for compatibility.
- 'title' (string): The title of the tile.
- 'txt' (string): Text content of the tile.
- 'link' (string): Link associated with the tile.
- 'url' (string): URL of an external resource, if any.
- 'reload_interval_secs' (int): Time interval for reloading the tile content in seconds.
- 'resource_count' (int): Resource count, if applicable.
- 'all_users' (int): Flag indicating if the tile is available to all users.
- 'allow_delete' (int): Flag indicating if the tile can be deleted.
- 'default_order_by' (int): Default order for the tile.
- 'order_by' (int|null): Order for the tile within the user group; may be null if not explicitly set.
- 'dash_tile' (int): Always set to 1, indicating it is a dashboard tile.
get_usergroup_tile()
Get usergroup_dash_tile record
get_usergroup_tile(int $tile_id, int $user_group_id) : array<string|int, mixed>
Parameters
- $tile_id : int
- $user_group_id : int
Return values
array<string|int, mixed>add_user_dash_tile()
add_user_dash_tile(mixed $user, mixed $tile, mixed $order_by[, mixed $reorder = true ]) : mixed
Parameters
- $user : mixed
- $tile : mixed
- $order_by : mixed
- $reorder : mixed = true
get_user_tile()
get_user_tile(mixed $usertile, mixed $user) : mixed
Parameters
- $usertile : mixed
- $user : mixed
create_new_user_dash()
create_new_user_dash(mixed $user) : mixed
Parameters
- $user : mixed
update_user_dash_tile_order()
update_user_dash_tile_order(mixed $user, mixed $tile, mixed $order_by) : mixed
Parameters
- $user : mixed
- $tile : mixed
- $order_by : mixed
delete_user_dash_tile()
delete_user_dash_tile(mixed $usertile, mixed $user) : mixed
Parameters
- $usertile : mixed
- $user : mixed
empty_user_dash()
empty_user_dash(mixed $user[, mixed $purge = true ]) : mixed
Parameters
- $user : mixed
- $purge : mixed = true
reorder_user_dash()
reorder_user_dash(mixed $user) : mixed
Parameters
- $user : mixed
append_user_position()
append_user_position(mixed $user) : mixed
Parameters
- $user : mixed
get_user_available_tiles()
get_user_available_tiles(mixed $user[, mixed $tile = "null" ]) : mixed
Parameters
- $user : mixed
- $tile : mixed = "null"
get_user_dash()
get_user_dash(mixed $user) : mixed
Parameters
- $user : mixed
render_delete_dialog_JS()
Render JavaScript for the dashboard tile delete dialog.
render_delete_dialog_JS([bool $all_users = false ]) : void
This function outputs JavaScript to create and display a jQuery UI dialog for deleting dashboard tiles.
Depending on the $all_users parameter, the dialog may include additional options for deleting default tiles
or managing default dashboard tiles.
Parameters
- $all_users : bool = false
-
(optional) If set to
true, additional options are displayed for managing tiles that are accessible by all users. Default isfalse.
Return values
void —Outputs JavaScript directly to the page to render the dialog.
parse_dashtile_link()
parse_dashtile_link(mixed $link) : mixed
Parameters
- $link : mixed
build_dash_tile_list()
build_dash_tile_list(mixed $dtiles_available) : mixed
Parameters
- $dtiles_available : mixed
delete_usergroup_dash_tile()
delete_usergroup_dash_tile(mixed $tile, mixed $group) : mixed
Parameters
- $tile : mixed
- $group : mixed
allowPromotedResources()
Confirms whether a dash tile type allows for promoted resources
allowPromotedResources(string $tile_type) : bool
Parameters
- $tile_type : string
Return values
boolrender_upgrade_available_tile()
Render "Upgrade available" tile for Administrators and Super Admins. This tile cannot be deleted or removed unless ResourceSpace version is up to date
render_upgrade_available_tile(int $user) : void
Parameters
- $user : int
-
User ID, normally this is the $userref
generate_dash_tile_toolbar()
Generate HTML and JavaScript for the dashboard tile toolbar.
generate_dash_tile_toolbar(array<string|int, mixed> $tile, string $tile_id[, bool $display_counter = false ]) : void
This function renders a toolbar for a dashboard tile, providing options to delete or edit the tile, based on the user's permissions. The toolbar appears on hover and includes JavaScript functionality to manage tile interactions, including preventing accidental clicks on the tile itself when using the toolbar.
Parameters
- $tile : array<string|int, mixed>
-
An associative array containing information about the dashboard tile, including:
- 'ref' (int): Tile reference ID.
- 'all_users' (int): Flag indicating if the tile is accessible by all users.
- 'no_edit' (bool): Flag indicating if the tile is non-editable.
- 'url' (string|null): Optional URL for the tile's link.
- $tile_id : string
-
The unique HTML ID of the tile used for identifying elements in the toolbar.
- $display_counter : bool = false
-
If true then a counter pill will be rendered opposite the dash tile actions
dash_tile_featured_collection_get_resources()
Build list of resources that can be shown on a dash tile as a background image. Helper function.
dash_tile_featured_collection_get_resources(array<string|int, mixed>|int $c, array<string|int, mixed> $ctx) : array<string|int, mixed>
Parameters
- $c : array<string|int, mixed>|int
-
Collection ref -or- collection data as returned by get_collection()
- $ctx : array<string|int, mixed>
-
Contextual data
Return values
array<string|int, mixed>dash_tile_featured_collection_get_top_resources()
dash_tile_featured_collection_get_top_resources() : mixed
validate_tile_style()
Validate the type of dash tile and check that the style provided is valid for it.
validate_tile_style(string $type, string $style) : string
Parameters
- $type : string
-
Tile type name.
- $style : string
-
Tile style name.
Return values
string —Will return the style value provided if correct, the first defined style or blank if no styles defined.
validate_build_url()
Sanitise the url provided when saving a dash tile. This function will take the value obtained by the form and pass it through if valid.
validate_build_url(string $buildurl) : string
If the url supplied is invalid, a blank value will be returned allowing the default standard tile type to be used.
Parameters
- $buildurl : string
-
url supplied when dash tile is edited, containing a number of optional parameters.
Return values
string —A valid url or empty string if invalid.
tltype_srch_generate_js_for_background_and_count()
Generate client side logic for doing expensive computation async for retrieving the tile background and total results count.
tltype_srch_generate_js_for_background_and_count(array<string|int, mixed> $tile, string $tile_id, int $tile_width, int $tile_height, int $promoted_image) : mixed
Parameters
- $tile : array<string|int, mixed>
-
Tile information pages/ajax/dash_tile.php
- $tile_id : string
-
HTML ID for the container div
- $tile_width : int
-
Tile width pages/ajax/dash_tile.php
- $tile_height : int
-
Tile height pages/ajax/dash_tile.php
- $promoted_image : int
-
ID of the promoted resource (for background)
get_dash_search_data()
Get images and resource count for search dash tile.
get_dash_search_data([string $link = '' ][, int $promimg = 0 ]) : array<string|int, mixed>
This has to work on a string because the dash tile does not yet exist when on dash creation page For performance this function will return a maximum of 4 images
Parameters
- $link : string = ''
-
Tile link URL
- $promimg : int = 0
-
Promoted image ref
Return values
array<string|int, mixed> —$searchdata Array containing the count of resources and details of preview images.
can_edit_tile()
Check if current user can edit dash tile. Users shouldn't be able to edit tiles that they can't view and only dash admins should be able to edit shared tiles.
can_edit_tile(int $tileref, int $audience, int $user) : bool
Parameters
- $tileref : int
- $audience : int
-
0 for tile available to one user, 1 for all users. Typically obtained from get_tile()
- $user : int
-
Ref of the user editing the tile.
Return values
bool —Will return true if editing is allowed else will return false.
tile_select()
tile_select(mixed $tile_type, mixed $tile_style, mixed $tile, mixed $tile_id, mixed $tile_width, mixed $tile_height) : mixed
Parameters
- $tile_type : mixed
- $tile_style : mixed
- $tile : mixed
- $tile_id : mixed
- $tile_width : mixed
- $tile_height : mixed
tile_graph()
Generate the HTML for a graph dash tile.
tile_graph(array<string|int, mixed> $tile, string $tile_id) : void
@param array $tile array usually from get_tile()
Parameters
- $tile : array<string|int, mixed>
- $tile_id : string
-
string used to identify the tile on the page
tile_config_themeselector()
tile_config_themeselector(mixed $tile, mixed $tile_id, mixed $tile_width, mixed $tile_height) : mixed
Parameters
- $tile : mixed
- $tile_id : mixed
- $tile_width : mixed
- $tile_height : mixed
tile_icon()
Generate HTML for an icon tile, i.e. pending submission, pending review or upload
tile_icon(array<string|int, mixed> $tile, string $tile_id) : void
@param array $tile array usually from get_tile()
Parameters
- $tile : array<string|int, mixed>
- $tile_id : string
-
string used to identify the tile on the page
tile_freetext()
Generate HTML for a freetext tile
tile_freetext(array<string|int, mixed> $tile[, string|null $tile_id = null ]) : void
@param array $tile array usually from get_tile()
Parameters
- $tile : array<string|int, mixed>
- $tile_id : string|null = null
-
string used to identify the tile on the page
tile_search_thumbs()
tile_search_thumbs(mixed $tile, mixed $tile_id, mixed $tile_width, mixed $tile_height[, mixed $promoted_image = false ]) : mixed
Parameters
- $tile : mixed
- $tile_id : mixed
- $tile_width : mixed
- $tile_height : mixed
- $promoted_image : mixed = false
tile_search_multi_or_blank()
tile_search_multi_or_blank(mixed $tile, mixed $tile_id, mixed $tile_width, mixed $tile_height) : mixed
Parameters
- $tile : mixed
- $tile_id : mixed
- $tile_width : mixed
- $tile_height : mixed
tile_featured_collection_thumbs()
tile_featured_collection_thumbs(mixed $tile, mixed $tile_id, mixed $tile_width, mixed $tile_height, mixed $promoted_image) : mixed
Parameters
- $tile : mixed
- $tile_id : mixed
- $tile_width : mixed
- $tile_height : mixed
- $promoted_image : mixed
tile_featured_collection_multi()
tile_featured_collection_multi(mixed $tile, mixed $tile_id, mixed $tile_width, mixed $tile_height, mixed $promoted_image) : mixed
Parameters
- $tile : mixed
- $tile_id : mixed
- $tile_width : mixed
- $tile_height : mixed
- $promoted_image : mixed
errorhandler()
Centralised error handler. Display friendly error messages.
errorhandler(int $errno, string $errstr, string $errfile, int $errline) : void
Parameters
- $errno : int
- $errstr : string
- $errfile : string
- $errline : int
db_use_multiple_connection_modes()
Check if ResourceSpace has been configured to run with differnt users (read-write and/or read-only)
db_use_multiple_connection_modes() : bool
Return values
booldb_set_connection_mode()
Used to force the database connection mode before running a particular SQL query
db_set_connection_mode(string $name) : void
NOTE: this will generate a global variable that can be used to determine which mode is currently set.
IMPORTANT: It is the responsibility of each function to clear the current db mode once it finished running the query as the variable is not meant to persist between queries.
Parameters
- $name : string
-
The name of the connection mode
db_get_connection_mode()
Return the current DB connection mode
db_get_connection_mode() : string
Return values
stringdb_clear_connection_mode()
Clear the current DB connection mode that is in use to override the current SQL queries.
db_clear_connection_mode() : void
@see db_set_connection_mode() for more details.
sql_connect()
Connect to the database using the configured settings.
sql_connect() : void
db_begin_transaction()
Indicate that from now on we want to group together DML statements into one transaction.
db_begin_transaction(string $name) : bool
Parameters
- $name : string
-
Savepoint name for the transaction.
Tags
Return values
bool —Returns TRUE on success or FALSE on failure.
db_end_transaction()
Tell the database to commit the current transaction.
db_end_transaction(string $name) : bool
Parameters
- $name : string
-
Savepoint name for the transaction.
Tags
Return values
bool —Returns TRUE on success or FALSE on failure.
db_rollback_transaction()
Tell the database to rollback the current transaction.
db_rollback_transaction(string $name) : bool
Parameters
- $name : string
-
Savepoint name for the transaction.
Return values
bool —Returns TRUE on success or FALSE on failure.
ps_query()
Execute a prepared statement and return the results as an array.
ps_query(string $sql[, array<string|int, mixed> $parameters = array() ][, string $cache = "" ][, int $fetchrows = -1 ][, bool $dbstruct = true ][, int $logthis = 2 ][, bool $reconnect = true ][, mixed $fetch_specific_columns = false ]) : array<string|int, mixed>
Parameters
- $sql : string
-
The SQL to execute
- $parameters : array<string|int, mixed> = array()
-
An array of parameters used in the SQL in the order: type, value, type, value... and so on. Types are as follows: i - integer, d - double, s - string, b - BLOB. Example: array("s","This is the first SQL parameter and is a string","d",3.14)
- $cache : string = ""
-
Disk based caching - cache the results on disk, if a cache group is specified. The group allows selected parts of the cache to be cleared by certain operations, for example clearing all cached site content whenever site text is edited.
- $fetchrows : int = -1
-
set we don't have to loop through all the returned rows. We just fetch $fetchrows row but pad the array to the full result set size with empty values.
- $dbstruct : bool = true
-
Set to false to prevent the dbstruct being checked on an error - only set by operations doing exactly that to prevent an infinite loop
- $logthis : int = 2
-
No longer used
- $reconnect : bool = true
- $fetch_specific_columns : mixed = false
Tags
Return values
array<string|int, mixed>copy_value()
Copy value as value (flatten / no references)
copy_value(mixed $v) : mixed
Parameters
- $v : mixed
ps_value()
Return a single value from a database query, or the default if no rows
ps_value(string $query, array<string|int, mixed> $parameters, mixed $default[, string $cache = "" ]) : string
NOTE: The value returned must have the column name aliased to 'value'
Parameters
- $query : string
-
SQL query
- $parameters : array<string|int, mixed>
-
SQL parameters with types, as for ps_query()
- $default : mixed
-
Default value to return if no rows returned
- $cache : string = ""
-
Cache category (optional)
Tags
Return values
stringps_array()
Like ps_value() but returns an array of all values found
ps_array(string $query[, array<string|int, mixed> $parameters = array() ][, string $cache = "" ]) : array<string|int, mixed>
NOTE: The value returned must have the column name aliased to 'value'
Parameters
- $query : string
-
SQL query
- $parameters : array<string|int, mixed> = array()
-
SQL parameters with types, as for ps_query()
- $cache : string = ""
-
Cache category (optional)
Tags
Return values
array<string|int, mixed>sql_insert_id()
Return the ID of the previously inserted row.
sql_insert_id() : int
Return values
intget_query_cache_location()
Returns the location of the query cache files
get_query_cache_location() : string
Return values
stringclear_query_cache()
Clear all cached queries for cache group $cache
clear_query_cache(string $cache) : bool
If we've already done this on this page load, don't do it again as it will only add to the load in the case of batch operations.
Parameters
- $cache : string
Return values
boolcheck_db_structs()
Check the database structure conforms to that describe in the /dbstruct folder. Usually only happens after a SQL error after which the SQL is retried, thus the database is automatically upgraded.
check_db_structs([bool $verbose = false ]) : void
This function calls CheckDBStruct() for all plugin paths and the core project.
Parameters
- $verbose : bool = false
CheckDBStruct()
Check the database structure against the text files stored in $path.
CheckDBStruct(string $path[, bool $verbose = false ]) : void
Add tables / columns / data / indices as necessary.
Parameters
- $path : string
- $verbose : bool = false
sql_limit()
Generate the LIMIT statement for a SQL query
sql_limit(int $offset, int $rows) : string
Parameters
- $offset : int
-
Specifies the offset of the first row to return
- $rows : int
-
Specifies the maximum number of rows to return
Return values
stringsql_limit_with_total_count()
Utility function to obtain the total found rows while paginating the results.
sql_limit_with_total_count(PreparedStatementQuery $query, null|int $rows, null|int $offset[, bool $cachecount = false ][, null|PreparedStatementQuery $countquery = null ]) : array<string|int, mixed>
IMPORTANT: the input query MUST have a deterministic order so it can help with performance and not have an undefined behaviour
Parameters
- $query : PreparedStatementQuery
-
SQL query
- $rows : null|int
-
Specifies the maximum number of rows to return. Usually set by a global configuration option (e.g $default_perpage, $default_perpage_list).
- $offset : null|int
-
Specifies the offset of the first row to return. Use NULL to not offset.
- $cachecount : bool = false
-
Use previously cached count if available?
- $countquery : null|PreparedStatementQuery = null
-
Optional separate query to obtain count, usually without ORDER BY
Return values
array<string|int, mixed> —Returns a:
- total: int - count of total found records (before paging)
- data: array - paged result set
sql_truncate_text_val()
Query helper to ensure code honours the database schema constraints on text columns.
sql_truncate_text_val(string $v, int $len) : string
IMPORTANT: please use where appropriate! In some cases, truncating may mean losing useful information (e.g contextual data), in which case changing the column type may be a better option.
Parameters
- $v : string
-
String value that may require truncating
- $len : int
-
Desired length (limit as imposed by the database schema). https://www.resourcespace.com/knowledge-base/developers/database_schema
Return values
stringps_param_insert()
When constructing prepared statements and using e.g. ref in (some list of values), assists in outputting the correct number of parameters.
ps_param_insert(int $count) : string
Parameters
- $count : int
-
How many parameters to insert, e.g. 3 returns "?,?,?"
Return values
stringps_param_fill()
When constructing prepared statements and using e.g. ref in (some list of values), assists in preparing the parameter array.
ps_param_fill(array<string|int, mixed> $array, string $type) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
-
The input array, to prepare for output. Will return this array but with type entry inserted before each value.
- $type : string
-
The column type as per ps_query
Return values
array<string|int, mixed>ps_fill_param_array()
Assists in generating parameter arrays where all of the parameters for a given section of sql are the same.
ps_fill_param_array(string $string, string $value, string $type) : array<string|int, mixed>
Parameters
- $string : string
-
A portion of sql that contains one or more placeholders
- $value : string
-
The value that should be used to generate the array of parameters
- $type : string
-
The column type of $value as per ps_query
Return values
array<string|int, mixed>sql_reorder_records()
Re-order rows in the table
sql_reorder_records(string $table, array<string|int, mixed> $refs) : void
Parameters
- $table : string
-
Table name. MUST have an "order_by" column.
- $refs : array<string|int, mixed>
-
List of record IDs in the new desired order
columns_in()
Returns a comma separated list of table columns from the given table. Optionally, will use an alias instead of the table name to prefix the columns. For inclusion in SQL to replace "select *" which is not supported when using prepared statements.
columns_in(string $table[, string $alias = null ][, string $plugin = null ][, bool $return_list = false ]) : string|array<string|int, mixed>
Parameters
- $table : string
-
The source table
- $alias : string = null
-
Optionally, a different alias to use
- $plugin : string = null
-
[DEPRECATED] Specifies that this table is defined in a plugin with the supplied name
- $return_list : bool = false
-
Set to true to return a list of column names. Note: the alias is ignored in this mode.
Return values
string|array<string|int, mixed>db_chunk_id_list()
Database helper to chunk a list of IDs
db_chunk_id_list(array<int, int> $refs) : array<int, array<int, int>>
Parameters
- $refs : array<int, int>
Return values
array<int, array<int, int>>db_delete_table_records()
Delete database table records from a list of IDs
db_delete_table_records(string $table, array<int, int> $refs, callable $logger) : bool
return db_delete_table_records(
'brand_guidelines_content',
$refs,
fn($ref) => log_activity(null, LOG_CODE_DELETED, null, 'brand_guidelines_content', 'content', $ref)
);
Example how to not log it:
return db_delete_table_records('brand_guidelines_content', $refs, fn() => null);
Parameters
- $table : string
-
Database table name
- $refs : array<int, int>
-
List of database IDs
- $logger : callable
Return values
bool —True if it executed the query, false otherwise
check_debug_log_override()
Check and set the debug log override status for the current user.
check_debug_log_override() : void
This function determines if debug logging should be enabled based on system variables and the user's ID. If a debug override is set for a specific user or globally, and the override has not expired, debug logging will be activated. Expired overrides are removed.
create_debug_log_override()
Create a debug log override for a specified user or globally.
create_debug_log_override([int $debug_user = -1 ][, int $debug_expires = 60 ]) : void
This function sets a debug override that enables debug logging for a specified user
or all users if $debug_user is -1. The override is set to expire after a specified
duration in seconds. Any existing override settings are removed before the new values
are inserted.
Parameters
- $debug_user : int = -1
-
The user ID for whom to enable debug logging (-1 for all users). Default is -1.
- $debug_expires : int = 60
-
The time in seconds until the debug override expires, starting from the current time. Default is 60 seconds.
debug_function_call()
Debug called function and its arguments
debug_function_call(string $name, array<string|int, mixed> $args) : bool|void
The best way to use this function is to call it on the first line of a function definition:
function some_test($required, $num, $optional_bool = false) { debug_function_call(FUNCTION, func_get_args());
echo "called some_test" . PHP_EOL;
return;
}
Parameters
- $name : string
-
The function name
- $args : array<string|int, mixed>
-
The "runtime" args
Return values
bool|void —@see debug()
debug_stringify()
Stringify variables for use in the debug log. This is used more as fallback to json_encode() failing to maintain quick readability of the logs.
debug_stringify(mixed $value) : string
Parameters
- $value : mixed
-
Any value that needs stringified
Return values
stringLOG_CODE_validate()
LOG_CODE_validate(mixed $log_code) : mixed
Parameters
- $log_code : mixed
LOG_CODE_get_all()
LOG_CODE_get_all() : mixed
definitions_get_by_prefix()
definitions_get_by_prefix(mixed $prefix) : mixed
Parameters
- $prefix : mixed
do_search()
Takes a search string $search, as provided by the user, and returns a results set of matching resources. If there are no matches, instead returns an array of suggested searches
do_search(string $search[, string $restypes = '' ][, string $order_by = 'relevance' ][, string $archive = '0' ][, int|array<string|int, mixed> $fetchrows = -1 ][, string $sort = 'desc' ][, bool $access_override = false ][, int $starsearch = DEPRECATED_STARSEARCH ][, bool $ignore_filters = false ][, bool $return_disk_usage = false ][, string $recent_search_daylimit = '' ][, string|bool $go = false ][, bool $stats_logging = true ][, bool $return_refs_only = false ][, bool $editable_only = false ][, bool $returnsql = false ][, int $access = null ][, mixed $smartsearch = false ]) : null|string|array<string|int, mixed>|PreparedStatementQuery
Parameters
- $search : string
-
Search string
- $restypes : string = ''
-
Optionally used to specify which resource types to search for
- $order_by : string = 'relevance'
- $archive : string = '0'
-
Allows searching in more than one archive state
- $fetchrows : int|array<string|int, mixed> = -1
-
- If passing an integer, retrieve the specified number of rows (a limit with no offset). The returned array of resources will be padded with '0' elements up to the total without the limit.
- If passing an array, the first element must be the offset (int) and the second the limit (int) (the number of rows to return). See setup_search_chunks() for more detail. IMPORTANT: When passing an array, the returned array will be in structured form - as returned by sql_limit_with_total_count() i.e. the array will have 'total' (the count) and 'data' (the resources) named array elements, and the data will not be padded.
- $sort : string = 'desc'
- $access_override : bool = false
-
Used by smart collections, so that all all applicable resources can be judged regardless of the final access-based results
- $starsearch : int = DEPRECATED_STARSEARCH
-
DEPRECATED_STARSEARCH passed in for backwards compatibility
- $ignore_filters : bool = false
- $return_disk_usage : bool = false
- $recent_search_daylimit : string = ''
- $go : string|bool = false
-
Paging direction (prev|next)
- $stats_logging : bool = true
-
Log keyword usage
- $return_refs_only : bool = false
- $editable_only : bool = false
- $returnsql : bool = false
-
Returns the query as a PreparedStatementQuery instance
- $access : int = null
-
Search for resources with this access
- $smartsearch : mixed = false
Tags
Return values
null|string|array<string|int, mixed>|PreparedStatementQueryresolve_given_nodes()
resolve_given_nodes(mixed &$search, mixed &$node_bucket, mixed &$node_bucket_not) : mixed
Parameters
- $search : mixed
- $node_bucket : mixed
- $node_bucket_not : mixed
rsEncrypt()
Encrypts data
rsEncrypt(string $data, string $key[, string $keylength = 128 ]) : string
Parameters
- $data : string
-
Data to be encypted
- $key : string
-
Key to use
- $keylength : string = 128
-
Optional key length
Tags
Return values
string —Encrypted data
rsDecrypt()
Decrypts data
rsDecrypt(string $data, string $key) : false|string
Parameters
- $data : string
-
Data to be decrypted
- $key : string
Tags
Return values
false|string —Returns FALSE if MAC check failed, plaintext otherwise
eval_check_signed()
Prior to eval() checks to make sure the code has been signed first, by the offline script / migration script.
eval_check_signed(string $code) : string
Parameters
- $code : string
-
The code to check
Return values
string —The code, if correctly signed, or an empty string if not.
sign_code()
Returns a signature for a given block of code.
sign_code(string $code) : string
Parameters
- $code : string
-
The code to sign
Return values
string —The signature
resign_all_code()
Returns a signature for a given block of code.
resign_all_code([bool $confirm = true ][, bool $output = true ][, bool $output_changes_only = false ]) : void
Parameters
- $confirm : bool = true
-
Require user to approve code changes when resigning from the server side.
- $output : bool = true
-
Display output. $confirm will override this option to provide detail if approval needed.
- $output_changes_only : bool = false
-
Output changes only - do not sign code.
rs_validate_token()
Used to compare the user's provided token with the expected value derived from the given identifier
rs_validate_token(string $token_data, string $id) : bool
Used by isValidCSRFToken() Also used on upload_batch to validate an upload session when user cookie not available (i.e. companion uploads)
Parameters
- $token_data : string
-
Encrypted token data
- $id : string
-
Identifier
Tags
Return values
boolinitFacialRecognition()
Initialize facial recognition functionality.
initFacialRecognition() : bool
IMPORTANT: only one field can be setup for the annotation side and it also MUST be a dynamic keywords list
Tags
Return values
boolprepareFaceImage()
Crops out a selected area of an image and makes it ready to be used by FaceRecognizer.
prepareFaceImage(string $image_path, string $prepared_image_path, float $x, float $y, float $width, float $height[, bool $overwrite_existing = false ]) : bool
Note: The selected area should follow the normalized coordinate system.
Parameters
- $image_path : string
-
Path of the source image
- $prepared_image_path : string
-
Path of the prepared image
- $x : float
-
X position
- $y : float
-
Y position
- $width : float
-
Width
- $height : float
-
Height
- $overwrite_existing : bool = false
-
Set to TRUE to overwrite existing prepared image (if any exists)
Tags
Return values
boolfaceRecognizerPredict()
Use FaceRecognizer to predict the association between a face and a label (i.e person name)
faceRecognizerPredict(string $model_file_path, string $test_image_path) : bool|array<string|int, mixed>
Parameters
- $model_file_path : string
-
Path to the FaceRecognizer model state file
- $test_image_path : string
-
Path to the prepared image we are testing
Return values
bool|array<string|int, mixed> —Return the label ID and probability on successful prediction or FALSE on error
safe_file_name()
Ensures the filename cannot leave the directory set.
safe_file_name(string $name) : string
Only to be used for internal ResourceSpace paths as only a limited character set is supported
Parameters
- $name : string
Return values
stringgenerateUserFilenameUID()
Generate a UID for filnames that can be different from user to user (e.g. contact sheets)
generateUserFilenameUID(int $user_id) : string
Parameters
- $user_id : int
Return values
stringisPathWhitelisted()
Checks if a path is part of a whitelisted list of paths. This applies to both folders and files.
isPathWhitelisted(string $path, array<string|int, mixed> $whitelisted_paths) : bool
Note: the function is not supposed to check/ validate the syntax of the path (ie. UNIX/ Windows)
Parameters
- $path : string
-
Path which is going to be checked against whitelisted paths
- $whitelisted_paths : array<string|int, mixed>
-
List of whitelisted paths
Return values
boolget_checksum()
Return a checksum for the given file path.
get_checksum(string $path[, bool $forcefull = false ]) : string|false
Parameters
- $path : string
-
Path to file
- $forcefull : bool = false
-
Force use of whole file and ignore $file_checksums_50k setting
Return values
string|false —Return the checksum value, false otherwise.
temp_local_download_remote_file()
Download remote file to the temp filestore location.
temp_local_download_remote_file(string $url[, string $key = "" ]) : string|bool
Parameters
- $url : string
-
Source URL
- $key : string = ""
-
Optional key to use - to prevent conflicts when simultaneous calls use same file name
Return values
string|bool —Returns the new temp filestore location or false otherwise.
check_valid_file_extension()
Basic check of uploaded file against list of allowed extensions
check_valid_file_extension(array{name: string} $uploadedfile, array<string|int, mixed> $validextensions) : bool
Parameters
- $uploadedfile : array{name: string}
-
An element from the $_FILES PHP reserved variable
- $validextensions : array<string|int, mixed>
-
Array of valid extension strings
Return values
boolis_banned_extension()
Is the given extension in the list of blocked extensions? Also ensures extension is no longer than 10 characters due to resource.file_extension database column limit
is_banned_extension(string $extension) : bool
Parameters
- $extension : string
-
- file extension to check
Return values
boolremove_empty_temp_directory()
Remove empty folder from path to file. Helpful to remove a temp directory once the file it was created to hold no longer exists.
remove_empty_temp_directory([string $path_to_file = "" ]) : void
This function should be called only once the directory to be removed is empty.
Parameters
- $path_to_file : string = ""
-
Full path to file in filestore.
is_valid_upload_path()
Confirm upload path is one of valid paths.
is_valid_upload_path(string $file_path, array<string|int, mixed> $valid_upload_paths) : bool
Parameters
- $file_path : string
-
Upload path.
- $valid_upload_paths : array<string|int, mixed>
-
Array of valid upload paths to test against.
Return values
bool —true when path is valid else false
validate_resource_files()
Validate the files on disk that are associated with the given resources
validate_resource_files(array<string|int, mixed> $resources[, array<string|int, mixed> $criteria = [] ]) : array<string|int, mixed>
Parameters
- $resources : array<string|int, mixed>
-
Array of resource IDs or array of resource data e.g, from search results
- $criteria : array<string|int, mixed> = []
-
Array with an array of callables for each resource with the required return values in order to pass the check e.g. 'file_exists" =>true for a file presence only check
Return values
array<string|int, mixed> —$results An array with resource ID as the index and the results of the check as the value (boolean) e.g. ["1234" => true, "1235" => false]
is_valid_rs_path()
Check if a given file path is from a valid RS accessible location
is_valid_rs_path(string $path[, array<string|int, mixed> $override_paths = [] ]) : bool
Parameters
- $path : string
- $override_paths : array<string|int, mixed> = []
-
Override checking of the default RS paths to check a specific location only.
Return values
boolis_safe_basename()
Validation helper function to determine if a path base name is unsafe (e.g OS command injection).
is_safe_basename(string $val) : bool
Very strict, limited to specific characters only. Should only be used for filenames originating in ResourceSpace.
Parameters
- $val : string
Return values
boolprocess_file_upload()
High level function which can handle processing file uploads.
process_file_upload(SplFileInfo|array{name: string, full_path: string, type: string, tmp_name: string, error: int, size: int} $source, SplFileInfo $destination, array{allow_extensions?: list, file_move?: "move_uploaded_file"|"rename"|"copy"|"dry_run", mime_file_based_detection?: bool} $processor) : ProcessFileUploadErrorCondition}
Parameters
- $source : SplFileInfo|array{name: string, full_path: string, type: string, tmp_name: string, error: int, size: int}
- $destination : SplFileInfo
-
$processor
: array{allow_extensions?: list
, file_move?: "move_uploaded_file"|"rename"|"copy"|"dry_run", mime_file_based_detection?: bool} -
Processors which can override different parts of the main logic (e.g. allow specific extensions)
Return values
ProcessFileUploadErrorCondition}parse_filename_extension()
Parse file name (can include path, although it's unnecessary) to prevent known security bypasses associated with extensions, such as: - Double extensions, e.g. .jpg.php - Null bytes, e.g. .php%00.jpg, where .jpg gets truncated and .php becomes the new extension - Using Windows (DOS) 8.3 short path feature where it's possible to replace existing files by using their shortname (e.g. ".htaccess" can be replaced by "HTACCE~1")
parse_filename_extension(string $filename) : string
Parameters
- $filename : string
Return values
stringdelete_temp_files()
Delete old files and folders from tempo directory based on the configured $purge_temp_folder_age value Affects filestore/tmp, $storagedir/tmp or the configured $tempdir directory
delete_temp_files() : void
purge_query_cache()
purge_query_cache() : void
permitted_archiver_arguments()
Are the arguments set in $archiver_settings["arguments"] permitted? Allows word characters, '@', and '-' only
permitted_archiver_arguments(mixed $string) : bool
Parameters
- $string : mixed
Return values
boolcheck_symlink()
Check if a given path is absolute or contains a symlink or junction is_link() does not accurately detect junction links on Windows systems instead we check if the output from stat() and lstat() differ.
check_symlink(string $checkpath) : bool
Parameters
- $checkpath : string
Return values
boolgetval()
Retrieve a user-submitted parameter from the browser via post/get/cookies, in that order.
getval(string $param, string $default[, bool $force_numeric = false ][, callable $type_check = null ]) : mixed
Parameters
- $param : string
-
The parameter name
- $default : string
-
A default value to return if no matching parameter was found
- $force_numeric : bool = false
-
Ensure a number is returned. (DEPRECATED)
- $type_check : callable = null
-
Validate param type. Default is to check param values are strings.
escape_check()
Escape a value prior to using it in SQL.
escape_check(string $text) : string
IMPORTANT! NO LONGER NEEDED with prepared statements. This is only used when exporting SQL scripts.
Parameters
- $text : string
Return values
stringunescape()
For comparing escape_checked strings against mysql content because just doing $text=str_replace("\\","",$text); does not undo escape_check
unescape(mixed $text) : string
Parameters
- $text : mixed
Return values
stringnicedate()
Formats a MySQL ISO date
nicedate(mixed $date[, mixed $time = false ][, mixed $wordy = true ][, mixed $offset_tz = false ]) : string
Always use the 'wordy' style from now on as this works better internationally.
Parameters
- $date : mixed
- $time : mixed = false
- $wordy : mixed = true
- $offset_tz : mixed = false
Tags
Return values
string —Returns an empty string if date not set/invalid
date_to_age()
Generates a text representation of the age from a given date
date_to_age(string $datetime) : string
This can be used to give a more user friendly indication of how old something is.
Parameters
- $datetime : string
-
ISO format date which can be a BCE date (ie. with negative year -yyyy)
Return values
string —Returns a string representing the age calculated from $datetime, otherwise an empty string if date is invalid
preview_from_text()
Generates preview text of a certain line length and count
preview_from_text(string $text, int $line_length, int $line_count[, bool $add_ellipsis = true ]) : string
Can be used for generating previews of text output, such as messages.
Parameters
- $text : string
-
The text to generate the preview of, can contain HTML
- $line_length : int
-
The number of characters that the preview can have on each line
- $line_count : int
-
The number of lines to be generated in the preview
- $add_ellipsis : bool = true
-
Should ellipsis (...) be added if the original $text exceeds $line_count
Return values
string —Returns a string of the preview text, or an empty string if the preview is unable to be generated
redirect()
Redirect to the provided URL using a HTTP header Location directive. Exits after redirect
redirect(string $url) : never
Parameters
- $url : string
-
URL to redirect to
Return values
nevertrim_spaces()
replace multiple spaces with a single space
trim_spaces(mixed $text) : string
Parameters
- $text : mixed
Return values
stringtrim_array()
Removes whitespace from the beginning/end of all elements in an array
trim_array(array<string|int, mixed> $array[, string $trimchars = '' ]) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
- $trimchars : string = ''
Return values
array<string|int, mixed>tidylist()
Takes a value as returned from a check-list field type and reformats to be more display-friendly.
tidylist(string $list) : string
Check-list fields have a leading comma.
Parameters
- $list : string
Return values
stringtidy_trim()
Trims $text to $length if necessary. Tries to trim at a space if possible. Adds three full stops if trimmed.
tidy_trim(string $text, int $length) : string
..
Parameters
- $text : string
- $length : int
Return values
stringaverage_length()
Returns the average length of the strings in an array
average_length(array<string|int, mixed> $array) : float
Parameters
- $array : array<string|int, mixed>
Return values
floatget_stats_activity_types()
Returns a list of activity types for which we have stats data (Search, User Session etc.)
get_stats_activity_types() : array<string|int, mixed>
Return values
array<string|int, mixed>newlines()
Replace escaped newlines with real newlines.
newlines(string $text) : string
Parameters
- $text : string
Return values
stringget_all_site_text()
Returns a list of all available editable site text (content). If $find is specified a search is performed across page, name and text fields.
get_all_site_text([string $findpage = "" ][, string $findname = "" ][, string $findtext = "" ]) : array<string|int, mixed>
Parameters
- $findpage : string = ""
- $findname : string = ""
- $findtext : string = ""
Return values
array<string|int, mixed>get_site_text()
Returns a specific site text entry.
get_site_text(string $page, string $name, string $getlanguage, string $group) : string
Parameters
- $page : string
- $name : string
- $getlanguage : string
- $group : string
Return values
stringcheck_site_text_custom()
Check if site text section is custom, i.e. deletable.
check_site_text_custom(mixed $page, mixed $name) : bool
Parameters
- $page : mixed
- $name : mixed
Return values
boolsave_site_text()
Saves the submitted site text changes to the database.
save_site_text(string $page, string $name, string $language, int $group) : void
Parameters
- $page : string
- $name : string
- $language : string
- $group : int
formatfilesize()
Return a human-readable string representing $bytes in either KB or MB.
formatfilesize(int $bytes[, bool $html = true ]) : string
Parameters
- $bytes : int
-
file size to format in bytes
- $html : bool = true
-
if set to true output will include  instead of a space
Return values
stringfilesize2bytes()
Converts human readable file size (e.g. 10 MB, 200.20 GB) into bytes.
filesize2bytes(string $str) : int
Parameters
- $str : string
Return values
int —the result is in bytes
get_mime_type()
Get the mime type for a file on disk
get_mime_type(string $path[, string $ext = null ][, bool|null $file_based_detection = null ]) : array<string|int, mixed>
Parameters
- $path : string
- $ext : string = null
- $file_based_detection : bool|null = null
-
Determine the MIME type:
- null: Check by extension or using exiftool
- true: Only file based (uses exiftool)
- false: Only based on extension
Return values
array<string|int, mixed>get_mime_types_by_extension()
Find matching MIME type(s) for a file extension.
get_mime_types_by_extension(string $extension) : array<int, string>
Parameters
- $extension : string
Return values
array<int, string>get_unsafe_mime_types()
Get the global MIME types associated with the configured banned extensions.
get_unsafe_mime_types() : array<string|int, mixed>
Return values
array<string|int, mixed>allowed_type_mime()
Convert the permitted resource type extension to MIME type. Used by upload_batch.php
allowed_type_mime(mixed $allowedtype) : string
Parameters
- $allowedtype : mixed
Return values
string —MIME type e.g. image/jpeg
send_mail()
Send a mail - but correctly encode the message/subject in quoted-printable UTF-8.
send_mail(string $email, string $subject, string $message[, string $from = "" ][, string $reply_to = "" ][, string $html_template = "" ][, array<string|int, mixed> $templatevars = array() ][, string $from_name = "" ][, string $cc = "" ][, string $bcc = "" ][, array<string|int, mixed> $files = array() ]) : mixed
NOTE: $from is the name of the user sending the email, while $from_name is the name that should be put in the header, which can be the system name It is necessary to specify two since in all cases the email should be able to contain the user's name.
Old mail function remains the same to avoid possible issues with phpmailer send_mail_phpmailer allows for the use of text and html (multipart) emails, and the use of email templates in Manage Content.
Parameters
- $email : string
-
Email address to send to
- $subject : string
-
Email subject
- $message : string
-
Message text
- $from : string = ""
-
From address - defaults to $email_from
- $reply_to : string = ""
-
Reply to address - defaults to $email_from
- $html_template : string = ""
-
Optional template (this is a $lang entry with placeholders)
- $templatevars : array<string|int, mixed> = array()
-
Used to populate email template placeholders
- $from_name : string = ""
-
Email from name
- $cc : string = ""
-
Optional CC addresses
- $bcc : string = ""
-
Optional BCC addresses
- $files : array<string|int, mixed> = array()
-
Optional array of file paths to attach in the format [filename.txt => /path/to/file.txt]
send_mail_phpmailer()
if ($use_phpmailer==true) this function is used instead.
send_mail_phpmailer(string $email, string $subject[, string $message = "" ][, string $from = "" ][, string $reply_to = "" ][, string $html_template = "" ][, array<string|int, mixed> $templatevars = array() ][, string $from_name = "" ][, string $cc = "" ][, string $bcc = "" ][, array<string|int, mixed> $files = array() ]) : void
Mail templates can include lang, server, site_text, and POST variables by default ex ( [lang_mycollections], [server_REMOTE_ADDR], [text_footer] , [message]
additional values must be made available through $templatevars For example, a complex url or image path that may be sent in an email should be added to the templatevars array and passed into send_mail. available templatevars need to be well-documented, and sample templates need to be available.
Parameters
- $email : string
-
Email address to send to
- $subject : string
-
Email subject
- $message : string = ""
-
Message text
- $from : string = ""
-
From address - defaults to $email_from
- $reply_to : string = ""
-
Reply to address - defaults to $email_from
- $html_template : string = ""
-
Optional template (this is a $lang entry with placeholders)
- $templatevars : array<string|int, mixed> = array()
-
Used to populate email template placeholders
- $from_name : string = ""
-
Email from name
- $cc : string = ""
-
Optional CC addresses
- $bcc : string = ""
-
Optional BCC addresses
- $files : array<string|int, mixed> = array()
-
Optional array of file paths to attach in the format [filename.txt => /path/to/file.txt]
log_mail()
Log email
log_mail(string $email, string $subject, string $sender) : void
Data logged is: Time To address From, User ID or 0 for system emails (cron etc.) Subject
Parameters
- $email : string
- $subject : string
- $sender : string
-
The email address of the sender
rs_quoted_printable_encode()
Quoted printable encoding is rather simple.
rs_quoted_printable_encode(string $string[, int $linelen = 0 ][, string $linebreak = "=\r\n" ][, int $breaklen = 0 ][, bool $encodecrlf = false ]) : string
Each character in the string $string should be encoded if: Character code is <0x20 (space) Character is = (as it has a special meaning: 0x3d) Character is over ASCII range (>=0x80)
Parameters
- $string : string
- $linelen : int = 0
- $linebreak : string = "=\r\n"
- $breaklen : int = 0
- $encodecrlf : bool = false
Return values
stringrs_quoted_printable_encode_subject()
As rs_quoted_printable_encode() but for e-mail subject
rs_quoted_printable_encode_subject(string $string[, string $encoding = 'UTF-8' ]) : string
Parameters
- $string : string
- $encoding : string = 'UTF-8'
Return values
stringpager()
A generic pager function used by many display lists in ResourceSpace.
pager([bool $break = false ][, bool $scrolltotop = true ][, array<string|int, mixed> $options = array() ]) : void
Requires the following globals to be set or passed inb the $options array $url - Current page url $curpage - Current page $totalpages - Total number of pages
Parameters
- $break : bool = false
- $scrolltotop : bool = true
- $options : array<string|int, mixed> = array()
-
- array of options to use instead of globals
remove_extension()
Remove the extension part of a filename
remove_extension(mixed $strName) : string
Parameters
- $strName : mixed
-
The filename
Return values
string —The filename minus the extension
get_allowed_extensions_by_type()
Retrieve a list of permitted extensions for the given resource type.
get_allowed_extensions_by_type(int $resource_type) : string
Parameters
- $resource_type : int
Return values
stringgetAbsolutePath()
Detect if a path is relative or absolute.
getAbsolutePath(string $path[, bool $create_if_not_exists = false ]) : string
If it is relative, we compute its absolute location by assuming it is relative to the application root (parent folder).
Parameters
- $path : string
-
A relative or absolute path
- $create_if_not_exists : bool = false
-
Try to create the path if it does not exists. Default to False.
Tags
Return values
string —A absolute path
getFolderContents()
Find the files present in a folder, and sub-folder.
getFolderContents(string $path[, bool $recurse = true ][, bool $include_hidden = false ]) : array<string|int, mixed>
Parameters
- $path : string
-
The path to look into.
- $recurse : bool = true
-
Trigger the recursion, default to True.
- $include_hidden : bool = false
-
Trigger the listing of hidden files / hidden directories, default to False.
Tags
Return values
array<string|int, mixed> —A list of files present in the inspected folder (paths are relative to the inspected folder path).
mb_basename()
Returns filename component of path This version is UTF-8 proof.
mb_basename(string $file) : string
Parameters
- $file : string
-
A path.
Tags
Return values
string —Returns the base name of the given path.
strip_extension()
Remove the extension part of a filename.
strip_extension(string $name[, mixed $use_ext_list = false ]) : string
Parameters
- $name : string
-
A file name.
- $use_ext_list : mixed = false
Tags
Return values
string —Return the file name without the extension part.
is_process_lock()
Checks to see if a process lock exists for the given process name.
is_process_lock(string $name) : bool
Parameters
- $name : string
-
Name of lock to check
Return values
bool —TRUE if a current process lock is in place, false if not
set_process_lock()
Set a process lock
set_process_lock(string $name) : bool
Parameters
- $name : string
Return values
boolclear_process_lock()
Clear a process lock
clear_process_lock(string $name) : bool
Parameters
- $name : string
Return values
boolfilesize_unlimited()
Custom function for retrieving a file size. A resolution for PHP's issue with large files and filesize().
filesize_unlimited(string $path) : int|bool
Parameters
- $path : string
Return values
int|bool —The file size in bytes
strip_leading_comma()
Strip the leading comma from a string
strip_leading_comma(string $val) : string
Parameters
- $val : string
Return values
stringget_temp_dir()
Determines where the tmp directory is. There are three options here: 1. tempdir - If set in config.php, use this value.
get_temp_dir([bool $asUrl = false ][, mixed $uniqid = "" ]) : string
- storagedir ."/tmp" - If storagedir is set in config.php, use it and create a subfolder tmp.
- generate default path - use filestore/tmp if all other attempts fail.
- if a uniqid is provided, create a folder within tmp and return the full path
Parameters
- $asUrl : bool = false
-
- If we want the return to be like http://my.resourcespace.install/path set this as true.
- $uniqid : mixed = ""
Tags
Return values
string —Path to the tmp directory.
convert_path_to_url()
Converts a path to a url relative to the installation.
convert_path_to_url(string $abs_path) : Url
Parameters
- $abs_path : string
-
: The absolute path.
Return values
Url —that is the relative path.
escape_command_args()
Escaping an unsafe command string
escape_command_args(string $cmd, array<string|int, mixed> $args) : string
Parameters
- $cmd : string
-
Unsafe command to run
- $args : array<string|int, mixed>
-
List of placeholders and their values which will have to be escapedshellarg()d.
Tags
Return values
string —Escaped command string
run_command()
Utility function which works like system(), but returns the complete output string rather than just the last line of it.
run_command(string $command[, bool $geterrors = false ][, array<string|int, mixed> $params = array() ][, int $timeout = 0 ]) : string
Parameters
- $command : string
-
Command to run
- $geterrors : bool = false
-
Set to TRUE to include errors in the output
- $params : array<string|int, mixed> = array()
-
List of placeholders and their values which will have to be escapedshellarg()d.
- $timeout : int = 0
-
Maximum time in seconds before a command is forcibly stopped
Tags
Return values
string —Command output
run_external()
Similar to run_command but returns an array with the resulting output (stdout & stderr) fetched concurrently for improved performance.
run_external(mixed $command) : array<string|int, mixed>
Parameters
- $command : mixed
-
Command to run
Return values
array<string|int, mixed> —Command output
error_alert()
Display a styledalert() modal error and optionally return the browser to the previous page after 2 seconds
error_alert(string $error[, bool $back = true ][, int $code = 403 ]) : void
Parameters
- $error : string
-
Error text to display
- $back : bool = true
-
Return to previous page?
- $code : int = 403
-
(Optional) HTTP code to return
format_display_field()
When displaying metadata, applies trim/wordwrap.
format_display_field(string $value) : string
Parameters
- $value : string
Return values
stringformat_string_more_link()
Formats a string with a collapsible more / less section
format_string_more_link(string $string[, int $max_words_before_more = 30 ]) : string
Parameters
- $string : string
- $max_words_before_more : int = 30
Return values
stringdraw_performance_footer()
Render a performance footer with metrics.
draw_performance_footer() : void
format_query()
Format SQL queries for display purposes Note: these queries are no longer known to be safe from sql injection
format_query(string $query, array<string|int, mixed> $params) : string
Parameters
- $query : string
- $params : array<string|int, mixed>
Return values
stringsql_affected_rows()
Abstracted mysqli_affected_rows()
sql_affected_rows() : mixed
get_imagemagick_path()
Returns the path to the ImageMagick utilities such as 'convert'.
get_imagemagick_path(string $utilityname, string $exeNames, string &$checked_path) : string
Parameters
- $utilityname : string
- $exeNames : string
- $checked_path : string
Tags
Return values
stringget_utility_path()
Returns the full path to a utility, if installed or FALSE otherwise.
get_utility_path(string $utilityname[, string &$checked_path = null ]) : string|bool
Note: this function doesn't check that the utility is working.
Parameters
- $utilityname : string
- $checked_path : string = null
Tags
Return values
string|bool —Returns full path to utility tool or FALSE
get_executable_path()
Get full path to utility
get_executable_path(string $path, array<string|int, mixed> $executable, string &$checked_path[, bool $check_exe = false ]) : string|bool
Parameters
- $path : string
- $executable : array<string|int, mixed>
- $checked_path : string
- $check_exe : bool = false
Tags
Return values
string|booltruncate_cache_arrays()
Clean up the resource data cache to keep within $cache_array_limit
truncate_cache_arrays() : void
is_html()
Work out of a string is likely to be in HTML format.
is_html(mixed $string) : bool
Parameters
- $string : mixed
Return values
boolrs_setcookie()
Set a cookie.
rs_setcookie(string $name, string $value[, int $daysexpire = 0 ][, string $path = "" ][, string $domain = "" ][, bool $secure = false ][, bool $httponly = true ][, string $samesite = "Strict" ]) : void
Note: The argument $daysexpire is not the same as the argument $expire in the PHP internal function setcookie.
Parameters
- $name : string
- $value : string
- $daysexpire : int = 0
- $path : string = ""
- $domain : string = ""
- $secure : bool = false
- $httponly : bool = true
- $samesite : string = "Strict"
get_editable_states()
Get an array of all the states that a user has edit access to
get_editable_states(int $userref) : array<string|int, mixed>
Parameters
- $userref : int
Return values
array<string|int, mixed>validate_html()
Returns true if $html is valid HTML, otherwise an error string describing the problem.
validate_html(mixed $html) : bool|string
Parameters
- $html : mixed
Return values
bool|stringgenerateURL()
Utility function to generate URLs with query strings easier, with the ability to override existing query string parameters when needed.
generateURL(string $url[, array<string|int, mixed> $parameters = array() ][, array<string|int, mixed> $set_params = array() ]) : string
Parameters
- $url : string
- $parameters : array<string|int, mixed> = array()
-
Default query string params (e.g "k", which appears on most of ResourceSpace URLs)
- $set_params : array<string|int, mixed> = array()
-
Override existing query string params
Tags
Return values
stringmove_array_element()
Utility function used to move the element of one array from a position to another one in the same array Note: the manipulation is done on the same array
move_array_element(array<string|int, mixed> &$array, int $from_index, int $to_index) : void
Parameters
- $array : array<string|int, mixed>
- $from_index : int
-
Array index we are moving from
- $to_index : int
-
Array index we are moving to
emptyiszero()
Check if a value that may equate to false in PHP is actually a zero
emptyiszero(mixed $value) : bool
Parameters
- $value : mixed
Return values
boolget_slideshow_files_data()
Get data for each image that should be used on the slideshow.
get_slideshow_files_data() : array<string|int, mixed>
The format of the returned array should be: Array ( [0] => Array ( [ref] => 1 [resource_ref] => [homepage_show] => 1 [login_show] => 1 [file_path] => /var/www/filestore/system/slideshow_1bf4796ac6f051a/1.jpg [checksum] => 1539875502 )
[1] => Array
(
[ref] => 4
[resource_ref] => 19
[homepage_show] => 1
[login_show] => 0
[file_path] => /var/www/filestore/system/slideshow_1bf4796ac6f051a/4.jpg
[checksum] => 1542818794
[link] => http://localhost/?r=19
)
)
Return values
array<string|int, mixed>is_login_slideshow_enabled()
Determines if at least one slideshow image is configured for the login page
is_login_slideshow_enabled() : bool
Return values
boolform_value_display()
Returns a sanitised row from the table in a safe form for use in a form value, suitable overwritten by POSTed data if it has been supplied.
form_value_display(array<string|int, mixed> $row, string $name[, string $default = "" ]) : string
Parameters
- $row : array<string|int, mixed>
- $name : string
- $default : string = ""
Return values
stringuser_set_usergroup()
Change the user's user group
user_set_usergroup(int $user, int $usergroup) : void
Parameters
- $user : int
- $usergroup : int
generateSecureKey()
Generates a random string of requested length.
generateSecureKey([int $length = 64 ]) : string
Used to generate initial spider and scramble keys.
Parameters
- $length : int = 64
-
Length of desired string of bytes
Tags
Return values
string —Random character string
IsModal()
Check if current page is a modal and set global $modal variable if not already set
IsModal() : bool
Return values
bool —true if modal, false otherwise
generateCSRFToken()
Generates a CSRF token (Encrypted Token Pattern)
generateCSRFToken(string $session_id, string $form_id) : string
Parameters
- $session_id : string
-
The current user session ID
- $form_id : string
-
A unique form ID
Tags
Return values
string —Token
isValidCSRFToken()
Checks if CSRF Token is valid
isValidCSRFToken(mixed $token_data, mixed $session_id) : bool
Parameters
- $token_data : mixed
- $session_id : mixed
Tags
Return values
bool —Returns TRUE if token is valid or CSRF is not enabled, FALSE otherwise
generateFormToken()
Render the CSRF Token input tag
generateFormToken(string $form_id) : void
Parameters
- $form_id : string
-
The id/ name attribute of the form
Tags
generateAjaxToken()
Render the CSRF Token for AJAX use
generateAjaxToken(string $form_id) : string
Parameters
- $form_id : string
-
The id/ name attribute of the form or just the calling function for this type of request
Tags
Return values
stringgenerate_csrf_js_object()
Create a CSRF token as a JS object
generate_csrf_js_object(string $name) : string
Parameters
- $name : string
-
The name of the token identifier (e.g API function called)
Tags
Return values
string —JS object with CSRF data (identifier & token) if CSRF is enabled, empty object otherwise
generate_csrf_data_for_api_native_authmode()
Create an HTML data attribute holding a CSRF token (JS) object
generate_csrf_data_for_api_native_authmode(string $fct_name) : string
Parameters
- $fct_name : string
-
The name of the API function called (e.g create_resource)
Return values
stringenforcePostRequest()
Enforce using POST requests
enforcePostRequest(bool $ajax) : bool|void
Parameters
- $ajax : bool
-
Set to TRUE if request is done via AJAX
Return values
bool|void —Returns true if request method is POST or sends 405 header otherwise
is_resourcespace_upgrade_available()
Check if ResourceSpace is up to date or an upgrade is available
is_resourcespace_upgrade_available() : bool
Tags
Return values
boolget_recent_users()
Fetch a count of recently active users
get_recent_users(int $days) : int
Parameters
- $days : int
-
How many days to look back
Return values
intget_total_approved_users()
Return the total number of approved
get_total_approved_users() : int
Return values
int —The number of approved users
get_total_resources()
Return the number of resources in the system with optional filter by archive state
get_total_resources([int|bool $status = false ]) : int
Parameters
- $status : int|bool = false
-
Archive state to filter by if required
Return values
int —Number of resources in the system, filtered by status if provided
check_script_last_ran()
Check if script last ran more than the failure notification days Note: Never/ period longer than allowed failure should return false
check_script_last_ran(string $name, int $fail_notify_allowance, string &$last_ran_datetime) : bool
Parameters
- $name : string
-
Name of the sysvar to check the record for
- $fail_notify_allowance : int
-
How long to allow (in days) before user can consider script has failed
- $last_ran_datetime : string
-
Datetime (string format) when script was last run
Return values
boolcount_errors()
Counting errors found in a collection of items. An error is found when an item has an "error" key.
count_errors(array<string|int, mixed> $a) : int
Parameters
- $a : array<string|int, mixed>
-
Collection of items that may contain errors.
Return values
intsearch_array_by_keyvalue()
Function can be used to order a multi-dimensional array using a key and corresponding value
search_array_by_keyvalue(array<string|int, mixed> $array2search, string $search_key, string $search_value, array<string|int, mixed> $return_array) : array<string|int, mixed>
Parameters
- $array2search : array<string|int, mixed>
-
multi-dimensional array in which the key/value pair may be present
- $search_key : string
-
key of the key/value pair used for search
- $search_value : string
-
value of the key/value pair to search
- $return_array : array<string|int, mixed>
-
array to which the matching elements in the search array are pushed - also returned by function
Return values
array<string|int, mixed> —$return_array
bypass_permissions()
Temporary bypass access controls for a particular function
bypass_permissions(array<string|int, mixed> $perms, callable $f[, array<string|int, mixed> $p = array() ]) : mixed
When functions check for permissions internally, in order to keep backwards compatibility it may be better if we temporarily bypass the permissions instead of adding a parameter to the function for this. It will allow developers to keep the code clean.
IMPORTANT: never make this function public to the API.
Example code: $log = bypass_permissions(array("v"), "get_resource_log", array($ref));
Parameters
- $perms : array<string|int, mixed>
-
Permission list to be bypassed
- $f : callable
-
Callable that we need to bypas permissions for
- $p : array<string|int, mixed> = array()
-
Parameters to be passed to the callable if required
set_sysvar()
Set a system variable (which is stored in the sysvars table) - set to null to remove
set_sysvar(mixed $name[, mixed $value = null ][, bool $clear_cache = true ]) : bool
Parameters
- $name : mixed
-
Variable name
- $value : mixed = null
-
String to set a new value; null to remove any existing value.
- $clear_cache : bool = true
-
Set to false to skip the clearing of any cached values (default true).
Tags
Return values
boolget_sysvar()
Get a system variable (which is received from the sysvars table)
get_sysvar(string $name[, string $default = false ]) : string
Parameters
- $name : string
- $default : string = false
-
Returned if no matching variable was found
Tags
Return values
stringhook()
Plugin architecture. Look for hooks with this name (and corresponding page, if applicable) and run them sequentially.
hook(string $name[, string $pagename = "" ][, array<string|int, mixed> $params = array() ][, bool $last_hook_value_wins = false ]) : mixed
Utilises a cache for significantly better performance. Enable $draw_performance_footer in config.php to see stats.
Parameters
- $name : string
- $pagename : string = ""
- $params : array<string|int, mixed> = array()
- $last_hook_value_wins : bool = false
Tags
html_find_and_replace_node()
Performs a string replace once a text-only node is encountered, otherwise loops and calls itself to iterate over child nodes Not intended to be called directly - use html_find_and_replace
html_find_and_replace_node(string $findstring, string $replacestring, DOMNode $node) : void
Parameters
- $findstring : string
- $replacestring : string
-
can be blank if using for removal
- $node : DOMNode
html_find_and_replace()
Loads HTML fragment into a DOMDocument instance to parse and perform a recursive find/replace on text-only nodes.
html_find_and_replace(string $findstring, string $replacestring, string $html) : string
Returns modified HTML if possible, otherwise the original HTML.
Parameters
- $findstring : string
- $replacestring : string
-
can be blank if using for removal
- $html : string
Return values
stringstrip_tags_and_attributes()
Utility function to remove unwanted HTML tags and attributes.
strip_tags_and_attributes(string $html[, array<string|int, mixed> $tags = array() ][, array<string|int, mixed> $attributes = array() ]) : mixed
Note: if $html is a full page, developers should allow html and body tags.
Parameters
- $html : string
-
HTML string
- $tags : array<string|int, mixed> = array()
-
Extra tags to be allowed
- $attributes : array<string|int, mixed> = array()
-
Extra attributes to be allowed
Return values
mixed —Normally a string however if anything but a string is supplied, return type will be as supplied.
strip_paragraph_tags()
Remove paragraph tags from start and end of text.
strip_paragraph_tags(string $text) : string
Inner paragraph tags are untouched
Parameters
- $text : string
-
HTML string
Return values
string —Returns the text without surrounding
and
tags.get_inner_html_from_tag()
Helper function to quickly return the inner HTML of a specific tag element from a DOM document.
get_inner_html_from_tag(string $txt, string $tag) : string
Example usage: get_inner_html_from_tag(strip_tags_and_attributes($unsafe_html), "p");
Parameters
- $txt : string
-
HTML string
- $tag : string
-
DOM document tag element (e.g a, div, p)
Return values
string —Returns the inner HTML of the first tag requested and found. Returns empty string if caller code requested the wrong tag.
show_pagetime()
Returns the page load time until this point.
show_pagetime() : string
Return values
stringget_debug_log_dir()
Determines where the debug log will live. Typically, same as tmp dir (See general.php: get_temp_dir().
get_debug_log_dir() : string
Since general.php may not be included, we cannot use that method so I have created this one too.
Return values
string —- The path to the debug_log directory.
debug()
Output debug information to the debug log, if debugging is enabled.
debug(string $text[, mixed $resource_log_resource_ref = null ][, string $resource_log_code = LOG_CODE_TRANSFORMED ]) : bool
Parameters
- $text : string
- $resource_log_resource_ref : mixed = null
-
Update the resource log if resource reference passed.
- $resource_log_code : string = LOG_CODE_TRANSFORMED
-
If updating the resource log, the code to use
Tags
Return values
boolrcRmdir()
Recursively removes a directory.
rcRmdir(string $path[, array<string|int, mixed> $ignore = array() ]) : bool
Parameters
- $path : string
-
Directory path to remove.
- $ignore : array<string|int, mixed> = array()
-
List of directories to ignore.
Return values
booldaily_stat()
Update the daily statistics after a loggable event.
daily_stat(string $activity_type, int $object_ref[, int $to_add = 1 ]) : void
The daily_stat table contains a counter for each 'activity type' (i.e. download) for each object (i.e. resource) per day.
Parameters
- $activity_type : string
- $object_ref : int
- $to_add : int = 1
-
Optional, how many counts to add, defaults to 1.
pagename()
Returns the current page name minus the extension, e.g. "home" for pages/home.php
pagename() : string
Return values
stringpluginname()
pluginname() : string
Return values
stringtext()
Returns the site content from the language strings. These will already be overridden with site_text content if present.
text(string $name) : string
Parameters
- $name : string
Return values
stringget_section_list()
Gets a list of site text sections, used for a multi-page help area.
get_section_list(mixed $page) : array<string|int, mixed>
Parameters
- $page : mixed
Return values
array<string|int, mixed>resolve_user_agent()
Returns a more friendly user agent string based on the passed user agent. Used in the user area to establish browsers used.
resolve_user_agent(mixed $agent) : string
Parameters
- $agent : mixed
-
The user agent string
Return values
stringget_ip()
Returns the current user's IP address, using HTTP proxy headers if present.
get_ip() : string
Return values
stringResolveKB()
For a value such as 10M return the kilobyte equivalent such as 10240. Used by check.php
ResolveKB(mixed $value) : string
Parameters
- $value : mixed
Return values
stringtrim_filename()
Trim a filename that is longer than 255 characters while keeping its extension (if present)
trim_filename(string $s) : string
Parameters
- $s : string
Return values
stringarray_flip_by_value_key()
Flip array keys to use one of the keys of the values it contains. All elements (ie values) of the array must contain the key (ie. they are arrays). Helper function to greatly increase search performance on huge PHP arrays.
array_flip_by_value_key(array<string|int, mixed> $a, string $k) : array<string|int, mixed>
Normal use is: array_flip_by_value_key($huge_array, 'ref');
IMPORTANT: make sure that for the key you intend to use all elements will have a unique value set.
Example: Result after calling array_flip_by_value_key($nodes, 'ref'); [20382] => Array ( [ref] => 20382 [name] => Example node [parent] => 20381 )
Parameters
- $a : array<string|int, mixed>
- $k : string
-
A values' key to use as an index/key in the main array, ideally an integer
Return values
array<string|int, mixed>reshape_array_by_value_keys()
Reshape array using the keys of its values. All values must contain the selected keys.
reshape_array_by_value_keys(array<string|int, mixed> $a, string $k, string $v) : array<string|int, mixed>
Parameters
- $a : array<string|int, mixed>
-
Array to reshape
- $k : string
-
The current elements' key to be used as the KEY in the new array. MUST be unique otherwise elements will be lost
- $v : string
-
The current elements' key to be used as the VALUE in the new array
Return values
array<string|int, mixed>permission_j()
Permission check for "j[ref]"
permission_j(int $ref) : bool
Parameters
- $ref : int
-
Featured collection category ref
Return values
boolpermission_negative_j()
Permission check for "-j[ref]"
permission_negative_j(int $ref) : bool
Parameters
- $ref : int
-
Featured collection sub-category ref
Return values
boolcleanup_files()
Delete temporary files
cleanup_files(array<string|int, mixed> $files) : void
Parameters
- $files : array<string|int, mixed>
-
array of file paths
is_int_loose()
Validate if value is integer or string integer
is_int_loose(mixed $var) : bool
Parameters
- $var : mixed
-
- variable to check
Return values
bool —true if variable resolves to integer value
is_positive_int_loose()
Helper function to check if value is a positive integer looking type.
is_positive_int_loose(int|float|string $V) : bool
Parameters
- $V : int|float|string
-
Value to be tested
Return values
boolis_positive_or_zero_int_loose()
Helper function to check if value is a positive or zero integer looking type.
is_positive_or_zero_int_loose(int|float|string $V) : bool
Parameters
- $V : int|float|string
-
Value to be tested
Return values
boolis_array_of_pos_or_zero_ints()
Helper function to check if value is an array containing only positive or zero integer looking types
is_array_of_pos_or_zero_ints(mixed $var) : bool
Parameters
- $var : mixed
-
value to be tested
Return values
boolis_string_loose()
Helper function to check if a value is able to be cast to a string
is_string_loose(mixed $var) : bool
Parameters
- $var : mixed
-
value to be tested
Return values
boolis_input_list_loose()
Input (type) validation helper function for a list of integers (mostly used for IDs). This covers cases when the submitted data is either sent as an actual list (i.e. myInput[]) or when retrieved from the cookie/query string as a CSV.
is_input_list_loose(mixed $val) : bool
Parameters
- $val : mixed
-
User input value to be validated
Return values
boolis_float_loose()
Helper function to check if a value is able to be cast to a float
is_float_loose(mixed $var) : bool
Parameters
- $var : mixed
-
value to be tested
Return values
boolip_matches()
Does the provided $ip match the string $ip_restrict? Used for restricting user access by IP address.
ip_matches(string $ip, string $ip_restrict) : bool|int
Parameters
- $ip : string
- $ip_restrict : string
Return values
bool|intset_unique_filename()
Ensures filename is unique in $filenames array and adds resulting filename to the array
set_unique_filename(string &$filename, array<string|int, mixed> &$filenames) : string
Parameters
- $filename : string
-
Requested filename to be added. Passed by reference
- $filenames : array<string|int, mixed>
-
Array of filenames already in use. Passed by reference
Return values
string —New filename
build_permission()
Build a specific permission closure which can be applied to a list of items.
build_permission(string $perm) : Closure
Parameters
- $perm : string
-
Permission string to build (e.g f-, F, T, X, XU)
Return values
Closurevalidate_remote_code()
Attempt to validate remote code.
validate_remote_code(string $code) : bool
IMPORTANT: Never use this function or eval() on any code received externally from a source that can't be trusted!
Parameters
- $code : string
-
Remote code to validate
Return values
boolget_system_status()
Get system status information
get_system_status([bool $basic = false ]) : array<string|int, mixed>
Parameters
- $basic : bool = false
-
Optional, set to true to perform a quick "system up" check only.
Return values
array<string|int, mixed>try_unlink()
Try and delete a file without triggering a fatal error
try_unlink(string $deletefile) : bool|string
Parameters
- $deletefile : string
-
Full path to file
Return values
bool|string —Returns TRUE on success or a string containing error
try_getimagesize()
try_getimagesize(string $filename[, mixed &$image_info = null ]) : mixed
Parameters
- $filename : string
- $image_info : mixed = null
check_filestore_browseability()
Check filestore folder browseability.
check_filestore_browseability() : array<string|int, mixed>
For security reasons (e.g data breach) the filestore location shouldn't be indexed by the web server (in Apache2 - disable autoindex module)
Return values
array<string|int, mixed> —Returns data structure with following keys:-
- status: An end user status of OK/FAIL
- info: Any extra relevant information (aimed at end users)
- filestore_url: ResourceSpace URL to the filestore location
- index_disabled: PHP bool (used by code). FALSE if web server allows indexing/browsing the filestore, TRUE otherwise
check_imagemagick_cli_version_found()
Check CLI version found for ImageMagick is as expected.
check_imagemagick_cli_version_found(string $version_output, array<string|int, mixed> $utility) : array<string|int, mixed>
Parameters
- $version_output : string
-
The version output for ImageMagick
- $utility : array<string|int, mixed>
-
Utility structure. RS_SYSTEM_UTILITIES
Return values
array<string|int, mixed> —Returns array as expected by the check.php page
- utility - New utility value for its display name
- found - PHP bool representing whether we've found what we were expecting in the version output.
check_exiftool_cli_version_found()
Check CLI version found for Exiftool is as expected.
check_exiftool_cli_version_found(string $version_output, array<string|int, mixed> $utility) : array<string|int, mixed>
Parameters
- $version_output : string
-
The version output for ImageMagick
- $utility : array<string|int, mixed>
-
Utility structure. RS_SYSTEM_UTILITIES
Return values
array<string|int, mixed> —Returns array as expected by the check.php page
- utility - New utility value for its display name
- found - PHP bool representing whether we've found what we were expecting in the version output.
- error_message - optional error message if an issue is detected
check_numeric_cli_version_found()
Check CLI numeric version found for a utility is as expected.
check_numeric_cli_version_found(string $version_output, array<string|int, mixed> $utility) : array<string|int, mixed>
Parameters
- $version_output : string
-
The version output
- $utility : array<string|int, mixed>
-
Utility structure. RS_SYSTEM_UTILITIES
Return values
array<string|int, mixed> —Returns array as expected by the check.php page
- utility - not used
- found - PHP bool representing whether we've found what we were expecting in the version output.
check_utility_cli_version_found_by_name()
Check CLI version found for a utility is as expected by looking up for its name.
check_utility_cli_version_found_by_name(string $version_output, array<string|int, mixed> $utility, array<string|int, mixed> $lookup_names) : array<string|int, mixed>
Parameters
- $version_output : string
-
The version output for the utility
- $utility : array<string|int, mixed>
-
Utility structure. RS_SYSTEM_UTILITIES
- $lookup_names : array<string|int, mixed>
Return values
array<string|int, mixed> —Returns array as expected by the check.php page
- utility - not used
- found - PHP bool representing whether we've found what we were expecting in the version output.
command_line_only()
Check we're running on the command line, exit otherwise. Security feature for the scripts in /pages/tools/
command_line_only() : void
prefix_value()
Helper function to quickly build a list of values, all prefixed the same way.
prefix_value(string $prefix) : Closure
$fieldXs = array_map(prefix_value('field'), [3, 88]);
Parameters
- $prefix : string
-
Prefix value to prepend.
Return values
ClosurevalidateDatetime()
Utility function to check string is a valid date/time with a specific format.
validateDatetime(string $datetime[, string $format = 'Y-m-d H:i:s' ]) : bool
Parameters
- $datetime : string
-
Date/time value
- $format : string = 'Y-m-d H:i:s'
-
The format that date/time value should be in. https://www.php.net/manual/en/datetimeimmutable.createfromformat.php
Return values
boolstring_ends_with()
string_ends_with(string $haystack, mixed $needle) : mixed
Parameters
- $haystack : string
-
Value to be checked @param string $needle Substing to seach for in the haystack
@return bool True if the haystack ends with the needle otherwise false
- $needle : mixed
set_order_by_to_zero()
Helper function to set the order_by key of an array to zero.
set_order_by_to_zero(array<string|int, mixed> $item) : array<string|int, mixed>
Parameters
- $item : array<string|int, mixed>
Return values
array<string|int, mixed> —Same item with the order_by key zero.
cast_echo_to_string()
Helper function to cast functions that only echo things out (e.g render functions) to string type.
cast_echo_to_string(callable $fn[, array<string|int, mixed> $args = [] ]) : string
Parameters
- $fn : callable
-
Function to cast
- $args : array<string|int, mixed> = []
-
Provide function's arguments (if applicable)
Return values
stringparse_csv_to_list_of_type()
Helper function to parse input to a list of a particular type.
parse_csv_to_list_of_type(string $csv, callable $type) : array<string|int, mixed>
Parameters
- $csv : string
-
CSV of raw data
- $type : callable
-
Function checking each CSV item, as required by your context, to determine if it should be allowed in the result set
Tags
Return values
array<string|int, mixed>execution_lockout_remove_resource_type_field_props()
Remove metadata field properties during execution lockout
execution_lockout_remove_resource_type_field_props(array<string|int, mixed> $rtf) : array<string|int, mixed>
Parameters
- $rtf : array<string|int, mixed>
-
Resource type field data structure
Return values
array<string|int, mixed> —Returns without the relevant properties if execution lockout is enabled
set_watermark_image()
Update global variable watermark to point to the correct file. Watermark set on System Configuration page will override a watermark set in config.php. config.default.php will apply otherwise (blank) so no watermark will be applied.
set_watermark_image() : void
compute_dpi()
DPI calculations
compute_dpi(mixed $width, mixed $height, mixed &$dpi, mixed &$dpi_unit, mixed &$dpi_w, mixed &$dpi_h) : mixed
Parameters
- $width : mixed
- $height : mixed
- $dpi : mixed
- $dpi_unit : mixed
- $dpi_w : mixed
- $dpi_h : mixed
compute_megapixel()
MP calculation
compute_megapixel(int $width, int $height) : float
Parameters
- $width : int
- $height : int
Return values
floatget_size_info()
Get size info as a paragraphs HTML tag
get_size_info(array<string|int, mixed> $size[, array<string|int, mixed>|null $originalSize = null ]) : string
Parameters
- $size : array<string|int, mixed>
-
Preview size information
- $originalSize : array<string|int, mixed>|null = null
-
Original preview size information
Return values
stringis_jpeg_extension()
Simple function to check if a given extension is associated with a JPG file
is_jpeg_extension(string $extension) : bool
Parameters
- $extension : string
-
File extension
Return values
boolurl_starts_with()
Input validation helper function to check a URL is ours (e.g. if it's our base URL). Mostly used for redirect URLs.
url_starts_with(string $base, mixed $val) : bool
Parameters
- $base : string
-
The value the URL is expected to start with. Due to the structure of a URL, you can also check for (partial) paths.
- $val : mixed
-
URL to check
Return values
boolis_safe_url()
Input validation helper function to check if a URL is safe (from XSS) in an HTML context.
is_safe_url(mixed $url) : bool
Parameters
- $url : mixed
Tags
Return values
boolsanitise_url()
Sanitise URL for HTML rendering purposes.
sanitise_url(string $val) : string
ResourceSpace only works with absolute (via $baseurl) and relative root (via $baseurl_short) URLs.
Parameters
- $val : string
-
Untrusted URL
Tags
Return values
string —Returns the provided value (URL) if considered safe, "#" otherwise.
validate_sort_value()
Input validation helper function for sorting (ASC/DESC).
validate_sort_value(mixed $val) : bool
Parameters
- $val : mixed
-
User input value to be validated
Return values
boolvalidate_digit_csv()
Input validation helper function for a CSV of integers (mostly used for IDs).
validate_digit_csv(mixed $val) : bool
Parameters
- $val : mixed
-
User input value to be validated
Return values
boolget_sub_array_with()
Helper function to get an array of values with a subset of their original keys.
get_sub_array_with(array<string|int, mixed> $keys) : callable
Parameters
- $keys : array<string|int, mixed>
Return values
callableenforceSharePassword()
Server side check to backup front end javascript validation.
enforceSharePassword(string $password) : void
Parameters
- $password : string
-
Password supplied when creating or editing external share.
js_call_CentralSpaceLoad()
Helper function to call the JS CentralSpaceLoad().
js_call_CentralSpaceLoad(string $url) : never
Parameters
- $url : string
Return values
nevergetCertificateExpiry()
Get expiration date of a given PEM certificate
getCertificateExpiry(string $cert) : string|bool
Parameters
- $cert : string
-
Certificate text
Return values
string|bool —Expiry date. False if unable to parse certificate
isValidCssColor()
Is the provided colour a valid CSS colour and therefore safe to display?
isValidCssColor(string $colour) : bool
Parameters
- $colour : string
Return values
bool —True if a valid colour, false if not
hslToRgb()
Convert HSL to RGB.
hslToRgb(float $h, float $s, float $l) : array<string|int, mixed>
Parameters
- $h : float
-
Hue (0-360).
- $s : float
-
Saturation (0-1).
- $l : float
-
Lightness (0-1).
Return values
array<string|int, mixed> —Array with RGB values (0-255).
check_tinymce_plugins()
Check TinyMCE plugin list against an array of valid options The passed list is checked against TINYMCE_VALID_PLUGINS.
check_tinymce_plugins([string $plugins = "" ]) : string
The autoresize plugin is also included by default.
Parameters
- $plugins : string = ""
-
A comma-separated list of plugins for TinyMCE
Return values
string —The list of plugins with any invalid options removed
check_tinymce_toolbar()
Check TinyMCE toolbar configuration to ensure it contains only alphanumeric characters, spaces and the pipe (|) symbol.
check_tinymce_toolbar([string $toolbar = "" ]) : string
Parameters
- $toolbar : string = ""
-
The requested configuration for the toolbar
Return values
string —The configured toolbar with any invalid characters removed
get_non_ingested_resources()
Return the number of resources in the system that are not ingested into the filestore i.e. with 'file_path' set
get_non_ingested_resources() : int
Return values
int —Number of non-ingested resources in the system
get_favicon_url()
Return URL of the application favicon
get_favicon_url() : string
Return values
string —Favicon URL
is_original_preview()
Determine what is a manually uploaded preview based off of data in the resource log
is_original_preview(int $ref) : bool
@param int $ref resource ID
Parameters
- $ref : int
Return values
bool —returns true if a resource is using its original preview otherwise false.
get_page_title()
Return the page title to use for the given page and optionally plugin.
get_page_title(string $page[, string $plugin = "" ]) : string
Parameters
- $page : string
-
Page name without any leading filepath or trailing file extension.
- $plugin : string = ""
-
Optional. Used to denote which plugin the page is part of.
Return values
string —If a language string is found, returns "%%APPLICATION_NAME%% - %%PAGENAME%%"; otherwise, returns "%%APPLICATION_NAME%%".
log_bandwidth()
Log the bandwidth used by download.php
log_bandwidth(int $bandwidth_usage) : void
Parameters
- $bandwidth_usage : int
strip_unicode_points()
Strip Unicode points from a text value.
strip_unicode_points(string $value[, array<int, string> $blocklist = [] ]) : string
Parameters
- $value : string
-
Text value subject
- $blocklist : array<int, string> = []
-
List of unicode points (e.g. \x{FEFF}), ranges allowed too (e.g. \x{200B}-\x{200D})
Return values
stringallow_unicode_characters()
Strip any characters not present in the allow list. Mostly useful for search/indexing purposes where we care more about the words themselves and less about linking or any other type of characters.
allow_unicode_characters(string $text[, array<int, string> $allowlist = [] ]) : string
Parameters
- $text : string
-
Initial text value
- $allowlist : array<int, string> = []
-
List of allowed characters. IMPORTANT: it's used to create a regex pattern.
Return values
stringset_per_page_cookie()
Add or update the value used for paging for the current page to the list of stored pager cookies
set_per_page_cookie(int $per_page) : void
Parameters
- $per_page : int
-
value to be stored
get_per_page_cookie()
Retrieve the pager cookie for the current page.
get_per_page_cookie() : int
This function also clears the per_page and per_page_list cookies
Return values
intparse_int_ranges()
Parse a comma-separated list of integers and integer ranges into a sorted array.
parse_int_ranges(string $input[, int $max_val = 0 ][, bool $optional = false ][, bool $allow_wildcard = false ]) : array<string|int, mixed>
Accepts input such as:
- "*"
- "1,2,5"
- "1-3,7,10-12"
- "1-3,10-*"
Parameters
- $input : string
-
Comma-separated list of integers and/or ranges (e.g. "1,3-5,10")
- $max_val : int = 0
-
Optional upper bound for allowed values. Use 0 for no limit
- $optional : bool = false
-
If true, an empty input string is allowed. If false, empty input is an error
- $allow_wildcard : bool = false
-
If true, an asterisk can be used as a wildcard (e.g * for all, 10-* for 10 and above)
Return values
array<string|int, mixed> —ok: bool True when parsing succeeds, false when any validation error occurs numbers: int[] Sorted list of unique integers when ok is true and allow_wildcard is false, otherwise empty errors: string[] List of error messages when ok is false, otherwise empty
build_range_where_condition()
Build a SQL WHERE fragment and bound parameters from a list of integers and ranges.
build_range_where_condition(string $input, string $field[, int $max_val = 0 ][, bool $allow_wildcard = false ]) : array<string|int, mixed>
Parses a comma-separated input string containing single integers and/or ranges and can take optional wildcards (e.g. "1,3-5,10,12-*") Converts each item into a parameterized SQL condition:
- Single value: "
= ?" - Range: "
BETWEEN ? AND ?" - Sole wildcard: No filter, so 1=1 is used
- Range wildcard: "
>= ?"
All generated conditions are joined using OR and wrapped in parentheses. Parameters are returned in the order they appear in the WHERE fragment.
Parameters
- $input : string
-
Comma-separated list of integers and/or ranges (e.g. "1,3-5,10")
- $field : string
-
Database column name to use in the generated SQL expressions
- $max_val : int = 0
-
Optional upper bound for allowed values. Use 0 for no limit
- $allow_wildcard : bool = false
-
If true, an asterisk can be used as a wildcard (e.g * for all, 10-* for 10 and above)
Return values
array<string|int, mixed> —ok: bool True when the WHERE clause is successfully built, false on validation errors where: string|null Parenthesized SQL fragment joined with OR when ok is true, otherwise null params: array Ordered list of bind types and values errors: string[] List of error messages when ok is false, otherwise empty
iiif_get_canvases()
Get an array of all the canvases for the identifier ready for JSON encoding
iiif_get_canvases(int $identifier, array<string|int, mixed> $iiif_results[, bool $sequencekeys = false ]) : array<string|int, mixed>
Parameters
- $identifier : int
-
IIIF identifier (this associates resources via the metadata field set as $iiif_identifier_field
- $iiif_results : array<string|int, mixed>
-
Array of ResourceSpace search results that match the $identifier, sorted
- $sequencekeys : bool = false
-
Get the array with each key matching the value set in the metadata field $iiif_sequence_field. By default the array will be sorted but have a 0 based index
Tags
Return values
array<string|int, mixed>iiif_get_thumbnail()
Get thumbnail information for the specified resource id ready for IIIF JSON encoding
iiif_get_thumbnail(int $resourceid) : array<string|int, mixed>
Parameters
- $resourceid : int
-
Resource ID
Tags
Return values
array<string|int, mixed>iiif_get_image()
Get the image for the specified identifier canvas and resource id
iiif_get_image(int $identifier, int $resourceid, string $position, array<string|int, mixed> $size_info) : array<string|int, mixed>
Parameters
- $identifier : int
-
IIIF identifier (this associates resources via the metadata field set as $iiif_identifier_field
- $resourceid : int
-
Resource ID
- $position : string
-
The canvas identifier, i.e position in the sequence. If $iiif_sequence_field is defined
- $size_info : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>iiif_error()
Handle a IIIF error.
iiif_error([int $errorcode = 404 ][, array<string|int, mixed> $errors = array() ]) : void
Parameters
- $errorcode : int = 404
-
The error code
- $errors : array<string|int, mixed> = array()
-
An array of errors
is_power_of_two()
is_power_of_two(int $x) : bool
Parameters
- $x : int
Return values
boolupload_file()
Upload a file from the provided path to the given resource
upload_file(int $ref[, bool $no_exif = false ][, bool $revert = false ][, bool $autorotate = false ][, string $file_path = "" ][, bool $after_upload_processing = false ][, bool $deletesource = true ]) : bool
Parameters
- $ref : int
-
Resource ID
- $no_exif : bool = false
-
Do not extract embedded metadata. False by default so data will be extracted
- $revert : bool = false
-
Delete all data and re-extract embedded data
- $autorotate : bool = false
-
Autorotate images - alters embedded orientation data in uploaded file
- $file_path : string = ""
-
Path to file
- $after_upload_processing : bool = false
-
Set to true will create an offline job to process the file
- $deletesource : bool = true
-
Delete resource after upload
Return values
boolextract_exif_comment()
Extract and process EXIF, IPTC, and FITS metadata for a resource.
extract_exif_comment(int $ref[, string $extension = "" ]) : bool
This function retrieves metadata from an image file, including EXIF, IPTC, and FITS metadata,
and updates the corresponding fields in the database. The process includes support for embedded
geolocation data, handling character encoding, and applying user-configurable options for specific fields.
If ExifTool is available, it is used for more comprehensive metadata extraction. Otherwise, the PHP
exif_read_data function is used as a fallback.
Parameters
- $ref : int
-
The resource reference ID.
- $extension : string = ""
-
(optional) The file extension for the image, used to validate processing compatibility.
Return values
bool —Returns false if the file does not exist; true on successful completion
iptc_return_utf8()
Convert IPTC metadata text to UTF-8 encoding.
iptc_return_utf8(string $text) : string
This function attempts to detect the character encoding of IPTC metadata text and converts it to UTF-8. If conversion is not possible due to missing libraries or if the encoding is unknown, the text is returned as-is. It uses a predefined list of character encodings for the conversion attempts.
Parameters
- $text : string
-
The IPTC metadata text to be converted.
Return values
string —The converted text in UTF-8 encoding, or the original text if conversion fails.
create_previews()
Generate previews for a resource, including thumbnails and alternative image sizes.
create_previews(int $ref[, bool $thumbonly = false ][, string $extension = "jpg" ][, bool $previewonly = false ][, bool $previewbased = false ][, int $alternative = -1 ][, bool $ignoremaxsize = false ][, bool $ingested = false ][, bool $checksum_required = true ][, array<string|int, mixed> $onlysizes = array() ][, bool $no_tiles = false ]) : bool
This function creates or updates image previews for a resource, such as thumbnails, based on the specified parameters. It supports a variety of configurations, including resizing with ImageMagick or GD library, generating checksums, and setting file attributes. If the file size exceeds a specified limit, it can queue the preview generation as an offline job.
Parameters
- $ref : int
-
The resource ID for which previews are generated.
- $thumbonly : bool = false
-
(optional) If
true, only the thumbnail will be generated. Default isfalse. - $extension : string = "jpg"
-
(optional) The file extension for the resource. Default is "jpg".
- $previewonly : bool = false
-
(optional) If
true, only preview images will be generated. Default isfalse. - $previewbased : bool = false
-
(optional) If
true, previews are generated based on existing previews rather than original files. Default isfalse. - $alternative : int = -1
-
(optional) If set, specifies an alternative file ID to generate previews for. Default is
-1. - $ignoremaxsize : bool = false
-
(optional) If
true, the file size limit for preview generation is ignored. Default isfalse. - $ingested : bool = false
-
(optional) If
true, marks the resource as already ingested into the system. Default isfalse. - $checksum_required : bool = true
-
(optional) If
true, generates a checksum for the file. Default istrue. - $onlysizes : array<string|int, mixed> = array()
-
(optional) Specifies an array of preview sizes to generate. If empty, all sizes are generated.
- $no_tiles : bool = false
-
(optional) Set to true to prevent creation of preview tiles (if enabled). Tiles would not be created where the preview source is a file created by preview_preprocessing.php.
Return values
bool —Returns true if previews were generated successfully; false otherwise.
extract_mean_colour()
Calculate and update the mean color values for a resource image.
extract_mean_colour(GdImage $image, int $ref) : void
Calculate and update the mean color values for a resource image.
This function calculates the mean red, green, and blue color values for a given image by sampling pixels in a grid pattern. It adjusts for brightness and excludes grayscale pixels to determine the dominant colors. Additionally, it updates the thumbnail dimensions and color key in the resource record.
Parameters
- $image : GdImage
-
The image resource to analyze for mean color.
- $ref : int
-
The resource ID for which the color data is updated.
update_portrait_landscape_field()
Update the portrait or landscape orientation field for a resource.
update_portrait_landscape_field(int $ref[, resource|null $image = null ]) : void
This function determines whether a resource image is in portrait, landscape, or square orientation and updates the specified field accordingly. If no image resource is provided, it attempts to load the thumbnail image for the resource.
Parameters
- $ref : int
-
The resource ID to update.
- $image : resource|null = null
-
(optional) An image resource for orientation analysis. If not provided, the function will load the resource thumbnail.
get_colour_key()
Generate a color key for an image based on dominant colors.
get_colour_key(GdImage $image) : string
This function extracts a color key that represents the dominant colors in an image, similar to a soundex code for colors. It maps the colors in the image to predefined color categories (e.g., black, white, red, etc.), calculates the closest match for each sampled pixel, and returns a five-character color key based on the most frequent colors.
Parameters
- $image : GdImage
-
The image resource to analyze.
Return values
string —A five-character string representing the dominant colors in the image.
tweak_preview_images()
Apply rotation and gamma adjustments to all preview images of a resource.
tweak_preview_images(int $ref, int $rotateangle, float $gamma[, string $extension = "jpg" ][, int $alternative = -1 ][, string $resource_ext = "" ]) : bool
This function adjusts the preview images of a resource by rotating or applying gamma correction. It primarily modifies the screen resolution preview, then scales and updates other preview sizes accordingly. For video resources, it also rotates snapshot images. Updates to rotation and gamma values are recorded in the database to allow future reconstruction of adjustments.
Parameters
- $ref : int
-
The resource ID for which previews are tweaked.
- $rotateangle : int
-
The angle in degrees to rotate the preview images.
- $gamma : float
-
The gamma correction factor (values > 1 to lighten, values < 1 to darken).
- $extension : string = "jpg"
-
(optional) The file extension for the preview images. Default is "jpg".
- $alternative : int = -1
-
(optional) The ID of an alternative file to tweak previews for. Default is
-1. - $resource_ext : string = ""
-
(optional) The file extension of the original resource, used for video snapshot rotation.
Return values
bool —Returns false if the main preview file does not exist; otherwise, updates previews and returns true.
tweak_wm_preview_images()
Apply rotation and gamma adjustments to all watermarked preview images of a resource.
tweak_wm_preview_images(int $ref, int $rotateangle, float $gamma[, string $extension = "jpg" ][, int $alternative = -1 ]) : bool
This function modifies watermarked preview images by applying a specified rotation angle and gamma correction factor. Each preview size defined in the database is processed, adjusting the watermarked version accordingly. The function resizes and updates each adjusted preview image.
Parameters
- $ref : int
-
The resource ID for which watermarked previews are tweaked.
- $rotateangle : int
-
The angle in degrees to rotate the watermarked preview images.
- $gamma : float
-
The gamma correction factor to apply (values > 1 to lighten, values < 1 to darken).
- $extension : string = "jpg"
-
(optional) The file extension for the preview images. Default is "jpg".
- $alternative : int = -1
-
(optional) The ID of an alternative file to tweak previews for. Default is
-1.
Return values
bool —Returns false if a watermarked file does not exist; otherwise, updates previews and returns true.
AltImageRotate()
Rotate an image resource by a specified angle without using built-in rotation functions.
AltImageRotate(GdImage $src_img, int $angle) : resource
This function manually rotates an image resource by 90, -90, or 180 degrees, creating a new image with the rotated pixels. If the angle is not one of these specified values, the original image is returned unmodified.
Parameters
- $src_img : GdImage
-
The source image resource to rotate.
- $angle : int
-
The angle in degrees to rotate the image (90, -90, or 180).
Return values
resource —The rotated image resource, or the original if the angle is unsupported.
base64_to_jpeg()
Convert a base64-encoded image to a JPEG file.
base64_to_jpeg(string $imageData, string $outputfile) : void
This function decodes a base64-encoded image string and saves it as a JPEG file.
Parameters
- $imageData : string
-
The base64-encoded image data.
- $outputfile : string
-
The path to save the decoded JPEG file.
Tags
extract_indd_pages()
Extracts JPG previews from INDD files when these have been set with a preview Note: it requires ExifTool >= 9.50
extract_indd_pages(string $filename) : array<string|int, mixed>|bool
Parameters
- $filename : string
Return values
array<string|int, mixed>|boolgenerate_file_checksum()
Generate or update the checksum for a resource file.
generate_file_checksum(int $resource, string $extension[, bool $anyway = false ]) : bool
This function calculates a unique checksum for a specified resource file. It either generates the checksum based on file contents and updates the resource record, or clears any existing checksum if the file does not exist. It also sets metadata indicating the checksum's last verification date and integrity status.
Parameters
- $resource : int
-
The ID of the resource for which the checksum is generated.
- $extension : string
-
The file extension of the resource.
- $anyway : bool = false
-
(optional) If
true, forces checksum generation regardless of configuration settings.
Return values
bool —Returns true if the checksum was generated; false if the file does not exist or was not generated.
clear_file_checksum()
Clear the checksum value for a specified resource.
clear_file_checksum(int $resource) : bool
Parameters
- $resource : int
-
The ID of the resource to clear the checksum for.
Return values
bool —Returns true if the checksum was cleared successfully; false if the resource ID is invalid.
check_duplicate_checksum()
Check for duplicate files based on checksum.
check_duplicate_checksum(string $filepath, int $replace_resource) : array<string|int, mixed>
This function calculates the checksum of a file and checks if any existing resources have the same checksum, indicating a possible duplicate. If a duplicate is found and the resource is not marked for replacement, the function returns the list of duplicate resource IDs.
Parameters
- $filepath : string
-
The file path of the file to check.
- $replace_resource : int
-
The resource ID to replace, if applicable, to avoid detecting it as a duplicate.
Return values
array<string|int, mixed> —An array of duplicate resource IDs, or an empty array if no duplicates are found.
upload_preview()
Upload and generate previews for a resource.
upload_preview(int $ref) : bool
This function uploads a user-provided preview image for a specified resource, ensuring the file is in JPEG format. After moving the file to its temporary location, it generates previews and cleans up the temporary file if not in use for transcoding.
Parameters
- $ref : int
-
The resource ID for which the preview is uploaded.
Return values
bool —Returns true if the preview upload and processing are successful, false if the file is not in JPEG format.
extract_text()
Extract text from the resource and save to the configured field
extract_text(int $ref, string $extension[, string $path = "" ]) : bool
Parameters
- $ref : int
-
Resource ref
- $extension : string
-
File extension
- $path : string = ""
-
Path can be set to use an alternate file, for example, in the case of unoconv
Tags
Return values
bool —Returns false on error else true.
get_image_orientation()
Get the orientation of an image file using ExifTool.
get_image_orientation(string $file) : int
This function retrieves the orientation metadata of an image file. If orientation information is not available, it attempts to retrieve the rotation metadata. The function uses ExifTool for the extraction and processes the result to return the orientation angle in degrees.
Parameters
- $file : string
-
The path to the image file.
Return values
int —The orientation angle in degrees (0, 90, 180, 270), or 0 if no orientation information is available.
AutoRotateImage()
Automatically rotate an image based on its orientation metadata.
AutoRotateImage(string $src_image[, int|bool $ref = false ]) : bool
This function uses ImageMagick to rotate an image to the correct orientation. If the image's orientation is determined using ExifTool, the function will rotate the image accordingly. It preserves custom metadata when applicable.
Parameters
- $src_image : string
-
The path to the source image that needs to be rotated.
- $ref : int|bool = false
-
The resource ID for the image; used to fetch orientation data if needed. Pass
falseif no resource ID is available.
Return values
bool —Returns true if the image was successfully rotated and saved, or false on failure.
extract_icc_profile()
Provides ability to extract the ICC profile for a specified resource/ alternative file
extract_icc_profile(int $ref, string $extension[, int $alternative = -1 ]) : bool
Parameters
- $ref : int
-
Resource ref
- $extension : string
-
Extension of the file
- $alternative : int = -1
-
Resource alternative ref. Default -1 as per get_resource_path() defintion
Tags
Return values
boolextract_icc()
Extracts the ICC profile from an image file using ImageMagick.
extract_icc(string $infile[, string $ref = '' ]) : bool
This function attempts to extract the ICC profile from the specified image file and saves it as a
separate file with the .icc extension. It checks if the ICC profile already exists and will
remove it before extraction. The function is compatible with both Windows and non-Windows
environments.
Parameters
- $infile : string
-
The path to the input image file from which to extract the ICC profile.
- $ref : string = ''
-
Optional. The resource ID associated with the image file. Used to determine the output path for the extracted ICC profile.
Tags
Return values
bool —Returns true if the ICC profile was successfully extracted and saved, or false on failure.
get_imagemagick_version()
Retrieves the version of ImageMagick installed on the system.
get_imagemagick_version([bool $array = true ]) : mixed
This function checks the version of ImageMagick by executing the convert command.
It can return the version information as either an array or a string, depending on the
value of the $array parameter.
Parameters
- $array : bool = true
-
Optional. If set to true, the function returns an array containing the major, minor, revision, and patch version numbers. If false, it returns a version string in the format "major.minor.revision-patch".
Return values
mixed —Returns an array with version numbers if $array is true, a version string if false, or false if ImageMagick is not installed or the version cannot be determined.
calculate_image_dimensions()
Function used to get new width & height for an image in order to maintain aspect ratio while it will fit within a desired dimension.
calculate_image_dimensions(string $image_path, int $target_width, int $target_height[, bool $enlarge_image = false ]) : array<string|int, mixed>
Parameters
- $image_path : string
-
The full path to the image (can be physical / URL)
- $target_width : int
- $target_height : int
- $enlarge_image : bool = false
-
Specify whether images smaller than our target should be enlarged or not. Default is FALSE
Return values
array<string|int, mixed> —New dimensions which can be used to resize the image and offset values client code can use for consistent visual display
upload_file_by_url()
Upload file from a URL and add it to a resource.
upload_file_by_url(int $ref[, bool $no_exif = false ][, bool $revert = false ][, bool $autorotate = false ][, string $url = "" ][, string $key = "" ]) : bool
Parameters
- $ref : int
-
Resource ID
- $no_exif : bool = false
-
=false Don't extract exif data - true to disable extraction
- $revert : bool = false
-
=false Delete all data and re-extract embedded data
- $autorotate : bool = false
-
=false Autorotate images - alters embedded orientation data in uploaded file
- $url : string = ""
-
="" File URL
- $key : string = ""
-
="" Optional key to distinguish betweeen simultaneous requests from same user with same filename
Return values
booldelete_previews()
Delete all preview files for specified resource id or resource data array
delete_previews(mixed $resource[, mixed $alternative = -1 ]) : mixed
Parameters
- $resource : mixed
-
array|integer Resource array or resource ID to delete preview files for
- $alternative : mixed = -1
getFileDimensions()
Get dimensions of image file
getFileDimensions(string $identify_fullpath, string $prefix, string $file, string $extension) : array<string|int, mixed>
Parameters
- $identify_fullpath : string
-
path to IM identify command
- $prefix : string
-
prefix - used by camera RAW files
- $file : string
-
path to file
- $extension : string
-
file extension
Return values
array<string|int, mixed> —width and height of image, elements are null if not possible e.g. not an image file
getSvgSize()
Get SVG size by reading the file and looking for dimensions at either width and height OR at Viewbox attribute(s)
getSvgSize(string $file_path) : array<string|int, mixed>
Parameters
- $file_path : string
-
Path to SVG file (should work with both a physical path and a URL)
Return values
array<string|int, mixed> —where first element is width and second is height represented as strings
convertSvgLengthToPx()
Convert SVG length/width dimension to px size at 96DPI
convertSvgLengthToPx(string $length) : int|null
Parameters
- $length : string
-
dimension to be converted
Return values
int|null —dimension in pixels, or null if cannot be converted
replace_preview_from_resource()
Replace preview image with preview image from another resource/alternaive file
replace_preview_from_resource(int $ref, int $previewresource, int $previewalt) : bool
Parameters
- $ref : int
-
Resource to replace preview image for
- $previewresource : int
-
Preview source resource ref
- $previewalt : int
-
Preview source resource alternative ref
Return values
boolget_preview_source_file()
Get the source file to use for creating a preview
get_preview_source_file(int $ref, string $extension, bool $previewonly, bool $previewbased, int $alternative, bool $ingested) : string
Parameters
- $ref : int
-
Resource ID
- $extension : string
-
Resource extension
- $previewonly : bool
-
Create previews only
- $previewbased : bool
-
Use existing preview as source
- $alternative : int
-
Alternative file reference
- $ingested : bool
-
Has file been ingested?
Return values
stringcompute_tiles_at_scale_factor()
Compute image tile regions based on a scale factor.
compute_tiles_at_scale_factor(int $sf, int $sw, int $sh) : array<string|int, mixed>
IMPORTANT: Please note that the origin position (0,0) is the upper left-most pixel of the image
Parameters
- $sf : int
-
Scale factor
- $sw : int
-
Source image width
- $sh : int
-
Source image height
Tags
Return values
array<string|int, mixed> —Returns array of tile data:
- id -> tile region identifier. Usually used as the size argument with get_resource_path()
- x -> represents the number of pixels from the origin (ie. position zero) on the horizontal axis
- y -> represents the number of pixels from the origin (ie. position zero) on the vertical axis
- w -> width of the region in pixels
- h -> height of the region in pixels
- row -> represents the row grid position of the region (used with DZI compliant systems)
- column -> represents the column grid position of the region (used with DZI compliant systems)
transform_file()
Perform the requested action on the original file to create a new file
transform_file(string $sourcepath, string $outputpath, array<string|int, mixed> $actions) : bool
Parameters
- $sourcepath : string
-
Path to source file
- $outputpath : string
- $actions : array<string|int, mixed>
-
Array of actions to perform
Return values
bool —Image created successfully?
remove_video_previews()
For a given resource reference, remove the video pre size and all snapshots.
remove_video_previews(int $resource) : void
Parameters
- $resource : int
-
Resource to remove video previews.
start_previews()
Create preview sizes via create_previews() and/or generate jobs as necessary
start_previews(int $ref[, string $extension = "" ]) : int
Parameters
- $ref : int
-
Resource ID
- $extension : string = ""
-
File extension
Return values
int —0 Preview creation failed 1 All previews have been created 2 Minimal previews created and offline jobs/scripts are required to create the full set of previews/image/video $alternatives
get_sizes_to_generate()
Get an array of preview size IDs to generate
get_sizes_to_generate(string $extension, array<string|int, mixed> $dimensions[, bool $thumbonly = false ][, bool $previewonly = false ][, array<string|int, mixed> $onlysizes = [] ][, bool $no_tiles = false ]) : array<string|int, mixed>|bool
Parameters
- $extension : string
-
File extension ('hpr' is only required for non-JPG images)
- $dimensions : array<string|int, mixed>
-
Image source dimensions in format [width,height]
- $thumbonly : bool = false
-
Generate 'thm' and 'col' only
- $previewonly : bool = false
-
Generate 'scr', 'pre', 'thm' and 'col' only
- $onlysizes : array<string|int, mixed> = []
-
Array of requested size IDs to generate
- $no_tiles : bool = false
-
Set to true to prevent creation of preview tiles (if enabled). Tiles would not be created where the preview source is a file created by preview_preprocessing.php.
Return values
array<string|int, mixed>|bool —Array of size IDs or false on failure.
create_image_alternatives()
Generates alternative image files for a specified resource.
create_image_alternatives(int $ref, array<string|int, mixed> $params[, bool $force = false ]) : bool
This function checks the existing alternative files and creates new ones based on the specified parameters. It can also force the creation of alternatives even if they already exist. It uses ImageMagick to process the images according to the specified configurations.
Parameters
- $ref : int
-
The resource ID for which alternatives are being generated.
- $params : array<string|int, mixed>
-
An associative array containing the following keys:
- file: The file path of the original image.
- extension: The extension of the original image (default is "jpg").
- previewonly: A boolean indicating if only previews should be created.
- previewbased: A boolean indicating if the alternatives are based on previews.
- ingested: A boolean indicating if the resource has been ingested (default is true).
- $force : bool = false
-
Optional. If set to true, will force the generation of alternative files even if they exist.
Return values
bool —Returns true if alternatives were generated successfully, false otherwise.
is_valid_imagemagick_color()
Input validation helper function for ImageMagick's color values (e.g. blue, #ddddff and rgb(255,255,255))
is_valid_imagemagick_color(string $val) : bool
Parameters
- $val : string
Tags
Return values
boolcan_apply_icc_profile()
With $icc_extraction enabled, determine whether we should apply the icc profile that has been found.
can_apply_icc_profile(string $original_file_path) : bool
Note: This doesn't prevent ICC profile extraction.
Parameters
- $original_file_path : string
-
Path to the original file from which the ICC profile was extracted.
Return values
booltransform_apply_icc_profile()
Check if system is using ICC profiles and prepare ImageMagick command for use by transform_file() to enable system wide configuration for $icc_extraction to be applied when transforming a file, such as by format chooser or image tools.
transform_apply_icc_profile(int $ref, string $original_file_path) : array<string|int, mixed>
Parameters
- $ref : int
-
Resource id.
- $original_file_path : string
-
Path to the original file for the resource.
Return values
array<string|int, mixed>create_previews_using_im()
Generate previews for a resource using ImageMagick.
create_previews_using_im(int $ref[, bool $thumbonly = false ][, string $extension = "jpg" ][, bool $previewonly = false ][, bool $previewbased = false ][, int $alternative = -1 ][, bool $ingested = false ][, array<string|int, mixed> $onlysizes = [] ][, bool $no_tiles = false ]) : bool
This function creates image previews for a resource by leveraging ImageMagick to handle resizing and generating thumbnails, medium, large, and custom-sized previews. It provides flexible options to control the generation process, such as limiting previews to specific sizes, applying watermarks, handling color profiles, and managing alternative files. The function includes extensive support for non-standard image formats and configurations.
Parameters
- $ref : int
-
The resource ID for which previews are generated.
- $thumbonly : bool = false
-
(optional) If
true, only the thumbnail will be generated. Default isfalse. - $extension : string = "jpg"
-
(optional) The file extension for the resource. Default is "jpg".
- $previewonly : bool = false
-
(optional) If
true, only preview images will be generated. Default isfalse. - $previewbased : bool = false
-
(optional) If
true, previews are generated based on existing previews rather than original files. Default isfalse. - $alternative : int = -1
-
(optional) Specifies an alternative file ID to generate previews for, if any. Default is
-1. - $ingested : bool = false
-
(optional) If
true, marks the resource as already ingested into the system. Default isfalse. - $onlysizes : array<string|int, mixed> = []
-
(optional) Specifies an array of preview sizes to generate. If empty, all sizes are generated.
- $no_tiles : bool = false
-
(optional) Set to true to prevent creation of preview tiles (if enabled). Tiles would not be created where the preview source is a file created by preview_preprocessing.php.
Return values
bool —Returns true if previews were generated successfully; false otherwise.
job_queue_add()
Adds a job to the job_queue table.
job_queue_add([string $type = "" ][, array<string|int, mixed> $job_data = array() ][, string $user = "" ][, string $time = "" ][, string $success_text = "" ][, string $failure_text = "" ][, string $job_code = "" ][, int $priority = null ]) : string|int
Parameters
- $type : string = ""
- $job_data : array<string|int, mixed> = array()
- $user : string = ""
- $time : string = ""
- $success_text : string = ""
- $failure_text : string = ""
- $job_code : string = ""
- $priority : int = null
Return values
string|int —ID of newly created job or error text
job_queue_update()
Update the data/status/time of a job queue record.
job_queue_update(int $ref[, array<string|int, mixed> $job_data = array() ][, string $newstatus = "" ][, string $newtime = "" ][, mixed $priority = null ]) : void
Parameters
- $ref : int
- $job_data : array<string|int, mixed> = array()
-
- pass empty array to leave unchanged
- $newstatus : string = ""
- $newtime : string = ""
- $priority : mixed = null
job_queue_delete()
Delete a job queue entry if user owns job or user is admin
job_queue_delete(mixed $ref) : void
Parameters
- $ref : mixed
job_queue_get_jobs()
Gets a list of offline jobs
job_queue_get_jobs([string $type = "" ][, string $status = -1 ][, int $user = "" ][, string $job_code = "" ][, string $job_order_by = "priority" ][, string $job_sort = "asc" ][, string $find = "" ][, bool $returnsql = false ][, int $maxjobs = 0 ][, bool $overdue = false ][, array<string|int, mixed> $find_by_job_ref = [] ]) : mixed
Parameters
- $type : string = ""
-
Job type, can be a comma separated list of job types
- $status : string = -1
-
Job status - see definitions.php
- $user : int = ""
-
Job user
- $job_code : string = ""
-
Unique job code
- $job_order_by : string = "priority"
-
Column to order by - default is priority
- $job_sort : string = "asc"
-
Sort order - ASC or DESC
- $find : string = ""
-
Search jobs for this string
- $returnsql : bool = false
-
Return raw SQL
- $maxjobs : int = 0
-
Maximum number of jobs to return
- $overdue : bool = false
-
Only return overdue jobs?
- $find_by_job_ref : array<string|int, mixed> = []
-
Find queued jobs by their ref
Return values
mixed —Resulting array of requests or an SQL query object
job_queue_get_job()
Get details of specified offline job
job_queue_get_job(mixed $ref) : array<string|int, mixed>
Parameters
- $ref : mixed
Return values
array<string|int, mixed>job_queue_purge()
Delete all jobs in the specified state
job_queue_purge([int $status = 0 ]) : void
Parameters
- $status : int = 0
-
to purge, whole queue will be purged if not set
job_queue_run_job()
Run offline job
job_queue_run_job(array<string|int, mixed> $job, bool $clear_process_lock) : string
Parameters
- $job : array<string|int, mixed>
-
Metadata of the queued job as returned by job_queue_get_jobs()
- $clear_process_lock : bool
-
Clear process lock for this job
Return values
string —'Process lock', 'Error' or 'Complete'.
get_job_type_priority()
Get the default priority for a given job type
get_job_type_priority([string $type = "" ]) : int
Parameters
- $type : string = ""
-
Name of job type e.g. 'collection_download'
Return values
intget_job_queue_log_path()
Build and ensure a writable log file path for a queued job
get_job_queue_log_path([string $type = "" ][, string $job_code = "" ][, string $job_ref = "" ]) : string|false
Parameters
- $type : string = ""
-
Job category or queue type used as a subdirectory name
- $job_code : string = ""
-
Job identifier used in the log filename
- $job_ref : string = ""
-
Job reference value used in the log filename
Return values
string|false —Full path to the log file on success, or false on failure
get_job_queue_log_path_by_ref()
Resolve a queued job reference to its corresponding log file path
get_job_queue_log_path_by_ref([int $job_ref = 0 ]) : string|false
Parameters
- $job_ref : int = 0
-
Job reference
Return values
string|false —Full path to the job log file on success, or false on failure
get_job_progress_from_log_file()
Scan a log file from the end and return the most recent line matching a pattern.
get_job_progress_from_log_file([string $path = "" ][, string $pattern = "/\\[PROGRESS\\]/i" ][, int $block_size = 65536 ]) : array<string|int, mixed>
The file is read in fixed-size blocks starting from EOF and scanned backwards line-by-line for the first line that matches the supplied regular expression (by default, lines containing "[PROGRESS]").
On the first read pass, the function also captures the last non-empty line in the file (closest to EOF), regardless of whether it matches the pattern.
Parameters
- $path : string = ""
-
Path to the log file to scan
- $pattern : string = "/\\[PROGRESS\\]/i"
-
Regular expression used to match progress lines
- $block_size : int = 65536
-
Number of bytes to read per backward scan iteration
Return values
array<string|int, mixed> —found: string|null The most recent line matching $pattern, or null if none found or if the file could not be read last_line: string|null The last non-empty line in the file, or null if unavailable
job_trigger_permission_check()
Determine whether the current user is allowed to manually trigger background jobs.
job_trigger_permission_check() : bool
The system must have config $offline_job_queue set to true and the user must have 'a', 'f*', 't' and 'v' permissions as well as edit access to all workflow states.
Return values
bool —true if the user satisfies all required permissions and workflow access, false otherwise
triggerable_job_check()
Determine whether a job type is user triggerable.
triggerable_job_check([string $type = "" ]) : bool
This can stop system jobs from creating unnecessary log files.
Parameters
- $type : string = ""
Return values
bool —true if job is user triggerable, so logging is allowed
update_preview()
update_preview(mixed $ref, mixed $previewbased, mixed $sizes, mixed $delete_existing) : mixed
Parameters
- $ref : mixed
- $previewbased : mixed
- $sizes : mixed
- $delete_existing : mixed
lang_or_i18n_get_translated()
Translates field names / values using two methods: First it checks if $text exists in the current $lang (after $text is sanitized and $mixedprefix - one by one if an array - and $suffix are added). If not found in the $lang, it tries to translate $text using the i18n_get_translated function.
lang_or_i18n_get_translated(string $text, string $mixedprefix[, string $suffix = "" ]) : string
Parameters
- $text : string
- $mixedprefix : string
- $suffix : string = ""
Return values
stringi18n_get_translated()
For field names / values using the i18n syntax, return the version in the current user's language. Format is ~en:Somename~es:Someothername
i18n_get_translated(string|null $text[, string|null $lang_domain = null ]) : string
Parameters
- $text : string|null
- $lang_domain : string|null = null
-
As an optional fallback if an i18n string is not provided, check the system language translations for a matching translation instead.
Tags
Return values
stringi18n_get_collection_name()
Translates collection names
i18n_get_collection_name(mixed $mixedcollection[, string $index = "name" ]) : string
Parameters
- $mixedcollection : mixed
- $index : string = "name"
Return values
stringi18n_get_indexable()
For field names / values using the i18n syntax, return all language versions, as necessary for indexing.
i18n_get_indexable(string $text) : string
Parameters
- $text : string
-
The text to process
Return values
stringi18n_get_translations()
For a string in the language format, return all translations as an associative array E.g. "en"->"English translation"; "fr"->"French translation"
i18n_get_translations(string $value) : array<string|int, mixed>
Parameters
- $value : string
-
A string in the language format
Return values
array<string|int, mixed>str_replace_formatted_placeholder()
Returns a string with all occurrences of the $mixedplaceholder in $subject replaced with the $mixedreplace.
str_replace_formatted_placeholder(mixed $mixedplaceholder, mixed $mixedreplace, mixed $subject[, mixed $question_mark = false ][, string $separator = ", " ]) : string
If $mixedplaceholder is a string but $mixedreplace is an array, the $mixedreplace is imploded to a string using $separator. The replace values are formatted according to the formatting of the placeholders. The placeholders may be written in UPPERCASE, lowercase or Uppercasefirst. Each placeholder will be replaced by the replace value, written with the same case as the placeholder. It's possible to also include "?" as a placeholder for legacy reasons.
Example #1: str_replace_formatted_placeholder("%extension", $resource["file_extension"], $lang["originalfileoftype"], true) will search for the three words "%EXTENSION", "%extension" and "%Extension" and also the char "?" in the string $lang["originalfileoftype"]. If the found placeholder is %extension it will be replaced by the value of $resource["file_extension"], written in lowercase. If the found placeholder instead would have been "?" the value would have been written in UPPERCASE.
Example #2: str_replace_formatted_placeholder("%resourcetypes%", $searched_resource_types_names_array, $lang["resourcetypes-collections"], false, $lang["resourcetypes_separator"]) will search for the three words "%RESOURCETYPES%", "%resourcetypes%" and "%Resourcetypes%" in the string $lang["resourcetypes-collections"]. If the found placeholder is %resourcetypes% all elements in $searched_resource_types_names_array will be written in lowercase and separated by $lang["resourcetypes_separator"] before the resulting string will replace the placeholder.
Parameters
- $mixedplaceholder : mixed
- $mixedreplace : mixed
- $subject : mixed
- $question_mark : mixed = false
- $separator : string = ", "
Return values
stringucfirstletter()
Returns a string with the first LETTER of $string capitalized.
ucfirstletter(mixed $string) : string|array<string|int, mixed>|null
Compare with ucfirst($string) which returns a string with first CHAR of $string capitalized: ucfirstletter("abc") / ucfirstletter("%abc") returns "Abc" / "%Abc" ucfirst("abc") / ucfirst("%abc") returns "Abc" / "%abc"
Search for the first letter ([a-zA-Z]), which may or may not be followed by other characters (.*). Replaces the found substring ('$0') with the same substring but now with the first character capitalized, using ucfirst(). Note the /e modifier: If this modifier is set, preg_replace() does normal substitution of backreferences in the replacement string, evaluates it as PHP code, and uses the result for replacing the search string.
Parameters
- $string : mixed
Return values
string|array<string|int, mixed>|nullucfirstletter_callback()
Callback used by ucfirstletter
ucfirstletter_callback(array<string|int, mixed> $matches) : void
Parameters
- $matches : array<string|int, mixed>
normalize_keyword()
Normalize the text if function available
normalize_keyword(string $keyword[, bool $user_language = false ]) : string
Parameters
- $keyword : string
-
Keyword to normalize
- $user_language : bool = false
-
Flag to enable normalizing based on the current user language. Some languages consider characters with accents to be different characters and therefore order them after z and other consider them to be the same as the character without the accent. See https://www.php.net/manual/en/class.normalizer.php for more information
Return values
string —Normalized keyword
remove_accents()
This function and seems_utf8 are reused from WordPress. See documentation/licenses/wordpress.txt for license information
remove_accents(string $string) : string
Converts all accent characters to ASCII characters.
If there are no accent characters, then the string given is just returned.
Parameters
- $string : string
-
Text that might have accent characters
Return values
string —Filtered string with replaced "nice" characters.
seems_utf8()
Looks for particular patterns to attempt to determine if the provided string is in UTF8 format
seems_utf8(string $str) : bool
Parameters
- $str : string
Return values
bool —True if it's possibly UTF8
http_get_preferred_language()
Use the browser settings to determine the default / preferred language
http_get_preferred_language([bool $strict_mode = false ]) : string
Parameters
- $strict_mode : bool = false
Return values
string —The language string the user may prefer
setLanguage()
Set the user's current language based on get/post/cookie values as appropriate.
setLanguage() : string
Return values
string —The language string set
lang_load_site_text()
Load all site text for the given page and language into the global $lang array
lang_load_site_text(array<string|int, mixed> &$lang, string $pagename[, string $language = "" ]) : void
Parameters
- $lang : array<string|int, mixed>
-
Passed by reference
- $pagename : string
-
Pagename
- $language : string = ""
-
Language
i18n_get_all_translations()
Return an array of all available language strings for the given id, with the language code as the key
i18n_get_all_translations(string $langid) : array<string|int, mixed>
Parameters
- $langid : string
-
The identifier of the lang string
Return values
array<string|int, mixed>i18n_merge_translations()
Merge values for across multiple translation strings.
i18n_merge_translations(array<string|int, mixed> $values) : array<string|int, mixed>
Where a value is missing for a language used elsewhere i18n_get_translated will be used. If no value is provided and no English (en) string is found then blank will be returned.
Example input: ["~en:cheese~fr:fromage","~en:bread~fr:pain"]
Example output: ["~en:cheese, bread","~fr:fromage, pain"]
Parameters
- $values : array<string|int, mixed>
-
Translation strings to merge.
Return values
array<string|int, mixed> —Each language string as a comma separated list.
get_display_language()
Get the name of a language in your own language plus its native name.
get_display_language(string $language_key, string $language_value) : string
Used for language selection dropdowns.
Parameters
- $language_key : string
-
Key of $languages array, e.g. "fr"
- $language_value : string
-
The value (full name) from the $languages array, e.g. "Français"
Return values
stringis_i18n_language_string()
Simple check to determine if the text string supplied contains i18n language translations.
is_i18n_language_string(string $text) : bool
Returns true if match found e.g. '~en:test~en-US:test'. Returns false if no code is found. e.g. 'test'.
Parameters
- $text : string
-
Text string to check e.g. a node name or field value.
Return values
boollog_activity()
Log activity in the system (e.g user deleted a user)
log_activity([string $note = null ][, string $log_code = LOG_CODE_UNSPECIFIED ][, string $value_new = null ][, string $remote_table = null ][, string $remote_column = null ][, string $remote_ref = null ][, string $ref_column_override = null ][, string $value_old = null ][, string $user = null ][, bool $generate_diff = false ]) : void
Parameters
- $note : string = null
-
Notes/comments regarding this activity
- $log_code : string = LOG_CODE_UNSPECIFIED
- $value_new : string = null
- $remote_table : string = null
- $remote_column : string = null
- $remote_ref : string = null
- $ref_column_override : string = null
- $value_old : string = null
- $user : string = null
-
User that ran the activity
- $generate_diff : bool = false
logScript()
Log script messages on screen and optionally in a file. If debug_log is enabled, it will also write the message in the debug log file.
logScript(string $message[, resource $file = null ]) : void
Parameters
- $message : string
- $file : resource = null
Tags
resource_log_last_rows()
Retrieve entries from resource log based on date or references
resource_log_last_rows([int $minref = 0 ][, int $days = 7 ][, int $maxrecords = 0 ][, array<string|int, mixed> $fields = [] ][, array<string|int, mixed> $log_codes = [] ]) : array<string|int, mixed>
Parameters
- $minref : int = 0
-
(Optional) Minimum ref of resource log entry to return (default 0)
- $days : int = 7
-
(Optional) Number of days to return. e.g 3 = all results for today, yesterday and the day before. Default = 7 (ignored if minref supplied)
- $maxrecords : int = 0
-
(Optional) Maximum number of records to return. Default = all rows (0)
- $fields : array<string|int, mixed> = []
-
(Optional) Limit results to particular metadata field(s)
- $log_codes : array<string|int, mixed> = []
-
(Optional) Limit results to particular log code(s)
Return values
array<string|int, mixed>get_activity_log()
Get activity log entries from log tables (e.g activity_log, resource_log and collection_log)
get_activity_log(string $search, int $offset, int $rows, array<string|int, mixed> $where_statements, string $table, int $table_reference[, bool $count = false ]) : array<string|int, mixed>|int
Parameters
- $search : string
-
Search text to filter down results using fuzzy searching
- $offset : int
-
Specifies the offset of the first row to return
- $rows : int
-
Specifies the maximum number of rows to return
- $where_statements : array<string|int, mixed>
-
Where statements for log tables Example of where statements: $where_statements = array( 'activity_log' => "
activity_log.user='{$actasuser}' AND ", 'resource_log' => "resource_log.user='{$actasuser}' AND ", 'collection_log' => "collection_log.user='{$actasuser}' AND ", ); - $table : string
-
Table name (e.g resource_type_field, user, resource)
- $table_reference : int
-
ID of the record in the referred table
- $count : bool = false
-
Switch for if the result should be a single count or the result set
Tags
Return values
array<string|int, mixed>|intget_user_downloads()
Use resource log to obtain a count of resources downloaded by the specified user in the last X days
get_user_downloads(int $userref, int $user_dl_days) : int
Parameters
- $userref : int
-
User reference
- $user_dl_days : int
-
The number of days to check the resource log for
Return values
int —download count
log_node_changes()
Add detail of node changes to resource log
log_node_changes(int $resource, array<string|int, mixed> $nodes_new, array<string|int, mixed> $nodes_current[, string $lognote = "" ][, array<string|int, mixed> $nodes_renamed = [] ]) : bool
Note that this function originally required only the added and removed nodes to be passed. This was prior to node reversion changes, which requires the logging of all the existing resource nodes
Parameters
- $resource : int
-
Resource ID
- $nodes_new : array<string|int, mixed>
-
Array of new node IDs
- $nodes_current : array<string|int, mixed>
-
Array of old node IDs
- $lognote : string = ""
-
Optional note to add to log entry
- $nodes_renamed : array<string|int, mixed> = []
-
Optional array of old node names with node id as key e.g. [345 => 'oldname',678 => "pastname"]
Return values
bool —Success/failure
log_search_event()
Log search events
log_search_event(string $search, array<string|int, mixed> $resource_types, array<string|int, mixed> $archive_states, int $result_count) : void
Parameters
- $search : string
-
Actual search string do_search()
- $resource_types : array<string|int, mixed>
-
Resource types filter
- $archive_states : array<string|int, mixed>
-
Archive states filter
- $result_count : int
-
Search result count
generate_trace_id()
Generate a fingerprint which could then be used as a trace ID for event correlation purposes.
generate_trace_id(array<string|int, mixed> $components) : string
Parameters
- $components : array<string|int, mixed>
-
Data making up our fingerprint.
Return values
stringdaily_stat_past_month_by_activity()
Return sum of activity from the daily_stat table for the past month for a given activity_type.
daily_stat_past_month_by_activity(string $activity_type) : int
Parameters
- $activity_type : string
Return values
int —Sum of activity for the requested type.
perform_login()
Performs the login using the global $username, and $password. Since the "externalauth" hook is allowed to change the credentials later on, the $password_hash needs to be global as well.
perform_login([mixed $loginuser = "" ][, mixed $loginpass = "" ]) : array<string|int, mixed>
Parameters
- $loginuser : mixed = ""
- $loginpass : mixed = ""
Return values
array<string|int, mixed> —Containing the login details ('valid' determines whether or not the login succeeded).
generate_session_hash()
Generates a unique session hash for user authentication.
generate_session_hash(string $password_hash) : string
This function creates a session hash based on either a completely randomized method or a method that combines a password hash with the current date. It ensures that the generated hash is unique by checking against existing sessions in the database.
Parameters
- $password_hash : string
-
The hashed password of the user, used for generating the session hash.
Return values
string —Returns a unique session hash.
set_login_cookies()
Set login cookies
set_login_cookies(int $user, string $session_hash[, string $language = "" ][, bool $user_preferences = true ]) : void
Parameters
- $user : int
-
User ref
- $session_hash : string
-
User session hash
- $language : string = ""
-
Language code (e.g en)
- $user_preferences : bool = true
-
Set colour theme from user preferences
rs_password_hash()
ResourceSpace password hashing
rs_password_hash(string $password) : string|false
Parameters
- $password : string
-
Password
Tags
Return values
string|false —Password hash or false on failure
rs_password_verify()
ResourceSpace verify password
rs_password_verify(string $password, string $hash, array<string|int, mixed> $data) : bool
Parameters
- $password : string
-
Password
- $hash : string
-
Password hash
- $data : array<string|int, mixed>
-
Extra data required for matching hash expectations (e.g username, impersonate_user). Key is the variable name, value is the actual value for that variable.
Return values
boolget_password_hash_info()
Helper function to get the password hash information (algorithm and options) from the global scope.
get_password_hash_info() : array<string|int, mixed>
Return values
array<string|int, mixed>leaflet_osm_basemaps()
Generates OpenStreetMap basemaps for use in a Leaflet map.
leaflet_osm_basemaps() : string
This function defines various tile layers from OpenStreetMap and related providers, setting properties such as caching, retina display support, maximum zoom levels, and attribution for each layer.
Return values
string —JavaScript code that initializes the OSM basemaps for Leaflet.
leaflet_esri_basemaps()
Generates ESRI basemaps for use in a Leaflet map.
leaflet_esri_basemaps() : string
This function defines various tile layers from ESRI, setting properties such as caching, retina display support, maximum zoom levels, and attribution for each layer.
Return values
string —JavaScript code that initializes the ESRI basemaps for Leaflet.
leaflet_stamen_basemaps()
leaflet_stamen_basemaps() : mixed
leaflet_hydda_basemaps()
Generates Hydda basemaps for use in a Leaflet map.
leaflet_hydda_basemaps() : string
Return values
string —JavaScript code that initializes the Hydda basemaps for Leaflet.
leaflet_nasa_basemaps()
Generates NASA basemaps for use in a Leaflet map.
leaflet_nasa_basemaps() : string
Return values
string —JavaScript code that initializes the NASA basemaps for Leaflet.
leaflet_usgs_basemaps()
Generates USGS basemaps for use in a Leaflet map.
leaflet_usgs_basemaps() : string
Return values
string —JavaScript code that initializes the USGS basemaps for Leaflet.
leaflet_thunderforest_basemaps()
Generates Thunderforest basemaps for use in a Leaflet map.
leaflet_thunderforest_basemaps() : string
Return values
string —JavaScript code that initializes the Thunderforest basemaps for Leaflet.
leaflet_mapbox_basemaps()
leaflet_mapbox_basemaps() : mixed
leaflet_map_zoom()
Generates Mapbox basemaps for use in a Leaflet map.
leaflet_map_zoom(mixed $map_zoom) : string
This function initializes a Mapbox tile layer, requiring an API ID and access token. It also allows configuration for caching, retina display support, and attribution.
Parameters
- $map_zoom : mixed
Return values
string —JavaScript code that initializes the Mapbox basemap for Leaflet.
leaflet_polygon_parsing()
Parses the resource polygon string to extract latitude and longitude bounds and formats the polygon string.
leaflet_polygon_parsing(array<string|int, mixed> $fields[, bool $minmax = true ]) : array<string|int, mixed>
Parameters
- $fields : array<string|int, mixed>
-
The resource fields array containing polygon data.
- $minmax : bool = true
-
Flag to determine if minimum and maximum latitude and longitude values should be calculated.
Return values
array<string|int, mixed> —An associative array containing the minimum and maximum latitude and longitude values, as well as the formatted polygon string for Leaflet display.
leaflet_coordinate_check()
Validates geolocation coordinates to ensure they are numeric and within acceptable bounds.
leaflet_coordinate_check(mixed $coordinate, string $type) : bool
Parameters
- $coordinate : mixed
-
The coordinate value to check.
- $type : string
-
The type of coordinate ('latitude' or 'longitude').
Return values
bool —True if the coordinate is valid; otherwise, false.
leaflet_markers_legend()
Creates a map color markers legend for Leaflet maps.
leaflet_markers_legend() : void
This function generates HTML for a legend that displays markers with colors corresponding to resource types or custom metadata field values. If a custom metadata field is defined, the legend reflects that; otherwise, it shows the default resource types and their associated colors.
Return values
void —Outputs the HTML for the legend.
header_add_map_providers()
Adds map providers for Leaflet maps.
header_add_map_providers() : void
This function generates a JavaScript snippet that defines various tile layer providers for use in Leaflet maps.
It supports OpenStreetMap and ESRI basemaps, as well as custom providers defined in the global variable $geo_leaflet_sources.
The function also includes options for caching tile layers and handling different zoom levels and attribution.
Return values
void —Outputs the HTML and JavaScript for adding map providers to Leaflet.
get_geolibraries()
Checks the current page and includes necessary geolocation libraries for Leaflet maps.
get_geolibraries() : void
This function loads the Leaflet Control Geocoder plugin and checks if the current page requires geolocation capabilities. It also handles polyfills for browser compatibility, specifically for Internet Explorer and Edge.
Return values
void —Outputs the HTML and JavaScript for including geolocation libraries if applicable.
set_geo_map_centerview()
Set bounds for default map view (geo_search.php and geo_edit.php)
set_geo_map_centerview() : void
get_geo_maps_scripts()
Outputs the script tag for including additional Leaflet plugins.
get_geo_maps_scripts() : void
This function loads the necessary JavaScript for the Leaflet Marker Cluster library, which helps in managing large sets of markers on Leaflet maps by clustering them for better visualization.
Return values
void —Outputs the script tag for the Marker Cluster plugin.
message_get()
Gets messages for a given user (returns true if there are messages, false if not) Note that messages are passed by reference.
message_get(array<string|int, mixed> &$messages, int $user[, bool $expired = false ][, bool $seen = false ][, string $sort = "ASC" ][, string $order_by = "ref" ][, int $limit = 0 ]) : bool
Parameters
- $messages : array<string|int, mixed>
-
Array that will be populated by messages. Passed by reference
- $user : int
-
User ID
- $expired : bool = false
-
Include expired messages?
- $seen : bool = false
-
Include seen messages?
- $sort : string = "ASC"
-
Sort by message ID in ascending (ASC) or descending (DESC) order
- $order_by : string = "ref"
-
Order of messages returned
- $limit : int = 0
-
Limit the number of messages returned, defaults to 0 which is no limit
Return values
bool —Flag to indicate if any messages exist
message_add()
Add a new resourcespace system message
message_add(mixed $users, string $text[, string $url = "" ][, int $owner = null ][, int $notification_type = MESSAGE_ENUM_NOTIFICATION_TYPE_SCREEN ][, int $ttl_seconds = MESSAGE_DEFAULT_TTL_SECONDS ][, int $related_activity = 0 ][, int $related_ref = 0 ]) : void
Parameters
- $users : mixed
-
User ID, or array of user IDs
- $text : string
-
Message text
- $url : string = ""
-
URL to include as link in message
- $owner : int = null
-
ID of message creator/owner
- $notification_type : int = MESSAGE_ENUM_NOTIFICATION_TYPE_SCREEN
-
Message type e.g. MESSAGE_ENUM_NOTIFICATION_TYPE_SCREEN, MESSAGE_ENUM_NOTIFICATION_TYPE_EMAIL. See definitions.php
- $ttl_seconds : int = MESSAGE_DEFAULT_TTL_SECONDS
-
Lifetime of message in seconds before expiry
- $related_activity : int = 0
-
ID of related activity type - see SYSTEM NOTIFICATION TYPES section in definitions.php
- $related_ref : int = 0
-
Related activity ID - used with type above to delete redundant messages e.g. once a user or resource request has been approved
Tags
message_remove()
Remove a message from message table and associated user_messages
message_remove(int $message) : void
Parameters
- $message : int
-
Message ID
message_seen()
Mark a message as seen
message_seen(int $message[, int $seen_type = MESSAGE_ENUM_NOTIFICATION_TYPE_SCREEN ]) : void
Parameters
- $message : int
-
Message ID
- $seen_type : int = MESSAGE_ENUM_NOTIFICATION_TYPE_SCREEN
-
- see definitons.php
message_unseen()
Mark a message as unseen
message_unseen(int $message) : void
Parameters
- $message : int
-
Message ID
message_seen_all()
Flags all non-read messages as read for given user and seen type
message_seen_all(int $user[, int $seen_type = MESSAGE_ENUM_NOTIFICATION_TYPE_SCREEN ]) : void
Parameters
- $user : int
-
User ID
- $seen_type : int = MESSAGE_ENUM_NOTIFICATION_TYPE_SCREEN
-
- see definitons.php
message_purge()
Remove all messages from message and user_message tables that have expired (regardless of read).
message_purge() : void
This will be called from a cron job.
message_deleteselusrmsg()
Delete all selected messages
message_deleteselusrmsg(mixed $messages) : void
Parameters
- $messages : mixed
-
List of message refs in JSON list format
message_selectedseen()
Mark all selected messages as seen
message_selectedseen(mixed $messages) : void
Parameters
- $messages : mixed
-
List of message refs in JSON list format
message_selectedunseen()
Mark all selected messages as unseen
message_selectedunseen(mixed $messages) : void
Parameters
- $messages : mixed
-
List of message refs in JSON list format
message_send_unread_emails()
Send a summary of all unread notifications as an email from the standard cron_copy_hitcount
message_send_unread_emails() : bool
Return values
bool —Returns false if not due to run
message_remove_related()
Remove all messages related to a certain activity (e.g. resource request or resource submission) matching the given ref(s)
message_remove_related([int $remote_activity = 0 ][, mixed $remote_refs = array() ]) : void
Parameters
- $remote_activity : int = 0
-
ID of related activity type - see SYSTEM NOTIFICATION TYPES section in definitions.php
- $remote_refs : mixed = array()
-
Related activity ID or array of IDs
system_notification()
Send a system notification or email to the system administrators according to preference
system_notification(string $message[, string $url = "" ]) : void
Parameters
- $message : string
-
Message text
- $url : string = ""
-
Optional URL
message_getrefs()
Get all message refs for a given user
message_getrefs(string $user) : void
Parameters
- $user : string
-
User ID
message_get_conversation()
Get all messages between the given user IDs
message_get_conversation(int $user[, array<string|int, mixed> $msgusers = array() ][, array<string|int, mixed> $filteropts = array() ]) : array<string|int, mixed>
Parameters
- $user : int
- $msgusers : array<string|int, mixed> = array()
-
Array of other user IDs
- $filteropts : array<string|int, mixed> = array()
-
Array of extra options to filter and sort messages returned "msgfind" - (string) Text to find "sort_desc" - (bool) Sort by message ID in descending order? False = Ascending "limit" - (int) Maximum number of messages to return
Return values
array<string|int, mixed> —Array of messages
send_user_message()
Send a user to user(s) message
send_user_message(array<string|int, mixed> $users, string $text) : bool|string
Parameters
- $users : array<string|int, mixed>
-
Array of user IDs or usernames/groupnames from user select
- $text : string
-
Message text
Return values
bool|string —True if sent ok or error message
send_user_notification()
Send system notifications to specified users, checking the user preferences first if specified
send_user_notification(array<string|int, mixed> $users, ResourceSpaceUserNotification $notifymessage[, bool $forcemail = false ]) : array<string|int, mixed>
Parameters
- $users : array<string|int, mixed>
-
Array of user IDs or array of user details from get_users()
- $notifymessage : ResourceSpaceUserNotification
-
An instance of a ResourceSpaceUserNotification object holding message properties
- $forcemail : bool = false
-
Force system to send email instead of notification?
Return values
array<string|int, mixed> —Array containing resulting messages - can be used for testing when emails are not being sent This will contain two arrays:- "emails" array of emails sent, with the following elements:- "email" => Email address "subject" => Email subject "body" => Body text
"messages" Array of system messages sent with the following elements :-
"user" => User ID
"message" => message text
"url" => url
get_user_message()
Gets the user message for the given ref
get_user_message(int $ref[, bool $checkaccess = true ]) : array<string|int, mixed>|bool
Parameters
- $ref : int
-
Message ID
- $checkaccess : bool = true
-
Check if user can see the given message?
Return values
array<string|int, mixed>|bool —Array with two elements: 'message' => message text,'url'=> message URL and 'owner' => message owner False if user has no access or the requested message doesn't exist,
send_integrity_failure_notices()
Send notifications about file integrity failures
send_integrity_failure_notices(array<string|int, mixed> $failures) : void
Parameters
- $failures : array<string|int, mixed>
-
Array of resources that have failed integrity check
build_specialsearch_list_urls()
Limit the length of !list special search url by adding a maximum of 650 characters of resource references per link including separators.
build_specialsearch_list_urls(array<string|int, mixed> $resource_refs) : array<string|int, mixed>
Mail servers may break very long text strings into multiple lines and this will cause the special search to fail. Loading URLs of great length may also cause a Request-URI Too Long error in the browser. Multiple urls will be returned, formatted to include in action dates notifications.
Parameters
- $resource_refs : array<string|int, mixed>
-
Array containing resource references to include in url.
Return values
array<string|int, mixed> —Array containing 'single' value of url (650 characters of resources or less) and 'multiple' value of url (more than 650 characters of resources).
runFitsForFile()
Run FITS on a file and get the output back
runFitsForFile(string $file_path) : bool|SimpleXMLElement
Parameters
- $file_path : string
-
Physical path to the file
Tags
Return values
bool|SimpleXMLElementgetFitsMetadataFieldValue()
Get metadata value for a FITS field
getFitsMetadataFieldValue(SimpleXMLElement $xml, string $fits_field) : string
Parameters
- $xml : SimpleXMLElement
-
FITS metadata XML
- $fits_field : string
-
A ResourceSpace specific FITS field mapping which allows ResourceSpace to know exactly where to look for that value in XML by converting it to an XPath query string. Example: video.mimeType would point to
Tags
Return values
stringextractFitsMetadata()
Extract FITS metadata from a file for a specific resource.
extractFitsMetadata(string $file_path, int|array<string|int, mixed> $resource) : bool
Parameters
- $file_path : string
-
Path to the file from which you will extract FITS metadata
- $resource : int|array<string|int, mixed>
-
Resource ID or resource array (as returned by get_resource_data())
Tags
Return values
boolcheck_date_format()
Check date conforms to "yyyy-mm-dd hh:mm" format or any valid partital of that e.g. yyyy-mm.
check_date_format(mixed $date) : string
Parameters
- $date : mixed
Tags
Return values
stringcheck_date_parts()
Check datepart conforms to its formatting and error out each section accordingly
check_date_parts(mixed $parts) : string
Parameters
- $parts : mixed
Tags
Return values
stringupdate_fieldx()
updates the value of fieldx field further to a metadata field value update
update_fieldx(int $metadata_field_ref) : void
Parameters
- $metadata_field_ref : int
-
- metadata field ref
exiftool_resolution_calc()
Extract and store dimensions, resolution, and unit (if available) from exif data Exiftool output format (tab delimited): widthxheight resolution unit (e.g., 1440x1080 300 inches)
exiftool_resolution_calc(string $file_path, int $ref[, bool $remove_original = false ]) : void
Parameters
- $file_path : string
-
Path to the original file.
- $ref : int
-
Reference of the resource.
- $remove_original : bool = false
-
Option to remove the original record. Used by update_resource_dimensions.php
get_required_fields()
Return array containing data for all required fields that apply to the given resource type.
get_required_fields(int $resource_type) : array<string|int, mixed>
Parameters
- $resource_type : int
-
Resource type reference.
Return values
array<string|int, mixed>missing_fields_check()
For a given resource, return an array of data for required metadata field references which have not been completed.
missing_fields_check(int|array<string|int, mixed> $resource) : array<string|int, mixed>
Required fields shown by a display condition will only be considered required if the display condition is met.
Parameters
- $resource : int|array<string|int, mixed>
-
Integer representing the resource reference or array of resource data from get_resource_data().
Return values
array<string|int, mixed>update_archive_required_fields_check()
Considers if checking of missed required fields is required when a resource changes archive state. We'll always allow moving to the $resource_deletion_state and Pending Submission state (-2). Exceptions made to archive states in rse_workflow will be applied.
update_archive_required_fields_check(int|array<string|int, mixed> $resource, int $archive_state) : array<string|int, mixed>
Return will consist of an empty array where no checking is needed or an array of metadata field data where the field is required but was not completed.
Parameters
- $resource : int|array<string|int, mixed>
-
Resource ref or array of resource data, likely from get_resource_data().
- $archive_state : int
-
Destination archive state.
Return values
array<string|int, mixed>update_geolocation_fields()
Update the geo location fields (if set) for the given resource(s).
update_geolocation_fields(int|array<string|int, mixed> $resources, string|array<string|int, mixed> $location) : void
User permissions are not checked as this should be used in cases where the user has already edited the location.
Parameters
- $resources : int|array<string|int, mixed>
-
The resource ref(s) as a single integer or an array of integers.
- $location : string|array<string|int, mixed>
-
The new location to use, a blank string to clear the location from the resource(s). Otherwise an array with two integer values being the latitude and longitude.
migrate_resource_type_field_check()
migrate_resource_type_field_check(mixed &$resource_type_field) : mixed
Parameters
- $resource_type_field : mixed
migrate_category_tree_to_nodes()
migrate_category_tree_to_nodes(mixed $resource_type_field_ref, mixed $category_tree_options) : mixed
Parameters
- $resource_type_field_ref : mixed
- $category_tree_options : mixed
migrate_filter()
migrate_filter(mixed $filtertext[, mixed $allowpartialmigration = false ]) : mixed
Parameters
- $filtertext : mixed
- $allowpartialmigration : mixed = false
random_char()
Utility function to generate a random UTF8 character
random_char() : string
Return values
stringmix_date()
Utility function to randomly alter date by offset
mix_date(string $fromdate[, int $maxoffset = 30 ]) : string
Parameters
- $fromdate : string
-
- date string
- $maxoffset : int = 30
-
- Maximum number of days to offset
Return values
stringmix_text()
Utility function to randomly scramble string
mix_text(null|string $string[, bool $recurse = true ]) : string
Parameters
- $string : null|string
-
Text string to scramble
- $recurse : bool = true
-
Optionally prevent recursion (maybe called by another mix unction)
Return values
stringalter_data()
Utility function to randomly scramble data array for exporting
alter_data(array<string|int, mixed> &$row, mixed $key[, bool $scramblecolumns = array() ]) : void
Parameters
- $row : array<string|int, mixed>
-
- Array of data passed by reference
- $key : mixed
- $scramblecolumns : bool = array()
-
- Optional array of columns to scramble
mix_url()
Utility function to scramble a URL
mix_url(string $string) : string
Parameters
- $string : string
-
- URL to scramble
Return values
stringmix_filename()
Utility function to scramble a filename
mix_filename(string $string) : string
Parameters
- $string : string
-
- filename to scramble
Return values
stringmix_email()
Utility function to scramble an email address
mix_email(string $string) : string
Parameters
- $string : string
-
- email to scramble
Return values
stringsafe_export()
Utility function to escape and replace any empty strings with NULLS for exported SQL scripts
safe_export(null|string $value) : string
Parameters
- $value : null|string
-
Value to check
Return values
stringget_export_tables()
Get array of tables to export when exporting system config and data
get_export_tables([int $exportcollection = 0 ]) : array<string|int, mixed>
Parameters
- $exportcollection : int = 0
-
- Optional collection id to include resources and data from
Return values
array<string|int, mixed>edit_filter_to_restype_permission()
edit_filter_to_restype_permission(mixed $filtertext, mixed $usergroup, mixed $existingperms[, mixed $updatecurrent = false ]) : mixed
Parameters
- $filtertext : mixed
- $usergroup : mixed
- $existingperms : mixed
- $updatecurrent : mixed = false
set_node()
Set node - Used for both creating and saving a node in the database.
set_node(int $ref, int $resource_type_field, string $name, int $parent, int $order_by) : bool|int
Use NULL for ref if you just want to insert a new record.
Parameters
- $ref : int
-
ID of the node. To insert new record ID should be NULL
- $resource_type_field : int
-
ID of the metadata field
- $name : string
-
Node name to be used (international)
- $parent : int
-
ID of the parent of this node (null for non trees)
- $order_by : int
-
Value of the order in the list (e.g. 10). To automatically pick next order by use ''.
Tags
Return values
bool|intdelete_node()
Delete node. This will fully delete a node and remove any association between the deleted node and resources / keywords.
delete_node(int $ref) : void
Parameters
- $ref : int
-
ID of the node
delete_nodes_for_resource_type_field()
Delete all nodes for a resource type field
delete_nodes_for_resource_type_field(mixed $ref) : void
Parameters
- $ref : mixed
get_node()
Get a specific node by ref
get_node(int $ref, array<string|int, mixed> &$returned_node[, bool $cache = true ]) : bool
Parameters
- $ref : int
-
ID of the node
- $returned_node : array<string|int, mixed>
-
If a value does exist it will be returned through this parameter which is passed by reference
- $cache : bool = true
-
By default this function returns cached data. This may not be appropriate if called after a value has been changed, for example after editing a node name. Set to false to not use cache.
Tags
Return values
boolget_nodes()
Get all nodes from database for a specific metadata field or parent.
get_nodes([int $resource_type_field = null ][, int $parent = null ][, bool $recursive = false ][, int $offset = null ][, int $rows = null ][, string $name = '' ][, bool $use_count = false ][, bool $order_by_translated_name = false ][, bool $exact_match = false ]) : array<string|int, mixed>
Use $parent = NULL and recursive = TRUE to get all nodes for a category tree field
Use $offset and $rows only when returning a subset.
Parameters
- $resource_type_field : int = null
-
ID of the metadata field
- $parent : int = null
-
ID of parent node
- $recursive : bool = false
-
Set to true to get children nodes as well. IMPORTANT: this is normally used with category trees, but can also be used with other fixed field types which allow multiple values eg. dynamic keywords list and checkbox list. This allows field type changes to be made between these three types without losing sight of all nodes.
- $offset : int = null
-
Specifies the offset of the first row to return
- $rows : int = null
-
Specifies the maximum number of rows to return. IMPORTANT! For non-fixed list fields this is capped at 10000 to avoid out of memory errors
- $name : string = ''
-
Filter by name of node
- $use_count : bool = false
-
Show how many resources use a particular node in the node properties
- $order_by_translated_name : bool = false
-
Flag to order by translated names rather then the order_by column
- $exact_match : bool = false
-
When $name is supplied, match the exact name only instead of returning matches containing the $name string.
Tags
Return values
array<string|int, mixed>get_nodes_by_refs()
Find and return node details for a list of node IDs.
get_nodes_by_refs(array<string|int, mixed> $refs) : array<string|int, mixed>
Parameters
- $refs : array<string|int, mixed>
-
List of node IDs
Return values
array<string|int, mixed>is_parent_node()
Checks whether a node is parent to other nodes or not
is_parent_node(int $ref[, bool $active_only = false ]) : bool
Parameters
- $ref : int
-
Node ref
- $active_only : bool = false
-
Check only for active (children) nodes
Return values
boolget_tree_node_level()
Determine how many level deep a node is. Useful for knowing how much to indent a node
get_tree_node_level(int $ref) : int
Parameters
- $ref : int
-
Node ref
Return values
int —The depth value of a tree node
get_all_ancestors_for_node()
Return a row consisting of all ancestor nodes of a given node Example: 1 2 2.3 2.7 2.8.4 2.8.5 2.8.6 2.9 3 Passing in node 5 will return nodes 8,2 in one row
get_all_ancestors_for_node(int $ref, int $level) : array<string|int, mixed>|bool
Parameters
- $ref : int
-
A tree node
- $level : int
-
Node depth level (as returned by get_tree_node_level())
Return values
array<string|int, mixed>|boolreorder_node()
Function used to reorder nodes based on an array with nodes in the new order
reorder_node(array<string|int, mixed> $nodes_new_order) : void
Parameters
- $nodes_new_order : array<string|int, mixed>
-
Array of nodes
reorder_nodes()
Virtually re-order nodes
reorder_nodes(array<string|int, mixed> $unordered_nodes) : array<string|int, mixed>
Temporarily re-order nodes (mostly) for display purposes
Parameters
- $unordered_nodes : array<string|int, mixed>
-
Original nodes array
Return values
array<string|int, mixed>render_new_node_record()
Renders HTML for adding a new node record in the database
render_new_node_record(string $form_action, bool $is_tree[, int $parent = 0 ][, int $node_depth_level = 0 ][, array<string|int, mixed> $parent_node_options = array() ]) : void
Parameters
- $form_action : string
-
Set the action path of the form
- $is_tree : bool
-
Set to TRUE if the field is category tree type
- $parent : int = 0
-
ID of the parent of this node
- $node_depth_level : int = 0
-
When rendering for trees, we need to know how many levels deep we need to render it
- $parent_node_options : array<string|int, mixed> = array()
-
Array of node options to be used as parent for new records
get_node_order_by()
Calculate the next order by for a new record
get_node_order_by(int $resource_type_field[, bool $is_tree = false ][, int $parent = null ]) : int
Parameters
- $resource_type_field : int
-
ID of the metadata field
- $is_tree : bool = false
-
Param to flag whether this is for a tree node
- $parent : int = null
-
ID of the parent of this node
Return values
int —$order_by
draw_tree_node_table()
Renders HTML for a tree node
draw_tree_node_table(int $ref, int $resource_type_field, string $name, int $parent, int $order_by[, bool $last_node = false ][, int $use_count = 0 ]) : bool
Parameters
- $ref : int
-
ID of the node
- $resource_type_field : int
-
ID of the metadata field
- $name : string
-
Node name to be used (international)
- $parent : int
-
ID of the parent of this node
- $order_by : int
-
Value of the order in the list (e.g. 10)
- $last_node : bool = false
-
Set to true to allow to insert new records after last node in each level
- $use_count : int = 0
-
Counter of how many resources use a particular node
Return values
boolnode_field_options_override()
Overrides either a field[options] array structure or a flat option array with values derived from nodes.
node_field_options_override(mixed &$field[, int $resource_type_field = null ]) : bool
If a field, then will also add field=>nodes[] sub array ready for field rendering.
Parameters
- $field : mixed
-
Either field array structure or flat options list array
- $resource_type_field : int = null
-
ID of the metadata field, if specified will treat as flat options list
Return values
booladd_node_keyword()
Adds node keyword for indexing purposes
add_node_keyword(int $node, string $keyword, int $position[, mixed $normalize = true ][, mixed $stem = true ]) : bool
Parameters
- $node : int
-
ID of the node (from node table) the keyword should be linked to
- $keyword : string
-
Keyword to index
- $position : int
-
The position of the keyword in the string that was indexed
- $normalize : mixed = true
- $stem : mixed = true
Return values
boolremove_node_keyword()
Removes node keyword for indexing purposes
remove_node_keyword(int $node, string $keyword, int $position[, bool $normalized = false ]) : void
Parameters
- $node : int
-
ID of the node (from node table) the keyword should be linked to
- $keyword : string
-
Keyword to index
- $position : int
-
The position of the keyword in the string that was indexed
- $normalized : bool = false
-
If this keyword is normalized by the time we add it, set as true
remove_all_node_keyword_mappings()
Removes all indexed keywords for a specific node ID
remove_all_node_keyword_mappings(int $node) : void
Parameters
- $node : int
-
Node ID
check_node_indexed()
Function used to check if a fields' node needs (re-)indexing
check_node_indexed(array<string|int, mixed> $node[, bool $partial_index = false ]) : void
Parameters
- $node : array<string|int, mixed>
-
Individual node for a field ( as returned by get_nodes() )
- $partial_index : bool = false
-
Partially index flag for node keywords
add_node_keyword_mappings()
Function used to index node keywords
add_node_keyword_mappings(array<string|int, mixed> $node[, bool|null $partial_index = false ][, bool $is_date = false ][, bool $is_html = false ]) : bool
Parameters
- $node : array<string|int, mixed>
-
Individual node for a field ( as returned by get_nodes() )
- $partial_index : bool|null = false
-
Partially index flag for node keywords. Use NULL if code doesn't have access to the fields' data
- $is_date : bool = false
- $is_html : bool = false
Return values
boolremove_node_keyword_mappings()
Function used to un-index node keywords
remove_node_keyword_mappings(array<string|int, mixed> $node[, bool|null $partial_index = false ]) : bool
Parameters
- $node : array<string|int, mixed>
-
Individual node for a field ( as returned by get_nodes() )
- $partial_index : bool|null = false
-
Partially index flag for node keywords. Use NULL if code doesn't have access to the fields' data
Return values
booladd_resource_nodes()
Add nodes in array to resource
add_resource_nodes(int $resourceid[, array<string|int, mixed> $nodes = array() ][, bool $checkperms = true ][, bool $logthis = true ]) : bool
Parameters
- $resourceid : int
-
Resource ID to add nodes to
- $nodes : array<string|int, mixed> = array()
-
Array of node IDs to add
- $checkperms : bool = true
-
Check permissions before adding?
- $logthis : bool = true
-
Log this? Log entries are ideally added when more data on all the changes made is available to make reverts easier.
Tags
Return values
booladd_resource_nodes_multi()
Add nodes in array to multiple resources. Changes made using this function will not be logged by default.
add_resource_nodes_multi([array<string|int, mixed> $resources = array() ][, array<string|int, mixed> $nodes = array() ][, bool $checkperms = true ][, bool $logthis = false ]) : bool
Parameters
- $resources : array<string|int, mixed> = array()
-
Array of resource IDs to add nodes to
- $nodes : array<string|int, mixed> = array()
-
Array of node IDs to add
- $checkperms : bool = true
-
Check permissions before adding?
- $logthis : bool = false
-
Log this? Log entries are ideally added when more data on all the changes made is available to make reverts easier.
Return values
boolget_resource_nodes()
Get nodes associated with a particular resource for all / a specific field (optionally)
get_resource_nodes(int $resource[, int $resource_type_field = null ][, bool $detailed = false ][, bool $node_sort = null ]) : array<string|int, mixed>
Parameters
- $resource : int
- $resource_type_field : int = null
- $detailed : bool = false
-
Set to true to return full node details (as get_node() does)
- $node_sort : bool = null
-
Set to SORT_ASC to sort nodes ascending, SORT_DESC sort nodes descending, null means do not sort
Tags
Return values
array<string|int, mixed>get_resources_nodes_by_rtf()
Get all resource nodes associated for a specific resource type field.
get_resources_nodes_by_rtf(int $ref) : Generator
Parameters
- $ref : int
-
Resource type field ID
Return values
Generatordelete_resource_nodes()
Delete nodes in array from resource
delete_resource_nodes(int $resourceid[, array<string|int, mixed> $nodes = array() ][, bool $logthis = true ]) : void
Parameters
- $resourceid : int
-
Resource ID to add nodes to
- $nodes : array<string|int, mixed> = array()
-
Array of node IDs to remove
- $logthis : bool = true
-
Log this? Log entries are ideally added when more data on all changes made is available to make reverts easier.
Tags
delete_resource_nodes_multi()
Delete all node relationships matching the passed resource IDs and node IDs.
delete_resource_nodes_multi([array<string|int, mixed> $resources = array() ][, mixed $nodes = array() ]) : void
Parameters
- $resources : array<string|int, mixed> = array()
-
An array of resource IDs
- $nodes : mixed = array()
-
An integer or array of single/multiple nodes
delete_all_resource_nodes()
Delete all node relationships for the given resource.
delete_all_resource_nodes(int $resourceid) : void
Parameters
- $resourceid : int
-
The resource ID
delete_node_resources()
Delete all resource node relationships for the given node.
delete_node_resources(int $node) : void
Parameters
- $node : int
-
The node ID to remove from all resources.
copy_resource_nodes()
Copy resource nodes from one resource to another. Only applies for active metadata fields.
copy_resource_nodes(int $resourcefrom, int $resourceto) : void
Parameters
- $resourcefrom : int
-
Resource we are copying data from
- $resourceto : int
-
Resource we are copying data to
copy_resource_type_field_nodes()
Copy all nodes from one metadata field to another one.
copy_resource_type_field_nodes(int $from, int $to) : bool
Used mostly with copy field functionality
Parameters
- $from : int
-
resource_type_field ID FROM which we copy
- $to : int
-
resource_type_field ID TO which we copy
Return values
boolget_parent_nodes()
Get all the parent nodes of the given node, all the way back to the top of the node tree.
get_parent_nodes(int $noderef[, bool $detailed = false ][, bool $include_child = false ]) : array<string|int, mixed>
Parameters
- $noderef : int
-
The child node ID
- $detailed : bool = false
-
Return all node data? false by default
- $include_child : bool = false
-
Include the passed node in the returned array (easier for resolving tree nodes to paths)? false by default
Return values
array<string|int, mixed> —Array of the parent node IDs
get_nodes_count()
Get the total number of nodes for a specific field
get_nodes_count(int $resource_type_field[, string $name = '' ]) : int
Parameters
- $resource_type_field : int
-
ID of the metadata field
- $name : string = ''
-
Filter by name of node
Return values
intextract_node_options()
Extract option names (in raw form if desired) from a nodes array.
extract_node_options(array<string|int, mixed> $nodes[, bool $i18n = true ][, bool $index_with_node_id = true ]) : array<string|int, mixed>
Parameters
- $nodes : array<string|int, mixed>
-
Array of nodes as returned by get_nodes()
- $i18n : bool = true
-
Set to false if you don't need to translate the option name
- $index_with_node_id : bool = true
-
Set to false if you don't want a map between node ID and its name
Tags
Return values
array<string|int, mixed>get_node_by_name()
Search an array of nodes by name
get_node_by_name(array<string|int, mixed> $nodes, string $name[, bool $i18n = true ]) : array<string|int, mixed>
Useful to avoid querying the database multiple times if we already have a full detail array of nodes
Parameters
- $nodes : array<string|int, mixed>
-
Nodes array as returned by get_nodes()
- $name : string
-
Filter by name of node
- $i18n : bool = true
-
Use the translated option value?
Tags
Return values
array<string|int, mixed>get_node_id()
Return a node ID for a given string
get_node_id(string $value, int $resource_type_field) : false|int
Parameters
- $value : string
-
The node name to return
- $resource_type_field : int
-
The field to search
Return values
false|int —false = not found integer = node ID of matching keyword.
node_translated_name_comparator()
Comparator function for uasort to allow sorting of node array by translated name
node_translated_name_comparator(array<string|int, mixed> $n1, string $n2) : 0
Parameters
- $n1 : array<string|int, mixed>
-
Node one to compare
- $n2 : string
-
Node two to compare
Return values
0 —means $n1 equals $n2 <0 means $n1 less than $n2
0 means $n1 greater than $n2
node_orderby_comparator()
Comparator function for uasort to allow sorting of node array by order_by field
node_orderby_comparator(array<string|int, mixed> $n1, string $n2) : 0
Parameters
- $n1 : array<string|int, mixed>
-
Node one to compare
- $n2 : string
-
Node two to compare
Return values
0 —means $n1 equals $n2 <0 means $n1 less than $n2
0 means $n1 greater than $n2
get_node_elements()
This function returns an array containing list of values for a selected field, identified by $field_label, in the multidimensional array $nodes
get_node_elements(array<string|int, mixed> $node_values, array<string|int, mixed> $nodes, string $field_label) : array<string|int, mixed>
Parameters
- $node_values : array<string|int, mixed>
-
- list of values for a selected field in the node tree
- $nodes : array<string|int, mixed>
-
- node tree to parse
- $field_label : string
-
- node field to retrieve value of and add to array $node_values
Return values
array<string|int, mixed> —$node_values
get_node_tree()
This function returns a multidimensional array with hierarchy that reflects category tree field hierarchy, using parent and order_by fields
get_node_tree([string $parentId = "" ][, array<string|int, mixed> $nodes = array() ]) : array<string|int, mixed>
Parameters
- $parentId : string = ""
-
- elements at top of tree do not have a value for "parent" field, so default value is empty string, otherwise it is the value of the parent element in tree
- $nodes : array<string|int, mixed> = array()
-
- node tree to parse and order
Return values
array<string|int, mixed> —$tree - multidimension array containing nodes in correct hierarchical order
get_cattree_nodes_ordered()
This function returns an array of category tree nodes in the hierarchical sequence defined in manage options
get_cattree_nodes_ordered(array<string|int, mixed> $treefield[, int $resource = null ][, array<string|int, mixed> $allnodes = false ]) : array<string|int, mixed>
Parameters
- $treefield : array<string|int, mixed>
-
- the category tree field to be processed
- $resource : int = null
-
- the resource against which to check for selected nodes - optional
- $allnodes : array<string|int, mixed> = false
-
- is true if all nodes in the structure are returned, false if only selected nodes are returned
Return values
array<string|int, mixed> —$flatnodes - the array of nodes returned in correct hierarchical order
get_cattree_node_strings()
This function returns an array of category tree node strings in the hierarchical sequence defined in manage options The returned strings are i18 translated
get_cattree_node_strings(array<string|int, mixed> $nodesordered[, array<string|int, mixed> $strings_are_paths = true ]) : array<string|int, mixed>
Parameters
- $nodesordered : array<string|int, mixed>
-
- the array of nodes in correct hierarchical order
- $strings_are_paths : array<string|int, mixed> = true
-
- governs the format of the name returned True (default) strings are paths to nodes; False strings are the individual node names
Return values
array<string|int, mixed> —$strings - the returned array of node paths or node names
cattree_node_creator()
Helper function for building node entry arrays for ordering
cattree_node_creator(int $ref, int $resource_type_field, string $name, int $parent, int $order_by, int $resource, array<string|int, mixed> $children, int $active) : array<string|int, mixed>
Parameters
- $ref : int
-
Node id
- $resource_type_field : int
-
Category tree field id
- $name : string
-
Node name
- $parent : int
-
Parent node id
- $order_by : int
-
Node order by
- $resource : int
-
Resource id
- $children : array<string|int, mixed>
-
Array of child node ids
- $active : int
-
Node active state (0 or 1)
Return values
array<string|int, mixed>cattree_node_flatten()
Helper function which adds child nodes after each flattened parent node
cattree_node_flatten(array<string|int, mixed> $node) : array<string|int, mixed>
Parameters
- $node : array<string|int, mixed>
-
Array of nodes each with a child node array
Return values
array<string|int, mixed> —Array of nodes with child nodes flattened out after their respective parents
get_node_strings()
This function returns an array of strings that represent the full paths to each tree node passed
get_node_strings(array<string|int, mixed> $resource_nodes[, bool $allnodes = false ][, bool $translate = true ]) : array<string|int, mixed>
Parameters
- $resource_nodes : array<string|int, mixed>
-
- node tree to parse
- $allnodes : bool = false
-
- include paths to all nodes -if false will just include the paths to the end leaf nodes
- $translate : bool = true
-
- translate strings?
Return values
array<string|int, mixed> —$nodestrings - array of strings for all nodes passed in correct hierarchical order
compute_node_branch_path()
Get to the root of the branch starting from a node.
compute_node_branch_path(array<string|int, mixed> $nodes, int $id) : array<string|int, mixed>
IMPORTANT: the term nodes here is generic, it refers to a tree node structure containing at least ref and parent
Parameters
- $nodes : array<string|int, mixed>
-
List of nodes to search through (MUST contain elements with at least the "ref" index)
- $id : int
-
Node ref we compute the branch path for
Return values
array<string|int, mixed> —Branch path structure starting from root to the searched node (inclusive)
compute_nodes_by_parent()
Find all nodes with parent
compute_nodes_by_parent(array<string|int, mixed> $nodes, int $id) : array<string|int, mixed>
Parameters
- $nodes : array<string|int, mixed>
-
List of nodes to search through (MUST contain elements with at least the "parent" index)
- $id : int
-
Parent node ref to search by
Return values
array<string|int, mixed>get_resource_nodes_batch()
Get all nodes for given resources and fields. Returns a multidimensional array wth resource IDs as top level indexes and field IDs as second level indexes
get_resource_nodes_batch(array<string|int, mixed> $resources[, array<string|int, mixed> $resource_type_fields = array() ][, bool $detailed = false ][, bool $node_sort = null ]) : array<string|int, mixed>
Parameters
- $resources : array<string|int, mixed>
- $resource_type_fields : array<string|int, mixed> = array()
- $detailed : bool = false
-
Set to true to return full node details (as get_node() does)
- $node_sort : bool = null
-
Set to SORT_ASC to sort nodes ascending, SORT_DESC sort nodes descending, null means do not sort
Return values
array<string|int, mixed>process_node_search_syntax_to_names()
Process one of the columns whose value is a search string containing nodes (e.g @@228@229, @@555) and mutate input array by adding a new column (named $column + '_node_name') which will hold the nodes found in the search string and their translated names
process_node_search_syntax_to_names(array<string|int, mixed> $R, string $column) : array<string|int, mixed>
Parameters
- $R : array<string|int, mixed>
-
Generic type for array (e.g DB results). Each value is a result row.
- $column : string
-
Record column which needs to be checked and its value converted (if applicable)
Return values
array<string|int, mixed>delete_unused_non_fixed_list_nodes()
Delete unused non-fixed list field nodes with a 1:1 resource association
delete_unused_non_fixed_list_nodes(int $resource_type_field) : mixed
Parameters
- $resource_type_field : int
-
Resource type field (metadata field) ID
remove_invalid_node_keyword_mappings()
Delete invalid node_keyword associations. Note, by invalid, it's meant where the node is missing.
remove_invalid_node_keyword_mappings() : mixed
remove_invalid_resource_node_mappings()
Delete invalid resource_node associations. Note, by invalid, it's meant where the node is missing.
remove_invalid_resource_node_mappings() : mixed
get_nodes_use_count()
Get a count of how many resources are using the specified nodes
get_nodes_use_count(array<string|int, mixed> $nodes) : array<string|int, mixed>
Parameters
- $nodes : array<string|int, mixed>
-
Array of node refs
Return values
array<string|int, mixed> —Array of node ref as keys and number of resources using them as the values
check_delete_nodes()
Check array of nodes and delete any that relate to non-fixed list fields and are unused
check_delete_nodes(array<string|int, mixed> $nodes) : mixed
Parameters
- $nodes : array<string|int, mixed>
-
Array of node IDs
remove_field_keywords()
Delete all keywords for all nodes associated with the specified field
remove_field_keywords(int $field) : void
Parameters
- $field : int
-
Field ID
update_resource_node_hitcount()
For the specified $resource, increment the hitcount for each node in array
update_resource_node_hitcount(int $resource, array<string|int, mixed> $nodes) : void
Parameters
- $resource : int
- $nodes : array<string|int, mixed>
order_tree_nodes()
Order array of tree nodes into logical order - Each parent followed by its child nodes, all following order_by
order_tree_nodes(array<string|int, mixed> $nodes[, mixed $order_by_translated_name = false ]) : array<string|int, mixed>
Parameters
- $nodes : array<string|int, mixed>
-
Array of detailed nodes
- $order_by_translated_name : mixed = false
Return values
array<string|int, mixed> —Full nodes in order
add_sql_node_language()
Append SQL to an existing node query to obtain the translated names of the node
add_sql_node_language(string &$sql_select, array<string|int, mixed> &$sql_params[, string $alias = "node" ]) : void
Parameters
- $sql_select : string
-
SQL query
- $sql_params : array<string|int, mixed>
-
Array of SQL parameters
- $alias : string = "node"
migrate_fixed_to_text()
Migrate fixed list field data to text field data for a given resource reference. Useful when changing resource type field from a data type that can contain multiple values such as a dynamic keywords field. This script will concatenate the existing values and leave one remaining node for the new text field.
migrate_fixed_to_text(mixed $resource_type_field, mixed $resource, mixed $category_tree[, mixed $separator = ', ' ]) : bool
Parameters
- $resource_type_field : mixed
-
Resource type field id. ** The field type should have been changed to a text type in advance
- additional checks maybe need before calling this to ensure the fields are / were of the expected type. see examples in pages/tools/migrate_fixed_to_text.php **
- $resource : mixed
-
Resource reference to be processed.
- $category_tree : mixed
-
Was the field data being migrated previously of type category tree? Specifying true will allow the format of category tree branches to be preserved e.g. "level1/value, level2/value"
- $separator : mixed = ', '
-
Default is comma and space e.g. "value1, value2"
Return values
bool —True on success else false.
cleanup_invalid_nodes()
Remove invalid field data from resources, optionally just for the specified resource types and/or fields
cleanup_invalid_nodes([array<string|int, mixed> $fields = [] ][, array<string|int, mixed> $restypes = [] ][, bool $dryrun = false ]) : int
Parameters
- $fields : array<string|int, mixed> = []
-
=[] Array of resource_type_field refs
- $restypes : array<string|int, mixed> = []
-
=[] Array of resource_type refs
- $dryrun : bool = false
-
Don't delete, just return count of rows that will be affected
Return values
int —Count of rows deleted/to delete
update_node_active_state()
Batch update nodes' active state to the database. The same state will apply to all nodes in the list.
update_node_active_state(array<int, int> $refs, bool $active) : void
For logic on which nodes to toggle toggle_active_state_for_nodes()
Parameters
- $refs : array<int, int>
-
Node IDs
- $active : bool
-
Should nodes be active or not?
toggle_active_state_for_nodes()
Toggle nodes' active state
toggle_active_state_for_nodes(array<int, int> $refs) : array<int, 0|1>
Parameters
- $refs : array<int, int>
-
Node IDs
Return values
array<int, 0|1>toggle_category_tree_nodes_active_state()
Toggle category tree nodes' active state
toggle_category_tree_nodes_active_state(int $rtf, array<int, int> $node_refs) : array<int, 0|1>
Parameters
- $rtf : int
-
Resource type field ID
- $node_refs : array<int, int>
Return values
array<int, 0|1>node_is_active()
Helper function to check if a node is active Note: a node here requires the "active" key.
node_is_active(array{'active': 0|1} $node) : bool
Parameters
- $node : array{'active': 0|1}
-
A node structure with at least the "active" key present
Return values
boolsuggest_dynamic_keyword_nodes()
Suggest dynamic keyword nodes. Used by pages/edit_fields/9_ajax/suggest_keywords.php
suggest_dynamic_keyword_nodes(int $field, string $keyword, bool $readonly) : array<string|int, mixed>
Parameters
- $field : int
-
Metadata field ID
- $keyword : string
-
String to match
- $readonly : bool
-
Add an option to add new node if no exact match
Return values
array<string|int, mixed>get_pdf_template_path()
Returns the path to a pdf template
get_pdf_template_path(string $resource_type[, string $template_name = '' ]) : string
Parameters
- $resource_type : string
-
ID of the resource type
- $template_name : string = ''
-
Known template name already found in the array
Return values
stringgenerate_pdf()
Takes an HTML template suitable for HTML2PDF library and generates a PDF file if successfull
generate_pdf(string $html_template_path, string $filename[, array<string|int, mixed> $bind_placeholders = array() ][, bool $save_on_server = false ][, array<string|int, mixed> $pdf_properties = array() ]) : bool
Parameters
- $html_template_path : string
-
HTML template path
- $filename : string
-
The file name of the generated PDF file. If this is an actual path, and $save_on_server = true, it will be save on the server
- $bind_placeholders : array<string|int, mixed> = array()
-
A map of all the values that are meant to replace any placeholders found in the HTML template
- $save_on_server : bool = false
-
If true, PDF file will be saved to the filename path
- $pdf_properties : array<string|int, mixed> = array()
-
Properties of the PDF file (e.g. author, title, font, margins)
Return values
boolget_template_path()
Returns the path to any template in the system.
get_template_path(string $template_name, string $template_namespace) : string
Returns the path to any templates in the system as long as they are saved in the correct place:
- /templates (default - base templates)
- /filestore/system/templates (custom templates) Templates will be structured in folders based on features (e.g templates/contact_sheet/ will be used for any templates used for contact sheets)
Parameters
- $template_name : string
-
Template names should contain the extension as well (e.g. template_1.php / template_1.html)
- $template_namespace : string
-
The name by which multiple templates are grouped together
Return values
stringprocess_template()
Function used to process a template
process_template(string $template_path[, array<string|int, mixed> $bind_placeholders = array() ]) : string
Process template and bind any placeholders. The template should contain (if needed) PHP statements which will will be processed through this function.
Parameters
- $template_path : string
-
The full path to the location of the template (as returned by get_template_path())
- $bind_placeholders : array<string|int, mixed> = array()
-
A map of all the values that are meant to replace any placeholders found in the template
Return values
stringprocess_if_statements()
Process a string (mainly HTML) which contains if statement placeholders and return the processed string
process_if_statements(string $original_string, array<string|int, mixed> $bind_params) : string
Handles [%if var is set%] [%endif%] type of placeholders
Parameters
- $original_string : string
-
Full string containing placeholders
- $bind_params : array<string|int, mixed>
-
A map of all the values that are meant to replace any placeholders found in the HTML template
Return values
stringresolve_pdf_language()
Function to convert the user's language into an HTML2PDF supported language.
resolve_pdf_language() : string
Scans the HTML2PDF locale folder to create a list of supported languages to compare against the set user language. Also resolves dialects when possible. Fallback set to 'en'.
Return values
stringget_pdf_templates()
Returns an array of available PDF template names *
get_pdf_templates(string $template_namespace) : mixed
Parameters
- $template_namespace : string
-
The name by which multiple templates are grouped together e.g. contact_sheet
Tags
activate_plugin()
Activate a named plugin.
activate_plugin(string $name) : bool
Parses the plugins directory to look for a pluginname.yaml file and adds the plugin to the plugins database, setting the inst_version field to the version specified in the yaml file.
Parameters
- $name : string
-
Name of plugin to be activated.
Tags
Return values
bool —Returns true if plugin directory was found.
deactivate_plugin()
Deactivate a named plugin.
deactivate_plugin(string $name) : void
Blanks the inst_version field in the plugins database, which has the effect of deactivating the plugin while maintaining any configuration that is stored in the database.
Parameters
- $name : string
-
Name of plugin to be deativated.
Tags
purge_plugin_config()
Purge configuration of a plugin.
purge_plugin_config(string $name) : mixed
Replaces config value in plugins table with NULL. Note, this function will operate on an activated plugin as well so its configuration can be 'defaulted' by the plugin's configuration page.
Parameters
- $name : string
-
Name of plugin to purge configuration.
Tags
get_plugin_yaml()
Load plugin .yaml file.
get_plugin_yaml(string $plugin[, bool $validate = true ][, bool $translate = true ]) : array<string|int, mixed>|bool
Load a .yaml file for a plugin and return an array of its values.
Parameters
- $plugin : string
-
Name of the plugin
- $validate : bool = true
-
Check that the .yaml file is complete. [optional, default=false]
- $translate : bool = true
-
Translate the contents to the user's selected language (default=true)
Return values
array<string|int, mixed>|bool —Associative array of yaml values. If validate is false, this function will return an array of blank values if a yaml isn't available
config_json_encode()
A subset json_encode function that only works on $config arrays but has none of the version-to-version variability and other "unusual" behavior of PHP's.
config_json_encode(mixed $config) : string
implementation.
Parameters
- $config : mixed
-
mixed a configuration variables array. This must be an array whose elements are UTF-8 encoded strings, booleans, numbers or arrays of such elements and whose keys are either numbers or UTF-8 encoded strings.
Return values
string —encoded version of $config or null if $config is beyond our capabilities to encode
config_encode()
Utility function to encode the passed string to something that conforms to the json spec for a string. Json doesn't allow strings with double-quotes, backslashes or control characters in them. For double-quote and backslash, the encoding is '\"' and '\\' respectively. The encoding for control characters is of the form '\uxxx' where "xxx" is the UTF-8 4-digit hex value of the encoded character.
config_encode(mixed $input) : an
Parameters
- $input : mixed
-
string the string that needs encoding
Return values
an —encoded version of $input
get_plugin_config()
Return plugin config stored in plugins table for a given plugin name.
get_plugin_config(string $name) : mixed|null
Queries the plugins table for a stored config value and, if found, unserializes the data and returns the result. If config isn't found returns null.
Parameters
- $name : string
-
Plugin name
Tags
Return values
mixed|null —Returns config data or null if no config.
set_plugin_config()
Store a plugin's configuration in the database.
set_plugin_config(string $plugin_name, mixed $config) : mixed
Serializes the $config parameter and stores in the config
and config_json columns of the plugins table.
Parameters
- $plugin_name : string
-
Plugin name
- $config : mixed
-
Configuration variable to store.
Tags
is_plugin_activated()
Check if a plugin is activated.
is_plugin_activated(mixed $name) : bool
Returns true is a plugin is activated in the plugins database.
Parameters
- $name : mixed
-
Name of plugin to check
Return values
bool —Returns true is plugin is activated.
get_active_plugins()
Get active plugins
get_active_plugins() : array<string|int, mixed>
Return values
array<string|int, mixed>config_gen_setup_post()
Generate the first half of the "guts" of a plugin setup page from a page definition array. This function deals with processing the POST that comes (usually) as a result of clicking on the Save Configuration button.
config_gen_setup_post(mixed $page_def, mixed $plugin_name) : void|string
The page definition array is typically constructed by a series of calls to config_add_xxxx functions (see below). See the setup page for the sample plugin for information on how to use this and the associated functions.
If wishing to store array of values in one config option, in your setup page have something like the following which adds a single definition for each key of your config option: foreach($usergroups as $k => $group) { global $usergroupemails; if(!isset($usergroupemails[$group["ref"]])){$usergroupemails[$group["ref"]]=array();} // Define any missing keys $page_def[] = config_add_text_list_input("usergroupemails[".$group["ref"]."]",$group["name"]); //need to pass a string that looks like: "$configoption["key"]" } The key can consist of numbers, letters or an underscore contained within "" or ''. If using numbers you don't need the quote marks
Parameters
- $page_def : mixed
-
mixed an array whose elements are generated by calls to config_add_xxxx functions each of which describes how one of the plugin's configuration variables.
- $plugin_name : mixed
-
string the name of the plugin for which the function is being invoked.
Return values
void|string —Returns NULL
config_gen_setup_html()
Generate the second half of the "guts" of a plugin setup page from a page definition array. The page definition array is typically constructed by a series of calls to config_add_xxxx functions (see below). See the setup page for the sample plugin for information on how to use this and the associated functions.
config_gen_setup_html(mixed $page_def, mixed $plugin_name, mixed $upload_status, mixed $plugin_page_heading[, mixed $plugin_page_frontm = '' ]) : mixed
If wishing to ouput array of values for one config option, in your setup page have something like the following which adds a single definition for each key of your config option: foreach($usergroups as $k => $group) { global $usergroupemails; if(!isset($usergroupemails[$group["ref"]])){$usergroupemails[$group["ref"]]=array();} // Define any missing keys $page_def[] = config_add_text_list_input("usergroupemails[".$group["ref"]."]",$group["name"]); //need to pass a string that looks like: "$configoption["key"]" } The key can consist of numbers, letters or an underscore contained within "" or ''. If using numbers you don't need the quote marks
Parameters
- $page_def : mixed
-
mixed an array whose elements are generated by calls to config_add_xxxx functions each of which describes how one of the plugin's configuratoin variables.
- $plugin_name : mixed
-
string the name of the plugin for which the function is being invoked.
- $upload_status : mixed
-
string the status string returned by config_get_setup_post().
- $plugin_page_heading : mixed
-
string the heading to be displayed for the setup page for this plugin, typically a $lang[] variable.
- $plugin_page_frontm : mixed = ''
-
string front matter for the setup page in html format. This material is placed after the page heading and before the form. Default: '' (i.e., no front matter).
config_section_header()
Generate an html text section header
config_section_header(string $title, string $description) : mixed
Parameters
- $title : string
-
the title of the section.
- $description : string
-
the user text displayed to describe the section. Usually a $lang string.
config_add_section_header()
Return a data structure that will instruct the configuration page generator functions to add a section header.
config_add_section_header(string $title[, string $description = '' ]) : mixed
Parameters
- $title : string
-
the title of the section.
- $description : string = ''
-
Usually a $lang string.
config_add_text_list_input()
Return a data structure that will instruct the configuration page generator functions to add a comma-separated list text entry configuration variable to the setup page.
config_add_text_list_input(string $config_var, string $label[, bool $password = false ][, int $width = 300 ]) : mixed
Parameters
- $config_var : string
-
the name of the configuration variable to be added.
- $label : string
-
the user text displayed to label the text block. Usually a $lang string.
- $password : bool = false
-
whether this is a "normal" text-entry field or a password-style field. Defaulted to false.
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
config_multi_select()
Generate an html multi-select + options block
config_multi_select(string $name, string $label, mixed $current, mixed $choices[, bool $usekeys = true ][, int $width = 300 ]) : mixed
Parameters
- $name : string
-
the name of the select block. Usually the name of the config variable being set.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $current : mixed
- $choices : mixed
- $usekeys : bool = true
-
tells whether to use the keys from $choices as the values of the options. If set to false the values from $choices will be used for both the values of the options and the text the user sees. Defaulted to true.
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
config_add_multi_select()
Return a data structure that will instruct the configuration page generator functions to add a multi select configuration variable to the setup page.
config_add_multi_select(string $config_var, string $label, mixed $choices[, bool $usekeys = true ][, int $width = 300 ]) : mixed
Parameters
- $config_var : string
-
the name of the configuration variable to be added.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $choices : mixed
- $usekeys : bool = true
-
tells whether to use the keys from $choices as the values of the options. If set to false the values from $choices will be used for both the values of the options and the text the user sees. Defaulted to true.
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
config_single_user_select()
Generate an html single-select block for selecting one of the RS users.
config_single_user_select(string $name, string $label[, int $current = array() ][, int $width = 300 ]) : mixed
The user key (i.e., the value from the "ref" column of the user table) of the selected user is the value posted.
Parameters
- $name : string
-
the name of the select block. Usually the name of the config variable being set.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $current : int = array()
-
the current value of the config variable being set.
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
config_add_single_user_select()
Return a data structure that will instruct the configuration page generator functions to add a single RS user select configuration variable to the setup page.
config_add_single_user_select(string $config_var, string $label[, int $width = 300 ]) : mixed
Parameters
- $config_var : string
-
the name of the configuration variable to be added.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
config_multi_user_select()
Generate an html multi-select block for selecting from among RS users.
config_multi_user_select(string $name, string $label[, mixed $current = array() ][, int $width = 420 ]) : mixed
An array consisting of the user keys (i.e., values from the "ref" column of the user table) for the selected users is the value posted.
Parameters
- $name : string
-
the name of the select block. Usually the name of the config variable being set.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $current : mixed = array()
- $width : int = 420
-
the width of the input field in pixels. Default: 300.
config_add_multi_user_select()
Return a data structure that will instruct the configuration page generator functions to add a multiple RS user select configuration variable to the setup page.
config_add_multi_user_select(string $config_var, string $label[, int $width = 420 ]) : mixed
Parameters
- $config_var : string
-
the name of the configuration variable to be added.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $width : int = 420
-
the width of the input field in pixels. Default: 420.
config_single_group_select()
Generate an html single-select block for selecting from among RS user groups.
config_single_group_select(string $name, string $label[, mixed $current = array() ][, int $width = 300 ]) : mixed
Parameters
- $name : string
-
the name of the select block. Usually the name of the config variable being set.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $current : mixed = array()
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
config_add_single_group_select()
Return a data structure that will instruct the configuration page generator functions to add a single RS group select configuration variable to the setup page.
config_add_single_group_select(string $config_var, string $label[, int $width = 300 ]) : mixed
Parameters
- $config_var : string
-
the name of the configuration variable to be added.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
config_multi_group_select()
Generate an html multi-select block for selecting from among RS user groups.
config_multi_group_select(string $name, string $label[, mixed $current = array() ][, int $width = 420 ]) : mixed
An array consisting of the group keys (i.e., values from the "ref" column of the usergroup table) for the selected groups is the value posted.
Parameters
- $name : string
-
the name of the select block. Usually the name of the config variable being set.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $current : mixed = array()
- $width : int = 420
-
the width of the input field in pixels. Default: 300.
config_add_multi_group_select()
Return a data structure that will instruct the configuration page generator functions to add a multiple RS user select configuration variable to the setup page.
config_add_multi_group_select(string $config_var, string $label[, int $width = 420 ]) : mixed
Parameters
- $config_var : string
-
the name of the configuration variable to be added.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $width : int = 420
-
the width of the input field in pixels. Default: 300.
config_multi_ftype_select()
Generate an html multi-select + options block for selecting multiple RS field types. The selected field type is posted as an array of the values of the "ref" column of the selected field types.
config_multi_ftype_select(string $name, string $label, array<string|int, mixed> $current[, int $width = 300 ][, int $size = 7 ][, int $rtype = false ]) : mixed
Parameters
- $name : string
-
the name of the select block. Usually the name of the config variable being set.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $current : array<string|int, mixed>
-
Array holding the current field IDs of the config variable being set
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
- $size : int = 7
-
- Number of visible options. Default 7
- $rtype : int = false
-
- Limit to fields associated with a specific resource type
config_add_multi_ftype_select()
Return a data structure that will instruct the configuration page generator functions to add a multiple RS field-type select configuration variable to the setup page.
config_add_multi_ftype_select(string $config_var, string $label[, int $width = 300 ][, mixed $size = 7 ][, mixed $ftype = false ]) : mixed
Parameters
- $config_var : string
-
the name of the configuration variable to be added.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
- $size : mixed = 7
- $ftype : mixed = false
config_single_rtype_select()
Generate an html single-select + options block for selecting one of the RS resource types. The selected field type is posted as the value of the "ref" column of the selected resource type.
config_single_rtype_select(string $name, string $label, int $current[, int $width = 300 ]) : mixed
Parameters
- $name : string
-
the name of the select block. Usually the name of the config variable being set.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $current : int
-
the current value of the config variable being set
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
config_add_single_rtype_select()
Return a data structure that will instruct the configuration page generator functions to add a single RS resource-type select configuration variable to the setup page.
config_add_single_rtype_select(string $config_var, string $label[, int $width = 300 ]) : mixed
Parameters
- $config_var : string
-
the name of the configuration variable to be added.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
config_multi_rtype_select()
Generate an html multi-select check boxes block for selecting multiple the RS resource types. The selected field type is posted as an array of the values of the "ref" column of the selected resource types.
config_multi_rtype_select(string $name, string $label, mixed $current[, int $width = 300 ]) : mixed
Parameters
- $name : string
-
the name of the select block. Usually the name of the config variable being set.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $current : mixed
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
config_add_multi_rtype_select()
Return a data structure that will instruct the configuration page generator functions to add a multiple RS resource-type select configuration variable to the setup page.
config_add_multi_rtype_select(string $config_var, string $label[, int $width = 300 ]) : mixed
Parameters
- $config_var : string
-
the name of the configuration variable to be added.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
config_multi_archive_select()
Generate an html multi-select check boxes block for selecting multiple the RS archive states.
config_multi_archive_select(string $name, string $label, mixed $current, mixed $choices[, int $width = 300 ]) : mixed
The selections are posted as an array of the archive states archive state.
Parameters
- $name : string
-
the name of the select block. Usually the name of the config variable being set.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $current : mixed
- $choices : mixed
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
config_add_multi_archive_select()
Return a data structure that will instruct the configuration page generator functions to add a multiple RS archive select configuration variable to the setup page.
config_add_multi_archive_select(string $config_var, string $label, mixed $choices[, int $width = 300 ]) : mixed
Parameters
- $config_var : string
-
the name of the configuration variable to be added.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $choices : mixed
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
config_db_single_select()
Generate an html single-select + options block for selecting from among rows returned by a database query in which one of the columns is the unique key (by default, the "ref" column) and one of the others is the text to display (by default the "name" column). The value posted is the value at the intersection of the selected rown with the column given by the $ixcol variable.
config_db_single_select(string $name, string $label, string $current, array<string|int, mixed> $choices[, string $ixcol = 'ref' ][, string $dispcolA = 'name' ][, string $dispcolB = '' ][, string $fmt = '' ][, int $width = 300 ]) : mixed
Parameters
- $name : string
-
the name of the select block. Usually the name of the config variable being set.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $current : string
-
the current value of the config variable being set.
- $choices : array<string|int, mixed>
-
the array of db rows that make up the choices.
- $ixcol : string = 'ref'
-
the key in $choices (i.e., the db column) for the value of the choice. Defaulted to 'ref'.
- $dispcolA : string = 'name'
-
the key in $choices (i.e., the db column) for the text to display to the user. Defaulted to 'name'.
- $dispcolB : string = ''
-
the key in $choices (i.e., the db column) for secondary text to display to the user. Defaulted to '' indicating that only $dispcolA is to be displayed.
- $fmt : string = ''
-
the formatting string for combining $dispcolA and B when both are specified. Defaulted to $lang['plugin_field_fmt']. $fmt is all literal except for %A and %B which are replaced with values. In English $fmt is '%A(%B)' which results in the i-th choice displaying as: $choices[i][$dispcolA] . '(' . $choices[i][$dispcolB] . ')'
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
config_add_db_single_select()
Return a data structure that will instruct the configuration page generator functions to add a single select configuration variable whose value is chosen from among the results of a db query to the setup page.
config_add_db_single_select(string $config_var, string $label, array<string|int, mixed> $choices[, string $ixcol = 'ref' ][, string $dispcolA = 'name' ][, string $dispcolB = '' ][, string $fmt = '' ][, int $width = 300 ]) : mixed
Parameters
- $config_var : string
-
the name of the configuration variable to be added.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $choices : array<string|int, mixed>
-
the array of db rows that make up the choices.
- $ixcol : string = 'ref'
-
the key in $choices (i.e., the db column) for the value of the choice. Defaulted to 'ref'.
- $dispcolA : string = 'name'
-
the key in $choices (i.e., the db column) for the text to display to the user. Defaulted to 'name'.
- $dispcolB : string = ''
-
the key in $choices (i.e., the db column) for secondary text to display to the user. Defaulted to '' indicating that only $dispcolA is to be displayed.
- $fmt : string = ''
-
the formatting string for combining $dispcolA and B when both are specified. Defaulted to $lang['plugin_field_fmt']. $fmt is all literal except for %A and %B which are replaced with values. In English $fmt is '%A(%B)' which results in the i-th choice displaying as: $choices[i][$dispcolA] . '(' . $choices[i][$dispcolB] . ')'
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
config_db_multi_select()
Generate an html multi-select + options block for selecting from among rows returned by a database query in which one of the columns is the unique key (by default, the "ref" column) and one of the others is the text to display (by default the "name" column). The value posted is an array of the values of the column given by the $ixcol variable for the rows selected.
config_db_multi_select(string $name, string $label, mixed $current, array<string|int, mixed> $choices[, string $ixcol = 'ref' ][, string $dispcolA = 'name' ][, string $dispcolB = '' ][, string $fmt = '' ][, int $width = 300 ]) : mixed
Parameters
- $name : string
-
the name of the select block. Usually the name of the config variable being set.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $current : mixed
- $choices : array<string|int, mixed>
-
the array of db rows that make up the choices.
- $ixcol : string = 'ref'
-
the key in $choices (i.e., the db column) for the value of the choice Defaulted to 'ref'.
- $dispcolA : string = 'name'
-
the key in $choices (i.e., the db column) for the text to display to the user. Defaulted to 'name'.
- $dispcolB : string = ''
-
the key in $choices (i.e., the db column) for secondary text to display to the user. Defaulted to '' indicating that only $dispcolA is to be displayed.
- $fmt : string = ''
-
the formatting string for combining $dispcolA and B when both are specified. Defaulted to $lang['plugin_field_fmt']. $fmt is all literal except for %A and %B which are replaced with values. In English $fmt is '%A(%B)' which results in the i-th choice displaying as: $choices[i][$dispcolA] . '(' . $choices[i][$dispcolB] . ')'
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
config_add_db_multi_select()
Return a data structure that will instruct the configuration page generator functions to add a multi select configuration variable whose values are chosen from among the results of a db query to the setup page.
config_add_db_multi_select(string $config_var, string $label, array<string|int, mixed> $choices[, string $ixcol = 'ref' ][, string $dispcolA = 'name' ][, string $dispcolB = '' ][, string $fmt = '' ][, int $width = 300 ]) : mixed
Parameters
- $config_var : string
-
the name of the configuration variable to be added.
- $label : string
-
the user text displayed to label the select block. Usually a $lang string.
- $choices : array<string|int, mixed>
-
the array of db rows that make up the choices.
- $ixcol : string = 'ref'
-
the key in $choices (i.e., the db column) for the value of the choice. Defaulted to 'ref'.
- $dispcolA : string = 'name'
-
the key in $choices (i.e., the db column) for the text to display to the user. Defaulted to 'name'.
- $dispcolB : string = ''
-
the key in $choices (i.e., the db column) for secondary text to display to the user. Defaulted to '' indicating that only $dispcolA is to be displayed.
- $fmt : string = ''
-
the formatting string for combining $dispcolA and B when both are specified. Defaulted to $lang['plugin_field_fmt']. $fmt is all literal except for %A and %B which are replaced with values. In English $fmt is '%A(%B)' which results in the i-th choice displaying as: $choices[i][$dispcolA] . '(' . $choices[i][$dispcolB] . ')'
- $width : int = 300
-
the width of the input field in pixels. Default: 300.
config_add_hidden()
Return a data structure that will instruct the configuration page generator functions to add a hidden configuration variable.
config_add_hidden(string $config_var) : mixed
Parameters
- $config_var : string
-
the name of the configuration variable to be added.
config_text_field()
Deprecated -- use config_text_input instead
config_text_field(mixed $name, mixed $label, mixed $value[, mixed $size = '30' ]) : mixed
Parameters
- $name : mixed
- $label : mixed
- $value : mixed
- $size : mixed = '30'
config_userselect_field()
Deprecated -- use config_multi_user_select instead
config_userselect_field(mixed $name, mixed $label[, mixed $values = array() ]) : mixed
Parameters
- $name : mixed
- $label : mixed
- $values : mixed = array()
config_field_select()
Deprecated -- use config_single_ftype_select instead
config_field_select(mixed $name, mixed $label, mixed $value) : mixed
Parameters
- $name : mixed
- $label : mixed
- $value : mixed
config_boolean_field()
Deprecated -- use config_boolean_select instead
config_boolean_field(mixed $name, mixed $label, mixed $value) : mixed
Parameters
- $name : mixed
- $label : mixed
- $value : mixed
config_custom_select_multi()
Deprecated -- use config_db_multi_select instead
config_custom_select_multi(mixed $name, mixed $label, mixed $available, mixed $values[, mixed $index = 'ref' ][, mixed $nameindex = 'name' ][, mixed $additional = '' ]) : mixed
Parameters
- $name : mixed
- $label : mixed
- $available : mixed
- $values : mixed
- $index : mixed = 'ref'
- $nameindex : mixed = 'name'
- $additional : mixed = ''
config_custom_select()
Deprecated -- use config_single_select instead
config_custom_select(mixed $name, mixed $label, mixed $available, mixed $value) : mixed
Parameters
- $name : mixed
- $label : mixed
- $available : mixed
- $value : mixed
get_plugin_css()
get_plugin_css() : mixed
plugin_activate_for_setup()
plugin_activate_for_setup(mixed $plugin_name) : mixed
Parameters
- $plugin_name : mixed
include_plugin_config()
Includes configuration files for a specified plugin.
include_plugin_config(string $plugin_name[, string $config = "" ][, string $config_json = "" ]) : void
Parameters
- $plugin_name : string
-
The name of the plugin whose configuration files are to be included.
- $config : string = ""
-
Optional serialized base64-encoded configuration string.
- $config_json : string = ""
-
Optional JSON-encoded configuration string.
Return values
void —This function does not return a value; it modifies global variables.
register_plugin_language()
Registers the language files for a specified plugin.
register_plugin_language(string $plugin) : void
Parameters
- $plugin : string
-
The name of the plugin for which to register language files.
Return values
void —This function does not return a value; it modifies the global $lang variable.
get_plugin_path()
Retrieves the file path for a specified plugin.
get_plugin_path(string $plugin[, bool $url = false ]) : string|false
This function checks both the standard plugin directory and the user-uploaded filestore directory to locate the plugin. It can return either the file path on disk or a URL to the plugin based on the provided parameter.
Parameters
- $plugin : string
-
The short name of the plugin to locate.
- $url : bool = false
-
Optional. If true, return the URL to the plugin instead of the file path. Default is false.
Return values
string|false —The path to the plugin on disk or the URL to the plugin, or false if the plugin is not found.
register_plugin()
Registers a specified plugin by including its hooks and API bindings.
register_plugin(string $plugin) : bool
This function attempts to load hook files specific to the current page, as well as an 'all' hook that is applicable across all pages. Additionally, it loads any API bindings that the plugin may have.
Parameters
- $plugin : string
-
The short name of the plugin to register.
Return values
bool —Always returns true after attempting to include the relevant files.
plugin_encode_complex_configs()
Encode complex plugin configuration (e.g mappings defined by users on plugins' setup page)
plugin_encode_complex_configs(mixed $c) : string
Parameters
- $c : mixed
-
Configuration requiring encoding
Return values
stringplugin_decode_complex_configs()
Decode complex plugin configuration (e.g mappings defined by users on plugins' setup page)
plugin_decode_complex_configs(string $b64sc) : mixed
Parameters
- $b64sc : string
-
Configuration encoded prior with plugin_encode_complex_configs()
register_group_access_plugins()
Load group specific plugins and reorder plugins list
register_group_access_plugins([int $usergroup = -1 ][, array<string|int, mixed> $plugins = [] ]) : array<string|int, mixed>
Parameters
- $usergroup : int = -1
-
Usergroup reference
- $plugins : array<string|int, mixed> = []
-
Enabled Plugins
Return values
array<string|int, mixed>register_all_group_access_plugins()
Load ALL group specific plugins and reorder plugins list This will bypass any group access controls for use with CLI scripts
register_all_group_access_plugins(array<string|int, mixed> $plugins) : array<string|int, mixed>
Parameters
- $plugins : array<string|int, mixed>
-
Enabled Plugins
Return values
array<string|int, mixed>RenderPlugin()
Render the plugin in the Plugin Manager with options to activate and configure.
RenderPlugin(array<string|int, mixed> $plugin[, bool $active = true ]) : void
Parameters
- $plugin : array<string|int, mixed>
-
An array containing the plugin data, loaded from the plugin table
- $active : bool = true
-
If true, display options to deactivate and allow group configuration
render_search_field()
Renders the HTML for the provided $field for inclusion in a search form, for example the advanced search page. Standard field titles are translated using $lang. Custom field titles are i18n translated.
render_search_field(mixed $field, mixed $fields[, mixed $value = "" ][, mixed $autoupdate = false ][, mixed $class = "stdwidth" ][, mixed $forsearchbar = false ][, mixed $limit_keywords = array() ][, array<string|int, mixed> $searched_nodes = array() ][, mixed $reset = "" ][, mixed $simpleSearchFieldsAreHidden = false ]) : mixed
$field the field being rendered as an associative array of field data, i.e. one row from the resource_type_field table. $fields the array of fields data, i.e. multiple rows from the resource_type_field table. $name the input name to use in the form (post name) $value the default value to set for this field, if any $reset is non-blank if the caller requires the field to be reset
Parameters
- $field : mixed
- $fields : mixed
- $value : mixed = ""
- $autoupdate : mixed = false
- $class : mixed = "stdwidth"
- $forsearchbar : mixed = false
- $limit_keywords : mixed = array()
- $searched_nodes : array<string|int, mixed> = array()
-
Array of all the searched nodes previously
- $reset : mixed = ""
- $simpleSearchFieldsAreHidden : mixed = false
render_sort_order()
Renders sort order functionality as a dropdown box
render_sort_order(array<string|int, mixed> $order_fields, mixed $default_sort_order) : mixed
Parameters
- $order_fields : array<string|int, mixed>
- $default_sort_order : mixed
render_dropdown_option()
Renders a dropdown option
render_dropdown_option(mixed $value, mixed $label[, array<string|int, mixed> $data_attr = array() ][, mixed $extra_tag_attributes = '' ]) : mixed
Parameters
- $value : mixed
- $label : mixed
- $data_attr : array<string|int, mixed> = array()
- $extra_tag_attributes : mixed = ''
render_actions()
Renders search actions functionality as a dropdown box
render_actions(array<string|int, mixed> $collection_data[, bool $top_actions = true ][, bool $two_line = true ][, string $id = '' ][, array<string|int, mixed> $resource_data = array() ][, bool $optionsonly = false ][, string $forpage = "" ]) : void
Parameters
- $collection_data : array<string|int, mixed>
-
Collection data
- $top_actions : bool = true
-
Set to true if actions are to be rendered in the search filter bar (above results)
- $two_line : bool = true
-
Display on two lines
- $id : string = ''
-
Selector HTML ID
- $resource_data : array<string|int, mixed> = array()
-
Resource data
- $optionsonly : bool = false
-
Render only options
- $forpage : string = ""
-
Specifically target for which page actions apply
render_user_group_multi_select()
render_user_group_multi_select(string $name[, array<string|int, mixed> $current = array() ][, int $size = 10 ][, mixed $style = '' ]) : mixed
Parameters
- $name : string
- $current : array<string|int, mixed> = array()
-
Current selected values (eg. array(1, 3) for Admins and Super admins user groups selected)
- $size : int = 10
-
How many options to show before user has to scroll
- $style : mixed = ''
render_user_group_checkbox_select()
Renders a list of user groups
render_user_group_checkbox_select(string $name[, array<string|int, mixed> $current = array() ][, string $style = '' ]) : void
Parameters
- $name : string
- $current : array<string|int, mixed> = array()
-
Current selected values (eg. array(1, 3) for Admins and Super admins user groups selected)
- $style : string = ''
-
CSS styling that will apply to the outer container (ie. table element)
render_text_question()
render_text_input_question - Used to display a question with simple text input
render_text_question(string $label, string $input[, string $additionaltext = "" ][, bool $numeric = false ][, mixed $extra = "" ][, mixed $current = "" ][, array<string|int, mixed> $ctx = array() ]) : void
Parameters
- $label : string
-
Label of question
- $input : string
-
Name of input field
- $additionaltext : string = ""
-
Text to to display after input
- $numeric : bool = false
-
Set to true to force numeric input
- $extra : mixed = ""
- $current : mixed = ""
- $ctx : array<string|int, mixed> = array()
-
Rendering context. Should be used to inject different elements (e.g set the div class)
render_split_text_question()
render_split_text_question - Used to display a question with two inputs e.g. for a from/to range
render_split_text_question(string $label[, array<string|int, mixed> $inputs = array() ][, string $additionaltext = "" ][, bool $numeric = false ][, mixed $extra = "" ][, mixed $currentvals = array() ]) : mixed
Parameters
- $label : string
-
Label of question
- $inputs : array<string|int, mixed> = array()
-
Array of input names and labels(eg. array('pixelwidthmin'=>'From','pixelwidthmin'=>'To')
- $additionaltext : string = ""
-
(optional) Text to to display after input
- $numeric : bool = false
-
Set to true to force numeric input
- $extra : mixed = ""
- $currentvals : mixed = array()
render_dropdown_question()
render_dropdown_question - Used to display a question with a dropdown selector
render_dropdown_question(string $label, string $inputname[, array<string|int, mixed> $options = array() ][, string|array<int, int> $current = "" ][, string $extra = "" ][, array{no_div_class_question?: bool, div_class?: list, div_content?: string, div_extra_attr?: string, input_class?: string, onchange?: string} $ctx = array() ]) : void
IMPORTANT: careful when having to handle untrusted data! If you have to pass it to elements, make sure they're encoded accordingly.
Parameters
- $label : string
-
Label of question
- $inputname : string
-
Name of input field
- $options : array<string|int, mixed> = array()
-
Array of options (value and text pairs) (eg. array('pixelwidthmin'=>'From','pixelwidthmin'=>'To')
- $current : string|array<int, int> = ""
-
The current selected value. For a multiple selector, a list of currently selected values.
- $extra : string = ""
-
Extra attributes used on the selector element
-
$ctx
: array{no_div_class_question?: bool, div_class?: list
, div_content?: string, div_extra_attr?: string, input_class?: string, onchange?: string} = array() -
Rendering context. Should be used to inject different elements (e.g set the div class, add onchange for select).
render_access_key_tr()
Render a table row (tr) for a single access key
render_access_key_tr(array<string|int, mixed> $record) : void
Parameters
- $record : array<string|int, mixed>
-
Access key record details
is_field_displayed()
Checks whether a specified field should be displayed based on various conditions.
is_field_displayed(array<string|int, mixed> $field) : bool
This function evaluates several criteria to determine if a field is visible in the resource editing interface. It takes into account the field's active status, permissions for viewing and editing, upload conditions, and any custom hooks that may hide the field.
Parameters
- $field : array<string|int, mixed>
-
The field configuration array containing information about the field's settings.
Return values
bool —Returns true if the field should be displayed; false otherwise.
display_field()
Displays a field in the resource edit interface.
display_field(int $n, array<string|int, mixed> $field[, bool $newtab = false ][, bool $modal = false ]) : mixed
This function handles the rendering of various types of fields based on their configurations and context. It supports multiple modes, such as batch editing, and adjusts the display based on user permissions, errors from previous saves, and whether the field is being copied from another resource.
Parameters
- $n : int
-
The index of the field in the form.
- $field : array<string|int, mixed>
-
The field configuration array containing settings and metadata for the field.
- $newtab : bool = false
-
Indicates if the field should be displayed in a new tab.
- $modal : bool = false
-
Indicates if the field is part of a modal dialog.
render_date_range_field()
Renders a date range input field for resource editing.
render_date_range_field(string $name, string $value[, bool $forsearch = true ][, bool $autoupdate = false ][, array<string|int, mixed> $field = array() ][, string $reset = "" ]) : mixed
This function creates a set of input fields for selecting a start and end date. It supports EDTF format and includes validation for the entered dates. It also provides functionality for handling multiple edit modes and integrates with the autosave feature.
Parameters
- $name : string
-
The base name for the input fields.
- $value : string
-
The value of the date range (in a specific format).
- $forsearch : bool = true
-
Indicates if the field is being used for a search query.
- $autoupdate : bool = false
-
Indicates if the field should trigger an update on change.
- $field : array<string|int, mixed> = array()
-
The field configuration array containing settings and metadata for the field.
- $reset : string = ""
-
An optional parameter indicating if the form should be reset.
renderBreadcrumbs()
Renders a full breadcrumbs trail.
renderBreadcrumbs(array<string|int, mixed> $links[, string $pre_links = '' ][, string $class = '' ]) : void
Parameters
- $links : array<string|int, mixed>
-
List of link "objects" that create the trail
- $pre_links : string = ''
-
Pre-rendered links in HTML form
- $class : string = ''
-
Extra classes for the main container div
render_new_featured_collection_cta()
Render a blank tile used for call to actions (e.g: on featured collections, a tile for creating new collections)
render_new_featured_collection_cta(string $url, array<string|int, mixed> $ctx) : void
Parameters
- $url : string
-
URL
- $ctx : array<string|int, mixed>
-
Rendering options determined by the outside context
renderSocialMediaShareLinksForUrl()
Renders social media links in order to share a particular link
renderSocialMediaShareLinksForUrl(string $url) : void
Parameters
- $url : string
-
The URL to be shared on social media networks
renderLockButton()
Renders a lock button for a field - used to 'lock' metadata in upload_review_mode
renderLockButton(string $name[, array<string|int, mixed> $locked_fields = array() ]) : void
Parameters
- $name : string
-
The field identifier e.g. 'resource_type', '18'
- $locked_fields : array<string|int, mixed> = array()
-
- Array of locked field identifiers
render_resource_image()
Renders an image, with width and height specified for centering in div
render_resource_image(array<string|int, mixed> $resource, string $img_url[, string $display = "thumbs" ]) : void
Parameters
- $resource : array<string|int, mixed>
-
An array of resource data from search results
- $img_url : string
-
URL to image file
- $display : string = "thumbs"
-
size to use - from search results
calculate_image_display()
Calculations width, height and margin-top property for resource image to display in ResourcePanel
calculate_image_display(array{'thumb_width': positive-int, 'thumb_height': positive-int} $imagedata, string $img_url[, string $display = "thumbs" ]) : array<string|int, mixed>
Parameters
- $imagedata : array{'thumb_width': positive-int, 'thumb_height': positive-int}
- $img_url : string
- $display : string = "thumbs"
Return values
array<string|int, mixed> —Returns a tuple of width, height and margin
render_share_options()
Render the share options (used on collection_share.php and resource_share.php)
render_share_options([array<string|int, mixed> $shareopts = array() ]) : void
Parameters
- $shareopts : array<string|int, mixed> = array()
-
Array of share options. If not set will use the old getval() methods "password" bool Has a password been set for this share? (password will not actually be displayed) "editaccesslevel" int Current access level of share "editexpiration" string Current expiration date "editgroup" int ID of existing share group
render_field_selector_question()
Renders a metadata field selector
render_field_selector_question(string $label, string $name, array<string|int, mixed> $ftypes[, string $class = "stdwidth" ][, bool $hidden = false ][, array<string|int, mixed> $current = 0 ]) : void
Parameters
- $label : string
-
label for the field
- $name : string
-
name of form select
- $ftypes : array<string|int, mixed>
-
Array of integer field type ids to include. See definitions.php. Will return all types if incorrect value or empty array supplied.
- $class : string = "stdwidth"
-
array CSS class to apply
- $hidden : bool = false
-
optionally hide the question usng CSS display:none
- $current : array<string|int, mixed> = 0
-
Current selected value
render_filter_bar_button()
Render a filter bar button
render_filter_bar_button(string $text, string $attr, string $icon) : void
Parameters
- $text : string
-
Button text
- $attr : string
-
Button attributes
- $icon : string
-
HTML for icon element (e.g "")
render_upload_here_button()
Render "Upload here" button.
render_upload_here_button(array{search: string, restypes: string, archive: string, advsearch?: "true"|""} $search_params[, bool $return_params_only = false ]) : void|array<string|int, mixed>
This applies to search results that are either a special search "!collection" and/or consist of purely the following:
- Nodes
- Resource type
- Workflow (archive) state
For free text searches this SHOULD NOT work!
Parameters
- $search_params : array{search: string, restypes: string, archive: string, advsearch?: "true"|""}
- $return_params_only : bool = false
-
Exception to the rule! Rather than render, return the upload here params
Return values
void|array<string|int, mixed>render_trash()
Renders the trash bin. This is used to delete dash tiles and remove resources from collections
render_trash(string $type, mixed $deletetext[, mixed $forjs = false ]) : string|void
Parameters
- $type : string
-
type of trash_bin
- $deletetext : mixed
- $forjs : mixed = false
Return values
string|voidrender_help_link()
Generates a help icon that opens the relevant Knowledge Base article in a modal
render_help_link([string $page = '' ][, bool $return_string = false ]) : mixed
Parameters
- $page : string = ''
-
Knowledge Base article to display, leave blank to show the Knowledge Base homepage
- $return_string : bool = false
-
Set to true to return the html as a single line string, False will cause the function to echo the html
Return values
mixed —if $return_string=true return is string, else void
render_question_div()
Render generic Question div (including clearleft)
render_question_div(mixed $id, callable $render_content) : void
Parameters
- $id : mixed
- $render_content : callable
render_custom_fields()
Render custom fields (NOT metadata fields)
render_custom_fields(array<string|int, mixed> $cfs) : true
Parameters
- $cfs : array<string|int, mixed>
-
Custom fields information (as returned by process_custom_fields_submission function)
Return values
truerender_selected_resources_counter()
Generates HTML for the "X Selected" in the search results found part pointing to the special collection COLLECTION_TYPE_SELECTION
render_selected_resources_counter(int $i) : string
Parameters
- $i : int
-
Counter to display
Return values
string —Returns HTML
render_edit_selected_btn()
Renders the "Edit selected" button. This is using the special 'COLLECTION_TYPE_SELECTION' collection
render_edit_selected_btn() : void
render_clear_selected_btn()
Renders the "Clear selected" button. This is using the special 'COLLECTION_TYPE_SELECTION' collection
render_clear_selected_btn() : void
render_selected_collection_actions()
Render the actions specific to when a user selected resources (using the special "COLLECTION_TYPE_SELECTION" collection)
render_selected_collection_actions() : void
render_user_collection_select()
render_user_collection_select([mixed $name = "collection" ][, mixed $collections = array() ][, mixed $selected = 0 ][, mixed $classes = "" ][, mixed $onchangejs = "" ]) : mixed
Parameters
- $name : mixed = "collection"
- $collections : mixed = array()
- $selected : mixed = 0
- $classes : mixed = ""
- $onchangejs : mixed = ""
render_csrf_data_attributes()
Render CSRF information as data attributes. Useful to allow JS to run state changing operations
render_csrf_data_attributes(mixed $ident) : mixed
Parameters
- $ident : mixed
check_display_condition()
Check display condition for a field.
check_display_condition(int $n, array<string|int, mixed> $field, array<string|int, mixed> $fields, bool $render_js, int $resource_ref) : bool
Parameters
- $n : int
-
Question sequence number on the rendered form
- $field : array<string|int, mixed>
-
Field on which we check display conditions
- $fields : array<string|int, mixed>
-
Resource field data and properties as returned by get_resource_field_data()
- $render_js : bool
-
Set to TRUE to render the client side code for checking display conditions or FALSE otherwise
- $resource_ref : int
-
Resource reference for which the display condition applies
Tags
Return values
bool —Returns TRUE if no display condition or if field should be displayed or FALSE if field should not be displayed.
display_upload_options()
Utility to if collapsable upload options should be displayed
display_upload_options() : bool
Return values
booldisplay_field_data()
display_field_data(array<string|int, mixed> $field[, mixed $valueonly = false ][, mixed $fixedwidth = 452 ]) : mixed
Parameters
- $field : array<string|int, mixed>
- $valueonly : mixed = false
- $fixedwidth : mixed = 452
render_fixed_list_as_pills()
render_fixed_list_as_pills(mixed $nodes) : string
Parameters
- $nodes : mixed
Return values
stringrender_resource_lock_link()
render_resource_lock_link(mixed $ref, mixed $lockuser, mixed $editaccess) : mixed
Parameters
- $ref : mixed
- $lockuser : mixed
- $editaccess : mixed
EditNav()
EditNav - render html for next/back browsing on the resource edit page. Called by SaveAndClearButtons()
EditNav() : void
SaveAndClearButtons()
Render the 'QuestionSubmit' div with the 'Save', 'Clear' and 'Save all with values' locked Buttons - used by the resource edit page
SaveAndClearButtons([string $extraclass = "" ][, bool $requiredfields = false ][, bool $backtoresults = false ]) : void
Parameters
- $extraclass : string = ""
-
- Additional CSS classes to add to the Question div
- $requiredfields : bool = false
-
- to indicate the input is required
- $backtoresults : bool = false
-
- Show the next/back links using EditNav()
display_size_option()
display_size_option
display_size_option(mixed $sizeID, mixed $sizeName[, mixed $fordropdown = true ][, mixed $selected = false ]) : void
Parameters
- $sizeID : mixed
- $sizeName : mixed
- $fordropdown : mixed = true
- $selected : mixed = false
render_featured_collection_category_selector()
Render the featured collection category selector
render_featured_collection_category_selector(int $parent, array<string|int, mixed> $context) : void
Parameters
- $parent : int
-
Parent collection ref
- $context : array<string|int, mixed>
-
Contextual data (e.g depth level to render or the current branch path)
render_featured_collections()
Render featured collections (as tiles on the collections_featured.php page)
render_featured_collections(array<string|int, mixed> $ctx, array<string|int, mixed> $items) : mixed
Parameters
- $ctx : array<string|int, mixed>
-
Context data to allow caller code to decide rendering requirements
- $items : array<string|int, mixed>
-
List of items to render (featured collection category, actual collection or smart collection)
render_featured_collection()
Render a featured collection (as tiles on the collections_featured.php page)
render_featured_collection(array<string|int, mixed> $ctx, array<string|int, mixed> $fc) : void
Parameters
- $ctx : array<string|int, mixed>
-
Context data to allow caller code to decide rendering requirements
- $fc : array<string|int, mixed>
-
Featured collection data structure
render_top_right_menu_btn()
Render the top right menu button ellipsis icon.
render_top_right_menu_btn(array<string|int, mixed> $options) : void
Parameters
- $options : array<string|int, mixed>
render_featured_collection_context_menu()
Render a featured collection (category) contextual menu
render_featured_collection_context_menu(string $id, array<string|int, mixed> $options) : void
Parameters
- $id : string
-
The HTML identifier for the menu container.
- $options : array<string|int, mixed>
DrawOption()
Renders an option in the Permission Manager (admin_group_permissions.php page)
DrawOption(string $permission, string $description[, bool $reverse = false ][, bool $reload = false ][, bool $disabled = false ]) : void
Parameters
- $permission : string
-
Permission identifier
- $description : string
-
User friendly description of the permission
- $reverse : bool = false
-
Reverse the permission
- $reload : bool = false
-
deprecated - Autosave changes done on this permission
- $disabled : bool = false
-
Disable this permission as another supersedes it (greys it out and checks it)
render_featured_collections_category_permissions()
Render featured collections options in the Permission Manager (admin_group_permissions.php page)
render_featured_collections_category_permissions(array<string|int, mixed> $ctx) : void
This function will generate and render the following permissions that target featured collection categories
j[numeric ID of new collection] - valid for FC categories at root level. These are normal permissions.
-j[numeric ID of new collection] - valid for the rest of FC sub-categories. These permissions are reversed, DrawOption()!
Parameters
- $ctx : array<string|int, mixed>
-
Context data to allow caller code to start from different tree levels. Supports the following properties: parent and depth
show_upgrade_in_progress()
show_upgrade_in_progress message
show_upgrade_in_progress([bool $dbstructonly = false ]) : void
Parameters
- $dbstructonly : bool = false
-
- Indicates whether this is a full upgrade with migration scripts or just a check_db_structs()
render_audio_download_link()
add link to mp3 preview file if resource is a wav file
render_audio_download_link(array<string|int, mixed> $resource, int $ref, string $k, array<string|int, mixed> $ffmpeg_audio_extensions, string $baseurl, array<string|int, mixed> $lang) : mixed
Parameters
- $resource : array<string|int, mixed>
-
- resource data
- $ref : int
-
- resource ref
- $k : string
-
- url param key
- $ffmpeg_audio_extensions : array<string|int, mixed>
-
- config var containing a list of extensions which will be ported to mp3 format for preview
- $baseurl : string
-
- config base url
- $lang : array<string|int, mixed>
-
- array containing language strings
render_table()
Render a table based on ResourceSpace data to include sorting by various columns
render_table(array<string|int, mixed> $tabledata) : void
Parameters
- $tabledata : array<string|int, mixed>
-
- This must be constructed as detailed below
Required elements:-
"class" Optional class to add to table div "headers" - Column headings using the identifier as the index,
- name - Title to display
- Sortable - can column be sorted?
- width - Optional column width
"orderbyname" - name of variable used on page to determine orderby (used to differentiate from standard search values) "orderby" - Current order by value "sortbyname" - name of variable used on page to determine sort "sort" - Current sort "defaulturl" - Default URL to construct links "modal" - Open links in modal? (false by default) "params" - Current parameters to use in URL "pager" - Pager settings
- current page
- total pages "data" - Array of data to display in table, using header identifers as indexes
- If "rowid" is specified this will be used as the id attribute for the
element - The "alerticon" can be used to specify a CSS class to use for a row status icon
- An additional 'tools' element can be included to add custom action icons
- "icon" - Lucide class to use for icon
- "text" - title attribute
- "url" - URl to link to
- "url:class" - The styling classes for the URL. Type: string. This tool property is optional.
- "modal" - (boolean) Open link in modal?
- "onclick" - OnClick action to add to icon
e.g.
array( "icon"=>"icon-trash-2", "text"=>$lang["action-delete"], "url"=>"", "modal"=>false, "onclick"=>"delete_job(" . $jobs[$n]["ref"] . ");return false;" );
array( "icon"=>"icon-info", "text"=>$lang["job_details"], "url"=>generateURL($baseurl . "/pages/job_details.php",array("job" => $jobs[$n]["ref"])), "modal"=>true, );
render_array_in_table_cells()
Render multimensional array or object to display within table cells
render_array_in_table_cells(array<string|int, mixed> $array) : voidParameters
- $array : array<string|int, mixed>
render_top_page_error_style()
Render the top page error style version
render_top_page_error_style(string $err_msg) : voidParameters
- $err_msg : string
-
Error message
render_question_form_helper()
Render a FormHelper. These are used in forms, to provide extra information to the user to a question.
render_question_form_helper(string $txt, string $id, array<string|int, mixed> $ctx) : mixedParameters
- $txt : string
-
Help text
- $id : string
-
Div ID
- $ctx : array<string|int, mixed>
-
Contextual data
render_hidden_input()
Render an HTML hidden input
render_hidden_input(string $name, string $value) : mixedParameters
- $name : string
-
Input name
- $value : string
-
Input value
render_workflow_state_question()
Renders a dropdown for selecting the workflow state of a resource.
render_workflow_state_question([int|null $current = null ][, bool $checkaccess = true ]) : mixedThis function generates a dropdown menu with various workflow states, allowing the user to select the current state of the resource. The available options are based on permission checks and additional states defined globally.
Parameters
- $current : int|null = null
-
The currently selected state, if any.
- $checkaccess : bool = true
-
Indicates whether to check user permissions for each state.
render_share_password_question()
Renders a question field for setting a share password.
render_share_password_question([bool $blank = true ]) : mixedThis function generates an HTML input field where users can set or change the password for shared access to a resource. It includes functionality to toggle password visibility and indicates if the password is required.
Parameters
- $blank : bool = true
-
Indicates if the password field should be left blank (default is true).
radio_get_layout()
Get required rows and columns for use when displaying radio buttons in a table
radio_get_layout(array<string|int, mixed> $options) : array<string|int, mixed>Parameters
- $options : array<string|int, mixed>
-
Array of text options
Return values
array<string|int, mixed> —(Number of rows, number of columns)
render_radio_buttons_question()
render_radio_buttons_question - Used to display a question with radio buttons
render_radio_buttons_question(string $label, string $inputname[, array<string|int, mixed> $options = array() ][, string $current = "" ][, string $extra = "" ][, bool $listview = false ][, array<string|int, mixed> $ctx = array() ]) : voidParameters
- $label : string
-
Label of question
- $inputname : string
-
Name of input field
- $options : array<string|int, mixed> = array()
-
Array of options (value and text pairs) (eg. array('pixelwidthmin'=>'From','pixelwidthmin'=>'To')
- $current : string = ""
-
The current selected value
- $extra : string = ""
-
Extra attributes used on the selector element
- $listview : bool = false
-
Show as vertical list? (false for table view)
- $ctx : array<string|int, mixed> = array()
-
Rendering context. Should be used to inject different elements (e.g set the div class, add onclick for select)
render_message()
Render a user message for use in conversation view
render_message([array<string|int, mixed> $message = "" ]) : voidParameters
- $message : array<string|int, mixed> = ""
-
Message data from message_get_conversation()
render_antispam_question()
Render the antispam Question form section
render_antispam_question() : mixedrender_fixed_text_question()
Renders a 'fixed' text question - not an input but to display information or values that cannot be changed
render_fixed_text_question(string $label, string $text[, string $helptext = "" ][, string $divid = "" ]) : voidParameters
- $label : string
-
Question label
- $text : string
-
Fixed text
- $helptext : string = ""
-
Optional div identifier
- $divid : string = ""
escape()
Output encoding for HTML context when unsafe input is rendered inside it
escape(string $unsafe) : stringParameters
- $unsafe : string
Return values
stringencode_js_value()
Output encoding for Javascript (JS) context. Allows PHP code to embed data as a JS value by producing a JS-compatible literal for the common JSON types.
encode_js_value(mixed $unsafe) : stringIMPORTANT: encoding failures result in NULL.
Parameters
- $unsafe : mixed
Tags
Return values
stringhtml_break_long_words()
HTML aware function to break up long words onto multiple lines for PDF generation where CSS text wrapping can't be used
html_break_long_words(string $html, int $length) : stringParameters
- $html : string
-
HTML/text to be processed
- $length : int
-
Maximum word length
Return values
stringrender_lucide_icon_selector()
Renders a Lucide icon selector question Requires lib/lucide/icon_classes.php to be included in the page using the function
render_lucide_icon_selector([string $label = "" ][, string $name = "icon" ][, string $current = "" ]) : voidParameters
- $label : string = ""
- $name : string = "icon"
-
Input name
- $current : string = ""
-
Current value
display_related_resources()
Render all related resources on view page
display_related_resources(array<string|int, mixed> $context) : voidParameters
- $context : array<string|int, mixed>
-
Array with all required info from the view page
admin_resource_type_field_constraint()
Display appropriate field constraint for use on admin_resource_type_field_edit.php e.g. single select/Number
admin_resource_type_field_constraint(int $ref, int $currentvalue) : voidParameters
- $ref : int
- $currentvalue : int
admin_resource_type_field_option()
Render metadata field option input on admin_resource_type_field_edit.php
admin_resource_type_field_option(string $propertyname, string $propertytitle, string $helptext, mixed $type, mixed $currentvalue, int $fieldtype, bool $system_date_field) : voidParameters
- $propertyname : string
-
Field property/column name
- $propertytitle : string
-
Title
- $helptext : string
-
Help text
- $type : mixed
-
Input type (0=text,1=boolean,2=text area)
- $currentvalue : mixed
-
Current field setting
- $fieldtype : int
-
Field type. See definitions.php
- $system_date_field : bool
-
Is this field set as the system $date_field?
render_resource_type_selector_question()
Renders a resource type selection dropdown
render_resource_type_selector_question(string $label, string $name[, string $class = "stdwidth" ][, bool $hidden = false ][, int $current = 0 ]) : voidParameters
- $label : string
-
label for the field
- $name : string
-
name of form select
- $class : string = "stdwidth"
-
array CSS class to apply
- $hidden : bool = false
-
optionally hide the question usng CSS display:none
- $current : int = 0
-
Current selected value
add_download_column()
Render the Download info for the resource tool (on view page)
add_download_column(int $ref, array<string|int, mixed> $size_info, bool $downloadthissize[, bool $view_in_browser = false ]) : mixedParameters
- $ref : int
-
Resource ref
- $size_info : array<string|int, mixed>
-
Preview size information
- $downloadthissize : bool
-
Should the size be downloadable or requested?
- $view_in_browser : bool = false
-
Allow the size to be viewed directly in the browser
render_resource_view_image()
Render image on view.php
render_resource_view_image(array<string|int, mixed> $resource, array<string|int, mixed> $context) : voidParameters
- $resource : array<string|int, mixed>
-
Resource data
- $context : array<string|int, mixed>
-
Array with following named elements "access" - Resource access "edit_access" - Resource edit access
render_resource_tools_size_download_options()
Render the resource tools for preview sizes
render_resource_tools_size_download_options(array<string|int, mixed> $resource, array{'download_multisize': bool, "sizes"?: array, 'urlparams': array} $ctx) : voidParameters
- $resource : array<string|int, mixed>
-
Resource data - get_resource_data()
- $ctx : array{'download_multisize': bool, "sizes"?: array, 'urlparams': array}
-
Contextual information.
toast_notification()
Adds script to display toast notification. Note: Must be included after header.php.
toast_notification(ToastNotificationType $type, string $message) : voidParameters
- $type : ToastNotificationType
-
Options are: 'success', 'error' or 'download'. Determines toast notification icon.
- $message : string
-
Notification text to display.
render_icon_wrapper_component()
render_icon_wrapper_component(Icon $name[, IconSize $size = IconSize::Default ]) : voidParameters
- $name : Icon
- $size : IconSize = IconSize::Default
render_header_links()
Render the header's primary navigation. In responsive mode, all the nav links are being overflown.
render_header_links(Icon, force_overflow?: bool} $ctx) : voidParameters
- $ctx : Icon, force_overflow?: bool}
-
Change behaviour based on context (e.g. normal vs responsive)
get_smart_fc_branch_trail()
Helper function for smart featured collections to update $branch_trail with all parent nodes of the selected node
get_smart_fc_branch_trail(int $node, int $tree_node_level, array<string|int, mixed> $field_data, array<string|int, mixed> $general_url_params, array<string|int, mixed> $branch_trail) : array<string|int, mixed>Parameters
- $node : int
-
Node selected
- $tree_node_level : int
-
Current level of node in tree
- $field_data : array<string|int, mixed>
-
Array of the smart featured collections field data
- $general_url_params : array<string|int, mixed>
-
URL parameters to use with generated href links
- $branch_trail : array<string|int, mixed>
-
Partial array of links to use for renderBreadcrumbs(), only includes the highest level link
Return values
array<string|int, mixed> —$branch_trail Full array of parent nodes and field links
get_report_name()
Retrieves the name of a report
get_report_name(array<string|int, mixed> $report) : stringParameters
- $report : array<string|int, mixed>
-
The report array containing at least a 'name' key.
Return values
string —The translated report name.
get_reports()
Retrieves an array of reports from the database.
get_reports() : array<string|int, mixed>This function queries the database for all reports and processes them by:
- Translating the report names using the
get_report_namefunction. - Checking if the reports contain date fields using
report_has_date. - Verifying if the reports have associated thumbnails using
report_has_thumbnail.
The reports are always listed in the same order, regardless of the language used.
Return values
array<string|int, mixed> —An array of processed reports, each containing 'ref', 'name', 'contains_date', and 'has_thumbnail' keys.
do_report()
do_report - Runs the specified report. This is used in a number of ways:- 1) Outputs an HTML table to screen ($download = false) 2) Produces a CSV - for direct download from team_report.php - captured and saved as a CSV file if called by send_periodic_report_emails() and over 100 rows are returned
do_report(int $ref, mixed $from_y, mixed $from_m, mixed $from_d, mixed $to_y, mixed $to_m, mixed $to_d[, mixed $download = true ][, mixed $add_border = false ][, mixed $foremail = false ][, array<string|int, mixed> $search_params = array() ][, bool $results_as_array = false ]) : void|string|array<string|int, mixed>Parameters
- $ref : int
-
Report ID
- $from_y : mixed
-
Start year (used for reprts with date placholders)
- $from_m : mixed
-
Start month
- $from_d : mixed
-
Start day
- $to_y : mixed
-
End year
- $to_m : mixed
-
To month
- $to_d : mixed
-
To day
- $download : mixed = true
-
Output as CSV attachment (default)/output directly to client
- $add_border : mixed = false
-
Optional table border (not for download)
- $foremail : mixed = false
-
Sending as email?
- $search_params : array<string|int, mixed> = array()
-
Search parameters - get_search_params() - will run the report on the search results and replace the '[non_correlated_sql]' placeholder with the search query.
- $results_as_array : bool = false
-
Output is an array containing report rows. Will override other output modes. Useful for the API.
Return values
void|string|array<string|int, mixed> —Outputs CSV file, array of report data, returns HTML table or returns an array with path to the CSV file, rows and filename
create_periodic_email()
Creates a new automatic periodic e-mail report
create_periodic_email(mixed $user, mixed $report, mixed $period, mixed $email_days, array<string|int, mixed> $user_groups, array<string|int, mixed> $search_params) : mixedParameters
- $user : mixed
- $report : mixed
- $period : mixed
- $email_days : mixed
- $user_groups : array<string|int, mixed>
- $search_params : array<string|int, mixed>
send_periodic_report_emails()
Sends periodic report emails to users based on configured schedules.
send_periodic_report_emails([bool $echo_out = true ][, bool $toemail = true ]) : voidThis function checks for any scheduled reports that need to be sent, either because they are pending or overdue. It gathers the necessary user email addresses, generates the reports, and sends them as emails with attachments if applicable.
Parameters
- $echo_out : bool = true
-
Determines whether to output progress messages during processing.
- $toemail : bool = true
-
Determines whether to send the reports via email.
delete_periodic_report()
Deletes a periodic report for the current user.
delete_periodic_report(int $ref) : boolThis function removes the specified periodic report from the database for the user and also clears any associated unsubscribe (opt out) records.
Parameters
- $ref : int
-
The reference ID of the periodic report to delete.
Return values
bool —Returns true upon successful deletion.
unsubscribe_user_from_periodic_report()
Unsubscribes a user from a specified periodic report.
unsubscribe_user_from_periodic_report(int $user_id, int $periodic_email_id) : boolThis function inserts a record into the unsubscribe table, preventing the specified user from receiving future emails related to the given periodic report.
Parameters
- $user_id : int
-
The ID of the user to unsubscribe.
- $periodic_email_id : int
-
The ID of the periodic email report to unsubscribe from.
Return values
bool —Returns true upon successful unsubscription.
get_translated_activity_type()
Retrieves the translated version of an activity type.
get_translated_activity_type(string $activity_type) : stringThis function takes an activity type string, checks if a corresponding translation exists in the global language array, and returns the translated string if available. If no translation is found, it returns the original activity type.
Parameters
- $activity_type : string
-
The activity type in plain text English.
Return values
string —The translated activity type if available; otherwise, the original activity type.
report_has_date()
Checks for the presence of date placeholders in a report's SQL query.
report_has_date(string $query) : boolParameters
- $query : string
-
The report's SQL query.
Return values
bool —Returns true if a date placeholder was found else false.
report_has_date_by_id()
Checks for the presence of date placeholders in a report's sql query using the report's id.
report_has_date_by_id(int $report) : boolParameters
- $report : int
-
Report id of the report to retrieve the query data from the report table.
Return values
bool —Returns true if a date placeholder was found else false.
report_has_thumbnail()
Check if report has a "thumbnail" column in its SQL query.
report_has_thumbnail(string|null $query) : boolParameters
- $query : string|null
-
The reports' SQL query.
Return values
boolreport_process_period()
Get report date range based on user input
report_process_period(array<string|int, mixed> $info) : array<string|int, mixed>Parameters
- $info : array<string|int, mixed>
-
Information about the period selection. See unit test for example input
Return values
array<string|int, mixed>report_process_query_placeholders()
Find and replace a reports' query placeholders with their values.
report_process_query_placeholders(string $query, array<string|int, mixed> $placeholders) : stringParameters
- $query : string
-
Reports' SQL query
- $placeholders : array<string|int, mixed>
-
Map between a placeholder and its actual value
Return values
stringrender_pie_graph()
Output the Javascript to build a pie chart in the canvas denoted by $id $data must be in the following format $data = array( "slice_a label" => "slice_a value", "slice_b label" => "slice_b value", );
render_pie_graph(string $id, array<string|int, mixed> $data[, string|null $total = null ]) : voidParameters
- $id : string
-
identifier for the canvas to render the chart in
- $data : array<string|int, mixed>
-
data to be rendered in the chart
- $total : string|null = null
-
null will mean that the data is complete and an extra field is not required a string can be used to denote the total value to pad the data to
render_bar_graph()
Output the Javascript to build a bar chart in the canvas denoted by $id $data must be in the following format $data = array( "point_a x value" => "point_a y value", "point_b x value" => "point_b y value",
render_bar_graph(string $id, array<string|int, mixed> $data) : voidParameters
- $id : string
-
identifier for the canvas to render the chart in
- $data : array<string|int, mixed>
-
data to be rendered in the chart
get_request()
Retrieve a resource request record
get_request(int $request) : mixedParameters
- $request : int
-
The request record ID
Return values
mixed —False if not found, the resource record (associative array) if found
get_user_requests()
Fetch a list of all requests for a user
get_user_requests([bool $excludecompleted = false ][, bool $returnsql = false ]) : mixedParameters
- $excludecompleted : bool = false
-
Exclude requests that have already been completed
- $returnsql : bool = false
-
Return the SQL for the execution rather than the results
save_request()
Handle the posted request form, when saving a request in the admin area.
save_request(int $request) : boolParameters
- $request : int
-
The request record ID
Return values
bool —Was this successful?
get_requests()
Fetch a list of requests assigned to the logged in user
get_requests([bool $excludecompleted = false ][, bool $excludeassigned = false ][, bool $returnsql = false ]) : mixedParameters
- $excludecompleted : bool = false
-
Exclude completed requests?
- $excludeassigned : bool = false
-
Exclude assigned requests? (e.g. if the user is able to assign unassigned requests) unless assigned to the logged in user
- $returnsql : bool = false
-
Return SQL query object instead of the results?
Return values
mixed —Resulting array of requests or an SQL query object
email_collection_request()
Email a collection request to the team responsible for dealing with requests. Request mode 0 only (non managed).
email_collection_request(int $ref, mixed $details, mixed $external_email) : boolParameters
- $ref : int
- $details : mixed
- $external_email : mixed
Return values
boolmanaged_collection_request()
Request mode 1 - quests are managed via the administrative interface. Sends an e-mail but also logs the request in the request table.
managed_collection_request(mixed $ref, mixed $details[, mixed $ref_is_resource = false ]) : boolParameters
- $ref : mixed
- $details : mixed
- $ref_is_resource : mixed = false
Return values
boolemail_resource_request()
E-mails a basic resource request for a single resource (posted) to the team (not a managed request)
email_resource_request(mixed $ref, mixed $details) : void|false|stringParameters
- $ref : mixed
-
The resource ID
- $details : mixed
-
The request details provided by the user
Return values
void|false|stringget_valid_custom_fields()
Get collection of valid custom fields. A valid fields has at least the expected field properties
get_valid_custom_fields(array<string|int, mixed> $fields) : array<string|int, mixed>IMPORTANT: these fields are not metadata fields - they are configured through config options such as custom_researchrequest_fields
Parameters
- $fields : array<string|int, mixed>
-
List of custom fields. Often this will simply be the global configuration option (e.g custom_researchrequest_fields)
Return values
array<string|int, mixed>gen_custom_fields_html_props()
Generate HTML properties for custom fields. These properties can then be used by other functions like render_custom_fields or process_custom_fields_submission
gen_custom_fields_html_props(array<string|int, mixed> $fields, array<string|int, mixed> $ctx) : array<string|int, mixed>Parameters
- $fields : array<string|int, mixed>
-
List of custom fields as returned by get_valid_custom_fields(). Note: At this point code assumes fields have been validated
- $ctx : array<string|int, mixed>
-
Contextual information for process_custom_fields_submission()
Return values
array<string|int, mixed> —Returns collection items with the extra "html_properties" key
process_custom_fields_submission()
Process posted custom fields
process_custom_fields_submission(array<string|int, mixed> $fields, bool $submitted, array<string|int, mixed> $ctx) : array<string|int, mixed>Parameters
- $fields : array<string|int, mixed>
-
List of custom fields
- $submitted : bool
-
Processing submitted fields?
- $ctx : array<string|int, mixed>
-
Contextual information (e.g. change the prefix for html tags' identifiers)
Return values
array<string|int, mixed> —Returns collection of items with the extra "html_properties" key
can_use_owner_field()
Initialisation and system check if configuration is correctly enabled to use the owner field and mappings logic.
can_use_owner_field() : boolIMPORTANT: during init the globals $owner_field & $owner_field_mappings values will be updated for validation purposes
Return values
bool —Return true if the system is configured with a valid $owner_field and numeric $owner_field_mappings, false otherwise.
get_notification_users_by_owner_field()
Get users to notify for requested resources "owned" by particular groups. Configurable using a metadata field ($owner_field) and a defined map ($owner_field_mappings).
get_notification_users_by_owner_field(array<string|int, mixed> $users, array<string|int, mixed> $resources) : array<string|int, mixed>Parameters
- $users : array<string|int, mixed>
-
List of notification users get_notification_users(). Any array structure where each value contains an array with at least a "ref" and "email" keys.
- $resources : array<string|int, mixed>
-
List of resource IDs
Return values
array<string|int, mixed> —Returns user ID (key) and email (value)
resource_request_visible()
Can the logged in user see the request specified?
resource_request_visible(array<string|int, mixed> $request) : boolParameters
- $request : array<string|int, mixed>
-
Array of request details
Return values
boolsend_research_request()
Sends a research request by inserting it into the requests table and notifying the relevant users.
send_research_request(array<string|int, mixed> $rr_cfields) : voidThis function takes an array of custom fields related to the research request, processes the input data, and sends an email notification to the designated research admins. It gathers resource types, deadlines, contact information, and custom fields, and stores them in the database. It also constructs and sends a notification message with the request details.
Parameters
- $rr_cfields : array<string|int, mixed>
-
An array of custom fields associated with the research request.
Tags
Return values
void —This function does not return any value but performs database operations and sends notifications.
get_research_requests()
Retrieves research requests from the database, optionally filtering by a search term and sorting the results by a specified field.
get_research_requests([string $find = "" ][, string $order_by = "name" ][, string $sort = "ASC" ]) : array<string|int, mixed>Parameters
- $find : string = ""
-
Optional search term to filter research requests by name, description, contact, or reference number.
- $order_by : string = "name"
-
The field to sort the results by. Valid options are 'ref', 'name', 'created', 'status', or 'assigned_to'.
- $sort : string = "ASC"
-
The sort direction, either 'ASC' or 'DESC'. Defaults to 'ASC'.
Return values
array<string|int, mixed> —An array of research requests that match the search criteria.
get_research_request()
Retrieves a research request by its reference number, returning its details including name, description, deadline, contact information, user assignment, status, and custom fields.
get_research_request(int $ref) : array<string|int, mixed>|falseParameters
- $ref : int
-
The reference number of the research request to retrieve.
Return values
array<string|int, mixed>|false —An associative array with the research request details if found, or false if no request exists.
save_research_request()
Saves a research request by updating its status and assigned user, sending notifications to the originator if the status changes, and optionally deleting the request or copying existing collection resources.
save_research_request(int $ref) : boolParameters
- $ref : int
-
The reference number of the research request to be saved.
Return values
bool —True if the operation was successful, false otherwise.
get_research_request_collection()
Retrieves the collection reference associated with a given research request.
get_research_request_collection(int $ref) : int|falseParameters
- $ref : int
-
The reference number of the research request.
Return values
int|false —The collection reference if found, or false if not.
set_research_collection()
Updates the collection reference associated with a specified research request.
set_research_collection(int $research, int $collection) : voidParameters
- $research : int
-
The reference number of the research request.
- $collection : int
-
The reference number of the collection to associate.
get_resource_path()
Get resource path / resource URL / download URL for this resource
get_resource_path(int $ref, bool $getfilepath[, string|null $size = '' ][, bool $generate = true ][, string|null $extension = 'jpg' ][, bool $scramble = true ][, int $page = 1 ][, bool $watermarked = false ][, string|null $file_modified = '' ][, int $alternative = -1 ][, bool $includemodified = true ]) : stringIMPORTANT: the download URL should always be used client side (public) whilst filstore path is private for internal use only
Parameters
- $ref : int
-
Resource ID
- $getfilepath : bool
-
Set to TRUE to get the filestore (physical) path
- $size : string|null = ''
-
Specify which size of the resource should be returned. Use '' for original file
- $generate : bool = true
-
Generate folder if not found
- $extension : string|null = 'jpg'
-
Extension of the file we are looking for. For original file, this would be the file extension, otherwise use the preview extension (e.g image preview will have JPG while video preview can have MP4 or others)
- $scramble : bool = true
-
Set to TRUE to get the scrambled folder (requires scramble key for it to work)
- $page : int = 1
-
For documents, use the page number we are trying to get the preview of.
- $watermarked : bool = false
-
Get the watermark version?
- $file_modified : string|null = ''
-
Specify when the file was last modified as a Unix timestamp
- $alternative : int = -1
-
ID of the alternative file
- $includemodified : bool = true
-
Show when the file was last modified
Tags
Return values
string —resource path / resource URL / download URL
get_resource_data()
get_resource_data(mixed $ref[, mixed $cache = true ]) : mixedParameters
- $ref : mixed
- $cache : mixed = true
Tags
get_resource_data_batch()
get_resource_data_batch - get data from resource table for all resource IDs
get_resource_data_batch(mixed $refs) : array<string|int, mixed>Parameters
- $refs : mixed
-
- array of resource IDs
Return values
array<string|int, mixed>put_resource_data()
Updates $resource with the name/value pairs in $data - this relates to the resource table column, not metadata.
put_resource_data(int $resource, array<string|int, mixed> $data) : boolParameters
- $resource : int
-
ID of resource
- $data : array<string|int, mixed>
-
Array of data to be applied to resource
Return values
boolcreate_resource()
create_resource
create_resource(int $resource_type[, int $archive = 999 ][, int $user = -1 ][, string $origin = '' ][, string $file_extension = '' ][, bool $run_macro = true ]) : mixedParameters
- $resource_type : int
-
ID of target resource type
- $archive : int = 999
-
ID of target archive state, 999 if archived
- $user : int = -1
-
User ID, -1 for current user
- $origin : string = ''
-
Source of resource, should not be blank
- $file_extension : string = ''
-
If specified
- $run_macro : bool = true
-
Run autocomplete macros, can be disabled if they are run later in process
Return values
mixed —false if invalid inputs given, integer of resource reference if resource is created
update_hitcount()
update_hitcount(mixed $ref) : mixedParameters
- $ref : mixed
save_resource_data()
Save resource data
save_resource_data(int $ref, bool $multi[, string|int $autosave_field = "" ]) : true|array<string|int, mixed>IMPORTANT: inactive nodes should be left alone (don't add/remove) except when processing fixed list field types that only hold one value (dropdown, radio). Plugins should determine this based on their use cases when hooking.
Parameters
- $ref : int
- $multi : bool
- $autosave_field : string|int = ""
Return values
true|array<string|int, mixed> —List of errors if unsuccessful, true otherwise
set_resource_defaults()
Set resource defaults. Optional, a list of field IDs can be passed on to only update certain fields.
set_resource_defaults(int $ref[, array<string|int, mixed> $specific_fields = array() ]) : boolIMPORTANT: this function will always set the resource defaults if any are found. The "client code" is where developers decide whether this should happen
Parameters
- $ref : int
-
Resource ID
- $specific_fields : array<string|int, mixed> = array()
-
Specific field ID(s) to update
Return values
boolsave_resource_data_multi()
Batch save resources in a collection
save_resource_data_multi(int $collection[, array<string|int, mixed> $editsearch = array() ][, array<string|int, mixed> $postvals = [] ]) : true|array<string|int, mixed>IMPORTANT: inactive nodes should be left alone (don't add/remove) except when processing fixed list field types that only hold one value (dropdown, radio). Plugins should determine this based on their use cases when hooking.
Parameters
- $collection : int
- $editsearch : array<string|int, mixed> = array()
- $postvals : array<string|int, mixed> = []
Return values
true|array<string|int, mixed> —List of errors if unsuccessful, true otherwise
update_field()
Updates resource field. Works out the previous value, so this is not efficient if we already know what this previous value is (hence it is not used for edit where multiple fields are saved)
update_field(int $resource, int $field, string $value[, array<string|int, mixed> &$errors = array() ][, bool $log = true ][, bool $nodevalues = false ]) : boolParameters
- $resource : int
-
Resource ID
- $field : int
-
Field ID
- $value : string
-
The new value
- $errors : array<string|int, mixed> = array()
-
Any errors that may occur during update
- $log : bool = true
-
Log this change in the resource log?
- $nodevalues : bool = false
-
Set to TRUE to process the value as a comma separated list of node IDs
Tags
Return values
boolemail_resource()
email_resource(mixed $resource, mixed $resourcename, mixed $fromusername, mixed $userlist, mixed $message[, mixed $access = -1 ][, mixed $expires = "" ][, mixed $sharepwd = "" ][, mixed $useremail = "" ][, mixed $from_name = "" ][, mixed $cc = "" ][, mixed $list_recipients = false ][, mixed $open_internal_access = false ][, mixed $useraccess = 2 ][, mixed $group = "" ]) : mixedParameters
- $resource : mixed
- $resourcename : mixed
- $fromusername : mixed
- $userlist : mixed
- $message : mixed
- $access : mixed = -1
- $expires : mixed = ""
- $sharepwd : mixed = ""
- $useremail : mixed = ""
- $from_name : mixed = ""
- $cc : mixed = ""
- $list_recipients : mixed = false
- $open_internal_access : mixed = false
- $useraccess : mixed = 2
- $group : mixed = ""
delete_resource()
delete_resource(mixed $ref) : mixedParameters
- $ref : mixed
get_resource_type_field()
Returns field data from resource_type_field for the given field
get_resource_type_field(int $field) : bool|array<string|int, mixed>Parameters
- $field : int
-
Resource type field ID
Tags
Return values
bool|array<string|int, mixed>get_resource_field_data()
get_resource_field_data
get_resource_field_data(int $ref[, bool $multi = false ][, bool $use_permissions = true ][, int $originalref = null ][, bool $external_access = false ][, bool $ord_by = false ][, bool $forcsv = false ][, bool $translate_value = true ]) : array<string|int, mixed>|boolParameters
- $ref : int
-
Resource ID
- $multi : bool = false
-
Get all fields? False by default (only fields that apply to the given resource type)
- $use_permissions : bool = true
-
Honour user permissions e.g. field access. TRUE by default
- $originalref : int = null
-
Original resource ID to get data for. NULL by default
- $external_access : bool = false
-
Only get data permitted to view externally. FALSE by default
- $ord_by : bool = false
-
Use field order_by setting. FALSE by default (order is by resource type first)
- $forcsv : bool = false
-
Get data for CSV export (uses \ separator for category tree nodes). FALSE by default
- $translate_value : bool = true
-
Field value will be translated with i18n_get_translated() unless FALSE supplied.
Tags
Return values
array<string|int, mixed>|boolget_resource_field_data_batch()
get_resource_field_data_batch - Get all resource data for the given resources
get_resource_field_data_batch(array<string|int, mixed> $resources[, bool $use_permissions = true ][, bool $external_access = false ][, bool $ord_by = false ][, mixed $exportoptions = array() ]) : array<string|int, mixed>Returns a multidimensional array with resource IDs as top level keys, then fields (order determined by $ord_by setting) IMPORTANT: This differs from get_resource_field_data() in that only fields containing data will be returned.
e.g. Array ( [119912] => array ( [0] => Array ( [resource] => 119912 [value] => This is the title of resource 119912 [resource_type_field] => 8 [ref] => 8 [name] => title [title] => Title [field_constraint] => 0 [type] => 1)) ....
Parameters
- $resources : array<string|int, mixed>
-
(either an array of resource ids or an array returned from search results)
- $use_permissions : bool = true
-
Honour user permissions e.g. field access. TRUE by default
- $external_access : bool = false
-
Only get data permitted to view externally. FALSE by default
- $ord_by : bool = false
-
Use field order_by setting. FALSE by default (order is by resource type first)
- $exportoptions : mixed = array()
-
Array of options as below "csvexport" (bool) - get data for CSV export (uses \ separator for category tree nodes) "personal" (bool) - include data in fields marked as personal "alldata" (bool) - include data in all fields, including technical metadata
Return values
array<string|int, mixed> —Array of resource data organised by resource then metadata field ID
get_resource_types()
Return an array of resource types that this user has access to
get_resource_types([string $types = "" ][, bool $translate = true ][, bool $ignore_access = false ][, bool $usecache = false ]) : array<string|int, mixed>Parameters
- $types : string = ""
-
Comma separated list to limit the types that are returned by ref, blank string returns all available types
- $translate : bool = true
-
Flag to translate the resource types before returning
- $ignore_access : bool = false
-
Return all resource types regardless of access?#
- $usecache : bool = false
-
Return cached result?
Return values
array<string|int, mixed> —Array of resource types limited by T* permissions and optionally by $types
get_all_resource_types()
Returns all resources types
get_all_resource_types() : array<string|int, mixed>No permissions are checked or applied, do not expose this function to the API
Return values
array<string|int, mixed> —Array of resource types ordered by 'order_by' then 'ref'
clear_resource_data()
clear_resource_data(mixed $resource) : mixedParameters
- $resource : mixed
copy_resource()
Create a new resource, copying all data from the resource with reference $from.
copy_resource(int $from[, int $resource_type = -1 ][, string $origin = '' ]) : bool|intNote this copies only the data and not any attached file. It's very unlikely the same file would be in the system twice, however users may want to clone an existing resource to avoid reentering data if the resource is very similar. If $resource_type if specified then the resource type for the new resource will be set to $resource_type rather than simply copied from the $from resource.
Parameters
- $from : int
-
ID of resource
- $resource_type : int = -1
-
ID of resource type
- $origin : string = ''
-
Origin of resource when uploading, leave blank if not an upload
Return values
bool|intresource_log()
Log resource activity
resource_log(int $resource, string $type, int $field[, string $notes = "" ][, mixed $fromvalue = "" ][, mixed $tovalue = "" ][, int $usage = -1 ][, int $alt_ref = -1 ]) : intParameters
- $resource : int
-
- resource ref -- resource_log.resource
- $type : string
-
- log code defined in include/definitions.php -- resource_log.type
- $field : int
-
- resource type field -- resource_log.resource_type_field
- $notes : string = ""
-
- text notes -- resource_log.notes
- $fromvalue : mixed = ""
-
- original value (int or string) -- resource_log.previous_value
- $tovalue : mixed = ""
-
- new value (int or string)
- $usage : int = -1
-
-- resource_log.usageoption
- $alt_ref : int = -1
-
- ref of alt file -- resource_log.alt_ref
Tags
Return values
int —(or false)
get_resource_log()
Get resource log records. The standard field titles are translated using $lang. Custom field titles are i18n translated.
get_resource_log(int $resource[, int $fetchrows = -1 ][, array<string|int, mixed> $filters = array() ]) : array<string|int, mixed>Parameters
- $resource : int
-
Resource ID - set to NULL and specify r.ref=>[id] in the $filters array to retrieve a specific log entry by log ref
- $fetchrows : int = -1
-
If $fetchrows is set we don't have to loop through all the returned rows. @see ps_query()
- $filters : array<string|int, mixed> = array()
-
List of filters to include in the where clause. The key of the array is linked to the available columns in the sql statement so they must match!
Return values
array<string|int, mixed>get_resource_type_name()
get_resource_type_name(mixed $type) : mixedParameters
- $type : mixed
get_resource_custom_access()
get_resource_custom_access(mixed $resource) : mixedParameters
- $resource : mixed
get_resource_custom_access_users_usergroups()
Retrieves custom access settings for users and user groups associated with a specific resource.
get_resource_custom_access_users_usergroups(int $resource) : array<string|int, mixed>This function performs a database query to return a list of custom access rows for a given resource, including the names of user groups and users, the access level, and expiration details.
Parameters
- $resource : int
-
The resource reference ID for which to retrieve custom access settings.
Return values
array<string|int, mixed> —The result set containing user groups, users, access levels, and expiration information.
save_resource_custom_access()
Saves custom access settings for a specific resource.
save_resource_custom_access(int $resource) : voidThis function retrieves custom access groups associated with the given resource, deletes existing custom access records for that resource, and then inserts new access settings based on user input.
Parameters
- $resource : int
-
The resource reference ID for which custom access is being set.
get_custom_access()
Lookup custom access value for a resource
get_custom_access(int $resource, int $usergroup[, bool $return_default = true ]) : mixedParameters
- $resource : int
-
Resource ID.
- $usergroup : int
-
User group ID.
- $return_default : bool = true
-
Return default custom access value RESOURCE_ACCESS_CONFIDENTIAL
Return values
mixed —False if custom access is disabled or there is no custom access value set for this resource. Int representing custom access level if set; 0 - open, 1 - restricted, 2 - confidential.
get_themes_by_resource()
Determine the featured collections and public collections a resource is associated with.
get_themes_by_resource(int $ref) : array<string|int, mixed>Parameters
- $ref : int
-
Resource ref
Return values
array<string|int, mixed>update_resource_type()
update_resource_type(mixed $ref, mixed $type) : mixedParameters
- $ref : mixed
- $type : mixed
Tags
get_exiftool_fields()
Returns a list of exiftool fields, which are basically fields with an 'exiftool field' set.
get_exiftool_fields(int $resource_type[, string $option_separator = "," ][, bool $skip_translation = false ]) : array<string|int, mixed>Parameters
- $resource_type : int
- $option_separator : string = ","
-
String to separate the node options returned for fixed list fields
- Recommended NODE_NAME_STRING_SEPARATOR
- Defaults to comma for backwards compatibility
- $skip_translation : bool = false
-
Set to true to return the entire untranslated node value rather than the appropriate translation only.
Return values
array<string|int, mixed>createTempFile()
Create a temporary copy of the file in the tmp folder (ie. the usual filestore/tmp/)
createTempFile(string $path, string $uniqid, string $filename) : bool|stringParameters
- $path : string
-
File path
- $uniqid : string
-
If a uniqid is provided, create a folder within tmp. See get_temp_dir() for more information.
- $filename : string
-
Filename of the new file
Tags
Return values
bool|string —Returns FALSE or the file path of the temporary file
stripMetadata()
Strips metadata from file
stripMetadata(string $file_path) : bool|stringParameters
- $file_path : string
-
Physical path to file that will have metadata stripped. Use NULL to just get the exiftool command returned instead of running the command on the file
Tags
Return values
bool|string —Returns TRUE or the Exiftool command for stripping metadata
write_metadata()
Writes metadata to a specified file using ExifTool.
write_metadata(string $path, int $ref[, string $uniqid = "" ]) : string|boolParameters
- $path : string
-
The file path where the metadata will be written.
- $ref : int
-
The reference ID of the resource associated with the file.
- $uniqid : string = ""
-
A unique identifier for the temporary file location (optional).
Return values
string|bool —The path to the temporary file if successful, false otherwise.
delete_exif_tmpfile()
Delete Exif temp file
delete_exif_tmpfile(string $tmpfile) : mixedParameters
- $tmpfile : string
-
Exif temp file to be deleted
update_resource()
Updates a resource with a new file and its associated metadata.
update_resource(int $r, string $path, string $type, string $title[, bool $ingest = false ][, bool $createPreviews = true ][, string $extension = '' ][, bool $after_upload_processing = false ]) : int|boolParameters
- $r : int
-
The resource ID to update.
- $path : string
-
The file path of the new resource.
- $type : string
-
The type of the resource.
- $title : string
-
The title for the resource.
- $ingest : bool = false
-
Indicates if the resource is being ingested.
- $createPreviews : bool = true
-
Flag to create previews.
- $extension : string = ''
-
The file extension of the new resource.
- $after_upload_processing : bool = false
-
Indicates if the update is after upload processing.
Return values
int|bool —The resource ID if successful, false otherwise.
import_resource()
Imports a resource from the specified path and updates its details.
import_resource(string $path, string $type, string $title[, bool $ingest = false ][, string $extension = '' ]) : int|boolThis function is used to import resources into the system, particularly through staticsync.php It creates a new resource entry and updates it with the provided file details.
Parameters
- $path : string
-
The file path of the resource to import.
- $type : string
-
The type of the resource being imported.
- $title : string
-
The title for the imported resource.
- $ingest : bool = false
-
Indicates if the resource is being ingested (default is false).
- $extension : string = ''
-
The file extension of the resource (optional).
Return values
int|bool —The newly created resource ID if successful, false otherwise.
get_alternative_files()
Retrieves alternative files associated with a specified resource.
get_alternative_files(int $resource[, string $order_by = "" ][, string $sort = "" ][, string $type = "" ]) : array<string|int, mixed>|boolParameters
- $resource : int
-
The resource ID for which to fetch alternative files.
- $order_by : string = ""
-
The field to order the results by (optional).
- $sort : string = ""
-
The sorting direction (ASC or DESC) for the order_by field (optional).
- $type : string = ""
-
The type of alternative file to filter by (optional).
Return values
array<string|int, mixed>|bool —An array of alternative files if successful, false otherwise.
get_alternative_files_by_filename()
Search the alternative file records for matching filenames Alternative files can be optionally filtered by the Resource ID or by collection
get_alternative_files_by_filename(string $filename, int $collection, int $min, int $max) : array<string|int, mixed>Parameters
- $filename : string
-
Filename of the alternative file(s) to search for
- $collection : int
-
Collection ID to filter resources, use 0 to ignore
- $min : int
-
Minimum Resource ID to consider, use 0 to ignore
- $max : int
-
Maximum Resource ID to consider, use 0 to ignore
Return values
array<string|int, mixed> —All matching alternative file records with corresponding: resource ID, filename, file size, extension, name, and description
add_alternative_file()
Add alternative file
add_alternative_file(int $resource, string $name[, string $description = "" ][, string $file_name = "" ][, string $file_extension = "" ][, int $file_size = 0 ][, string $alt_type = '' ]) : intParameters
- $resource : int
- $name : string
- $description : string = ""
- $file_name : string = ""
- $file_extension : string = ""
- $file_size : int = 0
- $alt_type : string = ''
Return values
intdelete_alternative_file()
delete_alternative_file
delete_alternative_file(int $resource, int $ref) : boolParameters
- $resource : int
-
Resource id.
- $ref : int
-
Alternative file id.
Return values
boolget_alternative_file()
Retrieves a specific alternative file associated with a given resource.
get_alternative_file(int $resource, int $ref) : array<string|int, mixed>|boolParameters
- $resource : int
-
The resource ID associated with the alternative file.
- $ref : int
-
The reference ID of the alternative file to retrieve.
Tags
Return values
array<string|int, mixed>|bool —An associative array containing the alternative file details if found, false otherwise.
save_alternative_file()
Updates the details of an alternative file in the database.
save_alternative_file(int $resource, int $ref[, array<string|int, mixed> $data = [] ]) : voidParameters
- $resource : int
-
The resource ID associated with the alternative file.
- $ref : int
-
The reference ID of the alternative file to update.
- $data : array<string|int, mixed> = []
-
Array of data in name=>value format, where name is the resource_alt_files column name. If a column is to be left as is then it must not be included in the array
user_rating_save()
Saves a user rating for a given resource.
user_rating_save(int $userref, int $ref, int $rating) : voidParameters
- $userref : int
-
The reference ID of the user rating the resource.
- $ref : int
-
The reference ID of the resource being rated.
- $rating : int
-
The rating value to be saved (0 to remove rating).
get_field()
A standard field title is translated using $lang. A custom field title is i18n translated.
get_field(int $field) : bool|array<string|int, mixed>Parameters
- $field : int
-
Resource type field ID
Return values
bool|array<string|int, mixed> —Returns FALSE or record data (array)
get_keyword_from_option()
Retrieves the keyword that will be indexed for a given field option.
get_keyword_from_option(string $option) : stringThis function splits the provided option into keywords and applies stemming if enabled.
Parameters
- $option : string
-
The field option to process.
Return values
string —The keyword to be indexed.
get_resource_access()
Retrieves the access level for the currently logged-in user for a specified resource.
get_resource_access(int|array<string|int, mixed> $resource) : intThe access levels returned are:
- 0 = Full Access (download all sizes)
- 1 = Restricted Access (download only those sizes that are set to allow restricted downloads)
- 2 = Confidential (no access)
Parameters
- $resource : int|array<string|int, mixed>
-
The reference ID of the resource or a resource data array.
Tags
Return values
int —The access level for the resource.
get_custom_access_user()
Retrieves the custom access level for a specific user on a given resource.
get_custom_access_user(int $resource, int $user) : mixedThis function checks the
resource_custom_accesstable to see if the user has any custom access permissions for the specified resource. It returns the access level if found and still valid; otherwise, it returns false.Parameters
- $resource : int
-
The resource ID to check access for.
- $user : int
-
The user ID to check for custom access.
Return values
mixed —The access level if found; false otherwise.
edit_resource_external_access()
Edits the external access settings for a given resource.
edit_resource_external_access(string $key[, int $access = -1 ][, string $expires = "" ][, string $group = "" ][, string $sharepwd = "" ]) : boolParameters
- $key : string
-
The external access key to edit.
- $access : int = -1
-
The new access level; defaults to -1 for no change.
- $expires : string = ""
-
The expiration date for the access key; optional.
- $group : string = ""
-
The user group to share with; defaults to the current user group if not specified.
- $sharepwd : string = ""
-
The password for accessing the resource; "(unchanged)" means no change.
Return values
bool —Returns true if the operation was successful; false if the key is empty.
resource_download_allowed()
For the given resource and size, can the current user download it? resource type and access may already be available in the case of search, so pass them along to get_resource_access to avoid extra queries $resource can be a resource-specific search result array.
resource_download_allowed(int $resource, string $size, int $resource_type[, int $alternative = -1 ][, bool $usecache = false ]) : boolParameters
- $resource : int
-
ID of resource
- $size : string
-
ID of size
- $resource_type : int
-
ID of resource type
- $alternative : int = -1
-
Use alternative?
- $usecache : bool = false
-
Use cached result if available?
Return values
boolget_edit_access()
Check if current user has edit access to a resource. Checks the edit permissions (e0, e-1 etc.) and also the group edit filter which filters edit access based on resource metadata.
get_edit_access(int $resource[, int $status = -999 ][, array<string|int, mixed> &$resourcedata = [] ]) : boolParameters
- $resource : int
-
Resource ID
- $status : int = -999
-
Archive status ID. Use -999 to use the one from resourcedata argument
- $resourcedata : array<string|int, mixed> = []
Return values
boolfilter_match()
In the given filter string, does name/value match? Returns: 0 = no match for name 1 = matched name but value was not present 2 = matched name and value was correct
filter_match(string $filter, string $name, string $value) : intParameters
- $filter : string
-
Sring to for which filtering is to be applied
- $name : string
-
Name to match
- $value : string
-
Value to match
Return values
intlog_diff()
Check changes made to a metadata field and create a nice user friendly summary
log_diff(string $fromvalue, string $tovalue) : stringParameters
- $fromvalue : string
-
- if nodes then values will be separated by NODE_NAME_STRING_SEPARATOR
- $tovalue : string
-
- if nodes then values will be separated by NODE_NAME_STRING_SEPARATOR
Tags
Return values
stringget_metadata_templates()
Retrieves a list of all metadata templates for a specified resource type.
get_metadata_templates() : array<string|int, mixed>Return values
array<string|int, mixed> —An array of metadata templates, each containing the resource reference and its title.
get_resource_collections()
Retrieves a list of collections that a resource is used in for the specified resource reference.
get_resource_collections(int $ref) : array<string|int, mixed>Parameters
- $ref : int
-
The resource reference for which to retrieve associated collections.
Return values
array<string|int, mixed> —An array of collections associated with the resource, including user information and resource count.
download_summary()
Retrieves a summary of downloads for a given resource, categorized by usage type.
download_summary(int $resource) : array<string|int, mixed>This function queries the resource log to count the number of downloads for the specified resource, grouping the results by the usage option.
Parameters
- $resource : int
-
The resource reference for which to retrieve the download summary.
Return values
array<string|int, mixed> —An array of download summaries, each containing the usage option and the corresponding count.
check_use_watermark()
check_use_watermark([mixed $download_key = "" ][, mixed $resource = "" ]) : mixedParameters
- $download_key : mixed = ""
- $resource : mixed = ""
autocomplete_blank_fields()
Fill in any blank fields for the resource.
autocomplete_blank_fields(int $resource, bool $force_run[, bool $return_changes = false ][, int $field_ref = 0 ]) : bool|array<string|int, mixed>IMPORTANT: Auto completing blank fields with inactive options should be allowed (possibly a system misconfiguration). This function will NOT exclude inactive nodes because, for required fields, you might end up having no value after processing the field.
Parameters
- $resource : int
-
Resource ID
- $force_run : bool
-
Allow code to force running this function and update the fields even if there is data.
- $return_changes : bool = false
-
When true an array of fields changed by autocomplete is returned. For example:
- when creating a resource, autocomplete_blank_fields() should always be triggered regardless if user has data in its user template.
- when copying resource/ extracting embedded metadata, autocomplete_blank_fields() should not overwrite if there is data for that field as at this point you probably have the expected data for your field.
- $field_ref : int = 0
-
Optional parameter to specify which metadata field should be processed. Left blank, all fields will be processed (default behaviour).
Return values
bool|array<string|int, mixed> —Success/fail or array of changes made
get_page_count()
get_page_count(mixed $resource[, mixed $alternative = -1 ]) : mixedParameters
- $resource : mixed
- $alternative : mixed = -1
Tags
update_disk_usage()
Updates the disk usage for a specified resource by calculating the total size of the files in the resource's directory and storing the result in the resource table.
update_disk_usage(int $resource) : boolThis function first checks for the size of the primary resource file and then scans the associated folder to compute the total disk usage, excluding any files in staticsync locations.
Parameters
- $resource : int
-
The resource reference whose disk usage is to be updated.
Return values
bool —Returns true on success, or false if the directory does not exist.
update_disk_usage_cron()
Update disk usage for all resources that have not yet been updated or have not been updated in the past 30 days.
update_disk_usage_cron() : bool|voidLimit to a reasonable amount so that this process is spread over several cron intervals for large data sets.
Return values
bool|voidget_total_disk_usage()
Returns the total disk space used by all resources on the system
get_total_disk_usage() : intReturn values
intoverquota()
Calculate if the quota set by $disksize in the configuration has been exceeded.
overquota() : array<string|int, mixed>|boolReturn values
array<string|int, mixed>|bool —True if the system is over quota
get_original_imagesize()
Get size of specified image file
get_original_imagesize([int $ref = "" ][, string $path = "" ][, string $extension = "jpg" ][, bool $forcefromfile = false ]) : array<string|int, mixed>|boolParameters
- $ref : int = ""
-
Resource ID
- $path : string = ""
-
File path
- $extension : string = "jpg"
-
File extension
- $forcefromfile : bool = false
-
Get info from file instead of database cache
Tags
Return values
array<string|int, mixed>|bool —File size info. Returns false if not available
generate_resource_access_key()
Generates an external access key for a resource, allowing specified access to a user or group.
generate_resource_access_key(int $resource, int $userref, int $access, string|null $expires, string $email[, string $group = "" ][, string $sharepwd = "" ]) : string|boolThis function creates a unique access key and stores it in the database along with information about the resource, the user, the type of access granted, expiration date, email, and user group. It also hashes the share password if provided.
Parameters
- $resource : int
-
The resource reference for which the access key is being generated.
- $userref : int
-
The user reference for the user to whom access is granted.
- $access : int
-
The level of access granted (e.g., full access, restricted).
- $expires : string|null
-
The expiration date of the access key, formatted as 'Y-m-d'.
- $email : string
-
The email address associated with the user receiving the access key.
- $group : string = ""
-
The user group associated with the access, defaults to the current user group if not specified.
- $sharepwd : string = ""
-
The share password, if any, used to secure access.
Return values
string|bool —Returns the generated access key on success, or false if permissions are insufficient.
get_resource_external_access()
Retrieves all external access keys granted for a specific resource.
get_resource_external_access(int $resource) : array<string|int, mixed>This function returns a list of all external access details for the given resource, including users and emails associated with each access key. If the user does not have the elevated 'v' permission, the function will only return access keys associated with the current user. The results are grouped by access key, allowing for multiple users or emails to be returned as comma-separated values.
Parameters
- $resource : int
-
The reference ID of the resource for which external access is being retrieved.
Return values
array<string|int, mixed> —An array of access details, including access keys, users, emails, expiration dates, and other related information for the specified resource.
delete_resource_access_key()
delete_resource_access_key(mixed $resource, mixed $access_key) : mixedParameters
- $resource : mixed
- $access_key : mixed
resource_type_config_override()
resource_type_config_override(mixed $resource_type[, mixed $only_onchange = true ]) : mixedParameters
- $resource_type : mixed
- $only_onchange : mixed = true
update_archive_status()
Update the archive state of resource(s) and log this
update_archive_status(mixed $resource, int $archive[, int|array<string|int, mixed> $existingstates = array() ][, int $collection = 0 ][, mixed $more_notes = "" ]) : voidParameters
- $resource : mixed
- $archive : int
-
- Destination archive state
- $existingstates : int|array<string|int, mixed> = array()
-
- existing archive state or array of corresponding existing archive states
- $collection : int = 0
-
- optional id of collection containing resources
- $more_notes : mixed = ""
Tags
delete_resources_in_collection()
delete_resources_in_collection(mixed $collection) : mixedParameters
- $collection : mixed
update_related_resource()
Update related resources - add new related resource(s) or delete existing
update_related_resource(int $ref, mixed $related[, bool $add = true ]) : boolParameters
- $ref : int
-
ID of primary resource
- $related : mixed
- $add : bool = true
-
Add relationship? If false this will delete the specified relationships
Return values
boolcan_share_resource()
Check if sharing of resource is permitted
can_share_resource(int $ref[, int $access = "" ]) : boolParameters
- $ref : int
-
ID of resource
- $access : int = ""
-
Level of resource access (0 - Open 1 - Restricted 2 - Confidential)
Return values
booldelete_resource_custom_access_usergroups()
Delete all usergroup specific access to resource $ref
delete_resource_custom_access_usergroups(int $ref) : mixedParameters
- $ref : int
-
ID of resource
truncate_join_field_value()
Truncate the field for insertion into the main resource table field
truncate_join_field_value(string $value) : stringParameters
- $value : string
Return values
stringget_video_snapshots()
Check whether a resource (of a video type) has any snapshots created.
get_video_snapshots(int $resource_id[, bool $file_path = false ][, bool $count_only = false ][, mixed $includemodified = false ]) : array<string|int, mixed>|intSnapshots are being created using config option $ffmpeg_snapshot_frames
Parameters
- $resource_id : int
-
Resource unique ref
- $file_path : bool = false
-
Specify whether the return value should be the file path. Default is FALSE
- $count_only : bool = false
-
Set to true if we are only interested in how many snapshots we have. Default is FALSE
- $includemodified : mixed = false
Tags
Return values
array<string|int, mixed>|int —Array of all file paths found or number of files found
resource_file_readonly()
Check if resource file is read-only because it's part of the filestore template threshold
resource_file_readonly(int|numeric-string $ref) : boolParameters
- $ref : int|numeric-string
-
Resource ID
Return values
booldelete_resource_custom_user_access()
delete_resource_custom_user_access(mixed $resource, mixed $user) : mixedParameters
- $resource : mixed
- $user : mixed
get_video_info()
get_video_info(mixed $file) : mixedParameters
- $file : mixed
Tags
copyAllDataToResource()
Provides the ability to copy any metadata field data from one resource to another.
copyAllDataToResource(int $from, int $to[, mixed $resourcedata = false ]) : boolParameters
- $from : int
-
Resource we are copying data from
- $to : int
-
The Resource ID that needs updating
- $resourcedata : mixed = false
Return values
boolcopy_locked_data()
Update resource data for 'locked' fields from last edited resource. Used for upload_then_edit
copy_locked_data(array<string|int, mixed> $resource, array<string|int, mixed> $locked_fields, int $lastedited[, bool $save = false ]) : array<string|int, mixed>Parameters
- $resource : array<string|int, mixed>
-
- existing resource data
- $locked_fields : array<string|int, mixed>
-
- array of locked data columns (may also include field ids which are handled by copy_locked_fields)
- $lastedited : int
-
- last edited resource to copy data from
- $save : bool = false
-
- if true, save data to database (as opposed to just updating the $resource array e.g. for edit page)
Tags
Return values
array<string|int, mixed> —$resource - modified resource data array
copy_locked_fields()
Update resource metadata for 'locked' fields from last edited resource.
copy_locked_fields(int $ref, array<string|int, mixed> &$fields, array<string|int, mixed> &$all_selected_nodes, array<string|int, mixed> $locked_fields, int $lastedited[, bool $save = false ]) : voidNB: $fields and $all_selected_nodes are passed by reference
Parameters
- $ref : int
-
- resource id being updated
- $fields : array<string|int, mixed>
-
- resource $fields array
- $all_selected_nodes : array<string|int, mixed>
-
- array of existing resource nodes
- $locked_fields : array<string|int, mixed>
-
- array of locked data columns (may also include resource table columns - handled by copy_locked_data)
- $lastedited : int
-
- last edited resource to copy data from
- $save : bool = false
-
- save data to database (as opposed to just updating the $fields array e.g. for edit page)
Tags
copyRelatedResources()
Copy related resources from one resource to another
copyRelatedResources(int $from, mixed $to) : voidParameters
- $from : int
-
Resource we are copying related resources from
- $to : mixed
Tags
process_edit_form()
process_edit_form(mixed $ref, mixed $resource) : mixedParameters
- $ref : mixed
- $resource : mixed
update_timestamp()
update_timestamp(mixed $resource) : mixedParameters
- $resource : mixed
get_extension()
Get resource file extension from the database or use JPG, for download
get_extension(array<string|int, mixed> $resource, string $size) : stringParameters
- $resource : array<string|int, mixed>
- $size : string
-
Preview size as defined in the system
Tags
Return values
stringget_last_resource_edit_array()
Obtain details of the last resource edited in the given array of resource ids
get_last_resource_edit_array([array<string|int, mixed> $resources = array() ]) : array<string|int, mixed>|falseParameters
- $resources : array<string|int, mixed> = array()
-
Array of resource IDs
Return values
array<string|int, mixed>|false —Array containing details of last edit (resource ID, timestamp and username of user who performed edit)
get_default_archive_state()
Get the default archive state for new resources
get_default_archive_state([int $requestedstate = "" ]) : intParameters
- $requestedstate : int = ""
-
(optional) ID of requested archive state
Return values
int —ID of valid user requested archive state, may differ from that requested
save_original_file_as_alternative()
Save the original file being replaced, as an alternative file
save_original_file_as_alternative(int $ref) : bool|intParameters
- $ref : int
-
(required) ID of original resource
Return values
bool|int —int = id of new alternative file; false = file not saved
replace_resource_file()
Replace the primary resource file with the file located at the path specified
replace_resource_file(int $ref, mixed $file_location[, mixed $no_exif = false ][, mixed $autorotate = false ][, mixed $keep_original = true ]) : boolParameters
- $ref : int
-
Resource ID to replace
- $file_location : mixed
- $no_exif : mixed = false
- $autorotate : mixed = false
- $keep_original : mixed = true
Return values
boolget_resource_all_image_sizes()
Return all sizes available for a specific resource. Multi page resources should have each page size included as well in the output.
get_resource_all_image_sizes(int $ref) : array<string|int, mixed>Parameters
- $ref : int
-
Resource ID
Tags
Return values
array<string|int, mixed>sanitize_date_field_input()
sanitize_date_field_input(mixed $date[, mixed $validate = false ]) : mixedParameters
- $date : mixed
- $validate : mixed = false
download_link_generate_key()
Create a temporary download key for a specific user or key and resource combination Used when both $watermark_open and $terms_download are enabled
download_link_generate_key(string $id, int $resource) : stringParameters
- $id : string
-
Key identifier e.g. user ID or external access key
- $resource : int
-
Resource ID
Return values
stringdownload_link_check_key()
Check the download key for a specific user/resource combination
download_link_check_key(string $download_key, int $resource) : stringParameters
- $download_key : string
-
Download key
- $resource : int
-
Resource ID
Return values
stringfilter_check()
Check if a given set of nodes meets the conditions set for the provided filter NOte that all resource_nodes for a resource should be passed to check if a filter is matched
filter_check(mixed $filterid, array<string|int, mixed> $nodes) : boolParameters
- $filterid : mixed
- $nodes : array<string|int, mixed>
-
Array of nodes
Return values
boolupdate_node_hitcount_from_search()
update_node_hitcount_from_search(mixed $resource, mixed $search) : mixedParameters
- $resource : mixed
- $search : mixed
copy_hitcount_to_live()
copy_hitcount_to_live() : mixedget_image_sizes()
Returns a table of available image sizes for resource $ref. The standard image sizes are translated using $lang. Custom image sizes are i18n translated.
get_image_sizes(int $ref[, bool $internal = false ][, string $extension = "jpg" ][, bool $onlyifexists = true ]) : array<string|int, mixed>The original image file assumes the name of the 'nearest size (up)' in the table
Parameters
- $ref : int
-
ID of resource
- $internal : bool = false
- $extension : string = "jpg"
-
File extension of image
- $onlyifexists : bool = true
Tags
Return values
array<string|int, mixed> —$return
get_related_resources()
Return an array of resource references that are related to resource $ref
get_related_resources(int $ref) : array<string|int, mixed>Parameters
- $ref : int
-
ID of resource
Return values
array<string|int, mixed>get_field_options()
Get available options for fixed list field types
get_field_options(int $ref[, bool $nodeinfo = false ][, bool $skip_translation = false ]) : array<string|int, mixed>|boolParameters
- $ref : int
-
Metadata field ref
- $nodeinfo : bool = false
-
Get full node details?
- $skip_translation : bool = false
-
Do not translate node name. Only relevant if $nodeinfo=false
Return values
array<string|int, mixed>|bool —Array of field options, either as a simple array or with full node details
get_data_by_field()
Get the resource data value for a field and a specific resource or get the specified field for all resources in the system
get_data_by_field(int $resource, int|string $field[, bool $flatten = true ]) : string|array<string|int, mixed>|GeneratorParameters
- $resource : int
-
Resource ID. Use NULL to retrieve all resources records for the specified field
- $field : int|string
-
Resource type field ID. Can also be a shortname.
- $flatten : bool = true
-
Should a fixed list field value be flatten to a simple string? Set to FALSE to get the list of nodes
Tags
Return values
string|array<string|int, mixed>|Generator —Generator is returned for the old behaviour of returning field data for all resources (for performance). Shouldn't be an issue as long as it's used in foreach loops
get_all_image_sizes()
get_all_image_sizes([mixed $internal = false ][, mixed $restricted = false ]) : mixedParameters
- $internal : mixed = false
- $restricted : mixed = false
image_size_restricted_access()
image_size_restricted_access(mixed $id) : mixedParameters
- $id : mixed
get_fields()
Returns a list of fields with refs matching the supplied field refs.
get_fields(array<string|int, mixed> $field_refs[, bool $order_by_passed_refs = false ]) : array<string|int, mixed>Parameters
- $field_refs : array<string|int, mixed>
-
Array of field refs
- $order_by_passed_refs : bool = false
Return values
array<string|int, mixed>get_hidden_indexed_fields()
get_hidden_indexed_fields() : mixedget_OR_fields()
get_OR_fields() : mixedget_nopreview_html()
Returns the HTML necessary to represent a resource with the given extension when no image preview exists.
get_nopreview_html(string $extension[, int $resource_type = null ]) : stringParameters
- $extension : string
-
File extension
- $resource_type : int = null
-
Optional, the resource type of the resource, used to find an icon at the resource type level if an icon for this extension is not defined.
Return values
stringget_resource_type_fields()
Gets all metadata fields, optionally for a specified array of resource types
get_resource_type_fields([array<string|int, mixed> $restypes = "" ][, string $field_order_by = "ref" ][, string $field_sort = "asc" ][, string $find = "" ][, array<string|int, mixed> $fieldtypes = array() ][, bool $include_inactive = false ]) : array<string|int, mixed>Parameters
- $restypes : array<string|int, mixed> = ""
-
Optional array of resource types to check
- $field_order_by : string = "ref"
-
Order by column
- $field_sort : string = "asc"
-
Sort order
- $find : string = ""
-
Parameter value to search for
- $fieldtypes : array<string|int, mixed> = array()
-
List of field types to include
- $include_inactive : bool = false
-
Should inactive resources be checked, default is false
Return values
array<string|int, mixed>notify_resource_change()
notify_resource_change(mixed $resource) : mixedParameters
- $resource : mixed
add_verbatim_keywords()
add_verbatim_keywords(mixed &$keywords, mixed $string, mixed $resource_type_field[, mixed $called_from_search = false ]) : mixedParameters
- $keywords : mixed
- $string : mixed
- $resource_type_field : mixed
- $called_from_search : mixed = false
Tags
metadata_field_edit_access()
Check the current user's edit access to given metadata field ID
metadata_field_edit_access(int $field) : boolParameters
- $field : int
Return values
boolget_download_filename()
Work out the filename to use, based on the download_filename_format configuration option, when downloading the specified resource file with the given settings
get_download_filename(int $ref, string $size, int $alternative, string $ext) : stringParameters
- $ref : int
-
Resource ID
- $size : string
-
size code
- $alternative : int
-
Alternative file ID
- $ext : string
-
File extension
Return values
string —Filename to use
get_resource_type_from_extension()
Get resource type ID based on extension $mappings = array(resource_type_id => array(allowed_extensions));
get_resource_type_from_extension(string $extension, array<string|int, mixed> $resource_type_extension_mapping, int $default) : intExample of mapping array: $mappings = array(2 => array('pdf', 'doc', 'docx', 'epub', 'ppt', 'pptx', 'odt', 'ods', 'tpl'));
Parameters
- $extension : string
-
Extension we search by (ie. "mp4")
- $resource_type_extension_mapping : array<string|int, mixed>
-
Maps between resource types and extensions
- $default : int
-
The default value to use in case we can't find it the mappings
Return values
int —Resource type ID
canSeePreviewTools()
Helper function for Preview tools feature. Checks all necessary permissions or options in order to tell the system whether PreviewTools panel should be displayed
canSeePreviewTools(array<string|int, mixed> $resource) : boolParameters
- $resource : array<string|int, mixed>
-
Resource data structure
Return values
boolcanSeeAnnotationsFields()
Helper function to determine if annotations are to be displayed.
canSeeAnnotationsFields() : array<string|int, mixed>Return values
array<string|int, mixed> —Array of annotation fields that can be viewed.
alt_is_ffmpeg_alternative()
Determine if a video alternative was created from $ffmpeg_alternatives settings.
alt_is_ffmpeg_alternative(array<string|int, mixed> $alternative) : boolPlaces in this file because get_resource_path relies on it
Parameters
- $alternative : array<string|int, mixed>
-
Record line from resource_alt_files
Return values
bool —True means alternative was created from $ffmpeg_alternatives settings
create_resource_type_field()
Create a new resource type field with the specified name of the required type
create_resource_type_field(string $name[, int|array<string|int, mixed> $restype = 0 ][, int $type = FIELD_TYPE_TEXT_BOX_SINGLE_LINE ][, string $shortname = "" ][, bool $index = false ]) : bool|intParameters
- $name : string
-
- name of new field
- $restype : int|array<string|int, mixed> = 0
-
- resource type - resource type(s) that field applies to (0 = global, single value = one type, array = multiple types)
- $type : int = FIELD_TYPE_TEXT_BOX_SINGLE_LINE
-
- field type - refer to include/definitions.php
- $shortname : string = ""
-
- shortname of new field
- $index : bool = false
-
- should new field be indexed?
Return values
bool|int —- ref of new field, false if unsuccessful
metadata_field_view_access()
Check if user has view access to metadata field
metadata_field_view_access(int $field) : boolParameters
- $field : int
-
Field ref
Tags
Return values
boolget_workflow_states()
Utility to get all workflow states available in the system.
get_workflow_states() : array<string|int, mixed>IMPORTANT: No permissions are being honoured on purpose! If you need to honour permissions @see get_editable_states()
Tags
Return values
array<string|int, mixed>get_workflow_state_names()
get_workflow_state_names() : array<string|int, mixed>Return values
array<string|int, mixed>delete_resource_type_field()
Delete the specified metadata field. Also delets any node or resource_data rows associated with that field
delete_resource_type_field(int $ref) : bool|stringParameters
- $ref : int
-
Metadata field id (ref from resource_type_field)
Return values
bool|string —Returns true on success or text on failure describing error
get_resource_table_joins()
get_resource_table_joins() : mixedupdate_resource_lock()
update_resource_lock(mixed $ref, mixed $lockaction[, mixed $newlockuser = null ][, mixed $accesschecked = false ]) : mixedParameters
- $ref : mixed
- $lockaction : mixed
- $newlockuser : mixed = null
- $accesschecked : mixed = false
get_resource_lock_message()
get_resource_lock_message(mixed $lockuser) : mixedParameters
- $lockuser : mixed
get_external_shares()
Get details of external shares
get_external_shares(array<string|int, mixed> $filteropts) : array<string|int, mixed>Parameters
- $filteropts : array<string|int, mixed>
-
Array of options to filter shares returned "share_group" - (int) Usergroup ref 'shared as' "share_user" - (int) user ID of share creator "share_order_by" - (string) order by column "share_sort" - (string) sortorder (ASC or DESC) "share_type" - (int) 0=view, 1=upload "share_collection" - (int) Collection ID "share_resource" - (int) Resource ID "access_key" - (string) Access key "ignore_permissions"- (bool) Show all shares, irrespective of permissions
Return values
array<string|int, mixed>get_video_duration()
Get video duration
get_video_duration(string $file_path) : floatParameters
- $file_path : string
-
Path to video file
Tags
Return values
floatrelate_all_resources()
Relate all resources in the passed array with each other
relate_all_resources([array<string|int, mixed> $related = [] ]) : boolParameters
- $related : array<string|int, mixed> = []
-
Array of resource IDs
Return values
boolupdate_resource_type_field_order()
Apply new order to metadata fields
update_resource_type_field_order(array<string|int, mixed> $neworder) : voidParameters
- $neworder : array<string|int, mixed>
-
Field IDs in new order
update_resource_type_order()
Apply a new order to resource types
update_resource_type_order(array<string|int, mixed> $neworder) : voidParameters
- $neworder : array<string|int, mixed>
-
Resource type IDs in new order
allow_in_browser()
Check if file can be rendered in browser via download.php
allow_in_browser(string $path) : boolParameters
- $path : string
-
Path to file
Return values
boolupdate_resource_field_column()
Update the value of the fieldXX field on resource table
update_resource_field_column(int $resource, int $field, string $value) : boolParameters
- $resource : int
-
- Resource ID
- $field : int
-
- Metadata field ID
- $value : string
-
- Value
Return values
booldata_joins_field_value_translate_and_csv()
Convert $data_joins (ie fieldX column) value to a user friendly version.
data_joins_field_value_translate_and_csv(string|null $value) : string|nullIMPORTANT: csv in this context simply means user defined separator values (relies on $field_column_string_separator).
Text value will be:-
- split by the configued separator $field_column_string_separator;
- have all parts translated; (note: to correctly translate tree paths, a part will also be broken into path elements)
- glued back using the same separator
Parameters
- $value : string|null
-
Text to be processed
Return values
string|nullprocess_resource_data_joins_values()
Process resource data_joins (ie fieldX columns) values
process_resource_data_joins_values(array<string|int, mixed> $resource, array<string|int, mixed> $resource_table_joins) : array<string|int, mixed>Parameters
- $resource : array<string|int, mixed>
-
A resource table record
- $resource_table_joins : array<string|int, mixed>
-
List of refs for the resource table data_joins. get_resource_table_joins()
Return values
array<string|int, mixed> —Returns the resource record with updated data_joins (ie fieldX columns) values
resource_has_access_denied_by_RT_size()
Check if resource has access denied by its type and for a size.
resource_has_access_denied_by_RT_size(int $resource_type, string $size) : boolParameters
- $resource_type : int
-
Resource type ref
- $size : string
-
Preview size ID (not ref).
Return values
boolrevert_resource_file()
Revert primary resource file based on log entry data
revert_resource_file(int $resource, array<string|int, mixed> $logentry[, bool $createpreviews = true ]) : boolParameters
- $resource : int
-
Resource ID
- $logentry : array<string|int, mixed>
-
Log data from get_resource_log(). Requires rse_version plugin to be enabled
- $createpreviews : bool = true
-
Create previews?
Return values
boolapply_resource_default()
When changing resource type, new resource type specific fields may become available. This function will apply any resource default values for resource type specific fields that were not previously available (i.e. not containing user data). This is used by upload then edit mode after switching resource types and also when locking the resource type with save and next.
apply_resource_default(int $old_resource_type, int $new_resource_type, int $resource) : voidParameters
- $old_resource_type : int
-
Original resource type.
- $new_resource_type : int
-
Resource type being switched to.
- $resource : int
-
Resource id.
related_resource_pull()
Get a related resource to pull images from
related_resource_pull(array<string|int, mixed> $resource) : array<string|int, mixed>|boolParameters
- $resource : array<string|int, mixed>
-
Array of resource data from do_search()
Return values
array<string|int, mixed>|bool —$resdata Array of alternative resource data to use, or false if not configured or no resource image found
get_resource_preview()
Get the largest available preview URL for the given resource and the given array of sizes
get_resource_preview(array<string|int, mixed> $resource[, array<string|int, mixed> $sizes = [] ][, int $access = -1 ][, bool $watermark = false ][, int $page = 1 ][, bool $try_pulled_resource = true ][, int $alt = -1 ]) : array<string|int, mixed>|boolParameters
- $resource : array<string|int, mixed>
-
Array of resource data from get_resource_data() or search results
- $sizes : array<string|int, mixed> = []
-
Array of size IDs to look through, in order of size. If not provided will use all sizes
- $access : int = -1
-
Resource access
- $watermark : bool = false
-
Look for watermarked versions?
- $page : int = 1
-
Page to look for
- $try_pulled_resource : bool = true
-
Should we try to use an image from a pulled resource if the current resource doesn't have a usable preview
- $alt : int = -1
-
Int ref of alternative file
Return values
array<string|int, mixed>|bool —array, or false if no image is found
check_resources()
Check integrity of primary resource files
check_resources([array<string|int, mixed> $resources = [] ][, bool $presenceonly = false ]) : array<string|int, mixed>Parameters
- $resources : array<string|int, mixed> = []
-
Array of resource data e.g. from search results
- $presenceonly : bool = false
-
Check for file presence only? If false (and if $file_checksums is enabled) then file checksums will be checked
Return values
array<string|int, mixed> —Array of resource IDs that have failed to verify
get_resources_to_validate()
Get an array of all resources that require files to be validated
get_resources_to_validate([int $days = 0 ]) : array<string|int, mixed>Parameters
- $days : int = 0
-
Return only resources not validated in the last X number of days
Return values
array<string|int, mixed>acl_can_edit_resource_of_type()
Access control check that user can edit (a resource) of a particular Resource Type (RT). Main use is to hide inapplicable RTs.
acl_can_edit_resource_of_type(int $ref) : boolParameters
- $ref : int
-
Resource type ID
Return values
boolcan_upload_preview_image()
Check if current user can upload a preview image
can_upload_preview_image(int $ref) : boolParameters
- $ref : int
-
Resource ID
Return values
boolresource_has_preview_source()
Check if a resource has a file to derive previews from.
resource_has_preview_source(int $ref, string $extension[, int $alternative = -1 ]) : boolParameters
- $ref : int
-
Resource ID
- $extension : string
-
Resource file extension
- $alternative : int = -1
-
Alternative file record ID
Return values
boolacl_can_edit_contributed_by()
Access control check that user can edit a resources 'Contributed by' field
acl_can_edit_contributed_by() : boolReturn values
boolresolve_soundex()
Resolves the most commonly used keyword that sounds like the given keyword.
resolve_soundex(string $keyword) : string|falseThis function attempts to find a keyword that phonetically matches the provided keyword using the Soundex algorithm. If no Soundex match is found, it will suggest the most commonly used keyword that starts with the same first few letters.
Parameters
- $keyword : string
-
The keyword to resolve.
Return values
string|false —Returns the matched keyword if found, or false if no match is found.
suggest_refinement()
Suggests search refinements based on common keywords from a set of resource references.
suggest_refinement(array<string|int, mixed> $refs, string $search) : array<string|int, mixed>This function analyzes the provided array of resource references and the original search query. It identifies common keywords associated with the specified resources and suggests new search queries by appending these keywords to the original search query, provided they are not already included in it.
Parameters
- $refs : array<string|int, mixed>
-
An array of resource references to analyze.
- $search : string
-
The original search query.
Return values
array<string|int, mixed> —An array of suggested search refinements. Returns an empty array if no refinements can be suggested.
get_advanced_search_fields()
Retrieves a list of fields suitable for advanced searching.
get_advanced_search_fields([bool $archive = false ][, string $hiddenfields = "" ]) : array<string|int, mixed>This function queries the database for resource type fields that are marked for advanced searching. It checks for visibility based on user permissions and whether the fields are hidden from the search. If a designated date field is specified and not already included in the results, it will be added to the beginning of the list if it matches the resource types of the other fields.
Parameters
- $archive : bool = false
-
Whether to include fields related to archived resources. Defaults to false.
- $hiddenfields : string = ""
-
A comma-separated string of field references that should be hidden from the search.
Return values
array<string|int, mixed> —An array of searchable fields that can be used in an advanced search form.
get_advanced_search_collection_fields()
Retrieves a list of fields suitable for advanced searching within collections.
get_advanced_search_collection_fields([bool $archive = false ][, string $hiddenfields = "" ]) : array<string|int, mixed>This function constructs an array of fields specifically related to collections, including collection title, keywords, and owner. It checks against a list of hidden fields to determine which fields should be included in the return array for advanced searching.
Parameters
- $archive : bool = false
-
Whether to include fields related to archived collections. Defaults to false.
- $hiddenfields : string = ""
-
A comma-separated string of field references that should be hidden from the search.
Return values
array<string|int, mixed> —An array of fields suitable for advanced searching in the context of collections.
search_form_to_search_query()
Constructs a search query string from the posted search form data.
search_form_to_search_query(array<string|int, mixed> $fields[, bool $fromsearchbar = false ]) : stringThis function takes the advanced search form fields and assembles them into a search query string that can be used for a standard search. It processes various input fields, including dates, keywords, and resource IDs, while respecting user permissions and field visibility settings.
Parameters
- $fields : array<string|int, mixed>
-
An array of fields used in the search form.
- $fromsearchbar : bool = false
-
Indicates if the search is initiated from a search bar.
Return values
string —The constructed search query string based on the input data.
refine_searchstring()
Refines the search string to eliminate duplicates and ensure proper formatting.
refine_searchstring(string $search) : stringThis function addresses several issues related to searching, including:
- Eliminating duplicate terms from the search query.
- Preserving string search functionality when quotes are used.
- Formatting date-related keywords correctly.
- Adjusting keywords for advanced search fields and ensuring they carry over properly.
- Fixing bugs related to search separators and ensuring valid search syntax.
Parameters
- $search : string
-
The original search string to be refined.
Return values
string —The refined search string, with duplicates removed and properly formatted.
compile_search_actions()
Compiles a list of actions based on the provided top actions and search parameters.
compile_search_actions(bool $top_actions) : array<string|int, mixed>This function generates an array of options for various actions that can be performed on search results, such as saving searches to collections, saving to dashboards, exporting results, editing resources, and running reports. The available actions depend on user permissions and specific conditions.
Parameters
- $top_actions : bool
-
Indicates whether to include top actions in the options.
Return values
array<string|int, mixed> —An array of action options, each containing value, label, data attributes, category, and order for sorting.
search_filter()
Constructs a SQL filter based on the provided search parameters.
search_filter(string $search, mixed $archive, string $restypes, int $recent_search_daylimit, mixed $access_override, bool $return_disk_usage[, bool $editable_only = false ][, int|null $access = null ][, bool $smartsearch = false ]) : PreparedStatementQueryThis function generates a prepared statement query that can be used to filter search results based on various criteria, including archive status, resource types, user permissions, and more. The function also takes into account user-specific access rights and other configurations to ensure that the returned resources meet the necessary visibility and editability criteria.
Parameters
- $search : string
-
The search query string.
- $archive : mixed
-
Archive states to filter by (can be a comma-separated string).
- $restypes : string
-
Resource types to include in the search.
- $recent_search_daylimit : int
-
Limit for filtering recent searches by creation date.
- $access_override : mixed
-
If set, overrides access restrictions.
- $return_disk_usage : bool
-
Indicates whether to include disk usage information.
- $editable_only : bool = false
-
If true, only returns resources that are editable by the user.
- $access : int|null = null
-
The specific access level to filter by (if applicable).
- $smartsearch : bool = false
-
If true, enables smart search features.
Tags
Return values
PreparedStatementQuery —A prepared statement object containing the SQL query and parameters.
search_special()
Processes special searches and constructs a corresponding SQL query.
search_special(string $search, PreparedStatementQuery $sql_join, int $fetchrows, string $sql_prefix, string $sql_suffix, string $order_by, string $orig_order, PreparedStatementQuery $select, PreparedStatementQuery $sql_filter, mixed $archive, bool $return_disk_usage[, bool $return_refs_only = false ][, bool $returnsql = false ]) : mixedThis function handles various special search commands (like viewing the last resources, resources with no downloads, duplicates, collections, etc.) and creates a prepared statement for the query that retrieves the desired resources based on the search parameters. It also incorporates user permissions and other configurations into the search logic.
Parameters
- $search : string
-
The search string indicating the type of special search.
- $sql_join : PreparedStatementQuery
-
The SQL JOIN query to be applied.
- $fetchrows : int
-
The number of rows to fetch.
- $sql_prefix : string
-
The prefix for the SQL query.
- $sql_suffix : string
-
The suffix for the SQL query.
- $order_by : string
-
The order by clause for sorting the results.
- $orig_order : string
-
The original order specified by the user.
- $select : PreparedStatementQuery
-
The fields to select in the query.
- $sql_filter : PreparedStatementQuery
-
The SQL WHERE filter to apply.
- $archive : mixed
-
Archive states to filter by.
- $return_disk_usage : bool
-
Indicates whether to return disk usage information.
- $return_refs_only : bool = false
-
If true, returns only resource references.
- $returnsql : bool = false
-
If true, returns the constructed SQL query instead of executing it.
Tags
Return values
mixed —The results of the special search or false if no special search was matched.
resolve_nodes_from_string()
Function used to create a list of nodes found in a search string
resolve_nodes_from_string(string $string) : array<string|int, mixed>IMPORTANT: use resolve_given_nodes() if you need to detect nodes based on search string format (ie. @@253@@255 and/ or @@!260)
Parameters
- $string : string
Return values
array<string|int, mixed>rebuild_specific_field_search_from_node()
Utility function which helps rebuilding a specific field search string from a node element
rebuild_specific_field_search_from_node(array<string|int, mixed> $node) : stringParameters
- $node : array<string|int, mixed>
-
A node element as returned by get_node() or get_nodes()
Return values
stringsearch_get_previews()
search_get_previews(mixed $search[, mixed $restypes = "" ][, mixed $order_by = "relevance" ][, mixed $archive = 0 ][, mixed $fetchrows = -1 ][, mixed $sort = "DESC" ][, mixed $access_override = false ][, mixed $ignore_filters = false ][, mixed $return_disk_usage = false ][, mixed $recent_search_daylimit = "" ][, mixed $go = false ][, mixed $stats_logging = true ][, mixed $return_refs_only = false ][, mixed $editable_only = false ][, mixed $returnsql = false ][, mixed $getsizes = array() ][, mixed $previewextension = "jpg" ]) : mixedParameters
- $search : mixed
- $restypes : mixed = ""
- $order_by : mixed = "relevance"
- $archive : mixed = 0
- $fetchrows : mixed = -1
- $sort : mixed = "DESC"
- $access_override : mixed = false
- $ignore_filters : mixed = false
- $return_disk_usage : mixed = false
- $recent_search_daylimit : mixed = ""
- $go : mixed = false
- $stats_logging : mixed = true
- $return_refs_only : mixed = false
- $editable_only : mixed = false
- $returnsql : mixed = false
- $getsizes : mixed = array()
- $previewextension : mixed = "jpg"
get_upload_here_selected_nodes()
get_upload_here_selected_nodes(mixed $search, array<string|int, mixed> $nodes) : mixedParameters
- $search : mixed
- $nodes : array<string|int, mixed>
get_default_search_states()
get the default archive states to search
get_default_search_states() : array<string|int, mixed>Return values
array<string|int, mixed>get_filter_sql()
Get the required search filter sql for the given filter for use in do_search()
get_filter_sql(mixed $filterid) : PreparedStatementQueryParameters
- $filterid : mixed
Return values
PreparedStatementQuerysplit_keywords()
split_keywords(mixed $search[, mixed $index = false ][, mixed $partial_index = false ][, mixed $is_date = false ][, mixed $is_html = false ][, mixed $keepquotes = false ][, bool $preserve_separators = false ]) : mixedParameters
- $search : mixed
- $index : mixed = false
- $partial_index : mixed = false
- $is_date : mixed = false
- $is_html : mixed = false
- $keepquotes : mixed = false
- $preserve_separators : bool = false
Tags
cleanse_string()
Removes characters from a string, for example full stops, prior to keyword splitting - {@see split_keywords()}.
cleanse_string(string $string, bool $preserve_separators[, bool $for_search = false ]) : stringAlso makes the string lower case ready for indexing.
Parameters
- $string : string
-
Text value which needs to be pre-processed
- $preserve_separators : bool
-
Set to false to separate keywords when specifying multiple field/keyword pairs (comma and colon)
- $for_search : bool = false
-
Set to true if you need certain characters to be preserved during a search (e.g. the wildcard or minus for NOT searches).
Return values
stringresolve_keyword()
Resolve keyword
resolve_keyword(string $keyword[, bool $create = false ][, bool $normalize = true ][, bool $stem = true ]) : int|boolParameters
- $keyword : string
-
The keyword to resolve
- $create : bool = false
-
If keyword not found, should we create it instead?
- $normalize : bool = true
-
Should we normalize the keyword before resolving?
- $stem : bool = true
-
Should we use the keywords' stem when resolving?
Return values
int|bool —Returns the keyword reference for $keyword, or false if no such keyword exists.
add_partial_index()
Generates a list of keywords for indexing, including all possible infixes for each keyword in the provided list.
add_partial_index(array<string|int, mixed> $keywords) : array<string|int, mixed>This function processes each keyword and, for those without spaces, adds all possible infixes of a specified minimum length to the return array. The resulting array is suitable for indexing in fields that have partial indexing enabled.
Parameters
- $keywords : array<string|int, mixed>
-
An array of keywords to process for partial indexing.
Return values
array<string|int, mixed> —An array of keywords, each with its associated position in the original list.
get_suggested_keywords()
Suggests complete existing keywords based on a partial search term.
get_suggested_keywords(string $search[, string $ref = "" ]) : array<string|int, mixed>This function fetches keywords that match the given partial word, returning suggestions from the keyword database. It also considers user permissions by excluding indexed fields that are hidden from the user. Additionally, it can restrict results to a specific resource type field.
Parameters
- $search : string
-
The partial keyword to search for.
- $ref : string = ""
-
(optional) The resource type field to restrict suggestions to.
Return values
array<string|int, mixed> —An array of suggested keywords matching the search criteria.
get_related_keywords()
Retrieves keywords related to a given keyword reference.
get_related_keywords(int $keyref) : array<string|int, mixed>This function checks a cache for related keywords associated with the provided keyword reference. If not found in the cache, it queries the database for related keywords. The relationship can be one-way or bidirectional based on the configuration. It returns an array of related keyword references.
Parameters
- $keyref : int
-
The reference ID of the keyword for which to find related keywords.
Return values
array<string|int, mixed> —An array of related keyword references.
get_grouped_related_keywords()
Retrieves keywords and their related keywords, optionally filtered by specific keywords.
get_grouped_related_keywords([string $find = "" ][, string $specific = "" ]) : array<string|int, mixed>This function returns a list of keywords along with their related keywords grouped together. It can filter the results based on the provided keyword or specific keyword string. The related keywords are returned as a comma-separated string.
Parameters
- $find : string = ""
-
An optional keyword to find related keywords for. If specified, it filters the results to include only the related keywords for this keyword.
- $specific : string = ""
-
An optional specific keyword to find. If specified, it filters the results to include only the related keywords for this specific keyword.
Return values
array<string|int, mixed> —An array of keywords and their related keywords grouped together.
save_related_keywords()
Saves the related keywords for a specified keyword.
save_related_keywords(string $keyword, string $related) : boolThis function first resolves the keyword reference for the provided keyword. It then deletes any existing relationships for that keyword and inserts the new related keywords into the database.
Parameters
- $keyword : string
-
The keyword for which related keywords are being saved.
- $related : string
-
A comma-separated string of related keywords to associate with the specified keyword.
Return values
bool —Returns true on success, or false on failure.
get_simple_search_fields()
Retrieves a list of fields suitable for the simple search box.
get_simple_search_fields() : array<string|int, mixed>This function gathers all resource type fields that are marked for simple search usage. It includes standard fields and custom fields that have their titles translated. It ensures that only fields with appropriate permissions and those that are either indexed or of a fixed list type are included in the returned array.
Return values
array<string|int, mixed> —An array of fields suitable for simple search, including their titles and other properties, filtered by permissions and search capabilities.
get_fields_for_search_display()
Retrieves a list of fields/properties suitable for search display based on the provided field references.
get_fields_for_search_display(array<string|int, mixed> $field_refs) : array<string|int, mixed>Parameters
- $field_refs : array<string|int, mixed>
-
An array of field references to filter the search display fields.
Tags
Return values
array<string|int, mixed> —An array of fields with their properties, including translated titles, that are visible to the user based on permission checks.
get_filters()
Get all defined filters (currently only used for search)
get_filters([string $order = "ref" ][, string $sort = "ASC" ][, string $find = "" ]) : array<string|int, mixed>Parameters
- $order : string = "ref"
-
column to order by
- $sort : string = "ASC"
-
sort order ("ASC" or "DESC")
- $find : string = ""
-
text to search for in filter
Return values
array<string|int, mixed>get_filter()
Get filter summary details
get_filter(int $filterid) : array<string|int, mixed>Parameters
- $filterid : int
-
ID of filter (from usergroup search_filter_id or user search_filter_oid)
Return values
array<string|int, mixed>get_filter_rules()
Get filter rules for use in search
get_filter_rules(int $filterid) : array<string|int, mixed>Parameters
- $filterid : int
-
ID of filter (from usergroup search_filter_id or user search_filter_oid)
Return values
array<string|int, mixed>get_filter_rule()
Get filter rule
get_filter_rule(int $ruleid) : array<string|int, mixed>Parameters
- $ruleid : int
-
- ID of filter rule
Return values
array<string|int, mixed>save_filter()
Save filter, will return existing filter ID if text matches already migrated
save_filter(int $filter, int $filter_name, int $filter_condition) : bool|intParameters
- $filter : int
-
- ID of filter. Set to 0 for new filter
- $filter_name : int
-
- Name of filter
- $filter_condition : int
-
- One of RS_FILTER_ALL,RS_FILTER_NONE,RS_FILTER_ANY
Return values
bool|int —- false, or ID of filter
save_filter_rule()
Save filter rule, will return existing rule ID if text matches already migrated
save_filter_rule(int $filter_rule, int $filterid, mixed $rule_data) : bool|intParameters
- $filter_rule : int
-
- ID of filter_rule
- $filterid : int
-
- ID of associated filter
- $rule_data : mixed
Return values
bool|int —- false, or ID of filter_rule
delete_filter()
Delete specified filter
delete_filter(int $filter) : bool|array<string|int, mixed>Parameters
- $filter : int
-
- ID of filter
Return values
bool|array<string|int, mixed> —of users/groups using filter
delete_filter_rule()
Delete specified filter_rule
delete_filter_rule(mixed $filter_rule) : bool|intParameters
- $filter_rule : mixed
Return values
bool|int —- false, or ID of filter_rule
copy_filter()
Copy specified filter_rule
copy_filter(int $filter) : bool|intParameters
- $filter : int
-
- ID of filter_rule to copy
Return values
bool|int —- false, or ID of new filter
update_search_from_request()
Add POST/GET parameters into search string. Moved from pages/search.php
update_search_from_request(string $search) : stringParameters
- $search : string
-
Existing search string without params added
Return values
string —Updated string with params added
get_search_default_restypes()
Retrieves the default resource types for search functionality.
get_search_default_restypes() : array<string|int, mixed>This function determines which resource types to include in the search based on the global settings for resource and theme inclusion. If resources are to be included, it checks the default resource types and returns them as an array. If no specific default resource types are defined, it defaults to including "Global." If resources are not to be included, it defaults to "Collections," and if themes are included, "FeaturedCollections" is also added.
Return values
array<string|int, mixed> —An array of default resource types to be used in the search.
get_selectedtypes()
Retrieves the selected resource types for the search functionality.
get_selectedtypes() : array<string|int, mixed>Return values
array<string|int, mixed> —An array of selected resource types for the search.
render_advanced_search_buttons()
Renders the buttons for the advanced search form.
render_advanced_search_buttons() : voidThis function generates HTML for two buttons: one to reset the search form and clear the submitted search criteria, and another to execute the search.
Return values
void —This function outputs HTML directly and does not return a value.
check_order_by_in_table_joins()
If a "fieldX" order_by is used, check it's a valid value.
check_order_by_in_table_joins(mixed $order_by) : stringWhere the value is invalid, the default 'resourceid' will be used instead.
Parameters
- $order_by : mixed
Return values
string —Order by string if valid else default 'resourceid'
get_collections_resource_count()
Get collection total resource count for a list of collections
get_collections_resource_count(array<string|int, mixed> $refs) : array<string|int, mixed>Parameters
- $refs : array<string|int, mixed>
-
List of collection IDs
Return values
array<string|int, mixed> —Returns table of collections and their total resource count (taking into account access controls). Please note that the returned array might NOT contain keys for all the input IDs (e.g validation failed).
get_search_params()
Get all search request parameters. Note that this does not escape the parameters which must be sanitised using e.g. htmlspecialchars() or urlencode() before rendering on page
get_search_params() : mixedTags
is_not_wildcard_only()
Helper function to check a string is not just the asterisk.
is_not_wildcard_only(string $str) : boolParameters
- $str : string
-
The string to be checked.
Return values
boolsearch_title_node_processing()
Convert node searches into a friendly syntax. Used by search_title_processing.php
search_title_node_processing(string $string) : stringParameters
- $string : string
-
Search string
Return values
stringsetup_search_chunks()
Allow $fetchrows as supplied to do_search() to support an integer or array. If integer then search will recieve the number of rows with no offset.
setup_search_chunks(int|array<string|int, mixed> $fetchrows, int &$chunk_offset, int &$search_chunk_size) : voidIf array then search will receive the number of rows to return and an offset allowing for chunking of results. $chunk_offset[0] is the offset of the first row to return. $chunk_offset[1] is the number of rows to return in the batch. $chunk_offset[0] will normally be 0 in the first search, increasing by $chunk_offset[1] for each search, generated by an external looping structure. This allows for batches of $chunk_offset[1] search results up to the total size of the search. For an example pages/csv_export_results_metadata.php. This approach can be used to avoid particularly large searches exceeding the PHP memory_limit when processing the data in ps_query().
Parameters
- $fetchrows : int|array<string|int, mixed>
-
$fetchrows value passed from do_search() / search_special(). See details above.
- $chunk_offset : int
-
Starting position for offset. Default is 0 if none supplied i.e. $fetchrows is int.
- $search_chunk_size : int
-
Number of rows to return.
log_keyword_usage()
Log which keywords are used in a search
log_keyword_usage(array<string|int, mixed> $keywords, mixed $search_result) : mixedParameters
- $keywords : array<string|int, mixed>
-
refs of keywords used in a search
- $search_result : mixed
set_search_order_by()
Validate and set the order_by for the current search from the requested values passed to do_search()
set_search_order_by(string $search, string $order_by, string $sort) : stringParameters
- $search : string
- $order_by : string
- $sort : string
Return values
stringprepare_regex_search_string()
Escape and process a string from ResourceSpace search syntax to regex syntax Wildcards are replaced with '.*?' - any character 0 or more times Multiple keyword matches are split into an OR group Word boundaries are added to avoid unintended wildcards.
prepare_regex_search_string(string $keyword) : stringParameters
- $keyword : string
-
Keyword string without any field names or special search strings
Return values
string —Processed string ready for RLIKE searches
convert_search_form_date_to_search_query()
Utility converter between sumitted date input and ResourceSpace search query
convert_search_form_date_to_search_query(array{ref: int, name: string, type: int} $field[, array{html_field_name?: string} $ctx = [] ]) : stringParameters
- $field : array{ref: int, name: string, type: int}
-
Field information relevant for the submitted data
- $ctx : array{html_field_name?: string} = []
Return values
string —The constructed search query string (based on the input/submitted data).
set_slideshow()
Create/ Update a slideshow image record. Use NULL for $ref to create new records.
set_slideshow(int $ref[, int $resource_ref = null ][, int $homepage_show = 1 ][, int $login_show = 0 ]) : bool|intParameters
- $ref : int
-
ID of the slideshow image. Use NULL to create a new record
- $resource_ref : int = null
-
ID of the resource this slideshow is related to. Use NULL if no link is required
- $homepage_show : int = 1
-
Set to 1 if slideshow image should appear on the home page
- $login_show : int = 0
-
Set to 1 if slideshow image should appear on the login page
Return values
bool|int —Returns ID of the slideshow image(new/ updated), FALSE otherwise
delete_slideshow()
Delete slideshow record
delete_slideshow(int $ref) : boolParameters
- $ref : int
-
ID of the slideshow
Return values
boolreorder_slideshow_images()
Function used to re-order slideshow images
reorder_slideshow_images(array<string|int, mixed> $from, array<string|int, mixed> $to) : boolParameters
- $from : array<string|int, mixed>
-
Slideshow image data we move FROM
- $to : array<string|int, mixed>
-
Slideshow image data we move TO
Return values
boolget_slideshow_image_file_path()
Get the full path for the slideshow image file
get_slideshow_image_file_path(int $ref) : stringParameters
- $ref : int
-
ID of the slideshow image
Return values
string —The full path to the slideshow image
acl_can_manage_tabs()
Access control check if user is allowed to manage system tabs.
acl_can_manage_tabs() : boolReturn values
boolget_tabs_by_refs()
Get entire tab records for a list of IDs
get_tabs_by_refs(array<string|int, mixed> $refs) : array<string|int, mixed>Parameters
- $refs : array<string|int, mixed>
-
List of tab refs
Return values
array<string|int, mixed>get_tabs_with_usage_count()
Get tabs (paged) based on some criteria (currently only order by and limit).
get_tabs_with_usage_count(array<string|int, mixed> $criteria) : array<string|int, mixed>Parameters
- $criteria : array<string|int, mixed>
-
Array holding criteria information (order_by and limit).
Return values
array<string|int, mixed> —get_all_tabs()
Get all tab records, sorted by the order_by column
get_all_tabs() : array<string|int, mixed>Return values
array<string|int, mixed>get_tab_name_options()
Get list of all tabs sorted based on current configuration. This always adds a fake record (ref #0) to indicate no assignment.
get_tab_name_options() : array<string|int, mixed>Return values
array<string|int, mixed> —Key is the tabs' ID and value its translated name.
sort_tabs_as_configured()
Sort list of tab names (preserving their key ID)
sort_tabs_as_configured(array<string|int, mixed> $tabs) : array<string|int, mixed>Parameters
- $tabs : array<string|int, mixed>
-
List of tab ID and tab translated name pairs
Return values
array<string|int, mixed>create_tab()
Create a new system tab record NOTE: order_by should only be set when re-ordering the set by the user. {@see sql_reorder_records('tab', $refs)}
create_tab(array<string|int, mixed> $tab) : bool|intParameters
- $tab : array<string|int, mixed>
Return values
bool|int —Return new tab record ID or FALSE otherwise
delete_tabs()
Delete system tabs.
delete_tabs(array<string|int, mixed> $refs) : boolIMPORTANT: never allow the "Default" tab (ref #1) to be deleted because this is the fallback location for information that has no association with other tabs.
Parameters
- $refs : array<string|int, mixed>
-
List of tab IDs
Return values
bool —Returns TRUE if it executed the query, FALSE otherwise
save_tab()
Update an existing tab.
save_tab(array<string|int, mixed> $tab) : boolNOTE: order_by should only be set when re-ordering the set by the user. sql_reorder_records('tab', $refs)
Parameters
- $tab : array<string|int, mixed>
-
A tab record (type)
Return values
bool —Returns TRUE if it executed the query, FALSE otherwise
resource_random_jpg()
Generates a random JPEG image for a given resource with random background color and text.
resource_random_jpg(int $resource, int $width, int $height) : boolThis function creates an image of specified dimensions with a random background color and text indicating the resource reference. The image is then saved to the resource's designated path and also triggers the creation of previews for the resource.
Parameters
- $resource : int
-
The reference ID of the resource for which the image is being created.
- $width : int
-
The width of the generated image in pixels.
- $height : int
-
The height of the generated image in pixels.
Return values
bool —Returns true on success, indicating that the image was created and saved successfully.
create_random_image()
Generate a random image which can be used during testing (e.g to upload, or create previews for)
create_random_image(array<string|int, mixed> $info) : array<string|int, mixed>Parameters
- $info : array<string|int, mixed>
-
Set image parameters:
- text -> Image content text
- filename (default: random)
- width (default: 150)
- height (default: 50)
- bg[red|green|blue] -> Background colour (RGB), e.g $info['bg']['red'] = 234;
Return values
array<string|int, mixed> —Returns an "error" key if something went wrong, otherwise provides some useful info (e.g path)
create_random_video()
Generate a random video which can be used during testing (e.g to upload, or create previews for)
create_random_video(array<string|int, mixed> $info) : array<string|int, mixed>Parameters
- $info : array<string|int, mixed>
-
Set video parameters:
- duration (default: 5 seconds)
- width (default: 300)
- height (default: 300)
- filename (default: random)
- extension (default: mp4)
- text -> Video content text (optional)
Return values
array<string|int, mixed> —Returns an "error" key if something went wrong, otherwise provides some useful info (e.g path)
test_log()
Debug logs for ResourceSpace automated tests
test_log(string $msg) : voidParameters
- $msg : string
Tags
test_get_file_id()
Get the test files' ID (from its file name)
test_get_file_id(string $file) : intParameters
- $file : string
Return values
intvalidate_user()
Validate user - check we have a valid user based on SQL criteria e.g. session that is passed in as $user_select_sql Will always return false if matches criteria but the user account is not approved or has expired
validate_user(object $user_select_sql[, bool $getuserdata = true ]) : bool|array<string|int, mixed>$user_select_sql example u.session=$variable. Joins to usergroup table as g which can be used in criteria
Parameters
- $user_select_sql : object
-
PreparedStatementQuery instance - to validate user usually session hash or key
- $getuserdata : bool = true
-
default true. Return user data as required by authenticate.php
Return values
bool|array<string|int, mixed>setup_user()
Given an array of user data loaded from the user table, set up all necessary global variables for this user including permissions, current collection, config overrides and so on.
setup_user(array<string|int, mixed> $userdata) : boolParameters
- $userdata : array<string|int, mixed>
-
Array of user data obtained by validate_user() from user/usergroup tables
Return values
bool —success/failure flag - used for example to prevent certain users from making API calls
get_users()
Returns a user list. Group or search term is optional. The standard user group names are translated using $lang. Custom user group names are i18n translated.
get_users([int $group = 0 ][, string $find = "" ][, string $order_by = "u.username" ][, bool $usepermissions = false ][, int $fetchrows = -1 ][, string $approvalstate = "" ][, bool $returnsql = false ][, string $selectcolumns = "" ][, bool $exact_username_match = false ]) : array<string|int, mixed>|objectParameters
- $group : int = 0
-
Can be a single group, or a comma separated list of groups used to limit the results If blank, zero or NULL then all users will be returned irrespective of their group
- $find : string = ""
-
Search string to filter returned results
- $order_by : string = "u.username"
- $usepermissions : bool = false
- $fetchrows : int = -1
- $approvalstate : string = ""
- $returnsql : bool = false
-
Return prepared statement object containing sql query and parameters.
- $selectcolumns : string = ""
- $exact_username_match : bool = false
-
Denotes $find must be an exact username
Return values
array<string|int, mixed>|object —Matching user records Returns an array of user information or prepared statement object containing sql query and parameters.
get_users_with_permission()
Returns all the users who have the permission $permission.
get_users_with_permission(string $permission) : array<string|int, mixed>The standard user group names are translated using $lang. Custom user group names are i18n translated.
Parameters
- $permission : string
-
The permission code to search for
Return values
array<string|int, mixed> —Matching user records
get_user_by_email()
Retrieve user records by e-mail address
get_user_by_email(string $email) : array<string|int, mixed>Parameters
- $email : string
-
The e-mail address to search for
Return values
array<string|int, mixed> —Matching user records
get_user_by_username()
Retrieve user ID by username
get_user_by_username(string $username) : mixedParameters
- $username : string
-
The username to search for (will match email if not found)
Return values
mixed —The matching user ID or false if not found
get_usergroups()
Returns a list of user groups. The standard user groups are translated using $lang. Custom user groups are i18n translated.
get_usergroups([bool $usepermissions = false ][, string $find = '' ][, bool $id_name_pair_array = false ]) : array<string|int, mixed>Puts anything starting with 'General Staff Users' - in the English default names - at the top (e.g. General Staff).
Parameters
- $usepermissions : bool = false
-
Use permissions (user access)
- $find : string = ''
-
Search string
- $id_name_pair_array : bool = false
-
Return an array of ID->name instead of full records
Return values
array<string|int, mixed> —Matching user group records
get_usergroup()
Returns the user group corresponding to the $ref. A standard user group name is translated using $lang. A custom user group name is i18n translated.
get_usergroup(int $ref) : mixedParameters
- $ref : int
-
User group ID
Return values
mixed —False if not found, or the user group record if found.
get_user()
Return the user group record matching $ref
get_user(int $ref) : array<string|int, mixed>|boolParameters
- $ref : int
Return values
array<string|int, mixed>|boolsave_user()
Function used to update or delete a user.
save_user(string $ref[, array<string|int, mixed> $data = [] ]) : bool|stringNote: data is taken from the submitted form
Parameters
- $ref : string
-
ID of the user
- $data : array<string|int, mixed> = []
-
Data to save (optional, will use posted data otherwise)
Return values
bool|string —True if successful or a descriptive string if there's an issue
email_user_welcome()
E-mail the user the welcome message on account creation.
email_user_welcome(string $email, string $username, int $usergroup) : voidParameters
- $email : string
- $username : string
- $usergroup : int
email_reset_link()
Email password reset link to the user
email_reset_link(string $email[, string $newuser = false ]) : bool|stringParameters
- $email : string
-
Email address of user
- $newuser : string = false
-
Is this a new user account? If so a welcome message template will be used
Return values
bool|string —true if success or error message
auto_create_user_account()
Automatically creates a user account The request can be auto approved if $auto_approve_accounts is true Otherwise the approval is managed by admins via notification messages and/or emails
auto_create_user_account([string $hash = "" ]) : boolParameters
- $hash : string = ""
Return values
bool —Success?
email_user_request()
Send user request to admins in form of notification messages and/or emails Send email confirmation to requesting user
email_user_request() : boolReturn values
booluser_limit_reached()
Check to see if the user limit has been reached.
user_limit_reached() : boolReturn values
bool —- true if user limit has been reached or exceeded
new_user()
Create a new user *
new_user(string $newuser[, int $usergroup = 0 ]) : bool|intParameters
- $newuser : string
-
- username to create
- $usergroup : int = 0
-
- optional usergroup to assign
Return values
bool|int —- id of new user or false if user already exists / permission denied, or -2 if user limit reached
get_active_users()
Returns a list of active users
get_active_users() : array<string|int, mixed>Return values
array<string|int, mixed>change_password()
Sets a new password for the current user.
change_password(string $password) : mixedParameters
- $password : string
Return values
mixed —True if a success or a descriptive string if there's an issue.
make_password()
Generate a password using the configured settings.
make_password() : stringReturn values
string —The generated password
bulk_mail()
Send a bulk e-mail using the bulk e-mail tool.
bulk_mail(string $userlist, string $subject, string $text[, string $html = false ][, int $message_type = MESSAGE_ENUM_NOTIFICATION_TYPE_EMAIL ][, string $url = "" ]) : stringParameters
- $userlist : string
- $subject : string
- $text : string
- $html : string = false
- $message_type : int = MESSAGE_ENUM_NOTIFICATION_TYPE_EMAIL
- $url : string = ""
Return values
string —The empty string if all OK, a descriptive string if there's an issue.
get_user_log()
Returns a user action log for $user.
get_user_log(int $user[, int $fetchrows = -1 ]) : array<string|int, mixed>Standard field titles are translated using $lang. Custom field titles are i18n translated.
Parameters
- $user : int
- $fetchrows : int = -1
-
How many rows to fetch?
Return values
array<string|int, mixed>resolve_userlist_groups()
Given an array or comma separated user list (from the user select include file) turn all Group: entries into fully resolved list of usernames.
resolve_userlist_groups(string|array<string|int, mixed> $userlist) : stringNote that this function can't decode default groupnames containing special characters.
Parameters
- $userlist : string|array<string|int, mixed>
Return values
string —The resolved list
resolve_userlist_groups_smart()
Given a comma separated user list (from the user select include file) turn all Group: entries into fully resolved list of usernames.
resolve_userlist_groups_smart(string $userlist[, bool $return_usernames = false ]) : stringNote that this function can't decode default groupnames containing special characters.
Parameters
- $userlist : string
- $return_usernames : bool = false
Return values
string —The resolved list
remove_groups_smart_from_userlist()
Remove smart lists from the provided user lists.
remove_groups_smart_from_userlist(string|array<string|int, mixed> $ulist) : stringParameters
- $ulist : string|array<string|int, mixed>
-
Comma separated list of user list names
Return values
string —The updated list with smart groups removed.
check_password()
Checks that a password conforms to the configured paramaters.
check_password(string $password) : mixedParameters
- $password : string
-
The password
Return values
mixed —True if OK, or a descriptive string if it isn't
resolve_users()
For a given comma-separated list of user refs (e.g. returned from a group_concat()), return a string of matching usernames.
resolve_users(string $users) : stringParameters
- $users : string
-
User list - caution, used directly in SQL so must not contain user input
Return values
string —Matching usernames.
check_access_key()
Verify a supplied external access key
check_access_key(array<string|int, mixed>|int $resources, string $key[, bool $checkcollection = true ][, bool $is_category = false ]) : boolParameters
- $resources : array<string|int, mixed>|int
-
Resource ID | Array of resource IDs
- $key : string
-
The external access key
- $checkcollection : bool = true
-
Check collection access key? true by default but required to prevent infinite recursion
- $is_category : bool = false
-
True if checking featured collection category. Silently checks collection resources by preventing excessive updating of external_access_keys. Resource keys will update if collection viewed later.
Return values
bool —Valid?
check_access_key_collection()
Check access key for a collection. For a featured collection category, the check will be done on all sub featured collections.
check_access_key_collection(int $collection, string $key[, bool $checkresource = true ]) : boolParameters
- $collection : int
-
Collection ID
- $key : string
-
Access key
- $checkresource : bool = true
-
Check for resource access key? true by default but required to prevent infinite recursion
Return values
boolmake_username()
Generates a unique username for the given name
make_username(string $name[, string $email = "" ]) : stringParameters
- $name : string
-
The user's full name
- $email : string = ""
-
Optional email address
Return values
string —The username to use
get_registration_selectable_usergroups()
Returns a list of user groups selectable in the registration . The standard user groups are translated using $lang. Custom user groups are i18n translated.
get_registration_selectable_usergroups() : array<string|int, mixed>Return values
array<string|int, mixed>open_access_to_user()
Give the user full access to the given resource. Used when approving requests.
open_access_to_user(int $user, int $resource, string $expires) : boolParameters
- $user : int
- $resource : int
- $expires : string
Return values
boolopen_access_to_group()
Give the user full access to the given resource. Used when approving requests.
open_access_to_group(int $group, int $resource, string $expires) : boolParameters
- $group : int
- $resource : int
- $expires : string
Return values
boolresolve_open_access()
Grants open access to the user list for the specified resource.
resolve_open_access(string $userlist, int $resource, string $expires) : voidParameters
- $userlist : string
- $resource : int
- $expires : string
remove_access_to_user()
Remove any user-specific access granted by an 'approve'. Used when declining requests.
remove_access_to_user(int $user, int $resource) : boolParameters
- $user : int
- $resource : int
Return values
booluser_email_exists()
Returns true if a user account exists with e-mail address $email
user_email_exists(string $email) : boolParameters
- $email : string
Return values
boolresolve_user_emails()
Return an array of emails from a list of usernames and email addresses.
resolve_user_emails(array<string|int, mixed> $user_list) : array<string|int, mixed>with 'key_required' sibling array preserving the intent of internal/external sharing
Parameters
- $user_list : array<string|int, mixed>
Return values
array<string|int, mixed>mark_email_as_invalid()
Finds all users with matching email and marks them as having an invalid email
mark_email_as_invalid(string $email) : boolParameters
- $email : string
Return values
boolcheck_email_invalid()
Checks if the email entered is marked as invalid for any users
check_email_invalid(string $email) : boolParameters
- $email : string
Return values
bool —true if email is marked invalid for any users with matching email address
create_password_reset_key()
Creates a reset key for password reset e-mails
create_password_reset_key(string $username) : stringParameters
- $username : string
-
The user's username
Return values
string —The reset key
get_rs_session_id()
For anonymous access - a unique session key to identify the user (e.g. so they can still have their own collections)
get_rs_session_id([bool $create = false ]) : mixedParameters
- $create : bool = false
-
Create one if it doesn't already exist
Return values
mixed —False on failure, the key on success
get_notification_users()
Returns an array of users (refs and emails) for use when sending email notifications (messages that in the past went to $email_notify, which can be emulated by using $email_notify_usergroups)
get_notification_users([string $userpermission = "SYSTEM_ADMIN" ][, int|null $usergroup = null ]) : array<string|int, mixed>Can be passed a specific user type or an array of permissions Types supported:- SYSTEM_ADMIN RESOURCE_ACCESS RESEARCH_ADMIN USER_ADMIN RESOURCE_ADMIN
Parameters
- $userpermission : string = "SYSTEM_ADMIN"
-
Permission string
- $usergroup : int|null = null
-
Optional id of usergroup to find notification users for e.g. the parent group of new user or as defined in $usergroup_approval_mappings
Return values
array<string|int, mixed>verify_antispam()
Validates the user entered antispam code
verify_antispam([string $spamcode = "" ][, string $usercode = "" ][, string $spamtime = 0 ]) : boolParameters
- $spamcode : string = ""
-
The antispam hash to check against
- $usercode : string = ""
-
The antispam code the user entered
- $spamtime : string = 0
-
The antispam timestamp
Return values
bool —Return true if the code was successfully validated, otherwise false
check_share_password()
Check that access for given external share key is correct
check_share_password(array<string|int, mixed> $key, string $password, string $cookie) : boolParameters
- $key : array<string|int, mixed>
-
External access key
- $password : string
-
Share password to check
- $cookie : string
-
Share session cookie that has been set previously
Return values
booloffset_user_local_timezone()
Offset a datetime to user local time zone
offset_user_local_timezone(string $datetime, string $format) : stringIMPORTANT: the offset is fixed, there is no calculation for summertime!
Parameters
- $datetime : string
-
A date/time string. @see https://www.php.net/manual/en/datetime.formats.php
- $format : string
-
The format of the outputted date string. @see https://www.php.net/manual/en/function.date.php
Tags
Return values
string —The date in the specified format
checkPermission_anonymoususer()
Returns whether a user is anonymous or not
checkPermission_anonymoususer() : boolTags
Return values
boolcheckPermission_dashadmin()
Does the current user have the ability to administer the dash (the tiles for all users)
checkPermission_dashadmin() : boolReturn values
boolcheckPermission_dashuser()
Can the user manage their own dash tiles.
checkPermission_dashuser() : boolReturn values
boolcheckPermission_dashmanage()
Can the user manage their dash?
checkPermission_dashmanage() : boolLogic: Home_dash is on, And not the Anonymous user with default dash, And (Dash tile user (Not with a managed dash) || Dash Tile Admin)
Return values
boolcheckPermission_dashcreate()
Can the user create tiles?
checkPermission_dashcreate() : boolLogic: Home_dash is on, And not Anonymous use, And (Dash tile user (Not with a managed dash) || Dash Tile Admin)
Return values
boolcheckperm()
Check that the user has the $perm permission
checkperm(string $perm) : boolParameters
- $perm : string
Tags
Return values
bool —Do they have the permission?
checkperm_user_edit()
Check if the current user is allowed to edit user with passed reference
checkperm_user_edit(int $user) : boolParameters
- $user : int
-
The user to be edited
Return values
boolcheckperm_login_as_user()
Check if the current user has sufficient permissions to log in as the specified user
checkperm_login_as_user(mixed $user) : boolThe regex used is to check if the a permission is present in the permission string of the target user
Parameters
- $user : mixed
-
Either a user reference or user array
Return values
boolinternal_share_access()
Determine if this is an internal share access request
internal_share_access() : boolReturn values
boolsave_usergroup()
Save changes to a usergroup or create usergroup
save_usergroup(int $ref, array<string|int, mixed> $groupoptions) : mixedParameters
- $ref : int
-
Group ref. Set to 0 to create a new group
- $groupoptions : array<string|int, mixed>
-
array of options to set for group in the form array("columnname" => $value)
Return values
mixed —bool|int True to indicate existing group has been updated or ID of newly created group
copy_usergroup_permissions()
Copy the permissions string from another usergroup
copy_usergroup_permissions(int $src_id, int $dst_id) : mixedParameters
- $src_id : int
-
The group ID to copy from
- $dst_id : int
-
The group ID to copy to
Return values
mixed —bool|int True to indicate existing group has been updated or ID of newly created group
set_user_profile()
Set user's profile image and profile description (bio). Used by ../pages/user/user_profile_edit.php to setup user's profile.
set_user_profile(int $user_ref, string $profile_text, string $image_path) : boolParameters
- $user_ref : int
-
User id of user who's profile is being set.
- $profile_text : string
-
User entered profile description text (bio).
- $image_path : string
-
Path to temp file created if user chose to upload a profile image.
Return values
bool —If an error is encountered saving the profile image return will be false.
delete_profile_image()
Delete a user's profile image. This will first remove the file and then update the db to clear the existing value.
delete_profile_image(mixed $user_ref) : voidParameters
- $user_ref : mixed
-
User id of the user who's profile image is to be deleted.
get_profile_image()
Generate the url to the user's profile image. Fetch the url by the user's id or by the profile image filename.
get_profile_image([int $user_ref = "" ][, string $by_image = "" ]) : stringParameters
- $user_ref : int = ""
-
User id of the user who's profile image is requested.
- $by_image : string = ""
-
The filename of the profile image to fetch having been collected from the db separately: user.profile_image
Return values
string —The url to the user's profile image if available or blank if not set.
get_profile_text()
Return user profile for a defined user.
get_profile_text(int $user_ref) : stringParameters
- $user_ref : int
-
User id to fetch profile details for.
Return values
string —Profile details for the requested user.
get_languages_notify_users()
load language files for all users that need to be notified into an array - use for message and email notification load in default language strings first and then overwrite with preferred language strings
get_languages_notify_users([array<string|int, mixed> $languages = array() ]) : array<string|int, mixed>Parameters
- $languages : array<string|int, mixed> = array()
-
- array of language strings
Return values
array<string|int, mixed> —$language_strings_all
get_upload_url()
Generate upload URL - alters based on $upload_then_edit setting and external uploads
get_upload_url([string $collection = "" ][, mixed $k = "" ]) : stringParameters
- $collection : string = ""
-
- optional collection
- $k : mixed = ""
Return values
stringemulate_user()
Used to emulate system users when accessing system anonymously or via external shares Sets global array such as $userpermissions, $username and sets any relevant config options
emulate_user(int $user[, int $usergroup = "" ]) : voidParameters
- $user : int
-
User ID
- $usergroup : int = ""
-
usergroup ID
is_authenticated()
is_authenticated() : mixedget_approver_usergroups()
Returns an array of the user groups the supplied user group acts as an approver for.
get_approver_usergroups([int $usergroup = "" ]) : array<string|int, mixed>Uses config $usergroup_approval_mappings.
Parameters
- $usergroup : int = ""
-
Approving user group
Return values
array<string|int, mixed> —Array of subordinate user group ids.
get_usergroup_approvers()
Returns an array of user groups who act as user request approvers to the user group supplied.
get_usergroup_approvers([int $usergroup = "" ]) : array<string|int, mixed>Uses config $usergroup_approval_mappings.
Parameters
- $usergroup : int = ""
-
Subordinate user group who's approval user group we need to find.
Return values
array<string|int, mixed> —Approval user group ids for supplied user group. Likely one value but its possible to have multiple approving groups.
get_users_by_permission()
Retrieve all user records in groups with/without the specified permissions
get_users_by_permission(array<string|int, mixed> $permissions) : array<string|int, mixed>Parameters
- $permissions : array<string|int, mixed>
-
array of permission strings to check
Return values
array<string|int, mixed> —Matching user records (only returns a subset of columns)
Note that this can't use a straight FIND_IN_SET for permissions since that is case insensitive
is_anonymous_user()
Determine whether user is anonymous user
is_anonymous_user() : boolReturn values
boolget_users_by_preference()
Retrieve all user records with the user preference specified
get_users_by_preference(string $preference, string $value) : array<string|int, mixed>Parameters
- $preference : string
-
Preference to check
- $value : string
-
Preference value to check for
Return values
array<string|int, mixed> —Array of user refs with the preference set as specified
get_default_notify_states()
Get the default notification workflow states for the current user. Used by setup_user() and get_user_actions() if no user preference has been set
get_default_notify_states() : array<string|int, mixed>Return values
array<string|int, mixed> —Array of workflow state references
generate_temp_download_key()
Generate a temporary download key for user. Used to enable temporary resource access to a file via download.php so that API can access resources after calling get_resource_path()
generate_temp_download_key(int $user, int $resource, string $size) : stringParameters
- $user : int
-
User ID
- $resource : int
-
Resource ID
- $size : string
-
Download size to access.
Return values
string —Access key - empty if not permitted
validate_temp_download_key()
Validate the provided download key to authenticate a download or override an access check.
validate_temp_download_key(int $ref, string $keystring, string $size[, int $expire_seconds = 0 ][, bool $setup_user = true ]) : boolParameters
- $ref : int
-
Resource ID
- $keystring : string
-
Key string - includes a nonce prefix
- $size : string
-
Download size to access.
- $expire_seconds : int = 0
-
Optional parameter to set specified expiry time in seconds. Use 0 to set system default.
- $setup_user : bool = true
-
Set to false where there is no need to initialise the user.
Return values
boolsetup_command_line_user()
Set up a dummy user with required permissions etc. to pass permission checks if running scripts from the command line
setup_command_line_user([array<string|int, mixed> $setoptions = [] ]) : boolParameters
- $setoptions : array<string|int, mixed> = []
Return values
boolupdate_user_access()
Update user table to record access by a user
update_user_access([int $user = 0 ][, array<string|int, mixed> $set_values = [] ]) : boolParameters
- $user : int = 0
-
User ID
- $set_values : array<string|int, mixed> = []
-
Optional array of column names and values to set
Return values
boolcheckPermission_manage_users()
Check if the user can manage users.
checkPermission_manage_users() : boolReturn values
boolget_processing_message()
Get the processing status message for the current user.
get_processing_message() : false|array<string|int, mixed>Return values
false|array<string|int, mixed>set_processing_message()
set_processing_message(string $message) : mixedParameters
- $message : string
can_set_admin_usergroup()
Consider if the current user is able to escalate the permissions of a user to the level of a "super admin".
can_set_admin_usergroup(int $new_usergroup) : boolOnly users with "a" permission should be able to make other users super admins (user groups with "a" permission). Also used to determine if "super admin" level user groups should be displayed.
Parameters
- $new_usergroup : int
-
ID of user group to be set
Return values
boolcors_is_origin_allowed()
Checks if the origin matches a whitelist entry, supporting wildcards like "*.example.com".
cors_is_origin_allowed(string $origin, array<string|int, mixed> $whitelist) : bool@param string $origin The URL to check.
Parameters
- $origin : string
- $whitelist : array<string|int, mixed>
-
Array of valid URLs - can include wildcards. @return bool True if the origin is allowed, false otherwise.
Return values
booldelete_usergroup()
Delete a user group and associated records.
delete_usergroup(int $usergroup_ref) : boolParameters
- $usergroup_ref : int
Return values
boolbrowser_check()
Check that this is a real browser by executing JS to set an expected cookie.
browser_check() : mixedxor_base64_encode()
Obfuscates a string using a fixed XOR pattern and encodes it in Base64.
xor_base64_encode(string $str) : stringThis function performs a basic transformation by XOR-ing each character of the input with a repeating fixed byte pattern, then encodes the result in Base64. Designed to be mirrored easily in JavaScript for lightweight bot detection.
Parameters
- $str : string
-
The input string to obfuscate.
Return values
string —The Base64-encoded, XOR-obfuscated string.
load_site_text_for_usergroup()
Load site text for a user group. To preserve the original state of global language values, this function will always revert previous changes first.
load_site_text_for_usergroup(int $group) : voidParameters
- $group : int
-
$usergroup value. Normally int however maybe null for activity before login e.g. load user group site text for an activity by supplying a user group id and then return to the defaults by supplying null.
get_video_resolution()
Get video resolution and framerate using FFMpeg
get_video_resolution(string $file) : array<string|int, mixed>Parameters
- $file : string
-
Path to video file
Tags
Return values
array<string|int, mixed>display_video_subtitles()
Generate HTML to display subtitles in playback of a video resource.
display_video_subtitles(int $ref, int $access) : voidParameters
- $ref : int
-
Resource ID
- $access : int
-
Resource access level - e.g. 0 for open access
generate_videojs_options()
Generate JSON array of VideoJS options to be used in the data-setup attribute
generate_videojs_options(bool $view_as_gif, bool $play_on_hover, array<string|int, mixed> $video_preview_sources) : string|falseParameters
- $view_as_gif : bool
-
True if the video is a GIF file
- $play_on_hover : bool
-
True if playing video on hover
- $video_preview_sources : array<string|int, mixed>
-
Array of preview sources, including URL, type and label
Return values
string|falseHookAction_datesAllInitialise()
HookAction_datesAllInitialise() : mixedHookAction_datesCronCron()
HookAction_datesCronCron() : mixedHookAction_datesCron_copy_hitcountCron()
HookAction_datesCron_copy_hitcountCron() : mixedHookAdobe_linkAllInitialise()
HookAdobe_linkAllInitialise() : mixedHookAdobe_linkDownloadProvideusercredentials()
HookAdobe_linkDownloadProvideusercredentials() : mixedHookAdobe_linkDownloadCookies_notification_bypass()
HookAdobe_linkDownloadCookies_notification_bypass() : mixedHookAdobe_linkDownloadBlockwatermark()
HookAdobe_linkDownloadBlockwatermark() : mixedHookAdobe_linkDownloadAllow_in_browser()
HookAdobe_linkDownloadAllow_in_browser(mixed $permitted_mime) : mixedParameters
- $permitted_mime : mixed
HookAdobe_linkUpload_batchProvideusercredentials()
HookAdobe_linkUpload_batchProvideusercredentials() : mixedHookAdobe_linkUpload_batchCookies_notification_bypass()
HookAdobe_linkUpload_batchCookies_notification_bypass() : mixedHookAdobe_linkUpload_batchModify_upload_file()
HookAdobe_linkUpload_batchModify_upload_file(mixed $filename, mixed $filepath) : mixedParameters
- $filename : mixed
- $filepath : mixed
HookAdobe_linkViewBefore_footer_always()
Replace download links with code to support importing resources into Adobe CC
HookAdobe_linkViewBefore_footer_always() : mixedHookAdobe_linkViewDownloadbuttonreplace()
HookAdobe_linkViewDownloadbuttonreplace() : mixedHookAdobe_linkViewOrigdownloadlink()
HookAdobe_linkViewOrigdownloadlink() : mixedHookAdobe_linkViewReplacepreviewlink()
HookAdobe_linkViewReplacepreviewlink(string $preview_title) : mixedParameters
- $preview_title : string
adobe_link_genkey()
adobe_link_genkey(mixed $user, mixed $resource) : mixedParameters
- $user : mixed
- $resource : mixed
adobe_link_check_credentials()
adobe_link_check_credentials() : mixedHookApi_webhooksEditExtra_edit_buttons()
HookApi_webhooksEditExtra_edit_buttons() : mixedHookApi_webhooksEditRedirectaftersave()
HookApi_webhooksEditRedirectaftersave() : mixedHookApi_webhooksEditUploadreviewabortnext()
HookApi_webhooksEditUploadreviewabortnext() : mixedHookApi_webhooksEditRedirectaftersavetemplate()
HookApi_webhooksEditRedirectaftersavetemplate() : mixedHookAutoassign_mrequestsAllAutoassign_individual_requests()
HookAutoassign_mrequestsAllAutoassign_individual_requests(mixed $user_ref, mixed $collection_ref, mixed $message, mixed $manage_collection_request) : mixedParameters
- $user_ref : mixed
- $collection_ref : mixed
- $message : mixed
- $manage_collection_request : mixed
HookAutoassign_mrequestsAllAutoassign_collection_requests()
HookAutoassign_mrequestsAllAutoassign_collection_requests(mixed $user_ref, mixed $collection_data, mixed $message, mixed $manage_collection_request) : mixedParameters
- $user_ref : mixed
- $collection_data : mixed
- $message : mixed
- $manage_collection_request : mixed
HookAutoassign_mrequestsAllBypass_end_managed_collection_request()
HookAutoassign_mrequestsAllBypass_end_managed_collection_request(mixed $manage_individual_requests, mixed $collection_id, mixed $request_query, mixed $message, mixed $templatevars, mixed $assigned_to_user, mixed $admin_mail_template, mixed $user_mail_template) : mixedParameters
- $manage_individual_requests : mixed
- $collection_id : mixed
- $request_query : mixed
- $message : mixed
- $templatevars : mixed
- $assigned_to_user : mixed
- $admin_mail_template : mixed
- $user_mail_template : mixed
HookAutoassign_mrequestsAllExport_add_tables()
HookAutoassign_mrequestsAllExport_add_tables() : mixedHookAutoassign_mrequestsAllOn_delete_user()
HookAutoassign_mrequestsAllOn_delete_user(mixed $ref) : mixedParameters
- $ref : mixed
get_mapped_fields()
get_mapped_fields() : mixedget_mapped_user_by_field()
get_mapped_user_by_field(mixed $id, mixed $value) : mixedParameters
- $id : mixed
- $value : mixed
HookBrand_guidelinesAdmin_group_permissionsAdditionalperms()
HookBrand_guidelinesAdmin_group_permissionsAdditionalperms() : mixedHookBrand_guidelinesAllInitialise()
HookBrand_guidelinesAllInitialise() : mixedHookBrand_guidelinesAllHandleuserref()
HookBrand_guidelinesAllHandleuserref() : mixedHookBrand_guidelinesContentRender_custom_fields_default_case_override()
Render decorator of custom fields used by Brand Guidelines
HookBrand_guidelinesContentRender_custom_fields_default_case_override(array<string|int, mixed> $field) : boolParameters
- $field : array<string|int, mixed>
-
Custom field structure - process_custom_fields_submission()
Return values
bool —Returns true to indicate to ResourceSpace that the core render functionality is being overriden by the plugin (for this field type), false otherwise.
HookBrand_guidelinesContentProcess_custom_fields_submission_validator()
Validate custom fields' submitted input.
HookBrand_guidelinesContentProcess_custom_fields_submission_validator(array<string|int, mixed> $field) : false|stringParameters
- $field : array<string|int, mixed>
Return values
false|string —Return custom fields' type input validation error or false to let ResourceSpace core handling to run.
HookBrand_guidelinesEditEditbeforeheader()
Ensure we always pass along the Brand Guidelines callback URL, if one was provided.
HookBrand_guidelinesEditEditbeforeheader() : voidTags
HookBrand_guidelinesEditUploadreviewabortnext()
Hooks onto the upload review workflow (for upload then edit mode) when "save and next" is carried out and adds the first resource ID (which is supposed to be the last uploaded resource, for brand guidelines) to the manage content callback (redirect URL).
HookBrand_guidelinesEditUploadreviewabortnext() : boolTags
Return values
boolHookBrand_guidelinesEditRedirectaftersavetemplate()
Hooks onto the edit then upload mode and changes the redirect URL to the provided callback. This will allow the upload_batch page to use it once the file upload has finished.
HookBrand_guidelinesEditRedirectaftersavetemplate() : boolTags
Return values
boolHookBrand_guidelinesGuidelinesExtra_videojs_content_html()
HookBrand_guidelinesGuidelinesExtra_videojs_content_html(array<string|int, mixed> $ctx) : mixedParameters
- $ctx : array<string|int, mixed>
HookBrand_guidelinesUpload_batchModify_redirecturl()
Ensure we always pass along the Brand Guidelines callback URL, if one was provided.
HookBrand_guidelinesUpload_batchModify_redirecturl() : mixedTags
HookBrand_guidelinesUpload_batchPostUploadActions_before_csl_redirurl_js()
IMPORTANT: Directly within Javascript world on the upload_batch page!
HookBrand_guidelinesUpload_batchPostUploadActions_before_csl_redirurl_js() : voidComplements the following hooks:
- HookBrand_guidelinesEditEditbeforeheader
- HookBrand_guidelinesEditRedirectaftersavetemplate which are used in the edit then upload mode. Here the logic will modify the "redirurl" URL variable and inject the newly uploaded resource ID required by the plugin.
HookClipAdmin_group_permissionsAdditionalperms()
HookClipAdmin_group_permissionsAdditionalperms() : mixedHookClipAllAddspecialsearch()
HookClipAllAddspecialsearch(mixed $search, mixed $select, mixed $sql_join, mixed $sql_filter) : mixedParameters
- $search : mixed
- $select : mixed
- $sql_join : mixed
- $sql_filter : mixed
HookClipAllSearch_pipeline_setup()
HookClipAllSearch_pipeline_setup(mixed $search, mixed $select, mixed $sql_join, mixed $sql_filter) : mixedParameters
- $search : mixed
- $select : mixed
- $sql_join : mixed
- $sql_filter : mixed
HookClipAllSearchbarafterbuttons()
HookClipAllSearchbarafterbuttons() : mixedHookClipAllAfterpreviewcreation()
Runs vector generation automatically after preview creation, if configured.
HookClipAllAfterpreviewcreation(int $resource, int $alternative[, bool $generate_all = false ]) : voidThis function is triggered after a resource's preview image has been generated. If configured, it will perform CLIP generation on the main resource file (ignoring alternative files). Progress messages are displayed during processing.
Parameters
- $resource : int
-
The resource reference ID that has just had previews created.
- $alternative : int
-
The alternative file ID, or -1 if processing the main resource.
- $generate_all : bool = false
-
Flag to indicate if hook has been triggered during full preview creation process
HookClipAllCron()
HookClipAllCron() : mixedHookClipAllBeforedeleteresourcefromdb()
HookClipAllBeforedeleteresourcefromdb(mixed $ref) : mixedParameters
- $ref : mixed
HookClipAllAddtriggerablejob()
Hook into offline jobs list to add custom job
HookClipAllAddtriggerablejob() : array<string|int, mixed>Return values
array<string|int, mixed> —Array of existing job data with custom job added
HookClipSearchSearch_header_after_actions()
HookClipSearchSearch_header_after_actions() : mixedHookClipViewCustompanels()
HookClipViewCustompanels() : mixedget_vector()
Sends an image file or text input to the CLIP vector service and returns the resulting vector.
get_vector(bool $is_text, string $input, int $ref) : array<string|int, mixed>|falseParameters
- $is_text : bool
-
Whether the input is text (true) or an image file (false).
- $input : string
-
Either the text string or the path to the image file.
- $ref : int
-
The resource ID (used for logging/debugging purposes only).
Return values
array<string|int, mixed>|false —Returns a 512-float array representing the CLIP vector, or false if the service failed or returned invalid data.
vector_visualise()
Generates a simple visual representation of a CLIP vector as a 64-character string. This helps visualise differences between vectors in a human-readable form.
vector_visualise(array<string|int, mixed> $vector) : stringParameters
- $vector : array<string|int, mixed>
-
A 512-element array of float values (normalised CLIP vector).
Return values
string —A 64-character string "fingerprint" visualising the vector content.
clip_generate_vector()
Generates and stores a CLIP vector for a given resource.
clip_generate_vector(int $ref) : boolThis function:
- Loads the specified resource data.
- Attempts to locate a resized (pre) version of the resource image.
- Sends the image to the CLIP service to obtain a 512-float vector.
- Stores the resulting vector as a binary blob in the database.
Parameters
- $ref : int
-
The resource ID for which to generate the vector.
Return values
bool —Returns true on success, or false on failure (e.g., file missing or vector generation error).
clip_tag()
Auto-tags and titles a resource using CLIP vector search.
clip_tag(int $resource) : boolThis function sends the resource ID to the external CLIP-based Python service to retrieve suggested keywords and a title based on the resource's content.
It populates:
- A keyword metadata field (multiple nodes created)
- A title metadata field (single text string)
Global configuration variables (all available on the plugin's setup page)
- $clip_service_url: Base URL for the CLIP service
- $mysql_db: Current MySQL database name
- $clip_keyword_field: Field ID for keywords (node-based)
- $clip_keyword_url: URL of tag database for keywords
- $clip_keyword_count: Number of keyword suggestions to fetch
- $clip_title_field: Field ID for title (text field)
- $clip_title_url: URL of tag database for titles
Parameters
- $resource : int
-
Resource ID to tag and title.
Return values
bool —Always returns true after processing.
clip_generate_missing_vectors()
clip_generate_missing_vectors(mixed $limit) : mixedParameters
- $limit : mixed
clip_count_vectors()
Returns a count of vectors in the system
clip_count_vectors() : intReturn values
int —The total
clip_missing_vectors()
Returns a count of vectors missing
clip_missing_vectors() : intReturn values
int —The total
clip_vector_cleanup()
Removes orphaned vectors - those that do not have a valid resource specified either because the resource has been removed or because the list of resource types for which vectors are created has been changed.
clip_vector_cleanup() : voidHookConditional_termsAllInitialise()
HookConditional_termsAllInitialise() : mixedHookConditional_termsAllExtra_checks()
HookConditional_termsAllExtra_checks() : mixedHookConditional_termsCheckAddinstallationcheck()
HookConditional_termsCheckAddinstallationcheck() : mixedHookConditional_termsViewDownloadlink()
HookConditional_termsViewDownloadlink(mixed $baseparams[, mixed $view_in_browser = false ]) : mixedParameters
- $baseparams : mixed
- $view_in_browser : mixed = false
conditional_terms_config_check()
conditional_terms_config_check() : mixedapi_consentmanager_get_consents()
api_consentmanager_get_consents(mixed $ref) : mixedParameters
- $ref : mixed
api_consentmanager_delete_consent()
api_consentmanager_delete_consent(mixed $ref) : mixedParameters
- $ref : mixed
api_consentmanager_batch_link_unlink()
api_consentmanager_batch_link_unlink(mixed $consent, mixed $collection, mixed $unlink) : mixedParameters
- $consent : mixed
- $collection : mixed
- $unlink : mixed
api_consentmanager_link_consent()
api_consentmanager_link_consent(mixed $consent, mixed $resource) : mixedParameters
- $consent : mixed
- $resource : mixed
api_consentmanager_unlink_consent()
api_consentmanager_unlink_consent(mixed $consent, mixed $resource) : mixedParameters
- $consent : mixed
- $resource : mixed
api_consentmanager_create_consent()
api_consentmanager_create_consent(mixed $name, mixed $email, mixed $telephone, mixed $consent_usage[, mixed $notes = "" ][, mixed $expires = null ][, mixed $date_of_birth = null ][, mixed $address = null ][, mixed $parent_guardian = null ][, mixed $date_of_consent = null ]) : mixedParameters
- $name : mixed
- $email : mixed
- $telephone : mixed
- $consent_usage : mixed
- $notes : mixed = ""
- $expires : mixed = null
- $date_of_birth : mixed = null
- $address : mixed = null
- $parent_guardian : mixed = null
- $date_of_consent : mixed = null
api_consentmanager_get_consent()
api_consentmanager_get_consent(mixed $consent) : mixedParameters
- $consent : mixed
api_consentmanager_update_consent()
api_consentmanager_update_consent(mixed $consent, mixed $name, mixed $email, mixed $telephone, mixed $consent_usage[, mixed $notes = "" ][, mixed $expires = null ][, mixed $date_of_birth = null ][, mixed $address = null ][, mixed $parent_guardian = null ][, mixed $date_of_consent = null ]) : mixedParameters
- $consent : mixed
- $name : mixed
- $email : mixed
- $telephone : mixed
- $consent_usage : mixed
- $notes : mixed = ""
- $expires : mixed = null
- $date_of_birth : mixed = null
- $address : mixed = null
- $parent_guardian : mixed = null
- $date_of_consent : mixed = null
api_consentmanager_get_all_consents()
api_consentmanager_get_all_consents([mixed $findtext = "" ]) : mixedParameters
- $findtext : mixed = ""
api_consentmanager_get_all_consents_by_collection()
api_consentmanager_get_all_consents_by_collection(mixed $collection) : mixedParameters
- $collection : mixed
api_consentmanager_save_file()
api_consentmanager_save_file(mixed $consent, mixed $filename) : mixedParameters
- $consent : mixed
- $filename : mixed
HookConsentmanagerAdmin_group_permissionsAdditionalperms()
HookConsentmanagerAdmin_group_permissionsAdditionalperms() : mixedHookConsentmanagerAllExport_add_tables()
HookConsentmanagerAllExport_add_tables() : mixedHookConsentmanagerAllRender_actions_add_collection_option()
HookConsentmanagerAllRender_actions_add_collection_option(mixed $top_actions, array<string|int, mixed> $options, array<string|int, mixed> $collection_data) : mixedParameters
- $top_actions : mixed
- $options : array<string|int, mixed>
- $collection_data : array<string|int, mixed>
HookConsentmanagerAllHandleuserref()
HookConsentmanagerAllHandleuserref() : mixedHookConsentmanagerAllCron()
HookConsentmanagerAllCron() : mixedHookConsentmanagerAllAddspecialsearch()
HookConsentmanagerAllAddspecialsearch(mixed $search, mixed $select, mixed $sql_join, mixed $sql_filter) : mixedParameters
- $search : mixed
- $select : mixed
- $sql_join : mixed
- $sql_filter : mixed
HookConsentmanagerEditEndofmetadataaddcustomfield()
HookConsentmanagerEditEndofmetadataaddcustomfield() : mixedHookConsentmanagerEditAftersaveresourcedata()
HookConsentmanagerEditAftersaveresourcedata(int|array<string|int, mixed> $ref) : bool|array<string|int, mixed>Parameters
- $ref : int|array<string|int, mixed>
Return values
bool|array<string|int, mixed>HookConsentmanagerEditCopy_locked_data_extra()
HookConsentmanagerEditCopy_locked_data_extra(array<string|int, mixed> $resource, array<string|int, mixed> $locked_fields, int $last_edited[, bool $save = false ]) : bool|array<string|int, mixed>Parameters
- $resource : array<string|int, mixed>
- $locked_fields : array<string|int, mixed>
- $last_edited : int
- $save : bool = false
Return values
bool|array<string|int, mixed>HookConsentmanagerTeam_homeCustomteamfunction()
HookConsentmanagerTeam_homeCustomteamfunction() : mixedHookConsentmanagerUser_preferencesAdd_user_preference_page_def()
HookConsentmanagerUser_preferencesAdd_user_preference_page_def(mixed $page_def) : mixedParameters
- $page_def : mixed
HookConsentmanagerViewCustompanels()
HookConsentmanagerViewCustompanels() : mixedconsentmanager_check_read()
Check if the user should have read access to a consent record
consentmanager_check_read([int|null $resource = null ]) : boolDetermines if the user has read access for a specific resource or general read permissions.
Parameters
- $resource : int|null = null
-
The ID of the resource to check read access for. If null, checks for general read permissions.
Return values
bool —Returns true if the user has the required permissions; false otherwise.
consentmanager_check_write()
Check if the user should have write access to a consent record
consentmanager_check_write([int|null $resource = null ]) : boolDetermines if the user has write access for a specific resource or general write permissions.
Parameters
- $resource : int|null = null
-
The ID of the resource to check write access for. If null, checks for general write permissions.
Return values
bool —Returns true if the user has the required permissions; false otherwise.
consentmanager_get_consents()
Get a list of consents for a given resource
consentmanager_get_consents(int $resource) : array<string|int, mixed>|boolThis function retrieves a list of consent records associated with a specified resource. Each record includes the consent ID, name, expiration date, and consent usage.
Parameters
- $resource : int
-
The ID of the resource for which to retrieve associated consents.
Return values
array<string|int, mixed>|bool —Returns an array of consents associated with the resource if the user has read access; otherwise, returns false.
consentmanager_delete_consent()
Delete a consent record
consentmanager_delete_consent(int $ref) : boolThis function deletes a consent record and its associations with resources by removing entries from the
consentandresource_consenttables.Parameters
- $ref : int
-
The ID of the consent record to be deleted.
Return values
bool —Returns true if the consent record was successfully deleted, or false if the user does not have write access to the resource.
consentmanager_create_consent()
Create a new consent record
consentmanager_create_consent(string $name, string|null $date_of_birth, string|null $address, string|null $parent_guardian, string $email, string $telephone, string $consent_usage, string $notes, string|null $date_of_consent, string|null $expires, string $created_by) : int|boolThis function creates a new consent record by inserting the provided details into the
consenttable. It returns the ID of the newly created consent record if successful.Parameters
- $name : string
-
The name of the individual giving consent.
- $date_of_birth : string|null
-
The DOB of the individual, formatted as a string. Optional.
- $address : string|null
-
The address of the individual. Optional.
- $parent_guardian : string|null
-
The parent or guardian of the individual. Optional.
- $email : string
-
The email address of the individual.
- $telephone : string
-
The telephone number of the individual.
- $consent_usage : string
-
Description of the intended usage for which consent is given.
- $notes : string
-
Any additional notes related to the consent record.
- $date_of_consent : string|null
-
The date the consent applies from.
- $expires : string|null
-
The expiry date of the consent, formatted as a string.
- $created_by : string
-
The ref of the user who created the consent record.
Return values
int|bool —Returns the ID of the new consent record on success, or false if the user does not have write access.
consentmanager_link_consent()
Link a consent record with a resource
consentmanager_link_consent(int $consent, int $resource) : boolThis function links a consent record to a specified resource by inserting an entry in the
resource_consenttable. It also logs this action in the resource's log.Parameters
- $consent : int
-
The ID of the consent record to be linked to the resource.
- $resource : int
-
The ID of the resource to which the consent is being linked.
Return values
bool —Returns true if the consent was successfully linked, false if the user does not have write access to the resource.
consentmanager_unlink_consent()
Unlink a consent record from a resource
consentmanager_unlink_consent(int $consent, int $resource) : boolThis function removes the association between a specified consent record and a resource. The action is logged for the resource.
Parameters
- $consent : int
-
The ID of the consent record to unlink.
- $resource : int
-
The ID of the resource from which to unlink the consent.
Return values
bool —Returns true if the consent record is successfully unlinked; returns false if the user does not have write access to the resource.
consentmanager_batch_link_unlink()
Link/unlink all resources in a collection with a consent record
consentmanager_batch_link_unlink(int $consent, int $collection, bool $unlink) : boolThis function links or unlinks all resources in a specified collection to/from a given consent record. If unlinking, it removes existing relationships between the consent record and the resources. If linking, it creates new relationships. Each action is logged.
Parameters
- $consent : int
-
The ID of the consent record to link or unlink.
- $collection : int
-
The ID of the collection containing the resources to process.
- $unlink : bool
-
Set to true to unlink resources from the consent; set to false to link resources to the consent.
Return values
bool —Returns true if the process completes successfully; returns false if an invalid consent ID is provided.
consentmanager_get_consent()
Retrieve a consent record
consentmanager_get_consent(int $consent) : array<string|int, mixed>|boolThis function retrieves the details of a specified consent record, including the subject's name, email, telephone number, consent usage types, notes, expiry date, and file. It also fetches a list of resources associated with the consent.
Parameters
- $consent : int
-
The ID of the consent record to fetch.
Return values
array<string|int, mixed>|bool —Returns an associative array containing consent details and associated resources if the user has read access; returns false if access is denied or the consent record does not exist.
consentmanager_update_consent()
Update a consent record
consentmanager_update_consent(int $consent, string $name, string|null $date_of_birth, string|null $address, string|null $parent_guardian, string $email, string $telephone, string $consent_usage, string $notes, string|null $date_of_consent, string|null $expires) : boolThis function updates the details of an existing consent record with the provided information. It allows modification of the subject's name, DOB, address, parent/guardian name, email, telephone number, consent usage types, date of consent, notes, and expiry date. It also resets the expiration_notice_sent flag if the expiry date is modified.
Parameters
- $consent : int
-
The ID of the consent record to update.
- $name : string
-
The name of the individual giving consent.
- $date_of_birth : string|null
-
The DOB of the individual, formatted as a string. Optional.
- $address : string|null
-
The address of the individual. Optional.
- $parent_guardian : string|null
-
The parent or guardian of the individual. Optional.
- $email : string
-
The email address of the individual.
- $telephone : string
-
The telephone number of the individual.
- $consent_usage : string
-
A description of the permitted usage types for the consent.
- $notes : string
-
Additional notes related to the consent record.
- $date_of_consent : string|null
-
The date the consent applies from.
- $expires : string|null
-
The expiry date of the consent record, formatted as a string.
Return values
bool —Returns true if the consent record was successfully updated, or false if the user does not have write access.
consentmanager_get_all_consents_by_collection()
Fetch all consent records linked to resources in a collection
consentmanager_get_all_consents_by_collection(int $collection) : array<string|int, mixed>|boolThis function retrieves all consent records that are linked to resources within a specified collection. It returns an array of consents associated with the resources in the collection.
Parameters
- $collection : int
-
The ID of the collection containing the resources for which to retrieve consent records.
Return values
array<string|int, mixed>|bool —Returns an array of consent records if the user has read access; otherwise, returns false.
consentmanager_get_all_consents()
Fetch all consent records, optionally filtered by search text
consentmanager_get_all_consents([string $findtext = "" ][, string $consent_status = "all" ]) : array<string|int, mixed>|boolThis function retrieves all consent records from the database. If a search string is provided, it filters the results based on the name of the person associated with each consent record. It can also filter based on consent status e.g all, active (non-expired), expiring (expiring within a configured amount of days), expired. Defaults to returning all.
Parameters
- $findtext : string = ""
-
Optional. A search string to filter the results by the name of the person giving consent. If empty, returns all records.
- $consent_status : string = "all"
-
Status of consent records to return
Return values
array<string|int, mixed>|bool —Returns an array of consent records if the user has read access; otherwise, returns false.
consentmanager_get_all_consents_grouped()
Fetch all consent records grouped by if they are expiring or not
consentmanager_get_all_consents_grouped() : array<string|int, mixed>|boolReturn values
array<string|int, mixed>|bool —Returns an array of consent records if the user has read access; otherwise, returns false.
consentmanager_save_file()
Save a file associated with a consent record
consentmanager_save_file(int $consent, string $filename, string $filedata) : boolThis function saves a file (typically a consent form or related document) to the file system and updates the associated consent record in the database with the filename. The function checks user permissions and blocks the upload if the file extension is banned.
Parameters
- $consent : int
-
The ID of the consent record to associate the file with.
- $filename : string
-
The name of the file to be saved (including extension).
- $filedata : string
-
The raw file data (contents) to be written to disk.
Return values
bool —Returns true if the file was saved and the database updated successfully; returns false if the user lacks permission or the file extension is not allowed.
consentmanager_get_expiring_consents()
Fetch all expiring consent records
consentmanager_get_expiring_consents(int $expires_within[, bool $unsent_only = true ]) : array<string|int, mixed>|boolThis function returns an array of consent records that are expiring within so many days. It can optionally be filtered to include records that have not been flagged as having an expiration notification already sent
Parameters
- $expires_within : int
-
Number of days that the records are expiring within
- $unsent_only : bool = true
-
Include only records where an expiration notification hasn't been sent
Return values
array<string|int, mixed>|bool —Returns an array of expiring consent records if the user has read access; otherwise, returns false.
consentmanager_set_consent_expiration_notice()
Sets expiration notice sent flag on consent records
consentmanager_set_consent_expiration_notice(array<string|int, mixed> $consents) : boolThis function takes an array of consent record references and sets the expiration_notice_sent flag on each one.
Parameters
- $consents : array<string|int, mixed>
-
An array of consent references
Return values
bool —Returns true if the flags were set; otherwise, returns false
consentmanager_get_expired_consent_resources()
Fetch expired consent records
consentmanager_get_expired_consent_resources(int $archive_status) : array<string|int, mixed>|boolThis function returns expired consent records that are not deleted and are not in the passed archive_state
Parameters
- $archive_status : int
Return values
array<string|int, mixed>|bool —Returns an array of expired consent records; otherwise, returns false.
consentmanager_process_expiry_notifications()
Process expiring consent records and send a notification/email
consentmanager_process_expiry_notifications() : boolReturn values
bool —Returns true if the notification process completes
consentmanager_process_expired_auto_archive()
Process expired consent records and archive them
consentmanager_process_expired_auto_archive() : boolReturn values
bool —Returns true if the auto archiving process completes
get_consent_file_path()
get_consent_file_path(mixed $ref) : mixedParameters
- $ref : mixed
HookCookies_notificationAllHandleuserref()
HookCookies_notificationAllHandleuserref() : mixedHookCookies_notificationAllAfteruicenter()
HookCookies_notificationAllAfteruicenter() : mixedHookCookies_notificationLoginPostlogout()
HookCookies_notificationLoginPostlogout() : mixedHookCookies_notificationAllRemoveuseridcookie()
HookCookies_notificationAllRemoveuseridcookie() : mixedHookCsv_uploadTeam_resourceMenuitem()
HookCsv_uploadTeam_resourceMenuitem() : mixedcsv_upload_process()
Process the uploaded CSV
csv_upload_process(string $filename, array<string|int, mixed> &$meta, array<string|int, mixed> $resource_types, array<string|int, mixed> &$messages, array<string|int, mixed> $csv_set_options[, int $max_error_count = 100 ][, bool $processcsv = false ]) : boolParameters
- $filename : string
-
Path to CSV file
- $meta : array<string|int, mixed>
-
Array of resource types and associated fields returned by meta_get_map() in include/meta_functions.php
- $resource_types : array<string|int, mixed>
-
Array of resource type data, with the resource type ID as the key
- $messages : array<string|int, mixed>
-
Array to store processing, information and error messages, passed by reference
- $csv_set_options : array<string|int, mixed>
-
Array of CSV processsing options, includes CSV column to metadata field mappings and csv mode
- $max_error_count : int = 100
-
Maximum number of fatal errors to accept before aborting
- $processcsv : bool = false
-
Process data? If false data will be checked without making changes
Return values
boolcsv_upload_get_info()
csv_upload_get_info(mixed $filename, mixed &$messages) : mixedParameters
- $filename : mixed
- $messages : mixed
csv_upload_log()
Append text to csv log file
csv_upload_log(string $logfile, mixed $logtext) : voidParameters
- $logfile : string
-
path to log file
- $logtext : mixed
-
text to append
get_csv_line_matching_resources()
Return the resources with the csv value found in the specified field.
get_csv_line_matching_resources(int $field, string $csv_value) : array<string|int, mixed>Parameters
- $field : int
-
Resource type field ref - the field for csv upload to match on.
- $csv_value : string
-
The value from the csv to match.
Return values
array<string|int, mixed> —Array of resources which have the csv value in the given field.
csv_check_utf8()
Checks if a passed csv file is valid for being processed, needs to be UTF-8 and if a BOM is present it will be stripped out before processing.
csv_check_utf8(string $filename) : array<string|int, mixed>Parameters
- $filename : string
-
Path to csv file
Return values
array<string|int, mixed> —Return an array with whether the file passed the check and a message
csv_strip_bom()
Attempt to strip out BOM from passed csv file if present. Replaces the original file.
csv_strip_bom(string $filename) : boolParameters
- $filename : string
-
Path to csv file
Return values
bool —Return whether BOM was able to be stripped or not
meta_get_map()
meta_get_map() : mixedHookCsv_user_importTeam_userRender_options_to_create_users()
HookCsv_user_importTeam_userRender_options_to_create_users() : mixedcsv_user_import_process()
Import users from uploaded CSV file or validate file for future use
csv_user_import_process(string $csv_file, string $user_group_id, array<string|int, mixed> &$messages[, bool $processcsv = false ]) : boolmandatory_columns in csv: 'username', 'email' optional_columns in csv: 'password', 'fullname', 'account_expires', 'comments', 'ip_restrict', 'lang'
Parameters
- $csv_file : string
-
Filepath to input file
- $user_group_id : string
-
Usergroup reference to add new users to
- $messages : array<string|int, mixed>
-
Array to store errors or warnings
- $processcsv : bool = false
-
if true process file else validate file only
Return values
bool —Return true if file processed of validated successfully, false if unable to process or validate file
HookCustom_filenameAllUploadfilesuccess()
HookCustom_filenameAllUploadfilesuccess(mixed $resource_ref) : mixedParameters
- $resource_ref : mixed
HookDirect_LinkResource_ShareAdditionalshares()
HookDirect_LinkResource_ShareAdditionalshares() : mixedHookEmbeddocumentAllModified_cors_process()
HookEmbeddocumentAllModified_cors_process() : mixedHookEmbeddocumentViewAfterresourceactions2()
HookEmbeddocumentViewAfterresourceactions2() : mixedHookEmbedslideshowAllExternal_share_view_as_internal_override()
HookEmbedslideshowAllExternal_share_view_as_internal_override() : mixedHookEmbedslideshowCollection_shareExtra_share_options()
HookEmbedslideshowCollection_shareExtra_share_options() : mixedHookEmbedvideoAllDirectdownloadaccess()
HookEmbedvideoAllDirectdownloadaccess() : mixedHookEmbedvideoAllModified_cors_process()
HookEmbedvideoAllModified_cors_process() : mixedHookEmbedvideoViewAfterresourceactions()
HookEmbedvideoViewAfterresourceactions() : mixedHookEmuAllInitialise()
HookEmuAllInitialise() : mixedHookEmuAllExtra_checks()
HookEmuAllExtra_checks() : mixedHookEmuCheckAddinstallationcheck()
HookEmuCheckAddinstallationcheck() : mixedHookEmuCron_copy_hitcountAddplugincronjob()
HookEmuCron_copy_hitcountAddplugincronjob() : mixedHookEmuEditEdithidefield()
HookEmuEditEdithidefield(mixed $field) : mixedParameters
- $field : mixed
HookEmuEditEditbeforesectionhead()
HookEmuEditEditbeforesectionhead() : mixedHookEmuAllAdditionalvalcheck()
HookEmuAllAdditionalvalcheck(mixed $fields, mixed $fields_item) : mixedParameters
- $fields : mixed
- $fields_item : mixed
HookEmuEditSaveextraresourcedata()
HookEmuEditSaveextraresourcedata(mixed $list) : mixedParameters
- $list : mixed
HookEmuEditAftersaveresourcedata()
Emu plugin attaching to the 'aftersaveresourcedata' hook IMPORTANT: 'aftersaveresourcedata' hook is called from both save_resource_data() and save_resource_data_multi()!
HookEmuEditAftersaveresourcedata() : bool|array<string|int, mixed>Return values
bool|array<string|int, mixed> —Returns FALSE to show hook didn't run -OR- a list of errors. See hook 'aftersaveresourcedata' in resource_functions.php for more info.
HookEmuEditcopylockedfieldsaddfields()
When uploading a batch of resources in upload then edit mode, locked fields are copied between resources in the batch.
HookEmuEditcopylockedfieldsaddfields(array<string|int, mixed> $locked_fields, int $origin_resource) : bool|array<string|int, mixed>If the EMu IRN field was locked and it contained a value, this function will add any fields mapped in the EMu plugin to the list of fields to copy. This allows the EMu data obtained for the first resource to be applied to all without making another call to EMu.
Parameters
- $locked_fields : array<string|int, mixed>
-
Array of metadata field refs that were locked on edit page (values to apply to all uploads)
- $origin_resource : int
-
Ref of resource to copy the locked field data from.
Return values
bool|array<string|int, mixed> —False if the EMu IRN field wasn't locked or has no value else array containing the updated list of locked fields (those supplied plus any mapped in the EMu plugin).
HookEmuViewRenderfield()
HookEmuViewRenderfield(mixed $field, mixed $resource) : mixedParameters
- $field : mixed
- $resource : mixed
emu_format_date()
Format date for EMu use (similar to the ISO8601 date format except the time zone designator is not included)
emu_format_date(int $timestamp[, string $format = 'c' ]) : stringParameters
- $timestamp : int
- $format : string = 'c'
-
PHP's date() valid format
Return values
stringget_emu_resources()
Function to retrieve all resources that have their IRN field set to a value and that are within the allowed resource types for an EMu update
get_emu_resources() : array<string|int, mixed>Return values
array<string|int, mixed>get_emu_data()
Get EMu data by using an array of IRNs.
get_emu_data(mixed $emu_api_server, mixed $emu_api_server_port, array<string|int, mixed> $irns, array<string|int, mixed> $emu_rs_mappings) : array<string|int, mixed>Parameters
- $emu_api_server : mixed
- $emu_api_server_port : mixed
- $irns : array<string|int, mixed>
-
Array of one/ more IRNs to get data by
- $emu_rs_mappings : array<string|int, mixed>
-
EMu table-column -> RS field mappings
Return values
array<string|int, mixed> —$return[IRN][Column] = Column value
Example: [74766] => Array ( [ObjTitle] => [ObjName] => mask [ChaAspectRatio] => )
[886159] => Array ( [ObjTitle] => [ObjName] => mask )
emu_script_log()
Log EMu script history both on screen and in a file
emu_script_log(string $message[, resource $log_file_pointer = null ]) : voidParameters
- $message : string
- $log_file_pointer : resource = null
check_config_changed()
Utility function to figure out emu plugin configuration changed.
check_config_changed() : boolFor example, can be used in cases when we need to check all records again because of new mappings have been added.
Return values
booladd_search_criteria()
Add search criteria to any existing IMuTerms object before doing a search on a module Note: uses $emu_search_criteria which value is basic TexQL (currently only AND and OR are supported, without support for nesting)
add_search_criteria(IMuTerms $imu_terms) : IMuTermsParameters
- $imu_terms : IMuTerms
-
Any IMuTerms object on which we want to add new search terms
Return values
IMuTermsemu_update_resource()
Update resource with the newly imported orginal file from EMu
emu_update_resource(int $ref, int $type, string $file_path) : boolParameters
- $ref : int
-
Resource ID
- $type : int
-
Resource type ID
- $file_path : string
-
Resource original file path
Return values
boolemu_get_rs_mapped_field_id()
Utility function to get the mapped ResourceSpace field from the mapping we set for emu plugin
emu_get_rs_mapped_field_id(string $column, array<string|int, mixed> $rs_module_column_field_mappings) : intParameters
- $column : string
-
EMu column that should have a map to a ResourceSpace field
- $rs_module_column_field_mappings : array<string|int, mixed>
Return values
int —Returns 0 if could not find value
emu_update_resource_metadata_from_record()
Update a resource with all the information from an EMu record which has mapped fields to ResourceSpace
emu_update_resource_metadata_from_record(int $resource, array<string|int, mixed> $record, array<string|int, mixed> $rs_module_column_field_mappings) : boolParameters
- $resource : int
-
Resource ID
- $record : array<string|int, mixed>
-
EMu record processed by emu plugin
- $rs_module_column_field_mappings : array<string|int, mixed>
Return values
boolemu_update_rs_field()
Update ResourceSpace field based on an EMu record field value (atomic/ non-atomic) Note: non-atomic values will be converted to a CSV value
emu_update_rs_field(int $ref, int $field, string|array<string|int, mixed> $record_value) : boolParameters
- $ref : int
-
Resource ID
- $field : int
-
Field ID
- $record_value : string|array<string|int, mixed>
-
The value of the record field
Return values
boolemu_convert_to_atomic()
Utility function which allows ResourceSpace to convert any EMu record field to an atomic field with its value formatted as CSV
emu_convert_to_atomic(string|array<string|int, mixed> $values) : stringParameters
- $values : string|array<string|int, mixed>
-
The value client code wants to convert to
Return values
string —CSV formatted string
HookFacesAdmin_group_permissionsAdditionalperms()
HookFacesAdmin_group_permissionsAdditionalperms() : mixedHookFacesAllAddspecialsearch()
Hook that enables special search syntax to find resources with visually similar faces to a given resource.
HookFacesAllAddspecialsearch(string $search, object $select, object $sql_join, object $sql_filter) : PreparedStatementQuery|falseThis hook listens for the special search syntax
!face<ID>, where<ID>is therefof a face in theresource_facetable. It queries an external Python service via HTTP to retrieve a list of resource references with matching faces above a configurable similarity threshold. The results are then integrated into ResourceSpace’s standard search mechanism.Parameters
- $search : string
-
The search string input, expected to be in the format '!face<ID>' if this is a search we're interested in.
- $select : object
-
An object containing the SQL SELECT clause and its parameters.
- $sql_join : object
-
An object containing any necessary SQL JOIN clauses and parameters.
- $sql_filter : object
-
An object containing additional SQL filter conditions and parameters.
Tags
Return values
PreparedStatementQuery|false —Returns a prepared SQL query to fetch matching resources if the search matches the
!facepattern; otherwise, returns false.HookFacesAllAfterpreviewcreation()
Runs face detection and tagging automatically after preview creation, if configured.
HookFacesAllAfterpreviewcreation(int $resource, int $alternative[, bool $generate_all = false ]) : voidThis function is triggered after a resource's preview image has been generated. If configured, it will perform face detection and/or tagging on the main resource file (ignoring alternative files). Progress messages are displayed during processing.
Parameters
- $resource : int
-
The resource reference ID that has just had previews created.
- $alternative : int
-
The alternative file ID, or -1 if processing the main resource.
- $generate_all : bool = false
-
Flag to indicate if hook has been triggered during full preview creation process
HookFacesAllCron()
Add face detection to the cron.
HookFacesAllCron() : voidHookFacesAllAddtriggerablejob()
Hook into offline jobs list to add custom job
HookFacesAllAddtriggerablejob() : array<string|int, mixed>Return values
array<string|int, mixed> —Array of existing job data with custom job added
HookFacesViewCustompanels()
Adds a custom panel to the resource view page displaying detected faces and tagging options.
HookFacesViewCustompanels() : boolThis hook is is triggered during the
view.phprendering process. It queries theresource_facetable for any faces detected in the current resource, and if found, renders a table showing cropped face previews along with a dropdown to tag the face with a named person. It also includes a link to perform a face similarity search (!face<ID>).Image dimensions are used to correctly crop and scale face previews for display using CSS background properties. Tagging actions invoke the
faces_tagAPI via JavaScript to persist the selected person name (node) for each face.Tags
Return values
bool —Returns false to allow further custom panels to be rendered after this one.
faces_detect()
Detects faces in the image associated with a given resource.
faces_detect(int $ref[, bool $force = false ]) : boolThis function attempts to locate a suitable JPEG file for the specified resource. It then sends the file to the Python FastAPI service. For each detected face, it records the bounding box, detection score, and face vector into the
resource_facedatabase table. The resource is then marked as processed.Parameters
- $ref : int
-
The resource reference ID to process.
- $force : bool = false
-
Force the processing of this resource, for example when replacing the file or where it was previously not possible to find the file.
Return values
bool —Returns true if face detection and storage were successful, or false if the file was missing, the service failed, or invalid data was returned.
faces_tag()
Tags detected faces in a given resource based on similarity to existing tagged faces.
faces_tag(int $resource) : boolThis function finds all untagged faces for the specified resource, sends each face to the Python FastAPI service to find similar known faces, and tags the face with the most frequently matched metadata node. It also updates the
resource_facetable to associate the face with the chosen metadata node.Parameters
- $resource : int
-
The resource reference ID to process and tag faces for.
Return values
bool —Returns true on successful processing, or false if any service errors or invalid responses are encountered.
api_faces_set_node()
API function to update the named person tag for a specific face using the provided node value.
api_faces_set_node(int $resource, int $face, int $node) : boolTypically triggered when selecting a name from a dropdown, this function assigns a metadata node (e.g. representing a person) to a face record in the
resource_facetable by updating thenodefield.Parameters
- $resource : int
- $face : int
-
The unique reference ID of the face to update (from
resource_face.ref). - $node : int
-
The node ID to assign to the face (typically corresponds to a controlled vocabulary entry).
Tags
Return values
bool —Returns true on successful update.
faces_detect_missing()
Detect faces in resources that have not yet been processed
faces_detect_missing() : intTags
Return values
int —A count of the resources processed.
faces_count_missing()
Return count of images to process
faces_count_missing() : intReturn values
int —The count
faces_count_faces()
Return a count of the detected faces
faces_count_faces() : intReturn values
int —The count
HookFalcon_linkAllInitialise()
HookFalcon_linkAllInitialise() : mixedHookFalcon_linkAllRender_actions_add_collection_option()
HookFalcon_linkAllRender_actions_add_collection_option(mixed $top_actions, mixed $options, mixed $collection_data) : mixedParameters
- $top_actions : mixed
- $options : mixed
- $collection_data : mixed
HookFalcon_linkViewAfterresourceactions()
HookFalcon_linkViewAfterresourceactions() : mixedHookFalcon_linkViewRenderfield()
HookFalcon_linkViewRenderfield(mixed $field) : mixedParameters
- $field : mixed
falcon_link_publish()
Publish resources in the array to falcon.io
falcon_link_publish(array<string|int, mixed> $resources, string $template_text, string $template_tags) : array<string|int, mixed>Parameters
- $resources : array<string|int, mixed>
-
Array of resources to publish. Must include named "ref" key with resource ID as value as per search results
- $template_text : string
-
Text to use for template description. If not passed will use value from configured $falcon_link_text_field
- $template_tags : string
-
Comma separated list of tags to add to Falcon template. If not passed will use values from configured $falcon_link_tag_fields
Return values
array<string|int, mixed> —"success" => Overall outcome of publish action "errors" => Array of error messages "results" => Array of resource IDs and associated status messages
falcon_link_archive()
Archive resources in falcon.io
falcon_link_archive(array<string|int, mixed> $resources) : array<string|int, mixed>Parameters
- $resources : array<string|int, mixed>
-
Array of resources to archive. Must include named "ref" key with resource ID as value as per search results
Return values
array<string|int, mixed> —"success" => Overall outcome of archive action "errors" => Array of error messages "results" => Array of resource IDs and associated status messages
HookFormat_chooserAllGetdownloadurl()
HookFormat_chooserAllGetdownloadurl(mixed $ref, mixed $size, mixed $ext[, mixed $page = 1 ][, mixed $alternative = -1 ][, mixed $usage = -1 ][, mixed $usagecomment = "" ][, mixed $email = "" ]) : mixedParameters
- $ref : mixed
- $size : mixed
- $ext : mixed
- $page : mixed = 1
- $alternative : mixed = -1
- $usage : mixed = -1
- $usagecomment : mixed = ""
- $email : mixed = ""
HookFormat_chooserAllReplaceuseoriginal()
HookFormat_chooserAllReplaceuseoriginal() : mixedHookFormat_chooserAllSize_is_available()
HookFormat_chooserAllSize_is_available(mixed $resource, mixed $path, mixed $size) : mixedParameters
- $resource : mixed
- $path : mixed
- $size : mixed
HookFormat_chooserAllReplacedownloadextension()
HookFormat_chooserAllReplacedownloadextension(mixed $resource, mixed $extension) : mixedParameters
- $resource : mixed
- $extension : mixed
HookFormat_chooserAllReplacedownloadfile()
HookFormat_chooserAllReplacedownloadfile(mixed $resource, mixed $size, mixed $ext, mixed $fileExists) : mixedParameters
- $resource : mixed
- $size : mixed
- $ext : mixed
- $fileExists : mixed
HookFormat_chooserAllCollection_download_modify_job()
HookFormat_chooserAllCollection_download_modify_job([mixed $job_data = array() ]) : mixedParameters
- $job_data : mixed = array()
HookFormat_chooserViewAppend_to_download_filename_td()
HookFormat_chooserViewAppend_to_download_filename_td(array<string|int, mixed> $resource, string $ns) : mixedParameters
- $resource : array<string|int, mixed>
- $ns : string
HookFormat_chooserViewAppend_to_resource_tools_size_download_options_script()
HookFormat_chooserViewAppend_to_resource_tools_size_download_options_script(string $ns, array<string|int, mixed> $allowed_sizes, array<string|int, mixed> $resource) : mixedParameters
- $ns : string
- $allowed_sizes : array<string|int, mixed>
- $resource : array<string|int, mixed>
HookFormat_chooserViewAppend_to_updateDownloadLink_js()
HookFormat_chooserViewAppend_to_updateDownloadLink_js(array<string|int, mixed> $resource) : mixedParameters
- $resource : array<string|int, mixed>
HookFormat_chooserViewModifySizesArray()
HookFormat_chooserViewModifySizesArray(mixed $resource, mixed $sizes) : array<string|int, mixed>|falseParameters
- $resource : mixed
- $sizes : mixed
Return values
array<string|int, mixed>|falseHookFormat_chooserViewModifyAllowed_Sizes()
HookFormat_chooserViewModifyAllowed_Sizes(mixed $resource, mixed $sizes) : array<string|int, mixed>|falseParameters
- $resource : mixed
- $sizes : mixed
Return values
array<string|int, mixed>|falseHookFormat_chooserViewModifycheckifexists()
HookFormat_chooserViewModifycheckifexists(array<string|int, mixed> $resource) : boolParameters
- $resource : array<string|int, mixed>
Return values
boolgetDefaultOutputFormat()
Returns the default output file format to use given an optional input format.
getDefaultOutputFormat([mixed $inputFormat = null ]) : mixedParameters
- $inputFormat : mixed = null
supportsInputFormat()
supportsInputFormat(mixed $inputFormat) : mixedParameters
- $inputFormat : mixed
getImageFormat()
Returns the size record from the database specified by its ID.
getImageFormat(mixed $size) : mixedParameters
- $size : mixed
convertImage()
Converts the file of the given resource to the new target file with the specified size. The target file format is determined from the suffix of the target file.
convertImage(mixed $resource, mixed $page, mixed $alternative, mixed $target, mixed $width, mixed $height, mixed $profile) : mixedThe original colorspace of the image is retained. If $width and $height are zero, the image keeps its original size.
Parameters
- $resource : mixed
- $page : mixed
- $alternative : mixed
- $target : mixed
- $width : mixed
- $height : mixed
- $profile : mixed
sendFile()
sendFile(mixed $filename, string $download_filename[, mixed $usage = -1 ][, mixed $usagecomment = "" ][, mixed $email = "" ]) : mixedParameters
- $filename : mixed
- $download_filename : string
- $usage : mixed = -1
- $usagecomment : mixed = ""
- $email : mixed = ""
showProfileChooser()
Show colour profile selector based on $format_chooser_profiles config
showProfileChooser([string $class = '' ][, string $disabledtext = '' ][, string $ns = '' ]) : voidParameters
- $class : string = ''
-
CSS class for select
- $disabledtext : string = ''
-
Text to disable and hide inputs
- $ns : string = ''
-
Select ID
getProfileFileName()
getProfileFileName(mixed $profile) : mixedParameters
- $profile : mixed
failed_format_chooser_checks()
Helper function to run determine if the plugin should take effect.
failed_format_chooser_checks(array<string|int, mixed> $resource) : boolParameters
- $resource : array<string|int, mixed>
-
Resource data
Return values
boolHookGoogle_analyticsAllFootertop()
HookGoogle_analyticsAllFootertop() : mixedHookGoogle_analyticsAllExtra_meta()
HookGoogle_analyticsAllExtra_meta() : mixedHookGoogle_visionAllInitialise()
HookGoogle_visionAllInitialise() : mixedHookGoogle_visionAllAfterpreviewcreation()
HookGoogle_visionAllAfterpreviewcreation(int $resource, int $alternative[, bool $generate_all = false ]) : voidParameters
- $resource : int
- $alternative : int
- $generate_all : bool = false
HookGoogle_visionAllAddtriggerablejob()
Hook into offline jobs list to add custom job
HookGoogle_visionAllAddtriggerablejob() : array<string|int, mixed>Return values
array<string|int, mixed> —Array of existing job data with custom job added
HookGoogle_visionEditEdithidefield()
HookGoogle_visionEditEdithidefield(mixed $field) : mixedParameters
- $field : mixed
HookGoogle_visionRecreate_previewsBeforescriptaction()
HookGoogle_visionRecreate_previewsBeforescriptaction() : mixedgoogle_visionProcess()
google_visionProcess(mixed $resource[, mixed $verbose = false ][, mixed $ignore_resource_type_constraint = false ]) : mixedParameters
- $resource : mixed
- $verbose : mixed = false
- $ignore_resource_type_constraint : mixed = false
google_visionTranslate()
google_visionTranslate(mixed $labels) : mixedParameters
- $labels : mixed
HookGrant_editAllCustomediteaccess()
HookGrant_editAllCustomediteaccess(mixed $ref) : mixedParameters
- $ref : mixed
HookGrant_editAllModifysearcheditable()
HookGrant_editAllModifysearcheditable(mixed $editable_filter, mixed $user) : mixedParameters
- $editable_filter : mixed
- $user : mixed
HookGrant_editAllExport_add_tables()
HookGrant_editAllExport_add_tables() : mixedHookGrant_editAllModifyDefaultStatusMode()
HookGrant_editAllModifyDefaultStatusMode() : mixedHookGrant_editEditeditbeforeheader()
HookGrant_editEditeditbeforeheader() : mixedHookGrant_editEditEditstatushide()
Needed to prevent user changing the archive stat otherwise a user with temporary edit access to an active resource could change it from active to pending submission
HookGrant_editEditEditstatushide() : boolReturn values
boolHookGrant_editEditAppendcustomfields()
HookGrant_editEditAppendcustomfields() : mixedHookGrant_editViewBeforepermissionscheck()
HookGrant_editViewBeforepermissionscheck() : mixedHookImage_banksAllExtra_checks()
HookImage_banksAllExtra_checks() : mixedHookImage_banksAllSearchfiltertop()
HookImage_banksAllSearchfiltertop() : mixedHookImage_banksAllAdd_folders_to_delete_from_temp()
HookImage_banksAllAdd_folders_to_delete_from_temp(array<string|int, mixed> $folders_scan_list) : mixedParameters
- $folders_scan_list : array<string|int, mixed>
HookImage_banksAllClearsearchcookies()
HookImage_banksAllClearsearchcookies() : mixedHookImage_banksAllSimplesearchfieldsarehidden()
HookImage_banksAllSimplesearchfieldsarehidden() : mixedHookImage_banksSearchSearchaftersearchcookie()
HookImage_banksSearchSearchaftersearchcookie() : mixedapi_licensemanager_get_licenses()
api_licensemanager_get_licenses(mixed $ref) : mixedParameters
- $ref : mixed
HookLicensemanagerAdmin_group_permissionsAdditionalperms()
HookLicensemanagerAdmin_group_permissionsAdditionalperms() : mixedHookLicensemanagerAllExport_add_tables()
HookLicensemanagerAllExport_add_tables() : mixedHookLicensemanagerAllRender_actions_add_collection_option()
HookLicensemanagerAllRender_actions_add_collection_option(mixed $top_actions, array<string|int, mixed> $options, array<string|int, mixed> $collection_data) : mixedParameters
- $top_actions : mixed
- $options : array<string|int, mixed>
- $collection_data : array<string|int, mixed>
HookLicensemanagerAllHandleuserref()
HookLicensemanagerAllHandleuserref() : mixedHookLicensemanagerAllCron()
HookLicensemanagerAllCron() : mixedHookLicensemanagerAllAddspecialsearch()
HookLicensemanagerAllAddspecialsearch(mixed $search, mixed $select, mixed $sql_join, mixed $sql_filter) : mixedParameters
- $search : mixed
- $select : mixed
- $sql_join : mixed
- $sql_filter : mixed
HookLicensemanagerEditEndofmetadataaddcustomfield()
HookLicensemanagerEditEndofmetadataaddcustomfield() : mixedHookLicensemanagerEditAftersaveresourcedata()
HookLicensemanagerEditAftersaveresourcedata(int|array<string|int, mixed> $ref) : bool|array<string|int, mixed>Parameters
- $ref : int|array<string|int, mixed>
Return values
bool|array<string|int, mixed>HookLicensemanagerEditCopy_locked_data_extra()
HookLicensemanagerEditCopy_locked_data_extra(array<string|int, mixed> $resource, array<string|int, mixed> $locked_fields, int $last_edited[, bool $save = false ]) : bool|array<string|int, mixed>Parameters
- $resource : array<string|int, mixed>
- $locked_fields : array<string|int, mixed>
- $last_edited : int
- $save : bool = false
Return values
bool|array<string|int, mixed>HookLicensemanagerTeam_homeCustomteamfunction()
HookLicensemanagerTeam_homeCustomteamfunction() : mixedHookLicensemanagerUser_preferencesAdd_user_preference_page_def()
HookLicensemanagerUser_preferencesAdd_user_preference_page_def(mixed $page_def) : mixedParameters
- $page_def : mixed
HookLicensemanagerViewCustompanels()
HookLicensemanagerViewCustompanels() : mixedget_license_file_path()
get_license_file_path(int $ref) : mixedParameters
- $ref : int
licensemanager_check_read()
Check if the user should have read access to a license record
licensemanager_check_read([int|null $resource = null ]) : boolDetermines if the user has read access for a specific resource or general read permissions.
Parameters
- $resource : int|null = null
-
The ID of the resource to check read access for. If null, checks for general read permissions.
Return values
bool —Returns true if the user has the required permissions; false otherwise.
licensemanager_check_write()
Check if the user should have write access to a license record
licensemanager_check_write([int|null $resource = null ]) : boolDetermines if the user has write access for a specific resource or general write permissions.
Parameters
- $resource : int|null = null
-
The ID of the resource to check write access for. If null, checks for general write permissions.
Return values
bool —Returns true if the user has the required permissions; false otherwise.
licensemanager_get_licenses()
Get a list of licenses for a given resource
licensemanager_get_licenses(int $resource) : array<string|int, mixed>|boolThis function retrieves a list of license records associated with a specified resource. Each record includes the license details, expiration date, and consent usage.
Parameters
- $resource : int
-
The ID of the resource for which to retrieve associated licenses.
Return values
array<string|int, mixed>|bool —Returns an array of licenses associated with the resource if the user has read access; otherwise, returns false.
licensemanager_delete_license()
Delete a license record
licensemanager_delete_license(int $ref) : boolThis function deletes a license record and its associations with resources by removing entries from the
licenseandresource_licensetables.Parameters
- $ref : int
-
The ID of the license record to be deleted.
Return values
bool —Returns true if the license record was successfully deleted, or false if the user does not have write access to the resource.
licensemanager_link_license()
Link a license record with a resource
licensemanager_link_license(int $license, int $resource) : boolThis function links a license record to a specified resource by inserting an entry in the
resource_licensetable. It also logs this action in the resource's log.Parameters
- $license : int
-
The ID of the license record to be linked to the resource.
- $resource : int
-
The ID of the resource to which the license is being linked.
Return values
bool —Returns true if the license was successfully linked, false if the user does not have write access to the resource.
licensemanager_get_license()
Retrieve a license record
licensemanager_get_license(int $license) : array<string|int, mixed>|boolThis function retrieves the details of a specified license record It also fetches a list of resources associated with the license.
Parameters
- $license : int
-
The ID of the license record to fetch.
Return values
array<string|int, mixed>|bool —Returns an associative array containing license details and associated resources if the user has read access; returns false if access is denied or the license record does not exist.
licensemanager_get_all_licenses()
Fetch all license records, optionally filtered by search text
licensemanager_get_all_licenses([string $findtext = "" ][, string $license_status = "all" ]) : array<string|int, mixed>|boolThis function retrieves all license records from the database. If a search string is provided, it filters the results based on licensor/licensee/medium/description It can also filter based on license status e.g all, active (non-expired), expiring (expiring within a configured amount of days), expired. Defaults to returning all.
Parameters
- $findtext : string = ""
-
Optional. A search string to filter the results by the licensor/licensee/medium/description of the license. If empty, returns all records.
- $license_status : string = "all"
-
Status of license records to return
Return values
array<string|int, mixed>|bool —Returns an array of license records if the user has read access; otherwise, returns false.
licensemanager_get_all_licenses_grouped()
Fetch all license records grouped by if they are expiring or not
licensemanager_get_all_licenses_grouped() : array<string|int, mixed>|boolReturn values
array<string|int, mixed>|bool —Returns an array of license records if the user has read access; otherwise, returns false.
licensemanager_get_expiring_licenses()
Fetch all expiring license records
licensemanager_get_expiring_licenses(int $expires_within[, bool $unsent_only = true ]) : array<string|int, mixed>|boolThis function returns an array of license records that are expiring within so many days. It can optionally be filtered to include records that have not been flagged as having an expiration notification already sent
Parameters
- $expires_within : int
-
Number of days that the records are expiring within
- $unsent_only : bool = true
-
Include only records where an expiration notification hasn't been sent
Return values
array<string|int, mixed>|bool —Returns an array of expiring license records if the user has read access; otherwise, returns false.
licensemanager_set_license_expiration_notice()
Sets expiration notice sent flag on license records
licensemanager_set_license_expiration_notice(array<string|int, mixed> $licenses) : boolThis function takes an array of license record references and sets the expiration_notice_sent flag on each one.
Parameters
- $licenses : array<string|int, mixed>
-
An array of license references
Return values
bool —Returns true if the flags were set; otherwise, returns false
licensemanager_get_expired_license_resources()
Fetch expired license records
licensemanager_get_expired_license_resources(int $archive_status) : array<string|int, mixed>|boolThis function returns expired license records that are not deleted and are not in the passed archive_state
Parameters
- $archive_status : int
Return values
array<string|int, mixed>|bool —Returns an array of expired license records; otherwise, returns false.
licensemanager_process_expiry_notifications()
Process expiring license records and send a notification/email
licensemanager_process_expiry_notifications() : boolReturn values
bool —Returns true if the notification process completes
licensemanager_process_expired_auto_archive()
Process expired license records and archive them
licensemanager_process_expired_auto_archive() : boolReturn values
bool —Returns true if the auto archiving process completes
HookLightbox_previewAllAdditionalheaderjs()
HookLightbox_previewAllAdditionalheaderjs() : mixedHookLightbox_previewAllReplacefullscreenpreviewicon()
HookLightbox_previewAllReplacefullscreenpreviewicon() : mixedHookLightbox_previewViewRenderbeforerecorddownload()
HookLightbox_previewViewRenderbeforerecorddownload(mixed $disable_flag) : mixedParameters
- $disable_flag : mixed
HookLightbox_previewViewGetpreviewurlforsize()
HookLightbox_previewViewGetpreviewurlforsize() : mixedHookLightbox_previewViewRenderaltthumb()
HookLightbox_previewViewRenderaltthumb
HookLightbox_previewViewRenderaltthumb(int $n, array<string|int, mixed> $altfile) : boolParameters
- $n : int
-
index value for alternative file
- $altfile : array<string|int, mixed>
-
parameters of alternative file to be rendered
Return values
boolHookLightbox_previewViewAftersearchimg()
HookLightbox_previewViewAftersearchimg() : mixedgetPreviewURLForType()
getPreviewURLForType(mixed $resource, mixed $type[, mixed $alternative = -1 ][, mixed $page = 1 ]) : mixedParameters
- $resource : mixed
- $type : mixed
- $alternative : mixed = -1
- $page : mixed = 1
getPreviewURL()
getPreviewURL(mixed $resource[, mixed $alternative = -1 ][, mixed $page = 1 ]) : mixedParameters
- $resource : mixed
- $alternative : mixed = -1
- $page : mixed = 1
addLightBox()
addLightBox(mixed $selector[, mixed $url = "" ][, mixed $title = "" ][, mixed $set = "" ]) : mixedParameters
- $selector : mixed
- $url : mixed = ""
- $title : mixed = ""
- $set : mixed = ""
HookMuseumplusAllInitialise()
HookMuseumplusAllInitialise() : mixedHookMuseumplusAllAfter_setup_user()
HookMuseumplusAllAfter_setup_user() : mixedHookMuseumplusAllAftersaveresourcedata()
MuseumPlus plugin attaching to the 'aftersaveresourcedata' hook IMPORTANT: 'aftersaveresourcedata' hook is called from both save_resource_data() and save_resource_data_multi()!
HookMuseumplusAllAftersaveresourcedata(int|array<string|int, mixed> $R) : bool|array<string|int, mixed>Parameters
- $R : int|array<string|int, mixed>
-
Generic type for resource ID(s). It will be a resource ref when hook is called from save_resource_data() -OR- a list of resource IDs when called from save_resource_data_multi().
Return values
bool|array<string|int, mixed> —Returns FALSE to show hook didn't run or list of errors. See hook 'aftersaveresourcedata' in resource_functions.php for more info
HookMuseumplusAllAddspecialsearch()
HookMuseumplusAllAddspecialsearch(mixed $search, mixed $select, mixed $sql_join, mixed $sql_filter) : mixedParameters
- $search : mixed
- $select : mixed
- $sql_join : mixed
- $sql_filter : mixed
HookMuseumplusAllHandleuserref()
HookMuseumplusAllHandleuserref() : mixedHookMuseumplusAllAfternewresource()
HookMuseumplusAllAfternewresource(mixed $to) : mixedParameters
- $to : mixed
HookMuseumplusCron_copy_hitcountAddplugincronjob()
HookMuseumplusCron_copy_hitcountAddplugincronjob() : mixedHookMuseumplusViewRenderfield()
HookMuseumplusViewRenderfield(mixed $field, mixed $resource) : mixedParameters
- $field : mixed
- $resource : mixed
do_http_request()
Execute a cURL request
do_http_request(string $url, string $basic_auth, string $content_type, string $request_method, string $data) : array<string|int, mixed>Parameters
- $url : string
-
URL
- $basic_auth : string
-
Username and password used for basic authentication. MUST follow the "username:password" syntax to work!
- $content_type : string
-
Content type header value (e.g application/xml)
- $request_method : string
-
HTTP request methods (e.g GET, POST, PUT, DELETE)
- $data : string
-
Posted data (e.g XML)
Return values
array<string|int, mixed> —Response information such status code (e.g 200), headers and actual body
mplus_get_connection_data()
Helper function to ensure required connection data was provided
mplus_get_connection_data() : array<string|int, mixed>Tags
Return values
array<string|int, mixed>mplus_notify()
Send notifications to users regarding MuseumPlus events (e.g script failed)
mplus_notify(array<string|int, mixed> $users, string $message) : boolParameters
- $users : array<string|int, mixed>
-
List of users' IDs
- $message : string
-
Notification message
Tags
Return values
bool —TRUE on success FALSE on failure
mplus_generate_module_record_url()
Generate a MuseumPlus URL for any module records without having to know the form name
mplus_generate_module_record_url(string $module, int $id) : stringParameters
- $module : string
-
Module name
- $id : int
-
Module record technical (internal) ID
Return values
string —Returns the generated URL or empty string on failure
mplus_save_module_config()
Save MuseumPlus modules configuration
mplus_save_module_config(array<string|int, mixed> $cf) : voidParameters
- $cf : array<string|int, mixed>
-
Modules configuration to save
mplus_get_associated_module_conf()
For a list of resources, obtain the associated modules' configuration.
mplus_get_associated_module_conf(array<string|int, mixed> $resource_refs, bool $with_values) : array<string|int, mixed>IMPORTANT: make sure the return of this function is not exposed to the end user when called using the $with_values param.
Parameters
- $resource_refs : array<string|int, mixed>
-
List of resource IDs
- $with_values : bool
-
Should associated module configurations include the RS metadata fields values (this applies to module configurations that are using a metadata field - e.g. rs_uid_field or the field mappings).
Return values
array<string|int, mixed> —The associated modules' configuration for each of the resources in the list -or- an empty array.
mplus_get_cfg_by_module_name()
Find the module configuration using the module name.
mplus_get_cfg_by_module_name(string $n) : array<string|int, mixed>Parameters
- $n : string
-
Module name to search by in the plugin configuration
Return values
array<string|int, mixed> —Returns the module configuration record found. @see $museumplus_modules_saved_config elements for the array structure
mplus_validate_association()
Validate a modules' record ID (technical or virtual)
mplus_validate_association(array<string|int, mixed> $ramc, bool $use_technical_id, bool $force) : array<string|int, mixed>Parameters
- $ramc : array<string|int, mixed>
-
Resources associated module configurations. mplus_get_associated_module_conf()
- $use_technical_id : bool
-
Validate using the technical ID (ie __id) fieldPath.
- $force : bool
-
Force re-validation even if association state is already known.
Return values
array<string|int, mixed> —Returns the valid resources that have a valid combination of "module name - MpID (virtual or technical)". IMPORTANT: Each returned resource associated module configuration will get mutated with an additional "__id" key which will always hold the technical ID of the module item "linked" to that resource - always use MPLUS_FIELD_ID constant to find this key. An optional "errors" key may be added to the return array to hold any errors the end user should be aware of.
mplus_flip_struct_by_module()
Transpose a resource associated module config array to one ready to be used for batch searching via MuseumPlus API.
mplus_flip_struct_by_module(array<string|int, mixed> $ramc) : array<string|int, mixed>Utility function for validation & syncing.
Parameters
- $ramc : array<string|int, mixed>
-
Resources associated module configurations. mplus_get_associated_module_conf()
Return values
array<string|int, mixed> —Returns array structure where the key is the module name and value contains information useful for validation/syncing data from MuseumPlus
mplus_compute_data_md5()
Compute the MD5 hash for the association between a resource and the combination of "module name - MpID (virtual or technical).
mplus_compute_data_md5(array<string|int, mixed> $resources_data, string $module_name) : array<string|int, mixed>Utility function which is used to save the data in the resource table, column "museumplus_data_md5" and used to determine if either of the data of interest (module name or MpID) have changed in order to revalidate the association.
Parameters
- $resources_data : array<string|int, mixed>
-
Resources data array - key is the resource ref and value is the module item ID (virtual or technical). Example: [23 => '2423432', 24 => 'OB3223-N']
- $module_name : string
-
Module name
Return values
array<string|int, mixed>mplus_log_event()
Log events related to MuseumPlus integration. Any information that can be useful (even a user trying to save a resource)
mplus_log_event(string $msg[, array<string|int, mixed> $ctx = array() ][, string $lvl = 'info' ]) : voidParameters
- $msg : string
-
Log message. Max size 255 characters.
- $ctx : array<string|int, mixed> = array()
-
Contextual data relevant to the event. Try namespacing the data if needed using keys (e.g http_request - and then the body could contain different aspects: header, body, url etc.). IMPORTANT: make sure to never log sensitive information (e.g MuseumPlus authentication credentials)
- $lvl : string = 'info'
-
Logging level (Options could be: Trace, Debug, Info, Warn, Error, Fatal). Max size 10 characters.
mplus_validate_resource_association_filters()
Validate a list of filter names that can be used by {@see mplus_resource_get_association_data()}.
mplus_validate_resource_association_filters(array<string|int, mixed> $f) : array<string|int, mixed>Parameters
- $f : array<string|int, mixed>
-
List of filters. Key is the filter name. The value of a filter is any data type required by that particular filters' parameter (e.g for "byref" filter, the input is a list of refs => array).
Return values
array<string|int, mixed>mplus_resource_get_data()
Get resource table columns relevant to the MuseumPlus integration
mplus_resource_get_data(array<string|int, mixed> $refs) : array<string|int, mixed>Parameters
- $refs : array<string|int, mixed>
-
List of resource IDs
Return values
array<string|int, mixed>mplus_resource_mark_validation_failed()
Mark resource failed validating the MuseumPlus association
mplus_resource_mark_validation_failed(array<string|int, mixed> $resources) : voidParameters
- $resources : array<string|int, mixed>
-
List of resource IDs (key) and computed MD5 hashes (value). mplus_compute_data_md5()
mplus_resource_update_association()
Mark resource module association as valid. This updates the MD5 hash for the current combination of "module name - MpID" and the valid technical ID retrieved from MuseumPlus.
mplus_resource_update_association(array<string|int, mixed> $resources, array<string|int, mixed> $md5s) : voidParameters
- $resources : array<string|int, mixed>
-
List of resource IDs (key) and MuseumPlus technical ID - ie. "__id" - as value.
- $md5s : array<string|int, mixed>
-
List of resource IDs (key) and computed MD5 hashes (value). mplus_compute_data_md5()
mplus_resource_clear_metadata()
Clear resource metadata fields that are mapped to any of the modules configured by the plugin.
mplus_resource_clear_metadata(array<string|int, mixed> $refs) : voidParameters
- $refs : array<string|int, mixed>
-
List of resource IDs
mplus_resource_get_association_data()
Get all resources associated with a MuseumPlus module.
mplus_resource_get_association_data(array<string|int, mixed> $filters) : array<string|int, mixed>Parameters
- $filters : array<string|int, mixed>
-
Rules to filter results (if applicable). There are "flag" filters (e.g new_and_changed_associations filter) and filters that take arguments (e.g byref)
Return values
array<string|int, mixed>mplus_xml_search_by_fieldpath()
Build the search XML for MuseumPlus API request body {@see http://docs.zetcom.com/ws/module/search/search_1_4.xsd}
mplus_xml_search_by_fieldpath(string $fp, array<string|int, mixed> $vals, array<string|int, mixed> $sfs) : DOMDocumentParameters
- $fp : string
-
Field path used to identify the "linked" modules. This is essentially either the technical ID field (ie. __id) or another virtual field (e.g ObjObjectNumberVrt)
- $vals : array<string|int, mixed>
-
Module record IDs to search for in MuseumPlus. Hash table where key is resource ID and value is the MpID
- $sfs : array<string|int, mixed>
-
MuseumPlus modules' fields to return back
Return values
DOMDocument —Returns XML document with the search criteria
mplus_search()
Run an ad-hoc module search using the provided expert search expression {@see http://docs.zetcom.com/ws/#Perform_an_ad-hoc_search_for_modules_items}
mplus_search(string $module_name, DOMDocument $search) : array<string|int, mixed>Parameters
- $module_name : string
-
Module name
- $search : DOMDocument
-
Expert search criteria. mplus_xml_search_by_fieldpath()
Return values
array<string|int, mixed>mplus_get_response_xml()
Get XML response body received from MuseumPlus search request {@see http://docs.zetcom.com/ws/module/module_1_4.xsd}
mplus_get_response_xml(array<string|int, mixed> $result) : DOMDocumentParameters
- $result : array<string|int, mixed>
-
Search results as returned by mplus_search()
Return values
DOMDocumentmplus_sync()
Synchronise (search & import) MuseumPlus module fields to the associated ("linked") resources.
mplus_sync(array<string|int, mixed> $ramc) : void|array<string|int, mixed>Parameters
- $ramc : array<string|int, mixed>
-
Valid resources with an associated module configuration. mplus_validate_association()
Return values
void|array<string|int, mixed> —Returns NULL if sync finished (or had nothing to process) -or- list of errors caught during the validation/sync process (NOTE: validation errors get carried forward).
HookNewsHomeHomebeforepanels()
HookNewsHomeHomebeforepanels() : mixedHookNewsTeam_homeCustomteamfunction()
HookNewsTeam_homeCustomteamfunction() : mixedget_news()
get_news([mixed $ref = "" ][, mixed $recent = "" ][, mixed $findtext = "" ]) : mixedParameters
- $ref : mixed = ""
- $recent : mixed = ""
- $findtext : mixed = ""
get_news_headlines()
get_news_headlines([mixed $ref = "" ][, mixed $recent = "" ]) : mixedParameters
- $ref : mixed = ""
- $recent : mixed = ""
get_news_ref()
get_news_ref(mixed $maxmin) : mixedParameters
- $maxmin : mixed
delete_news()
delete_news(mixed $ref) : mixedParameters
- $ref : mixed
add_news()
add_news(mixed $date, mixed $title, mixed $body) : mixedParameters
- $date : mixed
- $title : mixed
- $body : mixed
update_news()
update_news(mixed $ref, mixed $date, mixed $title, mixed $body) : mixedParameters
- $ref : mixed
- $date : mixed
- $title : mixed
- $body : mixed
HookOffline_archiveAllInitialise()
HookOffline_archiveAllInitialise() : mixedHookOffline_archiveAllAddplugincronjob()
HookOffline_archiveAllAddplugincronjob() : mixedHookOffline_archiveTeam_homeCustomteamfunction()
HookOffline_archiveTeam_homeCustomteamfunction() : mixedHookOffline_archiveViewResourceactions()
HookOffline_archiveViewResourceactions() : mixedHookOffline_archiveViewRenderbeforeresourceview()
HookOffline_archiveViewRenderbeforeresourceview(mixed $resource) : mixedParameters
- $resource : mixed
offline_archive_run_jobs()
Run any outstanding offline archive jobs
offline_archive_run_jobs([bool $showoutput = false ]) : bool|array<string|int, mixed>Parameters
- $showoutput : bool = false
-
Display progress?
Return values
bool|array<string|int, mixed> —TRUE if ok, array of messages if any errors encountered
HookOpenai_gptAdmin_resource_type_fieldsReplacetabnamecolumnheader()
HookOpenai_gptAdmin_resource_type_fieldsReplacetabnamecolumnheader() : mixedHookOpenai_gptAdmin_resource_type_fieldsReplacetabnamecolumn()
HookOpenai_gptAdmin_resource_type_fieldsReplacetabnamecolumn() : mixedHookOpenai_gptAllModifyresourcetypefieldcolumns()
Add to array of field column data on metadata field editing page
HookOpenai_gptAllModifyresourcetypefieldcolumns(array<string|int, mixed> $fieldcolumns) : array<string|int, mixed>Parameters
- $fieldcolumns : array<string|int, mixed>
-
Existing array of columns
Return values
array<string|int, mixed> —Updated array of columns
HookOpenai_gptAdmin_resource_type_field_editAdmin_field_replace_question()
Alter rendering of the new columns on the metadata field editing page
HookOpenai_gptAdmin_resource_type_field_editAdmin_field_replace_question(int $ref, string $column, array<string|int, mixed> $column_detail, array<string|int, mixed> $fielddata) : boolParameters
- $ref : int
-
Ref of the metadata field being edited
- $column : string
-
Name of table column for which input is being rendered
- $column_detail : array<string|int, mixed>
-
Array of metadata field rendering data from the edit page
- $fielddata : array<string|int, mixed>
-
Array of metadata field information from get_resource_type_field()
Return values
bool —Is standard display rendering being overridden?
HookOpenai_gptAllUpdate_field()
Hook into update_field() to process value changes
HookOpenai_gptAllUpdate_field(int $resource, int $field, string $value, string $existing, array<string|int, mixed> $fieldinfo, array<string|int, mixed> $newnodes, array<string|int, mixed> $newvalues) : boolParameters
- $resource : int
-
Resource ID
- $field : int
-
Metadata field ref
- $value : string
-
New field value (comma separated for nodes)
- $existing : string
-
Existing field value
- $fieldinfo : array<string|int, mixed>
-
Array of metadata field information from get_resource_type_field()
- $newnodes : array<string|int, mixed>
-
Array of new nodes that have been set
- $newvalues : array<string|int, mixed>
-
Array of new text values that have been set
Return values
boolHookOpenai_gptAllAftersaveresourcedata()
Hook into save_resource_data() and save_resource_data_multi() to process value changes
HookOpenai_gptAllAftersaveresourcedata(int|array<string|int, mixed> $r, mixed $all_nodes_to_add, mixed $all_nodes_to_remove, mixed $autosave_field, mixed $fields, mixed $updated_resources) : boolParameters
- $r : int|array<string|int, mixed>
-
Resource ID or array of resource IDs
- $all_nodes_to_add : mixed
-
Passed from hook, unused
- $all_nodes_to_remove : mixed
-
Passed from hook, unused
- $autosave_field : mixed
-
Passed from hook, unused
- $fields : mixed
-
Array of edited field data
- $updated_resources : mixed
-
Array of resources & fields that have been updated with resources as the top level key and field IDs as subkeys
Return values
boolHookOpenai_gptAllAfterpreviewcreation()
Hook into image upload to process the image as GPT input *
HookOpenai_gptAllAfterpreviewcreation(int $ref, int $alternative[, bool $generate_all = false ]) : boolParameters
- $ref : int
- $alternative : int
- $generate_all : bool = false
Return values
bool —Success if field is updated
HookOpenai_gptAllExtra_checks()
Return total token usage for the past 30 days.
HookOpenai_gptAllExtra_checks() : array<string|int, mixed>Return values
array<string|int, mixed> —Array of data for processing in get_system_status().
HookOpenai_gptAllAddtriggerablejob()
Hook into offline jobs list to add custom job
HookOpenai_gptAllAddtriggerablejob() : array<string|int, mixed>Return values
array<string|int, mixed> —Array of existing job data with custom job added
HookOpenai_gptTeam_homeCustomteamfunctionadmin()
HookOpenai_gptTeam_homeCustomteamfunctionadmin() : mixedopenai_gpt_update_field()
Send the new field value or image to the OpenAI API in order to update the linked field
openai_gpt_update_field(int|array<string|int, mixed> $resources, array<string|int, mixed> $target_field, array<string|int, mixed> $values[, string $file = "" ]) : bool|array<string|int, mixed>Parameters
- $resources : int|array<string|int, mixed>
-
Resource ID or array of resource IDS
- $target_field : array<string|int, mixed>
-
Target metadata field array from get_resource_type_field()
- $values : array<string|int, mixed>
-
Array of strings from the field currently being processed
- $file : string = ""
-
Path to image file. If provided will use this file instead of metadata values
Return values
bool|array<string|int, mixed> —Array indicating success/failure True if update successful, false if invalid field or no data returned
openai_gpt_generate_completions()
Call OpenAI compatibile APIs
openai_gpt_generate_completions(string $endpoint, string $api_key, string $model, array<string|int, mixed> $messages[, float $temperature = 0 ][, int $max_tokens = 2048 ]) : stringRefer to https://beta.openai.com/docs/api-reference for detailed explanation
Parameters
- $endpoint : string
-
API endpoint
- $api_key : string
-
API key
- $model : string
-
Model name e.g. "text-davinci-003"
- $messages : array<string|int, mixed>
-
Array of prompt messages to generate response from API. See https://platform.openai.com/docs/guides/chat/introduction for more information
- $temperature : float = 0
-
Value between 0 and 1 - higher values means model will take more risks. Default 0.
- $max_tokens : int = 2048
-
The maximum number of completions to generate, default 2048
Return values
string —The first API response text output
openai_gpt_get_dependent_fields()
Return array of resource type field refs for a given openai_gpt_input_field value.
openai_gpt_get_dependent_fields(int $field) : array<string|int, mixed>Parameters
- $field : int
-
ID of GPT input field.
Return values
array<string|int, mixed>openai_gpt_get_configured_fields()
Return an array of resource type field refs for all AI configured fields
openai_gpt_get_configured_fields() : array<string|int, mixed>Return values
array<string|int, mixed> —Array field references for all AI configured fields
openai_gpt_get_tokens_used()
Return a count of tokens used by GPT during the number of days passed as a parameter.
openai_gpt_get_tokens_used(int $days) : intDefaults to using 30 days if 0 or less is passed.
Parameters
- $days : int
Return values
int —Count of tokens used in $days days
openai_gpt_get_provider()
Return the configured AI provider handles the remote override.
openai_gpt_get_provider() : stringReturn values
string —Currently configured AI provider
HookOpenai_image_editAllExtra_checks()
Return total successful image edits for the past 30 days.
HookOpenai_image_editAllExtra_checks() : array<string|int, mixed>Return values
array<string|int, mixed> —Array of data for processing in get_system_status().
HookOpenai_image_editViewAfterresourceactions()
HookOpenai_image_editViewAfterresourceactions() : mixedcurlprogress()
curlprogress(mixed $resource, mixed $download_size, mixed $downloaded, mixed $upload_size, mixed $uploaded) : mixedParameters
- $resource : mixed
- $download_size : mixed
- $downloaded : mixed
- $upload_size : mixed
- $uploaded : mixed
HookPdf_splitViewAfterresourceactions()
HookPdf_splitViewAfterresourceactions() : mixedHookPropose_changesAllAddtoactions()
HookPropose_changesAllAddtoactions() : mixedHookPropose_changesAllShowfieldedit()
HookPropose_changesAllShowfieldedit(mixed $field) : mixedParameters
- $field : mixed
HookPropose_changesAllExport_add_tables()
HookPropose_changesAllExport_add_tables() : mixedHookPropose_changesAlluser_actions_recent()
Add any recent proposed changes to the $newactions array passed from get_user_actions_recent() and return the updated array
HookPropose_changesAlluser_actions_recent(int $minutes, array<string|int, mixed> $newactions) : array<string|int, mixed>Parameters
- $minutes : int
- $newactions : array<string|int, mixed>
Return values
array<string|int, mixed>HookPropose_changesAllUpdateactiontypes()
HookPropose_changesAllUpdateactiontypes(mixed $actiontypes) : mixedParameters
- $actiontypes : mixed
HookPropose_changesAllActioneditlink()
HookPropose_changesAllActioneditlink(mixed $action) : mixedParameters
- $action : mixed
HookPropose_changesCollection_editSavecollectionAdditionalfields()
HookPropose_changesCollection_editSavecollectionAdditionalfields() : mixedHookPropose_changesCollection_editGetcollectionAdditionalfields()
HookPropose_changesCollection_editGetcollectionAdditionalfields() : mixedHookPropose_changesCollection_editAdditionalfields2()
HookPropose_changesCollection_editAdditionalfields2() : mixedHookPropose_changesCollection_emailAdditionalemailfield()
HookPropose_changesCollection_emailAdditionalemailfield() : mixedHookPropose_changesCollection_emailAdditional_email_collection()
HookPropose_changesCollection_emailAdditional_email_collection(mixed $colrefs, mixed $collectionname, mixed $fromusername, mixed $userlist, mixed $message, mixed $feedback, mixed $access, mixed $expires, mixed $useremail, mixed $from_name, mixed $cc, mixed $themeshare, mixed $themename, mixed $themeurlsuffix, mixed $template, mixed $templatevars) : mixedParameters
- $colrefs : mixed
- $collectionname : mixed
- $fromusername : mixed
- $userlist : mixed
- $message : mixed
- $feedback : mixed
- $access : mixed
- $expires : mixed
- $useremail : mixed
- $from_name : mixed
- $cc : mixed
- $themeshare : mixed
- $themename : mixed
- $themeurlsuffix : mixed
- $template : mixed
- $templatevars : mixed
HookPropose_changesUser_preferencesAdd_user_preference_page_def()
HookPropose_changesUser_preferencesAdd_user_preference_page_def(mixed $page_def) : mixedParameters
- $page_def : mixed
HookPropose_changesViewAfterresourceactions()
HookPropose_changesViewAfterresourceactions() : mixedsave_proposed_changes()
save_proposed_changes(mixed $ref) : mixedParameters
- $ref : mixed
get_proposed_changes()
get_proposed_changes(mixed $ref, mixed $userid) : mixedParameters
- $ref : mixed
- $userid : mixed
delete_proposed_changes()
delete_proposed_changes(mixed $ref[, mixed $userid = "" ]) : mixedParameters
- $ref : mixed
- $userid : mixed = ""
propose_changes_display_field()
propose_changes_display_field(mixed $n, mixed $field) : mixedParameters
- $n : mixed
- $field : mixed
HookRefineresultsSearchBeforesearchresults()
HookRefineresultsSearchBeforesearchresults() : mixedHookRefineresultsSearchBeforesearchresultsexpandspace()
HookRefineresultsSearchBeforesearchresultsexpandspace() : mixedHookRefineresultsSearchSearchstringprocessing()
HookRefineresultsSearchSearchstringprocessing() : mixedHookRefineresultsSearchSearch_header_after_actions()
HookRefineresultsSearchSearch_header_after_actions() : mixedHookRemote_assistAllHomeafterwelcometext()
HookRemote_assistAllHomeafterwelcometext() : mixedHookResource_usageViewCustompanels()
HookResource_usageViewCustompanels() : mixedHookRse_search_notificationsAllRender_search_actions_add_option()
HookRse_search_notificationsAllRender_search_actions_add_option(mixed $options) : mixedParameters
- $options : mixed
HookRse_search_notificationsAllRender_actions_add_collection_option()
HookRse_search_notificationsAllRender_actions_add_collection_option(mixed $top_actions, array<string|int, mixed> $options) : mixedParameters
- $top_actions : mixed
- $options : array<string|int, mixed>
HookRse_search_notificationsCron_copy_hitcountAddplugincronjob()
HookRse_search_notificationsCron_copy_hitcountAddplugincronjob() : mixedHookRse_search_notificationsSearchafterResulthints()
HookRse_search_notificationsSearchafterResulthints() : mixedHookRse_search_notificationsUser_homeUser_home_additional_links()
HookRse_search_notificationsUser_homeUser_home_additional_links() : mixedsearch_notifications_get()
search_notifications_get(mixed &$results[, mixed $user = "" ][, mixed $enabled_only = true ][, mixed $search = "" ][, mixed $orderby = 1 ][, mixed $orderbydirection = "DESC" ]) : mixedParameters
- $results : mixed
- $user : mixed = ""
- $enabled_only : mixed = true
- $search : mixed = ""
- $orderby : mixed = 1
- $orderbydirection : mixed = "DESC"
search_notification_add()
search_notification_add(mixed $search, mixed $restypes, mixed $archive) : mixedParameters
- $search : mixed
- $restypes : mixed
- $archive : mixed
search_notification_delete()
search_notification_delete(mixed $ref[, mixed $force = false ]) : mixedParameters
- $ref : mixed
- $force : mixed = false
search_notification_enable()
search_notification_enable(mixed $ref[, mixed $force = false ]) : mixedParameters
- $ref : mixed
- $force : mixed = false
search_notification_disable()
search_notification_disable(mixed $ref[, mixed $force = false ]) : mixedParameters
- $ref : mixed
- $force : mixed = false
search_notification_enable_all()
search_notification_enable_all([mixed $force = false ]) : mixedParameters
- $force : mixed = false
search_notification_disable_all()
search_notification_disable_all([mixed $force = false ]) : mixedParameters
- $force : mixed = false
search_notification_process()
search_notification_process([mixed $owner = -1 ][, mixed $search_saved = -1 ]) : mixedParameters
- $owner : mixed = -1
- $search_saved : mixed = -1
search_notification_make_url()
search_notification_make_url(mixed $watched_search) : mixedParameters
- $watched_search : mixed
search_notification_delete_by_owner()
Delete all watched searches by user
search_notification_delete_by_owner(int $user) : voidParameters
- $user : int
-
User ID
render_sortable_header()
render_sortable_header(mixed $title, mixed $col_number) : mixedParameters
- $title : mixed
- $col_number : mixed
HookRse_VersionAllBeforeremoveexistingfile()
HookRse_VersionAllBeforeremoveexistingfile(mixed $ref) : mixedParameters
- $ref : mixed
HookRse_VersionAllUpload_image_after_log_write()
HookRse_VersionAllUpload_image_after_log_write(mixed $ref, mixed $log_ref) : mixedParameters
- $ref : mixed
- $log_ref : mixed
HookRse_VersionAllGet_alternative_files_extra_sql()
HookRse_VersionAllGet_alternative_files_extra_sql(mixed $resource) : mixedParameters
- $resource : mixed
HookRse_versionAllSave_resource_data_multi_extra_modes()
HookRse_versionAllSave_resource_data_multi_extra_modes(mixed $ref, mixed $field, mixed $existing, mixed $postvals, mixed &$errors) : mixedParameters
- $ref : mixed
- $field : mixed
- $existing : mixed
- $postvals : mixed
- $errors : mixed
HookRse_versionAllGet_resource_log_extra_fields()
HookRse_versionAllGet_resource_log_extra_fields() : mixedHookRse_versionCollection_logLog_extra_columns_header()
HookRse_versionCollection_logLog_extra_columns_header() : mixedHookRse_versionCollection_logLog_extra_columns_row()
HookRse_versionCollection_logLog_extra_columns_row(mixed $log, array<string|int, mixed> $collection_info) : mixedParameters
- $log : mixed
- $collection_info : array<string|int, mixed>
HookRse_versionCollection_logCollection_log_extra_fields()
HookRse_versionCollection_logCollection_log_extra_fields() : mixedHookRse_versionEditEdit_all_extra_modes()
HookRse_versionEditEdit_all_extra_modes(mixed $field) : mixedParameters
- $field : mixed
HookRse_versionEditEdit_all_mode_js()
HookRse_versionEditEdit_all_mode_js() : mixedHookRse_versionEditEdit_all_after_findreplace()
HookRse_versionEditEdit_all_after_findreplace(mixed $field, mixed $n) : mixedParameters
- $field : mixed
- $n : mixed
HookRse_versionEditBefore_status_question()
HookRse_versionEditBefore_status_question() : mixedHookRse_versionEditSave_resource_data_multi_set_archive_state()
HookRse_versionEditSave_resource_data_multi_set_archive_state(mixed $resource_ref, mixed $old_archive) : mixedParameters
- $resource_ref : mixed
- $old_archive : mixed
HookRse_versionLog_entryLog_entry_processing()
HookRse_versionLog_entryLog_entry_processing(mixed $column, mixed $value, mixed $logentry) : mixedParameters
- $column : mixed
- $value : mixed
- $logentry : mixed
HookRse_workflowAdmin_group_permissionsAdditionalperms()
HookRse_workflowAdmin_group_permissionsAdditionalperms() : mixedHookRse_workflowAdmin_homeCustomadminsetup()
HookRse_workflowAdmin_homeCustomadminsetup() : mixedHookRse_workflowAllInitialise()
HookRse_workflowAllInitialise() : mixedHookRse_workflowAllAfter_update_archive_status()
HookRse_workflowAllAfter_update_archive_status(mixed $resource, mixed $archive, mixed $existingstates) : mixedParameters
- $resource : mixed
- $archive : mixed
- $existingstates : mixed
HookRse_workflowAllRender_actions_add_collection_option()
HookRse_workflowAllRender_actions_add_collection_option(mixed $top_actions, array<string|int, mixed> $options, mixed $collection_data, mixed $urlparams) : mixedParameters
- $top_actions : mixed
- $options : array<string|int, mixed>
- $collection_data : mixed
- $urlparams : mixed
HookRse_workflowAllRender_search_actions_add_option()
HookRse_workflowAllRender_search_actions_add_option(array<string|int, mixed> $options, array<string|int, mixed> $urlparams) : mixedParameters
- $options : array<string|int, mixed>
- $urlparams : array<string|int, mixed>
HookRse_workflowAllRender_actions_add_option_js_case()
HookRse_workflowAllRender_actions_add_option_js_case(mixed $action_selection_id) : mixedParameters
- $action_selection_id : mixed
HookRse_workflowAllAfter_setup_user()
HookRse_workflowAllAfter_setup_user() : mixedHookRse_workflowAllArchive_skip_required_fields()
Check if supplied archive state code (e.g. 0 = Active) allows required field checking to be skipped when a resource is moved to this archive state.
HookRse_workflowAllArchive_skip_required_fields(int $archive_state) : mixedParameters
- $archive_state : int
-
Integer of destination archive state i.e. the state the resource will be moved to.
HookRse_workflowViewPageevaluation()
HookRse_workflowViewPageevaluation() : mixedHookRse_workflowViewAdditionaldownloadtabs()
HookRse_workflowViewAdditionaldownloadtabs() : mixedHookRse_workflowViewAdditionaldownloadtabbuttons()
HookRse_workflowViewAdditionaldownloadtabbuttons() : mixedHookRse_workflowViewReplacetitleprefix()
HookRse_workflowViewReplacetitleprefix(mixed $state) : mixedParameters
- $state : mixed
rse_workflow_get_actions()
Fetch a list of actions from the rse_workflow plugin Action text, name, and button text support i18n translation strings
rse_workflow_get_actions([string|int $status = "" ][, string|int $ref = "" ]) : array<string|int, mixed>Parameters
- $status : string|int = ""
-
Filter based on statusfrom, onle a single workflow state reference can be passed
- $ref : string|int = ""
-
Reference ID of action to return a single specific action
Return values
array<string|int, mixed> —SQL results from workflow_actions table. name, text, and buttontext values are translated using i18n translation
rse_workflow_save_action()
rse_workflow_save_action([mixed $ref = "" ]) : mixedParameters
- $ref : mixed = ""
rse_workflow_delete_action()
rse_workflow_delete_action(mixed $action) : mixedParameters
- $action : mixed
rse_workflow_get_archive_states()
rse_workflow_get_archive_states() : mixedrse_workflow_delete_state()
rse_workflow_delete_state(mixed $state, mixed $newstate) : mixedParameters
- $state : mixed
- $newstate : mixed
rse_workflow_get_valid_actions()
Validate list of actions for a resource or a batch of resources. For a batch of resources, an action is valid only if using the 'wf' permission is set for that action.
rse_workflow_get_valid_actions(array<string|int, mixed> $actions, bool $use_perms_only) : array<string|int, mixed>Parameters
- $actions : array<string|int, mixed>
-
List of workflow actions (@see rse_workflow_get_actions())
- $use_perms_only : bool
-
Validate actions using edit access (e perm) on the destination state -OR- 'wf' permissions
Return values
array<string|int, mixed>rse_workflow_validate_action()
Validate a workflow action for a particular resource
rse_workflow_validate_action(array<string|int, mixed> $action, array<string|int, mixed> $resource) : boolParameters
- $action : array<string|int, mixed>
-
Workflow action structure (@see rse_workflow_get_actions())
- $resource : array<string|int, mixed>
-
Resource structure (@see get_resource_data() or do_search())
Return values
boolrse_workflow_compile_actions()
Compile workflow actions for the unified dropdown actions. This will validate actions using only 'wf' permissions (@see rse_workflow_get_valid_actions)
rse_workflow_compile_actions(array<string|int, mixed> $url_params) : array<string|int, mixed>Parameters
- $url_params : array<string|int, mixed>
-
Inject any url params if needed. Useful to pass along search params.
Return values
array<string|int, mixed>rse_workflow_create_state()
Create new workflow state
rse_workflow_create_state(array<string|int, mixed> $data) : bool|array<string|int, mixed>Parameters
- $data : array<string|int, mixed>
-
New workflow state data. Requires at least a 'name' property!
Return values
bool|array<string|int, mixed> —Returns false if it fails or the new state data.
HookRss2AllInitialise()
HookRss2AllInitialise() : mixedHookRss2AllPreheaderoutput()
HookRss2AllPreheaderoutput() : mixedHookRss2AllSearchbarbeforebottomlinks()
HookRss2AllSearchbarbeforebottomlinks() : mixedHookRss2SearchRender_search_actions_add_option()
HookRss2SearchRender_search_actions_add_option(mixed $options) : mixedParameters
- $options : mixed
xmlentities()
xmlentities(mixed $text) : mixedParameters
- $text : mixed
HookSensitive_imagesAllAdditionaljoins()
HookSensitive_imagesAllAdditionaljoins() : mixedHookSensitive_imagesAllStopblurbleed()
HookSensitive_imagesAllStopblurbleed() : mixedSensitiveImageResultsReplace()
SensitiveImageResultsReplace(mixed $collection) : mixedParameters
- $collection : mixed
HookSensitive_imagesSearchResourcethumbtop()
HookSensitive_imagesSearchResourcethumbtop() : mixedHookSensitive_imagesCollectionsRendercollectionthumb()
HookSensitive_imagesCollectionsRendercollectionthumb() : mixedHookSensitive_imagesViewReplacepreviewlink()
HookSensitive_imagesViewReplacepreviewlink(string $preview_title) : mixedParameters
- $preview_title : string
HookSimpleldapAllExternalauth()
HookSimpleldapAllExternalauth(mixed $uname, mixed $pword) : mixedParameters
- $uname : mixed
- $pword : mixed
HooksimpleldapCheckAddinstallationcheck()
HooksimpleldapCheckAddinstallationcheck() : mixedHookSimpleldapTeam_user_editAdditionaluserfields()
HookSimpleldapTeam_user_editAdditionaluserfields() : mixedHookSimpleldapTeam_user_editPassword()
HookSimpleldapTeam_user_editPassword(mixed $user) : mixedParameters
- $user : mixed
HookSimpleldapTeam_user_editTicktoemailpassword()
HookSimpleldapTeam_user_editTicktoemailpassword() : mixedsimpleldap_authenticate()
Authenticate to directory by binding and performing LDAP search
simpleldap_authenticate(string $username, string $password) : array<string|int, mixed>|boolParameters
- $username : string
-
Username
- $password : string
-
Password
Return values
array<string|int, mixed>|bool —Array of user data or false if failed to authenticate
simpleldap_to_utf8()
Helper function to convert received data from LDAP server to UTF-8
simpleldap_to_utf8(string $str) : stringParameters
- $str : string
-
String to convert to UTF8
Return values
stringHookSimplesamlAllInitialise()
HookSimplesamlAllInitialise() : mixedHookSimplesamlAllPreheaderoutput()
HookSimplesamlAllPreheaderoutput() : mixedHookSimplesamlAllProvideusercredentials()
HookSimplesamlAllProvideusercredentials() : mixedHookSimplesamlAllLoginformlink()
HookSimplesamlAllLoginformlink() : mixedHookSimplesamlLoginPostlogout()
HookSimplesamlLoginPostlogout() : mixedHookSimplesamlLoginPostlogout2()
HookSimplesamlLoginPostlogout2() : mixedHookSimplesamlAllCheckuserloggedin()
HookSimplesamlAllCheckuserloggedin() : mixedHookSimplesamlAllReplaceheadernav1anon()
Render header navigation links in anonymous mode based on simplasaml configuration
HookSimplesamlAllReplaceheadernav1anon() : mixedHookSimplesamlCollection_emailReplacecollectionemailredirect()
HookSimplesamlCollection_emailReplacecollectionemailredirect() : mixedHookSimplesamlResource_emailReplaceresourceemailredirect()
HookSimplesamlResource_emailReplaceresourceemailredirect() : mixedHookSimplesamlAllCheck_access_key()
HookSimplesamlAllCheck_access_key() : mixedHookSimplesamlAllExtra_checks()
HookSimplesamlAllExtra_checks() : mixedHookSimplesamlAllSsologindefault()
HookSimplesamlAllSsologindefault() : mixedHookSimplesamlAllCron()
HookSimplesamlAllCron() : mixedHooksimplesamlCheckAddinstallationcheck()
HooksimplesamlCheckAddinstallationcheck() : mixedHookSimplesamlTeam_user_editAdditionaluserfields()
HookSimplesamlTeam_user_editAdditionaluserfields() : mixedHookSimplesamlTeam_user_editPassword()
HookSimplesamlTeam_user_editPassword(mixed $user) : mixedParameters
- $user : mixed
HookSimplesamlTeam_user_editTicktoemailpassword()
HookSimplesamlTeam_user_editTicktoemailpassword() : mixedsimplesaml_get_lib_path()
Get the configured path to the root of the SimpleSAML library If $simplesaml_lib_path is not set this will be the [webroot]/plugins/simplesaml/lib folder
simplesaml_get_lib_path() : stringReturn values
stringsimplesaml_authenticate()
Authenticate user, redfirecting to IdP if necessary
simplesaml_authenticate() : boolReturn values
boolsimplesaml_getattributes()
Get SAML attributes
simplesaml_getattributes() : array<string|int, mixed>Return values
array<string|int, mixed>simplesaml_signout()
Sign out of SAML SP
simplesaml_signout() : voidsimplesaml_is_authenticated()
Check if user has been authenticated by SimpleSAMLPHP
simplesaml_is_authenticated() : boolReturn values
boolsimplesaml_getauthdata()
simplesaml_getauthdata(mixed $value) : mixedParameters
- $value : mixed
simplesaml_duplicate_notify()
Notify of a new SAML user with an email address that is already in use by an existing user
simplesaml_duplicate_notify(string $username, int $group, string $email, array<string|int, mixed> $email_matches[, int $newuserid = 0 ]) : voidParameters
- $username : string
-
Username
- $group : int
-
Usergroup
- $email : string
-
Email
- $email_matches : array<string|int, mixed>
-
Array of existing users with matching email
- $newuserid : int = 0
-
ID of new user if created
simplesaml_config_check()
Check that the SimpleSAMLphp configuration is valid
simplesaml_config_check() : array{success: bool, error?: string}Return values
array{success: bool, error?: string}simplesaml_php_check()
Check whether PHP version will cause an error with current SAML config
simplesaml_php_check([bool $with_config = true ]) : boolParameters
- $with_config : bool = true
Return values
boolsimplesaml_is_configured()
Check that the SimpleSAMLphp has been configured.
simplesaml_is_configured() : boolThis is done by either:- a) Adding config, authsources and metadata files manually to the configured lib folder ($simplesaml_lib_path) or b) By setting the options in the $simplesamlconfig variable and then enabling the plugin option 'Use ResourceSpace configuration to set SP configuration and metadata'
Return values
boolsimplesaml_generate_keypair()
Generate a key/certificate pair
simplesaml_generate_keypair(array<string|int, mixed> $dn) : array<string|int, mixed>Parameters
- $dn : array<string|int, mixed>
-
Array of certificate attributes with named indexes as below
- "countryName"
- "stateOrProvinceName"
- "localityName"
- "organizationName"
- "commonName"
- "emailAddress"
Return values
array<string|int, mixed> —Array containing paths to private key (.pem) and certificate (.crt) files
get_saml_sp_name()
Get the name of the saml SP to use
get_saml_sp_name() : stringReturn values
stringget_saml_metadata_expiry()
Get the latest expiration date for the given SAML Identity Provider's certificates
get_saml_metadata_expiry(string $entityid) : stringParameters
- $entityid : string
-
EntityID of SAML IdP
Return values
string —Expiration date. Empty string if no certificate or IdP is not found.
simplesaml_update_metadata()
Get the latest metadata from the configured IdP Metadata URL
simplesaml_update_metadata() : bool|stringReturn values
bool|string —True if successful, otherwise error message
get_saml_metadata()
Get SAML IdP metadata from sysvars, updating if necessary
get_saml_metadata([bool $retry = true ]) : array<string|int, mixed>|falseParameters
- $retry : bool = true
-
Retry if invalid. Default true
Return values
array<string|int, mixed>|false —Metadata if successful, false if failed
simplesaml_use_idp_metadata_url_mode()
simplesaml_use_idp_metadata_url_mode() : boolReturn values
boolHookSystem_resetAdmin_homeCustomadminfunction()
HookSystem_resetAdmin_homeCustomadminfunction() : mixedHookTesseractAllCron()
Add tesseract processing to the cron.
HookTesseractAllCron() : voidHookTesseractAllAfterpreviewcreation()
Runs tesseract processing after preview creation.
HookTesseractAllAfterpreviewcreation(int $resource, int $alternative[, bool $generate_all = false ]) : voidParameters
- $resource : int
-
The resource reference ID that has just had previews created.
- $alternative : int
-
The alternative file ID, or -1 if processing the main resource.
- $generate_all : bool = false
-
Flag to indicate if hook has been triggered during full preview creation process
tesseract_process_unprocessed()
Processes all unprocessed audio/video resources supported by tesseract.
tesseract_process_unprocessed() : int|falseThis function:
- Prevents concurrent execution via process locking.
- Selects resources with supported file extensions that have not yet been transcribed.
- Invokes tesseract_process() for each selected resource.
Return values
int|false —Returns the number of resources processed, or false if a process lock is active.
tesseract_process()
Extracts text from an image or scanned document using tesseract OCR.
tesseract_process(int $resource) : boolMarks the resource as processed by setting
tesseract_processed = 1.Parameters
- $resource : int
-
The resource ID to process.
Return values
bool —True on successful processing, false if any step fails.
HookTms_linkAllInitialise()
HookTms_linkAllInitialise() : mixedHookTms_linkAllUpdate_field()
HookTms_linkAllUpdate_field(mixed $resource, mixed $field, mixed $value, mixed $existing) : mixedParameters
- $resource : mixed
- $field : mixed
- $value : mixed
- $existing : mixed
HookTms_linkAllAfterpreviewcreation()
HookTms_linkAllAfterpreviewcreation(int $ref[, int $alternative = -1 ][, bool $generate_all = false ]) : voidParameters
- $ref : int
- $alternative : int = -1
- $generate_all : bool = false
HookTms_linkCheckAddinstallationcheck()
HookTms_linkCheckAddinstallationcheck() : mixedHookTms_linkCron_copy_hitcountAddplugincronjob()
HookTms_linkCron_copy_hitcountAddplugincronjob() : mixedHookTms_linkEditEditbeforesectionhead()
HookTms_linkEditEditbeforesectionhead() : mixedHookTMS_linkEditEdithidefield()
HookTMS_linkEditEdithidefield(mixed $field) : mixedParameters
- $field : mixed
HookTms_linkAllAdditionalvalcheck()
HookTms_linkAllAdditionalvalcheck(mixed $fields, mixed $fieldsitem) : mixedParameters
- $fields : mixed
- $fieldsitem : mixed
HookTms_linkEditAftersaveresourcedata()
TMS plugin implementing the 'aftersaveresourcedata' hook IMPORTANT: 'aftersaveresourcedata' hook is called from both save_resource_data() and save_resource_data_multi()!
HookTms_linkEditAftersaveresourcedata(int|array<string|int, mixed> $R, mixed $nodes_to_add, mixed $nodes_to_remove, mixed $autosave_field, array<string|int, mixed> $fields, array<string|int, mixed> $updated_resources) : array<string|int, mixed>|boolParameters
- $R : int|array<string|int, mixed>
-
Generic type for resource ID(s). It will be a resource ref when hook is called from save_resource_data() -OR- a list of resource IDs when called from save_resource_data_multi().
- $nodes_to_add : mixed
- $nodes_to_remove : mixed
- $autosave_field : mixed
- $fields : array<string|int, mixed>
-
List of fields that was submitted with the request (contains stale data)
- $updated_resources : array<string|int, mixed>
-
Map of field changes for each resource (if applicable)
Return values
array<string|int, mixed>|bool —Returns bool to show whether the hook ran or not -or- list of errors. See hook 'aftersaveresourcedata' in resource_functions.php for more info
HookTms_linkTeam_homeCustomteamfunctionadmin()
HookTms_linkTeam_homeCustomteamfunctionadmin() : mixedHookTms_linkViewRenderfield()
HookTms_linkViewRenderfield(mixed $field) : mixedParameters
- $field : mixed
unistr_to_ords()
unistr_to_ords(mixed $str[, mixed $encoding = 'UTF-8' ]) : mixedParameters
- $str : mixed
- $encoding : mixed = 'UTF-8'
getEncodingOrder()
getEncodingOrder() : mixedtms_convert_value()
tms_convert_value(mixed $value, mixed $key, array<string|int, mixed> $module) : mixedParameters
- $value : mixed
- $key : mixed
- $module : array<string|int, mixed>
tms_link_get_tms_data()
tms_link_get_tms_data(mixed $resource[, mixed $tms_object_id = "" ][, mixed $resourcechecksum = "" ][, mixed $onlymodule = "" ]) : mixedParameters
- $resource : mixed
- $tms_object_id : mixed = ""
- $resourcechecksum : mixed = ""
- $onlymodule : mixed = ""
tms_link_get_tms_resources()
tms_link_get_tms_resources(array<string|int, mixed> $module) : mixedParameters
- $module : array<string|int, mixed>
tms_link_test()
tms_link_test() : mixedtms_add_mediaxref()
tms_add_mediaxref(mixed $mediamasterid, mixed $tms_object_id[, mixed $create = true ]) : mixedParameters
- $mediamasterid : mixed
- $tms_object_id : mixed
- $create : mixed = true
tms_link_create_tms_thumbnail()
tms_link_create_tms_thumbnail(mixed $resource[, mixed $alternative = -1 ]) : mixedParameters
- $resource : mixed
- $alternative : mixed = -1
tms_get_mediamasterid()
tms_get_mediamasterid Retrieve a list of unused Media Master IDs from the TMS database and return the first available.
tms_get_mediamasterid([bool $create = true ][, int $resource = null ]) : bool|stringIf no IDs are found then create a new one and then retry To avoid Media Master IDs being used by multiple resources $tms_link_mediapaths_resource_reference_column can be set. This will store the resource ID in the MediaMaster table when creating the new ID so that it is not used by another Resource
Parameters
- $create : bool = true
-
flag to create a new ID if none found
- $resource : int = null
-
ResourceSpace resource ID
Return values
bool|string —False if no ID found, otherwise the Media Master ID is returned
tms_get_renditionid()
tms_get_renditionid(mixed $mediamasterid, mixed $resourceid[, mixed $create = true ]) : mixedParameters
- $mediamasterid : mixed
- $resourceid : mixed
- $create : mixed = true
tms_get_mediapathid()
tms_get_mediapathid(mixed $path[, mixed $create = true ]) : mixedParameters
- $path : mixed
- $create : mixed = true
tms_update_media_rendition()
tms_update_media_rendition(mixed $mediamasterid, mixed $mediafileid) : mixedParameters
- $mediamasterid : mixed
- $mediafileid : mixed
tms_check_thumb()
tms_check_thumb(mixed $pathid, mixed $filepath, mixed $filename) : mixedParameters
- $pathid : mixed
- $filepath : mixed
- $filename : mixed
tms_update_media_rendition_thumb()
tms_update_media_rendition_thumb(mixed $mediamasterid, mixed $mediafileid, mixed $pathid, mixed $filepath, mixed $filename) : mixedParameters
- $mediamasterid : mixed
- $mediafileid : mixed
- $pathid : mixed
- $filepath : mixed
- $filename : mixed
tms_add_mediafile()
tms_add_mediafile(mixed $renditionid, mixed $pathid, mixed $filepath, mixed $relfilepath[, mixed $create = true ]) : mixedParameters
- $renditionid : mixed
- $pathid : mixed
- $filepath : mixed
- $relfilepath : mixed
- $create : mixed = true
tms_show_data()
tms_show_data(mixed $table, mixed $columns, mixed $utf16_columns, mixed $conditionsql[, mixed $limit = 10 ]) : mixedParameters
- $table : mixed
- $columns : mixed
- $utf16_columns : mixed
- $conditionsql : mixed
- $limit : mixed = 10
tms_link_check_preview()
tms_link_check_preview(mixed $ref[, mixed $alternative = -1 ]) : mixedParameters
- $ref : mixed
- $alternative : mixed = -1
tms_link_save_module_mappings_config()
Save plugins' module saved mappings configuration on an ad-hoc basis
tms_link_save_module_mappings_config(mixed $value) : voidParameters
- $value : mixed
-
Configuration option new value
Tags
tms_link_get_modules_mappings()
tms_link_get_modules_mappings() : mixedtms_link_encode_modules_mappings()
tms_link_encode_modules_mappings() : mixedtms_link_is_rs_uid_field()
tms_link_is_rs_uid_field(mixed $field_ref) : mixedParameters
- $field_ref : mixed
tms_link_split_identifiers()
Split string identifier values on commas with optional whitespace for multiple tms object IDs
tms_link_split_identifiers(string|array<string|int, mixed> $tms_object_id) : array<string|int, mixed>Parameters
- $tms_object_id : string|array<string|int, mixed>
Return values
array<string|int, mixed>HookTotpAllPreheaderoutput()
Redirects the user to the TOTP setup page if their TOTP cookie is invalid or missing.
HookTotpAllPreheaderoutput() : voidThis hook runs before the page header output and ensures that users with TOTP enabled are redirected to complete setup or authentication if needed.
HookTotpAllAdditionalheaderjs()
Includes the QR code JavaScript library needed for TOTP setup.
HookTotpAllAdditionalheaderjs() : voidThis hook appends the necessary JS to the page header.
HookTotpTeam_user_editAdditionaluserfields()
Adds a TOTP reset checkbox to the user edit form.
HookTotpTeam_user_editAdditionaluserfields() : voidThis allows administrators to reset a user's TOTP configuration, e.g. if they have lost their device.
HookTotpTeam_user_editAdditionaluserfieldssave()
Processes the TOTP reset checkbox and prepares a query to reset the user's TOTP data.
HookTotpTeam_user_editAdditionaluserfieldssave() : PreparedStatementQuery|nullIf the reset checkbox was ticked, returns a PreparedStatementQuery that modifies the user save action to clear the user's TOTP fields.
Return values
PreparedStatementQuery|null —A query to reset TOTP fields, or null if not resetting.
HookTotpAllBeforetermsredirect()
HookTotpAllBeforetermsredirect() : mixedTOTP_validate()
Validates a TOTP code for the given user reference.
TOTP_validate(string $code, int $user_ref) : boolParameters
- $code : string
-
The TOTP code to validate.
- $user_ref : int
-
The user reference.
Return values
bool —True if the code is valid, false otherwise.
TOTP_cookie()
Generates a daily cookie hash based on the user reference and scramble key.
TOTP_cookie(int $user_ref) : stringParameters
- $user_ref : int
-
The user reference.
Return values
string —A SHA-256 hash used for TOTP cookie validation.
TOTP_is_user_set_up()
Checks whether TOTP is set up for the specified user.
TOTP_is_user_set_up(int $user_ref) : boolParameters
- $user_ref : int
-
The user reference.
Return values
bool —True if TOTP is set up, false otherwise.
TOTP_get_secret()
Generates the TOTP secret for the given user.
TOTP_get_secret(int $user_ref) : stringParameters
- $user_ref : int
-
The user reference.
Return values
string —A base32-encoded TOTP secret.
TOTP_get_url()
Constructs the otpauth URL for the user's TOTP setup.
TOTP_get_url(int $user_ref) : stringParameters
- $user_ref : int
-
The user reference.
Return values
string —The otpauth URL used to generate a QR code in authenticator apps.
TOTP_setup_complete()
Marks TOTP setup as complete for the specified user.
TOTP_setup_complete(int $user_ref) : voidParameters
- $user_ref : int
-
The user reference.
TOTP_tries()
Retrieves the number of failed TOTP attempts for the user.
TOTP_tries(int $user_ref) : intParameters
- $user_ref : int
-
The user reference.
Return values
int —The number of TOTP validation attempts.
TOTP_increase_tries()
Increments the TOTP attempt counter for the specified user.
TOTP_increase_tries(int $user_ref) : voidParameters
- $user_ref : int
-
The user reference.
TOTP_saml_authenticate()
Checks to see if SAML is authenticated for the given user if TOTP can be skipped for SAML users.
TOTP_saml_authenticate() : boolReturn values
bool —True if SAML is enabled and authenticates, false otherwise
HookTrack_field_historyViewValue_mod_after_highlight()
HookTrack_field_historyViewValue_mod_after_highlight(mixed $field, mixed $value) : mixedParameters
- $field : mixed
- $value : mixed
track_field_history_get_field_log()
track_field_history_get_field_log(mixed $resource_id, mixed $field_id) : mixedParameters
- $resource_id : mixed
- $field_id : mixed
HookTransformAdmin_manage_slideshowRender_new_element_for_manage_slideshow()
HookTransformAdmin_manage_slideshowRender_new_element_for_manage_slideshow(array<string|int, mixed> $slideshow_files) : mixedParameters
- $slideshow_files : array<string|int, mixed>
HookTransformAdmin_manage_slideshowRender_replace_button_for_manage_slideshow()
HookTransformAdmin_manage_slideshowRender_replace_button_for_manage_slideshow(mixed $slideshow_image, array<string|int, mixed> $slideshow_file_info) : mixedParameters
- $slideshow_image : mixed
- $slideshow_file_info : array<string|int, mixed>
HookTransformAdmin_manage_slideshowRender_replace_slideshow_form_for_manage_slideshow()
HookTransformAdmin_manage_slideshowRender_replace_slideshow_form_for_manage_slideshow(mixed $replace_slideshow_id) : mixedParameters
- $replace_slideshow_id : mixed
HookTransformAllAdditionalheaderjs()
HookTransformAllAdditionalheaderjs() : mixedHookTransformAllRender_actions_add_collection_option()
HookTransformAllRender_actions_add_collection_option(mixed $top_actions, mixed $options, mixed $collection_data, array<string|int, mixed> $urlparams) : mixedParameters
- $top_actions : mixed
- $options : mixed
- $collection_data : mixed
- $urlparams : array<string|int, mixed>
HookTransformAllAdditional_title_pages_array()
HookTransformAllAdditional_title_pages_array() : mixedHookTransformAllAdditional_title_pages()
HookTransformAllAdditional_title_pages() : mixedHookTransformAllreplace_resource_file_extra()
HookTransformAllreplace_resource_file_extra(mixed $resource) : mixedParameters
- $resource : mixed
HookTransformCollection_editColleditformbottom()
HookTransformCollection_editColleditformbottom() : mixedHookTransformViewAfterresourceactions()
HookTransformViewAfterresourceactions() : mixedHookTypesense_searchAllExternal_search()
Intercept ResourceSpace searches and optionally handle them using Typesense.
HookTypesense_searchAllExternal_search(string $search, array<string|int, mixed> $keywords, array<string|int, mixed> $node_bucket, array<string|int, mixed> $node_bucket_not, mixed $restypes, mixed $order_by, array<string|int, mixed> $archive, mixed $fetchrows, string $sort, bool $access_override, bool $ignore_filters, bool $return_disk_usage, string $recent_search_daylimit, bool $return_refs_only, bool $editable_only, bool $returnsql, mixed $access, bool $smartsearch, PreparedStatementQuery $sql_filter, PreparedStatementQuery $sql_join, PreparedStatementQuery $select) : array<string|int, mixed>|falseReturning false allows normal MySQL-based ResourceSpace search processing to continue.
Parameters
- $search : string
-
Original search string.
- $keywords : array<string|int, mixed>
-
Parsed search keywords.
- $node_bucket : array<string|int, mixed>
-
Included node search buckets.
- $node_bucket_not : array<string|int, mixed>
-
Excluded node search buckets.
- $restypes : mixed
-
Resource type filter.
- $order_by : mixed
-
Requested sort field.
- $archive : array<string|int, mixed>
-
Archive state filter.
- $fetchrows : mixed
-
Result limit or chunk details.
- $sort : string
-
Sort direction.
- $access_override : bool
-
Whether access checks are overridden.
- $ignore_filters : bool
-
Whether standard filters are ignored.
- $return_disk_usage : bool
-
Whether disk usage totals are requested.
- $recent_search_daylimit : string
-
Recent search day limit.
- $return_refs_only : bool
-
Whether only resource refs should be returned.
- $editable_only : bool
-
Whether only editable resources should be returned.
- $returnsql : bool
-
Whether SQL should be returned instead of results.
- $access : mixed
-
Access filter override.
- $smartsearch : bool
-
Whether smart search mode is active.
- $sql_filter : PreparedStatementQuery
-
Existing ResourceSpace filter SQL.
- $sql_join : PreparedStatementQuery
-
Existing ResourceSpace JOIN SQL.
- $select : PreparedStatementQuery
-
Existing ResourceSpace SELECT SQL.
Return values
array<string|int, mixed>|false —ResourceSpace-compatible search results, or false to fall back to core search.
HookTypesense_searchAllBeforenodedelete()
Store resources using a node before the node is deleted.
HookTypesense_searchAllBeforenodedelete(int $node) : voidParameters
- $node : int
-
Node ID.
HookTypesense_searchAllAfternodedelete()
Reindex resources that used a node after the node has been deleted.
HookTypesense_searchAllAfternodedelete(int $node) : voidParameters
- $node : int
-
Node ID.
HookTypesense_searchAllAftersaveresourcedata()
Reindex resource after metadata has been saved.
HookTypesense_searchAllAftersaveresourcedata() : falseReturn values
falseHookTypesense_searchAllAfter_save_related_keywords()
Sync Typesense related keyword synonyms after related keywords have been saved.
HookTypesense_searchAllAfter_save_related_keywords(string $keyword, string $related) : falseParameters
- $keyword : string
-
Keyword that was updated.
- $related : string
-
Related keyword string.
Return values
falsetypesense_search_supported()
Check whether the current ResourceSpace search can be handled by Typesense.
typesense_search_supported(string $search, array<string|int, mixed> $keywords, array<string|int, mixed> $node_bucket, array<string|int, mixed> $node_bucket_not, bool $return_disk_usage, bool $editable_only, bool $returnsql, bool $smartsearch) : boolParameters
- $search : string
-
The original search string after ResourceSpace preprocessing.
- $keywords : array<string|int, mixed>
-
Parsed search keywords.
- $node_bucket : array<string|int, mixed>
-
Included node search buckets.
- $node_bucket_not : array<string|int, mixed>
-
Excluded node search buckets.
- $return_disk_usage : bool
-
Whether disk usage totals are requested.
- $editable_only : bool
-
Whether only editable resources should be returned.
- $returnsql : bool
-
Whether SQL should be returned instead of results.
- $smartsearch : bool
-
Whether smart search mode is active.
Return values
bool —True if Typesense can handle the search, otherwise false.
typesense_search_do_search()
Run a ResourceSpace search using Typesense and return ResourceSpace-compatible results.
typesense_search_do_search(string $search, mixed $restypes, array<string|int, mixed> $archive, mixed $fetchrows, bool $return_refs_only, PreparedStatementQuery $select, string $order_by, string $sort) : array<string|int, mixed>|falseParameters
- $search : string
-
Search string.
- $restypes : mixed
-
Resource type filter.
- $archive : array<string|int, mixed>
-
Archive state filter.
- $fetchrows : mixed
-
Result limit or chunk details.
- $return_refs_only : bool
-
Whether only resource refs should be returned.
- $select : PreparedStatementQuery
-
Existing ResourceSpace SELECT fields.
- $order_by : string
-
The order by SQL from the standard ResourceSpace search construction.
- $sort : string
Return values
array<string|int, mixed>|false —ResourceSpace-compatible results, or false to fall back to core search.
typesense_search_get_refs()
Query Typesense and return matching resource refs in relevance order.
typesense_search_get_refs(string $search, mixed $restypes, array<string|int, mixed> $archive, mixed $fetchrows, mixed $order_by, mixed $sort) : array<string|int, mixed>|falseParameters
- $search : string
-
Search string.
- $restypes : mixed
-
Resource type filter.
- $archive : array<string|int, mixed>
-
Archive state filter.
- $fetchrows : mixed
-
Result limit or chunk details.
- $order_by : mixed
- $sort : mixed
Return values
array<string|int, mixed>|false —Ordered resource refs, or false if Typesense should be bypassed.
typesense_search_filter_by()
Build a Typesense filter expression for simple ResourceSpace filters.
typesense_search_filter_by(mixed $restypes, array<string|int, mixed> $archive) : stringParameters
- $restypes : mixed
-
Resource type filter.
- $archive : array<string|int, mixed>
-
Archive state filter.
Return values
string —Typesense filter expression.
typesense_search_hydrate_refs()
Hydrate Typesense resource refs into the standard ResourceSpace search result structure.
typesense_search_hydrate_refs(array<string|int, mixed> $refs, int $total, mixed $fetchrows, bool $return_refs_only, PreparedStatementQuery $select, string $order_by) : array<string|int, mixed>Parameters
- $refs : array<string|int, mixed>
-
Ordered resource refs from Typesense.
- $total : int
-
Total number of matches reported by Typesense.
- $fetchrows : mixed
-
Result limit or chunk details.
- $return_refs_only : bool
-
Whether only resource refs should be returned.
- $select : PreparedStatementQuery
-
Existing ResourceSpace SELECT fields.
- $order_by : string
-
The order by SQL from the standard ResourceSpace search construction.
Return values
array<string|int, mixed> —ResourceSpace-compatible search results.
typesense_search_request()
Send a request to the Typesense API.
typesense_search_request(string $method, string $endpoint[, array<string|int, mixed>|null $payload = null ]) : array<string|int, mixed>|falseParameters
- $method : string
-
HTTP method.
- $endpoint : string
-
API endpoint beginning with a slash.
- $payload : array<string|int, mixed>|null = null
-
Optional request payload.
Return values
array<string|int, mixed>|false —Decoded JSON response, or false on failure.
typesense_search_ensure_collection()
Ensure that the Typesense resources collection exists.
typesense_search_ensure_collection() : boolReturn values
bool —True if the collection exists or was created.
typesense_search_get_document_data()
Build a Typesense document for a ResourceSpace resource.
typesense_search_get_document_data(int $resource) : array<string|int, mixed>|falseParameters
- $resource : int
-
Resource ID.
Return values
array<string|int, mixed>|false —Typesense document data, or false if the resource cannot be indexed.
typesense_search_index_resource()
Index a single ResourceSpace resource in Typesense.
typesense_search_index_resource(int $resource) : boolParameters
- $resource : int
-
Resource ID.
Return values
bool —True if the resource was indexed successfully.
typesense_search_delete_resource()
Delete a resource document from Typesense.
typesense_search_delete_resource(int $resource) : boolParameters
- $resource : int
-
Resource ID.
Return values
bool —True if the delete request succeeded.
typesense_search_reindex_node_resources()
Reindex all resources that are currently linked to a node.
typesense_search_reindex_node_resources(int $node) : intParameters
- $node : int
-
Node ID.
Return values
int —Number of resources successfully reindexed.
typesense_search_reindex_all()
Reindex resources in batches.
typesense_search_reindex_all([int $limit = 100 ][, int $after = 0 ]) : array<string|int, mixed>Parameters
- $limit : int = 100
-
Maximum number of resources to index in this batch.
- $after : int = 0
-
Only index resources with refs greater than this value.
Return values
array<string|int, mixed> —Batch indexing summary.
typesense_search_index_document()
Index a Typesense document.
typesense_search_index_document(array<string|int, mixed> $document) : boolParameters
- $document : array<string|int, mixed>
-
Typesense document data.
Return values
bool —True if the document was indexed successfully.
typesense_search_sync_related_keywords()
Synchronise ResourceSpace related keywords to Typesense synonyms.
typesense_search_sync_related_keywords() : boolCreates or updates synonym groups in the configured Typesense collection based on ResourceSpace related keyword relationships so that searches automatically match related terms using OR-style expansion.
Return values
bool —True if the sync completed successfully.
HookUser_preferencesuser_change_passwordReplaceuserpreferencesheader()
HookUser_preferencesuser_change_passwordReplaceuserpreferencesheader() : mixedHookUser_preferencesuser_change_passwordSaveadditionaluserpreferences()
HookUser_preferencesuser_change_passwordSaveadditionaluserpreferences() : mixedHookUser_preferencesuser_change_passwordAdditionaluserpreferences()
HookUser_preferencesuser_change_passwordAdditionaluserpreferences() : mixedHookVideo_bookendViewAfterresourceactions()
HookVideo_bookendViewAfterresourceactions() : mixedHookVideo_spliceAllInitialise()
HookVideo_spliceAllInitialise() : mixedHookVideo_spliceAllRender_actions_add_collection_option()
HookVideo_spliceAllRender_actions_add_collection_option(mixed $top_actions, array<string|int, mixed> $options) : mixedParameters
- $top_actions : mixed
- $options : array<string|int, mixed>
HookVideo_spliceViewAfterresourceactions()
HookVideo_spliceViewAfterresourceactions() : mixedgenerate_merged_video()
generate_merged_video(mixed $videos, mixed $video_splice_type, mixed $target_video_command, mixed $target_video_extension, mixed $target_audio_command, mixed $target_width, mixed $target_height, mixed $target_frame_rate, mixed $description, mixed $auto_populate_video_info, mixed $offline) : mixedParameters
- $videos : mixed
- $video_splice_type : mixed
- $target_video_command : mixed
- $target_video_extension : mixed
- $target_audio_command : mixed
- $target_width : mixed
- $target_height : mixed
- $target_frame_rate : mixed
- $description : mixed
- $auto_populate_video_info : mixed
- $offline : mixed
generate_video_trim()
Trim video as requested from pages/trim.php
generate_video_trim(string $target, string $source_video_file, int $resource_ref, string $ffmpeg_start_time, string $ffmpeg_duration_time) : voidParameters
- $target : string
-
Path to the target file. This is the output location for the trim.
- $source_video_file : string
-
Path to the source video file. This file will be the input for the trim.
- $resource_ref : int
-
Ref of the resource to be trimmed.
- $ffmpeg_start_time : string
-
Start of trim - formatted with gmdate()
- $ffmpeg_duration_time : string
-
Duration of trim - formatted with gmdate()
HookVideo_timestamp_linksViewFooterbottom()
HookVideo_timestamp_linksViewFooterbottom() : mixedHookVideo_tracksAllStaticsync_after_alt()
HookVideo_tracksAllStaticsync_after_alt(mixed $resource[, mixed $altfile = "" ]) : mixedParameters
- $resource : mixed
- $altfile : mixed = ""
HookVideo_tracksAllAfter_alt_upload()
HookVideo_tracksAllAfter_alt_upload(mixed $resource[, mixed $altfile = "" ]) : mixedParameters
- $resource : mixed
- $altfile : mixed = ""
HookVideo_tracksViewModifydownloadbutton()
HookVideo_tracksViewModifydownloadbutton() : mixedHookVideo_tracksViewDownloadbuttonreplace()
HookVideo_tracksViewDownloadbuttonreplace() : mixedHookVideo_tracksViewAfterresourceactions()
HookVideo_tracksViewAfterresourceactions() : mixedHookVideo_tracksViewAdditionalresourcetools2()
HookVideo_tracksViewAdditionalresourcetools2(mixed $resource, mixed $access) : mixedParameters
- $resource : mixed
- $access : mixed
HookVimeo_publishAllInitialise()
HookVimeo_publishAllInitialise() : mixedHookVimeo_publishViewAfterresourceactions()
HookVimeo_publishViewAfterresourceactions() : mixedinit_vimeo_api()
init_vimeo_api(mixed $client_id, mixed $client_secret, mixed $redirect_uri) : mixedParameters
- $client_id : mixed
- $client_secret : mixed
- $redirect_uri : mixed
get_access_token()
get_access_token(mixed $client_id, mixed $client_secret, mixed $redirect_uri) : mixedParameters
- $client_id : mixed
- $client_secret : mixed
- $redirect_uri : mixed
delete_vimeo_token()
delete_vimeo_token([mixed $user_ref = 0 ]) : mixedParameters
- $user_ref : mixed = 0
get_vimeo_user()
get_vimeo_user(mixed $client_id, mixed $client_secret, mixed $access_token, array<string|int, mixed> &$vimeo_user_data) : mixedParameters
- $client_id : mixed
- $client_secret : mixed
- $access_token : mixed
- $vimeo_user_data : array<string|int, mixed>
vimeo_upload()
vimeo_upload(mixed $client_id, mixed $client_secret, mixed $access_token, mixed $ref, mixed $file_path, mixed $rs_vimeo_link_field, mixed &$new_video_id, mixed &$error) : mixedParameters
- $client_id : mixed
- $client_secret : mixed
- $access_token : mixed
- $ref : mixed
- $file_path : mixed
- $rs_vimeo_link_field : mixed
- $new_video_id : mixed
- $error : mixed
set_video_information()
set_video_information(mixed $client_id, mixed $client_secret, mixed $access_token, mixed $video_id, mixed $parameters) : mixedParameters
- $client_id : mixed
- $client_secret : mixed
- $access_token : mixed
- $video_id : mixed
- $parameters : mixed
HookVm2rsAllInitialise()
HookVm2rsAllInitialise() : mixedHookvm2rsUpload_batchUpload_page_bottom()
Hookvm2rsUpload_batchUpload_page_bottom() : mixedisValidVimeoURL()
isValidVimeoURL(mixed $url) : mixedParameters
- $url : mixed
Hookvm2rsViewrenderinnerresourcepreview()
Hookvm2rsViewrenderinnerresourcepreview() : mixedHookvm2rsViewreplacedownloadoptions()
Hookvm2rsViewreplacedownloadoptions() : mixedHookVr_viewAllInitialise()
HookVr_viewAllInitialise() : mixedHookVr_viewAllAdditionalheaderjs()
HookVr_viewAllAdditionalheaderjs() : mixedHookVr_viewAllmodified_Cors_Process()
HookVr_viewAllmodified_Cors_Process() : mixedHookVr_viewPreviewFullpreviewresultnav()
HookVr_viewPreviewFullpreviewresultnav() : mixedHookVr_viewPreviewcustomflvplay()
HookVr_viewPreviewcustomflvplay() : mixedHookVr_viewPreviewReplacepreviewimage()
HookVr_viewPreviewReplacepreviewimage() : mixedHookVr_viewViewaftergetresourcedataview()
HookVr_viewViewaftergetresourcedataview(mixed $ref, mixed $resource) : mixedParameters
- $ref : mixed
- $resource : mixed
HookVr_viewViewReplacepreviewlink()
HookVr_viewViewReplacepreviewlink(string $preview_title) : mixedParameters
- $preview_title : string
HookVr_viewViewRenderinnerresourcepreview()
HookVr_viewViewRenderinnerresourcepreview() : mixedVrViewUseVR()
Check whether VR view is to be enabled for the specified resource
VrViewUseVR(array<string|int, mixed> $resource) : boolParameters
- $resource : array<string|int, mixed>
-
Resource data array (not resource field data)
Tags
Return values
boolVrViewRenderPlayer()
VrViewRenderPlayer(mixed $ref, mixed $source[, mixed $isvideo = false ][, mixed $width = 852 ][, mixed $height = 600 ][, mixed $parentdivid = "" ][, mixed $scope = "" ]) : mixedParameters
- $ref : mixed
- $source : mixed
- $isvideo : mixed = false
- $width : mixed = 852
- $height : mixed = 600
- $parentdivid : mixed = ""
- $scope : mixed = ""
HookWhisperAllCron()
Add whisper processing to the cron.
HookWhisperAllCron() : voidHookWhisperAllTemp_block_deletion()
Prevent downloaded Whisper models from being deleted
HookWhisperAllTemp_block_deletion() : stringReturn values
stringHookWhisperAllAddtriggerablejob()
Hook into offline jobs list to add custom job
HookWhisperAllAddtriggerablejob() : array<string|int, mixed>Return values
array<string|int, mixed> —Array of existing job data with custom job added
whisper_process_unprocessed()
Processes all unprocessed audio/video resources supported by Whisper.
whisper_process_unprocessed([int $size_limit = 0 ]) : int|falseThis function:
- Prevents concurrent execution via process locking.
- Selects resources with supported file extensions that have not yet been transcribed.
- Invokes whisper_process() for each selected resource.
Parameters
- $size_limit : int = 0
-
The total size of files in GB to be processed in a batch, 0 = no limit
Return values
int|false —Returns the number of resources processed, or false if a process lock is active.
whisper_process()
Converts a media file to audio, transcribes it using Whisper, and stores the transcript in a metadata field.
whisper_process(int $resource) : boolThis function:
- Converts the original media file to mono, 16kHz WAV using ffmpeg.
- Runs Whisper transcription with an optional initial prompt.
- Saves the generated text into the configured resource field.
- Optionally adds a generated subtitle file as an alternative file.
- Marks the resource as processed by setting
whisper_processed = 1.
Parameters
- $resource : int
-
The resource ID to process.
Return values
bool —True on successful processing, false if any step fails.
HookYoutube_publishAllInitialise()
HookYoutube_publishAllInitialise() : mixedHookYoutube_publishViewAfterresourceactions()
HookYoutube_publishViewAfterresourceactions() : mixedyoutube_publish_initialize()
youtube_publish_initialize() : mixedget_youtube_authorization_code()
get_youtube_authorization_code() : mixeddelete_youtube_tokens()
delete_youtube_tokens() : mixedupload_video()
upload_video() : mixedyoutube_upload_get_categories()
youtube_upload_get_categories() : mixedHookyt2rsAllInitialise()
Hookyt2rsAllInitialise() : mixedHookyt2rsUpload_batchUpload_page_bottom()
Hookyt2rsUpload_batchUpload_page_bottom() : mixedisValidURL()
isValidURL(mixed $url) : mixedParameters
- $url : mixed
Hookyt2rsViewrenderinnerresourcepreview()
Hookyt2rsViewrenderinnerresourcepreview() : mixedHookyt2rsViewreplacedownloadoptions()
Hookyt2rsViewreplacedownloadoptions() : mixedSearch results