コード例 #1
0
  global $wpi_settings;
  $user_information = apply_filters('wpi_user_information', $wpi_settings['user_meta']['custom']);
  //$user_information = array_merge($wpi_settings['user_meta']['required'], $custom_user_information);
  
 ?>

 

  <h3><?php _e('Billing / Invoicing Info', WPI) ?></h3>
  <a name="billing_info"></a>
  <table class="form-table" >

  <?php foreach ($user_information as $field_id => $field_name) { ?>
  <tr>
        <th><?php _e($field_name, WPI) ?></th>
        <td><?php echo WPI_UI::input("class=regular-text&name=$field_id&value=".get_user_meta($user_id, $field_id, true)); ?></td>
    </tr>  
  <?php } ?>


   
  <tr>
  <th></th>
  <td>
  

  </td>
  </tr>

  
</table>
コード例 #2
0
  global $wpi_settings, $wpdb; 
 
?>

<div class="wrap">
  <h2>&nbsp;</h2>
  <div class="postbox" id="wp_new_invoice_div">
    <div class="inside">
      <form action="<?php echo $wpi_settings['links']['manage_invoice']; ?>" method='POST' id="wpi_new_invoice_form">
        <?php echo WPI_UI::input("name=wpi[new_invoice][invoice_id]&value=".rand(10000000, 90000000)."&type=hidden"); ?>
        <table class="form-table" id="get_user_info">
          <tr class="invoice_main">
            <th><label for="wp_invoice_userlookup"><?php _e('E-mail Address:', WPI); ?></label></th>
            <td>
              <?php WPI_UI::draw_user_auto_complete_field(); ?>
              <input type="submit" class="button" id="wp_invoice_create_new_invoice" value="<?php esc_attr(_e('Create New', WPI)); ?>">
              <?php if($wpi_settings['total_invoice_count']) { ?>
                <span id="wp_invoice_copy_invoice" class="wp_invoice_click_me">copy from another</span><br />
                <div class="wp_invoice_copy_invoice">
                  <?php $all_invoices = $wpdb->get_results("SELECT ID FROM ".$wpdb->posts." WHERE post_type = 'wpi_object' AND post_title != ''"); ?>
                    <select name="wpi[new_invoice][template_copy]">
                    <option><?php _e('-- Select Invoice --', WPI) ?></option>
                    <?php foreach ($all_invoices as $invoice) {
                            $invoice_id = wpi_post_id_to_invoice_id($invoice->ID);
                            $invoice_obj = new WPI_Invoice();
                            $invoice_obj->load_invoice("id=".$invoice_id);
                            //print_r( $invoice_obj );
                            if ( $invoice_obj->data['type'] != 'single_payment' ) :
                    ?>
                    <option value="<?php echo $invoice_id; ?>">
コード例 #3
0
ファイル: class_wpi_stripe.php プロジェクト: JSpier/smacamp
    /**
     * Fields renderer for STRIPE
     * @param type $invoice
     */
    function wpi_payment_fields($invoice)
    {
        $this->front_end_fields = apply_filters('wpi_crm_custom_fields', $this->front_end_fields, 'crm_data');
        if (!empty($this->front_end_fields)) {
            //** For each section */
            foreach ($this->front_end_fields as $key => $value) {
                //** If section is not empty */
                if (!empty($this->front_end_fields[$key])) {
                    $html = '';
                    ob_start();
                    ?>
          <ul class="wpi_checkout_block">
            <li class="section_title"><?php 
                    _e(ucwords(str_replace('_', ' ', $key)), WPI);
                    ?>
</li>
            <?php 
                    $html = ob_get_clean();
                    echo $html;
                    //** For each field */
                    foreach ($value as $field_slug => $field_data) {
                        //** Change field properties if we need */
                        $field_data = apply_filters('wpi_payment_form_styles', $field_data, $field_slug, 'wpi_stripe');
                        $html = '';
                        ob_start();
                        switch ($field_data['type']) {
                            case self::TEXT_INPUT_TYPE:
                                ?>

                  <li class="wpi_checkout_row">
                    <div class="control-group">
                      <label class="control-label" for="<?php 
                                echo esc_attr($field_slug);
                                ?>
"><?php 
                                _e($field_data['label'], WPI);
                                ?>
</label>
                      <div class="controls">
                        <input type="<?php 
                                echo esc_attr($field_data['type']);
                                ?>
" class="<?php 
                                echo esc_attr($field_data['class']);
                                ?>
"  name="<?php 
                                echo esc_attr($field_data['name']);
                                ?>
" value="<?php 
                                echo isset($field_data['value']) ? $field_data['value'] : (!empty($invoice['user_data'][$field_slug]) ? $invoice['user_data'][$field_slug] : '');
                                ?>
" />
                      </div>
                    </div>
                  </li>

                  <?php 
                                $html = ob_get_clean();
                                break;
                            case self::SELECT_INPUT_TYPE:
                                ?>

                  <li class="wpi_checkout_row">
                    <label for="<?php 
                                echo esc_attr($field_slug);
                                ?>
"><?php 
                                _e($field_data['label'], WPI);
                                ?>
</label>
                    <?php 
                                echo WPI_UI::select("name={$field_data['name']}&values={$field_data['values']}&id={$field_slug}&class={$field_data['class']}");
                                ?>
                  </li>

                  <?php 
                                $html = ob_get_clean();
                                break;
                            default:
                                break;
                        }
                        echo $html;
                    }
                    echo '</ul>';
                }
            }
        }
    }
コード例 #4
0
ファイル: first_time_setup.php プロジェクト: JSpier/smacamp
            ?>
                    <?php 
            echo WPI_UI::textarea(array('name' => "wpi_settings[billing][{$key}][settings][{$key2}][value]", 'value' => $setting_value['value'], 'special' => 'readonly="readonly"'));
            ?>
                  <?php 
        } elseif (isset($setting_value['type']) && $setting_value['type'] == 'static') {
            ?>
                    <p><?php 
            echo !empty($setting_value['data']) ? $setting_value['data'] : '';
            ?>
</p>
                  <?php 
        } else {
            ?>
                    <?php 
            echo WPI_UI::input(array('type' => 'text', 'name' => "wpi_settings[billing][{$key}][settings][{$key2}][value]", 'value' => !empty($setting_value['value']) ? $setting_value['value'] : ""));
            ?>
                  <?php 
        }
        ?>
                  <?php 
        if (!empty($setting_value['special']) && is_array($setting_value['special']) && (!isset($setting_value['type']) || $setting_value['type'] != 'select')) {
            ?>
                    <?php 
            $s_count = 0;
            ?>
                    <br/>
                    <?php 
            foreach ($setting_value['special'] as $s_label => $s_value) {
                ?>
                    <span class="wp_invoice_click_me <?php 
  function plugins($wpi_settings) {

    $parseUrl = parse_url(trim(get_bloginfo('url')));
    $this_domain = trim($parseUrl['host'] ? $parseUrl['host'] : array_shift(explode('/', $parseUrl['path'], 2)));

    ?>

      <table id="wpi_premium_feature_table" cellpadding="0" cellspacing="0">
        <thead>
        <tr>
          <td colspan="2" class="wpi_premium_feature_intro">
              <span class="header"><?php _e('WP-Invoice Premium Features',WPI) ?></span>
              <p><?php _e('When purchasing the premium features you will need to specify your domain to add the license correctly.  This is your domain:',WPI); echo ' <b>'. $this_domain .'</b>'; ?></p>
              <p id="wpi_plugins_ajax_response" class="hidden"></p>
          </td>
        </tr>
        </thead>
        <?php if(!empty($wpi_settings['available_features'])) :
          foreach($wpi_settings['available_features'] as $plugin_slug => $plugin_data): ?>
        <input type="hidden" name="wpi_settings[available_features][<?php echo $plugin_slug; ?>][title]" value="<?php echo $plugin_data['title']; ?>" />
        <input type="hidden" name="wpi_settings[available_features][<?php echo $plugin_slug; ?>][tagline]" value="<?php echo $plugin_data['tagline']; ?>" />
        <input type="hidden" name="wpi_settings[available_features][<?php echo $plugin_slug; ?>][image]" value="<?php echo $plugin_data['image']; ?>" />
        <input type="hidden" name="wpi_settings[available_features][<?php echo $plugin_slug; ?>][description]" value="<?php echo $plugin_data['description']; ?>" />

        <?php $installed = WPI_Functions::check_premium($plugin_slug); ?>
        <?php $active = (@$wpi_settings['installed_features'][$plugin_slug]['disabled'] != 'false' ? true : false); ?>

        <?php if($installed): ?>
        <?php /* Do this to preserve settings after page save. */ ?>
        <input type="hidden" name="wpi_settings[installed_features][<?php echo $plugin_slug; ?>][disabled]" value="<?php echo $wpi_settings['installed_features'][$plugin_slug]['disabled']; ?>" />
        <input type="hidden" name="wpi_settings[installed_features][<?php echo $plugin_slug; ?>][name]" value="<?php echo $wpi_settings['installed_features'][$plugin_slug]['name']; ?>" />
        <input type="hidden" name="wpi_settings[installed_features][<?php echo $plugin_slug; ?>][version]" value="<?php echo $wpi_settings['installed_features'][$plugin_slug]['version']; ?>" />
        <input type="hidden" name="wpi_settings[installed_features][<?php echo $plugin_slug; ?>][description]" value="<?php echo $wpi_settings['installed_features'][$plugin_slug]['description']; ?>" />
        <?php endif; ?>
        <tr class="wpi_premium_feature_block">

          <td valign="top" class="wpi_premium_feature_image">
            <?php if(!empty($plugin_data['image'])) { ?>
            <a href="http://usabilitydynamics.com/products/wp-invoice/"><img src="<?php echo $plugin_data['image']; ?>" /></a>
            <?php } ?>
          </td>

          <td valign="top">
            <div class="wpi_box">
            <div class="wpi_box_header">
              <strong><?php echo $plugin_data['title']; ?></strong>
              <p><?php echo $plugin_data['tagline']; ?> <a href="https://usabilitydynamics.com/products/wp-invoice/premium/?wp_checkout_payment_domain=<?php echo $this_domain; ?>"><?php _e('[purchase feature]', WPI) ?></a>
              </p>
            </div>
            <div class="wpi_box_content">
              <p><?php echo $plugin_data['description']; ?></p>
            </div>

            <div class="wpi_box_footer clearfix">
              <?php if($installed) { ?>

                <div class="alignleft">
                <?php

                if($wpi_settings['installed_features'][$plugin_slug]['needs_higher_wpi_version'] == 'true')  {
                  printf(__('This feature is disabled because it requires WP-Invoice %1$s or higher.'), $wpi_settings['installed_features'][$plugin_slug]['minimum_wpi_version']);
                } else {
                  echo WPI_UI::checkbox("value=true&name=wpi_settings[installed_features][$plugin_slug][disabled]&label=" . __('Disable premium feature.',WPI), $wpi_settings['installed_features'][$plugin_slug]['disabled']);

                 ?>
                </div>
                <div class="alignright"><?php _e('Feature installed, using version',WPI) ?> <?php echo $wpi_settings['installed_features'][$plugin_slug]['version']; ?>.</div>
              <?php }
              } else {
                  $pr_link = 'https://usabilitydynamics.com/products/wp-invoice/premium/'; echo sprintf(__('Please visit <a href="%s">UsabilityDynamics.com</a> to purchase this feature.',WPI),$pr_link);
              } ?>
            </div>
            </div>
          </td>
        </tr>
      <?php endforeach; else: ?>
        <tr>
          <td class="wpi_features_not_found"><?php _e('There are no available premium features.', WPI); ?></td><td></td>
        </tr>
      <?php endif; ?>
      </table>

    <?php

  }
コード例 #6
0
ファイル: wpi_chargify.php プロジェクト: JSpier/smacamp
    /**
     * Our main settings page
     */
    function wpi_chargify_settings()
    {
        global $wpi_settings;
        if ($this->enabled) {
            /** Chargify is enabled */
            $products = isset($wpi_settings['chargify']['products']) && $wpi_settings['chargify']['products'] ? json_decode($wpi_settings['chargify']['products']) : false;
            $components = isset($wpi_settings['chargify']['components']) && $wpi_settings['chargify']['components'] ? json_decode($wpi_settings['chargify']['components'], ARRAY_A) : false;
            if ($products) {
                usort($products, 'wpi_chargify::sort_by_product_family');
            }
            ?>

      <div class="wpi_box chargify">
        <div class="wpi_box_header">
          <strong><?php 
            _e('Subscription Based Payments via Chargify', WPI);
            ?>
</strong>
        </div>
        <div class="wpi_box_content">

          <h3 class="title"><?php 
            _e('General Information', WPI);
            ?>
</h3> <?php 
            if ($this->shell) {
                ?>
            <table class="form-table">
              <tr class="wpi_something_advanced_wrapper">
                <th><?php 
                _e("WPI API Key ", WPI);
                ?>
</th>
                <td> <?php 
                if ($this->valid_api_key) {
                    echo $wpi_settings['wpi_api_key'];
                } else {
                    _e('Oops, it looks like you haven\'t set your WPI API key on the Premium Features tab. Chargify will <strong>not</strong> work in it\'s current state.', WPI);
                }
                ?>
                </td>
              </tr>
            </table> <?php 
            } else {
                ?>
            <table class="form-table">
              <tr class="wpi_something_advanced_wrapper">
                <th><?php 
                _e("Domain", WPI);
                ?>
</th>
                <td><?php 
                echo WPI_UI::input("name=wpi_settings[chargify][domain]&value={$wpi_settings['chargify']['domain']}");
                ?>
</td>
              </tr>
              <tr class="wpi_something_advanced_wrapper">
                <th><?php 
                _e("API Key", WPI);
                ?>
</th>
                <td><?php 
                echo WPI_UI::input("name=wpi_settings[chargify][api_key]&value={$wpi_settings['chargify']['api_key']}");
                ?>
</td>
              </tr>
            </table> <?php 
            }
            if ($this->valid_api_key) {
                ?>
            <h3><?php 
                _e('Chargify Product Information', WPI);
                ?>
</h3> <?php 
                if (!$products) {
                    ?>

              <?php 
                    _e('No products currently found, please update your API settings and ', WPI);
                    ?>
              <a id="wpi_ajax_check_chargify_products" href="#"
                 class="button"><?php 
                    _e('Check for Chargify Products', WPI);
                    ?>
</a> <?php 
                } else {
                    ?>

              <table class="form-table">
                <tr class="wpi_something_advanced_wrapper">
                  <th><?php 
                    _e("Update Products", WPI);
                    ?>
</th>
                  <td><a id="wpi_ajax_check_chargify_products" href="#" class="button"><?php 
                    _e('Go', WPI);
                    ?>
</a>
                  </td>
                </tr>
                <tr class="wpi_something_advanced_wrapper">
                  <th><?php 
                    _e("Products Last Updated At", WPI);
                    ?>
</th>
                  <td><?php 
                    echo wpi_chargify::format_date($wpi_settings['chargify']['products_last_updated']);
                    ?>
</td>
                </tr>
                <tr class="wpi_something_advanced_wrapper">
                  <th><?php 
                    _e("Management Shortcode", WPI);
                    ?>
</th>
                  <td><code>[wpi_chargify_frontend_manage]</code></td>
                </tr>
                <tr class="wpi_something_advanced_wrapper">
                  <th colspan="2"><?php 
                    _e("Products", WPI);
                    ?>
</th>
                </tr>
                <tr class="wpi_something_advanced_wrapper">
                  <td colspan="2">

                    <table class="wp-list-table widefat wpi_chargify_products">
                      <thead>
                      <tr>
                        <th class="name"><?php 
                    _e('Name', WPI);
                    ?>
</th>
                        <th class="trial"><?php 
                    _e('Trial', WPI);
                    ?>
</th>
                        <th class="price"><?php 
                    _e('Price', WPI);
                    ?>
</th>
                      </tr>
                      </thead>
                      <tfoot>
                      <tr>
                        <th><?php 
                    _e('Name', WPI);
                    ?>
</th>
                        <th><?php 
                    _e('Trial', WPI);
                    ?>
</th>
                        <th><?php 
                    _e('Price', WPI);
                    ?>
</th>
                      </tr>
                      </tfoot>
                      <tbody> <?php 
                    foreach ($products as $product) {
                        $alternate = isset($alternate) && !$alternate ? 'alternate' : '';
                        ?>
                        <tr class="product <?php 
                        echo $alternate;
                        ?>
">
                          <td>
                            <?php 
                        echo $product->product_family->name;
                        ?>
 - <?php 
                        echo $product->name;
                        ?>
                            <div class="shortcode">
                              <code>[wpi_chargify_product name="<?php 
                        echo $product->handle;
                        ?>
"]</code>
                            </div>
                          </td>
                          <td><?php 
                        echo wpi_chargify::get_trial_line($product);
                        ?>
</td>
                          <td><?php 
                        echo wpi_chargify::get_price_line($product);
                        ?>
</td>
                        </tr> <?php 
                    }
                    ?>
                      </tbody>
                    </table>

                  </td>
                </tr> <?php 
                    if (isset($components) && is_array($components) && count($components)) {
                        ?>
                  <tr class="wpi_something_advanced_wrapper">
                    <th colspan="2"><?php 
                        _e("Components", WPI);
                        ?>
</th>
                  </tr>
                  <tr class="wpi_something_advanced_wrapper">
                    <td colspan="2">

                      <table class="wp-list-table widefat wpi_chargify_components">
                        <thead>
                        <tr>
                          <th class="name"><?php 
                        _e('Name', WPI);
                        ?>
</th>
                          <th class="trial"><?php 
                        _e('Type', WPI);
                        ?>
</th>
                          <th class="price"><?php 
                        _e('Price', WPI);
                        ?>
</th>
                        </tr>
                        </thead>
                        <tfoot>
                        <tr>
                          <th><?php 
                        _e('Name', WPI);
                        ?>
</th>
                          <th><?php 
                        _e('Type', WPI);
                        ?>
</th>
                          <th><?php 
                        _e('Price', WPI);
                        ?>
</th>
                        </tr>
                        </tfoot>
                        <tbody> <?php 
                        foreach ($products as $product) {
                            if (isset($last_component) && $last_component == $product->product_family->id) {
                                continue;
                            }
                            if (!is_array($components[$product->product_family->id]) || !count($components[$product->product_family->id])) {
                                continue;
                            }
                            foreach ($components[$product->product_family->id] as $component) {
                                $alternate = isset($alternate) && !$alternate ? 'alternate' : '';
                                ?>
                            <tr class="component <?php 
                                echo $alternate;
                                ?>
">
                              <td><?php 
                                echo $product->product_family->name;
                                ?>
                                - <?php 
                                echo $component['name'];
                                ?>
</td>
                              <td><?php 
                                echo wpi_chargify::get_component_type_line($component);
                                ?>
</td>
                              <td><?php 
                                echo wpi_chargify::get_component_price_line($component);
                                ?>
</td>
                            </tr> <?php 
                                $last_component = $product->product_family->id;
                            }
                        }
                        ?>
                        </tbody>
                      </table>

                    </td>
                  </tr> <?php 
                    }
                    ?>
              </table> <?php 
                }
            }
            ?>
        </div>
        <!-- /wpi_box_content -->
        <div class="wpi_box_footer">
          <?php 
            //pr( json_decode( $wpi_settings[ 'chargify' ][ 'products' ], ARRAY_A ), 1 );
            ?>
          <?php 
            //pr( json_decode( $wpi_settings[ 'chargify' ][ 'components' ], ARRAY_A ), 1 );
            ?>
        </div>
      </div>

      <script type="text/javascript">
        jQuery( document ).ready( function () {
          /** Check for product updates */
          jQuery( "#wpi_ajax_check_chargify_products" ).click( function ( e ) {

            e.preventDefault();
            jQuery( '.plugin_status' ).remove();
            jQuery.post( ajaxurl, { action: 'wpi_ajax_check_chargify_products', from_ajax: '1' }, function ( data ) {
              message = "<div class='plugin_status updated fade'><p>" + data + "</p></div>";
              jQuery( message ).insertAfter( "h2" );
            } );

          } );
        } );
      </script> <?php 
        } else {
            /** Chargify is disabled */
            ?>
      <div class="wpi_box chargify">
        <div class="wpi_box_header">
          <b><?php 
            _e('Subscription Based Payments via Chargify', WPI);
            ?>
</b>
        </div>
        <div class="wpi_box_content">
          <p><?php 
            _e('Did you know that you can now accept subscription payments using <a href="http://chargify.com" target="_blank">Chargify</a> and our <a href="#">Single Page Checkout</a> Premium Feature?');
            ?>
</p>
        </div>
        <div class="wpi_box_footer clearfix">
          <?php 
            _e('<a href="#" target="_blank">Tell Me More</a>', WPI);
            ?>
        </div>
      </div> <?php 
        }
    }
コード例 #7
0
  /**
   * Render fields
   * 
   * @param array $invoice 
   */
  function wpi_payment_fields( $invoice ) {

    $this->front_end_fields = apply_filters( 'wpi_crm_custom_fields', $this->front_end_fields, 'cc_data' );
    
    if ( !empty( $this->front_end_fields ) ) {
      // For each section
      foreach( $this->front_end_fields as $key => $value ) {
        // If section is not empty
        if ( !empty( $this->front_end_fields[ $key ] ) ) {
					$html = '';
					ob_start();
					
					?>
					<ul class="wpi_checkout_block">
						<li class="section_title"><?php _e( ucwords( str_replace('_', ' ', $key) ), WPI); ?></li>
					<?php
					$html = ob_get_contents();
					ob_end_clean();
					echo $html;
          // For each field
          foreach( $value as $field_slug => $field_data ) {

            $html = '';

            switch ( $field_data['type'] ) {
              case self::TEXT_INPUT_TYPE:

                ob_start();

                ?>

                <li class="wpi_checkout_row">
                  <label for="<?php echo esc_attr( $field_slug ); ?>"><?php _e($field_data['label'], WPI); ?></label>
                  <input type="<?php echo esc_attr( $field_data['type'] ); ?>" class="<?php echo esc_attr( $field_data['class'] ); ?>"  name="<?php echo esc_attr( $field_data['name'] ); ?>" value="<?php echo !empty($invoice['user_data'][$field_slug])?$invoice['user_data'][$field_slug]:'';?>" />
                </li>

                <?

                $html = ob_get_contents();
                ob_end_clean();

                break;

              case self::SELECT_INPUT_TYPE:

                ob_start();

                ?>

                <li class="wpi_checkout_row">
                  <label for="<?php echo esc_attr( $field_slug ); ?>"><?php _e($field_data['label'], WPI); ?></label>
                  <?php echo WPI_UI::select("name={$field_data['name']}&values={$field_data['values']}&id={$field_slug}&class={$field_data['class']}"); ?>
                </li>

                <?php

                $html = ob_get_contents();
                ob_clean();

                break;

              default:
                break;
            }

            echo $html;

          }
					echo '</ul>';
        }
      }
      
    }
    
  }
コード例 #8
0
              <?php 
}
?>
            </td>
          </tr>
          <?php 
if ($wpi_settings['total_invoice_count']) {
    ?>
          <tr class="wp_invoice_copy_invoice invoice_main">
            <th><label for="wpi_template_lookup"><?php 
    _e('Existing Invoice:', WPI);
    ?>
</label></th>
            <td>
              <?php 
    WPI_UI::draw_template_auto_complete_field();
    ?>
              <input type="submit" class="button" value="<?php 
    esc_attr(_e('New Invoice from Template', WPI));
    ?>
">
              <span id="wp_invoice_copy_invoice_cancel" class="wp_invoice_click_me">cancel</span>
            </td>
          </tr>
          <?php 
}
?>
        </table>
      </form>
    </div>
  </div>
コード例 #9
0
ファイル: payment_processing.php プロジェクト: JSpier/smacamp
            <tr class="advanced_gateway_info">
                    <th width="300"><?php 
_e('Security: MD5 Hash', WPI);
?>
</th>
                    <td><?php 
echo WPI_UI::draw_inputfield('wp_invoice_gateway_MD5Hash', $wp_invoice_gateway_MD5Hash);
?>
</td>
            </tr>
            <tr class="advanced_gateway_info">
                    <th><?php 
_e('Delim Data:', WPI);
?>
</th>
                    <td><?php 
echo WPI_UI::draw_select('wp_invoice_gateway_delim_data', array("TRUE" => __("True", WPI), "FALSE" => __("False", WPI)), $wp_invoice_gateway_delim_data);
?>
</td>
            </tr>
            <tr class="">
                    <th width="300">&nbsp;</th>
                    <td><span class="wp_invoice_click_me" onClick="jQuery('.advanced_gateway_info').toggle();"><?php 
_e('Toggle Advanced Options', WPI);
?>
</span></td>
            </tr>
        </table>
    </div>
</div>
コード例 #10
0
    <?php 
if (is_array($wpi_settings['predefined_services'])) {
    // Convert predefined services into special array
    $services_array[""] = __("Insert a predefined line item", WPI);
    foreach ($wpi_settings['predefined_services'] as $service) {
        // skip blanks
        if (empty($service['name'])) {
            continue;
        }
        $services_array["{$service['name']}|{$service['description']}|{$service['quantity']}|{$service['price']}|{$service['tax']}"] = $service['name'] . ": " . $service['quantity'] . " x " . $service['price'];
    }
    //** Make sure there are more services than the label */
    if (count($services_array) > 1) {
        $services_string = serialize($services_array);
        $select_data = array('id' => 'wpi_predefined_services', 'values' => $services_string, 'current_value' => '');
        echo WPI_UI::select($select_data);
    }
}
?>

      <input type="button" class="button wpi_button" id="wpi_add_discount" value="<?php 
esc_attr(_e("Add Discount", WPI));
?>
"/>

      <span id="wpi_discount_mismatch_error"></span>

    </li>

    </ul>
コード例 #11
0
    /**
     * Plugins tab
     *
     * @param type $wpi_settings
     */
    static function plugins($wpi_settings)
    {
        $parseUrl = parse_url(trim(get_bloginfo('url')));
        $this_domain = trim($parseUrl['host'] ? $parseUrl['host'] : array_shift(explode('/', $parseUrl['path'], 2)));
        ?>
    <script type="text/javascript">
      jQuery(document).ready(function() {
        //** Check plugin updates */
        jQuery("#wpi_ajax_check_plugin_updates").click(function() {
          jQuery('.plugin_status').remove();
          jQuery.post(ajaxurl, {
            action: 'wpi_ajax_check_plugin_updates'
          }, function(data) {
            message = "<div class='plugin_status updated fade'><p>" + data + "</p></div>";
            jQuery(message).insertAfter("h2");
          });
        });
      });
    </script>

    <table class="form-table wpi_premium_feature_intro">
      <tbody>
        <tr>
          <th><?php 
        _e('Check for Updates', WPI);
        ?>
</th>
          <td>
    <?php 
        _e('Check for any premium feature updates from the Usability Dynamics Update server:', WPI);
        ?>
            <input type="button" id="wpi_ajax_check_plugin_updates" value="<?php 
        esc_attr(_e('Check Updates', WPI));
        ?>
">
          </td>
        </tr>
        <tr>
          <th><?php 
        _e('Your Domain', WPI);
        ?>
</th>
          <td>
    <?php 
        _e('When purchasing the premium features you will need to specify your domain to add the license correctly.  This is your domain:', WPI);
        echo ' <b>' . $this_domain . '</b>';
        ?>
            <div id="wpi_plugins_ajax_response" class="hidden"></div>
          </td>
        </tr>
        <!--<tr>
          <th><?php 
        _e('WP-Invoice API Key', WPI);
        ?>
 for <?php 
        echo $this_domain;
        ?>
</th>
          <td>
    <?php 
        echo WPI_UI::input("type=text&name=wpi_api_key&group=wpi_settings&value=" . (isset($wpi_settings['wpi_api_key']) ? $wpi_settings['wpi_api_key'] : ''));
        ?>
            <div class="description">
      <?php 
        _e('Some subscription based premium features require an API key that is specific to this domain and WP-Invoice. You can get this from your account on <a href="#" target="_blank">UsabilityDynamics.com</a>.', WPI);
        ?>
            </div>
          </td>
        </tr>-->
      </tbody>
    </table>

    <table id="wpi_premium_feature_table" cellpadding="0" cellspacing="0">
      <tr>
    <?php 
        if (!empty($wpi_settings['available_features'])) {
            foreach ($wpi_settings['available_features'] as $plugin_slug => $plugin_data) {
                ?>
          <input type="hidden" name="wpi_settings[available_features][<?php 
                echo $plugin_slug;
                ?>
][title]" value="<?php 
                echo esc_attr(stripslashes($plugin_data['title']));
                ?>
" />
          <input type="hidden" name="wpi_settings[available_features][<?php 
                echo $plugin_slug;
                ?>
][tagline]" value="<?php 
                echo esc_attr(stripslashes($plugin_data['tagline']));
                ?>
" />
          <input type="hidden" name="wpi_settings[available_features][<?php 
                echo $plugin_slug;
                ?>
][image]" value="<?php 
                echo esc_attr(stripslashes($plugin_data['image']));
                ?>
" />
          <input type="hidden" name="wpi_settings[available_features][<?php 
                echo $plugin_slug;
                ?>
][description]" value="<?php 
                echo esc_attr(stripslashes($plugin_data['description']));
                ?>
" />

        <?php 
                $installed = WPI_Functions::check_premium($plugin_slug);
                ?>
        <?php 
                $active = @$wpi_settings['installed_features'][$plugin_slug]['disabled'] != 'false' ? true : false;
                ?>

        <?php 
                if ($installed) {
                    ?>
          <?php 
                    /* Do this to preserve settings after page save. */
                    ?>
          <input type="hidden" name="wpi_settings[installed_features][<?php 
                    echo $plugin_slug;
                    ?>
][disabled]" value="<?php 
                    echo esc_attr(stripslashes($wpi_settings['installed_features'][$plugin_slug]['disabled']));
                    ?>
" />
          <input type="hidden" name="wpi_settings[installed_features][<?php 
                    echo $plugin_slug;
                    ?>
][name]" value="<?php 
                    echo esc_attr(stripslashes($wpi_settings['installed_features'][$plugin_slug]['name']));
                    ?>
" />
          <input type="hidden" name="wpi_settings[installed_features][<?php 
                    echo $plugin_slug;
                    ?>
][version]" value="<?php 
                    echo esc_attr(stripslashes($wpi_settings['installed_features'][$plugin_slug]['version']));
                    ?>
