本文整理汇总了PHP中Misc类的典型用法代码示例。如果您正苦于以下问题:PHP Misc类的具体用法?PHP Misc怎么用?PHP Misc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Misc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatKey
public function formatKey($data = array())
{
$cache_key = array_merge(array_keys($data), $data);
$key = $this->table . '_' . Misc::implodeMultiArr($cache_key, '-');
$cache_key = strlen($key) < 32 ? $key : md5($key);
return $cache_key;
}
示例2: _getFactoryOptions
function _getFactoryOptions($name)
{
$retval = NULL;
switch ($name) {
case 'type':
$retval = array(10 => TTi18n::gettext('Auto-Deduct'), 15 => TTi18n::gettext('Auto-Add'), 20 => TTi18n::gettext('Normal'));
break;
case 'auto_detect_type':
$retval = array(10 => TTi18n::gettext('Time Window'), 20 => TTi18n::gettext('Punch Time'));
break;
case 'columns':
$retval = array('-1010-type' => TTi18n::gettext('Type'), '-1020-name' => TTi18n::gettext('Name'), '-1030-amount' => TTi18n::gettext('Break Time'), '-1040-trigger_time' => TTi18n::gettext('Active After'), '-1050-auto_detect_type' => TTi18n::gettext('Auto Detect Breaks By'), '-1100-include_break_punch_time' => TTi18n::gettext('Include Break Punch'), '-1110-include_multiple_breaks' => TTi18n::gettext('Include Multiple Breaks'), '-2000-created_by' => TTi18n::gettext('Created By'), '-2010-created_date' => TTi18n::gettext('Created Date'), '-2020-updated_by' => TTi18n::gettext('Updated By'), '-2030-updated_date' => TTi18n::gettext('Updated Date'));
break;
case 'list_columns':
$retval = Misc::arrayIntersectByKey($this->getOptions('default_display_columns'), Misc::trimSortPrefix($this->getOptions('columns')));
break;
case 'default_display_columns':
//Columns that are displayed by default.
$retval = array('name', 'type', 'amount', 'updated_date', 'updated_by');
break;
case 'unique_columns':
//Columns that are unique, and disabled for mass editing.
$retval = array('name');
break;
case 'linked_columns':
//Columns that are linked together, mainly for Mass Edit, if one changes, they all must.
$retval = array();
break;
}
return $retval;
}
示例3: api_exit
function api_exit($code, $msg = '')
{
global $remotehost, $cfg;
if ($code != EX_SUCCESS && $cfg->alertONMailParseError()) {
//Error occured...
$_SESSION['api']['errors'] += 1;
$_SESSION['api']['time'] = time();
$alert = sprintf("Possible issues with the API\n\n Error Code: %d\nErrors: %d\nRemote IP:%s\n\n%s", $code, $_SESSION['api']['errors'], $_SERVER['REMOTE_ADDR'], $msg);
//echo 'API Error(s) '.$msg;
Misc::alertAdmin('API Error(s)', $msg);
}
if ($remotehost) {
switch ($code) {
case EX_SUCCESS:
Http::response(200, $code, 'text/plain');
break;
case EX_UNAVAILABLE:
Http::response(405, $code, 'text/plain');
break;
case EX_NOPERM:
Http::response(403, $code, 'text/plain');
break;
case EX_DATAERR:
case EX_NOINPUT:
default:
Http::response(416, $code, 'text/plain');
}
}
exit($code);
}
示例4: _getFactoryOptions
function _getFactoryOptions($name)
{
$retval = NULL;
switch ($name) {
case 'ach_transaction_type':
//ACH transactions require a transaction code that matches the bank account.
$retval = array(22 => TTi18n::getText('Checking'), 32 => TTi18n::getText('Savings'));
break;
case 'columns':
$retval = array('-1010-first_name' => TTi18n::gettext('First Name'), '-1020-last_name' => TTi18n::gettext('Last Name'), '-1090-title' => TTi18n::gettext('Title'), '-1099-user_group' => TTi18n::gettext('Group'), '-1100-default_branch' => TTi18n::gettext('Branch'), '-1110-default_department' => TTi18n::gettext('Department'), '-5010-transit' => TTi18n::gettext('Transit/Routing'), '-5020-account' => TTi18n::gettext('Account'), '-5030-institution' => TTi18n::gettext('Institution'), '-2000-created_by' => TTi18n::gettext('Created By'), '-2010-created_date' => TTi18n::gettext('Created Date'), '-2020-updated_by' => TTi18n::gettext('Updated By'), '-2030-updated_date' => TTi18n::gettext('Updated Date'));
break;
case 'list_columns':
$retval = Misc::arrayIntersectByKey($this->getOptions('default_display_columns'), Misc::trimSortPrefix($this->getOptions('columns')));
break;
case 'default_display_columns':
//Columns that are displayed by default.
$retval = array('first_name', 'last_name', 'account', 'institution');
break;
case 'linked_columns':
//Columns that are linked together, mainly for Mass Edit, if one changes, they all must.
$retval = array();
break;
}
return $retval;
}
示例5: getOptions
static function getOptions($name, $interval = 1)
{
$all_array_option = array('*' => TTi18n::getText('-- All --'));
$retval = FALSE;
switch ($name) {
case 'minute':
for ($i = 0; $i <= 59; $i += $interval) {
$retval[$i] = $i;
}
$retval = Misc::prependArray($all_array_option, $retval);
break;
case 'hour':
for ($i = 0; $i <= 23; $i += $interval) {
$retval[$i] = $i;
}
$retval = Misc::prependArray($all_array_option, $retval);
break;
case 'day_of_month':
$retval = Misc::prependArray($all_array_option, TTDate::getDayOfMonthArray());
break;
case 'month':
$retval = Misc::prependArray($all_array_option, TTDate::getMonthOfYearArray());
break;
case 'day_of_week':
$retval = Misc::prependArray($all_array_option, TTDate::getDayOfWeekArray());
break;
}
return $retval;
}
示例6: _getFactoryOptions
function _getFactoryOptions($name)
{
$retval = NULL;
switch ($name) {
case 'columns':
$retval = array('-1010-status' => TTi18n::gettext('Status'), '-1020-type' => TTi18n::gettext('Type'), '-1030-name' => TTi18n::gettext('Tax / Deduction'), '-1040-calculation' => TTi18n::gettext('Calculation'), '-1110-first_name' => TTi18n::gettext('First Name'), '-1120-last_name' => TTi18n::gettext('Last Name'), '-2000-created_by' => TTi18n::gettext('Created By'), '-2010-created_date' => TTi18n::gettext('Created Date'), '-2020-updated_by' => TTi18n::gettext('Updated By'), '-2030-updated_date' => TTi18n::gettext('Updated Date'));
break;
case 'list_columns':
$retval = Misc::arrayIntersectByKey($this->getOptions('default_display_columns'), Misc::trimSortPrefix($this->getOptions('columns')));
break;
case 'default_display_columns':
//Columns that are displayed by default.
$retval = array('status', 'type', 'name', 'calculation');
break;
case 'unique_columns':
//Columns that are unique, and disabled for mass editing.
$retval = array();
break;
case 'linked_columns':
//Columns that are linked together, mainly for Mass Edit, if one changes, they all must.
$retval = array();
break;
}
return $retval;
}
示例7: newFromUrl
public static function newFromUrl($url, $langCode, $dbType)
{
$url = str_replace('http://www.wikihow.com/', '', $url);
$pageTitle = Misc::getUrlDecodedData($url);
$row = self::getDBRowFromPageTitle($pageTitle, $langCode, $dbType);
return is_null($row) ? null : BabelfishArticle::newFromDBRow($row, $dbType);
}
示例8: _getFactoryOptions
function _getFactoryOptions($name)
{
$retval = NULL;
switch ($name) {
case 'type':
$retval = array(10 => TTi18n::gettext('Missed Punch'), 20 => TTi18n::gettext('Punch Adjustment'), 30 => TTi18n::gettext('Absence (incl. Vacation)'), 40 => TTi18n::gettext('Schedule Adjustment'), 100 => TTi18n::gettext('Other'));
break;
case 'status':
$retval = array(10 => TTi18n::gettext('INCOMPLETE'), 20 => TTi18n::gettext('OPEN'), 30 => TTi18n::gettext('PENDING'), 40 => TTi18n::gettext('AUTHORIZATION OPEN'), 50 => TTi18n::gettext('AUTHORIZED'), 55 => TTi18n::gettext('DECLINED'), 60 => TTi18n::gettext('DISABLED'));
break;
case 'columns':
$retval = array('-1010-first_name' => TTi18n::gettext('First Name'), '-1020-last_name' => TTi18n::gettext('Last Name'), '-1060-title' => TTi18n::gettext('Title'), '-1070-user_group' => TTi18n::gettext('Group'), '-1080-default_branch' => TTi18n::gettext('Branch'), '-1090-default_department' => TTi18n::gettext('Department'), '-1110-date_stamp' => TTi18n::gettext('Date'), '-1120-status' => TTi18n::gettext('Status'), '-1130-type' => TTi18n::gettext('Type'), '-2000-created_by' => TTi18n::gettext('Created By'), '-2010-created_date' => TTi18n::gettext('Created Date'), '-2020-updated_by' => TTi18n::gettext('Updated By'), '-2030-updated_date' => TTi18n::gettext('Updated Date'));
break;
case 'list_columns':
$retval = Misc::arrayIntersectByKey(array('date_stamp', 'status', 'type'), Misc::trimSortPrefix($this->getOptions('columns')));
break;
case 'default_display_columns':
//Columns that are displayed by default.
$retval = array('first_name', 'last_name', 'type', 'date_stamp', 'status');
break;
case 'unique_columns':
//Columns that are unique, and disabled for mass editing.
$retval = array();
break;
case 'linked_columns':
//Columns that are linked together, mainly for Mass Edit, if one changes, they all must.
$retval = array();
break;
}
return $retval;
}
示例9: _sleep
private static function _sleep($values)
{
if (isset($values['ms']) == false) {
return false;
}
return Misc::sleep(Basic::handle($values['ms']));
}
示例10: _getFactoryOptions
function _getFactoryOptions($name)
{
$retval = NULL;
switch ($name) {
case 'columns':
$retval = array('-1020-name' => TTi18n::gettext('Name'), '-1030-meal_policy' => TTi18n::gettext('Meal Policy'), '-1040-absence_policy' => TTi18n::gettext('Absence Policy'), '-1050-over_time_policy' => TTi18n::gettext('Overtime Policy'), '-1060-start_stop_window' => TTi18n::gettext('Window'), '-2000-created_by' => TTi18n::gettext('Created By'), '-2010-created_date' => TTi18n::gettext('Created Date'), '-2020-updated_by' => TTi18n::gettext('Updated By'), '-2030-updated_date' => TTi18n::gettext('Updated Date'));
break;
case 'list_columns':
$retval = Misc::arrayIntersectByKey($this->getOptions('default_display_columns'), Misc::trimSortPrefix($this->getOptions('columns')));
break;
case 'default_display_columns':
//Columns that are displayed by default.
$retval = array('name', 'meal_policy', 'start_stop_window', 'updated_date', 'updated_by');
break;
case 'unique_columns':
//Columns that are unique, and disabled for mass editing.
$retval = array('name');
break;
case 'linked_columns':
//Columns that are linked together, mainly for Mass Edit, if one changes, they all must.
$retval = array();
break;
}
return $retval;
}
示例11: _getFactoryOptions
function _getFactoryOptions($name)
{
$retval = NULL;
switch ($name) {
case 'status':
$retval = array(10 => TTi18n::gettext('INCOMPLETE'), 20 => TTi18n::gettext('OPEN'), 30 => TTi18n::gettext('PENDING AUTHORIZATION'), 40 => TTi18n::gettext('AUTHORIZATION OPEN'), 45 => TTi18n::gettext('PENDING EMPLOYEE VERIFICATION'), 50 => TTi18n::gettext('Verified'), 55 => TTi18n::gettext('AUTHORIZATION DECLINED'), 60 => TTi18n::gettext('DISABLED'));
break;
case 'columns':
$retval = array('-1010-first_name' => TTi18n::gettext('First Name'), '-1020-last_name' => TTi18n::gettext('Last Name'), '-1060-title' => TTi18n::gettext('Title'), '-1070-user_group' => TTi18n::gettext('Group'), '-1080-default_branch' => TTi18n::gettext('Branch'), '-1090-default_department' => TTi18n::gettext('Department'), '-1110-start_date' => TTi18n::gettext('Start Date'), '-1112-end_date' => TTi18n::gettext('End Date'), '-1115-transaction_date' => TTi18n::gettext('Transaction Date'), '-1120-status' => TTi18n::gettext('Status'), '-2000-created_by' => TTi18n::gettext('Created By'), '-2010-created_date' => TTi18n::gettext('Created Date'), '-2020-updated_by' => TTi18n::gettext('Updated By'), '-2030-updated_date' => TTi18n::gettext('Updated Date'));
break;
case 'list_columns':
$retval = Misc::arrayIntersectByKey($this->getOptions('default_display_columns'), Misc::trimSortPrefix($this->getOptions('columns')));
break;
case 'default_display_columns':
//Columns that are displayed by default.
$retval = array('first_name', 'last_name', 'start_date', 'end_date', 'status');
break;
case 'unique_columns':
//Columns that are unique, and disabled for mass editing.
$retval = array();
break;
case 'linked_columns':
//Columns that are linked together, mainly for Mass Edit, if one changes, they all must.
$retval = array();
break;
}
return $retval;
}
示例12: _getFactoryOptions
function _getFactoryOptions($name, $parent = NULL)
{
$retval = NULL;
switch ($name) {
case 'columns':
$retval = array('-1100-type' => TTi18n::gettext('Type'), '-1110-status' => TTi18n::gettext('Status'), '-1210-time_stamp' => TTi18n::gettext('Date/Time'), '-1220-date' => TTi18n::gettext('Date'), '-1230-time' => TTi18n::gettext('Time'), '-1239-in_type' => TTi18n::gettext('In Type'), '-1240-in_time_stamp' => TTi18n::gettext('In Date/Time'), '-1250-in_punch_date' => TTi18n::gettext('In Date'), '-1260-in_punch_time' => TTi18n::gettext('In Time'), '-1269-out_type' => TTi18n::gettext('Out Type'), '-1270-out_time_stamp' => TTi18n::gettext('Out Date/Time'), '-1280-out_punch_date' => TTi18n::gettext('Out Date'), '-1290-out_punch_time' => TTi18n::gettext('Out Time'), '-1310-branch' => TTi18n::gettext('Branch'), '-1320-department' => TTi18n::gettext('Department'), '-1410-station_id' => TTi18n::gettext('Station ID'), '-1420-longitude' => TTi18n::gettext('Longitude'), '-1430-latitude' => TTi18n::gettext('Latitude'), '-1500-note' => TTi18n::gettext('Note'));
//Since getOptions() can be called without first setting a company, we don't always know the product edition for the currently
//logged in employee.
if (is_object($this->getCompanyObject()) and $this->getCompanyObject()->getProductEdition() >= TT_PRODUCT_CORPORATE or !is_object($this->getCompanyObject()) and getTTProductEdition() >= TT_PRODUCT_CORPORATE) {
$retval += array('-1330-job' => TTi18n::gettext('Job'), '-1340-job_item' => TTi18n::gettext('Task'), '-1350-quantity' => TTi18n::gettext('Quantity'), '-1360-bad_quantity' => TTi18n::gettext('Bad Quantity'));
}
$retval = Misc::addSortPrefix(Misc::prependArray($this->getUserIdentificationColumns(), Misc::trimSortPrefix($retval)));
ksort($retval);
break;
case 'column_aliases':
//Used for converting column names after they have been parsed.
$retval = array('type' => 'type_id', 'status' => 'status_id', 'branch' => 'branch_id', 'department' => 'department_id', 'job' => 'job_id', 'job_item' => 'job_item_id');
break;
case 'import_options':
$retval = array('-1010-fuzzy_match' => TTi18n::getText('Enable smart matching.'), '-1020-disable_rounding' => TTi18n::getText('Disable rounding.'));
break;
case 'parse_hint':
$upf = TTnew('UserPreferenceFactory');
$retval = array('branch' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'department' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'job' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'job_item' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'time_stamp' => $upf->getOptions('date_time_format'), 'in_time_stamp' => $upf->getOptions('date_time_format'), 'out_time_stamp' => $upf->getOptions('date_time_format'), 'date' => $upf->getOptions('date_format'), 'in_punch_date' => $upf->getOptions('date_format'), 'out_punch_date' => $upf->getOptions('date_format'), 'time' => $upf->getOptions('time_format'), 'in_punch_time' => $upf->getOptions('time_format'), 'out_punch_time' => $upf->getOptions('time_format'));
break;
}
return $retval;
}
示例13: _getFactoryOptions
function _getFactoryOptions($name)
{
$retval = NULL;
switch ($name) {
case 'length_of_service_unit':
$retval = array(10 => TTi18n::gettext('Day(s)'), 20 => TTi18n::gettext('Week(s)'), 30 => TTi18n::gettext('Month(s)'), 40 => TTi18n::gettext('Year(s)'), 50 => TTi18n::gettext('Hour(s)'));
break;
case 'columns':
$retval = array('-1010-length_of_service' => TTi18n::gettext('Length Of Service'), '-1020-length_of_service_unit' => TTi18n::gettext('Units'), '-1030-accrual_rate' => TTi18n::gettext('Accrual Rate'), '-1050-maximum_time' => TTi18n::gettext('Maximum Time'), '-1050-rollover_time' => TTi18n::gettext('Rollover Time'), '-2000-created_by' => TTi18n::gettext('Created By'), '-2010-created_date' => TTi18n::gettext('Created Date'), '-2020-updated_by' => TTi18n::gettext('Updated By'), '-2030-updated_date' => TTi18n::gettext('Updated Date'));
break;
case 'list_columns':
$retval = Misc::arrayIntersectByKey($this->getOptions('default_display_columns'), Misc::trimSortPrefix($this->getOptions('columns')));
break;
case 'default_display_columns':
//Columns that are displayed by default.
$retval = array('length_of_service', 'length_of_service_unit', 'accrual_rate', 'maximum_time', 'rollover_time');
break;
case 'unique_columns':
//Columns that are unique, and disabled for mass editing.
$retval = array();
break;
case 'linked_columns':
//Columns that are linked together, mainly for Mass Edit, if one changes, they all must.
$retval = array();
break;
}
return $retval;
}
示例14: index
public function index()
{
Cache::loadPage('', 30);
$inputData = array();
$postid = 0;
$curPage = 0;
// Model::loadWithPath('home',System::getThemePath().'model/');
if (!($match = Uri::match('tag\\/(\\w+)\\/?'))) {
Redirect::to('404page');
}
$friendly_url = addslashes($match[1]);
if ($match = Uri::match('page\\/(\\d+)')) {
$curPage = (int) $match[1];
}
$loadData = Post::get(array('limitShow' => 10, 'limitPage' => $curPage, 'cacheTime' => 30, 'where' => "where postid IN (select postid from post_tags where title='{$friendly_url}')", 'orderby' => "order by postid desc"));
if (!isset($loadData[0]['postid'])) {
Redirect::to('404page');
}
$inputData['newPost'] = $loadData;
$inputData['keywords'] = $friendly_url;
$inputData['listPage'] = Misc::genPage('tag/' . $friendly_url, $curPage);
System::setTitle('Tag "' . $friendly_url . '" results:');
self::makeContent('tag', $inputData);
Cache::savePage();
}
示例15: index
public function index()
{
$post = array('alert' => '');
Model::load('admincp/pages');
if ($match = Uri::match('\\/pages\\/(\\w+)')) {
if (method_exists("controlPages", $match[1])) {
$method = $match[1];
$this->{$method}();
die;
}
}
$curPage = 0;
if ($match = Uri::match('\\/page\\/(\\d+)')) {
$curPage = $match[1];
}
if (Request::has('btnAction')) {
actionProcess();
}
if (Request::has('btnSearch')) {
filterProcess();
} else {
$post['pages'] = Misc::genSmallPage('admincp/pages', $curPage);
$filterPending = '';
$post['theList'] = Pages::get(array('limitShow' => 20, 'limitPage' => $curPage, 'cacheTime' => 1));
}
System::setTitle('Pages list - ' . ADMINCP_TITLE);
View::make('admincp/head');
self::makeContents('pagesList', $post);
View::make('admincp/footer');
}