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

Functions

 replace_macros ($s, $r)
 This is our template processor. More...
 
 random_string ($size=64, $type=RANDOM_STRING_HEX)
 Generates a random string. More...
 
 notags ($string)
 This is our primary input filter. More...
 
 escape_tags ($string)
 
 z_input_filter ($s, $type= 'text/bbcode', $allow_code=false)
 
 purify_html ($s, $allow_position=false)
 Use HTMLPurifier to get standards compliant HTML. More...
 
 autoname ($len)
 generate a string that's random, but usually pronounceable. More...
 
 xmlify ($str)
 escape text ($str) for XML transport More...
 
 unxmlify ($s)
 Undo an xmlify. More...
 
 paginate (&$a)
 Automatic pagination. More...
 
 alt_pager (&$a, $i, $more= '', $less= '')
 
 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)
 for html,xml parsing - let's say you've got an attribute foobar="class1 class2 class3" and you want to find out if it contains 'class3'. you can't use a normal sub string search because you might match 'notclass3' and a regex to do the job is possible but a bit complicated. More...
 
 logger ($msg, $level=LOGGER_NORMAL, $priority=LOG_INFO)
 Logging function for Hubzilla. More...
 
 btlogger ($msg, $level=LOGGER_NORMAL, $priority=LOG_INFO)
 like logger() but with a function backtrace to pinpoint certain classes of problems which show up deep in the calling stack. More...
 
 log_priority_str ($priority)
 
 dlogger ($msg, $level=0)
 This is a special logging facility for developers. More...
 
 profiler ($t1, $t2, $label)
 
 activity_match ($haystack, $needle)
 
 get_tags ($s)
 Pull out all #hashtags and @person tags from $s. More...
 
 tag_sort_length ($a, $b)
 
 total_sort ($a, $b)
 
 qp ($s)
 Quick and dirty quoted_printable encoding. More...
 
 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)
 
 linkify ($s, $me=false)
 Replace naked text hyperlink with HTML formatted hyperlink. More...
 
 sslify ($s)
 Replace media element using http url with https to a local redirector if using https locally. More...
 
 get_poke_verbs ()
 
 get_mood_verbs ()
 
 list_smilies ($default_only=false)
 Function to list all smilies, both internal and from addons. More...
 
 smilies ($s, $sample=false)
 Replaces text emoticons with graphical images. More...
 
 smile_shield ($m)
 
 smile_unshield ($m)
 
 preg_heart ($x)
 Expand <3333 to the correct number of hearts. More...
 
 day_translate ($s)
 
 normalise_link ($url)
 normalises a string. More...
 
 link_compare ($a, $b)
 Compare two URLs to see if they are the same. More...
 
 unobscure (&$item)
 
 unobscure_mail (&$item)
 
 theme_attachments (&$item)
 
 format_categories (&$item, $writeable)
 
 format_hashtags (&$item)
 Add any hashtags which weren't mentioned in the message body, e.g. community tags. More...
 
 format_mentions (&$item)
 
 format_filer (&$item)
 
 generate_map ($coord)
 
 generate_named_map ($location)
 
 prepare_body (&$item, $attach=false)
 
 prepare_binary ($item)
 
 prepare_text ($text, $content_type= 'text/bbcode', $cache=false)
 Given a text string, convert from bbcode to html and add smilie icons. More...
 
 create_export_photo_body (&$item)
 
 feed_hublinks ()
 Return atom link elements for all of our hubs. More...
 
 feed_salmonlinks ($nick)
 Return atom link elements for salmon endpoints. More...
 
 get_plink ($item, $conversation_mode=true)
 
 unamp ($s)
 
 layout_select ($channel_id, $current= '')
 
 mimetype_select ($channel_id, $current= 'text/bbcode', $choices=null, $element= 'mimetype')
 
 engr_units_to_bytes ($size_str)
 
 base64url_encode ($s, $strip_padding=true)
 
 base64url_decode ($s)
 
 base64special_encode ($s, $strip_padding=true)
 
 base64special_decode ($s)
 
 cleardiv ()
 Return a div to clear floats. More...
 
 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)
 
 legal_webbie_text ()
 
 check_webbie ($arr)
 
 ids_to_array ($arr, $idx= 'id')
 
 ids_to_querystr ($arr, $idx= 'id', $quote=false)
 
 xchan_query (&$items, $abook=true, $effective_uid=0)
 Fetches xchan and hubloc data for an array of items with only an author_xchan and owner_xchan. More...
 
 xchan_mail_query (&$item)
 
 find_xchan_in_array ($xchan, $arr)
 
 get_rel_link ($j, $rel)
 
 magic_link ($s)
 
 stringify_array_elms (&$arr, $escape=false)
 If $escape is true, dbesc() each element before adding quotes. More...
 
 jindent ($json)
 Indents a flat JSON string to make it more human-readable. More...
 
 design_tools ()
 Creates navigation menu for webpage, layout, blocks, menu sites. More...
 
 website_portation_tools ()
 Creates website portation tools menu. More...
 
 in_arrayi ($needle, $haystack)
 case insensitive in_array() More...
 
 normalise_openid ($s)
 
 extra_query_args ()
 
 handle_tag ($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag, $diaspora=false)
 This function removes the tag $tag from the text $body and replaces it with the appropiate link. More...
 
 linkify_tags ($a, &$body, $uid, $diaspora=false)
 
 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...
 
 str_rot47 ($str)
 
 string_replace ($old, $new, &$s)
 
 json_url_replace ($old, $new, &$s)
 
 item_url_replace ($channel, &$item, $old, $new, $oldnick= '')
 
 sanitise_acl (&$item)
 Used to wrap ACL elements in angle brackets for storage. More...
 
 perms2str ($p)
 Convert an ACL array to a storable string. More...
 
 expand_acl ($s)
 Turn user/group ACLs stored as angle bracketed text into arrays. More...
 
 acl2json ($s)
 
 pdl_selector ($uid, $current='')
 When editing a webpage - a dropdown is needed to select a page layout. More...
 
 flatten_array_recursive ($arr)
 returns a one-dimensional array from a multi-dimensional array empty values are discarded More...
 
 text_highlight ($s, $lang)
 Highlight Text. More...
 
 arrtoxml ($root_elem, $arr)
 
 array2XML ($obj, $array)
 
 create_table_from_array ($table, $arr)
 Inserts an array into $table. More...
 
 share_shield ($m)
 
 share_unshield ($m)
 
 cleanup_bbcode ($body)
 
 gen_link_id ($mid)
 
 array_trim (&$v, $k)
 
 array_escape_tags (&$v, $k)
 
 ellipsify ($s, $maxlen)
 
 purify_filename ($s)
 

