0) {
$uploaded_file = p3dlite_upload_file('p3dlite_settings', 'ajax_loader');
$settings_update['ajax_loader']=str_replace('http:','',$uploaded_file['url']);
}
else {
$settings_update['ajax_loader']=$settings['ajax_loader'];
}
/*
if (isset($_FILES['woo3dv_settings']['tmp_name']['view3d_button_image']) && strlen($_FILES['woo3dv_settings']['tmp_name']['view3d_button_image'])>0) {
$uploaded_file = woo3dv_upload_file('woo3dv_settings', 'view3d_button_image');
$settings_update['view3d_button_image']=str_replace('http:','',$uploaded_file['url']);
}
else {
$settings_update['view3d_button_image']=$settings['view3d_button_image'];
}
*/
if (!is_numeric($settings_update['num_decimals'])) $settings_update['num_decimals'] = 2;
if (empty($settings_update['canvas_width'])) $settings_update['canvas_width'] = 1024;
if (empty($settings_update['canvas_height'])) $settings_update['canvas_height'] = 768;
if (empty($settings_update['file_max_size'])) $settings_update['file_max_size'] = 20;
if (empty($settings_update['file_chunk_size'])) $settings_update['file_chunk_size'] = 2;
if (empty($settings_update['items_per_page'])) $settings_update['items_per_page'] = 10;
update_option( 'p3dlite_settings', $settings_update );
}
$settings=p3dlite_get_option( 'p3dlite_settings' );
#var_dump( $settings['ninjaforms_shortcode']);
# $shortcode_atts = shortcode_parse_atts( $settings['ninjaforms_shortcode'] );
# if (isset($shortcode_atts['id']))
# $form_id = (int)$shortcode_atts['id'];
# else
# $form_id = 0;
#p3dlite_clean_uploads();
add_thickbox();
#p3dlite_check_install();
$p3dlite_cache=p3dlite_get_option('p3dlite_cache');
$p3dlite_triangulation_cache=p3dlite_get_option('p3dlite_triangulation_cache');
?>
get_results( "select * from {$wpdb->prefix}p3dlite_printers where status=1", ARRAY_A );
if ($wpdb->num_rows==0) { //should not happen, but let's create a default one, at least one printer is required
$printer_default_data=array( 'name'=>'At least one active printer is required for the plugin to work', 'status'=>1, 'width'=>300, 'length'=>400, 'height'=>300 );
$wpdb->insert( $wpdb->prefix . 'p3dlite_printers', $printer_default_data );
}
if (isset($_POST['p3dlite_printers_description'])) {
update_option('p3dlite_printers_description', wp_kses_post(nl2br($_POST['p3dlite_printers_description'])));
}
if (isset($_GET['action']) && $_GET['action'] == 'edit') {
$printer_id = (int)$_GET['printer'];
$printer_result = $wpdb->get_results( "select * from {$wpdb->prefix}p3dlite_printers where id='$printer_id'", ARRAY_A );
$printer = $printer_result[0];
$materials=p3dlite_get_option( 'p3dlite_materials' );
$infills=p3dlite_get_option( 'p3dlite_infills' );
add_thickbox();
// if (count($_POST)) {
// $printers=p3dlite_get_option( 'p3dlite_printers' );
// foreach ($printers as $key => $printer) {
// wp_set_object_terms( 0, strval($key), 'pa_p3dlite_printer' , false );
// }
// }
include('3dprint-lite-admin-printers-edit.php');
}
elseif (isset($_GET['action']) && $_GET['action'] == 'clone') {
$printer_id = (int)$_GET['printer'];
$printer_result = $wpdb->get_results( "select * from {$wpdb->prefix}p3dlite_printers where id='$printer_id'", ARRAY_A );
$clone_data = $printer_result[0];
unset($clone_data['id']);
$wpdb->insert($wpdb->prefix."p3dlite_printers", $clone_data);
wp_redirect( admin_url( 'admin.php?page=p3dlite_printers&action=edit&printer='.(int)$wpdb->insert_id ) );
}
elseif (isset($_GET['action']) && $_GET['action'] == 'add') {
$default_printer_data = array(
'status' => '1',
'name' => 'New Printer',
'description' => '',
'photo' => '',
'type' => 'fff',
'full_color' => '1',
'platform_shape' => 'rectangle',
'width' => '300',
'length' => '400',
'height' => '300',
'diameter' => '300',
'min_side' => '1',
'price' => '0',
'price_type' => 'box_volume',
'infills' => '0,10,20,30,40,50,60,70,80,90,100',
'default_infill' => '20',
'materials' => "",
'group_name' => '',
'sort_order' => '0'
);
$wpdb->insert($wpdb->prefix."p3dlite_printers", $default_printer_data);
wp_redirect( admin_url( 'admin.php?page=p3dlite_printers&action=edit&printer='.(int)$wpdb->insert_id ) );
}
else {
include('3dprint-lite-admin-printers.php');
$p3dlitep_instance = p3dliteP_Plugin::get_instance();
$p3dlitep_instance->plugin_settings_page();
}
}
function register_3dprintlite_materials_page_callback() {
global $wpdb;
if ( $_GET['page'] != 'p3dlite_materials') return false;
if ( !current_user_can('administrator') ) return false;
$settings=p3dlite_get_option( 'p3dlite_settings' );
if (isset($_POST['p3dlite_materials_description'])) {
update_option('p3dlite_materials_description', wp_kses_post(nl2br($_POST['p3dlite_materials_description'])));
}
$wpdb->get_results( "select * from {$wpdb->prefix}p3dlite_materials where status=1", ARRAY_A );
if ($wpdb->num_rows==0) { //should not happen, but let's create a default one, at least one material is required
$default_material_data=array(
'status' => '1',
'name' => 'At least one active material is required for the plugin to work',
'description' => '',
'photo' => '',
'type' => 'filament',
'density' => '1.26',
'length' => '330',
'diameter' => '1.75',
'weight' => '1',
'price' => '0.03',
'price_type' => 'gram',
'roll_price' => '20',
'group_name' => 'PLA',
'color' => '#08c101',
'shininess' => 'plastic',
'glow' => '0',
'transparency' => 'opaque'
);
$wpdb->insert( $wpdb->prefix . 'p3dlite_materials', $default_material_data );
}
if (isset($_GET['action']) && $_GET['action'] == 'edit') {
$material_id = (int)$_GET['material'];
$material_result = $wpdb->get_results( "select * from {$wpdb->prefix}p3dlite_materials where id='$material_id'", ARRAY_A );
$material = $material_result[0];
add_thickbox();
// if (count($_POST)) {
// $materials=p3dlite_get_option( 'p3dlite_materials' );
// foreach ($materials as $key => $material) {
// wp_set_object_terms( 0, strval($key), 'pa_p3dlite_material' , false );
// }
// }
include('3dprint-lite-admin-materials-edit.php');
}
elseif (isset($_GET['action']) && $_GET['action'] == 'clone') {
$material_id = (int)$_GET['material'];
$material_result = $wpdb->get_results( "select * from {$wpdb->prefix}p3dlite_materials where id='$material_id'", ARRAY_A );
$clone_data = $material_result[0];
unset($clone_data['id']);
$wpdb->insert($wpdb->prefix."p3dlite_materials", $clone_data);
wp_redirect( admin_url( 'admin.php?page=p3dlite_materials&action=edit&material='.(int)$wpdb->insert_id ) );
}
elseif (isset($_GET['action']) && $_GET['action'] == 'add') {
$default_material_data = array(
'status' => '1',
'name' => 'New Material',
'description' => '',
'photo' => '',
'type' => 'filament',
'density' => '1.26',
'length' => '330',
'diameter' => '1.75',
'weight' => '1',
'price' => '0.03',
'price_type' => 'gram',
'roll_price' => '20',
'group_name' => 'PLA',
'color' => '#08c101',
'shininess' => 'plastic',
'glow' => '0',
'transparency' => 'opaque'
);
$wpdb->insert($wpdb->prefix."p3dlite_materials", $default_material_data);
wp_redirect( admin_url( 'admin.php?page=p3dlite_materials&action=edit&material='.(int)$wpdb->insert_id ) );
}
else {
include('3dprint-lite-admin-materials.php');
$p3dlitem_instance = p3dliteM_Plugin::get_instance();
$p3dlitem_instance->plugin_settings_page();
}
}
function register_3dprintlite_coatings_page_callback() {
global $wpdb;
if ( $_GET['page'] != 'p3dlite_coatings') return false;
if ( !current_user_can('administrator') ) return false;
$settings=p3dlite_get_option( 'p3dlite_settings' );
if (isset($_POST['p3dlite_coatings_description'])) {
update_option('p3dlite_coatings_description', wp_kses_post(nl2br($_POST['p3dlite_coatings_description'])));
}
$materials=p3dlite_get_option( 'p3dlite_materials' );
add_thickbox();
// if (count($_POST)) {
// $coatings=p3dlite_get_option( 'p3dlite_coatings' );
// foreach ($coatings as $key => $coating) {
// wp_set_object_terms( 0, strval($key), 'pa_p3dlite_coating' , false );
// }
// }
if (isset($_GET['action']) && $_GET['action'] == 'edit') {
$coating_id = (int)$_GET['coating'];
$coating_result = $wpdb->get_results( "select * from {$wpdb->prefix}p3dlite_coatings where id='$coating_id'", ARRAY_A );
$coating = $coating_result[0];
add_thickbox();
// if (count($_POST)) {
// $coatings=p3dlite_get_option( 'p3dlite_coatings' );
// foreach ($coatings as $key => $coating) {
// wp_set_object_terms( 0, strval($key), 'pa_p3dlite_coating' , false );
// }
// }
include('3dprint-lite-admin-coatings-edit.php');
}
elseif (isset($_GET['action']) && $_GET['action'] == 'clone') {
$coating_id = (int)$_GET['coating'];
$coating_result = $wpdb->get_results( "select * from {$wpdb->prefix}p3dlite_coatings where id='$coating_id'", ARRAY_A );
$clone_data = $coating_result[0];
unset($clone_data['id']);
$wpdb->insert($wpdb->prefix."p3dlite_coatings", $clone_data);
wp_redirect( admin_url( 'admin.php?page=p3dlite_coatings&action=edit&coating='.(int)$wpdb->insert_id ) );
}
elseif (isset($_GET['action']) && $_GET['action'] == 'add') {
$default_coating_data = array(
'status' => '1',
'name' => 'New Coating',
'description' => '',
'photo' => '',
'color' => '#08c101',
);
$wpdb->insert($wpdb->prefix."p3dlite_coatings", $default_coating_data);
wp_redirect( admin_url( 'admin.php?page=p3dlite_coatings&action=edit&coating='.(int)$wpdb->insert_id ) );
}
else {
include('3dprint-lite-admin-coatings.php');
$p3dlitec_instance = p3dliteC_Plugin::get_instance();
$p3dlitec_instance->plugin_settings_page();
}
}
function register_3dprintlite_price_requests_page_callback() {
global $wpdb;
if ( $_GET['page'] != 'p3dlite_price_requests') return false;
if ( !current_user_can('administrator') ) return false;
$settings=p3dlite_get_option( 'p3dlite_settings' );
if (isset($_GET['action']) && $_GET['action'] == 'edit') {
$price_request_id = (int)$_GET['price_request'];
if (empty($price_request_id)) {
wp_redirect( admin_url( 'admin.php?page=p3dlite_price_requests' ) );
}
$price_request_result = $wpdb->get_results( "select * from {$wpdb->prefix}p3dlite_price_requests where id='$price_request_id'", ARRAY_A );
$price_request = $price_request_result[0];
include('3dprint-lite-admin-price-requests-edit.php');
}
else {
include('3dprint-lite-admin-price-requests.php');
$p3dlitepr_instance = p3dlitePR_Plugin::get_instance();
$p3dlitepr_instance->plugin_settings_page();
}
# p3dlite_check_install();
}
function register_3dprintlite_email_templates_page_callback() {
global $wpdb;
if ( $_GET['page'] != 'p3dlite_email_templates') return false;
if ( !current_user_can('administrator') ) return false;
$settings=p3dlite_get_option( 'p3dlite_settings' );
if ( isset( $_POST['p3dlite_email_templates'] ) && !empty( $_POST['p3dlite_email_templates'] ) ) {
if ( ! isset( $_POST['p3d_email_templates_edit'] ) || ! wp_verify_nonce( $_POST['p3d_email_templates_edit'], 'update' ) ) {
print 'Sorry, your nonce did not verify.';
exit;
}
$templates_update = p3dlite_sanitize_templates($_POST['p3dlite_email_templates']);
if (isset($templates_update['client_email_preserve_html']) && $templates_update['client_email_preserve_html']=='on') {
$templates_update['client_email_body'] = $templates_update['client_email_body_raw'];
}
else {
$templates_update['client_email_body'] = nl2br($templates_update['client_email_body']);
}
if (isset($templates_update['admin_email_preserve_html']) && $templates_update['admin_email_preserve_html']=='on') {
$templates_update['admin_email_body'] = $templates_update['admin_email_body_raw'];
}
else {
$templates_update['admin_email_body'] = nl2br($templates_update['admin_email_body']);
}
update_option( 'p3dlite_email_templates', $templates_update );
}
$current_templates = get_option( 'p3dlite_email_templates' );
#p3dlite_check_install();
?>
Available in Premium version
Available in Premium version
Requires a subscription!
Screenshot:
Available in Premium version
Screenshot: