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 }
/** * * @param type $this_invoice */ function recurring_settings($this_invoice) { ?> <h4><?php _e('Authorize.net ARB', WPI); ?> </h4> <table class="wpi_recurring_bill_settings"> <tr> <th><?php _e('Bill Every', WPI); ?> </th> <td> <?php echo WPI_UI::input("name=wpi_invoice[recurring][" . $this->type . "][length]&value=" . (!empty($this_invoice['recurring'][$this->type]) ? $this_invoice['recurring'][$this->type]['length'] : '') . "&class=wpi_small wpi_bill_every_length"); ?> <?php echo WPI_UI::select("name=wpi_invoice[recurring][" . $this->type . "][unit]&values=" . serialize(array("days" => __("Day(s)", WPI), "months" => __("Month(s)", WPI))) . "¤t_value=" . (!empty($this_invoice['recurring'][$this->type]) ? $this_invoice['recurring'][$this->type]['unit'] : '')); ?> </td> </tr> <tr> <th><?php _e('Billing Cycles', WPI); ?> </th> <td><?php echo WPI_UI::input("id=wpi_meta_recuring_cycles&name=wpi_invoice[recurring][" . $this->type . "][cycles]&value=" . (!empty($this_invoice['recurring'][$this->type]) ? $this_invoice['recurring'][$this->type]['cycles'] : '') . "&class=wpi_small"); ?> </td> </tr> <tr> <th><?php _e('Payment Date', WPI); ?> </th> <td> <script type="text/javascript"> var recurring_send_invoice_automatically_<?php echo $this->type; ?> = '<?php echo !empty($this_invoice['recurring'][$this->type]['send_invoice_automatically']) ? $this_invoice['recurring'][$this->type]['send_invoice_automatically'] : 'on'; ?> '; jQuery( document ).bind('wpi_enable_recurring', function(){ if ( recurring_send_invoice_automatically_<?php echo $this->type; ?> == 'on' ) { wpi_disable_recurring_start_date( '<?php echo $this->type; ?> ' ); } else { wpi_enable_recurring_start_date( '<?php echo $this->type; ?> ' ); } }); </script> <?php echo WPI_UI::checkbox("special=data-type='{$this->type}'&id=wpi_wpi_invoice_recurring_send_invoice_automatically_{$this->type}&class=wpi_wpi_invoice_recurring_send_invoice_automatically {$this->type}&name=wpi_invoice[recurring][" . $this->type . "][send_invoice_automatically]&value=true&label=" . __('Automatically.', WPI), !empty($this_invoice['recurring'][$this->type]['send_invoice_automatically']) ? $this_invoice['recurring'][$this->type]['send_invoice_automatically'] : 'on'); ?> </td> </tr> <tr class="wpi_recurring_start_date <?php echo $this->type; ?> " style="display:<?php echo !empty($this_invoice['recurring'][$this->type]) && $this_invoice['recurring'][$this->type]['send_invoice_automatically'] == 'on' ? 'none;' : ''; ?> "> <th><?php _e('Date', WPI); ?> </th> <td> <div> <?php echo WPI_UI::select("id=r_start_date_mm&name=wpi_invoice[recurring][" . $this->type . "][start_date][month]&values=months¤t_value=" . (!empty($this_invoice['recurring'][$this->type]) ? $this_invoice['recurring'][$this->type]['start_date']['month'] : '')); ?> <?php echo WPI_UI::input("id=r_start_date_jj&name=wpi_invoice[recurring][" . $this->type . "][start_date][day]&value=" . (!empty($this_invoice['recurring'][$this->type]) ? $this_invoice['recurring'][$this->type]['start_date']['day'] : '') . "&special=size='2' maxlength='2' autocomplete='off'"); ?> <?php echo WPI_UI::input("id=r_start_date_aa&name=wpi_invoice[recurring][" . $this->type . "][start_date][year]&value=" . (!empty($this_invoice['recurring'][$this->type]) ? $this_invoice['recurring'][$this->type]['start_date']['year'] : '') . "&special=size='2' maxlength='4' autocomplete='off'"); ?> <br /> <span onclick="wp_invoice_add_time('r_start_date', 7);" class="wp_invoice_click_me"><?php _e('In One Week', WPI); ?> </span> | <span onclick="wp_invoice_add_time('r_start_date', 30);" class="wp_invoice_click_me"><?php _e('In 30 Days', WPI); ?> </span> | <span onclick="wp_invoice_add_time('r_start_date', 'clear');" class="wp_invoice_click_me"><?php _e('Clear', WPI); ?> </span> </div> </td> </tr> </table> <?php }
function postbox_payment_methods($this_invoice) { global $wpi_settings; if (!empty($this_invoice['billing'])) { $this_invoice['billing'] = apply_filters('wpi_billing_method', $this_invoice['billing']); ?> <table class="form-table"> <tr class="column-payment-method-default wpi_not_for_quote"> <th><?php _e("Default Payment Option", WPI) ?></th> <td> <select id="wp_invoice_payment_method" name="wpi_invoice[default_payment_method]"> <?php foreach ($this_invoice['billing'] as $key => $payment_option) : ?> <?php if (!isset($payment_option['name'])) continue; ?> <option value="<?php echo $key; ?>" <?php echo ($this_invoice['default_payment_method'] == $key) ? 'selected="selected"' : ''; ?> ><?php echo $payment_option['name']; ?></option> <?php endforeach; ?> </select> <?php if (count($this_invoice['billing']) > 1) { echo WPI_UI::checkbox("class=wpi_client_change_payment_method&name=wpi_invoice[client_change_payment_method]&value=true&label=".__('Client can change payment option.', WPI), !empty( $this_invoice['client_change_payment_method'] )? ( $this_invoice['client_change_payment_method'] == 'on' ? true : false ) : false); } ?> </td> </tr> <tr class='wpi_not_for_quote wpi-payment-setting column-paymenth-method-<?php echo $key; ?>'> <th><?php _e("Accepted Payments", WPI) ?></th> <td> <ul class="wpi_settings_list"> <?php foreach ($this_invoice['billing'] as $key => $value) : ?> <?php if (empty($value['name'])) break; ?> <li class="clearfix"> <?php echo WPI_UI::checkbox("name=wpi_invoice[billing][{$key}][allow]&id={$key}&value=true&label={$value['name']}&class=wpi_billing_section_show", $value['allow'] == 'on' ? true : false) ?> <?php /* <div class="wpi_notice"><?php _e("Notice the ") ?><span onClick="wpi_select_payment_method('<?php echo $key; ?>');"><u><?php echo $value['name']; ?><?php _e(" Tab") ?></u></span><?php _e(" below. ") ?></div> */ ?> </li> <?php endforeach; ?> </ul> </td> </tr> <tr class="wpi_advanced_payment_options column-publish-currency"> <th><?php _e("Default Currency", WPI) ?></th> <td> <select name="wpi_invoice[default_currency_code]"> <?php foreach ($wpi_settings['currency']['types'] as $value => $currency_x) : ?> <option value="<?php echo $value; ?>" <?php echo ($this_invoice['default_currency_code'] == $value) ? 'selected="selected"' : ''; ?>"><?php echo $value; ?> - <?php echo $currency_x; ?></option> <?php endforeach; ?> </select> </td> </tr> <tr class="wpi_advanced_payment_options wpi_not_for_quote"> <td colspan="2"> <div class="wp_invoice_accordion"> <?php foreach ($this_invoice['billing'] as $key => $value) : ?> <?php if (empty($this_invoice['default_payment_method'])) $this_invoice['default_payment_method'] = key($this_invoice['billing']); ?> <?php if (empty($value['name'])) break; ?> <div class="<?php echo $key; ?>-setup-section wp_invoice_accordion_section"> <h3 id="<?php echo $key; ?>-setup-section-header" <?php if ($this_invoice['default_payment_method'] == $key) { ?>aria-expanded="true"<?php } else { ?>aria-expanded="false"<?php } ?>> <span class="selector"><?php echo $value['name'] ?></span> </h3> <div style="display:<?php echo $this_invoice['default_payment_method'] == $key ? 'block' : 'none'; ?>"> <?php echo WPI_UI::input("type=hidden&name=wpi_invoice[billing][{$key}][default_option]&class=billing-default-option billing-{$key}-default-option&value={$value['default_option']}") ?> <table class="form-table"> <?php foreach ($value['settings'] as $key2 => $setting_value) : $setting_value['value'] = urldecode($setting_value['value']); $setting_value['type'] = !empty($setting_value['type']) ? $setting_value['type'] : 'input'; ?> <tr> <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 ($setting_value['type'] == 'select') : ?> <?php echo WPI_UI::select("name=wpi_invoice[billing][{$key}][settings][{$key2}][value]&values=" . serialize($setting_value['data']) . "¤t_value={$setting_value['value']}"); ?> <?php elseif ($setting_value['type'] == 'textarea') : ?> <?php echo WPI_UI::textarea("name=wpi_invoice[billing][{$key}][settings][{$key2}][value]&value={$setting_value['value']}"); ?> <?php elseif ($setting_value['type'] == 'readonly') : ?> <?php $setting_value['value'] = urlencode($setting_value['value']); ?> <?php echo WPI_UI::textarea("name=wpi_invoice[billing][{$key}][settings][{$key2}][value]&value={$setting_value['value']}&special=readonly='readonly'"); ?> <?php else : ?> <?php echo WPI_UI::input("name=wpi_invoice[billing][{$key}][settings][{$key2}][value]&value={$setting_value['value']}"); ?> <?php endif; ?> <?php if (!empty($setting_value['special']) && is_array($setting_value['special']) && $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_invoice[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 endforeach; ?> </table> </div> </div> <?php endforeach; ?> </div> </td> </tr> <tr> <th></th> <td class="wpi_toggle_advanced_payment_options"><span class="wpi_link"><?php _e('Toggle Advanced Payment Options', WPI); ?></span></td> </tr> </table> <?php } else { ?> <table class="form-table"> <tr> <th><?php _e("Payment Method", WPI) ?></th> <td> <input type="hidden" name="wpi_invoice[default_payment_method]" value="manual" /> <p><?php echo sprintf(__('To manage payment settings you should accept at least one payment method. Visit <a href="%s">Payment Settings page</a> to setup.', WPI), admin_url('admin.php?page=wpi_page_settings#wpi_tab_payment')); ?></p> <p><?php echo sprintf(__('If you do not want to use any payment venue then <a href="%s">setup Manual Payment information</a>.', WPI), admin_url('admin.php?page=wpi_page_settings#wpi_tab_payment')); ?></p> </td> </tr> <tr class="wpi_advanced_payment_options column-publish-currency"> <th><?php _e("Default Currency", WPI) ?></th> <td> <select name="wpi_invoice[default_currency_code]"> <?php foreach ($wpi_settings['currency']['types'] as $value => $currency_x) : ?> <option value="<?php echo $value; ?>" <?php echo ($this_invoice['default_currency_code'] == $value) ? 'selected="selected"' : ''; ?>"><?php echo $value; ?> - <?php echo $currency_x; ?></option> <?php endforeach; ?> </select> </td> </tr> <tr> <th></th> <td class="wpi_toggle_advanced_payment_options"><span class="wpi_link"><?php _e('Toggle Advanced Payment Options', WPI); ?></span></td> </tr> </table> <?php } }
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>
/** * 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 }