" />
          <input type="hidden" name="wpi_settings[installed_features][<?php 
                    echo $plugin_slug;
                    ?>
][description]" value="<?php 
                    echo esc_attr(stripslashes($wpi_settings['installed_features'][$plugin_slug]['description']));
                    ?>
" />
        <?php 
                }
                ?>
        <tr class="wpi_premium_feature_block">

          <td valign="top" class="wpi_premium_feature_image">
            <?php 
                if (!empty($plugin_data['image'])) {
                    ?>
              <a target="_blank" href="https://usabilitydynamics.com/products/wp-invoice/"><img src="<?php 
                    echo $plugin_data['image'];
                    ?>
" /></a>
            <?php 
                }
                ?>
          </td>

          <td valign="top">
            <div class="wpi_box">
              <div class="wpi_box_header">
                <strong><?php 
                echo $plugin_data['title'];
                ?>
</strong>
                <p><?php 
                echo $plugin_data['tagline'];
                ?>
 <a target="_blank" href="https://usabilitydynamics.com/products/wp-invoice/premium-features/"><?php 
                _e('[purchase feature]', WPI);
                ?>
</a></p>
              </div>
              <div class="wpi_box_content">
                <p><?php 
                echo stripslashes($plugin_data['description']);
                ?>
</p>
              </div>
              <div class="wpi_box_footer clearfix">
              <?php 
                if ($installed) {
                    ?>
                <div class="alignleft">
                  <?php 
                    if ($wpi_settings['installed_features'][$plugin_slug]['needs_higher_wpi_version'] == 'true') {
                        printf(__('This feature is disabled because it requires WP-Invoice %1$s or higher.'), $wpi_settings['installed_features'][$plugin_slug]['minimum_wpi_version']);
                    } else {
                        echo WPI_UI::checkbox("value=true&name=wpi_settings[installed_features][{$plugin_slug}][disabled]&label=" . __('Disable premium feature.', WPI), $wpi_settings['installed_features'][$plugin_slug]['disabled']);
                        ?>
                </div>
                <div class="alignright"><?php 
                        _e('Feature installed, using version', WPI);
                        ?>
 <?php 
                        echo $wpi_settings['installed_features'][$plugin_slug]['version'];
                        ?>
.</div>
              <?php 
                    }
                } else {
                    $pr_link = 'https://usabilitydynamics.com/products/wp-invoice/premium/';
                    echo sprintf(__('Please visit <a href="%s">UsabilityDynamics.com</a> to purchase this feature.', WPI), $pr_link);
                }
                ?>
              </div>
            </div>
          </td>
        </tr>
      <?php 
            }
        } else {
            ?>
        <tr>
          <td class="wpi_features_not_found"><?php 
            _e('There are no available premium features. Try clicking Check Updates button above.', WPI);
            ?>
</td><td></td>
        </tr>
    <?php 
        }
        ?>
    </table> <?php 
    }
