AdminPageFramework_ImportOptions::getImportData PHP Метод

getImportData() публичный Метод

public getImportData ( )
    public function getImportData()
    {
        $sFilePath = $this->getElementInFilesArray($this->aFilesImport, $this->sInputID, 'tmp_name');
        $vData = file_exists($sFilePath) ? file_get_contents($sFilePath, true) : false;
        return $vData;
    }

Usage Example

 private function _importOptions($aStoredOptions, $sPageSlug, $sTabSlug)
 {
     $_oImport = new AdminPageFramework_ImportOptions($_FILES['__import'], $_POST['__import']);
     $_aArguments = array('class_name' => $this->oFactory->oProp->sClassName, 'page_slug' => $sPageSlug, 'tab_slug' => $sTabSlug, 'section_id' => $_oImport->getSiblingValue('section_id'), 'pressed_field_id' => $_oImport->getSiblingValue('field_id'), 'pressed_input_id' => $_oImport->getSiblingValue('input_id'), 'should_merge' => $_oImport->getSiblingValue('is_merge'));
     if ($_oImport->getError() > 0) {
         $this->oFactory->setSettingNotice($this->oFactory->oMsg->get('import_error'));
         return $aStoredOptions;
     }
     $_aMIMEType = $this->_getImportMIMEType($_aArguments);
     $_sType = $_oImport->getType();
     if (!in_array($_sType, $_aMIMEType)) {
         $this->oFactory->setSettingNotice(sprintf($this->oFactory->oMsg->get('uploaded_file_type_not_supported'), $_sType));
         return $aStoredOptions;
     }
     $_mData = $_oImport->getImportData();
     if (false === $_mData) {
         $this->oFactory->setSettingNotice($this->oFactory->oMsg->get('could_not_load_importing_data'));
         return $aStoredOptions;
     }
     $_sFormatType = $this->_getImportFormatType($_aArguments, $_oImport->getFormatType());
     $_oImport->formatImportData($_mData, $_sFormatType);
     $_sImportOptionKey = $this->_getImportOptionKey($_aArguments, $_oImport->getSiblingValue('option_key'));
     $_mData = $this->_getFilteredImportData($_aArguments, $_mData, $aStoredOptions, $_sFormatType, $_sImportOptionKey);
     $this->_setImportAdminNotice(empty($_mData));
     if ($_sImportOptionKey != $this->oFactory->oProp->sOptionKey) {
         update_option($_sImportOptionKey, $_mData);
         return $aStoredOptions;
     }
     return $_aArguments['should_merge'] ? $this->uniteArrays($_mData, $aStoredOptions) : $_mData;
 }
All Usage Examples Of AdminPageFramework_ImportOptions::getImportData