芝麻web文件管理V1.00
编辑当前文件:/home/p/r/i/prismawe/clients/_syntaxis.fr/wp-content/plugins/watu/controllers/social-sharing.php
$linkedin_enabled, "msg"=>watu_strip_tags($_POST['linkedin_msg']), 'title' => $linkedin_title); update_option('watuproshare_linkedin', $linkedin_options); $twitter_options = array("use_twitter" => $use_twitter, "show_count" => $show_count, "via" => $_POST['via'], "hashtag" => $hashtag, 'large_button' => '', "tweet" => watu_strip_tags($_POST['tweet'])); update_option('watuproshare_twitter', $twitter_options); } $appid = get_option('watuproshare_facebook_appid'); $linkedin_options = get_option('watuproshare_linkedin'); $twitter_options = get_option('watuproshare_twitter'); if(@file_exists(get_stylesheet_directory().'/watu/sharing-options.html.php')) include get_stylesheet_directory().'/watu/sharing-options.html.php'; else include(WATU_PATH . '/views/sharing-options.html.php'); } // display the social sharing buttons static function display() { global $wpdb; $taking_id = intval($GLOBALS['watu_taking_id']); ob_start(); // https://developers.facebook.com/docs/sharing/reference/feed-dialog $appid = get_option('watuproshare_facebook_appid'); // get the grade title and description $grade_id = $wpdb->get_var($wpdb->prepare("SELECT grade_id FROM ".WATU_TAKINGS." WHERE ID=%d", $taking_id)); if(empty($grade_id)) $grade = (object)array("gtitle"=>'None', 'gdescription'=>'None'); else $grade = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".WATU_GRADES." WHERE ID=%d", $grade_id)); // select quiz name $quiz_name = $wpdb->get_var($wpdb->prepare("SELECT tE.name FROM ".WATU_EXAMS." tE JOIN ".WATU_TAKINGS." tT ON tE.ID = tT.exam_id WHERE tT.ID = %d", $taking_id)); // keep linkedin vars always because they are also used in Facebook $linkedin = get_option('watuproshare_linkedin'); $linkedin_msg = stripslashes($linkedin['msg']); $linkedin_title = stripslashes($linkedin['title']); // title and description set up? if(!empty($linkedin_title)) { $linkedin_title = str_replace('{{{grade-title}}}', stripslashes($grade->gtitle), $linkedin_title); $linkedin_title = str_replace('{{{quiz-name}}}', stripslashes($quiz_name), $linkedin_title); } if(!empty($linkedin_msg)) { $linkedin_msg = str_replace('{{{grade-title}}}', stripslashes($grade->gtitle), $linkedin_msg); $linkedin_msg = str_replace('{{{grade-description}}}', stripslashes($grade->gdescription), $linkedin_msg); $linkedin_msg = str_replace('{{{quiz-name}}}', stripslashes($quiz_name), $linkedin_msg); $linkedin_msg = str_replace('{{{url}}}', get_permalink($_POST['post_id']), $linkedin_msg); } // if not, default to grade title and desc if(empty($linkedin_title)) $linkedin_title = $grade->gtitle; if(empty($linkedin_msg)) $linkedin_msg = $grade->gdescription; $linkedin_title = stripslashes($linkedin_title); $linkedin_msg = stripslashes($linkedin_msg); // any picture? $picture_str = ''; if(strstr($grade->gdescription, '
gdescription); $dom = new DOMDocument; $dom->loadHTML($html); $images = array(); foreach ($dom->getElementsByTagName('img') as $image) { $src = $image->getAttribute('src'); $class = $image->getAttribute('class'); $images[] = array('src'=>$src, 'class'=>$class); } // end foreach DOM element if(sizeof($images)) { $target_image = $images[0]['src']; // but check if we have any that are marked with the class foreach($images as $image) { if(strstr($image['class'], 'watu-share')) { $target_image = $image['src']; break; } } $picture_str = "&picture=".urlencode($target_image); } } // end searching for image $twitter_options = get_option('watuproshare_twitter'); // prepare tweet text if(!empty($twitter_options['use_twitter'])) { $tweet = stripslashes($twitter_options['tweet']); if(empty($tweet)) { $tweet = stripslashes($grade->gdescription); if(empty($tweet)) $tweet = stripslashes($grade->gtitle); } else { $tweet = str_replace('{{{grade-title}}}', stripslashes($grade->gtitle), $tweet); $tweet = str_replace('{{{grade-description}}}', stripslashes($grade->gdescription), $tweet); $tweet = str_replace('{{{quiz-name}}}', stripslashes($quiz_name), $tweet); } $tweet = substr($tweet, 0, 140); } ?>
data-count="none">Tweet