コード例 #12
0
                <th width="300"><?php _e('Merchant Email', WPI); ?></th>
                <td><?php echo WPI_UI::draw_inputfield('wp_invoice_gateway_merchant_email', get_option('wp_invoice_gateway_merchant_email')); ?></td>
            </tr>
            <tr class="gateway_info payment_info">
                <th width="300"><a class="wp_invoice_tooltip" title="<?php _e('Your credit card processor will provide you with a gateway username.', WPI); ?>"><?php _e('Gateway Username', WPI); ?></a></th>
                <td><?php echo WPI_UI::draw_inputfield('wp_invoice_gateway_username', get_option('wp_invoice_gateway_username'), ' AUTOCOMPLETE="off"  '); ?>
                </td>
            </tr>
            <tr class="gateway_info payment_info">
                <th width="300"><a class="wp_invoice_tooltip" title="<?php _e("You will be able to generate this in your credit card processor's control panel.", WPI); ?>"><?php _e('Gateway Transaction Key', WPI); ?></a></th>
                <td><?php echo WPI_UI::draw_inputfield('wp_invoice_gateway_tran_key', get_option('wp_invoice_gateway_tran_key'), ' AUTOCOMPLETE="off"  '); ?></td>
            </tr>
            <tr class="gateway_info payment_info">
                <th width="300"><a class="wp_invoice_tooltip"  title="<?php _e('This is the URL provided to you by your credit card processing company.', WPI); ?>"><?php _e('Gateway URL', WPI); ?></a></th>
                <td><?php echo WPI_UI::draw_inputfield('wp_invoice_gateway_url', get_option('wp_invoice_gateway_url')); ?><br />
                    <span class="wp_invoice_click_me" onclick="jQuery('#wp_invoice_gateway_url').val('https://gateway.merchantplus.com/cgi-bin/PAWebClient.cgi');">MerchantPlus</span> |
                    <span class="wp_invoice_click_me" onclick="jQuery('#wp_invoice_gateway_url').val('https://secure.authorize.net/gateway/transact.dll');">Authorize.Net</span> |
                    <span class="wp_invoice_click_me" onclick="jQuery('#wp_invoice_gateway_url').val('https://test.authorize.net/gateway/transact.dll');">Authorize.Net Developer</span>
                </td>
            </tr>
            <tr class="gateway_info payment_info">
                <th width="300"><a class="wp_invoice_tooltip"  title="<?php _e('Recurring billing gateway URL is most likely different from the Gateway URL, and will almost always be with Authorize.net. Be advised - test credit card numbers will be declined even when in test mode.', WPI); ?>"><?php _e('Recurring Billing Gateway URL', WPI); ?></a></th>
                <td><?php echo WPI_UI::draw_inputfield('wp_invoice_recurring_gateway_url', get_option('wp_invoice_recurring_gateway_url')); ?><br />
                    <span class="wp_invoice_click_me" onclick="jQuery('#wp_invoice_recurring_gateway_url').val('https://api.authorize.net/xml/v1/request.api');">Authorize.net ARB</span> |
                    <span class="wp_invoice_click_me" onclick="jQuery('#wp_invoice_recurring_gateway_url').val('https://apitest.authorize.net/xml/v1/request.api');">Authorize.Net ARB Testing</span>
                </td>
            </tr>
        </table>
    </div>
