| The Red Matrix

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Pages
Functions | Variables
text.php File Reference

## Functions
| replace_macros ($s, $r)
| random_string ($size=64, $type=RANDOM_STRING_HEX)
| notags ($string)
| escape_tags ($string)
| z_input_filter ($channel_id, $s, $type= 'text/bbcode')
| purify_html ($s)
| autoname ($len)
| xmlify ($str)
| unxmlify ($s)
if(!function_exists('hex2bin')) | paginate (&$a)
| alt_pager (&$a, $i, $more= '', $less= '')
| expand_acl ($s)
| sanitise_acl (&$item)
| perms2str ($p)
| item_message_id ()
| Generate a guaranteed unique (for this domain) item ID for ATOM. More...
| photo_new_resource ()
| Generate a guaranteed unique photo ID. More...
| attribute_contains ($attr, $s)
| logger ($msg, $level=0)
| Logging function for RedMatrix. More...
| dlogger ($msg, $level=0)
| This is a special logging facility for developers. More...
| profiler ($t1, $t2, $label)
| activity_match ($haystack, $needle)
| get_tags ($s)
| tag_sort_length ($a, $b)
| strip_zids ($s)
| qp ($s)
| get_mentions ($item, $tags)
| contact_block ()
| chanlink_hash ($s)
| chanlink_url ($s)
| chanlink_cid ($d)
| magiclink_url ($observer, $myaddr, $url)
| micropro ($contact, $redirect=false, $class= '', $textmode=false)
| search ($s, $id='search-box', $url='/search', $save=false)
| searchbox ($s, $id='search-box', $url='/search', $save=false)
| valid_email ($x)
| linkify ($s)
| sslify ($s)
| get_poke_verbs ()
| get_mood_verbs ()
| list_smilies ()
| smilies ($s, $sample=false)
| smile_shield ($m)
| smile_unshield ($m)
| preg_heart ($x)
| day_translate ($s)
| normalise_link ($url)
| link_compare ($a, $b)
| unobscure (&$item)
| theme_attachments (&$item)
| format_categories (&$item, $writeable)
| format_hashtags (&$item)
| format_mentions (&$item)
| format_filer (&$item)
| generate_map ($coord)
| generate_named_map ($location)
| prepare_body (&$item, $attach=false)
| prepare_text ($text, $content_type= 'text/bbcode')
| zidify_callback ($match)
| zidify_img_callback ($match)
| zidify_links ($s)
| feed_hublinks ()
| feed_salmonlinks ($nick)
| get_plink ($item, $conversation_mode=true)
| unamp ($s)
| layout_select ($channel_id, $current= '')
| mimetype_select ($channel_id, $current= 'text/bbcode')
| lang_selector ()
| return_bytes ($size_str)
| base64url_encode ($s, $strip_padding=true)
| base64url_decode ($s)
| cleardiv ()
| bb_translate_video ($s)
| html2bb_video ($s)
| array_xmlify ($val)
| reltoabs ($text, $base)
| item_post_type ($item)
| undo_post_tagging ($s)
| fix_mce_lf ($s)
| protect_sprintf ($s)
| is_a_date_arg ($s)
| legal_webbie ($s)
| check_webbie ($arr)
| ids_to_querystr ($arr, $idx= 'id')
| xchan_query (&$items, $abook=true, $effective_uid=0)
| xchan_mail_query (&$item)
| find_xchan_in_array ($xchan, $arr)
| get_rel_link ($j, $rel)
| magic_link ($s)
| stringify_array_elms (&$arr, $escape=false)
| jindent ($json)
| json_decode_plus ($s)
| design_tools ()
| in_arrayi ($needle, $haystack)
| normalise_openid ($s)
| extra_query_args ()
| handle_tag ($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag)
| linkify_tags ($a, &$body, $uid)
| getIconFromType ($type)
| returns icon name for use with e.g. font-awesome based on mime-type More...
| userReadableSize ($size)
| Returns a human readable formatted string for filesizes. More...

## Variables
const | RANDOM_STRING_HEX 0x00
const | RANDOM_STRING_TEXT 0x01

## Function Documentation

activity_match | ( |  | $haystack,
|  |  | $needle
| ) |  |

Referenced by Item\add_child(), Conversation\add_thread(), builtin_activity_puller(), conversation(), get_atom_elements(), item_post_type(), localize_item(), remove_community_tag(), and visible_activity().

