示例#1
0
 function cp_modules_mypoints_admin()
 {
     echo '<div class="wrap">';
     echo '<h2>CubePoints - ' . __('My Points', 'cp') . '</h2>';
     echo __('Manage and view information about your points.', 'cp');
     echo '<br /><br />';
     echo '<div style="background:#EFEFEF;display:inline-block;margin-right:25px;"><div style="float:left;font-size:17px;font-weight:bold;background:#E0E0E0;padding:18px;color:#565656;">' . __('My Points', 'cp') . ':</div><div style="float:left;padding:18px;font-size:20px;">' . cp_getPoints(cp_currentUser()) . '</div></div>';
     if (cp_module_activated('ranks')) {
         echo '<div style="background:#EFEFEF;display:inline-block;"><div style="float:left;font-size:17px;font-weight:bold;background:#E0E0E0;padding:18px;color:#565656;">' . __('My Rank', 'cp') . ':</div><div style="float:left;padding:18px;font-size:20px;">' . cp_module_ranks_getRank(cp_currentUser()) . '</div></div>';
     }
     echo '<div style="clear:both;"></div><br />';
     echo '<p style="font-weight:bold;">' . __('Your recent point transactions:', 'cp') . '</p>';
     cp_show_logs(cp_currentUser(), 15, false);
     echo '</div>';
 }
示例#2
0
<?php