</div>
コード例 #13
0
<div class="wp_invoice_lookup">
  <form action="<?php echo get_permalink($wpi_settings['web_invoice_page']); ?>" method="POST">
  <div for="wp_invoice_lookup_input"><?php echo $message; ?></div>
  <?php echo WPI_UI::input("name=wp_invoice_lookup_input&autocomplete=off")?>
  <input type="submit" value="<?php echo $button; ?>" class="wp_invoice_lookup_submit" />
  </form>
</div>
          continue;

        }

        $services_array["{$service['name']}|{$service['description']}|{$service['quantity']}|{$service['price']}|{$service['tax']}"] = $service['name'] . ": " . $service['quantity'] . " x ". $service['price'];

      }

      //** Make sure there are more services than the label */

      if(count($services_array) > 1){

        $services_string = serialize($services_array);

        echo WPI_UI::select("id=wpi_predefined_services&values=$services_string&current_value=");

      }

    } ?>
      
      <input type="button" class="button wpi_button" id="wpi_add_discount" value="<?php esc_attr(_e("Add Discount", WPI)) ?>"/>

      <span id="wpi_discount_mismatch_error"></span>

    </li>

    </ul>

      <?php do_meta_boxes($screen_id, 'normal', $this_invoice->data); ?>
function status_meta_box($this_invoice) {
 
    
  $hidden = '';
  if (!empty($_REQUEST['wpi']['new_invoice'])) {
    $hidden = ' hidden ';
  }
  ?>
  <div id="postbox_status_and_history" class="postbox <?php echo $hidden; ?>">
    <h3 class="hndle"><?php _e("Invoice Status and History", WPI) ?></h3>
    <div class="inside" style="margin:0;padding:0;">
      <div id="submitbox" class="submitbox" style="overflow: auto; max-height: 150px;">
        <table id="wpi_enter_payments" class="form-table hidden" >
          <tr>
            <th><?php _e("Event Type", WPI) ?></th>
            <td>
  <?php echo WPI_UI::select("name=event_type&values=" . serialize(array('add_payment' => __('Receive Payment', WPI), 'add_charge' => __('Add Charge', WPI), 'do_adjustment' => __('Administrative Adjustment', WPI)))); ?>
              <span class="wpi_recurring_options"><?php _e('Note: Recurring bills cannot have administrative adjustments or additional charges, only received payments.', WPI); ?></span>
            </td>
          </tr>
          <tr>
            <th><?php _e("Event Amount", WPI) ?></th>
            <td>
              <?php echo WPI_UI::input("type=text&name=wpi_event_amount&class=wpi_money&special=autocomplete='off'"); ?>
              <span id="event_tax_holder" class="hidden">
                <b style="padding:5px;"><?php _e("Charge Tax", WPI) ?></b><?php echo WPI_UI::input("type=text&name=wpi_event_tax&class=wpi_money&special=autocomplete='off'"); ?>%
              </span>
            </td>
          </tr>
          <tr>
            <th><?php _e("Event Date & Time", WPI) ?></th>
            <td>
              <?php echo WPI_UI::input("type=text&name=wpi_event_date&class=wpi_date"); ?>
              <?php echo WPI_UI::input("type=text&name=wpi_event_time&class=wpi_time"); ?>
            </td>
          </tr>
          <tr>
            <th><?php _e("Event Note", WPI) ?></th>
            <td><?php echo WPI_UI::input("name=wpi_event_note"); ?>
            </td>
          </tr>
          <tr>
            <th>&nbsp;</th>
            <td>
              <?php wp_nonce_field('wpi_process_manual_event_nonce', 'wpi_process_manual_event_nonce'); ?>
              <input type="button" class="button" value="<?php esc_attr(_e('Process Charge / Payment', WPI)); ?>"  id="wpi_process_manual_event" />
              <input type="button" class="button" value="<?php esc_attr(_e('Cancel', WPI)); ?>" onclick="wpi_show_paycharge_box();" />
              <span class="wpi_ajax_response"></span>
            </td>
          </tr>
        </table>
        <div style="padding: 5px;">
          <table class="form-table" id="wpi_invoice_status_table">
  <?php
  
  if (!empty($this_invoice['log']) && is_array($this_invoice['log'])) {
    if (!empty($this_invoice['ID'])) {
      WPI_Functions::get_status($this_invoice['ID']);
    }
  }
  ?>
          </table>
        </div>
      </div>
      <div class="footer_functions">
        <span class="wpi_clickable" onclick="jQuery('.wpi_event_update').toggle();"><?php _e('Toggle History Detail', WPI); ?></span>
      </div>
    </div>
  </div>
<?php
  do_action('wpi_add_comments_box');
?>
  <?php } ?>