alt_pager | ( | & | $a,
|  |  | $i,
|  |  | $more = `''`,
|  |  | $less = `''`
| ) |  |

Referenced by channel_content(), directory_content(), home_content(), message_content(), and network_content().

array_xmlify | ( |  | $val | ) |

apply xmlify() to all values of array $val, recursively

Referenced by api_apply_template(), and poco().

attribute_contains | ( |  | $attr,
|  |  | $s
| ) |  |

Referenced by scrape_vcard().

autoname | ( |  | $len | ) |

generate a string that's random, but usually pronounceable. used to generate initial passwords

Parameters

  int | $len |

Returns
  string

Referenced by check_php(), invite_post(), and lostpass_content().

base64url_decode | ( |  | $s | ) |

Referenced by aes_unencapsulate(), consume_feed(), contactgroup_content(), diaspora_decode(), get_atom_elements(), get_item_elements(), group_content(), impel_init(), import_post(), import_site(), import_xchan(), oembed_init(), pemtome(), post_init(), post_post(), process_rating_delivery(), pubrsatome(), share_unshield(), smile_unshield(), sync_directories(), sync_locations(), zfinger_init(), and zot_register_hub().

base64url_encode | ( |  | $s,
|  |  | $strip_padding = `true`
| ) |  |

Referenced by aes_encapsulate(), connedit_post(), consume_feed(), create_identity(), diaspora_decode(), diaspora_msg_build(), diaspora_pubmsg_build(), editblock_content(), editlayout_content(), editwebpage_content(), fix_system_urls(), get_atom_elements(), group_content(), group_side(), identity_basic_export(), import_post(), item_post(), item_store(), item_store_update(), magic_init(), make_xchan_hash(), oembed_iframe(), post_activity_item(), post_post(), prate_post(), random_string(), rate_post(), salmon_key(), share_shield(), smile_shield(), zfinger_init(), zot_build_packet(), zot_fetch(), and zot_new_uid().

bb_translate_video | ( |  | $s | ) |

Referenced by item_post().

chanlink_cid | ( |  | $d | ) |

Referenced by connedit_content().

chanlink_hash | ( |  | $s | ) |

Referenced by item_photo_menu(), mail_content(), message_content(), and micropro().

chanlink_url | ( |  | $s | ) |

Referenced by builtin_activity_puller(), Item\check_wall_to_wall(), connections_content(), directory_content(), fetch_post_tags(), Item\get_template_data(), localize_item(), randprof_init(), suggest_content(), viewconnections_content(), and widget_suggestions().

check_webbie | ( |  | $arr | ) |

Referenced by create_identity(), foofoo(), and new_channel_init().

cleardiv | ( |  | ) |

@ Return a div to clear floats.

Returns
  string

Referenced by common_content(), and match_content().

contact_block | ( |  | ) |

Referenced by profile_sidebar().

day_translate | ( |  | $s | ) |

Referenced by advanced_profile(), cal(), events_content(), format_event_diaspora(), format_event_html(), get_birthdays(), get_events(), list_post_dates(), ping_init(), and posted_dates().

design_tools | ( |  | ) |

Referenced by widget_design_tools().

dlogger | ( |  | $msg,
|  |  | $level = `0`
| ) |  |

This is a special logging facility for developers.

It allows one to target specific things to trace/debug and is identical to logger() with the exception of the log filename. This allows one to isolate specific calls while allowing logger() to paint a bigger picture of overall activity and capture more detail.

If you find dlogger() calls in checked in code, you are free to remove them - so as to provide a noise-free development environment which responds to events you are targetting personally.

Parameters

  string | $msg | Message to log
  int | $level | A log level.

escape_tags | ( |  | $string | ) |

use this on "body" or "content" input where angle chars shouldn't be removed, and allow them to be safely displayed.

Parameters

  string | $string |

Returns
  string

Referenced by admin_page_logs(), app_store(), app_update(), appman_post(), bookmark_add(), chatsvc_post(), connect_post(), connedit_post(), create_identity(), events_post(), fsuggest_post(), get_atom_elements(), item_post(), mail_post(), mail_store(), menu_add_item(), menu_create(), menu_edit(), menu_edit_item(), network_content(), notes_init(), pdledit_post(), poco_load(), post_activity_item(), prate_post(), profiles_post(), rate_post(), rbmark_content(), rbmark_post(), thing_init(), and z_input_filter().

