Example #1
0
/**
 * Load Dokan Plugin when all plugins loaded
 *
 * @return void
 */
function dokan_load_plugin()
{
    $dokan = WeDevs_Dokan::init();
}
 /**
  * Load Product Edit Template
  *
  * @since 2.4
  *
  * @return void
  */
 public function load_product_edit_template()
 {
     if (!WeDevs_Dokan::init()->is_pro()) {
         dokan_get_template_part('products/new-product-single');
     }
 }
Example #3
0
function dokan_admin_dash_metabox_glance()
{
    $user_count = count_users();
    $withdraw_counts = dokan_get_withdraw_count();
    $seller_counts = dokan_get_seller_count();
    $total_seller = isset($user_count['avail_roles']['seller']) ? $user_count['avail_roles']['seller'] : 0;
    ?>

    <div class="dokan-left">
        <h4><?php 
    _e('Sellers', 'dokan');
    ?>
</h4>

        <ul>
            <li class="seller-count">
                <div class="dashicons dashicons-businessman"></div>
                <a href="<?php 
    echo WeDevs_Dokan::init()->is_pro() ? admin_url('admin.php?page=dokan-sellers') : '';
    ?>
"><?php 
    printf(_n(__('%d Total Seller', 'dokan'), __('%d Total Sellers', 'dokan'), $total_seller, 'dokan'), $total_seller);
    ?>
</a>
            </li>
            <li class="seller-count mark-green">
                <div class="dashicons dashicons-awards"></div>
                <a href="<?php 
    echo WeDevs_Dokan::init()->is_pro() ? admin_url('admin.php?page=dokan-sellers') : '';
    ?>
">
                    <?php 
    if ($seller_counts['yes']) {
        printf(_n(__('%d Active Seller', 'dokan'), __('%d Active Sellers', 'dokan'), $seller_counts['yes'], 'dokan'), $seller_counts['yes']);
    } else {
        _e('No Active Seller', 'dokan');
    }
    ?>
                </a>
            </li>
            <li class="seller-count <?php 
    echo $seller_counts['no'] < 1 ? 'mark-green' : 'mark-red';
    ?>
">
                <div class="dashicons dashicons-editor-help"></div>
                <a href="<?php 
    echo WeDevs_Dokan::init()->is_pro() ? admin_url('admin.php?page=dokan-sellers') : '';
    ?>
">
                    <?php 
    if ($seller_counts['no']) {
        printf(_n(__('%d Pending Seller', 'dokan'), __('%d Pending Sellers', 'dokan'), $seller_counts['no'], 'dokan'), $seller_counts['no']);
    } else {
        _e('No Pending Seller', 'dokan');
    }
    ?>
                </a>
            </li>
        </ul>
    </div>

    <div class="dokan-right">
        <h4><?php 
    _e('Withdraw', 'dokan');
    ?>
</h4>

        <ul>
            <li class="withdraw-pending <?php 
    echo $withdraw_counts['pending'] < 1 ? 'mark-green' : 'mark-red';
    ?>
">
                <div class="dashicons dashicons-visibility"></div>
                <a href="<?php 
    echo WeDevs_Dokan::init()->is_pro() ? admin_url('admin.php?page=dokan-withdraw') : '';
    ?>
"><?php 
    printf(__('%d Pending Withdraw', 'dokan'), $withdraw_counts['pending']);
    ?>
</a>
            </li>
            <li class="withdraw-completed mark-green">
                <div class="dashicons dashicons-yes"></div>
                <a href="<?php 
    echo WeDevs_Dokan::init()->is_pro() ? admin_url('admin.php?page=dokan-withdraw&amp;status=completed') : '';
    ?>
"><?php 
    printf(__('%d Completed Withdraw', 'dokan'), $withdraw_counts['completed']);
    ?>
</a>
            </li>
            <li class="withdraw-cancelled">
                <div class="dashicons dashicons-dismiss"></div>
                <a href="<?php 
    echo WeDevs_Dokan::init()->is_pro() ? admin_url('admin.php?page=dokan-withdraw&amp;status=cancelled') : '';
    ?>
"><?php 
    printf(__('%d Cancelled Withdraw', 'dokan'), $withdraw_counts['cancelled']);
    ?>
</a>
            </li>
        </ul>
    </div>

    <?php 
}
Example #4
0
/**
 * Locate a template and return the path for inclusion.
 *
 * This is the load order:
 *
 *      yourtheme       /   $template_path  /   $template_name
 *      yourtheme       /   $template_name
 *      $default_path   /   $template_name
 *
 * @access public
 * @param mixed $template_name
 * @param string $template_path (default: '')
 * @param string $default_path (default: '')
 * @return string
 */
function dokan_locate_template($template_name, $template_path = '', $default_path = '')
{
    $dokan = WeDevs_Dokan::init();
    if (!$template_path) {
        $template_path = $dokan->template_path();
    }
    if (!$default_path) {
        $default_path = $dokan->plugin_path() . '/templates/';
    }
    // Look within passed path within the theme - this is priority
    $template = locate_template(array(trailingslashit($template_path) . $template_name, $template_name));
    // Get default template
    if (!$template) {
        $template = $default_path . $template_name;
    }
    // Return what we found
    return apply_filters('dokan_locate_template', $template, $template_name, $template_path);
}
Example #5
0
 /**
  * Returns the edit product template
  *
  * @param string  $template
  *
  * @return string
  */
 function product_edit_template($template)
 {
     if (!$this->is_woo_installed()) {
         return $template;
     }
     if (get_query_var('edit') && is_singular('product')) {
         if (dokan_get_option('product_style', 'dokan_selling', 'old') == 'old' && WeDevs_Dokan::init()->is_pro()) {
             $edit_product_url = dokan_locate_template('products/product-edit.php', '', '', true);
         } elseif (dokan_get_option('product_style', 'dokan_selling', 'old') == 'new' && WeDevs_Dokan::init()->is_pro()) {
             $edit_product_url = dokan_locate_template('products/new-product-single.php');
         } else {
             $edit_product_url = dokan_locate_template('products/new-product-single.php');
         }
         return $edit_product_url;
     }
     return $template;
 }