コード例 #16
0
                    echo '</li>';
                    break;
                case 'input_field':
                    echo '<li id="state_field"><label for="state">State</label>';                
                    echo "<input name='state' value='{$invoice[user_data][state]}' />";
                    echo '</li>';
                    break;
            }
            ?>
            <li>
                <label for="zip"><?php _e('Zip Code', WPI); ?></label>
                <input name="zip" value="<?php echo $invoice[user_data][zip];?>" />
            </li>
            <li>
                <label for="country"><?php _e('Country', WPI); ?></label>
                <?php echo WPI_UI::select("name=country&current_value={$invoice[user_data][country]}&values=countries"); ?>
            </li>
            <?php /*if($invoice['meta']['terms_acceptance_required'] == 'on') { ?>
                <li class="wpi_terms">
                    <label for="term_acceptance">&nbsp;</label>
                    <?php show_terms_acceptance(); ?>I accept the terms defined in the service agreement.
                </li>
            <?php }*/ ?>
            <li>
                <label for="submit">&nbsp;</label>
                <input type="image"  src="<?php echo $invoice['billing']['paypal']['settings']['button_url']['value']; ?>" class="paypal_button" name="submit" alt="<?php _e('Pay with PayPal', WPI); ?>">
            </li>

            <br class="cb" />    
        </ol>
    </fieldset>
