-
Notifications
You must be signed in to change notification settings - Fork 70
/
AdminPageFramework_Form_Meta.php
33 lines (32 loc) · 1.6 KB
/
AdminPageFramework_Form_Meta.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
Admin Page Framework v3.8.26 by Michael Uno
Generated by PHP Class Files Script Generator <https://github.com/michaeluno/PHP-Class-Files-Script-Generator>
<http://en.michaeluno.jp/admin-page-framework>
Copyright (c) 2013-2021, Michael Uno; Licensed under MIT <http://opensource.org/licenses/MIT> */
class AdminPageFramework_Form_Meta extends AdminPageFramework_Form {
public function updateMetaDataByType($iObjectID, array $aInput, array $aSavedMeta, $sStructureType = 'post_meta_box') {
if (!$iObjectID) {
return;
}
$_aFunctionNameMapByFieldsType = array('post_meta_box' => 'update_post_meta', 'user_meta' => 'update_user_meta', 'term_meta' => 'update_term_meta',);
if (!in_array($sStructureType, array_keys($_aFunctionNameMapByFieldsType))) {
return;
}
$_sFunctionName = $this->getElement($_aFunctionNameMapByFieldsType, $sStructureType);
$aInput = $this->getInputsUnset($aInput, $this->sStructureType);
foreach ($aInput as $_sSectionOrFieldID => $_vValue) {
$this->_updateMetaDatumByFunctionName($iObjectID, $_vValue, $aSavedMeta, $_sSectionOrFieldID, $_sFunctionName);
}
}
private function _updateMetaDatumByFunctionName($iObjectID, $_vValue, array $aSavedMeta, $_sSectionOrFieldID, $_sFunctionName) {
if (is_null($_vValue)) {
return;
}
$_vSavedValue = $this->getElement($aSavedMeta, $_sSectionOrFieldID, null);
if ($_vValue == $_vSavedValue) {
return;
}
$_sFunctionName($iObjectID, $_sSectionOrFieldID, $_vValue);
}
}