expand_acl | ( |  | $s | ) |

Referenced by collect_recipients(), enumerate_permissions(), file_activity(), lockview_content(), and recursive_activity_recipients().

extra_query_args | ( |  | ) |

Referenced by connections_content(), directory_content(), and photos_content().

feed_hublinks | ( |  | ) |

return atom link elements for all of our hubs

feed_salmonlinks | ( |  | $nick | ) |

find_xchan_in_array | ( |  | $xchan,
|  |  | $arr
| ) |  |

Referenced by private_messages_fetch_conversation(), private_messages_fetch_message(), private_messages_list(), xchan_mail_query(), and xchan_query().

fix_mce_lf | ( |  | $s | ) |

Referenced by profiles_post().

format_categories | ( | & | $item,
|  |  | $writeable
| ) |  |

Referenced by prepare_body().

format_filer | ( | & | $item | ) |

Referenced by prepare_body().

format_hashtags | ( | & | $item | ) |

Referenced by prepare_body().

format_mentions | ( | & | $item | ) |

Referenced by prepare_body().

generate_map | ( |  | $coord | ) |

Referenced by bb_map_coords(), and prepare_body().

generate_named_map | ( |  | $location | ) |

Referenced by bb_map_location().

get_mentions | ( |  | $item,
|  |  | $tags
| ) |  |

get_mood_verbs | ( |  | ) |

Referenced by mood_content(), and mood_init().

get_plink | ( |  | $item,
|  |  | $conversation_mode = `true`
| ) |  |

Referenced by conversation(), and Item\get_template_data().

get_poke_verbs | ( |  | ) |

Referenced by poke_content(), and poke_init().

get_rel_link | ( |  | $j,
|  |  | $rel
| ) |  |

Referenced by localize_item(), remove_community_tag(), sharedwithme_content(), and tag_deliver().

get_tags | ( |  | $s | ) |

Referenced by linkify_tags().

getIconFromType | ( |  | $type | ) |

returns icon name for use with e.g. font-awesome based on mime-type

Parameters

  string | $type |

Returns
  string

Referenced by RedMatrix\RedDAV\RedBrowser\generateDirectoryIndex(), and sharedwithme_content().

handle_tag | ( |  | $a,
|  | & | $body,
|  | & | $access_tag,
|  | & | $str_tags,
|  |  | $profile_uid,
|  |  | $tag
| ) |  |

This function removes the tag $tag from the text $body and replaces it with the appropiate link.

Parameters

  unknown_type | $body | the text to replace the tag in
  unknown_type | $access_tag | - used to return tag ACL exclusions e.g. @!foo
  unknown_type | $str_tags | string to add the tag to
  unknown_type | $profile_uid |
  unknown_type | $tag | the tag to replace

Returns
  boolean true if replaced, false if not replaced

Referenced by linkify_tags().

html2bb_video | ( |  | $s | ) |

Referenced by api_statuses_mediap(), api_statuses_update(), and get_atom_elements().

ids_to_querystr | ( |  | $arr,
|  |  | $idx = `'id'`
| ) |  |

Referenced by channel_content(), display_content(), home_content(), items_fetch(), network_content(), and zot_feed().

in_arrayi | ( |  | $needle,
|  |  | $haystack
| ) |  |

Referenced by directory_content(), and import_directory_profile().

is_a_date_arg | ( |  | $s | ) |

Referenced by channel_content(), and network_content().

item_message_id | ( |  | ) |

Generate a guaranteed unique (for this domain) item ID for ATOM.

Safe from birthday paradox.

Returns
  string a unique id

Referenced by event_store_item(), file_activity(), impel_init(), item_post(), like_content(), mood_init(), photo_upload(), photos_create_item(), post_activity_item(), profile_activity(), and subthread_content().

item_post_type | ( |  | $item | ) |

Referenced by notification().

jindent | ( |  | $json | ) |

Indents a flat JSON string to make it more human-readable.

Parameters

  string | $json | The original JSON string to process.

Returns
  string Indented version of the original JSON string.

json_decode_plus | ( |  | $s | ) |

Referenced by diaspora_send_mail(), editpost_content(), editwebpage_content(), encode_item(), encode_mail(), localize_item(), private_messages_fetch_conversation(), private_messages_fetch_message(), private_messages_list(), remove_community_tag(), tag_deliver(), theme_attachments(), and unobscure().

