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


PHP leyka函数代码示例

本文整理汇总了PHP中leyka函数的典型用法代码示例。如果您正苦于以下问题:PHP leyka函数的具体用法?PHP leyka怎么用?PHP leyka使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: __construct

 function __construct(Leyka_Payment_Method $payment_method, $current_currency = null)
 {
     if (!leyka()->form_is_screening) {
         leyka()->form_is_screening = true;
     }
     $this->_pm = $payment_method;
     $this->_pm_name = $payment_method->id;
     $this->_current_currency = $current_currency;
     $this->_form_action = get_option('permalink_structure') ? home_url('leyka-process-donation') : home_url('?page=leyka-process-donation');
 }
开发者ID:WarmHouseProject,项目名称:WarmHouse,代码行数:10,代码来源:leyka-class-payment-form.php

示例2: leyka_submit_donation

/** Different ajax handler functions */
function leyka_submit_donation()
{
    if (empty($_POST['_wpnonce']) || !wp_verify_nonce($_POST['_wpnonce'], 'leyka_payment_form')) {
        die(json_encode(array('status' => 0, 'message' => __('Wrong nonce in submitted form data', 'leyka'))));
    }
    leyka()->clear_session_errors();
    // Clear all previous submits errors, if there are some
    $pm = explode('-', $_POST['leyka_payment_method']);
    if (!$pm || count($pm) < 2) {
        die(json_encode(array('status' => 0, 'message' => __('Wrong gateway or/and payment method in submitted form data', 'leyka'))));
    }
    $donation_id = leyka()->log_submission();
    do_action('leyka_payment_form_submission-' . $pm[0], $pm[0], implode('-', array_slice($pm, 1)), $donation_id, $_POST);
    $payment_vars = array_merge(apply_filters('leyka_submission_form_data-' . $pm[0], $_POST, $pm[1], $donation_id), array('status' => 1, 'donation_id' => $donation_id));
    //    echo '<pre>' . print_r($payment_vars, 1) . '</pre>';
    die(json_encode($payment_vars));
}
开发者ID:WarmHouseProject,项目名称:WarmHouse,代码行数:18,代码来源:leyka-ajax.php

示例3: dir

require_once LEYKA_PLUGIN_DIR . 'inc/leyka-class-options-controller.php';
require_once LEYKA_PLUGIN_DIR . 'inc/leyka-core.php';
require_once LEYKA_PLUGIN_DIR . 'inc/leyka-gateways-api.php';
require_once LEYKA_PLUGIN_DIR . 'inc/leyka-class-campaign.php';
require_once LEYKA_PLUGIN_DIR . 'inc/leyka-class-donation.php';
require_once LEYKA_PLUGIN_DIR . 'inc/leyka-class-payment-form.php';
require_once LEYKA_PLUGIN_DIR . 'inc/leyka-ajax.php';
require_once LEYKA_PLUGIN_DIR . 'inc/leyka-shortcodes.php';
require_once LEYKA_PLUGIN_DIR . 'inc/leyka-widgets.php';
/** Automatically include all sub-dirs of /leyka/gateways/ */
$gateways_dir = dir(LEYKA_PLUGIN_DIR . 'gateways/');
if (!$gateways_dir) {
    // ?..
} else {
    while (false !== ($gateway_id = $gateways_dir->read())) {
        $file_addr = LEYKA_PLUGIN_DIR . "gateways/{$gateway_id}/leyka-class-{$gateway_id}-gateway.php";
        if ($gateway_id != '.' && $gateway_id != '..' && file_exists($file_addr)) {
            require_once $file_addr;
        }
    }
    $gateways_dir->close();
}
register_activation_hook(__FILE__, array('Leyka', 'activate'));
// Activation
add_action('plugins_loaded', array('Leyka', 'activate'));
// Any update needed
register_deactivation_hook(__FILE__, array('Leyka', 'deactivate'));
// Deactivate
leyka();
// All systems go
//restore_error_handler(); // Finally, restore errors handler to previous one
开发者ID:WarmHouseProject,项目名称:WarmHouse,代码行数:31,代码来源:leyka.php

示例4: leyka_get_current_template_data

