function smart_show_console() { define('PLUGINS_FILE_PATH', dirname(dirname(__FILE__))); define('SM_PLUGIN_DIRNAME', plugins_url('', __FILE__)); define('IMG_URL', SM_PLUGIN_DIRNAME . '/images/'); define('SM_BETA_IMG_URL', SM_PLUGIN_DIRNAME . '/new/assets/images/'); if (WPSC_RUNNING === true) { $json_filename = IS_WPSC37 ? 'json37' : 'json38'; } else { if (WOO_RUNNING === true) { $json_filename = 'woo-json'; } } // define( 'JSON_URL', SM_PLUGIN_DIRNAME . "/sm/$json_filename.php" ); define('JSON_URL', $json_filename); define('ADMIN_URL', get_admin_url()); //defining the admin url define('ABS_WPSC_URL', WP_PLUGIN_DIR . '/wp-e-commerce'); define('WPSC_NAME', 'wp-e-commerce'); $latest_version = smart_get_latest_version(); $is_pro_updated = smart_is_pro_updated(); // if (isset( $_GET ['action'] ) && $_GET ['action'] == 'sm-settings') { // smart_settings_page(); // } else { $base_path = WP_PLUGIN_DIR . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)) . 'sm/'; ?> <div class="wrap"> <div id="icon-smart-manager" class="icon32"><br /> </div> <style> div#TB_window { background: lightgrey; } </style> <?php if (SMPRO === true && function_exists('smart_support_ticket_content')) { smart_support_ticket_content(); } ?> <h2><?php echo 'Smart Manager '; echo SMPRO === true ? 'Pro' : 'Lite'; $before_plug_page = ''; $after_plug_page = ''; $plug_page = ''; ?> <span style="float:right; margin: -6px -21px -20px 0px;"> <!-- <a href="http://www.storeapps.org/?buy-now=742&coupon=sm-festive-40-2013&utm_source=SM&utm_medium=Lite&utm_campaign=Festive2013" target="_blank"> <img src="<?php echo IMG_URL . '40perc-off-sm-thanks2013.png'; ?> " alt="40peroff"> </a> --> <a href="http://www.storeapps.org/sm-in-app-promo" target="_blank"> <img src="<?php echo IMG_URL . 'sm-in-app-promo.png'; ?> " alt=""> </a> </span> <p class="wrap" style="font-size: 12px; margin: 18px -21px 0px 5px;"><span style="float: right; line-height: 17px;"> <?php if (SMPRO === true && !is_multisite()) { $before_plug_page .= '<a href="admin.php?page=smart-manager-'; $after_plug_page = '&action=sm-settings">Settings</a> | '; if (WPSC_RUNNING == true) { $plug_page = 'wpsc'; } elseif (WOO_RUNNING == true) { $plug_page = 'woo'; } } else { $before_plug_page = ''; $after_plug_page = ''; $plug_page = ''; } $sm_beta = ''; if (isset($_GET['page']) && ($_GET['page'] == "smart-manager-woo" || $_GET['page'] == "smart-manager-wpsc")) { $sm_beta = '<a href="' . admin_url('edit.php?post_type=' . $_GET['post_type'] . '&page=' . $_GET['page'] . '&sm_beta=1') . '" title="' . __('Try out Smart Manager Beta', SM_TEXT_DOMAIN) . '"> ' . __('Try out Smart Manager Beta', SM_TEXT_DOMAIN) . '</a> <sup style="vertical-align: super;color:red;">New</sup> | '; } if (SMPRO === true) { if (!wp_script_is('thickbox')) { if (!function_exists('add_thickbox')) { require_once ABSPATH . 'wp-includes/general-template.php'; } add_thickbox(); } $before_plug_page = '<a href="edit.php#TB_inline?max-height=420px&inlineId=smart_manager_post_query_form" title="Send your query" class="thickbox" id="support_link">Need Help?</a> | '; $before_plug_page = apply_filters('sm_before_plug_page', $before_plug_page); if (is_super_admin()) { $before_plug_page .= '<a href="options-general.php?page=smart-manager-settings">Settings</a> | '; } } // printf ( __ ( '%1s%2s%3s<a href="%4s" target=_storeapps>Docs</a>' , SM_TEXT_DOMAIN), $before_plug_page, $plug_page, $after_plug_page, "http://www.storeapps.org/support/documentation/" ); printf(__('%1s%2s<a href="%3s" target="_blank">Docs</a>', SM_TEXT_DOMAIN), $sm_beta, $before_plug_page, "http://www.storeapps.org/support/documentation/smart-manager"); ?> </span><?php _e('10x productivity gains with store administration. Quickly find and update products, orders and customers', SM_TEXT_DOMAIN); ?> </p> </h2> <h6 align="right"><?php if (!$is_pro_updated) { $admin_url = ADMIN_URL . "plugins.php"; $update_link = __('An upgrade for Smart Manager Pro', SM_TEXT_DOMAIN) . " " . $latest_version . " " . __('is available.', SM_TEXT_DOMAIN) . " " . "<a align='right' href={$admin_url}>" . __('Click to upgrade.', SM_TEXT_DOMAIN) . "</a>"; smart_display_notice($update_link); } ?> </h6> <!--<h6 align="right"> <?php if (SMPRO === true) { $sm_license_key = smart_get_license_key(); if ($sm_license_key == '') { if (!is_multisite()) { if (WPSC_RUNNING == true) { $plug_page = 'wpsc'; } elseif (WOO_RUNNING == true) { $plug_page = 'woo'; } smart_display_notice(__('Please enter your license key for automatic upgrades and support to get activated.', SM_TEXT_DOMAIN) . '<a href=admin.php?page=smart-manager-' . $plug_page . '&action=sm-settings>' . __('Enter License Key', SM_TEXT_DOMAIN) . '</a>'); } } } ?> </h6>--> </div> <?php if (SMPRO === false) { ?> <div id="message" class="updated fade" style="display:block !important;"> <!-- <span style="float:right; margin-top: -1px; margin-right: -15px"> <a href="http://www.storeapps.org/?buy-now=742&coupon=sm-festive-40-2013&utm_source=SM&utm_medium=Lite&utm_campaign=Festive2013" target="_blank"> <img src="<?php echo IMG_URL . '40perc-off-sm-thanks2013.png'; ?> " alt="40peroff"> </a> </span> --> <p><?php // printf( ('<b>' . __( 'Important:', SM_TEXT_DOMAIN ) . '</b> ' . __( 'Upgrading to Pro gives you powerful features like \'<i>Batch Update</i>\' , \'<i>Export CSV</i>\' , \'<i>Duplicate Products</i>\' & many more...', SM_TEXT_DOMAIN ) . " " . '<br /><a href="%1s" target=_storeapps>' . " " .__( 'Learn more about Pro version here', SM_TEXT_DOMAIN ) . '</a> ' . __( 'or take a', SM_TEXT_DOMAIN ) . " " . '<a href="%2s" target=_livedemo>' . " " . __( 'Live Demo here', SM_TEXT_DOMAIN ) . '</a>'), 'http://www.storeapps.org/product/smart-manager', 'http://demo.storeapps.org/?p=1' ); printf('<b>' . __('Important:', SM_TEXT_DOMAIN) . '</b> ' . __('Upgrade to Pro to get features like \'<i>Batch Update</i>\' , \'<i>Export CSV</i>\' , \'<i>Duplicate Products</i>\' & many more...', SM_TEXT_DOMAIN) . " " . '<br /><a href="%1s" target=_storeapps>' . " " . __('Learn more about Pro version', SM_TEXT_DOMAIN) . '</a> ' . __('or take a', SM_TEXT_DOMAIN) . " " . '<a href="%2s" target=_livedemo>' . " " . __('Live Demo', SM_TEXT_DOMAIN) . '</a>', 'http://www.storeapps.org/product/smart-manager', 'http://demo.storeapps.org/?demo=sm-woo'); ?> </p> </div> <?php } ?> <?php $error_message = ''; if (file_exists(WP_PLUGIN_DIR . '/wp-e-commerce/wp-shopping-cart.php') && file_exists(WP_PLUGIN_DIR . '/woocommerce/woocommerce.php')) { if (is_plugin_active('wp-e-commerce/wp-shopping-cart.php')) { require_once WPSC_FILE_PATH . '/wp-shopping-cart.php'; // if (IS_WPSC37 || IS_WPSC38) { if (version_compare(WPSC_VERSION, '3.8', '>=')) { if (file_exists($base_path . 'manager-console.php')) { include_once $base_path . 'manager-console.php'; return; } else { $error_message = __("A required Smart Manager file is missing. Can't continue.", SM_TEXT_DOMAIN); } } else { $error_message = __('Smart Manager currently works only with WP e-Commerce 3.7 or above.', SM_TEXT_DOMAIN); } } else { if (is_plugin_active('woocommerce/woocommerce.php')) { if (IS_WOO13) { $error_message = __('Smart Manager currently works only with WooCommerce 1.4 or above.', SM_TEXT_DOMAIN); } else { if (file_exists($base_path . 'manager-console.php')) { include_once $base_path . 'manager-console.php'; return; } else { $error_message = __("A required Smart Manager file is missing. Can't continue.", SM_TEXT_DOMAIN); } } } else { $error_message = "<b>" . __('Smart Manager', SM_TEXT_DOMAIN) . "</b> " . __('add-on requires', SM_TEXT_DOMAIN) . " " . '<a href="http://www.storeapps.org/wpec/">' . __('WP e-Commerce', SM_TEXT_DOMAIN) . "</a>" . " " . __('plugin or', SM_TEXT_DOMAIN) . " " . '<a href="http://www.storeapps.org/woocommerce/">' . __('WooCommerce', SM_TEXT_DOMAIN) . "</a>" . " " . __('plugin. Please install and activate it.', SM_TEXT_DOMAIN); } } } else { if (file_exists(WP_PLUGIN_DIR . '/wp-e-commerce/wp-shopping-cart.php')) { if (is_plugin_active('wp-e-commerce/wp-shopping-cart.php')) { require_once WPSC_FILE_PATH . '/wp-shopping-cart.php'; if (IS_WPSC37 || IS_WPSC38) { if (file_exists($base_path . 'manager-console.php')) { include_once $base_path . 'manager-console.php'; return; } else { $error_message = __("A required Smart Manager file is missing. Can't continue.", SM_TEXT_DOMAIN); } } else { $error_message = __('Smart Manager currently works only with WP e-Commerce 3.7 or above.', SM_TEXT_DOMAIN); } } else { $error_message = __('WP e-Commerce plugin is not activated.', SM_TEXT_DOMAIN) . "<br/><b>" . _e('Smart Manager', SM_TEXT_DOMAIN) . "</b> " . _e('add-on requires WP e-Commerce plugin, please activate it.', SM_TEXT_DOMAIN); } } else { if (file_exists(WP_PLUGIN_DIR . '/woocommerce/woocommerce.php')) { if (is_plugin_active('woocommerce/woocommerce.php')) { if (IS_WOO13) { $error_message = __('Smart Manager currently works only with WooCommerce 1.4 or above.', SM_TEXT_DOMAIN); } else { if (file_exists($base_path . 'manager-console.php')) { include_once $base_path . 'manager-console.php'; return; } else { $error_message = __("A required Smart Manager file is missing. Can't continue.", SM_TEXT_DOMAIN); } } } else { $error_message = __('WooCommerce plugin is not activated.', SM_TEXT_DOMAIN) . "<br/><b>" . __('Smart Manager', SM_TEXT_DOMAIN) . "</b> " . __('add-on requires WooCommerce plugin, please activate it.', SM_TEXT_DOMAIN); } } else { $error_message = "<b>" . __('Smart Manager', SM_TEXT_DOMAIN) . "</b> " . __('add-on requires', SM_TEXT_DOMAIN) . " " . '<a href="http://www.storeapps.org/wpec/">' . __('WP e-Commerce', SM_TEXT_DOMAIN) . "</a>" . " " . __('plugin or', SM_TEXT_DOMAIN) . " " . '<a href="http://www.storeapps.org/woocommerce/">' . __('WooCommerce', SM_TEXT_DOMAIN) . "</a>" . " " . __('plugin. Please install and activate it.', SM_TEXT_DOMAIN); } } } if ($error_message != '') { smart_display_err($error_message); ?> </p> </div> <?php } }
function smart_settings_page() { global $sm_download_url, $wpdb; $is_pro_updated = smart_is_pro_updated(); $sm_license_key = smart_get_license_key(); if (isset($_POST['submit'])) { $latest_version = smart_get_latest_version(); $sm_license_key = $wpdb->_real_escape(trim($_POST['license_key'])); $sm_post_url = STORE_APPS_URL . 'wp-admin/admin-ajax.php?action=woocommerce_validate_serial_key&serial=' . urlencode($sm_license_key) . '&sku=sm'; $sm_response_result = smart_get_sm_response($sm_post_url); if ($sm_license_key != '') { if ($sm_response_result->is_valid) { if (is_multisite()) { $delete_query = "DELETE FROM {$wpdb->sitemeta} WHERE meta_key = 'sm_license_key'"; $wpdb->query($delete_query); $query = "REPLACE INTO {$wpdb->sitemeta} (`meta_key`,`meta_value`) VALUES('sm_license_key','{$sm_license_key}')"; } else { $query = "REPLACE INTO `{$wpdb->prefix}options`(`option_name`,`option_value`) VALUES('sm_license_key','{$sm_license_key}')"; } $result = $wpdb->query($query); $msg = __('Your key is valid. Automatic Upgrades and support are now activated.', 'smart-manager'); smart_display_notice($msg); } else { smart_display_err($sm_response_result->msg); } } else { $msg = __('Please enter license key', 'smart-manager'); smart_display_err($msg); } } ?> </br> <form method="post" action=""> <div class="wrap"> <div id="icon-smart-manager" class="icon32"><br/></div> <h2><?php _e('Smart Manager Pro Settings', 'smart-manager'); ?> </h2> <?php _e("Your Smart Manager Pro license key is used to verify your support package, enable automatic updates and receive support.", 'smart-manager'); ?> </div> <br /> <?php _e('License key:', 'smart-manager'); ?> <input id="license_key" type="text" name="license_key" size="45" value="<?php echo $sm_license_key; ?> " /> <input class="button" type="submit" name="submit" value="<?php _e('Validate', 'smart-manager'); ?> " /></form> <div id="notification" name="notification"></div> <?php }