lang_selector | ( |  | ) |

Referenced by lang_content().

layout_select | ( |  | $channel_id,
|  |  | $current = `''`
| ) |  |

Referenced by editwebpage_content().

legal_webbie | ( |  | $s | ) |

Referenced by check_webbie(), and new_channel_init().

link_compare | ( |  | $a,
|  |  | $b
| ) |  |

Compare two URLs to see if they are the same, but ignore slight but hopefully insignificant differences such as if one is https and the other isn't, or if one is www.something and the other isn't - and also ignore case differences.

Return true if the URLs match, otherwise false.

Referenced by consume_feed(), diaspora_retraction(), pubsub_init(), pubsubhubbub_init(), tag_deliver(), tgroup_check(), and zid().

linkify | ( |  | $s | ) |

Function: linkify

Replace naked text hyperlink with HTML formatted hyperlink

Referenced by advanced_profile(), directory_content(), and profile_sidebar().

linkify_tags | ( |  | $a,
|  | & | $body,
|  |  | $uid
| ) |  |

Referenced by admin_page_site_post(), diaspora_comment(), diaspora_post(), diaspora_reshare(), events_post(), item_post(), mail_post(), photos_post(), and profiles_post().

list_smilies | ( |  | ) |

Referenced by smilies(), and smilies_content().

logger | ( |  | $msg,
|  |  | $level = `0`
| ) |  |

Logging function for RedMatrix.

Logging output is configured through RedMatrix's system config. The log file is set in system logfile, log level in system loglevel and to enable logging set system debugging.

Available constants for log level are LOGGER_NORMAL, LOGGER_TRACE, LOGGER_DEBUG, LOGGER_DATA and LOGGER_ALL.

Since PHP5.4 we get the file, function and line automatically where the logger was caleld, so no need to add it to the message anymore.

Parameters

  string | $msg | Message to log
  int | $level | A log level.