function leyka_get_current_template_data($campaign = null, $template = null, $is_service = false)
{
    global $post;
    if (!$campaign) {
        $campaign = $post;
    } elseif (is_int($campaign)) {
        $campaign = get_post($campaign);
    }
    // Get campaign-specific template, if needed:
    if (!$template) {
        if (!is_a($campaign, 'Leyka_Campaign')) {
            $campaign = new Leyka_Campaign($campaign);
        }
        $template = $campaign->template;
    }
    if (!$template || $template == 'default') {
        $template = leyka_options()->opt('donation_form_template');
    }
    $template = leyka()->get_template($template, !!$is_service);
    return $template ? $template : false;
}
开发者ID:slavam,项目名称:adult-childhood,代码行数:21,代码来源:leyka-class-payment-form.php

示例5: leyka_add_gateway_chronopay

function leyka_add_gateway_chronopay()
{
    // Use named function to leave a possibility to remove/replace it on the hook
    leyka()->add_gateway(Leyka_Chronopay_Gateway::get_instance());
}
开发者ID:slavam,项目名称:adult-childhood,代码行数:5,代码来源:leyka-class-chronopay-gateway.php

示例6: get_status_labels

 /** Helpers **/
 static function get_status_labels($status = false)
 {
     $labels = leyka()->get_donation_statuses();
     if (empty($status)) {
         return $labels;
     } elseif ($status == 'publish') {
         return $labels['funded'];
     } else {
         return !empty($labels[$status]) ? $labels[$status] : false;
     }
 }
开发者ID:GenV,项目名称:Leyka,代码行数:12,代码来源:leyka-class-donation.php

示例7: leyka_add_gateway_yandex_phyz

function leyka_add_gateway_yandex_phyz()
{
    // Use named function to leave a possibility to remove/replace it on the hook
    leyka()->add_gateway(Leyka_Yandex_Phyz_Gateway::get_instance());
}
开发者ID:WarmHouseProject,项目名称:WarmHouse,代码行数:5,代码来源:leyka-class-yandex_phyz-gateway.php

示例8: leyka_add_gateway_cp

function leyka_add_gateway_cp()
{
    leyka()->add_gateway(Leyka_CP_Gateway::get_instance());
}
开发者ID:WarmHouseProject,项目名称:WarmHouse,代码行数:4,代码来源:leyka-class-cp-gateway.php

示例9: get_target_state_label

 static function get_target_state_label($state = false)
 {
     $labels = leyka()->get_campaign_target_states();
     if (!$state) {
         return $labels;
     } else {
         return !empty($labels[$state]) ? $labels[$state] : false;
     }
 }
开发者ID:WarmHouseProject,项目名称:WarmHouse,代码行数:9,代码来源:leyka-class-campaign.php

示例10: leyka_do_donations_export

