\seekquarry\yiooplibrary

Namespaces

archive_bundle_iterators
classifiers
compressors
index_bundle_iterators
indexing_plugins
media_jobs
processors
summarizers

Interfaces

CrawlConstants Shared constants and enums used by components that are involved in the crawling process
Join Marker interface used to say that a class has supports a join() callback method. IndexArchiveBundle has methods which take objects that implement Join. For activities which may take a long time such as index saving index tier merging IndexArchiveBundle will periodically call the Join objects join method so that it can continue processing rather than blocking entirely until the long running method completes
MediaConstants Shared constants and enums used by components that are involved in the media related operations
Notifier A Notifier is an object which will be notified by a priority queue when the index in the queue viewed as array of some data item has been changed.

Classes

AnalyticsManager Used to set and get SQL query and search query timing statistic between models and index_bundle_iterators
BloomFilterBundle A BloomFilterBundle is a directory of BloomFilterFile.
BloomFilterFile Code used to manage a bloom filter in-memory and in file.
BrowserRunner Used to execute browser-based Javascript and browser page rendering from PHP.
BTNode Class for B-Tree nodes
BTree This class implements the B-Tree data structure for storing int key based key-value pairs based on the algorithms in Introduction To Algorithms, by T.H. Cormen, C.E. Leiserson, R.L. Rivest, and C. Stein. Second Edition, 2001, The MIT Press
BZip2BlockIterator This class is used to allow one to iterate through a Bzip2 file.
ComputerVision Class used to encapsulate verious methods related to computer vision that might be useful for indexing documents. These include recognizing text in images
CrawlDaemon Used to run scripts as a daemon on *nix systems
DoubleIndexBundle A DoubleIndexBundle encapsulates and provided methods for two IndexArchiveBundle used to store a repeating crawl. One one thse bundles is used to handle current search queries, while the other is used to store an ongoing crawl, once the crawl time has been reach the roles of the two bundles are swapped
FeedArchiveBundle Subclass of IndexArchiveBundle with bloom filters to make it easy to check if a news feed item has been added to the bundle already before adding it
FetchGitRepositoryUrls Library of functions used to fetch Git internal urls
FetchUrl Code used to manage HTTP or Gopher requests from one or more URLS
FileCache Library of functions used to implement a simple file cache
HashTable Code used to manage a memory efficient hash table Weights for the queue must be flaots
IndexArchiveBundle Encapsulates a set of web page summaries and an inverted word-index of terms from these summaries which allow one to search for summaries containing a particular word.
IndexDictionary Data structure used to store for entries of the form: word id, index shard generation, posting list offset, and length of posting list. It has entries for all words stored in a given IndexArchiveBundle. There might be multiple entries for a given word_id if it occurs in more than one index shard in the given IndexArchiveBundle.
IndexManager Class used to manage open IndexArchiveBundle's while performing a query. Ensures an easy place to obtain references to these bundles and ensures only one object per bundle is instantiated in a Singleton-esque way.
JavascriptUnitTest Super class of all the test classes testing Javascript functions.
Library A class used to ensure can autoload non utility and locale function when using Yioop as a composer library. Also let's one set the debug level
LinearAlgebra Class useful for handling linear algebra operations on associative array with key => value pairs where the value is a number.
MailServer A small class for communicating with an SMTP server. Used to avoid configuration issues that might be needed with PHP's built-in mail() function. Here is an example of how one might use this class:
Mod9Constants Mini-class (so not own file) used to hold encode decode info related to Mod9 encoding (as variant of Simplified-9 specify to Yioop).
NamedEntityContextTagger Machine learning based named entity recognizer.
NWordGrams Library of functions used to create and extract n word grams
PageRuleParser Has methods to parse user-defined page rules to apply documents to be indexed.
PartialZipArchive Used to extract files from an initial segment or a fragment of a ZIP Archive.
PersistentStructure A PersistentStructure is a data structure which every so many operations will be saved to secondary storage (such as disk).
PhraseParser Library of functions used to manipulate words and phrases
PriorityQueue Code used to manage a memory efficient priority queue.
ScraperManager Class used by html processors to detect if a page matches a particular signature such as that of a content management system, and also to provide scraping mechanisms for the content of such a page
StringArray Memory efficient implementation of persistent arrays
SuffixTree Data structure used to maintain a suffix tree for a passage of words.
Trie Implements a trie data structure which can be used to store terms read from a dictionary in a succinct way
UnitTest Base class for all the SeekQuarry/Yioop engine Unit tests
UrlParser Library of functions used to manipulate and to extract components from urls
VersionManager VersionManager can be used to create and manage versions of files in a folder so that a user can revert the files to any version desired back to the time the folder under manager was first managed. It is used by Yioop's Wiki system to handle versions of image and other media resources for a Wiki page.
WebArchive Code used to manage web archive files
WebArchiveBundle A web archive bundle is a collection of web archives which are managed together.It is useful to split data across several archive files rather than just store it in one, for both read efficiency and to keep filesizes from getting too big. In some places we are using 4 byte int's to store file offsets which restricts the size of the files we can use for wbe archives.
WebQueueBundle Encapsulates the data structures needed to have a queue of to crawl urls
WikiParser Class with methods to parse mediawiki documents, both within Yioop, and when Yioop indexes mediawiki dumps as from Wikipedia.

Functions

addActivityAtId()

addActivityAtId(\seekquarry\yioop\library\resource&  $db, string  $string_id, string  $method_name, integer  $activity_id) 

Used to insert a new activity into the database at a given activity_id

Inserting at an ID rather than at the end is useful since activities are displayed in admin panel in order of increasing id.

Parameters

\seekquarry\yioop\library\resource& $db

database handle where Yioop database stored

string $string_id

message identifier to give translations for for activity

string $method_name

admin_controller method to be called to perform this activity

integer $activity_id

the id location at which to create this activity activity at and below this location will be shifted down by 1.

addDocIndexPostings()

addDocIndexPostings(\seekquarry\yioop\library\string&  $postings, integer  $add_offset) : string

This method is used while appending one index shard to another.