Variables

const RANDOM_STRING_HEX 0x00
 
const RANDOM_STRING_TEXT 0x01
 

Function Documentation

array2XML (   $obj,
  $array 
)

Referenced by arrtoxml().

array_escape_tags ( $v,
  $k 
)
array_trim ( $v,
  $k 
)
array_xmlify (   $val)

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

Referenced by poco().

arrtoxml (   $root_elem,
  $arr 
)

Referenced by api_apply_template().

attribute_contains (   $attr,
  $s 
)

for html,xml parsing - let's say you've got an attribute foobar="class1 class2 class3" and you want to find out if it contains 'class3'. you can't use a normal sub string search because you might match 'notclass3' and a regex to do the job is possible but a bit complicated.

pass the attribute string as $attr and the attribute you are looking for as $s - returns true if found, otherwise false

Parameters
string$attrattribute string
string$sattribute you are looking for
Returns
boolean true if found

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 Zotlabs\Module\Setup\check_php(), Zotlabs\Module\Lostpass\get(), Zotlabs\Module\Settings\Tokens\get(), and Zotlabs\Module\Invite\get().

base64special_decode (   $s)

Referenced by smile_unshield().

base64special_encode (   $s,
  $strip_padding = true 
)

Referenced by smile_shield().

bb_translate_video (   $s)

Referenced by cleanup_bbcode().

btlogger (   $msg,
  $level = LOGGER_NORMAL,
  $priority = LOG_INFO 
)

like logger() but with a function backtrace to pinpoint certain classes of problems which show up deep in the calling stack.

Parameters
string$msgMessage to log
int$levelA log level
int$priority- compatible with syslog

Referenced by Zotlabs\Access\Permissions\FilledPerms(), Zotlabs\Lib\PConfig\Load(), markdown_to_bb(), rsa_verify(), Zotlabs\Lib\PConfig\Set(), and xmlify().

chanlink_cid (   $d)
cleanup_bbcode (   $body)

fix naked links by passing through a callback to see if this is a hubzilla site (already known to us) which will get a zrl, otherwise link with url, add bookmark tag to both. First protect any url inside certain bbcode tags so we don't double link it.

Fold multi-line [code] sequences

Referenced by Zotlabs\Module\Mail\post(), Zotlabs\Module\Item\post(), and send_message().

cleardiv ( )

Return a div to clear floats.

Returns
string
contact_block ( )

Referenced by profile_sidebar().

create_export_photo_body ( $item)

Referenced by atom_entry().

design_tools ( )

Creates navigation menu for webpage, layout, blocks, menu sites.

Returns
string with parsed HTML

Referenced by Zotlabs\Widget\Design_tools\widget().

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$msgMessage to log
int$levelA log level.
ellipsify (   $s,
  $maxlen 
)

Referenced by photos_albums_list().

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 api_client_register(), Zotlabs\Lib\Apps\app_feature(), Zotlabs\Lib\Apps\app_store(), Zotlabs\Lib\Apps\app_update(), array_escape_tags(), bookmark_add(), Zotlabs\Lib\NativeWikiPage\commit(), Zotlabs\Lib\NativeWikiPage\convert_links(), create_identity(), Zotlabs\Widget\Wiki_pages\create_missing_page(), Zotlabs\Lib\NativeWikiPage\create_page(), decode_item_meta(), Zotlabs\Module\Dreport\get(), Zotlabs\Module\Viewsrc\get(), Zotlabs\Module\Apps\get(), Zotlabs\Module\Pubstream\get(), Zotlabs\Module\Articles\get(), Zotlabs\Module\Cards\get(), Zotlabs\Module\Network\get(), Zotlabs\Module\Admin\Logs\get(), Zotlabs\Module\Pconfig\get(), Zotlabs\Module\Rbmark\get(), get_atom_elements(), get_plugin_info(), get_vcard_array(), Zotlabs\Lib\NativeWiki\get_wiki(), import_apps(), import_menus(), Zotlabs\Module\Notes\init(), Zotlabs\Module\Feed\init(), Zotlabs\Module\Page\init(), Zotlabs\Module\Ofeed\init(), Zotlabs\Module\Impel\init(), Zotlabs\Module\Thing\init(), Zotlabs\Lib\NativeWiki\listwikis(), mail_store(), menu_add_item(), menu_create(), menu_edit(), menu_edit_item(), Zotlabs\Lib\NativeWikiPage\page_list(), Zotlabs\Module\Pconfig\pconfig_form(), poco_load(), Zotlabs\Module\Pdledit\post(), Zotlabs\Module\Settings\Permcats\post(), Zotlabs\Module\Settings\Tokens\post(), Zotlabs\Module\Pconfig\post(), Zotlabs\Module\Settings\Channel\post(), Zotlabs\Module\Appman\post(), Zotlabs\Module\Events\post(), Zotlabs\Module\Mail\post(), Zotlabs\Module\Prate\post(), Zotlabs\Module\Item\post(), Zotlabs\Module\Rbmark\post(), Zotlabs\Module\Chatsvc\post(), Zotlabs\Module\Connect\post(), Zotlabs\Module\Tasks\post(), Zotlabs\Module\Rate\post(), Zotlabs\Module\Connedit\post(), Zotlabs\Module\Profiles\post(), Zotlabs\Module\Wiki\post(), post_activity_item(), prepare_text(), Zotlabs\Lib\NativeWikiPage\rename_page(), sync_apps(), sync_menus(), and z_input_filter().

