• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP bool_from_yn函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: settings_update

 function settings_update()
 {
     // form type
     switch ($_POST['setting_form']) {
         case 'main':
             // form main
             // set fields
             $this->setting['clientid'] = $_POST['setting']['clientid'];
             $this->setting['formid'] = $_POST['setting']['formid'];
             $this->setting['listid'] = $_POST['setting']['listid'];
             $this->setting['specialid'] = $_POST['setting']['specialid'];
             $this->setting['doubleopt'] = $_POST['setting']['doubleopt'];
             // fieldmap
             $this->setting['fieldmap'] = $this->_make_assoc($_POST['setting']['fieldmap']);
             // membershipmap
             $this->setting['membershipmap'] = $this->_make_assoc($_POST['setting']['membershipmap']);
             // update enable/disable
             $this->enabled = $_POST['enabled'];
             // enable/disable method
             $activate_method = bool_from_yn($this->enabled) ? 'activate_module' : 'deactivate_module';
             // update
             $ret = call_user_func_array(array(mgm_get_class('system'), $activate_method), array($this->code, $this->type));
             // save object options
             $this->save();
             // message
             return json_encode(array('status' => 'success', 'message' => sprintf(__('%s settings updated', 'mgm'), $this->name)));
             break;
         case 'box':
         default:
             // from box
             // set fields
             $this->setting['clientid'] = $_POST['setting']['icontact']['clientid'];
             $this->setting['formid'] = $_POST['setting']['icontact']['formid'];
             $this->setting['listid'] = $_POST['setting']['icontact']['listid'];
             $this->setting['specialid'] = $_POST['setting']['icontact']['specialid'];
             $this->setting['doubleopt'] = $_POST['setting']['icontact']['doubleopt'];
             // update object options
             $this->save();
             // message
             return json_encode(array('status' => 'success', 'message' => sprintf(__('%s settings updated', 'mgm'), $this->name)));
             break;
     }
 }
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:43,代码来源:mgm_icontact.php


示例2: _auto_login

 /**
  * API helper method auto login after subscribed
  *
  * @param int $user_id / transaction_id
  * @return bool
  */
 function _auto_login($id)
 {
     // get setting
     $setting = mgm_get_class('system')->get_setting();
     // if autologin not enabled
     if (!isset($setting['enable_autologin']) || isset($setting['enable_autologin']) && !bool_from_yn($setting['enable_autologin'])) {
         return false;
     }
     // check when enabled
     if (is_numeric($id)) {
         // user id
         $user_id = null;
         // get custom param
         $custom = $this->_get_transaction_passthrough($id);
         // verify if not subs purchase
         if ($custom['payment_type'] != 'subscription_purchase' || (!isset($custom['is_registration']) || isset($custom['is_registration']) && !bool_from_yn($custom['is_registration']))) {
             return false;
         }
         // fetch user id
         if (is_numeric($custom['user_id']) && $custom['user_id'] > 0) {
             // return id // #711, autologin is done in background
             mgm_auto_login($id);
             // redirect url for register & purchase
             if (isset($custom['post_id'])) {
                 return get_permalink($custom['post_id']);
             } elseif (isset($custom['postpack_post_id']) && isset($custom['postpack_id'])) {
                 return get_permalink($custom['postpack_post_id']);
             } else {
                 return true;
             }
         }
     }
     // return false
     return false;
 }
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:41,代码来源:mgm_payment.php


示例3: sandbox_init

function sandbox_init()
{
    load_theme_textdomain('sandbox');
    if ($GLOBALS['pagenow'] == 'themes.php' && isset($_GET['page']) && $_GET['page'] == 'skins' && isset($_GET['action']) && $_GET['action'] == 'activate' && current_user_can('switch_themes')) {
        check_admin_referer('switch-skin_' . $_GET['skin']);
        $info = sandbox_skin_info($_GET['skin']);
        sandbox_set_options(array('skin' => wp_filter_kses($_GET['skin']), 'globalnav' => bool_from_yn($info['global_navigation'])));
        wp_redirect('themes.php?page=skins&message=updated');
    }
}
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:10,代码来源:functions.php


示例4: test_bool_from_yn

 /**
  * @ticket 35972
  */
 function test_bool_from_yn()
 {
     $this->assertTrue(bool_from_yn('Y'));
     $this->assertTrue(bool_from_yn('y'));
     $this->assertFalse(bool_from_yn('n'));
 }
开发者ID:jaspermdegroot,项目名称:develop.wordpress,代码行数:9,代码来源:functions.php


示例5: get_links_list

