post_type=='post') { $meta=get_post_meta($post_id,'_qixit_delivery_url'); if ( !empty($meta)) { return $content; } if ( $current_user->has_cap( "administrator" ) || $current_user->has_cap( "editor" ) ) { return $content; } $more_tag_html_single_page = ''; $more_tag_position = (strpos($content, $more_tag_html_single_page) <= 0 )?$qixit_settings['characters']:strpos($content, $more_tag_html_single_page); $more_tag_html_post_list_page = 'is_viewable'; $more_tag_position_on_post_list_page = strpos($content, $more_tag_html_post_list_page); $qixit_more_tag = substr($content, 0, $more_tag_position)." ".__(QIXIT_MORE_LINK,'qixit').""; if ( qixit_display_full_content() ) { return $content; } $qixit_product = new QixitProduct($post_id); if ($more && $qixit_product->get_post_qixit_PID() && $qixit_product->get_premium_post_cost() > 0) { if ($qixit_product->get_qixit_post_type() == QIXIT_PREMIUM_PAY_ONCE_VIEW_ANYTIME) { if (qixit_is_cookie_set($post_id)) { return $content; } else { return $qixit_more_tag; } } else if ($qixit_product->get_qixit_post_type() == QIXIT_PREMIUM_PAY_PER_VIEW) { if (isset($_SESSION['paid_for_one_time'])) { return $content; } else { return $qixit_more_tag; } } return $content; } if ( !$more && $more_tag_position_on_post_list_page<=0 ) { if ($qixit_product->get_qixit_post_type() == QIXIT_REG) { return $content; } else { return $qixit_more_tag; } } } elseif ($post->post_type=='page') { if (stristr($content,'[QIXIT_COST_TO_BE_AN_AUTHOR]')) { $content = str_replace('[QIXIT_COST_TO_BE_AN_AUTHOR]',$qixit_settings['cost_to_be_author'],$content); } if (stristr($content,'[QIXIT_COST_TO_PUBLISH]')) { $content = str_replace('[QIXIT_COST_TO_PUBLISH]',$qixit_settings['cost_to_publish_post_by_author'],$content); } if (stristr($content,'[QIXIT_AMOUNT_SHARE]')) { $content = str_replace('[QIXIT_AMOUNT_SHARE]',$qixit_settings['percent_to_author'],$content); } return $content; } return $content; } // modify the more link, so that on click, we can check if the content is viewable or not add_action( 'the_content_more_link', 'qixit_updated_the_content_more_link' ); function qixit_updated_the_content_more_link($more_link) { global $post, $more_link_text; $old_link = $more_link; $end_pos = stripos($old_link,''); $old_link = substr($old_link,0,$end_pos); $start_pos = stripos($old_link,'>'); $old_link = substr($old_link,$start_pos+1); $more_link_text = $old_link_text = $old_link; //return our style $more link; return $new_more_link=''.$old_link_text.''; } add_action( 'wp_print_scripts', 'qixit_enqueue_scripts' ); function qixit_enqueue_scripts() { wp_enqueue_script('jquery'); } add_action( 'comments_array', 'qixit_comments_array' ); function qixit_comments_array($comments_array) { global $wpdb; @session_start(); $regular_comments = array(); $premium_comments = array(); foreach($comments_array as $key=>$comment_object) { if ($comment_object->qixit_comment_type == QIXIT_REGULAR) { $regular_comments[] = $comment_object; unset($comments_array[$key]); } else { $premium_comments[] = $comment_object; } } //put the comments on session $_SESSION['PREMIUM_COMMENTS'] = $premium_comments; $_SESSION['REGULAR_COMMENTS'] = $regular_comments; // modify the comments_array to only contain regular comments. $comments_array = array_merge($comments_array, $regular_comments); return $comments_array; } add_action('comments_popup_link_attributes','qixit_comments_popup_link_attributes'); function qixit_comments_popup_link_attributes() { return "onclick=\"JavaScript:qixit_session_marker_to_no_qixit_login(this)\""; } //pre_comment_on_post add_action('preprocess_comment','qixit_preprocess_comment'); function qixit_preprocess_comment($comment_data) { @session_start(); global $wpdb; $qixit_allow_premium_comments = true; $qixit_settings = get_option( 'qixit_settings' ); if ($comment_data['comment_parent'] != 0) { $comment_parent = get_comment($comment_data['comment_parent']); if ($comment_parent->qixit_comment_type == QIXIT_REGULAR) { $qixit_allow_premium_comments = false; unset($_SESSION['QIXIT_POST_COMMENTS_DATA']); } } if ($qixit_settings['paid_comments'] == '0') { $qixit_allow_premium_comments = false; unset($_SESSION['QIXIT_POST_COMMENTS_DATA']); } if ( (!(isset($_POST['qixit_comment_type']))) && $qixit_allow_premium_comments) { $comment_post_ID = isset($_POST['comment_post_ID']) ? (int) $_POST['comment_post_ID'] : 0; $qixit_product = new QixitProduct($comment_post_ID); if ($qixit_allow_premium_comments && $qixit_product->get_comments_qixit_PID() != '' ) { // premium comments is only on posts created by admin, so check who is the owner first $comment_post = get_post( $comment_post_ID ); $user = new WP_User( $comment_post->post_author ); $_SESSION['QIXIT_POST_COMMENTS_DATA'] = $_POST; $permalink = get_permalink($comment_post_ID); if (stristr($permalink,'?')) { wp_redirect($permalink . '&commentbox=true'); } else { wp_redirect($permalink . '?commentbox=true'); } die(" "); // do not delete this otherwise control will not redirect. } } return $comment_data; } add_action('comment_post','qixit_comment_post'); function qixit_comment_post($comment_ID) { global $wpdb,$current_user; @session_start(); if (isset($_SESSION['QIXIT_POST_COMMENTS_DATA'])) { $qixit_product = new QixitProduct($_SESSION['QIXIT_POST_COMMENTS_DATA']['comment_post_ID']); $qixit_settings = get_option('qixit_settings'); $comment = get_comment($_SESSION['QIXIT_POST_COMMENTS_DATA']['comment_parent']); if ( ($_SESSION['QIXIT_POST_COMMENTS_DATA']['comment_parent'] == 0) || ((!empty($comment)) && $comment->qixit_comment_type == QIXIT_PREMIUM) && $comment_ID > 0) { if ( (!(isset($_SESSION['QIXIT_POST_COMMENTS_DATA']['QIXIT_COMMENT_TYPE']) && $_SESSION['QIXIT_POST_COMMENTS_DATA']['QIXIT_COMMENT_TYPE'] == QIXIT_REGULAR)) && isset($_POST['qixit_comment_type']) ) { // approve the comment, since its a premium comment wp_update_comment(array('user_id'=>$current_user->ID,'user_ID'=>$current_user->ID,'comment_ID'=>$comment_ID,'comment_approved'=>1)); // update the qixit_comment_type $wpdb->update( $wpdb->comments, array( 'qixit_comment_type' => QIXIT_PREMIUM, ), array( 'comment_ID' => $comment_ID, ) ); // insert payment information for comment purchase $wpdb->insert( $wpdb->prefix.QIXIT_PAYMENT_DETAILS, array( 'product_id' => $qixit_product->get_product_id(), 'qixit_PID' => $qixit_product->get_comments_qixit_PID(), 'qixit_id' => (($_SESSION['QIXIT_POST_COMMENTS_DATA']['qixit_id']!='')?$_SESSION['QIXIT_POST_COMMENTS_DATA']['qixit_id']:''), 'total' => $qixit_product->get_premium_comments_cost(), 'payment_for' => 'comments', 'percent_to_author' => $qixit_product->get_percent_to_author(), 'date_purchased' => date('Y-m-d H:i:s') )); } } } unset($_SESSION['QIXIT_POST_COMMENTS_DATA']); } function qixit_display_full_content() { global $post; $current_user = wp_get_current_user(); if ( is_user_logged_in() ) { if ( is_admin() || $post->post_author == $current_user->ID) { return true; } return false; } return false; } add_action( 'wp_footer', 'qixit_footer' ); function qixit_footer() { global $post, $posts, $more; @session_start(); $qixit_product = new QixitProduct($post->ID); $qixit_ad_hoc_product = new QixitAdHocProduct($post->ID); // for post if ( $more && $qixit_product->get_product_id()!='' && ($qixit_product->get_post_qixit_PID() != '') ) { if ( ($qixit_product->get_qixit_post_type() == QIXIT_PREMIUM_PAY_PER_VIEW) && !qixit_display_full_content()) { if ((isset($_SESSION['paid_for_one_time']))) { unset($_SESSION['paid_for_one_time']); } } } // for ad-hoc-product if ( $more && $qixit_ad_hoc_product->get_product_id()!='' && ($qixit_ad_hoc_product->get_qixit_PID() != '') ) { if ( ($qixit_ad_hoc_product->get_qixit_ad_hoc_link_type() == QIXIT_PREMIUM_PAY_PER_VIEW) && !qixit_display_full_content()) { if ((isset($_SESSION['paid_for_one_time']))) { unset($_SESSION['paid_for_one_time']); } } } // for comments if (isset($_GET['commentbox']) && ($_GET['commentbox'] == true)) { qixit_show_pre_comments_box(); } if(isset($_SESSION['QIXIT_POST_COMMENTS_DATA'])){ qixit_refill_comments_data(); } } add_action( 'login_head', 'qixit_author_registraiton_css'); function qixit_author_registraiton_css() { wp_register_style('qixit', QIXIT_PLUGIN_URL.'/css/style.css', array(), QIXIT_VERSION, 'all' ); wp_print_scripts('jquery'); wp_admin_css('qixit',true); ?> 0) { if ( $_POST['user_password'] == '' ) { $errors->add('empty_user_password', ''.__('ERROR','qixit').' : '.__('Please enter password','qixit')); } else { $user_password = $_POST['user_password']; } if ( $_POST['user_password_confirm'] == '' ) { $errors->add('empty_user_password_confirm', ''.__('ERROR','qixit').' : '.__('Please enter confirm password','qixit')); } else { $user_password_confirm = $_POST['user_password_confirm']; } if ( $_POST['user_password_confirm'] != $_POST['user_password'] ) { $errors->add('empty_user_password_n_confirm_equal', ''.__('ERROR','qixit').' : '.__('Password & confirm password should be same','qixit')); } } } } add_action('register_post','qixit_author_register', '2', 3); function qixit_author_register($user_login, $user_email, $errors) { @session_start(); if ( get_option( 'default_role' )=='author' || ( isset($_POST['type']) && $_POST['type']=='author' ) ) { $qixit_settings = get_option( 'qixit_settings' ); if (empty($errors->errors) && $qixit_settings['cost_to_be_author']>0) { $_SESSION['QIXIT_AUTHOR_DATA']=$_POST; wp_redirect(get_option('siteurl').'/wp-login.php?action=register&type=author'); die(); } } } add_action( 'register_form', 'qixit_atuhor_registration_extra_fields' ); function qixit_atuhor_registration_extra_fields() { $qixit_settings = get_option( 'qixit_settings' ); if($qixit_settings['e_guest_authors'] == 0){ $site_url = get_option('siteurl'); echo ""; }else{ if ( get_option( 'default_role' )=='author' || ( isset($_REQUEST['type']) && $_REQUEST['type']=='author' ) ) { $qixit_settings = get_option( 'qixit_settings' ); if ($qixit_settings['cost_to_be_author']>0) { ?>

ID) == true ) { ?>

".__('Please fix the following errors:','qixit')."
"; foreach ($error_msg as $key=>$error_value) { if (is_array($error_value)) { foreach ($error_value as $error) echo __($error,'qixit').'
'; } else { echo __($error_value,'qixit').'
'; } } ?>