This commit is contained in:
71
app/Helpers/array_helper.php
Normal file
71
app/Helpers/array_helper.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* Confirms
|
||||
*
|
||||
* 네이버 현장확인매물 관리 시스템 php 5.3
|
||||
*
|
||||
* @package admin.confirms.co.kr
|
||||
* @author OWRAinfo.inc Dev Team
|
||||
* @copyright Copyright (c) 2012 - 2013, OWRAinfo, Inc.
|
||||
* @since Version 1.0
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 배열을 HashTable 형태의 배열로 변환 한다.
|
||||
*/
|
||||
if (!function_exists('convertArrayToHashTable')) {
|
||||
function convertArrayToHashTable($array, $key, $value, $firstArray = array(), $lastArray = array())
|
||||
{
|
||||
|
||||
$returnArray = array();
|
||||
|
||||
if (!empty($firstArray) && is_array($firstArray)) {
|
||||
|
||||
foreach ($firstArray as $row) {
|
||||
$k = @$row[$key];
|
||||
if (empty($k))
|
||||
$k = '';
|
||||
|
||||
$v = @$row[$value];
|
||||
if (empty($v))
|
||||
$v = '';
|
||||
|
||||
$returnArray[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($array) && is_array($array)) {
|
||||
foreach ($array as $row) {
|
||||
$k = @$row[$key];
|
||||
if (empty($k))
|
||||
$k = '';
|
||||
|
||||
$v = @$row[$value];
|
||||
if (empty($v))
|
||||
$v = '';
|
||||
|
||||
$returnArray[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($lastArray) && is_array($lastArray)) {
|
||||
foreach ($lastArray as $row) {
|
||||
$k = $row[$key];
|
||||
if (empty($k))
|
||||
$k = '';
|
||||
|
||||
$v = $row[$value];
|
||||
if (empty($v))
|
||||
$v = '';
|
||||
|
||||
$returnArray[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
|
||||
}
|
||||
41
app/Helpers/string_helper.php
Normal file
41
app/Helpers/string_helper.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
if (!function_exists('sqlstr_quotes')) {
|
||||
function sqlstr_quotes($str)
|
||||
{
|
||||
return str_replace("'", "''", $str);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('phone_format')) {
|
||||
function phone_format($str)
|
||||
{
|
||||
|
||||
$phone = $str;
|
||||
if (substr($phone, 0, 2) == '02') {
|
||||
switch (strlen(($phone))) {
|
||||
case 9:
|
||||
$phone = substr($phone, 0, 2) . '-' . substr($phone, 2, 3) . '-' . substr($phone, 5, 4);
|
||||
break;
|
||||
|
||||
case 10:
|
||||
$phone = substr($phone, 0, 2) . '-' . substr($phone, 2, 4) . '-' . substr($phone, 6, 4);
|
||||
break;
|
||||
|
||||
}
|
||||
} else {
|
||||
switch (strlen(($phone))) {
|
||||
case 10:
|
||||
$phone = substr($phone, 0, 3) . '-' . substr($phone, 3, 3) . '-' . substr($phone, 6, 4);
|
||||
break;
|
||||
case 11:
|
||||
$phone = substr($phone, 0, 3) . '-' . substr($phone, 3, 4) . '-' . substr($phone, 7, 4);
|
||||
break;
|
||||
case 12:
|
||||
$phone = substr($phone, 0, 4) . '-' . substr($phone, 4, 4) . '-' . substr($phone, 8, 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $phone;
|
||||
}
|
||||
}
|
||||
43
app/Helpers/url_helper.php
Normal file
43
app/Helpers/url_helper.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
// CI4에서는 BASEPATH 체크 삭제
|
||||
|
||||
function make_query_string($array)
|
||||
{
|
||||
if (!isset($array) || !is_array($array))
|
||||
return '';
|
||||
|
||||
$qs = '';
|
||||
foreach ($array as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $value2) {
|
||||
if (empty($qs)) {
|
||||
$qs .= '?';
|
||||
} else {
|
||||
$qs .= '&';
|
||||
}
|
||||
$qs .= $key . '=' . urlencode($value2);
|
||||
}
|
||||
} else {
|
||||
if (empty($qs)) {
|
||||
$qs .= '?';
|
||||
} else {
|
||||
$qs .= '&';
|
||||
}
|
||||
$qs .= $key . '=' . urlencode($value);
|
||||
}
|
||||
}
|
||||
return $qs;
|
||||
}
|
||||
|
||||
// ... 기존 다른 함수들도 그대로 넣어도 됨
|
||||
|
||||
function siteURL()
|
||||
{
|
||||
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443)
|
||||
? "https://"
|
||||
: "http://";
|
||||
|
||||
$domainName = $_SERVER['HTTP_HOST'] . '/';
|
||||
return $protocol . $domainName;
|
||||
}
|
||||
Reference in New Issue
Block a user