expand_acl (   $s)

Turn user/group ACLs stored as angle bracketed text into arrays.

turn string array of angle-bracketed elements into string array e.g. "<123xyz><246qyo><sxo33e>" => array(123xyz,246qyo,sxo33e);

Parameters
string$s
Returns
array

Referenced by acl2json(), attach_recursive_perms(), collect_recipients(), enumerate_permissions(), file_activity(), Zotlabs\Module\Lockview\get(), Zotlabs\Module\File_upload\post(), and Zotlabs\Module\Photos\post().

extra_query_args ( )

Used in ajax endless scroll request to find out all the args that the master page was viewing. This was using $_REQUEST, but $_REQUEST also contains all your cookies. So we're restricting it to $_GET and $_POST.

Returns
string with additional URL parameters

Referenced by Zotlabs\Module\Viewconnections\get(), Zotlabs\Module\Connections\get(), Zotlabs\Module\Directory\get(), and Zotlabs\Module\Photos\get().

feed_hublinks ( )

Return atom link elements for all of our hubs.

Returns
string
feed_salmonlinks (   $nick)

Return atom link elements for salmon endpoints.

Parameters
string$nick
Returns
string
fix_mce_lf (   $s)
flatten_array_recursive (   $arr)

returns a one-dimensional array from a multi-dimensional array empty values are discarded

example: print_r(flatten_array_recursive(array('foo','bar',array('baz','blip',array('zob','glob')),'','grip')));

Array ( [0] => foo [1] => bar [2] => baz [3] => blip [4] => zob [5] => glob [6] => grip )

Parameters
array$arrmulti-dimensional array
Returns
one-dimensional array

Referenced by proc_run().

format_categories ( $item,
  $writeable 
)

Referenced by prepare_body().

format_filer ( $item)

Referenced by prepare_body().

format_hashtags ( $item)

Add any hashtags which weren't mentioned in the message body, e.g. community tags.

Parameters
[in]array&$item
Returns
string HTML link of hashtag

Referenced by prepare_body().

format_mentions ( $item)

Referenced by prepare_body().

generate_map (   $coord)

Referenced by prepare_body().

generate_named_map (   $location)
get_mentions (   $item,
  $tags 
)
get_mood_verbs ( )
get_plink (   $item,
  $conversation_mode = true 
)
get_poke_verbs ( )
get_rel_link (   $j,
  $rel 
)
get_tags (   $s)

Pull out all #hashtags and @person tags from $s.

We also get @person@domain.com - which would make the regex quite complicated as tags can also end a sentence. So we'll run through our results and strip the period from any tags which end with one.

Parameters
string$s
Returns
Returns array of tags found, or empty array.

Referenced by linkify_tags().

getIconFromType (   $type)

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

These are the the font-awesome names of version 3.2.1. The newer font-awesome 4 has different names.

Parameters
string$typemime type
Returns
string
Todo:
rename to get_icon_from_type()

Referenced by Zotlabs\Module\Sharedwithme\get(), and theme_attachments().

handle_tag (   $a,
$body,
$access_tag,
$str_tags,
  $profile_uid,
  $tag,
  $diaspora = false 
)

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

Parameters
App$a
[in,out]string&$bodythe text to replace the tag in
[in,out]string&$access_tagused to return tag ACL exclusions e.g. @!foo
[in,out]string&$str_tagsstring to add the tag to
int$profile_uid
string$tagthe tag to replace
boolean$diasporadefault false
Returns
boolean true if replaced, false if not replaced

Referenced by linkify_tags().

html2bb_video (   $s)

Referenced by get_atom_elements().

ids_to_array (   $arr,
  $idx = 'id' 
)
in_arrayi (   $needle,
  $haystack 
)

case insensitive in_array()

Parameters
string$needle
array$haystack
Returns
boolean

Referenced by Zotlabs\Module\Directory\get(), and import_directory_profile().

is_a_date_arg (   $s)
item_post_type (   $item)
item_url_replace (   $channel,
$item,
  $old,
  $new,
  $oldnick = '' 
)

Referenced by import_items().

jindent (   $json)

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

Parameters
string$jsonThe original JSON string to process.
Returns
string Indented version of the original JSON string.

Referenced by text_highlight().

json_url_replace (   $old,
  $new,
$s 
)

Referenced by item_url_replace().

layout_select (   $channel_id,
  $current = '' 
)
legal_webbie (   $s)
legal_webbie_text ( )
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.

See Also
normalise_link()
Parameters
string$a
string$b
Returns
true if the URLs match, otherwise false

Referenced by consume_feed(), tag_deliver(), tgroup_check(), and zid().

linkify (   $s,
  $me = false 
)

Replace naked text hyperlink with HTML formatted hyperlink.

Parameters
string$s
boolean$me(optional) default false
Returns
string

Referenced by advanced_profile(), Zotlabs\Module\Directory\get(), and profile_sidebar().

list_smilies (   $default_only = false)

Function to list all smilies, both internal and from addons.

Returns
Returns array with keys 'texts' and 'icons'

Referenced by Zotlabs\Module\Smilies\get(), and smilies().

log_priority_str (   $priority)

Referenced by btlogger(), and logger().

logger (   $msg,
  $level = LOGGER_NORMAL,
  $priority = LOG_INFO 
)

Logging function for Hubzilla.

Logging output is configured through Hubzilla'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 called, so no need to add it to the message anymore.

Parameters
string$msgMessage to log
int$levelA log level
int$priority- compatible with syslog

Referenced by Zotlabs\Lib\DB_Upgrade\__construct(), Zotlabs\Storage\GitRepo\__construct(), Zotlabs\Zot\Auth\__construct(), Zotlabs\Web\Router\__construct(), account_remove(), account_verify_password(), Zotlabs\Lib\ThreadItem\add_child(), Zotlabs\Lib\ThreadStream\add_thread(), aes_encapsulate(), allowed_public_recips(), anon_identity_init(), api_attach_list(), api_call(), api_channel_stream(), api_export_basic(), api_login(), api_network_stream(), api_oauth_request_token(), api_red_xchan(), api_zot_abook_xchan(), attach_mkdir(), attach_mkdirp(), attach_store(), base64special_decode(), base64url_decode(), bookmark_add(), btlogger(), build_sync_packet(), channel_remove(), check_config(), check_form_security_token_ForbiddenOnErr(), check_form_security_token_redirectOnErr(), check_plugin_versions(), check_zotinfo(), consume_feed(), contact_remove(), conversation(), convert_salmon_key(), copy_folder_to_cloudfiles(), copy_of_pubitem(), create_account(), create_identity(), Zotlabs\Lib\NativeWikiPage\create_page(), datetime_convert(), Zotlabs\Render\Theme\debug(), delete_imported_item(), delete_item_lowlevel(), detect_language(), Zotlabs\Module\Dirsearch\dir_parse_query(), discover_by_url(), discover_by_webbie(), do_delivery(), downgrade_accounts(), encode_item(), event_import_ical(), event_import_ical_task(), feed_conversation_fetch(), feed_meta(), fetch_lrdd_template(), Zotlabs\Lib\ActivityStreams\fetch_property(), fetch_xrd_links(), find_folder_hash_by_attach_hash(), fix_private_photos(), fix_system_urls(), Zotlabs\Lib\PermissionDescription\fromGlobalPermission(), Zotlabs\Lib\PermissionDescription\fromStandalonePermission(), Zotlabs\Module\Filerm\get(), Zotlabs\Module\Chanview\get(), Zotlabs\Module\Linkinfo\get(), Zotlabs\Module\Filer\get(), Zotlabs\Module\Like\get(), Zotlabs\Module\Subthread\get(), Zotlabs\Module\Tagger\get(), Zotlabs\Module\Wiki\get(), Zotlabs\Module\Admin\get(), Zotlabs\Module\Directory\get(), Zotlabs\Module\Group\get(), Zotlabs\Module\Register\get(), get_atom_elements(), get_item_elements(), Zotlabs\Lib\ThreadStream\get_template_data(), get_zcard(), get_zcard_embed(), Zotlabs\Zot\Auth\GetHublocs(), guess_image_type(), html2markdown(), http_status(), hubloc_change_primary(), Zotlabs\Module\Import\import_account(), import_author_rss(), import_author_unknown(), import_author_zot(), import_channel(), import_channel_photo(), import_directory_profile(), import_hublocs(), import_site(), import_xchan(), import_xchan_photo(), Zotlabs\Module\Hostxrd\init(), Zotlabs\Module\Bookmarks\init(), Zotlabs\Module\Hcard\init(), Zotlabs\Module\Notes\init(), Zotlabs\Module\Siteinfo\init(), Zotlabs\Module\Well_known\init(), Zotlabs\Module\Search_ac\init(), Zotlabs\Module\Magic\init(), Zotlabs\Module\Wfinger\init(), Zotlabs\Module\Wall_attach\init(), Zotlabs\Module\Xrd\init(), Zotlabs\Module\Zotfeed\init(), Zotlabs\Module\Feed\init(), Zotlabs\Module\Impel\init(), Zotlabs\Module\Cdav\init(), Zotlabs\Module\Ofeed\init(), Zotlabs\Module\Photo\init(), Zotlabs\Module\Mood\init(), Zotlabs\Module\Oep\init(), Zotlabs\Web\Session\init(), Zotlabs\Module\Ping\init(), Zotlabs\Module\Acl\init(), Zotlabs\Module\Poke\init(), install_plugin(), item_store(), item_store_update(), jsonld_document_loader(), limit_body_size(), load_plugin(), local_dir_update(), localize_item(), ZotOAuth1\loginUser(), ZotOAuth1DataStore\lookup_consumer(), ZotOAuth1DataStore\lookup_token(), mail_store(), menu_edit(), mini_group_select(), ZotOAuth1DataStore\new_access_token(), new_contact(), Zotlabs\Web\Session\new_cookie(), new_keypair(), ZotOAuth1DataStore\new_request_token(), Zotlabs\Lib\LDSignatures\normalise(), oembed_action(), oembed_fetch_url(), oembed_process(), Zotlabs\Module\Oep\oep_display_reply(), old_webfinger(), other_encapsulate(), owt_init(), parse_vobject(), parse_xml_string(), photo_factory(), photo_upload(), poco(), poco_load(), Zotlabs\Module\Admin\Features\post(), Zotlabs\Module\File_upload\post(), Zotlabs\Module\Settings\Display\post(), Zotlabs\Module\Events\post(), Zotlabs\Module\Import_items\post(), Zotlabs\Module\Admin\Plugins\post(), Zotlabs\Module\Mail\post(), Zotlabs\Module\Admin\post(), Zotlabs\Module\Getfile\post(), Zotlabs\Module\Rbmark\post(), Zotlabs\Module\Item\post(), Zotlabs\Module\Cover_photo\post(), Zotlabs\Module\Chat\post(), Zotlabs\Module\Profile_photo\post(), Zotlabs\Module\Photos\post(), Zotlabs\Module\Webpages\post(), Zotlabs\Module\Wiki\post(), post_activity_item(), proc_run(), process_channel_sync_delivery(), process_delivery(), process_feed_tombstones(), process_location_delivery(), process_mail_delivery(), process_profile_delivery(), process_rating_delivery(), process_salmon_feed(), profile_load(), profile_photo_set_profile_perms(), prune_hub_reinstalls(), public_recips(), dba_mysql\q(), queue_deliver(), queue_set_delivered(), random_profile(), red_item(), Zotlabs\Daemon\Master\Release(), reload_plugins(), Zotlabs\Lib\ThreadItem\remove_child(), remove_community_tag(), remove_obsolete_hublocs(), remove_queue_by_posturl(), remove_queue_item(), Zotlabs\Web\Session\return_check(), rsa_verify(), Zotlabs\Daemon\Cron\run(), Zotlabs\Daemon\Importfile\run(), Zotlabs\Daemon\Poller\run(), Zotlabs\Daemon\Cronhooks\run(), Zotlabs\Daemon\Cron_daily\run(), Zotlabs\Daemon\Cron_weekly\run(), Zotlabs\Daemon\Expire\run(), Zotlabs\Daemon\Checksites\run(), Zotlabs\Daemon\Queue\run(), Zotlabs\Daemon\Onedirsync\run(), Zotlabs\Daemon\Onepoll\run(), Zotlabs\Daemon\Externals\run(), Zotlabs\Daemon\Deliver\run(), Zotlabs\Daemon\Ratenotif\run(), Zotlabs\Daemon\Directory\run(), Zotlabs\Zot\Finger\run(), Zotlabs\Daemon\Notifier\run(), photo_driver\save(), scale_external_images(), scan_webpage_elements(), scrape_feed(), scrape_vcard(), Zotlabs\Lib\Enotify\send(), send_reg_approval_email(), set_linkified_perms(), Zotlabs\Lib\ThreadStream\set_mode(), start_delivery_chain(), stream_perms_api_uids(), stream_perms_xchans(), Zotlabs\Lib\Enotify\submit(), sync_directories(), sync_files(), sync_locations(), tag_deliver(), tgroup_check(), Zotlabs\Thumbs\Video\Thumb(), Zotlabs\Thumbs\Pdf\Thumb(), uninstall_plugin(), unload_plugin(), update_directory_entry(), update_imported_item(), update_queue_item(), Zotlabs\Lib\LDSignatures\verify(), Zotlabs\Web\HTTPSig\verify(), Zotlabs\Zot\Auth\Verify(), verify_email_address(), webfinger_rfc7033(), xchan_store(), xml2array(), z_fetch_url(), z_mail(), z_post_url(), zid_init(), zot_build_packet(), zot_feed(), zot_fetch(), zot_gethub(), zot_import(), zot_item_update(), zot_process_response(), zot_refresh(), zot_register_hub(), zot_reply_auth_check(), zot_reply_message_request(), zot_reply_notify(), zot_reply_pickup(), zot_reply_ping(), and zotinfo().