Referenced by account_remove(), account_verify_password(), Item\add_child(), Conversation\add_thread(), admin_content(), admin_page_hubloc_post(), admin_post(), aes_encapsulate(), allowed_public_recips(), api_call(), api_channel_stream(), api_export_basic(), api_favorites(), api_get_user(), api_login(), api_oauth_request_token(), api_statuses_destroy(), api_statuses_mediap(), api_statuses_repeat(), api_statuses_show(), api_statuses_update(), api_statuses_user_timeline(), attach_mkdir(), avatar_img(), base64url_decode(), bb2diaspora_itembody(), bb2diaspora_itemwallwall(), bookmark_add(), bookmarks_init(), build_sync_packet(), channel_remove(), chanview_content(), chat_post(), check_config(), check_form_security_token_ForbiddenOnErr(), check_form_security_token_redirectOnErr(), cloud_init(), connedit_post(), consume_feed(), contact_remove(), conversation(), create_account(), create_identity(), RedMatrix\RedDAV\RedDirectory\createDirectory(), RedMatrix\RedDAV\RedDirectory\createFile(), cronhooks_run(), datetime_convert(), dav_init(), RedMatrix\RedDAV\RedFile\delete(), delete_imported_item(), deliver_run(), detect_language(), diaspora_asphoto(), diaspora_comment(), diaspora_conversation(), diaspora_decode(), diaspora_dispatch(), diaspora_dispatch_public(), diaspora_handle_from_contact(), diaspora_is_blacklisted(), diaspora_like(), diaspora_message(), diaspora_msg_build(), diaspora_photo(), diaspora_post(), diaspora_process_outbound(), diaspora_profile(), diaspora_pubmsg_build(), diaspora_request(), diaspora_reshare(), diaspora_send_followup(), diaspora_send_images(), diaspora_send_mail(), diaspora_send_relay(), diaspora_send_status(), diaspora_share(), diaspora_signed_retraction(), diaspora_transmit(), dir_parse_query(), directory_content(), directory_run(), discover_by_url(), discover_by_webbie(), downgrade_accounts(), email_send(), encode_item(), events_post(), expire_run(), externals_run(), feed_init(), fetch_lrdd_template(), fetch_xrd_links(), filer_content(), filerm_content(), find_diaspora_person_by_handle(), fix_private_photos(), fix_system_urls(), RedMatrix\RedDAV\RedFile\get(), get_atom_elements(), get_diaspora_key(), get_diaspora_reshare_xml(), get_item_elements(), Conversation\get_template_data(), RedMatrix\RedDAV\RedDirectory\getChild(), RedMatrix\RedDAV\RedDirectory\getDir(), group_content(), guess_image_type(), http_status_exit(), hubloc_change_primary(), impel_init(), import_author_rss(), import_author_unknown(), import_author_zot(), import_channel_photo(), import_directory_profile(), import_post(), import_profile_photo(), import_site(), import_xchan(), install_plugin(), item_post(), item_store(), item_store_update(), like_content(), limit_body_size(), load_plugin(), local_dir_update(), local_user(), localize_item(), RedMatrix\RedDAV\RedDirectory\log(), RedMatrix\RedDAV\RedBasicAuth\log(), FKOAuth1\loginUser(), FKOAuthDataStore\lookup_consumer(), FKOAuthDataStore\lookup_token(), magic_init(), mail_post(), mail_store(), menu_edit(), mini_group_select(), mood_init(), FKOAuthDataStore\new_access_token(), new_contact(), new_keypair(), FKOAuthDataStore\new_request_token(), notes_init(), notification(), notifier_run(), old_webfinger(), onedirsync_run(), onepoll_run(), openid_content(), parse_url_content(), parse_xml_string(), photo_init(), photo_upload(), photos_content(), photos_post(), ping_init(), poco(), poco_load(), poke_init(), poller_run(), post_activity_item(), post_init(), post_post(), process_channel_sync_delivery(), process_delivery(), process_location_delivery(), process_mail_delivery(), process_profile_delivery(), process_rating_delivery(), profile_load(), profile_photo_set_profile_perms(), profile_sidebar(), prune_hub_reinstalls(), public_recips(), pubsub_init(), pubsub_post(), pubsubhubbub_init(), RedMatrix\RedDAV\RedFile\put(), dba_mysql\q(), dba_mysqli\q(), dba_postgres\q(), queue_run(), random_profile(), ratenotif_run(), rbmark_post(), receive_post(), red_item_new(), RedChannelList(), RedCollectionData(), RedFileData(), register_content(), reload_plugins(), remote_user(), Item\remove_child(), remove_community_tag(), remove_obsolete_hublocs(), remove_queue_item(), scale_external_images(), scrape_feed(), scrape_vcard(), search_ac_init(), enotify\send(), send_reg_approval_email(), set_linkified_perms(), Conversation\set_mode(), RedMatrix\RedDAV\RedFile\setName(), RedMatrix\RedDAV\RedDirectory\setName(), settings_post(), start_delivery_chain(), store_diaspora_comment_sig(), stream_perms_api_uids(), stream_perms_xchans(), subthread_content(), sync_directories(), sync_locations(), tag_deliver(), tagger_content(), tgroup_check(), uninstall_plugin(), unload_plugin(), update_directory_entry(), update_feed_item(), update_imported_item(), update_queue_time(), RedMatrix\RedDAV\RedBasicAuth\validateUserPass(), verify_email_address(), xml2array(), xml_status(), z_fetch_url(), z_post_url(), zfinger_init(), zid_init(), zot_build_packet(), zot_feed(), zot_fetch(), zot_finger(), zot_gethub(), zot_import(), zot_process_message_request(), zot_process_response(), zot_refresh(), zot_register_hub(), and zotfeed_init().

magic_link | ( |  | $s | ) |

magiclink_url | ( |  | $observer,
|  |  | $myaddr,
|  |  | $url
| ) |  |

Referenced by item_redir_and_replace_images().

micropro | ( |  | $contact,
|  |  | $redirect = `false`,
|  |  | $class = `''`,
|  |  | $textmode = `false`
| ) |  |

Referenced by contact_block().

mimetype_select | ( |  | $channel_id,
|  |  | $current = `'text/bbcode'`
| ) |  |

Referenced by editblock_content(), and editwebpage_content().

normalise_link | ( |  | $url | ) |

Referenced by best_link_url(), conversation(), delegate_content(), item_photo_menu(), link_compare(), tag_deliver(), and tgroup_check().

normalise_openid | ( |  | $s | ) |

Referenced by openid_content().

notags | ( |  | $string | ) |

This is our primary input filter.

The high bit hack only involved some old IE browser, forget which (IE5/Mac?) that had an XSS attack vector due to stripping the high-bit on an 8-bit character after cleansing, and angle chars with the high bit set could get through as markup.

