4 lines
52 KiB
HTML
4 lines
52 KiB
HTML
<?xml version="1.0"?>
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:pu="http://schema.phpunit.de/coverage/1.0" lang="en"><head><title>phpDox - Source of common.php</title><link rel="stylesheet" type="text/css" href="../css/style.css" media="screen"/><link rel="stylesheet" href="../css/source.css"/><meta http-equiv="content-type" content="text/html; charset=utf-8"/></head><body><nav class="topnav"><ul><li><div class="logo"><span>/**</span>phpDox</div></li><li class="separator"><a href="../index.html">Overview</a></li><li class="separator"><a href="../namespaces.html">Namespaces</a></li><li><a href="../interfaces.html">Interfaces</a></li><li><a href="../classes.html">Classes</a></li><li class="separator"><a href="../source/index.html">Source</a></li></ul></nav><div id="mainstage"><div class="box"><ul class="breadcrumb"><li><a href="../index.html">Overview</a></li><li class="separator"><a href="../source/index.html">Source</a></li></ul></div><h1>Source of file common.php</h1><p>
|
|
Size: 4,775 Bytes - Last Modified: 2015-07-30T14:31:59-04:00</p><section><h2><small>../src/</small>common.php</h2><table class="source"><tr><td class="no"><a class="anker" href="#line1">1</a><a class="anker" href="#line2">2</a><a class="anker" href="#line3">3</a><a class="anker" href="#line4">4</a><a class="anker" href="#line5">5</a><a class="anker" href="#line6">6</a><a class="anker" href="#line7">7</a><a class="anker" href="#line8">8</a><a class="anker" href="#line9">9</a><a class="anker" href="#line10">10</a><a class="anker" href="#line11">11</a><a class="anker" href="#line12">12</a><a class="anker" href="#line13">13</a><a class="anker" href="#line14">14</a><a class="anker" href="#line15">15</a><a class="anker" href="#line16">16</a><a class="anker" href="#line17">17</a><a class="anker" href="#line18">18</a><a class="anker" href="#line19">19</a><a class="anker" href="#line20">20</a><a class="anker" href="#line21">21</a><a class="anker" href="#line22">22</a><a class="anker" href="#line23">23</a><a class="anker" href="#line24">24</a><a class="anker" href="#line25">25</a><a class="anker" href="#line26">26</a><a class="anker" href="#line27">27</a><a class="anker" href="#line28">28</a><a class="anker" href="#line29">29</a><a class="anker" href="#line30">30</a><a class="anker" href="#line31">31</a><a class="anker" href="#line32">32</a><a class="anker" href="#line33">33</a><a class="anker" href="#line34">34</a><a class="anker" href="#line35">35</a><a class="anker" href="#line36">36</a><a class="anker" href="#line37">37</a><a class="anker" href="#line38">38</a><a class="anker" href="#line39">39</a><a class="anker" href="#line40">40</a><a class="anker" href="#line41">41</a><a class="anker" href="#line42">42</a><a class="anker" href="#line43">43</a><a class="anker" href="#line44">44</a><a class="anker" href="#line45">45</a><a class="anker" href="#line46">46</a><a class="anker" href="#line47">47</a><a class="anker" href="#line48">48</a><a class="anker" href="#line49">49</a><a class="anker" href="#line50">50</a><a class="anker" href="#line51">51</a><a class="anker" href="#line52">52</a><a class="anker" href="#line53">53</a><a class="anker" href="#line54">54</a><a class="anker" href="#line55">55</a><a class="anker" href="#line56">56</a><a class="anker" href="#line57">57</a><a class="anker" href="#line58">58</a><a class="anker" href="#line59">59</a><a class="anker" href="#line60">60</a><a class="anker" href="#line61">61</a><a class="anker" href="#line62">62</a><a class="anker" href="#line63">63</a><a class="anker" href="#line64">64</a><a class="anker" href="#line65">65</a><a class="anker" href="#line66">66</a><a class="anker" href="#line67">67</a><a class="anker" href="#line68">68</a><a class="anker" href="#line69">69</a><a class="anker" href="#line70">70</a><a class="anker" href="#line71">71</a><a class="anker" href="#line72">72</a><a class="anker" href="#line73">73</a><a class="anker" href="#line74">74</a><a class="anker" href="#line75">75</a><a class="anker" href="#line76">76</a><a class="anker" href="#line77">77</a><a class="anker" href="#line78">78</a><a class="anker" href="#line79">79</a><a class="anker" href="#line80">80</a><a class="anker" href="#line81">81</a><a class="anker" href="#line82">82</a><a class="anker" href="#line83">83</a><a class="anker" href="#line84">84</a><a class="anker" href="#line85">85</a><a class="anker" href="#line86">86</a><a class="anker" href="#line87">87</a><a class="anker" href="#line88">88</a><a class="anker" href="#line89">89</a><a class="anker" href="#line90">90</a><a class="anker" href="#line91">91</a><a class="anker" href="#line92">92</a><a class="anker" href="#line93">93</a><a class="anker" href="#line94">94</a><a class="anker" href="#line95">95</a><a class="anker" href="#line96">96</a><a class="anker" href="#line97">97</a><a class="anker" href="#line98">98</a><a class="anker" href="#line99">99</a><a class="anker" href="#line100">100</a><a class="anker" href="#line101">101</a><a class="anker" href="#line102">102</a><a class="anker" href="#line103">103</a><a class="anker" href="#line104">104</a><a class="anker" href="#line105">105</a><a class="anker" href="#line106">106</a><a class="anker" href="#line107">107</a><a class="anker" href="#line108">108</a><a class="anker" href="#line109">109</a><a class="anker" href="#line110">110</a><a class="anker" href="#line111">111</a><a class="anker" href="#line112">112</a><a class="anker" href="#line113">113</a><a class="anker" href="#line114">114</a><a class="anker" href="#line115">115</a><a class="anker" href="#line116">116</a><a class="anker" href="#line117">117</a><a class="anker" href="#line118">118</a><a class="anker" href="#line119">119</a><a class="anker" href="#line120">120</a><a class="anker" href="#line121">121</a><a class="anker" href="#line122">122</a><a class="anker" href="#line123">123</a><a class="anker" href="#line124">124</a><a class="anker" href="#line125">125</a><a class="anker" href="#line126">126</a><a class="anker" href="#line127">127</a><a class="anker" href="#line128">128</a><a class="anker" href="#line129">129</a><a class="anker" href="#line130">130</a><a class="anker" href="#line131">131</a><a class="anker" href="#line132">132</a><a class="anker" href="#line133">133</a><a class="anker" href="#line134">134</a><a class="anker" href="#line135">135</a><a class="anker" href="#line136">136</a><a class="anker" href="#line137">137</a><a class="anker" href="#line138">138</a><a class="anker" href="#line139">139</a><a class="anker" href="#line140">140</a><a class="anker" href="#line141">141</a><a class="anker" href="#line142">142</a><a class="anker" href="#line143">143</a><a class="anker" href="#line144">144</a><a class="anker" href="#line145">145</a><a class="anker" href="#line146">146</a><a class="anker" href="#line147">147</a><a class="anker" href="#line148">148</a><a class="anker" href="#line149">149</a><a class="anker" href="#line150">150</a><a class="anker" href="#line151">151</a><a class="anker" href="#line152">152</a><a class="anker" href="#line153">153</a><a class="anker" href="#line154">154</a><a class="anker" href="#line155">155</a><a class="anker" href="#line156">156</a><a class="anker" href="#line157">157</a><a class="anker" href="#line158">158</a><a class="anker" href="#line159">159</a><a class="anker" href="#line160">160</a><a class="anker" href="#line161">161</a><a class="anker" href="#line162">162</a><a class="anker" href="#line163">163</a><a class="anker" href="#line164">164</a><a class="anker" href="#line165">165</a><a class="anker" href="#line166">166</a><a class="anker" href="#line167">167</a><a class="anker" href="#line168">168</a><a class="anker" href="#line169">169</a><a class="anker" href="#line170">170</a><a class="anker" href="#line171">171</a><a class="anker" href="#line172">172</a><a class="anker" href="#line173">173</a><a class="anker" href="#line174">174</a><a class="anker" href="#line175">175</a><a class="anker" href="#line176">176</a><a class="anker" href="#line177">177</a><a class="anker" href="#line178">178</a><a class="anker" href="#line179">179</a><a class="anker" href="#line180">180</a><a class="anker" href="#line181">181</a><a class="anker" href="#line182">182</a><a class="anker" href="#line183">183</a><a class="anker" href="#line184">184</a><a class="anker" href="#line185">185</a><a class="anker" href="#line186">186</a><a class="anker" href="#line187">187</a><a class="anker" href="#line188">188</a><a class="anker" href="#line189">189</a><a class="anker" href="#line190">190</a><a class="anker" href="#line191">191</a><a class="anker" href="#line192">192</a><a class="anker" href="#line193">193</a><a class="anker" href="#line194">194</a><a class="anker" href="#line195">195</a><a class="anker" href="#line196">196</a><a class="anker" href="#line197">197</a><a class="anker" href="#line198">198</a><a class="anker" href="#line199">199</a><a class="anker" href="#line200">200</a><a class="anker" href="#line201">201</a><a class="anker" href="#line202">202</a><a class="anker" href="#line203">203</a><a class="anker" href="#line204">204</a><a class="anker" href="#line205">205</a><a class="anker" href="#line206">206</a><a class="anker" href="#line207">207</a><a class="anker" href="#line208">208</a><a class="anker" href="#line209">209</a><a class="anker" href="#line210">210</a><a class="anker" href="#line211">211</a><a class="anker" href="#line212">212</a><a class="anker" href="#line213">213</a><a class="anker" href="#line214">214</a><a class="anker" href="#line215">215</a><a class="anker" href="#line216">216</a><a class="anker" href="#line217">217</a><a class="anker" href="#line218">218</a><a class="anker" href="#line219">219</a><a class="anker" href="#line220">220</a><a class="anker" href="#line221">221</a><a class="anker" href="#line222">222</a><a class="anker" href="#line223">223</a><a class="anker" href="#line224">224</a><a class="anker" href="#line225">225</a></td><td class="line"><div id="line1"><pre><span class="token T_OPEN_TAG"><?php</span></pre></div><div id="line2"><pre><span class="token T_DOC_COMMENT">/**</span></pre></div><div id="line3"><pre><span class="token T_DOC_COMMENT"> * Query</span></pre></div><div id="line4"><pre><span class="token T_DOC_COMMENT"> *</span></pre></div><div id="line5"><pre><span class="token T_DOC_COMMENT"> * Free Query Builder / Database Abstraction Layer</span></pre></div><div id="line6"><pre><span class="token T_DOC_COMMENT"> *</span></pre></div><div id="line7"><pre><span class="token T_DOC_COMMENT"> * @package Query</span></pre></div><div id="line8"><pre><span class="token T_DOC_COMMENT"> * @subpackage Core</span></pre></div><div id="line9"><pre><span class="token T_DOC_COMMENT"> * @author Timothy J. Warren</span></pre></div><div id="line10"><pre><span class="token T_DOC_COMMENT"> * @copyright Copyright (c) 2012 - 2014</span></pre></div><div id="line11"><pre><span class="token T_DOC_COMMENT"> * @link https://github.com/aviat4ion/Query</span></pre></div><div id="line12"><pre><span class="token T_DOC_COMMENT"> * @license http://philsturgeon.co.uk/code/dbad-license</span></pre></div><div id="line13"><pre><span class="token T_DOC_COMMENT"> */</span></pre></div><div id="line14"><br/></div><div id="line15"><pre><span class="token T_COMMENT">// --------------------------------------------------------------------------</span></pre></div><div id="line16"><br/></div><div id="line17"><pre><span class="token T_DOC_COMMENT">/**</span></pre></div><div id="line18"><pre><span class="token T_DOC_COMMENT"> * Global functions that don't really fit anywhere else</span></pre></div><div id="line19"><pre><span class="token T_DOC_COMMENT"> */</span></pre></div><div id="line20"><br/></div><div id="line21"><pre><span class="token T_COMMENT">// --------------------------------------------------------------------------</span></pre></div><div id="line22"><br/></div><div id="line23"><pre><span class="token T_IF">if</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EXCLAMATION_MARK">!</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">function_exists</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_CONSTANT_ENCAPSED_STRING">'do_include'</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line24"><pre><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line25"><pre><span class="token T_WHITESPACE"> </span><span class="token T_DOC_COMMENT">/**</span></pre></div><div id="line26"><pre><span class="token T_DOC_COMMENT"> * Bulk directory loading workaround for use</span></pre></div><div id="line27"><pre><span class="token T_DOC_COMMENT"> * with array_map and glob</span></pre></div><div id="line28"><pre><span class="token T_DOC_COMMENT"> *</span></pre></div><div id="line29"><pre><span class="token T_DOC_COMMENT"> * @param string $path</span></pre></div><div id="line30"><pre><span class="token T_DOC_COMMENT"> * @return void</span></pre></div><div id="line31"><pre><span class="token T_DOC_COMMENT"> */</span></pre></div><div id="line32"><pre><span class="token T_WHITESPACE"> </span><span class="token T_FUNCTION">function</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">do_include</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$path</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line33"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line34"><pre><span class="token T_WHITESPACE"> </span><span class="token T_REQUIRE_ONCE">require_once</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$path</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line35"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line36"><pre><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line37"><br/></div><div id="line38"><pre><span class="token T_COMMENT">// --------------------------------------------------------------------------</span></pre></div><div id="line39"><br/></div><div id="line40"><pre><span class="token T_IF">if</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EXCLAMATION_MARK">!</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">function_exists</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_CONSTANT_ENCAPSED_STRING">'mb_trim'</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line41"><pre><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line42"><pre><span class="token T_WHITESPACE"> </span><span class="token T_DOC_COMMENT">/**</span></pre></div><div id="line43"><pre><span class="token T_DOC_COMMENT"> * Multibyte-safe trim function</span></pre></div><div id="line44"><pre><span class="token T_DOC_COMMENT"> *</span></pre></div><div id="line45"><pre><span class="token T_DOC_COMMENT"> * @param string $string</span></pre></div><div id="line46"><pre><span class="token T_DOC_COMMENT"> * @return string</span></pre></div><div id="line47"><pre><span class="token T_DOC_COMMENT"> */</span></pre></div><div id="line48"><pre><span class="token T_WHITESPACE"> </span><span class="token T_FUNCTION">function</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">mb_trim</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$string</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line49"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line50"><pre><span class="token T_WHITESPACE"> </span><span class="token T_RETURN">return</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">preg_replace</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_CONSTANT_ENCAPSED_STRING">"/(^\s+)|(\s+$)/us"</span><span class="token T_PHPDOX_COMMA">,</span><span class="token T_WHITESPACE"> </span><span class="token T_CONSTANT_ENCAPSED_STRING">""</span><span class="token T_PHPDOX_COMMA">,</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$string</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line51"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line52"><pre><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line53"><br/></div><div id="line54"><pre><span class="token T_COMMENT">// --------------------------------------------------------------------------</span></pre></div><div id="line55"><br/></div><div id="line56"><pre><span class="token T_IF">if</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EXCLAMATION_MARK">!</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">function_exists</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_CONSTANT_ENCAPSED_STRING">'db_filter'</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line57"><pre><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line58"><pre><span class="token T_WHITESPACE"> </span><span class="token T_DOC_COMMENT">/**</span></pre></div><div id="line59"><pre><span class="token T_DOC_COMMENT"> * Filter out db rows into one array</span></pre></div><div id="line60"><pre><span class="token T_DOC_COMMENT"> *</span></pre></div><div id="line61"><pre><span class="token T_DOC_COMMENT"> * @param array $array</span></pre></div><div id="line62"><pre><span class="token T_DOC_COMMENT"> * @param mixed $index</span></pre></div><div id="line63"><pre><span class="token T_DOC_COMMENT"> * @return array</span></pre></div><div id="line64"><pre><span class="token T_DOC_COMMENT"> */</span></pre></div><div id="line65"><pre><span class="token T_WHITESPACE"> </span><span class="token T_FUNCTION">function</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">db_filter</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$array</span><span class="token T_PHPDOX_COMMA">,</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$index</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line66"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line67"><pre><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$new_array</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EQUAL">=</span><span class="token T_WHITESPACE"> </span><span class="token T_ARRAY">array</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line68"><br/></div><div id="line69"><pre><span class="token T_WHITESPACE"> </span><span class="token T_FOREACH">foreach</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$array</span><span class="token T_WHITESPACE"> </span><span class="token T_AS">as</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$a</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line70"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line71"><pre><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$new_array</span><span class="token T_PHPDOX_OPEN_SQUARE">[</span><span class="token T_PHPDOX_CLOSE_SQUARE">]</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EQUAL">=</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$a</span><span class="token T_PHPDOX_OPEN_SQUARE">[</span><span class="token T_VARIABLE">$index</span><span class="token T_PHPDOX_CLOSE_SQUARE">]</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line72"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line73"><br/></div><div id="line74"><pre><span class="token T_WHITESPACE"> </span><span class="token T_RETURN">return</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$new_array</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line75"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line76"><pre><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line77"><br/></div><div id="line78"><pre><span class="token T_COMMENT">// --------------------------------------------------------------------------</span></pre></div><div id="line79"><br/></div><div id="line80"><pre><span class="token T_IF">if</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EXCLAMATION_MARK">!</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">function_exists</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_CONSTANT_ENCAPSED_STRING">'from_camel_case'</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line81"><pre><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line82"><pre><span class="token T_WHITESPACE"> </span><span class="token T_DOC_COMMENT">/**</span></pre></div><div id="line83"><pre><span class="token T_DOC_COMMENT"> * Create a snake_case string from camelCase</span></pre></div><div id="line84"><pre><span class="token T_DOC_COMMENT"> *</span></pre></div><div id="line85"><pre><span class="token T_DOC_COMMENT"> * @see http://stackoverflow.com/questions/1993721/how-to-convert-camelcase-to-camel-case</span></pre></div><div id="line86"><pre><span class="token T_DOC_COMMENT"> *</span></pre></div><div id="line87"><pre><span class="token T_DOC_COMMENT"> * @param string $input</span></pre></div><div id="line88"><pre><span class="token T_DOC_COMMENT"> * @return string</span></pre></div><div id="line89"><pre><span class="token T_DOC_COMMENT"> */</span></pre></div><div id="line90"><pre><span class="token T_WHITESPACE"> </span><span class="token T_FUNCTION">function</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">from_camel_case</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$input</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line91"><pre><span class="token T_WHITESPACE"> </span><span class="token T_STRING">preg_match_all</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_CONSTANT_ENCAPSED_STRING">'!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!'</span><span class="token T_PHPDOX_COMMA">,</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$input</span><span class="token T_PHPDOX_COMMA">,</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$matches</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line92"><pre><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$ret</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EQUAL">=</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$matches</span><span class="token T_PHPDOX_OPEN_SQUARE">[</span><span class="token T_LNUMBER">0</span><span class="token T_PHPDOX_CLOSE_SQUARE">]</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line93"><pre><span class="token T_WHITESPACE"> </span><span class="token T_FOREACH">foreach</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$ret</span><span class="token T_WHITESPACE"> </span><span class="token T_AS">as</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_AMPERSAND">&</span><span class="token T_VARIABLE">$match</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line94"><pre><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$match</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EQUAL">=</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">strtolower</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$match</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_SEMICOLON">;</span><span class="token T_COMMENT">// == strtoupper($match) ? strtolower($match) : lcfirst($match);</span></pre></div><div id="line95"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line96"><pre><span class="token T_WHITESPACE"> </span><span class="token T_RETURN">return</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">implode</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_CONSTANT_ENCAPSED_STRING">'_'</span><span class="token T_PHPDOX_COMMA">,</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$ret</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line97"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line98"><pre><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line99"><br/></div><div id="line100"><pre><span class="token T_COMMENT">// --------------------------------------------------------------------------</span></pre></div><div id="line101"><br/></div><div id="line102"><pre><span class="token T_IF">if</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EXCLAMATION_MARK">!</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">function_exists</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_CONSTANT_ENCAPSED_STRING">'array_zipper'</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line103"><pre><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line104"><pre><span class="token T_WHITESPACE"> </span><span class="token T_DOC_COMMENT">/**</span></pre></div><div id="line105"><pre><span class="token T_DOC_COMMENT"> * Zip a set of arrays together on common keys</span></pre></div><div id="line106"><pre><span class="token T_DOC_COMMENT"> *</span></pre></div><div id="line107"><pre><span class="token T_DOC_COMMENT"> * The $zipper_input array is an array of arrays indexed by their place in the output</span></pre></div><div id="line108"><pre><span class="token T_DOC_COMMENT"> * array.</span></pre></div><div id="line109"><pre><span class="token T_DOC_COMMENT"> *</span></pre></div><div id="line110"><pre><span class="token T_DOC_COMMENT"> * @param array $zipper_input</span></pre></div><div id="line111"><pre><span class="token T_DOC_COMMENT"> * @return array</span></pre></div><div id="line112"><pre><span class="token T_DOC_COMMENT"> */</span></pre></div><div id="line113"><pre><span class="token T_WHITESPACE"> </span><span class="token T_FUNCTION">function</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">array_zipper</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_ARRAY">Array</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$zipper_input</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line114"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line115"><pre><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$output</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EQUAL">=</span><span class="token T_WHITESPACE"> </span><span class="token T_ARRAY">array</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line116"><br/></div><div id="line117"><pre><span class="token T_WHITESPACE"> </span><span class="token T_FOREACH">foreach</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$zipper_input</span><span class="token T_WHITESPACE"> </span><span class="token T_AS">as</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$append_key</span><span class="token T_WHITESPACE"> </span><span class="token T_DOUBLE_ARROW">=></span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$values</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line118"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line119"><pre><span class="token T_WHITESPACE"> </span><span class="token T_FOREACH">foreach</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$values</span><span class="token T_WHITESPACE"> </span><span class="token T_AS">as</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$index</span><span class="token T_WHITESPACE"> </span><span class="token T_DOUBLE_ARROW">=></span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$value</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line120"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line121"><pre><span class="token T_WHITESPACE"> </span><span class="token T_IF">if</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EXCLAMATION_MARK">!</span><span class="token T_WHITESPACE"> </span><span class="token T_ISSET">isset</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$output</span><span class="token T_PHPDOX_OPEN_SQUARE">[</span><span class="token T_VARIABLE">$index</span><span class="token T_PHPDOX_CLOSE_SQUARE">]</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line122"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line123"><pre><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$output</span><span class="token T_PHPDOX_OPEN_SQUARE">[</span><span class="token T_VARIABLE">$index</span><span class="token T_PHPDOX_CLOSE_SQUARE">]</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EQUAL">=</span><span class="token T_WHITESPACE"> </span><span class="token T_ARRAY">array</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line124"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line125"><pre><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$output</span><span class="token T_PHPDOX_OPEN_SQUARE">[</span><span class="token T_VARIABLE">$index</span><span class="token T_PHPDOX_CLOSE_SQUARE">]</span><span class="token T_PHPDOX_OPEN_SQUARE">[</span><span class="token T_VARIABLE">$append_key</span><span class="token T_PHPDOX_CLOSE_SQUARE">]</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EQUAL">=</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$value</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line126"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line127"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line128"><br/></div><div id="line129"><pre><span class="token T_WHITESPACE"> </span><span class="token T_RETURN">return</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$output</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line130"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line131"><pre><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line132"><br/></div><div id="line133"><pre><span class="token T_COMMENT">// --------------------------------------------------------------------------</span></pre></div><div id="line134"><br/></div><div id="line135"><pre><span class="token T_IF">if</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EXCLAMATION_MARK">!</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">function_exists</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_CONSTANT_ENCAPSED_STRING">'array_pluck'</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line136"><pre><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line137"><pre><span class="token T_WHITESPACE"> </span><span class="token T_DOC_COMMENT">/**</span></pre></div><div id="line138"><pre><span class="token T_DOC_COMMENT"> * Get an array out of an multi-dimensional array based on a common</span></pre></div><div id="line139"><pre><span class="token T_DOC_COMMENT"> * key</span></pre></div><div id="line140"><pre><span class="token T_DOC_COMMENT"> *</span></pre></div><div id="line141"><pre><span class="token T_DOC_COMMENT"> * @param array $array</span></pre></div><div id="line142"><pre><span class="token T_DOC_COMMENT"> * @param string $key</span></pre></div><div id="line143"><pre><span class="token T_DOC_COMMENT"> * @return array</span></pre></div><div id="line144"><pre><span class="token T_DOC_COMMENT"> */</span></pre></div><div id="line145"><pre><span class="token T_WHITESPACE"> </span><span class="token T_FUNCTION">function</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">array_pluck</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_ARRAY">Array</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$array</span><span class="token T_PHPDOX_COMMA">,</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$key</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line146"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line147"><pre><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$output</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EQUAL">=</span><span class="token T_WHITESPACE"> </span><span class="token T_ARRAY">array</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line148"><br/></div><div id="line149"><pre><span class="token T_WHITESPACE"> </span><span class="token T_COMMENT">// No point iterating over an empty array</span></pre></div><div id="line150"><pre><span class="token T_WHITESPACE"> </span><span class="token T_IF">if</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_EMPTY">empty</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$array</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_WHITESPACE"> </span><span class="token T_RETURN">return</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$array</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line151"><br/></div><div id="line152"><pre><span class="token T_WHITESPACE"> </span><span class="token T_FOREACH">foreach</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$array</span><span class="token T_WHITESPACE"> </span><span class="token T_AS">as</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$inner_array</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line153"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line154"><pre><span class="token T_WHITESPACE"> </span><span class="token T_IF">if</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_STRING">array_key_exists</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$key</span><span class="token T_PHPDOX_COMMA">,</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$inner_array</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line155"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line156"><pre><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$output</span><span class="token T_PHPDOX_OPEN_SQUARE">[</span><span class="token T_PHPDOX_CLOSE_SQUARE">]</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EQUAL">=</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$inner_array</span><span class="token T_PHPDOX_OPEN_SQUARE">[</span><span class="token T_VARIABLE">$key</span><span class="token T_PHPDOX_CLOSE_SQUARE">]</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line157"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line158"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line159"><br/></div><div id="line160"><pre><span class="token T_WHITESPACE"> </span><span class="token T_RETURN">return</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$output</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line161"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line162"><pre><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line163"><br/></div><div id="line164"><pre><span class="token T_COMMENT">// --------------------------------------------------------------------------</span></pre></div><div id="line165"><br/></div><div id="line166"><pre><span class="token T_IF">if</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EXCLAMATION_MARK">!</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">function_exists</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_CONSTANT_ENCAPSED_STRING">'regex_in_array'</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line167"><pre><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line168"><pre><span class="token T_WHITESPACE"> </span><span class="token T_DOC_COMMENT">/**</span></pre></div><div id="line169"><pre><span class="token T_DOC_COMMENT"> * Determine whether a value in the passed array matches the pattern</span></pre></div><div id="line170"><pre><span class="token T_DOC_COMMENT"> * passed</span></pre></div><div id="line171"><pre><span class="token T_DOC_COMMENT"> *</span></pre></div><div id="line172"><pre><span class="token T_DOC_COMMENT"> * @param array $array</span></pre></div><div id="line173"><pre><span class="token T_DOC_COMMENT"> * @param string $pattern</span></pre></div><div id="line174"><pre><span class="token T_DOC_COMMENT"> * @return bool</span></pre></div><div id="line175"><pre><span class="token T_DOC_COMMENT"> */</span></pre></div><div id="line176"><pre><span class="token T_WHITESPACE"> </span><span class="token T_FUNCTION">function</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">regex_in_array</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_ARRAY">Array</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$array</span><span class="token T_PHPDOX_COMMA">,</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$pattern</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line177"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line178"><pre><span class="token T_WHITESPACE"> </span><span class="token T_IF">if</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_EMPTY">empty</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$array</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_WHITESPACE"> </span><span class="token T_RETURN">return</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">FALSE</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line179"><br/></div><div id="line180"><pre><span class="token T_WHITESPACE"> </span><span class="token T_FOREACH">foreach</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$array</span><span class="token T_WHITESPACE"> </span><span class="token T_AS">as</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$item</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line181"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line182"><pre><span class="token T_WHITESPACE"> </span><span class="token T_IF">if</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_STRING">is_scalar</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$item</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line183"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line184"><pre><span class="token T_WHITESPACE"> </span><span class="token T_IF">if</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_STRING">preg_match</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$pattern</span><span class="token T_PHPDOX_COMMA">,</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$item</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_WHITESPACE"> </span><span class="token T_RETURN">return</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">TRUE</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line185"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line186"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line187"><br/></div><div id="line188"><pre><span class="token T_WHITESPACE"> </span><span class="token T_RETURN">return</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">FALSE</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line189"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line190"><pre><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line191"><br/></div><div id="line192"><pre><span class="token T_COMMENT">// --------------------------------------------------------------------------</span></pre></div><div id="line193"><br/></div><div id="line194"><pre><span class="token T_IF">if</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EXCLAMATION_MARK">!</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">function_exists</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_CONSTANT_ENCAPSED_STRING">'Query'</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line195"><pre><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line196"><pre><span class="token T_WHITESPACE"> </span><span class="token T_DOC_COMMENT">/**</span></pre></div><div id="line197"><pre><span class="token T_DOC_COMMENT"> * Connection function</span></pre></div><div id="line198"><pre><span class="token T_DOC_COMMENT"> *</span></pre></div><div id="line199"><pre><span class="token T_DOC_COMMENT"> * Send an array or object as connection parameters to create a connection. If</span></pre></div><div id="line200"><pre><span class="token T_DOC_COMMENT"> * the array or object has an 'alias' parameter, passing that string to this</span></pre></div><div id="line201"><pre><span class="token T_DOC_COMMENT"> * function will return that connection. Passing no parameters returns the last</span></pre></div><div id="line202"><pre><span class="token T_DOC_COMMENT"> * connection created.</span></pre></div><div id="line203"><pre><span class="token T_DOC_COMMENT"> *</span></pre></div><div id="line204"><pre><span class="token T_DOC_COMMENT"> * @param string|object|array $params</span></pre></div><div id="line205"><pre><span class="token T_DOC_COMMENT"> * @return Query\Query_Builder|null</span></pre></div><div id="line206"><pre><span class="token T_DOC_COMMENT"> */</span></pre></div><div id="line207"><pre><span class="token T_WHITESPACE"> </span><span class="token T_FUNCTION">function</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">Query</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$params</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EQUAL">=</span><span class="token T_WHITESPACE"> </span><span class="token T_CONSTANT_ENCAPSED_STRING">''</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line208"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line209"><pre><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$cmanager</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EQUAL">=</span><span class="token T_WHITESPACE"> </span><span class="token T_NS_SEPARATOR">\</span><span class="token T_STRING">Query</span><span class="token T_NS_SEPARATOR">\</span><span class="token T_STRING">Connection_Manager</span><span class="token T_DOUBLE_COLON">::</span><span class="token T_STRING">get_instance</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line210"><br/></div><div id="line211"><pre><span class="token T_WHITESPACE"> </span><span class="token T_COMMENT">// If you are getting a previously created connection</span></pre></div><div id="line212"><pre><span class="token T_WHITESPACE"> </span><span class="token T_IF">if</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_STRING">is_scalar</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$params</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line213"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line214"><pre><span class="token T_WHITESPACE"> </span><span class="token T_RETURN">return</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$cmanager</span><span class="token T_OBJECT_OPERATOR">-></span><span class="token T_STRING">get_connection</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$params</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line215"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line216"><pre><span class="token T_WHITESPACE"> </span><span class="token T_ELSEIF">elseif</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EXCLAMATION_MARK">!</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">is_scalar</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$params</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_WHITESPACE"> </span><span class="token T_BOOLEAN_AND">&&</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EXCLAMATION_MARK">!</span><span class="token T_WHITESPACE"> </span><span class="token T_STRING">is_null</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$params</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span></pre></div><div id="line217"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_OPEN_CURLY">{</span></pre></div><div id="line218"><pre><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$params_object</span><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_EQUAL">=</span><span class="token T_WHITESPACE"> </span><span class="token T_OBJECT_CAST">(object)</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$params</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line219"><br/></div><div id="line220"><pre><span class="token T_WHITESPACE"> </span><span class="token T_COMMENT">// Otherwise, return a new connection</span></pre></div><div id="line221"><pre><span class="token T_WHITESPACE"> </span><span class="token T_RETURN">return</span><span class="token T_WHITESPACE"> </span><span class="token T_VARIABLE">$cmanager</span><span class="token T_OBJECT_OPERATOR">-></span><span class="token T_STRING">connect</span><span class="token T_PHPDOX_OPEN_BRACKET">(</span><span class="token T_VARIABLE">$params_object</span><span class="token T_PHPDOX_CLOSE_BRACKET">)</span><span class="token T_PHPDOX_SEMICOLON">;</span></pre></div><div id="line222"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line223"><pre><span class="token T_WHITESPACE"> </span><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line224"><pre><span class="token T_PHPDOX_CLOSE_CURLY">}</span></pre></div><div id="line225"><pre><span class="token T_COMMENT">// End of common.php</span></pre></div></td></tr></table></section></div><footer><span>Generated using phpDox 0.8.2-dev - Copyright (C) 2010 - 2015 by Arne Blankerts</span></footer></body></html>
|