Changeset 1179063
- Timestamp:
- 06/11/2015 04:02:41 PM (11 years ago)
- Location:
- expresscurate
- Files:
-
- 2 added
- 35 edited
-
assets/screenshot-13.png (modified) (previous)
-
assets/screenshot-14.png (modified) (previous)
-
assets/screenshot-15.png (modified) (previous)
-
assets/screenshot-16.png (modified) (previous)
-
assets/screenshot-17.png (modified) (previous)
-
assets/screenshot-18.png (added)
-
trunk/ExpressCurate.php (modified) (1 diff)
-
trunk/ExpressCurate_Actions.php (modified) (29 diffs)
-
trunk/ExpressCurate_CronManager.php (modified) (4 diffs)
-
trunk/ExpressCurate_Email.php (modified) (1 diff)
-
trunk/ExpressCurate_FeedManager.php (modified) (42 diffs)
-
trunk/ExpressCurate_GoogleClient.php (modified) (2 diffs)
-
trunk/ExpressCurate_HtmlParser.php (modified) (24 diffs)
-
trunk/ExpressCurate_Sitemap.php (modified) (1 diff)
-
trunk/ExpressCurate_SocialManager.php (modified) (4 diffs)
-
trunk/ExpressCurate_Tags.php (modified) (1 diff)
-
trunk/assets/screenshot-13.png (modified) (previous)
-
trunk/assets/screenshot-14.png (modified) (previous)
-
trunk/assets/screenshot-15.png (modified) (previous)
-
trunk/assets/screenshot-16.png (modified) (previous)
-
trunk/assets/screenshot-17.png (modified) (previous)
-
trunk/assets/screenshot-18.png (added)
-
trunk/css/expresscurate.css (modified) (8 diffs)
-
trunk/css/theme-styles.css (modified) (1 diff)
-
trunk/js/Buttons.js (modified) (5 diffs)
-
trunk/js/Dialog.js (modified) (1 diff)
-
trunk/js/Settings.js (modified) (6 diffs)
-
trunk/js/keywords/KeywordUtils.js (modified) (6 diffs)
-
trunk/js/keywords/Keywords.js (modified) (1 diff)
-
trunk/js/keywords/SEOControlCenter.js (modified) (1 diff)
-
trunk/js/socialPostWidget.js (modified) (10 diffs)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/templates/dashboard.php (modified) (2 diffs)
-
trunk/templates/dashboard/social_publishing_widget.php (modified) (1 diff)
-
trunk/templates/settings.php (modified) (5 diffs)
-
trunk/templates/sitemap.php (modified) (1 diff)
-
trunk/templates/social_posts_widget.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
expresscurate/trunk/ExpressCurate.php
r1172885 r1179063 5 5 Plugin URI: http://www.expresscurate.com/products 6 6 Description: ExpressCurate plugin is a content curation tool for WordPress. It enables you to create and publish high quality content within minutes. 7 Version: 2.1. 07 Version: 2.1.1 8 8 Author: ExpressCurate 9 9 Author URI: http://www.expresscurate.com -
expresscurate/trunk/ExpressCurate_Actions.php
r1172885 r1179063 16 16 const COLUMN_NAME = "curated"; 17 17 const COLUMN_TITLE = "Curated"; 18 19 const SOCIAL_COLUMN_NAME = "socialPosts"; 20 const SOCIAL_COLUMN_TITLE = "Social Posts"; 18 21 19 22 const SMART_PUBLISH_COLUMN_NAME = "smart_publish_date"; … … 78 81 add_filter('manage_edit-post_sortable_columns', array(&$this, 'curated_column_register_sortable')); 79 82 83 add_filter('manage_edit-post_columns', array(&$this, 'social_posts_column_register')); 84 add_action('manage_posts_custom_column', array(&$this, 'social_posts_column_display'), 10, 2); 85 add_filter('manage_edit-post_sortable_columns', array(&$this, 'social_posts_column_register_sortable')); 86 80 87 add_filter('request', array(&$this, 'curated_column_orderby')); 81 88 add_action('wp_enqueue_scripts', array(&$this, 'theme_styles')); … … 95 102 96 103 add_action('admin_notices', array(&$this, 'check_plugins')); 97 add_action('save_post', array(&$this, 'save_post'), 10,2);104 add_action('save_post', array(&$this, 'save_post'), 10, 2); 98 105 add_filter('post_updated_messages', array(&$this, 'messages')); 99 106 add_filter('mce_css', array(&$this, 'add_editor_style')); 100 107 add_filter('show_admin_bar', array(&$this, 'hide_admin_bar')); 101 add_action('admin_ init', array(&$this, 'load_source'));108 add_action('admin_footer', array(&$this, 'load_source')); 102 109 103 110 // Above and below content filters … … 163 170 add_action('wp_ajax_expresscurate_save_active_social_profiles', array($this->socialManager, 'saveActiveProfiles')); 164 171 add_action('wp_ajax_expresscurate_save_post_messages', array($this->socialManager, 'savePostMessages')); 172 add_action('wp_ajax_expresscurate_save_social_publishing_status', array(&$this->socialManager, 'saveSocialPublishingStatus')); 165 173 166 174 add_action('wp_ajax_expresscurate_change_tab_event', array(&$this, 'change_tabs')); … … 182 190 add_action('transition_post_status', array(&$this, 'status_changes'), 10, 3); 183 191 add_action('update_option_permalink_structure', array(&$this, 'permalink_changes'), 10, 2); 184 if ( $_REQUEST['page'] == 'expresscurate_settings') {192 if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'expresscurate_settings') { 185 193 $this->cronManager->schedule_events(); 186 194 … … 215 223 register_setting('expresscurate-group', 'expresscurate_posts_number'); // setting for post number 216 224 register_setting('expresscurate-feed-group', 'expresscurate_enable_content_alert'); 225 register_setting('expresscurate-feed-group', 'expresscurate_content_alert_users'); 217 226 register_setting('expresscurate-feed-group', 'expresscurate_pull_hours_interval'); 218 227 register_setting('expresscurate-feed-group', 'expresscurate_content_alert_frequency'); 228 register_setting('expresscurate-feed-group', 'expresscurate_content_stop_keywords'); 219 229 register_setting('expresscurate-smartpublish-group', 'expresscurate_publish'); 220 230 register_setting('expresscurate-smartpublish-group', 'expresscurate_manually_approve_smart'); … … 244 254 function add_oembed_facebook() 245 255 { 246 wp_oembed_add_provider('http://www.facebook.com/*', 'http://api.embed.ly/v1/api/oembed'); 256 wp_oembed_add_provider('http://www.facebook.com/', 'http://www.facebook.com/*'); 257 //wp_oembed_add_provider('https://www.facebook.com/*', 'https://www.facebook.com/oembedprovider'); 247 258 } 248 259 … … 255 266 return false; 256 267 if ($pagenow == 'post-new.php' && isset($_REQUEST['expresscurate_load_source'])) { //check for new post page 257 ob_start();258 268 echo '<script type="text/javascript"> 259 269 window.expresscurate_load_url = "' . urldecode(base64_decode($_REQUEST['expresscurate_load_source'])) . '"; 260 270 </script>'; 261 ob_flush();262 263 271 } 264 272 } … … 304 312 } 305 313 array_push($buttons, 'addKeyword'); 306 if (get_option('expresscurate_social_publishing', '') == "on" && strlen(get_option('expresscurate_buffer_access_token')) > 2) {314 if (get_option('expresscurate_social_publishing', '') == "on" && strlen(get_option('expresscurate_buffer_access_token')) > 2) { 307 315 array_push($buttons, 'addSocialPost'); 308 316 } … … 377 385 $tracker->track(); 378 386 } 379 387 /*social posts count*/ 388 // Register the column 389 function social_posts_column_register($columns) 390 { 391 return array_merge($columns, array(self::SOCIAL_COLUMN_NAME => __(self::SOCIAL_COLUMN_TITLE, self::PLUGIN_FOLDER))); 392 } 393 394 // Display the column content 395 public function social_posts_column_display($column_name, $post_id) 396 { 397 if ('socialPosts' != $column_name) 398 return; 399 $postsCount = get_post_meta($post_id, '_expresscurate_social_post_counter', true); 400 $postsCount = $postsCount === '' ? '-' : $postsCount; 401 $postsCount = '<em>' . __($postsCount, self::PLUGIN_FOLDER) . '</em>'; 402 403 echo $postsCount; 404 } 405 406 // Register the column as sortable 407 public function social_posts_column_register_sortable($columns) 408 { 409 $columns[self::SOCIAL_COLUMN_NAME] = self::SOCIAL_COLUMN_NAME; 410 return $columns; 411 } 412 413 414 /**/ 380 415 // Register the column 381 416 function curated_column_register($columns) … … 507 542 } 508 543 509 // private function checkOpenTag($matches)510 // {511 // if (strpos($matches[0], '<') === false) {512 // return $matches[0];513 // } else {514 // return '<strong>' . $matches[1] . '</strong>' . $this->doReplace($matches[2]);515 // }516 // }517 //518 // private function doReplace($html)519 // {520 /* return preg_replace_callback('/(\b' . $this->word . '\b)(.*?>)/i', array(&$this, 'checkOpenTag'), $html);*/521 // }522 //523 // public function replace($html, $word)524 // {525 // $this->word = $word;526 //527 // return $this->doReplace($html);528 // }529 544 530 545 public function generate_tags($post) … … 539 554 $defined_tags = explode(",", $defined_tags); 540 555 } 541 // get the content of the post556 // get the content of the post 542 557 $post_content = $post->post_content; 543 558 … … 545 560 $post_content = $tagsObj->removeHighlights($post_content); 546 561 } 547 $tags = get_the_tags($post_id); 562 $tags = get_the_tags($post->ID); 563 $ptags = array(); 548 564 if ($tags) { 549 565 foreach ($tags as $tag) { 550 566 $post_tags[$tag->term_id] = $tag->name; 567 if (strpos($tag->name, "[ ]") > 0) { 568 $post_tags[$tag->term_id] = str_replace("[ ]", " ", $tag->name); 569 wp_update_term($tag->term_id, $tag->taxonomy, array( 570 'name' => $post_tags[$tag->term_id] 571 )); 572 } 573 $ptags[] = $post_tags[$tag->term_id]; 551 574 } 552 575 } … … 561 584 //adding content tag to post tags if not exists 562 585 if (!in_array($content_tag_insert, $post_tags)) { 563 wp_set_post_tags($post->ID, strtolower($content_tag_insert), true); 564 } 565 } 586 $ptags[] = $content_tag_insert; 587 } 588 } 589 wp_set_post_tags($post->ID, $ptags, false); 566 590 if ($defined_tags && count($defined_tags)) { 567 591 foreach ($defined_tags as $defined_tag) { 568 592 $defined_tag_insert = trim($defined_tag); 569 $defined_tag_insert = preg_replace('/\s+/', '[ ]', $defined_tag_insert);570 //$defined_tag_insert = preg_replace('/\s+/', '|', $defined_tag_insert);571 593 //adding defined tag to post tags if tag exists in posttitle or post content 572 594 preg_match("/(?!<\w)(?=[^>]*(<|$))" . $defined_tag_insert . "(\W|$)/i", $post_content, $tag_in_content); 573 if ((isset($tag_in_content[0]) || strpos($ the_post->title, $defined_tag_insert)) && !in_array($defined_tag_insert, $post_tags)) {574 wp_set_post_tags($post->ID, $defined_tag_insert, true);595 if ((isset($tag_in_content[0]) || strpos($post->title, $defined_tag_insert)) && !in_array($defined_tag_insert, $post_tags) && !in_array($defined_tag_insert, $ptags)) { 596 $ptags[] = $defined_tag_insert; 575 597 } 576 598 } 577 }578 579 $tags = get_the_tags($post_id); 580 $ count_tags = count($tags);581 if ($tags && count($ count_tags)) {599 wp_set_post_tags($post->ID, $ptags, false); 600 } 601 602 $tags = get_the_tags($post->ID); 603 if ($tags && count($tags)) { 582 604 $sorted_tags = array(); 583 605 foreach ($tags as $tag) { 584 $tag_name = preg_replace('/\s+/', '[ ]', $tag->name); 585 $sorted_tags[$tag_name]["count_words"] = str_word_count($tag_name); 586 $sorted_tags[$tag_name]["name"] = $tag_name; 587 $sorted_tags[$tag_name]["id"] = $tag->term_id; 606 $sorted_tags[$tag->name]["count_words"] = str_word_count($tag->name); 607 $sorted_tags[$tag->name]["name"] = $tag->name; 608 $sorted_tags[$tag->name]["id"] = $tag->term_id; 588 609 } 589 610 … … 594 615 595 616 foreach ($tags as $tag) { 596 $tag_name = preg_replace('/\s+/', '[ ]', $tag["name"]); 597 $post_content = $tagsObj->createTag($post_content, $tag_name, $tag["id"]); 598 }//end tags 617 $post_content = $tagsObj->createTag($post_content, $tag['name'], $tag["id"]); 618 } 599 619 } 600 620 return $post_content; … … 665 685 * Save the metaboxes for this custom post type 666 686 */ 667 public function save_post($post_id, $post=null)668 { 669 $post_type = $post->post_type;687 public function save_post($post_id, $post = null) 688 { 689 $post_type = (!empty($post)) ? $post->post_type : get_post_type($post_id); 670 690 671 691 if ($post_type == 'acf') { … … 681 701 682 702 703 $post = (!empty($post)) ? $post : get_post($post_id); 683 704 // get the content of the post 684 705 if (get_option('expresscurate_smart_tagging') == "on") { … … 687 708 $post_content = $post->post_content; 688 709 $tags_obj = new ExpressCurate_Tags(); 710 $post_content = $tags_obj->removeHighlights($post_content); 689 711 $post_content = $tags_obj->removeTagLinks($post_content); 690 712 } … … 729 751 730 752 //social posts 731 // $expresscurate_social_post_messages = isset($_POST['expresscurate_social_post_messages']) ? $_POST['expresscurate_social_post_messages'] : '';732 733 // update_post_meta($post_id, '_expresscurate_social_post_messages', esc_attr($expresscurate_social_post_messages));753 // $expresscurate_social_post_messages = isset($_POST['expresscurate_social_post_messages']) ? $_POST['expresscurate_social_post_messages'] : ''; 754 755 // update_post_meta($post_id, '_expresscurate_social_post_messages', esc_attr($expresscurate_social_post_messages)); 734 756 735 757 //post analysis notification … … 881 903 } else if ($make_featured) { 882 904 // create file 883 $file = parse_url($image, PHP_URL_PATH);905 $file = parse_url($image, PHP_URL_PATH); 884 906 $file = strtok($file, '?'); 885 907 … … 912 934 preg_match_all('/\sdata-curated-url\s*=\s*(["\'])((?:\\.|(?!\1).)*)\1/i', $post_content, $curated_links); 913 935 914 $curated_links_meta = $this->get_metas($post_id, '_expresscurate_link_%','post','publish'); //get_post_meta($post_id, '_expresscurate_links');936 $curated_links_meta = $this->get_metas($post_id, '_expresscurate_link_%', 'post', 'publish'); //get_post_meta($post_id, '_expresscurate_links'); 915 937 if (!$curated_links_meta) { 916 938 $curated_links_meta = array(); … … 1057 1079 add_meta_box('expresscurate_advanced_seo', ' Advanced SEO', array(&$this, 'advanced_seo'), $post_type, 'normal', 'high'); 1058 1080 } 1059 if ($social) {1081 if ($social) { 1060 1082 add_meta_box('expresscurate_social_publishing', ' Social Posts', array(&$this, 'social_posts'), $post_type, 'normal', 'high'); 1061 1083 } … … 1083 1105 <?php 1084 1106 } 1085 1107 1086 1108 public function social_posts() 1087 1109 { … … 1090 1112 <?php include(sprintf("%s/templates/social_posts_widget.php", dirname(__FILE__))); ?> 1091 1113 </div> 1092 <?php1114 <?php 1093 1115 } 1094 1116 … … 1428 1450 wp_enqueue_script('expresscurate_utils', $pluginUrl . 'js/Utils.js', array('jquery', 'masonry', 'jquery-ui-sortable', 'wp-util')); 1429 1451 wp_enqueue_script('expresscurate_dialog', $pluginUrl . 'js/Dialog.js', array('jquery', 'jquery-ui-core', 'jquery-ui-dialog')); 1430 wp_enqueue_script('expresscurate_settings', $pluginUrl . 'js/Settings.js', array('jquery' ));1452 wp_enqueue_script('expresscurate_settings', $pluginUrl . 'js/Settings.js', array('jquery', 'jquery-ui-autocomplete')); 1431 1453 wp_enqueue_script('expresscurate_source_collection', $pluginUrl . 'js/sourceCollection.js', array('jquery')); 1432 1454 wp_enqueue_script('expresscurate_social_post_widget', $pluginUrl . 'js/socialPostWidget.js', array('jquery')); … … 1507 1529 add_meta_box('dashboard_widget_smartPublishing', 'Smart Publishing Overview', array(&$this, 'smart_publishing_widget'), get_current_screen(), 'side', 'high'); 1508 1530 } 1509 1531 1510 1532 if (get_option('expresscurate_social_publishing', '') == "on" && strlen(get_option('expresscurate_buffer_access_token')) > 2) { 1511 1533 add_meta_box('dashboard_widget_social_publishing', 'Social Publishing Overview', array(&$this, 'social_publishing_widget'), get_current_screen(), 'side', 'high'); … … 1531 1553 <?php include(sprintf("%s/templates/dashboard/smart_publishing_widget.php", dirname(__FILE__))); ?> 1532 1554 </div> 1533 <?php1534 } 1535 1555 <?php 1556 } 1557 1536 1558 public function social_publishing_widget() 1537 1559 { … … 1540 1562 <?php include(sprintf("%s/templates/dashboard/social_publishing_widget.php", dirname(__FILE__))); ?> 1541 1563 </div> 1542 <?php1564 <?php 1543 1565 } 1544 1566 … … 1648 1670 $expresscurateWebsiteUrl = self::EXPRESSCURATE_URL; 1649 1671 if (strlen(get_option('expresscurate_google_refresh_token')) < 3 && get_option('expresscurate_sitemap_submit') == 'on') { 1650 $warnings[] = '<p>Authorise access to Google Webmaster Tools. <a class="expresscurateLink" href="' . $expresscurateWebsiteUrl . 'api/connector/google/webmasters/refreshtoken/' . $blogName . '">Authorize </a> | <a class="expresscurateLink" href="options-general.php?page=expresscurate_settings"> Sitemap Settings </a></p>';1672 $warnings[] = '<p>Authorise access to Google Search Console (aka Webmaster Tools). <a class="expresscurateLink" href="' . $expresscurateWebsiteUrl . 'api/connector/google/webmasters/refreshtoken/' . $blogName . '">Authorize </a> | <a class="expresscurateLink" href="options-general.php?page=expresscurate_settings"> Sitemap Settings </a></p>'; 1651 1673 } 1652 1674 -
expresscurate/trunk/ExpressCurate_CronManager.php
r1137344 r1179063 19 19 20 20 public $websiteUrlCallCronjob = null; 21 public $websiteUrlCallCronjobDeleteAfter = null; 21 22 22 23 public function __construct() { 23 24 $this->websiteUrlCallCronjob ='0 * * * * wget '.get_site_url().' > /dev/null 2>&1'; 25 $this->websiteUrlCallCronjobDeleteAfter ='0 * * * * wget --delete-after '.get_site_url().' > /dev/null 2>&1'; 24 26 } 25 27 … … 41 43 42 44 $execExists = function_exists('exec'); 43 $cronjobExists = $this->check_if_exist($this->websiteUrlCallCronjob);44 45 45 if ($execExists && !$cronjobExists) {46 ExpressCurate_Util::exec('crontab -l' ,$output);46 if($execExists) { 47 ExpressCurate_Util::exec('crontab -l', $output); 47 48 $output = implode(PHP_EOL, $output); 48 $output = $output . PHP_EOL . $this->websiteUrlCallCronjob . PHP_EOL; 49 50 $tempFile = ExpressCurate_Util::tmpname('cron'); 49 50 $cronjobExists = $this->check_if_exist($this->websiteUrlCallCronjob, $output) || $this->check_if_exist($this->websiteUrlCallCronjobDeleteAfter, $output); 51 52 if ($cronjobExists) { 53 $this->websiteUrlCallCronjob . PHP_EOL; 54 $this->websiteUrlCallCronjobDeleteAfter . PHP_EOL; 55 } 56 57 $output = $output . PHP_EOL . $this->websiteUrlCallCronjobDeleteAfter . PHP_EOL; 58 59 $tempFile = ExpressCurate_Util::tmpname('cron'); 51 60 file_put_contents($tempFile, $output); 52 61 ExpressCurate_Util::exec('crontab ' . $tempFile, $output); … … 83 92 wp_clear_scheduled_hook('expresscurate_sitemap_push'); 84 93 85 if($this->check_if_exist($this->websiteUrlCallCronjob)) { 94 $execExists = function_exists('exec'); 95 96 if($execExists) { 86 97 ExpressCurate_Util::exec('crontab -l', $output); 98 $cronjobExists = $this->check_if_exist($this->websiteUrlCallCronjob, $output) || $this->check_if_exist($this->websiteUrlCallCronjobDeleteAfter, $output); 87 99 $output = implode(PHP_EOL, $output); 88 $output = str_replace($this->websiteUrlCallCronjob, "", $output) . PHP_EOL; 89 90 $tempFile = ExpressCurate_Util::tmpname('cron'); 100 101 if ($cronjobExists) { 102 $output = str_replace($this->websiteUrlCallCronjob, "", $output) . PHP_EOL; 103 $output = str_replace($this->websiteUrlCallCronjobDeleteAfter, "", $output) . PHP_EOL; 104 } 105 106 $tempFile = ExpressCurate_Util::tmpname('cron'); 91 107 file_put_contents($tempFile, $output); 92 108 ExpressCurate_Util::exec('crontab ' . $tempFile); … … 108 124 * Check if cron job exists 109 125 */ 110 public function check_if_exist($command) { 111 ExpressCurate_Util::exec('crontab -l', $crontab); 126 public function check_if_exist($command, $crontab) { 112 127 if(isset($crontab) && is_array($crontab)){ 113 128 $crontab = array_flip($crontab); -
expresscurate/trunk/ExpressCurate_Email.php
r1137344 r1179063 16 16 private $customerEmail = null; 17 17 18 public function hasContentAlertRecipients() 19 { 20 $alertUsers = trim(get_option('expresscurate_content_alert_users', '')); 21 return strlen($alertUsers) > 0; 22 } 23 18 24 public function sendContentAlertEmail($emailData) 19 25 { 26 // render the email 20 27 ob_start(); 21 28 include(sprintf("%s/templates/email/contentAlert.php", dirname(__FILE__))); 22 29 $email = ob_get_clean(); 23 30 31 // define headers 32 $headers = 'Content-type: text/html; charset=utf-8' . "\r\n"; 33 34 // get recipients 24 35 $wpUsers = get_users(); 25 $headers = 'Content-type: text/html; charset=utf-8' . "\r\n"; 36 $alertUsers = split(',', trim(get_option('expresscurate_content_alert_users', ''))); 37 // TODO optimize to load only the users we need 26 38 foreach ($wpUsers as $user) { 27 39 // don't sent alerts to subscribers 28 if(in_array('subscriber', $user->roles) ) {40 if(in_array('subscriber', $user->roles) || !in_array($user->user_login, $alertUsers)) { 29 41 continue; 30 42 } 31 43 @wp_mail($user->user_email, 'ExpressCurate Content Alert', $email, $headers); 32 44 } 45 // set the last alert time 33 46 update_option('expresscurate_content_alert_lastDate', date('Y-m-d H:i:s')); 34 35 47 } 36 48 -
expresscurate/trunk/ExpressCurate_FeedManager.php
r1165036 r1179063 64 64 if (filter_var($rssUrl, FILTER_VALIDATE_URL)) { 65 65 $result['status'] = 'success'; 66 66 67 67 // retrieve the feed title 68 68 $feedMeta = $this->getFeedMeta($rssUrl); 69 69 $link = $feedMeta['link']; 70 70 $link = empty($link) ? $rssUrl : $link; 71 71 72 72 // get the number of posts that are curated from this feed 73 73 $metas = $wpdb->get_results( … … 81 81 $curated_links_rss[$rssUrl]['post_count'] = $result['post_count'] = count($metas); 82 82 $curated_links_rss[$rssUrl]['feed_title'] = $result['feed_title'] = $feedMeta['title']; 83 83 84 84 // save 85 85 update_option('expresscurate_links_rss', json_encode($curated_links_rss)); … … 96 96 die; 97 97 } 98 98 99 99 private function getFeedMeta($feedURL) { 100 100 $loadURL = "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=" . urlencode($feedURL); … … 102 102 $res = $htmlparser->download(); 103 103 $result = json_decode($res, true); 104 104 105 105 if(isset($result['responseData']) && isset($result['responseData']['feed'])) { 106 106 $meta = array(); … … 159 159 if ($curated_links_rss) { 160 160 $curated_links_rss = json_decode($curated_links_rss, true); 161 161 162 162 $links = array(); 163 163 foreach($curated_links_rss as $link => $data) { … … 197 197 $url = parse_url($meta_values[$key][0]); 198 198 $host = $url['host']; 199 199 200 200 // get only the main domain 201 201 preg_match('/([a-z0-9\-_]{1,63})\.([a-z]{2,6})$/i', $host, $regs); 202 202 $link = $regs[1] . '.' . $regs[2]; 203 203 204 204 // filter 205 205 if(empty($link) || $link == '.') { 206 206 continue; 207 207 } 208 208 209 209 // add 210 210 $curated_links[$i]['host'] = $host; … … 218 218 } 219 219 wp_reset_postdata(); 220 220 221 221 $rssLinks = array(); 222 222 223 223 if(ExpressCurate_HtmlParser::supportsDownload()) { 224 224 foreach ($curated_links as $key => $top_link) { 225 225 $websiteHost = $top_link['host']; 226 226 $website = $top_link['link']; 227 227 228 228 if(isset($rssLinks[$websiteHost])) { 229 229 $rssUrl = $rssLinks[$websiteHost]; … … 232 232 $rssLinks[$websiteHost] = $rssUrl; 233 233 } 234 234 235 235 if ($rssUrl && isset($curated_links_rss[$rssUrl])) { 236 236 $feed_status = 'rssStatusYes'; … … 242 242 } 243 243 } 244 244 245 245 $top_sources_rss['links'][$website] = array( 246 246 'post_ids' => array($top_link['post_id']), … … 276 276 { 277 277 global $wpdb; 278 278 279 279 $curated_links_rss = get_option('expresscurate_links_rss', ''); 280 280 if ($curated_links_rss) { 281 281 $curated_links_rss = json_decode($curated_links_rss, true); 282 282 283 283 $save = false; 284 284 foreach($curated_links_rss as $rss => $data) { … … 286 286 continue; 287 287 } 288 288 289 289 // correct the url and get the meta data 290 290 $rssUrl = $this->getRssUrl($rss); … … 292 292 $link = $feedMeta['link']; 293 293 $link = empty($link) ? $rssUrl : $link; 294 294 295 295 $data = array(); 296 296 $data['feed_title'] = $feedMeta['title']; 297 297 $data['feed_url'] = $rssUrl; 298 298 $data['link'] = $link; 299 299 300 300 // remove the old row and add the new one 301 301 unset($curated_links_rss[$rss]); 302 302 $curated_links_rss[$link] = $data; 303 303 304 304 // make sure to save in the end 305 305 $save = true; 306 306 } 307 307 308 308 // update the post count 309 309 foreach($curated_links_rss as $link => $data) { … … 313 313 FROM $wpdb->postmeta 314 314 WHERE meta_key LIKE '%_expresscurate_link_%' AND meta_value LIKE '%" . $link . "%' GROUP BY post_id"); 315 315 316 316 $curated_links_rss[$link]['post_count'] = count($posts); 317 317 } 318 318 319 319 // save 320 320 update_option('expresscurate_links_rss', json_encode($curated_links_rss)); … … 322 322 $curated_links_rss = array(); 323 323 } 324 324 325 325 unset($curated_links_rss['']); 326 326 return $curated_links_rss; … … 370 370 return false; 371 371 } 372 373 372 373 374 374 375 375 public function get_feed_content() … … 387 387 $data = $_REQUEST; 388 388 $pull_feed_interval = (get_option('expresscurate_pull_hours_interval')) ? get_option('expresscurate_pull_hours_interval') : 1; 389 $date = ($data["date"]) ? urldecode($data["date"]) : date('Y-m-d H:i:s', strtotime("-" . $pull_feed_interval . " hour"));389 $date = ($data["date"]) ? urldecode($data["date"]) : date('Y-m-d H:i:s', strtotime("-" . $pull_feed_interval . " hour")); 390 390 $curated_links_rss = get_option('expresscurate_links_rss', ''); 391 391 if ($curated_links_rss) { … … 403 403 } 404 404 } 405 405 406 406 // go over the feeds and try to pull 407 407 $curated_links_rss = json_decode($curated_links_rss, true); … … 409 409 foreach ($curated_links_rss as $url => $feed_url) { 410 410 // pull content 411 $lookup_url = "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0& q=" . urlencode($feed_url['feed_url']);411 $lookup_url = "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&scoring=h&q=" . urlencode($feed_url['feed_url']); 412 412 $htmlparser = new ExpressCurate_HtmlParser($lookup_url); 413 413 $res = $htmlparser->download(); … … 421 421 if(!empty($feed_array)) { 422 422 @uasort($feed_array, array($this, "feedSortByDate")); 423 423 424 424 // check if the feed is full or not 425 425 if(count($feed_array) > self::CONTENT_FEED_MAX_SIZE) { … … 430 430 } 431 431 } 432 432 433 433 // save the latest feed 434 434 $feed_content = json_encode(array('date' => date('Y-m-d H:i:s'), 'content' => $feed_array)); … … 437 437 } 438 438 } 439 439 440 440 private function collect_feed($result, $deleted_urls, &$feed_array, $type = 'feed', $date = false) 441 441 { … … 448 448 } 449 449 } 450 451 $blockWords = split(',', trim(get_option('expresscurate_content_stop_keywords', ''))); 452 $blockWords = empty($blockWords) ? false : $blockWords; 453 450 454 foreach ($feeds as $story) { 451 455 // get the post url … … 454 458 continue; 455 459 } 456 460 457 461 // parse the post url 458 462 $parsedLink = parse_url($link); 459 463 460 464 // google alerts support 461 465 // check for google redirect urls and pick up the original post link 462 466 $protocol = $parsedLink['scheme']; 463 if (strpos($protocol . "://www.google.com/url", $ url) == 0) {467 if (strpos($protocol . "://www.google.com/url", $link) == 0) { 464 468 $query = $parsedLink['query']; 465 469 $url_query = explode("&", $query); … … 473 477 } 474 478 } 475 479 476 480 // check if this link is already in the feed 477 481 if(isset($feed_array[$link])) { 478 482 continue; 479 483 } 480 484 481 485 $domain = parse_url($link); 482 486 if (preg_match('/(?P<subdomain>.<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $parsedLink['host'], $regs)) { … … 485 489 $domain = $domain['host']; 486 490 } 487 491 488 492 // download and analyze 489 493 $html_parser = new ExpressCurate_HtmlParser($link); … … 493 497 continue; 494 498 } 499 500 if($blockWords) { 501 $blocked = $html_parser->contains($blockWords); 502 if($blocked) { 503 continue; 504 } 505 } 506 495 507 496 508 $keywords = $html_parser->analyzeKeywords(); 497 509 $media = $html_parser->containsMedia(); 498 510 499 511 $publishDate = isset($story['publishedDate']) ? $story['publishedDate'] : $story['date']; 500 512 $expressCurateDate = new ExpressCurate_Date(); 501 513 $publishDate = $expressCurateDate->dateWithTimeUtc(strtotime($publishDate)); 502 514 503 515 $story_array = array( 504 516 'title' => str_replace(""","'",$story['title']), … … 532 544 // get feed data 533 545 $feeds = json_decode($this->get_feed_content(), true); 534 546 535 547 // reschedule the cronjob 536 548 //if(!empty($feeds['content'])) { … … 540 552 $feeds["minutes_to_next_pull"] = human_time_diff(wp_next_scheduled('expresscurate_pull_feeds'), time()); 541 553 //} 542 554 543 555 // return 544 556 echo json_encode($feeds); … … 551 563 die; 552 564 } 553 565 554 566 public function filter_feeds_by_date() { 555 567 $data = $_REQUEST; … … 570 582 571 583 if (get_option('expresscurate_enable_content_alert') == 'on') { 584 $expressCurateEmail = new ExpressCurate_Email(); 585 586 $alertAddresses = trim(get_option('expresscurate_content_alert_users', '')); 587 if(!$expressCurateEmail->hasContentAlertRecipients()) { 588 return; 589 } 590 572 591 $feed_content = json_decode(get_option('expresscurate_feed_content', ''), true); 573 592 … … 585 604 } 586 605 if (!empty($emailStories)) { 587 $expressCurateEmail = new ExpressCurate_Email();588 606 $expressCurateEmail->sendContentAlertEmail($emailStories); 589 590 } 591 592 } 593 } 594 607 } 608 } 609 } 595 610 } 596 611 … … 655 670 $current_user = wp_get_current_user(); 656 671 $item['user'] = $current_user->display_name; 657 672 658 673 $this->collectBookmark($bookmarks, $item); 659 674 660 675 $result[$bookmarkURL]['status'] = 'success'; 661 676 } 662 677 } 663 678 664 679 // save the updated bookmarks 665 680 update_option('expresscurate_bookmarks', json_encode($bookmarks)); … … 683 698 // get the url 684 699 $bookmarkURL = $data['url']; 685 700 686 701 // clean-up the provided url 687 702 // parse the post url 688 703 $parsedLink = parse_url($bookmarkURL); 689 704 690 705 // google alerts supportbookmarkURL // check for google redirect urls and pick up the original post link 691 706 $protocol = $parsedLink['scheme']; … … 701 716 } 702 717 } 703 718 704 719 // read the existing bookmarks 705 720 $bookmarks = get_option('expresscurate_bookmarks', ''); … … 709 724 $bookmarks = array(); 710 725 } 711 726 712 727 // check if the provided url is already bookmarked 713 728 if (isset($bookmarks[$bookmarkURL])) { … … 716 731 // save the new comment 717 732 $bookmarks[$bookmarkURL]['comment'] = $data['comment']; 718 733 719 734 // construct the result 720 735 $result['status'] = 'success'; 721 736 $result['result'] = $bookmarkURL; 722 737 723 738 // save the updated bookmarks 724 739 update_option('expresscurate_bookmarks', json_encode($bookmarks)); … … 734 749 $contentManager = new ExpressCurate_ContentManager(); 735 750 $article = $contentManager->getArticle($bookmarkURL, false); 736 751 737 752 // check if the article is loaded successfully 738 753 if (isset($article['status']) && $article['status'] == 'success') { 739 754 // get the comment 740 755 $comment = isset($data['comment']) ? $data['comment'] : ''; 741 756 742 757 // set the type and author 743 758 $article['type'] = isset($data['type']) ? $data['type'] : 'user'; 744 759 $current_user = wp_get_current_user(); 745 760 $article['result']['user'] = $current_user->display_name; 746 761 747 762 // ... 748 763 $this->collectBookmark($bookmarks, $article, $bookmarkURL, $comment); 749 764 750 765 // construct the result 751 766 $result['status'] = 'success'; 752 767 $result['result'] = $bookmarks[$bookmarkURL]; 753 768 $result['result']['curateLink'] = base64_encode(urlencode($bookmarkURL)); 754 769 755 770 // save the updated bookmarks 756 771 update_option('expresscurate_bookmarks', json_encode($bookmarks)); … … 773 788 die; 774 789 } 775 790 776 791 private function collectBookmark(&$bookmarks, $item, $url = null, $comment = '') { 777 792 if ($url) { … … 790 805 $bookmark['comment'] = $comment; 791 806 $bookmark['curated'] = 0; 792 807 793 808 $bookmark['type'] = isset($item['result']['type']) ? $item['type'] : 'user'; 794 809 795 810 // add the bookmark to the list 796 811 $bookmarks[$url] = $bookmark; … … 803 818 $item['comment'] = $comment; 804 819 $item['bookmark_date'] = date('Y-m-d H:i:s'); 805 820 806 821 $bookmarks[$item['link']] = $item; 807 822 } … … 884 899 { 885 900 $needle = !empty($_GET['searchKeyword']) ? $_GET['searchKeyword'] : ' '; 886 $resul Array = array();901 $resultArray = array(); 887 902 $hayStack = array(); 888 903 … … 901 916 $feeds = array(); 902 917 } 903 $hayStack = array_merge($bookmarks, $feeds); 904 } 905 906 foreach ($hayStack as $content) { 907 if (mb_stripos($content['title'], $needle) != false) { 908 $resulArray[] = $content; 909 } 910 } 911 912 echo json_encode($resulArray); 918 if(!empty($bookmarks)){ 919 $hayStack = array_merge($bookmarks, $feeds); 920 } 921 } 922 923 if(!empty($hayStack)){ 924 foreach ($hayStack as $content) { 925 if (mb_stripos($content['title'], $needle) != false) { 926 $resultArray[] = $content; 927 } 928 } 929 } 930 931 echo json_encode($resultArray); 913 932 die; 914 933 } -
expresscurate/trunk/ExpressCurate_GoogleClient.php
r1140784 r1179063 22 22 if($accessToken == null) { 23 23 // no access token, break! 24 $response = array('status'=> 1,'message' => 'ExpressCurate shall be authorized to access to Google Webmaster Tools.');24 $response = array('status'=> 1,'message' => 'ExpressCurate shall be authorized to access to Google Search Console (aka Webmaster Tools).'); 25 25 return $response; 26 26 } … … 48 48 } else if($httpCode == 401) { 49 49 $decodedResponse = json_decode($response, true); 50 $response = array('status'=> 1,'message' => 'ExpressCurate shall be authorized to access to Google Webmaster Tools.');50 $response = array('status'=> 1,'message' => 'ExpressCurate shall be authorized to access to Google Search Console (aka Webmaster Tools).'); 51 51 } else { 52 52 $decodedResponse = json_decode($response, true); 53 $response = array('status'=> 2,'message' => isset($decodedResponse['error']) ? $decodedResponse['error'] : 'Something went wrong. Please, make sure you have authorized ExpressCurate to access to Google Webmaster Tools.');53 $response = array('status'=> 2,'message' => isset($decodedResponse['error']) ? $decodedResponse['error'] : 'Something went wrong. Please, make sure you have authorized ExpressCurate to access to Google Search Console (aka Webmaster Tools).'); 54 54 } 55 55 return $response; -
expresscurate/trunk/ExpressCurate_HtmlParser.php
r1165036 r1179063 47 47 } 48 48 49 public static function isNotSafeMode() 50 { 51 $safeMode = ini_get('safe_mode'); 52 if($safeMode && version_compare(PHP_VERSION, '5.4.0') < 0) { 53 return false; 54 } else { 55 return true; 56 } 57 } 58 49 59 public static function supportsDownload() 50 60 { … … 105 115 return true; 106 116 } 107 if (is_array($this->dataHTTPStatus) && ($this->dataHTTPStatus[0] == "HTTP/1.1 301 Moved Permantenly" || strpos($this->dataHTTPStatus[0], '301')) || ($this->dataHTTPStatus[0] == "HTTP/1.1 302 Found" || strpos($this->dataHTTPStatus[0], '302')) || ($this->dataHTTPStatus[0] == "HTTP/1.1 303 See Other" || strpos($this->dataHTTPStatus[0], '303')) || ($this->dataHTTPStatus[0] == "HTTP/1.1 307 Temporary Redirect" || strpos($this->dataHTTPStatus[0], '307')) || ($this->dataHTTPStatus[0] == "HTTP/1.1 308 Permanent Redirect" || strpos($this->dataHTTPStatus[0], '308'))) {117 if (is_array($this->dataHTTPStatus) && ($this->dataHTTPStatus[0] == "HTTP/1.1 301 Moved Permantenly" || strpos($this->dataHTTPStatus[0], '301')) || ($this->dataHTTPStatus[0] == "HTTP/1.1 302 Found" || strpos($this->dataHTTPStatus[0], '302')) || ($this->dataHTTPStatus[0] == "HTTP/1.1 303 See Other" || strpos($this->dataHTTPStatus[0], '303')) || ($this->dataHTTPStatus[0] == "HTTP/1.1 307 Temporary Redirect" || strpos($this->dataHTTPStatus[0], '307')) || ($this->dataHTTPStatus[0] == "HTTP/1.1 308 Permanent Redirect" || strpos($this->dataHTTPStatus[0], '308'))) { 108 118 return true; 109 119 } … … 210 220 211 221 212 public function getRealURL(){ 213 if(self::supportsAsynch()){ 222 public function getRealURL() 223 { 224 if (self::supportsAsynch()) { 214 225 $ch = curl_init(); 215 226 curl_setopt($ch, CURLOPT_URL, $this->url); … … 218 229 curl_setopt($ch, CURLOPT_NOBODY, 1); 219 230 curl_exec($ch); 220 $this->url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);231 $this->url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); 221 232 curl_close($ch); 222 } else{233 } else { 223 234 $headers = get_headers($this->url); 224 foreach ($headers as $header) {235 foreach ($headers as $header) { 225 236 if (strpos($header, "Location:") === 0) { 226 237 $this->url = trim(substr($header, 9)); … … 237 248 } 238 249 set_time_limit(0); 239 if (self::supportsAsynch()) { 240 // setup the single curl 241 $ch = $this->createCURL($this->url); 242 $content = curl_exec($ch); 243 //$this->dataHTTPStatus = curl_getinfo($this->asynchHandle, CURLINFO_HTTP_CODE); 244 $this->dataHTTPStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); 245 $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); 246 curl_close($ch); 247 } else { 248 $header = ''; 249 if ($this->referer) { 250 $header .= 'Referer: ' . $this->referer . '\r\n'; 251 } 252 if (!$this->raw) { 253 $header .= 'Accept: application/xhtml+xml, application/xml, text/html\r\n'; 254 $header .= 'Accept-Charset: UTF-8'; 255 } 256 $options = array('http' => array( 257 'user_agent' => ExpressCurate_Actions::USER_AGENT, 258 'follow_location' => 1, 259 'max_redirects' => 5, 260 'request_fulluri ' => TRUE, 261 'timeout' => self::$REQUEST_TIMEOUT, 262 'header' => $header)); 263 if (strpos($this->url, 'https://') === 0) { 264 $options['ssl'] = array('verify_peer' => false, 'verify_peer_name' => false); 265 } 266 $context = stream_context_create($options); 267 $content = @file_get_contents($this->url, false, $context); 268 //var_dump($content); 269 // $http_response_header gets loaded once file get contents is called, php native stuff 270 $this->dataHTTPStatus = $http_response_header; 271 272 // try to resolve the content encoding if text/html content 273 if (!$this->raw) { 274 if (!empty($http_response_header)) { 275 foreach ($http_response_header as $header) { 276 if (substr(strtolower($header), 0, 13) == "content-type:") { 277 $contentTypeData = explode(";", $header); 278 if (count($contentTypeData) == 2) { 279 list( , $contentType) = $contentTypeData; 250 if (self::supportsAsynch()&& self::isNotSafeMode() && strlen(ini_get('open_basedir'))==0) { 251 252 // setup the single curl 253 $ch = $this->createCURL($this->url); 254 $content = curl_exec($ch); 255 //$this->dataHTTPStatus = curl_getinfo($this->asynchHandle, CURLINFO_HTTP_CODE); 256 $this->dataHTTPStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); 257 $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); 258 curl_close($ch); 259 } else { 260 $header = ''; 261 if ($this->referer) { 262 $header .= 'Referer: ' . $this->referer . '\r\n'; 263 } 264 if (!$this->raw) { 265 $header .= 'Accept: application/xhtml+xml, application/xml, text/html\r\n'; 266 $header .= 'Accept-Charset: UTF-8'; 267 } 268 $options = array('http' => array( 269 'user_agent' => ExpressCurate_Actions::USER_AGENT, 270 'follow_location' => 1, 271 'max_redirects' => 5, 272 'request_fulluri ' => TRUE, 273 'timeout' => self::$REQUEST_TIMEOUT, 274 'header' => $header)); 275 if (strpos($this->url, 'https://') === 0) { 276 $options['ssl'] = array('verify_peer' => false, 'verify_peer_name' => false); 277 } 278 $context = stream_context_create($options); 279 $content = @file_get_contents($this->url, false, $context); 280 281 // $http_response_header gets loaded once file get contents is called, php native stuff 282 $this->dataHTTPStatus = $http_response_header; 283 284 // try to resolve the content encoding if text/html content 285 if (!$this->raw) { 286 // try to resolve the content type from headers 287 $encoding = false; 288 if (!empty($http_response_header)) { 289 foreach ($http_response_header as $header) { 290 if (substr(strtolower($header), 0, 13) == "content-type:") { 291 // get content type 292 $contentTypeData = explode(";", $header); 293 if (count($contentTypeData) == 2) { 294 list(, $contentType) = $contentTypeData; 295 } 296 297 // resolve encoding 298 if ($contentType) { 299 list(, $encoding) = explode("=", $contentType); 300 $encoding = strtoupper(trim($encoding)); 301 302 $supportedEncoding = array_search($encoding, mb_list_encodings()) !== false; 303 304 if (!$supportedEncoding) { 305 $encoding = false; 306 } 307 } 280 308 } 281 309 } … … 283 311 } 284 312 } 285 }286 313 // make sure if there is a response at all 287 314 if ($this->isHTTPStatusOK() === false) { … … 293 320 // there is data with OK code, process if required 294 321 if (!$this->raw) { 322 // cleanup the content 295 323 $content = self::sanitizeContent($content); 296 324 297 if ($contentType) { 298 list( , $encoding) = explode("=", $contentType); 299 $encoding = strtoupper(trim($encoding)); 300 301 $supportedEncoding = array_search($encoding, mb_list_encodings()) !== false; 302 303 if (!$supportedEncoding) { 304 $encoding = mb_detect_encoding($content); 305 } 306 325 // check if encoding is found 326 if($encoding == false) { 327 preg_match('/<meta.*?http-equiv\s*=\s*("|\')Content-Type("|\')\s*content\s*=\s*("|\')([a-z1-9\/\-\+\;\= ]+)("|\')/i', $content, $matches); 328 $contentType = count($matches) > 0 ? trim($matches[4]) : false; 329 330 // resolve encoding 331 if ($contentType) { 332 list(, $encoding) = explode("=", $contentType); 333 $encoding = strtoupper(trim($encoding)); 334 335 $supportedEncoding = array_search($encoding, mb_list_encodings()) !== false; 336 337 if (!$supportedEncoding) { 338 $encoding = false; 339 } 340 } 341 } 342 343 // if no encoding was resolved so far, try to detect 344 if($encoding == false) { 345 $encoding = mb_detect_encoding($content); 346 } 347 348 // fix up the encoding 349 if ($encoding !== false) { 307 350 $content = mb_convert_encoding($content, 'UTF-8', $encoding); 308 351 $content = mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'); 309 310 352 } 311 353 } … … 389 431 } 390 432 391 private function parseArticles(){ 433 private function parseArticles() 434 { 392 435 if ($this->articles == null) { 393 436 // TODO check the xpath object problem, the final article shall support the same query method 394 437 395 438 $article = $this->xpath->query('//article'); 396 if ($article->length ==0) {439 if ($article->length == 0) { 397 440 //$article = $this->xpath->query("//*[contains(concat(' ', normalize-space(@class), ' '), 'hentry')]"); 398 441 $article = $this->xpath->query('//div[contains(concat("\s+", normalize-space(@class), "\s+"), " hentry ")]'); 399 442 } 400 if ($article->length ==0) {443 if ($article->length == 0) { 401 444 $article = $this->xpath->query("//*[contains(@itemtype, 'http://schema.org/Article')]"); 402 445 } 403 if ($article->length ==0) {446 if ($article->length == 0) { 404 447 $article = $this->xpath->query("//*[contains(@itemtype, 'http://schema.org/TechArticle')]"); 405 448 } 406 449 407 if ($article->length ==0) {450 if ($article->length == 0) { 408 451 $article = $this->xpath->query("//*[contains(@itemtype, 'http://schema.org/ScholarlyArticle')]"); 409 452 } 410 453 411 if ($article->length ==0) {454 if ($article->length == 0) { 412 455 $article = $this->xpath->query('//body'); 413 456 } … … 513 556 } 514 557 558 public function contains($words) 559 { 560 $this->download(); 561 562 // TODO optimize to "cache" the regexp generation 563 $escaped = array(); 564 foreach ($words as $word) { 565 $escaped[] = preg_quote($word); 566 } 567 $escapedExp = implode('|', $escaped); 568 569 $matches = array(); 570 preg_match('/' . $escapedExp . '/i', $this->data, $matches); 571 return !empty($matches); 572 } 573 515 574 public function getContents() 516 575 { … … 531 590 } 532 591 } 533 592 534 593 public function getCloneContents() 535 594 { … … 566 625 preg_match('/<meta.*?name=("|\')keywords("|\').*?content=("|\')(.*?)("|\')/i', $this->data, $matches); 567 626 if (count($matches) > 4) { 568 if (strpos(trim($matches[4]),',')){627 if (strpos(trim($matches[4]), ',')) { 569 628 return array_filter(explode(",", trim($matches[4]))); 570 } 571 else{ 629 } else { 572 630 return array_filter(explode(" ", trim($matches[4]))); 573 631 } … … 577 635 preg_match('/<meta.*?content=("|\')(.*?)("|\').*?name=("|\')keywords("|\')/i', $this->data, $matches); 578 636 if (count($matches) > 2) { 579 if (strpos(trim($matches[2]),',')){637 if (strpos(trim($matches[2]), ',')) { 580 638 return array_filter(explode(",", trim($matches[2]))); 581 } 582 else{ 639 } else { 583 640 return array_filter(explode(" ", trim($matches[2]))); 584 641 } … … 686 743 $result_paragraphs[$i]['tag'] = 'blockquote'; 687 744 $i++; 688 745 689 746 $blockquote->parentNode->removeChild($blockquote); 690 747 } 691 748 692 749 // get paragraphs 693 750 $paragraphTag = $this->xpath->query(".//p", $this->article); … … 696 753 $result_paragraphs[$i]['tag'] = 'p'; 697 754 $i++; 698 755 699 756 $paragraph->parentNode->removeChild($paragraph); 700 757 } … … 768 825 } 769 826 770 private function in_object($value,$object) { 827 private function in_object($value, $object) 828 { 771 829 if (is_object($object)) { 772 foreach ($object as $item) {773 if ($value->getAttribute('class') ==$item->getAttribute('class') && $item->nodeName!='body') return true;830 foreach ($object as $item) { 831 if ($value->getAttribute('class') == $item->getAttribute('class') && $item->nodeName != 'body') return true; 774 832 } 775 833 } … … 780 838 { 781 839 $articleContent = array( 782 "article_html" =>array(),783 "links" =>array(),784 "domains" =>array(),785 "images" =>array(),786 "keywords" =>array(),787 "titles" =>array()840 "article_html" => array(), 841 "links" => array(), 842 "domains" => array(), 843 "images" => array(), 844 "keywords" => array(), 845 "titles" => array() 788 846 ); 789 847 // TODO make sure this cleanup can be done earlier or later, or maybe shall not affect the base dom with original html at all … … 791 849 $main_article = $this->xpath->query("//*[contains(@class, 'hentry')]"); 792 850 $main_article = ($main_article->length > 0) ? $main_article->item(0) : $this->xpath->query('//body')->item(0); 793 foreach ($this->articles as $article){794 $this->getArticlesContent($article, $articleContent);795 if (isset($article->parentNode)){851 foreach ($this->articles as $article) { 852 $this->getArticlesContent($article, $articleContent); 853 if (isset($article->parentNode)) { 796 854 $article->parentNode->removeChild($article); 797 855 } 798 856 } 799 857 800 if (!$this->in_object($main_article,$this->articles)){801 $this->getArticlesContent($main_article, $articleContent);802 } 803 foreach ($articleContent as $key => $article_info){858 if (!$this->in_object($main_article, $this->articles)) { 859 $this->getArticlesContent($main_article, $articleContent); 860 } 861 foreach ($articleContent as $key => $article_info) { 804 862 $articleContent[$key] = array_reverse($article_info); 805 863 } … … 808 866 } 809 867 810 private function getArticlesContent($article,&$articleContent){ 811 $comments = $this->xpath->query(".//comment()",$article); 812 foreach($comments as $comment){ 868 private function getArticlesContent($article, &$articleContent) 869 { 870 $comments = $this->xpath->query(".//comment()", $article); 871 foreach ($comments as $comment) { 813 872 $comment->parentNode->removeChild($comment); 814 873 } 815 $input = $this->xpath->query(".//node()[name()='iframe' or name()='input' or name()='button' or name='textarea' or name()='form']", $article);874 $input = $this->xpath->query(".//node()[name()='iframe' or name()='input' or name()='button' or name='textarea' or name()='form']", $article); 816 875 foreach ($input as $inp) { 817 876 $inp->parentNode->removeChild($inp); 818 877 } 819 $art = $this->xpath->query('.//article', $article);820 if ($art->length>0){821 foreach ($art as $artcl){878 $art = $this->xpath->query('.//article', $article); 879 if ($art->length > 0) { 880 foreach ($art as $artcl) { 822 881 $artcl->parentNode->removeChild($artcl); 823 882 } … … 828 887 foreach ($imgTags as $t) { 829 888 $src = $t->getAttribute('src'); 830 $src = !empty($src) ? $src : $t->getAttribute('data-src');831 $src = !empty($src) ? $src : $t->getAttribute('data-src-template');832 833 if (empty($src)) {834 $styles = explode(';', $t->getAttribute('style'));889 $src = !empty($src) ? $src : $t->getAttribute('data-src'); 890 $src = !empty($src) ? $src : $t->getAttribute('data-src-template'); 891 892 if (empty($src)) { 893 $styles = explode(';', $t->getAttribute('style')); 835 894 preg_match("/url[\s]*\(([\'\"]*)([^\'\")]*)/i", $styles[0], $output); 836 if (!empty($output)) $src = $output[2];895 if (!empty($output)) $src = $output[2]; 837 896 } 838 897 if (strlen($src) > 3) { … … 861 920 } 862 921 $articleContent['images'][] = $result_images; 863 $title_node = $this->xpath->query('.//node()[name()="h1"]', $article);922 $title_node = $this->xpath->query('.//node()[name()="h1"]', $article); 864 923 $title = ""; 865 if ($title_node->length > 0){924 if ($title_node->length > 0) { 866 925 $title = $title_node->item(0)->nodeValue; 867 } 868 else{ 869 $title_node = $this->xpath->query('.//node()[name()="h2"]',$article); 870 if($title_node->length > 0){ 926 } else { 927 $title_node = $this->xpath->query('.//node()[name()="h2"]', $article); 928 if ($title_node->length > 0) { 871 929 $title = $title_node->item(0)->nodeValue; 872 } 873 else{ 874 $title_node = $this->xpath->query('.//*[contains(@class,"title")]',$article); 930 } else { 931 $title_node = $this->xpath->query('.//*[contains(@class,"title")]', $article); 875 932 $title = $title_node->item(0)->nodeValue; 876 933 } 877 934 } 878 935 $articleContent['titles'][] = trim($title); 879 if (isset($title_node->item(0)->parentNode)){936 if (isset($title_node->item(0)->parentNode)) { 880 937 $title_node->item(0)->parentNode->removeChild($title_node->item(0)); 881 938 } 882 939 $articleContent['article_html'][] = $this->dom->saveXML($article); 883 $link = ($this->xpath->query('.//a', $article)->length > 0)?$this->xpath->query('.//a',$article)->item(0)->getAttribute('href'):"";884 $link = (strpos($link, '/') ==0)? $this->domain.$link : $link;885 $articleContent['links'][] = (!empty($link)) ? $link : "";886 $articleContent['domains'][] = (!empty($link)) ? parse_url($link,PHP_URL_SCHEME) ."://". parse_url($link,PHP_URL_HOST) : "";940 $link = ($this->xpath->query('.//a', $article)->length > 0) ? $this->xpath->query('.//a', $article)->item(0)->getAttribute('href') : ""; 941 $link = (strpos($link, '/') == 0) ? $this->domain . $link : $link; 942 $articleContent['links'][] = (!empty($link)) ? $link : ""; 943 $articleContent['domains'][] = (!empty($link)) ? parse_url($link, PHP_URL_SCHEME) . "://" . parse_url($link, PHP_URL_HOST) : ""; 887 944 //smart tags 888 945 $smart_tags = array(); … … 895 952 foreach ($defined_tags as $tag) { 896 953 $tag = trim($tag); 897 $count = $this->countMatches($tag, $title,$article->nodeValue);954 $count = $this->countMatches($tag, $title, $article->nodeValue); 898 955 if ($count > 0) { 899 956 $smart_tags[$tag] = $count; … … 904 961 if (count($this->keywords)) { 905 962 foreach ($this->keywords as $key => $keyword) { 906 $count = $this->countMatches($key, $title,$article->nodeValue);963 $count = $this->countMatches($key, $title, $article->nodeValue); 907 964 if ($count > 0) { 908 965 $smart_tags[$keyword] = $count; … … 916 973 $articleContent['keywords'][] = $smart_tags; 917 974 } 918 private function countMatches($keyword,$title=false,$content=false) 975 976 private function countMatches($keyword, $title = false, $content = false) 919 977 { 920 978 $total_occurrence = 0; 921 979 $tag_in_title = array(); 922 980 $tag_in_content = array(); 923 $title = (!empty($title)) ? $title: $this->title;924 $content = (!empty($content)) ? $content : $this->data;981 $title = (!empty($title)) ? $title : $this->title; 982 $content = (!empty($content)) ? $content : $this->data; 925 983 preg_match_all("/(?<!\w)(?=[^>]*(<|$))" . $keyword . "/i", $title, $tag_in_title); 926 984 preg_match_all("/(?<!\w)(?=[^>]*(<|$))" . $keyword . "/i", $content, $tag_in_content); … … 928 986 return $total_occurrence; 929 987 } 930 931 988 932 989 -
expresscurate/trunk/ExpressCurate_Sitemap.php
r1162493 r1179063 157 157 die; 158 158 } else { 159 $response = array('status'=> 3,'message' => 'ExpressCurate shall be authorized to access to Google Webmaster Tools.');159 $response = array('status'=> 3,'message' => 'ExpressCurate shall be authorized to access to Google Search Console (aka Webmaster Tools).'); 160 160 } 161 161 } -
expresscurate/trunk/ExpressCurate_SocialManager.php
r1172885 r1179063 16 16 const SOCIAL_APPROVED_POST_MESSAGES_META = '_expresscurate_social_approved_post_messages'; 17 17 const SOCIAL_POST_MESSAGES_META = '_expresscurate_social_post_messages'; 18 const SOCIAL_POST_COUNTER = '_expresscurate_social_post_counter'; 18 19 19 20 const APPROVED = 'approved'; … … 37 38 38 39 return self::$instance; 40 } 41 42 public function saveSocialPublishingStatus() { 43 $data = $_REQUEST; 44 $status = $data['status']; 45 if($status == 'off'){ 46 update_option('expresscurate_buffer_access_token', ''); 47 } 48 update_option('expresscurate_social_publishing', $status); 39 49 } 40 50 … … 120 130 } 121 131 132 $publishedPostMessages = $this->getPublishedPostMessages($post_id); 133 122 134 update_post_meta($post_id, self::SOCIAL_APPROVED_POST_MESSAGES_META, $approved); 123 135 update_post_meta($post_id, self::SOCIAL_POST_MESSAGES_META, $allMessages); 136 update_post_meta($post_id, self::SOCIAL_POST_COUNTER, count($approved)+count($publishedPostMessages)); 124 137 } 125 138 … … 142 155 // save the new statuses 143 156 update_post_meta($post_id, self::SOCIAL_PUBLISHED_POST_MESSAGES_META, $publishedPostMessages); 144 update_post_meta($post_id, self::SOCIAL_APPROVED_POST_MESSAGES_META, ''); 157 update_post_meta($post_id, self::SOCIAL_APPROVED_POST_MESSAGES_META, null); 158 update_post_meta($post_id, self::SOCIAL_POST_COUNTER, count($publishedPostMessages)); 145 159 } 146 160 } -
expresscurate/trunk/ExpressCurate_Tags.php
r1137344 r1179063 16 16 17 17 if ((strpos($matches[3], '</a') < strpos($matches[3], '<a')) || strpos($matches[3], '.') !== false) { 18 return '<a class="expresscurate_contentTags" href="' . get_tag_link($this->tag_id) . '">#' . strtolower($matches[0]). '</a>';18 return '<a class="expresscurate_contentTags" href="' . get_tag_link($this->tag_id) . '">#' . $matches[0]. '</a>'; 19 19 } else { 20 20 return $matches[0]; -
expresscurate/trunk/css/expresscurate.css
r1172885 r1179063 638 638 .expresscurate_feed_dashboard .addFeed span span, 639 639 .expresscurate_keywords_settings .addKeywords span span, 640 .expresscurate_settings .addUsers span span, 641 .expresscurate_settings .addKeywords span span, 640 642 .expresscurate_widget_wrapper .addKeywords span span{ 641 643 background: url("../images/plus.svg") no-repeat transparent center; … … 1232 1234 z-index: 90000; 1233 1235 } 1234 1236 .expresscurate_settings .addUsers, 1237 .expresscurate_settings .addKeywords{ 1238 width: 200px; 1239 height: 30px; 1240 overflow: hidden; 1241 margin: 0; 1242 position: relative; 1243 } 1244 1245 .expresscurate_settings .addUsers input, 1246 .expresscurate_settings .addKeywords input, 1235 1247 .expresscurate_widget_wrapper .addKeywords input { 1236 1248 height: 100%; … … 1246 1258 border: none; 1247 1259 } 1260 .expresscurate_settings .addUsers input, 1261 .expresscurate_settings .addKeywords input{ 1262 font-size: 12px; 1263 line-height: 25px; 1264 } 1248 1265 .expresscurate_widget_wrapper .addKeywords input::-webkit-input-placeholder, 1249 1266 .expresscurate_widget_wrapper .addKeywords input:-moz-placeholder { … … 1251 1268 line-height: 14px; 1252 1269 } 1270 .expresscurate_settings .addUsers span , 1271 .expresscurate_settings .addKeywords span , 1253 1272 .expresscurate_widget_wrapper .addKeywords span { 1254 1273 height: 35px; … … 1265 1284 cursor: pointer; 1266 1285 } 1286 .expresscurate_settings .addUsers span, 1287 .expresscurate_settings .addKeywords span{ 1288 height: 30px; 1289 width: 30px; 1290 } 1291 .expresscurate_settings .addUsers span:hover, 1292 .expresscurate_settings .addKeywords span:hover, 1267 1293 .expresscurate_widget_wrapper .addKeywords span:hover{ 1268 1294 background-color: #20d0b1; 1269 1295 } 1296 /*.expresscurate_settings .addKeywords ::-webkit-input-placeholder,*/ 1270 1297 .expresscurate_widget_wrapper ::-webkit-input-placeholder { 1271 1298 padding-top: 3px; … … 2942 2969 .expresscurate .tab-content > div{ 2943 2970 min-height: 70vh; 2944 max-width: 800px;2971 max-width: 1000px; 2945 2972 } 2946 2973 .expresscurate_advancedSEO_widget .tab-link.disabled, … … 3077 3104 margin: 0 0 0 5px; 3078 3105 } 3079 3106 .expresscurate .socialPublishingWrap{ 3107 margin-left: 30px; 3108 } 3109 .expresscurate .socialPublishingWrap li{ 3110 display: inline-block; 3111 } 3112 /*feed stop words*/ 3113 .expresscurate_settings .usersToAlert li, 3114 .expresscurate_settings .stopKeywords li{ 3115 display: inline-block; 3116 border: solid 1px #E6E6E6; 3117 height: 30px; 3118 margin: 0 5px 5px 0 ; 3119 position: relative; 3120 padding: 0 40px 0 10px; 3121 line-height: 28px; 3122 box-sizing: border-box; 3123 -moz-box-sizing: border-box; 3124 -webkit-box-sizing: border-box; 3125 vertical-align: top; 3126 } 3127 .expresscurate_settings .usersToAlert li span, 3128 .expresscurate_settings .stopKeywords li span{ 3129 position: absolute; 3130 width: 30px; 3131 height: 30px; 3132 display: inline-block; 3133 color: #fefefe; 3134 font-size: 30px; 3135 text-align: center; 3136 line-height: 30px; 3137 right: 0; 3138 top: -1px; 3139 box-sizing: border-box; 3140 -moz-box-sizing: border-box; 3141 -webkit-box-sizing: border-box; 3142 cursor: pointer; 3143 background: url("../images/remove.svg") #1cbb9f no-repeat center; 3144 background-size: 16px auto; 3145 } 3146 /**/ 3080 3147 .expresscurate .form-table { 3081 3148 margin-left: 25px; … … 5125 5192 background-position: 6px -64px; 5126 5193 } 5127 .expresscurate_social_box_Twitter:hover{5128 background-color: rgba(0,172,273,0.8);5129 }5130 5194 .expresscurate_social_box_Facebook{ 5131 5195 background-color: rgba(59,89,152,1); 5132 5196 background-position: 5px 0; 5133 5197 } 5134 .expresscurate_social_box_Facebook:hover{5135 background-color: rgba(59,89,152,0.8);5136 }5137 5198 .expresscurate_social_box_LinkedIn{ 5138 5199 background-color: rgba(30,135,189,1); 5139 5200 background-position: 6px -173px; 5140 5201 } 5141 .expresscurate_social_box_LinkedIn:hover{5142 background-color: rgba(30,135,189,0.8);5143 }5144 5202 .expresscurate_social_box_Google{ 5145 5203 background-color: rgba(212,65,50,1); 5146 5204 background-position: 7px -120px; 5147 }5148 .expresscurate_social_box_Google:hover{5149 background-color: rgba(212,65,50,0.8);5150 5205 } 5151 5206 .expresscurate_social_box .dailySuggestions{ -
expresscurate/trunk/css/theme-styles.css
r1106118 r1179063 113 113 resize:both; 114 114 } 115 116 .expresscurate_FacebookEmbed{117 width: 500px;118 height: 300px;119 background-image: url("../images/noimage.png");120 } -
expresscurate/trunk/js/Buttons.js
r1172885 r1179063 183 183 messageHtml += arrOutboundLinks ? '' : '<p class="lengthSuggestion blue">This page contains no outbound links, add some where appropriate.</p>'; 184 184 185 /*social post*/ 186 if($('#expresscurate_social_publishing').length){ 187 if($('.expresscurate_socialPostBlock').length<1){ 188 messageHtml+='<p class="lengthSuggestion blue">You currently have no social posts. Add a couple of them to get more exposure.</p>'; 189 } 190 } 191 185 192 /*keywords validation*/ 186 193 var defKeywords = $('#expresscurate_defined_tags').val(); … … 313 320 var $this = $('#expresscurate_socialEmbed'), 314 321 content = $this.val().trim(), 315 $tabs = $('.expresscurate_socialDialog .tabs li'); 316 $.each($tabs, function (index, value) { 317 var tab = $(value).data('tab'), 318 myRegExp = new RegExp('https?:\/\/([a-zA-Z\d-]+\.){0,}' + tab + '\.com', 'gmi'); 322 $tabs = $('.expresscurate_socialDialog .tabs li'), 323 names = ['youtube', 'youtu', 'vimeo', 'facebook', 'twitter']; 324 $.each(names, function (index, value) { 325 var tab = value, 326 myRegExp = new RegExp('https?:\/\/([a-zA-Z\d-]+\.){0,}' + tab + '(\.com|\.be)', 'gmi'); 319 327 if (myRegExp.test(content)) { 320 328 $tabs.removeClass('current'); 329 if(tab=='youtu'){ 330 tab='youtube'; 331 } 321 332 $('.expresscurate_socialDialog .tabs li.' + tab).addClass('current'); 322 333 } … … 345 356 ($contentWrap.css("display") === "block") ? $contentWrap.focus() : tinyMCE.get("content").focus(); 346 357 var ed = tinymce.activeEditor; 358 ExpressCurateUtils.track('/post/embed-dialog/open'); 347 359 ed.windowManager.open({ 348 360 title: 'Embed', … … 391 403 break; 392 404 } 405 ExpressCurateUtils.track('/post/embed-dialog/insert' + selectedTab); 393 406 if (url) { 394 407 if ($contentWrap.css("display") === "block") { … … 634 647 ed.addCommand('addSocialPost', function () { 635 648 if (tinymce.activeEditor.selection.getContent().length > 1) { 649 ExpressCurateUtils.track('/post/social-post-widget/getselection'); 636 650 var text = tinymce.activeEditor.selection.getContent(), 637 651 myRegExp = new RegExp('(<([^>]+)>)', 'ig'); -
expresscurate/trunk/js/Dialog.js
r1162493 r1179063 393 393 displayCuratedTags(keywords); 394 394 } 395 ExpressCurateUtils.track('/post/content-dialog/cloneload'); 395 396 } else { 396 397 if (data.result.title && data.result.title.length > 0) { -
expresscurate/trunk/js/Settings.js
r1162493 r1179063 22 22 } 23 23 24 function addSettingsListItems($this) { 25 var $stopKeywordsWrap = $this.parents('.controls'), 26 $input = $stopKeywordsWrap.find('input'), 27 $list = $stopKeywordsWrap.find('.defItems'), 28 $definedWrap = $stopKeywordsWrap.find('> textarea'), 29 keywords = ExpressCurateKeywordUtils.multipleKeywords($input, $list, $definedWrap); 30 31 $.each(keywords, function (key, value) { 32 $list.append('<li>' + value + '<span class="close"></span></li>'); 33 }); 34 } 35 24 36 function setupSettings() { 25 37 var $submitSitemap = $('.expresscurate #submitSiteMap'); … … 38 50 $publishDiv.stop(true, true).slideUp('slow'); 39 51 } 40 41 52 }); 42 53 /*settings page traching*/ … … 61 72 }); 62 73 /*social publishing*/ 63 $('#expresscurate_social_publishing').on('change', function () { 74 $('.expresscurate_settings #expresscurate_social_publishing').on('change', function () { 75 var $this = $(this), 76 $token = $('#expresscurateBufferAccessToken'), 77 status = $this.is(':checked') ? 'on' : 'off'; 64 78 showHideOptions($('.socialPublishingWrap'), $(this)); 79 if ($this.is(':checked')) { 80 $token.removeClass('expresscurate_displayNone'); 81 } else { 82 $token.addClass('expresscurate_displayNone'); 83 } 84 85 $.ajax({ 86 type: 'POST', 87 url: 'admin-ajax.php?action=expresscurate_save_social_publishing_status', 88 data: {status: status} 89 }); 65 90 }); 66 91 $('html').on('change', '.expresscurate_social_publishing_profile', function () { … … 86 111 }); 87 112 113 /*stop keywords for feed*/ 114 $('.expresscurate_settings .addKeywords input').on('keyup', function (e) { 115 116 var $this = $(this); 117 e.preventDefault(); 118 e.stopPropagation(); 119 if (e.keyCode === 13) { 120 addSettingsListItems($this); 121 } 122 }); 123 $('.expresscurate_settings .addKeywords span span').on('click', function () { 124 addSettingsListItems($(this)); 125 }); 126 127 $('.expresscurate_settings .stopKeywords').on('click', ' li span', function () { 128 var $this = $(this), 129 $elem = $this.parent('li'), 130 $defWrap = $this.parents('.controls').find(' > textarea'); 131 ExpressCurateKeywordUtils.close(ExpressCurateKeywordUtils.justText($elem), $elem, $defWrap); 132 }); 133 /*content alert users*/ 134 $('.expresscurate_settings .addUsers input').on('keyup', function (e) { 135 var $this = $(this), 136 allUsers = $('#expresscurate_allUsers').val().split(','); 137 $this.autocomplete({source: allUsers}); 138 139 if (e.keyCode === 13) { 140 if ($.inArray($this.val(), allUsers) > -1) { 141 addSettingsListItems($this); 142 } 143 } 144 }); 145 $('.expresscurate_settings .addUsers span span').on('click', function () { 146 var $this = $(this), 147 $user = $this.parents('.addUsers').find('input'), 148 allUsers = $('#expresscurate_allUsers').val().split(','); 149 150 if ($.inArray($user.val(), allUsers) > -1) { 151 addSettingsListItems($this); 152 } 153 }); 154 155 $('.expresscurate_settings .usersToAlert').on('click', ' li span', function () { 156 var $this = $(this), 157 $elem = $this.parent('li'), 158 $defWrap = $this.parents('.controls').find(' > textarea'); 159 ExpressCurateKeywordUtils.close(ExpressCurateKeywordUtils.justText($elem), $elem, $defWrap); 160 }); 88 161 /*sitemap*/ 89 162 $('#expresscurate_sitemap_submit').on('change', function () { … … 120 193 } else { 121 194 $submitSitemap.addClass('expresscurate_displayNone').removeClass('generated'); 122 $submitSitemap.after('<p class="expresscurate_Error expresscurate_SettingsError">Something went wrong. Please, make sure you have authorized ExpressCurate to access to Google Webmaster Tools.</p>');195 $submitSitemap.after('<p class="expresscurate_Error expresscurate_SettingsError">Something went wrong. Please, make sure you have authorized ExpressCurate to access to Google Search Console (aka Webmaster Tools).</p>'); 123 196 } 124 197 }); … … 175 248 $(this).next('span').children('a').attr('href', rest + $(this).val()); 176 249 }); 250 251 252 $('.expresscurate_settings').keydown(function (event) { 253 if (event.keyCode === 13) { 254 event.preventDefault(); 255 return false; 256 } 257 }); 177 258 } 178 259 -
expresscurate/trunk/js/keywords/KeywordUtils.js
r1106118 r1179063 2 2 var autoCompleteRequest; 3 3 4 function checkKeyword(text, listName ) {4 function checkKeyword(text, listName,defElem) { 5 5 if (text !== '') { 6 6 text = text.replace(/[,.;:?!]+/g, '').trim(); 7 var $defTags = $('textarea[name=expresscurate_defined_tags]'),7 var $defTags =defElem ? defElem : $('textarea[name=expresscurate_defined_tags]'), 8 8 defVal = justText($defTags).replace(/\s{2,}/g, ' '), 9 9 $widget = $('#expresscurate_widget'), 10 $errorMessage=$widget.find('.expresscurate_errorMessage'), 11 defValArr = defVal.split(', '), 12 rslt; 10 $errorMessage = $widget.find('.expresscurate_errorMessage'), 11 defValArr = defVal.split(', '); 13 12 $errorMessage.remove(); 14 13 if (text.length < 3 && $widget.length) { 15 14 $errorMessage.text('This keyword is too short. We recommend keywords with at least 3 characters.'); 16 15 } else { 17 rslt = null;18 16 for (var i = 0; i < defValArr.length; i++) { 19 17 if (defValArr[i].toLowerCase() === text.toLowerCase()) { 20 rslt = (i + 1);21 18 if ($widget.length > 0) { 22 19 highlight(text, $widget.find(' .statisticsTitle')); … … 26 23 text = ''; 27 24 break; 28 } else {29 rslt = -1;30 25 } 31 26 } … … 49 44 } 50 45 51 function multipleKeywords(el, listName ) {46 function multipleKeywords(el, listName,defElem) { 52 47 var keywords = '', 53 48 arr, … … 63 58 arr = keywords.split(/,|:|;|[\\.]/); 64 59 for (var i = 0; i < arr.length; i++) { 65 var checkedKeyword = checkKeyword(arr[i], listName );60 var checkedKeyword = checkKeyword(arr[i], listName,defElem); 66 61 if (checkedKeyword.length > 0) { 67 62 result.push(checkedKeyword); … … 71 66 } 72 67 73 function close(keyword, elemToRemove) { 74 var $defTags = $('textarea[name=expresscurate_defined_tags]'), 75 newVal = justText($defTags).toLocaleLowerCase(), 76 lastChar = ''; 77 78 newVal = newVal.replace(keyword.toLocaleLowerCase(), ''); 79 newVal = newVal.replace(', ,', ','); 68 function close(keyword, elemToRemove, defElem) { 69 70 var $defTags =defElem ? defElem : $('textarea[name=expresscurate_defined_tags]'), 71 newVal = justText($defTags).toLocaleLowerCase().trim(), 72 lastChar = '', 73 myRegExp = new RegExp('(, |^)' + keyword.toLocaleLowerCase() + '(,|$)', 'gmi'); 74 75 newVal = newVal.replace(myRegExp, ''); 80 76 lastChar = newVal.slice(-2); 81 77 if (lastChar === ', ') { … … 131 127 var liHTML = '', 132 128 text = input.val(), 133 $autoComplete =$('.suggestion');129 $autoComplete = $('.suggestion'); 134 130 if (autoCompleteRequest && autoCompleteRequest.readystate !== 4) { 135 131 autoCompleteRequest.abort(); -
expresscurate/trunk/js/keywords/Keywords.js
r1129694 r1179063 153 153 var matches = ed.getBody(), 154 154 i = 0; 155 155 156 keywords = keywords.sort(function (a, b) { 156 return b > a 157 }); 157 return b.length > a.length 158 }); 159 158 160 keywords.forEach(function (val) { 159 161 $(matches).html(function (index, oldHTML) { -
expresscurate/trunk/js/keywords/SEOControlCenter.js
r1137344 r1179063 284 284 $noFollow.add($noIndex).attr('disabled',false); 285 285 } 286 287 ExpressCurateUtils.track('/post/seo-control-center/clonestatuschange'); 286 288 }); 287 289 $('.expresscurate_moveToAdvanced').on('click', function () { -
expresscurate/trunk/js/socialPostWidget.js
r1172885 r1179063 14 14 var $contentWrap = $('#content'), 15 15 content = (($contentWrap.css("display") === "block") ? $contentWrap.val() : tinyMCE.get("content").getContent()), 16 myRegExp = new RegExp('(<([^>]+)>)', 'ig'); 16 myRegExp = new RegExp('(<([^>]+)>)', 'ig'), 17 li = $(content).find('li'), 18 posts = []; 19 20 if (li.length) { 21 $.each(li, function (index, value) { 22 var text = $(value).text(); 23 posts.push(text); 24 content = content.replace(text, ''); 25 }); 26 } 17 27 18 28 content = content.split('<p>'); … … 20 30 content[i] = content[i].replace(myRegExp, ' ').trim(); 21 31 } 22 content = content.filter(function (el) { 32 33 var result = $.merge(posts, content); 34 result = result.filter(function (el) { 23 35 return el.length !== 0; 24 36 }); 25 37 26 return content;38 return result; 27 39 } 28 40 … … 33 45 message: $(content).find(header).text() 34 46 }; 47 ExpressCurateUtils.track('/post/social-post-widget/get' + header); 35 48 if (data.message.length > 1) { 36 49 createSocialPost(data); … … 114 127 if (value.id == blockId) { 115 128 value.message = text; 129 value.postLength = maxLength - text.length; 116 130 updatePosts(posts); 117 131 } … … 150 164 createSocialPost(data); 151 165 }); 166 ExpressCurateUtils.track('/post/social-post-widget/getcontent'); 152 167 }); 153 168 /*add new*/ 154 169 $('#expresscurate_addTweet').on('click', function () { 155 170 createSocialPost(null); 171 ExpressCurateUtils.track('/post/social-post-widget/createnew'); 156 172 }); 157 173 /*post from headers*/ … … 166 182 message: $('#expresscurate_advanced_seo_social_title').val() 167 183 }; 184 ExpressCurateUtils.track('/post/social-post-widget/socialtitle'); 168 185 createSocialPost(data); 169 186 } … … 176 193 message: $('#expresscurate_advanced_seo_social_desc').val() 177 194 }; 195 ExpressCurateUtils.track('/post/social-post-widget/socialdescription'); 178 196 createSocialPost(data); 179 197 } … … 186 204 message: $('#expresscurate_advanced_seo_social_shortdesc').val() 187 205 }; 206 ExpressCurateUtils.track('/post/social-post-widget/socialshortdescription'); 188 207 createSocialPost(data); 189 208 } … … 206 225 } 207 226 }); 208 227 ExpressCurateUtils.track('/post/social-post-widget/approve'); 209 228 updatePosts(posts); 210 229 … … 247 266 var clone = $.extend({}, post); 248 267 clone.id = uniqueId(); 268 clone.postLength = maxLength - clone.message.length; 249 269 posts.push(clone); 250 251 updatePosts(posts); 252 $('.mainControls').after(ExpressCurateUtils.getTemplate('socialPostWidget', post)); 253 254 255 }); 256 270 ExpressCurateUtils.track('/post/social-post-widget/copy'); 271 updatePosts(posts); 272 $block.before(ExpressCurateUtils.getTemplate('socialPostWidget', post)); 273 }); 257 274 } 258 275 -
expresscurate/trunk/readme.txt
r1172885 r1179063 1 1 === ExpressCurate === 2 2 Contributors: expresscurate 3 Tags: content curation, content marketing, curation plugin, content curation plugin, curation tools, content curation tools, content curation toolkit, content writing, attribution, content, curation, curating, rss, feed, keywords summary, keywords dashboard, seo control center, keyword, seo, sitemap, google webmasters, google, widget, bookmark3 Tags: content curation, content marketing, curation plugin, content curation plugin, curation tools, content curation tools, content curation toolkit, content writing, attribution, content, curation, curating, rss, feed, keywords summary, keywords dashboard, seo control center, keyword, seo, sitemap, search console, google, widget, bookmark, social, twitter 4 4 Donate link: https://bit.ly/expresscuratedonate 5 5 Requires at least: 3.9 6 6 Tested up to: 4.2.2 7 Stable tag: 2.1. 07 Stable tag: 2.1.1 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl.html … … 81 81 82 82 = How To Get Started = 83 [Download ExpressCurate plugin](http://downloads.wordpress.org/plugin/expresscurate.2.1. 0.zip "Your favorite content marketing tools") for WordPress.83 [Download ExpressCurate plugin](http://downloads.wordpress.org/plugin/expresscurate.2.1.1.zip "Your favorite content marketing tools") for WordPress. 84 84 You can also [download](http://www.expresscurate.com/p/products/wordpress-theme "Your favorite WordPress Theme") a **free** [ExpressCurate WordPress theme](http://www.expresscurate.com/p/products/wordpress-theme "Your favorite WordPress Theme"). It will give your curated content a modern online news look. 85 85 … … 113 113 05. Post - Curate Content: Load the passages of choice into the post, and curate! 114 114 06. Post - Styling, Editing, Analytics: When editing a post, use the toolbar for keyword highlights, box styles and access to post analysis. 115 07. Post - Embed: Provide an embed code from Facebook, Twitter, YouTube or Vimeo and have the proper card inserted into your post.115 07. Post - Embed: Provide an embed code from Facebook, Twitter, YouTube or Vimeo and have the proper card inserted into your post. 116 116 08. Post - Embed: Embed multiple posts to create stories. 117 117 09. Post - SEO Control Center: Pick relevant keyword density and create meta descriptions using the SEO Control Center. … … 119 119 11. Post Analysis: Use Post analysis to receive improvement suggestions for your content! 120 120 12. Post - Sources: Access the list of Sources from which content is pulled and check for the number of posts curated from these sources. 121 13. Keywords Dashboard 122 14. RSS Feeds 123 15. Top Sources 124 16. Settings 125 17. FAQ: See FAQs for common usage hints and questions. 121 13. Social Publishing Widget: Use the social publishing widget for social media promotions, content optimization & sharing. 122 14. Keywords Dashboard 123 15. RSS Feeds 124 16. Top Sources 125 17. Settings 126 18. FAQ: See FAQs for common usage hints and questions. 126 127 127 128 … … 130 131 131 132 == Changelog == 133 134 = 2.1.1 = 135 * New Setting: Stop Keywords. Content Feed will filter out the posts that contain these stop words. 136 * New Setting: Content Alert Users. Content (Keyword Match) Alert will be sent to the specified users only. 137 * New Feature: All Posts now shows the number of approved social promotion messages. 138 * Miscellaneous bug fixes and improvements. 132 139 133 140 = 2.1.0 = -
expresscurate/trunk/templates/dashboard.php
r1172885 r1179063 27 27 <div class="expresscurate_blocksContainer expresscurate_masonryWrap"> 28 28 <?php 29 $dashboard_order = get_option('dashboard_items_order'); 29 $dashboard_order = get_option('dashboard_items_order') ? get_option('dashboard_items_order') : array(); 30 $allWidgets = array('keyWords', 'keyWordsIntOverTime', 'keyWordsRelTopics', 'smartPublish', 'socialPublish', 'feedWidget', 'bookmarks', 'support'); 31 foreach ($allWidgets as $item) { 32 if (!in_array($item, $dashboard_order)) { 33 $dashboard_order[] = $item; 34 } 35 } 30 36 if (!empty($dashboard_order)) { 31 37 foreach ($dashboard_order as $ordered_item): … … 103 109 endif; 104 110 endforeach; 105 } else { 106 ?> 107 <div id='keyWords' class="expresscurate_keywordsBlock expresscurate_masonryItem"> 108 <label class="label">Keywords Summary</label> 109 <?php $this->keywords_widget(); ?> 110 </div> 111 112 <div id='keyWordsIntOverTime' class="expresscurate_keywordsBlock expresscurate_masonryItem"> 113 <label class="label">Keywords Interest Over Time</label> 114 <?php $this->keywords_interest_over_time_widget(); ?> 115 </div> 116 117 <div id='keyWordsRelTopics' class="expresscurate_keywordsBlock expresscurate_masonryItem"> 118 <label class="label">Keywords Related Topics</label> 119 <?php $this->keywords_related_topics_widget(); ?> 120 </div> 121 122 <?php 123 if (get_option('expresscurate_publish', '') == "on") { ?> 124 <div id="smartPublish" class="expresscurate_smartPublishBlock expresscurate_masonryItem"> 125 <label class="label">Smart Publishing Overview</label> 126 <?php $this->smart_publishing_widget(); ?> 127 </div> 128 <?php } ?> 129 130 <?php 131 if (get_option('expresscurate_social_publishing', '') == "on" && strlen(get_option('expresscurate_buffer_access_token')) > 2) { ?> 132 <div id="socialPublish" class="expresscurate_socialPublishBlock expresscurate_masonryItem"> 133 <label class="label">Social Publishing Overview</label> 134 <?php $this->social_publishing_widget(); ?> 135 </div> 136 <?php } ?> 137 138 <div id="feedWidget" class="expresscurate_feedBlock expresscurate_masonryItem"> 139 <label class="label">Feed</label> 140 <?php $this->feed_widget(); ?> 141 </div> 142 143 <div id="bookmarks" class="expresscurate_bookmarksBlock expresscurate_masonryItem"> 144 <label class="label">Bookmarks</label> 145 <?php $this->bookmarks_widget(); ?> 146 </div> 147 148 149 <div id='support' class="expresscurate_supportBlock expresscurate_masonryItem"> 150 <label class="label">Support</label> 151 152 <div> 153 <?php if (!$sent) { ?> 154 <label for="expresscurate_support_email">Leave your feedback</label> 155 <?php 156 } else { 157 ?> 158 <label for="expresscurate_support_email">Thanks for your feedback</label> 159 <?php 160 } 161 ?> 162 <form method="post" action="<?php echo get_admin_url() ?>admin.php?page=expresscurate" 163 id="expresscurate_support_form"> 164 <input id="expresscurate_support_email" name="expresscurate_support_email" class="inputStyle" 165 placeholder="Email" 166 value="<?php echo $user_email ?>"/> 167 <label for="expresscurate_support_email" class="expresscurate_errorMessage"></label> 168 <textarea class="inputStyle" name="expresscurate_support_message" id="expresscurate_support_message" 169 placeholder="Message"></textarea> 170 <label for="expresscurate_support_message" class="expresscurate_errorMessage"></label> 171 <a class="feedbackButton send greenBackground" href="#">Send</a> 172 </form> 173 </div> 174 </div> 175 <?php 176 } 177 ?> 178 179 111 } ?> 180 112 </div> 181 113 </div> -
expresscurate/trunk/templates/dashboard/social_publishing_widget.php
r1172885 r1179063 9 9 <?php 10 10 if (!empty($profiles)) { 11 $profilesStatus = array(); 12 if (get_option('expresscurate_social_publishing_profiles', '')) { 13 $profilesStatus = json_decode(stripslashes(urldecode(get_option('expresscurate_social_publishing_profiles', '')))); 14 } 11 15 foreach ($profiles as $i => $profile) { 12 $counts = $profile->counts; 13 $formatedService= (strpos($profile->formatted_service,'Google') !== false)? 'Google' :$profile->formatted_service; 14 ?> 15 <li class="expresscurate_background_wrap"> 16 <div class="expresscurate_social_box expresscurate_social_box_<?php echo $formatedService; ?>"> 17 <span class="text"><?php echo $profile->formatted_username ?></span> 18 <span class="dailySuggestions"><span class="tooltip">daily suggestions</span><?php echo $counts->daily_suggestions; ?></span> 19 </div> 20 <div title="" class="statistics borderRight"> 21 <div class="center">sent<br/><span><?php echo $counts->sent; ?></span></div> 22 </div> 23 <div title="" class="statistics borderRight"> 24 <div>pending<span><?php echo $counts->pending; ?></span></div> 25 </div> 26 <div title="" class="statistics"> 27 <div>drafts<span><?php echo $counts->drafts; ?></span></div> 28 </div> 29 </li> 16 $profileId = $profile->id; 30 17 31 <?php 18 if ($profilesStatus->$profileId == 'on' || empty($profilesStatus->$profileId)) { 19 $counts = $profile->counts; 20 $formatedService = (strpos($profile->formatted_service, 'Google') !== false) ? 'Google' : $profile->formatted_service; 21 ?> 22 <li class="expresscurate_background_wrap"> 23 <div 24 class="expresscurate_social_box expresscurate_social_box_<?php echo $formatedService; ?>"> 25 <span class="text"><?php echo $profile->formatted_username ?></span> 26 <span class="dailySuggestions"><span 27 class="tooltip">daily suggestions</span><?php echo $counts->daily_suggestions; ?></span> 28 </div> 29 <div title="" class="statistics borderRight"> 30 <div class="center">sent<br/><span><?php echo $counts->sent; ?></span></div> 31 </div> 32 <div title="" class="statistics borderRight"> 33 <div>pending<span><?php echo $counts->pending; ?></span></div> 34 </div> 35 <div title="" class="statistics"> 36 <div>drafts<span><?php echo $counts->drafts; ?></span></div> 37 </div> 38 </li> 39 <?php } 40 32 41 } 33 42 } else { -
expresscurate/trunk/templates/settings.php
r1172885 r1179063 313 313 <?php 314 314 $blogName = urlencode(urlencode(get_bloginfo('url'))); 315 $socialPublishingStatus= get_option('expresscurate_social_publishing', '') == 'On' ? 'On' : 'Off'; 315 316 ?> 316 <a class="getApiKey <?php if (strlen(get_option('expresscurate_buffer_access_token')) > 2) { 317 echo 'expresscurate_displayNone'; 317 318 <a id="expresscurateBufferAccessToken" class="getApiKey <?php if (strlen(get_option('expresscurate_buffer_access_token')) > 2 || $socialPublishingStatus=='Off') { 319 echo 'expresscurate_displayNone defined'; 318 320 } ?>" 319 321 href="https://www.expresscurate.com/api/connector/buffer/accesstoken/<?php echo $blogName ?>">Authorize 320 322 access to Buffer</a> 321 323 </li> 322 <div class="socialPublishingWrap <?php if (get_option('expresscurate_social_publishing', '') !== "on") { 324 <div 325 class="socialPublishingWrap <?php if (get_option('expresscurate_social_publishing', '') !== "on") { 323 326 echo 'expresscurate_displayNone'; 324 327 } ?> "> … … 345 348 name="expresscurate_social_publishing_<?php echo $profileId; ?>" <?php if ($profilesStatus->$profileId == 'on' || empty($profilesStatus->$profileId)) { 346 349 echo 'checked="checked"'; 347 } ?> />350 } ?> /> 348 351 <label class="controls checkboxLabel" 349 352 for="expresscurate_social_publishing_<?php echo $profileId; ?>"></label> … … 352 355 } 353 356 ?> 354 <input type="hidden" value="<?php echo stripslashes(get_option('expresscurate_social_publishing_profiles', '')); ?>" id="expresscurate_social_publishing_profiles" name="expresscurate_social_publishing_profiles"/> 357 <input type="hidden" 358 value="<?php echo stripslashes(get_option('expresscurate_social_publishing_profiles', '')); ?>" 359 id="expresscurate_social_publishing_profiles" 360 name="expresscurate_social_publishing_profiles"/> 355 361 <?php 356 362 } … … 529 535 <li> 530 536 <div class="title"> 537 Stop Keywords 538 <div class="description"> 539 ExpressCurate will filter out the posts that contain any stop keywords. 540 </div> 541 </div> 542 <div class="controls"> 543 <?php $defStopKeywords = get_option('expresscurate_content_stop_keywords', ''); ?> 544 <textarea class="expresscurate_displayNone" name="expresscurate_content_stop_keywords" 545 id="expresscurate_content_stop_keywords" cols="30" rows="10"> 546 <?php echo $defStopKeywords ?> 547 </textarea> 548 <ul class="stopKeywords defItems"> 549 <?php 550 $stopKeywords = explode(', ', $defStopKeywords); 551 if (!empty($stopKeywords)) { 552 foreach ($stopKeywords as $keyword) { 553 if (!empty($keyword)) { 554 echo '<li>' . $keyword . '<span class="close"></span></li>'; 555 } 556 } 557 } 558 ?> 559 </ul> 560 <div class="addKeywords"> 561 <input type="text" placeholder="Add Keywords" class="expresscurate_disableInputStyle"/> 562 <span class=""><span></span></span> 563 <ul class="suggestion"></ul> 564 </div> 565 </div> 566 </li> 567 <li> 568 <div class="title"> 531 569 Keyword Match Email Alerts 532 570 <div class="description"> … … 539 577 <label class="controls checkboxLabel" for="expresscurate_enable_content_alert"></label> 540 578 </li> 541 <li class="emailAlertSlider <?php if (get_option('expresscurate_enable_content_alert') != 'on') echo 'expresscurate_displayNone'; ?>"> 542 <div class="title"> 543 Content Alert Frequency 544 <div class="description"> 545 How frequently should ExpressCurate send content Alert Email (from RSS feeds, Alerts, 546 etc) 547 </div> 548 </div> 549 <select class="controls" id="expresscurate_content_alert_frequency" 550 name="expresscurate_content_alert_frequency"> 551 <?php 552 for ($i = 1; $i < 14; $i++) { 553 ?> 554 <?php if ($i == 1) { ?> 555 <option value="<?php echo $i; ?>" <?php 556 if (get_option('expresscurate_content_alert_frequency') == $i) { 557 echo 'selected="selected"'; 558 } 559 ?>>Every hour 560 </option> 561 562 <?php } elseif ($i == 13) { ?> 563 <option value="<?php echo $i; ?>" <?php 564 if (get_option('expresscurate_content_alert_frequency') == $i) { 565 echo 'selected="selected"'; 566 } 567 ?>>Once a day 568 </option> 569 570 <?php } else { ?> 571 <option value="<?php echo $i; ?>" <?php 572 if (get_option('expresscurate_content_alert_frequency') == $i) { 573 echo 'selected="selected"'; 574 } 575 ?>>Every <?php echo $i; ?> hours 576 </option> 577 578 <?php 579 } 580 } 581 ?> 582 </select> 583 </li> 579 <div 580 class="emailAlertSlider <?php if (get_option('expresscurate_enable_content_alert') != 'on') echo 'expresscurate_displayNone'; ?>"> 581 <li> 582 <div class="title"> 583 Content Alert Frequency 584 <div class="description"> 585 How frequently should ExpressCurate send content Alert Emails (from RSS feeds, 586 Alerts, 587 etc) 588 </div> 589 </div> 590 <select class="controls" id="expresscurate_content_alert_frequency" 591 name="expresscurate_content_alert_frequency"> 592 <?php 593 for ($i = 1; $i < 14; $i++) { 594 ?> 595 <?php if ($i == 1) { ?> 596 <option value="<?php echo $i; ?>" <?php 597 if (get_option('expresscurate_content_alert_frequency') == $i) { 598 echo 'selected="selected"'; 599 } 600 ?>>Every hour 601 </option> 602 603 <?php } elseif ($i == 13) { ?> 604 <option value="<?php echo $i; ?>" <?php 605 if (get_option('expresscurate_content_alert_frequency') == $i) { 606 echo 'selected="selected"'; 607 } 608 ?>>Once a day 609 </option> 610 611 <?php } else { ?> 612 <option value="<?php echo $i; ?>" <?php 613 if (get_option('expresscurate_content_alert_frequency') == $i) { 614 echo 'selected="selected"'; 615 } 616 ?>>Every <?php echo $i; ?> hours 617 </option> 618 619 <?php 620 } 621 } 622 ?> 623 </select> 624 625 </li> 626 <li> 627 <div class="title"> 628 Users 629 <div class="description"> 630 Define who should get content alerts. 631 </div> 632 </div> 633 <div class="controls"> 634 <?php $defUsers = get_option('expresscurate_content_alert_users', ''); ?> 635 <textarea class="expresscurate_displayNone" name="expresscurate_content_alert_users" 636 id="expresscurate_content_alert_users" cols="30" rows="10"> 637 <?php echo $defUsers; ?> 638 </textarea> 639 <ul class="usersToAlert defItems"> 640 <?php 641 $users = explode(', ', $defUsers); 642 if (!empty($users)) { 643 foreach ($users as $user) { 644 if (!empty($user)) { 645 echo '<li>' . $user . '<span class="close"></span></li>'; 646 } 647 } 648 } 649 ?> 650 </ul> 651 <div class="addUsers"> 652 <input type="text" placeholder="Add Users" class="expresscurate_disableInputStyle"/> 653 <span class=""><span></span></span> 654 <?php 655 $blogusers = get_users(); 656 657 foreach ($blogusers as $user) { 658 if ($user->roles[0] != 'subscriber') { 659 $names[] = $user->user_login; 660 } 661 } 662 $allUsers = implode(',', $names); 663 if (!empty($allUsers)) { 664 echo '<textarea class="expresscurate_displayNone" name="" 665 id="expresscurate_allUsers" value="' . $allUsers . '" >' . $allUsers . '</textarea>'; 666 } 667 ?> 668 </div> 669 </div> 670 </li> 671 </div> 672 584 673 </ul> 585 674 <div class="centerSave"> -
expresscurate/trunk/templates/sitemap.php
r1162493 r1179063 169 169 $blogName = urlencode(urlencode(get_bloginfo('url'))); 170 170 ?> 171 <a class="getApiKey <?php if (strlen(get_option('expresscurate_google_refresh_token')) > 2) {echo 'expresscurate_displayNone';}?>" href="https://www.expresscurate.com/api/connector/google/webmasters/refreshtoken/<?=$blogName?>">Authorize access to Google Webmaster Tools</a>171 <a class="getApiKey <?php if (strlen(get_option('expresscurate_google_refresh_token')) > 2) {echo 'expresscurate_displayNone';}?>" href="https://www.expresscurate.com/api/connector/google/webmasters/refreshtoken/<?=$blogName?>">Authorize access to Google Search Console (aka Webmaster Tools)</a> 172 172 </div> 173 173 </li> -
expresscurate/trunk/templates/social_posts_widget.php
r1172885 r1179063 11 11 $publishedPosts = get_post_meta($post->ID, '_expresscurate_social_published_post_messages', true); 12 12 $posts = get_post_meta($post->ID, '_expresscurate_social_post_messages', true); 13 $postLength = 110;14 13 ?> 15 14 <div class="expresscurate_social_post_widget"> … … 17 16 18 17 <input type="hidden" id="expresscurate_social_post_messages" name="expresscurate_social_post_messages" 19 value="<?php echo htmlspecialchars(json_encode($posts), ENT_QUOTES); ?>"/>18 value="<?php echo htmlspecialchars(json_encode($posts), ENT_QUOTES); ?>"/> 20 19 21 20 … … 37 36 if (!empty($posts)) { 38 37 foreach ($posts as $i => $data) { 39 $postLengthCount = $postLength - strlen($data['message']);40 $approved =$data['approved'];?>38 $postLengthCount = ($data['postLength']); 39 $approved = $data['approved']; ?> 41 40 <div class="expresscurate_socialPostBlock" id="<?php echo $data['id']; ?>"> 42 41 <ul class="topControls"> 43 42 44 43 <?php if (!empty($profiles)) { ?> 45 <select name="profile" id="profile" <?php if ($approved) echo 'disabled="disabled"' ?> >44 <select name="profile" id="profile" <?php if ($approved) echo 'disabled="disabled"' ?> > 46 45 <?php 47 46 foreach ($profiles as $profile) { … … 53 52 echo 'selected="selected"'; 54 53 } 55 ?> value="<?php echo $profileId; ?>"><?php echo $profile->formatted_service; ?> / <?php echo $profile->formatted_username; ?></option> 54 ?> value="<?php echo $profileId; ?>"><?php echo $profile->formatted_service; ?> 55 / <?php echo $profile->formatted_username; ?></option> 56 56 <?php } 57 57 } ?> … … 59 59 <?php } ?> 60 60 61 <li class="close expresscurate_floatRight <?php if ($approved) echo 'expresscurate_displayNone' ?> "></li>61 <li class="close expresscurate_floatRight <?php if ($approved) echo 'expresscurate_displayNone' ?> "></li> 62 62 <div class="expresscurate_clear"></div> 63 63 </ul> 64 <textarea name="" class="expresscurate_social_post_content expresscurate_disableInputStyle" <?php if($approved) echo 'readonly="readonly"' ?> 64 <textarea name="" 65 class="expresscurate_social_post_content expresscurate_disableInputStyle" <?php if ($approved) echo 'readonly="readonly"' ?> 65 66 id=""><?php echo $data['message']; ?></textarea> 66 67 <ul class="bottomControls"> 67 <li class="expresscurate_social_widget_buttons expresscurate_floatRight <?php if($approved) echo 'expresscurate_displayNone' ?> approve">Approve</li> 68 <li class="expresscurate_social_widget_buttons expresscurate_floatRight <?php if($approved) echo 'expresscurate_displayNone' ?> clone">Copy</li> 69 <li class="expresscurate_socialPostLength <?php if($approved) echo 'expresscurate_displayNone' ?> expresscurate_floatRight <?php if ($postLengthCount < 0) echo 'error'; ?>"><?php echo $postLengthCount; ?></li> 70 <li class="expresscurate_social_widget_buttons <?php if(!$approved) echo 'expresscurate_displayNone' ?> edit">Edit</li> 68 <li class="expresscurate_social_widget_buttons expresscurate_floatRight <?php if ($approved) echo 'expresscurate_displayNone' ?> approve"> 69 Approve 70 </li> 71 <li class="expresscurate_social_widget_buttons expresscurate_floatRight <?php if ($approved) echo 'expresscurate_displayNone' ?> clone"> 72 Copy 73 </li> 74 <li class="expresscurate_socialPostLength <?php if ($approved) echo 'expresscurate_displayNone' ?> expresscurate_floatRight <?php if ($postLengthCount < 0) echo 'error'; ?>"><?php echo $postLengthCount; ?></li> 75 <li class="expresscurate_social_widget_buttons <?php if (!$approved) echo 'expresscurate_displayNone' ?> edit"> 76 Edit 77 </li> 71 78 <div class="expresscurate_clear"></div> 72 79 </ul> … … 103 110 if ($profilesStatus->$profileId == 'on' || empty($profilesStatus->$profileId)) { 104 111 ?> 105 <option value="<?php echo $profileId; ?>"><?php echo $profile->formatted_service; ?> / <?php echo $profile->formatted_username; ?></option> 112 <option value="<?php echo $profileId; ?>"><?php echo $profile->formatted_service; ?> 113 / <?php echo $profile->formatted_username; ?></option> 106 114 <?php } 107 115 } ?>
Note: See TracChangeset
for help on using the changeset viewer.