本文整理汇总了PHP中Tinebase_Helper::in_array_case方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Helper::in_array_case方法的具体用法?PHP Tinebase_Helper::in_array_case怎么用?PHP Tinebase_Helper::in_array_case使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_Helper
的用法示例。
在下文中一共展示了Tinebase_Helper::in_array_case方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _doMapping
/**
* do the mapping and replacements
*
* @param VCard $card
* @param array $_headline [optional]
* @return array
*
* @todo split this into smaller parts
*/
protected function _doMapping($card)
{
$data = array();
$data = $this->_getName($card, $data);
$data = $this->_getPhoto($card, $data);
$data = $this->_getUrl($card, $data);
// TODO check sample format support
// BDAY:1996-04-15
// BDAY:1953-10-15T23:10:00Z
// BDAY:1987-09-27T08:30:00-06:00
if ($card->getProperty('BDAY')) {
$data['bday'] = $card->getProperty('BDAY')->value;
}
$addressProperty = $card->getProperty('ADR') ? 'ADR' : ($card->getProperty('ITEM1.ADR') ? 'ITEM1.ADR' : '');
if ($addressProperty) {
$properties = $card->getProperties($addressProperty);
foreach ($properties as $property) {
if (!array_key_exists('TYPE', $property->params)) {
$property->params['TYPE'] = 'work';
}
// types available from RFC : 'dom', 'intl', 'postal', 'parcel', 'home', 'work', 'pref'
$types = $property->params['TYPE'];
//post office box; the extended address; the street
//address; the locality (e.g., city); the region (e.g., state or
//province); the postal code; the country name
$components = $property->getComponents();
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Address components ' . print_r($components, TRUE));
}
$mapping = array(NULL, 'street2', 'street', 'locality', 'region', 'postalcode', 'countryname');
$adrType = $types && Tinebase_Helper::in_array_case($types, 'home') ? 'two' : 'one';
foreach ($components as $index => $value) {
if (!isset($mapping[$index]) || $mapping[$index] === NULL) {
continue;
}
$data['adr_' . $adrType . '_' . $mapping[$index]] = $value;
}
}
}
// $properties = $card->getProperties('LABEL'); //NOT_IMPLEMENTED
if ($card->getProperty('TEL')) {
$properties = $card->getProperties('TEL');
foreach ($properties as $property) {
// types available from RFC : "home", "msg", "work", "pref", "voice", "fax", "cell", "video", "pager", "bbs", "modem", "car", "isdn", "pcs"
$types = $property->params['TYPE'];
$key = 'tel_work';
if ($types) {
if (Tinebase_Helper::in_array_case($types, 'home') && !Tinebase_Helper::in_array_case($types, 'cell') && !Tinebase_Helper::in_array_case($types, 'fax')) {
$key = 'tel_home';
} else {
if (Tinebase_Helper::in_array_case($types, 'home') && Tinebase_Helper::in_array_case($types, 'cell')) {
$key = 'tel_cell_private';
} else {
if (Tinebase_Helper::in_array_case($types, 'home') && Tinebase_Helper::in_array_case($types, 'fax')) {
$key = 'tel_fax_home';
} else {
if (Tinebase_Helper::in_array_case($types, 'work') && !Tinebase_Helper::in_array_case($types, 'cell') && !Tinebase_Helper::in_array_case($types, 'fax')) {
$key = 'tel_work';
} else {
if (Tinebase_Helper::in_array_case($types, 'work') && Tinebase_Helper::in_array_case($types, 'cell')) {
$key = 'tel_cell';
} else {
if (Tinebase_Helper::in_array_case($types, 'work') && !Tinebase_Helper::in_array_case($types, 'fax')) {
$key = 'tel_fax';
} else {
if (Tinebase_Helper::in_array_case($types, 'car')) {
$key = 'tel_car';
} else {
if (Tinebase_Helper::in_array_case($types, 'pager')) {
$key = 'tel_pager';
} else {
if (Tinebase_Helper::in_array_case($types, 'fax')) {
$key = 'tel_fax';
} else {
if (Tinebase_Helper::in_array_case($types, 'cell')) {
$key = 'tel_cell';
}
}
}
}
}
}
}
}
}
}
}
$data[$key] = $property->value;
//$data['tel_assistent'] = ''; //RFC has *a lot* of type, but not this one ^^
}
}
//.........这里部分代码省略.........
示例2: createAllDemoData
/**
* creates demo data for all applications
* accepts same arguments as Tinebase_Frontend_Cli_Abstract::createDemoData
* and the additional argument "skipAdmin" to force no user/group/role creation
*
* @param Zend_Console_Getopt $_opts
*/
public function createAllDemoData($_opts)
{
if (!$this->_checkAdminRight()) {
return FALSE;
}
// fetch all applications and check if required are installed, otherwise remove app from array
$applications = Tinebase_Application::getInstance()->getApplicationsByState(Tinebase_Application::ENABLED)->name;
foreach ($applications as $appName) {
echo 'Searching for DemoData in application "' . $appName . '"...' . PHP_EOL;
$className = $appName . '_Setup_DemoData';
if (class_exists($className)) {
echo 'DemoData in application "' . $appName . '" found!' . PHP_EOL;
$required = $className::getRequiredApplications();
foreach ($required as $requiredApplication) {
if (!Tinebase_Helper::in_array_case($applications, $requiredApplication)) {
echo 'Creating DemoData for Application ' . $appName . ' is impossible, because application "' . $requiredApplication . '" is not installed.' . PHP_EOL;
continue 2;
}
}
$this->_applicationsToWorkOn[$appName] = array('appName' => $appName, 'required' => $required);
} else {
echo 'DemoData in application "' . $appName . '" not found.' . PHP_EOL . PHP_EOL;
}
}
unset($applications);
foreach ($this->_applicationsToWorkOn as $app => $cfg) {
$this->_createDemoDataRecursive($app, $cfg, $_opts);
}
return 0;
}
示例3: inCategories
/**
* Returns true if the card belongs to at least one of the categories.
*/
function inCategories(&$categories)
{
$our_categories = $this->getCategories();
foreach ($categories as $category) {
if (Tinebase_Helper::in_array_case($category, $our_categories)) {
return true;
}
}
return false;
}