コード例 #1
0
ファイル: plugin-init.php プロジェクト: coollog/theboola
function pvc_lite_upgrade_plugin()
{
    if (version_compare(get_option('a3_pvc_version'), '1.2') === -1) {
        update_option('a3_pvc_version', '1.2');
        A3_PVC::upgrade_version_1_2();
    }
    if (version_compare(get_option('a3_pvc_version'), '1.3.5') === -1) {
        wp_schedule_event(strtotime(date('Y-m-d') . ' 00:00:00'), 'daily', 'pvc_empty_daily_table_daily_event_hook');
        global $wpdb;
        $sql = "ALTER TABLE " . $wpdb->prefix . "pvc_daily  CHANGE `id` `id` BIGINT NOT NULL AUTO_INCREMENT";
        $wpdb->query($sql);
        $sql = "ALTER TABLE " . $wpdb->prefix . "pvc_total  CHANGE `id` `id` BIGINT NOT NULL AUTO_INCREMENT";
        $wpdb->query($sql);
        update_option('a3_pvc_version', '1.3.5');
    }
    if (version_compare(get_option('a3_pvc_version'), '1.3.6') === -1) {
        $pvc_settings = get_option('pvc_settings');
        if (isset($pvc_settings['post_types']) && is_array($pvc_settings['post_types']) && count($pvc_settings['post_types']) > 0) {
            $post_types_new = array();
            foreach ($pvc_settings['post_types'] as $post_type) {
                $post_types_new[$post_type] = $post_type;
            }
            $pvc_settings['post_types'] = $post_types_new;
            update_option('pvc_settings', $pvc_settings);
        }
        update_option('a3_pvc_version', '1.3.6');
    }
    update_option('a3_pvc_version', '1.3.8');
}
コード例 #2
0
function pvc_is_activated($postid = 0)
{
    return A3_PVC::pvc_is_activated($postid);
}
コード例 #3
0
 /**
  * Save the meta when the post is saved.
  *
  * @param int $post_id The ID of the post being saved.
  */
 public function save($post_id)
 {
     /*
      * We need to verify this came from the our screen and with proper authorization,
      * because save_post can be triggered at other times.
      */
     // Check if our nonce is set.
     if (!isset($_POST['a3_pvc_activation_custom_box_nonce'])) {
         return $post_id;
     }
     $nonce = $_POST['a3_pvc_activation_custom_box_nonce'];
     // Verify that the nonce is valid.
     if (!wp_verify_nonce($nonce, 'a3_pvc_activation_custom_box')) {
         return $post_id;
     }
     // If this is an autosave, our form has not been submitted,
     // so we don't want to do anything.
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
         return $post_id;
     }
     // Check the user's permissions.
     if ('page' == $_POST['post_type']) {
         if (!current_user_can('edit_page', $post_id)) {
             return $post_id;
         }
     } else {
         if (!current_user_can('edit_post', $post_id)) {
             return $post_id;
         }
     }
     /* OK, its safe for us to save the data now. */
     if (isset($_POST['a3_pvc_activated'])) {
         $a3_pvc_activated = 'true';
     } else {
         $a3_pvc_activated = 'false';
     }
     // Update the meta field.
     update_post_meta($post_id, '_a3_pvc_activated', $a3_pvc_activated);
     // Manual change Total Views and Today Views
     if (isset($_POST['a3_pvc_total_views']) && isset($_POST['a3_pvc_today_views'])) {
         $total_views = trim($_POST['a3_pvc_total_views']);
         $today_views = trim($_POST['a3_pvc_today_views']);
         A3_PVC::pvc_stats_manual_update($post_id, $total_views, $today_views);
     }
 }
コード例 #4
0
ファイル: page-views-count.php プロジェクト: coollog/theboola
function pvc_check_exclude($postid = 0)
{
    return A3_PVC::pvc_check_exclude($postid);
}
コード例 #5
0
 public function clean_on_deletion()
 {
     if (isset($_POST['bt_save_settings']) && isset($_POST['pvc_reset_all_individual'])) {
         delete_option('pvc_reset_all_individual');
         A3_PVC::pvc_reset_individual_items();
     }
     if ((isset($_POST['bt_save_settings']) || isset($_POST['bt_reset_settings'])) && get_option('pvc_clean_on_deletion') == 0) {
         $uninstallable_plugins = (array) get_option('uninstall_plugins');
         unset($uninstallable_plugins[A3_PVC_PLUGIN_NAME]);
         update_option('uninstall_plugins', $uninstallable_plugins);
     }
 }
コード例 #6
0
ファイル: pvc_class.php プロジェクト: selectSIFISO/.comsite
 public static function custom_stats_update_echo($postid = 0, $have_echo = 1)
 {
     $output = '';
     global $pvc_settings;
     if (empty($pvc_settings)) {
         $pvc_settings = get_option('pvc_settings', array());
     }
     if (!isset($pvc_settings['enable_ajax_load']) || $pvc_settings['enable_ajax_load'] != 'yes') {
         A3_PVC::pvc_stats_update($postid);
     }
     $output .= A3_PVC::pvc_stats_counter($postid, true);
     if ($have_echo == 1) {
         echo $output;
     } else {
         return $output;
     }
 }