magic_link (   $s)
magiclink_url (   $observer,
  $myaddr,
  $url 
)
micropro (   $contact,
  $redirect = false,
  $class = '',
  $textmode = false 
)

Referenced by contact_block().

mimetype_select (   $channel_id,
  $current = 'text/bbcode',
  $choices = null,
  $element = 'mimetype' 
)
normalise_link (   $url)

normalises a string.

Parameters
string$url
Returns
string

Referenced by best_link_url(), link_compare(), tag_deliver(), tgroup_check(), and thread_author_menu().

normalise_openid (   $s)
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$stringInput string
Returns
string Filtered string

Referenced by channel_apps(), conversation(), create_account(), discover_by_url(), feed_get_reshare(), Zotlabs\Module\Subthread\get(), Zotlabs\Module\Tagger\get(), Zotlabs\Module\Like\get(), Zotlabs\Module\Help\get(), Zotlabs\Module\Oexchange\get(), Zotlabs\Module\Connections\get(), Zotlabs\Module\Network\get(), Zotlabs\Module\Directory\get(), Zotlabs\Module\Channel\get(), Zotlabs\Module\Setup\get(), get_atom_elements(), get_dirpath_by_cloudpath(), get_help_content(), Zotlabs\Module\Xrd\init(), Zotlabs\Module\Follow\init(), Zotlabs\Module\Mood\init(), Zotlabs\Module\Poke\init(), item_store(), item_store_update(), mail_store(), poco(), Zotlabs\Module\Settings\Account\post(), Zotlabs\Module\Admin\Security\post(), Zotlabs\Module\Lostpass\post(), Zotlabs\Module\Filestorage\post(), Zotlabs\Module\Group\post(), Zotlabs\Module\Settings\Channel\post(), Zotlabs\Module\Settings\Display\post(), Zotlabs\Module\Admin\Site\post(), Zotlabs\Module\Events\post(), Zotlabs\Module\Invite\post(), Zotlabs\Module\Mail\post(), Zotlabs\Module\Admin\Logs\post(), Zotlabs\Module\Item\post(), Zotlabs\Module\Register\post(), Zotlabs\Module\Photos\post(), Zotlabs\Module\Profiles\post(), and sanitise_acl().

