function colabsthemes_options_page() { $options = get_option('colabs_template'); $themename = get_option('colabs_themename'); $shortname = get_option('colabs_shortname'); $manualurl = get_option('colabs_manual'); //Framework Version in Backend Header $colabs_framework_version = get_option('colabs_framework_version'); $theme_data = wp_get_theme(); //GET themes update RSS feed and do magic include_once ABSPATH . WPINC . '/feed.php'; $pos = strpos($manualurl, 'documentation'); $theme_slug = str_replace("/", "", substr($manualurl, $pos + 13)); //13 for the word documentation ?> <div class="wrap colabs_container"> <h2 class="colabs_admin_page_title"></h2> <?php $free_themes = array('lensa', 'photogram', 'leatherly', 'tumblepress', 'rpg.cod', 'wellblog'); if (in_array(strtolower($themename), $free_themes)) { ?> <div class="colabs_twitter_stream updated"> <div class="stream-label"><?php _e('News On Twitter:', 'colabsthemes'); ?> </div> <?php $instance = array('query' => 'from:colorlabs', 'number' => 5, 'show_follow' => 'false', 'show_avatar' => 'false', 'show_account' => 'false', 'consumer_key' => 'tZC2RgSO04T7ctQQDIFw', 'consumer_secret' => 'xB8YWcEYkzqnqGAgHia84YVWlGSZqRnZn0otis2Ho', 'list_before' => '<li>', 'list_after' => '</li>'); ?> <ul> <?php colabs_get_tweets($instance); ?> </ul> </div> <!-- .colabs_twitter-stream --> <?php } ?> <form action="" enctype="multipart/form-data" id="colabsform"> <?php // Add nonce for added security. if (function_exists('wp_nonce_field')) { wp_nonce_field('colabsframework-theme-options-update'); } // End IF Statement $colabs_nonce = ''; if (function_exists('wp_create_nonce')) { $colabs_nonce = wp_create_nonce('colabsframework-theme-options-update'); } // End IF Statement if ('' == $colabs_nonce) { } else { ?> <input type="hidden" name="_ajax_nonce" value="<?php echo $colabs_nonce; ?> " /> <?php } // End IF Statement ?> <?php // Rev up the Options Machine $return = colabsthemes_machine($options); ?> <div id="main" class="menu-item-settings metabox-holder"> <div id="panel-header"> <?php colabsthemes_options_page_header(array('theme_data' => $theme_data, 'themename' => $themename)); ?> </div><!-- #panel-header --> <div id="sidebar-nav"> <ul><?php echo $return[1]; ?> </ul> </div> <div id="panel-content"> <div class="group help-block"> <p><?php _e("Drag an icon on the left and drop it here to customize", "colabsthemes"); ?> </p> </div> <?php echo $return[0]; /* Settings */ ?> <div class="clear"></div> </div> <div id="panel-footer"> <ul> <li class="docs"><a title="Theme Documentation" href="http://colorlabsproject.com/documentation/<?php echo strtolower(str_replace(" ", "", $themename)); ?> " target="_blank" ><?php _e("View Documentation", "colabsthemes"); ?> </a></li> <li class="forum"><a href="http://colorlabsproject.com/resolve/" target="_blank"><?php _e("Submit a Support Ticket", "colabsthemes"); ?> </a></li> <li class="idea"><a href="http://ideas.colorlabsproject.com/" target="_blank"><?php _e("Suggest a Feature", "colabsthemes"); ?> </a></li> </ul> <div class="save-bar save_bar_top right"> <img style="display:none" src="<?php echo get_template_directory_uri(); ?> /functions/images/ajax-loading.gif" class="ajax-loading-img ajax-loading-img-top" alt="Working..." /> <input type="submit" value="Save Changes" class="button submit-button button-primary" /> <button class="button submit-button reset-button button-highlighted"><?php _e('Reset Options', 'colabsthemes'); ?> </button> </div> </div><!-- #panel-footer --> </div><!--/#main--> </form> <form method="post" style="display:none" id="colabsform-reset"> <?php // Add nonce for added security. if (function_exists('wp_nonce_field')) { wp_nonce_field('colabsframework-theme-options-reset'); } // End IF Statement $colabs_nonce = ''; if (function_exists('wp_create_nonce')) { $colabs_nonce = wp_create_nonce('colabsframework-theme-options-reset'); } // End IF Statement if ('' == $colabs_nonce) { } else { ?> <input type="hidden" name="_ajax_nonce" value="<?php echo $colabs_nonce; ?> " /> <?php } // End IF Statement ?> <input name="reset" type="submit" value="Reset Options" class="button submit-button reset-button button-highlighted" onclick="return confirm( '<?php _e("Click OK to reset all options. All settings will be lost!", "colabsthemes"); ?> ' );" /> <input type="hidden" name="colabs_save" value="reset" /> </form> <div class="theme-info"><br> <span class="theme"><?php echo $themename; ?> <?php echo COLABS_THEME_VER; ?> </span> <span class="framework"><?php _e('Framework', 'colabsthemes'); ?> <?php echo $colabs_framework_version; ?> </span> </div><!--/.theme-info--> <div style="clear:both;"></div> </div><!--wrap--> <?php }
function colabs_get_tweets($instance) { extract($instance); $token = maybe_unserialize(get_option('colabs_twitter_token')); if ('' == $token) { colabs_get_tweets_bearer_token($consumer_key, $consumer_secret); return colabs_get_tweets(); } if (strpos($query, 'from:') === 0) { $query_type = 'user_timeline'; $query = substr($query, 5); $url = 'https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=' . rawurlencode($query) . '&count=' . $number; } else { $query_type = 'search'; $url = 'https://api.twitter.com/1.1/search/tweets.json?q=' . rawurlencode($query) . '&count=' . $number; } $options = array('http' => array('method' => 'GET', 'header' => 'Authorization: Bearer ' . $token['access_token'])); $context = stream_context_create($options); $result = json_decode(@file_get_contents($url, false, $context)); if (isset($result->errors) && $result->code == 89) { delete_option('colabs_twitter_token'); colabs_get_tweets_bearer_token(); return colabs_get_tweets(); } $tweets = array(); if ('user_timeline' == $query_type) { if (!empty($result)) { $tweets = $result; } } else { if (!empty($result->statuses)) { $tweets = $result->statuses; } } $follow_button = '<a href="https://twitter.com/__name__" class="twitter-follow-button" data-show-count="false" data-lang="en">Follow @__name__</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>'; $before_item = '<div class="tweet-item ' . $query_type . '">'; $after_item = '</div>'; if ($list_before) { $before_item = $list_before; } if ($list_after) { $after_item = $list_after; } if (!empty($tweets)) { foreach ($tweets as $tweet) { $text = colabs_update_tweet_urls($tweet->text); $time = human_time_diff(strtotime($tweet->created_at), time()); $url = 'http://twitter.com/' . $tweet->user->id . '/status/' . $tweet->id_str; $screen_name = $tweet->user->screen_name; $name = $tweet->user->name; $profile_image_url = $tweet->user->profile_image_url; echo $before_item; if ('search' == $query_type) { echo '<div class="twitter-user">'; if ($show_account == 'true') { echo '<a href="https://twitter.com/' . $screen_name . '" class="user">'; if ($show_avatar && $profile_image_url) { echo '<img src="' . $profile_image_url . '" width="16px" height="16px" >'; } echo ' <strong class="name">' . $name . '</strong> <span class="screen_name">@' . $screen_name . '</span></a>'; } echo '</div>'; } echo '<div class="tweet-content">' . $text . ' <span class="time"><a target="_blank" title="" href="' . $url . '"> about ' . $time . ' ago</a></span></div>'; if ('search' == $query_type) { if ($show_follow == 'true') { echo str_replace('__name__', $screen_name, $follow_button); } } echo $after_item; } if ('user_timeline' == $query_type) { if ($show_account == 'true' || $show_follow == 'true') { echo '<div class="twitter-user">'; if ($show_account == 'true') { echo '<a href="https://twitter.com/' . $screen_name . '" class="user">'; if ($show_avatar && $profile_image_url) { echo '<img src="' . $profile_image_url . '" width="16px" height="16px" >'; } echo ' <strong class="name">' . $name . '</strong> <span class="screen_name">@' . $screen_name . '</span></a>'; } if ($show_follow == 'true') { echo str_replace('__name__', $screen_name, $follow_button); } echo '</div>'; } } } }
function colabsthemes_dashboard_page() { global $wpdb; global $colabs_rss_feed, $colabs_twitter_rss_feed, $colabs_forum_rss_feed; $themename = get_option('colabs_themename'); $manualurl = get_option('colabs_manual'); $shortname = get_option('colabs_shortname'); $license = get_option('colabs_license'); //Version in Backend Head $local_version = COLABS_THEME_VER; $framework_version = get_option('colabs_framework_version'); ?> <div class="wrap colabs_container"> <div> <h2 class="colabs_admin_page_title"></h2> <div class="themever left"> <h2><?php echo $themename; ?> <?php echo $local_version; ?> <?php _e('Theme Info', 'colabsthemes'); ?> </h2> </div> <div class="logocolabs right"> <a href="http://colorlabsproject.com" title="Visit Our Website"><img src="<?php echo get_template_directory_uri(); ?> /functions/images/colorlabs.png" /></a> </div> <div class="clear"></div> </div> <div class="dash-left metabox-holder"> <div class="postbox"> <div class="statsico"></div> <h3 class="hndle"><span><?php echo $themename; ?> <?php _e('Info', 'colabsthemes'); ?> </span></h3> <div class="inside"> <div class="rss-widget"> <ul> <li><?php _e('Product Version', 'colabsthemes'); ?> : <strong><?php echo $local_version; ?> </strong></li> <li><?php _e('Framework Version', 'colabsthemes'); ?> : <strong><?php echo $framework_version; ?> </strong></li> <li><?php _e('Product Support', 'colabsthemes'); ?> : <a href="http://colorlabsproject.com/resolve/" target="_new"><?php _e('Submit a Support Ticket', 'colabsthemes'); ?> </a> | <a href="<?php echo $manualurl; ?> /documentation/<?php echo strtolower(str_replace(" ", "", $themename)); ?> " target="_new"><?php _e('Theme Documentation', 'colabsthemes'); ?> </a> | <a href="http://ideas.colorlabsproject.com/" target="_blank"><?php _e('Suggest a Feature', 'colabsthemes'); ?> </a></li> </ul> </div><!--/.insider end --> </div><!--/.preloader-container end --> </div><!--/.postbox end --> <div class="postbox"> <div class="newspaperico"></div><a target="_new" href="<?php echo $colabs_rss_feed; ?> "><div class="rssico"></div></a> <h3 class="hndle"><span><?php _e('ColorLabs News', 'colabsthemes'); ?> </span></h3> <div class="inside"> <div class="rss-widget" > <?php wp_widget_rss_output('http://colorlabsproject.com/feed/', array('items' => 10, 'show_author' => 0, 'show_date' => 1, 'show_summary' => 1)); ?> </div><!--/.insider end --> </div><!--/.preloader-container--> </div><!--/.postbox end --> <div class="clear"></div> </div><!-- dash-left end --> <div class="dash-right metabox-holder"> <div class="postbox"> <div class="twitterico"></div> <h3 class="hndle" ><span><?php _e('ColorLabs Tweets', 'colabsthemes'); ?> </span></h3> <div class="inside"> <div class="rss-widget"> <?php $instance = array('query' => 'from:colorlabs', 'number' => 10, 'show_follow' => 'false', 'show_avatar' => 'false', 'show_account' => 'false', 'consumer_key' => 'tZC2RgSO04T7ctQQDIFw', 'consumer_secret' => 'xB8YWcEYkzqnqGAgHia84YVWlGSZqRnZn0otis2Ho', 'list_before' => '<li>', 'list_after' => '</li>'); ?> <ul><?php colabs_get_tweets($instance); ?> </ul> </div><!--/.inside end --> </div><!--/.preloader-container end --> </div><!--/.postbox end --> <div class="postbox"> <h3 class="hndle"><span><?php _e('ColorLabs Latest Themes', 'colabsthemes'); ?> </span></h3> <div class="inside"> <div class="rss-widget" > <?php wp_widget_rss_output('http://colorlabsproject.com/feed/?post_type=themes', array('items' => 10, 'show_author' => 0, 'show_date' => 1, 'show_summary' => 1)); ?> </div><!--/.insider end --> </div><!--/.preloader-container--> </div><!--/.postbox end --> <div class="clear"></div> </div><!--/.dash-right end --> <div class="clear"></div> </div><!--/.wrap --> <?php }