Back to WordPress admin." ); } } } add_action( 'admin_init', 'paged_social_lockdown_requires_wordpress_version' ); define( 'VIRAL_CONTROL_CONTENT_LOCK_PATH', plugin_dir_path(__FILE__) ); define( 'VIRAL_CONTROL_CONTENT_LOCK_URL', plugin_dir_url(__FILE__) ); define( 'VIRAL_CONTROL_SLUG','viral-control' ); $PLUGINURL = VIRAL_CONTROL_CONTENT_LOCK_URL; require_once VIRAL_CONTROL_CONTENT_LOCK_PATH . 'includes/functions.php'; require_once VIRAL_CONTROL_CONTENT_LOCK_PATH . 'lib/lib.php'; require_once VIRAL_CONTROL_CONTENT_LOCK_PATH . 'includes/SmartMetaBox.php'; $paged_social_lockdownoptions = get_option('paged_social_lockdown_options'); ////////////////////////////////////////////////////////////////// // Install Operations ////////////////////////////////////////////////////////////////// global $paged_social_lockdown_db_version; $paged_social_lockdown_db_version = "1.4"; function paged_social_lockdown_install() { global $wpdb; global $paged_social_lockdown_db_version; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); add_option("paged_social_lockdown_db_version", $paged_social_lockdown_db_version); } ////////////////////////////////////////////////////////////////// // Load Scripts and Styles ////////////////////////////////////////////////////////////////// function paged_social_lockdown_scripts() { if(is_single() || is_page()) { $paged_social_lockdownoptions = get_option('paged_social_lockdown_options'); $unlock_type = $paged_social_lockdownoptions['unlock_behavior']; $paged_social_lockdown_active = paged_social_lockdownMetaBox::get('paged_social_lockdown_activate'); wp_enqueue_script('paged_social_lockdowncookie', VIRAL_CONTROL_CONTENT_LOCK_URL . 'includes/js/cookie.js', array('jquery')); if ($paged_social_lockdown_active == 'true') { if ($unlock_type == 'site' && $_COOKIE["paged_social_lockdown_shared"] != 1) { wp_enqueue_script( 'jquery' ); wp_deregister_script('plusone'); wp_register_script('plusone', 'https://apis.google.com/js/plusone.js'); wp_enqueue_script("plusone"); wp_deregister_script('twittersdk'); wp_register_script('twittersdk', 'https://platform.twitter.com/widgets.js'); wp_enqueue_script("twittersdk"); wp_enqueue_script('paged_social_lockdownjq2', VIRAL_CONTROL_CONTENT_LOCK_URL . 'includes/js/paged_social_lockdownjq2.js', array('jquery'), '1.0', true); wp_deregister_script('facebooksdk'); wp_register_script('facebooksdk', 'http://connect.facebook.net/en_US/all.js#xfbml=1', array('paged_social_lockdownjq2'), NULL, true); wp_enqueue_script("facebooksdk"); } elseif ($unlock_type == 'post' && $_COOKIE["paged_social_lockdown_shared"] != 1) { wp_enqueue_script( 'jquery' ); wp_deregister_script('plusone'); wp_register_script('plusone', 'https://apis.google.com/js/plusone.js'); wp_enqueue_script("plusone"); wp_deregister_script('twittersdk'); wp_register_script('twittersdk', 'https://platform.twitter.com/widgets.js'); wp_enqueue_script("twittersdk"); wp_deregister_script('facebooksdk'); wp_register_script('facebooksdk', 'http://connect.facebook.net/en_US/all.js#xfbml=1', array('paged_social_lockdownjq3'), NULL, true); wp_enqueue_script("facebooksdk"); wp_enqueue_script('paged_social_lockdownjq3', VIRAL_CONTROL_CONTENT_LOCK_URL . 'includes/js/paged_social_lockdownjq3.js', array('jquery'), '1.0', true); } if ($paged_social_lockdownoptions['powered_by'] == 'enabled') { wp_enqueue_script('powered', VIRAL_CONTROL_CONTENT_LOCK_URL . 'includes/js/powered.js', array('jquery'), '1.0', true); } } } } add_action('admin_init', create_function('','wp_register_style(VIRAL_CONTROL_SLUG."-admin-styles",VIRAL_CONTROL_CONTENT_LOCK_URL."assets/admin/css/style.css");wp_enqueue_style(VIRAL_CONTROL_SLUG."-admin-styles");')); function viral_control_twitter_frontend_stylesheet() { wp_register_style( VIRAL_CONTROL_SLUG."-front-styles",VIRAL_CONTROL_CONTENT_LOCK_URL."assets/front/style.css"); wp_enqueue_style(VIRAL_CONTROL_SLUG."-front-styles"); wp_register_script(VIRAL_CONTROL_SLUG."-front-script", VIRAL_CONTROL_CONTENT_LOCK_URL."assets/front/script.js", array('jquery')); wp_enqueue_script(VIRAL_CONTROL_SLUG."-front-script"); } add_action( 'wp_enqueue_scripts', 'viral_control_twitter_frontend_stylesheet' ); function paged_social_lockdown_footerscriptfirst(){ echo "
"; } function paged_social_lockdown_footerscript(){ if(is_single() || is_page()) { $paged_social_lockdown_active = paged_social_lockdownMetaBox::get('paged_social_lockdown_activate'); if ($paged_social_lockdown_active == 'true' && $_COOKIE["paged_social_lockdown_shared"] != 1){ $urlbehave = paged_social_lockdownMetaBox::get('paged_social_lockdown_urlswitch'); if ($urlbehave == 'thispost'){ $paged_social_lockdown_url = get_permalink(); } elseif ($urlbehave == 'thispost'){ $paged_social_lockdown_url = get_home_url(); } else{ $paged_social_lockdown_url = paged_social_lockdownMetaBox::get('paged_social_lockdown_customurl'); } /* Now lets shorten the url with bitly */ $paged_social_lockdown_url = ViralControl::bitly_shorten($paged_social_lockdown_url); $tweet = paged_social_lockdownMetaBox::get('paged_social_lockdown_comment'); $message = paged_social_lockdownMetaBox::get('paged_social_lockdown_message'); $whichpost = get_the_ID(); echo "
Tweet
"; } } } function paged_social_lockdown_footerscript2() { $paged_social_lockdown_active = paged_social_lockdownMetaBox::get('paged_social_lockdown_activate'); if ($paged_social_lockdown_active == 'true') { echo ' '; } } add_action('wp_footer', 'paged_social_lockdown_footerscriptfirst', 10); add_action('wp_footer', 'paged_social_lockdown_footerscript', 20); add_action('wp_footer', 'paged_social_lockdown_footerscript2', 30); function paged_social_lockdown_styles() { if(is_single() || is_page()){ $paged_social_lockdown_active = paged_social_lockdownMetaBox::get('paged_social_lockdown_activate'); if ($paged_social_lockdown_active == 'true' && $_COOKIE["paged_social_lockdown_shared"] != 1){ wp_enqueue_style('paged_social_lockdown', VIRAL_CONTROL_CONTENT_LOCK_URL . 'includes/css/paged_social_lockdown.css'); wp_enqueue_style('paged_social_lockdown-text', VIRAL_CONTROL_CONTENT_LOCK_URL . 'includes/css/paged_social_lockdown-text.css'); } } } function paged_social_lockdown_conditionals() { if(is_single() || is_page()){ $paged_social_lockdown_active = paged_social_lockdownMetaBox::get('paged_social_lockdown_activate'); if ($paged_social_lockdown_active == 'true' && $_COOKIE["paged_social_lockdown_shared"] != 1){ echo ' '; } } } function paged_social_lockdown_admin_scripts() { wp_enqueue_script('paged_social_lockdownsw', VIRAL_CONTROL_CONTENT_LOCK_URL . 'includes/js/paged_social_lockdownsw.js', array('jquery')); } add_action('admin_menu', 'register_paged_social_lockdown_menu_page'); function register_paged_social_lockdown_menu_page() { add_menu_page('Paged Social Lockdown Content Lock Settings', 'Paged Social Lockdown', 'manage_options', 'paged_social_lockdown/paged_social_lockdown.php', '', plugins_url('paged_social_lockdown/includes/img/menu.png'), 27); } function paged_social_lockdown_custom_logo() { if(is_single() || is_page()){ $paged_social_lockdown_active = paged_social_lockdownMetaBox::get('paged_social_lockdown_activate'); if ($paged_social_lockdown_active == 'true' && $_COOKIE["paged_social_lockdown_shared"] != 1){ $paged_social_lockdownoptions = get_option('paged_social_lockdown_options'); $custom_logo = $paged_social_lockdownoptions['custom_logo']; echo ''; } } } add_action( "admin_print_scripts-post.php", 'paged_social_lockdown_admin_scripts' ); add_action( "admin_print_scripts-post-new.php", 'paged_social_lockdown_admin_scripts' ); add_action('wp_enqueue_scripts', 'paged_social_lockdown_scripts'); add_action('wp_enqueue_scripts', 'paged_social_lockdown_styles'); add_action('wp_head', 'paged_social_lockdown_conditionals'); if ($paged_social_lockdownoptions['custom_logo']) { add_action('wp_head', 'paged_social_lockdown_custom_logo'); } add_filter('language_attributes', 'schema'); function schema($attr) { $attr .= "\n xmlns:fb=\"http://ogp.me/ns/fb#\""; return $attr; } ////////////////////////////////////////////////////////////////////////////// // Unlocking Actions ////////////////////////////////////////////////////////////////////////////// function paged_social_lockdown_callback() { global $wpdb; $post_id = $_POST['post']; $post_url = get_permalink($post_id); switch ($_POST['source']) { case "facebook": break; default: break; } } ////////////////////////////////////////////////////////////////////////////// // MCE ////////////////////////////////////////////////////////////////////////////// function paged_social_lockdown_mce_css( $mce_css ) { if ( ! empty( $mce_css ) ) $mce_css .= ','; $mce_css .= plugins_url( 'paged_social_lockdownadmin.css', __FILE__ ); return $mce_css; } function paged_social_lockdown_addbuttons() { if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) return; if ( get_user_option('rich_editing') == 'true') { add_filter("mce_external_plugins", "add_paged_social_lockdown_buttons"); add_filter('mce_buttons_3', 'register_paged_social_lockdown_buttons'); } } function register_paged_social_lockdown_buttons($buttons) { array_push($buttons, "paged_social_lockdown_button_image", "paged_social_lockdown_button_video", "paged_social_lockdown_button_text", "paged_social_lockdown_button_text_container", "paged_social_lockdownslb", "paged_social_lockdownslb2"); return $buttons; } function add_paged_social_lockdown_buttons($plugin_array) { $plugin_array['paged_social_lockdown_button_image'] = VIRAL_CONTROL_CONTENT_LOCK_URL.'includes/js/tinymce/paged_social_lockdown_button_image/editor_plugin.js'; $plugin_array['paged_social_lockdown_button_video'] = VIRAL_CONTROL_CONTENT_LOCK_URL.'includes/js/tinymce/paged_social_lockdown_button_video/editor_plugin.js'; $plugin_array['paged_social_lockdown_button_text'] = VIRAL_CONTROL_CONTENT_LOCK_URL.'includes/js/tinymce/paged_social_lockdown_button_text/editor_plugin.js'; $plugin_array['paged_social_lockdown_button_text_container'] = VIRAL_CONTROL_CONTENT_LOCK_URL.'includes/js/tinymce/paged_social_lockdown_button_text_container/editor_plugin.js'; $plugin_array['paged_social_lockdownslb'] = VIRAL_CONTROL_CONTENT_LOCK_URL.'includes/js/tinymce/paged_social_lockdownslb/editor_plugin.js'; $plugin_array['paged_social_lockdownslb2'] = VIRAL_CONTROL_CONTENT_LOCK_URL.'includes/js/tinymce/paged_social_lockdownslb2/editor_plugin.js'; return $plugin_array; } if (is_admin()) { add_action('init', 'paged_social_lockdown_addbuttons'); add_filter( 'mce_css', 'paged_social_lockdown_mce_css' ); add_action('wp_ajax_paged_social_lockdown', 'paged_social_lockdown_callback'); add_action('wp_ajax_nopriv_paged_social_lockdown', 'paged_social_lockdown_callback'); } //add_filter( 'mce_buttons_2', 'paged_social_lockdown_mce' ); // //function paged_social_lockdown_mce( $buttons ) { // array_unshift( $buttons, 'styleselect' ); // return $buttons; //} add_filter( 'tiny_mce_before_init', 'paged_social_lockdown_mce_styles' ); function paged_social_lockdown_mce_styles( $settings ) { $formats = array( 'lockimage' => array( 'selector' => 'img', 'classes' => 'paged_social_lockdown-locked-image paged_social_lockdown-default' ), 'lockvideo' => array( 'inline' => 'span', 'classes' => 'paged_social_lockdown-locked-video paged_social_lockdown-default' ), 'locktext' => array( 'inline' => 'span', 'classes' => 'paged_social_lockdown-locked-text', 'wrapper' => true ), 'textcontain' => array( 'inline' => 'div', 'classes' => 'paged_social_lockdown-contained-text', 'wrapper' => true ), 'blackdiamond' => array( 'selector' => 'img', 'classes' => 'paged_social_lockdown-diamond-dark' ), 'whitediamond' => array( 'selector' => 'img', 'classes' => 'paged_social_lockdown-diamond-light' ), 'blackoverlay' => array( 'selector' => 'img', 'classes' => 'paged_social_lockdown-black' ), 'whiteoverlay' => array( 'selector' => 'img', 'classes' => 'paged_social_lockdown-white' ), 'gradientdark' => array( 'selector' => 'img', 'classes' => 'paged_social_lockdown-gradient-dark' ), 'gradientskyblue' => array( 'selector' => 'img', 'classes' => 'paged_social_lockdown-gradient-lightblue' ), 'gradientblue' => array( 'selector' => 'img', 'classes' => 'paged_social_lockdown-gradient-blue' ), 'gradientgreen' => array( 'selector' => 'img', 'classes' => 'paged_social_lockdown-gradient-green' ), 'blackdiamondv' => array( 'selector' => 'span', 'classes' => 'paged_social_lockdown-diamond-dark' ), 'whitediamondv' => array( 'selector' => 'span', 'classes' => 'paged_social_lockdown-diamond-light' ), 'blackoverlayv' => array( 'selector' => 'span', 'classes' => 'paged_social_lockdown-black' ), 'whiteoverlayv' => array( 'selector' => 'span', 'classes' => 'paged_social_lockdown-white' ), 'gradientdarkv' => array( 'selector' => 'span', 'classes' => 'paged_social_lockdown-gradient-dark' ), 'gradientskybluev' => array( 'selector' => 'span', 'classes' => 'paged_social_lockdown-gradient-lightblue' ), 'gradientbluev' => array( 'selector' => 'span', 'classes' => 'paged_social_lockdown-gradient-blue' ), 'gradientgreenv' => array( 'selector' => 'span', 'classes' => 'paged_social_lockdown-gradient-green' ) ); $settings['formats'] = json_encode( $formats ); return $settings; } ////////////////////////////////////////////////////////////////////////////// // Settings API ////////////////////////////////////////////////////////////////////////////// // Set-up Action and Filter Hooks register_activation_hook(__FILE__, 'paged_social_lockdown_add_defaults'); register_uninstall_hook(__FILE__, 'paged_social_lockdown_delete_plugin_options'); add_action('admin_init', 'paged_social_lockdown_init' ); add_action('admin_menu', 'paged_social_lockdown_add_options_page'); add_filter( 'plugin_action_links', 'paged_social_lockdown_plugin_action_links', 10, 2 ); // Delete options table entries ONLY when plugin deactivated AND deleted function paged_social_lockdown_delete_plugin_options() { delete_option('paged_social_lockdown_options'); } // Define default option settings function paged_social_lockdown_add_defaults() { $tmp = get_option('paged_social_lockdown_options'); if(($tmp['chk_default_options_db']=='1')||(!is_array($tmp))) { delete_option('paged_social_lockdown_options'); $arr = array( "default_comment" => "Hey check this out!", "default_message" => "Share this page with friends to Unlock!", "unlock_behavior" => "site", "custom_logo" => "", "powered_by" => "enabled", ); update_option('paged_social_lockdown_options', $arr); } } function paged_social_lockdown_init(){ register_setting( 'paged_social_lockdown_plugin_options', 'paged_social_lockdown_options', 'paged_social_lockdown_validate_options' ); } function paged_social_lockdown_add_options_page() { add_options_page('Paged Social Lockdown Content Lock Settings', 'Paged Social Lockdown Content Lock', 'manage_options', __FILE__, 'paged_social_lockdown_render_form'); add_submenu_page(__FILE__,'social curator', 'Social Curator Setting', 'add_users','social-curator-settings','social_curator_setting' ); } function social_curator_setting() { include_once(VIRAL_CONTROL_CONTENT_LOCK_PATH.'/settings/settings.php'); } function create_table() { $ViralControl = new ViralControl(); global $wpdb; $table_name = $ViralControl->getAccountsTable(); $sql = "CREATE TABLE $table_name ( id INT(11) NOT NULL AUTO_INCREMENT, account_name VARCHAR(255), account_type VARCHAR(255), account_params TEXT, PRIMARY KEY (id) );"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); } register_activation_hook(__FILE__,'create_table'); function social_curator() { add_meta_box('viral_control','Paged Social Lockdown Social Curator','viral_control_social_curator','post','advanced'); add_meta_box('viral_control','Paged Social Lockdown Social Curator','viral_control_social_curator','page','advanced'); } add_action('add_meta_boxes', 'social_curator'); function viral_control_social_curator() { $viral_control = new ViralControl(); ?> ID, 'social_curator_keyword', true); ?> ID, 'social_curator_headline_keyword', true); ?>
Search Keyword
Headline Keyword