paginate ( $a)

Automatic pagination.

To use, get the count of total items. Then call App::set_pager_total($number_items); Optionally call App::set_pager_itemspage($n) to the number of items to display on each page Then call paginate($a) after the end of the display loop to insert the pager block on the page (assuming there are enough items to paginate). When using with SQL, the setting LIMIT d, d => App::$pager['start'],App::$pager['itemspage'] will limit the results to the correct items for the current page. The actual page handling is then accomplished at the application layer.

Parameters
App&$a

Referenced by Zotlabs\Module\Connections\get(), Zotlabs\Module\Admin\Channels\get(), and Zotlabs\Module\Admin\Accounts\get().

pdl_selector (   $uid,
  $current = '' 
)

When editing a webpage - a dropdown is needed to select a page layout.

On submit, the pdl_select value (which is the mid of an item with item_type = ITEM_TYPE_PDL) is stored in the webpage's resource_id, with resource_type 'pdl'.

Then when displaying a webpage, we can see if it has a pdl attached. If not we'll use the default site/page layout.

If it has a pdl we'll load it as we know the mid and pass the body through comanche_parser() which will generate the page layout from the given description

Fixme:
  • there is apparently a very similar function called layout_select; this one should probably take precedence and the other should be checked for compatibility and removed
Parameters
int$uid
string$current
Returns
string HTML code for dropdown
perms2str (   $p)

Convert an ACL array to a storable string.

Parameters
array$p
Returns
array

Referenced by attach_store(), file_activity(), and Zotlabs\Module\File_upload\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_xchan_photo(), photo_upload(), Zotlabs\Module\Cover_photo\post(), and Zotlabs\Module\Profile_photo\post().

preg_heart (   $x)

Expand <3333 to the correct number of hearts.

Parameters
array$x
prepare_binary (   $item)

Referenced by prepare_body().

prepare_body ( $item,
  $attach = false 
)
prepare_text (   $text,
  $content_type = 'text/bbcode',
  $cache = false 
)

Given a text string, convert from bbcode to html and add smilie icons.

Parameters
string$text
sting$content_type(optional) default text/bbcode
boolean$cache(optional) default false
Returns
string

Referenced by advanced_profile(), atom_entry(), Zotlabs\Render\Comanche\block(), check_item_source(), Zotlabs\Module\Search\get(), Zotlabs\Module\Connect\get(), post_is_importable(), prepare_body(), store_doc_file(), and Zotlabs\Widget\Random_block\widget().

profiler (   $t1,
  $t2,
  $label 
)
purify_filename (   $s)
purify_html (   $s,
  $allow_position = false 
)

Use HTMLPurifier to get standards compliant HTML.

Use the HTMLPurifier library to get filtered and standards compliant HTML.

See Also
HTMLPurifier
Parameters
string$sraw HTML
boolean$allow_positionallow CSS position
Returns
string standards compliant filtered HTML
Fixme:
this function has html output, not bbcode - so safely purify these require_once('include/html2bbcode.php'); $s = html2bb_video($s); $s = oembed_html2bbcode($s);

Referenced by feed_get_reshare(), get_atom_elements(), oembed_fetch_url(), Zotlabs\Lib\MarkdownSoap\purify(), and z_input_filter().

qp (   $s)

Quick and dirty quoted_printable encoding.

Parameters
string$s
Returns
string
random_string (   $size = 64,
  $type = RANDOM_STRING_HEX 
)
reltoabs (   $text,
  $base 
)

Referenced by get_atom_elements().

replace_macros (   $s,
  $r 
)

This is our template processor.

Parameters
string | SmartyEngine$sthe string requiring macro substitution, or an instance of SmartyEngine
array$rkey value pairs (search => replace)
Returns
string substituted string