コード例 #17
0
echo WPI_UI::checkbox("name=wpi_settings[products][post_type][supports][1]&value=excerpt&label=" . __('Excerpt', WPI), !empty($wpi_settings['products']['post_type']['supports']) ? in_array('excerpt', $wpi_settings['products']['post_type']['supports']) : in_array('excerpt', self::$defaults['post_type']['supports']));
?>
            </li>
            <li>
              <?php 
echo WPI_UI::checkbox("name=wpi_settings[products][post_type][supports][2]&value=trackbacks&label=" . __('Trackbacks', WPI), !empty($wpi_settings['products']['post_type']['supports']) ? in_array('trackbacks', $wpi_settings['products']['post_type']['supports']) : in_array('trackbacks', self::$defaults['post_type']['supports']));
?>
            </li>
            <li>
              <?php 
echo WPI_UI::checkbox("name=wpi_settings[products][post_type][supports][3]&value=comments&label=" . __('Comments', WPI), !empty($wpi_settings['products']['post_type']['supports']) ? in_array('comments', $wpi_settings['products']['post_type']['supports']) : in_array('comments', self::$defaults['post_type']['supports']));
?>
            </li>
            <li>
              <?php 
echo WPI_UI::checkbox("name=wpi_settings[products][post_type][supports][4]&value=page-attributes&label=" . __('Page Attributes', WPI), !empty($wpi_settings['products']['post_type']['supports']) ? in_array('page-attributes', $wpi_settings['products']['post_type']['supports']) : in_array('page-attributes', self::$defaults['post_type']['supports']));
?>
            </li>
            <li>
              <?php 
echo WPI_UI::checkbox("name=wpi_settings[products][post_type][supports][5]&value=post-formats&label=" . __('Post Formats', WPI), !empty($wpi_settings['products']['post_type']['supports']) ? in_array('post-formats', $wpi_settings['products']['post_type']['supports']) : in_array('post-formats', self::$defaults['post_type']['supports']));
?>
            </li>
          </ul>

        </li>
      </ul>
    </td>
  </tr>
  
</table>
コード例 #18
0
//$user_information = array_merge($wpi_settings['user_meta']['required'], $custom_user_information);
?>

<h3><?php 
_e('Billing / Invoicing Info', WPI);
?>
</h3>
<a name="billing_info"></a>
<table class="form-table" >
  <?php 
foreach ($user_information as $field_id => $field_name) {
    ?>
    <tr>
      <th><?php 
    _e($field_name, WPI);
    ?>
</th>
      <td>
        <?php 
    echo WPI_UI::input(array('type' => 'text', 'class' => 'regular-text', 'name' => $field_id, 'value' => get_user_meta($user_id, $field_id, true)));
    ?>
      </td>
    </tr>
  <?php 
}
?>
  <tr>
    <th></th>
    <td></td>
  </tr>
