本文整理匯總了PHP中PMXI_Import_Record::getbyId方法的典型用法代碼示例。如果您正苦於以下問題:PHP PMXI_Import_Record::getbyId方法的具體用法?PHP PMXI_Import_Record::getbyId怎麽用?PHP PMXI_Import_Record::getbyId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PMXI_Import_Record
的用法示例。
在下文中一共展示了PMXI_Import_Record::getbyId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* data load initialize
*
* @param mixed $filename please look at the load() method
*
* @access public
* @see load()
* @return void
*/
public function __construct($options = array('filename' => null, 'xpath' => '', 'delimiter' => '', 'encoding' => '', 'xml_path' => '', 'targetDir' => false))
{
PMXI_Plugin::$csv_path = $options['filename'];
$this->xpath = !empty($options['xpath']) ? $options['xpath'] : (!empty($_POST['xpath']) ? $_POST['xpath'] : '/node');
if (!empty($options['delimiter'])) {
$this->delimiter = $options['delimiter'];
} else {
$input = new PMXI_Input();
$id = $input->get('id', 0);
if (!$id) {
$id = $input->get('import_id', 0);
}
if ($id) {
$import = new PMXI_Import_Record();
$import->getbyId($id);
if (!$import->isEmpty()) {
$this->delimiter = $import->options['delimiter'];
}
}
}
if (!empty($options['encoding'])) {
$this->csv_encoding = $options['encoding'];
$this->auto_encoding = false;
}
if (!empty($options['xml_path'])) {
$this->xml_path = $options['xml_path'];
}
@ini_set("display_errors", 0);
@ini_set('auto_detect_line_endings', true);
$file_params = self::analyse_file($options['filename'], 1);
$this->set_settings(array('delimiter' => $file_params['delimiter']['value'], 'eol' => $file_params['line_ending']['value']));
unset($file_params);
$wp_uploads = wp_upload_dir();
$this->targetDir = empty($options['targetDir']) ? wp_all_import_secure_file($wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::UPLOADS_DIRECTORY) : $options['targetDir'];
$this->load($options['filename']);
}
示例2: feed
public function feed()
{
$nonce = !empty($_REQUEST['_wpnonce']) ? $_REQUEST['_wpnonce'] : '';
if (!wp_verify_nonce($nonce, '_wpnonce-download_feed')) {
die(__('Security check', 'wp_all_import_plugin'));
} else {
$import_id = $this->input->get('id');
$path = '';
$import = new PMXI_Import_Record();
$import->getbyId($import_id);
if (!$import->isEmpty()) {
$path = wp_all_import_get_absolute_path($import->path);
}
if (file_exists($path)) {
if (preg_match('%\\W(zip)$%i', trim(basename($path)))) {
PMXI_download::zip($path);
} elseif (preg_match('%\\W(xml)$%i', trim(basename($path)))) {
PMXI_download::xml($path);
} else {
PMXI_download::csv($path);
}
} else {
wp_redirect(add_query_arg(array('pmxi_nt' => urlencode(__('File does not exists.', 'wp_all_import_plugin'))), $this->baseUrl));
die;
}
}
}