Referenced by Zotlabs\Lib\DB_Upgrade\__construct(), Zotlabs\Web\Router\__construct(), account_allow(), Zotlabs\Module\Admin\admin_page_summary(), advanced_profile(), alt_pager(), Zotlabs\Lib\Apps\app_render(), articlecategories_widget(), App\build_pagehead(), cardcategories_widget(), categories_widget(), cert_bad_email(), channel_apps(), check_cron_broken(), Zotlabs\Module\Setup\check_php(), common_friends_visitor_widget(), construct_page(), contact_block(), conversation(), Zotlabs\Module\Cover_photo\cover_photo_crop_ui_head(), Zotlabs\Widget\Wiki_pages\create_missing_page(), datetimesel(), design_tools(), dir_sort_links(), dob(), Zotlabs\Module\Embedphotos\embedphotos_widget_album(), fileas_widget(), findpeople_widget(), Zotlabs\Theme\RedbasicConfig\form(), format_categories(), format_event_obj(), format_filer(), Zotlabs\Module\Dreport\get(), Zotlabs\Module\Achievements\get(), Zotlabs\Module\Manage\get(), Zotlabs\Module\Notifications\get(), Zotlabs\Module\Chanview\get(), Zotlabs\Module\Apps\get(), Zotlabs\Module\Pubstream\get(), Zotlabs\Module\Article_edit\get(), Zotlabs\Module\Card_edit\get(), Zotlabs\Module\Admin\Queue\get(), Zotlabs\Module\Admin\Dbsync\get(), Zotlabs\Module\Editpost\get(), Zotlabs\Module\Filer\get(), Zotlabs\Module\Search\get(), Zotlabs\Module\Apporder\get(), Zotlabs\Module\Display\get(), Zotlabs\Module\Sharedwithme\get(), Zotlabs\Module\Siteinfo\get(), Zotlabs\Module\Fbrowser\get(), Zotlabs\Module\Help\get(), Zotlabs\Module\Viewconnections\get(), Zotlabs\Module\Articles\get(), Zotlabs\Module\Cards\get(), Zotlabs\Module\Connections\get(), Zotlabs\Module\Suggest\get(), Zotlabs\Module\Pdledit\get(), Zotlabs\Module\Common\get(), Zotlabs\Module\Editblock\get(), Zotlabs\Module\Editlayout\get(), Zotlabs\Module\Layouts\get(), Zotlabs\Module\Editwebpage\get(), Zotlabs\Module\Settings\Features\get(), Zotlabs\Module\Api\get(), Zotlabs\Module\Blocks\get(), Zotlabs\Module\Webpages\get(), Zotlabs\Module\Network\get(), Zotlabs\Module\Rpost\get(), Zotlabs\Module\Hq\get(), Zotlabs\Module\Settings\Featured\get(), Zotlabs\Module\Notify\get(), Zotlabs\Module\Wiki\get(), Zotlabs\Module\Admin\Logs\get(), Zotlabs\Module\Admin\Themes\get(), Zotlabs\Module\Admin\Features\get(), Zotlabs\Module\Settings\Permcats\get(), Zotlabs\Module\Removeaccount\get(), Zotlabs\Module\Filestorage\get(), Zotlabs\Module\Removeme\get(), Zotlabs\Module\Cal\get(), Zotlabs\Module\Uexport\get(), Zotlabs\Module\Rbmark\get(), Zotlabs\Module\Admin\Account_edit\get(), Zotlabs\Module\Admin\Security\get(), Zotlabs\Module\Admin\Profs\get(), Zotlabs\Module\Admin\Channels\get(), Zotlabs\Module\Lostpass\get(), Zotlabs\Module\Directory\get(), Zotlabs\Module\Changeaddr\get(), Zotlabs\Module\Channel\get(), Zotlabs\Module\Group\get(), Zotlabs\Module\Menu\get(), Zotlabs\Module\Admin\Accounts\get(), Zotlabs\Module\Rmagic\get(), Zotlabs\Module\Sources\get(), Zotlabs\Module\Ratings\get(), Zotlabs\Module\Settings\Oauth\get(), Zotlabs\Module\Connect\get(), Zotlabs\Module\Settings\Tokens\get(), Zotlabs\Module\Appman\get(), Zotlabs\Module\Locs\get(), Zotlabs\Module\Chat\get(), Zotlabs\Module\Invite\get(), Zotlabs\Module\Settings\Account\get(), Zotlabs\Module\Mitem\get(), Zotlabs\Module\New_channel\get(), Zotlabs\Module\Settings\Display\get(), Zotlabs\Module\Rate\get(), Zotlabs\Module\Mood\get(), Zotlabs\Module\Import_items\get(), Zotlabs\Module\Mail\get(), Zotlabs\Module\Poke\get(), Zotlabs\Module\Admin\Site\get(), Zotlabs\Module\Setup\get(), Zotlabs\Module\Defperms\get(), Zotlabs\Module\Register\get(), Zotlabs\Module\Thing\get(), Zotlabs\Module\Events\get(), Zotlabs\Module\Admin\Plugins\get(), Zotlabs\Module\Cover_photo\get(), Zotlabs\Module\Profile_photo\get(), Zotlabs\Module\Settings\Channel\get(), Zotlabs\Module\Connedit\get(), Zotlabs\Module\Import\get(), Zotlabs\Module\Photos\get(), Zotlabs\Module\Profiles\get(), Zotlabs\Lib\ThreadItem\get_comment_box(), get_feed_for(), get_help_content(), get_zcard(), get_zcard_embed(), group_side(), identity_selector(), Zotlabs\Module\Hostxrd\init(), Zotlabs\Module\Oexchange\init(), Zotlabs\Module\Xrd\init(), lang_selector(), layout_select(), login(), mail_prepare_binary(), menu_render(), micropro(), mimetype_select(), mini_group_select(), nav(), oembed_format_object(), photos_album_widget(), poco(), populate_acl(), Zotlabs\Module\Lostpass\post(), Zotlabs\Module\Setup\post(), prepare_binary(), Zotlabs\Module\Profile_photo\profile_photo_crop_ui_head(), profile_sidebar(), remote_login(), Zotlabs\Lib\NativeWikiPage\render_page_history(), search(), searchbox(), send_reg_approval_email(), send_register_success_email(), Zotlabs\Lib\Enotify\submit(), theme_attachments(), vcard_from_xchan(), verify_email_address(), website_portation_tools(), Zotlabs\Widget\Bookmarkedchats\widget(), Zotlabs\Widget\Affinity\widget(), Zotlabs\Widget\Chatroom_list\widget(), Zotlabs\Widget\Wiki_list\widget(), Zotlabs\Widget\Appcategories\widget(), Zotlabs\Widget\Notifications\widget(), Zotlabs\Widget\Suggestedchats\widget(), Zotlabs\Widget\Wiki_page_history\widget(), Zotlabs\Widget\Notes\widget(), Zotlabs\Widget\Hq_controls\widget(), Zotlabs\Widget\Cover_photo\widget(), Zotlabs\Widget\Settings_menu\widget(), Zotlabs\Widget\Mailmenu\widget(), Zotlabs\Widget\Conversations\widget(), Zotlabs\Widget\Admin\widget(), Zotlabs\Widget\Savedsearch\widget(), Zotlabs\Widget\Eventstools\widget(), Zotlabs\Widget\Follow\widget(), Zotlabs\Widget\Archive\widget(), Zotlabs\Widget\Sitesearch\widget(), Zotlabs\Widget\Portfolio\widget(), Zotlabs\Widget\Filer\widget(), Zotlabs\Widget\Cdav\widget(), Zotlabs\Widget\Album\widget(), Zotlabs\Widget\Chatroom_members\widget(), Zotlabs\Widget\Suggestions\widget(), and Zotlabs\Widget\Wiki_pages\widget().