</table>
コード例 #19
0
    <label for="country"><?php _e('Country', WPI); ?></label>
      <?php echo WPI_UI::select("name=cc_data[country]&current_value={$invoice[user_data][country]}&values=countries"); ?>
    </li>

    <li class="hide_after_success">
    <label class="inputLabel" for="cc_data[card_num]"><?php _e('Credit Card Number', WPI); ?></label>
    <input name="cc_data[card_num]" autocomplete="off" onkeyup="cc_card_pick();"  id="cc_data[card_num]" class="credit_card_number input_field"  type="text"  size="22"  maxlength="22" />
    </li>

    <li class="hide_after_success nocard"  id="cardimage" style="background: url(<?php echo $wpi_settings['frontend_path']; ?>/core/images/card_array.png) no-repeat;">
    </li>

    <li class="hide_after_success">
    <label class="inputLabel" for="exp_month"><?php _e('Expiration Date', WPI); ?></label>
    <?php _e('Month', WPI); ?> <?php echo WPI_UI::select("name=cc_data[exp_year]&values=months"); ?>
    <?php _e('Year', WPI); ?> <?php echo WPI_UI::select("name=cc_data[exp_year]&values=years"); ?>

    </li>

    <li class="hide_after_success">
    <label class="inputLabel" for="card_code"><?php _e('Security Code', WPI); ?></label>
    <input id="card_code" autocomplete="off"  name="cc_data[card_code]" class="input_field"  style="width: 70px;" type="text" size="4" maxlength="4" />
    </li>

    <li id="wp_invoice_process_wait">
    <label for="submit"><span></span>&nbsp;</label>
    <button type="submit" id="cc_pay_button" class="hide_after_success submit_button"><?php echo sprintf(__('Process Payment of %s', WPI), $invoice['meta']['currency_symbol']  . WPI_Functions::money_format($invoice['amount'])); ?></button>
    </li>  
    
  <br class="cb" />  
    </ol>
コード例 #20
0
ファイル: class_wpi_paypal.php プロジェクト: JSpier/smacamp
    /**
     * Render fields
     *
     * @param array $invoice
     */
    function wpi_payment_fields($invoice)
    {
        $this->front_end_fields = apply_filters('wpi_crm_custom_fields', $this->front_end_fields, 'crm_data');
        if (!empty($this->front_end_fields)) {
            // For each section
            foreach ($this->front_end_fields as $key => $value) {
                // If section is not empty
                if (!empty($this->front_end_fields[$key])) {
                    $html = '';
                    ob_start();
                    ?>
          <ul class="wpi_checkout_block">
            <li class="section_title"><?php 
                    _e(ucwords(str_replace('_', ' ', $key)), WPI);
                    ?>
</li>
          <?php 
                    $html = ob_get_contents();
                    ob_end_clean();
                    echo $html;
                    // For each field
                    foreach ($value as $field_slug => $field_data) {
                        // If field is set of 3 fields for paypal phone number
                        if ($field_slug == 'phonenumber') {
                            echo '<li class="wpi_checkout_row"><div class="control-group"><label class="control-label">' . __('Phone Number', WPI) . '</label><div class="controls">';
                            $phonenumber = !empty($invoice['user_data']['phonenumber']) ? $invoice['user_data']['phonenumber'] : "---";
                            $phone_array = preg_split('/-/', $phonenumber);
                            foreach ($field_data as $field) {
                                //** Change field properties if we need */
                                $field = apply_filters('wpi_payment_form_styles', $field, $field_slug, 'wpi_paypal');
                                ob_start();
                                ?>
                  <input type="<?php 
                                echo esc_attr($field['type']);
                                ?>
" class="<?php 
                                echo esc_attr($field['class']);
                                ?>
"  name="<?php 
                                echo esc_attr($field['name']);
                                ?>
" value="<?php 
                                echo esc_attr($phone_array[key($phone_array)]);
                                next($phone_array);
                                ?>
" />
                  <?php 
                                $html = ob_get_contents();
                                ob_end_clean();
                                echo $html;
                            }
                            echo '</div></div></li>';
                        }
                        //** Change field properties if we need */
                        $field_data = apply_filters('wpi_payment_form_styles', $field_data, $field_slug, 'wpi_paypal');
                        $html = '';
                        if (!empty($field_data['type'])) {
                            switch ($field_data['type']) {
                                case self::TEXT_INPUT_TYPE:
                                    ob_start();
                                    ?>

                    <li class="wpi_checkout_row">
                      <div class="control-group">
                        <label class="control-label" for="<?php 
                                    echo esc_attr($field_slug);
                                    ?>
"><?php 
                                    _e($field_data['label'], WPI);
                                    ?>
</label>
                        <div class="controls">
                          <input type="<?php 
                                    echo esc_attr($field_data['type']);
                                    ?>
" class="<?php 
                                    echo esc_attr($field_data['class']);
                                    ?>
"  name="<?php 
                                    echo esc_attr($field_data['name']);
                                    ?>
" value="<?php 
                                    echo isset($field_data['value']) ? $field_data['value'] : (!empty($invoice['user_data'][$field_slug]) ? $invoice['user_data'][$field_slug] : '');
                                    ?>
" />
                        </div>
                      </div>
                    </li>

                    <?php 
                                    $html = ob_get_contents();
                                    ob_end_clean();
                                    break;
                                case self::SELECT_INPUT_TYPE:
                                    ob_start();
                                    ?>

                    <li class="wpi_checkout_row">
                      <label for="<?php 
                                    echo esc_attr($field_slug);
                                    ?>
"><?php 
                                    _e($field_data['label'], WPI);
                                    ?>
</label>
                  <?php 
                                    echo WPI_UI::select("name={$field_data['name']}&values={$field_data['values']}&id={$field_slug}&class={$field_data['class']}");
                                    ?>
                    </li>

                    <?php 
                                    $html = ob_get_contents();
                                    ob_clean();
                                    break;
                                default:
                                    break;
                            }
                        }
                        echo $html;
                    }
                    echo '</ul>';
                }
            }
        }
    }
コード例 #21
0
              } else {
                $display='';
              }
              ?>

              <tr style="<?php echo $display; ?>">
                <th width="300"><span class="<?php echo (!empty($setting_value['description']) ? "wp_invoice_tooltip" : ""); ?>" title="<?php echo (!empty($setting_value['description']) ? $setting_value['description'] : ''); ?>"><?php echo $setting_value['label']; ?></span></th>
                <td>
                  <?php if (isset($setting_value['type']) && $setting_value['type'] == 'select') : ?>
                    <?php echo WPI_UI::select("name=wpi_settings[billing][{$key}][settings][{$key2}][value]&values=" . serialize($setting_value['data']) . "&current_value=".(!empty($setting_value['value']) ? $setting_value['value'] : "")); ?>
                  <?php elseif (isset($setting_value['type']) && $setting_value['type'] == 'textarea') : ?>
                    <?php echo WPI_UI::textarea("name=wpi_settings[billing][{$key}][settings][{$key2}][value]&value={$setting_value['value']}"); ?>
                  <?php elseif (isset($setting_value['type']) && $setting_value['type'] == 'readonly') : ?>
                    <?php echo WPI_UI::textarea("name=wpi_settings[billing][{$key}][settings][{$key2}][value]&value={$setting_value['value']}&special=readonly='readonly'"); ?>
                  <?php else : ?>
                    <?php echo WPI_UI::input("name=wpi_settings[billing][{$key}][settings][{$key2}][value]&value=".(!empty($setting_value['value']) ? $setting_value['value'] : "")); ?>
                  <?php endif; ?>
                  <?php if (!empty($setting_value['special']) && is_array($setting_value['special']) && (!isset($setting_value['type']) || $setting_value['type'] != 'select')) : ?>
                    <?php $s_count = 0; ?>
                    <br/>
                    <?php foreach($setting_value['special'] as $s_label => $s_value): ?>
                      <span class="wp_invoice_click_me" onclick="jQuery('input[name=\'wpi_settings[billing][<?php echo $key; ?>][settings][<?php echo $key2; ?>][value]\']').val('<?php echo $s_value; ?>');"><?php echo $s_label; ?></span>
                      <?php echo (++$s_count < count($setting_value['special']) ? ' | ' : '' ); ?>
                    <?php endforeach; ?>
                  <?php endif; ?>
                </td>
              </tr>

            <?php } ?>
            </table>
            
