コード例 #1
0
ファイル: manage.php プロジェクト: hikaram/wee
 public function get_template()
 {
     $nonce = !empty($_REQUEST['_wpnonce']) ? $_REQUEST['_wpnonce'] : '';
     if (!wp_verify_nonce($nonce, '_wpnonce-download_template')) {
         die(__('Security check', 'wp_all_export_plugin'));
     } else {
         $id = $this->input->get('id');
         $export = new PMXE_Export_Record();
         $filepath = '';
         $export_data = array();
         if (!$export->getById($id)->isEmpty()) {
             $template = new PMXI_Template_Record();
             if (!empty($export->options['template_name'])) {
                 $template->getByName($export->options['template_name']);
                 if (!$template->isEmpty()) {
                     $export_data[] = $template->toArray(TRUE);
                     $uploads = wp_upload_dir();
                     $targetDir = $uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::TEMP_DIRECTORY;
                     $export_file_name = "templates_" . uniqid() . ".txt";
                     file_put_contents($targetDir . DIRECTORY_SEPARATOR . $export_file_name, json_encode($export_data));
                     PMXI_download::csv($targetDir . DIRECTORY_SEPARATOR . $export_file_name);
                 }
             }
         }
     }
 }
コード例 #2
0
ファイル: index.php プロジェクト: hikaram/wee
                        echo add_query_arg(array('page' => 'pmxi-admin-import', 'id' => $item['options']['import_id'], 'deligate' => 'wpallexport'), remove_query_arg('page', $this->baseUrl));
                        ?>
"><?php 
                        _e("Import with WP All Import", "wp_all_export_plugin");
                        ?>
</a>
									<?php 
                    }
                    ?>
			
									<?php 
                    if (wp_all_export_is_compatible() and (empty($item['options']['cpt']) or !in_array('shop_order', $item['options']['cpt']))) {
                        $template = new PMXI_Template_Record();
                        if (!empty($item['options']['template_name'])) {
                            $template->getByName($item['options']['template_name']);
                            if (!$template->isEmpty()) {
                                ?>
													<br/>
													<a href="<?php 
                                echo add_query_arg(array('id' => $item['id'], 'action' => 'templates'), $this->baseUrl);
                                ?>
"><?php 
                                _e('Download Import Templates', 'wp_all_export_plugin');
                                ?>
</a>
													<?php 
                            }
                        }
                    }
                    ?>