Facebook

getAccountDetails('facebook-account'); if(!$details['account_params']['user_id']) { ?>

Facebook Application not authorised! Please authorised the application!

ID, 'social_curator_facebook_enabled', true); if($facebook_enable=='enable') { $check="checked"; } else { $check=" "; } ?>
Enable: />    Display Position: ID, 'social_curator_facebook_position', true); ?>   Max Profile Count: ID, 'social_curator_facebook_profile_count', true); ?>
viral_control_facebook_app_id, 'secret' => viral_control_facebook_secret, 'cookie' => true )); $fb_limit=25; $facebook->setAccessToken($details['account_params']['access_token']); $fb_search_res = $facebook->api('/search?q='.urlencode($keyword).'&type=post&limit='.$fb_limit); //print_r($fb_search_res);?>
';?>

Twitter

getAccountDetails('twitter.com'); if(!$details['account_params']['user_id']) { ?>

Twitter Application not authorised! Please authorised the application!

ID, 'social_curator_twitter_enabled', true); if($twitter_enable=="twenable") { $checks="checked"; } else { $checks=""; } ?>
Enable: />   Display Position: ID, 'social_curator_twitter_position', true); ?>   Max Profile Count: ID, 'social_curator_twitter_profile_count', true); ?>
getAccountDetails('twitter.com'); $twitter = new TwitterOAuth(viral_control_twitter_consumer_key, viral_control_twitter_consumer_secret, $twitter_details['account_params']['access_token'], $twitter_details['account_params']['access_secret']); $search_results = $twitter->get('https://api.twitter.com/1.1/search/tweets.json',array('q'=>$keyword, 'result_type'=>'recent', 'count'=>$tw_limit)); ?>statuses as $status) { if(!$status->user->profile_image_url) { } else if($status->user->profile_image_url) {?>
user->name ; ?>
user->description; $j++; if($j==$tw_profile_count) { break; }?>
ID,'social_curator_keyword', $_POST['social_curator_keyword'],true)) update_post_meta($post->ID,'social_curator_keyword', $_POST['social_curator_keyword']); if(!add_post_meta($post->ID,'social_curator_headline_keyword', $_POST['social_curator_headline_keyword'],true)) update_post_meta($post->ID,'social_curator_headline_keyword', $_POST['social_curator_headline_keyword']); if(!add_post_meta($post->ID,'social_curator_facebook_enabled', $_POST['social_curator_facebook_enabled'],true)) update_post_meta($post->ID,'social_curator_facebook_enabled', $_POST['social_curator_facebook_enabled']); if(!add_post_meta($post->ID,'social_curator_facebook_position', $_POST['social_curator_facebook_position'],true)) update_post_meta($post->ID,'social_curator_facebook_position', $_POST['social_curator_facebook_position']); if(!add_post_meta($post->ID,'social_curator_facebook_profile_count', $_POST['social_curator_facebook_profile_count'],true)) update_post_meta($post->ID,'social_curator_facebook_profile_count', $_POST['social_curator_facebook_profile_count']); if(!add_post_meta($post->ID,'social_curator_twitter_enabled', $_POST['social_curator_twitter_enabled'],true)) update_post_meta($post->ID,'social_curator_twitter_enabled', $_POST['social_curator_twitter_enabled']); if(!add_post_meta($post->ID,'social_curator_twitter_position', $_POST['social_curator_twitter_position'],true)) update_post_meta($post->ID,'social_curator_twitter_position', $_POST['social_curator_twitter_position']); if(!add_post_meta($post->ID,'social_curator_twitter_profile_count', $_POST['social_curator_twitter_profile_count'],true)) update_post_meta($post->ID,'social_curator_twitter_profile_count', $_POST['social_curator_twitter_profile_count']); } add_action('save_post', 'save_viral_control_social_curator'); function paged_social_lockdown_render_form() { ?>

Paged Social Lockdown Content Lock Settings

Please look over these simple settings and make changes if necessary to suit your needs.

Default Tweet
Enter a default tweet to pre-populate the setting for new posts/pages.
Default Headline Message
Enter a default headline message to pre-populate the setting for new posts/pages.
Unlock Behavior Site-wide unlocking is recommended, it will protect you from getting a spammy footprint and keep your visitors happy.



Use Custom Logo
Enter the URL of your logo. The overall dimensions of the image must be 200x90. Use a PNG file with transparent background for best results.
Powered By Link

'.__('Settings').''; // make the 'Settings' link appear first array_unshift( $links, $paged_social_lockdown_links ); } return $links; } include_once(VIRAL_CONTROL_CONTENT_LOCK_PATH.'/includes/meta_box/meta_box.php');