コード例 #22
0
ファイル: wp-invoice.php プロジェクト: JSpier/smacamp
 /**
  * Handles validation when somebody is attempting to view an invoice.
  * If validation is passsed, we add the necessary
  * filters to display the invoice header and page content;
  * Global $invoice_id variable set by WPI_Functions::validate_page_hash();
  */
 function template_redirect()
 {
     global $invoice_id, $wpi_settings, $wpi_invoice_object, $post, $current_user;
     //** Alwys load styles without checking if given page has an invoice */
     wp_enqueue_style('wpi-theme-specific');
     wp_enqueue_style('wpi-default-style');
     //** Determine if the current page is invoice's page */
     if (empty($post->ID) || $wpi_settings['web_invoice_page'] != $post->ID) {
         return;
     }
     //** If invoice_id is passed, run validate_page_hash  to make sure this is the right page and invoice_id exists */
     if (isset($_GET['invoice_id'])) {
         if (WPI_Functions::validate_page_hash(esc_sql($_GET['invoice_id']))) {
             //** load global invoice object */
             $post_id = wpi_invoice_id_to_post_id($invoice_id);
             $wpi_invoice_object = new WPI_Invoice();
             $wpi_invoice_object->load_invoice("id={$post_id}");
             add_filter('viewable_invoice_types', array($this, 'viewable_types'));
             //** Determine if current invoice object is "viewable" */
             if (!in_array($wpi_invoice_object->data['post_status'], apply_filters('viewable_invoice_types', array('active')))) {
                 return;
             }
             if (isset($wpi_settings['logged_in_only']) && $wpi_settings['logged_in_only'] == 'true') {
                 if (!current_user_can(WPI_UI::get_capability_by_level($wpi_settings['user_level'])) && !WPI_Functions::user_is_invoice_recipient($wpi_invoice_object)) {
                     //** Show 404 when invoice doesn't exist */
                     $not_found = get_query_template('404');
                     require_once $not_found;
                     die;
                 }
             }
             //** Load front end scripts */
             wp_enqueue_script('jquery.validate');
             wp_enqueue_script('wpi-gateways');
             wp_enqueue_script('jquery.maskedinput');
             wp_enqueue_script('wpi-frontend-scripts');
             if (!empty($wpi_settings['ga_event_tracking']) && $wpi_settings['ga_event_tracking']['enabled'] == 'true') {
                 wp_enqueue_script('wpi-ga-tracking', WPI_URL . "/core/js/wpi.ga.tracking.js", array('jquery'));
             }
             //** Apply Filters to the invoice description */
             add_action('wpi_description', 'wpautop');
             add_action('wpi_description', 'wptexturize');
             add_action('wpi_description', 'shortcode_unautop');
             add_action('wpi_description', 'convert_chars');
             add_action('wpi_description', 'capital_P_dangit');
             //** Declare the variable that will hold our AJAX url for JavaScript purposes */
             wp_localize_script('wpi-gateways', 'wpi_ajax', array('url' => admin_url('admin-ajax.php')));
             add_action('wp_head', array('WPI_UI', 'frontend_header'));
             if ($wpi_settings['replace_page_title_with_subject'] == 'true' || $wpi_settings['hide_page_title'] == 'true') {
                 add_action('wp_title', array('WPI_UI', 'wp_title'), 0, 3);
             }
             if ($wpi_settings['replace_page_heading_with_subject'] == 'true' || $wpi_settings['hide_page_title'] == 'true') {
                 add_action('the_title', array('WPI_UI', 'the_title'), 0, 2);
             }
             add_action('the_content', array('WPI_UI', 'the_content'), 20);
         } else {
             //** Show 404 when invoice doesn't exist */
             $not_found = get_query_template('404');
             require_once $not_found;
             die;
         }
     }
     //** Fixed WordPress filters if page is being opened in HTTPS mode */
     if (isset($_SERVER['HTTPS']) && $_SERVER["HTTPS"] == "on") {
         if (function_exists('force_ssl')) {
             add_filter('option_siteurl', 'force_ssl');
             add_filter('option_home', 'force_ssl');
             add_filter('option_url', 'force_ssl');
             add_filter('option_wpurl', 'force_ssl');
             add_filter('option_stylesheet_url', 'force_ssl');
             add_filter('option_template_url', 'force_ssl');
             add_filter('script_loader_src', 'force_ssl');
         }
     }
     //** Lookup functionality */
     if (isset($_POST['wp_invoice_lookup_input'])) {
         if (!empty($current_user->ID)) {
             $id = get_invoice_id($_POST['wp_invoice_lookup_input']);
             if (empty($id)) {
                 //** Show 404 when invoice doesn't exist */
                 $not_found = get_query_template('404');
                 require_once $not_found;
                 die;
             }
             $invoice = get_invoice($id);
             if (current_user_can('level_10') || $current_user->data->user_email == $invoice['user_email']) {
                 header("location:" . get_invoice_permalink($_POST['wp_invoice_lookup_input']));
                 die;
             } else {
                 //** Show 404 when invoice doesn't exist */
                 $not_found = get_query_template('404');
                 require_once $not_found;
                 die;
             }
         } else {
             //** Show 404 when invoice doesn't exist */
             $not_found = get_query_template('404');
             require_once $not_found;
             die;
         }
     }
 }
コード例 #23
0
         echo '</li>';
         break;
     case 'input_field':
         echo '<li id="state_field"><label for="state">'. __('State', WPI) . '</label>';                
         echo "<input name='STATE' value='{$invoice['user_data']['state']}' />";
         echo '</li>';
         break;
 }
 ?>
 <li>
     <label for="ZIP"><?php _e('Zip Code', WPI); ?></label>
     <input name="ZIP" value="<?php echo $invoice['user_data']['zip'];?>" />
 </li>
 <li>
     <label for="COUNTRY"><?php _e('Country', WPI); ?></label>
     <?php echo WPI_UI::select("name=COUNTRY&current_value={$invoice['user_data']['country']}&values=countries"); ?>
 </li>
 
 <li>
     <label for="USER1"><?php _e('Your email', WPI); ?></label>
     <input type="text" name="USER1" size="12" value="<?php echo $invoice['user_data']['email_address'] ?>">
 </li>
 
 <li>
     <label><?php _e('The form of payment', WPI); ?></label>
     <select name="METHOD" size="1">
         <option selected value="CC"><?php _e('Credit Card', WPI); ?></option>
     </select>
 </li>
 
 <li>
コード例 #24
0
  function check_settings() {
    global $wpi_settings;
    if ($wpi_settings['web_invoice_page'] == '') {
      $message .= __('Invoice page not selected. ', WPI);
      $message .= __("Visit ", WPI) . "<a href='admin.php?page=wpi_page_settings'>".__('settings page', WPI)."</a>" . __(" to configure.", WPI);
    }

    if (!function_exists('curl_exec'))
      $message .= __("cURL is not turned on on your server, credit card processing will not work. If you have access to your php.ini file, activate <b>extension=php_curl.dll</b>.", WPI);

    WPI_UI::error_message($message);
  }
コード例 #25
0
ファイル: invoice_lookup.php プロジェクト: JSpier/smacamp
<div class="wp_invoice_lookup">
  <form action="<?php 
echo get_permalink($wpi_settings['web_invoice_page']);
?>
" method="POST">
  <div for="wp_invoice_lookup_input"><?php 
echo $message;
?>
</div>
  <?php 
echo WPI_UI::input(array('name' => 'wp_invoice_lookup_input', 'autocomplete' => 'off', 'special' => 'placeholder="' . __('Invoice ID', WPI) . '"'));
?>
  <input type="submit" value="<?php 
echo $button;
?>
" class="wp_invoice_lookup_submit" />
  </form>
</div>