Plugin Directory

Changeset 436198


Ignore:
Timestamp:
09/11/2011 03:22:27 AM (15 years ago)
Author:
freerobby
Message:

Adding the category page support

Location:
sexybookmarks/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sexybookmarks/trunk/includes/public.php

    r436195 r436198  
    375375              $shrsb_js_params['shr-publisher-'.$post->ID] = $config;
    376376        }
     377        shrsb_log("Manual:Content Analysis returning ");
    377378        return $post_content;
    378379    }
     
    380381    // If user selected hide from mobile and is mobile, get out.
    381382    elseif ($shrsb_plugopts['mobile-hide']=='yes' && false!==$shrsb_is_mobile || $shrsb_plugopts['mobile-hide']=='yes' && false!==$shrsb_is_bot) {
    382         return $post_content;
    383     }
    384 
     383        shrsb_log("Not Manual:Content Analysis returning");
     384        return $post_content;
     385    }
     386   
    385387    $output = "";
    386388    $likeButtonSetTop = "";
     
    388390   
    389391    // Decide whether or not to generate the bookmarks.
    390     if ((is_single() && false!==strpos($shrsb_plugopts['pageorpost'],"post")) || (is_page() && false!==strpos($shrsb_plugopts['pageorpost'],"page")) || (is_home() && false!==strpos($shrsb_plugopts['pageorpost'],"index")) || (is_feed() && !empty($shrsb_plugopts['feed']))) {
     392    if (    (is_single() && false!==strpos($shrsb_plugopts['pageorpost'],"post")) ||
     393            (is_page() && false!==strpos($shrsb_plugopts['pageorpost'],"page")) ||
     394            (is_home() && false!==strpos($shrsb_plugopts['pageorpost'],"index")) ||
     395            (is_category() && false!==strpos($shrsb_plugopts['pageorpost'],"category") ) ||
     396            (is_feed() && !empty($shrsb_plugopts['feed']))) {
     397   
    391398    // socials should be generated and added
    392     if( ($hide_sexy = get_post_meta($post->ID, 'Hide SexyBookmarks', true))  != 1 ){
    393       if ($shrsb_plugopts['shareaholic-javascript'] == '1') {
    394         $output = '<div class="shr-publisher-'.$post->ID.'"></div>';
    395         $likeButtonSetTop = get_shr_like_buttonset('Top', 1);
    396         $likeButtonSetBottom = get_shr_like_buttonset('Bottom', 1);
    397         $config = shrsb_get_publisher_config($post->ID);
    398 
    399         $shrsb_js_params['shr-publisher-'.$post->ID] = $config;
    400       }
    401       else {
    402         $output=get_sexy();
    403       }
    404     }
    405   }
    406 
     399        if( ($hide_sexy = get_post_meta($post->ID, 'Hide SexyBookmarks', true))  != 1 ){
     400            if ($shrsb_plugopts['shareaholic-javascript'] == '1') {
     401                $output = '<div class="shr-publisher-'.$post->ID.'"></div>';
     402                $likeButtonSetTop = get_shr_like_buttonset('Top', 1);
     403                $likeButtonSetBottom = get_shr_like_buttonset('Bottom', 1);
     404                $config = shrsb_get_publisher_config($post->ID);
     405
     406                $shrsb_js_params['shr-publisher-'.$post->ID] = $config;
     407            }
     408            else {
     409                $output=get_sexy();
     410            }
     411        }
     412    }
     413shrsb_log("came here".$output);
    407414    // Place of bookmarks and return w/ post content.
    408415  $r = $post_content;
    409416    if (!empty($output)) {
    410     switch($shrsb_plugopts['position']) {
    411       case 'above':
    412         $r = $output.$post_content;
    413         break;
    414       case 'both':
    415         $r = $output.$post_content.$output;
    416         break;
    417       case 'below':
    418         $r = $post_content.$output;
    419         break;
    420       default:
    421         error_log(__('An unknown error occurred in SexyBookmarks','shrsb'));
    422     }
    423 
    424     $r = $likeButtonSetTop.$r.$likeButtonSetBottom;
    425   }
     417       
     418        switch($shrsb_plugopts['position']) {
     419          case 'above':
     420            $r = $output.$post_content;
     421            break;
     422          case 'both':
     423            $r = $output.$post_content.$output;
     424            break;
     425          case 'below':
     426            $r = $post_content.$output;
     427            break;
     428          default:
     429            error_log(__('An unknown error occurred in SexyBookmarks','shrsb'));
     430        }
     431
     432        $r = $likeButtonSetTop.$r.$likeButtonSetBottom;
     433  }
     434 
    426435  shrsb_log("Content Analysis Completed");
    427436  return $r;
  • sexybookmarks/trunk/sexy-bookmarks.php

    r436195 r436198  
    165165  'bgimg' => 'caring', // default bg image
    166166  'shorty' => 'google', // default shortener
    167   'pageorpost' => 'postpageindex',
     167  'pageorpost' => 'postpageindexcategory',
    168168  'bookmark' => $shrsb_most_popular,//array_keys($shrsb_bookmarks_data), // pulled from bookmarks-data.php
    169169  'feed' => '0', // 1 or 0
     
    823823            'bgimg' => 'caring', // default bg image
    824824            'shorty' => 'google', // default shortener
    825             'pageorpost' => 'postpageindex',
     825            'pageorpost' => 'postpageindexcategory',
    826826            'bookmark' => $shrsb_most_popular ,//array_keys($shrsb_bookmarks_data),
    827827            'feed' => '0', // 1 or 0
     
    908908      unset($_POST['bookmark']['shr-fleck']);
    909909    }
    910 
     910        $_POST['pageorpost'] = shrsb_set_content_type();
    911911        // Set success message
    912912        $status_message = __('Your changes have been saved successfully!', 'shrsb');
     
    16141614            <label><input <?php echo (($shrsb_plugopts['position'] == "both")? 'checked="checked"' : ""); ?> name="position" id="position-both" type="radio" value="both" /> <?php _e('Above & Below Content', 'shrsb'); ?></label>
    16151615                        <label><input <?php echo (($shrsb_plugopts['position'] == "manual")? 'checked="checked"' : ""); ?> name="position" id="position-manual" type="radio" value="manual" /> <?php _e('Manual Mode', 'shrsb'); ?></label>
    1616                         <span class="shrsb_option"><?php _e('Posts, pages, or the whole shebang?', 'shrsb'); ?></span>
    1617                         <select name="pageorpost" id="pageorpost">
    1618                             <?php
    1619                                 print shrsb_select_option_group(
    1620                                     'pageorpost', array(
    1621                                         'post'=>__('Posts Only', 'shrsb'),
    1622                                         'page'=>__('Pages Only', 'shrsb'),
    1623                                         'index'=>__('Index Only', 'shrsb'),
    1624                                         'pagepost'=>__('Posts &amp; Pages', 'shrsb'),
    1625                                         'postindex'=>__('Posts &amp; Index', 'shrsb'),
    1626                                         'pageindex'=>__('Pages &amp; Index', 'shrsb'),
    1627                                         'postpageindex'=>__('Posts, Pages, &amp; Index', 'shrsb'),
    1628                                     )
    1629                                 );
    1630                             ?>
    1631                         </select><span class="shebang-info fugue f-question" title="<?php _e('Click here for help with this option', 'shrsb'); ?>"> </span>
     1616                       
     1617                        <span class="shrsb_option"><?php _e('Posts, pages,categories or the whole shebang?', 'shrsb'); ?></span>
     1618                        <input type="checkbox" id="type_post" name="content_type[]"  value="post" <?php echo (false!==strpos($shrsb_plugopts['pageorpost'],"post"))? 'checked' : ""; ?>/><label for="type_post" class="padding"><?php _e('posts', 'shrsb'); ?></label><br>
     1619                        <input type="checkbox" id="type_page" name="content_type[]"  value="page" <?php echo (false!==strpos($shrsb_plugopts['pageorpost'],"page"))? 'checked' : ""; ?>/><label for="type_page" class="padding"><?php _e('pages', 'shrsb'); ?></label><br>
     1620                        <input type="checkbox" id="type_index" name="content_type[]"  value="index" <?php echo (false!==strpos($shrsb_plugopts['pageorpost'],"index"))? 'checked' : ""; ?>/><label for="type_index"  class="padding"><?php _e('main index', 'shrsb'); ?></label><br>
     1621                        <input type="checkbox" id="type_category" name="content_type[]"  value="category" <?php echo (false!==strpos($shrsb_plugopts['pageorpost'],"category"))? 'checked' : ""; ?>/><label for="type_category" class="padding"><?php _e('category index', 'shrsb'); ?></label><br>
     1622                       
     1623                       
     1624                        <span class="shebang-info fugue f-question" title="<?php _e('Click here for help with this option', 'shrsb'); ?>"> </span>
    16321625                        <span class="shrsb_option"><?php _e('Show in RSS feed?', 'shrsb'); ?></span>
    16331626                        <label><input <?php echo (($shrsb_plugopts['feed'] == "1")? 'checked="checked"' : ""); ?> name="feed" id="feed-show" type="radio" value="1" /> <?php _e('Yes', 'shrsb'); ?></label>
     
    18241817    return $og_first_img;
    18251818  }
     1819}
     1820
     1821/*
     1822*   @desc For setting the content type which are enablled
     1823*/
     1824function shrsb_set_content_type() {
     1825    $type  = "";
     1826    $content = $_POST['content_type'];
     1827    if(empty ($content)){
     1828        $type  = "postpageindexcategory";
     1829    }else{
     1830        $n = count($content);
     1831        for($i = 0; $i < $n; $i++){
     1832            $type .= $content[$i];
     1833        }
     1834    }
     1835    return $type;
    18261836}
    18271837
Note: See TracChangeset for help on using the changeset viewer.