本文整理汇总了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;
}
}
}