sanitise_acl ( $item)

Used to wrap ACL elements in angle brackets for storage.

Parameters
[in,out]array&$item
search (   $s,
  $id = 'search-box',
  $url = '/search',
  $save = false 
)
searchbox (   $s,
  $id = 'search-box',
  $url = '/search',
  $save = false 
)
share_shield (   $m)
share_unshield (   $m)
smile_shield (   $m)
Parameters
array$m
Returns
string
smile_unshield (   $m)
smilies (   $s,
  $sample = false 
)

Replaces text emoticons with graphical images.

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.

Parameters
string$s
boolean$sample(optional) default false
Returns
string

Referenced by format_event_html(), format_event_obj(), Zotlabs\Module\Smilies\get(), Zotlabs\Module\Wiki\get(), Zotlabs\Module\Cal\get(), Zotlabs\Module\Chatsvc\get(), Zotlabs\Module\Mail\get(), Zotlabs\Module\Events\get(), menu_render(), Zotlabs\Module\Mail\post(), Zotlabs\Module\Wiki\post(), and prepare_text().

sslify (   $s)

Replace media element using http url with https to a local redirector if using https locally.

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

Parameters
string$s
Returns
string

Referenced by prepare_body().

string_replace (   $old,
  $new,
$s 
)

Referenced by item_url_replace().

stringify_array_elms ( $arr,
  $escape = false 
)

If $escape is true, dbesc() each element before adding quotes.

Parameters
[in,out]array&$arr
boolean$escape(optional) default false

Referenced by article_tagadelic(), card_tagadelic(), expand_groups(), Zotlabs\Module\Lockview\get(), get_things(), identity_basic_export(), Zotlabs\Daemon\Notifier\run(), tagadelic(), and zot_import().

tag_sort_length (   $a,
  $b 
)
text_highlight (   $s,
  $lang 
)

Highlight Text.

Parameters
string$sText to highlight
string$langWhich language should be highlighted
Returns
string Important: The returned text has the text pattern 'http' translated to 'eY9-!' which should be converted back after further processing. This was done to prevent oembed links from occurring inside code blocks. See include/bbcode.php

Referenced by bb_highlight().

theme_attachments ( $item)
total_sort (   $a,
  $b 
)
unamp (   $s)
unobscure ( $item)
unobscure_mail ( $item)
unxmlify (   $s)

Undo an xmlify.

Pass xml escaped text ($s), returns unescaped text.

Parameters
string$s
Returns
string

Referenced by discover_by_url(), feed_get_reshare(), feed_meta(), Zotlabs\Module\Filer\get(), and get_atom_elements().

userReadableSize (   $size)

Returns a human readable formatted string for filesizes.

Parameters
int$sizefilesize in bytes
Returns
string human readable formatted filesize
Todo:
rename to user_readable_size()

Referenced by Zotlabs\Module\Setup\check_phpconfig(), Zotlabs\Module\Sharedwithme\get(), and theme_attachments().

website_portation_tools ( )

Creates website portation tools menu.

Returns
string

Referenced by Zotlabs\Widget\Website_portation_tools\widget().

xchan_query ( $items,
  $abook = true,
  $effective_uid = 0 
)

Fetches xchan and hubloc data for an array of items with only an author_xchan and owner_xchan.

If $abook is true also include the abook info. This is needed in the API to save extra per item lookups there.

Parameters
[in,out]array&$items
boolean$abookIf true also include the abook info
number$effective_uid

Referenced by api_photo_detail(), attach_export_data(), channel_export_items(), event_addtocal(), event_store_item(), Zotlabs\Module\Pubstream\get(), Zotlabs\Module\Moderate\get(), Zotlabs\Module\Like\get(), Zotlabs\Module\Search\get(), Zotlabs\Module\Display\get(), Zotlabs\Module\Block\get(), Zotlabs\Module\Articles\get(), Zotlabs\Module\Cards\get(), Zotlabs\Module\Network\get(), Zotlabs\Module\Rpost\get(), Zotlabs\Module\Hq\get(), Zotlabs\Module\Cal\get(), Zotlabs\Module\Channel\get(), Zotlabs\Module\Page\get(), Zotlabs\Module\Events\get(), Zotlabs\Module\Item\get(), identity_basic_export(), identity_export_year(), Zotlabs\Module\Starred\init(), Zotlabs\Module\Share\init(), Zotlabs\Module\Ping\init(), item_create_edit_activity(), items_fetch(), Zotlabs\Lib\NativeWikiPage\load_page_history(), Zotlabs\Module\Oep\oep_articles_reply(), Zotlabs\Module\Oep\oep_cards_reply(), Zotlabs\Module\Oep\oep_display_reply(), Zotlabs\Module\Oep\oep_mid_reply(), Zotlabs\Module\Events\post(), Zotlabs\Module\Item\post(), Zotlabs\Daemon\Cron\run(), Zotlabs\Daemon\Notifier\run(), Zotlabs\Lib\Enotify\submit(), Zotlabs\Lib\NativeWiki\sync_a_wiki_item(), sync_an_item(), Zotlabs\Widget\Activity\widget(), Zotlabs\Widget\Item\widget(), and zot_feed().

z_input_filter (   $s,
  $type = 'text/bbcode',
  $allow_code = false 
)

Variable Documentation

const RANDOM_STRING_HEX 0x00
const RANDOM_STRING_TEXT 0x01

Referenced by random_string().