Given a string of postings adds $add_offset add to each offset to the document map in each posting.

Parameters

\seekquarry\yioop\library\string& $postings

a string of index shard postings

integer $add_offset

an fixed amount to add to each postings doc map offset

Returns

string —

$new_postings where each doc offset has had $add_offset added to it

addRegexDelimiters()

addRegexDelimiters(string  $expression) : string

Adds delimiters to a regex that may or may not have them

Parameters

string $expression

a regex

Returns

string —

rgex with delimiters if not there

adjustWeightCallback()

adjustWeightCallback(integer  $weight_info, integer  $adjustment) : integer

Given two ints encoding ($weight1, $depth1), ($weight2, $depth2) pairs computes an int encoding ($weight1 + $weight2, min($depth1, $depth2))

Parameters

integer $weight_info

coding weight and depth

integer $adjustment

coding an adjustment to weight and depth

Returns

integer —

$weight_info code for result pair

allCrawlHashPaths()

allCrawlHashPaths(string  $string, boolean  $raw = false) : array

Used to compute all hashes for a phrase based on each possible cond_max point. Here cond_max is the location of a substring of a phase which is maximal.

Parameters

string $string

what to find hashes for

boolean $raw

whether to base64 the result

Returns

array —

of hashes with appropriates shifts if needed

arraytoCsv()

arraytoCsv(array  $arr) : string

Converts an array of values to a comma separated value formatted string.

Parameters

array $arr

values to convert

Returns

string —

CSV string after conversion

base64DecodeCallback()

base64DecodeCallback(array  $matches) : string

Callback used to base64 decode the contents of previously base64 encoded (@see base64EncodeCallback) nowiki tags after all mediawiki substitutions have been done

Parameters

array $matches

$matches[1] should contain the contents of a nowiki tag

Returns

string —

base 64 decoded contents surrounded by a pre-formatted tag.

base64EncodeCallback()

base64EncodeCallback(array  $matches) : string

Callback used to base64 encode the contents of nowiki tags so they won't be manipulated by wiki replacements.

Parameters

array $matches

$matches[1] should contain the contents of a nowiki tag

Returns

string —

base 64 encoded contents surrounded by an escaped nowiki tag.

base64Hash()

base64Hash(string  $string) : string

Converts a crawl hash number to something closer to base64 coded but so doesn't get confused in urls or DBs

Parameters

string $string

a hash to base64 encode

Returns

string —

the encoded hash

calculatePartition()

calculatePartition(string  $input, integer  $num_partition, object  $callback = null) : integer

Used by a controller to say which queue_server should receive a given input

Parameters

string $input

can view as a key that might be processes by a queue_server. For example, in some cases input might be a url and we want to determine which queue_server should be responsible for queuing that url

integer $num_partition

number of queue_servers to choose between

object $callback

function or static method that might be applied to input before deciding the responsible queue_server. For example, if the input was a url we might want to get the host before deciding on the queue_server

Returns

integer —

id of server responsible for input

changeInMicrotime()

changeInMicrotime(string  $start, string  $end = null) : float

Measures the change in time in seconds between two timestamps to microsecond precision

Parameters

string $start

starting time with microseconds

string $end

ending time with microseconds, if null use current time

Returns

float —

time difference in seconds

charCopy()

charCopy(string  $source, \seekquarry\yioop\library\string&  $destination, integer  $start, integer  $length, string  $timeout_msg = "") 

Copies from $source string beginning at position $start, $length many bytes to destination string

Parameters

string $source

string to copy from

\seekquarry\yioop\library\string& $destination

string to copy to

integer $start

starting offset

integer $length

number of bytes to copy

string $timeout_msg

for long copys message to print if taking more than 30 seconds

checkTimeInterval()

checkTimeInterval(string  $start_time, string  $duration, integer  $time = -1) : integer

Checks that a timestamp is within the time interval given by a start time (HH:mm) and a duration

Parameters

string $start_time

string of the form (HH:mm)

string $duration

string containting an int in seconds

integer $time

a Unix timestamp.

Returns

integer —

-1 if the time of day of $time is not within the given interval. Otherwise, the Unix timestamp at which the interval will be over for the same day as $time.

citeCallback()

citeCallback(array  $matches, integer  $init = -1) : string

Used to convert {{cite }} to a numbered link to a citation

Parameters

array $matches

from regular expression to check for {{cite }}

integer $init

used to initialize counter for citations

Returns

string —

a HTML link to citation in current document

compareWordHashes()

compareWordHashes(string  $id1, string  $id2) : integer

Used to compare to ids for index dictionary lookup. ids are a 8 byte crawlHash together with 12 byte non-hash suffix.

Parameters

string $id1

20 byte word id to compare

string $id2

20 byte word id to compare

Returns

integer —

negative if $id1 smaller, positive if bigger, and 0 if same

computeLCS()

computeLCS(array  $lines1, array  $lines2, integer  $offset) 

Computes the longest common subsequence of two arrays

Parameters

array $lines1

an array of lines to compute LCS of

array $lines2

an array of lines to compute LCS of

integer $offset

an offset to shift over array addresses in output by

convertPixels()

convertPixels(string  $value) : integer

Converts a CSS unit string into its equivalent in pixels. This is used by @see SvgProcessor.

Parameters

string $value

a number followed by a legal CSS unit

Returns

integer —

a number in pixels

crawlCrypt()

crawlCrypt(string  $string, integer  $salt = null) : string

The crawlHash function is used to encrypt passwords stored in the database.

It tries to use the best version the Blowfish variant of php's crypt function available on the current system.

Parameters

string $string

the string to encrypt

integer $salt

salt value to be used (needed to verify if a password is valid)

Returns

string —

the crypted string where crypting is done using crawlHash

crawlHash()

crawlHash(string  $string, boolean  $raw = false) : string

Computes an 8 byte hash of a string for use in storing documents.

An eight byte hash was chosen so that the odds of collision even for a few billion documents via the birthday problem are still reasonable. If the raw flag is set to false then an 11 byte base64 encoding of the 8 byte hash is returned. The hash is calculated as the xor of the two halves of the 16 byte md5 of the string. (8 bytes takes less storage which is useful for keeping more doc info in memory)