This is now disabled because it was interfering with some legitimate unicode sequences and hopefully there aren't a lot of those browsers left.

Use this on any text input where angle chars are not valid or permitted They will be replaced with safer brackets. This may be filtered further if these are not allowed either.

Parameters

  string | $string | Input string

Returns
  string Filtered string

Referenced by admin_page_logs_post(), admin_page_site_post(), channel_content(), connections_content(), conversation(), create_account(), diaspora_asphoto(), diaspora_comment(), diaspora_conversation(), diaspora_like(), diaspora_message(), diaspora_photo(), diaspora_post(), diaspora_profile(), diaspora_reshare(), diaspora_retraction(), diaspora_signed_retraction(), directory_content(), discover_by_url(), filestorage_post(), follow_init(), get_atom_elements(), get_diaspora_reshare_xml(), group_post(), help_content(), invite_post(), item_post(), item_store(), item_store_update(), like_content(), lostpass_post(), mail_post(), mail_store(), mood_init(), network_content(), oexchange_content(), openid_content(), photos_post(), poco(), poke_init(), post_var(), profiles_post(), pubsub_init(), pubsub_post(), register_post(), sanitise_acl(), settings_post(), setup_content(), setup_post(), subthread_content(), tagger_content(), and xrd_init().

if (!function_exists('hex2bin')) paginate | ( | & | $a | ) |

Referenced by admin_page_channels(), admin_page_users(), connections_content(), match_content(), and viewconnections_content().

perms2str | ( |  | $p | ) |

Referenced by chat_post(), events_post(), file_activity(), filestorage_post(), item_post(), menu_add_item(), menu_edit_item(), photo_upload(), photos_post(), and settings_post().

photo_new_resource | ( |  | ) |

Generate a guaranteed unique photo ID.

Safe from birthday paradox.

Returns
  string a uniqe hash

Referenced by import_channel_photo(), import_profile_photo(), and photo_upload().

preg_heart | ( |  | $x | ) |

prepare_body | ( | & | $item,
|  |  | $attach = `false`
| ) |  |

Referenced by conversation(), email_send(), and Item\get_template_data().

prepare_text | ( |  | $text,
|  |  | $content_type = `'text/bbcode'`
| ) |  |

Referenced by advanced_profile(), api_format_items(), api_format_messages(), api_status_show(), api_users_show(), atom_entry(), check_item_source(), comanche_block(), connect_content(), prepare_body(), search_content(), and widget_random_block().

profiler | ( |  | $t1,
|  |  | $t2,
|  |  | $label
| ) |  |

protect_sprintf | ( |  | $s | ) |

Referenced by acl_init(), api_statuses_mentions(), attach_count_files(), attach_list_files(), channel_content(), chatroom_destroy(), connections_content(), dir_query_build(), dirsearch_content(), file_tag_file_query(), item_permissions_sql(), items_fetch(), menu_list(), menu_list_count(), network_content(), permissions_sql(), photos_list_photos(), public_permissions_sql(), search_ac_init(), search_content(), sync_directories(), and term_query().

purify_html | ( |  | $s | ) |

Referenced by get_atom_elements(), and z_input_filter().

qp | ( |  | $s | ) |

random_string | ( |  | $size = `64`,
|  |  | $type = `RANDOM_STRING_HEX`
| ) |  |

Referenced by aes_encapsulate(), app_store(), attach_mkdir(), attach_store(), bb_parse_crypt(), bbcode(), build_sync_packet(), create_account(), create_identity(), RedMatrix\RedDAV\RedDirectory\createFile(), diaspora_msg_build(), diaspora_transmit(), directory_run(), event_store_event(), fsuggest_post(), group_add(), import_directory_profile(), import_xchan(), item_message_id(), item_store(), local_dir_update(), lostpass_content(), lostpass_post(), magic_init(), mail_store(), notification(), notifier_run(), prepare_body(), process_location_delivery(), profiles_init(), pubsubhubbub_init(), ratenotif_run(), reflect_comment_store(), removeaccount_content(), removeme_content(), send_message(), send_reg_approval_email(), settings_post(), setup_post(), thing_init(), verify_email_address(), and zot_process_message_request().

reltoabs | ( |  | $text,
|  |  | $base
| ) |  |

Referenced by get_atom_elements().

