/** * Attempts to grab the taxonomy type and value from the current URL * * @param string $path Path to query * @return mixed */ public static function getCriteria($url) { $taxonomies = Config::getTaxonomies(); $segments = explode('/', ltrim($url, '/')); foreach ($taxonomies as $taxonomy) { if (in_array($taxonomy, $segments)) { $data = array_split($segments, $taxonomy); return array('type' => array_get($data, 0), 'slug' => array_get($data, 1)); } } return FALSE; }
function array_split($array, $split) { if ($split < 2) { return array($array); } $newCount = ceil(count($array) / $split); $a = array_slice($array, 0, $newCount); $b = array_split(array_slice($array, $newCount), $split - 1); return array_merge(array($a), $b); }
function array_split($array, $pieces = 2) { if ($pieces < 2) { return [$array]; } $newCount = ceil(count($array) / $pieces); $a = array_slice($array, 0, $newCount); $b = array_split(array_slice($array, $newCount), $pieces - 1); return array_merge([$a], $b); }
function setup_module($column, $moduleName, $obj) { global $request_info, $title, $body, $name, $email, $paging, $msg; global $group_details, $users, $search_string_array, $uid; switch ($moduleName) { case 'GroupAccessModule': case 'GroupStatsModule': // $obj->group_details = $group_details; break; case 'MembersFacewallModule': $obj->group_details = $group_details; $obj->mode = PRI; $obj->block_type = HOMEPAGE; $obj->links = $users; $obj->gid = $_REQUEST['ccid']; break; case 'ShowContentModule': $obj->uid = $uid; if (@$_GET['tier_one']) { $splited =& array_split($_GET, 'tier_one'); } if (@$_GET['btn_searchContent'] && (@$_GET['allwords'] || @$_GET['phrase'] || @$_GET['anywords'] || @$_GET['notwords'] || @$_GET['mFrom'] || @$_GET['dFrom'] || @$_GET['yFrom'] || @$_GET['mTo'] || @$_GET['dTo'] || @$_GET['yTo']) || !sizeof($_GET) || !empty($_GET['tag_id']) || !empty($_REQUEST['gid']) || !empty($_GET['page'])) { if (!empty($_GET["show"])) { $obj->type = "show"; } else { if (!empty($_GET["tag_id"])) { $obj->type = "tag"; $obj->tag_id = trim($_GET["tag_id"]); } else { if (!empty($_GET["btn_searchContent"])) { $obj->type = "search"; $obj->search_string_array = $search_string_array; } else { if (!empty($_REQUEST["gid"])) { $obj->type = "group"; $obj->html_block_id_flag = 1; $obj->gid = trim($_REQUEST["gid"]); } else { $obj->show_all = 1; } } } } $obj->show_filters = TRUE; $obj->content_type = @$content_type; $obj->Paging["page"] = $paging["page"]; $obj->Paging["show"] = 5; } else { return 'skip'; } break; case 'RecentPostModule': $obj->block_type = HOMEPAGE; $obj->type = 'group'; $obj->mode = PRI; $obj->gid = $_REQUEST['ccid']; $obj->group_details = $group_details; break; case 'GroupForumModule': $obj->parent_id = $request_info['parent_id']; $obj->parent_name_hidden = $request_info['parent_name_hidden']; $obj->parent_type = $request_info['parent_type']; $obj->header_title = $request_info['header_title']; $obj->title_form = $title; $obj->body = $body; $obj->name = $name; $obj->email = $email; $obj->Paging["page"] = $paging["page"]; $obj->Paging["show"] = $paging["show"]; if ($error) { $obj->msg = $msg; } break; } }
function sql_array($xsql, $colname) { include "phpconf.php"; if (!$xsql == "") { $result = mysql_db_query($DBName, $xsql) or die("Notconnect database error" . mysql_error()); if (mysql_num_rows($result) > 0) { $i = 0; while ($i < mysql_num_rows($result)) { $rs = mysql_fetch_array($result); if (!isset($rsarray)) { $rsarray = array($rs["Month"] => $rs["total"]); } else { $rsarray = $rsarray + array($rs["Month"] => $rs["total"]); } $i++; } $mtqt = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, 10 => 0, 11 => 0, 12 => 0); $rsarray = $rsarray + $mtqt; ksort($rsarray); $rsarray1 = array_split($rsarray, 10, 11, 12); $rsarray = $rsarray1 + $rsarray; print "<td width='194' align='left' class='text-intable'> {$colname}</td>"; foreach ($rsarray as $key => $qt) { if ($qt > 0) { echo "<td width='30' align='center'><font color=green><b>" . $qt . "</b></font></td>"; } else { echo "<td width='30' align='center'><font color='red'>" . $qt . "</font></td>"; } } } else { print "<tr width='194' align='left' class='text-intable'><td align='left'> {$colname}</td>"; $j = 0; while ($j < 12) { //if($xsql!==""){print"<td width='30' align='center'>0</td>";}else{print"<td width='30' align='center'> </td>";} print "<td width='30' align='center'><font color='red'>0</font></td>"; $j++; } print "</tr>"; } //row } else { print "<tr class='headtable'><td align='center'>{$colname}</td><td colspan='12' align='center' scope='col'> </td></tr>"; } }
<div class="tpp-app tpp-app-fact tpp-app-hidden"><?php $this->render('fact/_general'); ?> <div class="row"><?php foreach (array_split($facts, 3) as $facts) { ?> <div class="col-md-4 col-pokemon-milestones"> <div class="table-responsive table-bordered table-striped table-pokemon table-milestones"> <table class="table"><?php $this->render('fact/_info', ['facts' => $facts]); ?> </table> </div> </div><?php } ?> </div> </div>
<div class="tpp-app tpp-app-milestone tpp-app-hidden"><?php $this->render('milestone/_general'); ?> <div class="row"><?php /** * I can't find another way to do this. * Having $key * count($milestones) doesn't work, as 26/26/25 becomes 1-26, 27-52, 51-74 (note the starting # of the last one) */ $milestoneCount = 0; foreach (array_split($milestones, 3) as $milestones) { ?> <div class="col-md-4 col-pokemon-milestones"> <div class="table-responsive table-bordered table-striped table-pokemon table-milestones"> <table class="table"><?php $this->render('milestone/_info', ['milestones' => $milestones]); ?> </table> </div> </div><?php } ?> </div> </div>