/** Donate Module */
cp_module_register(__('Donate', 'cp'), 'donate', '1.1', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com', __('This module allows your users to donate points to each other.', 'cp'), 1);
if (cp_module_activated('donate')) {
    function cp_module_donate_scripts()
    {
        wp_register_script('boxy', CP_PATH . 'assets/boxy/javascripts/jquery.boxy.js', array('jquery'), '0.1.4');
        wp_register_style('boxy', CP_PATH . 'assets/boxy/stylesheets/boxy.css');
        wp_enqueue_script('boxy');
        wp_enqueue_style('boxy');
    }
    add_action('init', 'cp_module_donate_scripts');
    function cp_module_donate_do()
    {
        $recipient = $_POST['recipient'];
        $points = $_POST['points'];
        $message = htmlentities(stripslashes($_POST['message']), ENT_QUOTES, 'UTF-8');
        $user = get_userdatabylogin($recipient);
        if (!is_user_logged_in()) {
            $r['success'] = false;
            $r['message'] = __('You must be logged in to make a donation!', 'cp');
        } else {
            if ($recipient == '') {
                $r['success'] = false;
                $r['message'] = __('Please enter the username of the recipient!', 'cp');
            } else {
                if ($user->ID == '') {
                    $r['success'] = false;
                    $r['message'] = __('You have entered an invalid recipient!', 'cp');
                } else {
示例#3
0
    global $wpdb;
    if ($wpdb->get_var("SHOW TABLES LIKE '" . CP_DB . "_notify'") != CP_DB . '_notify' || (int) get_option('cp_module_notify_db_version') < 1) {
        $sql = "CREATE TABLE " . CP_DB . "_notify (\r\n\t\t\t  id bigint(20) NOT NULL AUTO_INCREMENT,\r\n\t\t\t  uid bigint(20) NOT NULL,\r\n\t\t\t  notice text NOT NULL,\r\n\t\t\t  UNIQUE KEY id (id)\r\n\t\t\t);";
        require_once ABSPATH . 'wp-admin/includes/upgrade.php';
        dbDelta($sql);
        add_option("cp_module_notify_db_version'", "1.0");
    }
}
add_action('cp_module_notify_activate', 'cp_module_notify_install');
function cp_module_notify_uninstall()
{
    global $wpdb;
    $wpdb->query('DROP TABLE `' . CP_DB . '_notify`');
}
add_action('cp_module_notify_deactivate', 'cp_module_notify_uninstall');
if (cp_module_activated('notify')) {
    /**********************
     * Enqueuing Scripts
     ***********************/
    wp_register_script('jQuery_notice', WP_PLUGIN_URL . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)) . 'jquery.notice.js', array('jquery'), '1.0.1');
    wp_register_style('jQuery_notice', WP_PLUGIN_URL . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)) . 'jquery.notice.css');
    function cp_notify_script()
    {
        wp_enqueue_script('jquery');
        wp_enqueue_script('jQuery_notice');
    }
    function cp_notify_style()
    {
        wp_enqueue_style('jQuery_notice');
    }
    add_action('init', 'cp_notify_script');
示例#4
0
function cp_admin_modules()
{
    ?>

	<div class="wrap">
		<h2>CubePoints - <?php 
    _e('Modules', 'cp');
    ?>
</h2>
		<?php 
    _e('View installed CubePoints modules!', 'cp');
    ?>
<br /><br />
		
		<?php 
    if (isset($_POST['cp_module_activate']) && isset($_POST['cp_module_name'])) {
        echo '<div class="updated"><p><strong>' . __('Module', 'cp') . ' "' . $_POST['cp_module_name'] . '"' . __(' activated', 'cp') . '!</strong></p></div>';
    }
    if (isset($_POST['cp_module_deactivate']) && isset($_POST['cp_module_name'])) {
        echo '<div class="updated"><p><strong>' . __('Module', 'cp') . ' "' . $_POST['cp_module_name'] . '"' . __(' deactivated', 'cp') . '!</strong></p></div>';
    }
    ?>
		
		<table id="cp_modules_table" class="widefat datatables">
			<thead><tr><th scope="col" width="150"><?php 
    _e('Module', 'cp');
    ?>
</th><th scope="col"><?php 
    _e('Description', 'cp');
    ?>
</th><th scope="col" width="80"><?php 
    _e('Version', 'cp');
    ?>
</th><th scope="col" width="70"><?php 
    _e('Action', 'cp');
    ?>
</th></tr></thead>
			<tfoot><tr><th scope="col"><?php 
    _e('Module', 'cp');
    ?>
</th><th scope="col"><?php 
    _e('Description', 'cp');
    ?>
</th><th scope="col"><?php 
    _e('Version', 'cp');
    ?>
</th><th scope="col"><?php 
    _e('Action', 'cp');
    ?>
</th></tr></tfoot>
		
			<?php 
    global $cp_module;
    if (count($cp_module) == 0) {
        $cp_module = array();
    }
    foreach ($cp_module as $m) {
        if ($m['can_deactivate']) {
            if (cp_module_activated($m['id'])) {
                $action = '<a href="admin.php?page=cp_admin_modules&cp_module_deactivate=' . $m['id'] . '">' . __('Deactivate', 'cp') . '</a>';
                $action = '<form method="post" name="cp_modules_form_' . $m['id'] . '"><input type="hidden" name="cp_module_deactivate" value="' . $m['id'] . '" /><input type="hidden" name="cp_module_name" value="' . $m['module'] . '" /><a href="javascript:void(0)" onclick="document.cp_modules_form_' . $m['id'] . '.submit();">' . __('Deactivate', 'cp') . '</a></form>';
            } else {
                $action = '<a href="admin.php?page=cp_admin_modules&cp_module_activate=' . $m['id'] . '">' . __('Activate', 'cp') . '</a>';
                $action = '<form method="post" name="cp_modules_form_' . $m['id'] . '"><input type="hidden" name="cp_module_activate" value="' . $m['id'] . '" /><input type="hidden" name="cp_module_name" value="' . $m['module'] . '" /><a href="javascript:void(0)" onclick="document.cp_modules_form_' . $m['id'] . '.submit();">' . __('Activate', 'cp') . '</a></form>';
            }
        } else {
            $action = '<a href="javascript:void(0);" onclick="alert(\'' . __('This module cannot be deactivated through this page.', 'cp') . '\\n' . __('To deactive this module, remove it manually', 'cp') . '.\')">' . __('Deactivate', 'cp') . '</a>';
        }
        if ($m['plugin_url'] != '') {
            $mname = '<a href="' . $m['plugin_url'] . '">' . $m['module'] . '</a>';
        } else {
            $mname = $m['module'];
        }
        if ($m['author'] != '') {
            if ($m['author_url'] != '') {
                $author = ' | ' . __('By', 'cp') . ' <a href="' . $m['author_url'] . '">' . $m['author'] . '</a>';
            } else {
                $author = ' | ' . __('By', 'cp') . ' ' . $m['author'];
            }
        }
        ?>
				<tr>
					<td><?php 
        echo $mname;
        ?>
</td>
					<td><?php 
        echo $m['description'] . $author;
        ?>
</td>
					<td><?php 
        echo $m['version'];
        ?>
</td>
					<td><?php 
        echo $action;
        ?>
</td>
				</tr>
			<?php 
    }
    ?>
		</table>
		
	</div>
	
	<br /><br />
	
	<?php 
    cp_donate_html();
    ?>
	
		<script type="text/javascript">
		jQuery(document).ready(function() {
			jQuery('#cp_modules_table').dataTable({
				"bPaginate": false,
				"aoColumns": [	{ "bSortable": false },
								{ "bSortable": false },
								{ "bSortable": false },
								{ "bSortable": false, "bSearchable": false }
							 ]
				});
		} );
		</script>
	
	<?php 
    do_action('cp_admin_modules');
    ?>
	
<?php 
}
示例#5
0
<?php

/** Paid Content Module */
cp_module_register(__('Paid Content', 'cp'), 'pcontent', '1.1', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com', __('This module lets you deduct point from users to view a page or post.', 'cp'), 1);
function cp_module_pcontent_install()
{
    add_option('cp_module_pcontent_default_points', 10);
    add_option('cp_module_pcontent_default', false);
    add_option('cp_module_pcontent_payauthor', false);
    add_option('cp_module_pcontent_text_pay', __('You need to pay %points% to access this page.', 'cp'));
    add_option('cp_module_pcontent_text_button', __('Pay %points%', 'cp'));
    add_option('cp_module_pcontent_text_logout', __('You must be logged in to access this page.', 'cp'));
    add_option('cp_module_pcontent_text_insufficient', __('You have insufficient points to purchase access for this page.', 'cp'));
}
add_action('cp_module_pcontent_activate', 'cp_module_pcontent_install');
if (cp_module_activated('pcontent')) {
    /* Config for this module */
    function cp_module_pcontent_config()
    {
        ?>
		<br />
		<h3><?php 
        _e('Paid Content', 'cp');
        ?>
</h3>
		<table class="form-table">

			<tr valign="top">
				<th scope="row"><label for="cp_module_pcontent_default_points"><?php 
        _e('Default number of points', 'cp');
        ?>
示例#6
0
<?php

/** Post Author Points Module */
cp_module_register(__('Post Author Points', 'cp'), 'post_author_points', '1.2', 'xBerry Labs', 'http://xBerryLabs.com', 'http://xBerryLabs.com', __('Gives points to authors when people comment on their posts', 'cp'), 1);
function cp_module_post_author_points_install()
{
    add_option('cp_post_author_points', 1);
}
add_action('cp_module_post_author_points_activate', 'cp_module_post_author_points_install');
if (cp_module_activated('post_author_points')) {
    function cp_module_post_author_points_config()
    {
        ?>
		<br />
		<h3><?php 
        _e('Post Author Points', 'cp');
        ?>
</h3>
		<table class="form-table">
			<tr valign="top">
				<th scope="row"><label for="cp_post_author_points"><?php 
        _e('Points for comments on author posts', 'cp');
        ?>
:</label></th>
				<td valign="middle"><input type="text" id="cp_post_author_points" name="cp_post_author_points" value="<?php 
        echo get_option('cp_post_author_points');
        ?>
" size="30" /></td>
			</tr>
		</table>
	<?php 
<?php

/** Limit Comment Points Module */
cp_module_register(__('Limit Comment Points', 'cp'), 'lcpoints', '1.0', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com', __('Limits the number of comments that would earn points for users across all posts.', 'cp'), 1);
function cp_module_lcpoints_install()
{
    add_option('cp_module_lcpoints_limit', 5);
}
add_action('cp_module_lcpoints_activate', 'cp_module_lcpoints_install');
if (cp_module_activated('lcpoints')) {
    function cp_module_lcpoints_config()
    {
        ?>
		<br />
		<h3><?php 
        _e('Limit Comment Points', 'cp');
        ?>
</h3>
		<table class="form-table">
			<tr valign="top">
				<th scope="row"><label for="cp_module_lcpoints_limit"><?php 
        _e('Max number of comments earning points', 'cp');
        ?>
:</label></th>
				<td valign="middle"><input type="text" id="cp_module_lcpoints_limit" name="cp_module_lcpoints_limit" value="<?php 
        echo get_option('cp_module_lcpoints_limit');
        ?>
" size="30" /></td>
			</tr>
		</table>
	<?php 
<?php

/** Comment Spam Control Module */
cp_module_register(__('Comment Spam Control', 'cp'), 'cp_csc', '1.1', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com', __('When enabled, this module would only allow users to receive points for one comment per post.', 'cp'), 1);
if (cp_module_activated('cp_csc')) {
    add_action('cp_comment_add', 'cp_module_csc_newComment');
    function cp_module_csc_newComment($cid)
    {
        if (is_user_logged_in()) {
            $cdata = get_comment($cid);
            $uid = $cdata->user_id;
            $pid = $cdata->comment_post_ID;
            global $wpdb;
            if ((int) $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->comments} WHERE `user_id`={$uid} AND `comment_post_ID`={$pid} AND comment_approved=1") != 1) {
                add_filter('cp_comment_points', create_function('$points', 'return 0;'), 10);
            }
        }
    }
}
示例#9
0
<?php

/** Daily Points Module */
cp_module_register(__('Daily Points', 'cp'), 'dailypoints', '1.0', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com', __('Give your users points for visiting your site everyday or every fixed interval.', 'cp'), 1);
function cp_module_dailypoints_install()
{
    add_option('cp_module_dailypoints_points', 5);
    add_option('cp_module_dailypoints_time', 86400);
}
add_action('cp_module_dailypoints_activate', 'cp_module_dailypoints_install');
if (cp_module_activated('dailypoints')) {
    function cp_module_dailypoints_checkTimer()
    {
        if (!is_user_logged_in()) {
            return;
        }
        $uid = cp_currentUser();
        $time = get_option('cp_module_dailypoints_time');
        $difference = time() - $time;
        global $wpdb;
        $count = (int) $wpdb->get_var("SELECT COUNT(*) FROM " . CP_DB . " WHERE `uid`={$uid} AND `timestamp`>{$difference} AND `type`='dailypoints'");
        if ($count != 0) {
            return;
        }
        cp_points('dailypoints', $uid, get_option('cp_module_dailypoints_points'), '');
    }
    add_action('init', 'cp_module_dailypoints_checkTimer', 1);
    function cp_module_dailypoints_config()
    {
        ?>
		<br />
示例#10
0
<?php

/** Ranks Module */
cp_module_register(__('Ranks', 'cp'), 'ranks', '1.0', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com', __('Create and display user ranks based on the number of points they have.', 'cp'), 1);
function cp_module_ranks_data_install()
{
    add_option('cp_module_ranks_data', array(0 => __('Newbie', 'cp')));
}
add_action('cp_module_ranks_activate', 'cp_module_ranks_data_install');
if (cp_module_activated('ranks')) {
    function cp_module_ranks_data_add_admin_page()
    {
        add_submenu_page('cp_admin_manage', 'CubePoints - ' . __('Ranks', 'cp'), __('Ranks', 'cp'), 8, 'cp_modules_ranks_admin', 'cp_modules_ranks_admin');
    }
    add_action('cp_admin_pages', 'cp_module_ranks_data_add_admin_page');
    function cp_modules_ranks_admin()
    {
        // handles form submissions
        if ($_POST['cp_module_ranks_data_form_submit'] == 'Y') {
            $cp_module_ranks_data_rank = trim($_POST['cp_module_ranks_data_rank']);
            $cp_module_ranks_data_points = (int) trim($_POST['cp_module_ranks_data_points']);
            $ranks = get_option('cp_module_ranks_data');
            if ($cp_module_ranks_data_rank == '' || $_POST['cp_module_ranks_data_points'] == '') {
                echo '<div class="error"><p><strong>' . __('Rank name or points cannot be empty!', 'cp') . '</strong></p></div>';
            } else {
                if (!is_numeric($_POST['cp_module_ranks_data_points']) || $cp_module_ranks_data_points < 0 || (int) $_POST['cp_module_ranks_data_points'] != (double) $_POST['cp_module_ranks_data_points']) {
                    echo '<div class="error"><p><strong>' . __('Please enter only positive integers for the points!', 'cp') . '</strong></p></div>';
                } else {
                    if ($ranks[$cp_module_ranks_data_points] != '') {
                        echo '<div class="updated"><p><strong>' . __('Rank Updated', 'cp') . '</strong></p></div>';
                    } else {
示例#11
0
/** Function to cache module versions and run activation hook on module update */
function cp_modules_updateCheck()
{
    global $cp_module;
    $module_ver_cache = unserialize(get_option('cp_moduleVersions'));
    $module_ver = array();
    foreach ($cp_module as $mod) {
        $module_ver[$mod['id']] = $mod['version'];
        // check for change in version and run module activation hook
        if (cp_module_activated($mod['id'])) {
            if ($module_ver_cache[$mod['id']] != $mod['version']) {
                if (!did_action('cp_module_' . $mod['id'] . '_activate')) {
                    do_action('cp_module_' . $mod['id'] . '_activate');
                }
            }
        }
    }
    update_option('cp_moduleVersions', serialize($module_ver));
}
示例#12
0
<?php

/** YouTube Module */
cp_module_register(__('YouTube', 'cp'), 'youtube', '1.0', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com', __('Let users earn points for watching YouTube videos.', 'cp'), 1);
function cp_module_youtube_points_install()
{
    add_option('cp_module_youtube_points', 10);
}
add_action('cp_module_youtube_activate', 'cp_module_youtube_points_install');
if (cp_module_activated('youtube')) {
    function cp_module_youtube_config()
    {
        ?>
		<br />
		<h3><?php 
        _e('YouTube', 'cp');
        ?>
</h3>
		<table class="form-table">
			<tr valign="top">
				<th scope="row"><label for="cp_module_youtube_points"><?php 
        _e('Default number of points for watching a YouTube video', 'cp');
        ?>
:</label></th>
				<td valign="middle"><input type="text" id="cp_module_youtube_points" name="cp_module_youtube_points" value="<?php 
        echo get_option('cp_module_youtube_points');
        ?>
" size="30" /></td>
			</tr>
		</table>
	<?php 
示例#13
0
<?php

/** Reset Data Module */
cp_module_register(__('Reset Data', 'cp'), 'resetdata', '1.0', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com', __('Erases all point data from the database.', 'cp'), 1);
if (cp_module_activated('resetdata')) {
    function cp_module_resetdata_add_admin_page()
    {
        add_submenu_page('cp_admin_manage', 'CubePoints - ' . __('Reset Data', 'cp'), __('Reset Data', 'cp'), 'manage_options', 'cp_modules_resetdata_admin', 'cp_modules_resetdata_admin');
    }
    add_action('cp_admin_pages', 'cp_module_resetdata_add_admin_page');
    function cp_modules_resetdata_admin()
    {
        // handles form submissions
        if ($_POST['cp_module_resetdata_form_submit'] == 'Y') {
            global $wpdb;
            $wpdb->query('TRUNCATE TABLE `' . CP_DB . '`');
            $wpdb->query('UPDATE  `' . $wpdb->base_prefix . 'usermeta` SET  `meta_value` = 0 WHERE `meta_key` = \'cpoints\'');
            echo '<div class="updated"><p><strong>' . __('Database reseted!', 'cp') . '</strong></p></div>';
        }
        ?>

<div class="wrap">
	<h2>CubePoints - <?php 
        _e('CubePoints - Reset Data', 'cp');
        ?>
</h2>
	<?php 
        _e('Erase all point data from the database.', 'cp');
        ?>
<br /><br />
示例#14
0
<?php

/** Backup and Restore Module */
cp_module_register(__('Backup and Restore', 'cp'), 'backup', '1.0', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com', __('Backup and restore the points of your users. Exports points in JSON or CSV format.', 'cp'), 1);
if (cp_module_activated('backup')) {
    add_action('wp_ajax_cp_module_backup_down', 'wp_ajax_cp_module_backup_down');
    function wp_ajax_cp_module_backup_down()
    {
        if (!current_user_can('manage_options')) {
            $response = json_encode(array());
            echo $response;
            exit;
        }
        global $wpdb;
        $data = $wpdb->get_results('SELECT ' . $wpdb->base_prefix . 'users.id, ' . $wpdb->base_prefix . 'users.user_login, ' . $wpdb->base_prefix . 'users.user_email, ' . $wpdb->base_prefix . 'usermeta.meta_value 
			FROM `' . $wpdb->base_prefix . 'users` 
			LEFT JOIN `' . $wpdb->base_prefix . 'usermeta` ON ' . $wpdb->base_prefix . 'users.id = ' . $wpdb->base_prefix . 'usermeta.user_id 
			AND ' . $wpdb->base_prefix . 'usermeta.meta_key=\'' . 'cpoints' . '\'' . $extraquery . ' 
			ORDER BY ' . $wpdb->base_prefix . 'users.id ASC' . $limit . ';', ARRAY_N);
        foreach ($data as $x => $y) {
            $data[$x][3] = (int) $data[$x][3];
        }
        switch ($_GET['fmt']) {
            default:
            case 'json':
                header("Content-Type: application/json");
                header('Content-Disposition: attachment; filename="' . __('backup', 'cp') . '_' . time() . '.json"');
                echo json_encode($data);
                exit;
                break;
            case 'csv':
示例#15
0
<?php

/** Limit Logs Display Module */
cp_module_register(__('Limit Logs Display', 'cp'), 'limitlogs', '1.0', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com', __('This module allows you to limit the number of log items being displayed in the logs page.', 'cp'), 1);
function cp_module_limitlogs_install()
{
    add_option('cp_module_limitlogs_max', 100);
}
add_action('cp_module_limitlogs_activate', 'cp_module_limitlogs_install');
if (cp_module_activated('limitlogs')) {
    function cp_module_limitlogs_config()
    {
        ?>
		<br />
		<h3><?php 
        _e('Limit Logs Display', 'cp');
        ?>
</h3>
		<table class="form-table">
			<tr valign="top">
				<th scope="row"><label for="cp_module_limitlogs_max"><?php 
        _e('Number of log entries to show', 'cp');
        ?>
:</label></th>
				<td valign="middle"><input type="text" id="cp_module_limitlogs_max" name="cp_module_limitlogs_max" value="<?php 
        echo get_option('cp_module_limitlogs_max');
        ?>
" size="30" /></td>
			</tr>
		</table>
	<?php 
示例#16
0
<?php

/** Custom Points Module */
cp_module_register(__('Custom Points', 'cp'), 'customp', '1.0', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com', __('This module gives you the ability to set custom points earned for comments for each post.', 'cp'), 1);
if (cp_module_activated('customp')) {
    /* Define the custom box */
    add_action('admin_init', 'cp_module_customp_add_custom_box', 1);
    /* Do something with the data entered */
    add_action('save_post', 'cp_module_customp_save_postdata');
    /* Adds a box to the main column on the Post and Page edit screens */
    function cp_module_customp_add_custom_box()
    {
        add_meta_box('cp_module_customp_set', 'CubePoints - Custom Points', 'cp_module_customp_box', 'post', 'normal', 'high');
        add_meta_box('cp_module_customp_set', 'CubePoints - Custom Points', 'cp_module_customp_box', 'page', 'normal', 'high');
    }
    /* Prints the box content */
    function cp_module_customp_box()
    {
        global $post;
        // Use nonce for verification
        wp_nonce_field(plugin_basename(__FILE__), 'cp_module_customp_nonce');
        // The actual fields for data entry
        echo '<br /><input type="checkbox" id="cp_module_customp_enable" name="cp_module_customp_enable" value="1" size="25" ' . ((bool) get_post_meta($post->ID, 'cp_points_enable', 1) ? 'checked="yes"' : '') . ' /> ';
        echo '<label for="cp_module_customp_enable">' . __("Set custom points for comments on this page", 'cp') . '</label> ';
        echo '<br /><br />';
        echo '<label for="cp_module_customp_points">' . __("Number of points per comment", 'cp') . ':</label> ';
        echo '<input type="text" id= "cp_module_customp_points" name="cp_module_customp_points" value="' . (int) get_post_meta($post->ID, 'cp_points', 1) . '" size="25" /><br /><br />';
    }
    /* When the post is saved, saves our custom data */
    function cp_module_customp_save_postdata($post_id)
    {
示例#17
0
/** PayPal Top-up Module */
cp_module_register(__('PayPal Top-up', 'cp'), 'paypal', '1.2', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com', __('Allow users to buy points using PayPal.', 'cp'), 1);
function cp_module_paypal_install()
{
    add_option('cp_module_paypal_account', '');
    add_option('cp_module_paypal_sandbox', false);
    add_option('cp_module_paypal_currency', 'USD');
    add_option('cp_module_paypal_item', '%npoints% ' . get_bloginfo('name') . ' ' . __('Points', 'cp'));
    add_option('cp_module_paypal_cancel', get_bloginfo('url') . '/?cp_module_paypal_return=0');
    add_option('cp_module_paypal_thankyou', get_bloginfo('url') . '/?cp_module_paypal_return=1');
    add_option('cp_module_paypal_price', 0.05);
    add_option('cp_module_paypal_min', 1);
    add_option('cp_module_paypal_form', "<form method=\"post\">\n<input type=\"hidden\" name=\"cp_module_paypal_pay\" value=\"1\" />\nNumber of points to purchase:<br />\n<input type=\"text\" name=\"points\" /><br />\n<input type=\"submit\" value=\"Buy!\" />\n</form>");
}
add_action('cp_module_paypal_activate', 'cp_module_paypal_install');
if (cp_module_activated('paypal')) {
    function cp_module_paypal_shortcode($atts)
    {
        $r = get_option('cp_module_paypal_form');
        $r = str_replace('%min%', get_option('cp_module_paypal_min'), $r);
        return $r;
    }
    add_shortcode('cp_paypal', 'cp_module_paypal_shortcode');
    /** PayPal top-up logs hook */
    add_action('cp_logs_description', 'cp_module_paypal_logs', 10, 4);
    function cp_module_paypal_logs($type, $uid, $points, $data)
    {
        if ($type != 'paypal') {
            return;
        }
        $data = unserialize($data);
示例#18
0
<?php

/** Points Multiplier Module */
cp_module_register(__('Points Multiplier', 'cp'), 'pmultiply', '1.0', 'CubePoints', 'http://cubepoints.com', 'http://cubepoints.com', __('This module allows you to temporarily double, triple points earned by users. Useful if you wish to increase user activity in a particular week. You may also use this module to temporarily disable points from being earned.', 'cp'), 1);
function cp_module_pmultiply_install()
{
    add_option('cp_module_pmultiply_multiplier', 2);
}
add_action('cp_module_pmultiply_activate', 'cp_module_pmultiply_install');
if (cp_module_activated('pmultiply')) {
    function cp_module_pmultiply_config()
    {
        ?>
		<br />
		<h3><?php 
        _e('Points Multiplier', 'cp');
        ?>
</h3>
		<table class="form-table">
			<tr valign="top">
				<th scope="row"><label for="cp_module_pmultiply_multiplier"><?php 
        _e('Multiply points earned by', 'cp');
        ?>
:</label></th>
				<td valign="middle"><input type="text" id="cp_module_pmultiply_multiplier" name="cp_module_pmultiply_multiplier" value="<?php 
        echo get_option('cp_module_pmultiply_multiplier');
        ?>
" size="30" /></td>
			</tr>
		</table>
	<?php 
/**
 * cubepoints_bp_profile() 
 *
 * Adds CubePoints to Profile Page
 * 
 *  @version 1.9.8.2
 *  @since 1.0
 */
function cubepoints_bp_profile()
{
    global $bp;
    if (function_exists('cp_displayPoints')) {
        ?>
		<span class="cubepoints_buddypress"><?php 
        echo cp_displayPoints($bp->displayed_user->id);
        ?>
</span>
	<?php 
    }
    if (cp_module_activated('donate')) {
        if (is_user_logged_in()) {
            ?>
			<span class="cupepoints_buddypress_donate"><a href="#" title="<?php 
            _e('Donate', 'cp_buddypress');
            ?>
" onclick="Javascript:cp_module_donate();" class="thickbox cp_donateLink"><?php 
            _e('Donate Points', 'cp_buddypress');
            ?>
</a></span>
	<?php 
        }
    }
    if (cp_module_activated('ranks')) {
        ?>
		<span class="cupepoints_buddypress_rank"><?php 
        _e('Rank', 'cp_buddypress');
        ?>
 - <?php 
        echo cp_module_ranks_getRank($bp->displayed_user->id);
        ?>
</span>
	<?php 
    }
}