XoopsModules25x/lexikon

View on GitHub
testdata/english/lxentries.yml

Summary

Maintainability
Test Coverage
-
    entryID: '1'
    categoryID: '1'
    term: XoopsObject
    init: X
    definition: "<strong>XoopsObject</strong> should be handled as an abstract class and has the following useful functions:\r\n    * initVar($key,$data_type,$value,$required,$maxlength,$options) - initialize a variable. Use this, when extending XoopsObject instead of declaring variables the normal way. for $data_type, see below."
    ref: XOOPS
    url: 'http://xoops.org'
    uid: '1'
    submit: '0'
    datesub: '1626106200'
    counter: '0'
    html: '1'
    smiley: '1'
    xcodes: '1'
    breaks: '1'
    block: '1'
    offline: '0'
    notifypub: '0'
    request: '0'
    comments: '0'
    item_tag: ''
-
    entryID: '2'
    categoryID: '1'
    term: XoopsObjectHandler
    init: X
    definition: '<p><strong>XoopsObjectHandler</strong>&nbsp;</p><p>Instead of instantiating your objects directly, the idea is to use the ObjectHandler instead. An object is created (new object - it can still come from the database or be an entirely new object) with this code:</p><div class="xoopsCode">$class_handler =&amp; xoops_gethandler(''classname''); //NOT classnameHandler</div><div class="xoopsCode">$thisobject =&amp; $class_handler-&gt;get($objectid);</div><p><br /><br /></p>'
    ref: XOOPS
    url: 'http://xoops.org'
    uid: '1'
    submit: '0'
    datesub: '1626311400'
    counter: '0'
    html: '1'
    smiley: '1'
    xcodes: '1'
    breaks: '1'
    block: '1'
    offline: '0'
    notifypub: '0'
    request: '0'
    comments: '0'
    item_tag: ''
-
    entryID: '3'
    categoryID: '1'
    term: Criteria
    init: X
    definition: '<p>The XOOPS API has a class called Criteria to aid in database searches. The class is defined as such:<br />Criteria Criteria (string $column, string $value =&nbsp;, string $operator = ''='',&nbsp;mixed $prefix =&nbsp;, mixed $function =&nbsp;)<br />It''s handy for returning a list of objects from the XoopsPersistableObjectHandler class.</p><p>Example:<br />$criteria = new Criteria(''id'', $object_id); <br />$array = $objecthandler-&gt;getObjects($criteria, false, false);</p><p>This returns $array as an array of all elements following the criteria! If the third argument of the getObjects method is true, it returns objects instead, handy for bulk manipulation!</p><p>The Criteria class only handles a single ''WHERE'' condition. If you need multiple conditions, use CriteriaCompo in combination with Criteria. Here is an example out of the mailusers file:</p><p><br />$criteria_object = new CriteriaCompo();<br /> foreach ($criteria as $c) {<br /> list ($field, $op, $value) = split('' '', $c); $criteria_object-&gt;add(new Criteria($field,$value,$op), ''AND'');<br /> }</p><p>If you have just a few simple conditions, you can just use</p><p><br />$criteria_object = new CriteriaCompo();<br />$criteria_object-&gt;add(new Criteria($field1,$value1,$op1), ''AND'');<br />$criteria_object-&gt;add(new Criteria($field2,$value2,$op2), ''AND'');</p>'
    ref: XOOPS
    url: 'http://xoops.org'
    uid: '1'
    submit: '0'
    datesub: '1626311400'
    counter: '0'
    html: '1'
    smiley: '1'
    xcodes: '1'
    breaks: '1'
    block: '1'
    offline: '0'
    notifypub: '0'
    request: '0'
    comments: '0'
    item_tag: ''
-
    entryID: '4'
    categoryID: '2'
    term: 'PHP Namespaces'
    init: P
    definition: '<p class="simpara">What are namespaces? In the broadest definition namespaces are a way of encapsulating items. This can be seen as an abstract concept in many places. For example, in any operating system directories serve to group related files, and act as a namespace for the files within them. As a concrete example, the file&nbsp;<code class="literal">foo.txt</code>&nbsp;can exist in both directory&nbsp;<code class="literal">/home/greg</code>&nbsp;and in&nbsp;<code class="literal">/home/other</code>, but two copies of&nbsp;<code class="literal">foo.txt</code>&nbsp;cannot co-exist in the same directory. In addition, to access the&nbsp;<code class="literal">foo.txt</code>&nbsp;file outside of the&nbsp;<code class="literal">/home/greg</code>&nbsp;directory, we must prepend the directory name to the file name using the directory separator to get&nbsp;<code class="literal">/home/greg/foo.txt</code>. This same principle extends to namespaces in the programming world.</p><p class="simpara">In the PHP world, namespaces are designed to solve two problems that authors of libraries and applications encounter when creating re-usable code elements such as classes or functions:</p><p class="para"></p><ol type="1"><li class="listitem"><span class="simpara">Name collisions between code you create, and internal PHP classes/functions/constants or third-party classes/functions/constants.</span></li><li class="listitem"><span class="simpara">Ability to alias (or shorten) Extra_Long_Names designed to alleviate the first problem, improving readability of source code.</span></li></ol><p class="simpara">PHP Namespaces provide a way in which to group related classes, interfaces, functions and constants. Here is an example of namespace syntax in PHP:</p>'
    ref: 'PHP Namespaces'
    url: 'https://www.php.net/manual/en/language.namespaces.rationale.php'
    uid: '1'
    submit: '0'
    datesub: '1626312000'
    counter: '0'
    html: '1'
    smiley: '1'
    xcodes: '1'
    breaks: '1'
    block: '1'
    offline: '0'
    notifypub: '0'
    request: '0'
    comments: '0'
    item_tag: ''