コード例 #1
0
 public static function cart66_add_dashboard_widgets()
 {
     if (Cart66Common::cart66UserCan('orders')) {
         wp_add_dashboard_widget('cart66_recent_orders_widget', __('Cart66 Recent Orders', 'cart66'), array('Cart66Dashboard', 'cart66_recent_orders_widget'), array('Cart66Dashboard', 'cart66_recent_orders_setup'));
     }
     if (Cart66Common::cart66UserCan('reports')) {
         wp_add_dashboard_widget('cart66_statistics_widget', __('Cart66 Statistics', 'cart66'), array('Cart66Dashboard', 'cart66_statistics_widget'));
     }
     global $wp_meta_boxes;
     $normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
     $cart66_recent_orders_widget_backup = array();
     $cart66_statistics_widget_backup = array();
     if (Cart66Common::cart66UserCan('orders')) {
         $cart66_recent_orders_widget_backup = array('cart66_recent_orders_widget' => $normal_dashboard['cart66_recent_orders_widget']);
         unset($normal_dashboard['cart66_recent_orders_widget']);
     }
     if (Cart66Common::cart66UserCan('reports')) {
         $cart66_statistics_widget_backup = array('cart66_statistics_widget' => $normal_dashboard['cart66_statistics_widget']);
         unset($normal_dashboard['cart66_statistics_widget']);
     }
     $sorted_dashboard = array_merge($cart66_recent_orders_widget_backup, $cart66_statistics_widget_backup, $normal_dashboard);
     $wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
     if (CART66_PRO) {
         $updater = new Cart66ProCommon();
         $newVersion = get_transient('_cart66_version_request');
         if (!$newVersion) {
             $newVersion = $updater->getVersionInfo();
             set_transient('_cart66_version_request', $newVersion, 43200);
         }
         $dismissVersion = Cart66Setting::getValue('dismiss_version');
         $currentVersion = Cart66Setting::getValue('version');
         if (version_compare($currentVersion, $newVersion['version'], '<') && version_compare($newVersion['version'], $dismissVersion, '>')) {
             if (current_user_can('update_plugins')) {
                 $plugins = get_plugin_updates();
                 if (isset($plugins[basename(CART66_PATH) . '/cart66.php'])) {
                     add_action('admin_footer', array('Cart66Dashboard', 'cart66_upgrade_message_jquery'));
                     add_action('admin_notices', array('Cart66Dashboard', 'cart66_upgrade_message'));
                 }
             }
         }
     }
 }
コード例 #2
0
ファイル: cart-button.php プロジェクト: rbredow/allyzabbacart
    </div>
  <?php 
    }
}
?>

<?php 
if ($data['ajax'] == 'yes' || $data['ajax'] == 'true') {
    ?>
  <?php 
    echo Cart66Common::getView('views/ajax-cart-button-message.php', array('id' => $id, 'productName' => $data['product']->name));
}
?>

<?php 
if (Cart66Common::cart66UserCan('products') && Cart66Setting::getValue('enable_edit_product_links')) {
    ?>
  <div class='cart66_edit_product_link'>
    <?php 
    if ($data['subscription'] == 0) {
        ?>
      <a href='<?php 
        echo admin_url();
        ?>
admin.php?page=cart66-products&amp;task=edit&amp;id=<?php 
        echo $id;
        ?>
'><?php 
        _e('Edit this Product', 'cart66');
        ?>
</a>
コード例 #3
0
ファイル: Cart66.php プロジェクト: rbredow/allyzabbacart
 public function cart66_admin_bar_menu()
 {
     global $wp_admin_bar;
     if (!is_admin_bar_showing()) {
         return;
     }
     $wp_admin_bar->add_menu(array('id' => 'cart66', 'title' => false, 'href' => false, 'meta' => array("html" => '<span class="cart66AdminBarIcon"></span>')));
     $cart66Pages = array("Orders" => array("role" => 'orders', "slug" => '_admin'), "Products" => array("role" => 'products', "slug" => '-products'), "Promotions" => array("role" => 'promotions', "slug" => '-promotions'), "Settings" => array("role" => 'settings', "slug" => '-settings'));
     //Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] pages array: " . print_r($cart66Pages, true));
     foreach ($cart66Pages as $page => $meta) {
         if (Cart66Common::cart66UserCan($meta['role'])) {
             $wp_admin_bar->add_menu(array('id' => 'cart66-adminbar-' . $meta['slug'], 'parent' => 'cart66', 'title' => __($page), 'href' => get_bloginfo('wpurl') . '/wp-admin/admin.php?page=cart66' . strtolower($meta['slug']), 'meta' => false));
         }
     }
     $wp_admin_bar->add_menu(array('id' => 'cart66-pages', 'parent' => 'cart66', 'title' => __("Store Pages"), 'href' => false, 'meta' => false));
     $storePages = array("Store" => get_page_by_path('store'), "Cart" => get_page_by_path('store/cart'), "Checkout" => get_page_by_path('store/checkout'), "Receipt" => get_page_by_path('store/receipt'));
     foreach ($storePages as $pageName => $cartPage) {
         if ($cartPage) {
             $wp_admin_bar->add_menu(array('id' => 'cart66-storepage-' . strtolower($pageName), 'parent' => 'cart66-pages', 'title' => __($pageName), 'href' => get_bloginfo('wpurl') . '/wp-admin/post.php?post=' . $cartPage->ID . '&action=edit', 'meta' => false));
         }
     }
 }
コード例 #4
0
ファイル: Cart66Ajax.php プロジェクト: rbredow/allyzabbacart
 public static function saveSettings()
 {
     if (!Cart66Common::cart66UserCan('settings')) {
         die;
     }
     $error = '';
     foreach ($_REQUEST as $key => $value) {
         if ($key[0] != '_' && $key != 'action' && $key != 'submit' && $key) {
             if (is_array($value) && $key != 'admin_page_roles') {
                 $value = array_filter($value, 'strlen');
                 if (empty($value)) {
                     $value = '';
                 } else {
                     $value = implode('~', $value);
                 }
             }
             if ($key == 'status_options') {
                 $value = str_replace('&', '', Cart66Common::deepTagClean($value));
             }
             if ($key == 'home_country') {
                 $hc = Cart66Setting::getValue('home_country');
                 if ($hc != $value) {
                     $method = new Cart66ShippingMethod();
                     $method->clearAllLiveRates();
                 }
             } elseif ($key == 'countries') {
                 if (strpos($value, '~') === false) {
                     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] country list value: {$value}");
                     $value = '';
                 }
                 if (empty($value) && !empty($_REQUEST['international_sales'])) {
                     $error = "Please select at least one country to ship to.";
                 }
             } elseif ($key == 'enable_logging' && $value == '1') {
                 try {
                     Cart66Log::createLogFile();
                 } catch (Cart66Exception $e) {
                     $error = '<span>' . $e->getMessage() . '</span>';
                     Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Caught Cart66 exception: " . $e->getMessage());
                 }
             } elseif ($key == 'constantcontact_list_ids') {
             } elseif ($key == 'admin_page_roles') {
                 $value = serialize($value);
                 Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Saving Admin Page Roles: " . print_r($value, true));
             } elseif ($key == 'currency_decimals' && $value == 0) {
                 $value = 'no_decimal';
             }
             Cart66Setting::setValue($key, trim(stripslashes($value)));
             if (CART66_PRO && $key == 'order_number') {
                 $versionInfo = get_transient('_cart66_version_request');
                 if (!$versionInfo) {
                     $versionInfo = Cart66ProCommon::getVersionInfo();
                     set_transient('_cart66_version_request', $versionInfo, 43200);
                 }
                 if (!$versionInfo) {
                     Cart66Setting::setValue('order_number', '');
                     $error = '<span>' . __('Invalid Order Number', 'cart66') . '</span>';
                 }
             }
         }
     }
     if ($error) {
         $result[0] = 'Cart66Modal alert-message alert-error';
         $result[1] = "<strong>" . __("Warning", "cart66") . "</strong><br/>{$error}";
     } else {
         $result[0] = 'Cart66Modal alert-message success';
         $result[1] = '<strong>Success</strong><br/>' . $_REQUEST['_success'] . '<br>';
     }
     $out = json_encode($result);
     echo $out;
     die;
 }