function leyka_do_donations_export()
{
    if (empty($_GET['leyka-donations-export-csv-excel'])) {
        return;
    }
    // Just in case that export will require some time:
    ini_set('max_execution_time', 99999);
    set_time_limit(99999);
    ob_start();
    $meta_query = array('relation' => 'AND');
    if (!empty($_GET['campaign'])) {
        $meta_query[] = array('key' => 'leyka_campaign_id', 'value' => (int) $_GET['campaign']);
    }
    if (!empty($_GET['payment_type'])) {
        $meta_query[] = array('key' => 'leyka_payment_type', 'value' => $_GET['payment_type']);
    }
    if (!empty($_GET['gateway_pm'])) {
        if (strpos($_GET['gateway_pm'], 'gateway__') !== false) {
            $meta_query[] = array('key' => 'leyka_gateway', 'value' => str_replace('gateway__', '', $_GET['gateway_pm']));
        } elseif (strpos($_GET['gateway_pm'], 'pm__') !== false) {
            $meta_query[] = array('key' => 'leyka_payment_method', 'value' => str_replace('pm__', '', $_GET['gateway_pm']));
        }
    }
    $args = array('post_type' => Leyka_Donation_Management::$post_type, 'post_status' => isset($_GET['post_status']) && in_array($_GET['post_status'], array_keys(leyka()->get_donation_statuses())) ? $_GET['post_status'] : 'any', 'm' => $_GET['month-year'], 's' => $_GET['search_string'], 'meta_query' => $meta_query, 'nopaging' => true);
    $donations = get_posts(apply_filters('leyka_donations_export_query_args', $args));
    function leyka_prep($text)
    {
        return '"' . str_replace(array(';', '"'), array('', ''), $text) . '"';
    }
    if (isset($_GET['export-tech'])) {
        $domain = str_replace(array('http:', 'https:'), '', home_url());
        ob_clean();
        header('Content-type: application/vnd.ms-excel');
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Pragma: no-cache');
        header('Content-Disposition: attachment; filename="donations-tech-' . $domain . '-' . date('d.m.Y-H.i.s') . '.csv"');
        echo iconv('UTF-8', apply_filters('leyka_donations_tech_export_content_charset', 'windows-1251'), "sep=;\n" . implode(';', array('hash', 'Domain', 'Org_name', 'Timestamp', 'Date', 'Email_hash', 'Donor_name hash', 'Sum', 'Currency', 'Gateway_pm', 'Donation_status', 'Campaign_title', 'Campaign_URL', 'Payment_title', 'Target_sum', 'Campaign_target_state', 'Campaign_is_finished')));
        foreach ($donations as $donation) {
            $donation = new Leyka_Donation($donation);
            $campaign = new Leyka_Campaign($donation->campaign_id);
            // @ to avoid notices about illegal chars that happen in the line sometimes:
            echo @iconv('UTF-8', apply_filters('leyka_donations_tech_export_content_charset', 'windows-1251'), "\r\n" . implode(';', array(leyka_prep(hash('sha256', $domain . $donation->date_timestamp . $donation->sum . $donation->id)), leyka_prep($domain), leyka_prep(leyka_options()->opt('org_full_name')), leyka_prep($donation->date_timestamp), leyka_prep(date('d.m.Y H:i:s', $donation->date_timestamp)), leyka_prep(hash('sha256', $donation->donor_email)), leyka_prep(hash('sha256', $donation->donor_name)), leyka_prep((int) $donation->sum), leyka_prep($donation->currency), $donation->payment_type == 'correction' ? leyka_prep($donation->pm_id) : leyka_prep($donation->gateway_label . '-' . $donation->pm_id), leyka_prep($donation->status), leyka_prep($campaign->title), leyka_prep($campaign->url), leyka_prep($campaign->payment_title), leyka_prep((int) $campaign->target), leyka_prep($campaign->target_state), leyka_prep((int) $campaign->is_finished))));
        }
        die('');
    } else {
        function leyka_prepare_donation_data_for_export($donation_data)
        {
            foreach ($donation_data as &$data) {
                $data = leyka_prep($data);
            }
            return $donation_data;
        }
        add_filter('leyka_donations_export_line', 'leyka_prepare_donation_data_for_export');
        ob_clean();
        header('Content-type: application/vnd.ms-excel');
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Pragma: no-cache');
        header('Content-Disposition: attachment; filename="donations-' . date('d.m.Y-H.i.s') . '.csv"');
        echo iconv('UTF-8', apply_filters('leyka_donations_export_content_charset', 'windows-1251'), "sep=;\n" . implode(';', apply_filters('leyka_donations_export_headers', array('ID', 'Имя донора', 'Email', 'Тип платежа', 'Способ платежа', 'Сумма', 'Дата пожертвования', 'Статус', 'Кампания'))));
        foreach ($donations as $donation) {
            $donation = new Leyka_Donation($donation);
            $campaign = new Leyka_Campaign($donation->campaign_id);
            echo @iconv('UTF-8', apply_filters('leyka_donations_export_content_charset', 'windows-1251'), "\r\n" . implode(';', apply_filters('leyka_donations_export_line', array($donation->id, $donation->donor_name, $donation->donor_email, $donation->payment_type_label, $donation->payment_method_label, $donation->sum . ' ' . $donation->currency_label, $donation->date, $donation->status_label, $campaign->title))));
        }
        die('');
    }
}
开发者ID:WarmHouseProject,项目名称:WarmHouse,代码行数:69,代码来源:leyka-donations-export.php

示例11: leyka_add_gateway_robokassa

function leyka_add_gateway_robokassa()
{
    leyka()->add_gateway(Leyka_Robokassa_Gateway::get_instance());
}
开发者ID:WarmHouseProject,项目名称:WarmHouse,代码行数:4,代码来源:leyka-class-robokassa-gateway.php

示例12: leyka_get_campaign_target_states_list

/**
 * Get all possible campaign target states.
 **/
function leyka_get_campaign_target_states_list()
{
    return leyka()->get_campaign_target_states();
}
开发者ID:slavam,项目名称:adult-childhood,代码行数:7,代码来源:leyka-functions.php

示例13: leyka_do_donations_export

function leyka_do_donations_export()
{
    if (empty($_GET['leyka-donations-export-csv-excel'])) {
        return;
    }
    // Just in case that export will require some time:
    ini_set('max_execution_time', 99999);
    set_time_limit(99999);
    ob_start();
    $meta_query = array('relation' => 'AND');
    if (!empty($_GET['campaign'])) {
        $meta_query[] = array('key' => 'leyka_campaign_id', 'value' => (int) $_GET['campaign']);
    }
    if (!empty($_GET['payment_type'])) {
        $meta_query[] = array('key' => 'leyka_payment_type', 'value' => $_GET['payment_type']);
    }
    if (!empty($_GET['gateway_pm'])) {
        if (strpos($_GET['gateway_pm'], 'gateway__') !== false) {
            $meta_query[] = array('key' => 'leyka_gateway', 'value' => str_replace('gateway__', '', $_GET['gateway_pm']));
        } elseif (strpos($_GET['gateway_pm'], 'pm__') !== false) {
            $meta_query[] = array('key' => 'leyka_payment_method', 'value' => str_replace('pm__', '', $_GET['gateway_pm']));
        }
    }
    $args = array('post_type' => Leyka_Donation_Management::$post_type, 'post_status' => isset($_GET['post_status']) && in_array($_GET['post_status'], array_keys(leyka()->get_donation_statuses())) ? $_GET['post_status'] : 'any', 'm' => $_GET['month-year'], 'meta_query' => $meta_query, 'posts_per_page' => 200);
    $donations = new WP_Query(apply_filters('leyka_donations_export_query_args', $args));
    $total_pages = $donations->found_posts / 200;
    $total_pages = $total_pages - (int) $total_pages > 0 ? (int) $total_pages + 1 : $total_pages;
    $posts_page = $total_pages > 0 ? 1 : 0;
    $donations = $donations->get_posts();
    require_once LEYKA_PLUGIN_DIR . 'inc/excel-writer/SimpleExcel.php';
    $excel = new SimpleExcel('csv');
    $domain = str_replace(array('http:', 'https:'), '', home_url());
    function prep($text)
    {
        return '"' . str_replace(array(';', '"'), array('', ''), $text) . '"';
    }
    if (isset($_GET['export-tech'])) {
        // Technical export mode column headings
        $excel->writer->addRow(array('hash', 'Domain', 'Org_name', 'Timestamp', 'Date', 'Email_hash', 'Donor_name hash', 'Sum', 'Currency', 'Gateway_pm', 'Donation_status', 'Campaign_title', 'Campaign_URL', 'Payment_title', 'Target_sum', 'Campaign_target_state', 'Campaign_is_finished'));
    } else {
        // Normal export mode column headings
        $excel->writer->addRow(array(apply_filters('leyka_donations_export_headers', array('ID', 'Имя донора', 'Email', 'Тип платежа', 'Способ платежа', 'Сумма', 'Дата пожертвования', 'Статус', 'Кампания'))));
    }
    while ($posts_page && $posts_page <= $total_pages) {
        // Main loop too fill the export file
        foreach ($donations as $donation) {
            $donation = new Leyka_Donation($donation);
            $campaign = new Leyka_Campaign($donation->campaign_id);
            if (isset($_GET['export-tech'])) {
                $excel->writer->addRow(array(prep(wp_hash($domain . $donation->date_timestamp . $donation->sum . $donation->id)), prep($domain), prep(leyka_options()->opt('org_full_name')), prep($donation->date_timestamp), prep(date(get_option('date_format') . ', H:i', $donation->date_timestamp)), prep(wp_hash($donation->donor_email)), prep(wp_hash($donation->donor_name)), prep((int) $donation->sum), prep($donation->currency), $donation->payment_type == 'correction' ? prep($donation->pm_id) : prep($donation->gateway_label . '-' . $donation->pm_id), prep($donation->status), prep($campaign->title), prep($campaign->url), prep($campaign->payment_title), prep((int) $campaign->target), prep($campaign->target_state), prep((int) $campaign->is_finished)));
            } else {
                $excel->writer->addRow(apply_filters('leyka_donations_export_line', array($donation->id, $donation->donor_name, $donation->donor_email, $donation->payment_type_label, $donation->payment_method_label, $donation->sum . ' ' . $donation->currency_label, $donation->date, $donation->status_label, $campaign->title)));
            }
        }
        $posts_page++;
        $args['paged'] = $posts_page;
        $donations = get_posts(apply_filters('leyka_donations_export_query_args', $args));
        wp_cache_flush();
    }
    if (isset($_GET['export-tech'])) {
        $excel->writer->setDelimiter(';');
        ob_clean();
        header('Content-type: application/vnd.ms-excel');
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Pragma: no-cache');
        header('Content-Disposition: attachment; filename="donations-tech-' . $domain . '-' . date('d.m.Y-H.i.s') . '.csv"');
        die(iconv('UTF-8', apply_filters('leyka_donations_export_content_charset', 'windows-1251'), "sep=;\n" . $excel->writer->saveString()));
        //        ob_clean();
        //
        //        header('Content-type: application/vnd.ms-excel');
        //        header('Content-Transfer-Encoding: binary');
        //        header('Expires: 0');
        //        header('Pragma: no-cache');
        //        header('Content-Disposition: attachment; filename="donations-tech-'.$domain.'-'.date('d.m.Y-H.i.s').'.csv"');
        //
        //        die("sep=;\n".implode("\r\n", $file_lines));
    } else {
        $excel->writer->setDelimiter(',');
        ob_clean();
        header('Content-type: application/vnd.ms-excel');
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Pragma: no-cache');
        header('Content-Disposition: attachment; filename="donations-' . date('d.m.Y-H.i.s') . '.csv"');
        die(iconv('UTF-8', apply_filters('leyka_donations_export_content_charset', 'windows-1251'), "sep=,\n" . $excel->writer->saveString()));
    }
}
开发者ID:slavam,项目名称:adult-childhood,代码行数:88,代码来源:leyka-donations-export.php