replace_macros | ( |  | $s,
|  |  | $r
| ) |  |

This is our template processor

Parameters

  string | FriendicaSmarty | $s | the string requiring macro substitution, or an instance of FriendicaSmarty
  array | $r | key value pairs (search => replace)

Returns
  string substituted string

Referenced by achievements_content(), admin_content(), admin_page_channels(), admin_page_dbsync(), admin_page_hubloc(), admin_page_logs(), admin_page_plugins(), admin_page_profs(), admin_page_site(), admin_page_summary(), admin_page_themes(), admin_page_users(), advanced_profile(), alt_pager(), api_apply_template(), api_content(), app_render(), appman_content(), apps_content(), apw_form(), blocks_content(), App\build_pagehead(), categories_widget(), channel_content(), chat_content(), check_config(), check_php(), common_content(), common_friends_visitor_widget(), connect_content(), connections_content(), connedit_content(), construct_page(), contact_block(), conversation(), delegate_content(), design_tools(), diaspora_send_followup(), diaspora_send_images(), diaspora_send_mail(), diaspora_send_relay(), diaspora_send_retraction(), diaspora_send_status(), diaspora_share(), diaspora_unshare(), dir_safe_mode(), dir_sort_links(), directory_content(), display_content(), editblock_content(), editlayout_content(), editpost_content(), editwebpage_content(), events_content(), fbrowser_content(), fileas_widget(), filer_content(), filestorage_content(), findpeople_widget(), format_categories(), format_filer(), RedMatrix\RedDAV\RedBrowser\generateDirectoryIndex(), get_birthdays(), Item\get_comment_box(), get_events(), get_feed_for(), group_content(), group_side(), help_content(), home_content(), hostxrd_init(), RedMatrix\RedDAV\RedBrowser\htmlActionsPanel(), identity_selector(), import_content(), invite_content(), lang_selector(), layouts_content(), locs_content(), login(), lostpass_content(), lostpass_post(), mail_content(), manage_content(), match_content(), menu_content(), menu_render(), message_content(), micropro(), mini_group_select(), mitem_content(), mood_content(), nav(), network_content(), new_channel_content(), notification(), notifications_content(), notify_content(), oembed_format_object(), oexchange_init(), opensearch_init(), p_init(), pagelist_widget(), pdledit_content(), photos_album_widget(), photos_content(), poco(), poke_content(), poll_content(), populate_acl(), profile_sidebar(), profiles_content(), rate_content(), ratings_content(), rbmark_content(), redbasic_form(), register_content(), removeaccount_content(), removeme_content(), rmagic_content(), rpost_content(), search(), search_content(), searchbox(), send_reg_approval_email(), send_verification_email(), setup_content(), setup_post(), sharedwithme_content(), siteinfo_content(), sources_content(), suggest_content(), theme_attachments(), thing_content(), uexport_content(), user_allow(), vcard_from_xchan(), verify_email_address(), viewconnections_content(), vote_content(), webpages_content(), widget_affinity(), widget_appselect(), widget_archive(), widget_bookmarkedchats(), widget_chatroom_list(), widget_filer(), widget_follow(), widget_mailmenu(), widget_notes(), widget_savedsearch(), widget_settings_menu(), widget_suggestedchats(), widget_suggestions(), writepages_widget(), and xrd_init().

return_bytes | ( |  | $size_str | ) |

sanitise_acl | ( | & | $item | ) |

search | ( |  | $s,
|  |  | $id = `'search-box'`,
|  |  | $url = `'/search'`,
|  |  | $save = `false`
| ) |  |

Referenced by search_content().

searchbox | ( |  | $s,
|  |  | $id = `'search-box'`,
|  |  | $url = `'/search'`,
|  |  | $save = `false`
| ) |  |

Referenced by widget_savedsearch().

smile_shield | ( |  | $m | ) |

smile_unshield | ( |  | $m | ) |

smilies | ( |  | $s,
|  |  | $sample = `false`
| ) |  |

Function: smilies

Description: Replaces text emoticons with graphical images

: string $s

Returns string

It is expected that this function will be called using HTML text. We will escape text between HTML pre and code blocks, and HTML attributes (such as urls) from being processed.

At a higher level, the bbcode [nosmile] tag can be used to prevent this function from being executed by the prepare_text() routine when preparing bbcode source for HTML display