Parameters

string $string

the string to hash

boolean $raw

whether to leave raw or base 64 encode

Returns

string —

the hash of $string

crawlHashPath()

crawlHashPath(string  $string, integer  $path_start, boolean  $raw = false) : string

Given a string makes an 20 byte hash path - where first 8 bytes is a hash of the string before path start, last 12 bytes is the path given by splitting on space and separately hashing each element according to the number of elements and the 3bit selector below:

general format: (64 bit lead word hash, 3bit selector, hashes of rest of words) according to: Selector Bits for each remaining word 001 29 32 32 010 29 16 16 16 16 011 29 16 16 8 8 8 8 100 29 16 16 8 8 4 4 4 4 101 29 16 16 8 8 4 4 2 2 2 2 110 29 16 16 8 8 4 4 2 2 1 1 1 1

If $path_start is 0 behaves like crawlHashWord(). The above encoding is typically used to make word_ids for whole phrases, to make word id's for single words, the format is (64 bits for word, 1 byte null, then ignored 11 bytes ).

Parameters

string $string

what to hash

integer $path_start

what to use as the split between 5 byte front hash and the rest

boolean $raw

whether to modified base64 the result

Returns

string —

8 bytes that results from this hash process

crawlHashWord()

crawlHashWord(string  $string, boolean  $raw = false) : string

Used to create a 20 byte hash of a string (typically a word or phrase with a wikipedia page). Format is 8 byte crawlHash of term (md5 of term two halves XOR'd), followed by a \x00, followed by the first 11 characters from the term. If there are not enough char's to make 20 bytes, then the string is padded with \x00s to 20bytes.

Parameters

string $string

word to hash

boolean $raw

whether to base64Hash the result

Returns

string —

first 8 bytes of md5 of $string concatenated with \x00 to indicate the hash is of a word not a phrase concatenated with the padded to 11 byte $meta_string.

crawlLog()

crawlLog(string  $msg, string  $lname = null, boolean  $check_process_handler = false) 

Logs a message to a logfile or the screen

Parameters

string $msg

message to log

string $lname

name of log file in the LOG_DIR directory, rotated logs will also use this as their basename followed by a number followed by gzipped (since they are gzipped (older versions of Yioop used bzip Some distros don't have bzip but do have gzip. Also gzip was being used elsewhere in Yioop, so to remove the dependency bzip was replaced )).

boolean $check_process_handler

whether or not to call the processHandler to check how long the code has run since the last time processHandler called.

crawlTimeoutLog()

crawlTimeoutLog(mixed  $msg) 

Writes a log message $msg if more than LOG_TIMEOUT time has passed since the last time crawlTimeoutLog was callled. Useful in loops to write a message as progress is made through the loop (but not on every iteration, but say every 30 seconds).

Parameters

mixed $msg

usually a string with what to be printed out after the timeout period. If $msg === true then clears the timout cache

decodeModified9()

decodeModified9(string  $input_string, \seekquarry\yioop\library\int&  $offset) : array

Decoded a sequence of positive integers from a string that has been encoded using Modified 9

Parameters

string $input_string

string to decode from

\seekquarry\yioop\library\int& $offset

where to string in the string, after decode points to where one was after decoding.

Returns

array —

sequence of positive integers that were decoded

decodeQueueWeightInfo()

decodeQueueWeightInfo(integer  $weight_info, string  $crawl_order) : array

Used to decode priority queue page weight and crawl depth from an int used to code this information

Parameters

integer $weight_info

coding weight and depth

string $crawl_order

CrawlConstants code for page crawl order if not CrawlConstants::PAGE_IMPORTANCE then only depth info would be stored in priority queue

Returns

array —

order pair [$weight, $depth]

deDeltaList()

deDeltaList(array  $delta_list) : array

Given an array of differences of integers reconstructs the original list. This computes the inverse of the deltaList function

Parameters

array $delta_list

a list of nonegative integers

Returns

array —

a nondecreasing list of integers

deleteFileOrDir()

deleteFileOrDir(string  $file_or_dir) 

This is a callback function used in the process of recursively deleting a directory

Parameters

string $file_or_dir

the filename or directory name to be deleted

deltaList()

deltaList(array  $list) : array

Computes the difference of a list of integers.

i.e., (a1, a2, a3, a4) becomes (a1, a2-a1, a3-a2, a4-a3)

Parameters

array $list

a nondecreasing list of integers

Returns

array —

the corresponding list of differences of adjacent integers

diff()

diff(string  $data1, string  $data2, boolean  $html = false) : string

Computes a Unix-style diff of two strings. That is it only outputs lines which disagree between the two strings. It outputs +line if a line occurs in the second but not first string and -line if a line occurs in the first string but not the second.

Parameters

string $data1

first string to compare

string $data2

second string to compare

boolean $html

whether to output html highlighting

Returns

string —

respresenting info about where $data1 and $data2 don't match

docIndexModified9()

docIndexModified9(integer  $encoded_list) : integer

Given an int encoding encoding a doc_index followed by a position list using Modified 9, extracts just the doc_index.

Parameters

integer $encoded_list

in the just described format

Returns

integer —

a doc index into an index shard document map.

e()

e(string  $text) 

shorthand for echo

Parameters

string $text

string to send to the current output

encodeModified9()

encodeModified9(array  $list) : string

Encodes a sequence of integers x, such that 1 <= x <= 2<<28-1 as a string. NOTICE x>=1.

The encoded string is a sequence of 4 byte words (packed int's). The high order 2 bits of a given word indicate whether or not to look at the next word. The codes are as follows: 11 start of encoded string, 10 continue four more bytes, 01 end of encoded, and 00 indicates whole sequence encoded in one word.

After the high order 2 bits, the next most significant bits indicate the format of the current word. There are nine possibilities: 00 - 1 28 bit number, 01 - 2 14 bit numbers, 10 - 3 9 bit numbers, 1100 - 4 6 bit numbers, 1101 - 5 5 bit numbers, 1110 6 4 bit numbers, 11110 - 7 3 bit numbers, 111110 - 12 2 bit numbers, 111111 - 24 1 bit numbers.

Parameters

array $list

a list of positive integers satsfying above

Returns

string —

encoded string

encodeQueueWeightInfo()

encodeQueueWeightInfo(integer  $weight, integer  $depth, string  $crawl_order) : integer

Packs an ordered pair of weight and depth info for a crawl priority url item into a single int.

Parameters

integer $weight

to be encoded

integer $depth

to be encoded

string $crawl_order

CrawlConstants code for page crawl order if not CrawlConstants::PAGE_IMPORTANCE then only depth info would be stored in priority queue

Returns

integer —

single int storing both peiece of information, weight in high order 24 bits, depth in low order 8 bits

extractLCSFromTable()

extractLCSFromTable(array  $lcs_moves, array  $lines, integer  $i, integer  $j, integer  $offset, \seekquarry\yioop\library\array&  $lcs) 

Extracts from a table of longest common sequence moves (probably calculated by @see computeLCS) and a starting coordinate $i, $j in that table, a longest common subsequence

Parameters

array $lcs_moves

a table of move computed by computeLCS

array $lines

from first of the two arrays computing LCS of

integer $i

a line number in string 1

integer $j

a line number in string 2

integer $offset

a number to add to each line number output into $lcs. This is useful if we have trimmed off the initially common lines from our two strings we are trying to compute the LCS of

\seekquarry\yioop\library\array& $lcs

an array of triples (index_string1, index_string2, line) the indexes indicate the line number in each string, line is the line in common the two strings

fileInfo()

fileInfo(string  $file) : \seekquarry\yioop\library\an

This is a callback function used in the process of recursively calculating an array of file modification times and files sizes for a directorys

Parameters

string $file

a name of a file in the file system

Returns

\seekquarry\yioop\library\an —

array whose single element contain an associative array with the size and modification time of the file

fixLinksCallback()

fixLinksCallback(array  $matches) : string

Used to changes spaces to underscores in links generated from our earlier matching rules

Parameters

array $matches

from regular expression to check for links

Returns

string —

result of correcting link

garbageCollect()

garbageCollect() : integer

Runs various system garbage collection functions and returns number of bytes freed.

Returns

integer —

number of bytes freed

generalIsA()

generalIsA(mixed  $class_1, mixed  $class_2) : boolean

Checks if class_1 is the same as class_2 or has class_2 as a parent Behaves like 3 param version (last param true) of PHP is_a function that came into being with Version 5.3.9.

Parameters

mixed $class_1

object or string class name to see if in class2

mixed $class_2

object or string class name to see if contains class1

Returns

boolean —

equal or contains class

getDomFromString()

getDomFromString(string  $to_parse) : \seekquarry\yioop\library\DOMDocument

Parses a provided string to make a DOM object. First tries to parse using XML and if this fails uses the more robust HTML Dom parser and manipulates the resulting DOM tree to make correspond to original tags for XML that isn't HTML

Parameters

string $to_parse

the string to parse a DOMDocument from

Returns

\seekquarry\yioop\library\DOMDocument —

pased on the provides string

getIniAssignMatch()

getIniAssignMatch(string  $matches) : mixed

Auxiliary function called from parse_ini_with_fallback to extract from the $matches array produced by the former function's preg_match what kind of assignment occurred in the ini file being parsed.

Parameters

string $matches

produced by a preg_match in parse_ini_with_fallback

Returns

mixed —

value of ini file assignment

getWikiHelpPages()

getWikiHelpPages() 

Reads the Help articles from default db and returns the array of pages.

greaterThan()

greaterThan(float  $a, float  $b) : integer

Callback to check if $a is greater than $b

Used to help sort document results returned in PhraseModel called in IndexArchiveBundle

Parameters

float $a

first value to compare

float $b

second value to compare

Returns

integer —

-1 if $a is greater than $b; 1 otherwise

intToMetric()

intToMetric(integer  $num) : string

Converts a number to a string followed by nothing, K, M, G, T depending on whether number is < 1000, < 10^6, < 10^9, or < 10^(12)

Parameters

integer $num

number to convert

Returns

string —

number the metric string corresponded to

isPositiveInteger()

isPositiveInteger(mixed  $input) : boolean

Returns whether an input can be parsed to a positive integer

Parameters

mixed $input

Returns

boolean —

whether $input can be parsed to a positive integer.

lessThan()

lessThan(float  $a, float  $b) : integer

Callback to check if $a is less than $b

Used to help sort document results returned in PhraseModel called in IndexArchiveBundle

Parameters

float $a

first value to compare

float $b

second value to compare

Returns

integer —

-1 if $a is less than $b; 1 otherwise

lineFilter()

lineFilter(string  $lines, mixed  $filters) : array

Given an array of lines returns a subarray of those lines containing the filter string or filter array

Parameters

string $lines

to search

mixed $filters

either string to filter lines with or an array of strings (any of which can be present to pass the filter)

Returns

array —

lines containing the string

logLineTimestamp()

logLineTimestamp(string  $line) : integer

Tries to extract a timestamp from a line which is presumed to come from a Yioop log file

Parameters

string $line

to search

Returns

integer —

timestamp of that log entry

main()

main() 

Command-line shell for testing the class

makePath()

makePath(string  $path) : boolean

Creates folders along a filesystem path if they don't exist

Parameters

string $path

a file system path

Returns

boolean —

success or failure

makeTableCallback()

makeTableCallback(array  $matches) 

Callback used by a preg_replace_callback in nextPage to make a table

Parameters

array $matches

of table cells

metricToInt()

metricToInt(string  $metric_num) : integer

Converts a string of the form some int followed by K, M, or G.

into its integer equivalent. For example 4K would become 4000, 16M would become 16000000, and 1G would become 1000000000 Note not using base 2 for K, M, G

Parameters

string $metric_num

metric number to convert

Returns

integer —

number the metric string corresponded to

microTimestamp()

microTimestamp() : string

Timestamp of current epoch with microsecond precision useful for situations where time() might cause too many collisions (account creation, etc)

Returns

string —

timestamp to microsecond of time in second since start of current epoch

mimeType()

mimeType(string  $file_name, boolean  $use_extension = false) : string

Returns the mime type of the provided file name if it can be determined.

Parameters

string $file_name

(name of file including path to figure out mime type for)

boolean $use_extension

whether to just try to guess from the file extension rather than looking at the file

Returns

string —

mime type or unknown if can't be determined

nextPostString()

nextPostString(\seekquarry\yioop\library\string&  $input_string, \seekquarry\yioop\library\int&  $offset) : string

Returns the next complete posting string from $input_string being at offset.

Does not do any decoding.

Parameters

\seekquarry\yioop\library\string& $input_string

a string of postings

\seekquarry\yioop\library\int& $offset

an offset to this string which will be updated after call

Returns

string —

undecoded posting

orderCallback()

orderCallback(string  $word_doc_a, string  $word_doc_b, string  $order_field = null) : integer

Callback function used to sort documents by a field

Should be initialized before using in usort with a call like: orderCallback($tmp, $tmp, "field_want");

Parameters

string $word_doc_a

doc id of first document to compare

string $word_doc_b

doc id of second document to compare

string $order_field

which field of these associative arrays to sort by

Returns

integer —

-1 if first doc bigger 1 otherwise

packFloat()

packFloat(float  $my_float) : string

Packs an float into a four char string

Parameters

float $my_float

the float to pack

Returns

string —

the packed string

packInt()

packInt(integer  $my_int) : string

Packs an int into a 4 char string

Parameters

integer $my_int

the integer to pack

Returns

string —

the packed string

packListModified9()

packListModified9(integer  $continue_bits, integer  $cnt, array  $pack_list) : string

Packs the contents of a single word of a sequence being encoded using Modified9.

Parameters

integer $continue_bits

the high order 2 bits of the word

integer $cnt

the number of element that will be packed in this word

array $pack_list

a list of positive integers to pack into word

Returns

string —

encoded 4 byte string

packPosting()

packPosting(integer  $doc_index, array  $position_list, boolean  $delta = true) : string

Makes an packed integer string from a docindex and the number of occurrences of a word in the document with that docindex.

Parameters

integer $doc_index

index (i.e., a count of which document it is rather than a byte offset) of a document in the document string

array $position_list

integer positions word occurred in that doc

boolean $delta

if true then stores the position_list as a sequence of differences (a delta list)

Returns

string —

a modified9 (our compression scheme) packed string containing this info.

parse_ini_with_fallback()

parse_ini_with_fallback(string  $file) : array

Yioop replacement for parse_ini_file($name, true) in case parse_ini_file is on the disable_functions list. Name has underscores to match original function. This function checks if parse_ini_file is disabled on not. If not, it just calls parse_ini_file; otherwise, it simulates it enough so that configure.ini files used for string translations can be read.

Parameters

string $file

filename of ini data to parse into an array

Returns

array —

data parse from file

parseCsv()

parseCsv(string  $csv_string) : array

Used to parse into a two dimensional array a string that contains CSV data.

Parameters

string $csv_string

string with csv data

Returns

array —

two dimensional array of elements from csv

partitionByHash()

partitionByHash(array  $table, string  $field, integer  $num_partition, integer  $instance, object  $callback = null) : array

Used by a controller to take a table and return those rows in the table that a given queue_server would be responsible for handling

Parameters

array $table

an array of rows of associative arrays which a queue_server might need to process

string $field

column of $table whose values should be used for partitioning

integer $num_partition

number of queue_servers to choose between

integer $instance

the id of the particular server we are interested in

object $callback

function or static method that might be applied to input before deciding the responsible queue_server. For example, if input was a url we might want to get the host before deciding on the queue_server

Returns

array —

the reduced table that the $instance queue_server is responsible for

preg_offset_replace()

preg_offset_replace(string  $pattern, string  $replacement, string  $subject, integer  $offset) : string

Replaces a pcre pattern with a replacement in $subject starting from some offset.

Parameters

string $pattern

a Perl compatible regular expression

string $replacement

what to replace the pattern with

string $subject

to search for pattern in

integer $offset

character offset into $subject to begin searching from

Returns

string —

result of the replacements

preg_search()

preg_search(string  $pattern, string  $subject, integer  $offset, boolean  $return_match = false) : mixed

search for a pcre pattern in a subject from a given offset, return position of first match if found -1 otherwise.

Parameters

string $pattern

a Perl compatible regular expression

string $subject

to search for pattern in

integer $offset

character offset into $subject to begin searching from

boolean $return_match

whether to return as well what the match was for the pattern

Returns

mixed —

if $return_match is false then the integer position of first match, otherwise, it returns the ordered pair [$pos, $match].

readInput()

readInput() : string

Used to read a line of input from the command-line

Returns

string —

from the command-line

readMessage()

readMessage() : string

Used to read a several lines from the terminal up until a last line consisting of just a "."

Returns

string —

from the command-line

readPassword()

readPassword() : string

Used to read a line of input from the command-line (on unix machines without echoing it)

Returns

string —

from the command-line

remoteAddress()

remoteAddress() 

Compute the real remote address of the incoming connection including forwarding

renameSerializedObject()

renameSerializedObject(string  $class_name, string  $object_string) : string

Used to change the namespace of a serialized php object (assumes doesn't have nested subobjects)

Parameters

string $class_name

new fully qualified name with namespace

string $object_string

serialized object

Returns

string —

serialized object with new name

rorderCallback()

rorderCallback(string  $word_doc_a, string  $word_doc_b, string  $order_field = null) : integer

Callback function used to sort documents by a field in reverse order

Should be initialized before using in usort with a call like: rorderCallback($tmp, $tmp, "field_want");

Parameters

string $word_doc_a

doc id of first document to compare

string $word_doc_b

doc id of second document to compare

string $order_field

which field of these associative arrays to sort by

Returns

integer —

1 if first doc bigger -1 otherwise

setWorldPermissions()

setWorldPermissions(string  $file) 

This is a callback function used in the process of recursively chmoding to 777 all files in a folder

Parameters

string $file

the filename or directory name to be chmod

spaceDecodeCallback()

spaceDecodeCallback(array  $matches) : string

Cleans up pre tags after other wiki rules applied

Parameters

array $matches

$matches[1] should contain the contents of a pre tag

Returns

string —

cleaned contents surrounded by a pre-formatted tag.

spaceEncodeCallback()

spaceEncodeCallback(array  $matches) : string

Callback used to encode the contents of pre tags so they won't accidently get sub-pre tags because a bunch of leading lines have spaces

Parameters

array $matches

$matches[1] should contain the contents of a pre tag

Returns

string —

encoded contents surrounded by an escaped pre tag.

spanEncodeCallback()

spanEncodeCallback(array  $matches) : string

Callback used to encode the contents of span tags so they newlines within them don't accidentally get treated as new wiki paragraphs

Parameters

array $matches

$matches[1] should contain the contents of a span tag

Returns

string —

encoded contents surrounded by an escaped pre tag.

stringOrderCallback()

stringOrderCallback(string  $word_doc_a, string  $word_doc_b, string  $order_field = null) : integer

Callback function used to sort documents by a field where field is assume to be a string

Should be initialized before using in usort with a call like: stringOrderCallback($tmp, $tmp, "field_want");

Parameters

string $word_doc_a

doc id of first document to compare

string $word_doc_b

doc id of second document to compare

string $order_field

which field of these associative arrays to sort by

Returns

integer —

-1 if first doc smaller 1 otherwise

stringROrderCallback()

stringROrderCallback(string  $word_doc_a, string  $word_doc_b, string  $order_field = null) : integer

Callback function used to sort documents by a field where field is assume to be a string

Should be initialized before using in usort with a call like: stringROrderCallback($tmp, $tmp, "field_want");

Parameters

string $word_doc_a

doc id of first document to compare

string $word_doc_b

doc id of second document to compare

string $order_field

which field of these associative arrays to sort by

Returns

integer —

-1 if first doc bigger 1 otherwise

stripAttributes()

stripAttributes(string  $start_tag_contents, array  $safe_attribute_list = array()) : string

Given the contents of a start XML/HMTL tag strips out all the attributes non listed in $safe_attribute_list

Parameters

string $start_tag_contents

the contents of an HTML/XML tag. I.e., if the tag was <tag stuff> then $start_tag_contents could be stuff

array $safe_attribute_list

a list of attributes which should be kept

Returns

string —

containing only safe attributes and their values

tail()

tail(string  $file_name, string  $num_lines) : array

Returns an array of the last $num_lines many lines our of a file

Parameters

string $file_name

name of file to return lines from

string $num_lines

number of lines to retrieve

Returns

array —

retrieved lines

toBinString()

toBinString(string  $str) : string

Converts a string to string where each char has been replaced by its binary equivalent

Parameters

string $str

what we want rewritten in hex

Returns

string —

the binary string

toHexString()

toHexString(string  $str) : string

Converts a string to string where each char has been replaced by its hexadecimal equivalent

Parameters

string $str

what we want rewritten in hex

Returns

string —

the hexified string

toIntString()

toIntString(string  $str) : string

Converts a string to string where each char has been replaced by a Integer equivalent

Parameters

string $str

what we want rewritten in hex

Returns

string —

the hexified string

unbase64Hash()

unbase64Hash(string  $base64) : string

Decodes a crawl hash number from base64 to raw ASCII

Parameters

string $base64

a hash to decode

Returns

string —

the decoded hash

unpackFloat()

unpackFloat(string  $str) : float

Unpacks a float from a 4 char string

Parameters

string $str

where to extract int from

Returns

float —

extracted float

unpackInt()

unpackInt(string  $str) : integer

Unpacks an int from a 4 char string

Parameters

string $str

where to extract int from

Returns

integer —

extracted integer

unpackListModified9()

unpackListModified9(string  $encoded_list) : array

Decode a single word with high two bits off according to modified 9

Parameters

string $encoded_list

four byte string to decode

Returns

array —

sequence of integers that results from the decoding.

unpackPosting()

unpackPosting(string  $posting, \seekquarry\yioop\library\int&  $offset, boolean  $dedelta = true) : array

Given a packed integer string, uses the top three bytes to calculate a doc_index of a document in the shard, and uses the low order byte to computer a number of occurrences of a word in that document.

Parameters

string $posting

a string containing a doc index position list pair coded encoded using modified9

\seekquarry\yioop\library\int& $offset

a offset into the string where the modified9 posting is encoded

boolean $dedelta

if true then assumes the list is a sequence of differences (a delta list) and undoes the difference to get the original sequence

Returns

array —

consisting of integer doc_index and a subarray consisting of integer positions of word in doc.

updateTranslationForStringId()

updateTranslationForStringId(\seekquarry\yioop\library\resource&  $db, string  $string_id, string  $locale_tag, string  $translation) 

Adds or replaces a translation for a database message string for a given IANA locale tag.

Parameters

\seekquarry\yioop\library\resource& $db

database handle where Yioop database stored

string $string_id

message identifier to give translation for

string $locale_tag

the IANA language tag to update the strings of

string $translation

the translation for $string_id in the language $locale_tag

updateVersionNumber()

updateVersionNumber(object  $db, integer  $number) 

Update the database version number to a new number

Parameters

object $db

datasource for Yioop database

integer $number

the new database number

upgradeDatabaseVersion1()

upgradeDatabaseVersion1(object  $db) 

Upgrades a Version 0 version of the Yioop database to a Version 1 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion10()

upgradeDatabaseVersion10(object  $db) 

Upgrades a Version 9 version of the Yioop database to a Version 10 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion11()

upgradeDatabaseVersion11(object  $db) 

Upgrades a Version 10 version of the Yioop database to a Version 11 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion12()

upgradeDatabaseVersion12(object  $db) 

Upgrades a Version 11 version of the Yioop database to a Version 12 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion13()

upgradeDatabaseVersion13(object  $db) 

Upgrades a Version 12 version of the Yioop database to a Version 13 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion14()

upgradeDatabaseVersion14(object  $db) 

Upgrades a Version 13 version of the Yioop database to a Version 14 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion15()

upgradeDatabaseVersion15(object  $db) 

Upgrades a Version 14 version of the Yioop database to a Version 15 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion16()

upgradeDatabaseVersion16(object  $db) 

Upgrades a Version 15 version of the Yioop database to a Version 16 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion17()

upgradeDatabaseVersion17(object  $db) 

Upgrades a Version 16 version of the Yioop database to a Version 17 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion18()

upgradeDatabaseVersion18(object  $db) 

Upgrades a Version 17 version of the Yioop database to a Version 18 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion19()

upgradeDatabaseVersion19(object  $db) 

Upgrades a Version 18 version of the Yioop database to a Version 19 version This update has been superseded by the Version20 update and so its contents have been eliminated.

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion2()

upgradeDatabaseVersion2(object  $db) 

Upgrades a Version 1 version of the Yioop database to a Version 2 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion20()

upgradeDatabaseVersion20(object  $db) 

Upgrades a Version 19 version of the Yioop database to a Version 20 version This is a major upgrade as the user table have changed. This also acts as a cumulative since version 0.98. It involves a web form that has only been localized to English

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion21()

upgradeDatabaseVersion21(object  $db) 

Upgrades a Version 20 version of the Yioop database to a Version 21 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion22()

upgradeDatabaseVersion22(object  $db) 

Upgrades a Version 21 version of the Yioop database to a Version 22 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion23()

upgradeDatabaseVersion23(object  $db) 

Upgrades a Version 22 version of the Yioop database to a Version 23 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion24()

upgradeDatabaseVersion24(object  $db) 

Upgrades a Version 23 version of the Yioop database to a Version 24 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion25()

upgradeDatabaseVersion25(object  $db) 

Upgrades a Version 24 version of the Yioop database to a Version 25 version This version upgrade includes creation of Help group that holds help pages.

Help Group is created with GROUP_ID=HELP_GROUP_ID. If a Group with Group_ID=HELP_GROUP_ID already exists, then that GROUP is moved to the end of the GROUPS table(Max group id is used).

Parameters

object $db

data source to use to upgrade

upgradeDatabaseVersion26()

upgradeDatabaseVersion26(object  $db) 

Upgrades a Version 25 version of the Yioop database to a Version 26 version This version upgrade includes updation fo the Help pages in the database to work with the changes to the way Hyperlinks are specified in wiki markup.

The changes were implemented to point all articles with page names containing %20 to be able to work with '_' and vice versa.

Parameters

object $db

data source to use to upgrade

upgradeDatabaseVersion27()

upgradeDatabaseVersion27(object  $db) 

Upgrades a Version 26 version of the Yioop database to a Version 27 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion28()

upgradeDatabaseVersion28(object  $db) 

Upgrades a Version 27 version of the Yioop database to a Version 28 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion29()

upgradeDatabaseVersion29(object  $db) 

Upgrades a Version 28 version of the Yioop database to a Version 29 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion3()

upgradeDatabaseVersion3(object  $db) 

Upgrades a Version 2 version of the Yioop database to a Version 3 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion30()

upgradeDatabaseVersion30(object  $db) 

Upgrades a Version 29 version of the Yioop database to a Version 30 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion31()

upgradeDatabaseVersion31(object  $db) 

Upgrades a Version 30 version of the Yioop database to a Version 31 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion32()

upgradeDatabaseVersion32(object  $db) 

Upgrades a Version 31 version of the Yioop database to a Version 32 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion33()

upgradeDatabaseVersion33(object  $db) 

Upgrades a Version 32 version of the Yioop database to a Version 33 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion34()

upgradeDatabaseVersion34(object  $db) 

Upgrades a Version 33 version of the Yioop database to a Version 34 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion35()

upgradeDatabaseVersion35(object  $db) 

Upgrades a Version 34 version of the Yioop database to a Version 35 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion36()

upgradeDatabaseVersion36(object  $db) 

Upgrades a Version 35 version of the Yioop database to a Version 36 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion37()

upgradeDatabaseVersion37(object  $db) 

Upgrades a Version 36 version of the Yioop database to a Version 37 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion38()

upgradeDatabaseVersion38(object  $db) 

Upgrades a Version 37 version of the Yioop database to a Version 38 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion39()

upgradeDatabaseVersion39(object  $db) 

Upgrades a Version 38 version of the Yioop database to a Version 39 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion4()

upgradeDatabaseVersion4(object  $db) 

Upgrades a Version 3 version of the Yioop database to a Version 4 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion40()

upgradeDatabaseVersion40(object  $db) 

Upgrades a Version 39 version of the Yioop database to a Version 40 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion41()

upgradeDatabaseVersion41(object  $db) 

Upgrades a Version 40 version of the Yioop database to a Version 41 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion42()

upgradeDatabaseVersion42(object  $db) 

Upgrades a Version 41 version of the Yioop database to a Version 42 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion43()

upgradeDatabaseVersion43(object  $db) 

Upgrades a Version 42 version of the Yioop database to a Version 43 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion44()

upgradeDatabaseVersion44(object  $db) 

Upgrades a Version 43 version of the Yioop database to a Version 44 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion45()

upgradeDatabaseVersion45(object  $db) 

Upgrades a Version 44 version of the Yioop database to a Version 45 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion46()

upgradeDatabaseVersion46(object  $db) 

Upgrades a Version 45 version of the Yioop database to a Version 46 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion47()

upgradeDatabaseVersion47(object  $db) 

Upgrades a Version 46 version of the Yioop database to a Version 47 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion48()

upgradeDatabaseVersion48(object  $db) 

Upgrades a Version 47 version of the Yioop database to a Version 48 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion49()

upgradeDatabaseVersion49(object  $db) 

Upgrades a Version 48 version of the Yioop database to a Version 49 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion5()

upgradeDatabaseVersion5(object  $db) 

Upgrades a Version 4 version of the Yioop database to a Version 5 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion50()

upgradeDatabaseVersion50(object  $db) 

Upgrades a Version 49 version of the Yioop database to a Version 50 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion51()

upgradeDatabaseVersion51(object  $db) 

Upgrades a Version 50 version of the Yioop database to a Version 51 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion52()

upgradeDatabaseVersion52(object  $db) 

Upgrades a Version 51 version of the Yioop database to a Version 52 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion53()

upgradeDatabaseVersion53(object  $db) 

Upgrades a Version 52 version of the Yioop database to a Version 53 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion54()

upgradeDatabaseVersion54(object  $db) 

Upgrades a Version 53 version of the Yioop database to a Version 54 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion55()

upgradeDatabaseVersion55(object  $db) 

Upgrades a Version 54 version of the Yioop database to a Version 55 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion57()

upgradeDatabaseVersion57(object  $db) 

Upgrades a Version 56 version of the Yioop database to a Version 5 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion58()

upgradeDatabaseVersion58(object  $db) 

Upgrades a Version 57 version of the Yioop database to a Version 58 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion59()

upgradeDatabaseVersion59(object  $db) 

Upgrades a Version 58 version of the Yioop database to a Version 59 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion6()

upgradeDatabaseVersion6(object  $db) 

Upgrades a Version 5 version of the Yioop database to a Version 6 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion60()

upgradeDatabaseVersion60(object  $db) 

Upgrades a Version 59 version of the Yioop database to a Version 60 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion61()

upgradeDatabaseVersion61(object  $db) 

Upgrades a Version 60 version of the Yioop database to a Version 61 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion62()

upgradeDatabaseVersion62(object  $db) 

Upgrades a Version 61 version of the Yioop database to a Version 62 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion64()

upgradeDatabaseVersion64(object  $db) 

Upgrades a Version 63 version of the Yioop database to a Version 64 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion65()

upgradeDatabaseVersion65(object  $db) 

Upgrades a Version 64 version of the Yioop database to a Version 65 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion66()

upgradeDatabaseVersion66(object  $db) 

Upgrades a Version 65 version of the Yioop database to a Version 66 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion67()

upgradeDatabaseVersion67(object  $db) 

Upgrades a Version 66 version of the Yioop database to a Version 67 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion68()

upgradeDatabaseVersion68(object  $db) 

Upgrades a Version 67 version of the Yioop database to a Version 68 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion69()

upgradeDatabaseVersion69(object  $db) 

Upgrades a Version 68 version of the Yioop database to a Version 69 version

Parameters

object $db

datasource to use to upgrade.

upgradeDatabaseVersion7()

upgradeDatabaseVersion7(object  $db) 

Upgrades a Version 6 version of the Yioop database to a Version 7 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion8()

upgradeDatabaseVersion8(object  $db) 

Upgrades a Version 7 version of the Yioop database to a Version 8 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseVersion9()

upgradeDatabaseVersion9(object  $db) 

Upgrades a Version 8 version of the Yioop database to a Version 9 version

Parameters

object $db

datasource to use to upgrade

upgradeDatabaseWorkDirectory()

upgradeDatabaseWorkDirectory() 

If the database data of Yioop is older than the version of the currently running Yioop then this function is called to try upgrade the database to the new version

upgradeDatabaseWorkDirectoryCheck()

upgradeDatabaseWorkDirectoryCheck() 

Checks to see if the database data or work_dir folder of Yioop! is from an older version of Yioop! than the currently running Yioop!

upgradeLocales()

upgradeLocales() 

If the locale data of Yioop! in the work directory is older than the currently running Yioop! then this function is called to at least try to copy the new strings into the old profile.

upgradeLocalesCheck()

upgradeLocalesCheck(string  $locale_tag) 

Checks to see if the locale data of Yioop! of a locale in the work dir is older than the currently running Yioop!

Parameters

string $locale_tag

locale to check directory of

upgradePublicHelpWiki()

upgradePublicHelpWiki(\seekquarry\yioop\library\object&  $db) 

Used to force push the default Public and Wiki pages into the current database

Parameters

\seekquarry\yioop\library\object& $db

datasource to use to upgrade

utf8SafeSaveHtml()

utf8SafeSaveHtml(\seekquarry\yioop\library\DOMDocument  $dom) : string

The dom method saveHTML has a tendency to replace UTF-8, non-ascii characters with html entities. This performs a save avoiding the replacement.

Parameters

\seekquarry\yioop\library\DOMDocument $dom

Returns

string —

output of saving html

utf8WordWrap()

utf8WordWrap(string  $string, integer  $width = 75, string  $break = "\n", boolean  $cut = false) : string

A UTF-8 safe version of PHP's wordwrap function that wraps a string to a given number of characters

Parameters

string $string

the input string

integer $width

the number of characters at which the string will be wrapped

string $break

string used to break a line into two

boolean $cut

whether to always force wrap at $width characters even if word hasn't ended

Returns

string —

the given string wrapped at the specified length

vByteDecode()

vByteDecode(\seekquarry\yioop\library\string&  $str, integer  $offset) : integer

Decodes from a string using variable byte coding an integer.

Parameters

\seekquarry\yioop\library\string& $str

string to use for decoding

integer $offset

byte offset into string when var int stored

Returns

integer —

the decoded integer

vByteEncode()

vByteEncode(integer  $pos_int) : string

Encodes an integer using variable byte coding.

Parameters

integer $pos_int

integer to encode

Returns

string —

a string of 1-5 chars depending on how bit $pos_int was

webdecode()

webdecode(string  $str) : string

Decodes a string encoded by webencode

Parameters

string $str

string to encode

Returns

string —

encoded string

webencode()

webencode(string  $str) : string

Encodes a string in a format suitable for post data (mainly, base64, but str_replace data that might mess up post in result)

Parameters

string $str

string to encode

Returns

string —

encoded string