/** * Performs exporting data. * * @since 2.0.0 */ public function doExport($vData, $sFileName = null, $sFormatType = null) { /* * Sample HTML elements that triggers the method. * e.g. * <input type="hidden" name="__export[export_sinble][file_name]" value="APF_GettingStarted_20130708.txt"> * <input type="hidden" name="__export[export_sinble][format]" value="json"> * <input id="export_and_import_export_sinble_0" * type="submit" * name="__export[submit][export_sinble]" * value="Export Options"> */ $sFileName = isset($sFileName) ? $sFileName : $this->sFileName; $sFormatType = isset($sFormatType) ? $sFormatType : $this->sFormatType; // Do export. header('Content-Description: File Transfer'); header('Content-Disposition: attachment; filename=' . $sFileName); switch (strtolower($sFormatType)) { case 'text': // for plain text. if (is_array($vData) || is_object($vData)) { die(AdminPageFramework_Debug::getArray($vData, null, false)); } die($vData); case 'json': // for json. die(json_encode((array) $vData)); case 'array': // for serialized PHP array. // for serialized PHP array. default: // for anything else, die(serialize((array) $vData)); } }
private function _getDebugInfo($aField) { if (!$this->_shouldShowDebugInfo($aField)) { return ''; } $_oToolTip = new AdminPageFramework_Form_View___ToolTip(array('title' => $this->oMsg->get('field_arguments'), 'dash-icon' => 'dashicons-info', 'icon_alt_text' => '[' . $this->oMsg->get('debug') . ' ]', 'content' => AdminPageFramework_Debug::getDetails($aField) . '<span class="admin-page-framework-info">' . $this->getFrameworkNameVersion() . ' (' . $this->oMsg->get('debug_info_will_be_disabled') . ')' . '</span>', 'attributes' => array('container' => array('class' => 'debug-info-field-arguments'))), $aField['field_id'] . '_debug'); return $_oToolTip->get(); }
private function _outputDataByType($vData, $sFormatType) { switch (strtolower($sFormatType)) { case 'text': if (in_array(gettype($vData), array('array', 'object'))) { echo AdminPageFramework_Debug::get($vData, null, false); } echo $vData; return; case 'json': echo json_encode((array) $vData); return; case 'array': default: echo serialize((array) $vData); return; } }
/** * Print out the contents in the front-end. * * Alternatively you may use the content_{instantiated class name} method. */ public function content($sContent, $aArguments, $aFormData) { return $sContent . '<p>' . __('Hello world! This is a widget created by Admin Page Framework.', 'admin-page-framework-loader') . '</p>' . AdminPageFramework_Debug::get($aArguments) . AdminPageFramework_Debug::get($aFormData); }
/** * Print out the contents in the front-end. * * Alternatively you may use the content_{instantiated class name} method. */ public function content($sContent, $aArguments, $aFormData) { return $sContent . '<p>' . __('Hello world! This is a widget created by Admin Page Framework with some custom field types.', 'admin-page-framework-demo') . '</p>' . AdminPageFramework_Debug::get($aArguments) . AdminPageFramework_Debug::get($aFormData); }
public function doExport($vData, $sFileName = null, $sFormatType = null) { $sFileName = isset($sFileName) ? $sFileName : $this->sFileName; $sFormatType = isset($sFormatType) ? $sFormatType : $this->sFormatType; header('Content-Description: File Transfer'); header('Content-Disposition: attachment; filename=' . $sFileName); switch (strtolower($sFormatType)) { case 'text': if (is_array($vData) || is_object($vData)) { die(AdminPageFramework_Debug::getArray($vData, null, false)); } die($vData); case 'json': die(json_encode((array) $vData)); case 'array': default: die(serialize((array) $vData)); } }
public static function logArray($asArray, $sFilePath = null) { self::showDeprecationNotice('AdminPageFramework_Debug::' . __FUNCTION__, 'AdminPageFramework_Debug::log()'); AdminPageFramework_Debug::log($asArray, $sFilePath); }