Referenced by chatsvc_content(), mail_content(), message_content(), and smilies_content().

sslify | ( |  | $s | ) |

sslify($s) Replace media element using http url with https to a local redirector if using https locally

Parameters

  string | $s | Looks for HTML tags containing src elements that are http when we're viewing an https page Typically this throws an insecure content violation in the browser. So we redirect them to a local redirector which uses https and which redirects to the selected content

Returns
  string

Referenced by prepare_body().

stringify_array_elms | ( | & | $arr,
|  |  | $escape = `false`
| ) |  |

Referenced by expand_groups(), get_things(), identity_basic_export(), lockview_content(), notifier_run(), tagadelic(), and zot_import().

strip_zids | ( |  | $s | ) |

Referenced by cloud_init(), dav_init(), red_zrl_callback(), and red_zrlify_img_callback().

tag_sort_length | ( |  | $a,
|  |  | $b
| ) |  |

theme_attachments | ( | & | $item | ) |

Referenced by mail_content(), and prepare_body().

unamp | ( |  | $s | ) |

Referenced by discover_by_webbie().

undo_post_tagging | ( |  | $s | ) |

Referenced by editblock_content(), editlayout_content(), editpost_content(), and editwebpage_content().

unobscure | ( | & | $item | ) |

Referenced by api_format_items(), api_format_messages(), api_status_show(), api_users_show(), prepare_body(), and webpages_content().

unxmlify | ( |  | $s | ) |

Referenced by diaspora_asphoto(), diaspora_comment(), diaspora_conversation(), diaspora_like(), diaspora_message(), diaspora_photo(), diaspora_post(), diaspora_profile(), diaspora_request(), diaspora_reshare(), diaspora_retraction(), diaspora_signed_retraction(), discover_by_url(), filer_content(), get_atom_elements(), and get_diaspora_reshare_xml().

userReadableSize | ( |  | $size | ) |

Returns a human readable formatted string for filesizes.

Parameters

  int | $size | filesize in bytes

Returns
  string

Referenced by RedMatrix\RedDAV\RedBrowser\generateDirectoryIndex(), and sharedwithme_content().

valid_email | ( |  | $x | ) |

Referenced by check_account_email(), invite_post(), and settings_post().

xchan_mail_query | ( | & | $item | ) |

Referenced by notifier_run().

xchan_query | ( | & | $items,
|  |  | $abook = `true`,
|  |  | $effective_uid = `0`
| ) |  |

Referenced by api_format_items(), api_statuses_home_timeline(), api_statuses_public_timeline(), api_statuses_show(), block_content(), channel_content(), display_content(), event_store_item(), events_content(), home_content(), identity_basic_export(), item_post(), items_fetch(), network_content(), notification(), notifier_run(), page_content(), ping_init(), search_content(), share_init(), widget_item(), and zot_feed().

xmlify | ( |  | $str | ) |

escape text ($str) for XML transport

Parameters

  string | $str |

Returns
  string Escaped text.

Referenced by array_xmlify(), atom_author(), atom_entry(), construct_activity_object(), construct_activity_target(), diaspora_post(), diaspora_send_followup(), diaspora_send_images(), diaspora_send_mail(), diaspora_send_relay(), diaspora_send_retraction(), diaspora_send_status(), encode_rel_links(), get_atom_elements(), get_feed_for(), item_getfeedattach(), p_init(), subthread_content(), tagger_content(), and xml_status().

z_input_filter | ( |  | $channel_id,
|  |  | $s,
|  |  | $type = `'text/bbcode'`
| ) |  |

Referenced by item_post(), item_store(), item_store_update(), and post_activity_item().

zidify_callback | ( |  | $match | ) |

zidify_callback() and zidify_links() work together to turn any HTML a tags with class="zrl" into zid links These will typically be generated by a bbcode '[zrl]' tag. This is done inside prepare_text() rather than bbcode() because the latter is used for general purpose conversions and the former is used only when preparing text for immediate display.

Issues: Currently the order of HTML parameters in the text is somewhat rigid and inflexible. We assume it looks like and will not work if zrl and href appear in a different order.

zidify_img_callback | ( |  | $match | ) |

zidify_links | ( |  | $s | ) |

Referenced by notification().

## Variable Documentation

const RANDOM_STRING_HEX 0x00

const RANDOM_STRING_TEXT 0x01

Referenced by aes_encapsulate(), and random_string().