当前位置: 首页>>代码示例>>PHP>>正文


PHP Cart66Common::cart66UserCan方法代码示例

本文整理汇总了PHP中Cart66Common::cart66UserCan方法的典型用法代码示例。如果您正苦于以下问题:PHP Cart66Common::cart66UserCan方法的具体用法?PHP Cart66Common::cart66UserCan怎么用?PHP Cart66Common::cart66UserCan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cart66Common的用法示例。


在下文中一共展示了Cart66Common::cart66UserCan方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cart66_add_dashboard_widgets

 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'));
                 }
             }
         }
     }
 }
开发者ID:rbredow,项目名称:allyzabbacart,代码行数:42,代码来源:Cart66Dashboard.php

示例2: array

    </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>
开发者ID:rbredow,项目名称:allyzabbacart,代码行数:31,代码来源:cart-button.php

示例3: cart66_admin_bar_menu

 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));
         }
     }
 }
开发者ID:rbredow,项目名称:allyzabbacart,代码行数:22,代码来源:Cart66.php

示例4: saveSettings

 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;
 }
开发者ID:rbredow,项目名称:allyzabbacart,代码行数:72,代码来源:Cart66Ajax.php


注:本文中的Cart66Common::cart66UserCan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。