__('Send Link', 'secure-downloads') // Title of TAB , 'hint' => __('Send Link', 'secure-downloads') // Hint , 'page_title' => __('Send Link', 'secure-downloads') // Title of Page , 'link' => '' // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link , 'position' => '' // 'left' || 'right' || '' , 'css_classes' => '' // CSS class(es) , 'icon' => '' // Icon - link to the real PNG img , 'font_icon' => 'glyphicon glyphicon-th' // CSS definition of forn Icon , 'default' => true // Is this tab activated by default or not: true || false. , 'disabled' => false // Is this tab disbaled: true || false. , 'hided' => true // Is this tab hided: true || false. , 'subtabs' => array() ); // $subtabs = array(); // $tabs[ 'items' ][ 'subtabs' ] = $subtabs; return $tabs; } public function content() { // Checking //////////////////////////////////////////////////////////// do_action( 'opsd_hook_settings_page_header', array( 'page' => $this->in_page() ) ); // Define Notices Section and show some static messages, if needed. // $this->settings_api(); // Init Settings API & Get Data from DB // Define all fields and get values from DB // Submit ///////////////////////////////////////////////////////////// $submit_form_name = 'opsd_send_links_form'; // Define form name $data_after_update = false; if ( isset( $_POST['is_form_sbmitted_'. $submit_form_name ] ) ) { // Nonce checking {Return false if invalid, 1 if generated between, 0-12 hours ago, 2 if generated between 12-24 hours ago. } $nonce_gen_time = check_admin_referer( 'opsd_settings_page_' . $submit_form_name ); // Its stop show anything on submiting, if its not refear to the original page // Save Changes $data_after_update = $this->update(); $updated_data = '';//$data_after_update['original_validated_data']; } else { $updated_data = ''; } //$opsd_user_role_master = get_opsd_option( 'opsd_user_role_master' ); // O L D W A Y: Get Fields Data // JavaScript: Tooltips, Popover, Datepick (js & css) ////////////////// echo ''; opsd_js_for_items_page(); echo ''; ?>
js(); $this->css(); do_action( 'opsd_hook_settings_page_footer', 'send_links' ); } public function update() { $post_action_key = 'opsd_action'; if ( isset( $_POST[ $post_action_key ] ) && ( $_POST[ $post_action_key ] == 'go_send' ) ) { // Get Validated post $validated = array(); // Email $validated['opsd_email_to'] = OPSD_Settings_API::validate_email_post_static( 'opsd_email_to' ); // Is send copy to admin $validated['send_copy_to_admin'] = OPSD_Settings_API::validate_checkbox_post_static( 'send_copy_to_admin' ); // Products $validated['opsd_product_selection'] = OPSD_Settings_API::validate_select_post_static( 'opsd_product_selection' ); // Expire $validated['opsd_product_expire'] = OPSD_Settings_API::validate_select_post_static( 'opsd_product_expire' ); // IP lock $validated['opsd_product_ip_lock'] = OPSD_Settings_API::validate_text_post_static( 'opsd_product_ip_lock' ); // Check if we selected custom email template and need to send email even if the product was not selected $validated['continue_without_product'] = false; $validated = apply_filters( 'opsd_send_secure_links_validate_fields', $validated ); //Hook for validated fields. $response = opsd_send_secure_download_email_to_user( $validated ); //FixIn: 1.1.3.2 //debuge($response); $sent_summary_content = ''; switch ( $response[ 'status' ] ) { case 'error': if ( 'select_valid_product' == $response[ 'error_type' ] ) { opsd_show_fixed_message( __( 'Select valid product', 'secure-downloads' ), 3, 'updated error' ); // Show Message } break; case 'email_sent': // Get Summary about sending email and generating link ... $sent_summary_content = $this->get_sent_summary( $response['mail_api'], $response['product_replace'], $validated ); opsd_show_fixed_message ( __('Email sent to', 'secure-downloads') . ' ' . $validated['opsd_email_to'], 3 ); // Show Message break; case 'link_generated': // Get Summary about sending email and generating link ... $sent_summary_content = $this->get_sent_summary( $response['mail_api'], $response['product_replace'], $validated ); opsd_show_fixed_message ( __('Link generated', 'secure-downloads'), 3 ); // Show Message break; default: // Default } // Reload page after sending. Stop from sending once again, if refresh browser in mobile browser after some time ?> $validated, 'sent_summary_content' => $sent_summary_content ); // Exit, for do not parse } /* //$validated_fields = $this->settings_api()->validate_post(); // Get Validated Settings fields in $_POST request. //$validated_fields = apply_filters( 'opsd_settings_validate_fields_before_saving', $validated_fields ); //Hook for validated fields. // Skip saving specific option, for example in Demo mode. // unset($validated_fields['opsd_start_day_weeek']); //$this->settings_api()->save_to_db( $validated_fields ); // Save fields to DB //opsd_show_changes_saved_message(); //opsd_show_fixed_message ( __('Done', 'secure-downloads'), 0 ); // Show Message // O L D W A Y: Saving Fields Data // update_opsd_option( 'opsd_is_delete_if_deactive' // , OPSD_Settings_API::validate_checkbox_post('opsd_is_delete_if_deactive') ); // ( (isset( $_POST['opsd_is_delete_if_deactive'] ))?'On':'Off') ); */ return false; } public function get_sent_summary( $mail_api, $replace, $validated ) { if ( false === $mail_api ) { // Email disabled $mail_api = new OPSD_Emails_API_LinkUser( OPSD_EMAIL_LINK_USER_ID ); } // Parse for getting email content ///////////////////////////////// $mail_api->set_replace( $replace ); $content_email = $mail_api->get_content(); $subject_email = $mail_api->get_subject(); $mail_api->set_replace(); // Reset Email $pos = strpos($content_email, '', ++$pos ); $content_email = substr($content_email, ++$pos ); } //////////////////////////////////////////////////////////////////// ob_start(); opsd_open_meta_box_section( 'opsd_sent_summary', __('Summary', 'secure-downloads') ); //debuge($validated,$replace); ?>' . $validated['opsd_email_to'] . ' - ';
//echo ( $validated['send_copy_to_admin'] == 'On' ) ? ' [' . __('copy to administrator' , 'secure-downloads') . ']' : '';
if (
( isset( $replace[ 'product_summary' ] ) )
&& ( isset( $replace[ 'product_expire_date' ] ) )
)
echo $replace['product_summary'] . ' ' . $replace['product_expire_date'] . '';
?> |