示例14: leyka_form_is_screening

/** @return boolean True if at least one Leyka form is currently on the screen, false otherwise */
function leyka_form_is_screening($widgets_also = true)
{
    $template = get_page_template_slug();
    $content_has_shortcode = false;
    if (get_post()) {
        foreach (leyka_get_shortcodes() as $shortcode_tag) {
            if (has_shortcode(get_post()->post_content, $shortcode_tag)) {
                $content_has_shortcode = true;
                break;
            }
        }
    }
    $form_is_screening = leyka()->form_is_screening || is_singular(Leyka_Campaign_Management::$post_type) || stristr($template, 'home-campaign_one') !== false || stripos($template, 'leyka') !== false || $content_has_shortcode || (!!$widgets_also ? leyka_is_widget_active() : false);
    return $form_is_screening;
}
开发者ID:WarmHouseProject,项目名称:WarmHouse,代码行数:16,代码来源:leyka-functions.php

示例15: leyka_fix

 public function leyka_fix()
 {
     if (!class_exists('Leyka')) {
         return;
     }
     $leyka = leyka();
     if (!is_singular('leyka_campaign')) {
         remove_action('wp_enqueue_scripts', array($leyka, 'enqueue_styles'));
         remove_action('wp_enqueue_scripts', array($leyka, 'enqueue_scripts'));
     }
 }
开发者ID:Teplitsa,项目名称:giger,代码行数:11,代码来源:class-cssjs.php


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