function get_links_list($order = 'name', $hide_if_empty = 'obsolete')
{
    global $wpdb;
    $order = strtolower($order);
    // Handle link category sorting
    if (substr($order, 0, 1) == '_') {
        $direction = ' DESC';
        $order = substr($order, 1);
    }
    // if 'name' wasn't specified, assume 'id':
    $cat_order = 'name' == $order ? 'cat_name' : 'cat_id';
    if (!isset($direction)) {
        $direction = '';
    }
    // Fetch the link category data as an array of hashesa
    $cats = $wpdb->get_results("\n\t\tSELECT DISTINCT link_category, cat_name, show_images, \n\t\t\tshow_description, show_rating, show_updated, sort_order, \n\t\t\tsort_desc, list_limit\n\t\tFROM `{$wpdb->links}` \n\t\tLEFT JOIN `{$wpdb->linkcategories}` ON (link_category = cat_id)\n\t\tWHERE link_visible =  'Y'\n\t\t\tAND list_limit <> 0\n\t\tORDER BY {$cat_order} {$direction} ", ARRAY_A);
    // Display each category
    if ($cats) {
        foreach ($cats as $cat) {
            // Handle each category.
            // First, fix the sort_order info
            $orderby = $cat['sort_order'];
            $orderby = (bool_from_yn($cat['sort_desc']) ? '_' : '') . $orderby;
            // Display the category name
            echo '	<li id="linkcat-' . $cat['link_category'] . '"><h2>' . $cat['cat_name'] . "</h2>\n\t<ul>\n";
            // Call get_links() with all the appropriate params
            get_links($cat['link_category'], '<li>', "</li>", "\n", bool_from_yn($cat['show_images']), $orderby, bool_from_yn($cat['show_description']), bool_from_yn($cat['show_rating']), $cat['list_limit'], bool_from_yn($cat['show_updated']));
            // Close the last category
            echo "\n\t</ul>\n</li>\n";
        }
    }
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:32,代码来源:links.php


示例6: _e

?>
</div>
				</div>				
			</div>
			<div class="row">
				<div class="cell width120px">
					<b><?php 
_e('Amazon S3 Settings', 'mgm');
?>
:</b> 
				</div>
			</div>
			<div class="row">		
				<div class="cell textalignleft ">
					<input type="checkbox" name="is_s3_torrent" id="is_s3_torrent" <?php 
echo bool_from_yn($data['download']->is_s3_torrent) ? "checked='checked'" : '';
?>
 /> <?php 
_e('Is Torrent', 'mgm');
?>

					<div class="tips"><?php 
printf(__('Allow Torrent for Amazon S3 larger files ( rquires public ACL ). Please read <a href="%s">here</a>.', 'mgm'), ' http://docs.amazonwebservices.com/AmazonS3/latest/dev/S3TorrentRetrieve.html');
?>
</div>
				</div>
			</div>
			<div class="row brBottom">
				<div class="cell">
					<div class="tips">
						<b><?php 
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:31,代码来源:edit.php


示例7: _e

    		<div class="cell">
				<p><input type="checkbox" name="enable_facebook" id="enable_facebook" value="Y" <?php 
if (bool_from_yn($data['system_obj']->get_setting('enable_facebook'))) {
    echo "checked='checked'";
}
?>
>&nbsp;<b><?php 
_e('Enable Facebook login/registration?', 'mgm');
?>
</b></p>				
			</div>
		</div>
  		<div class="row">
    		<div class="cell">
				<div id="enable_facebook_setting" class="<?php 
echo bool_from_yn($data['system_obj']->get_setting('enable_facebook')) ? 'displayblock' : 'displaynone';
?>
 paddingtop10px">
					<p><b><?php 
_e('Facebook API ID');
?>
:</b></p>
					<input type="text" name="facebook_id" value="<?php 
echo esc_html($data['system_obj']->get_setting('facebook_id'));
?>
" size="50" />
					<p><b><?php 
_e('Facebook API Key');
?>
:</b></p>
					<input type="text" name="facebook_key" value="<?php 
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:31,代码来源:general.php


示例8: cancel_recurring_subscription

 /**
  * Cancel Recurring Subscription
  * This is not a private function
  * @param int/string $trans_ref	
  * @param int $user_id	
  * @param int/string $subscr_id	
  * @param int $pack_id	
  * @return boolean
  */
 function cancel_recurring_subscription($trans_ref = null, $user_id = null, $subscr_id = null, $pack_id = null)
 {
     //if coming form process return after a subscription payment
     if (!empty($trans_ref)) {
         $transdata = $this->_get_transaction_passthrough($trans_ref);
         if ($transdata['payment_type'] != 'subscription_purchase') {
             return false;
         }
         $user_id = $transdata['user_id'];
         if (isset($transdata['is_another_membership_purchase']) && $transdata['is_another_membership_purchase'] == 'Y') {
             $member = mgm_get_member_another_purchase($user_id, $transdata['membership_type']);
         } else {
             $member = mgm_get_member($user_id);
         }
         if (isset($member->payment_info->module)) {
             if (isset($member->payment_info->subscr_id)) {
                 $subscr_id = $member->payment_info->subscr_id;
             } else {
                 //check pack is recurring:
                 $pid = $pack_id ? $pack_id : $member->pack_id;
                 if ($pid) {
                     $s_packs = mgm_get_class('subscription_packs');
                     $sel_pack = $s_packs->get_pack($pid);
                     if ($sel_pack['num_cycles'] != 1) {
                         $subscr_id = 0;
                     }
                 }
             }
             //check for same module: if not call the same function of the applicale module.
             if (str_replace('mgm_', '', $member->payment_info->module) != str_replace('mgm_', '', $this->code)) {
                 mgm_log('RECALLing ' . $member->payment_info->module . ': cancel_recurring_subscription FROM: ' . $this->code);
                 return mgm_get_module($member->payment_info->module, 'payment')->cancel_recurring_subscription($trans_ref, null, null, $pack_id);
             }
             //skip if same pack is updated
             if (empty($member->pack_id) || is_numeric($pack_id) && $pack_id == $member->pack_id) {
                 return false;
             }
         } else {
             return false;
         }
     }
     //send email only if setting enabled
     if (!empty($subscr_id) || $subscr_id === 0) {
         $system_obj = mgm_get_class('system');
         $dge = bool_from_yn($system_obj->get_setting('disable_gateway_emails'));
         //send email only if setting enabled
         if (!$dge) {
             // blog
             $blogname = get_option('blogname');
             // user
             $user = get_userdata($user_id);
             // notify admin
             mgm_notify_admin_membership_cancellation_manual_removal_required($blogname, $user, $member);
         }
         return true;
     }
     return false;
 }
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:67,代码来源:mgm_clickbank.php


示例9: get_template

 function get_template($name, $data = array(), $parse = false)
 {
     // by name
     switch ($name) {
         case 'tos':
         case 'subs_intro':
         case 'text_guest_purchase_pre_button':
         case 'text_guest_purchase_pre_register':
             return mgm_get_template($name, NULL, 'messages');
             break;
         case 'private_text':
         case 'private_text_no_access':
         case 'private_text_purchasable':
         case 'private_text_purchasable_login':
         case 'private_text_purchasable_pack_login':
         case 'private_text_postdelay_no_access':
             // parse enabled
             if ($parse) {
                 // parse
                 $message_content = mgm_get_template($name, $data, 'messages');
                 // set template
                 $template = mgm_get_template('private_text_template', NULL, 'templates');
                 // return
                 return str_replace('[message]', $message_content, $template);
             } else {
                 // parse disabled
                 return mgm_get_template($name, NULL, 'messages');
             }
             break;
         case 'login_errmsg_null':
         case 'login_errmsg_expired':
         case 'login_errmsg_trial_expired':
         case 'login_errmsg_pending':
         case 'login_errmsg_cancelled':
         case 'login_errmsg_default':
         case 'login_errmsg_date_range':
         case 'login_errmsg_multiple_logins':
             // parse enabled
             if ($parse) {
                 // argas
                 $q_args = array('action' => '[[ACTION]]');
                 //
                 if (bool_from_yn($this->setting['enable_email_as_username'])) {
                     $q_args = array_merge($q_args, array('user_id' => '[[USERID]]'));
                 } else {
                     $q_args = array_merge($q_args, array('username' => '[[USERNAME]]'));
                 }
                 // set url data
                 $data['subscription_url'] = add_query_arg($q_args, mgm_get_custom_url('transactions'));
                 // return
                 return mgm_get_template($name, $data, 'messages');
             } else {
                 // parse disabled
                 return mgm_get_template($name, NULL, 'messages');
             }
             break;
         case 'pack_desc_template':
         case 'pack_desc_lifetime_template':
         case 'pack_desc_date_range_template':
         case 'ppp_pack_template':
         case 'register_form_row_template':
         case 'profile_form_row_template':
         case 'register_form_row_autoresponder_template':
             // separate
             // parse enabled
             if ($parse) {
                 // return
                 return mgm_get_template($name, $data, 'templates');
             } else {
                 // parse disabled
                 return mgm_get_template($name, NULL, 'templates');
             }
             break;
         case 'reminder_email_template_subject':
         case 'reminder_email_template_body':
         case 'registration_email_template_subject':
         case 'registration_email_template_body':
         case 'new_user_notification_email_template_subject':
         case 'new_user_notification_email_template_body':
         case 'user_upgrade_notification_email_template_subject':
         case 'user_upgrade_notification_email_template_body':
         case 'payment_success_email_template_subject':
         case 'payment_success_email_template_body':
         case 'payment_success_subscription_email_template_body':
         case 'payment_failed_email_template_subject':
         case 'payment_failed_email_template_body':
         case 'payment_active_email_template_subject':
         case 'payment_active_email_template_body':
         case 'payment_pending_email_template_subject':
         case 'payment_pending_email_template_body':
         case 'payment_error_email_template_subject':
         case 'payment_error_email_template_body':
         case 'payment_unknown_email_template_subject':
         case 'payment_unknown_email_template_body':
         case 'subscription_cancelled_email_template_subject':
         case 'subscription_cancelled_email_template_body':
         case 'retrieve_password_email_template_subject':
         case 'retrieve_password_email_template_body':
         case 'lost_password_email_template_subject':
         case 'lost_password_email_template_body':
//.........这里部分代码省略.........
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:101,代码来源:mgm_system.php


示例10: enqueue_scripts

 /**
  * enqueue scripts
  *
  * @since 1.1
  *
  */
 public function enqueue_scripts()
 {
     global $stt2extat_settings;
     $set = $stt2extat_settings;
     $is_single = apply_filters('stt2extat_is_single', true);
     if (!$is_single && !is_search()) {
         return false;
     }
     $post_ids = stt2extat_post_ids_query();
     if (!$post_ids) {
         return false;
     }
     $settings = array('post_ID' => $post_ids, 'showList' => isset($set['auto']) ? bool_from_yn($set['auto']) : (bool) 0, 'single' => is_single());
     $heartbeat_set = wp_heartbeat_settings($settings);
     $localize_script = wp_parse_args($heartbeat_set, $settings);
     wp_register_script('jquery-stt2extat-res', plugin_dir_url(__FILE__) . 'assets/js/jquery-stt2extat-res.js', array('jquery-core'), STT2EXTAT_VER, true);
     wp_enqueue_script('jquery-stt2extat-res');
     wp_localize_script('jquery-stt2extat-res', 'stt2extatJs', $localize_script);
 }
开发者ID:Jevuska,项目名称:stt2-extension-add-terms,代码行数:25,代码来源:class-stt2extat-load.php


示例11: mgm_template_include

/**
 * override default template
 *
 * @param array $column
 * @param init $post_id
 * @return void
 */
function mgm_template_include($template)
{
    // check override
    if (bool_from_yn(mgm_get_setting('override_theme_for_custom_pages'))) {
        // name
        $name = mgm_get_query_var('name');
        // switch
        switch ($name) {
            case 'register':
            case 'profile':
            case 'lost_password':
            case 'login':
                $content = mgm_get_query_post_content();
                // @todo check #BUG_PENDING
                // check
                if (mgm_is_custom_page_published($name, $content)) {
                    // if template exists in theme only
                    if ($c_template = mgm_get_page_template($name, false, true)) {
                        $template = $c_template;
                    }
                }
                break;
        }
    }
    // return
    return $template;
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:34,代码来源:mgm_content_hooks.php


示例12: mgm_notify_admin_passthrough_verification_failed

/**
 * Send Email Notification to Admin on passthrough verification failed
 *
 * @uses mgm_notify_admin()
 * @param string $passthrough
 * @param string $module
 * @return bool @send
 */
function mgm_notify_admin_passthrough_verification_failed($passthrough, $module)
{
    // system
    $system_obj = mgm_get_class('system');
    $dge = bool_from_yn($system_obj->get_setting('disable_gateway_emails'));
    // notify admin, only if gateway emails on
    if (!$dge) {
        // subject
        $subject = sprintf('Error in %s custom passthrough verification', ucwords($module));
        // message
        $message = sprintf('Could not read custom passthrough:<br />passthrough: %s;<br>request: %s', $passthrough, print_r($_REQUEST, true));
        // mail
        return @mgm_notify_admin(null, $subject, $message);
    }
    // error
    return false;
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:25,代码来源:mgm_email_functions.php


示例13: cancel_recurring_subscription


//.........这里部分代码省略.........
             }
             //skip if same pack is updated
             if (empty($member->pack_id) || is_numeric($pack_id) && $pack_id == $member->pack_id) {
                 return false;
             }
         } else {
             return false;
         }
     }
     //if valid rebill data is found and settings are set
     if (!empty($rebill['rebill_id']) && !empty($rebill['rebill_customer_id']) && !empty($this->setting['customer_id']) && !empty($this->setting['username']) && !empty($this->setting['password'])) {
         $gateway_method = 'webservice';
         $secure = array('CustomerID' => $this->setting['customer_id'], 'Username' => $this->setting['username'], 'Password' => $this->setting['password']);
         //data to post
         //Delete Rebill Event
         $post_data = array('webservice_action' => 'DeleteRebillEvent', 'RebillCustomerID' => $rebill['rebill_customer_id'], 'RebillID' => $rebill['rebill_id']);
         $post_data = array_merge($post_data, $secure);
         // filter post data and create soap xml
         $post_string = $this->_filter_postdata($gateway_method, $post_data);
         // endpoint
         $endpoint = $this->_get_endpoint($this->status . '_' . $gateway_method);
         // test_webservice / live_webservice
         // headers
         $http_headers = $this->_get_http_headers($gateway_method, $post_data['webservice_action']);
         // log
         mgm_log('Request Headers [' . $post_data['webservice_action'] . ']' . mgm_pr($http_headers, true), __FUNCTION__);
         // log
         mgm_log('Request [' . $post_data['webservice_action'] . ']' . $post_string, __FUNCTION__);
         // create curl post
         $http_response = mgm_remote_post($endpoint, $post_string, array('headers' => $http_headers, 'timeout' => 30, 'sslverify' => false));
         // log
         mgm_log('Response [' . $post_data['webservice_action'] . ']' . $http_response, __FUNCTION__);
         /*$http_header = array('User-Agent: NuSOAP/0.9.5 (1.123)', 'Content-Type: text/xml; charset=ISO-8859-1', 
           sprintf('SOAPAction: "http://www.eway.com.au/gateway/rebill/manageRebill/%s"', $post_data['webservice_action']));*/
         // post soap data
         // $buffer = $this->_curl_post($endpoint, $post_string, $http_header);
         // parse response
         $this->_process_response($gateway_method, $http_response, $post_data['webservice_action']);
         // log
         mgm_log('Response Parsed [' . $post_data['webservice_action'] . ']' . mgm_pr($this->response, true), __FUNCTION__);
         //if rebill event is deleted, delete rebill customer
         if (isset($this->response['response_status']) && $this->response['response_status'] == 1) {
             //delete rebill customer:
             $post_data['webservice_action'] = 'DeleteRebillCustomer';
             // filter post data and create soap xml
             $post_string = $this->_filter_postdata($gateway_method, $post_data);
             // soap_action
             $soap_action = sprintf('http://www.eway.com.au/gateway/rebill/manageRebill/%s', $post_data['webservice_action']);
             // http_headers
             $http_headers = array_merge($http_headers, array('SOAPAction' => $soap_action));
             // log
             mgm_log('Request Headers [' . $post_data['webservice_action'] . ']' . mgm_pr($http_headers, true), __FUNCTION__);
             // log
             mgm_log('Request [' . $post_data['webservice_action'] . ']' . $post_string, __FUNCTION__);
             // create curl post
             $http_response = mgm_remote_post($endpoint, $post_string, array('headers' => $http_headers, 'timeout' => 30, 'sslverify' => false));
             // log
             mgm_log('Response [' . $post_data['webservice_action'] . ']' . $http_response, __FUNCTION__);
             /*$http_header = array('User-Agent: NuSOAP/0.9.5 (1.123)', 'Content-Type: text/xml; charset=ISO-8859-1', 
               sprintf('SOAPAction: "http://www.eway.com.au/gateway/rebill/manageRebill/%s"', $post_data['webservice_action']));*/
             // post soap data
             // $buffer = $this->_curl_post($endpoint, $post_string, $http_header);
             // parse response
             $this->_process_response($gateway_method, $http_response, $post_data['webservice_action']);
             // log
             mgm_log('Response Parsed [' . $post_data['webservice_action'] . ']' . mgm_pr($this->response, true), __FUNCTION__);
             // check
             if (isset($this->response['response_status']) && $this->response['response_status'] == 1) {
                 //done
                 return true;
             }
         }
     } elseif ($rebill['rebill_id'] === 0) {
         $system_obj = mgm_get_class('system');
         $dge = bool_from_yn($system_obj->get_setting('disable_gateway_emails'));
         //send email only if setting enabled
         if (!$dge) {
             $user = get_userdata($user_id);
             //send notification email to admin:
             $message = __('The User: ', 'mgm') . $user->user_email . ' (' . $user_id . ') ' . __('has upgraded/cancelled subscription.', 'mgm');
             $message .= "<br/>" . __('Please unsubscribe the user from Gateway Merchant panel.', 'mgm');
             if (!empty($rebill['rebill_customer_id'])) {
                 $message .= "<br/><br/>" . __('Customer Rebill Id: ', 'mgm') . $rebill['rebill_customer_id'];
             }
             if (!empty($rebill['rebill_id'])) {
                 $message .= "<br/><br/>" . __('Rebill Id: ', 'mgm') . $rebill['rebill_id'];
             }
             if (isset($member->transaction_id)) {
                 $message .= "<br/>" . __('MGM Transaction Id:', 'mgm') . $member->transaction_id;
             }
             //admin email:
             if (!empty($system_obj->setting['admin_email'])) {
                 @mgm_mail($system_obj->setting['admin_email'], sprintf(__('[%s] User Subscription Cancellation', 'mgm'), get_option('blogname')), $message);
             }
         }
         //treat as done
         return true;
     }
     return false;
 }
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:101,代码来源:mgm_eway.php


示例14: cancel_recurring_subscription

 /**
  * Cancel Recurring Subscription
  * This is not a private function
  * @param int/string $trans_ref	
  * @param int $user_id	
  * @param int/string $subscr_id	
  * @return boolean
  */
 function cancel_recurring_subscription($trans_ref = null, $user_id = null, $subscr_id = null, $pack_id = null)
 {
     //if coming form process return after a subscription payment
     if (!empty($trans_ref)) {
         $transdata = $this->_get_transaction_passthrough($trans_ref);
         if ($transdata['payment_type'] != 'subscription_purchase') {
             return false;
         }
         $user_id = $transdata['user_id'];
         if (isset($transdata['is_another_membership_purchase']) && $transdata['is_another_membership_purchase'] == 'Y') {
             $member = mgm_get_member_another_purchase($user_id, $transdata['membership_type']);
         } else {
             $member = mgm_get_member($user_id);
         }
         if (isset($member->payment_info->module) && !empty($member->payment_info->module)) {
             if (isset($member->payment_info->subscr_id)) {
                 $subscr_id = $member->payment_info->subscr_id;
             } else {
                 //check pack is recurring:
                 $pid = $pack_id ? $pack_id : $member->pack_id;
                 if ($pid) {
                     $s_packs = mgm_get_class('subscription_packs');
                     $sel_pack = $s_packs->get_pack($pid);
                     if ($sel_pack['num_cycles'] != 1) {
                         $subscr_id = 0;
                     }
                     // 0 stands for a lost subscription id
                 }
             }
             //check for same module: if not call the same function of the applicale module.
             if (str_replace('mgm_', '', $member->payment_info->module) != str_replace('mgm_', '', $this->code)) {
                 // mgm_log('RECALLing '. $member->payment_info->module .': cancel_recurring_subscription FROM: ' . $this->code);
                 return mgm_get_module($member->payment_info->module, 'payment')->cancel_recurring_subscription($trans_ref, null, null, $pack_id);
             }
             //skip if same pack is updated
             if (empty($member->pack_id) || is_numeric($pack_id) && $pack_id == $member->pack_id) {
                 return false;
             }
         } else {
             return false;
         }
     }
     //ony for subscription_purchase
     if ($subscr_id) {
         // end  point
         $endpoint = $this->_get_endpoint('unsubscribe');
         // base
         // add query
         $url = add_query_arg(array('SUBSCRIPTION_ID' => urlencode($subscr_id), 'MERCHANT_ID' => urlencode($this->setting['merchant_id']), 'ZombaioGWPass' => urlencode($this->setting['gw_pass']), 'ReasonCode' => urlencode(11)), $endpoint);
         // create curl post
         //$buffer = $this->_curl_post($url);
         // headers
         $http_headers = array();
         // fetch
         $http_response = mgm_remote_post($url, $post_data, array('headers' => $http_headers, 'timeout' => 30, 'sslverify' => false));
         // verify
         if ($http_response == 1) {
             return true;
         } else {
             // message
             return $this->_get_cancel_error($http_response);
         }
     } elseif ($subscr_id === 0) {
         //send email to admin if subscription Id is absent
         $system_obj = mgm_get_class('system');
         $dge = bool_from_yn($system_obj->get_setting('disable_gateway_emails'));
         //send email only if setting enabled
         if (!$dge) {
             $user = get_userdata($user_id);
             //send notification email to admin:
             $message = __('The User: ', 'mgm') . $user->user_email . ' (' . $user_id . ') ' . __('has upgraded/cancelled subscription.', 'mgm');
             $message .= "<br/>" . __('Please unsubscribe the user subscription from Gateway Merchant panel.', 'mgm');
             if (!empty($member->transaction_id)) {
                 $message .= "<br/>" . __('MGM Transaction Id:', 'mgm') . $member->transaction_id;
             }
             //admin email:
             if (!empty($system_obj->setting['admin_email'])) {
                 @mgm_mail($system_obj->setting['admin_email'], sprintf(__('[%s] User Subscription Cancellation', 'mgm'), get_option('blogname')), $message);
             }
         }
         return true;
     }
     return false;
 }
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:92,代码来源:mgm_zombaio.php


示例15: mgm_is_mgm_menu_enabled

/**
 * Check secondary menu is enabled for the logged in user
 * @param string $primary_menu
 * @param string $secondary_menu
 * @return boolean
 */
function mgm_is_mgm_menu_enabled($type = 'primary', $primary_menu, $secondary_menu = null)
{
    $user_id = get_current_user_id();
    $obj_roles = new mgm_roles();
    // for the firsttime load
    if (!get_option('rolebasedmenu_init')) {
        // update administrator role with capabilities
        $custom_caps = $obj_roles->get_custom_capabilities();
        foreach ($custom_caps as $cap) {
            $obj_roles->update_capability_role('administrator', $cap, true);
        }
        // set init value
        update_option('rolebasedmenu_init', 1);
    }
    $capabilities = $obj_roles->get_loggedinuser_custom_capabilities($user_id);
    $system_obj = mgm_get_class('system');
    // common setting
    $dml = $system_obj->setting['enable_role_based_menu_loading'];
    // if dynamic menu loading is disabled/priamry and secondary menus are enabled
    return is_super_admin() && !bool_from_yn($dml) || (bool_from_yn($dml) && ($type == 'primary' && in_array($primary_menu, $capabilities)) || $type == 'secondary' && in_array($primary_menu, $capabilities) && in_array($secondary_menu, $capabilities));
    // check secondary menu capability is loaded
}
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:28,代码来源:mgm_admin_functions.php


示例16: get_links_list

 function get_links_list($order = 'name', $hide_if_empty = 'obsolete')
 {
     $order = strtolower($order);
     $direction = '';
     // Handle link category sorting
     if (substr($order, 0, 1) == '_') {
         $direction = ' DESC';
         $order = substr($order, 1);
     }
     // if 'name' wasn't specified, assume 'id':
     $cat_order = 'name' == $order ? 'cat_name' : 'cat_id';
     // Fetch the link category data as an array of hashes
     $cats = $GLOBALS['wpdb']->get_results("SELECT DISTINCT link_category, cat_name, show_images,\n\t\tshow_description, show_rating, show_updated, sort_order, sort_desc, list_limit\nFROM `" . wp_table('links') . "` LEFT JOIN `" . wp_table('linkcategories') . "` ON (link_category = cat_id)\nWHERE link_visible =  'Y'\n\t\tORDER BY {$cat_order} {$direction} ", ARRAY_A);
     // Display each category
     if ($cats) {
         foreach ($cats as $cat) {
             // Handle each category.
             // First, fix the sort_order info
             $orderby = $cat['sort_order'];
             $orderby = (bool_from_yn($cat['sort_desc']) ? '_' : '') . $orderby;
             // Display the category name
             $cat_id = sanitize_title($cat['cat_name']);
             if ($cat_id == "") {
                 $cat_id = "lcat-" . $cat['link_category'];
             }
             echo '	<li id="' . sanitize_title($cat['cat_name']) . '">' . stripslashes($cat['cat_name']) . "\n\t<ul>\n";
             // Call get_links() with all the appropriate params
             get_links($cat['link_category'], '<li>', "</li>", "\n", bool_from_yn($cat['show_images']), $orderby, bool_from_yn($cat['show_description']), bool_from_yn($cat['show_rating']), $cat['list_limit'], bool_from_yn($cat['show_updated']));
             // Close the last category
             echo "\n\t</ul>\n</li>\n";
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:33,代码来源:links.php


示例17: edit

 function edit()
 {
     global $wpdb;
     // trim
     array_map('trim', $_POST);
     // extract
     extract($_POST);
     // system
     $system_obj = mgm_get_class('system');
     // save
     if (isset($submit_download)) {
         // response
         $response = array('status' => 'error', 'message' => sprintf(__('Error while updating download <b>%s</b>!', 'mgm'), $title));
         // check duplicate
         if (mgm_is_duplicate(TBL_MGM_DOWNLOAD, array('title'), "id <> '{$id}'")) {
             $response['message'] = sprintf(__('Error while updating download <b>%s</b>, title exists!', 'mgm'), $title);
         } else {
             // set vars
             $members_only = isset($members_only) ? 'Y' : 'N';
             // set vars
             $restrict_acces_ip = isset($restrict_acces_ip) ? 'Y' : 'N';
             // is_s3_torrent
             $is_s3_torrent = isset($is_s3_torrent) ? 'Y' : 'N';
             // filename
             $filename = isset($download_file_new) ? $download_file_new : $direct_url;
             // real name
             $real_filename = isset($download_file_new_realname) ? $download_file_new_realname : basename($filename);
             // filesize
             $filesize = mgm_file_get_size($filename);
             // post vars
             $post_date = date('Y-m-d H:i:s');
             // user
             $current_user = wp_get_current_user();
             // data
             $data = array('title' => $title, 'filename' => $filename, 'real_filename' => $real_filename, 'filesize' => $filesize, 'post_date' => $post_date, 'restrict_acces_ip' => $restrict_acces_ip, 'user_id' => $current_user->ID, 'members_only' => $members_only, 'is_s3_torrent' => $is_s3_torrent);
             // null
             $null_columns = array();
             // download limit
             if (isset($download_limit) && (int) $download_limit > 0) {
                 $data['download_limit'] = (int) $download_limit;
             } else {
                 $null_columns[] = "`download_limit` = NULL ";
             }
             // expire date
             if (isset($expire_dt) && !empty($expire_dt)) {
                 $data['expire_dt'] = mgm_format_inputdate_to_mysql($expire_dt);
             } else {
                 $null_columns[] = "`expire_dt` = NULL ";
             }
             // code
             if (!isset($code) || isset($code) && empty($code)) {
                 $data['code'] = uniqid();
             }
             // update
             if ($wpdb->update(TBL_MGM_DOWNLOAD, $data, array('id' => $id))) {
                 // update null
                 if (count($null_columns) > 0) {
                     // join
                     $set_string = implode(',', $null_columns);
                     // clear old
                     $wpdb->query($wpdb->prepare('UPDATE `' . TBL_MGM_DOWNLOAD . '` SET ' . $set_string . ' WHERE `id` = %d', $id));
                 }
                 // clear old
                 $wpdb->query($wpdb->prepare('DELETE FROM `' . TBL_MGM_DOWNLOAD_POST_ASSOC . '` WHERE `download_id` = %d', $id));
                 // save
                 if (bool_from_yn($members_only)) {
                     if (isset($link_to_post_id)) {
                         // loop
                         foreach ($link_to_post_id as $post_id) {
                             // insert
                             $wpdb->insert(TBL_MGM_DOWNLOAD_POST_ASSOC, array('download_id' => $id, 'post_id' => $post_id));
                         }
                     }
                 }
                 // set message
                 $response['message'] = sprintf(__('Download updated successfully <b>%s</b>', 'mgm'), $title);
                 $response['status'] = 'success';
             } else {
                 $response['message'] = sprintf(__('Error while updating download <b>%s</b> Or nothing updated!', 'mgm'), $title);
             }
         }
         // return response
         echo json_encode($response);
         exit;
     }
     // data
     $data = array();
     // download
     $data['download'] = $wpdb->get_row($wpdb->prepare("SELECT * FROM `" . TBL_MGM_DOWNLOAD . "` WHERE id = %d", $id));
     // download_posts
     $data['download_posts'] = mgm_get_download_post_ids($id);
     // get all post types
     $post_types = mgm_get_post_types();
     //get all published posts - issue #1034
     $all_posts = mgm_field_values($wpdb->posts, 'ID', 'SUBSTR(post_title,1, 100) AS post_title', "AND `post_status` ='publish' AND `post_type` IN ({$post_types})", 'post_title');
     //get all scheduled posts
     $scheduled_posts = mgm_field_values($wpdb->posts, 'ID', 'SUBSTR(post_title,1, 100) AS post_title', "AND `post_status` ='future' AND `post_type` IN ({$post_types})", 'post_title');
     foreach ($scheduled_posts as $k => $scheduled_post) {
         $all_posts[$k] = $scheduled_post . '(S)';
     }
//.........这里部分代码省略.........
开发者ID:jervy-ez,项目名称:magic-members-test,代码行数:101,代码来源:mgm_admin_downloads.php


示例18: printf

        ?>
</a>
						</div>
						<div class="cell textalignleft width175px maxwidth175px">
							<a href="javascript:void(0);" title="<?php 
        echo $filename;
        ?>
"><?php 
        printf('%s <br>(%s)', mgm_ellipsize($filename, 20), !empty($filesize) ? $filesize : '0 bytes');
        ?>
</a>
						</div>
						<div class="cell textalignleft width50px maxwidth50px">
							<div align="center">
								<b><?php 
        echo bool 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP bool_to_sql_bool函数代码示例发布时间:2022-05-24
下一篇:
PHP bool_config_item函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap